Package org.tinyuml.draw

Examples of org.tinyuml.draw.Compartment


   */
  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
    mockParent.expects(atLeastOnce()).method("getAbsoluteX1")
      .will(returnValue(0.0));
    mockParent.expects(atLeastOnce()).method("getAbsoluteY1")
      .will(returnValue(0.0));
   
    Compartment cloned = (Compartment) compartment.clone();
    assertTrue(cloned.getParent() == compartment.getParent());
    assertNotNull(cloned.getLabelAt(5, 5));
    assertTrue(compartment.getLabelAt(5, 5) != cloned.getLabelAt(5, 5));
    assertTrue(cloned.getLabelAt(5, 5).getParent() == cloned);
    assertTrue(compartment.getLabelAt(5, 5).getSource() ==
               cloned.getLabelAt(5, 5).getSource());
  }
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);
View Full Code Here

   */
  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
    mockParent.expects(atLeastOnce()).method("getAbsoluteX1")
      .will(returnValue(0.0));
    mockParent.expects(atLeastOnce()).method("getAbsoluteY1")
      .will(returnValue(0.0));
   
    Compartment cloned = (Compartment) compartment.clone();
    assertTrue(cloned.getParent() == compartment.getParent());
    assertNotNull(cloned.getLabelAt(5, 5));
    assertTrue(compartment.getLabelAt(5, 5) != cloned.getLabelAt(5, 5));
    assertTrue(cloned.getLabelAt(5, 5).getParent() == cloned);
    assertTrue(compartment.getLabelAt(5, 5).getSource() ==
               cloned.getLabelAt(5, 5).getSource());
  }
View Full Code Here

  /**
   * Private constructor.
   */
  private ClassElement() {
    mainCompartment = new Compartment();
    attributesCompartment = new Compartment();
    operationsCompartment = new Compartment();
    mainLabel = new SimpleLabel();
    mainLabel.setSource(this);
    mainCompartment.addLabel(mainLabel);
    mainCompartment.setParent(this);
    attributesCompartment.setParent(this);
View Full Code Here

  /**
   * Resizes the last visible compartment to fit within the total height.
   */
  private void resizeLastCompartmentToFit() {
    Compartment lastCompartment = getLastVisibleCompartment();
    double diffHeight = getSize().getHeight() - getCompartmentHeightSum();
    lastCompartment.setHeight(lastCompartment.getSize().getHeight() +
                              diffHeight);
  }
View Full Code Here

  /**
   * Returns the last visible compartment.
   * @return the last visible compartment
   */
  private Compartment getLastVisibleCompartment() {
    Compartment lastCompartment = mainCompartment;
    if (showAttributes) lastCompartment = attributesCompartment;
    if (showOperations) lastCompartment = operationsCompartment;
    return lastCompartment;
  }
View Full Code Here

  /**
   * Constructor.
   */
  private PackageElement() {
    tabCompartment = new Compartment();
    tabCompartment.setParent(this);
    tabCompartment.setBackground(BACKGROUND);
    tabCompartment.setAspectToParentWidth(0.33);
    mainCompartment = new Compartment();
    mainCompartment.setParent(this);
    mainCompartment.setBackground(BACKGROUND);
    mainLabel.setParent(this);
    mainLabel.setFontType(FontType.ELEMENT_NAME);
    mainLabel.setSource(this);
View Full Code Here

   */
  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
    mockParent.expects(atLeastOnce()).method("getAbsoluteX1")
      .will(returnValue(0.0));
    mockParent.expects(atLeastOnce()).method("getAbsoluteY1")
      .will(returnValue(0.0));
   
    Compartment cloned = (Compartment) compartment.clone();
    assertTrue(cloned.getParent() == compartment.getParent());
    assertNotNull(cloned.getLabelAt(5, 5));
    assertTrue(compartment.getLabelAt(5, 5) != cloned.getLabelAt(5, 5));
    assertTrue(cloned.getLabelAt(5, 5).getParent() == cloned);
    assertTrue(compartment.getLabelAt(5, 5).getSource() ==
               cloned.getLabelAt(5, 5).getSource());
  }
View Full Code Here

  /**
   * Private constructor.
   */
  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);
View Full Code Here

  /**
   * Resizes the last visible compartment to fit within the total height.
   */
  private void resizeLastCompartmentToFit() {
    Compartment lastCompartment = getLastVisibleCompartment();
    double diffHeight = getSize().getHeight() - getCompartmentHeightSum();
    lastCompartment.setHeight(lastCompartment.getSize().getHeight() +
                              diffHeight);
  }
View Full Code Here

TOP

Related Classes of org.tinyuml.draw.Compartment

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.