Package org.tinyuml.draw

Examples of org.tinyuml.draw.Label


  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

    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

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

  public ComponentElement(UmlComponent aComponent,
    Compartment theMainCompartment) {
    component = aComponent;
    mainCompartment = theMainCompartment;
    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

  public ComponentElement(UmlComponent aComponent,
    Compartment theMainCompartment) {
    component = aComponent;
    mainCompartment = theMainCompartment;
    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

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

    assertTrue(cloned.getModelElement() != element.getModelElement());
    assertTrue(cloned.getMainCompartment() != element.getMainCompartment());
    assertTrue(cloned.getMainCompartment().getParent() == cloned);
    // tests the contained label
    assertEquals(1, cloned.getMainCompartment().getLabels().size());
    Label label = cloned.getMainCompartment().getLabels().get(0);
    assertTrue(cloned.getMainCompartment() == label.getParent());
    assertTrue(label.getSource() == cloned);
  }
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

   * Stops the editing process if one was active.
   */
  private void stopEditing() {
    if (captionEditor.isVisible()) {
      String text = captionEditor.getText();
      Label label = captionEditor.getLabel();
      DrawingContext drawCtx = prepareDrawingContext(getGraphics());
      SetLabelTextCommand command = new SetLabelTextCommand(label, text,
        drawCtx);
      execute(command);
      captionEditor.hideEditor();
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.