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 2013/10/02 08:54:58 UTC
svn commit: r1528317 - in /myfaces/tobago/trunk: ./
tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/
tobago-example/tobago-example-test/src/main/webapp/test/in/
Author: lofwyr
Date: Wed Oct 2 06:54:57 2013
New Revision: 1528317
URL: http://svn.apache.org/r1528317
Log:
TOBAGO-1316: tx-taglib is broken with new createUniqueId() strategy from MyFaces (Facelets only)
Modified:
myfaces/tobago/trunk/pom.xml
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/SeparatorExtensionHandler.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoLabelExtensionHandler.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoMenuExtensionHandler.java
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/in/in-tx.xhtml
Modified: myfaces/tobago/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/pom.xml?rev=1528317&r1=1528316&r2=1528317&view=diff
==============================================================================
--- myfaces/tobago/trunk/pom.xml (original)
+++ myfaces/tobago/trunk/pom.xml Wed Oct 2 06:54:57 2013
@@ -1718,10 +1718,8 @@
<properties>
<myfaces-test20.version>1.0.4</myfaces-test20.version>
- <!--Not using myfaces 2.0.17 or higher because of change https://issues.apache.org/jira/browse/MYFACES-3663-->
- <myfaces20.version>2.0.16</myfaces20.version>
- <!--Not using myfaces 2.1.11 or higher because of change https://issues.apache.org/jira/browse/MYFACES-3663-->
- <myfaces21.version>2.1.10</myfaces21.version>
+ <myfaces20.version>2.0.18</myfaces20.version>
+ <myfaces21.version>2.1.12</myfaces21.version>
<mojarra20.version>2.0.11</mojarra20.version>
<mojarra21.version>2.1.25</mojarra21.version>
<mojarra22.version>2.2.2</mojarra22.version>
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java?rev=1528317&r1=1528316&r2=1528317&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java Wed Oct 2 06:54:57 2013
@@ -65,13 +65,19 @@ public class DateExtensionHandler extend
UIForm form = (UIForm) application.createComponent(UIForm.COMPONENT_TYPE);
form.setRendererType(RendererTypes.FORM);
- form.setId(formIdAttribute != null ? formIdAttribute.getValue(faceletContext) : root.createUniqueId());
+ final String formId = formIdAttribute != null
+ ? formIdAttribute.getValue(faceletContext)
+ : "_tx_" + faceletContext.generateUniqueId("form");
+ form.setId(formId);
panel.getChildren().add(form);
UIDatePicker picker = (UIDatePicker) application.createComponent(UIDatePicker.COMPONENT_TYPE);
picker.setRendererType(RendererTypes.DATE_PICKER);
picker.setFor("@auto");
- picker.setId(pickerIdAttribute != null ? pickerIdAttribute.getValue(faceletContext) : root.createUniqueId());
+ final String pickerId = pickerIdAttribute != null
+ ? pickerIdAttribute.getValue(faceletContext)
+ : "_tx_" + faceletContext.generateUniqueId("picker");
+ picker.setId(pickerId);
if (picker.getAttributes().get(OnComponentCreated.MARKER) == null) {
picker.getAttributes().put(OnComponentCreated.MARKER, Boolean.TRUE);
picker.onComponentCreated(faceletContext.getFacesContext(), panel);
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/SeparatorExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/SeparatorExtensionHandler.java?rev=1528317&r1=1528316&r2=1528317&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/SeparatorExtensionHandler.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/SeparatorExtensionHandler.java Wed Oct 2 06:54:57 2013
@@ -62,7 +62,7 @@ public class SeparatorExtensionHandler e
Application application = faceletContext.getFacesContext().getApplication();
UIViewRoot root = ComponentUtils.findViewRoot(faceletContext, parent);
UIOutput label = (UIOutput) application.createComponent(UILabel.COMPONENT_TYPE);
- label.setId(root.createUniqueId());
+ label.setId("_tx_" + faceletContext.generateUniqueId("label"));
label.setRendererType("Label");
setAttributes(faceletContext, label);
separator.getFacets().put(Facets.LABEL, label);
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoLabelExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoLabelExtensionHandler.java?rev=1528317&r1=1528316&r2=1528317&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoLabelExtensionHandler.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoLabelExtensionHandler.java Wed Oct 2 06:54:57 2013
@@ -34,7 +34,6 @@ import org.apache.myfaces.tobago.facelet
import org.apache.myfaces.tobago.facelets.SupportsMarkupRule;
import org.apache.myfaces.tobago.facelets.TobagoComponentHandler;
import org.apache.myfaces.tobago.internal.layout.LayoutUtils;
-import org.apache.myfaces.tobago.util.ComponentUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,7 +43,6 @@ import javax.faces.FacesException;
import javax.faces.application.Application;
import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
import javax.faces.view.facelets.ComponentConfig;
import javax.faces.view.facelets.ComponentHandler;
import javax.faces.view.facelets.FaceletContext;
@@ -54,8 +52,11 @@ import javax.faces.view.facelets.TagAttr
import java.io.IOException;
public abstract class TobagoLabelExtensionHandler extends ComponentHandler {
+
private static final Logger LOG = LoggerFactory.getLogger(TobagoLabelExtensionHandler.class);
+
private static final String DEFAULT_COLUMNS = "auto;*";
+
private TagAttribute labelWidthAttribute;
private TagAttribute tipAttribute;
private TagAttribute labelAttribute;
@@ -89,7 +90,7 @@ public abstract class TobagoLabelExtensi
throws IOException, FacesException, ELException {
if (ComponentHandler.isNew(panel)) {
// ensure that input has no parent (isNew)
- UIComponent input = panel.getChildren().remove(1);
+ UIComponent input = panel.getChildren().remove(1);
try {
input.getAttributes().put("tobago.panel", panel);
nextHandler.apply(ctx, input);
@@ -112,17 +113,16 @@ public abstract class TobagoLabelExtensi
public void onComponentCreated(FaceletContext faceletContext, UIComponent panel, UIComponent parent) {
- Application application = faceletContext.getFacesContext().getApplication();
- UIViewRoot root = ComponentUtils.findViewRoot(faceletContext, parent);
+ final Application application = faceletContext.getFacesContext().getApplication();
- addGridLayout(faceletContext, panel, root);
+ addGridLayout(faceletContext, panel, application);
+ addLabel(faceletContext, (UIPanel) panel, application);
- addLabel(faceletContext, (UIPanel) panel, root);
String uid;
- if (fieldIdAttribute != null) {
+ if (fieldIdAttribute != null) {
uid = fieldIdAttribute.getValue(faceletContext);
} else {
- uid = root.createUniqueId();
+ uid = "_tx_" + faceletContext.generateUniqueId("field");
}
if (checkForAlreadyCreated(panel, uid)) {
return;
@@ -141,13 +141,12 @@ public abstract class TobagoLabelExtensi
protected void enrichInput(FaceletContext faceletContext, UIComponent input) {
}
- private void addLabel(FaceletContext faceletContext, UIPanel panel, UIViewRoot root) {
- String uid = root.createUniqueId();
+ private void addLabel(FaceletContext faceletContext, UIPanel panel, final Application application) {
+ final String uid = "_tx_" + faceletContext.generateUniqueId("label");
if (checkForAlreadyCreated(panel, uid)) {
return;
}
- Application application = faceletContext.getFacesContext().getApplication();
- UILabel label = (UILabel) application.createComponent(UILabel.COMPONENT_TYPE);
+ final UILabel label = (UILabel) application.createComponent(UILabel.COMPONENT_TYPE);
label.setRendererType(RendererTypes.LABEL);
label.setId(uid);
label.getAttributes().put(Attributes.FOR, "@auto");
@@ -155,7 +154,7 @@ public abstract class TobagoLabelExtensi
if (tipAttribute.isLiteral()) {
panel.setTip(tipAttribute.getValue(faceletContext));
} else {
- ValueExpression expression = tipAttribute.getValueExpression(faceletContext, String.class);
+ final ValueExpression expression = tipAttribute.getValueExpression(faceletContext, String.class);
panel.setValueExpression(Attributes.TIP, expression);
}
}
@@ -163,7 +162,7 @@ public abstract class TobagoLabelExtensi
if (labelAttribute.isLiteral()) {
label.setValue(labelAttribute.getValue(faceletContext));
} else {
- ValueExpression expression = labelAttribute.getValueExpression(faceletContext, String.class);
+ final ValueExpression expression = labelAttribute.getValueExpression(faceletContext, String.class);
label.setValueExpression(Attributes.VALUE, expression);
}
}
@@ -171,7 +170,7 @@ public abstract class TobagoLabelExtensi
if (markupAttribute.isLiteral()) {
label.setMarkup(Markup.valueOf(markupAttribute.getValue()));
} else {
- ValueExpression expression = markupAttribute.getValueExpression(faceletContext, Object.class);
+ final ValueExpression expression = markupAttribute.getValueExpression(faceletContext, Object.class);
label.setValueExpression(Attributes.MARKUP, expression);
}
}
@@ -203,9 +202,8 @@ public abstract class TobagoLabelExtensi
}
}
- private void addGridLayout(FaceletContext faceletContext, UIComponent panel, UIViewRoot root) {
- Application application = faceletContext.getFacesContext().getApplication();
- UIGridLayout gridLayout = (UIGridLayout) application.createComponent(UIGridLayout.COMPONENT_TYPE);
+ private void addGridLayout(FaceletContext faceletContext, UIComponent panel, final Application application) {
+ final UIGridLayout gridLayout = (UIGridLayout) application.createComponent(UIGridLayout.COMPONENT_TYPE);
gridLayout.setRendererType(RendererTypes.GRID_LAYOUT);
if (labelWidthAttribute != null) {
String columns = getColumns(labelWidthAttribute.getValue(faceletContext));
@@ -218,7 +216,7 @@ public abstract class TobagoLabelExtensi
gridLayout.setColumns(getColumns("auto"));
}
gridLayout.setRows(getRows());
- gridLayout.setId(root.createUniqueId());
+ gridLayout.setId("_tx_" + faceletContext.generateUniqueId("layout"));
if (gridLayout instanceof OnComponentCreated) {
((OnComponentCreated) gridLayout).onComponentCreated(faceletContext.getFacesContext(), panel);
}
@@ -255,7 +253,7 @@ public abstract class TobagoLabelExtensi
protected MetaRuleset createMetaRuleset(Class aClass) {
MetaRuleset metaRuleset = super.createMetaRuleset(aClass);
- TagAttribute [] attrs = tag.getAttributes().getAll();
+ TagAttribute[] attrs = tag.getAttributes().getAll();
for (int i = 0; i < attrs.length; i++) {
TagAttribute attr = attrs[i];
if (!attr.getLocalName().equals("rendered")) {
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoMenuExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoMenuExtensionHandler.java?rev=1528317&r1=1528316&r2=1528317&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoMenuExtensionHandler.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoMenuExtensionHandler.java Wed Oct 2 06:54:57 2013
@@ -20,13 +20,11 @@
package org.apache.myfaces.tobago.facelets.extension;
import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.util.ComponentUtils;
import javax.el.ELException;
import javax.faces.FacesException;
import javax.faces.application.Application;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
import javax.faces.view.facelets.ComponentConfig;
import javax.faces.view.facelets.ComponentHandler;
import javax.faces.view.facelets.FaceletContext;
@@ -69,15 +67,11 @@ public abstract class TobagoMenuExtensio
public void onComponentCreated(FaceletContext faceletContext, UIComponent menuCommand, UIComponent parent) {
- Application application = faceletContext.getFacesContext().getApplication();
- UIViewRoot root = ComponentUtils.findViewRoot(faceletContext, parent);
- UIComponent component = application.createComponent(getSubComponentType());
- final String uid;
- if (fieldIdAttribute != null) {
- uid = fieldIdAttribute.getValue(faceletContext);
- } else {
- uid = root.createUniqueId();
- }
+ final Application application = faceletContext.getFacesContext().getApplication();
+ final UIComponent component = application.createComponent(getSubComponentType());
+ final String uid = fieldIdAttribute != null
+ ? fieldIdAttribute.getValue(faceletContext)
+ : "_tx_" + faceletContext.generateUniqueId("sub");
component.setId(uid);
component.setRendererType(getSubRendererType());
setSubComponentAttributes(faceletContext, component);
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/in/in-tx.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/in/in-tx.xhtml?rev=1528317&r1=1528316&r2=1528317&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/in/in-tx.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/in/in-tx.xhtml Wed Oct 2 06:54:57 2013
@@ -23,7 +23,7 @@
<tc:page id="page">
<f:facet name="layout">
- <tc:gridLayout rows="auto;auto;auto;auto"/>
+ <tc:gridLayout rows="auto;auto;auto;auto;auto"/>
</f:facet>
<tc:gridLayoutConstraint width="600px" height="600px"/>
@@ -52,6 +52,8 @@
<tc:dataAttribute name="assert-height" value="20"/>
</tx:in>
+ <tc:button label="Submit"/>
+
<tc:script file="script/tobago-assert.js"/>
</tc:page>