Hi  Indukumar,

Thanks for pointing out the problem.

I have created an issue: https://www.canoo.com/jira/browse/UBA-7082.

For workaround, force an expand on the root node as shown in the snippet
below.

Thanks and regards,

Janak

------------------------------
import com.ulcjava.base.application.IApplication;
import com.ulcjava.base.application.ULCFrame;
import com.ulcjava.base.application.ULCScrollPane;
import com.ulcjava.base.application.ULCTableTree;
import com.ulcjava.base.application.event.ActionEvent;
import com.ulcjava.base.application.event.IActionListener;
import com.ulcjava.base.application.tabletree.DefaultMutableTableTreeNode;
import com.ulcjava.base.application.tabletree.DefaultTableTreeModel;
import com.ulcjava.base.development.DevelopmentRunner;

public class TableTreeModelStructureChangedBug extends ULCFrame implements
IApplication {

        public static void main(String[] args) {
                
DevelopmentRunner.setApplicationClass(TableTreeModelStructureChangedBug.cl
ass);
                DevelopmentRunner.run();
        }

        public void start() {

                TableTreeModelStructureChangedBug testCase = new
TableTreeModelStructureChangedBug();

                final DefaultMutableTableTreeNode root = new
DefaultMutableTableTreeNode(new Object[] {"root", "root", "root"},
                        new boolean[] {false, false, true}, false);
                DefaultMutableTableTreeNode row1 = new 
DefaultMutableTableTreeNode(new
Object[] {"AAA", "BBB", "CCC"},
                        new boolean[] {false, false, true}, false);
                DefaultMutableTableTreeNode row1a = new 
DefaultMutableTableTreeNode(new
Object[] {"aaa", "bbb", "ccc"},
                        new boolean[] {false, false, true}, true);
                final DefaultMutableTableTreeNode row2 = new
DefaultMutableTableTreeNode(new Object[] {"DDD", "EEE", "FFF"},
                        new boolean[] {false, false, true}, false);
                DefaultMutableTableTreeNode row2a = new 
DefaultMutableTableTreeNode(new
Object[] {"ddd", "eee", "fff"},
                        new boolean[] {false, false, true}, true);


                row1.add(row1a);
                row2.add(row2a);

                root.add(row1);
                root.add(row2);

                final DefaultTableTreeModel model = new 
DefaultTableTreeModel(root, new
String[] {"As", "Bs", "Cs"});

                model.setRoot(root);

                final ULCTableTree tree = new ULCTableTree(model);
                tree.setRootVisible(false);
                tree.setShowsRootHandles(true);

                tree.addActionListener(new IActionListener() {

                        public void actionPerformed(ActionEvent arg0) {
                                model.structureChanged();
                                tree.expandPath(new TreePath(model.getRoot()));
                        }
                });

                testCase.add(new ULCScrollPane(tree));

                testCase.setVisible(true);
        }

        public void stop() {

        }

        public void activate() {

        }

        public void passivate() {

        }

        public void handleMessage(String arg0) {

        }

        public void pause() {

        }

        public void resume() {

        }
}



>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] Behalf Of Indukumar
>Vellapillil H. (KSDE 211)
>Sent: Thursday, October 19, 2006 7:34 PM
>To: Janak Mulani
>Cc: [EMAIL PROTECTED] Com
>Subject: RE: [ULC-developer] ULCTableTree loses contents when model
>structure changes
>
>
>Hi,
>
>This I understand.. But still should it not reload the model with my
>example? Do you mean to say that it is not a bug, but something that I
>did wrong?
>
>What I am actually trying to do is to fire node changed event on a
>particular node using the method
>ITableTreeModelListener.tableTreeNodesChanged(new
>TableTreeModelEvent(source, path)). Where path is Object[]. This does
>not seem to work, and I think that it is related to the problem I
>mentioned above.
>
>Thanks & Regards
>Indukumar
>
>-----Original Message-----
>From: Janak Mulani [mailto:[EMAIL PROTECTED]
>Sent: Thursday, 19. October 2006 3:47 PM
>To: Indukumar Vellapillil H. (KSDE 211)
>Cc: [EMAIL PROTECTED] Com
>Subject: RE: [ULC-developer] ULCTableTree loses contents when model
>structure changes
>
>Hi Indukumar,
>
>What exactly are you trying to do in the action listener?
>
>You should use an appropriate notifier.  To notify the table tree model
>listeners that data in the table tree model has
>changed the application should use the following convenience methods:
>
>. nodeChanged() when a single node value has been updated,
>. nodesChanged() when given children of a node have been updated,
>. nodesWereInserted() when children were inserted at a given node,
>. nodesWereRemoved() when children were removed from a given node,
>. nodeStructureChanged() when the structure below a node has been
>changed,
>. structureChanged() when entire structure has changed.
>
>Please see the JavaDoc of AbstractTableTreeModel and
>TableTreeModelEvent.
>
>Please also see the snippet below which adds a node to a row in the
>action
>listener.
>
>Thanks and regards,
>
>Janak
>
>
>---------
>
>import com.ulcjava.base.application.IApplication;
>import com.ulcjava.base.application.ULCFrame;
>import com.ulcjava.base.application.ULCScrollPane;
>import com.ulcjava.base.application.ULCTableTree;
>import com.ulcjava.base.application.event.ActionEvent;
>import com.ulcjava.base.application.event.IActionListener;
>import
>com.ulcjava.base.application.tabletree.DefaultMutableTableTreeNode;
>import com.ulcjava.base.application.tabletree.DefaultTableTreeModel;
>import com.ulcjava.base.development.DevelopmentRunner;
>
>public class ULCTestCase extends ULCFrame implements IApplication {
>
>       public static void main(String[] args) {
>
>DevelopmentRunner.setApplicationClass(ULCTestCase.class);
>               DevelopmentRunner.run();
>       }
>
>       public void start() {
>
>               ULCTestCase testCase = new ULCTestCase();
>
>               DefaultMutableTableTreeNode root = new
>DefaultMutableTableTreeNode(new Object[] {"root", "root", "root"},
>                       new boolean[] {false, false, true}, false);
>               DefaultMutableTableTreeNode row1 = new
>DefaultMutableTableTreeNode(new Object[] {"AAA", "BBB", "CCC"},
>                       new boolean[] {false, false, true}, false);
>               DefaultMutableTableTreeNode row1a = new
>DefaultMutableTableTreeNode(new Object[] {"aaa", "bbb", "ccc"},
>                       new boolean[] {false, false, true}, true);
>               final DefaultMutableTableTreeNode row2 = new
>DefaultMutableTableTreeNode(new Object[] {"DDD", "EEE", "FFF"},
>                       new boolean[] {false, false, true}, false);
>               DefaultMutableTableTreeNode row2a = new
>DefaultMutableTableTreeNode(new Object[] {"ddd", "eee", "fff"},
>                       new boolean[] {false, false, true}, true);
>
>
>               row1.add(row1a);
>               row2.add(row2a);
>
>               root.add(row1);
>               root.add(row2);
>
>               final DefaultTableTreeModel model = new
>DefaultTableTreeModel(root, new String[] {"As", "Bs", "Cs"});
>
>               model.setRoot(root);
>
>               ULCTableTree tree = new ULCTableTree(model);
>               tree.setAutoCreateColumnsFromModel(false);
>               tree.setRootVisible(false);
>               tree.setShowsRootHandles(true);
>
>               tree.addActionListener(new IActionListener() {
>
>                       public void actionPerformed(ActionEvent arg0) {
>                               DefaultMutableTableTreeNode row2b = new
>                               DefaultMutableTableTreeNode(new Object[]
>{"ddd", "eee", "fff"},
>                                                       new boolean[]
>{false, false, true}, true);
>                               row2.add(row2b);
>                               model.nodeStructureChanged(row2);
>                       }
>               });
>
>               testCase.add(new ULCScrollPane(tree));
>
>               testCase.setVisible(true);
>       }
>
>       public void stop() {
>
>       }
>
>       public void activate() {
>
>       }
>
>       public void passivate() {
>
>       }
>
>       public void handleMessage(String arg0) {
>
>       }
>
>       public void pause() {
>
>       }
>
>       public void resume() {
>
>       }
>
>}
>
>
>>-----Original Message-----
>>From: [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED] Behalf Of Indukumar
>>Vellapillil H. (KSDE 211)
>>Sent: Wednesday, October 18, 2006 7:11 PM
>>To: [email protected]
>>Subject: [ULC-developer] ULCTableTree loses contents when model
>>structure changes
>>
>>
>>Hi,
>>
>>I am using a ULCTableTree. The problem is that the structure-changed
>>event from a model causes the table tree to remove its contents, but it
>>does not load it back again!
>>I am attaching a sample application demonstrating the problem.
>>
>>Environment:
>>- ULC Version: 6.1.1
>>- Java: 1.4.2 on both client and server.
>>
>>To reproduce the problem:
>>1. Please run the following application and double-click the table
>tree.
>>2. The content of the table tree vanishes!
>>
>>Am I doing something wrong or is it a bug with a work around?
>>
>>Thanks and Regards
>>Indukumar
>>
>>X----------------------------------
>>
>>public class ULCTestCase extends ULCFrame implements IApplication {
>>
>>      public static void main(String[] args) {
>>
>>              DevelopmentRunner.main(args);
>>      }
>>
>>      /**
>>       * @see com.ulcjava.base.application.IApplication#start()
>>       */
>>      public void start() {
>>
>>              ULCTestCase testCase = new ULCTestCase();
>>
>>              DefaultMutableTableTreeNode root = new
>>DefaultMutableTableTreeNode(new Object[] {"root", "root", "root"},
>>                      new boolean[] {false, false, true}, false);
>>              DefaultMutableTableTreeNode row1 = new
>>DefaultMutableTableTreeNode(new Object[] {"AAA", "BBB", "CCC"},
>>                      new boolean[] {false, false, true}, false);
>>              DefaultMutableTableTreeNode row1a = new
>>DefaultMutableTableTreeNode(new Object[] {"aaa", "bbb", "ccc"},
>>                      new boolean[] {false, false, true}, true);
>>              DefaultMutableTableTreeNode row2 = new
>>DefaultMutableTableTreeNode(new Object[] {"DDD", "EEE", "FFF"},
>>                      new boolean[] {false, false, true}, false);
>>              DefaultMutableTableTreeNode row2a = new
>>DefaultMutableTableTreeNode(new Object[] {"ddd", "eee", "fff"},
>>                      new boolean[] {false, false, true}, true);
>>
>>              row1.add(row1a);
>>              row2.add(row2a);
>>
>>              root.add(row1);
>>              root.add(row2);
>>
>>              final DefaultTableTreeModel model = new
>>DefaultTableTreeModel(root, new String[] {"As", "Bs", "Cs"});
>>
>>              model.setRoot(root);
>>
>>              ULCTableTree tree = new ULCTableTree(model);
>>              tree.setRootVisible(false);
>>              tree.setShowsRootHandles(true);
>>
>>              tree.addActionListener(new IActionListener() {
>>
>>                      public void actionPerformed(ActionEvent arg0) {
>>
>>                              model.structureChanged();
>>                      }
>>              });
>>
>>              testCase.add(new ULCScrollPane(tree));
>>
>>              testCase.setVisible(true);
>>      }
>>
>>      /**
>>       * @see com.ulcjava.base.application.IApplication#stop()
>>       */
>>      public void stop() {
>>
>>      }
>>
>>      /**
>>       * @see com.ulcjava.base.application.IApplication#activate()
>>       */
>>      public void activate() {
>>
>>      }
>>
>>      /**
>>       * @see com.ulcjava.base.application.IApplication#passivate()
>>       */
>>      public void passivate() {
>>
>>      }
>>
>>      /**
>>       * @see
>>com.ulcjava.base.application.IApplication#handleMessage(java.lang.Strin
>g
>>)
>>       */
>>      public void handleMessage(String arg0) {
>>
>>      }
>>
>>      /**
>>       * @see com.ulcjava.base.application.IApplication#pause()
>>       */
>>      public void pause() {
>>
>>      }
>>
>>      /**
>>       * @see com.ulcjava.base.application.IApplication#resume()
>>       */
>>      public void resume() {
>>
>>      }
>>
>>}
>>
>>X----------------------------------
>>_______________________________________________
>>ULC-developer mailing list
>>[email protected]
>>http://lists.canoo.com/mailman/listinfo/ulc-developer
>
>_______________________________________________
>ULC-developer mailing list
>[email protected]
>http://lists.canoo.com/mailman/listinfo/ulc-developer

_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to