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 2009/12/13 17:55:32 UTC
svn commit: r890072 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/context/
core/src/main/java/org/apache/myfaces/tobago/util/
core/src/test/java/org/apache/myfaces/tobag...
Author: bommel
Date: Sun Dec 13 16:55:30 2009
New Revision: 890072
URL: http://svn.apache.org/viewvc?rev=890072&view=rev
Log:
merge missing changes from 1.0.x
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheet.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ResourceManagerImpl.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ContentType.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/UISheetUnitTest.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.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/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js
myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java
myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.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.js
myfaces/tobago/trunk/tobago-assembly/src/main/resources/README.txt
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheet.java?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheet.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheet.java Sun Dec 13 16:55:30 2009
@@ -79,7 +79,6 @@
public static final String MULTI = "multi";
public static final int DEFAULT_DIRECT_LINK_COUNT = 9;
public static final int DEFAULT_ROW_COUNT = 100;
- public static final String ROW_IDX_REGEX = "^\\d+" + SEPARATOR_CHAR + ".*";
private SheetState sheetState;
private List<Integer> widthList;
@@ -409,10 +408,23 @@
public UIComponent findComponent(String searchId) {
- if (searchId.matches(ROW_IDX_REGEX)) {
- searchId = searchId.substring(searchId.indexOf(SEPARATOR_CHAR) + 1);
+ return super.findComponent(stripRowIndex(searchId));
+ }
+
+ String stripRowIndex(String searchId) {
+ if (searchId.length() > 0 && Character.isDigit(searchId.charAt(0))) {
+ for (int i = 1; i < searchId.length(); ++i) {
+ char c = searchId.charAt(i);
+ if (c == SEPARATOR_CHAR) {
+ searchId = searchId.substring(i + 1);
+ break;
+ }
+ if (!Character.isDigit(c)) {
+ break;
+ }
+ }
}
- return super.findComponent(searchId);
+ return searchId;
}
public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java Sun Dec 13 16:55:30 2009
@@ -19,6 +19,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.commons.lang.StringUtils;
import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.event.SortActionEvent;
import org.apache.myfaces.tobago.model.SheetState;
@@ -172,8 +173,20 @@
}
}
- private boolean isSimpleProperty(String expressionString) {
- return expressionString.matches("^#\\{(\\w+(\\.\\w)*)\\}$");
+ // XXX needs to be tested
+ // XXX was based on ^#\{(\w+(\.\w)*)\}$ which is wrong, because there is a + missing after the last \w
+ boolean isSimpleProperty(String expressionString) {
+ if (expressionString.startsWith("#{") && expressionString.endsWith("}")) {
+ String inner = expressionString.substring(2, expressionString.length() - 1);
+ String[] parts = StringUtils.split(inner, ".");
+ for (String part : parts) {
+ if (!StringUtils.isAlpha(part)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
}
private void unsetSortableAttribute(UIColumn uiColumn) {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ResourceManagerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ResourceManagerImpl.java?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ResourceManagerImpl.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ResourceManagerImpl.java Sun Dec 13 16:55:30 2009
@@ -27,9 +27,10 @@
import javax.faces.render.Renderer;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
// FIXME: is this class thread-safe?
@@ -40,18 +41,22 @@
private static final String JSP = "jsp";
private static final String TAG = "tag";
- private final HashMap<String, String> resourceList;
+ private final Map<String, String> resourceList = new ConcurrentHashMap<String, String>(100, 0.75f, 1);
- private final HashMap<RendererCacheKey, Renderer> rendererCache = new HashMap<RendererCacheKey, Renderer>();
- private final HashMap<ImageCacheKey, String> imageCache = new HashMap<ImageCacheKey, String>();
- private final HashMap<JspCacheKey, String> jspCache = new HashMap<JspCacheKey, String>();
- private final HashMap<MiscCacheKey, String[]> miscCache = new HashMap<MiscCacheKey, String[]>();
- private final HashMap<PropertyCacheKey, String> propertyCache = new HashMap<PropertyCacheKey, String>();
+ private final Map<RendererCacheKey, Renderer>
+ rendererCache = new ConcurrentHashMap<RendererCacheKey, Renderer>(100, 0.75f, 1);
+ private final Map<ImageCacheKey, String>
+ imageCache = new ConcurrentHashMap<ImageCacheKey, String>(100, 0.75f, 1);
+ private final Map<JspCacheKey, String>
+ jspCache = new ConcurrentHashMap<JspCacheKey, String>(100, 0.75f, 1);
+ private final Map<MiscCacheKey, String[]>
+ miscCache = new ConcurrentHashMap<MiscCacheKey, String[]>(100, 0.75f, 1);
+ private final Map<PropertyCacheKey, String>
+ propertyCache = new ConcurrentHashMap<PropertyCacheKey, String>(100, 0.75f, 1);
private TobagoConfig tobagoConfig;
public ResourceManagerImpl(TobagoConfig tobagoConfig) {
- resourceList = new HashMap<String, String>();
this.tobagoConfig = tobagoConfig;
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java Sun Dec 13 16:55:30 2009
@@ -785,7 +785,7 @@
if (markups instanceof String[]) {
return (String[]) markups;
} else if (markups instanceof String) {
- String[] strings = ((String) markups).split("[, ]");
+ String[] strings = StringUtils.split((String) markups, ", ");
List<String> result = new ArrayList<String>(strings.length);
for (String string : strings) {
if (string.trim().length() != 0) {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ContentType.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ContentType.java?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ContentType.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ContentType.java Sun Dec 13 16:55:30 2009
@@ -17,6 +17,8 @@
* limitations under the License.
*/
+import org.apache.commons.lang.StringUtils;
+
/*
* Date: Oct 30, 2006
* Time: 10:26:27 PM
@@ -31,7 +33,7 @@
private void parse(String contentType) {
// TODO parse Parameter
- String[] values = contentType.split("/");
+ String[] values = StringUtils.split(contentType, "/");
if (values.length == 2) {
primaryType = values[0];
subType = values[1];
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/UISheetUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/UISheetUnitTest.java?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/UISheetUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/UISheetUnitTest.java Sun Dec 13 16:55:30 2009
@@ -99,4 +99,11 @@
Assert.assertEquals(8, data.getPages());
*/
}
+
+ @Test
+ public void testStripRowIndex() {
+ Assert.assertEquals("comp1:comp2", new UISheet().stripRowIndex("123:comp1:comp2"));
+ Assert.assertEquals("comp1:comp2", new UISheet().stripRowIndex("comp1:comp2"));
+ }
+
}
Modified: myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java (original)
+++ myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java Sun Dec 13 16:55:30 2009
@@ -1,6 +1,7 @@
package org.apache.myfaces.tobago.component;
import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.myfaces.tobago.config.ThemeConfig;
import org.apache.myfaces.tobago.layout.Measure;
@@ -308,7 +309,7 @@
if (strArray instanceof String[]) {
return (String[]) strArray;
} else if (strArray instanceof String) {
- String[] strings = ((String) strArray).split("[, ]");
+ String[] strings = StringUtils.split((String) strArray, ", ");
List<String> result = new ArrayList<String>(strings.length);
for (String string : strings) {
if (string.trim().length() != 0) {
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuCommandRenderer.java Sun Dec 13 16:55:30 2009
@@ -99,7 +99,7 @@
}
String formattedValue = RenderUtil.getFormattedValue(facesContext, radio, item.getValue());
String setValue = JQueryUtils.selectId(hiddenId) + ".val('" + JQueryUtils.escapeValue(formattedValue) + "'); ";
- encodeItem(facesContext, writer, null ,label, setValue + submit, disabled, firstLevel, image);
+ encodeItem(facesContext, writer, null, label, setValue + submit, disabled, firstLevel, image);
}
encodeHidden(writer, hiddenId, radio.getValue());
} else {
Modified: myfaces/tobago/trunk/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/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Sun Dec 13 16:55:30 2009
@@ -17,6 +17,7 @@
* limitations under the License.
*/
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.AbstractUIPage;
@@ -233,15 +234,17 @@
// script files
List<String> scriptFiles = facesContext.getScriptFiles();
// dojo.js and tobago.js needs to be first!
- addScripts(writer, facesContext, "script/jquery-1.3.2.min.js");
+
if (debugMode) {
+ addScripts(writer, facesContext, "script/jquery-1.3.2.js");
addScripts(writer, facesContext, "script/dojo/dojo/dojo.js.uncompressed.js");
} else {
+ addScripts(writer, facesContext, "script/jquery-1.3.2.min.js");
addScripts(writer, facesContext, "script/dojo/dojo/dojo.js");
}
addScripts(writer, facesContext, "script/tobago.js");
addScripts(writer, facesContext, "script/theme-config.js");
- // remove dojo.js and tobago.js from list to prevent dublicated rendering of script tags
+ // remove dojo.js and tobago.js from list to prevent duplicated rendering of script tags
scriptFiles.remove("script/jquery-1.3.2.min.js");
if (debugMode) {
scriptFiles.remove("script/dojo/dojo/dojo.js.uncompressed.js");
@@ -643,15 +646,17 @@
StringBuilder sb = new StringBuilder("LOG.info(\"FacesMessage: [");
sb.append(id != null ? id : "null");
sb.append("][");
- sb.append(message.getSummary() == null ? "null"
- : message.getSummary().replace("\\", "\\\\").replace("\"", "\\\""));
+ sb.append(message.getSummary() == null ? "null" : escape(message.getSummary()));
sb.append("/");
- sb.append(message.getDetail() == null ? "null"
- : message.getDetail().replace("\\", "\\\\").replace("\"", "\\\""));
+ sb.append(message.getDetail() == null ? "null" : escape(message.getDetail()));
sb.append("]\");");
return sb.toString();
}
+ private String escape(String s) {
+ return StringUtils.replace(StringUtils.replace(s, "\\", "\\\\"), "\"", "\\\"");
+ }
+
private String getMethod(UIPage page) {
String method = (String) page.getAttributes().get(Attributes.METHOD);
return method == null ? "post" : method;
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=890072&r1=890071&r2=890072&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 Sun Dec 13 16:55:30 2009
@@ -259,7 +259,7 @@
}
writer.startElement(HtmlConstants.DIV, null);
writer.writeIdAttribute(sheetId + "_header_box_filler");
- writer.writeClassAttribute("tobago-sheet-header-box");
+ writer.writeClassAttribute("tobago-sheet-header-box tobago-sheet-header-filler");
writer.writeAttribute(HtmlAttributes.STYLE, "width: 0px", false);
writer.startElement(HtmlConstants.DIV, null);
@@ -424,7 +424,7 @@
}
writer.startElement(HtmlConstants.TD, null);
- writer.writeClassAttribute("tobago-sheet-cell-td");
+ writer.writeClassAttribute("tobago-sheet-cell-td tobago-sheet-cell-filler");
writer.startElement(HtmlConstants.DIV, null);
writer.writeIdAttribute(
@@ -885,6 +885,7 @@
final Application application = facesContext.getApplication();
menu = (UIPanel) application.createComponent(UIMenu.COMPONENT_TYPE);
menu.setId("selectorMenu");
+ //menu.setTransient(true);
column.getFacets().put(Facets.MENUPOPUP, menu);
menu.setRendererType(RendererTypes.MENU_BAR);
menu.getAttributes().put(Attributes.MENU_POPUP, Boolean.TRUE);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/calendar.js Sun Dec 13 16:55:30 2009
@@ -261,13 +261,11 @@
var newValue = formatDate(date, document.calendar.formatPattern);
if (textBox.value != newValue) {
textBox.value = newValue;
- raiseEvent("change", textBox);
+ Tobago.raiseEvent("change", textBox);
}
}
// ------------------------------------------------------------------
-// ------------------------------------------------------------------
-
function tbgGetTimeInput(imageButton) {
if (imageButton.parentNode.selectedId) {
input = document.getElementById(imageButton.parentNode.selectedId);
Modified: myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java Sun Dec 13 16:55:30 2009
@@ -17,6 +17,7 @@
* limitations under the License.
*/
+import org.apache.commons.lang.StringUtils;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.UILabel;
import org.apache.myfaces.tobago.component.UISeparator;
@@ -51,7 +52,7 @@
if (label != null) {
if (ClientProperties.getInstance(facesContext.getViewRoot()).getUserAgent().isMsie()) {
- label = label.replace(" ", HtmlUtils.CHAR_NON_BEAKING_SPACE);
+ label = StringUtils.replace(label, " ", HtmlUtils.CHAR_NON_BEAKING_SPACE);
}
writer.startElement(HtmlConstants.TABLE, component);
Modified: myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/CommandRendererHelper.java Sun Dec 13 16:55:30 2009
@@ -17,6 +17,7 @@
* limitations under the License.
*/
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.Attributes;
@@ -148,7 +149,7 @@
String onclick;
onclick = (String) component.getAttributes().get(Attributes.ONCLICK);
if (onclick.contains("@autoId")) {
- onclick = onclick.replace("@autoId", component.getClientId(facesContext));
+ onclick = StringUtils.replace(onclick, "@autoId", component.getClientId(facesContext));
}
return onclick;
}
@@ -231,7 +232,8 @@
}
public String getOnclickDoubleQuoted() {
- return onclick.replaceAll("'", "\"");
+ return onclick.replace('\'', '\"');
+
}
public boolean isDisabled() {
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=890072&r1=890071&r2=890072&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 Sun Dec 13 16:55:30 2009
@@ -108,10 +108,10 @@
//LOG.error(element.id);
var idPrefix = element.id.substring(0, element.id.lastIndexOf(Tobago.SUB_COMPONENT_SEP2) + Tobago.SUB_COMPONENT_SEP2.length);
//LOG.error(idPrefix);
- for (i = this.activeIndex + 1; i < this.size; i++) {
+ for (var i = (this.activeIndex * 1) + 1; i < this.size; i++) {
var id = idPrefix + i;
- var div = Tobago.element(id);
- if (div) {
+ var span = Tobago.element(id);
+ if (span && span.className.indexOf('tobago-tab-disabled') == -1) {
this.activeIndex = i;
break;
}
@@ -154,10 +154,10 @@
//LOG.error(element.id);
var idPrefix = element.id.substring(0, element.id.lastIndexOf(Tobago.SUB_COMPONENT_SEP2) + Tobago.SUB_COMPONENT_SEP2.length);
//LOG.error(idPrefix);
- for (i = this.activeIndex - 1; i >= 0; i--) {
+ for (var i = this.activeIndex - 1; i >= 0; i--) {
var id = idPrefix + i;
- var div = Tobago.element(id);
- if (div) {
+ var span = Tobago.element(id);
+ if (span && span.className.indexOf('tobago-tab-disabled') == -1) {
this.activeIndex = i;
break;
}
Modified: myfaces/tobago/trunk/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/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Sun Dec 13 16:55:30 2009
@@ -108,12 +108,12 @@
partialRequestIds: null,
/**
- * The id ot the element which should became the focus after loading.
+ * The id of the element which should became the focus after loading.
* Set via renderer if requested.
*/
focusId: undefined,
- errorFocusId:undefined,
+ errorFocusId: undefined,
lastFocusId: undefined,
@@ -550,14 +550,16 @@
}
Tobago.oldTransition = Tobago.transition;
Tobago.transition = transition && !target;
- Tobago.onSubmit();
+ var onSubmitResult = Tobago.onSubmit();
+ if (onSubmitResult) {
// LOG.debug("submit form with action: " + Tobago.action.value);
- Tobago.form.submit();
+ Tobago.form.submit();
+ }
Tobago.action.value = oldAction;
if (target) {
Tobago.form.target = oldTarget;
}
- if (target || !transition) {
+ if (target || !transition || !onSubmitResult) {
this.isSubmit = false;
Tobago.Transport.pageSubmited = false;
}
@@ -937,7 +939,7 @@
if (background) {
background.style.width = Math.max(document.body.scrollWidth, document.body.clientWidth) + 'px';
background.style.height = Math.max(document.body.scrollHeight, document.body.clientHeight) + 'px';
- this.popupResizeStub = function() {Tobago.doResizePopupBackground(id);}
+ this.popupResizeStub = function() {Tobago.doResizePopupBackground(id);};
Tobago.addEventListener(window, "resize", this.popupResizeStub);
}
var contentId = id + Tobago.SUB_COMPONENT_SEP + "content";
@@ -999,7 +1001,7 @@
contains = true;
}
}
- if (!contains) {
+ if (!contains && modal) {
// Popup is loaded by ajax
Tobago.lockPopupPage(id);
}
@@ -1010,7 +1012,7 @@
contains = true;
}
}
- if (!contains) {
+ if (!contains&& modal) {
Tobago.openPopups.push(id);
}
@@ -1025,43 +1027,49 @@
// store their ids in a hidden field
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.name = id;
- hidden.type = "hidden";
- document.forms[0].appendChild(hidden);
- }
+ hidden = document.createElement("input");
+ hidden.id = id + Tobago.SUB_COMPONENT_SEP + "disabledElements";
+ hidden.name = id;
+ hidden.type = "hidden";
+ document.forms[0].appendChild(hidden);
+ }
hidden.value = ",";
var firstPopupElement = null;
- for (i = 0; i < document.forms[0].elements.length; i++) {
+ for (var i = 0; i < document.forms[0].elements.length; i++) {
var element = document.forms[0].elements[i];
if (element.type != "hidden" && !element.disabled) {
- if (element.id.indexOf(id + ":") != 0) {
- element.disabled = true;
- hidden.value += element.id + ",";
- } else {
- if (firstPopupElement == null && element.focus) {
- firstPopupElement = element;
- }
- }
- }
+ if (element.id) {
+ if (element.id.indexOf(id + ":") != 0) {
+ element.disabled = true;
+ hidden.value += element.id + ",";
+ } else {
+ if (firstPopupElement == null && Tobago.isFunction(element.focus)) {
+ firstPopupElement = element;
+ }
+ }
+ }
+ }
}
for (i = 0; i < document.anchors.length; i++) {
var element = document.anchors[i];
if (!element.disabled) {
- if (element.id.indexOf(id + ":") != 0) {
- element.disabled = true;
- hidden.value += element.id + ",";
- } else {
- if (firstPopupElement == null && element.focus) {
- firstPopupElement = element;
- }
- }
- }
+ if (element.id) {
+ if (element.id.indexOf(id + ":") != 0) {
+ element.disabled = true;
+ hidden.value += element.id + ",";
+ } else {
+ if (firstPopupElement == null && element.focus) {
+ firstPopupElement = element;
+ }
+ }
+ }
+ }
}
// set focus to first element in popup
if (firstPopupElement != null) {
- firstPopupElement.focus();
+ try {
+ firstPopupElement.focus();
+ } catch(e) {/* ignore */}
}
},
@@ -1098,7 +1106,7 @@
div = Tobago.findAnchestorWithTagName(div.parentNode, "DIV");
}
if (div) {
- var re = new RegExp(Tobago.SUB_COMPONENT_SEP + "content$")
+ var re = new RegExp(Tobago.SUB_COMPONENT_SEP + "content$");
id = div.id.replace(re, "");
}
}
@@ -1151,7 +1159,7 @@
// enable all elements and anchors on page stored in a hidden field
var hidden = Tobago.element(id + Tobago.SUB_COMPONENT_SEP + "disabledElements");
if (hidden != null && hidden.value != "") {
- for (i = 0; i < document.forms[0].elements.length; i++) {
+ for (var i = 0; i < document.forms[0].elements.length; i++) {
var element = document.forms[0].elements[i];
if (hidden.value.indexOf("," + element.id + ",") >= 0) {
element.disabled = false;
@@ -1213,10 +1221,10 @@
if (element) {
if (element.click) {
// LOG.debug("click on element");
- element.click()
+ element.click();
} else {
// LOG.debug("click on new button");
- var a = document.createElement("input")
+ var a = document.createElement("input");
a.type = "button";
a.style.width = "0px;";
a.style.height = "0px;";
@@ -1376,7 +1384,7 @@
classes = classes.replace(re, " ");
}
classes = classes.replace(/ /g, " ");
- element.className = classes;
+ element.className = classes;
},
/**
@@ -1534,28 +1542,28 @@
bind: function(object, func) {
var rest = [];
for (var i = 2; i < arguments.length; i++) {
- rest.push(arguments[i])
+ rest.push(arguments[i]);
}
return function() {
var args = [];
for (var i = 0; i < arguments.length; i++) {
- args.push(arguments[i])
+ args.push(arguments[i]);
}
object[func].apply(object, args.concat(rest));
- }
+ };
},
bind2: function(object, func) {
var rest = [];
for (var i = 2; i < arguments.length; i++) {
- rest.push(arguments[i])
+ rest.push(arguments[i]);
}
return function() {
for (var i = 0; i < arguments.length; i++) {
- rest.push(arguments[i])
+ rest.push(arguments[i]);
}
object[func].apply(object, rest);
- }
+ };
},
/**
@@ -1568,7 +1576,7 @@
bindAsEventListener: function(object, func) {
return function(event) {
object[func].call(object, event || window.event);
- }
+ };
},
/**
@@ -1789,6 +1797,10 @@
Tobago.action.value = defaultActionId;
},
+ isFunction: function (func) {
+ return (typeof func == "function") || ((typeof func == "object") && func.call);
+ },
+
raiseEvent: function(eventType, element) {
if (document.createEvent) {
var evt = document.createEvent("Events");
@@ -2096,6 +2108,7 @@
} catch(ex) {
LOG.error(ex);
LOG.error("errorCode: " + this.doAfter.valueOf());
+ throw ex;
}
};
Modified: myfaces/tobago/trunk/tobago-assembly/src/main/resources/README.txt
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-assembly/src/main/resources/README.txt?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-assembly/src/main/resources/README.txt (original)
+++ myfaces/tobago/trunk/tobago-assembly/src/main/resources/README.txt Sun Dec 13 16:55:30 2009
@@ -20,7 +20,7 @@
don't need a JDK 1.4 version, because they don't contain any classes.
-Addtionally add the retrotranslator-runtime-1.2.1.jar from
+Additionally add the retrotranslator-runtime-1.2.1.jar from
http://repo1.maven.org/maven2/net/sf/retrotranslator/retrotranslator-runtime/
to the WEB-INF/lib directory of your WAR.
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg Sun Dec 13 16:55:30 2009
@@ -41,6 +41,7 @@
<componentInfo.imports:import(); separator="\n">
import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.myfaces.tobago.config.ThemeConfig;
import org.apache.myfaces.tobago.layout.PixelMeasure;
import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
@@ -315,7 +316,7 @@
if (strArray instanceof String[]) {
return (String[]) strArray;
} else if (strArray instanceof String) {
- String[] strings = ((String) strArray).split("[, ]");
+ String[] strings = StringUtils.split((String) strArray, ", ");
List\<String\> result = new ArrayList\<String\>(strings.length);
for (String string : strings) {
if (string.trim().length() != 0) {
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg?rev=890072&r1=890071&r2=890072&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg Sun Dec 13 16:55:30 2009
@@ -41,6 +41,7 @@
<componentInfo.imports:import(); separator="\n">
import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression;
import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding;
import org.apache.myfaces.tobago.layout.PixelMeasure;
@@ -220,7 +221,7 @@
if (strArray instanceof String[]) {
return (String[]) strArray;
} else if (strArray instanceof String) {
- String[] strings = ((String) strArray).split("[, ]");
+ String[] strings = StringUtils.split((String) strArray, ", ");
List\<String\> result = new ArrayList\<String\>(strings.length);
for (String string : strings) {
if (string.trim().length() != 0) {