Search in sources :

Example 16 with EntityFigure

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

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

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

the class TreeNotationUtils method createTitleFigure.

public static EntityFigure createTitleFigure(String title, Toggle toggle) {
    EntityFigure titleFigure = new EntityFigure(new RowLayout().withSpacing(4).withMargin(2, 4, 2, 12));
    if (toggle != null)
        titleFigure.add(toggle);
    titleFigure.addDeclaration(title);
    return titleFigure;
}
Also used : EntityFigure(org.whole.lang.ui.figures.EntityFigure) RowLayout(org.whole.lang.ui.layout.RowLayout)

Example 19 with EntityFigure

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

the class TreeNotationUtils method createTitleFigureWithAlpha.

public static EntityFigure createTitleFigureWithAlpha(String title, Toggle toggle) {
    EntityFigure titleFigure = new EntityFigure(new RowLayout().withSpacing(4).withMargin(2, 4, 2, 12));
    if (toggle != null)
        titleFigure.add(toggle);
    EntityLabel label = new EntityLabel() {

        public Color getLocalForegroundColor() {
            return FigureConstants.declarationsColor;
        }

        public Font getLocalFont() {
            return FigureConstants.declarationsFont;
        }

        @Override
        protected void paintFigure(Graphics g) {
            int oldAlpha = g.getAlpha();
            g.setAlpha(60);
            super.paintFigure(g);
            g.setAlpha(oldAlpha);
        }
    };
    label.setText(title);
    titleFigure.add(label);
    return titleFigure;
}
Also used : Graphics(org.eclipse.draw2d.Graphics) EntityFigure(org.whole.lang.ui.figures.EntityFigure) RowLayout(org.whole.lang.ui.layout.RowLayout) EntityLabel(org.whole.lang.ui.figures.EntityLabel)

Example 20 with EntityFigure

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

the class CompositeEntityStyledTreePart method createFigure.

protected IFigure createFigure() {
    if (entityStyling.getLayoutStyle().equals(LayoutStyle.COMPOSITE_TABLE)) {
        return new CompositeTableFigure(entityStyling) {

            protected int getChildrenPaneIndex() {
                return 0;
            }

            protected IEntityFigure createTypeLabelFigure() {
                IEntityFigure typeFigure = new EntityFigure(new MonoLayout().withMargin(2, 4, 2, 8).withAutoresizeWeight(1.0f)).withViewportTracking(ViewportTracking.HORIZONTAL);
                typeFigure.add(LabelFactory.createDeclaration(entityStyling.getTypeLabel()));
                return typeFigure;
            }

            protected IEntityFigure createChildrenFigure() {
                TableFigure tableFigure = new TableFigure(Math.max(1, featuresStyling.length)) {

                    protected void paintFigure(Graphics g) {
                        super.paintFigure(g);
                        g.setBackgroundColor(ColorConstants.lightGray);
                        g.setForegroundColor(ColorConstants.lightGray);
                        if (getLayoutManager().hasHeaderRow()) {
                            drawHeadersRowBackground(g);
                            drawHeadersRowSeparator(g);
                        }
                        drawColumnSeparators(g);
                        int oldAlpha = g.getAlpha();
                        g.setAlpha(80);
                        drawRowSeparators(g);
                        drawTableColumnsBorder(g);
                        drawTableRowsBorder(g);
                        g.setAlpha(oldAlpha);
                    }
                };
                if (featuresStyling.length > 0) {
                    TableRowFigure tableHeaderFigure = new TableRowFigure();
                    TableLayout tableLayout = tableFigure.getLayoutManager();
                    int i = 0;
                    for (IFeatureStyling fs : featuresStyling) {
                        tableHeaderFigure.addLabel(fs.getName());
                        tableLayout.withColumnAlignment(i++, fs.getAlignment());
                    }
                    tableFigure.add(tableHeaderFigure, TableLayout.Placement.HEADER);
                }
                return createContentPane(getChildrenPaneIndex(), tableFigure);
            }
        };
    } else
        return new NodeWithCompositeBranchFigure(entityStyling) {

            @Override
            protected int getChildrenPaneIndex() {
                return 0;
            }

            @Override
            protected IEntityFigure createTypeLabelFigure() {
                String name = entityStyling.getTypeLabel();
                return LabelFactory.createDeclaration(name);
            }

            @Override
            protected IEntityFigure createChildrenFigure() {
                CompositeFigure compositeFigure = new CompositeFigure(false);
                compositeFigure.setBorder(CompositePlaceHolderBorder.OPTIONAL_VERTICAL);
                compositeFigure.getLayoutManager().withSpacing(4).withMarginLeft(0).withMarginRight(10).withMinorAlignment(Alignment.LEADING);
                return createContentPane(getChildrenPaneIndex(), compositeFigure);
            }
        };
}
Also used : CompositeTableFigure(org.whole.lang.ui.notations.styledtree.figures.CompositeTableFigure) TableFigure(org.whole.lang.ui.figures.TableFigure) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) EntityFigure(org.whole.lang.ui.figures.EntityFigure) IFeatureStyling(org.whole.lang.ui.notations.styledtree.styling.IFeatureStyling) Graphics(org.eclipse.draw2d.Graphics) TableRowFigure(org.whole.lang.ui.figures.TableRowFigure) NodeWithCompositeBranchFigure(org.whole.lang.ui.notations.styledtree.figures.NodeWithCompositeBranchFigure) CompositeFigure(org.whole.lang.ui.figures.CompositeFigure) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) MonoLayout(org.whole.lang.ui.layout.MonoLayout) CompositeTableFigure(org.whole.lang.ui.notations.styledtree.figures.CompositeTableFigure) TableLayout(org.whole.lang.ui.layout.TableLayout)

Aggregations

EntityFigure (org.whole.lang.ui.figures.EntityFigure)20 RowLayout (org.whole.lang.ui.layout.RowLayout)13 IEntityFigure (org.whole.lang.ui.figures.IEntityFigure)6 IFigure (org.eclipse.draw2d.IFigure)5 EntityButton (org.whole.lang.ui.figures.EntityButton)4 Graphics (org.eclipse.draw2d.Graphics)3 Dimension (org.eclipse.draw2d.geometry.Dimension)2 IEntity (org.whole.lang.model.IEntity)2 EntityLabel (org.whole.lang.ui.figures.EntityLabel)2 ColumnLayout (org.whole.lang.ui.layout.ColumnLayout)2 EntityXYLayout (org.whole.lang.ui.layout.EntityXYLayout)2 TableRowLayout (org.whole.lang.ui.layout.TableRowLayout)2 MarginBorder (org.eclipse.draw2d.MarginBorder)1 Point (org.eclipse.draw2d.geometry.Point)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 RootFragment (org.whole.lang.commons.model.RootFragment)1 FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)1 FeatureDescriptorEnum (org.whole.lang.reflect.FeatureDescriptorEnum)1 CompositeFigure (org.whole.lang.ui.figures.CompositeFigure)1 EntityToggle (org.whole.lang.ui.figures.EntityToggle)1