Borders dont appear to NatTable Cells in Eclipse RCP application -
i have tried both : setting theme configuration , registering style border style in config registry. not seeing borders. there else missing?
in postconstruct method initialising nattable follows :
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 apply cellconfigattributes.cell_style, // value of attribute style, // apply during normal rendering i.e not // during selection or edit displaymode.normal, // apply above cells label label_1); configregistry.registerconfigattribute( // attribute apply cellconfigattributes.cell_style, // value of attribute style, // apply during normal rendering i.e not // during selection or edit displaymode.normal, // apply above cells 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();
also theme configuration :
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); } }
i think need clear terms. want remove borders or grid lines? because specify border in style configuration, border should there.
if want rid of grid lines, need configure celllayerpainter
.
this can done example:
configregistry.registerconfigattribute( cellconfigattributes.render_grid_lines, boolean.false);
btw, not practice directly modify configregistry
doing in code. should create iconfiguration
(e.g. abstractregistryconfiguration
) , register iconfiguration
nattable instance instead. otherwise nattable#configure()
might override changes @ configuration time.
this explained here: http://www.vogella.com/tutorials/nattable/article.html#architecture_configuration
Comments
Post a Comment