Package org.eclipse.nebula.widgets.nattable.selection

Examples of org.eclipse.nebula.widgets.nattable.selection.MoveCellSelectionCommandHandler


public class DefaultMoveSelectionConfiguration extends
        AbstractLayerConfiguration<SelectionLayer> {

    @Override
    public void configureTypedLayer(SelectionLayer layer) {
        layer.registerCommandHandler(new MoveCellSelectionCommandHandler(layer));
    }
View Full Code Here


        viewportLayer.setRegionName(GridRegion.BODY);

        // register a MoveCellSelectionCommandHandler with
        // AXIS_CYCLE_TRAVERSAL_STRATEGY
        viewportLayer.registerCommandHandler(
                new MoveCellSelectionCommandHandler(selectionLayer, ITraversalStrategy.AXIS_CYCLE_TRAVERSAL_STRATEGY));

        natTable = new NatTable(panel, viewportLayer);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);

        // 3. TABLE traversal
        bodyDataLayer = new DataLayer(bodyDataProvider);
        selectionLayer = new SelectionLayer(bodyDataLayer);
        viewportLayer = new ViewportLayer(selectionLayer);
        // as the selection mouse bindings are registered for the region label
        // GridRegion.BODY we need to set that region label to the viewport so
        // the selection via mouse is working correctly
        viewportLayer.setRegionName(GridRegion.BODY);

        // register a MoveCellSelectionCommandHandler with
        // TABLE_TRAVERSAL_STRATEGY
        viewportLayer.registerCommandHandler(
                new MoveCellSelectionCommandHandler(selectionLayer, ITraversalStrategy.TABLE_TRAVERSAL_STRATEGY));

        natTable = new NatTable(panel, viewportLayer);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);

        // 4. TABLE CYCLE traversal
        bodyDataLayer = new DataLayer(bodyDataProvider);
        selectionLayer = new SelectionLayer(bodyDataLayer);
        viewportLayer = new ViewportLayer(selectionLayer);
        // as the selection mouse bindings are registered for the region label
        // GridRegion.BODY we need to set that region label to the viewport so
        // the selection via mouse is working correctly
        viewportLayer.setRegionName(GridRegion.BODY);

        // register a MoveCellSelectionCommandHandler with
        // TABLE_CYCLE_TRAVERSAL_STRATEGY
        viewportLayer.registerCommandHandler(
                new MoveCellSelectionCommandHandler(selectionLayer, ITraversalStrategy.TABLE_CYCLE_TRAVERSAL_STRATEGY));

        natTable = new NatTable(panel, viewportLayer);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);

        // 5. mixed traversal
        // on left/right we will use TABLE CYCLE
        // on up/down we will use AXIS CYCLE
        bodyDataLayer = new DataLayer(bodyDataProvider);
        selectionLayer = new SelectionLayer(bodyDataLayer);
        viewportLayer = new ViewportLayer(selectionLayer);
        // as the selection mouse bindings are registered for the region label
        // GridRegion.BODY we need to set that region label to the viewport so
        // the selection via mouse is working correctly
        viewportLayer.setRegionName(GridRegion.BODY);

        // register a MoveCellSelectionCommandHandler with
        // TABLE_CYCLE_TRAVERSAL_STRATEGY for horizontal traversal
        // and AXIS_CYCLE_TRAVERSAL_STRATEGY for vertical traversal
        // NOTE:
        // You could achieve the same by registering a command handler
        // with TABLE_CYCLE_TRAVERSAL_STRATEGY and registering
        // MoveSelectionActions with a customized ITraversalStrategy, e.g.
        // AXIS_CYCLE_TRAVERSAL_STRATEGY
        viewportLayer.registerCommandHandler(
                new MoveCellSelectionCommandHandler(selectionLayer,
                        ITraversalStrategy.TABLE_CYCLE_TRAVERSAL_STRATEGY, ITraversalStrategy.AXIS_CYCLE_TRAVERSAL_STRATEGY));

        natTable = new NatTable(panel, viewportLayer);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);

        // 6. edit traversal traversal
        // on left/right we will use TABLE CYCLE
        // on up/down we will use AXIS CYCLE
        bodyDataLayer = new DataLayer(bodyDataProvider);
        selectionLayer = new SelectionLayer(bodyDataLayer);
        viewportLayer = new ViewportLayer(selectionLayer);
        // as the selection mouse bindings are registered for the region label
        // GridRegion.BODY we need to set that region label to the viewport so
        // the selection via mouse is working correctly
        viewportLayer.setRegionName(GridRegion.BODY);

        final ColumnOverrideLabelAccumulator columnLabelAccumulator =
                new ColumnOverrideLabelAccumulator(bodyDataLayer);
        bodyDataLayer.setConfigLabelAccumulator(columnLabelAccumulator);
        registerColumnLabels(columnLabelAccumulator);

        // add some edit configuration
        viewportLayer.addConfiguration(new DefaultEditBindings());
        viewportLayer.addConfiguration(new DefaultEditConfiguration());
        viewportLayer.addConfiguration(new EditorConfiguration());

        natTable = new NatTable(panel, viewportLayer);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);

        // register a MoveCellSelectionCommandHandler with
        // TABLE_CYCLE_TRAVERSAL_STRATEGY for horizontal traversal
        // and AXIS_CYCLE_TRAVERSAL_STRATEGY for vertical traversal
        // NOTE:
        // You could achieve the same by registering a command handler
        // with TABLE_CYCLE_TRAVERSAL_STRATEGY and registering
        // MoveSelectionActions with a customized ITraversalStrategy, e.g.
        // AXIS_CYCLE_TRAVERSAL_STRATEGY
        viewportLayer.registerCommandHandler(
                new MoveCellSelectionCommandHandler(selectionLayer,
                        new EditTraversalStrategy(ITraversalStrategy.TABLE_CYCLE_TRAVERSAL_STRATEGY, natTable),
                        new EditTraversalStrategy(ITraversalStrategy.AXIS_CYCLE_TRAVERSAL_STRATEGY, natTable)));

        return panel;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.selection.MoveCellSelectionCommandHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.