Search in sources :

Example 11 with IEntityFigure

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

the class TestGroupResultsFigure method update.

public void update(Results expected, Results actual) {
    setVisible(EntityUtils.isImpl(actual));
    if (isVisible()) {
        for (int i = 0; i < RESULTS_FEATURES; i++) {
            Label actualLabel = (Label) actualResults[i].getChildren().get(0);
            actualLabel.setText(EntityUtils.isImpl(actual) ? DataTypeUtils.getAsPresentationString(actual.wGet(i)) : "0");
            Label expectedLabel = (Label) expectedResults[i].getChildren().get(0);
            expectedLabel.setText(EntityUtils.isImpl(expected) ? DataTypeUtils.getAsPresentationString(expected.wGet(i)) : "0");
            IEntityFigure expectedOutcome = (IEntityFigure) expectedResults[i].getChildren().get(1);
            expectedOutcome.setVisible(EntityUtils.isImpl(expected) && !actualLabel.getText().equals(expectedLabel.getText()));
            if (!expectedOutcome.isVisible())
                expectedLabel.setText("");
        }
    }
}
Also used : IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) Label(org.eclipse.draw2d.Label)

Example 12 with IEntityFigure

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

the class E4GraphicalViewer method setInteractive.

public void setInteractive(IEntity entity, boolean edit, boolean browse, boolean inherited) {
    Map<?, ?> mapping = getEditPartRegistry();
    IGraphicalEntityPart entityPart = (IGraphicalEntityPart) mapping.get(entity);
    if (entityPart != null) {
        IEntityFigure entityFigure = (IEntityFigure) entityPart.getFigure();
        entityFigure.setInteractiveEdit(edit);
        entityFigure.setInteractiveBrowse(browse);
        entityFigure.setInteractiveInherited(inherited);
    }
}
Also used : IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) IGraphicalEntityPart(org.whole.lang.ui.editparts.IGraphicalEntityPart)

Example 13 with IEntityFigure

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

the class HandlersBehavior method canSelectAll.

public static boolean canSelectAll(IBindingManager bm) {
    IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
    IEntity entityContents = viewer.getEntityContents();
    IGraphicalEntityPart contents = (IGraphicalEntityPart) viewer.getEditPartRegistry().get(entityContents);
    return ((IEntityFigure) contents.getFigure()).isInteractiveEdit();
}
Also used : IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) IEntity(org.whole.lang.model.IEntity) IGraphicalEntityPart(org.whole.lang.ui.editparts.IGraphicalEntityPart) IEntityPartViewer(org.whole.lang.ui.viewers.IEntityPartViewer)

Example 14 with IEntityFigure

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

the class TableLayout method setPrefSize.

protected void setPrefSize(int wHint, int hHint) {
    updateColumns();
    boolean isInvalid = false;
    columnWidth = new int[columns()];
    columnSpacingBefore = new int[columns() + 1];
    for (int rowIndex = 0; rowIndex < rows(); rowIndex++) {
        IEntityFigure row = getRow(rowIndex);
        if (row.isVisible()) {
            ITabularLayoutClient tabularLayoutClient = row.getTabularLayoutClient();
            for (int columnIndex = 0; columnIndex < columns(); columnIndex++) {
                int width = tabularLayoutClient.getPreferredCellSize(columnIndex, wHint, hHint).width;
                if (width > columnWidth[columnIndex]) {
                    columnWidth[columnIndex] = width;
                    if (rowIndex > 0)
                        isInvalid = true;
                }
                int sp = tabularLayoutClient.getPreferredCellSpacingBefore(columnIndex);
                if (sp > columnSpacingBefore[columnIndex]) {
                    columnSpacingBefore[columnIndex] = sp;
                    if (rowIndex > 0)
                        isInvalid = true;
                }
            }
            int sp = tabularLayoutClient.getPreferredCellSpacingBefore(columns());
            if (sp > columnSpacingBefore[columns()]) {
                columnSpacingBefore[columns()] = sp;
                isInvalid = true;
            }
        }
    }
    for (int rowIndex = 0; rowIndex < rows(); rowIndex++) {
        IEntityFigure row = getRow(rowIndex);
        if (row.isVisible()) {
            ITabularLayoutClient tabularLayoutClient = row.getTabularLayoutClient();
            tabularLayoutClient.invalidateCells();
        }
    }
}
Also used : IEntityFigure(org.whole.lang.ui.figures.IEntityFigure)

Example 15 with IEntityFigure

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

the class AbstractEntityLayout method getChildSize.

protected BaselinedDimension getChildSize(IFigure child, int wHint, int hHint, boolean preferred) {
    Dimension d = preferred ? child.getPreferredSize(wHint, hHint) : child.getMinimumSize(wHint, hHint);
    BaselinedDimension bd;
    if (d instanceof BaselinedDimension)
        bd = (BaselinedDimension) d;
    else {
        bd = new BaselinedDimension(d);
        if (child instanceof IEntityFigure) {
            bd.indent = ((IEntityFigure) child).getIndent();
            bd.ascent = ((IEntityFigure) child).getAscent();
        } else
            bd.ascent = bd.height / 2;
    }
    return bd;
}
Also used : IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) Dimension(org.eclipse.draw2d.geometry.Dimension)

Aggregations

IEntityFigure (org.whole.lang.ui.figures.IEntityFigure)25 IFigure (org.eclipse.draw2d.IFigure)10 Rectangle (org.eclipse.draw2d.geometry.Rectangle)6 IEntity (org.whole.lang.model.IEntity)5 EntityFigure (org.whole.lang.ui.figures.EntityFigure)5 Point (org.eclipse.draw2d.geometry.Point)4 TableFigure (org.whole.lang.ui.figures.TableFigure)4 List (java.util.List)3 Graphics (org.eclipse.draw2d.Graphics)3 CompositeFigure (org.whole.lang.ui.figures.CompositeFigure)3 TableRowFigure (org.whole.lang.ui.figures.TableRowFigure)3 RowLayout (org.whole.lang.ui.layout.RowLayout)3 TableLayout (org.whole.lang.ui.layout.TableLayout)3 Dimension (org.eclipse.draw2d.geometry.Dimension)2 FeatureDescriptorEnum (org.whole.lang.reflect.FeatureDescriptorEnum)2 IGraphicalEntityPart (org.whole.lang.ui.editparts.IGraphicalEntityPart)2 INodeFigure (org.whole.lang.ui.figures.INodeFigure)2 StringSeparatedCompositeRowFigure (org.whole.lang.ui.figures.StringSeparatedCompositeRowFigure)2 ICompositeEntityLayout (org.whole.lang.ui.layout.ICompositeEntityLayout)2 Label (org.eclipse.draw2d.Label)1