|
|
|
Re: Wrong order after inserting a row into a NatTable [message #1811116 is a reply to message #1811109] |
Tue, 27 August 2019 06:57 |
Dirk Fauth Messages: 2902 Registered: July 2012 |
Senior Member |
|
|
I used the _5083_ColumnAndRowReorderExample but also tested now with _5082_RowReorderExample where it works as expected. Do you see the same issue in those examples? For testing I simply added a header configuration to add a menu to the corner region.
final NatTable natTable = new NatTable(panel, gridLayer, false);
// as the autoconfiguration of the NatTable is turned off, we have to
// add the DefaultNatTableStyleConfiguration manually
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
// add the corner menu configuration for adding the view management
// action
natTable.addConfiguration(new AbstractHeaderMenuConfiguration(natTable) {
@Override
protected PopupMenuBuilder createCornerMenu(NatTable natTable) {
return super.createCornerMenu(natTable)
.withStateManagerMenuItemProvider()
.withMenuItemProvider(new IMenuItemProvider() {
@Override
public void addMenuItem(NatTable natTable, Menu popupMenu) {
// TODO Auto-generated method stub
MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
menuItem.setText("add");
menuItem.setEnabled(true);
menuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
int newPos = persons.size();
persons.add(new Person(newPos, "Ralph", "Wiggum", Gender.MALE, false, new Date()));
bodyDataLayer.fireLayerEvent(new RowInsertEvent(bodyDataLayer, newPos));
}
});
}
});
}
});
natTable.configure();
But those examples do not use GlazedLists. And it looks like the GlazedListsEventLayer is actually responsible for the behavior. That layer is a listener on the GlazedLists instance and fires a structural change event without details in case of changes.
You could try to use the DetailGlazedListsEventLayer which is creating events with detail information for list changes. Using that it worked for me in a modified example.
If you see an issue with that layer, please let me know soon. I am about to finish 1.6. But while preparing the release documents I could fix smaller things.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04768 seconds