import org.simantics.g2d.element.handler.InternalSize;
import org.simantics.g2d.element.handler.Move;
import org.simantics.g2d.element.handler.Outline;
+import org.simantics.g2d.element.handler.Parameters;
import org.simantics.g2d.element.handler.Parent;
import org.simantics.g2d.element.handler.Pick;
import org.simantics.g2d.element.handler.Resize;
public static Collection<Terminal> getTerminals(IElement e, Collection<Terminal> result, boolean clearResult) {
if (clearResult)
result.clear();
- TerminalTopology tt = e.getElementClass().getSingleItem(TerminalTopology.class);
- tt.getTerminals(e, result);
+ TerminalTopology tt = e.getElementClass().getAtMostOneItemOfClass(TerminalTopology.class);
+ if (tt != null) {
+ tt.getTerminals(e, result);
+ }
return result;
}
e.getElementClass().getSingleItem(Transform.class).setTransform(e, at);
}
+ public static void setParameters(IElement e, Map<String,Object> parameters)
+ {
+ Parameters ps = e.getElementClass().getSingleItem(Parameters.class);
+ if(ps != null) ps.setParameters(e, parameters);
+ }
+
+ public static Map<String,Object> getParameters(IElement e)
+ {
+ Parameters ps = e.getElementClass().getAtMostOneItemOfClass(Parameters.class);
+ return ps != null ? ps.getParameters(e) : null;
+ }
+
public static AffineTransform getInvTransform(IElement e)
{
try {
// If the previously available node is not a parent of the specified
// node create a new node under the specified parent and set that
// as the node of the specified element.
- if (!node.getParent().equals(withParentNode)) {
+ if (!withParentNode.equals(node.getParent())) {
node = nodeId != null ? withParentNode.getOrCreateNode(nodeId, nodeClass) : withParentNode.addNode(nodeClass);
forElement.setHint(withNodeKey, node);
if (nodeCreationCallback != null)