本文整理汇总了Java中org.jfree.ui.RectangleEdge.TOP属性的典型用法代码示例。如果您正苦于以下问题:Java RectangleEdge.TOP属性的具体用法?Java RectangleEdge.TOP怎么用?Java RectangleEdge.TOP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.jfree.ui.RectangleEdge
的用法示例。
在下文中一共展示了RectangleEdge.TOP属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLabelPosition
/**
* Returns the category label position specification for an axis at the
* given location.
*
* @param edge the axis location.
*
* @return The category label position specification.
*/
public CategoryLabelPosition getLabelPosition(RectangleEdge edge) {
CategoryLabelPosition result = null;
if (edge == RectangleEdge.TOP) {
result = this.positionForAxisAtTop;
}
else if (edge == RectangleEdge.BOTTOM) {
result = this.positionForAxisAtBottom;
}
else if (edge == RectangleEdge.LEFT) {
result = this.positionForAxisAtLeft;
}
else if (edge == RectangleEdge.RIGHT) {
result = this.positionForAxisAtRight;
}
return result;
}
示例2: add
/**
* Adds an axis to the collection.
*
* @param axis the axis (<code>null</code> not permitted).
* @param edge the edge of the plot that the axis should be drawn on
* (<code>null</code> not permitted).
*/
public void add(Axis axis, RectangleEdge edge) {
if (axis == null) {
throw new IllegalArgumentException("Null 'axis' argument.");
}
if (edge == null) {
throw new IllegalArgumentException("Null 'edge' argument.");
}
if (edge == RectangleEdge.TOP) {
this.axesAtTop.add(axis);
}
else if (edge == RectangleEdge.BOTTOM) {
this.axesAtBottom.add(axis);
}
else if (edge == RectangleEdge.LEFT) {
this.axesAtLeft.add(axis);
}
else if (edge == RectangleEdge.RIGHT) {
this.axesAtRight.add(axis);
}
}
示例3: add
/**
* Adds a block to the arrangement manager at the specified edge.
*
* @param block the block (<code>null</code> permitted).
* @param key the edge (an instance of {@link RectangleEdge}) or
* <code>null</code> for the center block.
*/
public void add(Block block, Object key) {
if (key == null) {
this.centerBlock = block;
}
else {
RectangleEdge edge = (RectangleEdge) key;
if (edge == RectangleEdge.TOP) {
this.topBlock = block;
}
else if (edge == RectangleEdge.BOTTOM) {
this.bottomBlock = block;
}
else if (edge == RectangleEdge.LEFT) {
this.leftBlock = block;
}
else if (edge == RectangleEdge.RIGHT) {
this.rightBlock = block;
}
}
}
示例4: calculateCategorySize
/**
* Calculates the size (width or height, depending on the location of the
* axis) of a category.
*
* @param categoryCount the number of categories.
* @param area the area within which the categories will be drawn.
* @param edge the axis location.
*
* @return The category size.
*/
protected double calculateCategorySize(int categoryCount, Rectangle2D area,
RectangleEdge edge) {
double result = 0.0;
double available = 0.0;
if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
available = area.getWidth();
}
else if ((edge == RectangleEdge.LEFT)
|| (edge == RectangleEdge.RIGHT)) {
available = area.getHeight();
}
if (categoryCount > 1) {
result = available * (1 - getLowerMargin() - getUpperMargin()
- getCategoryMargin());
result = result / categoryCount;
}
else {
result = available * (1 - getLowerMargin() - getUpperMargin());
}
return result;
}
示例5: drawAxisLine
/**
* Draws an axis line at the current cursor position and edge.
*
* @param g2 the graphics device.
* @param cursor the cursor position.
* @param dataArea the data area.
* @param edge the edge.
*/
protected void drawAxisLine(Graphics2D g2, double cursor,
Rectangle2D dataArea, RectangleEdge edge) {
Line2D axisLine = null;
if (edge == RectangleEdge.TOP) {
axisLine = new Line2D.Double(dataArea.getX(), cursor,
dataArea.getMaxX(), cursor);
}
else if (edge == RectangleEdge.BOTTOM) {
axisLine = new Line2D.Double(dataArea.getX(), cursor,
dataArea.getMaxX(), cursor);
}
else if (edge == RectangleEdge.LEFT) {
axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor,
dataArea.getMaxY());
}
else if (edge == RectangleEdge.RIGHT) {
axisLine = new Line2D.Double(cursor, dataArea.getY(), cursor,
dataArea.getMaxY());
}
g2.setPaint(this.axisLinePaint);
g2.setStroke(this.axisLineStroke);
g2.draw(axisLine);
}
示例6: reserved
/**
* Calculates the reserved area.
*
* @param area the area.
* @param edge the edge.
*
* @return The reserved area.
*/
public Rectangle2D reserved(Rectangle2D area, RectangleEdge edge) {
Rectangle2D result = null;
if (edge == RectangleEdge.TOP) {
result = new Rectangle2D.Double(area.getX(), area.getY(),
area.getWidth(), this.top);
}
else if (edge == RectangleEdge.BOTTOM) {
result = new Rectangle2D.Double(area.getX(), area.getMaxY() - this.top,
area.getWidth(), this.bottom);
}
else if (edge == RectangleEdge.LEFT) {
result = new Rectangle2D.Double(area.getX(), area.getY(),
this.left, area.getHeight());
}
else if (edge == RectangleEdge.RIGHT) {
result = new Rectangle2D.Double(area.getMaxX() - this.right, area.getY(),
this.right, area.getHeight());
}
return result;
}
示例7: getCategoryStart
/**
* Returns the starting coordinate for the specified category.
*
* @param category the category.
* @param categoryCount the number of categories.
* @param area the data area.
* @param edge the axis location.
*
* @return The coordinate.
*
* @see #getCategoryMiddle(int, int, Rectangle2D, RectangleEdge)
* @see #getCategoryEnd(int, int, Rectangle2D, RectangleEdge)
*/
public double getCategoryStart(int category, int categoryCount,
Rectangle2D area,
RectangleEdge edge) {
double result = 0.0;
if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
result = area.getX() + area.getWidth() * getLowerMargin();
}
else if ((edge == RectangleEdge.LEFT)
|| (edge == RectangleEdge.RIGHT)) {
result = area.getMinY() + area.getHeight() * getLowerMargin();
}
double categorySize = calculateCategorySize(categoryCount, area, edge);
double categoryGapWidth = calculateCategoryGapSize(categoryCount, area,
edge);
result = result + category * (categorySize + categoryGapWidth);
return result;
}
示例8: calculateAnchorPoint
/**
* Calculates the anchor point for a tick label.
*
* @param tick the tick.
* @param cursor the cursor.
* @param dataArea the data area.
* @param edge the edge on which the axis is drawn.
*
* @return the x and y coordinates of the anchor point.
*/
protected float[] calculateAnchorPoint(ValueTick tick,
double cursor,
Rectangle2D dataArea,
RectangleEdge edge) {
float[] result = new float[2];
if (edge == RectangleEdge.TOP) {
result[0] = (float) this.valueToJava2D(tick.getValue(), dataArea, edge);
result[1] = (float) (cursor - getTickLabelInsets().bottom - 2.0);
}
else if (edge == RectangleEdge.BOTTOM) {
result[0] = (float) this.valueToJava2D(tick.getValue(), dataArea, edge);
result[1] = (float) (cursor + getTickLabelInsets().top + 2.0);
}
else if (edge == RectangleEdge.LEFT) {
result[0] = (float) (cursor - getTickLabelInsets().left - 2.0);
result[1] = (float) this.valueToJava2D(tick.getValue(), dataArea, edge);
}
else if (edge == RectangleEdge.RIGHT) {
result[0] = (float) (cursor + getTickLabelInsets().right + 2.0);
result[1] = (float) this.valueToJava2D(tick.getValue(), dataArea, edge);
}
return result;
}
示例9: getLabelPosition
/**
* Returns the category label position specification for an axis at the given location.
*
* @param edge the axis location.
*
* @return the category label position specification.
*/
public CategoryLabelPosition getLabelPosition(RectangleEdge edge) {
CategoryLabelPosition result = null;
if (edge == RectangleEdge.TOP) {
result = this.positionForAxisAtTop;
}
else if (edge == RectangleEdge.BOTTOM) {
result = this.positionForAxisAtBottom;
}
else if (edge == RectangleEdge.LEFT) {
result = this.positionForAxisAtLeft;
}
else if (edge == RectangleEdge.RIGHT) {
result = this.positionForAxisAtRight;
}
return result;
}
示例10: calculateCategoryGapSize
/**
* Calculates the size (width or height, depending on the location of the
* axis) of a category gap.
*
* @param categoryCount the number of categories.
* @param area the area within which the categories will be drawn.
* @param edge the axis location.
*
* @return The category gap width.
*/
protected double calculateCategoryGapSize(int categoryCount,
Rectangle2D area,
RectangleEdge edge) {
double result = 0.0;
double available = 0.0;
if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
available = area.getWidth();
}
else if ((edge == RectangleEdge.LEFT)
|| (edge == RectangleEdge.RIGHT)) {
available = area.getHeight();
}
if (categoryCount > 1) {
result = available * getCategoryMargin() / (categoryCount - 1);
}
return result;
}
示例11: reserved
/**
* Calculates the reserved area.
*
* @param area the area.
* @param edge the edge.
*
* @return The reserved area.
*/
public Rectangle2D reserved(Rectangle2D area, RectangleEdge edge) {
Rectangle2D result = null;
if (edge == RectangleEdge.TOP) {
result = new Rectangle2D.Double(
area.getX(), area.getY(), area.getWidth(), this.top
);
}
else if (edge == RectangleEdge.BOTTOM) {
result = new Rectangle2D.Double(
area.getX(), area.getMaxY() - this.top,
area.getWidth(), this.bottom
);
}
else if (edge == RectangleEdge.LEFT) {
result = new Rectangle2D.Double(
area.getX(), area.getY(), this.left, area.getHeight()
);
}
else if (edge == RectangleEdge.RIGHT) {
result = new Rectangle2D.Double(
area.getMaxX() - this.right, area.getY(),
this.right, area.getHeight()
);
}
return result;
}
示例12: resolveDomainAxisLocation
/**
* Resolves a domain axis location for a given plot orientation.
*
* @param location the location (<code>null</code> not permitted).
* @param orientation the orientation (<code>null</code> not permitted).
*
* @return The edge (never <code>null</code>).
*/
public static RectangleEdge resolveDomainAxisLocation(
AxisLocation location, PlotOrientation orientation) {
if (location == null) {
throw new IllegalArgumentException("Null 'location' argument.");
}
if (orientation == null) {
throw new IllegalArgumentException("Null 'orientation' argument.");
}
RectangleEdge result = null;
if (location == AxisLocation.TOP_OR_RIGHT) {
if (orientation == PlotOrientation.HORIZONTAL) {
result = RectangleEdge.RIGHT;
}
else if (orientation == PlotOrientation.VERTICAL) {
result = RectangleEdge.TOP;
}
}
else if (location == AxisLocation.TOP_OR_LEFT) {
if (orientation == PlotOrientation.HORIZONTAL) {
result = RectangleEdge.LEFT;
}
else if (orientation == PlotOrientation.VERTICAL) {
result = RectangleEdge.TOP;
}
}
else if (location == AxisLocation.BOTTOM_OR_RIGHT) {
if (orientation == PlotOrientation.HORIZONTAL) {
result = RectangleEdge.RIGHT;
}
else if (orientation == PlotOrientation.VERTICAL) {
result = RectangleEdge.BOTTOM;
}
}
else if (location == AxisLocation.BOTTOM_OR_LEFT) {
if (orientation == PlotOrientation.HORIZONTAL) {
result = RectangleEdge.LEFT;
}
else if (orientation == PlotOrientation.VERTICAL) {
result = RectangleEdge.BOTTOM;
}
}
// the above should cover all the options...
if (result == null) {
throw new IllegalStateException("resolveDomainAxisLocation()");
}
return result;
}
示例13: refreshTicksHorizontal
/**
* Calculates the positions of the tick labels for the axis, storing the
* results in the tick label list (ready for drawing).
*
* @param g2 the graphics device.
* @param dataArea the area in which the data should be drawn.
* @param edge the location of the axis.
*
* @return A list of ticks.
*/
protected List refreshTicksHorizontal(Graphics2D g2,
Rectangle2D dataArea,
RectangleEdge edge) {
List result = new java.util.ArrayList();
Font tickLabelFont = getTickLabelFont();
g2.setFont(tickLabelFont);
if (isAutoTickUnitSelection()) {
selectAutoTickUnit(g2, dataArea, edge);
}
double size = getTickUnit().getSize();
int count = calculateVisibleTickCount();
double lowestTickValue = calculateLowestVisibleTickValue();
if (count <= ValueAxis.MAXIMUM_TICK_COUNT) {
for (int i = 0; i < count; i++) {
double currentTickValue = lowestTickValue + (i * size);
String tickLabel;
NumberFormat formatter = getNumberFormatOverride();
if (formatter != null) {
tickLabel = formatter.format(currentTickValue);
}
else {
tickLabel = getTickUnit().valueToString(currentTickValue);
}
TextAnchor anchor = null;
TextAnchor rotationAnchor = null;
double angle = 0.0;
if (isVerticalTickLabels()) {
anchor = TextAnchor.CENTER_RIGHT;
rotationAnchor = TextAnchor.CENTER_RIGHT;
if (edge == RectangleEdge.TOP) {
angle = Math.PI / 2.0;
}
else {
angle = -Math.PI / 2.0;
}
}
else {
if (edge == RectangleEdge.TOP) {
anchor = TextAnchor.BOTTOM_CENTER;
rotationAnchor = TextAnchor.BOTTOM_CENTER;
}
else {
anchor = TextAnchor.TOP_CENTER;
rotationAnchor = TextAnchor.TOP_CENTER;
}
}
Tick tick = new NumberTick(
new Double(currentTickValue), tickLabel, anchor,
rotationAnchor, angle
);
result.add(tick);
}
}
return result;
}
示例14: resolveRangeAxisLocation
/**
* Resolves a range axis location for a given plot orientation.
*
* @param location the location (<code>null</code> not permitted).
* @param orientation the orientation (<code>null</code> not permitted).
*
* @return the edge (never <code>null</code>).
*/
public static RectangleEdge resolveRangeAxisLocation(AxisLocation location,
PlotOrientation orientation) {
if (location == null) {
throw new IllegalArgumentException("Null 'location' argument.");
}
if (orientation == null) {
throw new IllegalArgumentException("Null 'orientation' argument.");
}
RectangleEdge result = null;
if (location == AxisLocation.TOP_OR_RIGHT) {
if (orientation == PlotOrientation.HORIZONTAL) {
result = RectangleEdge.TOP;
}
else if (orientation == PlotOrientation.VERTICAL) {
result = RectangleEdge.RIGHT;
}
}
else if (location == AxisLocation.TOP_OR_LEFT) {
if (orientation == PlotOrientation.HORIZONTAL) {
result = RectangleEdge.TOP;
}
else if (orientation == PlotOrientation.VERTICAL) {
result = RectangleEdge.LEFT;
}
}
else if (location == AxisLocation.BOTTOM_OR_RIGHT) {
if (orientation == PlotOrientation.HORIZONTAL) {
result = RectangleEdge.BOTTOM;
}
else if (orientation == PlotOrientation.VERTICAL) {
result = RectangleEdge.RIGHT;
}
}
else if (location == AxisLocation.BOTTOM_OR_LEFT) {
if (orientation == PlotOrientation.HORIZONTAL) {
result = RectangleEdge.BOTTOM;
}
else if (orientation == PlotOrientation.VERTICAL) {
result = RectangleEdge.LEFT;
}
}
// the above should cover all the options...
if (result == null) {
throw new IllegalStateException("XYPlot.resolveRangeAxisLocation(...)");
}
return result;
}
示例15: draw
/**
* Draws the axis on a Java 2D graphics device (such as the screen or a printer).
*
* @param g2 the graphics device (<code>null</code> not permitted).
* @param cursor the cursor location.
* @param plotArea the area within which the axis should be drawn (<code>null</code> not
permitted).
* @param dataArea the area within which the plot is being drawn (<code>null</code> not
* permitted).
* @param edge the location of the axis (<code>null</code> not permitted).
* @param plotState collects information about the plot (<code>null</code> permitted).
*
* @return the axis state (never <code>null</code>).
*/
public AxisState draw(Graphics2D g2,
double cursor,
Rectangle2D plotArea,
Rectangle2D dataArea,
RectangleEdge edge,
PlotRenderingInfo plotState) {
// if the axis is not visible, don't draw it...
if (!isVisible()) {
return new AxisState(cursor);
}
// calculate the adjusted data area taking into account the 3D effect...
// this assumes that there is a 3D renderer, all this 3D effect is a bit of an
// ugly hack...
CategoryPlot plot = (CategoryPlot) getPlot();
Rectangle2D adjustedDataArea = new Rectangle2D.Double();
if (plot.getRenderer() instanceof Effect3D) {
Effect3D e3D = (Effect3D) plot.getRenderer();
double adjustedX = dataArea.getMinX();
double adjustedY = dataArea.getMinY();
double adjustedW = dataArea.getWidth() - e3D.getXOffset();
double adjustedH = dataArea.getHeight() - e3D.getYOffset();
if (edge == RectangleEdge.LEFT || edge == RectangleEdge.BOTTOM) {
adjustedY += e3D.getYOffset();
}
else if (edge == RectangleEdge.RIGHT || edge == RectangleEdge.TOP) {
adjustedX += e3D.getXOffset();
}
adjustedDataArea.setRect(adjustedX, adjustedY, adjustedW, adjustedH);
}
else {
adjustedDataArea.setRect(dataArea);
}
// draw the category labels and axis label
AxisState state = new AxisState(cursor);
state = drawCategoryLabels(g2, plotArea, adjustedDataArea, edge, state, plotState);
state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state);
return state;
}