Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.TextAnnotation


    // text annotation
    artifactDrawInstructions.put(TextAnnotation.class, new ArtifactDrawInstruction() {

      public void draw(DefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, Artifact artifact) {
        GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(artifact.getId());
        TextAnnotation textAnnotation = (TextAnnotation) artifact;
        processDiagramCanvas.drawTextAnnotation(textAnnotation.getText(), graphicInfo);
      }
    });
   
    // association
    artifactDrawInstructions.put(Association.class, new ArtifactDrawInstruction() {
View Full Code Here


    return ELEMENT_TEXT_ANNOTATION;
  }
 
  @Override
  protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
    TextAnnotation textAnnotation = new TextAnnotation();
    BpmnXMLUtil.addXMLLocation(textAnnotation, xtr);
    textAnnotation.setTextFormat(xtr.getAttributeValue(null, ATTRIBUTE_TEXTFORMAT));
    parseChildElements(getXMLElementName(), textAnnotation, childParserMap, model, xtr);
    return textAnnotation;
  }
View Full Code Here

    return textAnnotation;
  }

  @Override
  protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
    TextAnnotation textAnnotation = (TextAnnotation) element;
    writeDefaultAttribute(ATTRIBUTE_TEXTFORMAT, textAnnotation.getTextFormat(), xtw);
  }
View Full Code Here

    writeDefaultAttribute(ATTRIBUTE_TEXTFORMAT, textAnnotation.getTextFormat(), xtw);
  }
 
  @Override
  protected void writeAdditionalChildElements(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
    TextAnnotation textAnnotation = (TextAnnotation) element;
    if (StringUtils.isNotEmpty(textAnnotation.getText())) {
      xtw.writeStartElement(ELEMENT_TEXT_ANNOTATION_TEXT);
      xtw.writeCharacters(textAnnotation.getText());
      xtw.writeEndElement();
    }
  }
View Full Code Here

          }
          documentationParser.parseChildElement(xtr, parentElement, model);
       
        } else if (activeProcess == null && ELEMENT_TEXT_ANNOTATION.equals(xtr.getLocalName())) {
          String elementId = xtr.getAttributeValue(null, ATTRIBUTE_ID);
          TextAnnotation textAnnotation = (TextAnnotation) new TextAnnotationXMLConverter().convertXMLToElement(xtr, model);
          textAnnotation.setId(elementId);
          model.getGlobalArtifacts().add(textAnnotation);
         
        } else if (activeProcess == null && ELEMENT_ASSOCIATION.equals(xtr.getLocalName())) {
          String elementId = xtr.getAttributeValue(null, ATTRIBUTE_ID);
          Association association = (Association) new AssociationXMLConverter().convertXMLToElement(xtr, model);
View Full Code Here

     
      if (!(bo instanceof TextAnnotation)) {
        return;
      }
     
      final TextAnnotation ta = (TextAnnotation) bo;
      String annotationText = ta.getText();
      if (annotationText != null) {
        text.removeFocusListener(listener);
        text.setText(annotationText);
        text.addFocusListener(listener);
      } else {
View Full Code Here

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

  }

  @Override
  public void setValue(String value, IDirectEditingContext context) {
    final PictogramElement pe = context.getPictogramElement();
    final 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) {
    final TextAnnotation annotation = (TextAnnotation) context.getNewObject();
   
    final IPeCreateService peCreateService = Graphiti.getPeCreateService();
    final ContainerShape containerShape = peCreateService.createContainerShape(context.getTargetContainer(), true);
   
    final IGaService gaService = Graphiti.getGaService();
   
    // TODO: we currently only support horizontal lanes!!!
    final int height = Math.max(50, context.getHeight());
    final int width = Math.max(100, context.getWidth());
    final int commentEdge = 20;
   
    final Rectangle rect = gaService.createInvisibleRectangle(containerShape);
    gaService.setLocationAndSize(rect, context.getX(), context.getY(), width, height);
   
    final Shape lineShape = peCreateService.createShape(containerShape, false);
    final Polyline line
      = gaService.createPolyline(lineShape
          , new int[] { commentEdge, 0, 0, 0, 0, height, commentEdge, height });
    line.setStyle(StyleUtil.getStyleForTask(getDiagram()));
    line.setLineWidth(2);
    gaService.setLocationAndSize(line, 0, 0, commentEdge, height);
   
    final Shape textShape = peCreateService.createShape(containerShape, false);
    final MultiText text = gaService.createDefaultMultiText(getDiagram(), textShape, annotation.getText());
    text.setStyle(StyleUtil.getStyleForTask(getDiagram()));
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
    if (OSUtil.getOperatingSystem() == OSEnum.Mac) {
      text.setFont(gaService.manageFont(getDiagram(), text.getFont().getName(), 11));
    }
View Full Code Here

    super(fp, "Annotation", "Provides additional textual information");
  }
 
  @Override
  public Object[] create(ICreateContext context) {
    final TextAnnotation ta = new TextAnnotation();
   
    ta.setText("Enter your text here");
     
    addObjectToContainer(context, ta);
   
    return new Object[] { ta };
  }
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.model.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.