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 2008/06/11 15:24:06 UTC

svn commit: r666656 - in /myfaces/tobago/branches/tobago-1.0.x: core/src/main/java/org/apache/myfaces/tobago/component/ core/src/main/java/org/apache/myfaces/tobago/event/ core/src/main/java/org/apache/myfaces/tobago/layout/ core/src/main/java/org/apac...

Author: lofwyr
Date: Wed Jun 11 06:24:05 2008
New Revision: 666656

URL: http://svn.apache.org/viewvc?rev=666656&view=rev
Log:
TOBAGO-487: Action on server-side needs the coordinate of the event on the client side
+ Adding some new submit methods with suffix "2" to be backward compatible.
+ The position will be stored in the UIPage

Added:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Position.java
Removed:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/event/DatePickerController.java
Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIPage.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/CommandRendererHelper.java
    myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/reference/popup.jsp
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/RichTextEditorRenderer.java
    myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
    myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js
    myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js
    myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java Wed Jun 11 06:24:05 2008
@@ -17,6 +17,7 @@
  * limitations under the License.
  */
 
+import org.apache.myfaces.tobago.TobagoConstants;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ALT;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_CALENDAR_DATE_INPUT_ID;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_COLUMNS;
@@ -35,9 +36,7 @@
 import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_POPUP;
 import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_TIME;
 import org.apache.myfaces.tobago.context.ResourceManagerUtil;
-import org.apache.myfaces.tobago.event.DatePickerController;
 import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
-import org.apache.myfaces.tobago.TobagoConstants;
 
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIGraphic;
@@ -53,6 +52,9 @@
 
   public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.DatePicker";
 
+  public static final String OPEN_POPUP = "openPopup";
+  public static final String CLOSE_POPUP = "closePopup";
+
   private String forComponent;
 
   public Object saveState(FacesContext context) {
@@ -145,7 +147,7 @@
         (UIPopup) ComponentUtil.createComponent(facesContext, UIPopup.COMPONENT_TYPE,
             RENDERER_TYPE_POPUP, (linkId != null ? linkId + "popup" : viewRoot.createUniqueId()));
     popup.getAttributes().put(TobagoConstants.ATTR_ZINDEX, 10);
-      
+
     link.getFacets().put(FACET_PICKER_POPUP, popup);
 
     popup.setRendered(false);
@@ -208,7 +210,7 @@
     final UICommand okButton =
         (UICommand) ComponentUtil.createComponent(facesContext,
             org.apache.myfaces.tobago.component.UIButtonCommand.COMPONENT_TYPE,
-            RENDERER_TYPE_BUTTON, "ok" + DatePickerController.CLOSE_POPUP);
+            RENDERER_TYPE_BUTTON, "ok" + CLOSE_POPUP);
     buttonPanel.getChildren().add(okButton);
     attributes = okButton.getAttributes();
     attributes.put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(
@@ -217,7 +219,7 @@
     final UICommand cancelButton =
         (UICommand) ComponentUtil.createComponent(facesContext,
             org.apache.myfaces.tobago.component.UIButtonCommand.COMPONENT_TYPE,
-            RENDERER_TYPE_BUTTON, DatePickerController.CLOSE_POPUP);
+            RENDERER_TYPE_BUTTON, CLOSE_POPUP);
     buttonPanel.getChildren().add(cancelButton);
     attributes = cancelButton.getAttributes();
     attributes.put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIPage.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIPage.java?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIPage.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIPage.java Wed Jun 11 06:24:05 2008
@@ -28,6 +28,7 @@
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STATE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
 import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
+import org.apache.myfaces.tobago.layout.Box;
 import org.apache.myfaces.tobago.model.PageState;
 import org.apache.myfaces.tobago.model.PageStateImpl;
 import org.apache.myfaces.tobago.webapp.TobagoMultipartFormdataRequest;
@@ -64,6 +65,8 @@
 
   private String actionId;
 
+  private Box actionPosition;
+
   private String defaultActionId;
 
   private List<KeyValue> postfields;
@@ -319,6 +322,14 @@
     this.actionId = actionId;
   }
 
+  public Box getActionPosition() {
+    return actionPosition;
+  }
+
+  public void setActionPosition(Box actionPosition) {
+    this.actionPosition = actionPosition;
+  }
+
   public String getDefaultActionId() {
     return defaultActionId;
   }

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java Wed Jun 11 06:24:05 2008
@@ -17,14 +17,12 @@
  * limitations under the License.
  */
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
 import org.apache.myfaces.tobago.TobagoConstants;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LEFT;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TOP;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
+import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
 
 import javax.faces.component.NamingContainer;
 import javax.faces.component.UIComponent;
@@ -35,8 +33,6 @@
 
 public class UIPopup extends UIPanelBase implements NamingContainer, AjaxComponent {
 
-  private static final Log LOG = LogFactory.getLog(UIPopup.class);
-
   public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Popup";
 
   private String width;
@@ -161,7 +157,8 @@
     }
     ValueBinding vb = getValueBinding(ATTR_WIDTH);
     if (vb != null) {
-      return (String) vb.getValue(getFacesContext());
+      Object value = vb.getValue(getFacesContext());
+      return value != null ? value.toString() : null;
     } else {
       return null;
     }
@@ -177,7 +174,8 @@
     }
     ValueBinding vb = getValueBinding(ATTR_HEIGHT);
     if (vb != null) {
-      return (String) vb.getValue(getFacesContext());
+      Object value = vb.getValue(getFacesContext());
+      return value != null ? value.toString() : null;
     } else {
       return null;
     }
@@ -193,7 +191,8 @@
     }
     ValueBinding vb = getValueBinding(ATTR_LEFT);
     if (vb != null) {
-      return (String) vb.getValue(getFacesContext());
+      Object value = vb.getValue(getFacesContext());
+      return value != null ? value.toString() : null;
     } else {
       return null;
     }
@@ -209,7 +208,8 @@
     }
     ValueBinding vb = getValueBinding(ATTR_TOP);
     if (vb != null) {
-      return (String) vb.getValue(getFacesContext());
+      Object value = vb.getValue(getFacesContext());
+      return value != null ? value.toString() : null;
     } else {
       return null;
     }

Added: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java?rev=666656&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java Wed Jun 11 06:24:05 2008
@@ -0,0 +1,84 @@
+package org.apache.myfaces.tobago.layout;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+/**
+ * User: lofwyr
+ * Date: 28.05.2008 15:10:29
+ */
+
+public class Box {
+
+  private Position position;
+  private Dimension dimension;
+
+  public Box(Position position, Dimension dimension) {
+    this.position = position;
+    this.dimension = dimension;
+  }
+
+  public Box(String string) {
+    int comma = string.indexOf(',');
+    if (comma >= 0) { // found first comma
+      comma = string.indexOf(',', comma + 1);
+      if (comma >= 0) { // found second comma
+        position = new Position(string.substring(0, comma));
+        dimension = new Dimension(string.substring(comma + 1));
+        return;
+      }
+    }
+    throw new IllegalArgumentException("Can't parse to a box: '" + string + "'");
+  }
+
+  public Measure getLeft() {
+    return position.getLeft();
+  }
+
+  public void setLeft(Measure left) {
+    position.setLeft(left);
+  }
+
+  public Measure getTop() {
+    return position.getTop();
+  }
+
+  public void setTop(Measure top) {
+    position.setTop(top);
+  }
+
+  public Measure getWidth() {
+    return dimension.getWidth();
+  }
+
+  public void setWidth(Measure width) {
+    dimension.setWidth(width);
+  }
+
+  public Measure getHeight() {
+    return dimension.getHeight();
+  }
+
+  public void setHeight(Measure height) {
+    dimension.setHeight(height);
+  }
+
+  @Override
+  public String toString() {
+    return new StringBuilder().append(position).append(',').append(dimension).toString();
+  }
+}

Added: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java?rev=666656&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java Wed Jun 11 06:24:05 2008
@@ -0,0 +1,64 @@
+package org.apache.myfaces.tobago.layout;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+/**
+ * User: lofwyr
+ * Date: 23.01.2008 20:18:45
+ */
+public class Dimension {
+
+  private Measure width;
+  private Measure height;
+
+  public Dimension(Measure width, Measure height) {
+    this.width = width;
+    this.height = height;
+  }
+
+  public Dimension(String string) {
+    int comma = string.indexOf(',');
+    if (comma >= 0) { // found first comma
+      width = Measure.parse(string.substring(0, comma));
+      height = Measure.parse(string.substring(comma + 1));
+    } else {
+      throw new IllegalArgumentException("Can't parse to the dimension: '" + string + "'");
+    }
+  }
+
+  public Measure getWidth() {
+    return width;
+  }
+
+  public void setWidth(Measure width) {
+    this.width = width;
+  }
+
+  public Measure getHeight() {
+    return height;
+  }
+
+  public void setHeight(Measure height) {
+    this.height = height;
+  }
+
+  @Override
+  public String toString() {
+    return new StringBuilder().append(width).append(',').append(height).toString();
+  }
+}

Added: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java?rev=666656&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java Wed Jun 11 06:24:05 2008
@@ -0,0 +1,44 @@
+package org.apache.myfaces.tobago.layout;
+
+import org.apache.commons.lang.StringUtils;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+/**
+ * User: lofwyr
+ * Date: 23.01.2008 20:12:30
+ */
+public abstract class Measure {
+
+  // todo: refactor and consolidate with LayoutToken
+
+  public static Measure parse(String value) {
+    if (StringUtils.isEmpty(value)) {
+      return new PixelMeasure(0); // fixme: may return a "default measure", or is Pixel the default?
+    }
+    if (value.toLowerCase().matches("\\d+px")) {// XXX no regexp here: user LayoutTokens.parse !!!
+      return new PixelMeasure(Integer.parseInt(value.substring(0, value.length() - 2)));
+    }
+    throw new IllegalArgumentException("Can't parse to any measure: '" + value + "'");
+  }
+
+  // fixme: use mesaure
+  abstract void substract(int sub);
+
+  abstract int getPixel();
+}

Added: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java?rev=666656&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java Wed Jun 11 06:24:05 2008
@@ -0,0 +1,56 @@
+package org.apache.myfaces.tobago.layout;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/*
+ * Date: 23.01.2008 20:21:08
+ */
+public class PixelMeasure extends Measure {
+
+  private static final Log LOG = LogFactory.getLog(PixelMeasure.class);
+
+  private int pixel;
+
+  public PixelMeasure(int pixel) {
+    this.pixel = pixel;
+  }
+
+  public void substract(int sub) {
+    pixel -= sub;
+    if (pixel < 0) {
+      LOG.warn("Not enough space! value=" + pixel);
+      pixel = 0;
+    }
+  }
+
+  public int getPixel() {
+    return pixel;
+  }
+
+  public void setPixel(int pixel) {
+    this.pixel = pixel;
+  }
+
+  @Override
+  public String toString() {
+    return pixel + "px";
+  }
+}

Added: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Position.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Position.java?rev=666656&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Position.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/layout/Position.java Wed Jun 11 06:24:05 2008
@@ -0,0 +1,64 @@
+package org.apache.myfaces.tobago.layout;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+/**
+ * User: lofwyr
+ * Date: 23.01.2008 20:18:45
+ */
+public class Position {
+
+  private Measure left;
+  private Measure top;
+
+  public Position(Measure left, Measure top) {
+    this.left = left;
+    this.top = top;
+  }
+
+  public Position(String string) {
+    int comma = string.indexOf(',');
+    if (comma >= 0) { // found first comma
+      left = Measure.parse(string.substring(0, comma));
+      top = Measure.parse(string.substring(comma + 1));
+    } else {
+      throw new IllegalArgumentException("Can't parse to the position: '" + string + "'");
+    }
+  }
+
+  public Measure getLeft() {
+    return left;
+  }
+
+  public void setLeft(Measure left) {
+    this.left = left;
+  }
+
+  public Measure getTop() {
+    return top;
+  }
+
+  public void setTop(Measure top) {
+    this.top = top;
+  }
+
+  @Override
+  public String toString() {
+    return new StringBuilder().append(left).append(',').append(top).toString();
+  }
+}

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java Wed Jun 11 06:24:05 2008
@@ -17,8 +17,8 @@
  * limitations under the License.
  */
 
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ONCLICK;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ONCLICK;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
 import static org.apache.myfaces.tobago.TobagoConstants.FACET_MENUBAR;
 import org.apache.myfaces.tobago.component.ComponentUtil;
@@ -183,7 +183,7 @@
       UIComponent facetComponent = facetEntry.getValue();
       String facetAction = (String) facetComponent.getAttributes().get(ATTR_ONCLICK);
       if (facetAction == null) {
-        facetAction = "Tobago.submitAction('" + facetComponent.getClientId(facesContext) + "')";
+        facetAction = "Tobago.submitAction2(this, '" + facetComponent.getClientId(facesContext) + "', null, null)";
       }
       String script =
           "var element = Tobago.element(\"" + clientId + "\");\n"

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java Wed Jun 11 06:24:05 2008
@@ -17,10 +17,12 @@
  * limitations under the License.
  */
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
 import org.apache.myfaces.tobago.component.UIPage;
+import org.apache.myfaces.tobago.layout.Box;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -32,14 +34,30 @@
   public void decode(FacesContext facesContext, UIComponent component) {
     if (component instanceof UIPage) {
       UIPage page = (UIPage) component;
-      String name = page.getClientId(facesContext)
-          + SUBCOMPONENT_SEP + "form-action";
-      String newActionId = (String) facesContext.getExternalContext()
-          .getRequestParameterMap().get(name);
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("action = " + newActionId);
+
+      {
+        String name = page.getClientId(facesContext) + SUBCOMPONENT_SEP + "form-action";
+        String newActionId = (String) facesContext.getExternalContext().getRequestParameterMap().get(name);
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("action = " + newActionId);
+        }
+        page.setActionId(newActionId);
+      }
+
+      try {
+        String name = page.getClientId(facesContext) + SUBCOMPONENT_SEP + "action-position";
+        String actionPositionString = (String) facesContext.getExternalContext().getRequestParameterMap().get(name);
+        LOG.info("actionPosition='" + actionPositionString + "'");
+        if (StringUtils.isNotEmpty(actionPositionString)) {
+          Box actionPosition = new Box(actionPositionString);
+          page.setActionPosition(actionPosition);
+        } else {
+          page.setActionPosition(null);
+        }
+      } catch (Exception e) {
+        LOG.warn("Can't analyse parameter for action-position", e);
       }
-      page.setActionId(newActionId);
+
     }
   }
 }

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/CommandRendererHelper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/CommandRendererHelper.java?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/CommandRendererHelper.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/CommandRendererHelper.java Wed Jun 11 06:24:05 2008
@@ -26,23 +26,23 @@
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_CLOSE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TARGET;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TRANSITION;
-import static org.apache.myfaces.tobago.TobagoConstants.FACET_POPUP;
 import static org.apache.myfaces.tobago.TobagoConstants.FACET_CONFIRMATION;
+import static org.apache.myfaces.tobago.TobagoConstants.FACET_POPUP;
 import org.apache.myfaces.tobago.component.ComponentUtil;
 import org.apache.myfaces.tobago.component.UIPopup;
-import org.apache.myfaces.tobago.event.PopupActionListener;
 import org.apache.myfaces.tobago.context.ClientProperties;
+import org.apache.myfaces.tobago.event.PopupActionListener;
 
-import javax.faces.context.FacesContext;
-import javax.faces.component.UIComponent;
-import javax.faces.component.ValueHolder;
-import javax.faces.component.UIParameter;
-import javax.faces.component.UICommand;
 import javax.faces.application.Application;
 import javax.faces.application.ViewHandler;
-import java.util.List;
-import java.util.Arrays;
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIParameter;
+import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
 import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * User: lofwyr
@@ -106,16 +106,16 @@
           // TODO find a better way
           boolean popupAction = ComponentUtil.containsPopupActionListener(command);
           if (popupAction) {
-            onclick = "Tobago.openPopupWithAction('"
-                + HtmlRendererUtil.getComponentId(facesContext, command, componentId[0]) + "', '" + clientId + "')";
+            onclick = "Tobago.openPopupWithAction2(this, '"
+                + HtmlRendererUtil.getComponentId(facesContext, command, componentId[0]) + "', '" + clientId + "', null)";
           } else {
-            onclick = "Tobago.reloadComponent('"
+            onclick = "Tobago.reloadComponent2(this, '"
                 + HtmlRendererUtil.getComponentId(facesContext, command, componentId[0]) + "','" + clientId + "', {});";
           }
         } else {
           LOG.error("more than one parially rendered component is currently not supported "
               + Arrays.toString(componentId));
-          onclick = "Tobago.submitAction('" + clientId + "', " + transition + ");";
+          onclick = "Tobago.submitAction2(this, '" + clientId + "', " + transition + ", null);";
         }
 
       } else if (defaultCommand) {
@@ -124,9 +124,9 @@
       } else {
         String target = ComponentUtil.getStringAttribute(command, ATTR_TARGET);
         if (target == null) {
-          onclick = "Tobago.submitAction('" + clientId + "', " + transition + ");";
+          onclick = "Tobago.submitAction2(this, '" + clientId + "', " + transition + ", null);";
         } else {
-          onclick = "Tobago.submitAction('" + clientId + "', " + transition + ", '" + target + "');";
+          onclick = "Tobago.submitAction2(this, '" + clientId + "', " + transition + ", '" + target + "');";
         }
       }
 

Modified: myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/reference/popup.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/reference/popup.jsp?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/reference/popup.jsp (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/reference/popup.jsp Wed Jun 11 06:24:05 2008
@@ -98,7 +98,6 @@
         </f:facet>
       </tc:button>
 
-
       <tc:out value="here is the boolean >>#{reference.bool}<<"/>
 
       <tc:cell/>
@@ -106,13 +105,15 @@
 
       <tc:button label="Open here">
         <f:facet name="popup">
-          <tc:popup width="150" height="100" left="220" top="260">
+          <tc:popup width="150" height="100"
+                    left="#{view.children[0].actionPosition.left.pixel + view.children[0].actionPosition.width.pixel + 5}"
+                    top="#{view.children[0].actionPosition.top.pixel}">
             <tc:box label="Text input">
               <f:facet name="layout">
                 <tc:gridLayout rows="*;fixed"/>
               </f:facet>
 
-              <tc:textarea value="This popup position is hardcoded!"/>
+              <tc:textarea value="The position of this popup should be right beside the button."/>
               <tc:button label="Ok">
                 <tc:attribute name="popupClose" value="afterSubmit"/>
               </tc:button>

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.java?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.java Wed Jun 11 06:24:05 2008
@@ -23,6 +23,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.TobagoConstants;
 import org.apache.myfaces.tobago.component.UICommand;
 import org.apache.myfaces.tobago.component.UIProgress;
 import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
@@ -31,7 +32,6 @@
 import org.apache.myfaces.tobago.renderkit.html.HtmlRendererUtil;
 import org.apache.myfaces.tobago.util.LayoutUtil;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
-import org.apache.myfaces.tobago.TobagoConstants;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -98,7 +98,7 @@
     if (model.getValue() == model.getMaximum() && facet != null
         && facet instanceof UICommand) {
       UICommand command = (UICommand) facet;
-      writer.writeJavascript("Tobago.submitAction('" + command.getClientId(facesContext) + "');");
+      writer.writeJavascript("Tobago.submitAction2(this, '" + command.getClientId(facesContext) + "', null, null);");
     }
   }
 }

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Wed Jun 11 06:24:05 2008
@@ -17,29 +17,28 @@
  * limitations under the License.
  */
 
-import org.apache.myfaces.tobago.event.DatePickerController;
-import org.apache.myfaces.tobago.event.PopupActionListener;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_WIDTH;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.TobagoConstants;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_ONCLICK;
-import static org.apache.myfaces.tobago.TobagoConstants.FACET_PICKER_POPUP;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_RESET;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_WIDTH;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_RESET;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
-import org.apache.myfaces.tobago.component.UIDatePicker;
-import org.apache.myfaces.tobago.component.UIPopup;
+import static org.apache.myfaces.tobago.TobagoConstants.FACET_PICKER_POPUP;
+import org.apache.myfaces.tobago.component.ComponentUtil;
 import org.apache.myfaces.tobago.component.UIDateInput;
+import org.apache.myfaces.tobago.component.UIDatePicker;
 import org.apache.myfaces.tobago.component.UIPage;
-import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.UIPopup;
 import org.apache.myfaces.tobago.config.ThemeConfig;
+import org.apache.myfaces.tobago.event.PopupActionListener;
 import org.apache.myfaces.tobago.util.DateFormatUtils;
-import org.apache.myfaces.tobago.TobagoConstants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
-import javax.faces.context.FacesContext;
-import javax.faces.component.UIComponent;
 import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
 import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
 import javax.faces.convert.DateTimeConverter;
 import static javax.faces.convert.DateTimeConverter.CONVERTER_ID;
@@ -57,7 +56,6 @@
   public void encodeBegin(FacesContext facesContext,
       UIComponent component) throws IOException {
     UIDatePicker link = (UIDatePicker) component;
-    DatePickerController datePickerController = new DatePickerController();
     UIDateInput dateInput = (UIDateInput) link.getForComponent();
     if (dateInput == null) {
       LOG.error("No required UIDateInput component found.");
@@ -73,7 +71,6 @@
       }
     }
     Map<String, Object>  attributes = link.getAttributes();
-    link.setActionListener(datePickerController);
     attributes.put(ATTR_LAYOUT_WIDTH, getConfiguredValue(facesContext, component, "pickerWidth"));
     UIComponent hidden = (UIComponent) link.getChildren().get(0);
     UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
@@ -99,13 +96,13 @@
       //    + converterPattern);
     }
 
-    UICommand okButton = (UICommand) popup.findComponent("ok" + DatePickerController.CLOSE_POPUP);
+    UICommand okButton = (UICommand) popup.findComponent("ok" + UIDatePicker.CLOSE_POPUP);
     attributes = okButton.getAttributes();
     attributes.put(ATTR_ACTION_ONCLICK, "var textBox = writeIntoField2(this);Tobago.closePopup(this);textBox.focus();");
     attributes.put(TobagoConstants.ATTR_POPUP_CLOSE, "afterSubmit");
    // okButton.setActionListener(datePickerController);
 
-    UICommand cancelButton  = (UICommand) popup.findComponent(DatePickerController.CLOSE_POPUP);
+    UICommand cancelButton  = (UICommand) popup.findComponent(UIDatePicker.CLOSE_POPUP);
     attributes = cancelButton.getAttributes();
     attributes.put(ATTR_ACTION_ONCLICK, "var textBox = writeIntoField2(this);Tobago.closePopup(this);textBox.focus();");
     attributes.put(TobagoConstants.ATTR_POPUP_CLOSE, "immediate");
@@ -113,10 +110,9 @@
 
     applyConverterPattern(facesContext, popup, converterPattern);
 
-    if (popup != null) {
-      UIPage page = ComponentUtil.findPage(facesContext, link);
-      page.getPopups().add(popup);
-    }
+    UIPage page = ComponentUtil.findPage(facesContext, link);
+    page.getPopups().add(popup);
+
     if (!ComponentUtil.containsPopupActionListener(link)) {
       link.addActionListener(new PopupActionListener(popup.getId()));
     }

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Wed Jun 11 06:24:05 2008
@@ -293,10 +293,11 @@
         String target = ComponentUtil.getStringAttribute(command, ATTR_TARGET);
         String action;
         if (target != null) {
-          action = "Tobago.submitAction('" + command.getClientId(facesContext) + "', " 
-                  + transition + ", '" + target + "' )";
+          action = "Tobago.submitAction2(this, '" + command.getClientId(facesContext) + "', "
+              + transition + ", '" + target + "')";
         } else {
-          action = "Tobago.submitAction('"+ command.getClientId(facesContext) + "', " + transition + " )";
+          action = "Tobago.submitAction2(this, '"+ command.getClientId(facesContext) + "', "
+              + transition + ", null)";
         }
         page.getOnloadScripts().add("setTimeout(\"" + action  + "\", " + duration + ");\n");
       }
@@ -379,22 +380,24 @@
 
     writer.startElement(HtmlConstants.INPUT, null);
     writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
-    writer.writeNameAttribute(
-        clientId + SUBCOMPONENT_SEP + "form-action");
-    writer.writeIdAttribute(
-        clientId + SUBCOMPONENT_SEP + "form-action");
+    writer.writeNameAttribute(clientId + SUBCOMPONENT_SEP + "form-action");
+    writer.writeIdAttribute(clientId + SUBCOMPONENT_SEP + "form-action");
     writer.writeAttribute(HtmlAttributes.VALUE, defaultActionId, true);
     writer.endElement(HtmlConstants.INPUT);
 
     writer.startElement(HtmlConstants.INPUT, null);
     writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
-    writer.writeNameAttribute(
-        clientId + SUBCOMPONENT_SEP + "context-path");
-    writer.writeIdAttribute(
-        clientId + SUBCOMPONENT_SEP + "context-path");
+    writer.writeNameAttribute(clientId + SUBCOMPONENT_SEP + "context-path");
+    writer.writeIdAttribute(clientId + SUBCOMPONENT_SEP + "context-path");
     writer.writeAttribute(HtmlAttributes.VALUE, facesContext.getExternalContext().getRequestContextPath(), true);
     writer.endElement(HtmlConstants.INPUT);
 
+    writer.startElement(HtmlConstants.INPUT, null);
+    writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
+    writer.writeNameAttribute(clientId + SUBCOMPONENT_SEP + "action-position");
+    writer.writeIdAttribute(clientId + SUBCOMPONENT_SEP + "action-position");
+    writer.endElement(HtmlConstants.INPUT);
+
     if (debugMode) {
       writer.startElement(HtmlConstants.INPUT, null);
       writer.writeAttribute(HtmlAttributes.VALUE, clientLogSeverity);

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java Wed Jun 11 06:24:05 2008
@@ -114,10 +114,7 @@
     if (model.getValue() == model.getMaximum() && facet != null
         && facet instanceof UICommand) {
       UICommand command = (UICommand) facet;
-      writer.writeJavascript("Tobago.submitAction('" + command.getClientId(facesContext) + "');");
+      writer.writeJavascript("Tobago.submitAction2(this, '" + command.getClientId(facesContext) + "', null, null);");
     }
-
   }
-
 }
-

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/RichTextEditorRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/RichTextEditorRenderer.java?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/RichTextEditorRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/RichTextEditorRenderer.java Wed Jun 11 06:24:05 2008
@@ -195,8 +195,8 @@
         facesContext, "tobago", "tobago.richtexteditor.edit.title");
     command.getAttributes().put(ATTR_TIP, title);
 
-    String onClick = "Tobago.submitAction('"
-        + clientId + RichTextEditorRenderer.CHANGE_BUTTON + "')";
+    String onClick = "Tobago.submitAction2(this, '" 
+        + clientId + RichTextEditorRenderer.CHANGE_BUTTON + "', null, null)";
     command.getAttributes().put(ATTR_ACTION_ONCLICK, onClick);
 
     command = (UICommand) ComponentUtil.createComponent(

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Wed Jun 11 06:24:05 2008
@@ -811,7 +811,7 @@
         column.getFacets().put(UIData.FACET_SORTER, sortCommand);
       }
 
-      String onclick = "Tobago.submitAction('" + sortCommand.getClientId(facesContext) + "')";
+      String onclick = "Tobago.submitAction2(this, '" + sortCommand.getClientId(facesContext) + "', null, null)";
       writer.writeAttribute(HtmlAttributes.ONCLICK, onclick, false);
 
       if (StringUtils.isNotEmpty(tip)) {

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js Wed Jun 11 06:24:05 2008
@@ -107,9 +107,9 @@
       if (Tobago.Updater.hasTransport()) {
         this.removeRelatedAcceleratorKeys(aId.substring(0, aId.lastIndexOf(Tobago.SUB_COMPONENT_SEP) + Tobago.SUB_COMPONENT_SEP.length));
         var container = Tobago.element(this.tabGroupId);
-        Tobago.Updater.update(container, Tobago.page, this.tabGroupId, this.tabGroupId, this.options);
+        Tobago.Updater.update2(event.srcElement, container, Tobago.page, this.tabGroupId, this.tabGroupId, this.options);
       } else {
-        Tobago.submitAction(this.tabGroupId);
+        Tobago.submitAction2(event.srcElement, this.tabGroupId, null, null);
       }
     }
   } else {

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js Wed Jun 11 06:24:05 2008
@@ -105,7 +105,7 @@
 };
 
 Tobago.Sheet.prototype.sortOnclickRegExp
-      = new RegExp("Tobago.submitAction\\(('|\")(.*?)('|\")\\)");
+      = new RegExp("Tobago.submitAction2\\(this, ('|\")(.*?)('|\"), null, null\\)");
 
 
 Tobago.Sheet.prototype.setupElements = function() {
@@ -204,7 +204,7 @@
     }
 //    LOG.debug("element.id = " + element.id);
 //    LOG.debug("sorterId = " + element.sorterId);
-    this.reloadWithAction(element.sorterId);
+    this.reloadWithAction2(event.srcElement, element.sorterId, null);
   };
 
 Tobago.Sheet.prototype.doPagingDirect = function(event) {
@@ -219,7 +219,7 @@
     hidden.name = action + Tobago.SUB_COMPONENT_SEP +  "value";
     Tobago.element(this.outerDivId).appendChild(hidden);
 
-    this.reloadWithAction(action);
+    this.reloadWithAction2(event.srcElement, action, null);
   };
 
 Tobago.Sheet.prototype.doPaging = function(event) {
@@ -234,15 +234,19 @@
     } else if (element.id.match(this.lastRegExp)){
       action = this.id + Tobago.COMPONENT_SEP +"Last";
     }
-    this.reloadWithAction(action);
+    this.reloadWithAction2(event.srcElement, action, null);
   };
 
-Tobago.Sheet.prototype.reloadWithAction = function(action, options) {
+  Tobago.Sheet.prototype.reloadWithAction = function(action, options) {
+    this.reloadWithAction2(null, action, options);
+  };
+
+  Tobago.Sheet.prototype.reloadWithAction2 = function(source, action, options) {
     LOG.debug("reload sheet with action \"" + action + "\"");
     var divElement = Tobago.element(this.outerDivId);
     var reloadOptions = Tobago.extend({}, this.options);
     reloadOptions = Tobago.extend(reloadOptions, options);
-    Tobago.Updater.update(divElement, null, action, this.id, reloadOptions);
+    Tobago.Updater.update2(source, divElement, null, action, this.id, reloadOptions);
   };
 
 Tobago.Sheet.prototype.insertTarget = function(event, actionId) {
@@ -305,7 +309,7 @@
       }
       if (keyCode == 13) {
         if (input.value != input.nextSibling.innerHTML) {
-          this.reloadWithAction(input.actionId);
+          this.reloadWithAction(event.srcElement, input.actionId, null);
           Tobago.stopEventPropagation(event);          
         }
         else {
@@ -414,7 +418,7 @@
 
 Tobago.Sheet.prototype.initReload = function() {
   if (typeof this.autoReload == "number" && Tobago.element(this.contentDivId)) {
-    Tobago.addReloadTimeout(this.id, Tobago.bind2(this, "reloadWithAction", this.id), this.autoReload);
+    Tobago.addReloadTimeout(this.id, Tobago.bind2(this, "reloadWithAction2", null, this.id), this.autoReload);
   }
 };
 
@@ -509,9 +513,9 @@
         var action = this.id + ":" + rowIndex + ":" + this.clickActionId;
         //LOG.debug("Action " + action);
         if (this.clickReloadComponentId && this.clickReloadComponentId.length > 0) {
-          Tobago.reloadComponent(this.clickReloadComponentId[0], action)
+          Tobago.reloadComponent2(srcElement, this.clickReloadComponentId[0], action, null)
         } else {
-          Tobago.submitAction(action, true, null);
+          Tobago.submitAction2(srcElement, action, true, null);
         }
       }
     }
@@ -549,9 +553,9 @@
         var action = this.id + ":" + rowIndex + ":" + this.dblClickActionId;
         //LOG.debug("dblAction " + action);
         if (this.dblClickReloadComponentId && this.dblClickReloadComponentId.length > 0) {
-          Tobago.reloadComponent(this.dblClickReloadComponentId[0], action)
+          Tobago.reloadComponent2(srcElement, this.dblClickReloadComponentId[0], action, null)
         } else {
-          Tobago.submitAction(action, true, null);
+          Tobago.submitAction2(srcElement, action, true, null);
         }
       }
     }

Modified: myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=666656&r1=666655&r2=666656&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Wed Jun 11 06:24:05 2008
@@ -244,6 +244,7 @@
     this.addBindEventListener(this.form, "submit", this, "onSubmit");
     this.action = this.element(this.form.id + '-action')
     this.contextPath = this.element(this.page.id + this.SUB_COMPONENT_SEP + "context-path");
+    this.actionPosition = this.element(this.page.id + this.SUB_COMPONENT_SEP + "action-position");
 
     this.addBindEventListener(window, "unload", this, "onUnload");
 
@@ -278,7 +279,8 @@
 
   onSubmit: function() {
     if (Tobago.applicationOnsubmit) {
-      if (!Tobago.applicationOnsubmit()) {
+      var result = Tobago.applicationOnsubmit();
+      if (!result) {
         this.isSubmit = false;
         Tobago.action.value = oldAction;
         Tobago.form.target = oldTarget;
@@ -454,13 +456,21 @@
   },
 
   /**
-    * Submitting the page with specified actionId.
+    * Deprecated! Will be replaced in Tobago 1.1 with changed method signature (see submitAction2).
     */
   submitAction: function(actionId, transition, target) {
+    Tobago.submitAction2(null, actionId, transition, target);
+  },
+
+  /**
+    * Submitting the page with specified actionId.
+    */
+  submitAction2: function(source, actionId, transition, target) {
     if (transition === undefined) {
       transition = true;
     }
-    LOG.info("transition =" + transition);
+
+    Tobago.setActionPosition(source);
     //LOG.inof("submitAction OpenPopups " + Tobago.openPopups);
     if (Tobago.openPopups.length > 0) {
       // enable all elements on page when this is a submit from a popup
@@ -499,6 +509,15 @@
     }, true);
   },
 
+  setActionPosition: function(source) {
+    var sourceLeft = Tobago.getAbsoluteLeft(source);
+    var sourceTop = Tobago.getAbsoluteTop(source);
+    var sourceWidth = Tobago.getWidth(source);
+    var sourceHeight = Tobago.getHeight(source);
+    Tobago.actionPosition.value = sourceLeft + "px," + sourceTop + "px," + sourceWidth + "px," + sourceHeight + "px";
+//    alert("source='" + source + "' action-position=" + Tobago.actionPosition.value);
+  },
+
   getJsfState: function() {
     var stateContainer = Tobago.element(Tobago.page.id + Tobago.SUB_COMPONENT_SEP + "jsf-state-container");
     var jsfState = "";
@@ -558,10 +577,11 @@
         hidden.value = hidden.value + ":" + event.clientX + "x" + event.clientY;
       }
     }
+    var source = Tobago.element(event);
     if (Tobago.Updater.hasTransport()) {
-      Tobago.openPopupWithAction(popupId, actionId);
+      Tobago.openPopupWithAction2(source, popupId, actionId, null);
     } else {
-      this.submitAction(actionId);
+      this.submitAction2(source, actionId, null, null);
     }
   },
 
@@ -705,7 +725,12 @@
     this.ajaxComponents[componentId] = containerId;
   },
 
+  /* @Deprecated: change method signature like update2 */
   reloadComponent: function(id, actionId, options) {
+    Tobago.reloadComponent2(null, id, actionId, options);
+  },
+
+  reloadComponent2: function(source, id, actionId, options) {
     var container = this.ajaxComponents[id];
     if (container) {
       if (typeof container == "string") {
@@ -713,13 +738,13 @@
           actionId = container;
         }
         container = this.element(container);
-        Tobago.Updater.update(container, this.page, actionId, id, options);
+        Tobago.Updater.update2(source, container, this.page, actionId, id, options);
       } else if ((typeof container == "object") && container.tagName) {
         if (!actionId) {
           actionId = container.id;
         }
-        Tobago.Updater.update(container, this.page, actionId, id, options);
-      } else if ((typeof container == "object") && (typeof container.reloadWithAction == "function")) {
+        Tobago.Updater.update2(source, container, this.page, actionId, id, options);
+      } else if ((typeof container == "object") && (typeof container.reloadWithAction2 == "function")) {
         if (!actionId) {
           if (container.id) {
             actionId = container.id;
@@ -727,7 +752,7 @@
             actionId = "_tbg_no_action_";
           }
         }
-        container.reloadWithAction(actionId, options);
+        container.reloadWithAction2(source, actionId, options);
       } else {
         LOG.warn("Illegal container for reload:" + (typeof container));
       }
@@ -1089,12 +1114,17 @@
    }
   },
 
+  /* @Deprecated: change method signature like openPopupWithAction2 */
   openPopupWithAction: function(popupId, actionId, options) {
+    Tobago.openPopupWithAction2(null, popupId, actionId, options);
+  },
+
+  openPopupWithAction2: function(source, popupId, actionId, options) {
     var div = Tobago.element(popupId);
     if (div) {
       LOG.warn("something is wrong, doing full reload");
 //      LOG.info("id = " + popupId + "  type = " + div.tagName + "  class = " + div.className);
-      Tobago.submitAction(actionId);
+      Tobago.submitAction2(source, actionId, null, null);
     }
 
     div = document.createElement('div');
@@ -1113,7 +1143,7 @@
     if (options) {
       Tobago.extend(newOptions, options);
     }
-    Tobago.reloadComponent(popupId, actionId, options);
+    Tobago.reloadComponent2(source, popupId, actionId, options);
   },
 
 // -------- Util functions ----------------------------------------------------
@@ -1491,7 +1521,7 @@
   getAbsoluteTop: function(element) {
     var top = 0;
     var parent = false;
-    while (element.offsetParent) {
+    while (element && element.offsetParent) {
       top += element.offsetTop;
       top -= element.scrollTop;
       if (parent && element.currentStyle) { // IE only
@@ -1503,6 +1533,27 @@
     return top;
   },
 
+  getWidth: function(element) {
+    var width = 0;
+    if (element) {
+      width = element.offsetWidth;
+      if (width === undefined) {
+        width = 0;
+      }
+    }
+    return width;
+  },
+
+  getHeight: function(element) {
+    var height = 0;
+    if (element) {
+      height = element.offsetHeight;
+      if (height === undefined) {
+        height = 0;
+      }
+    }
+    return height;
+  },
 
   /**
     * Returns the absolute left, related to the body element, value for an HTML element.
@@ -1510,7 +1561,7 @@
   getAbsoluteLeft: function(element) {
     var left = 0;
     var parent = false;
-    while (element.offsetParent) {
+    while (element && element.offsetParent) {
       left += element.offsetLeft;
       left -= element.scrollLeft;
       if (parent && element.currentStyle) {  // IE only
@@ -1735,17 +1786,17 @@
 
 Tobago.Panel.prototype.initReload = function() {
   if (typeof this.autoReload == "number") {
-    Tobago.addReloadTimeout(this.id, Tobago.bind2(this, "reload", this.id), this.autoReload);
+    Tobago.addReloadTimeout(this.id, Tobago.bind2(this, "reload", this.id, null, null), this.autoReload);
   }
 };
 
-Tobago.Panel.prototype.reload = function(action, options) {
+Tobago.Panel.prototype.reload = function(action, options, source) {
   //LOG.debug("reload panel with action \"" + action + "\"");
   var element = Tobago.element(this.id);
   element.skipUpdate = false;
   var reloadOptions = Tobago.extend({}, this.options);
   reloadOptions = Tobago.extend(reloadOptions, options);
-  Tobago.Updater.update(element, null, action, this.id, reloadOptions);
+  Tobago.Updater.update2(source, element, null, action, this.id, reloadOptions);
 };
 
 Tobago.EventListener = function(element, event, func) {
@@ -1866,6 +1917,7 @@
       } catch(ex) {
         LOG.error(ex);
         LOG.error("errorCode: " + this.doAfter.valueOf());
+        throw ex;
       }
   };
 
@@ -1988,12 +2040,18 @@
     }
   },
 
+  /* Deprecated: change signature like update2 */
   update: function(container, page, actionId, ajaxComponentId, options) {
+    Tobago.Updater.update2(null, container, page, actionId, ajaxComponentId, options);
+  },
+
+  update2: function(source, container, page, actionId, ajaxComponentId, options) {
 
     if (this.hasTransport()) {
 
       if (Tobago.applicationOnsubmit) {
-        if (!Tobago.applicationOnsubmit()) {
+        var result = Tobago.applicationOnsubmit();
+        if (!result) {
           return;
         }
       }
@@ -2011,6 +2069,9 @@
           }
         }
       }
+
+      Tobago.setActionPosition(source);
+
       var onComplete = requestOptions.onComplete;
       requestOptions.onComplete = function(transport, json) {
         onComplete(transport, json);
@@ -2038,7 +2099,7 @@
       }
     } else {
       LOG.info("No Ajax transport found! Doing full page reload.");
-      Tobago.submitAction(actionId);
+      Tobago.submitAction2(source, actionId, null, null);
     }
   },