use of org.whole.lang.ui.notations.styledtree.figures.CompositeTableFigure in project whole by wholeplatform.
the class AdaptiveEntityPart method createFigure.
protected IFigure createFigure() {
IEntityStyling entityStyling = getEntityStyling();
INotationStyling notationStyling = entityStyling.getNotationStyling();
switch(entityStyling.getKind()) {
case DATA:
switch(notationStyling.getEmbeddingStyle(stylingFactory, (IEntityPart) getParent(), getModelEntity())) {
case TABLE_CELL:
// TODO
case NONE:
default:
return new DataNodeFigure(entityStyling);
}
case SIMPLE:
return new SimpleTableNodeWithBranchesFigure(true, entityStyling);
case COMPOSITE:
default:
if (entityStyling.getLayoutStyle().equals(LayoutStyle.COMPOSITE_TABLE))
return new CompositeTableFigure(entityStyling);
else
return new NodeWithCompositeBranchFigure(entityStyling);
}
}
use of org.whole.lang.ui.notations.styledtree.figures.CompositeTableFigure in project whole by wholeplatform.
the class CompositeEntityStyledTreePart method createFigure.
protected IFigure createFigure() {
if (entityStyling.getLayoutStyle().equals(LayoutStyle.COMPOSITE_TABLE)) {
return new CompositeTableFigure(entityStyling) {
protected int getChildrenPaneIndex() {
return 0;
}
protected IEntityFigure createTypeLabelFigure() {
IEntityFigure typeFigure = new EntityFigure(new MonoLayout().withMargin(2, 4, 2, 8).withAutoresizeWeight(1.0f)).withViewportTracking(ViewportTracking.HORIZONTAL);
typeFigure.add(LabelFactory.createDeclaration(entityStyling.getTypeLabel()));
return typeFigure;
}
protected IEntityFigure createChildrenFigure() {
TableFigure tableFigure = new TableFigure(Math.max(1, featuresStyling.length)) {
protected void paintFigure(Graphics g) {
super.paintFigure(g);
g.setBackgroundColor(ColorConstants.lightGray);
g.setForegroundColor(ColorConstants.lightGray);
if (getLayoutManager().hasHeaderRow()) {
drawHeadersRowBackground(g);
drawHeadersRowSeparator(g);
}
drawColumnSeparators(g);
int oldAlpha = g.getAlpha();
g.setAlpha(80);
drawRowSeparators(g);
drawTableColumnsBorder(g);
drawTableRowsBorder(g);
g.setAlpha(oldAlpha);
}
};
if (featuresStyling.length > 0) {
TableRowFigure tableHeaderFigure = new TableRowFigure();
TableLayout tableLayout = tableFigure.getLayoutManager();
int i = 0;
for (IFeatureStyling fs : featuresStyling) {
tableHeaderFigure.addLabel(fs.getName());
tableLayout.withColumnAlignment(i++, fs.getAlignment());
}
tableFigure.add(tableHeaderFigure, TableLayout.Placement.HEADER);
}
return createContentPane(getChildrenPaneIndex(), tableFigure);
}
};
} else
return new NodeWithCompositeBranchFigure(entityStyling) {
@Override
protected int getChildrenPaneIndex() {
return 0;
}
@Override
protected IEntityFigure createTypeLabelFigure() {
String name = entityStyling.getTypeLabel();
return LabelFactory.createDeclaration(name);
}
@Override
protected IEntityFigure createChildrenFigure() {
CompositeFigure compositeFigure = new CompositeFigure(false);
compositeFigure.setBorder(CompositePlaceHolderBorder.OPTIONAL_VERTICAL);
compositeFigure.getLayoutManager().withSpacing(4).withMarginLeft(0).withMarginRight(10).withMinorAlignment(Alignment.LEADING);
return createContentPane(getChildrenPaneIndex(), compositeFigure);
}
};
}
Aggregations