JTree expandAll - refresh after each expandPath?

I'm using a JTree with about 1000 nodes under the not visible root node. All of these nodes have one or more children.
The "collapse/expand all" works fine (both algorithms listed in other topics), but it refreshes the whole view after each expandPath was called.
I've tried to overwrite the fireTreeExpanded/Collapsed in my tree in order to block the swing update and after each expandPath call and finally refresh the tree but I could not do that.
The in/revalidate(), repaint(), etc. and DefaultTreeModel.nodeStructureChanged and co. had not worked.
The only thing what seems to work is the updateUI, but it ignores the the previous JTree.setRowHeight(0) setting, and because I use different fontsize in some nodes they were only partially visible.
Any idea?

It is a shot in the dark at this point, but previously I had problems with renaming a node and get the ellipess (...) because the renderer (JLabel) didn't have enough room to draw the full string.
I am wondering if your issue stems from the renderer not having enough room to draw the second label in the layout for the tree.
I know you said you are already using the model to add/remove the nodes, but assuming you are using the default model have you tried calling nodeChanged?
((DefaultTreeModel)yourTree.getModel()).nodeChanged( yourNode );That seems to effect the space allocated for the renderer to draw the node.

Similar Messages

  • Why my JTree always collasped after refreshing?

    Hello,
    I have been spending whole day trying to figure out why my JTree always collasped after refreshing, but I haven't got any fruit.
    I have a Tree and it is collasped in the beginning, and I can expand and do some work(adding nodes or deleting nodes - no problem)
    But there is a button which validates the tree, and if a node has problem, its background changes which part is working Okay.
    but the tree always goes back to collasped(original state)
    I tried every methods that I searched, but nothing is working.
    Below is the codes..
    private void validateManifest() {
                CP_EditorHandler.checkManifestErrors(_contentPackage, false);
            ManifestTree manifestTree = _manifestPanel.getManifestTree();
         // get the selected node before updating
            ManifestTreeNode selectedNode = (ManifestTreeNode) manifestTree.getSelectedNode();
         // get the selected path before updating
            TreePath selectedPath = (TreePath) manifestTree.getSelectionPath();
         // below code is the part that recreates nodes of the tree and updates nodes' background
            manifestTree.getModel().setContentPackage(_contentPackage);
         // I set below code to expand to selected path
            manifestTree.setExpandsSelectedPaths(true);
         // I even added this code to make it sure
            manifestTree.setExpandedState(selectedPath, true);
    }I even added addTreeWillExpandListener in the tree constructor, but it doesn't work either.
             addTreeWillExpandListener
             (new TreeWillExpandListener() {
               public void treeWillExpand(TreeExpansionEvent e) { }
               public void treeWillCollapse(TreeExpansionEvent e)
                    throws ExpandVetoException {
                throw new ExpandVetoException(e, "you can't collapse this JTree");
               });What did I do wrong or what should I do to make it work?
    I really appreciate your help.

    I have been spending whole day trying to figure out why...no, you've spent your day cross-posting this.
    I don't know where to post the solution, l so I won't bother.

  • Problem with a field set to refresh after insert at Row level

    hello all,
    i have a problem with a field (a serial) which is set by a db trigger at insertion. The field "refresh after insert" is properly set in the Entity and everything is refreshed correctly when i insert data via an adf form in a jspx but when i want to insert programmatically nothing is refreshed. I insert data this way :
    ViewObject insertVO = findViewObject("myView");
    Row newRow = insertVO.createRow();
    newRow.setAttribute("mandatoryAttribute1",value1);
    newRow.setAttribute("mandatoryAttribute2",value2);
    <more init here but not the serial since it will be set by the DB trigger>
    insertVO.insertRow(newRow);
    but when i want to get back the value with "newRow().getAttribute("TheSerial");" i always get a null back and not the value set by the db trigger.
    One way to get the serial is to commit after each insert but i don't want to commit between inserts.
    i've tried to unset the refresh after insert and override the createDef() method to setUseReturningClause(false) as it's is advised in chapter 26.5 of the ADF 4GL dev. guide but in this case i have an exception JBO-29000: JBO-26041.
    How can i get the value back properly ?
    thanks
    -regards

    The data for the newly created row doesn't get inserted into the database until the commit is executed, so the insert trigger isn't called.
    If you need to get the value without committing, then you should implement the trigger programmatically and drop the trigger from the database. The code below shows how you could do this.
    ViewObject insertVO = findViewObject("myView");
    Row newRow = insertVO.createRow();
    SequenceImpl seq = new SequenceImpl("MY_SEQ", insertVO.getDBTransaction());
    Long next = (Long)seq.getData();
    newRow.setAttribute("primaryAttribute", new Number(next));
    ...You will need to replace MY_SEQ and primaryAttribute with the correct values for your example, but this should acheive what you want.

  • Add a button after each node of my tree

    Hi !
    I would like to add a button after each node of my tree. I think I have to create a new TreeCelleRenderer but I really don't know how to make it. Can someone help me and give me an idea (or an example !) about the code.
    When I click the button, I must know from which node the event comes.
    thanks.
    delph

    Hi, how did you resolve the problem. Well it's long time from your posting, but maybe someone else can help me...
    I'm creating similar JTree where's print and save buttons in some of the nodes. I created custom cell renderer which extends JPanel and holds images, text and the buttons inside it. Is it possible to link buttons' actionlisteners somehow to the nodes. I tried it customizing cell editor, but I can't get button events fired. I also tried to catch "button clicked" action using mouse listener in my tree and that worked somehow and can be used as quick and dirty solution. Still I want to do it better way.
    -e

  • [Solved] ADF BC - Correlation of Refresh After Update checkbox with Returni

    Hello all,
    As per JDev (10.1.3.3.0) help system Refresh After Update option is used when there is Before Update trigger on a table.
    As far as I know ADF BC framework is using Returing clause of an Update statement to implement Refresh After Update option.
    First of all I created the following objects in Oracle DB 10.2.0.3.0:
    CREATE TABLE TAB1
         ID          NUMBER          PRIMARY KEY,
         EDITED_AT     DATE,
         VALUE          VARCHAR2(64)
    CREATE SEQUENCE S_TAB1
         INCREMENT BY 1
         START WITH 1;
    CREATE TRIGGER T_TAB1_BIE
    BEFORE INSERT OR UPDATE ON TAB1
    FOR EACH ROW
    BEGIN
         IF INSERTING THEN
              SELECT S_TAB1.NEXTVAL INTO :NEW.ID FROM DUAL;
         END IF;
         :NEW.EDITED_AT := SYSDATE;
    END;
    /Taking into consideration aforesaid I tried to do the following in SQL Plus:
    SQL> insert into tab1(value) values('ddd');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL> select * from tab1;
            ID EDITED_AT           VALUE
             1 27.03.2008 17:01:24 ddd
    SQL>
    SQL> declare dt date; val varchar2(64);
      2  begin update tab1 set value = 'ddd' where id = 1 returning edited_at, value into dt, val;
      3  dbms_output.put_line('txt = ' || dt || ', ' || val);
      4  end;
      5  /
    txt = 27.03.2008 17:01:24, ddd
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select * from tab1;
            ID EDITED_AT           VALUE
             1 27.03.2008 17:02:12 ddd
    SQL>As it can be seen Returning clause of an Update statement does not return a new date, i.e. 27.03.2008 17:02:12, that was updated by the trigger, it returns an old one - 27.03.2008 17:01:24.
    Should I change any parameter in Oracle DB or what can I do that ADF BC refreshes values generated by a Before Trigger?

    Yerzhant,
    Something is certainly not right. I don't have a 10.2.0.3.0 instance handy at the moment, but I tried verbatim your example in 11.1.0.6.0, and it works properly.
    I am using this capability all over the place in ADF BC with no problems, database versions from 10gr1 to 11gr1.
    Perhaps time to contact support.
    John

  • Bc4j bug at refresh after insert / update

    having a table and a trigger on it that fills an attribute
    in a 9i db. one can take the scott/tiger emp table and use the
    following trigger:
    create or replace trigger t_bri_emp
    before insert on emp
    for each row
    declare
    v_no number(7,2);
    begin
    select user_SEQ.nextval*100
    into v_no
         from dual;
    :new.sal := v_no;
    end;
    then creating a bc4j project with an entity object based on this table (emp)
    and a view object based on the created entity object.
    !!!! when you create the bc4j project you must set the SQL Flavor to SQL92 or OLite
    when you set the attribute settings, for the attribute the trigger is on (sal),
    to refresh after insert / update or both in the entity object you get a
    null pointer when you try to insert a new row and commit.
    java.lang.NullPointerException
         oracle.jdbc.ttc7.TTIoac oracle.jdbc.ttc7.TTCAdapter.newTTCType(oracle.jdbc.dbaccess.DBType)
         oracle.jdbc.ttc7.NonPlsqlTTCColumn[] oracle ....................
    all can be reproduced just useing the wizard and start the bc4j project with the tester
    any workaround ??

    Sven:
    I looked into your issue. It turns out your problem is caused by a bug in the system (bug #2409955).
    The bug is that for non-Oracle SQLBuilder, we are not processing refresh-on-insert and refresh-on-update attributes correctly. We end up forming an invalid SQL statement and the JDBC driver gives the obscure NullPointerException.
    Thus, until 9.0.3, you should not use refresh-on-insert/update attributes on a non-Oracle SQLBuilder.
    If you need the refresh-on-insert/update attribute, here is a possible workaround:
    1. Whenever you invoke the tester, on the first panel, click on the 'Properities' tab. In the list of properties, you should find one for 'jbo.SQLBuilder'. It will say 'SQL92'. Remove it, so that it is empty. Run test tester. Then, the tester will use Oracle SQLBuilder which will handle refresh-on-insert/update attributes correctly for you.
    2. For switching between Oracle SQLBuilder and SQL92 SQLBuilder, you can try the following:
    2a) Locate bc4j.xcfg and your Project??.jpx under your 'src' directory.
    2b) Make copies of these files.
    2c) Edit them so that you have one set for Oracle SQLBuilder and one set for SQL92 SQLBuilder. For Oracle SQLBuilder, make sure these files do NOT have entries like:
    <jbo.SQLBuilder>..</jbo.SQLBuilder> in bc4j.xcfg and
    <Attr Name="_jbo.SQLBuilder" Value="..." /> in Project??.jpx
    When there is no jbo.SQLBuilder entry, BC4J will default to Oracle.
    For SQL92, make sure you have
    <jbo.SQLBuilder>SQL92</jbo.SQLBuilder> in bc4j.xcfg and
    <Attr Name="_jbo.SQLBuilder" Value="SQL92" /> in Project??.jpx.
    Before you run, decide which SQLBuilder to use (for 9.0.2, with retrieve-on-insert/update attrs, you have no choice but to use Oracle SQLBuilder) and copy these files into your class path, e.g.,
    <jdev-install-dir>\jdev\mywork\Workspace1\Project1\classes
    When you get 9.0.3, then you should be able to switch between Oracle and SQL92 SQLBuilders freely.
    Thanks.
    Sung

  • Print HTML Report Automatica​lly after Each UUT

    Hello
    I saw the document on NI site called "Print HTML Report Automatically after Each UUT". That's exactly what I want to do with XML files. So I put it in my sequence file and it works fine, but when it opens the xml file at the first step, there's a pop-up from IE who say that "Scripts are generally safe, do you want to authorise this script" (This message is also displayed when I open my file in files explorer).
    So, the print is not automatically anymore as I must answer to this pop-up. does anybody has a solution to bypass this pop-up ?
    I tried to use the property silent on the class IWebBrowser2. Inded, the pop-up doesn't appear anymore, but my XML file isn't correctly printed. I supposed the default response of the pop-up (which is no) is applied. So the script isn't executed.
    I also tried to configure IE to not display this pop-up : No result
    Regards
    Laurent

    Hello,
    I think that you need to configure your browser, can you take a look a this article:
    http://www.maxi-pedia.com/scripts+are+usually+safe​+do+you+want+to+allow+scripts+to+run
    Regards,
    Nacer M. | Certified LabVIEW Architecte

  • Spotlight index lost after each login

    Hello people,
    I've got a very confusing thing going on with Spotlight on my mac.
    After each login, Spotlight looses its index and I can't my files.
    I have tried solving this problem with the app IceClean, using "sudo mdutil -i on /", dragging and remvoing something into the privacy tab in Spotlight's preferences and some other tips and tricks I got from this forum, but nothing worked.
    The odd thing is, Spotlight finds the files, but only after some time. My guess it's restores the index or re-indexes everything. Yet that doesn't help since it gets deleted after the next login.
    I am very confused right now. No solution seems to work I thought maybe you guys know some answer to that problem.
    Any tip and help is greatly appreciated.
    Best regards
    Martin
    I am using a Macbook Pro, Snow Leopard v10.6.6 (10J567)

    No one?

  • Schedule line date changes after each MRP run

    Dear Experts,
    Clarification needed on how the system plans the MM schedule lines.
    Setting: Start in the past not allowed.
                  3 days for processing of order
    The issue is after each MRP run the system is moving the schedule line to the current date + 3 days for processing + the planned delivery time.
    If the schedule line is not firmed, after each MRP run ( which happens everyday) the system is moving the schedule line and then giving an alert saying the " order has to be rescheduled to the previous day"
    on the second day after the mrp run the system moves the schedule line again by one more day and gives the rescheduling date as " -2 days from today"
    this change is happening every day after the planning run. - because of this there are really no backorders ( schedule line in the past ) in the system. we were not able to know if the vendor is actually delayed in this case.
    can you kindly suggest what went wrong here ??
    we are using strategy 10 for the planning of procured parts. Let me know if more info is needed.
    Note: we are also using stock transfer process for some procured parts. there too the PR date gets changed after each MRP run. There there is no lead time in this case. the order is placed on the same day as the requirement as both plants are nearby. There the PR date is changing everyday to the current date.
    your advice would be of great help
    thanks
    Nagendra Kumar

    Hi Caetano,
    thanks for your suggestion
    Yes, we use firm zone for few of the vendors. there the system don't change the schedule lines.
    Also for the stock transfer PR's there is no firm zone and the lead time is one day. in this case it changes everyday after the MRP run.
    the stock transfer PR's leads to the creation of Schedule lines from the source plant. Since this PR gets changed everyday. the alerts coming out of MD07 gets changed and we really did not know if this order is delayed or not.  In the source plant we use the firm zone to avoid moving the schedule line. But then the alerts are always not correct.
    is there any setting which helps in not moving the PR everyday without using " start in the past"
    thanks
    Nagendra Kumar

  • Print a line after each constructor

    Would one of you java gods tell me how i can print a line after each constructor that tells me that the constructor has been constructed?
    * Employee.java
    * Created on April 28, 2007, 11:58 PM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    * @author Pete Berardi
    package edu.ctu.peteberardi.phase3db;
    import java.util.Scanner;
    public abstract class Employee extends Object
        protected String EmpName;
        protected String EmpAddress;
        protected String EmpSsn;
        protected String EmpEmployeeID;
        protected double EmpYearlySalary;
        protected double computePay;
        protected String Constructor;
        /** Creates a new instance of Employee */
        public Employee(String name, String address, String ssn,
                String id, double salary, double pay, String cvariable)
          name = EmpName;
          address = EmpAddress;
          ssn = EmpSsn;
          id = EmpEmployeeID;
          salary = EmpYearlySalary;
          pay = computePay;
        public void setEmpName(String name)
            EmpName = name;
        public String getEmpName()
            return EmpName;
        public void setEmpAdress(String address)
            EmpAddress = address;
        public String getEmpAddress()
            return EmpAddress;
        public void setEmpSsn(String ssn)
             EmpSsn = ssn; 
        public String getEmpSsn()
            return EmpSsn;
        public void setEmpID(String id)
            EmpEmployeeID = id;
        public String getEmployeeID()
            return EmpEmployeeID;
        public void setEmpYearlySalary(double salary)
            EmpYearlySalary = salary;
        public double getEmpYearlySalary()
            return EmpYearlySalary;
        public void setcomputePay(double pay)
            computePay = pay;
        public double computePay()
            return computePay;
          public void setContstructor(String cvariable)
             Constructor = cvariable;
        public String Constructor()
            return Constructor;
       public static void main( String args[])
          System.out.print("Constructor has been constructed");
     

    I do not know why you have declared the class as abstract. Abstract class must contain at least one abstract method.
    In your code, there is no abstract method.
    public Employee(String name, String address, String ssn,
                String id, double salary, double pay, String cvariable)
          name = EmpName;
          address = EmpAddress;
          ssn = EmpSsn;
          id = EmpEmployeeID;
          salary = EmpYearlySalary;
          pay = computePay;
          System.out.println("Constructor created");
         }The above code works only when you instantiate the object for the class. If it is abstract class, it will not work.
    Abstract class cannot be instantiated.

  • How to refresh after delete the records in ALV report ?

    Hi Friends,
    How to refresh after delete the records in ALV report.
    I am deleting records in ALV report .
    After successful delete the screen should refresh.
    u201C Deleted records should not appear in the screen u201C.
    Please guide me.
    Regards,
    Subash

    Hi subhash,
    FORM user_command USING r_ucomm LIKE sy-ucomm      rs_selfield TYPE slis_selfield.
    WHEN 'BACK'.
    Refresh the internal table from the ALV grid
          PERFORM update_alv_tab.
    ENDFORM.                    "user_command
    FORM update_alv_tab .
      DATA :  e_grid TYPE REF TO cl_gui_alv_grid.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = e_grid.
      CALL METHOD e_grid->check_changed_data.
      "update_alv_tab
      CALL METHOD e_grid->refresh_table_display.
    ENDFORM.                    " UPDATE_ALV_TAB
    Then see in Debug mode is it updating or not..
    Please confirm .
    And please paste the code if you can.
    Regards.

  • "Refresh after" insert fails for DB-View with INSTEAD OF Triggers

    Hi,
    I have a database view with INSTEAD OF triggers defined for INSERT, UPDATE, DELETE.
    For some EO attributes the refresh after insert and update is defined.
    Posting to database fails.
    According to Database 9.2 Manual and a previous thread (BC4J and Updatable Views the RETURNING clause is not allowed for database views with INSTEAD OF triggers.
    Is there a workaround so the refresh after is done, but without the RETURNING feature?
    I only need to refresh some values. The PK i can set in the create method of the EO so refresh via a additional SELECT would be possible.
    If not Feature Request:
    Add the possibility to do the "refresh after ..." with a 2nd SELECT using the PK instead of using the RETURNING clause.
    Of course then it is not possible to set the PK in the database trigger. PK has to be set in the create method of the EO.
    Thanks,
    Markus
    GEMS IT

    Hi Markus,
    Turning on the stack trace (-Djbo.debugout put=Console - in the Project/runner) did help and I should have done it sooner. Turns out that when I constructed my EO based upon a database view - I should have left out the PKs of the base tables.
    In my case, I am using an "Instead Of Trigger" to populate a multi-table arrangement (parent - child - grandChild - greatGrandChild relationship) where all base tables are using dbSequence/dbTriggers.
    Final analysis - I would like to see BC4J handle this situation. I do not want to use View-Links and I should * not * have to resort to stored procedures and BC4J/doDML. If I construct a DB View this is participating in an parent - child - grandChild - greatGrandChild relationship that are using dbSequence/dbTriggers, then BC4J should be smart enough to construct VO knowing that I want to do insert, update, delete, selects - based upon this structure.
    Thanks Markus,
    Bill G...

  • Wipe ipad after each use (like invited account)

    How wipe ipad data after each use (like invited account on MacOs)?

    Sorry, but assuming you mean that you want it to wipe automatically, that's not a feature of iOS (except the data wipe that can happen as a security feature after multiple incorrect passcode attempts). If you want to wipe an iPad, you have to do it manually.
    Regards.

  • Need to restart iTunes after each CD import... what's up with that ?

    Having an issue with my new Toshiba laptop, after bringing my library in from my HTPC(now gone) and finding atleast one song on each album cut short, i've decided to start from scratch and re-import my 350 odd CD collection.
    But i'm having an issue... i start iTunes, import one CD, then go to do another and it either tells me there is no CD in the drive, or won't download any track names/album info etc. So after each CD i have to exit iTunes and then restart it. Sometimes have to reboot... what a nightmare that has turned into.
    Any help would be very much appreciated
    Thanks
    Matt

    Never mind... simply needed to autherise the new computer.

  • Management Studio 2008 does not refresh after table create / alter

    hello
    Management Studio 2008 does not refresh after table create / alter, why?
    f5 / refresh button does not work in "Object Explorer".... i always need the restart the whole application to see any changes, this is strange...
    regards, jan

    Hi jm,
    I’m writing to follow up with you on this post. Was the problem resolved after performing Vishal ‘s steps? If you are satisfied with our solution, I’d like to mark this issue as "Answered". Please also feel free to unmark the issue, with any new findings
    or concerns you may have.
    Thanks,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

Maybe you are looking for

  • Illustrator CC crashing upon attempting to start a new document or even save a new workspace.

    Didn't realise I was a beta tester, in fact didnt know I had the time to be either. Creative Cloud is a great idea, pity it has been used to release under cooked software. The upgrade to CC has cost my department hours and hours of chargeable/billabl

  • Auto rotation is not working anymore on my iPhone 5s

    Today i woke up and grab my iphone to see if i get any new messages... so i opened my mail app and i turn it landscape mode the iphone screen doesn rotate at alll...  and after a while it rotate itself... realy weird situation... I have installed the

  • RFC/BAPI Exception in PI 7.0

    Hi there,   currently we have a scenario where the message come from middleware and pass through PI to POSDM system via RFC. my target structue is an BAPI .   for some reason if the BAPI execution gets failed on POSDM system then the BAPI should retu

  • Print PDF issues with Reader 11.0.03

    I upgraded to Reader 11.0.03 and can no longer print any .pdf files in Mac OS 10.8.4 I get the print dialog box, but when attempting to print get a pop-up "The document could not be printed" and then "there were no pages selected to print".

  • How to find group wise total in crystal report?

    Dear All,                    I have to find the total of a Quantity value based on the Item code.How to achieve that in Crystal report. Scenario: Itemcode   orderno     Qty A               1             100 A               2               20 A