Search in sources :

Example 1 with EntityButton

use of org.whole.lang.ui.figures.EntityButton in project whole by wholeplatform.

the class CompositeEntityReferenceTextFigure method setAdjacentSize.

public void setAdjacentSize(int size) {
    for (int i = compositeFigure.getChildren().size(); i < size; i++) {
        EntityFigure featureRow = new EntityFigure(new TableRowLayout().withMinorAlignment(Alignment.LEADING));
        featureRow.add(new EntityButton(linkListener, i));
        compositeFigure.add(featureRow);
    }
    while (compositeFigure.getChildren().size() > size) compositeFigure.remove((IFigure) compositeFigure.getChildren().get(size));
    revalidate();
    repaint();
}
Also used : EntityFigure(org.whole.lang.ui.figures.EntityFigure) TableRowLayout(org.whole.lang.ui.layout.TableRowLayout) EntityButton(org.whole.lang.ui.figures.EntityButton) IFigure(org.eclipse.draw2d.IFigure)

Example 2 with EntityButton

use of org.whole.lang.ui.figures.EntityButton 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 3 with EntityButton

use of org.whole.lang.ui.figures.EntityButton in project whole by wholeplatform.

the class FeatureReferenceFigure method initFigure.

@Override
protected void initFigure() {
    initContentPanes(1);
    EntityFigure headerFigure = new EntityFigure(new RowLayout().withSpacing(4).withMarginLeft(12));
    headerFigure.add(createContentPane(0));
    headerFigure.add(linkButton = new EntityButton(null));
    add(shapeFigure = headerFigure);
}
Also used : EntityFigure(org.whole.lang.ui.figures.EntityFigure) EntityButton(org.whole.lang.ui.figures.EntityButton) RowLayout(org.whole.lang.ui.layout.RowLayout)

Example 4 with EntityButton

use of org.whole.lang.ui.figures.EntityButton in project whole by wholeplatform.

the class CompositeEntityReferenceColumnFigure method setAdjacentSize.

public void setAdjacentSize(int size) {
    for (int i = tableFigure.getChildren().size(); i < size; i++) {
        EntityFigure featureRow = new EntityFigure(new TableRowLayout().withMinorAlignment(Alignment.LEADING));
        featureRow.add(new EntityButton(linkListener, i));
        tableFigure.add(featureRow);
    }
    while (tableFigure.getChildren().size() > size) tableFigure.remove((IFigure) tableFigure.getChildren().get(size));
    revalidate();
    repaint();
}
Also used : EntityFigure(org.whole.lang.ui.figures.EntityFigure) TableRowLayout(org.whole.lang.ui.layout.TableRowLayout) EntityButton(org.whole.lang.ui.figures.EntityButton) IFigure(org.eclipse.draw2d.IFigure)

Example 5 with EntityButton

use of org.whole.lang.ui.figures.EntityButton in project whole by wholeplatform.

the class CompositeEntityReferenceOutlineFigure method setAdjacentSize.

public void setAdjacentSize(int size) {
    for (int i = compositeFigure.getChildren().size(); i < size; i++) compositeFigure.add(new EntityButton(linkListener, i));
    while (compositeFigure.getChildren().size() > size) compositeFigure.remove((IFigure) compositeFigure.getChildren().get(size));
    revalidate();
    repaint();
}
Also used : EntityButton(org.whole.lang.ui.figures.EntityButton) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

EntityButton (org.whole.lang.ui.figures.EntityButton)5 IFigure (org.eclipse.draw2d.IFigure)4 EntityFigure (org.whole.lang.ui.figures.EntityFigure)4 Point (org.eclipse.draw2d.geometry.Point)2 RowLayout (org.whole.lang.ui.layout.RowLayout)2 TableRowLayout (org.whole.lang.ui.layout.TableRowLayout)2 MarginBorder (org.eclipse.draw2d.MarginBorder)1 FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)1 EntityLabel (org.whole.lang.ui.figures.EntityLabel)1 EntityToggle (org.whole.lang.ui.figures.EntityToggle)1 ColumnLayout (org.whole.lang.ui.layout.ColumnLayout)1