本文整理汇总了Java中org.eclipse.nebula.widgets.nattable.util.GUIHelper类的典型用法代码示例。如果您正苦于以下问题:Java GUIHelper类的具体用法?Java GUIHelper怎么用?Java GUIHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GUIHelper类属于org.eclipse.nebula.widgets.nattable.util包,在下文中一共展示了GUIHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSelectedModeStyling
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的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);
}
示例2: getForegroundColor
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的package包/类
private Color getForegroundColor(final ITableCell tableCell, final ILayerCell layerCell, final IStyle style) {
final Color defaultForeground = style.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR);
if (DisplayMode.NORMAL.equals(layerCell.getDisplayMode())) {
final IColorConstant foreground = tableCell.getForegroundColor();
if (foreground != null) {
return foregroundColorCache.getColor(foreground);
}
}
else if (DisplayMode.SELECT.equals(layerCell.getDisplayMode())) {
IColorConstant selectedForeground = tableCell.getSelectedForegroundColor();
if (selectedForeground == null) {
selectedForeground = defaultSelectedForegroundColor;
}
if (selectedForeground != null) {
return selectedForegroundColorCache.getColor(selectedForeground);
}
}
return defaultForeground != null ? defaultForeground : GUIHelper.COLOR_LIST_FOREGROUND;
}
示例3: configureRegistry
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的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: registerColumnThreePasswordPainter
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的package包/类
private void registerColumnThreePasswordPainter(IConfigRegistry configRegistry) {
Style style = new Style();
style.setAttributeValue(
CellStyleAttributes.GRADIENT_BACKGROUND_COLOR,
GUIHelper.COLOR_WHITE);
style.setAttributeValue(
CellStyleAttributes.GRADIENT_FOREGROUND_COLOR,
GUIHelper.COLOR_RED);
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_STYLE,
style,
DisplayMode.NORMAL,
CellPainterExample.COLUMN_THREE_LABEL);
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_PAINTER,
new GradientBackgroundPainter(new PasswordTextPainter(false, false)),
DisplayMode.NORMAL,
CellPainterExample.COLUMN_THREE_LABEL);
}
示例5: addColumnHighlight
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的package包/类
private void addColumnHighlight(IConfigRegistry configRegistry) {
Style style = new Style();
style.setAttributeValue(
CellStyleAttributes.BACKGROUND_COLOR,
GUIHelper.COLOR_RED);
configRegistry.registerConfigAttribute(
// attribute to apply
CellConfigAttributes.CELL_STYLE,
// value of the attribute
style,
// apply during normal rendering i.e not
// during selection or edit
DisplayMode.NORMAL,
// apply the above for all cells with this label
CELL_LABEL);
// Override the selection style on the highlighted cells.
// Note: This is achieved by specifying the display mode.
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_STYLE,
style,
DisplayMode.SELECT,
CELL_LABEL);
}
示例6: addNormalModeStyling
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的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);
}
示例7: fireEvent
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的package包/类
/**
* Checks the selected items and fires an event on changes
*/
private void fireEvent() {
Set<String> selection = new HashSet<String>();
for (TableItem item : table.getItems()) {
if (item.getChecked()) {
selection.add(item.getText());
}
}
if (model != null) {
if (selection.equals(model.getSelectedQuasiIdentifiers())) {
return;
}
if (selection.size() <= model.getRiskModel().getMaxQiSize()) {
model.setSelectedQuasiIdentifiers(selection);
controller.update(new ModelEvent(ViewRisksQuasiIdentifiers.this, ModelPart.SELECTED_QUASI_IDENTIFIERS, selection));
label.setText(Resources.getMessage("ViewRisksQuasiIdentifiers.3") + (int)(Math.pow(2, selection.size())-1)); //$NON-NLS-1$
label.setForeground(GUIHelper.COLOR_BLACK);
} else {
label.setText(Resources.getMessage("ViewRisksQuasiIdentifiers.4") + (int)(Math.pow(2, selection.size())-1)); //$NON-NLS-1$
label.setForeground(GUIHelper.COLOR_RED);
}
}
}
示例8: newFlowGraphNode
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的package包/类
private GraphNode newFlowGraphNode(Stream stream){
GraphNode node=new GraphNode(flowGraph, SWT.ALPHA);
String text=getFlowGraphNodeText(stream);
node.setText(text);
node.setData(stream.getUniqueName());
Color color=getInstanceColor(stream);
node.setBackgroundColor(color);
node.setBorderColor(color);
node.setHighlightColor(color);
node.setBorderHighlightColor(GUIHelper.COLOR_BLACK);
flowGraph.setData(stream.getUniqueName(), node);
return node;
}
示例9: getCellColor
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的package包/类
public Color getCellColor(int columnIndex, int rowIndex) {
StreamContainer sc=locateStreamContainer(columnIndex, rowIndex);
if(sc!=null){
InstanceStat insStat=clw.getContainerStatMap().get(sc.getUniqueName());
return InstanceColorFactory.getInstanceColor(insStat);
}
return GUIHelper.COLOR_WHITE;
}
示例10: setupGC
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的package包/类
@Override
void setupGC(final GC gc, final ILayerCell layerCell, final IStyle cellStyle) {
final ITableCell tableCell = (ITableCell) layerCell.getDataValue();
this.originalFont = gc.getFont();
this.originalForeground = gc.getForeground();
gc.setAntialias(GUIHelper.DEFAULT_ANTIALIAS);
gc.setTextAntialias(GUIHelper.DEFAULT_TEXT_ANTIALIAS);
gc.setFont(getFont(tableCell, cellStyle));
gc.setForeground(getForegroundColor(tableCell, layerCell, cellStyle));
}
示例11: configureRegistry
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的package包/类
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
IStyle style = new Style();
style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_BLUE);
style.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, GUIHelper.COLOR_WHITE);
configRegistry
.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.NORMAL, ACTIVE_LABEL);
configRegistry
.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.SELECT, ACTIVE_LABEL);
}
示例12: configureRegistry
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的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);
}
示例13: setupGCFromConfig
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的package包/类
/**
* Setup the GC by the values defined in the given cell style.
*
* @param gc
* @param cellStyle
*/
public void setupGCFromConfig(GC gc, IStyle cellStyle) {
Color fg = cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR);
Color bg = cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR);
Font font = cellStyle.getAttributeValue(CellStyleAttributes.FONT);
gc.setAntialias(GUIHelper.DEFAULT_ANTIALIAS);
gc.setTextAntialias(GUIHelper.DEFAULT_TEXT_ANTIALIAS);
gc.setFont(font);
gc.setForeground(fg != null ? fg : GUIHelper.COLOR_LIST_FOREGROUND);
gc.setBackground(bg != null ? bg : GUIHelper.COLOR_LIST_BACKGROUND);
}
示例14: registerColumnHeaderStyle
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的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);
}
示例15: registerColumnTwoTextPainterStyle
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; //导入依赖的package包/类
private void registerColumnTwoTextPainterStyle(IConfigRegistry configRegistry) {
Style style = new Style();
style.setAttributeValue(CellStyleAttributes.BORDER_STYLE,
new BorderStyle(2, GUIHelper.COLOR_BLUE, LineStyleEnum.DASHDOT));
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_STYLE,
style,
DisplayMode.NORMAL,
CellPainterExample.COLUMN_TWO_LABEL);
}