changeset 3738:34da25796c21

Theme transparency attribute support (#840) flys-artifacts/trunk@5414 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Sun, 09 Sep 2012 21:05:53 +0000
parents 976be312a84c
children 0edc05642fa4
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/default-themes.xml flys-artifacts/doc/conf/second-themes.xml flys-artifacts/doc/conf/virtual-themes.xml flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java
diffstat 6 files changed, 37 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Sun Sep 09 17:19:50 2012 +0000
+++ b/flys-artifacts/ChangeLog	Sun Sep 09 21:05:53 2012 +0000
@@ -1,3 +1,12 @@
+2012-09-09	Christian Lins 	<christian.lins@intevation.de>
+
+	* doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml,
+	  doc/conf/virtual-themes.xml,
+	  src/main/java/de/intevation/flys/utils/ThemeUtil.java,
+	  src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java:
+	  Theme transparency attribute support (part of #840).
+
 2012-09-09	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/extreme/Curve.java:
--- a/flys-artifacts/doc/conf/default-themes.xml	Sun Sep 09 17:19:50 2012 +0000
+++ b/flys-artifacts/doc/conf/default-themes.xml	Sun Sep 09 21:05:53 2012 +0000
@@ -52,7 +52,7 @@
                 default="0"/>
             <field name="fillcolor" type="Color" display="Bandbreitenfarbe"
                 default="104, 104, 104"/> 
-    	    <field name="alpha" type="int" default="50" display="Alpha-Transparenz"/>
+    	    <field name="transparency" type="int" default="20" display="Transparenz"/>
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="204, 204, 204" />
         </fields>
@@ -1441,8 +1441,8 @@
     		<inherit from="Areas"/>
     	</inherits>
     	<fields>
-    		<field name="alpha" type="int" default="50" display="Alpha-Transparenz"/>
-    		<field name="fillcolor" type="Color" default="0, 0, 0" display="Füllfarbe"/>
+    		<field name="transparency" type="int" default="80" display="Transparenz"/>
+    		<field name="backgroundcolor" type="Color" default="0, 0, 0" display="Füllfarbe"/>
     	</fields>
     </theme>
     <theme name="FixingDeltaWtAnalysisPeriods">
@@ -1450,10 +1450,8 @@
     		<inherit from="Areas"/>
     	</inherits>
     	<fields>
-    		<field name="alpha" type="int" default="80" display="Alpha-Transparenz"/>
+    		<field name="transparency" type="int" default="80" display="Transparenz"/>
             <field name="backgroundcolor" type="Color" default="255, 0, 0" display="Füllfarbe" />
-            <field name="showborder" type="boolean"
-                display="Flaechebegrenzungslinie anzeigen" default="false" hidden="true" />
     	</fields>
     </theme>
 
--- a/flys-artifacts/doc/conf/second-themes.xml	Sun Sep 09 17:19:50 2012 +0000
+++ b/flys-artifacts/doc/conf/second-themes.xml	Sun Sep 09 21:05:53 2012 +0000
@@ -52,7 +52,7 @@
                 default="0"/>
             <field name="fillcolor" type="Color" display="Bandbreitenfarbe"
                 default="104, 104, 104"/> 
-    	    <field name="alpha" type="int" default="50" display="Alpha-Transparenz"/>
+    	    <field name="transparency" type="int" default="30" display="Transparenz"/>
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="204, 0, 204" />
         </fields>
@@ -1451,8 +1451,8 @@
     		<inherit from="Areas"/>
     	</inherits>
     	<fields>
-    		<field name="alpha" type="int" default="70" display="Alpha-Transparenz"/>
-    		<field name="fillcolor" type="Color" default="0, 0, 0" display="Füllfarbe"/>
+    		<field name="transparency" type="int" default="30" display="Transparenz"/>
+    		<field name="backgroundcolor" type="Color" default="0, 0, 0" display="Füllfarbe"/>
     	</fields>
     </theme>
     <theme name="FixingDeltaWtAnalysisPeriods">
@@ -1460,9 +1460,7 @@
     		<inherit from="Areas"/>
     	</inherits>
     	<fields>
-    		<field name="alpha" type="int" default="40" display="Alpha-Transparenz"/>
-            <field name="showborder" type="boolean"
-                display="Flaechebegrenzungslinie anzeigen" default="false" hidden="true" />
+    		<field name="transparency" type="int" default="90" display="Transparenz"/>
     	</fields>
     </theme>
 
--- a/flys-artifacts/doc/conf/virtual-themes.xml	Sun Sep 09 17:19:50 2012 +0000
+++ b/flys-artifacts/doc/conf/virtual-themes.xml	Sun Sep 09 21:05:53 2012 +0000
@@ -136,11 +136,11 @@
         <fields>
             <field name="backgroundcolor" type="Color" display="Füllfarbe"
                 default="0, 100, 0" />
-            <field name="showbackground" type="boolean"
-                display="Hintergrund anzeigen" default="true" hidden="true" />
-            <field name="showborder" type="boolean"
-                display="Flaechebegrenzungslinie anzeigen" default="false" />
-            <field name="alpha" type="int" default="255" display="Alpha-Transparenzwert" />
+            <!-- <field name="showbackground" type="boolean"
+                display="Hintergrund anzeigen" default="true" hidden="true" /> //-->
+            <!-- <field name="showborder" type="boolean"
+                display="Flaechebegrenzungslinie anzeigen" default="false" /> //-->
+            <field name="transparency" type="int" default="50" display="Transparenz" />
         </fields>
     </theme>
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java	Sun Sep 09 17:19:50 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java	Sun Sep 09 21:05:53 2012 +0000
@@ -13,7 +13,7 @@
  */
 public class StyledDomainMarker extends IntervalMarker {
 
-    private static final long serialVersionUID = -4369410661339512342L;
+    private static final long serialVersionUID = -4369417661339512342L;
 
     private final Color fillColor, backgroundColor;
 
@@ -26,8 +26,8 @@
                 ThemeUtil.getFillColorString(theme));
         useSecondColor(false);
 
-        int alpha = ThemeUtil.parseInteger(ThemeUtil.getTransparencyAlpha(theme), 128);
-        setAlpha(alpha / 255.0f);
+        int alpha = 100 - ThemeUtil.parseInteger(ThemeUtil.getTransparency(theme), 50);
+        setAlpha(alpha / 100.0f);
     }
 
     /**
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Sun Sep 09 17:19:50 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Sun Sep 09 21:05:53 2012 +0000
@@ -1,12 +1,5 @@
 package de.intevation.flys.utils;
 
-import de.intevation.artifacts.common.utils.XMLUtils;
-import de.intevation.flys.artifacts.model.MapserverStyle;
-import de.intevation.flys.artifacts.model.MapserverStyle.Clazz;
-import de.intevation.flys.artifacts.model.MapserverStyle.Expression;
-import de.intevation.flys.artifacts.model.MapserverStyle.Label;
-import de.intevation.flys.artifacts.model.MapserverStyle.Style;
-
 import java.awt.Color;
 import java.awt.Font;
 
@@ -17,6 +10,13 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.flys.artifacts.model.MapserverStyle;
+import de.intevation.flys.artifacts.model.MapserverStyle.Clazz;
+import de.intevation.flys.artifacts.model.MapserverStyle.Expression;
+import de.intevation.flys.artifacts.model.MapserverStyle.Label;
+import de.intevation.flys.artifacts.model.MapserverStyle.Style;
+
 
 /**
  * Utility to deal with themes and their representations.
@@ -72,11 +72,11 @@
     public final static String XPATH_SHOW_LEVEL =
             "/theme/field[@name='showlevel']/@default";
 
-    public final static String XPATH_TRANSPARENCY =
+    public final static String XPATH_TRANSPARENT =
             "/theme/field[@name='transparent']/@default";
 
-    public final static String XPATH_TRANSPARENCY_ALPHA =
-            "/theme/field[@name='alpha']/@default";
+    public final static String XPATH_TRANSPARENCY =
+            "/theme/field[@name='transparency']/@default";
 
     public final static String XPATH_SHOW_AREA =
             "/theme/field[@name='showarea']/@default";
@@ -556,8 +556,8 @@
     }
 
 
-    public static String getTransparencyAlpha(Document theme) {
-        return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY_ALPHA, null);
+    public static String getTransparency(Document theme) {
+        return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY, null);
     }
 
 

http://dive4elements.wald.intevation.org