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/09/05 21:09:34 UTC
svn commit: r1381302 - in /myfaces/tobago/trunk/tobago-theme:
tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/st...
Author: lofwyr
Date: Wed Sep 5 19:09:33 2012
New Revision: 1381302
URL: http://svn.apache.org/viewvc?rev=1381302&view=rev
Log:
TOBAGO-1184: Support for initializing components without javascript fragments
Modified:
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.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-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.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/SelectManyCheckboxRenderer.java?rev=1381302&r1=1381301&r2=1381302&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java Wed Sep 5 19:09:33 2012
@@ -94,9 +94,6 @@ public class SelectManyCheckboxRenderer
HtmlRendererUtils.renderFocus(id, select.isFocus(), ComponentUtils.isError(select), facesContext, writer);
first = false;
}
- if (readonly) {
- writer.writeAttribute(HtmlAttributes.ONCLICK, "this.checked=" + checked, false);
- }
Integer tabIndex = select.getTabIndex();
if (tabIndex != null) {
writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.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/SelectOneListboxRenderer.java?rev=1381302&r1=1381301&r2=1381302&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java Wed Sep 5 19:09:33 2012
@@ -19,7 +19,6 @@
package org.apache.myfaces.tobago.renderkit.html.scarborough.standard.tag;
-import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.UISelectOneListbox;
import org.apache.myfaces.tobago.renderkit.SelectOneRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Classes;
@@ -79,10 +78,6 @@ public class SelectOneListboxRenderer ex
writer.writeClassAttribute(Classes.create(select));
HtmlRendererUtils.renderTip(select, writer);
writer.writeAttribute(HtmlAttributes.SIZE, 9); // must be > 1, but the real size comes from the layout
- if (!ComponentUtils.getBooleanAttribute(select, Attributes.REQUIRED)) {
- writer.writeAttribute(HtmlAttributes.ONCHANGE, "Tobago.selectOneListboxChange(this)", false);
- writer.writeAttribute(HtmlAttributes.ONCLICK, "Tobago.selectOneListboxClick(this)", false);
- }
HtmlRendererUtils.renderCommandFacet(select, facesContext, writer);
Object[] values = {select.getValue()};
HtmlRendererUtils.renderSelectItems(select, items, values, writer, facesContext);
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=1381302&r1=1381301&r2=1381302&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 Wed Sep 5 19:09:33 2012
@@ -875,11 +875,9 @@ var Tobago = {
},
-// -------- SelectOne functions ----------------------------------------------------
- // TODO move SelectOne function in Tobago.SelectOne object
-
/**
* Onchange function for SelectOneListbox.
+ * @deprecated since Tobago 1.6.0. Is replaces with SelectOneListbox.init()
*/
selectOneListboxChange: function(element) {
if (element.oldValue == undefined) {
@@ -889,6 +887,7 @@ var Tobago = {
/**
* Onclick function for SelectOneListbox.
+ * @deprecated since Tobago 1.6.0. Is replaces with SelectOneListbox.init()
*/
selectOneListboxClick: function(element) {
if (element.oldValue == undefined || element.oldValue == element.selectedIndex) {
@@ -899,6 +898,7 @@ var Tobago = {
/**
* Init function for SelectOneRadio.
+ * @deprecated since Tobago 1.6.0. Is replaces with SelectOneRadio.init()
*/
selectOneRadioInit: function(name) {
var elements = document.getElementsByName(name);
@@ -909,6 +909,7 @@ var Tobago = {
/**
* Onclick function for SelectOneRadio.
+ * @deprecated since Tobago 1.6.0. Is replaces with SelectOneRadio.init()
*/
selectOneRadioClick: function(element, name, required, readonly) {
var elements = document.getElementsByName(name);
@@ -2677,6 +2678,8 @@ Tobago.SelectManyShuttle.copyValues = fu
Tobago.registerListener(Tobago.SelectManyShuttle.init, Tobago.Phase.DOCUMENT_READY);
Tobago.registerListener(Tobago.SelectManyShuttle.init, Tobago.Phase.AFTER_UPDATE);
+// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
Tobago.SelectOneRadio = {};
Tobago.SelectOneRadio.init = function(elements) {
@@ -2722,6 +2725,32 @@ Tobago.registerListener(Tobago.SelectOne
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Tobago.SelectOneListbox = {};
+
+Tobago.SelectOneListbox.init = function (elements) {
+ var selects = Tobago.Utils.selectWidthJQuery(elements, ".tobago-selectOneListbox");
+ var notRequired = selects.not(".tobago-selectOneListbox-markup-required");
+ notRequired
+ .change(function () {
+ var element = jQuery(this);
+ if (element.data("tobago-oldvalue") == undefined) {
+ element.data("tobago-oldvalue", -1);
+ }
+ }).click(function () {
+ var element = jQuery(this);
+ if (element.data("tobago-oldvalue") == undefined
+ || element.data("tobago-oldvalue") == element.prop("selectedIndex")) {
+ element.prop("selectedIndex", -1);
+ }
+ element.data("tobago-oldvalue", element.prop("selectedIndex"));
+ });
+};
+
+Tobago.registerListener(Tobago.SelectOneListbox.init, Tobago.Phase.DOCUMENT_READY);
+Tobago.registerListener(Tobago.SelectOneListbox.init, Tobago.Phase.AFTER_UPDATE);
+
+// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
Tobago.SelectBooleanCheckbox = {};
Tobago.SelectBooleanCheckbox.init = function(elements) {
@@ -2740,6 +2769,24 @@ Tobago.registerListener(Tobago.SelectBoo
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+Tobago.SelectManyCheckbox = {};
+
+Tobago.SelectManyCheckbox.init = function(elements) {
+ var checkboxes = Tobago.Utils.selectWidthJQuery(elements, ".tobago-selectManyCheckbox-markup-readonly input");
+ checkboxes.each(function() {
+ // Save the initial state to restore it, when the user tries to manipulate it.
+ var initial = jQuery(this).is(":checked");
+ jQuery(this).click(function() {
+ jQuery(this).attr("checked", initial);
+ });
+ });
+};
+
+Tobago.registerListener(Tobago.SelectManyCheckbox.init, Tobago.Phase.DOCUMENT_READY);
+Tobago.registerListener(Tobago.SelectManyCheckbox.init, Tobago.Phase.AFTER_UPDATE);
+
+// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
Tobago.File = {};
Tobago.File.init = function(elements) {