コード例 #1
0
 @Before
 public void setup() throws Exception {
   super.setup();
   when(parent.getUUID()).thenReturn(PARENT_ID);
   when(child.getUUID()).thenReturn(CHILD_ID);
   this.tested = new RemoveCanvasChildCommand(parent, child);
 }
コード例 #2
0
  @SuppressWarnings("unchecked")
  private boolean getState() {
    boolean doEnable = false;
    final Diagram diagram =
        null != getSession() ? getSession().getCanvasHandler().getDiagram() : null;
    if (null != diagram) {
      final Graph graph = diagram.getGraph();
      if (null != graph) {
        final String rootUUID = diagram.getMetadata().getCanvasRootUUID();
        Iterable<Node> nodes = graph.nodes();
        final boolean hasNodes = null != nodes && nodes.iterator().hasNext();
        if (hasNodes) {
          final Iterator<Node> nodesIt = nodes.iterator();
          final Node node = nodesIt.next();
          if (nodesIt.hasNext()) {
            doEnable = true;

          } else {
            doEnable = null == rootUUID || !rootUUID.equals(node.getUUID());
          }
        }
      }
    }
    return doEnable;
  }