Search in sources :

Example 1 with RowLayout

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;
}
Also used : EntityFigure(org.whole.lang.ui.figures.EntityFigure) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) EntityButton(org.whole.lang.ui.figures.EntityButton) ColumnLayout(org.whole.lang.ui.layout.ColumnLayout) RowLayout(org.whole.lang.ui.layout.RowLayout) MarginBorder(org.eclipse.draw2d.MarginBorder) EntityToggle(org.whole.lang.ui.figures.EntityToggle) EntityLabel(org.whole.lang.ui.figures.EntityLabel) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure)

Example 2 with RowLayout

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;
}
Also used : IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) EntityFigure(org.whole.lang.ui.figures.EntityFigure) RowLayout(org.whole.lang.ui.layout.RowLayout)

Example 3 with RowLayout

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;
}
Also used : Graphics(org.eclipse.draw2d.Graphics) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) RowLayout(org.whole.lang.ui.layout.RowLayout) Rectangle(org.eclipse.draw2d.geometry.Rectangle) List(java.util.List) StringSeparatedCompositeRowFigure(org.whole.lang.ui.figures.StringSeparatedCompositeRowFigure) IFigure(org.eclipse.draw2d.IFigure)

Example 4 with RowLayout

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;
        }
    };
}
Also used : TypeNameValueTableRowFigure(org.whole.lang.ui.figures.TypeNameValueTableRowFigure) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) EntityFigure(org.whole.lang.ui.figures.EntityFigure) RowLayout(org.whole.lang.ui.layout.RowLayout)

Example 5 with RowLayout

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;
}
Also used : EntityFigure(org.whole.lang.ui.figures.EntityFigure) RowLayout(org.whole.lang.ui.layout.RowLayout)

Aggregations

RowLayout (org.whole.lang.ui.layout.RowLayout)14 EntityFigure (org.whole.lang.ui.figures.EntityFigure)13 IEntityFigure (org.whole.lang.ui.figures.IEntityFigure)4 Graphics (org.eclipse.draw2d.Graphics)2 IFigure (org.eclipse.draw2d.IFigure)2 EntityButton (org.whole.lang.ui.figures.EntityButton)2 EntityLabel (org.whole.lang.ui.figures.EntityLabel)2 ColumnLayout (org.whole.lang.ui.layout.ColumnLayout)2 List (java.util.List)1 MarginBorder (org.eclipse.draw2d.MarginBorder)1 Point (org.eclipse.draw2d.geometry.Point)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 IEntity (org.whole.lang.model.IEntity)1 FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)1 FeatureDescriptorEnum (org.whole.lang.reflect.FeatureDescriptorEnum)1 EntityToggle (org.whole.lang.ui.figures.EntityToggle)1 StringSeparatedCompositeRowFigure (org.whole.lang.ui.figures.StringSeparatedCompositeRowFigure)1 TypeNameValueTableRowFigure (org.whole.lang.ui.figures.TypeNameValueTableRowFigure)1 ICompositeEntityLayout (org.whole.lang.ui.layout.ICompositeEntityLayout)1 UnderColumnLayout (org.whole.lang.ui.layout.UnderColumnLayout)1