Search in sources :

Example 1 with ColumnLayout

use of org.whole.lang.ui.layout.ColumnLayout 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 ColumnLayout

use of org.whole.lang.ui.layout.ColumnLayout in project whole by wholeplatform.

the class SequencePart method createFigure.

protected IFigure createFigure() {
    IFigure figure = new CompositeFigure(new ColumnLayout().withMarginTop(5).withMarginBottom(5).withSpacing(13));
    figure.setBorder(new CurlyBracketsBorder());
    return figure;
}
Also used : CompositeFigure(org.whole.lang.ui.figures.CompositeFigure) CurlyBracketsBorder(org.whole.lang.ui.figures.CurlyBracketsBorder) ColumnLayout(org.whole.lang.ui.layout.ColumnLayout) IFigure(org.eclipse.draw2d.IFigure)

Example 3 with ColumnLayout

use of org.whole.lang.ui.layout.ColumnLayout in project whole by wholeplatform.

the class GrammarBasedUIUtils method createSequenceFigure.

public static IEntityFigure createSequenceFigure(IEntity entity, ContentPaneFigure contentPaneFigure, boolean embed) {
    FeatureDescriptorEnum fdEnum = entity.wGetLanguageKit().getFeatureDescriptorEnum();
    IEntity multiline = entity.wGet(fdEnum.valueOf("multiline"));
    ICompositeEntityLayout layout = EntityUtils.safeBooleanValue(multiline, false) ? new ColumnLayout() : new RowLayout();
    // TODO complete optional behavior
    IEntity optional = entity.wGet(fdEnum.valueOf("optional"));
    IEntityFigure figure;
    if (embed) {
        contentPaneFigure.setLayoutManager(layout.withSpacing(5));
        figure = contentPaneFigure;
    } else
        figure = new EntityFigure(layout.withSpacing(5));
    IEntity childFigures = entity.wGet(fdEnum.valueOf("figures"));
    for (int i = 0, size = childFigures.wSize(); i < size; i++) addChildFigure(childFigures.wGet(i), contentPaneFigure, figure);
    return figure;
}
Also used : ICompositeEntityLayout(org.whole.lang.ui.layout.ICompositeEntityLayout) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) FeatureDescriptorEnum(org.whole.lang.reflect.FeatureDescriptorEnum) EntityFigure(org.whole.lang.ui.figures.EntityFigure) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) IEntity(org.whole.lang.model.IEntity) ColumnLayout(org.whole.lang.ui.layout.ColumnLayout) RowLayout(org.whole.lang.ui.layout.RowLayout)

Aggregations

ColumnLayout (org.whole.lang.ui.layout.ColumnLayout)3 IFigure (org.eclipse.draw2d.IFigure)2 EntityFigure (org.whole.lang.ui.figures.EntityFigure)2 RowLayout (org.whole.lang.ui.layout.RowLayout)2 MarginBorder (org.eclipse.draw2d.MarginBorder)1 Point (org.eclipse.draw2d.geometry.Point)1 IEntity (org.whole.lang.model.IEntity)1 FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)1 FeatureDescriptorEnum (org.whole.lang.reflect.FeatureDescriptorEnum)1 CompositeFigure (org.whole.lang.ui.figures.CompositeFigure)1 CurlyBracketsBorder (org.whole.lang.ui.figures.CurlyBracketsBorder)1 EntityButton (org.whole.lang.ui.figures.EntityButton)1 EntityLabel (org.whole.lang.ui.figures.EntityLabel)1 EntityToggle (org.whole.lang.ui.figures.EntityToggle)1 IEntityFigure (org.whole.lang.ui.figures.IEntityFigure)1 ICompositeEntityLayout (org.whole.lang.ui.layout.ICompositeEntityLayout)1