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 2011/02/22 11:02:47 UTC
svn commit: r1073279 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/
tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/ta...
Author: lofwyr
Date: Tue Feb 22 10:02:47 2011
New Revision: 1073279
URL: http://svn.apache.org/viewvc?rev=1073279&view=rev
Log:
TOBAGO-976: The resize facet of the page should also support a script command
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PageTagDeclaration.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java?rev=1073279&r1=1073278&r2=1073279&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java Tue Feb 22 10:02:47 2011
@@ -43,6 +43,11 @@ public final class Facets {
public static final String POPUP = "popup";
public static final String RADIO = "radio";
public static final String RELOAD = "reload";
+ public static final String RESIZE = "resize";
+ /**
+ * @deprecated since 1.5.0. Please use {@link #RESIZE}
+ */
+ @Deprecated
public static final String RESIZE_ACTION = "resizeAction";
public static final String SORTER = "sorter";
public static final String TOOL_BAR = "toolBar";
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PageTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PageTagDeclaration.java?rev=1073279&r1=1073278&r2=1073279&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PageTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PageTagDeclaration.java Tue Feb 22 10:02:47 2011
@@ -45,9 +45,12 @@ import org.apache.myfaces.tobago.interna
{ @Facet(name = Facets.ACTION,
description ="Contains an instance of UICommand (tc:command) for an auto-action",
allowedChildComponenents = "org.apache.myfaces.tobago.Command"),
+ @Facet(name = Facets.RESIZE,
+ description ="Contains an instance of UICommand which will be executed when the"
+ + "size of the user agent was changed. Typically a <tc:command immediate='true' />",
+ allowedChildComponenents = {"org.apache.myfaces.tobago.Command", "org.apache.myfaces.tobago.Form"}),
@Facet(name = Facets.RESIZE_ACTION,
- description ="Contains an instance of UICommand (tc:command) or a UIForm (tc:form) with a UICommand"
- + " for a resize-action",
+ description ="Deprecated name for 'resize'",
allowedChildComponenents = {"org.apache.myfaces.tobago.Command", "org.apache.myfaces.tobago.Form"}),
@Facet(name = Facets.MENUBAR, description = "Menubar",
allowedChildComponenents = "javax.faces.component.UIPanel"), //fake
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml?rev=1073279&r1=1073278&r2=1073279&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.xhtml Tue Feb 22 10:02:47 2011
@@ -22,8 +22,10 @@
xmlns:tx="http://myfaces.apache.org/tobago/extension"
xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view locale="#{clientConfigController.locale}">
- <tc:page applicationIcon="icon/favicon.ico" label="#{overviewBundle.pageTitle} - #{title}" id="page" width="1000px"
- height="750px">
+ <tc:page applicationIcon="icon/favicon.ico" label="#{overviewBundle.pageTitle} - #{title}" id="page">
+ <f:facet name="resize">
+ <tc:command immediate="true"/>
+ </f:facet>
<f:facet name="menuBar">
<tc:menuBar>
Modified: myfaces/tobago/trunk/tobago-theme/tobago-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/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=1073279&r1=1073278&r2=1073279&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Tue Feb 22 10:02:47 2011
@@ -33,9 +33,11 @@ import org.apache.myfaces.tobago.context
import org.apache.myfaces.tobago.context.Theme;
import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.internal.ajax.AjaxInternalUtils;
+import org.apache.myfaces.tobago.internal.component.AbstractUICommandBase;
import org.apache.myfaces.tobago.internal.component.AbstractUIPage;
import org.apache.myfaces.tobago.internal.layout.LayoutContext;
import org.apache.myfaces.tobago.internal.util.AccessKeyMap;
+import org.apache.myfaces.tobago.internal.util.Deprecation;
import org.apache.myfaces.tobago.internal.util.FastStringWriter;
import org.apache.myfaces.tobago.internal.util.MimeTypeUtils;
import org.apache.myfaces.tobago.internal.util.ResponseUtils;
@@ -47,6 +49,7 @@ import org.apache.myfaces.tobago.renderk
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
+import org.apache.myfaces.tobago.renderkit.html.util.CommandRendererHelper;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
import org.apache.myfaces.tobago.util.ComponentUtils;
@@ -319,16 +322,31 @@ public class PageRenderer extends PageRe
+ client.getHorizontalScrollbarWeight().getPixel() + "');");
}
+ UIComponent command = null;
if (component.getFacets().containsKey(Facets.RESIZE_ACTION)) {
+ Deprecation.LOG.warn("Please use 'resize' instead of 'resizeAction' as facet.");
UIComponent facet = component.getFacet(Facets.RESIZE_ACTION);
- UIComponent command = null;
if (facet instanceof UICommand) {
command = facet;
} else if (facet instanceof UIForm && facet.getChildCount() == 1) {
+ Deprecation.LOG.warn("Please don't use a form, but a command with immediate=true instead.");
command = (UIComponent) facet.getChildren().get(0);
}
- if (command != null && command.isRendered()) {
- writer.writeJavascript("Tobago.resizeActionId = '" + command.getClientId(facesContext) + "';");
+ }
+
+ if (component.getFacets().containsKey(Facets.RESIZE)) {
+ UIComponent facet = component.getFacet(Facets.RESIZE);
+ if (facet instanceof UICommand) {
+ command = facet;
+ } else if (facet instanceof UIForm && facet.getChildCount() == 1) {
+ Deprecation.LOG.warn("Please don't use a form, but a command with immediate=true instead.");
+ command = (UIComponent) facet.getChildren().get(0);
+ }
+ }
+ if (command != null && command.isRendered()) {
+ final CommandRendererHelper helper = new CommandRendererHelper(facesContext, (AbstractUICommandBase) command);
+ if (!helper.isDisabled()) {
+ writer.writeJavascript("Tobago.resizeAction = function() {\n" + helper.getOnclick() + "\n};\n");
}
}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-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/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1073279&r1=1073278&r2=1073279&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Tue Feb 22 10:02:47 2011
@@ -116,9 +116,10 @@ var Tobago = {
lastFocusId: undefined,
/**
- * The id of the action which should be executed when the window was resized.
+ * The resize action is a function which should be executed when the window was resized.
+ * Can be defined as facet in the page.
*/
- resizeActionId: undefined,
+ resizeAction: undefined,
resizeEventCount: 0,
htmlIdIndex: 0,
@@ -279,8 +280,8 @@ var Tobago = {
this.addBindEventListener(document, 'keypress', this.acceleratorKeys, 'observe');
- if (Tobago.resizeActionId) {
- // firebug submits an onresize event
+ if (Tobago.resizeAction) {
+ // firefox submits an onresize event
window.setTimeout(Tobago.registerResizeAction, 1000);
}
@@ -1041,7 +1042,7 @@ var Tobago = {
resizePageAction: function() {
Tobago.resizeEventCount--;
if (Tobago.resizeEventCount == 0) {
- Tobago.submitAction(Tobago.resizeActionId);
+ Tobago.resizeAction();
}
},