org.kie.workbench.common.stunner.core.diagram.Diagram类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中org.kie.workbench.common.stunner.core.diagram.Diagram类的一些代码示例,展示了Diagram类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Diagram类的具体详情如下:
包路径:org.kie.workbench.common.stunner.core.diagram.Diagram
类名称:Diagram

Diagram介绍

暂无

代码示例

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-backend-common

private void domainValidation(Diagram diagram, Consumer<DiagramElementViolation<RuleViolation>> callback) {
    StreamSupport.stream(validators.spliterator(), false)
        .filter(validator -> Objects.equals(validator.getDefinitionSetId(), diagram.getMetadata().getDefinitionSetId()))
        .findFirst()
        .ifPresent(validator -> validator.validate(diagram, domainViolations ->
            callback.accept(new ElementViolationImpl.Builder()
                        .setUuid(diagram.getGraph().getUUID())
                        .setDomainViolations(domainViolations)
                        .build())));
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-widgets

@SuppressWarnings("unchecked")
private Notification translateCommand(final AbstractCanvasCommandEvent<? extends CanvasHandler> commandExecutedEvent) {
  final CanvasHandler canvasHandler = commandExecutedEvent.getCanvasHandler();
  final NotificationContext context = NotificationContext.Builder.build(canvasHandler.toString(),
                                     canvasHandler.getDiagram().getName(),
                                     canvasHandler.getDiagram().getMetadata().getTitle());
  return notificationBuilder.createCommandNotification(context,
                             commandExecutedEvent.getCommand(),
                             commandExecutedEvent.getResult());
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-backend-common

@Override
@SuppressWarnings("unchecked")
public String marshall(final Diagram<Graph, Metadata> diagram) throws IOException {
  String result = ServerMarshalling.toJSON(diagram.getGraph());
  return result;
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common

public static boolean isCanvasRoot(final Diagram diagram,
                  final String pUUID) {
  final String canvasRoot = diagram.getMetadata().getCanvasRootUUID();
  return (null != canvasRoot && null != pUUID && canvasRoot.equals(pUUID));
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Test
  public void testBuild() {
    final Diagram<Graph, Metadata> diagram = tested.build(NAME,
                               metadata,
                               graph);
    assertNotNull(diagram);
    assertEquals(NAME,
           diagram.getName());
    assertEquals(metadata,
           diagram.getMetadata());
    assertEquals(graph,
           diagram.getGraph());
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Override
public boolean equals(final Object o) {
  if (this == o) {
    return true;
  }
  if (!(o instanceof Diagram)) {
    return false;
  }
  Diagram that = (Diagram) o;
  return name != null && name.equals(that.getName());
}

代码示例来源:origin: org.kie.workbench/kie-wb-common-dmn-client

protected Graph getGraph() {
  final Diagram diagram = handler.getDiagram();
  return diagram.getGraph();
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-widgets

private void loadPreferences(final Diagram<Graph, Metadata> diagram,
                 final ParameterizedCommand<StunnerPreferences> callback,
                 final ParameterizedCommand<Throwable> errorCallback) {
    final Metadata metadata = diagram.getMetadata();
    preferencesRegistryLoader.load(metadata,
                    callback,
                    errorCallback);
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-backend-common

@Override
public String getRawContent(D diagram) {
  try {
    return serialize(diagram)[0];
  } catch (java.io.IOException e) {
    LOG.error("Error while getting raw content for diagram with UUID [" + diagram.getName() + "].",
         e);
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common

@SuppressWarnings("unchecked")
public Node<View<?>, Edge> getParent(final double _x,
                   final double _y) {
  if (_x > -1 && _y > -1) {
    final String rootUUID = canvasHandler.getDiagram().getMetadata().getCanvasRootUUID();
    graphBoundsIndexer.setRootUUID(rootUUID).build(canvasHandler.getDiagram().getGraph());
    final Node<View<?>, Edge> r = graphBoundsIndexer.getAt(_x,
                                _y);
    return r;
  }
  return null;
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-bpmn-client

private Node getSourceNode(Diagram diagram, String edgeUuid) {
  final Iterator<Node> nodes = diagram.getGraph().nodes().iterator();
  Node<?, ? extends Edge> sourceNode;
  while (nodes.hasNext()) {
    sourceNode = nodes.next();
    if (sourceNode.getOutEdges().stream()
        .anyMatch(edge -> edge.getUUID().equals(edgeUuid))) {
      return sourceNode;
    }
  }
  return null;
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-bpmn-backend

@Override
public boolean accepts(final Diagram diagram) {
  return this.definitionSetId.equals(diagram.getMetadata().getDefinitionSetId());
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Before
public void setup() throws Exception {
  this.graphTestHandler = new TestingGraphMockHandler();
  when(diagram.getName()).thenReturn("Test diagram");
  when(diagram.getMetadata()).thenReturn(metadata);
  this.tested = new TestDiagramValidator();
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-backend

@Override
protected boolean matches(final String criteria,
             final Diagram<Graph, Metadata> item) {
  final Map<String, String> criteriaMap = AbstractCriteriaLookupManager.parseCriteria(criteria);
  final String name = criteriaMap.get(DiagramLookupRequest.CRITERIA_NAME);
  if (null != name && name.trim().length() > 0) {
    return name.equals(item.getName());
  }
  return true;
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common

@SuppressWarnings("unchecked")
private void start(final AbstractCanvasHandler canvasHandler) {
  canvasHighlight = canvasHighlightBuilder.apply(canvasHandler);
  graphBoundsIndexer.setRootUUID(canvasHandler.getDiagram().getMetadata().getCanvasRootUUID());
  graphBoundsIndexer.build(canvasHandler.getDiagram().getGraph());
  edgeBuilderControl.init(canvasHandler);
  edgeBuilderControl.setCommandManagerProvider(() -> sessionCommandManager);
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common

protected void destroyGraph(final Command callback) {
  destroyGraphIndex(() -> {
    if (null != diagram && null != diagram.getGraph()) {
      diagram.getGraph().clear();
    }
    callback.execute();
  });
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common

protected void fireSavedEvent(D diagram) {
  saveEvent.fire(new SaveDiagramSessionCommandExecutedEvent(diagram.getMetadata().getCanvasRootUUID()));
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-backend-common

@SuppressWarnings("unchecked")
private M register(final D diagram) {
  try {
    String[] raw = serialize(diagram);
    return doSave(diagram,
           raw[0],
           raw[1]);
  } catch (Exception e) {
    LOG.error("Error while saving diagram with UUID [" + diagram.getName() + "].",
         e);
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-backend-common

private String getDiagramSvgFileName(Diagram diagram) {
  final Object metaProperty = definitionManager.adapters()
      .forDefinition()
      .getMetaProperty(PropertyMetaTypes.ID,
               ((Definition) diagram.getGraph()
                   .getNode(diagram.getMetadata().getCanvasRootUUID())
                   .getContent()).getDefinition());
  final Object diagramFileId = definitionManager.adapters().forProperty().getValue(metaProperty);
  return String.valueOf(diagramFileId).concat(SVG_SUFFIX);
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-bpmn-client

protected void onFormFieldChanged(@Observes FormFieldChanged formFieldChanged) {
  Optional.ofNullable(isSelected)
      .map(Supplier::get)
      .filter(Boolean.TRUE::equals)
      .map(focus -> getDiagram()
          .map(d -> d.getGraph().getNode(formFieldChanged.getUuid()))
      ).ifPresent(focus -> refresh());
}

相关文章