• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SelectionLayer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.nebula.widgets.nattable.selection.SelectionLayer的典型用法代码示例。如果您正苦于以下问题:Java SelectionLayer类的具体用法?Java SelectionLayer怎么用?Java SelectionLayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SelectionLayer类属于org.eclipse.nebula.widgets.nattable.selection包,在下文中一共展示了SelectionLayer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSelectedRowPosition

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
public int getSelectedRowPosition() {
    if (compositeLayer != null) {
        SelectionLayer selectionLayer = compositeLayer.getSelectionLayer();

        final Set<Range> selectedRows = selectionLayer.getSelectedRowPositions();
        List<Integer> selectedRowPositions = new ArrayList<Integer>();
        for (Range range : selectedRows) {
            for (int rowPosition = range.start; rowPosition < range.end; rowPosition++) {
                // + 1
                selectedRowPositions.add(rowPosition + 1);
            }
        }
        Collections.sort(selectedRowPositions);

        // at this moment return only first
        if (selectedRowPositions.size() > 0) {
            return selectedRowPositions.get(0).intValue();
        }
    }
    return -1;
}
 
开发者ID:e4c,项目名称:EclipseCommander,代码行数:22,代码来源:PathNatTable.java


示例2: construct

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
@Override
public Control construct(Composite parent) {
	Composite content = new Composite(parent, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(content);
	GridLayoutFactory.fillDefaults().numColumns(1).applyTo(content);

	CompositeLayer layer = new CompositeLayer(1, 1);
	layer.setChildLayer(GridRegion.BODY,
			new ViewportLayer(
					new SelectionLayer(new SpanningDataLayer(new DummySpanningBodyDataProvider(1000000, 1000000)))),
			0, 0);
	NatTable table = new NatTable(content, layer);
	
	GridDataFactory.fillDefaults().grab(true, true).applyTo(table);

	return content;
}
 
开发者ID:xored,项目名称:q7.quality.mockups,代码行数:18,代码来源:NatTableDemo1.java


示例3: addSelectionListener

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
/**
 * Adds a selection listener.
 *
 * @param layer
 */
private void addSelectionListener(final SelectionLayer layer) {
    layer.addLayerListener(new ILayerListener(){
        @Override
        public void handleLayerEvent(ILayerEvent arg0) {
            if (arg0 instanceof CellSelectionEvent) {
                if (!actionCellSelected((CellSelectionEvent)arg0)){
                    layer.clear(true);
                }
            } else if (arg0 instanceof ColumnSelectionEvent) {
                if (!actionColumnSelected((ColumnSelectionEvent)arg0)){
                    layer.clear(true);
                }
            } else if (arg0 instanceof RowSelectionEvent) {
                if (!actionRowSelected((RowSelectionEvent)arg0)) {
                    layer.clear(true);
                }
            }
        }
    });

}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:27,代码来源:ComponentTable.java


示例4: init

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
public void init(){
		rowCount=1;
		
		bodyDataProvider=new DodyDataProvider();
		bodyDataLayer=new DataLayer(bodyDataProvider, colWidth, rowHeight);
		selectionLayer = new SelectionLayer(bodyDataLayer);
		selectionLayer.addConfiguration(new DefaultSelectionLayerConfiguration());
		selectionLayer.addLayerListener(layerListener);
		viewportLayer = new ViewportLayer(selectionLayer);
		viewportLayer.setRegionName(GridRegion.BODY);
		
		columnSpanHeaderDataProvider=new ColumnSpanHeaderDataProvider();
		columnSpanHeaderDataLayer=new SpanningDataLayer(columnSpanHeaderDataProvider, colWidth, rowHeight);
//		columnHeaderLayer = new ColumnSpanHeaderLayer(columnSpanHeaderDataLayer, viewportLayer, selectionLayer, false);
		columnSpanHeaderSelectionLayer=new SelectionLayer(columnSpanHeaderDataLayer);
		columnHeaderLayer = new ColumnSpanHeaderLayer(columnSpanHeaderSelectionLayer, viewportLayer, selectionLayer, false);
		
		rowSpanHeaderDataProvider=new RowSpanHeaderDataProvider();
		rowSpanHeaderDataLayer=new SpanningDataLayer(rowSpanHeaderDataProvider, colWidth*2, rowHeight);
		rowHeaderLayer = new RowSpanHeaderLayer(rowSpanHeaderDataLayer, viewportLayer, selectionLayer, false);
		
		cornerDataProvider = new DefaultCornerDataProvider(columnSpanHeaderDataProvider, rowSpanHeaderDataProvider);
		cornerDataLayer = new DataLayer(cornerDataProvider, colWidth, rowHeight);
		cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
		
		gridLayer = new GridLayer(viewportLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
	}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:28,代码来源:InstanceTable.java


示例5: ColumnSpanHeaderLayer

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
public ColumnSpanHeaderLayer(IUniqueIndexLayer baseLayer,
		ILayer horizontalLayerDependency,
		SelectionLayer selectionLayer, boolean useDefaultConfiguration,
		ILayerPainter layerPainter) {
	super(baseLayer, horizontalLayerDependency, selectionLayer,
			useDefaultConfiguration, layerPainter);
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:8,代码来源:InstanceTable.java


示例6: clearSelection

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
/**
 * clear selection
 */
public void clearSelection() {
    SelectionLayer selLayer = getSelectionLayer();
    if (selLayer != null) {
        selLayer.clear();
    }
}
 
开发者ID:e4c,项目名称:EclipseCommander,代码行数:10,代码来源:PathNatTable.java


示例7: setDefaultSelection

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
/**
 * select first row in the table
 */
public void setDefaultSelection() {
    SelectionLayer selLayer = getSelectionLayer();
    if (selLayer != null) {
        selLayer.selectRow(0, 0, false, false);
    }
}
 
开发者ID:e4c,项目名称:EclipseCommander,代码行数:10,代码来源:PathNatTable.java


示例8: hasSelection

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
/**
 * @return true if selection layer have selected rows
 */
public boolean hasSelection() {
    SelectionLayer selLayer = getSelectionLayer();
    if (selLayer != null && selLayer.hasRowSelection()) {
        return true;
    }
    return false;
}
 
开发者ID:e4c,项目名称:EclipseCommander,代码行数:11,代码来源:PathNatTable.java


示例9: BodyLayerStack

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
public BodyLayerStack(List<T> values,
        IColumnPropertyAccessor<T> columnPropertyAccessor,
        ColumnGroupModel... columnGroupModel) {
    // wrapping of the list to show into GlazedLists
    // see http://publicobject.com/glazedlists/ for further information
    EventList<T> eventList = GlazedLists.eventList(values);
    TransformedList<T, T> rowObjectsGlazedList = GlazedLists.threadSafeList(eventList);

    // use the SortedList constructor with 'null' for the Comparator
    // because the Comparator will be set by configuration
    this.sortedList = new SortedList<T>(rowObjectsGlazedList, null);
    // wrap the SortedList with the FilterList
    this.filterList = new FilterList<T>(getSortedList());

    this.bodyDataProvider =
            new ListDataProvider<T>(this.filterList, columnPropertyAccessor);
    DataLayer bodyDataLayer = new DataLayer(this.bodyDataProvider);

    // layer for event handling of GlazedLists and PropertyChanges
    GlazedListsEventLayer<T> glazedListsEventLayer =
            new GlazedListsEventLayer<T>(bodyDataLayer, this.filterList);

    this.columnReorderLayer = new ColumnReorderLayer(glazedListsEventLayer);
    this.columnGroupReorderLayer =
            new ColumnGroupReorderLayer(this.columnReorderLayer, columnGroupModel[columnGroupModel.length - 1]);
    this.columnHideShowLayer = new ColumnHideShowLayer(this.columnGroupReorderLayer);
    this.columnGroupExpandCollapseLayer =
            new ColumnGroupExpandCollapseLayer(this.columnHideShowLayer, columnGroupModel);
    this.selectionLayer = new SelectionLayer(this.columnGroupExpandCollapseLayer);
    this.viewportLayer = new ViewportLayer(this.selectionLayer);

    final FreezeLayer freezeLayer = new FreezeLayer(this.selectionLayer);
    final CompositeFreezeLayer compositeFreezeLayer =
            new CompositeFreezeLayer(freezeLayer, this.viewportLayer, this.selectionLayer);

    setUnderlyingLayer(compositeFreezeLayer);
}
 
开发者ID:xored,项目名称:q7.quality.mockups,代码行数:38,代码来源:SortableFilterableColumnGroupExample.java


示例10: SelectionExampleBodyLayerStack

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
public SelectionExampleBodyLayerStack(IUniqueIndexLayer underlyingLayer) {
    this.columnReorderLayer = new ColumnReorderLayer(underlyingLayer);
    this.columnHideShowLayer = new ColumnHideShowLayer(this.columnReorderLayer);

    // No autoconfig on selection layer
    this.selectionLayer = new SelectionLayer(this.columnHideShowLayer, false);

    this.viewportLayer = new ViewportLayer(this.selectionLayer);
    setUnderlyingLayer(this.viewportLayer);

    registerCommandHandler(new CopyDataCommandHandler(this.selectionLayer));
}
 
开发者ID:xored,项目名称:q7.quality.mockups,代码行数:13,代码来源:SelectionExampleBodyLayerStack.java


示例11: RowSpanHeaderLayer

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
public RowSpanHeaderLayer(IUniqueIndexLayer baseLayer,
		ILayer verticalLayerDependency, SelectionLayer selectionLayer,
		boolean useDefaultConfiguration, ILayerPainter layerPainter) {
	super(baseLayer, verticalLayerDependency, selectionLayer,
			useDefaultConfiguration, layerPainter);
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:7,代码来源:InstanceTable.java


示例12: getSelectionLayer

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
public SelectionLayer getSelectionLayer() {
    return selectionLayer;
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:4,代码来源:NatTableLayers.java


示例13: RowIndexSelectionModel

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
RowIndexSelectionModel(final IDataProvider dataProvider, final SelectionLayer selectionLayer) {
    super(selectionLayer, new RowIndexDataProvider(dataProvider), new RowIndexAccessor());
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:4,代码来源:RowIndexSelectionModel.java


示例14: selectCell

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
@Override
public void selectCell(
    final int columnPosition,
    final int rowPosition,
    final boolean withShiftMask,
    final boolean withControlMask) {

    if (!withShiftMask && !withControlMask) {
        this.selectionLayer.clear(false);
    }

    final ILayerCell cell = this.selectionLayer.getCellByPosition(columnPosition, rowPosition);

    if (cell != null) {
        this.selectionLayer.setLastSelectedCell(cell.getOriginColumnPosition(), cell.getOriginRowPosition());

        if (this.selectionLayer.getSelectionModel().isMultipleSelectionAllowed()
            && withShiftMask
            && this.selectionLayer.getLastSelectedRegion() != null
            && this.selectionLayer.hasRowSelection()
            && (this.selectionLayer.getSelectionAnchor().rowPosition != SelectionLayer.NO_SELECTION)
            && (this.selectionLayer.getSelectionAnchor().columnPosition != SelectionLayer.NO_SELECTION)) {

            final Rectangle lastSelected = copyRectangle(this.selectionLayer.getLastSelectedRegion());

            final Interval<Integer> newSelection = createOrderedInterval(
                    this.selectionLayer.getSelectionAnchor().rowPosition,
                    cell.getOriginRowPosition());

            lastSelected.height = calcDistance(newSelection) + 1;
            lastSelected.y = newSelection.getLeftBoundary();

            if (!withControlMask) {
                selectionLayer.getSelectionModel().clearSelection();
            }

            this.selectionLayer.setLastSelectedRegion(lastSelected);
            this.selectionLayer.addSelection(lastSelected);
        }
        else {
            this.selectionLayer.setLastSelectedRegion(null);
            final Rectangle selection = new Rectangle(
                cell.getOriginColumnPosition(),
                cell.getOriginRowPosition(),
                cell.getColumnSpan(),
                cell.getRowSpan());

            this.selectionLayer.addSelection(selection);
        }
    }
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:52,代码来源:JoSelectCellCommandHandler.java


示例15: getSelectionLayer

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
SelectionLayer getSelectionLayer() {
    return selectionLayer;
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:4,代码来源:BodyLayerStack.java


示例16: getSelectionLayer

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
private SelectionLayer getSelectionLayer() {
    if (compositeLayer != null) {
        return compositeLayer.getSelectionLayer();
    }
    return null;
}
 
开发者ID:e4c,项目名称:EclipseCommander,代码行数:7,代码来源:PathNatTable.java


示例17: PathCompositeLayer

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
/**
 * Constructor
 *
 * @param rootPath
 * @param eventBroker
 */
public PathCompositeLayer(Path rootPath, IEventBroker eventBroker) {
    super(1, 2);

    this.rootPath = rootPath;
    fillContentList(rootPath);

    // TODO
    propertyToLabelMap.put(PathFixture.FIELD_NAME, "Name");
    propertyToLabelMap.put(PathFixture.FIELD_SIZE, "Size");
    propertyToLabelMap.put(PathFixture.FIELD_ATTRS, "Attr");

    columnPropertyAccessor = new PathColumnPropertyAccessor(propertyToLabelMap, rootPath);
    bodyDataProvider = new ListDataProvider<PathFixture>(this.contentlist, columnPropertyAccessor);

    bodyDataLayer = new DataLayer(bodyDataProvider);

    // set columns fixed percentage sizing
    bodyDataLayer.setColumnWidthPercentageByPosition(0, 80);
    bodyDataLayer.setColumnWidthPercentageByPosition(1, 10);
    bodyDataLayer.setColumnWidthPercentageByPosition(2, 10);

    selectionLayer = new SelectionLayer(bodyDataLayer, false);
    ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);

    // use a RowSelectionModel that will perform row selections and is able
    // to identify a row via unique ID
    selectionLayer.setSelectionModel(new RowSelectionModel<PathFixture>(selectionLayer, bodyDataProvider,
            new PathFixtureRowIdAccessor(this.contentlist)));

    // register different selection move command handler that always moves
    // by row
    selectionLayer.addConfiguration(new RowOnlySelectionConfiguration<PathFixture>());

    // register path handler
    OpenPathHandler pathHandler = new OpenPathHandler(selectionLayer, bodyDataProvider, eventBroker);
    viewportLayer.registerCommandHandler(pathHandler);

    // register selection bindings that will perform row selections instead
    // of cell selections
    // registering the bindings on a layer that is above the SelectionLayer
    // will consume the
    // commands before they are handled by the SelectionLayer
    viewportLayer.addConfiguration(new PathSelectionUiBinding());

    ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(new SimpleColumnHeaderDataProvider(
            propertyToLabelMap)), viewportLayer, selectionLayer);

    setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 0, 0);
    setChildLayer(GridRegion.BODY, viewportLayer, 0, 1);

}
 
开发者ID:e4c,项目名称:EclipseCommander,代码行数:58,代码来源:PathCompositeLayer.java


示例18: getSelectionLayer

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
public SelectionLayer getSelectionLayer() {
    return this.selectionLayer;
}
 
开发者ID:xored,项目名称:q7.quality.mockups,代码行数:4,代码来源:SortableFilterableColumnGroupExample.java


示例19: getSelectionLayer

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
public SelectionLayer getSelectionLayer() {
    return this.bodyLayer.getSelectionLayer();
}
 
开发者ID:xored,项目名称:q7.quality.mockups,代码行数:4,代码来源:SelectionExampleGridLayer.java


示例20: init

import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; //导入依赖的package包/类
/**
 * Initialize.
 *
 * @param bodyDataLayer
 * @param columnHeaderDataLayer
 * @param rowHeaderDataLayer
 * @param cornerDataLayer
 * @param parent
 */
protected void init(final IUniqueIndexLayer bodyDataLayer,
                    IUniqueIndexLayer columnHeaderDataLayer,
                    IUniqueIndexLayer rowHeaderDataLayer,
                    IUniqueIndexLayer cornerDataLayer,
                    Control parent) {
    // Body
    this.bodyDataLayer = bodyDataLayer;
    DataTableBodyLayerStack bodyLayer = new DataTableBodyLayerStack(bodyDataLayer, table, context, parent);

    SelectionLayer selectionLayer = bodyLayer.getSelectionLayer();

    // Column header
    this.columnHeaderDataLayer = columnHeaderDataLayer;
    ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayer, selectionLayer);
    
    // Configure the column resize action
    ((ColumnHeaderLayer) columnHeaderLayer).addConfiguration(new AbstractUiBindingConfiguration() {
        @Override
        public void configureUiBindings(UiBindingRegistry paramUiBindingRegistry) {
            paramUiBindingRegistry.registerFirstDoubleClickBinding(new ColumnResizeEventMatcher(SWT.NONE,
                                                                                                GridRegion.COLUMN_HEADER,
                                                                                                MouseEventMatcher.LEFT_BUTTON),
                                                                   new DataTableResizeColumnAction(bodyDataLayer));
        }
    });

    // Row header
    this.rowHeaderDataLayer = rowHeaderDataLayer;
    ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, bodyLayer, selectionLayer);
    bodyLayer.setRowHeaderLayer(rowHeaderLayer);
    
    // Corner
    this.cornerDataLayer = cornerDataLayer;
    ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);

    // Attach the listeners
    for (ILayerListener listener : context.getListeners()) {
        selectionLayer.addLayerListener(listener);
    }

    setBodyLayer(bodyLayer);
    setColumnHeaderLayer(columnHeaderLayer);
    setRowHeaderLayer(rowHeaderLayer);
    setCornerLayer(cornerLayer);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:55,代码来源:DataTableGridLayer.java



注:本文中的org.eclipse.nebula.widgets.nattable.selection.SelectionLayer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BaseKey类代码示例发布时间:2022-05-23
下一篇:
Java IssueEvent类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap