You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2006/06/17 13:07:37 UTC

svn commit: r415021 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/component/ core/src/main/java/org/apache/myfaces/tobago/taglib/component/ example/demo/src/main/webapp/overview/

Author: bommel
Date: Sat Jun 17 04:07:37 2006
New Revision: 415021

URL: http://svn.apache.org/viewvc?rev=415021&view=rev
Log:
Added reload facet for sheet for TOBAGO-74

Added:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIReload.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ReloadTag.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ReloadTagDeclaration.java
Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java
    myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheetControl.jsp

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java?rev=415021&r1=415020&r2=415021&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java Sat Jun 17 04:07:37 2006
@@ -82,7 +82,6 @@
   private String showPageRange;
   private String showDirectLinks;
   private Integer directLinkCount;
-  private Integer autoReload;
 
   public void encodeBegin(FacesContext facesContext) throws IOException {
     UILayout.prepareDimension(facesContext, this);
@@ -438,7 +437,7 @@
 
 
   public Object saveState(FacesContext context) {
-    Object[] saveState = new Object[10];
+    Object[] saveState = new Object[9];
     saveState[0] = super.saveState(context);
     saveState[1] = sheetState;
     saveState[2] = saveAttachedState(context, sortActionListener);
@@ -448,7 +447,6 @@
     saveState[6] = showPageRange;
     saveState[7] = showDirectLinks;
     saveState[8] = directLinkCount;
-    saveState[9] = autoReload;
     return saveState;
   }
 
@@ -463,8 +461,6 @@
     showPageRange = (String) values[6];
     showDirectLinks = (String) values[7];
     directLinkCount = (Integer) values[8];
-    autoReload = (Integer) values[9];
-
   }
 
 
@@ -592,15 +588,7 @@
     this.showHeader = showHeader;
   }
 
-    public Integer getAutoReload() {
-        return autoReload;
-    }
-
-    public void setAutoReload(Integer autoReload) {
-        this.autoReload = autoReload;
-    }
-
-    public void encodeAjax(FacesContext facesContext) throws IOException {
+  public void encodeAjax(FacesContext facesContext) throws IOException {
     setupState(facesContext);
     prepareDimensions(facesContext);
     AjaxUtils.encodeAjaxComponent(facesContext, this);

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIReload.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIReload.java?rev=415021&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIReload.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIReload.java Sat Jun 17 04:07:37 2006
@@ -0,0 +1,47 @@
+package org.apache.myfaces.tobago.component;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: bommel
+ * Date: 28.05.2006
+ * Time: 21:57:46
+ * To change this template use File | Settings | File Templates.
+ */
+public class UIReload extends UIComponentBase {
+  public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Reload";
+  public static final String COMPONENT_FAMILY = "org.apache.myfaces.tobago.Reload";
+
+  private int frequency;
+
+  public int getFrequency() {
+    return frequency;
+  }
+
+  public void setFrequency(int frequency) {
+    this.frequency = frequency;
+  }
+
+  public String getFamily() {
+    return COMPONENT_FAMILY;
+  }
+
+
+}

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ReloadTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ReloadTag.java?rev=415021&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ReloadTag.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ReloadTag.java Sat Jun 17 04:07:37 2006
@@ -0,0 +1,58 @@
+package org.apache.myfaces.tobago.taglib.component;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.component.UIReload;
+import org.apache.myfaces.tobago.component.ComponentUtil;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FREQUENCY;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: bommel
+ * Date: 28.05.2006
+ * Time: 22:23:07
+ * To change this template use File | Settings | File Templates.
+ */
+public class ReloadTag extends TobagoTag
+    implements ReloadTagDeclaration {
+
+  private String frequency;
+
+  public String getComponentType() {
+    return UIReload.COMPONENT_TYPE;
+  }
+
+  public String getRendererType() {
+    return null;
+  }
+
+  public void release() {
+    super.release();
+    frequency = null;
+  }
+
+  protected void setProperties(UIComponent component) {
+    super.setProperties(component);
+    ComponentUtil.setIntegerProperty(component, ATTR_FREQUENCY, frequency);
+  }
+
+  public void setFrequency(String frequency) {
+    this.frequency = frequency;
+  }
+}

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ReloadTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ReloadTagDeclaration.java?rev=415021&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ReloadTagDeclaration.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ReloadTagDeclaration.java Sat Jun 17 04:07:37 2006
@@ -0,0 +1,49 @@
+package org.apache.myfaces.tobago.taglib.component;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.apt.annotation.Tag;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
+
+/*
+ * Created by IntelliJ IDEA.
+ * User: bommel
+ * Date: 28.05.2006
+ * Time: 22:31:38
+ * To change this template use File | Settings | File Templates.
+ */
+
+/**
+ * Update the parent component
+ */
+
+@Tag(name = "reload")
+@UIComponentTag(
+    uiComponent = "org.apache.myfaces.tobago.component.UIReload")
+public interface ReloadTagDeclaration extends TobagoTagDeclaration, HasIdBindingAndRendered {
+
+
+  /**
+   * Time in milliseconds after which the parent component is automaticaly reloaded.
+   */
+  @TagAttribute
+  @UIComponentTagAttribute(type = "java.lang.Integer")
+  void setFrequency(String frequency);
+}

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java?rev=415021&r1=415020&r2=415021&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTag.java Sat Jun 17 04:07:37 2006
@@ -16,7 +16,6 @@
  * limitations under the License.
  */
 
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_AUTO_RELOAD;
 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;
@@ -50,7 +49,6 @@
   private String state;
   private String stateChangeListener;
   private String sortActionListener;
-  private String autoReload;
 
   public String getComponentType() {
     // TODO: implement uidata with overridden processUpdates to store state
@@ -73,7 +71,6 @@
     state = null;
     stateChangeListener = null;
     sortActionListener = null;
-    autoReload = null;
   }
 
   protected void setProperties(UIComponent component) {
@@ -86,12 +83,10 @@
     ComponentUtil.setBooleanProperty(data, ATTR_SHOW_HEADER, showHeader);
     ComponentUtil.setIntegerProperty(data, ATTR_FIRST, first);
     ComponentUtil.setIntegerProperty(data, ATTR_ROWS, rows);
-    ComponentUtil.setIntegerProperty(data, ATTR_AUTO_RELOAD, autoReload);
     ComponentUtil.setStringProperty(data, ATTR_COLUMNS, columns);
     ComponentUtil.setStringProperty(data, ATTR_VALUE, value);
     ComponentUtil.setStringProperty(data, ATTR_FORCE_VERTICAL_SCROLLBAR, forceVerticalScrollbar);
     ComponentUtil.setStringProperty(data, ATTR_VAR, var);
-    //data.getAttributes().put(ATTR_INNER_WIDTH, new Integer(-1));
     ComponentUtil.setValueBinding(component, ATTR_STATE, state);
     ComponentUtil.setStateChangeListener(data, stateChangeListener);
     ComponentUtil.setSortActionListener(data, sortActionListener);
@@ -189,12 +184,5 @@
     this.sortActionListener = sortActionListener;
   }
 
-  public String getAutoReload() {
-    return autoReload;
-  }
-
-  public void setAutoReload(String autoReload) {
-    this.autoReload = autoReload;
-  }
 }
 

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java?rev=415021&r1=415020&r2=415021&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java Sat Jun 17 04:07:37 2006
@@ -75,13 +75,6 @@
   void setRows(String pagingLength);
 
   /**
-   * Time in milliseconds after which the sheet content is automaticaly reloaded.
-   */
-  @TagAttribute
-  @UIComponentTagAttribute(type = "java.lang.Integer")
-  void setAutoReload(String autoReload);
-
-  /**
    * Zero-relative row number of the first row to be displayed.
    */
   @TagAttribute

Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheetControl.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheetControl.jsp?rev=415021&r1=415020&r2=415021&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheetControl.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/overview/sheetControl.jsp Sat Jun 17 04:07:37 2006
@@ -117,8 +117,10 @@
             pagingLength="#{overviewController.sheetConfig.sheetPagingLength}"
             directLinkCount="#{overviewController.sheetConfig.sheetDirectLinkCount}"
             stateChangeListener="#{demo.stateChangeListener}"
-            sortActionListener="#{overviewController.sheetSorter}"
-            autoReload="1000"    >
+            sortActionListener="#{overviewController.sheetSorter}" >
+          <f:facet name="reload">
+            <tc:reload frequency="5000" />  
+          </f:facet>
           <tc:column label="#{overviewBundle.solarArrayName}" id="name" sortable="true">
             <tc:out value="#{luminary.name}" id="t_name" />
           </tc:column>