RegisterSearchFAQ UsergroupsLog in
TableReorder didn't work properly

 
Reply to topic    Citra Technologies Forum Index » Report a Bug View previous topic
View next topic

TableReorder didn't work properly
Author Message
cone



Joined: 29 May 2007
Posts: 348

Post TableReorder didn't work properly Reply with quote
Hi,

i am not shure if the beahaviour is a bug but for me it seems so.

The TableReorder seems not to work if i have a Table with or without a sortTableModel.
Only if i use a FilterTableModel then the selection of a cell gets automatically restored with TableReorder#reselectTableRows when i fire a tableDataChanged().
In any other circumstances the cells gets deselected.

Kind regards,
michael
Thu Dec 07, 2017 2:48 am View user's profile Send private message
cone



Joined: 29 May 2007
Posts: 348

Post Reply with quote
Hi support,

can you write something for this problem?
Maybe it is no problem and i have to do something more?

Kind regards,
michael
Wed Dec 13, 2017 3:53 am View user's profile Send private message
support



Joined: 21 Feb 2006
Posts: 1463

Post Reply with quote
Hi,

I couldn't find a problem with TableReorder in the case where a FilterTableModel is not present. You can try this in the demo with:

Code:

   //models
   originalModel = dataModel;
   ListTableModel ltm = otm;
   //FilterTableModel ftm = new FilterTableModel(ltm);
   SortTableModel stm = new SortTableModel(ltm);

   //set class variables
   sortTableModel = stm;
   //filterTableModel = ftm;
   model = createTableModel(stm);


Just uncomment lines with FilterTableModel and feed the listtablemodel into the SortTableModel, instead of the FilterTableModel.


Also uncomment line fhm.attachToTable() :

Code:
   PopupFilterHeaderModel fhm = new CustomPopupFilterHeaderModel();
   //attach filter to table
   //fhm.attachToTable(table, ftm);


TableReorder restores table's selections correctly.

Maybe you have some other model other than ListTableModel?

Thanks
Wed Dec 20, 2017 8:04 am View user's profile Send private message
cone



Joined: 29 May 2007
Posts: 348

Post Reply with quote
That's curious because i did the same thing in your demo.

Additionally i do the following in AbstractDemoPanel

Code:

public JButton btnFireDataChanged;

protected JPanel createVerticalTableFeaturePanel() {
  ...
   //create the panel
   JPanel featurePanel = new JPanel(new BorderLayout());
   featurePanel.add(panel);
       
        // NEW CODE
   btnFireDataChanged = new JButton("fireDataChanged");
   btnFireDataChanged.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
         originalModel.fireTableDataChanged();
      }
   });
}

I select a cell and click on the button and the cell is not selected anymore (except when i use a filterTableModel).

Tested this again with version 4.9 !?

Tue Jan 02, 2018 3:07 am View user's profile Send private message
support



Joined: 21 Feb 2006
Posts: 1463

Post Reply with quote
Hi,

FilterTableModel has variable 'clearOnDataChanged' which is false by default, so this is why it does not assume that data has actually changed after a TableDataChanged event. If you set this variable to true, it will clear all selections after the event is fired.

But normally, a TableDataChanged event implies that all the data of the table have changed, so one would expect the selections to be cleared as well. In FilterTableModel there is the option to keep the selections since it was easy to implement, but in SortTableModel I am not so sure. But why don't you use fireTableRowsUpdated instead?
Thu Jan 04, 2018 6:22 am View user's profile Send private message
cone



Joined: 29 May 2007
Posts: 348

Post Reply with quote
Ahh, i did not realize that.

In my apps i worked with filtertablemodel and found it comfortable that the selection gets automatically restored on tabledatachanged.

well than i had to do the same like you do in the filtertablemodel if there was no filtertablemodel.
Thu Jan 04, 2018 8:54 am View user's profile Send private message
cone



Joined: 29 May 2007
Posts: 348

Post Reply with quote
But when you think that it is only usefull to reselect a filteredTableModel why is a TableReorder instanciated in AdvancedJTable?
But on tableChanged the selection didn't get reselected because reselectTableRows are allways null?

And to make the confusion complete...if i use a treeTable on tableChanged a the TableReorder gets an fireRowsReordered and the selection gets restored.
Fri Jan 05, 2018 2:22 am View user's profile Send private message
cone



Joined: 29 May 2007
Posts: 348

Post Reply with quote
Hi,
can you please respond to my last comment.
Did you think that the curretn behaviour works well or do you plan to implement the same behaviour in every table (probably with an overall parameter like clearOnDataChanged)?

Kind regards,
michael
Mon Mar 05, 2018 5:13 am View user's profile Send private message
support



Joined: 21 Feb 2006
Posts: 1463

Post Reply with quote
Hi,

The clearOnDataChanged makes sense only for ListTableMap classes like SortTableModel and FilterTableModel. I will try to add the same functionality to SortTableModel, as it is missing.

Also for TreeTables, a TreeTableReorder is used.
Wed Mar 07, 2018 6:27 am View user's profile Send private message
Display posts from previous:    

Reply to topic    Citra Technologies Forum Index » Report a Bug All times are GMT - 5 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group