use of net.sourceforge.nattable.resize.command.InitializeAutoResizeColumnsCommand in project translationstudio8 by heartsome.
the class AutoResizeColumnAction 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 column = CellEdgeDetectUtil.getColumnPositionToResize(natTable, clickPoint);
InitializeAutoResizeColumnsCommand command = new InitializeAutoResizeColumnsCommand(natTable, column, natTable.getConfigRegistry(), gc);
natTable.doCommand(command);
}
use of net.sourceforge.nattable.resize.command.InitializeAutoResizeColumnsCommand in project translationstudio8 by heartsome.
the class InitializeAutoResizeColumnsCommandHandler method doCommand.
@Override
protected boolean doCommand(InitializeAutoResizeColumnsCommand initCommand) {
int columnPosition = initCommand.getColumnPosition();
if (selectionLayer.isColumnFullySelected(columnPosition)) {
initCommand.setSelectedColumnPositions(selectionLayer.getFullySelectedColumnPositions());
} else {
initCommand.setSelectedColumnPositions(new int[] { columnPosition });
}
// Fire command carrying the selected columns
initCommand.getSourceLayer().doCommand(new AutoResizeColumnsCommand(initCommand));
return true;
}
use of net.sourceforge.nattable.resize.command.InitializeAutoResizeColumnsCommand in project translationstudio8 by heartsome.
the class MenuItemProviders method autoResizeColumnMenuItemProvider.
public static IMenuItemProvider autoResizeColumnMenuItemProvider() {
return new IMenuItemProvider() {
public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
MenuItem autoResizeColumns = new MenuItem(popupMenu, SWT.PUSH);
autoResizeColumns.setText("Auto resize column");
autoResizeColumns.setImage(GUIHelper.getImage("auto_resize"));
autoResizeColumns.setEnabled(true);
autoResizeColumns.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
int columnPosition = getNatEventData(event).getColumnPosition();
natTable.doCommand(new InitializeAutoResizeColumnsCommand(natTable, columnPosition, natTable.getConfigRegistry(), new GC(natTable)));
}
});
}
};
}
use of net.sourceforge.nattable.resize.command.InitializeAutoResizeColumnsCommand in project translationstudio8 by heartsome.
the class MenuItemProviders method autoResizeAllSelectedColumnMenuItemProvider.
public static IMenuItemProvider autoResizeAllSelectedColumnMenuItemProvider() {
return new IMenuItemProvider() {
public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
MenuItem autoResizeColumns = new MenuItem(popupMenu, SWT.PUSH);
autoResizeColumns.setText("Auto resize all selected columns");
autoResizeColumns.setEnabled(true);
autoResizeColumns.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
int columnPosition = getNatEventData(event).getColumnPosition();
natTable.doCommand(new InitializeAutoResizeColumnsCommand(natTable, columnPosition, natTable.getConfigRegistry(), new GC(natTable)));
}
});
}
};
}
Aggregations