use of org.whole.lang.ui.figures.IEntityFigure in project whole by wholeplatform.
the class GrammarBasedUIUtils method createCompositeFigure.
public static IEntityFigure createCompositeFigure(IEntity entity) {
ILanguageKit lk = entity.wGetLanguageKit();
EntityDescriptorEnum edEnum = lk.getEntityDescriptorEnum();
FeatureDescriptorEnum fdEnum = lk.getFeatureDescriptorEnum();
IEntity configuration = Matcher.findAncestor(edEnum.valueOf("CompositePart"), entity);
IEntity multiline = configuration.wGet(fdEnum.valueOf("multiline"));
boolean isMultiline = EntityUtils.safeBooleanValue(multiline, false);
IEntity columns = configuration.wGet(fdEnum.valueOf("columns"));
int columnsNum = EntityUtils.safeIntValue(columns, 0);
IEntity separator = configuration.wGet(fdEnum.valueOf("separator"));
IEntityFigure entityFigure;
if (EntityUtils.isNotResolver(separator)) {
String separatorText = GrammarBasedUIUtils.calculateSeparator(separator);
CompositeFigure compositeFigure = isMultiline ? new StringSeparatedCompositeColumnFigure(separatorText, 10) : new StringSeparatedCompositeRowFigure(separatorText, 10);
if (isMultiline)
compositeFigure.getLayoutManager().withMinorAlignment(Alignment.LEADING);
entityFigure = compositeFigure;
} else if (columnsNum > 0) {
TableFigure tableFigure = new TableFigure(columnsNum);
tableFigure.setBorder(CompositePlaceHolderBorder.OPTIONAL_VERTICAL);
entityFigure = tableFigure;
} else
entityFigure = new CompositeFigure(!isMultiline, true);
return entityFigure;
}
use of org.whole.lang.ui.figures.IEntityFigure 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;
}
use of org.whole.lang.ui.figures.IEntityFigure in project whole by wholeplatform.
the class CompositeTableFigure method createTypeLabelFigure.
protected IEntityFigure createTypeLabelFigure() {
IEntityFigure typeFigure = createContentPane(0, ViewportTracking.HORIZONTAL);
typeFigure.getLayoutManager().withMargin(2, 4, 2, 8);
return typeFigure;
}
use of org.whole.lang.ui.figures.IEntityFigure in project whole by wholeplatform.
the class XsiCompositeElementPart method createFigure.
@Override
protected IFigure createFigure() {
boolean startOpened = !getContents().isEmpty();
IEntityFigure figure = new XsiCompositeElementNodeFigure(startOpened, createLabel());
if (isRoot)
figure.setBorder(new MarginBorder(4, 8, 2, 4));
return figure;
}
use of org.whole.lang.ui.figures.IEntityFigure in project whole by wholeplatform.
the class InteractiveTreeSearch method prune.
public boolean prune(IFigure figure) {
boolean value;
if (figure instanceof IEntityFigure) {
IEntityFigure entityFigure = (IEntityFigure) figure;
value = entityFigure.isInteractiveInherited() ? peekInheritedInteractiveEdit(figure) : entityFigure.isInteractiveEdit();
} else
value = peekInheritedInteractiveEdit(figure);
inheritedInteractiveStack.set(inheritedInteractiveStack.length(), value);
return false;
}
Aggregations