Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ufk-dev] Swing ObservableListTableModel remove glitch

Hi,

I've found the problem and fixed it in SVN.

The problem is that when a multi remove/add happens we should have
delivered e.g. for the remove a fireTableRowsDeleted(0,0) twice but we
delivered something like this:

fireTableRowsDeleted(0,0)
fireTableRowsDeleted(1,1)

I'll try to implement a better fix later when I have more time. E.g. we
should fireTableRowsDeleted() with a range, same is true for additions
instead of single events who force a redraw everytime.

Tom

Am 08.02.11 02:45, schrieb Max Gordienko:
> Hi there!
> 
> I think there is a problem with the way ObservableListTableModel
> handles row delete.
> If multiple top rows are removed from the model for some reason a part
> of the JTable is not updated.
> I cannot pinpoint what causes this problem, mimicking the same
> scenario with DefaultTableModel works just fine.
> ObservableListTableModel handles all the remove operations correctly,
> all the required events are fired... but still.
> 
> Could anyone help me?
> 
> Thank you!
> 
> 
> 
> A simple demo to demonstrate the issue - run and click the "Remove"
> button:the result will be just like it on the attached screenshot.
> 
> SwingUtilities.invokeLater(new Runnable() {
> 
> 			@Override
> 			public void run() {
> 				SwingRealm.createDefault();
> 				final IObservableList l = WritableList.withElementType(Object.class);
> 				l.add("1");
> 				l.add("2");
> 				l.add("3");
> 				ObservableListTableModel model = new ObservableListTableModel(l);
> 				model.addColumn("val");
> 				JTable t = new JTable(model);
> 
> 				JFrame f = new JFrame();
> 				f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
> 				f.setLayout(new BorderLayout());
> 				f.add(t, BorderLayout.CENTER);
> 				f.add(new JButton(new AbstractAction("Remove") {
> 
> 					@Override
> 					public void actionPerformed(ActionEvent e) {
> 						l.removeAll(Arrays.asList("1", "2"));
> 					}
> 				}), BorderLayout.NORTH);
> 
> 				f.pack();
> 				f.setVisible(true);
> 			}
> 		});
> 
> 
> 
> _______________________________________________
> ufk-dev mailing list
> ufk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/ufk-dev


-- 
B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl                                        geschaeftsfuehrer/CEO
------------------------------------------------------------------------
eduard-bodem-gasse 5/1    A-6020 innsbruck      phone    ++43 512 935834


Back to the top