You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/03/04 19:34:21 UTC

svn commit: r383167 - in /incubator/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/component/ tobago-core/src/main/java/org/apache/myfaces/tobago/event/ tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/ tobago-exa...

Author: weber
Date: Sat Mar  4 10:34:20 2006
New Revision: 383167

URL: http://svn.apache.org/viewcvs?rev=383167&view=rev
Log:
adding javadoc

Modified:
    incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
    incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageAction.java
    incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java
    incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/SortActionEvent.java
    incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java
    incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java

Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIData.java?rev=383167&r1=383166&r2=383167&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIData.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIData.java Sat Mar  4 10:34:20 2006
@@ -263,8 +263,8 @@
             UIComponent child = (UIComponent) column.getChildren().get(0);
             int cellPaddingWidth = ((RendererBase) getRenderer(facesContext))
                 .getConfiguredValue(facesContext, this, "cellPaddingWidth");
-            child.getAttributes().put(ATTR_LAYOUT_WIDTH,
-                new Integer(width.intValue() - cellPaddingWidth));
+            child.getAttributes().put(
+                ATTR_LAYOUT_WIDTH, width - cellPaddingWidth);
           } else {
             LOG.warn("More or less than 1 child in column! "
                 + "Can't set width for column " + i + " to " + width);
@@ -456,7 +456,7 @@
         methodBinding.invoke(getFacesContext(), objects);
       } catch (EvaluationException e) {
         Throwable cause = e.getCause();
-        if (cause != null && cause instanceof AbortProcessingException) {
+        if (cause instanceof AbortProcessingException) {
           throw (AbortProcessingException) cause;
         } else {
           throw e;

Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageAction.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageAction.java?rev=383167&r1=383166&r2=383167&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageAction.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageAction.java Sat Mar  4 10:34:20 2006
@@ -21,31 +21,54 @@
 
 public enum PageAction {
 
+  /**
+   * First page is requested
+   */
   FIRST {
     public String getToken() {
       return "First";
     }
   },
+
+  /**
+   * Next page is requested
+   */
   NEXT {
     public String getToken() {
       return "Next";
     }
   },
+
+  /**
+   * Previous page is requested
+   */
   PREV {
     public String getToken() {
       return "Prev";
     }
   },
+
+  /**
+   * Next page is requested
+   */
   LAST {
     public String getToken() {
       return "Last";
     }
   },
+
+  /**
+   * A specified row is requested
+   */
   TO_ROW {
     public String getToken() {
       return "ToRow";
     }
   },
+
+  /**
+   * A specified page is requested
+   */
   TO_PAGE {
     public String getToken() {
       return "ToPage";
@@ -53,7 +76,7 @@
   };
 
   private static final Map<String, PageAction> mapping;
-    
+
   static {
     mapping = new HashMap<String, PageAction>();
 

Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java?rev=383167&r1=383166&r2=383167&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java Sat Mar  4 10:34:20 2006
@@ -32,6 +32,9 @@
     this.action = action;
   }
 
+  /**
+   * Returns the action type ({@link PageAction}).
+   */
   public PageAction getAction() {
     return action;
   }
@@ -40,10 +43,17 @@
     this.value = value;
   }
 
+  /**
+   * Returns the value for action types {@link PageAction.TO_ROW}
+   * and {@link PageAction.TO_PAGE}. 
+   */
   public int getValue() {
     return value;
   }
 
+ /**
+  * Convenience method to get the UIData Component.
+  */
   public UIData getSheet() {
     return (UIData) getComponent();
   }

Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/SortActionEvent.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/SortActionEvent.java?rev=383167&r1=383166&r2=383167&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/SortActionEvent.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/SortActionEvent.java Sat Mar  4 10:34:20 2006
@@ -32,6 +32,11 @@
     setPhaseId(PhaseId.INVOKE_APPLICATION);
   }
 
+  /**
+   * Returns the UIColumn object for which this event is triggert.
+   *
+   * @return UIColumn
+   */
   public UIColumn getColumn() {
     return column;
   }

Modified: incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java?rev=383167&r1=383166&r2=383167&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java (original)
+++ incubator/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java Sat Mar  4 10:34:20 2006
@@ -16,7 +16,19 @@
  * limitations under the License.
  */
 
-import static org.apache.myfaces.tobago.TobagoConstants.*;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_COLUMNS;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DIRECT_LINK_COUNT;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FIRST;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FORCE_VERTICAL_SCROLLBAR;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INNER_WIDTH;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ROWS;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_DIRECT_LINKS;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_HEADER;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_PAGE_RANGE;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_ROW_RANGE;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STATE;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VAR;
 import org.apache.myfaces.tobago.apt.annotation.BodyContentDescription;
 import org.apache.myfaces.tobago.apt.annotation.Tag;
 import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
@@ -276,13 +288,18 @@
    * MethodBinding representing an actionListener method that will be
    * invoked when sorting was requested by the user.
    * Use this if your application needs special handling for sorting columns.
-   * If this is not set and the sortable attribute column is not false the sheet
+   * If this is not set and the sortable attribute column is set to true the sheet
    * implementation will use a default sort method.
    * The expression must evaluate to a public method that takes an
    * ActionEvent parameter, with a return type of void.
-   * The parent of the actionEvents source will be the UIColumn object for that
-   * the sorting is requested,
-   * <code>UIColumn column = (UIColumn)actionEvent.getSource().getParent()</code>.
+   * The method will recieve a SortActionEvent,
+   * The method should sort according to the sortColumnId and direction getting from
+   * the sheets SheetState object.*//*
+   * The expression must evaluate to a public method that takes an
+   * ActionEvent parameter, with a return type of void.
+   * The method will recieve a {@link SortActionEvent},
+   * The method should sort according to the sortColumnId and direction getting from
+   * the sheets {@link SheetState} object.
    */
   @TagAttribute
   @UIComponentTagAttribute()

Modified: incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
URL: http://svn.apache.org/viewcvs/incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java?rev=383167&r1=383166&r2=383167&view=diff
==============================================================================
--- incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java (original)
+++ incubator/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java Sat Mar  4 10:34:20 2006
@@ -121,8 +121,10 @@
   public void sheetSorter(ActionEvent event) {
     if (event instanceof SortActionEvent) {
       SortActionEvent sortEvent = (SortActionEvent) event;
-      String columnId = sortEvent.getColumn().getId();
-      UIData sheet = sortEvent.getSheet();
+      UIData sheet = sortEvent.getSheet();      
+      SheetState sheetState
+          = sheet.getSheetState(FacesContext.getCurrentInstance());
+      String columnId = sheetState.getSortedColumnId();
       List<SolarObject> list = (List<SolarObject>) sheet.getValue();
       SolarObject sun = list.remove(0);
 
@@ -179,8 +181,6 @@
       }
 
       Collections.sort(list, comparator);
-      SheetState sheetState
-          = sheet.getSheetState(FacesContext.getCurrentInstance());
       if (!sheetState.isAscending()) {
         Collections.reverse(list);
       }