Package org.tinyuml.draw

Examples of org.tinyuml.draw.Label


    // 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


    if (multilineEditor.isVisible()) {
      currentEditor = multilineEditor;
    }
    if (currentEditor != null && currentEditor.isVisible()) {
      String text = currentEditor.getText();
      Label label = currentEditor.getLabel();
      SetLabelTextCommand command = new SetLabelTextCommand(label, text);
      execute(command);
      currentEditor.hideEditor();
      repaint();
      return true;
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);
      execute(command);
      currentEditor.hideEditor();
      repaint();
      return true;
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

 
  /**
   * Tests the clone() method.
   */
  public void testClone() {
    Label oldlabel = new Label();
    oldlabel.setOrigin(0, 0);
    oldlabel.setSize(100, 100);
    Compartment original = new Compartment();
    original.setParent((CompositeNode) mockParent.proxy());
    compartment.addLabel(oldlabel);
   
    // Test cloned object
View Full Code Here

    assertNotSame(lifeline, cloned);
    assertNotSame(lifeline.getModelElement(), cloned.getModelElement());
    assertNotSame(lifeline.getMainCompartment(), cloned.getMainCompartment());
    assertTrue(cloned == cloned.getMainCompartment().getParent());
    assertEquals(1, cloned.getMainCompartment().getLabels().size());
    Label label = cloned.getMainCompartment().getLabels().get(0);
    assertTrue(cloned.getMainCompartment() == label.getParent());
    assertTrue(cloned == label.getSource());
  }
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);
      execute(command);
      currentEditor.hideEditor();
      repaint();
      return true;
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.