You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2013/05/10 10:10:32 UTC
svn commit: r1480917 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/
tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
tobago-theme/tobago-t...
Author: weber
Date: Fri May 10 08:10:32 2013
New Revision: 1480917
URL: http://svn.apache.org/r1480917
Log:
TOBAGO-1264 - Post ClientDimension also in partial requests
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java
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/renderkit/PageRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java?rev=1480917&r1=1480916&r2=1480917&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java Fri May 10 08:10:32 2013
@@ -79,7 +79,7 @@ public class PageRendererBase extends La
try {
name = page.getClientId(facesContext) + ComponentUtils.SUB_SEPARATOR + "form-clientDimension";
value = (String) facesContext.getExternalContext().getRequestParameterMap().get(name);
- if (value != null) {
+ if (StringUtils.isNotBlank(value)) {
StringTokenizer tokenizer = new StringTokenizer(value, ";");
Measure width = Measure.parse(tokenizer.nextToken());
Measure height = Measure.parse(tokenizer.nextToken());
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=1480917&r1=1480916&r2=1480917&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 Fri May 10 08:10:32 2013
@@ -357,6 +357,12 @@ public class PageRenderer extends PageRe
writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "action-position");
writer.endElement(HtmlElements.INPUT);
+ writer.startElement(HtmlElements.INPUT, null);
+ writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
+ writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "form-clientDimension");
+ writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "form-clientDimension");
+ writer.endElement(HtmlElements.INPUT);
+
boolean calculateScrollbarWeight =
client.getVerticalScrollbarWeight() == null || client.getHorizontalScrollbarWeight() == null;
@@ -615,7 +621,7 @@ public class PageRenderer extends PageRe
if (!eventFunctions.isEmpty()) {
writer.write("Tobago.applicationOn");
writer.write(event);
- writer.write(" = function() {\n");
+ writer.write(" = function(listenerOptions) {\n");
if (returnBoolean) {
writer.write(" var result;\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=1480917&r1=1480916&r2=1480917&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 Fri May 10 08:10:32 2013
@@ -383,9 +383,8 @@ var Tobago = {
this.form.removeChild(hidden);
}
this.isSubmit = true;
- var clientDimension = this.createInput('hidden', this.page.id + this.SUB_COMPONENT_SEP + 'form-clientDimension');
- clientDimension.value = jQuery("body").width() + ';' + jQuery("body").height();
- this.form.appendChild(clientDimension);
+
+ Tobago.storeClientDimension();
Tobago.Popup.unlockBehind(jQuery(".tobago-popup-markup-modal"));
@@ -394,6 +393,13 @@ var Tobago = {
return true;
},
+ storeClientDimension: function() {
+ var body = jQuery("body");
+ body.children("form").first()
+ .children(Tobago.Utils.escapeClientId(this.page.id + this.SUB_COMPONENT_SEP + 'form-clientDimension'))
+ .val(body.width() + ';' + body.height());
+ },
+
onBeforeUnload: function() {
if (Tobago.transition) {
Tobago.createOverlay(jQuery("body"), false, false);
@@ -2160,6 +2166,8 @@ Tobago.Updater = {
Tobago.partialRequestIds = hidden;
}
+ Tobago.storeClientDimension();
+
var error = !Tobago.Transport.ajaxTransport.request(requestOptions);
if (error) {
@@ -2549,34 +2557,34 @@ Tobago.TabGroup.init = function(elements
// initialize the tab header elements
// client case
tabGroups.filter("[switchType='client']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
- var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
- jQuery(this).siblings(".tobago-tab-markup-selected").removeClass("tobago-tab-markup-selected");
- jQuery(this).addClass("tobago-tab-markup-selected");
- var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
- tabGroup.children(".tobago-tab-content-markup-selected").removeClass("tobago-tab-content-markup-selected");
- tabGroup.children(".tobago-tab-content[tabgroupindex=" + activeIndex + "]")
- .addClass("tobago-tab-content-markup-selected");
- // scroll the tabs, if necessary
- var header = jQuery(this).parents(".tobago-tabGroup-header:first");
- Tobago.TabGroup.ensureScrollPosition(header);
+ var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
+ jQuery(this).siblings(".tobago-tab-markup-selected").removeClass("tobago-tab-markup-selected");
+ jQuery(this).addClass("tobago-tab-markup-selected");
+ var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+ tabGroup.children(".tobago-tab-content-markup-selected").removeClass("tobago-tab-content-markup-selected");
+ tabGroup.children(".tobago-tab-content[tabgroupindex=" + activeIndex + "]")
+ .addClass("tobago-tab-content-markup-selected");
+ // scroll the tabs, if necessary
+ var header = jQuery(this).parents(".tobago-tabGroup-header:first");
+ Tobago.TabGroup.ensureScrollPosition(header);
});
// initialize the tab header elements
// reload tab case
tabGroups.filter("[switchType='reloadTab']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
- var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
- LOG.debug("todo: ajax reload, activeIndex=" + activeIndex); // @DEV_ONLY
- var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
- Tobago.Updater.update(tabGroup, tabGroup.attr("id"), tabGroup.attr("id"), {});
+ var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
+ LOG.debug("todo: ajax reload, activeIndex=" + activeIndex); // @DEV_ONLY
+ var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+ Tobago.Updater.update(tabGroup, tabGroup.attr("id"), tabGroup.attr("id"), {});
});
// initialize the tab header elements
// reload page case
tabGroups.filter("[switchType='reloadPage']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
- var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
- LOG.debug("todo: full reload, activeIndex=" + activeIndex); // @DEV_ONLY
- var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
- Tobago.submitAction(tabGroup.eq(0), tabGroup.attr("id"));
+ var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
+ LOG.debug("todo: full reload, activeIndex=" + activeIndex); // @DEV_ONLY
+ var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
+ Tobago.submitAction(tabGroup.eq(0), tabGroup.attr("id"));
});
// initialize previous button
@@ -2641,13 +2649,13 @@ Tobago.TabGroup.updateHidden = function(
Tobago.TabGroup.ensureScrollPosition = function (header) {
var tab = header.find(".tobago-tab-markup-selected");
- var tabRight = tab.position().left + tab.outerWidth() - header.outerWidth();
- if (tabRight > 0) {
- header.scrollLeft(header.scrollLeft() + tabRight + 1); // +1 to avoid rounding problems
- }
- var tabLeft = tab.position().left;
- if (tabLeft < 0) {
- header.scrollLeft(header.scrollLeft() + tabLeft);
+ var tabRight = tab.position().left + tab.outerWidth() - header.outerWidth();
+ if (tabRight > 0) {
+ header.scrollLeft(header.scrollLeft() + tabRight + 1); // +1 to avoid rounding problems
+ }
+ var tabLeft = tab.position().left;
+ if (tabLeft < 0) {
+ header.scrollLeft(header.scrollLeft() + tabLeft);
}
};