myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject svn commit: r775042 - in /myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm: annot/ui/ metadata/ metadata/impl/ metadata/impl/ejb/
Date Fri, 15 May 2009 07:16:38 GMT
Author: imario
Date: Fri May 15 07:16:38 2009
New Revision: 775042

URL: http://svn.apache.org/viewvc?rev=775042&view=rev
Log:
allow to attach a comparator to a field to make use of it for sorting in data tables with
frameworks supporting it

Modified:
    myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/annot/ui/DataProvider.java
    myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/MetaField.java
    myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/MetaFieldWritable.java
    myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/MetaFieldImpl.java
    myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/EjbExtractor.java

Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/annot/ui/DataProvider.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/annot/ui/DataProvider.java?rev=775042&r1=775041&r2=775042&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/annot/ui/DataProvider.java
(original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/annot/ui/DataProvider.java
Fri May 15 07:16:38 2009
@@ -47,6 +47,12 @@
     public String description();
 
     /**
+     * An EL expression which evaluates to an instance of a {@link java.util.Comparator}
which could
+     * be used to handle sorting in data-tables with frameworks supporting it. 
+     */
+    public String comparator() default "";
+
+    /**
      * A converter to use to convert the object from/to a string value.
      */
     public String converterBean() default "";

Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/MetaField.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/MetaField.java?rev=775042&r1=775041&r2=775042&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/MetaField.java
(original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/MetaField.java
Fri May 15 07:16:38 2009
@@ -18,13 +18,13 @@
  */
 package org.apache.myfaces.orchestra.dynaForm.metadata;
 
+import org.apache.myfaces.orchestra.dynaForm.jsf.guiBuilder.DynaFormComponentHandler;
+import org.apache.myfaces.orchestra.dynaForm.lib.SelectionSourceEnum;
+
 import javax.faces.component.UIComponent;
 import javax.faces.convert.Converter;
 import javax.persistence.TemporalType;
 
-import org.apache.myfaces.orchestra.dynaForm.jsf.guiBuilder.DynaFormComponentHandler;
-import org.apache.myfaces.orchestra.dynaForm.lib.SelectionSourceEnum;
-
 /**
  * Rad-only representation of meta-data about a single property of an entity.
  * <p>
@@ -123,6 +123,8 @@
 
     public String getDataSourceDescription();
 
+    public String getDataComparator();
+
     public String getConverterId();
 
     // TODO: remove this method, it is jsf-specific

Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/MetaFieldWritable.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/MetaFieldWritable.java?rev=775042&r1=775041&r2=775042&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/MetaFieldWritable.java
(original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/MetaFieldWritable.java
Fri May 15 07:16:38 2009
@@ -18,13 +18,13 @@
  */
 package org.apache.myfaces.orchestra.dynaForm.metadata;
 
+import org.apache.myfaces.orchestra.dynaForm.jsf.guiBuilder.DynaFormComponentHandler;
+import org.apache.myfaces.orchestra.dynaForm.lib.SelectionSourceEnum;
+
 import javax.faces.component.UIComponent;
 import javax.faces.convert.Converter;
 import javax.persistence.TemporalType;
 
-import org.apache.myfaces.orchestra.dynaForm.jsf.guiBuilder.DynaFormComponentHandler;
-import org.apache.myfaces.orchestra.dynaForm.lib.SelectionSourceEnum;
-
 
 /**
  * Metadata for a field
@@ -55,6 +55,7 @@
     public void setEmbedded(boolean embedded);
     public void setDataSource(String dataSource);
     public void setDataSourceDescription(String dataSourceDescription);
+    public void setDataComparator(String dataComparator);
     public void setConverterId(String converterId);
     public void setConverterClass(Class<Converter> converterClass);
     public void setConverterBean(String converterBean);

Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/MetaFieldImpl.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/MetaFieldImpl.java?rev=775042&r1=775041&r2=775042&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/MetaFieldImpl.java
(original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/MetaFieldImpl.java
Fri May 15 07:16:38 2009
@@ -18,14 +18,6 @@
  */
 package org.apache.myfaces.orchestra.dynaForm.metadata.impl;
 
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.convert.Converter;
-import javax.persistence.TemporalType;
-
 import org.apache.myfaces.orchestra.dynaForm.jsf.guiBuilder.DynaFormComponentHandler;
 import org.apache.myfaces.orchestra.dynaForm.lib.SelectionSourceEnum;
 import org.apache.myfaces.orchestra.dynaForm.metadata.FieldRepresentation;
@@ -33,6 +25,13 @@
 import org.apache.myfaces.orchestra.dynaForm.metadata.RelationType;
 import org.apache.myfaces.orchestra.dynaForm.metadata.Selection;
 
+import javax.faces.component.UIComponent;
+import javax.faces.convert.Converter;
+import javax.persistence.TemporalType;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
 
 /**
  * Metadata for a field
@@ -70,6 +69,7 @@
 
     private String dataSource;
     private String dataSourceDescription;
+    private String dataComparator;
 
     private String converterId;
     private Class<Converter> converterClass;
@@ -362,6 +362,16 @@
         this.dataSourceDescription = dataSourceDescription;
     }
 
+    public String getDataComparator()
+    {
+        return dataComparator;
+    }
+
+    public void setDataComparator(String dataComparator)
+    {
+        this.dataComparator = dataComparator;
+    }
+
     public String getConverterId()
     {
         return converterId;

Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/EjbExtractor.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/EjbExtractor.java?rev=775042&r1=775041&r2=775042&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/EjbExtractor.java
(original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/EjbExtractor.java
Fri May 15 07:16:38 2009
@@ -601,6 +601,12 @@
             DataProvider dataProvider = accessibleObject.getAnnotation(DataProvider.class);
             mdField.setDataSource(dataProvider.value());
             mdField.setDataSourceDescription(dataProvider.description());
+
+            String comparator = dataProvider.comparator();
+            if (comparator != null && comparator.length() > 0)
+            {
+                mdField.setDataComparator(dataProvider.comparator());
+            }
             if (!StringUtils.isEmpty(dataProvider.converterBean()))
             {
                 mdField.setConverterBean(dataProvider.converterBean());



Mime
View raw message