treetable problem

This forum is used by users to request and discuss new product features. Please do not use this forum for technical support including bug reports.

Moderator: JIDE Support

Forum rules
Product suggestions only. Please do not use this forum for technical support including bug reports.

treetable problem

Postby nicola.gioia » Mon Sep 10, 2007 9:06 am

When I use the following code i have a strange problem.
If I expand and collapse the rows in opposite order the expansion is ok.
If i use a different expansion/collapse row order, the tree table reach an inconsistent state.
For example I expand the first row, and then the second row.
all the childs seems to be appended to the first row.
Then if I try to play with expansion collapse of the row some first level rows disappear.
the code to play is:

Code: Select all
import java.awt.Dimension;
import java.util.*;

import javax.swing.*;

import com.jidesoft.grid.*;
import com.jidesoft.swing.JideSwingUtilities;

public class TreeTableTest {
   public static void main(String[] args) {
      JFrame f = new JFrame("Table test!");

      MyTableModel model = new MyTableModel();
      initModel(model);
      TreeTable treeTable = new TreeTable(model);
      treeTable.setExpandAllAllowed(false);
      treeTable.setRowHeight(18);
      treeTable.setShowTreeLines(true);
      treeTable.setShowGrid(false);
      treeTable.setIntercellSpacing(new Dimension(0, 0));

      f.setContentPane(new JScrollPane(treeTable));
      f.pack();
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      JideSwingUtilities.globalCenterWindow(f);
      f.setVisible(true);
   }

   protected static void initModel(MyTableModel model) {

      ArrayList<ExpandableRow> rows = new ArrayList<ExpandableRow>();
      for (int i = 0; i < 3; i++) {
         Object[] rowData = { "name " + i };
         rows.add(new MyElementRow(i + 1, rowData, false));
      }
      model.setOriginalRows(rows);
   }

   public static class MyTableModel extends TreeTableModel {
      private String[] columnNames;

      public MyTableModel() {
         columnNames = new String[] { "name", "prop1", "prop2", "prop3" };
      }

      @Override
      public String getColumnName(int column) {
         if (column >= 0 && column < columnNames.length)
            return columnNames[column];
         return null;
      }

      public int getColumnCount() {
         return columnNames.length;
      }

   }

   public static class MyElementRow extends DefaultExpandableRow {
      protected Object[] rowValues;
      protected long childs;
      Random r = new Random();

      public MyElementRow(long childs, Object[] values, boolean leafRow) {
         this.childs = childs;
         this.rowValues = values;
         setExpandable(!leafRow);
         if (!leafRow) {
            ArrayList<Row> list = new ArrayList<Row>();
            for (int i = 0; i < childs; i++) {
               Object[] rowData = { "", r.nextInt(20), r.nextBoolean(), r.nextInt(20) };
               Row row = new MyElementRow(i, rowData, true);
               row.setParent(this);
               list.add(row);
            }

            setChildren(list);
         }
      }

      public Object getValueAt(int columnIndex) {
         if (rowValues != null && columnIndex >= 0 && columnIndex < rowValues.length)
            return rowValues[columnIndex];
         return null;
      }

      public boolean hasChildren() {
         return isExpandable() && getChildrenCount() > 0;
      }
   }
}

I wrote wrong code or there are other problems?
Thanks
nicola.gioia
 
Posts: 60
Joined: Tue Sep 20, 2005 6:57 am

Postby JIDE Support » Mon Sep 10, 2007 9:13 am

It sounds like a bug we fixed recently. Can you download the latest 2.1.3.02 and check if it works?

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby nicola.gioia » Tue Sep 11, 2007 3:14 am

I tried to download the 2.1.3.02 version (I have used the 2.1.3.01 before) but the problem is still present.
If I try to do the following sequence of expansion collapse with the code that I have provided before the row "name1" disappear.

  1. Expand the row "name0"
  2. Expand the row "name1"
  3. Collapse the row "name0"
  4. Collapse the row "name1"


Thanks
nicola.gioia
 
Posts: 60
Joined: Tue Sep 20, 2005 6:57 am

Postby JIDE Support » Tue Sep 11, 2007 7:19 am

I tried again and it still worked in 2.1.3.02. Can you double check you are using the right version just to make sure?

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby nicola.gioia » Tue Sep 11, 2007 7:53 am

Ok I tried the last version outside eclipse and it is ok.
Probably eclipse was using the old library in cache...
Thanks
nicola.gioia
 
Posts: 60
Joined: Tue Sep 20, 2005 6:57 am

Postby Matthew Harrison » Wed Oct 17, 2007 4:07 am

I noticed this problem in the jide_demo last week...
Matthew Harrison
 
Posts: 18
Joined: Tue Aug 15, 2006 9:22 am

Postby JIDE Support » Wed Oct 17, 2007 8:02 am

Hi Matthew,

Can you tell me the steps to reproduce it?

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby Matthew Harrison » Wed Oct 17, 2007 8:13 am

Hi,

of course, now that I've mentioned it, I can't reproduce it right now...
It's behaving itself...

If I catch it at it again, I'll let you know...
Matthew Harrison
 
Posts: 18
Joined: Tue Aug 15, 2006 9:22 am

Postby Matthew Harrison » Wed Oct 17, 2007 9:03 am

(TreeTable filesystem demo)
what I had noticed was not exactly the same problem.
At some stage, if I expanded a folder which wasn't the first one (Ie 'My Computer') its contents appeared in 'My Computer', not under the folder I had just expanded.
Matthew Harrison
 
Posts: 18
Joined: Tue Aug 15, 2006 9:22 am

Postby JIDE Support » Wed Oct 17, 2007 9:15 am

There could be this issue before but it should been fixed already. Do you notice in the latest release or you just remembered saw that a while ago?

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby Matthew Harrison » Wed Oct 17, 2007 9:25 am

I believe it the was demo I ran on the 15th (2 days ago), but don't lose sleep unless I can reproduce it..
Matthew Harrison
 
Posts: 18
Joined: Tue Aug 15, 2006 9:22 am

Re: treetable problem

Postby Milan Schwarz » Fri Feb 13, 2009 5:33 am

Hi everybody,

how do I recognize which components did buy our company? I tried to run the code upside and unfortunatelly nothing happen. After pressing run as Java Application on this class, it is still launching, but nothing more. Eclipse is still working... It can be licence problem.

Thanks for help.

Milan
Milan Schwarz
 
Posts: 1
Joined: Fri Feb 13, 2009 5:22 am

Re: treetable problem

Postby JIDE Support » Fri Feb 13, 2009 4:39 pm

I am not sure if I understand your question. The code in the first post should run no matter what license key you are using.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to Product Suggestions

Who is online

Users browsing this forum: No registered users and 17 guests

cron