Java 类org.jfree.chart.block.LengthConstraintType 实例源码

项目:neoload-plugin    文件:NeoloadGraphXPathStat.java   
private int computeLegendHeight(final JFreeChart chart, final int imageWidth) {
    if (chart.getSubtitleCount() == 0) {
        return 0;
    }

    BufferedImage image = new BufferedImage(imageWidth, IMAGE_HEIGHT, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2 = image.createGraphics();
    RectangleConstraint constraint = new RectangleConstraint(
            imageWidth, new Range(0.0, imageWidth), LengthConstraintType.RANGE,
            0.0, null, LengthConstraintType.NONE
    );
    int height = 0;
    for (int i = 0; i < chart.getSubtitleCount(); i++) {
        final Title subtitle = chart.getSubtitle(i);
        final Size2D arrange = subtitle.arrange(g2, constraint);
        height += arrange.getHeight();
    }
    return height;
}
项目:parabuild-ci    文件:GridArrangementTests.java   
/**
 * Test arrangement with no constraints.
 */
public void testFN() {
    BlockContainer c = createTestContainer1();
    RectangleConstraint constraint = new RectangleConstraint(
        100.0, null, LengthConstraintType.FIXED, 
        0.0, null, LengthConstraintType.NONE
    );
    Size2D s = c.arrange(null, constraint);
    assertEquals(100.0, s.width, EPSILON);
    assertEquals(33.0, s.height, EPSILON);
}
项目:nabs    文件:GridArrangementTests.java   
/**
 * Test arrangement with no constraints.
 */
public void testFN() {
    BlockContainer c = createTestContainer1();
    RectangleConstraint constraint = new RectangleConstraint(
        100.0, null, LengthConstraintType.FIXED, 
        0.0, null, LengthConstraintType.NONE
    );
    Size2D s = c.arrange(null, constraint);
    assertEquals(100.0, s.width, EPSILON);
    assertEquals(33.0, s.height, EPSILON);
}
项目:astor    文件:GridArrangementTests.java   
/**
 * Test arrangement with a fixed width and no height constraint.
 */
public void testFN() {
    BlockContainer c = createTestContainer1();
    RectangleConstraint constraint = new RectangleConstraint(100.0, null,
            LengthConstraintType.FIXED, 0.0, null,
            LengthConstraintType.NONE);
    Size2D s = c.arrange(null, constraint);
    assertEquals(100.0, s.width, EPSILON);
    assertEquals(33.0, s.height, EPSILON);
}
项目:parabuild-ci    文件:TextTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and 
 * returns the block size.
 * 
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 * 
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }            
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(), 
                    cc.getHeightRange()); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:HTML5_WebSite    文件:LegendGraphic.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint contentConstraint = toContentConstraint(constraint);
    LengthConstraintType w = contentConstraint.getWidthConstraintType();
    LengthConstraintType h = contentConstraint.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            contentSize = new Size2D(
                contentConstraint.getWidth(),
                contentConstraint.getHeight()
            );
        }
    }
    return new Size2D(
        calculateTotalWidth(contentSize.getWidth()),
        calculateTotalHeight(contentSize.getHeight())
    );
}
项目:HTML5_WebSite    文件:TextTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeRN(g2, cc.getWidthRange());
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeFN(g2, cc.getWidth());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:HTML5_WebSite    文件:ShortTextTitle.java   
/**
 * Performs a layout for this title, subject to the supplied constraint,
 * and returns the dimensions required for the title (if the title
 * cannot be displayed in the available space, this method will return
 * zero width and height for the dimensions).
 *
 * @param g2  the graphics target.
 * @param constraint  the layout constraints.
 *
 * @return The dimensions for the title.
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeRN(g2, cc.getWidthRange());
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeFN(g2, cc.getWidth());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    if (contentSize.width <= 0.0 || contentSize.height <= 0.0) {
        return new Size2D(0.0, 0.0);
    }
    else {
        return new Size2D(calculateTotalWidth(contentSize.getWidth()),
                calculateTotalHeight(contentSize.getHeight()));
    }
}
项目:HTML5_WebSite    文件:PaintScaleLegend.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = new Size2D(getWidth(), getHeight());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:PI    文件:LegendGraphic.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint contentConstraint = toContentConstraint(constraint);
    LengthConstraintType w = contentConstraint.getWidthConstraintType();
    LengthConstraintType h = contentConstraint.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            contentSize = new Size2D(
                contentConstraint.getWidth(),
                contentConstraint.getHeight()
            );
        }
    }
    return new Size2D(
        calculateTotalWidth(contentSize.getWidth()),
        calculateTotalHeight(contentSize.getHeight())
    );
}
项目:PI    文件:TextTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeRN(g2, cc.getWidthRange());
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeFN(g2, cc.getWidth());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:PI    文件:ShortTextTitle.java   
/**
 * Performs a layout for this title, subject to the supplied constraint,
 * and returns the dimensions required for the title (if the title
 * cannot be displayed in the available space, this method will return
 * zero width and height for the dimensions).
 *
 * @param g2  the graphics target.
 * @param constraint  the layout constraints.
 *
 * @return The dimensions for the title.
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeRN(g2, cc.getWidthRange());
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeFN(g2, cc.getWidth());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    if (contentSize.width <= 0.0 || contentSize.height <= 0.0) {
        return new Size2D(0.0, 0.0);
    }
    else {
        return new Size2D(calculateTotalWidth(contentSize.getWidth()),
                calculateTotalHeight(contentSize.getHeight()));
    }
}
项目:PI    文件:PaintScaleLegend.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = new Size2D(getWidth(), getHeight());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:nabs    文件:LegendGraphic.java   
/**
 * Arranges the contents of the block, within the given constraints, and 
 * returns the block size.
 * 
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 * 
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint contentConstraint = toContentConstraint(constraint);
    LengthConstraintType w = contentConstraint.getWidthConstraintType();
    LengthConstraintType h = contentConstraint.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {   
            contentSize = new Size2D(
                contentConstraint.getWidth(),
                contentConstraint.getHeight()
            );
        }            
    }
    return new Size2D(
        calculateTotalWidth(contentSize.getWidth()), 
        calculateTotalHeight(contentSize.getHeight())
    );
}
项目:nabs    文件:TextTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and 
 * returns the block size.
 * 
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 * 
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }            
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(), 
                    cc.getHeightRange()); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:nabs    文件:PaintScaleLegend.java   
/**
 * Arranges the contents of the block, within the given constraints, and 
 * returns the block size.
 * 
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 * 
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = new Size2D(getWidth(), getHeight()); 
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }            
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(), 
                    cc.getHeightRange()); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:astor    文件:LegendGraphic.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint contentConstraint = toContentConstraint(constraint);
    LengthConstraintType w = contentConstraint.getWidthConstraintType();
    LengthConstraintType h = contentConstraint.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            contentSize = new Size2D(
                contentConstraint.getWidth(),
                contentConstraint.getHeight()
            );
        }
    }
    return new Size2D(
        calculateTotalWidth(contentSize.getWidth()),
        calculateTotalHeight(contentSize.getHeight())
    );
}
项目:astor    文件:TextTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeRN(g2, cc.getWidthRange());
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeFN(g2, cc.getWidth());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:astor    文件:ShortTextTitle.java   
/**
 * Performs a layout for this title, subject to the supplied constraint,
 * and returns the dimensions required for the title (if the title
 * cannot be displayed in the available space, this method will return
 * zero width and height for the dimensions).
 *
 * @param g2  the graphics target.
 * @param constraint  the layout constraints.
 *
 * @return The dimensions for the title.
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeRN(g2, cc.getWidthRange());
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeFN(g2, cc.getWidth());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    if (contentSize.width <= 0.0 || contentSize.height <= 0.0) {
        return new Size2D(0.0, 0.0);
    }
    else {
        return new Size2D(calculateTotalWidth(contentSize.getWidth()),
                calculateTotalHeight(contentSize.getHeight()));
    }
}
项目:astor    文件:PaintScaleLegend.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = new Size2D(getWidth(), getHeight());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:opensim-gui    文件:LegendGraphic.java   
/**
 * Arranges the contents of the block, within the given constraints, and 
 * returns the block size.
 * 
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 * 
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint contentConstraint = toContentConstraint(constraint);
    LengthConstraintType w = contentConstraint.getWidthConstraintType();
    LengthConstraintType h = contentConstraint.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {   
            contentSize = new Size2D(
                contentConstraint.getWidth(),
                contentConstraint.getHeight()
            );
        }            
    }
    return new Size2D(
        calculateTotalWidth(contentSize.getWidth()), 
        calculateTotalHeight(contentSize.getHeight())
    );
}
项目:opensim-gui    文件:TextTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and 
 * returns the block size.
 * 
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 * 
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }            
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(), 
                    cc.getHeightRange()); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:opensim-gui    文件:PaintScaleLegend.java   
/**
 * Arranges the contents of the block, within the given constraints, and 
 * returns the block size.
 * 
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 * 
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = new Size2D(getWidth(), getHeight()); 
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }            
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(), 
                    cc.getHeightRange()); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented."); 
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");                 
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:proyecto-teoria-control-utn-frro    文件:LegendGraphic.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint contentConstraint = toContentConstraint(constraint);
    LengthConstraintType w = contentConstraint.getWidthConstraintType();
    LengthConstraintType h = contentConstraint.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            contentSize = new Size2D(
                contentConstraint.getWidth(),
                contentConstraint.getHeight()
            );
        }
    }
    return new Size2D(
        calculateTotalWidth(contentSize.getWidth()),
        calculateTotalHeight(contentSize.getHeight())
    );
}
项目:proyecto-teoria-control-utn-frro    文件:TextTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeRN(g2, cc.getWidthRange());
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeFN(g2, cc.getWidth());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:proyecto-teoria-control-utn-frro    文件:ShortTextTitle.java   
/**
 * Performs a layout for this title, subject to the supplied constraint,
 * and returns the dimensions required for the title (if the title
 * cannot be displayed in the available space, this method will return
 * zero width and height for the dimensions).
 *
 * @param g2  the graphics target.
 * @param constraint  the layout constraints.
 *
 * @return The dimensions for the title.
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeRN(g2, cc.getWidthRange());
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeFN(g2, cc.getWidth());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    if (contentSize.width <= 0.0 || contentSize.height <= 0.0) {
        return new Size2D(0.0, 0.0);
    }
    else {
        return new Size2D(calculateTotalWidth(contentSize.getWidth()),
                calculateTotalHeight(contentSize.getHeight()));
    }
}
项目:proyecto-teoria-control-utn-frro    文件:PaintScaleLegend.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = new Size2D(getWidth(), getHeight());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:Memetic-Algorithm-for-TSP    文件:LegendGraphic.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint contentConstraint = toContentConstraint(constraint);
    LengthConstraintType w = contentConstraint.getWidthConstraintType();
    LengthConstraintType h = contentConstraint.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            contentSize = new Size2D(
                contentConstraint.getWidth(),
                contentConstraint.getHeight()
            );
        }
    }
    return new Size2D(
        calculateTotalWidth(contentSize.getWidth()),
        calculateTotalHeight(contentSize.getHeight())
    );
}
项目:Memetic-Algorithm-for-TSP    文件:TextTitle.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeRN(g2, cc.getWidthRange());
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeFN(g2, cc.getWidth());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}
项目:Memetic-Algorithm-for-TSP    文件:ShortTextTitle.java   
/**
 * Performs a layout for this title, subject to the supplied constraint,
 * and returns the dimensions required for the title (if the title
 * cannot be displayed in the available space, this method will return
 * zero width and height for the dimensions).
 *
 * @param g2  the graphics target.
 * @param constraint  the layout constraints.
 *
 * @return The dimensions for the title.
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeNN(g2);
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeRN(g2, cc.getWidthRange());
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            contentSize = arrangeFN(g2, cc.getWidth());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    if (contentSize.width <= 0.0 || contentSize.height <= 0.0) {
        return new Size2D(0.0, 0.0);
    }
    else {
        return new Size2D(calculateTotalWidth(contentSize.getWidth()),
                calculateTotalHeight(contentSize.getHeight()));
    }
}
项目:Memetic-Algorithm-for-TSP    文件:PaintScaleLegend.java   
/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = new Size2D(getWidth(), getHeight());
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(),
                    cc.getHeightRange());
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        }
        else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    return new Size2D(calculateTotalWidth(contentSize.getWidth()),
            calculateTotalHeight(contentSize.getHeight()));
}