use of org.whole.lang.ui.figures.StringSeparatedCompositeRowFigure in project whole by wholeplatform.
the class PathPart method createFigure.
protected IFigure createFigure() {
IFigure f = new StringSeparatedCompositeRowFigure("/", new RowLayout().withMarginLeft(8).withMarginRight(5).withSpacing(8)) {
@Override
public Color getLocalForegroundColor() {
return ColorConstants.gray;
}
@Override
protected Font getLocalFont() {
return FigureConstants.symbolFontLarge;
}
@SuppressWarnings("unchecked")
protected void paintDecorations(Graphics g) {
// workaround for LabelFactory.createModule
g.setFont(FigureConstants.symbolFontLarge);
int spacing = Math.max(1, getLayoutManager().getSpacing() / 5);
// getSeparatorAscent();
int separatorAscent = FigureUtilities.getFontMetrics(g.getFont()).getHeight() / 2;
List<IEntityFigure> children = (List<IEntityFigure>) getChildren();
if (!children.isEmpty()) {
for (int i = 0; i < children.size() - 1; i++) {
IEntityFigure childFigure = children.get(i);
Rectangle childBounds = childFigure.getBounds();
g.drawString(separator, childBounds.right() + spacing, childBounds.y + childFigure.getAscent() - separatorAscent);
}
IEntityFigure childFigure = children.get(0);
Rectangle childBounds = childFigure.getBounds();
g.setForegroundColor(ColorConstants.lightGray);
g.drawString(separator, childBounds.x - getLayoutManager().getMarginLeft() + 1, childBounds.y + childFigure.getAscent() - separatorAscent);
}
}
};
return f;
}
use of org.whole.lang.ui.figures.StringSeparatedCompositeRowFigure in project whole by wholeplatform.
the class GrammarBasedUIUtils method createCompositeFigure.
public static IEntityFigure createCompositeFigure(IEntity entity) {
ILanguageKit lk = entity.wGetLanguageKit();
EntityDescriptorEnum edEnum = lk.getEntityDescriptorEnum();
FeatureDescriptorEnum fdEnum = lk.getFeatureDescriptorEnum();
IEntity configuration = Matcher.findAncestor(edEnum.valueOf("CompositePart"), entity);
IEntity multiline = configuration.wGet(fdEnum.valueOf("multiline"));
boolean isMultiline = EntityUtils.safeBooleanValue(multiline, false);
IEntity columns = configuration.wGet(fdEnum.valueOf("columns"));
int columnsNum = EntityUtils.safeIntValue(columns, 0);
IEntity separator = configuration.wGet(fdEnum.valueOf("separator"));
IEntityFigure entityFigure;
if (EntityUtils.isNotResolver(separator)) {
String separatorText = GrammarBasedUIUtils.calculateSeparator(separator);
CompositeFigure compositeFigure = isMultiline ? new StringSeparatedCompositeColumnFigure(separatorText, 10) : new StringSeparatedCompositeRowFigure(separatorText, 10);
if (isMultiline)
compositeFigure.getLayoutManager().withMinorAlignment(Alignment.LEADING);
entityFigure = compositeFigure;
} else if (columnsNum > 0) {
TableFigure tableFigure = new TableFigure(columnsNum);
tableFigure.setBorder(CompositePlaceHolderBorder.OPTIONAL_VERTICAL);
entityFigure = tableFigure;
} else
entityFigure = new CompositeFigure(!isMultiline, true);
return entityFigure;
}
use of org.whole.lang.ui.figures.StringSeparatedCompositeRowFigure in project whole by wholeplatform.
the class InValueListPart method createFigure.
protected IFigure createFigure() {
IFigure figure = new StringSeparatedCompositeRowFigure(",", 10);
figure.setBorder(new RoundBracketsBorder());
return figure;
}
use of org.whole.lang.ui.figures.StringSeparatedCompositeRowFigure in project whole by wholeplatform.
the class TuplePart method createFigure.
protected IFigure createFigure() {
StringSeparatedCompositeRowFigure f = new StringSeparatedCompositeRowFigure();
f.setBorder(new RoundBracketsBorder());
return f;
}
Aggregations