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 16:02:06 UTC
svn commit: r666671 - in /myfaces/tobago/trunk:
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/apache/myfaces/tobag...
Author: lofwyr
Date: Wed Jun 11 07:02:05 2008
New Revision: 666671
URL: http://svn.apache.org/viewvc?rev=666671&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 Add some layout classes.
* Remove DatePickerController
Added:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Position.java
- copied, changed from r660811, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java
Removed:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/DatePickerController.java
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java
myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/RichTextEditorRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tab.js
myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js
myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtil.java
myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js
myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js
myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js
myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java Wed Jun 11 07:02:05 2008
@@ -24,6 +24,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.compat.InvokeOnComponent;
+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.util.ComponentUtil;
@@ -57,6 +58,8 @@
private String actionId;
+ private Box actionPosition;
+
private String defaultActionId;
private List<KeyValue> postfields;
@@ -237,6 +240,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/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java Wed Jun 11 07:02:05 2008
@@ -17,26 +17,22 @@
* 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 org.apache.myfaces.tobago.util.ComponentUtil;
+import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.compat.InvokeOnComponent;
+import org.apache.myfaces.tobago.util.ComponentUtil;
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponent;
+import javax.faces.FacesException;
import javax.faces.component.ContextCallback;
+import javax.faces.component.NamingContainer;
import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.faces.FacesException;
import java.io.IOException;
import java.util.Iterator;
-public class AbstractUIPopup extends UIPanelBase implements NamingContainer, AjaxComponent, InvokeOnComponent {
-
- private static final Log LOG = LogFactory.getLog(AbstractUIPopup.class);
+public abstract class AbstractUIPopup extends UIPanelBase implements NamingContainer, AjaxComponent, InvokeOnComponent {
private boolean activated;
@@ -141,4 +137,20 @@
throws FacesException {
return FacesUtils.invokeOnComponent(context, this, clientId, callback);
}
+
+ public abstract Integer getWidth();
+
+ public abstract void setWidth(Integer width);
+
+ public abstract Integer getHeight();
+
+ public abstract void setHeight(Integer height);
+
+ public abstract Integer getTop();
+
+ public abstract void setTop(Integer top);
+
+ public abstract Integer getLeft();
+
+ public abstract void setLeft(Integer left);
}
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java?rev=666671&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Box.java Wed Jun 11 07:02: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();
+ }
+}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java Wed Jun 11 07:02:05 2008
@@ -31,6 +31,16 @@
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;
}
@@ -46,4 +56,9 @@
public void setHeight(Measure height) {
this.height = height;
}
+
+ @Override
+ public String toString() {
+ return new StringBuilder().append(width).append(',').append(height).toString();
+ }
}
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Position.java (from r660811, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Position.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Position.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java&r1=660811&r2=666671&rev=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Position.java Wed Jun 11 07:02:05 2008
@@ -21,29 +21,44 @@
* User: lofwyr
* Date: 23.01.2008 20:18:45
*/
-public class Dimension {
+public class Position {
- private Measure width;
- private Measure height;
+ private Measure left;
+ private Measure top;
- public Dimension(Measure width, Measure height) {
- this.width = width;
- this.height = height;
+ public Position(Measure left, Measure top) {
+ this.left = left;
+ this.top = top;
}
- public Measure getWidth() {
- return width;
+ 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 void setWidth(Measure width) {
- this.width = width;
+ public Measure getLeft() {
+ return left;
}
- public Measure getHeight() {
- return height;
+ public void setLeft(Measure left) {
+ this.left = left;
}
- public void setHeight(Measure height) {
- this.height = height;
+ 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/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java Wed Jun 11 07:02: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.AbstractUIPage;
+import org.apache.myfaces.tobago.layout.Box;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -32,15 +34,29 @@
public void decode(FacesContext facesContext, UIComponent component) {
if (component instanceof AbstractUIPage) {
AbstractUIPage page = (AbstractUIPage) 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/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java Wed Jun 11 07:02:05 2008
@@ -41,11 +41,11 @@
public interface PopupTagDeclaration extends HasId, IsRendered, HasDimension {
@TagAttribute
- @UIComponentTagAttribute()
+ @UIComponentTagAttribute(type = "java.lang.Integer")
void setLeft(String left);
@TagAttribute
- @UIComponentTagAttribute()
+ @UIComponentTagAttribute(type = "java.lang.Integer")
void setTop(String top);
@TagAttribute
Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp Wed Jun 11 07:02:05 2008
@@ -104,13 +104,13 @@
<tc:button label="Open here">
<f:facet name="popup">
- <tc:popup width="150" height="100" left="220" top="260">
+ <tc:popup width="150" height="110" 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="This popup should opened right beside the button."/>
<tc:button label="Ok">
<tc:attribute name="popupClose" value="afterSubmit"/>
</tc:button>
Modified: myfaces/tobago/trunk/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/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.java?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.java Wed Jun 11 07:02: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.util.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.submitAction(this, '" + command.getClientId(facesContext) + "');");
}
}
}
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=666671&r1=666670&r2=666671&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 Wed Jun 11 07:02:05 2008
@@ -17,52 +17,51 @@
* 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_ALT;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_COLUMNS;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_HIDDEN;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_POPUP;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_BOX;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_GRID_LAYOUT;
-import static org.apache.myfaces.tobago.TobagoConstants.FACET_LAYOUT;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_WIDTH;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ROWS;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
+import static org.apache.myfaces.tobago.TobagoConstants.FACET_LAYOUT;
+import static org.apache.myfaces.tobago.TobagoConstants.FACET_PICKER_POPUP;
+import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_BOX;
+import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_BUTTON;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_CALENDAR;
+import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_GRID_LAYOUT;
+import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_HIDDEN;
+import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_IMAGE;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_PANEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_COLUMNS;
+import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_POPUP;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_TIME;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_BUTTON;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_IMAGE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ALT;
-import org.apache.myfaces.tobago.component.UIDatePicker;
-import org.apache.myfaces.tobago.component.UIPopup;
-import org.apache.myfaces.tobago.component.UIDateInput;
-import org.apache.myfaces.tobago.component.UITimeInput;
-import org.apache.myfaces.tobago.component.UIHiddenInput;
-import org.apache.myfaces.tobago.component.CreateComponentUtils;
+import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.component.AbstractUIPopup;
+import org.apache.myfaces.tobago.component.CreateComponentUtils;
import org.apache.myfaces.tobago.component.UIBox;
+import org.apache.myfaces.tobago.component.UIDateInput;
+import org.apache.myfaces.tobago.component.UIDatePicker;
import org.apache.myfaces.tobago.component.UIGridLayout;
+import org.apache.myfaces.tobago.component.UIHiddenInput;
import org.apache.myfaces.tobago.component.UIPanel;
-import org.apache.myfaces.tobago.util.ComponentUtil;
+import org.apache.myfaces.tobago.component.UIPopup;
+import org.apache.myfaces.tobago.component.UITimeInput;
import org.apache.myfaces.tobago.config.ThemeConfig;
-import org.apache.myfaces.tobago.util.DateFormatUtils;
-import org.apache.myfaces.tobago.compat.FacesUtils;
-import org.apache.myfaces.tobago.TobagoConstants;
-import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
-import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.context.TobagoFacesContext;
+import org.apache.myfaces.tobago.event.PopupActionListener;
+import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
+import org.apache.myfaces.tobago.util.ComponentUtil;
+import org.apache.myfaces.tobago.util.DateFormatUtils;
-import javax.faces.context.FacesContext;
-import javax.faces.component.UIComponent;
import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
import javax.faces.component.UIGraphic;
+import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.DateTimeConverter;
import static javax.faces.convert.DateTimeConverter.CONVERTER_ID;
@@ -76,6 +75,7 @@
*/
public class DatePickerRenderer extends LinkRenderer {
private static final Log LOG = LogFactory.getLog(DatePickerRenderer.class);
+ public static final String CLOSE_POPUP = "closePopup";
@Override
public void onComponentCreated(FacesContext context, UIComponent component) {
@@ -83,129 +83,128 @@
}
public void preparePicker(FacesContext facesContext, UIDatePicker link) {
- if (link.getFor() == null) {
- link.setFor("@auto");
- }
- link.setImmediate(true);
- String linkId = link.getId();
- UIHiddenInput hidden =
- (UIHiddenInput) CreateComponentUtils.createComponent(facesContext,
- UIHiddenInput.COMPONENT_TYPE, RENDERER_TYPE_HIDDEN);
- if (linkId != null) {
- hidden.setId(linkId + "hidden");
- } else {
- hidden.setId(facesContext.getViewRoot().createUniqueId());
- }
- link.getChildren().add(hidden);
+ if (link.getFor() == null) {
+ link.setFor("@auto");
+ }
+ link.setImmediate(true);
+ String linkId = link.getId();
+ UIHiddenInput hidden = (UIHiddenInput)
+ CreateComponentUtils.createComponent(facesContext, UIHiddenInput.COMPONENT_TYPE, RENDERER_TYPE_HIDDEN);
+ if (linkId != null) {
+ hidden.setId(linkId + "hidden");
+ } else {
+ hidden.setId(facesContext.getViewRoot().createUniqueId());
+ }
+ link.getChildren().add(hidden);
- // create popup
- final AbstractUIPopup popup =
- (AbstractUIPopup) CreateComponentUtils.createComponent(facesContext, UIPopup.COMPONENT_TYPE,
- RENDERER_TYPE_POPUP);
- if (linkId != null) {
- popup.setId(linkId + "popup");
- } else {
- popup.setId(facesContext.getViewRoot().createUniqueId());
- }
- popup.getAttributes().put(TobagoConstants.ATTR_ZINDEX, 10);
+ // create popup
+ final AbstractUIPopup popup =
+ (AbstractUIPopup) CreateComponentUtils.createComponent(facesContext, UIPopup.COMPONENT_TYPE,
+ RENDERER_TYPE_POPUP);
+ if (linkId != null) {
+ popup.setId(linkId + "popup");
+ } else {
+ popup.setId(facesContext.getViewRoot().createUniqueId());
+ }
+ popup.getAttributes().put(TobagoConstants.ATTR_ZINDEX, 10);
- link.getFacets().put(FACET_PICKER_POPUP, popup);
+ link.getFacets().put(FACET_PICKER_POPUP, popup);
- popup.setRendered(false);
+ popup.setRendered(false);
- final UIComponent box = CreateComponentUtils.createComponent(
- facesContext, UIBox.COMPONENT_TYPE, RENDERER_TYPE_BOX);
- popup.getChildren().add(box);
- box.setId("box");
- // TODO: set string resources in renderer
- box.getAttributes().put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(
- facesContext, "tobago", "datePickerTitle"));
- UIComponent layout = CreateComponentUtils.createComponent(
- facesContext, UIGridLayout.COMPONENT_TYPE, RENDERER_TYPE_GRID_LAYOUT);
- box.getFacets().put(FACET_LAYOUT, layout);
- layout.setId("layout");
- layout.getAttributes().put(ATTR_ROWS, "*;fixed;fixed");
-
- final UIComponent calendar = CreateComponentUtils.createComponent(
- facesContext, javax.faces.component.UIOutput.COMPONENT_TYPE,
- RENDERER_TYPE_CALENDAR);
-
- calendar.setId("calendar");
- box.getChildren().add(calendar);
-
- // add time input
- final UIComponent timePanel = CreateComponentUtils.createComponent(
- facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_PANEL);
- timePanel.setId("timePanel");
- box.getChildren().add(timePanel);
- layout = CreateComponentUtils.createComponent(
- facesContext, UIGridLayout.COMPONENT_TYPE, RENDERER_TYPE_GRID_LAYOUT);
- timePanel.getFacets().put(FACET_LAYOUT, layout);
- layout.setId("timePanelLayout");
- layout.getAttributes().put(ATTR_COLUMNS, "1*;fixed;1*");
- UIComponent cell = CreateComponentUtils.createComponent(
- facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_PANEL);
- cell.setId("cell1");
- timePanel.getChildren().add(cell);
-
- final UIComponent time = CreateComponentUtils.createComponent(
- facesContext,
- UITimeInput.COMPONENT_TYPE,
- RENDERER_TYPE_TIME);
- timePanel.getChildren().add(time);
- time.setId("time");
-
- cell = CreateComponentUtils.createComponent(
- facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_PANEL);
- cell.setId("cell2");
- timePanel.getChildren().add(cell);
-
-
- UIComponent buttonPanel = CreateComponentUtils.createComponent(
- facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_PANEL);
- buttonPanel.setId("buttonPanel");
- layout = CreateComponentUtils.createComponent(
- facesContext, UIGridLayout.COMPONENT_TYPE, RENDERER_TYPE_GRID_LAYOUT);
- layout.setId("buttonPanelLayout");
- buttonPanel.getFacets().put(FACET_LAYOUT, layout);
- layout.getAttributes().put(ATTR_COLUMNS, "*;*");
+ final UIComponent box = CreateComponentUtils.createComponent(
+ facesContext, UIBox.COMPONENT_TYPE, RENDERER_TYPE_BOX);
+ popup.getChildren().add(box);
+ box.setId("box");
+ // TODO: set string resources in renderer
+ box.getAttributes().put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(
+ facesContext, "tobago", "datePickerTitle"));
+ UIComponent layout = CreateComponentUtils.createComponent(
+ facesContext, UIGridLayout.COMPONENT_TYPE, RENDERER_TYPE_GRID_LAYOUT);
+ box.getFacets().put(FACET_LAYOUT, layout);
+ layout.setId("layout");
+ layout.getAttributes().put(ATTR_ROWS, "*;fixed;fixed");
+
+ final UIComponent calendar = CreateComponentUtils.createComponent(
+ facesContext, javax.faces.component.UIOutput.COMPONENT_TYPE,
+ RENDERER_TYPE_CALENDAR);
+
+ calendar.setId("calendar");
+ box.getChildren().add(calendar);
+
+ // add time input
+ final UIComponent timePanel = CreateComponentUtils.createComponent(
+ facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_PANEL);
+ timePanel.setId("timePanel");
+ box.getChildren().add(timePanel);
+ layout = CreateComponentUtils.createComponent(
+ facesContext, UIGridLayout.COMPONENT_TYPE, RENDERER_TYPE_GRID_LAYOUT);
+ timePanel.getFacets().put(FACET_LAYOUT, layout);
+ layout.setId("timePanelLayout");
+ layout.getAttributes().put(ATTR_COLUMNS, "1*;fixed;1*");
+ UIComponent cell = CreateComponentUtils.createComponent(
+ facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_PANEL);
+ cell.setId("cell1");
+ timePanel.getChildren().add(cell);
+
+ final UIComponent time = CreateComponentUtils.createComponent(
+ facesContext,
+ UITimeInput.COMPONENT_TYPE,
+ RENDERER_TYPE_TIME);
+ timePanel.getChildren().add(time);
+ time.setId("time");
+
+ cell = CreateComponentUtils.createComponent(
+ facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_PANEL);
+ cell.setId("cell2");
+ timePanel.getChildren().add(cell);
+
+
+ UIComponent buttonPanel = CreateComponentUtils.createComponent(
+ facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_PANEL);
+ buttonPanel.setId("buttonPanel");
+ layout = CreateComponentUtils.createComponent(
+ facesContext, UIGridLayout.COMPONENT_TYPE, RENDERER_TYPE_GRID_LAYOUT);
+ layout.setId("buttonPanelLayout");
+ buttonPanel.getFacets().put(FACET_LAYOUT, layout);
+ layout.getAttributes().put(ATTR_COLUMNS, "*;*");
// layout.getAttributes().put(TobagoConstants.ATTR_BORDER, "1");
- box.getChildren().add(buttonPanel);
+ box.getChildren().add(buttonPanel);
- final org.apache.myfaces.tobago.component.UICommand okButton =
- (org.apache.myfaces.tobago.component.UICommand) CreateComponentUtils.createComponent(facesContext,
- org.apache.myfaces.tobago.component.UIButtonCommand.COMPONENT_TYPE,
- RENDERER_TYPE_BUTTON);
- buttonPanel.getChildren().add(okButton);
- okButton.setId("ok" + DatePickerController.CLOSE_POPUP);
- okButton.getAttributes().put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(
- facesContext, "tobago", "datePickerOk"));
-
- final org.apache.myfaces.tobago.component.UICommand cancelButton =
- (org.apache.myfaces.tobago.component.UICommand) CreateComponentUtils.createComponent(facesContext,
- org.apache.myfaces.tobago.component.UIButtonCommand.COMPONENT_TYPE,
- RENDERER_TYPE_BUTTON);
- buttonPanel.getChildren().add(cancelButton);
-
- cancelButton.getAttributes().put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(
- facesContext, "tobago", "datePickerCancel"));
- cancelButton.setId(DatePickerController.CLOSE_POPUP);
-
- // create image
- UIGraphic image = (UIGraphic) CreateComponentUtils.createComponent(
- facesContext, UIGraphic.COMPONENT_TYPE, RENDERER_TYPE_IMAGE);
- image.setRendered(true);
- if (linkId != null) {
- image.setId(linkId + "image");
- } else {
- image.setId(facesContext.getViewRoot().createUniqueId());
- }
- image.setValue("image/date.gif");
- image.getAttributes().put(ATTR_ALT, ""); //TODO: i18n
- StyleClasses.ensureStyleClasses(image).addFullQualifiedClass("tobago-input-picker"); // XXX not a standard name
- link.getChildren().add(image);
+ final org.apache.myfaces.tobago.component.UICommand okButton =
+ (org.apache.myfaces.tobago.component.UICommand) CreateComponentUtils.createComponent(facesContext,
+ org.apache.myfaces.tobago.component.UIButtonCommand.COMPONENT_TYPE,
+ RENDERER_TYPE_BUTTON);
+ buttonPanel.getChildren().add(okButton);
+ okButton.setId("ok" + CLOSE_POPUP);
+ okButton.getAttributes().put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(
+ facesContext, "tobago", "datePickerOk"));
+
+ final org.apache.myfaces.tobago.component.UICommand cancelButton =
+ (org.apache.myfaces.tobago.component.UICommand) CreateComponentUtils.createComponent(facesContext,
+ org.apache.myfaces.tobago.component.UIButtonCommand.COMPONENT_TYPE,
+ RENDERER_TYPE_BUTTON);
+ buttonPanel.getChildren().add(cancelButton);
+
+ cancelButton.getAttributes().put(ATTR_LABEL, ResourceManagerUtil.getPropertyNotNull(
+ facesContext, "tobago", "datePickerCancel"));
+ cancelButton.setId(CLOSE_POPUP);
+
+ // create image
+ UIGraphic image = (UIGraphic) CreateComponentUtils.createComponent(
+ facesContext, UIGraphic.COMPONENT_TYPE, RENDERER_TYPE_IMAGE);
+ image.setRendered(true);
+ if (linkId != null) {
+ image.setId(linkId + "image");
+ } else {
+ image.setId(facesContext.getViewRoot().createUniqueId());
}
+ image.setValue("image/date.gif");
+ image.getAttributes().put(ATTR_ALT, ""); //TODO: i18n
+ StyleClasses.ensureStyleClasses(image).addFullQualifiedClass("tobago-input-picker"); // XXX not a standard name
+ link.getChildren().add(image);
+ }
public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
@@ -222,9 +221,9 @@
}
public void encodeBegin(FacesContext facesContext,
- UIComponent component) throws IOException {
+ UIComponent component) throws IOException {
UIDatePicker link = (UIDatePicker) component;
- DatePickerController datePickerController = new DatePickerController();
+// DatePickerController datePickerController = new DatePickerController();
UIDateInput dateInput = (UIDateInput) link.getForComponent();
if (dateInput == null) {
LOG.error("No required UIDateInput component found.");
@@ -235,14 +234,14 @@
dateInput, TobagoConstants.ATTR_READONLY);
} else {
if (FacesUtils.hasValueBindingOrValueExpression(dateInput, TobagoConstants.ATTR_DISABLED)) {
- FacesUtils.copyValueBindingOrValueExpression(link, TobagoConstants.ATTR_DISABLED,
+ FacesUtils.copyValueBindingOrValueExpression(link, TobagoConstants.ATTR_DISABLED,
dateInput, TobagoConstants.ATTR_DISABLED);
} else {
link.setDisabled(dateInput.isReadonly() || dateInput.isDisabled());
}
}
- Map<String, Object> attributes = link.getAttributes();
- link.setActionListener(datePickerController);
+ Map<String, Object> attributes = link.getAttributes();
+// link.setActionListener(datePickerController);
UIComponent hidden = (UIComponent) link.getChildren().get(0);
UIPopup popup = (UIPopup) link.getFacets().get(FACET_PICKER_POPUP);
@@ -250,29 +249,29 @@
attributes.put(ATTR_ACTION_ONCLICK, "Tobago.openPickerPopup(event, '"
+ link.getClientId(facesContext) + "', '"
+ hidden.getClientId(facesContext) + "', '"
- + popup.getClientId(facesContext) +"')");
+ + popup.getClientId(facesContext) + "')");
Converter converter = getConverter(facesContext, dateInput);
String converterPattern = "yyyy-MM-dd"; // from calendar.js initCalendarParse
if (converter instanceof DateTimeConverter) {
converterPattern = DateFormatUtils.findPattern((DateTimeConverter) converter);
} else {
- // LOG.warn("Converter for DateRenderer is not instance of DateTimeConverter. Using default Pattern "
+ // LOG.warn("Converter for DateRenderer is not instance of DateTimeConverter. Using default Pattern "
// + converterPattern);
}
- UICommand okButton = (UICommand) popup.findComponent("ok" + DatePickerController.CLOSE_POPUP);
+ UICommand okButton = (UICommand) popup.findComponent("ok" + 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");
- UICommand cancelButton = (UICommand) popup.findComponent(DatePickerController.CLOSE_POPUP);
+ UICommand cancelButton = (UICommand) popup.findComponent(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");
applyConverterPattern(facesContext, popup, converterPattern);
-
+
if (!ComponentUtil.containsPopupActionListener(link)) {
link.addActionListener(new PopupActionListener(popup.getId()));
}
@@ -288,7 +287,7 @@
popupHeight += ThemeConfig.getValue(FacesContext.getCurrentInstance(), time, "fixedHeight");
popup.getAttributes().put(ATTR_HEIGHT, popupHeight);
DateTimeConverter dateTimeConverter
- = (DateTimeConverter) facesContext.getApplication().createConverter(CONVERTER_ID);
+ = (DateTimeConverter) facesContext.getApplication().createConverter(CONVERTER_ID);
if (converterPattern.indexOf('s') > -1) {
dateTimeConverter.setPattern("HH:mm:ss");
} else {
@@ -300,7 +299,7 @@
timePanel.setRendered(false);
}
}
-
+
public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
UIDatePicker link = (UIDatePicker) component;
UIDateInput dateInput = (UIDateInput) link.getForComponent();
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Wed Jun 11 07:02:05 2008
@@ -35,7 +35,6 @@
import static org.apache.myfaces.tobago.TobagoConstants.FACET_MENUBAR;
import static org.apache.myfaces.tobago.TobagoConstants.FORM_ACCEPT_CHARSET;
import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
-import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.component.UILayout;
import org.apache.myfaces.tobago.component.UIPage;
import org.apache.myfaces.tobago.component.UIPopup;
@@ -43,11 +42,12 @@
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.renderkit.PageRendererBase;
-import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
+import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
import org.apache.myfaces.tobago.util.AccessKeyMap;
+import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.util.MimeTypeUtils;
import org.apache.myfaces.tobago.util.ResponseUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
@@ -278,10 +278,10 @@
String target = ComponentUtil.getStringAttribute(command, ATTR_TARGET);
String action;
if (target != null) {
- action = "Tobago.submitAction('" + command.getClientId(facesContext) + "', "
+ action = "Tobago.submitAction(this, '" + command.getClientId(facesContext) + "', "
+ transition + ", '" + target + "' )";
} else {
- action = "Tobago.submitAction('"+ command.getClientId(facesContext) + "', " + transition + " )";
+ action = "Tobago.submitAction(this, '"+ command.getClientId(facesContext) + "', " + transition + " )";
}
facesContext.getOnloadScripts().add("setTimeout(\"" + action + "\", " + duration + ");\n");
}
@@ -363,22 +363,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/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java Wed Jun 11 07:02:05 2008
@@ -31,8 +31,8 @@
import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
-import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
+import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
import org.apache.myfaces.tobago.util.LayoutUtil;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
@@ -114,7 +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.submitAction(this, '" + command.getClientId(facesContext) + "');");
}
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/RichTextEditorRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/RichTextEditorRenderer.java?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/RichTextEditorRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/RichTextEditorRenderer.java Wed Jun 11 07:02:05 2008
@@ -36,19 +36,19 @@
import static org.apache.myfaces.tobago.TobagoConstants.FACET_TOOL_BAR;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_MENUCOMMAND;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_TOOL_BAR;
-import org.apache.myfaces.tobago.util.ComponentUtil;
+import org.apache.myfaces.tobago.component.CreateComponentUtils;
import org.apache.myfaces.tobago.component.UICommand;
-import org.apache.myfaces.tobago.component.UIToolBar;
import org.apache.myfaces.tobago.component.UISelectBooleanCommand;
-import org.apache.myfaces.tobago.component.CreateComponentUtils;
+import org.apache.myfaces.tobago.component.UIToolBar;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.renderkit.HtmlUtils;
import org.apache.myfaces.tobago.renderkit.InputRendererBase;
-import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
-import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
+import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
+import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
+import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.EditableValueHolder;
@@ -196,7 +196,7 @@
facesContext, "tobago", "tobago.richtexteditor.edit.title");
command.getAttributes().put(ATTR_TIP, title);
- String onClick = "Tobago.submitAction('"
+ String onClick = "Tobago.submitAction(this, '"
+ clientId + RichTextEditorRenderer.CHANGE_BUTTON + "')";
command.getAttributes().put(ATTR_ACTION_ONCLICK, onClick);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Wed Jun 11 07:02:05 2008
@@ -33,8 +33,10 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FORCE_VERTICAL_SCROLLBAR;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INLINE;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INNER_WIDTH;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_HEIGHT;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_WIDTH;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MENU_POPUP;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MENU_POPUP_TYPE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SELECTED_LIST_STRING;
@@ -47,9 +49,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_HEADER;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH_LIST;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_WIDTH;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH_LIST_STRING;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INNER_WIDTH;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_MENUPOPUP;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_PAGER_PAGE;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_PAGER_ROW;
@@ -61,40 +61,40 @@
import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
import org.apache.myfaces.tobago.ajax.api.AjaxRenderer;
import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
-import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.component.UIColumnEvent;
import org.apache.myfaces.tobago.component.UIColumnSelector;
import org.apache.myfaces.tobago.component.UICommand;
import org.apache.myfaces.tobago.component.UIData;
import static org.apache.myfaces.tobago.component.UIData.ATTR_SCROLL_POSITION;
import static org.apache.myfaces.tobago.component.UIData.NONE;
+import org.apache.myfaces.tobago.component.UILayout;
import org.apache.myfaces.tobago.component.UIMenu;
import org.apache.myfaces.tobago.component.UIMenuCommand;
import org.apache.myfaces.tobago.component.UIReload;
-import org.apache.myfaces.tobago.component.UILayout;
-import org.apache.myfaces.tobago.layout.LayoutToken;
-import org.apache.myfaces.tobago.layout.FixedLayoutToken;
-import org.apache.myfaces.tobago.layout.LayoutTokens;
-import org.apache.myfaces.tobago.layout.RelativeLayoutToken;
import org.apache.myfaces.tobago.config.TobagoConfig;
import org.apache.myfaces.tobago.context.ResourceManager;
import org.apache.myfaces.tobago.context.ResourceManagerFactory;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.event.PageAction;
+import org.apache.myfaces.tobago.layout.FixedLayoutToken;
+import org.apache.myfaces.tobago.layout.LayoutToken;
+import org.apache.myfaces.tobago.layout.LayoutTokens;
+import org.apache.myfaces.tobago.layout.RelativeLayoutToken;
import org.apache.myfaces.tobago.model.SheetState;
-import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
-import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
import org.apache.myfaces.tobago.renderkit.LayoutInformationProvider;
-import org.apache.myfaces.tobago.renderkit.html.util.CommandRendererHelper;
+import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
-import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
import org.apache.myfaces.tobago.renderkit.html.HtmlStyleMap;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
-import org.apache.myfaces.tobago.util.StringUtil;
-import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.renderkit.html.util.CommandRendererHelper;
+import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
+import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
+import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.util.LayoutInfo;
+import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.util.StringUtil;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.application.Application;
@@ -818,7 +818,7 @@
column.getFacets().put(UIData.FACET_SORTER, sortCommand);
}
- String onclick = "Tobago.submitAction('" + sortCommand.getClientId(facesContext) + "')";
+ String onclick = "Tobago.submitAction(this, '" + sortCommand.getClientId(facesContext) + "')";
writer.writeAttribute(HtmlAttributes.ONCLICK, onclick, false);
if (StringUtils.isNotEmpty(tip)) {
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tab.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tab.js?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tab.js (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tab.js Wed Jun 11 07:02:05 2008
@@ -84,5 +84,5 @@
hidden.value = selectedIndex;
}
- Tobago.submitAction(controlId);
-}
\ No newline at end of file
+ Tobago.submitAction(null /*todo: source*/, controlId);
+}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js Wed Jun 11 07:02:05 2008
@@ -590,7 +590,7 @@
this.treeResources.getImage("checked.gif"));
} else {
// nothing to do, onclick has already done it
- Tobago.submitAction(this.id);
+ Tobago.submitAction(null /*todo: source*/, this.id);
}
}
Modified: myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java Wed Jun 11 07:02:05 2008
@@ -19,11 +19,19 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.*;
-import org.apache.myfaces.tobago.util.ComponentUtil;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_LINK;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_ONCLICK;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DEFAULT_COMMAND;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
+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_CONFIRMATION;
+import static org.apache.myfaces.tobago.TobagoConstants.FACET_POPUP;
import org.apache.myfaces.tobago.component.UIPopup;
import org.apache.myfaces.tobago.context.ClientProperties;
import org.apache.myfaces.tobago.event.PopupActionListener;
+import org.apache.myfaces.tobago.util.ComponentUtil;
import javax.faces.application.Application;
import javax.faces.application.ViewHandler;
@@ -101,7 +109,7 @@
LOG.warn("more than one parially rendered component is not supported for popup! using first one: "
+ Arrays.toString(componentIds));
}
- onclick = "Tobago.openPopupWithAction('"
+ onclick = "Tobago.openPopupWithAction(this, '"
+ HtmlRendererUtil.getComponentId(facesContext, command, componentIds[0]) + "', '" + clientId + "')";
} else {
onclick = "Tobago.reloadComponent('"
@@ -114,9 +122,9 @@
} else {
String target = ComponentUtil.getStringAttribute(command, ATTR_TARGET);
if (target == null) {
- onclick = "Tobago.submitAction('" + clientId + "', " + transition + ");";
+ onclick = "Tobago.submitAction(this, '" + clientId + "', " + transition + ");";
} else {
- onclick = "Tobago.submitAction('" + clientId + "', " + transition + ", '" + target + "');";
+ onclick = "Tobago.submitAction(this, '" + clientId + "', " + transition + ", '" + target + "');";
}
}
Modified: myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtil.java?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtil.java (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtil.java Wed Jun 11 07:02:05 2008
@@ -20,22 +20,22 @@
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.ATTR_DISABLED;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FOCUS;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INLINE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INNER_HEIGHT;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INNER_WIDTH;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_HEIGHT;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_WIDTH;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ONCLICK;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_READONLY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_BODY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_HEADER;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_LAYOUT;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_OUT;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_READONLY;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ONCLICK;
-import org.apache.myfaces.tobago.util.ComponentUtil;
+import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
import org.apache.myfaces.tobago.component.SupportsMarkup;
import org.apache.myfaces.tobago.component.UICommand;
import org.apache.myfaces.tobago.component.UIData;
@@ -44,18 +44,18 @@
import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
import org.apache.myfaces.tobago.renderkit.LayoutInformationProvider;
-import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
-import org.apache.myfaces.tobago.renderkit.RendererBaseWrapper;
import org.apache.myfaces.tobago.renderkit.LayoutableRenderer;
+import org.apache.myfaces.tobago.renderkit.RendererBaseWrapper;
+import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
+import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.HtmlStyleMap;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
-import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
-import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
+import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
+import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.webapp.TobagoResponseJsonWriterImpl;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriterWrapper;
-import org.apache.myfaces.tobago.webapp.TobagoResponseJsonWriterImpl;
-import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
@@ -896,7 +896,7 @@
if (facetAction != null) {
writer.write(facetAction);
} else {
- writer.write("Tobago.submitAction('");
+ writer.write("Tobago.submitAction(this, '");
writer.write(facetComponent.getClientId(facesContext));
writer.write("')");
}
Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/inputSuggest.js Wed Jun 11 07:02:05 2008
@@ -96,7 +96,7 @@
if (!this.request) {
this.request = request;
request.abort = function() {self.doUpdate({ajaxId: request.ajaxId, responseCode: Tobago.Updater.CODE_ERROR})};
- Tobago.Updater.update(request.ajaxId, request.ajaxId, {createOverlay: false});
+ Tobago.Updater.update(null, request.ajaxId, request.ajaxId, {createOverlay: false});
} else {
this.nextRequest = request;
request = {abort: function() {}};
Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tabgroup.js Wed Jun 11 07:02:05 2008
@@ -103,9 +103,9 @@
if (Tobago.Transport.hasTransport()) {
this.removeRelatedAcceleratorKeys(aId.substring(0, aId.lastIndexOf(Tobago.SUB_COMPONENT_SEP) + Tobago.SUB_COMPONENT_SEP.length));
Tobago.createOverlay(Tobago.element(this.tabGroupId));
- Tobago.Updater.update(this.tabGroupId, this.tabGroupId, this.options);
+ Tobago.Updater.update(event.srcElement, this.tabGroupId, this.tabGroupId, this.options);
} else {
- Tobago.submitAction(this.tabGroupId);
+ Tobago.submitAction(event.srcElement, this.tabGroupId);
}
}
} else {
Modified: myfaces/tobago/trunk/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/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js?rev=666671&r1=666670&r2=666671&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js Wed Jun 11 07:02:05 2008
@@ -99,7 +99,7 @@
};
Tobago.Sheet.prototype.sortOnclickRegExp
- = new RegExp("Tobago.submitAction\\(('|\")(.*?)('|\")\\)");
+ = new RegExp("Tobago.submitAction\\(this, ('|\")(.*?)('|\")\\)");
Tobago.Sheet.prototype.setupElements = function() {
@@ -198,7 +198,7 @@
}
// LOG.debug("element.id = " + element.id);
// LOG.debug("sorterId = " + element.sorterId);
- this.reloadWithAction(element.sorterId);
+ this.reloadWithAction(event.srcElement, element.sorterId);
};
Tobago.Sheet.prototype.doPagingDirect = function(event) {
@@ -213,7 +213,7 @@
hidden.name = action + Tobago.SUB_COMPONENT_SEP + "value";
Tobago.element(this.outerDivId).appendChild(hidden);
- this.reloadWithAction(action);
+ this.reloadWithAction(event.srcElement, action);
};
Tobago.Sheet.prototype.doPaging = function(event) {
@@ -228,15 +228,15 @@
} else if (element.id.match(this.lastRegExp)){
action = this.id + Tobago.COMPONENT_SEP +"Last";
}
- this.reloadWithAction(action);
+ this.reloadWithAction(event.srcElement, action);
};
-Tobago.Sheet.prototype.reloadWithAction = function(action, options) {
+Tobago.Sheet.prototype.reloadWithAction = function(source, action, options) {
LOG.debug("reload sheet with action \"" + action + "\"");
var reloadOptions = Tobago.extend({}, this.options);
reloadOptions = Tobago.extend(reloadOptions, options);
Tobago.createOverlay(Tobago.element(this.outerDivId));
- Tobago.Updater.update(action, this.id, reloadOptions);
+ Tobago.Updater.update(source, action, this.id, reloadOptions);
};
Tobago.Sheet.prototype.doUpdate = function(data) {
@@ -322,7 +322,7 @@
}
if (keyCode == 13) {
if (input.value != input.nextSibling.innerHTML) {
- this.reloadWithAction(input.actionId);
+ this.reloadWithAction(event.srcElement, input.actionId);
Tobago.stopEventPropagation(event);
}
else {
@@ -421,7 +421,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, "reloadWithAction", null, this.id), this.autoReload);
}
};
@@ -516,9 +516,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.reloadComponent(srcElement, this.clickReloadComponentId[0], action)
} else {
- Tobago.submitAction(action, true, null);
+ Tobago.submitAction(srcElement, action, true, null);
}
}
}
@@ -556,9 +556,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.reloadComponent(srcElement, this.dblClickReloadComponentId[0], action)
} else {
- Tobago.submitAction(action, true, null);
+ Tobago.submitAction(srcElement, action, true, null);
}
}
}
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=666671&r1=666670&r2=666671&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 Wed Jun 11 07:02:05 2008
@@ -251,8 +251,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");
- // AP
-// this.actionPosition = this.element(this.page.id + this.SUB_COMPONENT_SEP + "action-position");
+ this.actionPosition = this.element(this.page.id + this.SUB_COMPONENT_SEP + "action-position");
this.addBindEventListener(window, "unload", this, "onUnload");
@@ -299,7 +298,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;
@@ -481,11 +481,12 @@
/**
* Submitting the page with specified actionId.
*/
- submitAction: function(actionId, transition, target) {
+ submitAction: function(source, actionId, transition, target) {
if (transition === undefined) {
transition = true;
}
- LOG.info("transition =" + transition);
+
+ Tobago.setActionPosition(source);
if (Tobago.openPopups > 0) {
// enable all elements on page when this is a submit from a popup
@@ -524,6 +525,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 = "";
@@ -583,10 +593,11 @@
hidden.value = hidden.value + ":" + event.clientX + "x" + event.clientY;
}
}
+ var source = Tobago.element(event);
if (Tobago.Transport.hasTransport()) {
- Tobago.openPopupWithAction(popupId, actionId);
+ Tobago.openPopupWithAction(source, popupId, actionId);
} else {
- this.submitAction(actionId);
+ this.submitAction(source, actionId);
}
},
@@ -730,18 +741,18 @@
this.ajaxComponents[componentId] = containerId;
},
- reloadComponent: function(id, actionId, options) {
+ reloadComponent: function(source, id, actionId, options) {
var container = this.ajaxComponents[id];
if (typeof container == "string") {
if (!actionId) {
actionId = container;
}
- Tobago.Updater.update(actionId, id, options);
+ Tobago.Updater.update(source, actionId, id, options);
} else if ((typeof container == "object") && container.tagName) {
if (!actionId) {
actionId = container.id;
}
- Tobago.Updater.update(actionId, id, options);
+ Tobago.Updater.update(source, actionId, id, options);
} else if ((typeof container == "object") && (typeof container.reloadWithAction == "function")) {
if (!actionId) {
if (container.id) {
@@ -750,9 +761,9 @@
actionId = "_tbg_no_action_";
}
}
- container.reloadWithAction(actionId, options);
+ container.reloadWithAction(source, actionId, options);
} else if (container === undefined){
- Tobago.Updater.update(actionId, id, options);
+ Tobago.Updater.update(source, actionId, id, options);
} else {
LOG.warn("Illegal Container for reload:" + (typeof container));
}
@@ -1090,22 +1101,14 @@
}
},
-// AP
-// openPopupWithAction: function(source, popupId, actionId, options) {
- openPopupWithAction: function(popupId, actionId, options) {
+ openPopupWithAction: 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.submitAction(source, actionId);
}
-// AP
-// var sourceLeft = Tobago.getAbsoluteLeft(source);
-// var sourceTop = Tobago.getAbsoluteTop(source);
-// alert("source='" + source + "' " + sourceLeft + "," + sourceTop);
-// Tobago.actionPosition.value = sourceLeft + "," + sourceTop;
-//
div = document.createElement('div');
div.id = popupId + "parentDiv";
div.className = "tobago-popup-parent";
@@ -1122,7 +1125,7 @@
if (options) {
Tobago.extend(newOptions, options);
}
- Tobago.reloadComponent(popupId, actionId, options);
+ Tobago.reloadComponent(source, popupId, actionId, options);
},
// -------- Util functions ----------------------------------------------------
@@ -1505,7 +1508,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
@@ -1517,6 +1520,28 @@
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.
@@ -1524,7 +1549,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
@@ -1757,16 +1782,16 @@
Tobago.Panel.prototype.initReload = function() {
if (typeof this.autoReload == "number" && this.autoReload > 0) {
- Tobago.addReloadTimeout(this.id, Tobago.bind2(this, "reloadWithAction", this.id), this.autoReload);
+ Tobago.addReloadTimeout(this.id, Tobago.bind2(this, "reloadWithAction", null, this.id), this.autoReload);
}
};
-Tobago.Panel.prototype.reloadWithAction = function(action, options) {
+Tobago.Panel.prototype.reloadWithAction = function(source, action, options) {
//LOG.debug("reload panel with action \"" + action + "\"");
this.prepareReload();
var reloadOptions = Tobago.extend({}, this.options);
reloadOptions = Tobago.extend(reloadOptions, options);
- Tobago.Updater.update(action, this.id, reloadOptions);
+ Tobago.Updater.update(source, action, this.id, reloadOptions);
};
Tobago.Panel.prototype.prepareReload = function() {
@@ -2021,7 +2046,7 @@
createOverlay: true
},
- update: function(actionId, ajaxComponentIds, options) {
+ update: function(source, actionId, ajaxComponentIds, options) {
// LOG.show();
LOG.debug("Updater.update(\"" + actionId + "\", \"" + ajaxComponentIds + "\")");
@@ -2030,7 +2055,8 @@
// LOG.info("hasTransport");
if (Tobago.applicationOnsubmit) {
- if (!Tobago.applicationOnsubmit()) {
+ var result = Tobago.applicationOnsubmit();
+ if (!result) {
return;
}
}
@@ -2056,6 +2082,8 @@
}
}
+ Tobago.setActionPosition(source);
+
var requestObject = Tobago.extend({}, Tobago.Updater.dojoUpdateRequestBase);
requestObject.url = Tobago.form.action;
requestObject.form = Tobago.form.id;
@@ -2085,7 +2113,7 @@
}
} else {
LOG.info("No Ajax transport found! Doing full page reload.");
- Tobago.submitAction(actionId);
+ Tobago.submitAction(source, actionId);
}
},
@@ -2149,7 +2177,7 @@
alert("wait: initiating full reload");
}
Tobago.Transport.requestComplete();
- Tobago.submitAction(Tobago.page.id);
+ Tobago.submitAction(null, Tobago.page.id);
return data;
} else if (data.responseCode == Tobago.Updater.CODE_RELOAD_REQUIRED) {
// update required do full page reload
@@ -2159,7 +2187,7 @@
alert("wait: full reload requeste: responseCode = " + data.responseCode);
}
Tobago.Transport.requestComplete();
- Tobago.submitAction(Tobago.page.id);
+ Tobago.submitAction(null, Tobago.page.id);
return data;
}