Setting Session item from outside of APEX

Hi All,
First a little background: I've been learning APEX for a couple of days now. I'm evaluating it to see if it's suitable for the application we need to make, otherwise it'll be done in PHP.
The application needs to act as a web service client: as requirement number 1, we need to interface with a 3rd party IDP server to get a SAML2 assertion. This assertion will later need to be injected into the SOAP header of web service call, but I'm not worrying about this bit for now.
I've gotten half way there. I've created a new page with a process at runs before the header. This can handle creating our authn request (which is a bit of xml) and forward the browser onto the IPD server for authentication (with anthn request set as a GET parameter that has been deflated and base64 encoded). Whoo!
Once the IDP server has finished authenticating the user, a http post (with the SAML assertion we need) is done back to the application.
Now as I understand it, I can't get the IDP to post back to an APEX page directly, as we need to access the HTTP Post data. So, I plan on writing a PL/SQL procedure (which I've added to the FLOWS ok list to be called via the PL/SQL gateway).
So inside this procedure, I'm not in APEX, but I'll want to keep track of the SAML Assertion (which will just be a CLOB for arguments sake) such that I can use in APEX for when I make my SOAP call. If it was down to me, I'd have a table with session_id and the assertion, and just query that from APEX.
BUT this 3rd party that we have to work with is the government, and they've given us rules. We aren't allow to store these assertions, they can only exist in the scope of a users session (no storing in files, databases, anything that could be permanently stored on the hard drive), virtual memory is ok though.
So, after all that useless info, onto my question: Can I set an apex application item from this pl/sql procedure? If so, how would one do it? Now I understand that in the background, an item is probably written to a table, but I'm going to gloss over that for now (in the hope that the people certifying the app do the same).
Thanks for all the help,
Tim

Tim,
I am working a similar issue, but slightly different. I am trying to determine if we are trying to answer the same question.
Here is what I understand about your initial posting...
You are authenticating a user.. that must make a call to some "place".. then wait for that place to respond with an OK message, without storing the value. There is enough lag in this process that you want the response from "the place" that you want the response from "the place" to change the session value in the Web based UI. Is this correct?
Issue: Even if you did have this process setting the session value, the client web browser would not respond unless it was in some type of checking loop.
If you are in a checking loop, you would have the ability to call the "service" in some sort of checking mode from APEX.
If this is a smooth process (no major lag), you could manage it within a custom authentication scheme. Is this the area you are working in?
I understand your need to set from an outside connection. But if you are using the outside database connection method, you are isolated to a different session... I would believe (I do not work for Oracle) for security reasons.
--Tim St. Hilaire                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Create a session programatically (ie, outside of APEX).

    Following on from this thread (Using APEX Collections outside of APEX? we have a requirement to be able to create a user session programatically in sqlplus etc, so that we can utilize the APEX collections framework in our existing developments.
    The issue I am having is with getting the session populated in the wwv_flow_sessions$ table.
    If I create a session first by opening a page in APEX then my processing works fine using that session id, the problem comes when I want to programatically create a new session.
    I have tried the following (where l_session is the id of the session I grabbed from running an APEX page):
    DECLARE
      l_security_group_id  NUMBER := apex_util.find_security_group_id('OUR_WORKSPACE');
      l_session_id         NUMBER := apex_custom_auth.get_next_session_id;
      l_val                VARCHAR2(4000);
      v_arr                wwv_flow_global.vc_arr2;
    BEGIN
      wwv_flow_api.set_security_group_id(l_security_group_id);
      apex_application.g_flow_id  := '1';
      apex_custom_auth.define_user_session('USERNAME', l_session_id);
      apex_custom_auth.post_login(p_uname => 'USERNAME', p_session_id => l_session_id);  /*Added this as an after-thought but it made no difference*/
      apex_collection.create_collection('XXTEST');
      /*some more things after this but it never gets that far*/but I get the error:
    ORA-02291: integrity constraint (FLOWS_030100.WWV_FLOW_COLLECTION_FK) violated - parent key not found
    ORA-06512: at "FLOWS_030100.WWV_FLOW_COLLECTION", line 288
    ORA-06512: at line 12Running v('SESSION') returns a value, so the session is being populated, it's just a corresponding record isn't inserted into wwv_flow_sessions$.
    Is there any API to create such a session? If not, what are the implications of doing a manual insert into this table before processing and then removing the row afterwards?

    Ok, i see.
    Why do you need the record in the session-table, does CREATE_COLLECTION require that?
    I never created a Collection in a batch-job outside of APEX, but created/called an APEX Report. To "create" the session i used this code:
    PROCEDURE initApexFromOutside
      ( i_app_name     IN VARCHAR2
      , i_page_id      IN NUMBER
      , i_apex_user    IN VARCHAR2
    IS
        v_cgivar_name  owa.vc_arr;
        v_cgivar_val   owa.vc_arr;
        v_workspace_id NUMBER;
        v_app_id       NUMBER;
    BEGIN
        -- set up cgi environment
        htp.init;
        v_cgivar_name(1) := 'REQUEST_PROTOCOL';
        v_cgivar_val(1)  := 'HTTP';
        owa.init_cgi_env
          ( num_params => v_cgivar_name.count
          , param_name => v_cgivar_name
          , param_val  => v_cgivar_val
        -- load apex IDs by application name
        SELECT workspace_id,
               application_id
        INTO v_workspace_id,
             v_app_id
        FROM apex_applications
        WHERE application_name=i_app_name;
        -- set up apex workspace
        wwv_flow_api.set_security_group_id(v_workspace_id);
        -- set up apex session vars
        apex_application.g_instance     := wwv_flow_custom_auth.get_next_session_id;
        apex_application.g_flow_id      := v_app_id;
        apex_application.g_flow_step_id := i_page_id;
        -- "login"
        apex_custom_auth.define_user_session
          ( p_user       => i_apex_user
          , p_session_id => apex_application.g_instance
        wwv_flow_custom_auth_std.post_login
          ( p_uname      => i_apex_user
          , p_session_id => apex_application.g_instance
          , p_flow_page  => apex_application.g_flow_id
                         || ':'
                         || apex_application.g_flow_step_id
    END initApexFromOutside;
    PROCEDURE doInitApex(pUsername IN VARCHAR2)
    IS
    BEGIN
        IF v('APP_ID') IS NULL
        THEN
            -- init apex environment
            initApexFromOutside
              ( i_app_name  => cAppName
              , i_page_id   => 1
              , i_apex_user => pUsername
            -- call show once because it sets additonal internal apex parameters
            Apex_Application.show
              ( p_flow_id        => Apex_Application.g_flow_id
              , p_flow_step_id   => Apex_Application.g_flow_step_id
              , p_instance       => Apex_Application.g_instance
            -- show re-sets other parameters at the end. have to init again...
            initApexFromOutside
              ( i_app_name  => cAppName
              , i_page_id   => 1
              , i_apex_user => pUsername
        END IF;
    END;Maybe this works for you, too.
    brgds,
    Peter
    Blog: http://www.oracle-and-apex.com
    ApexLib: http://apexlib.oracleapex.info
    BuilderPlugin: http://builderplugin.oracleapex.info
    Work: http://www.click-click.at

  • Set page item from a stored procedure

    Dear reader
    We would like to have a stored procedure to run every 10 minutes. When the procedure starts, the user has to be warned that the update process is running.
    When the procedure is finished, the user should receive a message that the update process is finished.
    What I had in mind was to set a Page 0 item 'P0_REFRESH' and set his value depending on the status of the update. Then add a dynamic action with a change event. So everytime the value of this page item changes, the user will receive a correct message.
    Does anyone know if it is possible to set a page item from a stored procedure?
    Kind regards
    Xnni

    AndyPol
    I found a solution by querying the user_jobs table. In Apex, I created two page 0 items that hold the current status of the job (online, offline) and the old value of the job.
    Online of offline in the current status item is determined by a decode on "this_sec".
    The enext step was to include a html region in P0 that contains some javascript. This javascript will display a message when the values of the new status is different from the old status ;)
    Many thanks for bringing up the ideas.
    Greetz
    Xnni

  • Setting Page Items from SQL Query

    Hi, </br></br>
    I am using "SQL Query (PL/SQL function body returning SQL query)" for a report. In the body of the sql query, after calling a function, I have the following statement: </br></br>
    APEX_UTIL.SET_SESSION_STATE( p_name => 'P13_MESSAGE', p_value => 'Contact Tech Support' ); </br></br>
    and I find that I cannot save the query. I get an error message: </br></br>
    <b>Unexpected error, unable to find item name at application or page level.
    ERR-1002 Unable to find item ID for item "P13_MESSAGE" in application "4000". </b>
    </br></br>
    I do have the field 'P13_MESSAGE' on my page. </br></br>
    Can't this API call be used within such a query type? Is there an alternative to this? </br></br>
    Thanks in advance </br></br>
    Vasan

    Scott,</br></br>
    I have given the source of the region, below. Its type is 'SQL Query (PL/SQL Function body Returning SQL Query'). </br></br>
    "Get_State_Hit" is a procedure in a package. I have not shown the name of the package here.</br></br>
    Please give me your suggestion. </br></br> Thanks </br></br> Vasan </br></br>
    ========= </br></br>
    DECLARE </br>
    l_sql varchar2(100); </br>
    BEGIN <br>  
    IF(:P13_MATCH_TYPE = 'ALL') THEN</br>
        Get_State_Hit ( one set of values from user-interface );</br>
        apex_util.set_session_state( p_name => 'P13_MESSAGE', p_value => ' MsgString 1' );</br>
    ELSE</br>
        Get_State_Hit ( another set of values from user-interface );</br>
        apex_util.set_session_state( p_name => 'P13_MESSAGE', p_value => ' MsgString 2' );</br>
    END IF; </br>
    l_sql := 'Select Col 1, Col 2, ..., Col 9 from ABC_Vw'; </br>
    RETURN l_sql;</br>
    EXCEPTION</br>
    WHEN OTHERS THEN</br>
    l_sql := 'Select * from Default_Vw' ;</br>
    apex_util.set_session_state(p_name => 'P13_MESSAGE', p_value => 'Contact Tech Support');</br>
    RETURN l_sql; </br>
    END;</br></br>
    ==========</br></br>
    Message was edited by:
    Vasan

  • Set listbox items from web service response

    Hi All
    I am trying to set list box items from a web service response. Couple of issues over here:
    1. The user should be able to select multiple items from the list. Hence if I set "Allow multiple values" and set Commit on "exit", then after the web service returns the output, no data is displayed in the listbox. I need to click inside the list box to see the data returned by the web service. How to overcome this..??  ( However this problem (clicking inside the listbox to see the items) does not exist if "Allow multiple values" is unchecked and Commit is set on "Select". )
    2. After the list box is filled up, certain default values should be selected. This selection is based on one of the response field (which is actually a table with multiple values... ). Hence, how to capture this response field and set the default values in the above list..??
    3. The same case for a dropdown. The values are visible in dropdown. However, a default value should be selected and displayed after returning a response from web service. Again, this default value is dependant on another field in the response as in point no.2
    I am trying to use postExecute event as described in [this|http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/] link...however not able to achieve the functionality. Please provide suggestions / inputs.
    Thanks
    Deepak

    Hello,
    first: I don´t know anything about the right solution. I am unaware of the existence of the solution, because there were quite many of question about this multiple selection problem and I don´t remember a single "answer".
    I can recommend you to simplify everything and create the functionality yourself. I have done that before to avoid these "Adobe-standard" problems. If you have a problem with autofill of the object, ask your WS to send you a single string and pass it yourself using scripting (JS).
    And if you have problems with multiple selection, create your own field/ object. Get the string of values, parse it, create multiple lines of the dynamic table with some suitable tool to check/ select the rows you need (use checkbox for example, and your text as a table row). This way you can selected anything you want with no problems at all. It wil only cost you some extra work.
    Regards, Otto

  • Set application item from javascript?

    Hi!
    Is it possible to set an APPLICATION ITEM from javascript? If so can some one please point me to the thread, or a FAQ or an example, etc?
    Thanks!
    Dave Venus

    dvenus1,
    Sure. In the script below I check variables and populate based on what I find...
    <script language="JavaScript" type="text/javascript">
    function Populate_fld()
    var formVehicle = document.getElementById('P9_HIDE_VEHICLE').value;
    var formState = document.getElementById('P9_HIDE_STATE').value;
    var formTag = document.getElementById('P9_HIDE_TAG').value;
    var formName = document.getElementById('P9_HIDE_NAME').value;
    document.getElementById("P9_VEHICLE").value = formVehicle;
    document.getElementById("P9_TAG").value = formTag;
    document.getElementById("P9_STATE").value = formState;
    document.getElementById("P9_VISITOR_NAME").value = formName;
    if (formState = " ")
    document.getElementById("P9_STATE").value = "FL";
    </script>
    Keep Smiling,
    Bob R

  • Setting page items from Stored Procedure/Package

    Hi,
    Can anyone tell me if it is possible to set the values of page items from stored pl/sql code. I have some reasonably complex biz logic that I want to package and store in the database (not just call an anonymous pl/sql block through a page process). However within that stored code I want to set items on my page based on input parameters, other items on the page or calculations eg.
    I want to do something like:
    :P6_INT_ACC_START_DT := p_bony_auction_dt + 1;
    when trying to compile this code I get invalid bind variable error
    I also tried:
    V('P6_INT_ACC_START_DT') := p_bony_auction_dt + 1;
    but got invalid use of V function error
    Any ideas?
    Thanks, Robert

    Call apex_util.set_session_state:
    apex_util.set_session_state(p_name => 'P6_INT_ACC_START_DT', p_value => p_bony_auction_dt + 1);
    ...although be aware of date-to-varchar2 conversion and use date format masks explicitly.
    Scott

  • Setting Page Item from Hyperlink

    Hi,
    I am currently developing an APEX application that will show a Google map of our kiosk locations. It builds the javascript in a PL/SQL package using htp.print. For each marker it displays for the kiosk, I'm customizing the info window displayed when the marker is clicked to show the kiosk name, the address and some hyperlinks. One of these hyperlinks will go to another APEX page that displays orders for that kiosk. So, what I'm trying to accomplish is to set a page item value on the page when the hyperlink is clicked that will be used in a page query to pull the orders. I am not much of a javascript programmer, so I'm having some issues. Here is what i'm currently attempting:
    Withiin the FOR loop that builds my markers, I have defined a 'function' as follows:
    htp.print('function setKioskCode (P4_KIOSK_CODE) {');
    htp.print('var kioskcode = '||''''||<location from cursor loop>||''''||';');
    htp.print('$x('||''''||'P4_KIOSK_CODE'||''''||').value = kioskcode;');
    htp.print('}');Then, this is how I'm building the hyperlink in the info window (i've removed the link tags and single quotes so I could post the code). Using this method, I get an error on the load of the map page that says ' Expected ")" '. I can't find any syntax errors in what i have done from what I can tell (I could definitely be wrong!).
    l_order_link := href="f?p='||v('APP_ID')||':6:'||v('SESSION')||'" onclick="javascript:setKioskCode('||''''||'P4_KIOSK_CODE'||''''||');">OrdersWhen I remove the parameter value from the javascript call like this. It loads the map successfully, but, of course, the hyperlink on the marker info window doesn't work.
    l_order_link := href="f?p='||v('APP_ID')||':6:'||v('SESSION')||'" onclick="javascript:setKioskCode();">OrdersAny help would be much appreciated. And please let me know if you need any further info.
    Thanks,
    Troy
    Edited by: tfitz on Oct 21, 2010 1:53 PM

    Thanks for the reply, Jari.
    I have determined you definitely have to use the v('APP_ID') and v('SESSION') in the href statement. Otherwise, it puts the &APP_ID. and &APP_SESSION. in the URL.
    I tried the 'onclick' syntax you provided and it still does not work. I get the error I reported above. It's looking for the closing parenthesis and doesn't like a parameter being provided. If i remove the parameter from the function, the page loads and the hyperlink goes to the proper page but it doesn't populate the page item. I don't know why it doesn't like a parameter for the function.
    Thanks, Troy.

  • Accessing a collection from outside of Apex without causing a HTTP redirect

    First, some background:
    I am running Apex version 2.2.1.00.04 on Oracle9i Enterprise Edition Release 9.2.0.7. IE 6 and Flash 9
    My Apex page contains two third-party Flash controls. Each Flash control uses a passed in URL to get the data that it will display. The data that I need to pass to the Flash controls is stored in an Apex collection created in my page.
    Using the technique outlined in the following posts,
    Re: Accessing Collection through a DBMS.job
    Re: Accessing application item value from database
    I have created a stored procedure that will attach to my Apex session and query the collection. See procedure get_data below.
    The URL that the Flash controls are passed is like this:
    http://myhost/pls/mydad/get_data?p_user=MYUSER&p_session_id=535622580488397200&p_app_id=2332
    The call to WWV_FLOW_CUSTOM_AUTH_STD.POST_LOGIN causes a HTTP redirect to the Apex at page p_app_id:1. The Flash control that initiated the request never sees the data stream that the get_data procedure is sending via HTTP.P. Instead, it sees the HTML produced by the Apex page at p_app_id:1.
    Now, my question:
    Is it possible to call the WWV_FLOW_CUSTOM_AUTH_STD.POST_LOGIN command in away that does not cause a HTTP redirect? If not, then is there another series of commands that will attach to an Apex session but not cause a HTTP redirect?
    Thanks,
    Ken
    CREATE OR REPLACE procedure get_data(p_user IN VARCHAR2,
    p_session_id IN VARCHAR2,
    p_app_id IN VARCHAR2) as
    BEGIN
    APEX_CUSTOM_AUTH.DEFINE_USER_SESSION(p_user,
    p_session_id );
    APEX_APPLICATION.G_FLOW_ID:= p_app_id;
    WWV_FLOW_CUSTOM_AUTH_STD.POST_LOGIN(p_user ,
    NULL ,
    p_session_id ,
    p_app_id||':'||'1' );
    FOR c_collection_rec IN (SELECT c001
    FROM APEX_COLLECTIONS
    WHERE collection_name='MY_COLLECTION')
    LOOP
    HTP.P(c_collection_rec.c001);
    END LOOP;
    END;

    Ken - No way to prevent the redirect attempt, that's what the procedure is built to do. To use it otherwise is aberrant. I think you could use an on-demand process (FOO) callable from the URL that would spit the data back out. You do this by defining an application process (on-demand firing point) and callling it from the URL ( f?p=APP:0:SESSSION:APPLICATION_PROCESS=FOO). If the cookie is passed in the request (meaning you've authenticated) and authentication check passes again in your process request, the process will produce the result stream.
    Scott

  • Setting session item after logon

    hello,
    i want to set the value of an item after an user successfully has logged on to an apex application.
    where should i set the value best?
    regards,
    roman

    A good place to do this is in the authentication scheme's post-authentication process.
    Scott

  • Can't Set Session State from the Login Page

    I have a dilema. On the standard login page I enter values in 2 fields namely, CAMPUS (Select List) and USERNAME (text field).
    After clicking on the login button I want to navigate to PAGE 1 and use the values of CAMPUS and USERNAME to filter data. I have created two APPLICATION Level items (A_USERNAME,A_CAMPUS) to which I assign the values of USERNAME and CAMPUS in two AFTER SUBMIT computations on the login page.
    When I arrive on PAGE 1 the session state values of A_USERNAME,A_CAMPUS are still both null therefore the query returns null. It seems that the login process does not issue a SUBMIT for session state to be saved. How do I save the values in session state on login?
    In the Login PROCESS, can I specify the Page 1 items to be set and the values to set them in a URL somewhere? Is it here?
    wwv_flow_custom_auth_std.login(
    P_UNAME => :P101_USERNAME,
    P_PASSWORD => :P101_PASSWORD,
    P_SESSION_ID => v('APP_SESSION'),
    P_FLOW_PAGE => :APP_ID||':1' <<========here?
    If so what is the correct syntax?
    If I revisit the login page a second time, a submit is issued and the values are set in session state.
    Anyone got any ideas??
    I tried creating a standard position button which issues a submit but this didn't work either.
    regards
    Paul J Platt

    Unfortunately your solution is causing problems with retrieving cookies that I try to get for the campus and username during a "Before Header Process" as well. The cookies are normally set on an "After Submit" process. When I return to the login page I get
    Error ERR-1029 Unable to store session info. session=10760914996048113736 item=8561939526127479
    ORA-02291: integrity constraint (FLOWS_010600.WWV_FLOW_DATA_FK) violated - parent key not found
    But if I turn the cookies off, it seems to work OK.
    regards
    Paul JP

  • Can I set session variables from inside my Javascript?

    hi all,
    i want to set a couple of session variable while i am inside my javascript.
    can I do that?
    m_asu

    No. JavaScript runs on the client and the session is on the server. You can use JavaScript to set parameters that get passed back in the request and can then be put in the session.

  • Setting Output module from outside AE

    Hi,
    I'd like to automate AE renders on a third machine.
    I want to render out comps with the render engine to save myself from buying another copy just for rendering. I'd like to use aerender, and render to a custom format. For this, I'd need an output module, which I can make on my copy. My render engine is more than a month old, so I cannot go into the standard up because of the activation screen. If I run render engine the templates in the edit menu is grayed out.
    How can I get my custom output module inside AE so aerender could use it? Or is there a way to point to a .aom file for aerender?
    Thanks for any help,
    Sa,

    Thanks for your response, Aaron.
    I've kinda got around the problem with simply copying the AE preference file which contains the templates alongside the preferences of the app.
    My problem was that I rendering Premiere Pro projects straight with aerender because it's nicely automatable. And as such it has no render queue nor items in it.
    For even more detail, I wanted to render XviD videos, but for some reason, Premiere doesn't likes XviD and cannot render videos to that format while AE can. So, I make the projects in Premiere, than pass them to a third machine, containing only an AE render engine and the new preferences file which I created templates for XviD output in. Than I can batch process a bunch of prproj's with aerender.
    Once again thank you for your time and response.
    Sam

  • How to set selected JTree from outside?

    I have a JTree for example
    -A
      -a
      -b
      -c
    -B
      -a
      -b
      -c
    -C
      -a
      -b
      -cif the tree is All expand , it is easy to select the the tree by setSelectionRow(5), the result is "B.a", but how to select the the tree if all collap
    -A
    -B
    -C
    {code}
    let say i want to select "B.c", it can't use setSelectionRow(7) becouse the row between 0-2. So how to select the tree if the tree is *collap*?
    thx..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    i had try use setSelectionPath but still can't wotk
    this sample code:
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JTree;
    import javax.swing.tree.*;
    import javax.swing.*;
    public class test_tree extends JFrame{
        JTree tree;
        DefaultMutableTreeNode root_tree;
        test_tree(){
            //DefaultMutableTreeNode root_tree = new DefaultMutableTreeNode("Root",true);
            root_tree = new DefaultMutableTreeNode();
            DefaultMutableTreeNode child_tree;
            DefaultMutableTreeNode child_tree2;
            DefaultMutableTreeNode child_tree3;
            child_tree = new DefaultMutableTreeNode("A1",true);
            child_tree.add(new DefaultMutableTreeNode("A1.1",false));
            child_tree.add(new DefaultMutableTreeNode("A1.2",false));
            child_tree.add(new DefaultMutableTreeNode("A1.3",false));
            child_tree2 = new DefaultMutableTreeNode("B2",true);
            child_tree2.add(new DefaultMutableTreeNode("B2.1",false));
            child_tree2.add(new DefaultMutableTreeNode("B2.2",false));
            child_tree2.add(new DefaultMutableTreeNode("B2.4",false));
            child_tree3 = new DefaultMutableTreeNode("C3",true);
            child_tree3.add(new DefaultMutableTreeNode("C3.1",false));
            child_tree3.add(new DefaultMutableTreeNode("C3.2",false));
            child_tree3.add(new DefaultMutableTreeNode("C3.3",false));
            root_tree.add( child_tree);
            root_tree.add( child_tree2);
            root_tree.add( child_tree3);
            tree = new JTree(root_tree);
            tree.setRootVisible(false);
            tree.setSize(100,300);
            add(tree);
            JButton bt = new JButton("witPath");
            bt.setSize(new Dimension (80, 30));
            bt.setLocation(200,100);
            bt.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    tree.expandPath(new TreePath(root_tree.getNextNode().getChildAt(1)) );
                    tree.setSelectionPath(new TreePath(root_tree.getNextNode().getChildAt(1)) );
            add(bt);
            JButton br = new JButton("witROW");
            br.setSize(new Dimension (80, 30));
            br.setLocation(200,150);
            br.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    tree.expandRow(1);
                    tree.setSelectionRow(3);
            add(br);
            setSize(400,400);
            setLayout(null);
            setVisible(true);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public static void main(String args[]){
                new test_tree();
    }thx..

  • Can't Set Default for "Show Items From Subfolders"

    I like to view several folders and subfolders at the same time...and then view another group of folders and subfolders, etc. etc. etc....and to do that I'm constantly going to View > Show Items From Subfolders because the command doesn't "stick."  I've looked around, and don't see a way to set "Show Items From Subfolders" as a default. Does anyone know a way to do that?
    Thanks for any help.

      I've looked around, and don't see a way to set "Show Items From Subfolders"
    as a default. Does anyone know a way to do that?
    You can't do so and I'm still not sure you should, it is easy to forget
    resetting it and when visiting a new folder with lot's of subfolders and
    files not being cached it can slow down your workflow, but that is my
    personal opinion
    An option for you might be to open a new window for a new search in
    different folders. By default the new window reflects the current window
    with all subfolder content but changes also to without viewing subfolders
    after having clicked on a new folder. However switching back to the other
    window(s) they still have the 'show subfolders' active.
    Instead of switching folders you could switch windows (I often have multiple
    windows active and cycle through them using cmd+` (tilde key).

Maybe you are looking for