You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2010/03/29 12:05:57 UTC
svn commit: r928678 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/ajax/
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/internal/ajax/
core/src/main/java/org/apache/myfaces...
Author: bommel
Date: Mon Mar 29 10:05:56 2010
New Revision: 928678
URL: http://svn.apache.org/viewvc?rev=928678&view=rev
Log:
(TOBAGO-865) Simplify AJAX component handling
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/UIPanelBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/BoxTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PanelTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PanelRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.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/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java
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
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/AjaxUtils.java Mon Mar 29 10:05:56 2010
@@ -20,7 +20,6 @@ package org.apache.myfaces.tobago.ajax;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.internal.ajax.AjaxComponent;
import org.apache.myfaces.tobago.internal.ajax.AjaxInternalUtils;
import javax.faces.component.UIComponent;
@@ -51,14 +50,9 @@ public class AjaxUtils {
LOG.warn("Ignore AjaxComponent: null");
return;
}
- if (component instanceof AjaxComponent) {
- Map<String, UIComponent> ajaxComponents = AjaxInternalUtils.getAjaxComponents(facesContext);
- if (ajaxComponents != null) {
- ajaxComponents.put(component.getClientId(facesContext), component);
- }
- } else {
- LOG.warn("Ignore non AjaxComponent: id='"
- + component.getClientId(facesContext) + "' class=" + component.getClass().getName());
+ Map<String, UIComponent> ajaxComponents = AjaxInternalUtils.getAjaxComponents(facesContext);
+ if (ajaxComponents != null) {
+ ajaxComponents.put(component.getClientId(facesContext), component);
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIData.java Mon Mar 29 10:05:56 2010
@@ -19,11 +19,10 @@ package org.apache.myfaces.tobago.compon
import org.apache.myfaces.tobago.event.SortActionSource;
import org.apache.myfaces.tobago.event.SortActionSource2;
-import org.apache.myfaces.tobago.internal.ajax.AjaxComponent;
/**
* @deprecated Please use UISheet
*/
-public interface UIData extends SortActionSource2, AjaxComponent, SupportsMarkup, SortActionSource {
+public interface UIData extends SortActionSource2, SupportsMarkup, SortActionSource {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java Mon Mar 29 10:05:56 2010
@@ -103,7 +103,7 @@ public class AjaxResponseRenderer {
}
private void renderComponent(FacesContext facesContext, RenderKit renderKit, String clientId,
- AjaxComponent component) throws IOException {
+ UIComponent component) throws IOException {
PrintWriter writer = getPrintWriter(facesContext);
ResponseWriter contentWriter = renderKit.createResponseWriter(writer, contentType, null);
facesContext.setResponseWriter(contentWriter);
@@ -125,7 +125,7 @@ public class AjaxResponseRenderer {
writer.write("\",\n");
writer.write(" \"responseCode\": ");
- writer.write(Integer.toString(component.getAjaxResponseCode()));
+ writer.write(Integer.toString(CODE_SUCCESS));
if (contentWriter instanceof TobagoResponseJsonWriterImpl) {
writer.write(",\n");
@@ -183,7 +183,7 @@ public class AjaxResponseRenderer {
writer.write(Integer.toString(i++));
writer.write("\": ");
- AjaxComponent component = (AjaxComponent) entry.getValue();
+ UIComponent component = entry.getValue();
if (facesContext instanceof TobagoFacesContext) {
((TobagoFacesContext) facesContext).setAjaxComponentId(entry.getKey());
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java Mon Mar 29 10:05:56 2010
@@ -30,7 +30,6 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.OnComponentPopulated;
import org.apache.myfaces.tobago.component.Position;
import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.internal.ajax.AjaxComponent;
import org.apache.myfaces.tobago.internal.layout.LayoutUtils;
import org.apache.myfaces.tobago.layout.LayoutComponent;
import org.apache.myfaces.tobago.layout.LayoutContainer;
@@ -49,7 +48,7 @@ import java.util.Iterator;
import java.util.List;
public abstract class AbstractUIPopup extends UIPanelBase
- implements OnComponentCreated, OnComponentPopulated, NamingContainer, AjaxComponent, InvokeOnComponent,
+ implements OnComponentCreated, OnComponentPopulated, NamingContainer, InvokeOnComponent,
DeprecatedDimension, Position, LayoutContainer {
private static final Log LOG = LogFactory.getLog(AbstractUIPopup.class);
@@ -180,12 +179,6 @@ public abstract class AbstractUIPopup ex
}
@Override
- public void encodeAjax(FacesContext facesContext) throws IOException {
- super.encodeAjax(facesContext);
- activated = false;
- }
-
- @Override
public boolean invokeOnComponent(FacesContext facesContext, String clientId, ContextCallback callback)
throws FacesException {
return FacesUtils.invokeOnComponent(facesContext, this, clientId, callback);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java Mon Mar 29 10:05:56 2010
@@ -29,23 +29,18 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.OnComponentPopulated;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.component.Sorter;
-import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.event.PageActionEvent;
import org.apache.myfaces.tobago.event.SheetStateChangeEvent;
import org.apache.myfaces.tobago.event.SheetStateChangeListener;
import org.apache.myfaces.tobago.event.SheetStateChangeSource;
import org.apache.myfaces.tobago.event.SortActionEvent;
import org.apache.myfaces.tobago.event.SortActionSource;
-import org.apache.myfaces.tobago.internal.ajax.AjaxComponent;
-import org.apache.myfaces.tobago.internal.ajax.AjaxInternalUtils;
-import org.apache.myfaces.tobago.internal.ajax.AjaxResponseRenderer;
import org.apache.myfaces.tobago.internal.layout.LayoutUtils;
import org.apache.myfaces.tobago.layout.LayoutComponent;
import org.apache.myfaces.tobago.layout.LayoutContainer;
import org.apache.myfaces.tobago.layout.LayoutManager;
import org.apache.myfaces.tobago.layout.LayoutTokens;
import org.apache.myfaces.tobago.model.SheetState;
-import org.apache.myfaces.tobago.util.ComponentUtils;
import javax.faces.FacesException;
import javax.faces.component.ContextCallback;
@@ -57,14 +52,13 @@ import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
-import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public abstract class AbstractUISheet extends javax.faces.component.UIData
- implements SheetStateChangeSource, SortActionSource, AjaxComponent, InvokeOnComponent, OnComponentPopulated,
+ implements SheetStateChangeSource, SortActionSource, InvokeOnComponent, OnComponentPopulated,
LayoutContainer, LayoutComponent {
private static final Log LOG = LogFactory.getLog(AbstractUISheet.class);
@@ -366,61 +360,7 @@ public abstract class AbstractUISheet ex
this.widthList = widthList;
}
- @Override
- public void processDecodes(FacesContext context) {
- if (context instanceof TobagoFacesContext && ((TobagoFacesContext) context).isAjax()) {
- final String ajaxId = ((TobagoFacesContext) context).getAjaxComponentId();
- UIComponent reload = getFacet(Facets.RELOAD);
- if (ajaxId != null && ajaxId.equals(getClientId(context)) && reload != null && reload.isRendered()
- && ajaxId.equals(ComponentUtils.findPage(context, this).getActionId())) {
- Boolean immediate = (Boolean) reload.getAttributes().get(Attributes.IMMEDIATE);
- if (immediate != null && immediate) {
- Boolean update = (Boolean) reload.getAttributes().get(Attributes.UPDATE);
- if (update != null && !update) {
- if (context.getExternalContext().getResponse() instanceof HttpServletResponse) {
- ((HttpServletResponse) context.getExternalContext().getResponse())
- .setStatus(HttpServletResponse.SC_NOT_MODIFIED);
- }
- context.responseComplete();
- return;
- }
- }
- }
- }
- super.processDecodes(context);
- }
- public void encodeAjax(FacesContext facesContext) throws IOException {
- // TODO neets more testing!!!
- //if (!facesContext.getRenderResponse() && !ComponentUtils.hasErrorMessages(facesContext)) {
- // in encodeBegin of superclass is some logic which clears the DataModel
- // this must here also done.
- // in RI and myfaces this could done via setValue(null)
-
- if (FacesUtils.hasValueBindingOrValueExpression(this, "value")) {
- setValue(null);
- } else {
- setValue(getValue());
- }
- //}
- UIComponent reload = getFacet(Facets.RELOAD);
- if (reload != null && reload.isRendered()) {
- Boolean immediate = (Boolean) reload.getAttributes().get(Attributes.IMMEDIATE);
- if (immediate != null && !immediate) {
- Boolean update = (Boolean) reload.getAttributes().get(Attributes.UPDATE);
- if (update != null && !update) {
- ajaxResponseCode = AjaxResponseRenderer.CODE_NOT_MODIFIED;
- return;
- }
- }
- }
- ajaxResponseCode = AjaxResponseRenderer.CODE_SUCCESS;
- AjaxInternalUtils.encodeAjaxComponent(facesContext, this);
- }
-
- public int getAjaxResponseCode() {
- return ajaxResponseCode;
- }
public Integer[] getScrollPosition() {
Integer[] scrollPosition = (Integer[]) getAttributes().get(Attributes.SCROLL_POSITION);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java Mon Mar 29 10:05:56 2010
@@ -29,8 +29,6 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.event.TabChangeEvent;
import org.apache.myfaces.tobago.event.TabChangeListener;
import org.apache.myfaces.tobago.event.TabChangeSource;
-import org.apache.myfaces.tobago.internal.ajax.AjaxComponent;
-import org.apache.myfaces.tobago.internal.ajax.AjaxInternalUtils;
import org.apache.myfaces.tobago.internal.layout.LayoutUtils;
import org.apache.myfaces.tobago.layout.LayoutComponent;
import org.apache.myfaces.tobago.layout.LayoutContainer;
@@ -52,7 +50,7 @@ import java.util.Collection;
import java.util.List;
public abstract class AbstractUITabGroup extends UIPanelBase
- implements TabChangeSource, ActionSource, AjaxComponent, LayoutContainer, LayoutComponent, OnComponentPopulated {
+ implements TabChangeSource, ActionSource, LayoutContainer, LayoutComponent, OnComponentPopulated {
private static final Log LOG = LogFactory.getLog(AbstractUITabGroup.class);
@@ -239,8 +237,6 @@ public abstract class AbstractUITabGroup
}
}
-
-
public void addTabChangeListener(TabChangeListener listener) {
if (LOG.isWarnEnabled() && isClientType()) {
LOG.warn("Adding TabChangeListener to Client side Tabgroup!");
@@ -261,11 +257,6 @@ public abstract class AbstractUITabGroup
return (TabChangeListener[]) getFacesListeners(TabChangeListener.class);
}
- public void encodeAjax(FacesContext facesContext) throws IOException {
- setRenderedIndex(getSelectedIndex());
- AjaxInternalUtils.encodeAjaxComponent(facesContext, this);
- }
-
public abstract Integer getRenderedIndex();
public abstract void setRenderedIndex(Integer index);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/UIPanelBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/UIPanelBase.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/UIPanelBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/UIPanelBase.java Mon Mar 29 10:05:56 2010
@@ -19,65 +19,14 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.compat.InvokeOnComponent;
-import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.Facets;
-import org.apache.myfaces.tobago.context.TobagoFacesContext;
-import org.apache.myfaces.tobago.internal.ajax.AjaxComponent;
-import org.apache.myfaces.tobago.internal.ajax.AjaxInternalUtils;
-import org.apache.myfaces.tobago.internal.ajax.AjaxResponseRenderer;
-import org.apache.myfaces.tobago.util.ComponentUtils;
import javax.faces.FacesException;
import javax.faces.component.ContextCallback;
-import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
public abstract class UIPanelBase extends javax.faces.component.UIPanel
- implements AjaxComponent, InvokeOnComponent {
+ implements InvokeOnComponent {
- public void processDecodes(FacesContext context) {
- if (context instanceof TobagoFacesContext && ((TobagoFacesContext) context).isAjax()) {
-
- final String ajaxId = ((TobagoFacesContext) context).getAjaxComponentId();
- UIComponent reload = getFacet(Facets.RELOAD);
- if (ajaxId != null && ajaxId.equals(getClientId(context)) && reload != null && reload.isRendered()
- && ajaxId.equals(ComponentUtils.findPage(context, this).getActionId())) {
- Boolean immediate = (Boolean) reload.getAttributes().get(Attributes.IMMEDIATE);
- if (immediate != null && immediate) {
- Boolean update = (Boolean) reload.getAttributes().get(Attributes.UPDATE);
- if (update != null && !update) {
- if (context.getExternalContext().getResponse() instanceof HttpServletResponse) {
- ((HttpServletResponse) context.getExternalContext().getResponse())
- .setStatus(HttpServletResponse.SC_NOT_MODIFIED);
- }
- context.responseComplete();
- return;
- }
- }
- }
- }
- super.processDecodes(context);
- }
-
- public void encodeAjax(FacesContext facesContext) throws IOException {
- UIComponent reload = getFacet(Facets.RELOAD);
- if (reload != null && reload.isRendered()) {
- Boolean immediate = (Boolean) reload.getAttributes().get(Attributes.IMMEDIATE);
- if (immediate != null && !immediate) {
- Boolean update = (Boolean) reload.getAttributes().get(Attributes.UPDATE);
- if (update != null && !update) {
- return;
- }
- }
- }
- AjaxInternalUtils.encodeAjaxComponent(facesContext, this);
- }
-
- public int getAjaxResponseCode() {
- return AjaxResponseRenderer.CODE_SUCCESS;
- }
public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
throws FacesException {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/BoxTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/BoxTagDeclaration.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/BoxTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/BoxTagDeclaration.java Mon Mar 29 10:05:56 2010
@@ -36,7 +36,6 @@ import org.apache.myfaces.tobago.taglib.
uiComponent = "org.apache.myfaces.tobago.component.UIBox",
uiComponentBaseClass = "org.apache.myfaces.tobago.component.UIPanel",
componentType = "org.apache.myfaces.tobago.Box",
- interfaces = "org.apache.myfaces.tobago.internal.ajax.AjaxComponent",
rendererType = RendererTypes.BOX,
facets = {
@Facet(name= Facets.TOOL_BAR, description = "Contains an instance of UIToolBar",
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PanelTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PanelTagDeclaration.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PanelTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PanelTagDeclaration.java Mon Mar 29 10:05:56 2010
@@ -37,8 +37,7 @@ import org.apache.myfaces.tobago.taglib.
uiComponent = "org.apache.myfaces.tobago.component.UIPanel",
uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUIPanel",
rendererType = RendererTypes.PANEL,
- interfaces = {"org.apache.myfaces.tobago.internal.ajax.AjaxComponent",
- "org.apache.myfaces.tobago.component.SupportsMarkup"},
+ interfaces = "org.apache.myfaces.tobago.component.SupportsMarkup",
facets = {
@Facet(name= Facets.RELOAD, description = "Contains an instance of UIReload",
allowedChildComponenents = "org.apache.myfaces.tobago.Reload"),
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=928678&r1=928677&r2=928678&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 Mon Mar 29 10:05:56 2010
@@ -35,7 +35,6 @@ import org.apache.myfaces.tobago.taglib.
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UIPopup",
uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUIPopup",
- interfaces = "org.apache.myfaces.tobago.internal.ajax.AjaxComponent",
rendererType = RendererTypes.POPUP)
public interface PopupTagDeclaration
extends HasId, IsRendered, IsGridLayoutComponentWithDeprecatedDimension, IsGridLayoutContainer, HasMarkup {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java Mon Mar 29 10:05:56 2010
@@ -39,8 +39,7 @@ import org.apache.myfaces.tobago.taglib.
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UISheet",
uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUISheet",
- interfaces = { "org.apache.myfaces.tobago.internal.ajax.AjaxComponent",
- "org.apache.myfaces.tobago.event.SortActionSource" },
+ interfaces = "org.apache.myfaces.tobago.event.SortActionSource",
rendererType = RendererTypes.SHEET,
allowedChildComponenents = {
"javax.faces.Column",
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java Mon Mar 29 10:05:56 2010
@@ -42,7 +42,7 @@ import org.apache.myfaces.tobago.taglib.
uiComponent = "org.apache.myfaces.tobago.component.UITabGroup",
uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUITabGroup",
rendererType = RendererTypes.TAB_GROUP,
- interfaces = { "org.apache.myfaces.tobago.internal.ajax.AjaxComponent", "javax.faces.component.ActionSource"},
+ interfaces = "javax.faces.component.ActionSource",
// componentFamily = "org.apache.myfaces.tobago.TabGroup",
allowedChildComponenents = "org.apache.myfaces.tobago.Tab")
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java Mon Mar 29 10:05:56 2010
@@ -20,18 +20,41 @@ package org.apache.myfaces.tobago.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.component.Facets;
+import org.apache.myfaces.tobago.context.TobagoFacesContext;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
+import javax.servlet.http.HttpServletResponse;
public class ApplyRequestValuesCallback implements TobagoCallback {
@SuppressWarnings("UnusedDeclaration")
private static final Log LOG = LogFactory.getLog(ApplyRequestValuesCallback.class);
- public void invokeContextCallback(FacesContext facesContext, UIComponent component) {
- component.processDecodes(facesContext);
+ public void invokeContextCallback(FacesContext context, UIComponent component) {
+ if (context instanceof TobagoFacesContext && ((TobagoFacesContext) context).isAjax()) {
+ final String ajaxId = ((TobagoFacesContext) context).getAjaxComponentId();
+ UIComponent reload = component.getFacet(Facets.RELOAD);
+ if (ajaxId != null && ajaxId.equals(component.getClientId(context)) && reload != null && reload.isRendered()
+ && ajaxId.equals(ComponentUtils.findPage(context, component).getActionId())) {
+ Boolean immediate = (Boolean) reload.getAttributes().get(Attributes.IMMEDIATE);
+ if (immediate != null && immediate) {
+ Boolean update = (Boolean) reload.getAttributes().get(Attributes.UPDATE);
+ if (update != null && !update) {
+ if (context.getExternalContext().getResponse() instanceof HttpServletResponse) {
+ ((HttpServletResponse) context.getExternalContext().getResponse())
+ .setStatus(HttpServletResponse.SC_NOT_MODIFIED);
+ }
+ context.responseComplete();
+ return;
+ }
+ }
+ }
+ }
+ component.processDecodes(context);
}
public PhaseId getPhaseId() {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java Mon Mar 29 10:05:56 2010
@@ -18,7 +18,8 @@ package org.apache.myfaces.tobago.util;
*/
-import org.apache.myfaces.tobago.internal.ajax.AjaxComponent;
+import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import javax.faces.FacesException;
@@ -32,15 +33,42 @@ public class EncodeAjaxCallback implemen
public void invokeContextCallback(FacesContext facesContext, UIComponent component) {
try {
+ UIComponent reload = component.getFacet(Facets.RELOAD);
+ if (reload != null && reload.isRendered()) {
+ Boolean immediate = (Boolean) reload.getAttributes().get(Attributes.IMMEDIATE);
+ if (immediate != null && !immediate) {
+ Boolean update = (Boolean) reload.getAttributes().get(Attributes.UPDATE);
+ if (update != null && !update) {
+ return;
+ }
+ }
+ }
prepareRendererAll(facesContext, component);
- ((AjaxComponent) component).encodeAjax(facesContext);
+ encodeAll(facesContext, component);
} catch (IOException e) {
throw new FacesException(e);
}
}
-
+
public PhaseId getPhaseId() {
- return PhaseId.RENDER_RESPONSE;
+ return PhaseId.RENDER_RESPONSE;
+ }
+
+
+ // TODO replace with component.encodeAll after removing jsf 1.1 support
+ public static void encodeAll(FacesContext facesContext, UIComponent component) throws IOException {
+ if (component.isRendered()) {
+ component.encodeBegin(facesContext);
+ if (component.getRendersChildren()) {
+ component.encodeChildren(facesContext);
+ } else {
+ for (Object o : component.getChildren()) {
+ UIComponent kid = (UIComponent) o;
+ encodeAll(facesContext, kid);
+ }
+ }
+ component.encodeEnd(facesContext);
+ }
}
// TODO merge with RenderUtil.prepareRendererAll
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PanelRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PanelRenderer.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PanelRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PanelRenderer.java Mon Mar 29 10:05:56 2010
@@ -22,9 +22,7 @@ import org.apache.commons.logging.LogFac
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.UIPanel;
import org.apache.myfaces.tobago.component.UIReload;
-import org.apache.myfaces.tobago.config.TobagoConfig;
-import org.apache.myfaces.tobago.internal.ajax.AjaxInternalUtils;
-import org.apache.myfaces.tobago.internal.ajax.AjaxRenderer;
+import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.internal.component.AbstractUIPanel;
import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Style;
@@ -39,7 +37,7 @@ import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import java.io.IOException;
-public class PanelRenderer extends LayoutComponentRendererBase implements AjaxRenderer {
+public class PanelRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(PanelRenderer.class);
@@ -80,8 +78,8 @@ public class PanelRenderer extends Layou
if (panel instanceof UIPanel && ((UIPanel) panel).getTip() != null) {
writer.writeAttribute(HtmlAttributes.TITLE, ((UIPanel) panel).getTip(), true);
}
- if (TobagoConfig.getInstance(facesContext).isAjaxEnabled()) {
- // writer.writeJavascript("Tobago.addAjaxComponent(\"" + clientId + "\")");
+ // TODO check ajax id
+ if (facesContext instanceof TobagoFacesContext && !((TobagoFacesContext) facesContext).isAjax()) {
Integer frequency = null;
UIComponent facetReload = panel.getFacet(Facets.RELOAD);
if (facetReload != null && facetReload instanceof UIReload && facetReload.isRendered()) {
@@ -94,7 +92,6 @@ public class PanelRenderer extends Layou
final String[] cmds = {
"new Tobago.Panel(\"" + clientId + "\", " + true + ", " + frequency + ");"
};
-
HtmlRendererUtils.writeScriptLoader(facesContext, null, cmds);
}
}
@@ -104,9 +101,4 @@ public class PanelRenderer extends Layou
ResponseWriter writer = facesContext.getResponseWriter();
writer.endElement(HtmlConstants.DIV);
}
-
- public void encodeAjax(FacesContext facesContext, UIComponent component) throws IOException {
- AjaxInternalUtils.checkParamValidity(facesContext, component, UIPanel.class);
- component.encodeChildren(facesContext);
- }
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java Mon Mar 29 10:05:56 2010
@@ -21,8 +21,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.UIPopup;
import org.apache.myfaces.tobago.context.TobagoFacesContext;
-import org.apache.myfaces.tobago.internal.ajax.AjaxInternalUtils;
-import org.apache.myfaces.tobago.internal.ajax.AjaxRenderer;
import org.apache.myfaces.tobago.internal.component.AbstractUIPage;
import org.apache.myfaces.tobago.internal.layout.LayoutContext;
import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
@@ -30,7 +28,6 @@ import org.apache.myfaces.tobago.renderk
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
-import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
import org.apache.myfaces.tobago.util.ComponentUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
@@ -39,7 +36,7 @@ import javax.faces.context.FacesContext;
import java.io.IOException;
import java.text.DecimalFormat;
-public class PopupRenderer extends LayoutComponentRendererBase implements AjaxRenderer {
+public class PopupRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(PopupRenderer.class);
@@ -63,8 +60,14 @@ public class PopupRenderer extends Layou
@Override
public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
-
TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+ // TODO check ajaxId
+ if (facesContext instanceof TobagoFacesContext && ((TobagoFacesContext) facesContext).isAjax()) {
+ writer.startJavascript();
+ writer.write("Tobago.setupPopup();");
+ writer.endJavascript();
+ }
+
UIPopup popup = (UIPopup) component;
// LAYOUT Begin
@@ -110,13 +113,4 @@ public class PopupRenderer extends Layou
TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
writer.endElement(HtmlConstants.DIV);
}
-
- public void encodeAjax(FacesContext facesContext, UIComponent component) throws IOException {
- AjaxInternalUtils.checkParamValidity(facesContext, component, UIPopup.class);
- RenderUtil.encode(facesContext, component);
- TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
- writer.startJavascript();
- writer.write("Tobago.setupPopup();");
- writer.endJavascript();
- }
}
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=928678&r1=928677&r2=928678&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 Mon Mar 29 10:05:56 2010
@@ -71,7 +71,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
-public class SheetRenderer extends LayoutComponentRendererBase implements AjaxRenderer {
+public class SheetRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(SheetRenderer.class);
@@ -137,32 +137,34 @@ public class SheetRenderer extends Layou
renderSheet(facesContext, sheet, (clickAction != null || dblClickAction != null), style);
writer.endElement(HtmlConstants.DIV);
+ // TODO check ajax id
+ if (facesContext instanceof TobagoFacesContext && !((TobagoFacesContext) facesContext).isAjax()) {
- ResourceManager resourceManager = ResourceManagerFactory.getResourceManager(facesContext);
- String contextPath = facesContext.getExternalContext().getRequestContextPath();
+ ResourceManager resourceManager = ResourceManagerFactory.getResourceManager(facesContext);
+ String contextPath = facesContext.getExternalContext().getRequestContextPath();
- String unchecked = contextPath + resourceManager.getImage(facesContext, "image/sheetUnchecked.gif");
- String checked = contextPath + resourceManager.getImage(facesContext, "image/sheetChecked.gif");
- boolean ajaxEnabled = TobagoConfig.getInstance(facesContext).isAjaxEnabled();
+ String unchecked = contextPath + resourceManager.getImage(facesContext, "image/sheetUnchecked.gif");
+ String checked = contextPath + resourceManager.getImage(facesContext, "image/sheetChecked.gif");
- Integer frequency = null;
- UIComponent facetReload = sheet.getFacet(Facets.RELOAD);
- if (facetReload != null && facetReload instanceof UIReload && facetReload.isRendered()) {
- UIReload update = (UIReload) facetReload;
- frequency = update.getFrequency();
- }
- final String[] cmds = {
- "new Tobago.Sheet(\"" + sheetId + "\", " + ajaxEnabled
- + ", \"" + checked + "\", \"" + unchecked + "\", \"" + sheet.getSelectable()
- + "\", " + columnSelectorIndex + ", " + frequency
- + ", " + (clickAction != null ? HtmlRendererUtils.getJavascriptString(clickAction.getId()) : null)
- + ", " + HtmlRendererUtils.getRenderedPartiallyJavascriptArray(facesContext, clickAction)
- + ", " + (dblClickAction != null ? HtmlRendererUtils.getJavascriptString(dblClickAction.getId()) : null)
- + ", " + HtmlRendererUtils.getRenderedPartiallyJavascriptArray(facesContext, dblClickAction)
- + ");"
- };
+ Integer frequency = null;
+ UIComponent facetReload = sheet.getFacet(Facets.RELOAD);
+ if (facetReload != null && facetReload instanceof UIReload && facetReload.isRendered()) {
+ UIReload update = (UIReload) facetReload;
+ frequency = update.getFrequency();
+ }
+ final String[] cmds = {
+ "new Tobago.Sheet(\"" + sheetId + "\", " + true
+ + ", \"" + checked + "\", \"" + unchecked + "\", \"" + sheet.getSelectable()
+ + "\", " + columnSelectorIndex + ", " + frequency
+ + ", " + (clickAction != null ? HtmlRendererUtils.getJavascriptString(clickAction.getId()) : null)
+ + ", " + HtmlRendererUtils.getRenderedPartiallyJavascriptArray(facesContext, clickAction)
+ + ", " + (dblClickAction != null ? HtmlRendererUtils.getJavascriptString(dblClickAction.getId()) : null)
+ + ", " + HtmlRendererUtils.getRenderedPartiallyJavascriptArray(facesContext, dblClickAction)
+ + ");"
+ };
- HtmlRendererUtils.writeScriptLoader(facesContext, SCRIPTS, cmds);
+ HtmlRendererUtils.writeScriptLoader(facesContext, SCRIPTS, cmds);
+ }
}
private void renderSheet(FacesContext facesContext, UISheet sheet, boolean hasClickAction, Style style)
@@ -1075,36 +1077,6 @@ public class SheetRenderer extends Layou
return getLeftOffset(facesContext, data).add(getRightOffset(facesContext, data));
}
- public void encodeAjax(FacesContext facesContext, UIComponent component) throws IOException {
-
- UISheet data = (UISheet) component;
- Style style = new Style(facesContext, data);
-
- AjaxInternalUtils.checkParamValidity(facesContext, data, UISheet.class);
- // TODO find a better way
- UICommand clickAction = null;
- UICommand dblClickAction = null;
- for (UIComponent child : (List<UIComponent>) data.getChildren()) {
- if (child instanceof UIColumnEvent) {
- UIColumnEvent columnEvent = (UIColumnEvent) child;
- if (columnEvent.isRendered()) {
- UIComponent selectionChild = (UIComponent) child.getChildren().get(0);
- if (selectionChild != null && selectionChild instanceof UICommand && selectionChild.isRendered()) {
- UICommand action = (UICommand) selectionChild;
- if ("click".equals(columnEvent.getEvent())) {
- clickAction = action;
- }
- if ("dblclick".equals(columnEvent.getEvent())) {
- dblClickAction = action;
- }
- }
- }
- }
- }
- ensureColumnWidthList(facesContext, data, style);
-
- renderSheet(facesContext, data, (clickAction != null || dblClickAction != null), style);
- }
@Override
public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java Mon Mar 29 10:05:56 2010
@@ -60,7 +60,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
-public class TabGroupRenderer extends LayoutComponentRendererBase implements AjaxRenderer {
+public class TabGroupRenderer extends LayoutComponentRendererBase {
private static final Log LOG = LogFactory.getLog(TabGroupRenderer.class);
@@ -532,17 +532,6 @@ public class TabGroupRenderer extends La
writer.endElement(HtmlConstants.TR);
}
- public void encodeAjax(FacesContext context, UIComponent component) throws IOException {
- UITabGroup tabGroup = (UITabGroup) component;
- AjaxInternalUtils.checkParamValidity(context, tabGroup, UITabGroup.class);
- TabList tabList = getTabList(context, tabGroup);
- int index = ensureRenderedActiveIndex(context, tabGroup);
- Measure currentWidth = getCurrentWidth(tabList, index);
- renderTabGroupView(context, HtmlRendererUtils.getTobagoResponseWriter(context),
- tabGroup, index, UITabGroup.SWITCH_TYPE_RELOAD_TAB,
- ResourceManagerUtil.getImageWithPath(context, "image/1x1.gif"),
- getResourceManager().getThemeMeasure(context, tabGroup, "navigationBarWidth"), currentWidth, tabList);
- }
private static class TabList {
private List<Measure> widthList = new ArrayList<Measure>();
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java?rev=928678&r1=928677&r2=928678&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java Mon Mar 29 10:05:56 2010
@@ -26,6 +26,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.UITextarea;
+import org.apache.myfaces.tobago.context.Capability;
import org.apache.myfaces.tobago.renderkit.HtmlUtils;
import org.apache.myfaces.tobago.renderkit.InputRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Style;
@@ -35,6 +36,7 @@ import org.apache.myfaces.tobago.renderk
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.apache.myfaces.tobago.util.VariableResolverUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
@@ -82,6 +84,20 @@ public class TextAreaRenderer extends In
if (onchange != null) {
writer.writeAttribute(HtmlAttributes.ONCHANGE, onchange, null);
}
+ int maxLength = -1;
+ for (Validator validator : input.getValidators()) {
+ if (validator instanceof LengthValidator) {
+ LengthValidator lengthValidator = (LengthValidator) validator;
+ maxLength = lengthValidator.getMaximum();
+ }
+ }
+ if (maxLength > 0) {
+ writer.writeAttribute(HtmlAttributes.MAXLENGTH, maxLength);
+ }
+ String placeholder = input.getPlaceholder();
+ if (placeholder != null) {
+ writer.writeAttribute(HtmlAttributes.PLACEHOLDER, placeholder, true);
+ }
String currentValue = RenderUtil.currentValue(input);
if (currentValue != null) {
// this is because browsers eat the first CR+LF of <textarea>
@@ -95,24 +111,22 @@ public class TextAreaRenderer extends In
writer.writeText(currentValue, null);
}
writer.endElement(HtmlConstants.TEXTAREA);
+ if (placeholder != null && !VariableResolverUtils.resolveClientProperties(facesContext)
+ .getUserAgent().hasCapability(Capability.PLACEHOLDER)) {
+ HtmlRendererUtils.createPlaceholderDiv(input, currentValue, placeholder, style, writer);
+ }
HtmlRendererUtils.checkForCommandFacet(input, facesContext, writer);
- int maxLength = -1;
- for (Validator validator : input.getValidators()) {
- if (validator instanceof LengthValidator) {
- LengthValidator lengthValidator = (LengthValidator) validator;
- maxLength = lengthValidator.getMaximum();
- }
- }
+
boolean required = ComponentUtils.getBooleanAttribute(input, Attributes.REQUIRED);
- if (required || maxLength > 0) {
+ /*if (required || maxLength > 0) {
String rendererName = HtmlRendererUtils.getRendererName(facesContext, input);
final String[] cmds = {
"new Tobago.In(\"" + input.getClientId(facesContext) + "\", true ,\""
+ StyleClasses.PREFIX + rendererName + "\" " + (maxLength > -1? "," + maxLength: "") + " );"
};
HtmlRendererUtils.writeScriptLoader(facesContext, null, cmds);
- }
+ } */
// focus
HtmlRendererUtils.renderFocusId(facesContext, input);
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=928678&r1=928677&r2=928678&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 Mon Mar 29 10:05:56 2010
@@ -237,9 +237,11 @@ Tobago.TabGroup.prototype.removeRelatedA
Tobago.TabGroup.prototype.doUpdate = function(data) {
if (data.responseCode == Tobago.Updater.CODE_SUCCESS) {
var container = Tobago.element(this.tabGroupId);
- container.innerHTML = data.html;
+ Tobago.replaceElement(container, data.html);
try {
- data.script();
+ var updateScript;
+ eval("updateScript = " + data.script);
+ updateScript();
} catch (e) {
LOG.error(e);
}
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=928678&r1=928677&r2=928678&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 Mon Mar 29 10:05:56 2010
@@ -196,8 +196,8 @@ Tobago.Sheet.prototype.doSort = function
while (element && !element.sorterId) {
element = element.parentNode;
}
-// LOG.debug("element.id = " + element.id);
-// LOG.debug("sorterId = " + element.sorterId);
+ LOG.debug("element.id = " + element.id);
+ LOG.debug("sorterId = " + element.sorterId);
this.reloadWithAction(event.srcElement, element.sorterId);
};
@@ -242,9 +242,11 @@ Tobago.Sheet.prototype.reloadWithAction
Tobago.Sheet.prototype.doUpdate = function(data) {
if (data.responseCode == Tobago.Updater.CODE_SUCCESS) {
var divElement = Tobago.element(this.outerDivId);
- divElement.innerHTML = data.html;
+ Tobago.replaceElement(divElement, data.html);
try {
- data.script();
+ var updateScript;
+ eval("updateScript = " + data.script);
+ updateScript();
} catch (e) {
LOG.error(e);
}