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/11/26 16:51:57 UTC
svn commit: r1413689 [1/2] - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/compon...
Author: lofwyr
Date: Mon Nov 26 15:51:50 2012
New Revision: 1413689
URL: http://svn.apache.org/viewvc?rev=1413689&view=rev
Log:
TOBAGO-1221: Remove JSF 1.1 support
Removed:
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java-jsf-1.1/
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ConverterTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DataAttributeTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FileItemValidatorTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LoadBundleTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupReferenceTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ResetInputActionListenerTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SubmittedValueLengthValidatorTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabChangeListenerTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/PopupReferenceHandler.java
myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/ResetInputActionListenerHandler.java
myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/compat/FacesUtilsEL.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/event/ValueExpressionResetInputActionListener.java
myfaces/tobago/trunk/tobago-jsf-compat/src/main/java/org/apache/myfaces/tobago/util/MessageUtils.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tagAbstract1.2.stg
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Sorter.java Mon Nov 26 15:51:50 2012
@@ -20,15 +20,16 @@
package org.apache.myfaces.tobago.component;
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.internal.component.AbstractUICommand;
import org.apache.myfaces.tobago.internal.component.AbstractUISheet;
import org.apache.myfaces.tobago.model.SheetState;
import org.apache.myfaces.tobago.util.BeanComparator;
+import org.apache.myfaces.tobago.util.ValueExpressionComparator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.el.ValueExpression;
import javax.faces.component.UIColumn;
import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
@@ -71,19 +72,18 @@ public class Sorter {
String sortProperty;
try {
-
UIComponent child = getFirstSortableChild(column.getChildren());
if (child != null) {
- String attributeName = child instanceof AbstractUICommand ? Attributes.LABEL:Attributes.VALUE;
- if (FacesUtils.hasValueBindingOrValueExpression(child, attributeName)) {
+ String attributeName = child instanceof AbstractUICommand ? Attributes.LABEL : Attributes.VALUE;
+ if (child.getValueExpression(attributeName) != null) {
String var = data.getVar();
if (var == null) {
LOG.error("No sorting performed. Property var of sheet is not set!");
unsetSortableAttribute(column);
return;
}
- String expressionString = FacesUtils.getExpressionString(child, attributeName);
+ String expressionString = child.getValueExpression(attributeName).getExpressionString();
if (isSimpleProperty(expressionString)) {
if (expressionString.startsWith("#{")
&& expressionString.endsWith("}")) {
@@ -102,8 +102,8 @@ public class Sorter {
} else {
boolean descending = !sheetState.isAscending();
- actualComparator =
- FacesUtils.getBindingOrExpressionComparator(facesContext, child, var, descending, comparator);
+ ValueExpression expression = child.getValueExpression("value");
+ actualComparator = new ValueExpressionComparator(facesContext, var, expression, descending, comparator);
}
} else {
LOG.error("No sorting performed. No Expression target found for sorting!");
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/UIViewRoot.java Mon Nov 26 15:51:50 2012
@@ -20,7 +20,6 @@
package org.apache.myfaces.tobago.component;
import org.apache.myfaces.tobago.ajax.AjaxUtils;
-import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.compat.InvokeOnComponent;
import org.apache.myfaces.tobago.context.ClientProperties;
import org.apache.myfaces.tobago.internal.ajax.AjaxInternalUtils;
@@ -337,9 +336,9 @@ public class UIViewRoot extends javax.fa
}
}
- // todo: after removing jsf 1.1: @Override
+ @Override
public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
throws FacesException {
- return FacesUtils.invokeOnComponent(context, this, clientId, callback);
+ return ComponentUtils.invokeOnComponent(context, this, clientId, callback);
}
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/ajax/AjaxResponseRenderer.java Mon Nov 26 15:51:50 2012
@@ -19,7 +19,6 @@
package org.apache.myfaces.tobago.internal.ajax;
-import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.internal.lifecycle.TobagoLifecycle;
import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
@@ -121,7 +120,7 @@ public class AjaxResponseRenderer {
writer.write("\",\n");
writer.write(" \"html\": \"");
- FacesUtils.invokeOnComponent(facesContext, facesContext.getViewRoot(), clientId, callback);
+ ComponentUtils.invokeOnComponent(facesContext, facesContext.getViewRoot(), clientId, callback);
writer.write("\",\n");
writer.write(" \"responseCode\": ");
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIData.java Mon Nov 26 15:51:50 2012
@@ -19,7 +19,6 @@
package org.apache.myfaces.tobago.internal.component;
-import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.compat.InvokeOnComponent;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.model.ExpandedState;
@@ -206,7 +205,7 @@ public abstract class AbstractUIData ext
}
}
- return FacesUtils.invokeOnComponent(facesContext, this, clientId, callback);
+ return ComponentUtils.invokeOnComponent(facesContext, this, clientId, callback);
} finally {
// we should reset rowIndex on UISheet
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIForm.java Mon Nov 26 15:51:50 2012
@@ -19,13 +19,12 @@
package org.apache.myfaces.tobago.internal.component;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.compat.InvokeOnComponent;
import org.apache.myfaces.tobago.component.Form;
import org.apache.myfaces.tobago.util.ComponentUtils;
import org.apache.myfaces.tobago.util.TobagoCallback;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.faces.FacesException;
import javax.faces.component.ContextCallback;
@@ -107,7 +106,7 @@ public abstract class AbstractUIForm ext
}
}
- // todo: after removing jsf 1.1: @Override
+ @Override
public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
throws FacesException {
// TODO is this needed?
@@ -117,6 +116,6 @@ public abstract class AbstractUIForm ext
}
}
context.getExternalContext().getRequestMap().put(AbstractUIForm.SUBMITTED_MARKER, isSubmitted());
- return FacesUtils.invokeOnComponent(context, this, clientId, callback);
+ return ComponentUtils.invokeOnComponent(context, this, clientId, callback);
}
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java Mon Nov 26 15:51:50 2012
@@ -20,7 +20,6 @@
package org.apache.myfaces.tobago.internal.component;
import org.apache.commons.collections.KeyValue;
-import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.ComponentTypes;
import org.apache.myfaces.tobago.component.DeprecatedDimension;
@@ -43,6 +42,8 @@ import org.apache.myfaces.tobago.util.De
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.el.ELContext;
+import javax.el.ValueExpression;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -228,12 +229,13 @@ public abstract class AbstractUIPage ext
*/
@Deprecated
public PageState getPageState(FacesContext facesContext) {
- if (FacesUtils.hasValueBindingOrValueExpression(this, Attributes.STATE)) {
- PageState state = (PageState)
- FacesUtils.getValueFromValueBindingOrValueExpression(facesContext, this, Attributes.STATE);
+ final ValueExpression expression = getValueExpression(Attributes.STATE);
+ if (expression != null) {
+ final ELContext elContext = facesContext.getELContext();
+ PageState state = (PageState) expression.getValue(elContext);
if (state == null) {
state = new PageStateImpl();
- FacesUtils.setValueOfBindingOrExpression(facesContext, state, this, Attributes.STATE);
+ expression.setValue(elContext, state);
}
return state;
} else {
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPopup.java Mon Nov 26 15:51:50 2012
@@ -19,7 +19,6 @@
package org.apache.myfaces.tobago.internal.component;
-import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.ComponentTypes;
import org.apache.myfaces.tobago.component.DeprecatedDimension;
@@ -38,6 +37,7 @@ import org.apache.myfaces.tobago.util.Cr
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.el.ValueExpression;
import javax.faces.component.NamingContainer;
import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
@@ -104,9 +104,10 @@ public abstract class AbstractUIPopup ex
@Override
public boolean isRendered() {
- if (FacesUtils.hasValueBindingOrValueExpression(this, "rendered")) {
- return (Boolean)
- FacesUtils.getValueFromValueBindingOrValueExpression(FacesContext.getCurrentInstance(), this, "rendered");
+ final ValueExpression expression = getValueExpression("rendered");
+ if (expression != null) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ return (Boolean) expression.getValue(context.getELContext());
} else {
return isActivated() || isRedisplay();
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java Mon Nov 26 15:51:50 2012
@@ -47,6 +47,8 @@ import org.apache.myfaces.tobago.util.Cr
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.el.ELContext;
+import javax.el.ValueExpression;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -103,11 +105,13 @@ public abstract class AbstractUISheet ex
@Override
public void encodeBegin(FacesContext facesContext) throws IOException {
SheetState state = getSheetState(facesContext);
- if (state.getFirst() > -1 && (!hasRowCount() || state.getFirst() < getRowCount())) {
- if (FacesUtils.hasValueBindingOrValueExpression(this, Attributes.FIRST)) {
- FacesUtils.setValueOfBindingOrExpression(facesContext, state.getFirst(), this, Attributes.FIRST);
+ final int first = state.getFirst();
+ if (first > -1 && (!hasRowCount() || first < getRowCount())) {
+ final ValueExpression expression = getValueExpression(Attributes.FIRST);
+ if (expression != null) {
+ expression.setValue(facesContext.getELContext(), first);
} else {
- setFirst(state.getFirst());
+ setFirst(first);
}
}
super.encodeBegin(facesContext);
@@ -124,20 +128,21 @@ public abstract class AbstractUISheet ex
public SheetState getSheetState(FacesContext facesContext) {
if (sheetState != null) {
return sheetState;
- } else {
- if (FacesUtils.hasValueBindingOrValueExpression(this, Attributes.STATE)) {
- SheetState state = (SheetState)
- FacesUtils.getValueFromValueBindingOrValueExpression(facesContext, this, Attributes.STATE);
- if (state == null) {
- state = new SheetState();
- FacesUtils.setValueOfBindingOrExpression(facesContext, state, this, Attributes.STATE);
- }
- return state;
- } else {
+ }
+
+ final ValueExpression expression = getValueExpression(Attributes.STATE);
+ if (expression != null) {
+ final ELContext elContext = facesContext.getELContext();
+ SheetState sheetState = (SheetState) expression.getValue(elContext);
+ if (sheetState == null) {
sheetState = new SheetState();
- return sheetState;
+ expression.setValue(elContext, sheetState);
}
+ return sheetState;
}
+
+ sheetState = new SheetState();
+ return sheetState;
}
public abstract String getColumns();
@@ -546,8 +551,9 @@ public abstract class AbstractUISheet ex
first = -1;
}
- if (FacesUtils.hasValueBindingOrValueExpression(this, Attributes.FIRST)) {
- FacesUtils.setValueOfBindingOrExpression(FacesContext.getCurrentInstance(), first, this, Attributes.FIRST);
+ final ValueExpression expression = getValueExpression(Attributes.FIRST);
+ if (expression != null) {
+ expression.setValue(getFacesContext().getELContext(), first);
} else {
setFirst(first);
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java Mon Nov 26 15:51:50 2012
@@ -37,6 +37,7 @@ import org.apache.myfaces.tobago.layout.
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.el.ValueExpression;
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -209,8 +210,9 @@ public abstract class AbstractUITabGroup
}
}
Integer index = ((TabChangeEvent) facesEvent).getNewTabIndex();
- if (FacesUtils.hasValueBindingOrValueExpression(this, Attributes.SELECTED_INDEX)) {
- FacesUtils.setValueOfBindingOrExpression(getFacesContext(), index, this, Attributes.SELECTED_INDEX);
+ ValueExpression expression = getValueExpression(Attributes.SELECTED_INDEX);
+ if (expression != null) {
+ expression.setValue(getFacesContext().getELContext(), index);
} else {
setSelectedIndex(index);
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITree.java Mon Nov 26 15:51:50 2012
@@ -21,7 +21,6 @@ package org.apache.myfaces.tobago.intern
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.internal.util.Deprecation;
import org.apache.myfaces.tobago.layout.LayoutComponent;
@@ -30,6 +29,8 @@ import org.apache.myfaces.tobago.model.M
import org.apache.myfaces.tobago.model.MixedTreeModel;
import org.apache.myfaces.tobago.model.TreeState;
+import javax.el.ELContext;
+import javax.el.ValueExpression;
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -208,21 +209,22 @@ public abstract class AbstractUITree ext
public TreeState getState() {
if (state != null) {
return state;
- } else {
- if (FacesUtils.hasValueBindingOrValueExpression(this, Attributes.STATE)) {
- final FacesContext facesContext = FacesContext.getCurrentInstance();
- TreeState state = (TreeState)
- FacesUtils.getValueFromValueBindingOrValueExpression(facesContext, this, Attributes.STATE);
- if (state == null) {
- state = new TreeState(new ExpandedState(2), new MarkedState());
- FacesUtils.setValueOfBindingOrExpression(facesContext, state, this, Attributes.STATE);
- }
- return state;
- } else {
+ }
+
+ final ELContext elContext = FacesContext.getCurrentInstance().getELContext();
+ final ValueExpression expression = getValueExpression(Attributes.STATE);
+
+ if (expression != null) {
+ TreeState state = (TreeState) expression.getValue(elContext);
+ if (state == null) {
state = new TreeState(new ExpandedState(2), new MarkedState());
- return state;
+ expression.setValue(elContext, state);
}
+ return state;
}
+
+ state = new TreeState(new ExpandedState(2), new MarkedState());
+ return state;
}
public MarkedState getMarkedState() {
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTag.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/AttributeTag.java Mon Nov 26 15:51:50 2012
@@ -23,13 +23,16 @@ import org.apache.myfaces.tobago.apt.ann
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
-import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.SupportsRenderedPartially;
import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import javax.el.ELContext;
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import javax.faces.webapp.UIComponentClassicTagBase;
import javax.faces.webapp.UIComponentELTag;
import javax.servlet.jsp.JspException;
@@ -43,57 +46,13 @@ import javax.servlet.jsp.tagext.TagSuppo
@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.AttributeTag")
public abstract class AttributeTag extends TagSupport {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
- /**
- * The name of the attribute in the parent component.
- */
- @TagAttribute(required = true, name = "name", type = "java.lang.String")
- public abstract void setName(ValueExpression name);
-
- public abstract String getNameValue();
+ private static final Logger LOG = LoggerFactory.getLogger(AttributeTag.class);
- public abstract boolean isNameLiteral();
+ private ValueExpression name;
+ private ValueExpression value;
- public abstract Object getNameAsBindingOrExpression();
-
- public abstract String getNameExpression();
-
- /**
- * The value of the attribute in the parent component.
- */
- @TagAttribute(required = true, name = "value", type = "java.lang.String")
- public abstract void setValue(ValueExpression value);
-
- public abstract String getValueValue();
-
- public abstract boolean isValueLiteral();
-
- public abstract Object getValueAsBindingOrExpression();
-
- public abstract String getValueExpression();
-
- /**
- * Warning: The mode is only available when using Facelets.
- * Allowed values are "action", "actionListener", "actionFromValue", "isNotSet", "isSet", "valueIfSet".
- * <br/>
- * "action" (method binding) evaluate the expression to find the method binding which is referenced with the template.
- * <br/>
- * "actionListener" same as "action" but for the method signature of ActionListeners.
- * <br/>
- * "isSet" (boolean) checks, if the expression is set from the composition caller.
- * <br/>
- * "isNotSet" (boolean) negation of "isSet"
- * <br/>
- * "actionFromValue" Evaluates the ValueBinding to get an outcome set directly (no action method)
- * <br/>
- * "valueIfSet" set the attribute only if the value is set.
- */
- @TagAttribute(name = "mode")
- public void setMode(ValueExpression mode) {
- throw new RuntimeException("The mode is only available when using Facelets, not with JSP.");
- }
-
/**
* @throws javax.servlet.jsp.JspException if a JSP error occurs
*/
@@ -116,35 +75,67 @@ public abstract class AttributeTag exten
// TODO Message resource i18n
throw new JspException("Component Instance is null");
}
- String attributeName;
- if (!isNameLiteral()) {
- Object nameValueBindingOrValueExpression = getNameAsBindingOrExpression();
- if (nameValueBindingOrValueExpression != null) {
- attributeName = (String) FacesUtils.getValueFromBindingOrExpression(nameValueBindingOrValueExpression);
- } else {
- // TODO Message resource i18n
- throw new JspException("Can not get ValueBinding for attribute name " + getNameExpression());
- }
- } else {
- attributeName = getNameValue();
- }
- if (!isValueLiteral()) {
- Object obj = getValueAsBindingOrExpression();
- if (obj != null) {
- FacesUtils.setBindingOrExpression(component, attributeName, obj);
- } else {
- // TODO Message resource i18n
- throw new JspException("Can not get ValueBinding for attribute value " + getValueExpression());
- }
+
+ final ELContext elContext = FacesContext.getCurrentInstance().getELContext();
+
+ final String attributeName = (String) name.getValue(elContext);
+
+ if (!value.isLiteralText()) {
+ component.setValueExpression(attributeName, value);
} else if (Attributes.STYLE_CLASS.equals(attributeName)) {
- ComponentUtils.setStyleClasses(component, getValueValue());
+ ComponentUtils.setStyleClasses(component, (String) value.getValue(elContext));
} else if (Attributes.RENDERED_PARTIALLY.equals(attributeName)
&& component instanceof SupportsRenderedPartially) {
- String[] components = ComponentUtils.splitList(getValueValue());
+ String[] components = ComponentUtils.splitList((String) value.getValue(elContext));
((SupportsRenderedPartially) component).setRenderedPartially(components);
} else {
- component.getAttributes().put(attributeName, getValueValue());
+ component.getAttributes().put(attributeName, value.getValue(elContext));
}
return (SKIP_BODY);
}
+
+ @Override
+ public void release() {
+ super.release();
+ name = null;
+ value = null;
+ }
+
+ /**
+ * The name of the attribute in the parent component.
+ */
+ @TagAttribute(required = true, name = "name", type = "java.lang.String")
+ public void setName(ValueExpression name){
+ this.name = name;
+ }
+
+ /**
+ * The value of the attribute in the parent component.
+ */
+ @TagAttribute(required = true, name = "value", type = "java.lang.String")
+ public void setValue(ValueExpression value){
+ this.value = value;
+ }
+
+ /**
+ * Warning: The mode is only available when using Facelets.
+ * Allowed values are "action", "actionListener", "actionFromValue", "isNotSet", "isSet", "valueIfSet".
+ * <br/>
+ * "action" (method binding) evaluate the expression to find the method binding which is referenced with the template.
+ * <br/>
+ * "actionListener" same as "action" but for the method signature of ActionListeners.
+ * <br/>
+ * "isSet" (boolean) checks, if the expression is set from the composition caller.
+ * <br/>
+ * "isNotSet" (boolean) negation of "isSet"
+ * <br/>
+ * "actionFromValue" Evaluates the ValueBinding to get an outcome set directly (no action method)
+ * <br/>
+ * "valueIfSet" set the attribute only if the value is set.
+ */
+ @TagAttribute(name = "mode")
+ public void setMode(ValueExpression mode) {
+ LOG.error("The mode is only available when using Facelets, not with JSP.");
+ }
+
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ConverterTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ConverterTag.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ConverterTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ConverterTag.java Mon Nov 26 15:51:50 2012
@@ -23,9 +23,9 @@ import org.apache.myfaces.tobago.apt.ann
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
-import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.component.Attributes;
+import javax.el.ELContext;
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.component.ValueHolder;
@@ -36,10 +36,6 @@ import javax.faces.webapp.UIComponentELT
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
-/*
- * Date: Oct 13, 2006
- * Time: 6:01:59 PM
- */
/**
* Register an Converter instance on the UIComponent
* associated with the closest parent UIComponent.
@@ -48,7 +44,10 @@ import javax.servlet.jsp.tagext.TagSuppo
@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.ConverterTag")
public abstract class ConverterTag extends TagSupport {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
+
+ private ValueExpression binding;
+ private ValueExpression converterId;
/**
* Create a new instance of the specified {@link javax.faces.convert.Converter}
@@ -86,71 +85,53 @@ public abstract class ConverterTag exten
Converter converter = null;
- if (isBindingSet() && !isBindingLiteral()) {
- Object valueBinding = getBindingAsBindingOrExpression();
- if (valueBinding != null) {
- Object obj = FacesUtils.getValueFromBindingOrExpression(valueBinding);
- if (obj != null && obj instanceof Converter) {
- converter = (Converter) obj;
- }
- }
+ final FacesContext facesContext = FacesContext.getCurrentInstance();
+ final ELContext elContext = facesContext.getELContext();
+
+ if (binding != null && !binding.isLiteralText()) {
+ converter = (Converter) binding.getValue(elContext);
}
- if (converter == null && isConverterIdSet()) {
- String localConverterId;
+ if (converter == null && converterId != null) {
+ String localConverterId = (String) converterId.getValue(elContext);
// evaluate any VB expression that we were passed
- if (!isConverterIdLiteral()) {
- Object typeValueBinding = getConverterIdAsBindingOrExpression();
- localConverterId = (String) FacesUtils.getValueFromBindingOrExpression(typeValueBinding);
- } else {
- localConverterId = getConverterIdValue();
- }
- converter = FacesContext.getCurrentInstance().getApplication().createConverter(localConverterId);
- if (converter != null && isBindingSet()) {
- Object valueBinding = getBindingAsBindingOrExpression();
- FacesUtils.setValueOfBindingOrExpression(FacesContext.getCurrentInstance(), converter, valueBinding);
- }
+ converter = facesContext.getApplication().createConverter(localConverterId);
}
+
if (converter != null) {
- if (!isBindingLiteral()) {
- FacesUtils.setValueOfBindingOrExpression(
- FacesContext.getCurrentInstance(), converter, component, Attributes.CONVERTER);
+ if (!binding.isLiteralText()) {
+ ValueExpression ve = component.getValueExpression(Attributes.CONVERTER);
+ if (ve != null) {
+ ve.setValue(elContext, converter);
+ }
} else {
valueHolder.setConverter(converter);
}
}
- // TODO else LOG.warn?
+
return (SKIP_BODY);
}
+ @Override
+ public void release() {
+ super.release();
+ binding = null;
+ converterId = null;
+ }
+
/**
* The converterId of a registered converter.
- *
*/
@TagAttribute(name = "converterId", type = "java.lang.String")
- public abstract void setConverterId(ValueExpression converterId);
-
- public abstract String getConverterIdValue();
-
- public abstract boolean isConverterIdSet();
-
- public abstract boolean isConverterIdLiteral();
-
- public abstract Object getConverterIdAsBindingOrExpression();
+ public void setConverterId(ValueExpression converterId) {
+ this.converterId = converterId;
+ }
/**
* The value binding expression to a converter.
- *
*/
@TagAttribute(name = "binding", type = "javax.faces.convert.Converter")
- public abstract void setBinding(ValueExpression binding);
-
- public abstract Converter getBindingValue();
-
- public abstract boolean isBindingSet();
-
- public abstract boolean isBindingLiteral();
-
- public abstract Object getBindingAsBindingOrExpression();
-
+ public void setBinding(ValueExpression binding) {
+ this.binding = binding;
+ }
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DataAttributeTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DataAttributeTag.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DataAttributeTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DataAttributeTag.java Mon Nov 26 15:51:50 2012
@@ -25,8 +25,10 @@ import org.apache.myfaces.tobago.apt.ann
import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
import org.apache.myfaces.tobago.util.ComponentUtils;
+import javax.el.ELContext;
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import javax.faces.webapp.UIComponentClassicTagBase;
import javax.faces.webapp.UIComponentELTag;
import javax.servlet.jsp.JspException;
@@ -34,7 +36,7 @@ import javax.servlet.jsp.tagext.TagSuppo
/**
* PRELIMINARY - SUBJECT TO CHANGE
- *
+ * <p/>
* Add an data attribute on the UIComponent
* associated with the closest parent UIComponent custom action.
* Data attributes will be passed through the renderers into the DOM of the user agent and
@@ -44,39 +46,17 @@ import javax.servlet.jsp.tagext.TagSuppo
@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.DataAttributeTag")
public abstract class DataAttributeTag extends TagSupport {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
- /**
- * PRELIMINARY - SUBJECT TO CHANGE
- *
- * The name of the attribute in the parent component.
- */
- @TagAttribute(required = true, name = "name", type = "java.lang.String")
- public abstract void setName(ValueExpression name);
-
- public abstract String getNameValue();
-
- public abstract boolean isNameLiteral();
-
- public abstract Object getNameAsBindingOrExpression();
-
- public abstract String getNameExpression();
-
- /**
- * PRELIMINARY - SUBJECT TO CHANGE
- *
- * The value of the attribute in the parent component.
- */
- @TagAttribute(required = true, name = "value", type = "java.lang.String")
- public abstract void setValue(ValueExpression value);
-
- public abstract String getValueValue();
-
- public abstract boolean isValueLiteral();
-
- public abstract Object getValueAsBindingOrExpression();
+ private javax.el.ValueExpression name;
+ private javax.el.ValueExpression value;
- public abstract String getValueExpression();
+ @Override
+ public void release() {
+ super.release();
+ name = null;
+ value = null;
+ }
/**
* @throws javax.servlet.jsp.JspException if a JSP error occurs
@@ -100,30 +80,34 @@ public abstract class DataAttributeTag e
// TODO Message resource i18n
throw new JspException("Component Instance is null");
}
- final Object attributeName;
- if (!isNameLiteral()) {
- attributeName = getNameAsBindingOrExpression();
- if (attributeName == null) {
- // TODO Message resource i18n
- throw new JspException("Can not get ValueBinding for attribute name " + getNameExpression());
- }
- } else {
- attributeName = getNameValue();
- }
- final Object attributeValue;
- if (!isValueLiteral()) {
- attributeValue = getValueAsBindingOrExpression();
- if (attributeValue == null) {
- // TODO Message resource i18n
- throw new JspException("Can not get ValueBinding for attribute value " + getValueExpression());
- }
- } else {
- attributeValue = getValueValue();
- }
+ final ELContext elContext = FacesContext.getCurrentInstance().getELContext();
+
+ final Object attributeName = name.getValue(elContext);
+ final Object attributeValue = value.getValue(elContext);
ComponentUtils.putDataAttribute(component, attributeName, attributeValue);
return (SKIP_BODY);
}
+
+ /**
+ * PRELIMINARY - SUBJECT TO CHANGE
+ * <p/>
+ * The name of the attribute in the parent component.
+ */
+ @TagAttribute(required = true, name = "name", type = "java.lang.String")
+ public void setName(ValueExpression name) {
+ this.name = name;
+ }
+
+ /**
+ * PRELIMINARY - SUBJECT TO CHANGE
+ * <p/>
+ * The value of the attribute in the parent component.
+ */
+ @TagAttribute(required = true, name = "value", type = "java.lang.String")
+ public void setValue(ValueExpression value) {
+ this.value = value;
+ }
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FileItemValidatorTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FileItemValidatorTag.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FileItemValidatorTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FileItemValidatorTag.java Mon Nov 26 15:51:50 2012
@@ -24,55 +24,67 @@ import org.apache.myfaces.tobago.apt.ann
import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
import org.apache.myfaces.tobago.util.ComponentUtils;
import org.apache.myfaces.tobago.validator.FileItemValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import javax.el.ELContext;
import javax.el.ValueExpression;
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
-import javax.faces.webapp.ValidatorTag;
+import javax.faces.webapp.ValidatorELTag;
import javax.servlet.jsp.JspException;
-/*
- * Date: Oct 30, 2006
- * Time: 11:07:35 PM
- */
-
/**
* Register an FileItemValidator instance on the UIComponent
* associated with the closest parent UIComponent custom action.
*/
@Tag(name = "validateFileItem")
@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.FileItemValidatorTag")
-public abstract class FileItemValidatorTag extends ValidatorTag {
+// todo: use ValidatorELTag instead of ValidatorTag
+public abstract class FileItemValidatorTag extends ValidatorELTag {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
- @TagAttribute(name = "maxSize", type = "java.lang.Integer")
- public abstract void setMaxSize(ValueExpression maxSize);
+ private static final Logger LOG = LoggerFactory.getLogger(FileItemValidatorTag.class);
- public abstract Integer getMaxSizeValue();
-
- public abstract boolean isMaxSizeSet();
-
- @TagAttribute(name = "contentType", type = "java.lang.String")
- public abstract void setContentType(ValueExpression contentType);
-
- public abstract String getContentTypeValue();
-
- public abstract boolean isContentTypeSet();
+ private javax.el.ValueExpression contentType;
+ private javax.el.ValueExpression maxSize;
protected Validator createValidator() throws JspException {
- setValidatorId(FileItemValidator.VALIDATOR_ID);
- FileItemValidator validator = (FileItemValidator) super.createValidator();
- if (isMaxSizeSet()) {
+ final FacesContext facesContext = FacesContext.getCurrentInstance();
+ final Application application = facesContext.getApplication();
+ final FileItemValidator validator = (FileItemValidator) application.createValidator(FileItemValidator.VALIDATOR_ID);
+ final ELContext elContext = facesContext.getELContext();
+
+ if (maxSize != null) {
try {
- validator.setMaxSize(getMaxSizeValue());
+ validator.setMaxSize((Integer) maxSize.getValue(elContext));
} catch (NumberFormatException e) {
- // ignore
+ LOG.warn(e.getMessage());
}
}
- if (isContentTypeSet()) {
- validator.setContentType(ComponentUtils.splitList(getContentTypeValue()));
+ if (contentType != null) {
+ validator.setContentType(ComponentUtils.splitList((String) contentType.getValue(elContext)));
}
return validator;
}
+
+ @Override
+ public void release() {
+ super.release();
+ contentType = null;
+ maxSize = null;
+ }
+
+ @TagAttribute(name = "maxSize", type = "java.lang.Integer")
+ public void setMaxSize(ValueExpression maxSize) {
+ this.maxSize = maxSize;
+ }
+
+ @TagAttribute(name = "contentType", type = "java.lang.String")
+ public void setContentType(ValueExpression contentType) {
+ this.contentType = contentType;
+ }
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/GridLayoutConstraintTag.java Mon Nov 26 15:51:50 2012
@@ -24,12 +24,10 @@ import org.apache.myfaces.tobago.apt.ann
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
-import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.layout.LayoutBase;
import org.apache.myfaces.tobago.layout.LayoutComponent;
import org.apache.myfaces.tobago.layout.LayoutContainer;
-import org.apache.myfaces.tobago.layout.Measure;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,10 +45,32 @@ import javax.servlet.jsp.tagext.TagSuppo
@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.GridLayoutConstraintTag")
public abstract class GridLayoutConstraintTag extends TagSupport {
- private static final long serialVersionUID = 3L;
+ private static final long serialVersionUID = 4L;
private static final Logger LOG = LoggerFactory.getLogger(GridLayoutConstraintTag.class);
+ private javax.el.ValueExpression borderBottom;
+ private javax.el.ValueExpression borderLeft;
+ private javax.el.ValueExpression borderRight;
+ private javax.el.ValueExpression borderTop;
+ private javax.el.ValueExpression columnSpan;
+ private javax.el.ValueExpression height;
+ private javax.el.ValueExpression marginBottom;
+ private javax.el.ValueExpression marginLeft;
+ private javax.el.ValueExpression marginRight;
+ private javax.el.ValueExpression marginTop;
+ private javax.el.ValueExpression maximumHeight;
+ private javax.el.ValueExpression maximumWidth;
+ private javax.el.ValueExpression minimumHeight;
+ private javax.el.ValueExpression minimumWidth;
+ private javax.el.ValueExpression paddingBottom;
+ private javax.el.ValueExpression paddingLeft;
+ private javax.el.ValueExpression paddingRight;
+ private javax.el.ValueExpression paddingTop;
+ private javax.el.ValueExpression preferredHeight;
+ private javax.el.ValueExpression preferredWidth;
+ private javax.el.ValueExpression rowSpan;
+ private javax.el.ValueExpression width;
@Override
public int doStartTag() throws JspException {
@@ -75,7 +95,7 @@ public abstract class GridLayoutConstrai
// XXX need a better solution
if (component.getParent() != null && component.getParent().getClass().getName().endsWith("UIExtensionPanel")) {
- component = component.getParent();
+ component = component.getParent();
}
if (!(component instanceof LayoutBase)) {
@@ -83,545 +103,358 @@ public abstract class GridLayoutConstrai
throw new JspException("Component Instance is not a LayoutBase");
}
+ final boolean isLayoutContainer = component instanceof LayoutContainer;
+ final boolean isLayoutComponent = component instanceof LayoutComponent;
- if (component instanceof LayoutComponent && isColumnSpanSet()) {
- if (isColumnSpanLiteral()) {
- ((LayoutComponent) component).setColumnSpan(getColumnSpanValue());
+ if (columnSpan != null) {
+ if (isLayoutComponent) {
+ component.setValueExpression(Attributes.COLUMN_SPAN, columnSpan);
} else {
- FacesUtils.setBindingOrExpression(component, Attributes.COLUMN_SPAN, getColumnSpanAsBindingOrExpression());
+ LOG.warn("Ignoring '" + Attributes.COLUMN_SPAN + "', because the parent is not a LayoutComponent!");
}
}
- if (component instanceof LayoutComponent && isRowSpanSet()) {
- if (isRowSpanLiteral()) {
- ((LayoutComponent) component).setRowSpan(getRowSpanValue());
+ if (rowSpan != null) {
+ if (isLayoutComponent) {
+ component.setValueExpression(Attributes.ROW_SPAN, rowSpan);
} else {
- FacesUtils.setBindingOrExpression(component, Attributes.ROW_SPAN, getRowSpanAsBindingOrExpression());
+ LOG.warn("Ignoring '" + Attributes.ROW_SPAN + "', because the parent is not a LayoutComponent!");
}
}
- if (isWidthSet()) {
- if (isWidthLiteral()) {
- ((LayoutBase) component).setWidth(getWidthValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.WIDTH, getWidthAsBindingOrExpression());
- }
+ if (width != null) {
+ component.setValueExpression(Attributes.WIDTH, width);
}
- if (isHeightSet()) {
- if (isHeightLiteral()) {
- ((LayoutBase) component).setHeight(getHeightValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.HEIGHT, getHeightAsBindingOrExpression());
- }
+ if (height != null) {
+ component.setValueExpression(Attributes.HEIGHT, height);
}
- if (isMinimumWidthSet()) {
- if (isMinimumWidthLiteral()) {
- ((LayoutBase) component).setMinimumWidth(getMinimumWidthValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.MINIMUM_WIDTH, getMinimumWidthAsBindingOrExpression());
- }
+ if (minimumWidth != null) {
+ component.setValueExpression(Attributes.MINIMUM_WIDTH, minimumWidth);
}
- if (isMinimumHeightSet()) {
- if (isMinimumHeightLiteral()) {
- ((LayoutBase) component).setMinimumHeight(getMinimumHeightValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.MINIMUM_WIDTH, getMinimumHeightAsBindingOrExpression());
- }
+ if (minimumHeight != null) {
+ component.setValueExpression(Attributes.MINIMUM_HEIGHT, minimumHeight);
}
- if (isPreferredWidthSet()) {
- if (isPreferredWidthLiteral()) {
- ((LayoutBase) component).setPreferredWidth(getPreferredWidthValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.PREFERRED_WIDTH,
- getPreferredWidthAsBindingOrExpression());
- }
+ if (preferredWidth != null) {
+ component.setValueExpression(Attributes.PREFERRED_WIDTH, preferredWidth);
}
- if (isPreferredHeightSet()) {
- if (isPreferredHeightLiteral()) {
- ((LayoutBase) component).setPreferredHeight(getPreferredHeightValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.PREFERRED_WIDTH,
- getPreferredHeightAsBindingOrExpression());
- }
+ if (preferredHeight != null) {
+ component.setValueExpression(Attributes.PREFERRED_HEIGHT, preferredHeight);
}
- if (isMaximumWidthSet()) {
- if (isMaximumWidthLiteral()) {
- ((LayoutBase) component).setMaximumWidth(getMaximumWidthValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.MAXIMUM_WIDTH, getMaximumWidthAsBindingOrExpression());
- }
+ if (maximumWidth != null) {
+ component.setValueExpression(Attributes.MAXIMUM_WIDTH, maximumWidth);
}
- if (isMaximumHeightSet()) {
- if (isMaximumHeightLiteral()) {
- ((LayoutBase) component).setMaximumHeight(getMaximumHeightValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.MAXIMUM_WIDTH, getMaximumHeightAsBindingOrExpression());
- }
+ if (maximumHeight != null) {
+ component.setValueExpression(Attributes.MAXIMUM_HEIGHT, maximumHeight);
}
- if (isMarginLeftSet()) {
- if (isMarginLeftLiteral()) {
- ((LayoutBase) component).setMarginLeft(getMarginLeftValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.MARGIN_LEFT, getMarginLeftAsBindingOrExpression());
- }
+ if (marginLeft != null) {
+ component.setValueExpression(Attributes.MARGIN_LEFT, marginLeft);
}
- if (isMarginRightSet()) {
- if (isMarginRightLiteral()) {
- ((LayoutBase) component).setMarginRight(getMarginRightValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.MARGIN_RIGHT, getMarginRightAsBindingOrExpression());
- }
+ if (marginRight != null) {
+ component.setValueExpression(Attributes.MARGIN_RIGHT, marginRight);
}
- if (isMarginTopSet()) {
- if (isMarginTopLiteral()) {
- ((LayoutBase) component).setMarginTop(getMarginTopValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.MARGIN_TOP, getMarginTopAsBindingOrExpression());
- }
+
+ if (marginTop != null) {
+ component.setValueExpression(Attributes.MARGIN_TOP, marginTop);
}
- if (isMarginBottomSet()) {
- if (isMarginBottomLiteral()) {
- ((LayoutBase) component).setMarginBottom(getMarginBottomValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.MARGIN_BOTTOM, getMarginBottomAsBindingOrExpression());
- }
+ if (marginBottom != null) {
+ component.setValueExpression(Attributes.MARGIN_BOTTOM, marginBottom);
}
- if (isBorderLeftSet()) {
- if (component instanceof LayoutContainer) {
- if (isBorderLeftLiteral()) {
- ((LayoutContainer) component).setBorderLeft(getBorderLeftValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.BORDER_LEFT, getBorderLeftAsBindingOrExpression());
- }
+ if (borderLeft != null) {
+ if (isLayoutContainer) {
+ component.setValueExpression(Attributes.BORDER_LEFT, borderLeft);
} else {
- LOG.warn("Ignoring border left, because the parent is not a LayoutContainer!");
+ LOG.warn("Ignoring '" + Attributes.BORDER_LEFT + "', because the parent is not a LayoutContainer!");
}
}
- if (isBorderRightSet()) {
- if (component instanceof LayoutContainer) {
- if (isBorderRightLiteral()) {
- ((LayoutContainer) component).setBorderRight(getBorderRightValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.BORDER_RIGHT, getBorderRightAsBindingOrExpression());
- }
+ if (borderRight != null) {
+ if (isLayoutContainer) {
+ component.setValueExpression(Attributes.BORDER_RIGHT, borderRight);
} else {
- LOG.warn("Ignoring border left, because the parent is not a LayoutContainer!");
+ LOG.warn("Ignoring '" + Attributes.BORDER_RIGHT + "', because the parent is not a LayoutContainer!");
}
}
- if (isBorderTopSet()) {
- if (component instanceof LayoutContainer) {
- if (isBorderTopLiteral()) {
- ((LayoutContainer) component).setBorderTop(getBorderTopValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.BORDER_TOP, getBorderTopAsBindingOrExpression());
- }
+ if (borderTop != null) {
+ if (isLayoutContainer) {
+ component.setValueExpression(Attributes.BORDER_TOP, borderTop);
} else {
- LOG.warn("Ignoring border left, because the parent is not a LayoutContainer!");
+ LOG.warn("Ignoring '" + Attributes.BORDER_TOP + "', because the parent is not a LayoutContainer!");
}
}
- if (isBorderBottomSet()) {
- if (component instanceof LayoutContainer) {
- if (isBorderBottomLiteral()) {
- ((LayoutContainer) component).setBorderBottom(getBorderBottomValue());
- } else {
- FacesUtils
- .setBindingOrExpression(component, Attributes.BORDER_BOTTOM, getBorderBottomAsBindingOrExpression());
- }
+ if (borderBottom != null) {
+ if (isLayoutContainer) {
+ component.setValueExpression(Attributes.BORDER_BOTTOM, borderBottom);
} else {
- LOG.warn("Ignoring border left, because the parent is not a LayoutContainer!");
+ LOG.warn("Ignoring '" + Attributes.BORDER_BOTTOM + "', because the parent is not a LayoutContainer!");
}
}
- if (isPaddingLeftSet()) {
- if (component instanceof LayoutContainer) {
- if (isPaddingLeftLiteral()) {
- ((LayoutContainer) component).setPaddingLeft(getPaddingLeftValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.PADDING_LEFT, getPaddingLeftAsBindingOrExpression());
- }
+ if (paddingLeft != null) {
+ if (isLayoutContainer) {
+ component.setValueExpression(Attributes.PADDING_LEFT, paddingLeft);
} else {
- LOG.warn("Ignoring padding left, because the parent is not a LayoutContainer!");
+ LOG.warn("Ignoring '" + Attributes.PADDING_LEFT + "', because the parent is not a LayoutContainer!");
}
}
- if (isPaddingRightSet()) {
- if (component instanceof LayoutContainer) {
- if (isPaddingRightLiteral()) {
- ((LayoutContainer) component).setPaddingRight(getPaddingRightValue());
- } else {
- FacesUtils.setBindingOrExpression(
- component, Attributes.PADDING_RIGHT, getPaddingRightAsBindingOrExpression());
- }
+ if (paddingRight != null) {
+ if (isLayoutContainer) {
+ component.setValueExpression(Attributes.PADDING_RIGHT, paddingRight);
} else {
- LOG.warn("Ignoring padding left, because the parent is not a LayoutContainer!");
+ LOG.warn("Ignoring '" + Attributes.PADDING_RIGHT + "', because the parent is not a LayoutContainer!");
}
}
- if (isPaddingTopSet()) {
- if (component instanceof LayoutContainer) {
- if (isPaddingTopLiteral()) {
- ((LayoutContainer) component).setPaddingTop(getPaddingTopValue());
- } else {
- FacesUtils.setBindingOrExpression(component, Attributes.PADDING_TOP, getPaddingTopAsBindingOrExpression());
- }
+ if (paddingTop != null) {
+ if (isLayoutContainer) {
+ component.setValueExpression(Attributes.PADDING_TOP, paddingTop);
} else {
- LOG.warn("Ignoring padding left, because the parent is not a LayoutContainer!");
+ LOG.warn("Ignoring '" + Attributes.PADDING_TOP + "', because the parent is not a LayoutContainer!");
}
}
- if (isPaddingBottomSet()) {
- if (component instanceof LayoutContainer) {
- if (isPaddingBottomLiteral()) {
- ((LayoutContainer) component).setPaddingBottom(getPaddingBottomValue());
- } else {
- FacesUtils
- .setBindingOrExpression(component, Attributes.PADDING_BOTTOM, getPaddingBottomAsBindingOrExpression());
- }
+ if (paddingBottom != null) {
+ if (isLayoutContainer) {
+ component.setValueExpression(Attributes.PADDING_BOTTOM, paddingBottom);
} else {
- LOG.warn("Ignoring padding left, because the parent is not a LayoutContainer!");
+ LOG.warn("Ignoring '" + Attributes.PADDING_BOTTOM + "', because the parent is not a LayoutContainer!");
}
}
return (SKIP_BODY);
}
+ @Override
+ public void release() {
+ super.release();
+ borderBottom = null;
+ borderLeft = null;
+ borderRight = null;
+ borderTop = null;
+ columnSpan = null;
+ height = null;
+ marginBottom = null;
+ marginLeft = null;
+ marginRight = null;
+ marginTop = null;
+ maximumHeight = null;
+ maximumWidth = null;
+ minimumHeight = null;
+ minimumWidth = null;
+ paddingBottom = null;
+ paddingLeft = null;
+ paddingRight = null;
+ paddingTop = null;
+ preferredHeight = null;
+ preferredWidth = null;
+ rowSpan = null;
+ width = null;
+ }
+
/**
* The number of horizontal cells this component should use.
*/
@TagAttribute(name = "columnSpan", type = "java.lang.Integer")
- public abstract void setColumnSpan(ValueExpression columnSpan);
-
- public abstract Integer getColumnSpanValue();
-
- public abstract boolean isColumnSpanSet();
-
- public abstract boolean isColumnSpanLiteral();
-
- public abstract Object getColumnSpanAsBindingOrExpression();
+ public void setColumnSpan(ValueExpression columnSpan) {
+ this.columnSpan = columnSpan;
+ }
/**
* The number of vertical cells this component should use.
*/
@TagAttribute(name = "rowSpan", type = "java.lang.Integer")
- public abstract void setRowSpan(ValueExpression rowSpan);
-
- public abstract Integer getRowSpanValue();
-
- public abstract boolean isRowSpanSet();
-
- public abstract boolean isRowSpanLiteral();
-
- public abstract Object getRowSpanAsBindingOrExpression();
+ public void setRowSpan(ValueExpression rowSpan) {
+ this.rowSpan = rowSpan;
+ }
/**
* The width for this component.
*/
@TagAttribute(name = "width", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setWidth(ValueExpression width);
-
- public abstract Measure getWidthValue();
-
- public abstract boolean isWidthSet();
-
- public abstract boolean isWidthLiteral();
-
- public abstract Object getWidthAsBindingOrExpression();
+ public void setWidth(ValueExpression width) {
+ this.width = width;
+ }
/**
* The height for this component.
*/
@TagAttribute(name = "height", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setHeight(ValueExpression height);
-
- public abstract Measure getHeightValue();
-
- public abstract boolean isHeightSet();
-
- public abstract boolean isHeightLiteral();
-
- public abstract Object getHeightAsBindingOrExpression();
+ public void setHeight(ValueExpression height) {
+ this.height = height;
+ }
/**
* The minimum width for this component.
*/
@TagAttribute(name = "minimumWidth", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setMinimumWidth(ValueExpression minimumWidth);
-
- public abstract Measure getMinimumWidthValue();
-
- public abstract boolean isMinimumWidthSet();
-
- public abstract boolean isMinimumWidthLiteral();
-
- public abstract Object getMinimumWidthAsBindingOrExpression();
+ public void setMinimumWidth(ValueExpression minimumWidth) {
+ this.minimumWidth = minimumWidth;
+ }
/**
* The minimum height for this component.
*/
@TagAttribute(name = "minimumHeight", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setMinimumHeight(ValueExpression minimumHeight);
-
- public abstract Measure getMinimumHeightValue();
-
- public abstract boolean isMinimumHeightSet();
-
- public abstract boolean isMinimumHeightLiteral();
-
- public abstract Object getMinimumHeightAsBindingOrExpression();
+ public void setMinimumHeight(ValueExpression minimumHeight) {
+ this.minimumHeight = minimumHeight;
+ }
/**
* The preferred width for this component.
*/
@TagAttribute(name = "preferredWidth", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setPreferredWidth(ValueExpression preferredWidth);
-
- public abstract Measure getPreferredWidthValue();
-
- public abstract boolean isPreferredWidthSet();
-
- public abstract boolean isPreferredWidthLiteral();
-
- public abstract Object getPreferredWidthAsBindingOrExpression();
+ public void setPreferredWidth(ValueExpression preferredWidth) {
+ this.preferredWidth = preferredWidth;
+ }
/**
* The preferred height for this component.
*/
@TagAttribute(name = "preferredHeight", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setPreferredHeight(ValueExpression preferredHeight);
-
- public abstract Measure getPreferredHeightValue();
-
- public abstract boolean isPreferredHeightSet();
-
- public abstract boolean isPreferredHeightLiteral();
-
- public abstract Object getPreferredHeightAsBindingOrExpression();
+ public void setPreferredHeight(ValueExpression preferredHeight) {
+ this.preferredHeight = preferredHeight;
+ }
/**
* The maximum width for this component.
*/
@TagAttribute(name = "maximumWidth", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setMaximumWidth(ValueExpression maximumWidth);
-
- public abstract Measure getMaximumWidthValue();
-
- public abstract boolean isMaximumWidthSet();
-
- public abstract boolean isMaximumWidthLiteral();
-
- public abstract Object getMaximumWidthAsBindingOrExpression();
+ public void setMaximumWidth(ValueExpression maximumWidth) {
+ this.maximumWidth = maximumWidth;
+ }
/**
* The maximum height for this component.
*/
@TagAttribute(name = "maximumHeight", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setMaximumHeight(ValueExpression maximumHeight);
-
- public abstract Measure getMaximumHeightValue();
-
- public abstract boolean isMaximumHeightSet();
-
- public abstract boolean isMaximumHeightLiteral();
-
- public abstract Object getMaximumHeightAsBindingOrExpression();
+ public void setMaximumHeight(ValueExpression maximumHeight) {
+ this.maximumHeight = maximumHeight;
+ }
/**
* The left margin for this component.
*/
@TagAttribute(name = "marginLeft", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setMarginLeft(ValueExpression marginLeft);
-
- public abstract Measure getMarginLeftValue();
-
- public abstract boolean isMarginLeftSet();
-
- public abstract boolean isMarginLeftLiteral();
-
- public abstract Object getMarginLeftAsBindingOrExpression();
+ public void setMarginLeft(ValueExpression marginLeft) {
+ this.marginLeft = marginLeft;
+ }
/**
* The right margin for this component.
*/
@TagAttribute(name = "marginRight", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setMarginRight(ValueExpression marginLeft);
-
- public abstract Measure getMarginRightValue();
-
- public abstract boolean isMarginRightSet();
-
- public abstract boolean isMarginRightLiteral();
-
- public abstract Object getMarginRightAsBindingOrExpression();
+ public void setMarginRight(ValueExpression marginRight) {
+ this.marginRight = marginRight;
+ }
/**
* The top margin for this component.
*/
@TagAttribute(name = "marginTop", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setMarginTop(ValueExpression marginTop);
-
- public abstract Measure getMarginTopValue();
-
- public abstract boolean isMarginTopSet();
-
- public abstract boolean isMarginTopLiteral();
-
- public abstract Object getMarginTopAsBindingOrExpression();
+ public void setMarginTop(ValueExpression marginTop) {
+ this.marginTop = marginTop;
+ }
/**
* The bottom margin for this component.
*/
@TagAttribute(name = "marginBottom", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setMarginBottom(ValueExpression marginBottom);
-
- public abstract Measure getMarginBottomValue();
-
- public abstract boolean isMarginBottomSet();
-
- public abstract boolean isMarginBottomLiteral();
-
- public abstract Object getMarginBottomAsBindingOrExpression();
+ public void setMarginBottom(ValueExpression marginBottom) {
+ this.marginBottom = marginBottom;
+ }
/**
* The left border area for this component. Its only applicably for containers.
*/
@TagAttribute(name = "borderLeft", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setBorderLeft(ValueExpression borderLeft);
-
- public abstract Measure getBorderLeftValue();
-
- public abstract boolean isBorderLeftSet();
-
- public abstract boolean isBorderLeftLiteral();
-
- public abstract Object getBorderLeftAsBindingOrExpression();
+ public void setBorderLeft(ValueExpression borderLeft) {
+ this.borderLeft = borderLeft;
+ }
/**
* The right border area for this component. Its only applicably for containers.
*/
@TagAttribute(name = "borderRight", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setBorderRight(ValueExpression borderRight);
-
- public abstract Measure getBorderRightValue();
-
- public abstract boolean isBorderRightSet();
-
- public abstract boolean isBorderRightLiteral();
-
- public abstract Object getBorderRightAsBindingOrExpression();
+ public void setBorderRight(ValueExpression borderRight) {
+ this.borderRight = borderRight;
+ }
/**
* The top border area for this component. Its only applicably for containers.
*/
@TagAttribute(name = "borderTop", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setBorderTop(ValueExpression borderTop);
-
- public abstract Measure getBorderTopValue();
-
- public abstract boolean isBorderTopSet();
-
- public abstract boolean isBorderTopLiteral();
-
- public abstract Object getBorderTopAsBindingOrExpression();
+ public void setBorderTop(ValueExpression borderTop) {
+ this.borderTop = borderTop;
+ }
/**
* The bottom border area for this component. Its only applicably for containers.
*/
@TagAttribute(name = "borderBottom", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setBorderBottom(ValueExpression borderBottom);
-
- public abstract Measure getBorderBottomValue();
-
- public abstract boolean isBorderBottomSet();
-
- public abstract boolean isBorderBottomLiteral();
-
- public abstract Object getBorderBottomAsBindingOrExpression();
+ public void setBorderBottom(ValueExpression borderBottom) {
+ this.borderBottom = borderBottom;
+ }
/**
* The left padding for this component. Its only applicably for containers.
*/
@TagAttribute(name = "paddingLeft", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setPaddingLeft(ValueExpression paddingLeft);
-
- public abstract Measure getPaddingLeftValue();
-
- public abstract boolean isPaddingLeftSet();
-
- public abstract boolean isPaddingLeftLiteral();
-
- public abstract Object getPaddingLeftAsBindingOrExpression();
+ public void setPaddingLeft(ValueExpression paddingLeft) {
+ this.paddingLeft = paddingLeft;
+ }
/**
* The right padding for this component. Its only applicably for containers.
*/
@TagAttribute(name = "paddingRight", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setPaddingRight(ValueExpression paddingRight);
-
- public abstract Measure getPaddingRightValue();
-
- public abstract boolean isPaddingRightSet();
-
- public abstract boolean isPaddingRightLiteral();
-
- public abstract Object getPaddingRightAsBindingOrExpression();
+ public void setPaddingRight(ValueExpression paddingRight) {
+ this.paddingRight = paddingRight;
+ }
/**
* The top padding for this component. Its only applicably for containers.
*/
@TagAttribute(name = "paddingTop", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setPaddingTop(ValueExpression paddingTop);
-
- public abstract Measure getPaddingTopValue();
-
- public abstract boolean isPaddingTopSet();
-
- public abstract boolean isPaddingTopLiteral();
-
- public abstract Object getPaddingTopAsBindingOrExpression();
+ public void setPaddingTop(ValueExpression paddingTop) {
+ this.paddingTop = paddingTop;
+ }
/**
* The bottom padding for this component. Its only applicably for containers.
*/
@TagAttribute(name = "paddingBottom", type = "org.apache.myfaces.tobago.layout.Measure")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract void setPaddingBottom(ValueExpression paddingBottom);
-
- public abstract Measure getPaddingBottomValue();
-
- public abstract boolean isPaddingBottomSet();
-
- public abstract boolean isPaddingBottomLiteral();
-
- public abstract Object getPaddingBottomAsBindingOrExpression();
+ public void setPaddingBottom(ValueExpression paddingBottom) {
+ this.paddingBottom = paddingBottom;
+ }
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LoadBundleTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LoadBundleTag.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LoadBundleTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/LoadBundleTag.java Mon Nov 26 15:51:50 2012
@@ -20,11 +20,14 @@
package org.apache.myfaces.tobago.internal.taglib.component;
import org.apache.myfaces.tobago.apt.annotation.BodyContent;
+import org.apache.myfaces.tobago.apt.annotation.DynamicExpression;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.util.BundleMapWrapper;
+import javax.el.ELContext;
import javax.el.ValueExpression;
import javax.faces.context.FacesContext;
import javax.servlet.jsp.JspException;
@@ -46,33 +49,46 @@ import java.util.Map;
@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.LoadBundleTag")
public abstract class LoadBundleTag extends TagSupport {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
+
+ private ValueExpression basename;
+ private String var;
+
+ public int doStartTag() throws JspException {
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ final ELContext elContext = facesContext.getELContext();
+
+ Map toStore = new BundleMapWrapper((String) basename.getValue(elContext));
+ // (session scope is needed to support ajax requests)
+ facesContext.getExternalContext().getSessionMap().put(var, toStore);
+
+ return EVAL_BODY_INCLUDE;
+ }
+
+ @Override
+ public void release() {
+ super.release();
+ basename = null;
+ var = null;
+ }
/**
* Base name of the resource bundle to be loaded.
*/
@TagAttribute(required = true, name = "basename", type = "java.lang.String")
- public abstract void setBasename(ValueExpression basename);
-
- public abstract String getBasenameValue();
+ public void setBasename(ValueExpression basename) {
+ this.basename = basename;
+ }
/**
* Name of a session-scope attribute under which the bundle data
* will be exposed.
*/
@TagAttribute(required = true, name = "var")
- public abstract void setVar(ValueExpression var);
-
- public abstract String getVarValue();
-
- public int doStartTag() throws JspException {
-
- FacesContext context = FacesContext.getCurrentInstance();
-
- Map toStore = new BundleMapWrapper(getBasenameValue());
- // (session scope is needed to support ajax requests)
- context.getExternalContext().getSessionMap().put(getVarValue(), toStore);
-
- return EVAL_BODY_INCLUDE;
+ @UIComponentTagAttribute(expression = DynamicExpression.PROHIBITED)
+ public void setVar(String var){
+ this.var = var;
}
+
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupReferenceTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupReferenceTag.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupReferenceTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/PopupReferenceTag.java Mon Nov 26 15:51:50 2012
@@ -23,22 +23,18 @@ import org.apache.myfaces.tobago.apt.ann
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
-import org.apache.myfaces.tobago.compat.FacesUtils;
+import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.event.PopupActionListener;
import javax.el.ValueExpression;
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import javax.faces.webapp.UIComponentClassicTagBase;
import javax.faces.webapp.UIComponentELTag;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
-/*
- * Date: Jan 3, 2007
- * Time: 10:42:11 PM
- */
-
/**
* Register an PopupActionListener instance on the UIComponent
* associated with the closest parent UIComponent.
@@ -47,19 +43,9 @@ import javax.servlet.jsp.tagext.TagSuppo
@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.PopupReferenceTag")
public abstract class PopupReferenceTag extends TagSupport {
- private static final long serialVersionUID = 1L;
-
- /**
- * The id of a Popup.
- */
- @TagAttribute(required = true, name ="for", type = "java.lang.String")
- public abstract void setFor(ValueExpression forValue);
-
- public abstract String getForValue();
-
- public abstract boolean isForLiteral();
+ private static final long serialVersionUID = 2L;
- public abstract Object getForAsBindingOrExpression();
+ private javax.el.ValueExpression forValue;
public int doStartTag() throws JspException {
@@ -85,12 +71,24 @@ public abstract class PopupReferenceTag
throw new JspException("Component " + component.getClass().getName() + " is not instanceof ActionSource");
}
ActionSource actionSource = (ActionSource) component;
- if (isForLiteral()) {
- actionSource.addActionListener(new PopupActionListener(getForValue()));
+
+ component.setValueExpression(Attributes.FOR, forValue);
+
+ if (forValue.isLiteralText()) {
+ actionSource.addActionListener(new PopupActionListener(
+ (String) forValue.getValue(FacesContext.getCurrentInstance().getELContext())));
} else {
- FacesUtils.addBindingOrExpressionPopupActionListener(actionSource, getForAsBindingOrExpression());
+ component.setValueExpression(Attributes.FOR, forValue);
}
return (SKIP_BODY);
}
+ /**
+ * The id of a Popup.
+ */
+ @TagAttribute(required = true, name = "for", type = "java.lang.String")
+ public void setFor(ValueExpression forValue) {
+ this.forValue = forValue;
+ }
+
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ResetInputActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ResetInputActionListenerTag.java?rev=1413689&r1=1413688&r2=1413689&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ResetInputActionListenerTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ResetInputActionListenerTag.java Mon Nov 26 15:51:50 2012
@@ -23,15 +23,17 @@ import org.apache.myfaces.tobago.apt.ann
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.TagGeneration;
-import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.event.ResetFormActionListener;
import org.apache.myfaces.tobago.event.ResetInputActionListener;
+import org.apache.myfaces.tobago.event.ValueExpressionResetInputActionListener;
import org.apache.myfaces.tobago.util.ComponentUtils;
+import javax.el.ELContext;
import javax.el.ValueExpression;
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import javax.faces.webapp.UIComponentClassicTagBase;
import javax.faces.webapp.UIComponentELTag;
import javax.servlet.jsp.JspException;
@@ -44,21 +46,9 @@ import javax.servlet.jsp.tagext.TagSuppo
@TagGeneration(className = "org.apache.myfaces.tobago.internal.taglib.ResetInputActionListenerTag")
public abstract class ResetInputActionListenerTag extends TagSupport {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
- /**
- * The .
- */
- @TagAttribute(required = false, name = Attributes.EXECUTE, type = "java.lang.String")
- public abstract void setExecute(ValueExpression execute);
-
- public abstract String getExecuteValue();
-
- public abstract boolean isExecuteLiteral();
-
- public abstract Object getExecuteAsBindingOrExpression();
-
- public abstract boolean isExecuteSet();
+ private ValueExpression execute;
public int doStartTag() throws JspException {
@@ -83,15 +73,30 @@ public abstract class ResetInputActionLi
// TODO Message resource i18n
throw new JspException("Component " + component.getClass().getName() + " is not instanceof ActionSource");
}
+
+ final ELContext elContext = FacesContext.getCurrentInstance().getELContext();
+
ActionSource actionSource = (ActionSource) component;
- if (!isExecuteSet()) {
+ if (execute == null) {
actionSource.addActionListener(new ResetFormActionListener());
- } else if (isExecuteLiteral()) {
- actionSource.addActionListener(new ResetInputActionListener(ComponentUtils.splitList(getExecuteValue())));
+ } else if (execute.isLiteralText()) {
+ actionSource.addActionListener(new ResetInputActionListener(
+ ComponentUtils.splitList((String) execute.getValue(elContext))));
} else {
- FacesUtils.addBindingOrExpressionResetActionListener(actionSource, getExecuteAsBindingOrExpression());
+ actionSource.addActionListener(new ValueExpressionResetInputActionListener(execute));
}
return (SKIP_BODY);
}
+ @Override
+ public void release() {
+ super.release();
+ execute = null;
+ }
+
+ @TagAttribute(required = false, name = Attributes.EXECUTE, type = "java.lang.String")
+ public void setExecute(javax.el.ValueExpression execute) {
+ this.execute = execute;
+ }
+
}