use of org.whole.lang.ui.layout.RowLayout in project whole by wholeplatform.
the class SimpleEntityTreeFigure method createFeaturesOutline.
protected IFigure createFeaturesOutline(EntityDescriptor<?> ed, ActionListener linkListener) {
int featureNum = ed.childFeatureSize();
IFigure featuresOutline = new EntityFigure(new ColumnLayout().withAutoresizeWeight(1.0f).withMarginBottom(2).withMinorAlignment(isRightToLeft() ? Alignment.LEADING : Alignment.TRAILING));
featureToggles = new Toggle[featureNum];
for (int i = 0; i < featureNum; i++) {
FeatureDescriptor fd = ed.getEntityFeatureDescriptor(i);
EntityFigure feature = new EntityFigure(new RowLayout().withSpacing(3).withMajorAlignment(isRightToLeft() ? Alignment.LEADING : Alignment.TRAILING).withReversedChildren(isRightToLeft()));
feature.addLabel(fd.getName());
featureToggles[i] = createFoldingToggle(new EntityToggle(WholeImages.ROUND_EXPAND, WholeImages.ROUND_COLLAPSE), i);
feature.add(featureToggles[i]);
featuresOutline.add(feature);
}
for (int i = featureNum, size = ed.featureSize(); i < size; i++) {
FeatureDescriptor fd = ed.getEntityFeatureDescriptor(i);
EntityFigure feature = new EntityFigure(new RowLayout().withMarginLeft(3).withMarginRight(3).withMajorAlignment(isRightToLeft() ? Alignment.LEADING : Alignment.TRAILING).withReversedChildren(isRightToLeft()));
EntityLabel createLabel = feature.addLabel(fd.getName(), WholeImages.LINK);
createLabel.setTextPlacement(isRightToLeft() ? PositionConstants.EAST : PositionConstants.WEST);
createLabel.setBorder(new MarginBorder(3));
feature.add(new EntityButton(createLabel, linkListener, i));
featuresOutline.add(feature);
}
return featuresOutline;
}
use of org.whole.lang.ui.layout.RowLayout in project whole by wholeplatform.
the class ToolbarActionsFigure method createActionRow.
// TODO remove
protected EntityFigure createActionRow(int paneIndex) {
EntityFigure row = new EntityFigure(new RowLayout().withSpacing(4));
row.add(createFoldingToggle(paneIndex));
row.add(createContentPane(paneIndex));
return row;
}
use of org.whole.lang.ui.layout.RowLayout 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.layout.RowLayout in project whole by wholeplatform.
the class RepetitionPart method createFigure.
protected IFigure createFigure() {
return new TypeNameValueTableRowFigure() {
@Override
protected IEntityFigure createValueFigure(int paneIndex) {
EntityFigure row = new EntityFigure(new RowLayout());
row.add(createContentPane(paneIndex));
row.add(LabelFactory.createSymbolMediumContentLighter("\u2026"));
row.addContentLight(" ordered");
return row;
}
};
}
use of org.whole.lang.ui.layout.RowLayout in project whole by wholeplatform.
the class UnboundedPart method createFigure.
protected IFigure createFigure() {
EntityFigure figure = new EntityFigure(new RowLayout());
figure.addContent("maxOccurs");
figure.addContentLight("=");
figure.addContentLighter("\"");
figure.addIdentifier("unbounded");
figure.addContentLighter("\"");
return figure;
}
Aggregations