Package edu.stanford.nlp.ling

Examples of edu.stanford.nlp.ling.CoreAnnotations$TextAnnotation


        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("textAnnotation.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = getRootProcess(definitions);
        assertTrue(process.getArtifacts().iterator().next() instanceof TextAnnotation);
        TextAnnotation ta = (TextAnnotation) process.getArtifacts().iterator().next();
        assertEquals("text annotation", ta.getText());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here


        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("association.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = getRootProcess(definitions);
        Task g = (Task) process.getFlowElements().get(0);
        assertEquals("task", g.getName());
        TextAnnotation textA = (TextAnnotation) process.getArtifacts().get(0);
        Association association = (Association) process.getArtifacts().get(1);
        assertEquals(g, association.getSourceRef());
        assertEquals(textA, association.getTargetRef());
        assertEquals(AssociationDirection.NONE, association.getAssociationDirection());
        definitions.eResource().save(System.out, Collections.emptyMap());
View Full Code Here

        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("associationOne.json"), "").getContents().get(0));
        Process process = getRootProcess(definitions);
        Task g = (Task) process.getFlowElements().get(0);
        assertEquals("task", g.getName());
        TextAnnotation textA = (TextAnnotation) process.getArtifacts().get(0);
        Association association = (Association) process.getArtifacts().get(1);
        assertEquals(g, association.getSourceRef());
        assertEquals(textA, association.getTargetRef());
        assertEquals(AssociationDirection.ONE, association.getAssociationDirection());
        definitions.eResource().save(System.out, Collections.emptyMap());
View Full Code Here

        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("associationBoth.json"), "").getContents().get(0));
        Process process = getRootProcess(definitions);
        Task g = (Task) process.getFlowElements().get(0);
        assertEquals("task", g.getName());
        TextAnnotation textA = (TextAnnotation) process.getArtifacts().get(0);
        Association association = (Association) process.getArtifacts().get(1);
        assertEquals(g, association.getSourceRef());
        assertEquals(textA, association.getTargetRef());
        assertEquals(AssociationDirection.BOTH, association.getAssociationDirection());
        definitions.eResource().save(System.out, Collections.emptyMap());
View Full Code Here

            if (result == null)
                result = defaultCase(theEObject);
            return result;
        }
        case Bpmn2Package.TEXT_ANNOTATION: {
            TextAnnotation textAnnotation = (TextAnnotation) theEObject;
            T result = caseTextAnnotation(textAnnotation);
            if (result == null)
                result = caseArtifact(textAnnotation);
            if (result == null)
                result = caseBaseElement(textAnnotation);
View Full Code Here

    return intoDiagram || intoLane;
  }

  @Override
  public Object[] create(ICreateContext context) {
    TextAnnotation ta = null;

    try {
      ModelHandler mh = ModelHandlerLocator.getModelHandler(getDiagram().eResource());
      ta = ModelHandler.FACTORY.createTextAnnotation();
//      ta.setId(EcoreUtil.generateUUID());
      mh.addArtifact(FeatureSupport.getTargetParticipant(context, mh), ta);
      ta.setText("Enter your comment here");
    } catch (IOException e) {
      Activator.logError(e);
    }

    addGraphicalRepresentation(context, ta);
View Full Code Here

    }

  @Override
    public String getInitialValue(IDirectEditingContext context) {
    PictogramElement pe = context.getPictogramElement();
    TextAnnotation annotation = (TextAnnotation) getBusinessObjectForPictogramElement(pe);
    return annotation.getText();
  }
View Full Code Here

  }

  @Override
    public void setValue(String value, IDirectEditingContext context) {
    PictogramElement pe = context.getPictogramElement();
    TextAnnotation annotation = (TextAnnotation) getBusinessObjectForPictogramElement(pe);
    annotation.setText(value);
    updatePictogramElement(((Shape) pe).getContainer());
    }
View Full Code Here

    return isAnnotation && (intoDiagram || intoLane || intoSubProcess);
  }

  @Override
  public PictogramElement add(IAddContext context) {
    TextAnnotation annotation = (TextAnnotation) context.getNewObject();

    IPeCreateService peCreateService = Graphiti.getPeCreateService();
    ContainerShape containerShape = peCreateService.createContainerShape(context.getTargetContainer(), true);

    IGaService gaService = Graphiti.getGaService();

    int width = context.getWidth() > 0 ? context.getWidth() : 50;
    int height = context.getHeight() > 0 ? context.getHeight() : 100;
    int commentEdge = 15;

    Rectangle rect = gaService.createInvisibleRectangle(containerShape);
    gaService.setLocationAndSize(rect, context.getX(), context.getY(), width, height);

    Shape lineShape = peCreateService.createShape(containerShape, false);
    Polyline line = gaService.createPolyline(lineShape, new int[] { commentEdge, 0, 0, 0, 0, height, commentEdge,
        height });
    line.setStyle(StyleUtil.getStyleForClass(getDiagram()));
    line.setLineWidth(2);
    gaService.setLocationAndSize(line, 0, 0, commentEdge, height);

    Shape textShape = peCreateService.createShape(containerShape, false);
    MultiText text = gaService.createDefaultMultiText(getDiagram(), textShape, annotation.getText());
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
    gaService.setLocationAndSize(text, 5, 5, width - 5, height - 5);

    createDIShape(containerShape, annotation);
View Full Code Here

    Object o = BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(), BaseElement.class);
    if (o instanceof FlowElement) {
      FlowElement e = (FlowElement) o;
      return e.getName();
    } else if (o instanceof TextAnnotation) {
      TextAnnotation a = (TextAnnotation) o;
      return a.getText();
    } else if (o instanceof Participant) {
      Participant p = (Participant) o;
      return p.getName();
    } else if (o instanceof Lane) {
      Lane l = (Lane) o;
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.ling.CoreAnnotations$TextAnnotation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.