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 2012/03/27 10:31:10 UTC
svn commit: r1305777 - in /myfaces/tobago/branches/tobago-tree-table: ./
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/
tobago-example/tobago-example-test/...
Author: lofwyr
Date: Tue Mar 27 08:31:10 2012
New Revision: 1305777
URL: http://svn.apache.org/viewvc?rev=1305777&view=rev
Log:
merged with trunk
Added:
myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-test/src/main/webapp/tc/popup/popup-bug-tobago-1103.xhtml
- copied unchanged from r1305765, myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/popup/popup-bug-tobago-1103.xhtml
myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/tc/popup/BugTobago1103SeleniumTest.java
- copied unchanged from r1305765, myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/tc/popup/BugTobago1103SeleniumTest.java
Modified:
myfaces/tobago/branches/tobago-tree-table/ (props changed)
myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.tag
myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/MultiSuffixSeleniumTest.java
myfaces/tobago/branches/tobago-tree-table/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
myfaces/tobago/branches/tobago-tree-table/tobago-extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java
myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie_6_0/script/tobago.js
myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js
myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js
myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tree.js
myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Propchange: myfaces/tobago/branches/tobago-tree-table/
------------------------------------------------------------------------------
Merged /myfaces/tobago/trunk:r1302963-1305765
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java?rev=1305777&r1=1305776&r2=1305777&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java Tue Mar 27 08:31:10 2012
@@ -411,17 +411,13 @@ public abstract class AbstractUISheet ex
public void queueEvent(FacesEvent facesEvent) {
UIComponent parent = getParent();
if (parent == null) {
- throw new IllegalStateException(
- "component is not a descendant of a UIViewRoot");
+ throw new IllegalStateException("Component is not a descendant of a UIViewRoot");
}
if (facesEvent.getComponent() == this
&& (facesEvent instanceof SheetStateChangeEvent
|| facesEvent instanceof PageActionEvent)) {
facesEvent.setPhaseId(PhaseId.INVOKE_APPLICATION);
- if (LOG.isInfoEnabled()) {
- LOG.info("queueEvent = '" + facesEvent + "'");
- }
parent.queueEvent(facesEvent);
} else {
UIComponent source = facesEvent.getComponent();
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.tag
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.tag?rev=1305777&r1=1305776&r2=1305777&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.tag (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tags/layout/overview.tag Tue Mar 27 08:31:10 2012
@@ -76,9 +76,7 @@
<tc:messages/>
<tc:box label="(Label doesn't work in the JSP version) #{title}">
- <f:subview id="content">
- <jsp:doBody/>
- </f:subview>
+ <jsp:doBody/>
</tc:box>
<tc:cell>
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/MultiSuffixSeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/MultiSuffixSeleniumTest.java?rev=1305777&r1=1305776&r2=1305777&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/MultiSuffixSeleniumTest.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/MultiSuffixSeleniumTest.java Tue Mar 27 08:31:10 2012
@@ -43,4 +43,8 @@ public abstract class MultiSuffixSeleniu
new Object[]{"jspx"}
);
}
+
+ public boolean isFacelet() {
+ return suffix.equals("xhtml");
+ }
}
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java?rev=1305777&r1=1305776&r2=1305777&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java Tue Mar 27 08:31:10 2012
@@ -18,6 +18,7 @@ package org.apache.myfaces.tobago.facele
*/
import com.sun.facelets.FaceletContext;
+import com.sun.facelets.tag.TagAttribute;
import com.sun.facelets.tag.jsf.ComponentConfig;
import com.sun.facelets.tag.jsf.ComponentSupport;
import org.apache.myfaces.tobago.component.OnComponentCreated;
@@ -31,8 +32,11 @@ import javax.faces.component.UIViewRoot;
public class DateExtensionHandler extends TobagoLabelExtensionHandler {
+ private TagAttribute pickerIdAttribute;
+
public DateExtensionHandler(ComponentConfig config) {
super(config);
+ pickerIdAttribute = getAttribute("pickerId");
}
protected String getSubComponentType() {
@@ -50,8 +54,14 @@ public class DateExtensionHandler extend
UIDatePicker picker = (UIDatePicker) application.createComponent(UIDatePicker.COMPONENT_TYPE);
picker.setRendererType(RendererTypes.DATE_PICKER);
picker.setFor("@auto");
- UIViewRoot root = ComponentSupport.getViewRoot(faceletContext, parent);
- picker.setId(root.createUniqueId());
+ final String id;
+ if (pickerIdAttribute != null) {
+ id = pickerIdAttribute.getValue(faceletContext);
+ } else {
+ UIViewRoot root = ComponentSupport.getViewRoot(faceletContext, parent);
+ id = root.createUniqueId();
+ }
+ picker.setId(id);
if (picker.getAttributes().get(OnComponentCreated.MARKER) == null) {
picker.getAttributes().put(OnComponentCreated.MARKER, Boolean.TRUE);
picker.onComponentCreated(faceletContext.getFacesContext(), panel);
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java?rev=1305777&r1=1305776&r2=1305777&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java Tue Mar 27 08:31:10 2012
@@ -75,6 +75,7 @@ public class DateExtensionTag extends To
private javax.el.ValueExpression converterMessage;
private javax.el.ValueExpression requiredMessage;
private String fieldId;
+ private String pickerId;
private javax.el.ValueExpression labelWidth;
private LabelExtensionTag labelTag;
@@ -189,6 +190,9 @@ public class DateExtensionTag extends To
datePicker.setTabIndex(tabIndex);
}
datePicker.setParent(formTag);
+ if (pickerId != null) {
+ datePicker.setId(pickerId);
+ }
datePicker.setJspId(jspId + PREFIX + idSuffix++);
datePicker.doStartTag();
datePicker.doEndTag();
@@ -224,6 +228,7 @@ public class DateExtensionTag extends To
converterMessage = null;
requiredMessage = null;
fieldId = null;
+ pickerId = null;
}
/**
@@ -444,6 +449,16 @@ public class DateExtensionTag extends To
}
/**
+ * The component identifier for the input field component inside of the container.
+ * This value must be unique within the closest parent component that is a naming container.
+ */
+ @TagAttribute(rtexprvalue = true)
+ @UIComponentTagAttribute
+ public void setPickerId(String pickerId) {
+ this.pickerId = pickerId;
+ }
+
+ /**
* The component identifier for this component.
* This value must be unique within the closest parent component that is a naming container.
* For tx components the id will be set to the container (e. g. the panel).
Modified: myfaces/tobago/branches/tobago-tree-table/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/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=1305777&r1=1305776&r2=1305777&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Tue Mar 27 08:31:10 2012
@@ -653,8 +653,6 @@ public class PageRenderer extends PageRe
logMessages.add(0, "LOG.show();");
}
- logMessages.add("LOG.info(\"FacesContext = " + facesContext + "\");");
-
HtmlRendererUtils.writeScriptLoader(facesContext, null,
logMessages.toArray(new String[logMessages.size()]));
}
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie_6_0/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie_6_0/script/tobago.js?rev=1305777&r1=1305776&r2=1305777&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie_6_0/script/tobago.js (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie_6_0/script/tobago.js Tue Mar 27 08:31:10 2012
@@ -94,5 +94,5 @@ Tobago.fixSelectionOnFocus = function()
}
};
-Tobago.registerCallback(Tobago.fixPngAlphaAll, Tobago.Phase.WINDOW_LOAD);
-Tobago.registerCallback(Tobago.fixPngAlphaAll, Tobago.Phase.AFTER_UPDATE);
+Tobago.registerListener(Tobago.fixPngAlphaAll, Tobago.Phase.WINDOW_LOAD);
+Tobago.registerListener(Tobago.fixPngAlphaAll, Tobago.Phase.AFTER_UPDATE);
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js?rev=1305777&r1=1305776&r2=1305777&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js Tue Mar 27 08:31:10 2012
@@ -315,5 +315,5 @@ jQuery.tobagoMenuParent = function(eleme
});
})(jQuery);
-Tobago.registerCallback(Tobago.Menu.init, Tobago.Phase.DOCUMENT_READY);
-Tobago.registerCallback(Tobago.Menu.init, Tobago.Phase.AFTER_UPDATE);
+Tobago.registerListener(Tobago.Menu.init, Tobago.Phase.DOCUMENT_READY);
+Tobago.registerListener(Tobago.Menu.init, Tobago.Phase.AFTER_UPDATE);
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js?rev=1305777&r1=1305776&r2=1305777&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js Tue Mar 27 08:31:10 2012
@@ -37,7 +37,7 @@ Tobago.Popup.setup = function () {
var maxZIndex = -Infinity;
var maxModalPopup = null;
jQuery('.tobago-popup-markup-modal').each(function () {
- var zIndex = jQuery(this).css('z-index');
+ var zIndex = parseInt(jQuery(this).css('z-index'));
if (zIndex >= maxZIndex) {
maxZIndex = zIndex;
maxModalPopup = jQuery(this);
@@ -86,55 +86,46 @@ Tobago.Popup.setup = function () {
*/
Tobago.Popup.lockBehind = function (popup) {
// disable all elements and anchors on page not initially disabled and
- // store their ids in a hidden field
+ // store their ids in a data attribute of the popup
var id = popup.id;
- var hidden = Tobago.element(id + Tobago.SUB_COMPONENT_SEP + 'disabledElements');
- if (hidden == null) {
- hidden = document.createElement('input');
- hidden.id = id + Tobago.SUB_COMPONENT_SEP + 'disabledElements';
- hidden.type = 'hidden';
- popup.appendChild(hidden);
- }
- hidden.value = ',';
- var firstPopupElement = null;
- var elements = document.forms[0].elements;
- var element;
- for (var i = 0; i < elements.length; i++) {
- element = elements[i];
- if (element.type != 'hidden' && !element.disabled) {
- if (element.id) {
- if (element.id.indexOf(id + ':') != 0) { // not starts with
- element.disabled = true;
- hidden.value += element.id + ',';
- } else {
- if (firstPopupElement == null && jQuery.isFunction(element.focus)) {
- firstPopupElement = element;
- }
- }
+ // The attribute might be set by the last call, this may happen, when opening a non-modal popup on a modal popup.
+ if (jQuery(popup).data('tobago-disabledElements') == null) {
+ var disabledElements = jQuery();
+ var firstPopupElement = null;
+// var pageElements = jQuery(document.forms[0].elements);
+ var pageElements = jQuery("form:first :input");
+
+ // disable all active and visible page elements except the popup elements
+ pageElements.each(function () {
+ var element = jQuery(this);
+ if (element.prop("disabled")) {
+ return;
}
- }
- }
- var anchors = document.getElementsByTagName('a');
- for (i = 0; i < anchors.length; i++) {
- element = anchors[i];
- if (!element.disabled) {
- if (element.id) {
- if (element.id.indexOf(id + ':') != 0) { // not starts with
- element.disabled = true;
- hidden.value += element.id + ',';
- } else {
- if (firstPopupElement == null && jQuery.isFunction(element.focus)) {
- firstPopupElement = element;
- }
+ if (element.attr("type") == "hidden") {
+ return;
+ }
+ if (element[0].tagName.toLowerCase() == "form") {
+ return;
+ }
+ var fieldId = element.attr("id");
+ if (fieldId != null && fieldId.indexOf(id + ':') == 0) { // starts with means, is in popup
+ if (firstPopupElement == null && jQuery.isFunction(element.focus)) {
+ firstPopupElement = element;
}
+ } else {
+ element.prop({disabled:true}); // disable element
+ jQuery.merge(disabledElements, jQuery(element)); // store it for reactivation
+ }
+ });
+ jQuery(popup).data('tobago-disabledElements', disabledElements);
+
+ // find the first element in the popup for the focus
+ if (firstPopupElement != null) {
+ try {
+ firstPopupElement.focus();
+ } catch (e) {/* ignore */
+ LOG.warn("tried to setting the focus on'" + this + "'." + e); // @DEV_ONLY
}
- }
- }
- // set focus to first element in popup
- if (firstPopupElement != null) {
- try {
- firstPopupElement.focus();
- } catch (e) {/* ignore */
}
}
};
@@ -153,40 +144,37 @@ Tobago.Popup.blink = function (element)
* remove a popup without request
*/
Tobago.Popup.close = function (closeButton) {
- Tobago.Popup.unlockBehind();
var popup = jQuery(closeButton).parents('div.tobago-popup:first');
- popup.remove();
- var maxModalPopup = jQuery('.tobago-popup-shield').filter(":last");
- maxModalPopup.css({visibility:"visible"});
+ if (popup.hasClass("tobago-popup-markup-modal")) {
+ Tobago.Popup.unlockBehind(popup);
+ popup.remove();
+ var maxModalPopup = jQuery('.tobago-popup-shield').filter(":last");
+ maxModalPopup.css({visibility:"visible"});
+ } else {
+ popup.remove();
+ }
};
/**
* Unlock the parent page of a popup when it is closed
+ * @param popups The popups as jQuery object.
*/
-Tobago.Popup.unlockBehind = function () {
- var maxModalPopup = jQuery('.tobago-popup-shield').filter(":last").parent();
- if (maxModalPopup.size() == 0) { // there is no modal popup
- return;
- }
- var id = maxModalPopup.attr('id');
- // enable all elements and anchors on page stored in a hidden field
- var element;
- var hidden = Tobago.element(id + Tobago.SUB_COMPONENT_SEP + 'disabledElements');
- if (hidden != null && hidden.value != '') {
- for (var i = 0; i < document.forms[0].elements.length; i++) {
- element = document.forms[0].elements[i];
- if (hidden.value.indexOf(',' + element.id + ',') >= 0) {
- element.disabled = false;
- }
- }
- var anchors = document.getElementsByTagName('a');
- for (i = 0; i < anchors.length; i++) {
- element = anchors[i];
- if (hidden.value.indexOf(',' + element.id + ',') >= 0) {
- element.disabled = false;
- }
+Tobago.Popup.unlockBehind = function (popups) {
+ if (popups == null) {
+ LOG.warn("Since Tobago 1.5.5 Tobago.Popup.unlockBehind() has the popup as parameter"); // @DEV_ONLY
+ popups = jQuery('.tobago-popup-shield').filter(":last").parent();
+ }
+ popups.each(function() {
+ // re-enable all elements and anchors on page stored in the attribute
+ var popup = jQuery(this);
+ var disabledElements = popup.data('tobago-disabledElements');
+ if (disabledElements != null) {
+ disabledElements.each(function() {
+ jQuery(this).prop({disabled: false});
+ });
+ jQuery(popup).removeData('tobago-disabledElements');
}
- }
+ });
};
Tobago.Popup.openWithAction = function (source, popupId, actionId, options) {
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tree.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tree.js?rev=1305777&r1=1305776&r2=1305777&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tree.js (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-tree.js Tue Mar 27 08:31:10 2012
@@ -201,5 +201,5 @@ Tobago.Tree.rowIndex = function (node) {
return node.attr("id").replace(/.+\:(\d+)(\:\w+)+/, '$1');
};
-Tobago.registerCallback(Tobago.Tree.init, Tobago.Phase.DOCUMENT_READY);
-Tobago.registerCallback(Tobago.Tree.init, Tobago.Phase.AFTER_UPDATE);
+Tobago.registerListener(Tobago.Tree.init, Tobago.Phase.DOCUMENT_READY);
+Tobago.registerListener(Tobago.Tree.init, Tobago.Phase.AFTER_UPDATE);
Modified: myfaces/tobago/branches/tobago-tree-table/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/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1305777&r1=1305776&r2=1305777&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Tue Mar 27 08:31:10 2012
@@ -78,25 +78,25 @@ var Tobago = {
/**
* the html body object of current page.
- * set via init function (onload attribute of body)
+ * set via init function
*/
page: null,
/**
* The html form object of current page.
- * set via init function (onload attribute of body)
+ * set via init function
*/
form: null,
/**
* The hidden html input object for submitted actionId.
- * set via init function (onload attribute of body)
+ * set via init function
*/
action: null,
/**
* The hidden html input object for the contextPath.
- * set via init function (onload attribute of body)
+ * set via init function
*/
contextPath: null,
@@ -234,7 +234,7 @@ var Tobago = {
initMarker: false,
- callbacks: {
+ listeners: {
documentReady: [],
windowLoad: [],
afterUpdate: []
@@ -242,14 +242,14 @@ var Tobago = {
// -------- Functions -------------------------------------------------------
- registerCallback: function(callback, phase) {
+ registerListener: function(listener, phase) {
if (Tobago.Phase.DOCUMENT_READY == phase) {
- Tobago.callbacks.documentReady.push(callback);
+ Tobago.listeners.documentReady.push(listener);
} else if (Tobago.Phase.WINDOW_LOAD == phase) {
- Tobago.callbacks.windowLoad.push(callback);
+ Tobago.listeners.windowLoad.push(listener);
} else if (Tobago.Phase.AFTER_UPDATE == phase) {
- Tobago.callbacks.afterUpdate.push(callback);
+ Tobago.listeners.afterUpdate.push(listener);
} else {
LOG.error("Unknown phase: " + phase); // @DEV_ONLY
}
@@ -266,15 +266,15 @@ var Tobago = {
}
this.initMarker = true;
- var pageId = jQuery("body").attr("id");
// new LOG.LogArea({hide: false});
// LOG.show();
if (TbgTimer.endBody) { // @DEV_ONLY
TbgTimer.startOnload = new Date(); // @DEV_ONLY
} // @DEV_ONLY
- this.page = this.element(pageId);
- this.form = this.element(this.page.id + this.SUB_COMPONENT_SEP + 'form');
+ var body = jQuery("body");
+ this.page = body.get(0);
+ this.form = body.find("form").get(0); // find() seems to be faster than children()
this.addBindEventListener(this.form, 'submit', this, 'onSubmit');
this.action = this.element(this.page.id + this.SUB_COMPONENT_SEP + 'form-action');
this.contextPath = this.element(this.page.id + this.SUB_COMPONENT_SEP + 'context-path');
@@ -283,8 +283,8 @@ var Tobago = {
this.addBindEventListener(window, 'unload', this, 'onUnload');
- for (var i = 0; i < Tobago.callbacks.documentReady.length; i++) {
- Tobago.callbacks.documentReady[i]();
+ for (var i = 0; i < Tobago.listeners.documentReady.length; i++) {
+ Tobago.listeners.documentReady[i]();
}
if (TbgTimer.endBody) { // @DEV_ONLY
@@ -351,7 +351,7 @@ var Tobago = {
clientDimension.value = jQuery("body").width() + ';' + jQuery("body").height();
this.form.appendChild(clientDimension);
- Tobago.Popup.unlockBehind();
+ Tobago.Popup.unlockBehind(jQuery(".tobago-popup-markup-modal"));
Tobago.onBeforeUnload();
@@ -1508,8 +1508,8 @@ jQuery(document).ready(function() {
});
jQuery(window).load(function() {
- for (var i = 0; i < Tobago.callbacks.windowLoad.length; i++) {
- Tobago.callbacks.windowLoad[i]();
+ for (var i = 0; i < Tobago.listeners.windowLoad.length; i++) {
+ Tobago.listeners.windowLoad[i]();
}
});
@@ -1714,8 +1714,8 @@ Tobago.Panel.prototype.prepareReload = f
Tobago.createOverlay(jQuery(Tobago.Utils.escapeClientId(this.id)));
};
-Tobago.registerCallback(Tobago.Panel.init, Tobago.Phase.DOCUMENT_READY);
-Tobago.registerCallback(Tobago.Panel.init, Tobago.Phase.AFTER_UPDATE);
+Tobago.registerListener(Tobago.Panel.init, Tobago.Phase.DOCUMENT_READY);
+Tobago.registerListener(Tobago.Panel.init, Tobago.Phase.AFTER_UPDATE);
Tobago.EventListener = function(element, event, func) {
this.element = element;
@@ -2263,8 +2263,8 @@ Tobago.Updater = {
}
if (data.html.length > 0) {
- for (var i = 0; i < Tobago.callbacks.afterUpdate.length; i++) {
- Tobago.callbacks.afterUpdate[i](newElement);
+ for (var i = 0; i < Tobago.listeners.afterUpdate.length; i++) {
+ Tobago.listeners.afterUpdate[i](newElement);
}
}
} catch (e) {
@@ -2410,8 +2410,8 @@ Tobago.ToolBar.setRadioValue = function(
element.value = value;
};
-Tobago.registerCallback(Tobago.ToolBar.init, Tobago.Phase.DOCUMENT_READY);
-Tobago.registerCallback(Tobago.ToolBar.init, Tobago.Phase.AFTER_UPDATE);
+Tobago.registerListener(Tobago.ToolBar.init, Tobago.Phase.DOCUMENT_READY);
+Tobago.registerListener(Tobago.ToolBar.init, Tobago.Phase.AFTER_UPDATE);
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// TabGroup
@@ -2520,8 +2520,8 @@ Tobago.TabGroup.ensureScrollPosition = f
}
};
-Tobago.registerCallback(Tobago.TabGroup.init, Tobago.Phase.DOCUMENT_READY);
-Tobago.registerCallback(Tobago.TabGroup.init, Tobago.Phase.AFTER_UPDATE);
+Tobago.registerListener(Tobago.TabGroup.init, Tobago.Phase.DOCUMENT_READY);
+Tobago.registerListener(Tobago.TabGroup.init, Tobago.Phase.AFTER_UPDATE);
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -2572,8 +2572,8 @@ Tobago.SelectManyShuttle.copyValues = fu
.attr('selected', 'selected').appendTo(hidden);
};
-Tobago.registerCallback(Tobago.SelectManyShuttle.init, Tobago.Phase.DOCUMENT_READY);
-Tobago.registerCallback(Tobago.SelectManyShuttle.init, Tobago.Phase.AFTER_UPDATE);
+Tobago.registerListener(Tobago.SelectManyShuttle.init, Tobago.Phase.DOCUMENT_READY);
+Tobago.registerListener(Tobago.SelectManyShuttle.init, Tobago.Phase.AFTER_UPDATE);
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////