本文整理汇总了Java中org.eclipse.nebula.widgets.nattable.grid.GridRegion类的典型用法代码示例。如果您正苦于以下问题:Java GridRegion类的具体用法?Java GridRegion怎么用?Java GridRegion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GridRegion类属于org.eclipse.nebula.widgets.nattable.grid包,在下文中一共展示了GridRegion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}