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("");
}
}
}
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);
}
}
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();
}
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();
}
}
}
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;
}
Aggregations