incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r429832 - /incubator/adffaces/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
Date Tue, 08 Aug 2006 21:45:46 GMT
Author: awiner
Date: Tue Aug  8 14:45:45 2006
New Revision: 429832

URL: http://svn.apache.org/viewvc?rev=429832&view=rev
Log:
Add support for AWTKeyStroke properties (in addition to javax.swing.KeyStroke, already supported)

Modified:
    incubator/adffaces/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java

Modified: incubator/adffaces/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java?rev=429832&r1=429831&r2=429832&view=diff
==============================================================================
--- incubator/adffaces/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
(original)
+++ incubator/adffaces/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
Tue Aug  8 14:45:45 2006
@@ -1314,6 +1314,7 @@
 
         if (_isConverter(propertyClass) ||
             _isKeyStroke(propertyClass) ||
+            _isAWTKeyStroke(propertyClass) ||
             _isColorList(propertyClass, propertyClassParams) ||
             property.isVirtual())
         {
@@ -1529,6 +1530,10 @@
       {
         _writeSetKeyStroke(out, componentClass, propName);
       }
+      else if (_isAWTKeyStroke(propClass))
+      {
+        _writeSetAWTKeyStroke(out, componentClass, propName);
+      }
       else if (_isColorList(propClass, property.getPropertyClassParameters()))
       {
         _writeSetColorList(out, componentClass, propName);
@@ -1598,6 +1603,12 @@
       return ("javax.swing.KeyStroke".equals(propClass));
     }
 
+    private boolean _isAWTKeyStroke(
+      String propClass)
+    {
+      return ("java.awt.AWTKeyStroke".equals(propClass));
+    }
+
     private boolean _isColorList(
       String   propClass,
       String[] propClassParams)
@@ -1785,6 +1796,37 @@
       out.unindent();
       out.println("}");
     }
+
+
+    private void _writeSetAWTKeyStroke(
+      PrettyWriter  out,
+      String        componentClass,
+      String        propName) throws IOException
+    {
+      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
+      String propVar = "_" + propName;
+
+      out.println("if (" + propVar + " != null)");
+      out.println("{");
+      out.indent();
+      out.println("if (isValueReference(" + propVar + "))");
+      out.println("{");
+      out.indent();
+      out.println("ValueBinding vb = createValueBinding(" + propVar + ");");
+      out.println("bean.setValueBinding(" + componentClass + "." + propKey + ", vb);");
+      out.unindent();
+      out.println("}");
+      out.println("else");
+      out.println("{");
+      out.indent();
+      out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
+      out.println("\tAWTKeyStroke.getAWTKeyStroke(" + propVar + "));");
+      out.unindent();
+      out.println("}");
+      out.unindent();
+      out.println("}");
+    }
+
 
 
     private void _writeSetColorList(



Mime
View raw message