[Schmitzm-commits] r296 - in trunk/src/schmitzm/jfree: chart/style resource/images

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 11 00:08:27 CEST 2009


Author: alfonx
Date: 2009-08-11 00:08:23 +0200 (Tue, 11 Aug 2009)
New Revision: 296

Added:
   trunk/src/schmitzm/jfree/resource/images/ChartType_AREA_preview.png
   trunk/src/schmitzm/jfree/resource/images/ChartType_BAR_preview.png
   trunk/src/schmitzm/jfree/resource/images/ChartType_LINE.png
   trunk/src/schmitzm/jfree/resource/images/ChartType_LINE_preview.png
   trunk/src/schmitzm/jfree/resource/images/ChartType_PIE_preview.png
   trunk/src/schmitzm/jfree/resource/images/ChartType_SCATTER_preview.png
Modified:
   trunk/src/schmitzm/jfree/chart/style/ChartType.java
   trunk/src/schmitzm/jfree/resource/images/ChartType_AREA.png
   trunk/src/schmitzm/jfree/resource/images/ChartType_BAR.png
   trunk/src/schmitzm/jfree/resource/images/ChartType_PIE.png
   trunk/src/schmitzm/jfree/resource/images/ChartType_SCATTER.png
Log:
* Added a second image method to ChartType. Now ChartType provides 20x20 Icons ( getIcon() ), as well as 300x200 preview images ( getPreviewImage() )
* Homogenized all the chart icons

Modified: trunk/src/schmitzm/jfree/chart/style/ChartType.java
===================================================================
--- trunk/src/schmitzm/jfree/chart/style/ChartType.java	2009-08-10 22:07:06 UTC (rev 295)
+++ trunk/src/schmitzm/jfree/chart/style/ChartType.java	2009-08-10 22:08:23 UTC (rev 296)
@@ -72,11 +72,11 @@
 	 * given type. Never returns <code>null</code>, but rather a default image.
 	 * The images are not cached, so if ut's called often, cache it yourself.
 	 */
-	public ImageIcon getIcon() {
+	public ImageIcon getPreviewIcon() {
 		final String fileName = getClass().getSimpleName() + "_" + toString();
 
 		final String imageResPath = "../../resource/images/" + fileName
-				+ ".png";
+				+ "_preview.png";
 
 		// LOGGER.debug("Looking for image " + imageResPath);
 		final URL imageUrl = ChartStyle.class.getResource(imageResPath);
@@ -94,6 +94,29 @@
 	}
 
 	/**
+	 * Returns an image of 16x16 pixels that shows the basic appearance of this
+	 * chart type.
+	 */
+	public ImageIcon getIcon() {
+		final String fileName = getClass().getSimpleName() + "_" + toString();
+
+		final String imageResPath = "../../resource/images/" + fileName
+				+ ".png";
+
+		// LOGGER.debug("Looking for image " + imageResPath);
+		final URL imageUrl = ChartStyle.class.getResource(imageResPath);
+
+		if (imageUrl == null) {
+			// Create a default icon
+			final BufferedImage bufferedImage = new BufferedImage(16, 16,
+					BufferedImage.TYPE_INT_RGB);
+			return new ImageIcon(bufferedImage);
+
+		}
+		return new ImageIcon(imageUrl);
+	}
+
+	/**
 	 * Returns a description of this kind of chart. Can be used for tool-tips.
 	 * May return <code>null</code> if no localized String found.
 	 */
@@ -154,9 +177,8 @@
 		}
 	}
 
-
 	/**
-	 * Does the {@link ChartType} allow category data for the domain axis? 
+	 * Does the {@link ChartType} allow category data for the domain axis?
 	 */
 	public boolean isCategoryAllowedForDomainAxis() {
 		switch (this) {

Modified: trunk/src/schmitzm/jfree/resource/images/ChartType_AREA.png
===================================================================
(Binary files differ)

Added: trunk/src/schmitzm/jfree/resource/images/ChartType_AREA_preview.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/schmitzm/jfree/resource/images/ChartType_AREA_preview.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Modified: trunk/src/schmitzm/jfree/resource/images/ChartType_BAR.png
===================================================================
(Binary files differ)

Added: trunk/src/schmitzm/jfree/resource/images/ChartType_BAR_preview.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/schmitzm/jfree/resource/images/ChartType_BAR_preview.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: trunk/src/schmitzm/jfree/resource/images/ChartType_LINE.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/schmitzm/jfree/resource/images/ChartType_LINE.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: trunk/src/schmitzm/jfree/resource/images/ChartType_LINE_preview.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/schmitzm/jfree/resource/images/ChartType_LINE_preview.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Modified: trunk/src/schmitzm/jfree/resource/images/ChartType_PIE.png
===================================================================
(Binary files differ)

Added: trunk/src/schmitzm/jfree/resource/images/ChartType_PIE_preview.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/schmitzm/jfree/resource/images/ChartType_PIE_preview.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Modified: trunk/src/schmitzm/jfree/resource/images/ChartType_SCATTER.png
===================================================================
(Binary files differ)

Added: trunk/src/schmitzm/jfree/resource/images/ChartType_SCATTER_preview.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/schmitzm/jfree/resource/images/ChartType_SCATTER_preview.png
___________________________________________________________________
Name: svn:mime-type
   + image/png



More information about the Schmitzm-commits mailing list