Column size resetting intermittently in 0.8??

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

One thing I noticed after updating to 0.8 is that some columns I have hidden (to hold row data for easy access in the table model and the tree table) suddenly appear - meaning something is resetting the column size from zero to some default size.

How I usually "hide" columns is like this:
                getColumnModel().getColumn(TermTreeTableModel.PLACEHOLDER_COLUMN).setWidth(0);
getColumnModel().getColumn(TermTreeTableModel.PLACEHOLDER_COLUMN).setPreferredWidth(0);
getColumnModel().getColumn(TermTreeTableModel.PLACEHOLDER_COLUMN).setMinWidth(0);
getColumnModel().getColumn(TermTreeTableModel.PLACEHOLDER_COLUMN).setMaxWidth(0);

I now have put in a hack in various event handling to detect if a "hidden" column size is no longer zero, and then reset it back to zero. I haven't had time to dig into a better fix, or better yet to find out what is resetting the column width intermittently, but I was wondering if this is something someone has seen before?
[Message sent by forum member 'devdude' (devdude)]

http://forums.java.net/jive/thread.jspa?messageID=224390

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

TableColumnExt supports a visible property.  Do not set the size to 0, instead set the visibility of the column to false.

Karl
[Message sent by forum member 'kschaefe' (kschaefe)]

http://forums.java.net/jive/thread.jspa?messageID=224456

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, I'll look into that today and come back later with the results.
[Message sent by forum member 'devdude' (devdude)]

http://forums.java.net/jive/thread.jspa?messageID=224497

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There are several problems with this approach:

1) It doesn't fix the problem. The tree table still intermittently shows all columns and I still have to resort to my hack to reset the columns to be hidden.

2) When I set a column to not be visible with etColumnExt(TermTreeTableModel.PLACEHOLDER_COLUMN).setVisible(false); it is almost like it is removing it from the column model. If I then try to set the column size on another column that is the last index, then I get an array index out of bounds exception from getColumnExt() and DefaultColumnModel. For example, if I have four columns, indexed zero through three, then I set column 0 to not be visible and then try to manipulate column 3 in any way, I get the array index exception. It is like column 3 isn't in the column model anymore.

Because of this, to even try this, I had to make any calls for column manipulation in reverse order, making sure that I manipulated the highest order columns first, and even then I might be off if I tried certain orders - after once hidding the lower order columns then I can't manipulate the higher order columns again later without some convoluted logic to figure out what index they are.

I suppose I could use the column header name instead to maybe work around this index problem, but even if that was possible I am still getting the intermittent display of hidden columns.
[Message sent by forum member 'devdude' (devdude)]

http://forums.java.net/jive/thread.jspa?messageID=224542

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Additional notes: since I could not work around this, I have removed the offending columns from the model and I will use other means for what I used those for.

However, I now have just two columns, both visible. Intermittently, the column size of left column is being reset to some default size, just like the columns that would become visible. So, I am back to my old hack of calling a method periodically that checks the size of that column and resets it. I suspect there is something in the JXTable/JXTreeTable layout code that is resetting the size of columns to some default size.

Maybe after I get through this dev cycle I'll have time to update to the latest weekly build and/or look at the code in the SwingX components to figure out why this is happening.
[Message sent by forum member 'devdude' (devdude)]

http://forums.java.net/jive/thread.jspa?messageID=224547

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This AM I had a few minutes to try with the 6-17-07 build and saw the same effect.

We are in regression testing right now, so in a month or so I will be able to update to the latest build, fix what it breaks in my code (I have a hack to make multiple item DnD work - that breaks, maybe other stuff) and then try again. If the problem is still there (I suspect it will be unless someone looks into this), then I will try to dig into it and figure out who/what is resetting the column size - I suspect it is probably something in the repaint/validate logic during some change event. What I am seeing is that this happens mostly when I close and reload my model and start over again (I have a split pane where a user clicks on a vocabulary object and the term tree for it opens in another pane) - if I do this repeatedly and quickly, that seems to be the easiest way to get this to happen. Sometimes it happens when removing/adding nodes, especially if there are a bunch of complex updates (my tree has polyhierarchy).
[Message sent by forum member 'devdude' (devdude)]

http://forums.java.net/jive/thread.jspa?messageID=225350

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hmm, what autoResizeMode is that table using?  My guess is that you need to do:
[code]table.setAutoResizeMode(JTable.AUTO_RESIZE_MODE_OFF)[/code]

Karl
[Message sent by forum member 'kschaefe' (kschaefe)]

http://forums.java.net/jive/thread.jspa?messageID=225979

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The default apparently (I don't explicitly set it) is AUTO_RESIZE_SUBSEQUENT_COLUMNS

Setting it to AUTO_RESIZE_OFF did not help. The behavior is still there and the tree column now gets squished to a small width when it happens.

Thanks for the suggestion though.
[Message sent by forum member 'devdude' (devdude)]

http://forums.java.net/jive/thread.jspa?messageID=226037

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Since, you tried the latest build, do you have a test case for that build?  If so, could you please share it?

Karl
[Message sent by forum member 'kschaefe' (kschaefe)]

http://forums.java.net/jive/thread.jspa?messageID=226038

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Okay, here is one hack that works better than my hack of calling, from any event, a method which resets the column size to its correct size: I overrode sizeColumnsToFit thusly:

public void sizeColumnsToFit(int arg){}

When I do that, the columns never resize.

So I am guessing that is where the problem is in JXTreeTable. Maybe later I will get a chance to look at this in more depth.
[Message sent by forum member 'devdude' (devdude)]

http://forums.java.net/jive/thread.jspa?messageID=226040

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Oops!

 I guess I just did not try hard enough.

It still does it.
[Message sent by forum member 'devdude' (devdude)]

http://forums.java.net/jive/thread.jspa?messageID=226042

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Not yet.

I would need to simplify it down so I could write a simple tree and get it to do it so you guys could debug it. Right now where it happens is in a complicated implementation that has a DB backed model which is in turn loaded from a server. This is all inside an application.

When we finish this test cycle and do a release, maybe I will have time to look into this and maybe come up with a test case that replicates the problem.

Right now I notice it in two instances in my app: one where I am repeatedly reloading the tree over and over again - every once in a while it will happen.

The other case is where I have a polyheirarchy several levels deep. Which  should be neither here not there, but it happens.
[Message sent by forum member 'devdude' (devdude)]

http://forums.java.net/jive/thread.jspa?messageID=226043

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am doing nothing today, so I wrote a test case that fails against both 0.8 and the latest build.

It is four classes, and they are within our test package, but don't depend on anything but standard Java classes and SwingX. It is implemented as a unit test, but to get the failure to happen the JWindow must be made visible. I have pared it down to the minimum I think is necessary.

How do you want this?
[Message sent by forum member 'devdude' (devdude)]

http://forums.java.net/jive/thread.jspa?messageID=226465

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yep.  Please submit them to the issue for this (is there one?).

Karl
[Message sent by forum member 'kschaefe' (kschaefe)]

http://forums.java.net/jive/thread.jspa?messageID=226474

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There is no issue.

I guess I will look into entering one.
[Message sent by forum member 'devdude' (devdude)]

http://forums.java.net/jive/thread.jspa?messageID=226487

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I added an issue: #550

I added the files, although they are set to use my package, they can use another.

I added one extraneous file by mistake: TermTreeModelTest which is not part of the bug. I don't see any way to remove it.
[Message sent by forum member 'devdude' (devdude)]

http://forums.java.net/jive/thread.jspa?messageID=226612

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have distilled the following from your submitted files.  I am unable to reproduce the problem with it.  I have replaced my model with yours and am still unable to get the column to not be fixed.

Can you confirm that the code below works as you believe it should work?  In this case the second column (size) is fixed to 16 pixels.

[code]package org.jdesktop.swingx;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;

import org.jdesktop.swingx.treetable.FileSystemModel;

/**
 * A class to test whether setting the column size to a fixed value actually
 * fixes the column size.
 */
public class ColumnWidthTest extends JFrame {
    private static final long serialVersionUID = 8333806301174386640L;

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                JFrame frame = new ColumnWidthTest();
                frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
                frame.setVisible(true);
            }
        });
    }
   
    protected void frameInit() {
        super.frameInit();
       
        setTitle("Column Width Test");
       
        JXTreeTable treeTable = new JXTreeTable(new FileSystemModel());
        treeTable.getColumnExt(1).setWidth(16);
        treeTable.getColumnExt(1).setPreferredWidth(16);
        treeTable.getColumnExt(1).setMinWidth(16);
        treeTable.getColumnExt(1).setMaxWidth(16);
       
        treeTable.setColumnControlVisible(true);

       
        add(new JScrollPane(treeTable));
        pack();
    }
}
[/code]

Karl
[Message sent by forum member 'kschaefe' (kschaefe)]

http://forums.java.net/jive/thread.jspa?messageID=226615

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There are two problems with that test that cause it to not fail:

1) The tree table does not exist after the frame closes.
2) Changing the model after the model has already been set is key to this bug. In our application we frequently refresh the tree by throwing out the old model and setting up a new model for the tree. It is the nature of the underlying cache backed model that this is required (although I will look into if there is a way around that).

Nonetheless, even using the FileSystemModel, the same thing happens. I simplified my test case down to one file/class (sorry about the many files before, I should have simplified more) and the following fails for me:

package org.jdesktop.swingx;

import javax.swing.JScrollPane;
import javax.swing.JWindow;
import org.jdesktop.swingx.treetable.FileSystemModel;


import org.jdesktop.swingx.JXTreeTable;

import junit.framework.TestCase;

public class TreeTableTest extends TestCase
{

        public static void main(String[] args)
        {
                TreeTableTest test = new TreeTableTest();
               
                try
                {
                        test.setUp();
                        test.testTable();
                        test.tearDown();
                }
                catch(Exception ex)
                {
                        System.out.println(ex.getLocalizedMessage());
                }
        }
       
        public void testTable()
        {
                JScrollPane scrollPane;
                JXTreeTable treeTable;

                JWindow testWindow = new JWindow();
                treeTable = new JXTreeTable(new FileSystemModel());
                treeTable.getColumnExt(0).setWidth(16);
                treeTable.getColumnExt(0).setPreferredWidth(16);
                treeTable.getColumnExt(0).setMinWidth(16);
                treeTable.getColumnExt(0).setMaxWidth(16);

                scrollPane = new JScrollPane();
                scrollPane.setViewportView(treeTable);
                testWindow.add(scrollPane);
                treeTable.setTreeTableModel(new FileSystemModel());
                // without this reset of the model ^^, it will not fail
                testWindow.setVisible(true); // here is where it fails

                if (treeTable.getColumnExt(0).getMaxWidth() != 16)
                        fail("Column size test failed \n");
        }
}
[Message sent by forum member 'devdude' (devdude)]

http://forums.java.net/jive/thread.jspa?messageID=226620

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Now, I understand what your problem is.  It's not a bug per se.  A JTable rebuilds the TableColumnModel by default when a new TableModel is set.

Try setting setAutoCreateColumnsFromModel to false after you initially build the table.

Karl
[Message sent by forum member 'kschaefe' (kschaefe)]

http://forums.java.net/jive/thread.jspa?messageID=226645

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@...
For additional commands, e-mail: jdnc-help@...


Re: JXTreeTable Column size resetting intermittently in 0.8??

by jdnc-interest :: Rate this Message: