Package org.tinyuml.draw

Examples of org.tinyuml.draw.Label


  /**
   * {@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


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

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

  }
  /**
   * Tests the clone() method.
   */
  public void testClone() {
    Label oldlabel = new SimpleLabel();
    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

   */
  private ClassElement() {
    mainCompartment = new Compartment();
    attributesCompartment = new Compartment();
    operationsCompartment = new Compartment();
    mainLabel = new Label();
    mainLabel.setSource(this);
    mainCompartment.addLabel(mainLabel);
    mainCompartment.setParent(this);
    attributesCompartment.setParent(this);
    attributesCompartment.setAlignment(Alignment.LEFT);
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 Label();
      label.setSource(new UmlModelElementLabelSource(property));
      attributesCompartment.addLabel(label);
    }
    operationsCompartment.removeAllLabels();
    for (UmlProperty property : ((UmlClass) element).getMethods()) {
      Label label = new Label();
      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 Label();
        label.setSource(new UmlModelElementLabelSource(stereotype));
        mainCompartment.addLabel(label);
      }
    }
    mainCompartment.addLabel(mainLabel);
  }
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 Label();
    mainLabel.setSource(this);
    mainLabel.setFontType(FontType.ELEMENT_NAME);
    mainCompartment.addLabel(mainLabel);
    setMinimumSize(MIN_WIDTH, MIN_HEIGHT);
    mainCompartment.setMarginTop(MARGIN_TOP);
  }
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

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.