[Schmitzm-commits] r1582 - in trunk: schmitzm-core/src/main/java/de/schmitzm/net/mail schmitzm-gt/src/main/java/de/schmitzm/geotools/feature schmitzm-gt/src/main/java/de/schmitzm/geotools/gui schmitzm-jfree/src/main/java/de/schmitzm/jfree/chart/style
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon May 16 19:22:35 CEST 2011
Author: alfonx
Date: 2011-05-16 19:22:33 +0200 (Mon, 16 May 2011)
New Revision: 1582
Modified:
trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail/Mailer.java
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/gui/MapPaneToolBar.java
trunk/schmitzm-jfree/src/main/java/de/schmitzm/jfree/chart/style/ChartAxisStyle.java
Log:
Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail/Mailer.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail/Mailer.java 2011-05-15 17:56:58 UTC (rev 1581)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/net/mail/Mailer.java 2011-05-16 17:22:33 UTC (rev 1582)
@@ -29,12 +29,12 @@
@Override
public void sendMail(final String recipientsAddress, final String subject,
final String text) throws AddressException, MessagingException {
-// try {
+ try {
MailUtil.sendSmtpMail(recipientsAddress, subject, text, smtpUser,
smtpCredential, smtpAuth, smtpHost, mailSenderAddress);
-// } catch (Exception e) {
-// throw new RuntimeException(e);
-// }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@Override
Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java 2011-05-15 17:56:58 UTC (rev 1581)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/feature/FeatureUtil.java 2011-05-16 17:22:33 UTC (rev 1582)
@@ -2661,7 +2661,7 @@
// + localName + " " + d.getLocalName());
if (matcher.find()) {
- // Log.info("New Matching Debug " + localName + " zu "
+ // LOGGER.info("New Matching Debug " + localName + " zu "
// + d.getLocalName());
// LOGGER.debug("New Matching Debug !!! " + localName + " zu "
Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/gui/MapPaneToolBar.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/gui/MapPaneToolBar.java 2011-05-15 17:56:58 UTC (rev 1581)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/gui/MapPaneToolBar.java 2011-05-16 17:22:33 UTC (rev 1582)
@@ -233,8 +233,6 @@
lastZooms.add(oldMapArea);
zoomBackIndex = 1;
}
- if (mapArea == null)
- return;
if (lastZooms.size() > 0
&& mapArea.equals(lastZooms.get(lastZooms.size() - 1))) {
Modified: trunk/schmitzm-jfree/src/main/java/de/schmitzm/jfree/chart/style/ChartAxisStyle.java
===================================================================
--- trunk/schmitzm-jfree/src/main/java/de/schmitzm/jfree/chart/style/ChartAxisStyle.java 2011-05-15 17:56:58 UTC (rev 1581)
+++ trunk/schmitzm-jfree/src/main/java/de/schmitzm/jfree/chart/style/ChartAxisStyle.java 2011-05-16 17:22:33 UTC (rev 1582)
@@ -46,352 +46,389 @@
/**
* This class is defines the design style of a chart {@link Axis}.
+ *
* @author <a href="mailto:Martin.Schmitz at koeln.de">Martin Schmitz</a>
* @version 1.0
*/
public class ChartAxisStyle extends ChartLabelStyle {
- /** Holds the angle (in degrees) the label is rotated by. */
- protected Double angleDegr = 0.0;
- /** Holds the font the label is formated with. */
- protected Font font = null;
- /** Holds the angle (in degrees) the axis values are rotated by. */
- protected Double valuesAngleDegr = 0.0;
- /** Holds whether the axis is visible. */
- protected boolean visible = true;
- /** Holds the number format to display the axis values. */
- protected Format valuesFormat = null;
- /** Holds the font the axis values are formated with. */
- protected Font valuesFont = null;
- /** Holds the color the axis values are painted with. */
- protected Color valuesPaint = null;
- /** Holds a String that reflects the values units */
- protected String unitString = null;
- /** Indicates whether the unit is visible in axis label (Default is {@code true}). */
- protected boolean unitStringVisible = true;
-
+ /** Holds the angle (in degrees) the label is rotated by. */
+ protected Double angleDegr = 0.0;
+ /** Holds the font the label is formated with. */
+ protected Font font = null;
+ /** Holds the angle (in degrees) the axis values are rotated by. */
+ protected Double valuesAngleDegr = 0.0;
+ /** Holds whether the axis is visible. */
+ protected boolean visible = true;
+ /** Holds the number format to display the axis values. */
+ protected Format valuesFormat = null;
+ /** Holds the font the axis values are formated with. */
+ protected Font valuesFont = null;
+ /** Holds the color the axis values are painted with. */
+ protected Color valuesPaint = null;
+ /** Holds a String that reflects the values units */
+ protected String unitString = null;
+ /** Indicates whether the unit is visible in axis label (Default is {@code true}). */
+ protected boolean unitStringVisible = true;
- /**
- * Creates a new style with default values (empty label, color black, angle 0).
- */
- public ChartAxisStyle() {
- this("",Color.BLACK, 0.0 ,0.0);
- }
+ /**
+ * Creates a new style with default values (empty label, color black, angle 0).
+ */
+ public ChartAxisStyle() {
+ this("", Color.BLACK, 0.0, 0.0);
+ }
- /**
- * Creates a new style.
- * @param title axis title
- * @param color text color for the axis title
- * @param labelAngle angel (in degrees) the axis label is rotated by
- * @param valuesAngle angel (in degrees) the axis values are rotated by
- */
- public ChartAxisStyle(String title, Color color, Double labelAngle, Double valuesAngle) {
- super(title,color);
- setLabelAngle(labelAngle);
- setValuesAngle(valuesAngle);
- }
-
- /**
- * Creates a new style.
- * @param title axis title as an internationalized {@link Translation}
- * @param color text color for the axis title
- * @param labelAngle angel (in degrees) the axis label is rotated by
- * @param valuesAngle angel (in degrees) the axis values are rotated by
- */
- public ChartAxisStyle(Translation title, Color color, Double labelAngle, Double valuesAngle) {
- super(title,color);
- setLabelAngle(labelAngle);
- setValuesAngle(valuesAngle);
- }
+ /**
+ * Creates a new style.
+ *
+ * @param title
+ * axis title
+ * @param color
+ * text color for the axis title
+ * @param labelAngle
+ * angel (in degrees) the axis label is rotated by
+ * @param valuesAngle
+ * angel (in degrees) the axis values are rotated by
+ */
+ public ChartAxisStyle(String title, Color color, Double labelAngle, Double valuesAngle) {
+ super(title, color);
+ setLabelAngle(labelAngle);
+ setValuesAngle(valuesAngle);
+ }
- /**
- * Creates a (deep) clone of this style.
- */
- @Override
- public ChartAxisStyle copy() {
- return copyTo( new ChartAxisStyle() );
- }
-
- /**
- * Copies all properties of this style to another one.
- * @param dest destination object (if {@code null} the copy
- * is created by {@link #copy()})
- * @return {@code dest} or the new instance
- */
- public ChartAxisStyle copyTo(ChartAxisStyle dest) {
- // copy the super class properties
- dest = (ChartAxisStyle)copyTo((ChartLabelStyle)dest);
- // copy this classes properties
- dest.setLabelAngle( getLabelAngle() );
- dest.setLabelFont( getLabelFont() );
- dest.setValuesAngle( getValuesAngle() );
- dest.setValuesFont( getValuesFont() );
- dest.setValuesPaint( getValuesPaint() );
- dest.setVisible( isVisible() );
- dest.setValuesFormat( getValuesFormat() );
- dest.setUnitString( getUnitString() );
- dest.setUnitVisible( isUnitVisible() );
- return dest;
- }
+ /**
+ * Creates a new style.
+ *
+ * @param title
+ * axis title as an internationalized {@link Translation}
+ * @param color
+ * text color for the axis title
+ * @param labelAngle
+ * angel (in degrees) the axis label is rotated by
+ * @param valuesAngle
+ * angel (in degrees) the axis values are rotated by
+ */
+ public ChartAxisStyle(Translation title, Color color, Double labelAngle, Double valuesAngle) {
+ super(title, color);
+ setLabelAngle(labelAngle);
+ setValuesAngle(valuesAngle);
+ }
- /**
- * Returns the angle (in degrees) the label text is rotated by.
- */
- public Double getLabelAngle() {
- return angleDegr;
- }
+ /**
+ * Creates a (deep) clone of this style.
+ */
+ @Override
+ public ChartAxisStyle copy() {
+ return copyTo(new ChartAxisStyle());
+ }
- /**
- * Returns the angle (in radian) the label text is rotated by.
- */
- public Double getLabelAngleRadian() {
- return angleDegr == null ? null : angleDegr * Math.PI / 180;
- }
+ /**
+ * Copies all properties of this style to another one.
+ *
+ * @param dest
+ * destination object (if {@code null} the copy is created by {@link #copy()})
+ * @return {@code dest} or the new instance
+ */
+ public ChartAxisStyle copyTo(ChartAxisStyle dest) {
+ // copy the super class properties
+ dest = (ChartAxisStyle) copyTo((ChartLabelStyle) dest);
+ // copy this classes properties
+ dest.setLabelAngle(getLabelAngle());
+ dest.setLabelFont(getLabelFont());
+ dest.setValuesAngle(getValuesAngle());
+ dest.setValuesFont(getValuesFont());
+ dest.setValuesPaint(getValuesPaint());
+ dest.setVisible(isVisible());
+ dest.setValuesFormat(getValuesFormat());
+ dest.setUnitString(getUnitString());
+ dest.setUnitVisible(isUnitVisible());
+ return dest;
+ }
- /**
- * Sets the angle (in degrees) the label text is rotated by.
- * @param color Color for the label text
- */
- public void setLabelAngle(Double angle) {
- this.angleDegr = angle;
- }
+ /**
+ * Returns the angle (in degrees) the label text is rotated by.
+ */
+ public Double getLabelAngle() {
+ return angleDegr;
+ }
- /**
- * Returns the {@link Font} the axis label is formated with.
- */
- public Font getLabelFont() {
- return font;
- }
-
- /**
- * Sets the {@link Font} the axis label is formated with.
- * @param font Font for the axis label
- */
- public void setLabelFont(Font font) {
- this.font = font;
- }
+ /**
+ * Returns the angle (in radian) the label text is rotated by.
+ */
+ public Double getLabelAngleRadian() {
+ return angleDegr == null ? null : angleDegr * Math.PI / 180;
+ }
- /**
- * Returns the angle (in degrees) the axis values are rotated by.
- */
- public Double getValuesAngle() {
- return valuesAngleDegr;
- }
+ /**
+ * Sets the angle (in degrees) the label text is rotated by.
+ *
+ * @param color
+ * Color for the label text
+ */
+ public void setLabelAngle(Double angle) {
+ this.angleDegr = angle;
+ }
- /**
- * Returns the angle (in radian) the axis values are rotated by.
- */
- public double getValuesAngleRadian() {
- return valuesAngleDegr * Math.PI / 180;
- }
+ /**
+ * Returns the {@link Font} the axis label is formated with.
+ */
+ public Font getLabelFont() {
+ return font;
+ }
- /**
- * Sets the angle (in degrees) the label text is rotated by.
- * @param color Color for the label text
- */
- public void setValuesAngle(Double angel) {
- this.valuesAngleDegr = angel;
- }
+ /**
+ * Sets the {@link Font} the axis label is formated with.
+ *
+ * @param font
+ * Font for the axis label
+ */
+ public void setLabelFont(Font font) {
+ this.font = font;
+ }
- /**
- * Returns whether the axis is visible.
- */
- public boolean isVisible() {
- return visible;
- }
+ /**
+ * Returns the angle (in degrees) the axis values are rotated by.
+ */
+ public Double getValuesAngle() {
+ return valuesAngleDegr;
+ }
- /**
- * Sets whether the axis is visible.
- */
- public void setVisible(boolean visible) {
- this.visible = visible;
- }
+ /**
+ * Returns the angle (in radian) the axis values are rotated by.
+ */
+ public double getValuesAngleRadian() {
+ return valuesAngleDegr * Math.PI / 180;
+ }
- /**
- * Returns the {@link Color} the axis values are painted with.
- */
- public Color getValuesPaint() {
- return valuesPaint;
- }
-
- /**
- * Sets the {@link Color} the axis values are painted with.
- * @param color color for the axis values
- */
- public void setValuesPaint(Color color) {
- this.valuesPaint = color;
- }
+ /**
+ * Sets the angle (in degrees) the label text is rotated by.
+ *
+ * @param color
+ * Color for the label text
+ */
+ public void setValuesAngle(Double angel) {
+ this.valuesAngleDegr = angel;
+ }
- /**
- * Returns the {@link Font} the axis values are formated with.
- */
- public Font getValuesFont() {
- return valuesFont;
- }
-
- /**
- * Sets the {@link Font} the axis values are formated with.
- * @param font Font for the axis values
- */
- public void setValuesFont(Font font) {
- this.valuesFont = font;
- }
+ /**
+ * Returns whether the axis is visible.
+ */
+ public boolean isVisible() {
+ return visible;
+ }
- /**
- * Returns the (number) format for the axis values.
- */
- public Format getValuesFormat() {
- return valuesFormat;
- }
+ /**
+ * Sets whether the axis is visible.
+ */
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
- /**
- * Sets the (number) format for the axis values.
- */
- public void setValuesFormat(Format format) {
- this.valuesFormat = format;
- }
-
- /**
- * Applies the style to a specific axis.<br>
- * Note: Some style properties can only be applied to specific axis types.
- * @param axis an axis
- */
- public void applyToAxis(Axis axis) {
- if (axis == null) {
- LOGGER.debug("No axis to be customised.");
- return;
- }
+ /**
+ * Returns the {@link Color} the axis values are painted with.
+ */
+ public Color getValuesPaint() {
+ return valuesPaint;
+ }
- // If unit is set, add it to axis title
- String axisLabel = getLabel();
- String unitString = getUnitString();
- if ( isUnitVisible() && unitString != null && !"".equals(unitString.trim()) )
- axisLabel += " ["+unitString.trim()+"]";
-
- // Apply common attributes
- axis.setLabel( axisLabel );
- if (getPaint() != null)
- axis.setLabelPaint( getPaint() );
- if (getLabelAngle() != null)
- axis.setLabelAngle( getLabelAngle() );
- if (getLabelFont() != null)
- axis.setLabelFont( getLabelFont() );
- if (getValuesFont() != null)
- axis.setTickLabelFont( getValuesFont() );
- if (getValuesPaint() != null)
- axis.setTickLabelPaint(getValuesPaint());
- axis.setVisible( isVisible() );
-
-
- // Apply values format and angel according to the specific axis type
- if (axis instanceof CategoryAxis)
- applyToCategoryAxis((CategoryAxis)axis);
- else if (axis instanceof NumberAxis)
- applyToNumberAxis((NumberAxis)axis);
- else if (axis instanceof DateAxis)
- applyToDateAxis((DateAxis) axis);
- else
- LOGGER.warn("Only basic style properties applied to axis because of an unexpected axis type: " + LangUtil.getSimpleClassName(axis));
- }
-
-
- /**
- * Applies style properties which can only be applied to
- * {@link CategoryAxis} (values angle).<br>
- * Called by {@link #applyToAxis(Axis)}.
- * @param axis a {@link CategoryAxis}
- */
- protected void applyToCategoryAxis(CategoryAxis axis) {
- // any angle can be applied
- // Angle > 0 -> create a rotated label with right alignment to the tick
- // Angle = 0 -> STANDARD (centered alignment to the tick)
- if ( getValuesAngleRadian() != 0.0 )
- axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions( getValuesAngleRadian() ));
- else
- axis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
-
- // format can not be applied to category axis values,
- // so give a warn if style should apply one
- if ( getValuesFormat() != null )
- LOGGER.warn("Not any axis values format can be applied to "+LangUtil.getSimpleClassName(axis));
- }
+ /**
+ * Sets the {@link Color} the axis values are painted with.
+ *
+ * @param color
+ * color for the axis values
+ */
+ public void setValuesPaint(Color color) {
+ this.valuesPaint = color;
+ }
- /**
- * Applies style properties which can only be applied to
- * {@link NumberAxis} (values angle and format).<br>
- * Called by {@link #applyToAxis(Axis)}.
- * @param axis a {@link NumberAxis}
- */
- protected void applyToNumberAxis(NumberAxis axis) {
- // Only NumberFormat can be applied to NumberAxis
- if ( getValuesFormat() instanceof NumberFormat )
- axis.setNumberFormatOverride( (NumberFormat)getValuesFormat() );
- else
- // Give a warn if another format should be applied
- if ( getValuesFormat() != null )
- LOGGER.warn("Only a NumberFormat can not be applied to values of "+LangUtil.getSimpleClassName(axis)+": "+LangUtil.getSimpleClassName(getValuesFormat()));
-
- // Only a 0 or 90 degree angle can be applied to NumberAxis
- double angle = getValuesAngle();
- if ( angle == 90 || angle == 0 )
- axis.setVerticalTickLabels( angle == 90 );
- else
- // Give a warn if another angle should be applied to NumberAxis
- LOGGER.warn("Only 0 or 90 degrees (horizontal/vertical) can be applied to values of "+LangUtil.getSimpleClassName(axis)+": "+angle);
- }
+ /**
+ * Returns the {@link Font} the axis values are formated with.
+ */
+ public Font getValuesFont() {
+ return valuesFont;
+ }
- /**
- * Applies style properties which can only be applied to
- * {@link DateAxis} (values angle and format).<br>
- * Called by {@link #applyToAxis(Axis)}.
- * @param axis a {@link DateAxis}
- */
- protected void applyToDateAxis(DateAxis axis) {
- // Only DateFormat can be applied to NumberAxis
- if ( getValuesFormat() instanceof DateFormat )
- axis.setDateFormatOverride( (DateFormat)getValuesFormat() );
- else
- // Give a warn if another format should be applied
- if ( getValuesFormat() != null )
- LOGGER.warn("Only a DateFormat can not be applied to values of "+LangUtil.getSimpleClassName(axis)+": "+LangUtil.getSimpleClassName(getValuesFormat()));
-
- // Only a 0 or 90 degree angle can be applied to DateAxis
- double angle = getValuesAngle();
- if ( angle == 90 || angle == 0 )
- axis.setVerticalTickLabels( angle == 90 );
- else
- // Give a warn if another angle should be applied to DateAxis
- LOGGER.warn("Only 0 or 90 degrees (horizontal/vertical) can be applied to values of "+LangUtil.getSimpleClassName(axis)+": "+angle);
- }
+ /**
+ * Sets the {@link Font} the axis values are formated with.
+ *
+ * @param font
+ * Font for the axis values
+ */
+ public void setValuesFont(Font font) {
+ this.valuesFont = font;
+ }
- /**
- * Sets a unit for the axis.
- * @param unitString a string representing the unit
- */
- public void setUnitString(String unitString) {
- this.unitString = unitString;
- }
-
- /**
- * Returns a unit for the axis.
- * @param unitString a string representing the unit
- */
- public String getUnitString() {
- return unitString;
- }
+ /**
+ * Returns the (number) format for the axis values.
+ */
+ public Format getValuesFormat() {
+ return valuesFormat;
+ }
- /**
- * Sets whether the unit string is visible in the axis label. In case
- * of normalized data it may be useful to "deactivate" the unit without
- * clearing the whole unit string.
- */
- public void setUnitVisible(boolean visible) {
- this.unitStringVisible = visible;
- }
+ /**
+ * Sets the (number) format for the axis values.
+ */
+ public void setValuesFormat(Format format) {
+ this.valuesFormat = format;
+ }
- /**
- * Returns whether the unit string is visible in the axis label.
- */
- public boolean isUnitVisible() {
- return this.unitStringVisible;
- }
+ /**
+ * Applies the style to a specific axis.<br>
+ * Note: Some style properties can only be applied to specific axis types.
+ *
+ * @param axis
+ * an axis
+ */
+ public void applyToAxis(Axis axis) {
+ if (axis == null) {
+ LOGGER.debug("No axis to be customised.");
+ return;
+ }
+
+ // If unit is set, add it to axis title
+ String axisLabel = getLabel();
+ String unitString = getUnitString();
+ if (isUnitVisible() && unitString != null && !"".equals(unitString.trim()))
+ axisLabel += " [" + unitString.trim() + "]";
+
+ // Apply common attributes
+ axis.setLabel(axisLabel);
+ if (getPaint() != null)
+ axis.setLabelPaint(getPaint());
+ if (getLabelAngle() != null)
+ axis.setLabelAngle(getLabelAngle());
+ if (getLabelFont() != null)
+ axis.setLabelFont(getLabelFont());
+ if (getValuesFont() != null)
+ axis.setTickLabelFont(getValuesFont());
+ if (getValuesPaint() != null)
+ axis.setTickLabelPaint(getValuesPaint());
+ axis.setVisible(isVisible());
+
+ // Apply values format and angel according to the specific axis type
+ if (axis instanceof CategoryAxis)
+ applyToCategoryAxis((CategoryAxis) axis);
+ else if (axis instanceof NumberAxis)
+ applyToNumberAxis((NumberAxis) axis);
+ else if (axis instanceof DateAxis)
+ applyToDateAxis((DateAxis) axis);
+ else
+ LOGGER.warn("Only basic style properties applied to axis because of an unexpected axis type: "
+ + LangUtil.getSimpleClassName(axis));
+ }
+
+ /**
+ * Applies style properties which can only be applied to {@link CategoryAxis} (values angle).<br>
+ * Called by {@link #applyToAxis(Axis)}.
+ *
+ * @param axis
+ * a {@link CategoryAxis}
+ */
+ protected void applyToCategoryAxis(CategoryAxis axis) {
+ // any angle can be applied
+ // Angle > 0 -> create a rotated label with right alignment to the tick
+ // Angle = 0 -> STANDARD (centered alignment to the tick)
+ if (getValuesAngleRadian() != 0.0)
+ axis.setCategoryLabelPositions(CategoryLabelPositions
+ .createUpRotationLabelPositions(getValuesAngleRadian()));
+ else {
+ // CategoryLabelPosition x = new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.TOP_RIGHT);
+ // axis.setCategoryLabelPositionOffset(0);
+
+ axis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
+ }
+
+ // format can not be applied to category axis values,
+ // so give a warn if style should apply one
+ if (getValuesFormat() != null)
+ LOGGER.warn("Not any axis values format can be applied to " + LangUtil.getSimpleClassName(axis));
+ }
+
+ /**
+ * Applies style properties which can only be applied to {@link NumberAxis} (values angle and format).<br>
+ * Called by {@link #applyToAxis(Axis)}.
+ *
+ * @param axis
+ * a {@link NumberAxis}
+ */
+ protected void applyToNumberAxis(NumberAxis axis) {
+ // Only NumberFormat can be applied to NumberAxis
+ if (getValuesFormat() instanceof NumberFormat)
+ axis.setNumberFormatOverride((NumberFormat) getValuesFormat());
+ else
+ // Give a warn if another format should be applied
+ if (getValuesFormat() != null)
+ LOGGER.warn("Only a NumberFormat can not be applied to values of " + LangUtil.getSimpleClassName(axis)
+ + ": " + LangUtil.getSimpleClassName(getValuesFormat()));
+
+ // Only a 0 or 90 degree angle can be applied to NumberAxis
+ double angle = getValuesAngle();
+ if (angle == 90 || angle == 0)
+ axis.setVerticalTickLabels(angle == 90);
+ else
+ // Give a warn if another angle should be applied to NumberAxis
+ LOGGER.warn("Only 0 or 90 degrees (horizontal/vertical) can be applied to values of "
+ + LangUtil.getSimpleClassName(axis) + ": " + angle);
+ }
+
+ /**
+ * Applies style properties which can only be applied to {@link DateAxis} (values angle and format).<br>
+ * Called by {@link #applyToAxis(Axis)}.
+ *
+ * @param axis
+ * a {@link DateAxis}
+ */
+ protected void applyToDateAxis(DateAxis axis) {
+ // Only DateFormat can be applied to NumberAxis
+ if (getValuesFormat() instanceof DateFormat)
+ axis.setDateFormatOverride((DateFormat) getValuesFormat());
+ else
+ // Give a warn if another format should be applied
+ if (getValuesFormat() != null)
+ LOGGER.warn("Only a DateFormat can not be applied to values of " + LangUtil.getSimpleClassName(axis) + ": "
+ + LangUtil.getSimpleClassName(getValuesFormat()));
+
+ // Only a 0 or 90 degree angle can be applied to DateAxis
+ double angle = getValuesAngle();
+ if (angle == 90 || angle == 0)
+ axis.setVerticalTickLabels(angle == 90);
+ else
+ // Give a warn if another angle should be applied to DateAxis
+ LOGGER.warn("Only 0 or 90 degrees (horizontal/vertical) can be applied to values of "
+ + LangUtil.getSimpleClassName(axis) + ": " + angle);
+ }
+
+ /**
+ * Sets a unit for the axis.
+ *
+ * @param unitString
+ * a string representing the unit
+ */
+ public void setUnitString(String unitString) {
+ this.unitString = unitString;
+ }
+
+ /**
+ * Returns a unit for the axis.
+ *
+ * @param unitString
+ * a string representing the unit
+ */
+ public String getUnitString() {
+ return unitString;
+ }
+
+ /**
+ * Sets whether the unit string is visible in the axis label. In case of normalized data it may be useful to
+ * "deactivate" the unit without clearing the whole unit string.
+ */
+ public void setUnitVisible(boolean visible) {
+ this.unitStringVisible = visible;
+ }
+
+ /**
+ * Returns whether the unit string is visible in the axis label.
+ */
+ public boolean isUnitVisible() {
+ return this.unitStringVisible;
+ }
}
More information about the Schmitzm-commits
mailing list