Package org.tinyuml.draw

Examples of org.tinyuml.draw.Label


 
  /**
   * Tests the getLabelAt() method.
   */
  public void testGetLabelAt() {
    Label aLabel1 = new Label() {
      public boolean contains(double x, double y) { return true; }
    };
    assertEquals(aLabel1, aLabel1.getLabelAt(2.0, 3.0));

    Label aLabel2 = new Label() {
      public boolean contains(double x, double y) { return false; }
    };
    assertNull(aLabel2.getLabelAt(2.0, 3.0));
  }
View Full Code Here


    if (multilineEditor.isVisible()) {
      currentEditor = multilineEditor;
    }
    if (currentEditor != null && currentEditor.isVisible()) {
      String text = currentEditor.getText();
      Label label = currentEditor.getLabel();
      SetLabelTextCommand command = new SetLabelTextCommand(label, text);
      diagramEditor.execute(command);
      currentEditor.hideEditor();
      diagramEditor.repaint();
      return true;
View Full Code Here

   * Private constructor.
   */
  private LifeLineElement() {
    mainCompartment = new Compartment();
    mainCompartment.setParent(this);
    Label mainLabel = new SimpleLabel();
    mainLabel.setSource(this);
    mainLabel.setFontType(FontType.ELEMENT_NAME);
    mainCompartment.addLabel(mainLabel);
  }
View Full Code Here

    cloned.mainCompartment = (Compartment) mainCompartment.clone();
    cloned.mainCompartment.setParent(cloned);
    if (cloned.getModelElement() != null) {
      cloned.setModelElement((UmlLifeLine) getModelElement().clone());
    }
    Label mainLabel = new SimpleLabel();
    mainLabel.setSource(cloned);
    mainLabel.setFontType(FontType.ELEMENT_NAME);
    cloned.mainCompartment.getLabels().clear();
    cloned.mainCompartment.addLabel(mainLabel);
    return cloned;
  }
View Full Code Here

    // this is a pretty ugly cast, it is needed in order to use the getLabel()
    // method which is not a base DiagramElement method
    DiagramElement previousSelected = currentSelection.getElement();
    DiagramElement element = editor.getDiagram().getChildAt(mx, my);
    if (element instanceof UmlDiagramElement && previousSelected == element) {
      Label label = element.getLabelAt(mx, my);
      if (label != null) {
        editor.editLabel(label);
      } else if (e.getClickCount() >= 2) {
        editor.editProperties(element);
      }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public Label getLabelAt(double mx, double my) {
    Label labelAt = tabCompartment.getLabelAt(mx, my);
    if (labelAt == null) labelAt = mainCompartment.getLabelAt(mx, my);
    return labelAt;
  }
View Full Code Here

   * Private constructor.
   */
  private ComponentElement() {
    mainCompartment = new Compartment();
    mainCompartment.setParent(this);
    Label mainLabel = new SimpleLabel();
    mainLabel.setSource(this);
    mainLabel.setFontType(FontType.ELEMENT_NAME);
    mainCompartment.addLabel(mainLabel);
    setMinimumSize(MIN_WIDTH, MIN_HEIGHT);
    mainCompartment.setMarginTop(MARGIN_TOP);
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public Label getLabelAt(double mx, double my) {
    Label label = mainCompartment.getLabelAt(mx, my);
    if (label == null && showAttributes) {
      label = attributesCompartment.getLabelAt(mx, my);
    }
    if (label == null && showOperations) {
      label = operationsCompartment.getLabelAt(mx, my);
View Full Code Here

   * {@inheritDoc}
   */
  public void elementChanged(UmlModelElement element) {
    attributesCompartment.removeAllLabels();
    for (UmlProperty property : ((UmlClass) element).getAttributes()) {
      Label label = new SimpleLabel();
      label.setSource(new UmlModelElementLabelSource(property));
      attributesCompartment.addLabel(label);
    }
    operationsCompartment.removeAllLabels();
    for (UmlProperty property : ((UmlClass) element).getMethods()) {
      Label label = new SimpleLabel();
      label.setSource(new UmlModelElementLabelSource(property));
      operationsCompartment.addLabel(label);
    }
    reinitMainCompartment();
    invalidate();
  }
View Full Code Here

  private void reinitMainCompartment() {
    UmlClass umlclass = (UmlClass) getModelElement();
    mainCompartment.removeAllLabels();
    if (showStereotypes) {
      for (UmlStereotype stereotype : umlclass.getStereotypes()) {
        Label label = new SimpleLabel();
        label.setSource(new UmlModelElementLabelSource(stereotype));
        mainCompartment.addLabel(label);
      }
    }
    mainCompartment.addLabel(mainLabel);
  }
View Full Code Here

TOP

Related Classes of org.tinyuml.draw.Label

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.