How to resolve Nattable conflicts between DefaultRowSelectionLayerConfiguration and ButtonCellPainter on left mouse keydown event? -
i developing rcp application, , using nebula's nattable that. configer row selection (use defaultrowselectionlayerconfiguration) , , configer cell button (use buttoncellpainter) . both ui bing left mouse down event.
what want is:
when click left mouse button, button responds event while button of whole row selected.
below part code:
selectionlayer = new selectionlayer(columnhideshowlayer,false); selectionlayer.setselectionmodel(new rowselectionmodel<row>(selectionlayer, bodydataprovider, new irowidaccessor<row>() { @override public serializable getrowid(row rowobject) { return rowobject.getstatus(); } })); selectionlayer.addconfiguration(new defaultrowselectionlayerconfiguration()); class buttonclickconfiguration<t> extends abstractuibindingconfiguration { private final buttoncellpainter buttoncellpainter; public buttonclickconfiguration(buttoncellpainter buttoncellpainter) { this.buttoncellpainter = buttoncellpainter; } @override public void configureuibindings(uibindingregistry uibindingregistry) { // match mouse event on body, when left button clicked // , custom cell label present celllabelmouseeventmatcher mouseeventmatcher = new celllabelmouseeventmatcher(gridregion.body,mouseeventmatcher.left_button, custom_cell_label5); // inform button painter of click. uibindingregistry.registermousedownbinding(mouseeventmatcher, this.buttoncellpainter); } }
i research source code , find uibindingregistry code:
private imouseaction getmouseeventaction(mouseeventtypeenum mouseeventtype, mouseevent event) {
// todo: code can made more performant mapping mouse bindings // not mouseeventtype // region interested in. way, given // area , event can narrow down // list of mouse bindings need searched. -- azubuko.obele try { linkedlist<mousebinding> mouseeventbindings = this.mousebindingsmap .get(mouseeventtype); if (mouseeventbindings != null) { labelstack regionlabels = this.nattable.getregionlabelsbyxy(event.x, event.y); (mousebinding mousebinding : mouseeventbindings) { if (mousebinding.getmouseeventmatcher().matches(this.nattable, event, regionlabels)) { return mousebinding.getaction(); } } } } catch (exception e) { e.printstacktrace(); } return null;
}
if mousedown event bing 2 event, first able perform.what should do? can think of way select row of data @ same time simulation of cell button press action, don't know how simulate action of cell button.
any appreciated.
if want multiple actions performed on 1 interaction, need create custom action executes both desired actions together.
i showed here performing selection , menu opening. showing nattable context menu
Comments
Post a Comment