use of org.whole.lang.reflect.FeatureDescriptorEnum 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.reflect.FeatureDescriptorEnum 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.reflect.FeatureDescriptorEnum in project whole by wholeplatform.
the class GrammarBasedUIUtils method createTerminalFigure.
public static IEntityFigure createTerminalFigure(IEntity entity) {
FeatureDescriptorEnum fdEnum = entity.wGetLanguageKit().getFeatureDescriptorEnum();
IEntity category = entity.wGet(fdEnum.valueOf("category"));
IEntity literal = entity.wGet(fdEnum.valueOf("literal"));
EntityLabel label = createEntityLabel(category);
label.setText(StringUtils.unescapeString(DataTypeUtils.getAsPresentationString(literal)));
return label;
}
use of org.whole.lang.reflect.FeatureDescriptorEnum in project whole by wholeplatform.
the class E4Utils method createErrorStatusContents.
public static IEntity createErrorStatusContents(String error, String cause) {
ILanguageKit languageKit = ReflectionFactory.getLanguageKit(CoreMetaModelsDeployer.STATUS_URI, false, null);
FeatureDescriptorEnum fdEnum = languageKit.getFeatureDescriptorEnum();
IEntity statusModel = createErrorStatusContents();
statusModel.wGet(fdEnum.valueOf("error")).wSetValue(error);
statusModel.wGet(fdEnum.valueOf("cause")).wSetValue(cause);
return statusModel;
}
use of org.whole.lang.reflect.FeatureDescriptorEnum in project whole by wholeplatform.
the class AbstractFreeformNodePart method refreshVisuals.
protected void refreshVisuals() {
IEntity e = getPresentationEntity();
FeatureDescriptorEnum fe = e.wGetEntityDescriptor().getFeatureDescriptorEnum();
Rectangle bounds = new Rectangle(e.wGet(fe.valueOf("x")).wIntValue(), e.wGet(fe.valueOf("y")).wIntValue(), e.wGet(fe.valueOf("width")).wIntValue(), e.wGet(fe.valueOf("height")).wIntValue());
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), bounds);
}
Aggregations