私は両方でそれを試しました:テーマ構成の設定とConfig Registryでのボーダースタイルでのスタイルの登録。しかし、私には国境が見えません。私が見逃しているものは他にありますか?
私の postConstruct メソッドでは、次のように NatTable を初期化しています。
final ThemeConfiguration modernTheme = new ModernNatTableThemeConfiguration(imageRightUp, imageTreeRightDown);
TextPainter textPainter = new TextPainter(true, false);
ImagePainter imagePainter = new ImagePainter(threeDots);
CellPainterDecorator cellPainterDecorator = new CellPainterDecorator(textPainter, CellEdgeEnum.RIGHT, imagePainter);
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_PAINTER,
cellPainterDecorator,
DisplayMode.NORMAL,
LABEL_1);
Style style = new Style();
style.setAttributeValue(
CellStyleAttributes.BACKGROUND_COLOR,
GUIHelper.getColor(44, 104, 125));
style.setAttributeValue(
CellStyleAttributes.FOREGROUND_COLOR,
GUIHelper.COLOR_WHITE);
style.setAttributeValue(
CellStyleAttributes.BORDER_STYLE,
new BorderStyle(5, GUIHelper.COLOR_BLACK, LineStyleEnum.SOLID));
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
LABEL_1);
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
LABEL_2);
NatTable natTable = new NatTable(parent, viewportLayer, false);
GridData d = new GridData(SWT.FILL, SWT.FILL, true, true, 1,1);
natTable.setLayoutData(d);
natTable.setConfigRegistry(configRegistry);
natTable.addConfiguration(new DefaultTreeLayerConfiguration(treeLayer));
natTable.setTheme(modernTheme);
natTable.configure();
また、これはテーマ構成です:
public class ModernNatTableThemeConfiguration extends DefaultNatTableThemeConfiguration {
public ModernNatTableThemeConfiguration( Image imageRightUp, Image imageTreeRightDown ){
TreeImagePainter treeImagePainter = new TreeImagePainter(
false,
imageRightUp, imageTreeRightDown, null); //$NON-NLS-1$//$NON-NLS-2$
this.treeStructurePainter = new BackgroundPainter(new PaddingDecorator(
new IndentedTreeImagePainter(10, null, CellEdgeEnum.LEFT,
treeImagePainter, false, 2, true), 0, 5, 0, 5, false));
TreeImagePainter treeSelectionImagePainter = new TreeImagePainter(
false,
imageRightUp, imageTreeRightDown, null); //$NON-NLS-1$//$NON-NLS-2$
this.treeStructureSelectionPainter = new BackgroundPainter(
new PaddingDecorator(new IndentedTreeImagePainter(10, null,
CellEdgeEnum.LEFT, treeSelectionImagePainter, false, 2,
true), 0, 5, 0, 5, false));
this.treeBgColor = GUIHelper.getColor(44, 104, 125);
this.treeFgColor = GUIHelper.getColor(44, 104, 125);
}
}