You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/04/01 17:25:04 UTC

svn commit: r930001 - in /myfaces/tobago/trunk/theme: scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/

Author: lofwyr
Date: Thu Apr  1 15:25:04 2010
New Revision: 930001

URL: http://svn.apache.org/viewvc?rev=930001&view=rev
Log:
Cleanup: use default function to open the Date-Picker-Popup and remove unused functions.

Modified:
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
    myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=930001&r1=930000&r2=930001&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Thu Apr  1 15:25:04 2010
@@ -30,7 +30,6 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.UIDate;
 import org.apache.myfaces.tobago.component.UIDatePicker;
 import org.apache.myfaces.tobago.component.UIGridLayout;
-import org.apache.myfaces.tobago.component.UIHidden;
 import org.apache.myfaces.tobago.component.UIImage;
 import org.apache.myfaces.tobago.component.UIPanel;
 import org.apache.myfaces.tobago.component.UIPopup;
@@ -67,11 +66,6 @@ public class DatePickerRenderer extends 
     picker.setImmediate(true);
     final String linkId = picker.getId();
 
-    final String hiddenId = linkId != null ? linkId + "hidden" : facesContext.getViewRoot().createUniqueId();
-    UIHidden hidden = (UIHidden)
-        CreateComponentUtils.createComponent(facesContext, UIHidden.COMPONENT_TYPE, RendererTypes.HIDDEN, hiddenId);
-    picker.getChildren().add(hidden);
-
     // create popup
     final String popupId = linkId != null ? linkId + "popup" : facesContext.getViewRoot().createUniqueId();
     final UIPopup popup = (UIPopup) CreateComponentUtils.createComponent(
@@ -182,7 +176,6 @@ public class DatePickerRenderer extends 
   @Override
   public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
     UIDatePicker picker = (UIDatePicker) component;
-//    DatePickerController datePickerController = new DatePickerController();
     UIDate dateInput = (UIDate) picker.getForComponent();
     if (dateInput == null) {
       LOG.error("No required UIDate component found.");
@@ -200,15 +193,11 @@ public class DatePickerRenderer extends 
       }
     }
     Map<String, Object> attributes = picker.getAttributes();
-//    picker.setActionListener(datePickerController);
-
-    UIComponent hidden = (UIComponent) picker.getChildren().get(0);
     UIPopup popup = (UIPopup) picker.getFacets().get(Facets.PICKER_POPUP);
 
-    attributes.put(Attributes.ONCLICK, "Tobago.openPickerPopup(event, '"
-        + picker.getClientId(facesContext) + "', '"
-        + hidden.getClientId(facesContext) + "', '"
-        + popup.getClientId(facesContext) + "')");
+    attributes.put(Attributes.ONCLICK, "Tobago.openPopupWithAction(Tobago.element(event), '"
+        + popup.getClientId(facesContext) + "', '"
+        + picker.getClientId(facesContext) + "')");
 
     Converter converter = getConverter(facesContext, dateInput);
     String converterPattern = "yyyy-MM-dd"; // from calendar.js  initCalendarParse

Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=930001&r1=930000&r2=930001&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Thu Apr  1 15:25:04 2010
@@ -612,26 +612,6 @@ var Tobago = {
   },
 
   /**
-   * Submit the page with specified actionId and position data for popup.
-   */
-  openPickerPopup: function(event, actionId, hiddenId, popupId) {
-    var hidden = this.element(hiddenId);
-    if (hidden) {
-      // calculate position of command and size of window
-      hidden.value = this.getBrowserInnerWidth() + "x" + this.getBrowserInnerHeight();
-      if (event) {
-        hidden.value = hidden.value + ":" + event.clientX + "x" + event.clientY;
-      }
-    }
-    var source = Tobago.element(event);
-    if (Tobago.Transport.hasTransport()) {
-      Tobago.openPopupWithAction(source, popupId, actionId);
-    } else {
-      this.submitAction(source, actionId);
-    }
-  },
-
-  /**
    * Reset the form element.
    */
   resetForm: function() {
@@ -1582,35 +1562,6 @@ var Tobago = {
     return innerTop;
   },
 
-  /**
-    * Returns the client inner width.
-    */
-  getBrowserInnerWidth: function() {
-    var innerWidth;
-    if (document.all) { // ie
-      innerWidth = document.body.clientWidth;
-    } else {
-      innerWidth = window.innerWidth;
-      if (document.body.scrollHeight > window.innerHeight) {
-        innerWidth -= Tobago.Config.get("Tobago", "scrollbarWidth");
-      }
-    }
-    return innerWidth;
-  },
-
-  /**
-    * Returns the client inner height.
-    */
-  getBrowserInnerHeight: function() {
-    var innerHeight;
-    if (document.all) { // ie
-      innerHeight = document.body.clientHeight;
-    } else {
-      innerHeight = window.innerHeight;
-    }
-    return innerHeight;
-  },
-
   // TODO check if this is still ok
   doEditorCommand: function(element, id) {
     LOG.debug("doEditorCommand()");