use of net.sourceforge.nattable.resize.command.InitializeAutoResizeRowsCommand in project translationstudio8 by heartsome.
the class InitializeAutoResizeRowsCommandHandler method doCommand.
@Override
protected boolean doCommand(InitializeAutoResizeRowsCommand initCommand) {
int rowPosition = initCommand.getRowPosition();
if (selectionLayer.isRowFullySelected(rowPosition)) {
initCommand.setSelectedRowPositions(selectionLayer.getFullySelectedRowPositions());
} else {
initCommand.setSelectedRowPositions(new int[] { rowPosition });
}
// Fire command carrying the selected columns
initCommand.getSourceLayer().doCommand(new AutoResizeRowsCommand(initCommand));
return true;
}
use of net.sourceforge.nattable.resize.command.InitializeAutoResizeRowsCommand in project translationstudio8 by heartsome.
the class AutoResizeRowAction method run.
public void run(NatTable natTable, MouseEvent event) {
if (gc == null) {
gc = new GC(natTable);
natTable.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
gc.dispose();
}
});
}
Point clickPoint = new Point(event.x, event.y);
int row = CellEdgeDetectUtil.getRowPositionToResize(natTable, clickPoint);
InitializeAutoResizeRowsCommand command = new InitializeAutoResizeRowsCommand(natTable, row, natTable.getConfigRegistry(), gc);
natTable.doCommand(command);
}
use of net.sourceforge.nattable.resize.command.InitializeAutoResizeRowsCommand in project translationstudio8 by heartsome.
the class MenuItemProviders method autoResizeRowMenuItemProvider.
public static IMenuItemProvider autoResizeRowMenuItemProvider() {
return new IMenuItemProvider() {
public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
MenuItem autoResizeRows = new MenuItem(popupMenu, SWT.PUSH);
autoResizeRows.setText("Auto resize row");
autoResizeRows.setEnabled(true);
autoResizeRows.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
int rowPosition = getNatEventData(event).getRowPosition();
natTable.doCommand(new InitializeAutoResizeRowsCommand(natTable, rowPosition, natTable.getConfigRegistry(), new GC(natTable)));
}
});
}
};
}
Aggregations