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

Java GridRegion类代码示例

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

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



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

示例1: registerUiBindingsToNatTable

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
public static void registerUiBindingsToNatTable(
    final NatTable table,
    final HoveredColumnConfigLabelAccumulator hoveredColumnLabelAccumulator) {

    final UiBindingRegistry uiBindingRegistry = table.getUiBindingRegistry();

    //avoid selection removed on reorder, use swt win style reorder overlay color and
    //do not allow to draw overlay column outside the header
    uiBindingRegistry.unregisterMouseDragMode(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE));
    uiBindingRegistry.registerMouseDragMode(
            MouseEventMatcher.columnHeaderLeftClick(SWT.NONE),
            new AggregateDragMode(
                new JoColumnReorderCellDragMode(),
                new JoColumnReorderDragMode(hoveredColumnLabelAccumulator)));

    //do resize immediate when user changes column width
    uiBindingRegistry.registerFirstMouseDragMode(
            new ColumnResizeEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 1),
            new ResizeImediateDragMode());
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:21,代码来源:JoNatTableConfigurator.java


示例2: addSelectedModeStyling

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
/**
 * Add selected styling to the registry.
 *
 * @param configRegistry
 */
private void addSelectedModeStyling(final IConfigRegistry configRegistry) {

    final TextPainter txtPainter = new TextPainter(false, false, true, true);
    final ICellPainter selectedCellPainter = new DataTableBackgroundImagePainter(txtPainter,
                                                                                 selectedBackground,
                                                                                 GUIHelper.getColor(192, 192, 192));

    final CellPainterDecorator selectedHeaderPainter = new CellPainterDecorator(selectedCellPainter,
                                                                                CellEdgeEnum.LEFT,
                                                                                new DataTableImagePainter(context));

    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER,
                                           selectedHeaderPainter,
                                           DisplayMode.SELECT,
                                           GridRegion.COLUMN_HEADER);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:22,代码来源:DataTableColumnHeaderConfiguration.java


示例3: configureRegistry

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
	registry = configRegistry;
	// editable
	configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE,
			IEditableRule.ALWAYS_EDITABLE);
	// style for selected cells
	Style selectStyle = new Style();
	configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, selectStyle, DisplayMode.SELECT);
	// open adjacent editor when we leave the current one during editing
	configRegistry.registerConfigAttribute(EditConfigAttributes.OPEN_ADJACENT_EDITOR, Boolean.TRUE,
			DisplayMode.EDIT);
	// style for upper left corner
	BorderStyle borderStyle = new BorderStyle();
	borderStyle.setColor(GUIHelper.COLOR_GRAY);
	configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER,
			new LineBorderDecorator(new TextPainter(), borderStyle), DisplayMode.NORMAL, GridRegion.CORNER);
	// for each column...
	for (int column = 0; column < headingProvider.getColumnCount(); column++)
		addColumn(column);
}
 
开发者ID:DaveVoorhis,项目名称:Rel,代码行数:22,代码来源:Designer.java


示例4: construct

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的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


示例5: addNormalModeStyling

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
/**
 * Add normal styling to the registry.
 *
 * @param configRegistry
 */
private void addNormalModeStyling(final IConfigRegistry configRegistry) {

    final TextPainter txtPainter = new TextPainter(false, false, true, true);
    final ICellPainter bgImagePainter = new DataTableBackgroundImagePainter(txtPainter,
                                                                            defaultBackground,
                                                                            GUIHelper.getColor(192, 192, 192));
    final SortableHeaderTextPainter headerBasePainter = new SortableHeaderTextPainter(bgImagePainter, false, true);

    final CellPainterDecorator headerPainter = new CellPainterDecorator(headerBasePainter,
                                                                        CellEdgeEnum.LEFT,
                                                                        new DataTableImagePainter(context));

    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER,
                                           headerPainter,
                                           DisplayMode.NORMAL,
                                           GridRegion.COLUMN_HEADER);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER,
                                           headerBasePainter,
                                           DisplayMode.NORMAL,
                                           GridRegion.CORNER);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:27,代码来源:DataTableColumnHeaderConfiguration.java


示例6: LayerColumnHeader

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
/**
 * Creates a new instance.
 *
 * @param parent
 * @param dataProvider
 * @param bodyLayer
 * @param config
 * @param context
 */
public LayerColumnHeader(Composite parent,
                              IDataProvider dataProvider,
                              LayerBody bodyLayer,
                              CTConfiguration config, CTContext context) {
    super(config, context);
    
    DataLayer dataLayer = new DataLayer(dataProvider);
    ColumnHeaderLayer colHeaderLayer = new ColumnHeaderLayer(dataLayer,
                                                             bodyLayer,
                                                             bodyLayer.getSelectionLayer(),
                                                             false);
    colHeaderLayer.addConfiguration(new StyleConfigurationHeader(parent, GridRegion.COLUMN_HEADER, config));
    colHeaderLayer.addConfiguration(new DefaultColumnResizeBindings());
    setUnderlyingLayer(colHeaderLayer);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:25,代码来源:LayerColumnHeader.java


示例7: init

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的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


示例8: matches

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
@Override
public boolean matches(final NatTable natTable, final MouseEvent event, final LabelStack regionLabels) {
    if (regionLabels != null && regionLabels.hasLabel(GridRegion.COLUMN_HEADER)) {
        return true;
    }
    else {
        return false;
    }
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:10,代码来源:NatTableImplSpi.java


示例9: configureRegistry

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
public void configureRegistry(IConfigRegistry configRegistry) {
	ImagePainter keyPainter = new ImagePainter(IconLoader.loadIconNormal("bullet_key"));
	CellPainterDecorator decorator = new CellPainterDecorator(new TextPainter(), CellEdgeEnum.RIGHT,
			keyPainter);
	configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER,
			new BeveledBorderDecorator(decorator), DisplayMode.NORMAL, "keycolumnintegrated");
	configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER,
			new BeveledBorderDecorator(keyPainter), DisplayMode.NORMAL, "keycolumnalone");
	BorderStyle borderStyle = new BorderStyle();
	borderStyle.setColor(GUIHelper.COLOR_GRAY);
	configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER,
			new LineBorderDecorator(new TextPainter(), borderStyle), DisplayMode.NORMAL, GridRegion.CORNER);
}
 
开发者ID:DaveVoorhis,项目名称:Rel,代码行数:14,代码来源:Editor.java


示例10: registerColumnHeaderStyle

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
private void registerColumnHeaderStyle(IConfigRegistry configRegistry) {

            Image bgImage = GUIHelper.getImageByURL("columnHeaderBg",
                    getClass().getResource("/org/eclipse/nebula/widgets/nattable/examples/resources/column_header_bg.png"));
            Image selectedBgImage = GUIHelper.getImageByURL("selectedColumnHeaderBg",
                    getClass().getResource("/org/eclipse/nebula/widgets/nattable/examples/resources/selected_column_header_bg.png"));

            TextPainter txtPainter = new TextPainter(false, false);

            ICellPainter bgImagePainter =
                    new BackgroundImagePainter(txtPainter, bgImage, GUIHelper.getColor(192, 192, 192));

            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_PAINTER,
                    bgImagePainter,
                    DisplayMode.NORMAL,
                    GridRegion.COLUMN_HEADER);
            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_PAINTER,
                    bgImagePainter,
                    DisplayMode.NORMAL,
                    GridRegion.CORNER);

            ICellPainter selectedHeaderPainter =
                    new BackgroundImagePainter(
                            txtPainter, selectedBgImage, GUIHelper.getColor(192, 192, 192));

            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_PAINTER,
                    selectedHeaderPainter,
                    DisplayMode.SELECT,
                    GridRegion.COLUMN_HEADER);
        }
 
开发者ID:xored,项目名称:q7.quality.mockups,代码行数:34,代码来源:CellPainterExample.java


示例11: addSelectedModeStyling

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
/**
 * Add selected style.
 *
 * @param configRegistry
 */
private void addSelectedModeStyling(final IConfigRegistry configRegistry) {

    final TextPainter txtPainter = new TextPainter(false, false);
    final ICellPainter selectedCellPainter = new BackgroundImagePainter(txtPainter,
                                                                        backgroundSelected,
                                                                        GUIHelper.getColor(192, 192, 192));

    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER,
                                           selectedCellPainter,
                                           DisplayMode.SELECT,
                                           GridRegion.ROW_HEADER);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:18,代码来源:DataTableRowHeaderConfiguration.java


示例12: configureHeaderHasSelectionStyle

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
/**
 * 
 *
 * @param configRegistry
 */
protected void configureHeaderHasSelectionStyle(IConfigRegistry configRegistry) {
    Style cellStyle = new Style();

    cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, selectedHeaderFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, selectedHeaderBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.FONT, font);
    
    switch (getConfig().getHorizontalAlignment()) {
        case SWT.LEFT:
            cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.LEFT);
            break;
        case SWT.RIGHT:
            cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.RIGHT);
            break;
        case SWT.CENTER:
            cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.CENTER);
            break;
    }
    cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, selectedHeaderBorderStyle);

    configRegistry.registerConfigAttribute(
            CellConfigAttributes.CELL_STYLE, 
            cellStyle, 
            DisplayMode.SELECT, 
            GridRegion.COLUMN_HEADER);
    configRegistry.registerConfigAttribute(
            CellConfigAttributes.CELL_STYLE, 
            cellStyle, 
            DisplayMode.SELECT, 
            GridRegion.CORNER);
    configRegistry.registerConfigAttribute(
            CellConfigAttributes.CELL_STYLE, 
            cellStyle, 
            DisplayMode.SELECT, 
            GridRegion.ROW_HEADER);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:42,代码来源:StyleConfigurationSelection.java


示例13: LayerRowHeader

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
/**
 * Creates a new instance.
 *
 * @param parent
 * @param dataProvider
 * @param bodyLayer
 * @param config
 * @param context
 */
public LayerRowHeader(Composite parent,
                           IDataProvider dataProvider,
                           LayerBody bodyLayer,
                           CTConfiguration config, CTContext context) {
    super(config, context);
    DataLayer dataLayer = new DataLayer(dataProvider, 50, 20);
    RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(dataLayer, bodyLayer, bodyLayer.getSelectionLayer(), false);
    rowHeaderLayer.addConfiguration(new StyleConfigurationHeader(parent, GridRegion.ROW_HEADER, config));
    rowHeaderLayer.addConfiguration(new DefaultRowResizeBindings());
    setUnderlyingLayer(rowHeaderLayer);
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:21,代码来源:LayerRowHeader.java


示例14: dragStart

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
@Override
public void dragStart(DragSourceEvent event){
	if (this.tableWrapper.getSelection().isEmpty()) {
		event.doit = false;
	} else if (!this.tableWrapper.getNatTable().getRegionLabelsByXY(event.x, event.y)
		.hasLabel(GridRegion.BODY)) {
		event.doit = false;
	}
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:10,代码来源:DragAndDropSupport.java


示例15: configureRegistry

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
	configRegistry.registerConfigAttribute(
			CellConfigAttributes.CELL_PAINTER, new ColorCellPainter(),
			"NORMAL", GridRegion.BODY);
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:7,代码来源:InstanceTable.java


示例16: configureNatTable

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
public static void configureNatTable(
    final NatTable table,
    final ITableColumnModelSpi columnModel,
    final SwtImageRegistry imageRegistry) {

    final IConfigRegistry config = table.getConfigRegistry();

    //use modern theme as base theme (so fonts look like win 7 and win 10)
    final ThemeConfiguration modernTheme = new ModernNatTableThemeConfiguration();
    table.setTheme(modernTheme);

    //use white background instead of grey to be more close to the swt win7 table
    table.setBackground(ColorCache.getInstance().getColor(Colors.WHITE));

    //use grid color from the swt table under win7
    final Color gridColor = ColorCache.getInstance().getColor(GRID_COLOR);
    config.registerConfigAttribute(CellConfigAttributes.GRID_LINE_COLOR, gridColor, DisplayMode.NORMAL, GridRegion.BODY);

    //use grid for remainder space to be more close to the swt win7 table
    final ILayerPainter gridPainter = new JoNatTableGridLayerPainter(table, gridColor, CellConstants.DEFAULT_ROW_HEIGHT);
    table.setLayerPainter(gridPainter);

    //set table header painter
    final ICellPainter headerPainter = CellPainterFactory.createHeaderPainter(imageRegistry);
    config.registerConfigAttribute(
            CellConfigAttributes.CELL_PAINTER,
            headerPainter,
            DisplayMode.NORMAL,
            GridRegion.COLUMN_HEADER);

    //disable grid because header painter paints grid by itself to allow hovered and clicked grid colors
    config.registerConfigAttribute(
            CellConfigAttributes.RENDER_GRID_LINES,
            false,
            DisplayMode.NORMAL,
            GridRegion.COLUMN_HEADER);

    //set cell painter
    final ICellPainter cellPainter = CellPainterFactory.createCellPainter(columnModel, imageRegistry);
    config.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL, GridRegion.BODY);

    //do not render dotted line for selected cell because this is ugly and selected cell can be determined by selected background
    config.registerConfigAttribute(
            SelectionConfigAttributes.SELECTION_GRID_LINE_STYLE,
            new BorderStyle(1, gridColor, LineStyleEnum.SOLID),
            DisplayMode.SELECT);

}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:49,代码来源:JoNatTableConfigurator.java


示例17: NatTableImplSpi

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
NatTableImplSpi(
    final NatTableLayers tableLayers,
    final IGenericWidgetFactory widgetFactory,
    final Object parentUiReference,
    final ITableSetupSpi setup,
    final SwtImageRegistry imageRegistry) {
    super(new NatTable((Composite) parentUiReference, getStyle(setup), tableLayers.getGridLayer()), imageRegistry);

    this.table = getUiReference();
    this.tableLayers = tableLayers;
    this.rowSelectionModel = tableLayers.getSelectionModel();
    this.widgetFactory = widgetFactory;

    this.tableCellObservable = new TableCellObservable();
    this.tableCellPopupDetectionObservable = new TableCellPopupDetectionObservable();
    this.tableColumnPopupDetectionObservable = new TableColumnPopupDetectionObservable();
    this.tableColumnObservable = new TableColumnObservable();
    this.tableSelectionObservable = new TableSelectionObservable();

    this.tableModelListener = new TableModelListener();
    this.tableColumnModelListener = new TableColumnModelListener();
    this.columnLayerListener = new ColumnLayerListener();
    this.tableSelectionListener = new TableSelectionListener();

    this.hoveredColumnLabelAccumulator = new HoveredColumnConfigLabelAccumulator();
    this.clickedColumnLabelAccumulator = new ClickedColumnConfigLabelAccumulator();
    this.editorCustomWidgetFactory = new EditorCustomWidgetFactory();

    this.dataModel = setup.getDataModel();
    this.columnModel = setup.getColumnModel();
    this.editorFactory = setup.getEditor();

    this.editable = true;
    this.editRowIndex = -1;
    this.editColumnIndex = -1;

    final SwtDragSource swtDragSource = (SwtDragSource) super.getDragSource();
    this.dragSource = new NatTableDragSource(swtDragSource, this);

    setMenuDetectListener(new TableMenuDetectListener());

    table.addMouseListener(new CellSelectionListener(table, swtDragSource, rowSelectionModel));
    table.addMouseListener(new TableCellMouseListener());
    table.addMouseMoveListener(new HeaderHoverMouseMoveListener());
    table.addMouseTrackListener(new HeaderHoverAndClickMouseTrackAdapter());
    table.addMouseListener(new HeaderMouseClickModeMouseListener());
    table.getUiBindingRegistry().registerSingleClickBinding(new TableHeaderMouseEventMatcher(), new TableHeaderClickAction());
    table.addDisposeListener(new NatTableDisposeListener());

    tableLayers.getSelectionLayer().addLayerListener(tableSelectionListener);
    tableLayers.getColumnReorderLayer().addLayerListener(columnLayerListener);

    final AggregateConfigLabelAccumulator columnLabelAccumulator = new AggregateConfigLabelAccumulator();
    columnLabelAccumulator.add(hoveredColumnLabelAccumulator, clickedColumnLabelAccumulator);
    tableLayers.getColumnHeaderLayer().setConfigLabelAccumulator(columnLabelAccumulator);

    JoNatTableConfigurator.configureNatTable(table, setup.getColumnModel(), imageRegistry);
    JoNatTableConfigurator.registerUiBindingsToNatTable(table, hoveredColumnLabelAccumulator);

    final NatTableTooltip tooltip = new NatTableTooltip(
        table,
        dataModel,
        columnModel,
        GridRegion.COLUMN_HEADER,
        GridRegion.BODY);

    table.addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(final DisposeEvent e) {
            tooltip.dispose();
        }
    });

}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:75,代码来源:NatTableImplSpi.java


示例18: PathCompositeLayer

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的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


示例19: init

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
protected void init() {
	dataProvider = new DataProvider();
	headingProvider = new HeadingProvider();

	gridLayer = new DefaultGridLayer(dataProvider, headingProvider);

	// CellLabelAccumulator determines how cells will be displayed
	class CellLabelAccumulator implements IConfigLabelAccumulator {
		@Override
		public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
			configLabels.addLabel("column" + columnPosition);
			if (dataProvider.isEditableNonscalarDefinition(rowPosition) && columnPosition == Attr.HEADING_COLUMN)
				configLabels.addLabel("nonscalareditor");
		}
	}

	DataLayer bodyDataLayer = (DataLayer) gridLayer.getBodyDataLayer();
	CellLabelAccumulator cellLabelAccumulator = new CellLabelAccumulator();
	bodyDataLayer.setConfigLabelAccumulator(cellLabelAccumulator);

	table = new NatTable(parent, gridLayer, false);

	editorConfiguration = new EditorConfiguration();

	DefaultNatTableStyleConfiguration defaultStyle = new DefaultNatTableStyleConfiguration();
	table.addConfiguration(defaultStyle);
	table.addConfiguration(editorConfiguration);

	ContributionItem rowMenuItems = new ContributionItem() {
		@Override
		public void fill(Menu menu, int index) {
			MenuItem doesDelete = new MenuItem(menu, SWT.PUSH);
			doesDelete.setText("Delete");
			doesDelete.setImage(IconLoader.loadIcon("table_row_delete"));
			doesDelete.addListener(SWT.Selection, e -> askDeleteSelected());
		}
	};
	table.addConfiguration(new MenuConfiguration(GridRegion.ROW_HEADER,
			new PopupMenuBuilder(table).withContributionItem(rowMenuItems)));

	// Tabbing wraps and moves up/down
	gridLayer.registerCommandHandler(new MoveCellSelectionCommandHandler(
			gridLayer.getBodyLayer().getSelectionLayer(), ITraversalStrategy.TABLE_CYCLE_TRAVERSAL_STRATEGY));

	table.configure();

	// Tooltip for row/column headings
	new NatTableContentTooltip(table, GridRegion.ROW_HEADER) {
		protected String getText(Event event) {
			return "Right-click for options.";
		}
	};
}
 
开发者ID:DaveVoorhis,项目名称:Rel,代码行数:54,代码来源:Designer.java


示例20: createExampleControl

import org.eclipse.nebula.widgets.nattable.grid.GridRegion; //导入依赖的package包/类
public Control createExampleControl(Composite parent) {
    DefaultGridLayer gridLayer = new DefaultGridLayer(
            RowDataListFixture.getList(),
            RowDataListFixture.getPropertyNames(),
            RowDataListFixture.getPropertyToLabelMap());

    DataLayer columnHeaderDataLayer = (DataLayer) gridLayer.getColumnHeaderDataLayer();
    columnHeaderDataLayer.setConfigLabelAccumulator(new ColumnLabelAccumulator());

    final DataLayer bodyDataLayer = (DataLayer) gridLayer
            .getBodyDataLayer();
    IDataProvider dataProvider = bodyDataLayer.getDataProvider();

    // NOTE: Register the accumulator on the body data layer.
    // This ensures that the labels are bound to the column index and are
    // unaffected by column order.
    final ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(
            bodyDataLayer);
    bodyDataLayer.setConfigLabelAccumulator(columnLabelAccumulator);

    NatTable natTable = new NatTable(parent, gridLayer, false);

    natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
    natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
    natTable.addConfiguration(editableGridConfiguration(
            columnLabelAccumulator, dataProvider));

    final ColumnHeaderCheckBoxPainter columnHeaderCheckBoxPainter = new ColumnHeaderCheckBoxPainter(
            bodyDataLayer);
    final ICellPainter column9HeaderPainter = new BeveledBorderDecorator(
            new CellPainterDecorator(new TextPainter(), CellEdgeEnum.RIGHT,
                    columnHeaderCheckBoxPainter));
    natTable.addConfiguration(new AbstractRegistryConfiguration() {
        @Override
        public void configureRegistry(IConfigRegistry configRegistry) {
            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_PAINTER,
                    column9HeaderPainter, DisplayMode.NORMAL,
                    ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 9);
        }

        @Override
        public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
            uiBindingRegistry.registerFirstSingleClickBinding(
                    new CellPainterMouseEventMatcher(
                            GridRegion.COLUMN_HEADER,
                            MouseEventMatcher.LEFT_BUTTON,
                            columnHeaderCheckBoxPainter),
                    new ToggleCheckBoxColumnAction(
                            columnHeaderCheckBoxPainter, bodyDataLayer));
        }
    });

    natTable.configure();

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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