Search in sources :

Example 1 with InitializeAutoResizeRowsCommand

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;
}
Also used : AutoResizeRowsCommand(net.sourceforge.nattable.resize.command.AutoResizeRowsCommand) InitializeAutoResizeRowsCommand(net.sourceforge.nattable.resize.command.InitializeAutoResizeRowsCommand)

Example 2 with InitializeAutoResizeRowsCommand

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);
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) InitializeAutoResizeRowsCommand(net.sourceforge.nattable.resize.command.InitializeAutoResizeRowsCommand) Point(org.eclipse.swt.graphics.Point) GC(org.eclipse.swt.graphics.GC) DisposeEvent(org.eclipse.swt.events.DisposeEvent) Point(org.eclipse.swt.graphics.Point)

Example 3 with InitializeAutoResizeRowsCommand

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)));
                }
            });
        }
    };
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) InitializeAutoResizeRowsCommand(net.sourceforge.nattable.resize.command.InitializeAutoResizeRowsCommand) NatTable(net.sourceforge.nattable.NatTable) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) GC(org.eclipse.swt.graphics.GC)

Aggregations

InitializeAutoResizeRowsCommand (net.sourceforge.nattable.resize.command.InitializeAutoResizeRowsCommand)3 GC (org.eclipse.swt.graphics.GC)2 NatTable (net.sourceforge.nattable.NatTable)1 AutoResizeRowsCommand (net.sourceforge.nattable.resize.command.AutoResizeRowsCommand)1 DisposeEvent (org.eclipse.swt.events.DisposeEvent)1 DisposeListener (org.eclipse.swt.events.DisposeListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Point (org.eclipse.swt.graphics.Point)1 Menu (org.eclipse.swt.widgets.Menu)1 MenuItem (org.eclipse.swt.widgets.MenuItem)1