use of org.whole.lang.model.IEntity in project whole by wholeplatform.
the class AbstractConnectedFreeformRootPart method createEditPolicies.
// public IFigure getContentPane() {
// return pane;
// }
protected void createEditPolicies() {
installEditPolicy(EditPolicy.CONTAINER_ROLE, new WholeContainerEditPolicy(getCommandFactory()));
installEditPolicy(EditPolicy.COMPONENT_ROLE, new WholeComponentEditPolicy(getCommandFactory()));
installEditPolicy(EditPolicy.LAYOUT_ROLE, new WholeFreeformLayoutEditPolicy((XYLayout) getContentPane().getLayoutManager(), getCommandFactory()) {
protected DnDOverCompositeRequest createDnDOverCompositeRequest(IEntity entity) {
return new DnDOverCompositeRequest(PartRequest.MOVE_ADD_CHILD, (IEntityPart) getHost(), entity, null) {
@Override
public IEntity getModelEntity() {
// FIXME workaround to get nodes composite
IEntity modelEntity = super.getModelEntity().wGet(0);
return modelEntity;
}
};
}
});
installEditPolicy("Snap Feedback", new SnapFeedbackPolicy());
}
use of org.whole.lang.model.IEntity in project whole by wholeplatform.
the class AbstractFreeformContentPanePart method refreshVisuals.
@Override
protected void refreshVisuals() {
IEntity e = getPresentationEntity();
FeatureDescriptorEnum fe = e.wGetEntityDescriptor().getFeatureDescriptorEnum();
int x = e.wGet(fe.valueOf("x")).wIntValue();
int y = e.wGet(fe.valueOf("y")).wIntValue();
// int width = e.wGet(fe.valueOf("width")).wIntValue();
// int height = e.wGet(fe.valueOf("height")).wIntValue();
// width, height);
Rectangle bounds = new Rectangle(x, y, -1, -1);
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), bounds);
}
use of org.whole.lang.model.IEntity in project whole by wholeplatform.
the class AbstractNodePart method getSourceConnectionAnchor.
public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connection) {
IEntity e = getModelEntity();
IEntity c = (IEntity) connection.getModel();
for (int i = 0; i < sourceFeatures.length; i++) {
IEntity ec = e.wGet(sourceFeatures[i]);
switch(ec.wGetEntityKind()) {
case COMPOSITE:
if (ec.wContains(c))
return getNodeFigure().getSourceAnchor(i);
break;
case SIMPLE:
if (ec == c)
return getNodeFigure().getSourceAnchor(i);
break;
case DATA:
throw new IllegalStateException("unsupported entity kind");
}
}
return null;
}
use of org.whole.lang.model.IEntity in project whole by wholeplatform.
the class AbstractNodePart method getModelConnections.
@SuppressWarnings({ "unchecked" })
protected List<IEntity> getModelConnections(FeatureDescriptor[] features) {
IEntity e = getModelEntity();
List<IEntity> result = new ArrayList<IEntity>(features.length);
for (int i = 0; i < features.length; i++) {
IEntity c = e.wGet(features[i]);
if (EntityUtils.isResolver(c))
continue;
switch(c.wGetEntityKind()) {
case COMPOSITE:
result.addAll((Collection<? extends IEntity>) c);
break;
case SIMPLE:
result.add(c);
break;
case DATA:
throw new IllegalStateException("unsupported entity kind");
}
}
return result;
}
use of org.whole.lang.model.IEntity in project whole by wholeplatform.
the class AbstractPart method getParentModelEntity.
public IEntity getParentModelEntity() {
IEntity modelEntity = getModelEntity();
IEntity parentModelEntity = modelEntity.wGetParent();
if (!EntityUtils.isNull(parentModelEntity))
return parentModelEntity;
else
return getParentPartModelEntity();
}
Aggregations