use of net.sourceforge.nattable.ui.NatEventData in project translationstudio8 by heartsome.
the class SortColumnAction method run.
public void run(NatTable natTable, MouseEvent event) {
int columnPosition = ((NatEventData) event.data).getColumnPosition();
natTable.doCommand(new SortColumnCommand(natTable, columnPosition, accumulate));
}
use of net.sourceforge.nattable.ui.NatEventData in project translationstudio8 by heartsome.
the class CellLabelMouseEventMatcher method matches.
@Override
public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
NatEventData eventData = NatEventData.createInstanceFromEvent(event);
LabelStack customLabels = natTable.getConfigLabelsByPosition(eventData.getColumnPosition(), eventData.getRowPosition());
return super.matches(natTable, event, regionLabels) && customLabels.getLabels().contains(labelToMatch);
}
use of net.sourceforge.nattable.ui.NatEventData in project translationstudio8 by heartsome.
the class ButtonCellPainter method run.
/**
* Respond to mouse click. Simulate button press.
*/
public void run(final NatTable natTable, MouseEvent event) {
NatEventData eventData = (NatEventData) event.data;
columnPosClicked = eventData.getColumnPosition();
rowPosClicked = eventData.getRowPosition();
recentlyClicked = true;
new Timer().schedule(getButtonFlashTimerTask(natTable), buttonFlashTime);
natTable.fireLayerEvent(new CellVisualChangeEvent(natTable, columnPosClicked, rowPosClicked));
for (IMouseAction listener : clickLiseners) {
listener.run(natTable, event);
}
}
use of net.sourceforge.nattable.ui.NatEventData in project translationstudio8 by heartsome.
the class MenuItemProviders method inspectLabelsMenuItemProvider.
public static IMenuItemProvider inspectLabelsMenuItemProvider() {
return new IMenuItemProvider() {
public void addMenuItem(NatTable natTable, Menu popupMenu) {
MenuItem inspectLabelsMenuItem = new MenuItem(popupMenu, SWT.PUSH);
inspectLabelsMenuItem.setText("Debug info");
inspectLabelsMenuItem.setEnabled(true);
inspectLabelsMenuItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
NatEventData natEventData = getNatEventData(e);
NatTable natTable = natEventData.getNatTable();
int columnPosition = natEventData.getColumnPosition();
int rowPosition = natEventData.getRowPosition();
String msg = "Display mode: " + natTable.getDisplayModeByPosition(columnPosition, rowPosition) + "\nConfig labels: " + natTable.getConfigLabelsByPosition(columnPosition, rowPosition) + "\nData value: " + natTable.getDataValueByPosition(columnPosition, rowPosition) + "\n\nColumn position: " + columnPosition + "\nColumn index: " + natTable.getColumnIndexByPosition(columnPosition) + "\n\nRow position: " + rowPosition + "\nRow index: " + natTable.getRowIndexByPosition(rowPosition);
MessageBox messageBox = new MessageBox(natTable.getShell(), SWT.ICON_INFORMATION | SWT.OK);
messageBox.setText("Debug Information");
messageBox.setMessage(msg);
messageBox.open();
}
});
}
};
}
Aggregations