List of usage examples for org.jfree.ui RectangleInsets getLeft
public double getLeft()
From source file:com.jaspersoft.studio.components.chart.model.theme.util.PadUtil.java
public static RectangleInsets setPropertyValue(Object id, Object value, RectangleInsets ri, String preID) { if (ri == null) ri = PadUtil.RECTANGLE_INSETS;/*from w w w . j av a 2 s . c o m*/ if (value == null) value = 0.0d; if (id.equals(preID + PadUtil.PADDING_TOP)) return new RectangleInsets((Double) value, ri.getLeft(), ri.getBottom(), ri.getRight()); else if (id.equals(preID + PadUtil.PADDING_BOTTOM)) return new RectangleInsets(ri.getTop(), ri.getLeft(), (Double) value, ri.getRight()); else if (id.equals(preID + PadUtil.PADDING_LEFT)) return new RectangleInsets(ri.getTop(), (Double) value, ri.getBottom(), ri.getRight()); else if (id.equals(preID + PadUtil.PADDING_RIGHT)) return new RectangleInsets(ri.getTop(), ri.getLeft(), ri.getBottom(), (Double) value); return null; }
From source file:org.toobsframework.pres.chart.ChartUtil.java
public static void configureLegend(IRequest componentRequest, JFreeChart chart, Legend legend, Map params) { if (legend != null) { if (legend.getBorder() != null) { RectangleInsets rect = getRectangle(componentRequest, legend.getBorder(), params); chart.getLegend().setBorder(rect.getTop(), rect.getLeft(), rect.getBottom(), rect.getRight()); }/* w w w . j ava2 s . c o m*/ if (legend.getPadding() != null) { chart.getLegend().setItemLabelPadding(getRectangle(componentRequest, legend.getPadding(), params)); } } }
From source file:com.jaspersoft.studio.components.chart.model.theme.util.PadUtil.java
public static Object getPropertyValue(Object id, RectangleInsets ri, String preID) { if (ri == null) ri = PadUtil.RECTANGLE_INSETS;/*w ww . j av a 2 s .co m*/ if (id.equals(preID + PadUtil.PADDING_TOP)) return ri.getTop(); if (id.equals(preID + PadUtil.PADDING_BOTTOM)) return ri.getBottom(); if (id.equals(preID + PadUtil.PADDING_LEFT)) return ri.getLeft(); if (id.equals(preID + PadUtil.PADDING_RIGHT)) return ri.getRight(); return null; }
From source file:net.sf.jasperreports.customizers.marker.AbstractMarkerCustomizer.java
protected void configureMarker(Marker marker) { String label = getProperty(PROPERTY_LABEL); if (label != null && label.length() > 0) { marker.setLabel(label);/*from w w w . ja va 2s . co m*/ } RectangleAnchorEnum labelAnchor = RectangleAnchorEnum.getByName(getProperty(PROPERTY_LABEL_ANCHOR)); if (labelAnchor != null) { marker.setLabelAnchor(labelAnchor.getRectangleAnchor()); } Double offsetTop = getDoubleProperty(PROPERTY_LABEL_OFFSET_TOP); Double offsetLeft = getDoubleProperty(PROPERTY_LABEL_OFFSET_LEFT); Double offsetBottom = getDoubleProperty(PROPERTY_LABEL_OFFSET_BOTTOM); Double offsetRight = getDoubleProperty(PROPERTY_LABEL_OFFSET_RIGHT); if (offsetTop != null || offsetLeft != null || offsetBottom != null || offsetRight != null) { RectangleInsets currentOffset = marker.getLabelOffset(); marker.setLabelOffset(new RectangleInsets(offsetTop == null ? currentOffset.getTop() : offsetTop, offsetLeft == null ? currentOffset.getLeft() : offsetLeft, offsetBottom == null ? currentOffset.getBottom() : offsetBottom, offsetRight == null ? currentOffset.getRight() : offsetRight)); } TextAnchorEnum labelTextAnchor = TextAnchorEnum.getByName(getProperty(PROPERTY_LABEL_TEXT_ANCHOR)); if (labelTextAnchor != null) { marker.setLabelTextAnchor(labelTextAnchor.getTextAnchor()); } Color color = JRColorUtil.getColor(getProperty(PROPERTY_COLOR), null); if (color != null) { marker.setPaint(color); } Float alpha = getFloatProperty(PROPERTY_ALPHA); if (alpha != null) { marker.setAlpha(alpha); } }
From source file:com.jaspersoft.studio.components.chart.model.theme.MLegendSettings.java
@Override public void setPropertyValue(Object id, Object value) { LegendSettings ts = getValue();/*from w w w. j a v a 2 s .c o m*/ if (id.equals(LegendSettings.PROPERTY_showLegend)) ts.setShowLegend((Boolean) value); else if (id.equals(LegendSettings.PROPERTY_font)) ts.setFont(MFontUtil.setMFont(value)); else if (id.equals(LegendSettings.PROPERTY_position)) ts.setPosition((EdgeEnum) posD.getEnumValue(value)); else if (id.equals(LegendSettings.PROPERTY_horizontalAlignment)) ts.setHorizontalAlignment( ((JFreeChartHorizontalAlignmentEnum) hp.getEnumValue(value)).getJFreeChartValue()); else if (id.equals(LegendSettings.PROPERTY_verticalAlignment)) ts.setVerticalAlignment( ((JFreeChartVerticalAlignmentEnum) vp.getEnumValue(value)).getJFreeChartValue()); else if (id.equals(LegendSettings.PROPERTY_backgroundPaint)) ts.setBackgroundPaint((PaintProvider) value); else if (id.equals(LegendSettings.PROPERTY_foregroundPaint)) ts.setForegroundPaint((PaintProvider) value); RectangleInsets ri = PadUtil.setPropertyValue(id, value, ts.getPadding()); if (ri != null) ts.setPadding(ri); BlockFrame bf = ts.getBlockFrame(); ri = PadUtil.setPropertyValue(id, value, bf == null ? null : bf.getInsets(), LegendSettings.PROPERTY_blockFrame); if (ri != null) ts.setBlockFrame(new BlockBorder(ri.getTop(), ri.getLeft(), ri.getBottom(), ri.getRight())); }
From source file:com.att.aro.ui.view.waterfalltab.WaterfallPanel.java
/** * @return the timeAxis/*from ww w.j ava 2 s . co m*/ */ private NumberAxis getTimeAxis() { if (timeAxis == null) { timeAxis = new NumberAxis(ResourceBundleHelper.getMessageString("waterfall.time")) { private static final long serialVersionUID = 1L; /** * This override prevents the tick units from changing * as the timeline is scrolled to numbers with more digits */ @Override protected double estimateMaximumTickLabelWidth(Graphics2D g2d, TickUnit unit) { if (isVerticalTickLabels()) { return super.estimateMaximumTickLabelWidth(g2d, unit); } else { RectangleInsets tickLabelInsets = getTickLabelInsets(); double result = tickLabelInsets.getLeft() + tickLabelInsets.getRight(); // look at lower and upper bounds... FontMetrics fMetrics = g2d.getFontMetrics(getTickLabelFont()); double upper = traceDuration; String upperStr = ""; NumberFormat formatter = getNumberFormatOverride(); if (formatter == null) { upperStr = unit.valueToString(upper); } else { upperStr = formatter.format(upper); } double width2 = fMetrics.stringWidth(upperStr); result += width2; return result; } } }; timeAxis.setRange(new Range(0, DEFAULT_TIMELINE)); timeAxis.setStandardTickUnits(units); } return timeAxis; }
From source file:net.sourceforge.processdash.ui.web.reports.RadarPlot.java
/** * Draws the plot on a Java 2D graphics device (such as the screen * or a printer)./*from ww w .j a v a 2 s. com*/ * @param g2 The graphics device. * @param plotArea The area within which the plot should be drawn. */ @Override public void draw(Graphics2D g2, Rectangle2D plotArea, Point2D anchor, PlotState state, PlotRenderingInfo info) { // adjust for insets... RectangleInsets insets = getInsets(); if (insets != null) { plotArea.setRect(plotArea.getX() + insets.getLeft(), plotArea.getY() + insets.getTop(), plotArea.getWidth() - insets.getLeft() - insets.getRight(), plotArea.getHeight() - insets.getTop() - insets.getBottom()); } if (info != null) { info.setPlotArea(plotArea); info.setDataArea(plotArea); } drawBackground(g2, plotArea); drawOutline(g2, plotArea); Shape savedClip = g2.getClip(); g2.clip(plotArea); Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha())); if (this.dataset != null) { drawRadar(g2, plotArea, info, 0, this.dataset); } else { drawNoDataMessage(g2, plotArea); } g2.clip(savedClip); g2.setComposite(originalComposite); drawOutline(g2, plotArea); }
From source file:net.sf.fspdfs.chartthemes.spring.AegeanChartTheme.java
/** * *//* ww w. j a va 2 s . c o m*/ protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException { super.configureChart(jfreeChart, jrPlot); TextTitle title = jfreeChart.getTitle(); if (title != null) { RectangleInsets padding = title.getPadding(); double bottomPadding = Math.max(padding.getBottom(), 15d); title.setPadding(padding.getTop(), padding.getLeft(), bottomPadding, padding.getRight()); } }
From source file:net.sf.jasperreports.chartthemes.spring.AegeanChartTheme.java
@Override protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException { super.configureChart(jfreeChart, jrPlot); TextTitle title = jfreeChart.getTitle(); if (title != null) { RectangleInsets padding = title.getPadding(); double bottomPadding = Math.max(padding.getBottom(), 15d); title.setPadding(padding.getTop(), padding.getLeft(), bottomPadding, padding.getRight()); }// ww w . j av a2 s . c o m }
From source file:figs.treeVisualization.gui.TimeAxisTree2DPanel.java
/** * Estimate the maximum date width, this also tacks on the tick mark outside length. * * @param g2/*from ww w. j ava 2 s . c o m*/ */ private void estimateMaximumDateWidth(Graphics2D g2) { double maxWidth = 0.0; RectangleInsets insets = this.fDateAxis.getLabelInsets(); FontMetrics fm = g2.getFontMetrics(this.fDateAxis.getTickLabelFont()); DateFormat formatter = this.fDateAxis.getDateFormatOverride(); for (Iterator<Calendar> i = this.fLeafDates.values().iterator(); i.hasNext();) { Date tickDate = i.next().getTime(); String tickLabel; if (formatter != null) { tickLabel = formatter.format(tickDate); } else { tickLabel = this.fDateAxis.getTickUnit().dateToString(tickDate); } Rectangle2D labelBounds = TextUtilities.getTextBounds(tickLabel, g2, fm); if (labelBounds.getWidth() + insets.getLeft() + insets.getRight() > maxWidth) { maxWidth = labelBounds.getWidth() + insets.getLeft() + insets.getRight(); } } this.fEstMaxDateWidth = maxWidth + this.fDateAxis.getTickMarkOutsideLength(); }