You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2008/04/02 21:37:18 UTC
svn commit: r644014 [5/10] - in /myfaces/tobago/trunk: ./ core/
core/src/main/faces-config/
core/src/main/java/org/apache/myfaces/tobago/ajax/api/
core/src/main/java/org/apache/myfaces/tobago/application/
core/src/main/java/org/apache/myfaces/tobago/co...
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SubmittedValueLengthValidatorTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SubmittedValueLengthValidatorTag.java?rev=644014&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SubmittedValueLengthValidatorTag.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SubmittedValueLengthValidatorTag.java Wed Apr 2 12:36:26 2008
@@ -0,0 +1,89 @@
+package org.apache.myfaces.tobago.taglib.component;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.myfaces.tobago.apt.annotation.Tag;
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
+import org.apache.myfaces.tobago.validator.SubmittedValueLengthValidator;
+
+import javax.faces.validator.Validator;
+import javax.faces.webapp.ValidatorTag;
+import javax.servlet.jsp.JspException;
+
+/*
+ * Date: Oct 17, 2006
+ * Time: 12:35:01 AM
+ */
+
+/**
+ * Register an SubmittedValueLengthValidator instance on the UIComponent
+ * associated with the closest parent UIComponent custom action.
+ */
+@Tag(name = "validateSubmittedValueLength")
+public class SubmittedValueLengthValidatorTag extends ValidatorTag {
+
+ private static final long serialVersionUID = 6777040780038715924L;
+
+ private String minimum;
+ private String maximum;
+
+ public String getMinimum() {
+ return minimum;
+ }
+
+ @TagAttribute()
+ public void setMinimum(String minimum) {
+ this.minimum = minimum;
+ }
+
+ public String getMaximum() {
+ return maximum;
+ }
+
+ @TagAttribute()
+ public void setMaximum(String maximum) {
+ this.maximum = maximum;
+ }
+
+ protected Validator createValidator() throws JspException {
+ setValidatorId(SubmittedValueLengthValidator.VALIDATOR_ID);
+ SubmittedValueLengthValidator validator = (SubmittedValueLengthValidator) super.createValidator();
+ if (minimum != null) {
+ try {
+ validator.setMinimum(Integer.parseInt(minimum));
+ } catch (NumberFormatException e) {
+ // ignore
+ }
+ }
+ if (maximum != null) {
+ try {
+ validator.setMaximum(Integer.parseInt(maximum));
+ } catch (NumberFormatException e) {
+ // ignore
+ }
+ }
+ return validator;
+ }
+
+
+ public void release() {
+ super.release();
+ minimum = null;
+ maximum = null;
+ }
+}
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabChangeListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabChangeListenerTag.java?rev=644014&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabChangeListenerTag.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabChangeListenerTag.java Wed Apr 2 12:36:26 2008
@@ -0,0 +1,159 @@
+package org.apache.myfaces.tobago.taglib.component;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.apt.annotation.BodyContent;
+import org.apache.myfaces.tobago.apt.annotation.Tag;
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
+import org.apache.myfaces.tobago.event.TabChangeListener;
+import org.apache.myfaces.tobago.event.TabChangeListenerValueBindingDelegate;
+import org.apache.myfaces.tobago.event.TabChangeSource;
+import org.apache.myfaces.tobago.internal.taglib.TagUtils;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.webapp.UIComponentTag;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.TagSupport;
+
+/**
+ * Register an TabChangedListener instance on the UIComponent
+ * associated with the closest parent UIComponent custom action.
+ */
+@Tag(name = "tabChangeListener", bodyContent = BodyContent.EMPTY)
+public class TabChangeListenerTag extends TagSupport {
+
+ private static final long serialVersionUID = -419199086962377873L;
+
+ private static final Log LOG = LogFactory.getLog(TabChangeListenerTag.class);
+
+ /**
+ * <p>The fully qualified class name of the {@link TabChangeListener}
+ * instance to be created.</p>
+ */
+ private String type;
+ private String binding;
+
+ /**
+ * Fully qualified Java class name of a TabChangeListener to be
+ * created and registered.
+ */
+ @TagAttribute(required = true)
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * The value binding expression to a TabChangeListener.
+ */
+ @TagAttribute
+ public void setBinding(String binding) {
+ this.binding = binding;
+ }
+
+
+ /**
+ * <p>Create a new instance of the specified {@link TabChangeListener}
+ * class, and register it with the {@link javax.faces.component.UIComponent} instance associated
+ * with our most immediately surrounding {@link javax.faces.webapp.UIComponentTag} instance, if
+ * the {@link javax.faces.component.UIComponent} instance was created by this execution of the
+ * containing JSP page.</p>
+ *
+ * @throws JspException if a JSP error occurs
+ */
+ public int doStartTag() throws JspException {
+
+ // Locate our parent UIComponentTag
+ UIComponentTag tag =
+ UIComponentTag.getParentUIComponentTag(pageContext);
+ if (tag == null) {
+ // TODO Message resource i18n
+ throw new JspException("Not nested in faces tag");
+ }
+
+ if (!tag.getCreated()) {
+ return (SKIP_BODY);
+ }
+
+ UIComponent component = tag.getComponentInstance();
+ if (component == null) {
+ // TODO Message resource i18n
+ throw new JspException("Component Instance is null");
+ }
+ if (!(component instanceof TabChangeSource)) {
+ // TODO Message resource i18n
+ throw new JspException("Component " + component.getClass().getName() + " is not instanceof TabChangeSource");
+ }
+ TabChangeSource changeSource = (TabChangeSource) component;
+
+ TabChangeListener handler = null;
+ ValueBinding valueBinding = null;
+ if (binding != null && UIComponentTag.isValueReference(binding)) {
+ valueBinding = TagUtils.createValueBinding(binding);
+ if (valueBinding != null) {
+ Object obj = valueBinding.getValue(FacesContext.getCurrentInstance());
+ if (obj != null && obj instanceof TabChangeListener) {
+ handler = (TabChangeListener) obj;
+ }
+ }
+ }
+
+ if (handler == null && type != null) {
+ handler = createTabChangeListener(type);
+ if (handler != null && valueBinding != null) {
+ valueBinding.setValue(FacesContext.getCurrentInstance(), handler);
+ }
+ }
+ if (handler != null) {
+ if (valueBinding != null) {
+ changeSource.addTabChangeListener(new TabChangeListenerValueBindingDelegate(type, valueBinding));
+ } else {
+ changeSource.addTabChangeListener(handler);
+ }
+ }
+ // TODO else LOG.warn?
+ return (SKIP_BODY);
+ }
+
+
+ /**
+ * <p>Release references to any acquired resources.
+ */
+ public void release() {
+ this.type = null;
+ this.binding = null;
+ }
+
+ /**
+ * <p>Create and return a new {@link TabChangeListener} to be registered
+ * on our surrounding {@link javax.faces.component.UIComponent}.</p>
+ *
+ * @throws javax.servlet.jsp.JspException if a new instance cannot be created
+ */
+ protected TabChangeListener createTabChangeListener(String className) throws JspException {
+ try {
+ Class clazz = getClass().getClassLoader().loadClass(className);
+ return ((TabChangeListener) clazz.newInstance());
+ } catch (Exception e) {
+ throw new JspException(e);
+ }
+ }
+}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java Wed Apr 2 12:36:26 2008
@@ -23,7 +23,7 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.apt.annotation.DynamicExpression;
-import org.apache.myfaces.tobago.component.UITabGroup;
+import org.apache.myfaces.tobago.component.AbstractUITabGroup;
import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedDimension;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.IsImmediateCommand;
@@ -44,13 +44,12 @@
@BodyContentDescription(anyTagOf = "(<tc:tab>* ")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UITabGroup",
- uiComponentBaseClass = "org.apache.myfaces.tobago.component.UIPanelBase",
- generate = false,
+ uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUITabGroup",
rendererType = "TabGroup",
- isAjaxEnabled = true,
+ interfaces = "org.apache.myfaces.tobago.ajax.api.AjaxComponent",
allowedChildComponenents = "org.apache.myfaces.tobago.Tab")
-public interface TabGroupTagDeclaration extends TobagoTagDeclaration, HasIdBindingAndRendered, HasDeprecatedDimension,
+public interface TabGroupTagDeclaration extends HasIdBindingAndRendered, HasDeprecatedDimension,
IsImmediateCommand, HasAction, HasActionListener {
/**
* Deprecated! Use 'switchType' instead.
@@ -73,8 +72,8 @@
@TagAttribute
@UIComponentTagAttribute(type = "java.lang.String",
allowedValues =
- {UITabGroup.SWITCH_TYPE_CLIENT, UITabGroup.SWITCH_TYPE_RELOAD_PAGE, UITabGroup.SWITCH_TYPE_RELOAD_TAB},
- defaultValue = UITabGroup.SWITCH_TYPE_CLIENT)
+ {AbstractUITabGroup.SWITCH_TYPE_CLIENT, AbstractUITabGroup.SWITCH_TYPE_RELOAD_PAGE, AbstractUITabGroup.SWITCH_TYPE_RELOAD_TAB},
+ defaultValue = AbstractUITabGroup.SWITCH_TYPE_CLIENT)
void setSwitchType(String switchType);
/**
@@ -83,10 +82,12 @@
* component's selected Tab.
*
*/
- @TagAttribute @UIComponentTagAttribute(type = "java.lang.Integer",
- expression = DynamicExpression.VALUE_BINDING_REQUIRED)
+ @TagAttribute @UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "0")
void setSelectedIndex(String selectedIndex);
+ @TagAttribute @UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "0")
+ void setRenderedIndex(String renderedIndex);
+
/**
*
* <strong>ValueBindingExpression</strong> pointing to a Integer to save the
@@ -96,4 +97,11 @@
@UIComponentTagAttribute(type = "java.lang.Integer")
@Deprecated()
void setState(String state);
+
+ @TagAttribute
+ @UIComponentTagAttribute(
+ type = {},
+ expression = DynamicExpression.METHOD_BINDING_REQUIRED,
+ methodSignature = "org.apache.myfaces.tobago.event.TabChangeEvent")
+ void setTabChangeListener(String listener);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTagDeclaration.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTagDeclaration.java Wed Apr 2 12:36:26 2008
@@ -37,8 +37,8 @@
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UITab",
uiComponentBaseClass = "org.apache.myfaces.tobago.component.UIPanel",
- namingContainer = true,
+ interfaces = "javax.faces.component.NamingContainer",
rendererType = "Tab")
-public interface TabTagDeclaration extends TobagoBodyTagDeclaration, HasIdBindingAndRendered, HasLabelAndAccessKey,
+public interface TabTagDeclaration extends HasIdBindingAndRendered, HasLabelAndAccessKey,
HasTip, HasMarkup, IsDisabled {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextInputTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextInputTagDeclaration.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextInputTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextInputTagDeclaration.java Wed Apr 2 12:36:26 2008
@@ -1,5 +1,7 @@
package org.apache.myfaces.tobago.taglib.component;
+import org.apache.myfaces.tobago.taglib.decl.InputTagDeclaration;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TimeTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TimeTagDeclaration.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TimeTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TimeTagDeclaration.java Wed Apr 2 12:36:26 2008
@@ -27,6 +27,7 @@
import org.apache.myfaces.tobago.taglib.decl.IsInline;
import org.apache.myfaces.tobago.taglib.decl.IsReadonly;
import org.apache.myfaces.tobago.taglib.decl.IsRequired;
+import org.apache.myfaces.tobago.taglib.decl.InputTagDeclaration;
/*
* Created: Aug 5, 2005 5:03:15 PM
@@ -39,8 +40,7 @@
@Tag(name = "time")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UITimeInput",
- uiComponentBaseClass = "javax.faces.component.UIInput",
- generate = false,
+ uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUITimeInput",
rendererType = RENDERER_TYPE_TIME,
allowedChildComponenents = "NONE")
public interface TimeTagDeclaration
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarCommandTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarCommandTagDeclaration.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarCommandTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarCommandTagDeclaration.java Wed Apr 2 12:36:26 2008
@@ -25,6 +25,7 @@
import org.apache.myfaces.tobago.taglib.decl.HasLabelAndAccessKey;
import org.apache.myfaces.tobago.taglib.decl.HasTip;
import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
+import org.apache.myfaces.tobago.taglib.decl.AbstractCommandTagDeclaration;
/*
* Date: 10.04.2006
@@ -37,7 +38,7 @@
@Tag(name = "toolBarCommand", tagExtraInfoClassName = "org.apache.myfaces.tobago.taglib.component.CommandTagExtraInfo")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UIToolBarCommand",
- uiComponentBaseClass = "org.apache.myfaces.tobago.component.UICommand",
+ uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUICommand",
rendererType = "Button",
allowedChildComponenents = "NONE")
public interface ToolBarCommandTagDeclaration extends AbstractCommandTagDeclaration, HasIdBindingAndRendered,
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarSelectBooleanTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarSelectBooleanTagDeclaration.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarSelectBooleanTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarSelectBooleanTagDeclaration.java Wed Apr 2 12:36:26 2008
@@ -26,6 +26,7 @@
import org.apache.myfaces.tobago.taglib.decl.HasLabelAndAccessKey;
import org.apache.myfaces.tobago.taglib.decl.HasTip;
import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
+import org.apache.myfaces.tobago.taglib.decl.AbstractCommandTagDeclaration;
/*
* Date: 31.03.2006
@@ -41,7 +42,7 @@
uiComponentBaseClass = "org.apache.myfaces.tobago.component.UISelectBooleanCommand",
rendererType = "MenuCommand",
allowedChildComponenents = "NONE")
-public interface ToolBarSelectBooleanTagDeclaration extends TobagoTagDeclaration, AbstractCommandTagDeclaration,
+public interface ToolBarSelectBooleanTagDeclaration extends AbstractCommandTagDeclaration,
HasIdBindingAndRendered, HasLabelAndAccessKey,
HasCommandType, HasImage, IsDisabled, HasBooleanValue,
HasTip {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarSelectOneTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarSelectOneTagDeclaration.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarSelectOneTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarSelectOneTagDeclaration.java Wed Apr 2 12:36:26 2008
@@ -23,6 +23,7 @@
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.HasValue;
import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
+import org.apache.myfaces.tobago.taglib.decl.AbstractCommandTagDeclaration;
/*
* Date: 31.03.2006
@@ -39,6 +40,6 @@
uiComponentBaseClass = "org.apache.myfaces.tobago.component.UISelectOneCommand",
rendererType = "MenuCommand",
allowedChildComponenents = "NONE")
-public interface ToolBarSelectOneTagDeclaration extends TobagoTagDeclaration, AbstractCommandTagDeclaration,
+public interface ToolBarSelectOneTagDeclaration extends AbstractCommandTagDeclaration,
HasIdBindingAndRendered, IsDisabled, HasCommandType, HasValue {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTagDeclaration.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTagDeclaration.java Wed Apr 2 12:36:26 2008
@@ -22,7 +22,7 @@
import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
-import org.apache.myfaces.tobago.component.UIToolBar;
+import org.apache.myfaces.tobago.component.AbstractUIToolBar;
/*
* Date: 11.02.2006
@@ -59,8 +59,7 @@
@BodyContentDescription(anyTagOf = "(<tc:toolBarCommand>|<tc:toolBarSelectBoolean>|<tc:toolBarSelectOne>)* ")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UIToolBar",
- uiComponentBaseClass = "javax.faces.component.UIPanel",
- generate = false,
+ uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUIToolBar",
rendererType = "ToolBar",
allowedChildComponenents = {
"org.apache.myfaces.tobago.SelectOneCommand",
@@ -72,23 +71,23 @@
* If toolbar is facet of box: bottom is changed to right!
*/
@TagAttribute
- @UIComponentTagAttribute(defaultValue = UIToolBar.LABEL_BOTTOM,
- allowedValues = {UIToolBar.LABEL_BOTTOM, UIToolBar.LABEL_RIGHT, UIToolBar.LABEL_OFF})
+ @UIComponentTagAttribute(defaultValue = AbstractUIToolBar.LABEL_BOTTOM,
+ allowedValues = {AbstractUIToolBar.LABEL_BOTTOM, AbstractUIToolBar.LABEL_RIGHT, AbstractUIToolBar.LABEL_OFF})
void setLabelPosition(String labelPosition);
/**
* Size of button images, possible values are: small, big, off.
*/
@TagAttribute
- @UIComponentTagAttribute(defaultValue = UIToolBar.ICON_SMALL,
- allowedValues = {UIToolBar.ICON_SMALL, UIToolBar.ICON_BIG, UIToolBar.ICON_OFF})
+ @UIComponentTagAttribute(defaultValue = AbstractUIToolBar.ICON_SMALL,
+ allowedValues = {AbstractUIToolBar.ICON_SMALL, AbstractUIToolBar.ICON_BIG, AbstractUIToolBar.ICON_OFF})
void setIconSize(String iconSize);
/**
* Orientation of toolbar
*/
@TagAttribute
- @UIComponentTagAttribute(defaultValue = UIToolBar.ORIENTATION_LEFT,
- allowedValues = {UIToolBar.ORIENTATION_LEFT, UIToolBar.ORIENTATION_RIGHT})
+ @UIComponentTagAttribute(defaultValue = AbstractUIToolBar.ORIENTATION_LEFT,
+ allowedValues = {AbstractUIToolBar.ORIENTATION_LEFT, AbstractUIToolBar.ORIENTATION_RIGHT})
void setOrientation(String orientation);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeListboxTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeListboxTagDeclaration.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeListboxTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeListboxTagDeclaration.java Wed Apr 2 12:36:26 2008
@@ -46,7 +46,7 @@
uiComponentBaseClass = "org.apache.myfaces.tobago.component.UITreeOld",
generate = false,
rendererType = "TreeListbox")
-public interface TreeListboxTagDeclaration extends TobagoTagDeclaration, HasIdBindingAndRendered, HasTreeNodeValue,
+public interface TreeListboxTagDeclaration extends HasIdBindingAndRendered, HasTreeNodeValue,
HasState, HasIdReference, HasNameReference, IsRequired {
/**
* Flag indicating whether or not this component should be render selectable items.
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeOldNodeDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeOldNodeDeclaration.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeOldNodeDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeOldNodeDeclaration.java Wed Apr 2 12:36:26 2008
@@ -24,6 +24,5 @@
uiComponent = "org.apache.myfaces.tobago.component.UITreeOldNode",
generate = false,
rendererType = "TreeOldNode")
-public interface TreeOldNodeDeclaration extends TobagoTagDeclaration,
- HasIdBindingAndRendered {
+public interface TreeOldNodeDeclaration extends HasIdBindingAndRendered {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeOldTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeOldTagDeclaration.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeOldTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeOldTagDeclaration.java Wed Apr 2 12:36:26 2008
@@ -42,9 +42,8 @@
uiComponentBaseClass = "javax.faces.component.UIInput",
generate = false,
rendererType = "TreeOld")
-public interface TreeOldTagDeclaration extends TobagoTagDeclaration,
- HasIdBindingAndRendered, HasTreeNodeValue, HasState, HasIdReference,
- HasActionListener, HasNameReference, IsRequired, HasTabIndex {
+public interface TreeOldTagDeclaration extends HasIdBindingAndRendered, HasTreeNodeValue, HasState,
+ HasIdReference, HasActionListener, HasNameReference, IsRequired, HasTabIndex {
/**
* Flag indicating whether or not this component should be render selectable items.
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/AbstractCommandTagDeclaration.java (from r638966, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/AbstractCommandTagDeclaration.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/AbstractCommandTagDeclaration.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/AbstractCommandTagDeclaration.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/AbstractCommandTagDeclaration.java&r1=638966&r2=644014&rev=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/AbstractCommandTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/AbstractCommandTagDeclaration.java Wed Apr 2 12:36:26 2008
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.taglib.component;
+package org.apache.myfaces.tobago.taglib.decl;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,20 +17,11 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.taglib.decl.HasAction;
-import org.apache.myfaces.tobago.taglib.decl.HasActionListener;
-import org.apache.myfaces.tobago.taglib.decl.HasLink;
-import org.apache.myfaces.tobago.taglib.decl.HasOnclick;
-import org.apache.myfaces.tobago.taglib.decl.IsImmediateCommand;
-import org.apache.myfaces.tobago.taglib.decl.IsTransition;
-
/*
-* Created by IntelliJ IDEA.
-* User: bommel
* Date: 10.02.2006
* Time: 22:03:07
*/
-public interface AbstractCommandTagDeclaration extends TobagoTagDeclaration,
- HasAction, HasActionListener, IsImmediateCommand, HasOnclick, HasLink, IsTransition {
+public interface AbstractCommandTagDeclaration extends HasAction, HasActionListener, IsImmediateCommand,
+ HasOnclick, HasLink, IsTransition, HasRenderedPartially {
}
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/AbstractCommandTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/AbstractCommandTagDeclaration.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasAction.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasAction.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasAction.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasAction.java Wed Apr 2 12:36:26 2008
@@ -35,9 +35,7 @@
* The String is directly passed to the Navigationhandler.
*/
@TagAttribute
- @UIComponentTagAttribute(
- type = "javax.faces.el.MethodBinding",
- expression = DynamicExpression.METHOD_BINDING)
+ @UIComponentTagAttribute(type = {}, expression = DynamicExpression.METHOD_BINDING)
void setAction(String action);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasActionListener.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasActionListener.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasActionListener.java Wed Apr 2 12:36:26 2008
@@ -32,9 +32,7 @@
* parameter, with a return type of void.
*/
@TagAttribute
- @UIComponentTagAttribute(
- type = "javax.faces.el.MethodBinding",
- expression = DynamicExpression.METHOD_BINDING_REQUIRED,
+ @UIComponentTagAttribute(type = {}, expression = DynamicExpression.METHOD_BINDING_REQUIRED,
methodSignature = "javax.faces.event.ActionEvent")
void setActionListener(String actionListener);
}
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasRenderedPartially.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasRenderedPartially.java?rev=644014&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasRenderedPartially.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasRenderedPartially.java Wed Apr 2 12:36:26 2008
@@ -0,0 +1,14 @@
+package org.apache.myfaces.tobago.taglib.decl;
+
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+
+
+public interface HasRenderedPartially {
+ /**
+ * Indicate the partially rendered Components in a case of a submit.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = "java.lang.String[]")
+ void setRenderedPartially(String componentIds);
+}
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasRenderedPartially.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasRenderedPartially.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasSuggestMethod.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasSuggestMethod.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasSuggestMethod.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasSuggestMethod.java Wed Apr 2 12:36:26 2008
@@ -30,7 +30,7 @@
* @param suggestMethod
*/
@TagAttribute
- @UIComponentTagAttribute(type = "javax.faces.el.MethodBinding",
+ @UIComponentTagAttribute(type = {},
expression = DynamicExpression.METHOD_BINDING_REQUIRED,
methodSignature = "java.lang.String")
void setSuggestMethod(String suggestMethod);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasValidator.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasValidator.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasValidator.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasValidator.java Wed Apr 2 12:36:26 2008
@@ -37,7 +37,7 @@
* the component's local value.
*/
@TagAttribute
- @UIComponentTagAttribute(type = "javax.faces.el.MethodBinding",
+ @UIComponentTagAttribute(type = {},
expression = DynamicExpression.METHOD_BINDING,
methodSignature = { "javax.faces.context.FacesContext", "javax.faces.component.UIComponent", "java.lang.Object" })
void setValidator(String validator);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasValueChangeListener.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasValueChangeListener.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasValueChangeListener.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasValueChangeListener.java Wed Apr 2 12:36:26 2008
@@ -36,7 +36,7 @@
*/
@TagAttribute
@UIComponentTagAttribute(
- type = "javax.faces.el.MethodBinding",
+ type = {},
expression = DynamicExpression.METHOD_BINDING_REQUIRED,
methodSignature = "javax.faces.event.ValueChangeEvent")
void setValueChangeListener(String valueChangeListener);
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/InputTagDeclaration.java (from r638966, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTagDeclaration.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/InputTagDeclaration.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/InputTagDeclaration.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTagDeclaration.java&r1=638966&r2=644014&rev=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/InputTagDeclaration.java Wed Apr 2 12:36:26 2008
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.taglib.component;
+package org.apache.myfaces.tobago.taglib.decl;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,19 +17,12 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.taglib.decl.IsFocus;
-import org.apache.myfaces.tobago.taglib.decl.HasOnchange;
-import org.apache.myfaces.tobago.taglib.decl.HasTabIndex;
-import org.apache.myfaces.tobago.taglib.decl.HasValidator;
-import org.apache.myfaces.tobago.taglib.decl.HasValue;
-import org.apache.myfaces.tobago.taglib.decl.HasValueChangeListener;
/*
* Created: Aug 5, 2005 4:18:38 PM
- * User: bommel
* $Id$
*/
-public interface InputTagDeclaration extends BeanTagDeclaration, HasValidator,
+public interface InputTagDeclaration extends HasValidator,
HasOnchange, HasValue, HasValueChangeListener, HasTabIndex, IsFocus {
}
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/InputTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/InputTagDeclaration.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtil.java (from r638966, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtil.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtil.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java&r1=638966&r2=644014&rev=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtil.java Wed Apr 2 12:36:26 2008
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.component;
+package org.apache.myfaces.tobago.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,44 +25,28 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.lang.StringUtils;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_LINK;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_ONCLICK;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ALIGN;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_CONVERTER;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_CREATE_SPAN;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ESCAPE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FOR;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HOVER;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MARKUP;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_READONLY;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_RENDERED_PARTIALLY;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_RENDER_RANGE;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_RENDER_RANGE_EXTERN;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SORTABLE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_CLASS;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_VALUE;
-import static org.apache.myfaces.tobago.TobagoConstants.COMMAND_TYPE_NAVIGATE;
-import static org.apache.myfaces.tobago.TobagoConstants.COMMAND_TYPE_RESET;
-import static org.apache.myfaces.tobago.TobagoConstants.COMMAND_TYPE_SCRIPT;
-import static org.apache.myfaces.tobago.TobagoConstants.FACET_ITEMS;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_LABEL;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_OUT;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_SELECT_BOOLEAN_CHECKBOX;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_SELECT_ONE_RADIO;
import org.apache.myfaces.tobago.context.TransientStateHolder;
import org.apache.myfaces.tobago.el.ConstantMethodBinding;
import org.apache.myfaces.tobago.event.PopupActionListener;
-import org.apache.myfaces.tobago.event.SheetStateChangeEvent;
import org.apache.myfaces.tobago.renderkit.LayoutableRenderer;
import org.apache.myfaces.tobago.renderkit.LayoutRenderer;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
-import javax.faces.component.ContextCallback;
-import org.apache.myfaces.tobago.util.RangeParser;
-import org.apache.myfaces.tobago.util.TobagoCallback;
-import org.apache.myfaces.tobago.internal.taglib.TagUtils;
+import org.apache.myfaces.tobago.component.AbstractUIPopup;
+import org.apache.myfaces.tobago.component.AbstractUIPage;
+import org.apache.myfaces.tobago.component.AbstractUIForm;
+import org.apache.myfaces.tobago.component.UIInputBase;
+import org.apache.myfaces.tobago.component.SupportsMarkup;
import javax.faces.FactoryFinder;
import javax.faces.application.Application;
@@ -75,8 +59,6 @@
import javax.faces.component.UIGraphic;
import javax.faces.component.UIOutput;
import javax.faces.component.UIParameter;
-import javax.faces.component.UISelectItem;
-import javax.faces.component.UISelectItems;
import javax.faces.component.ValueHolder;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
@@ -84,7 +66,6 @@
import javax.faces.el.ValueBinding;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
-import javax.faces.event.PhaseId;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
import javax.faces.render.RenderKit;
@@ -93,26 +74,24 @@
import javax.faces.webapp.UIComponentTag;
import javax.servlet.jsp.JspException;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
public class ComponentUtil {
private static final Log LOG = LogFactory.getLog(ComponentUtil.class);
private static final String RENDER_KEY_PREFIX
- = "org.apache.myfaces.tobago.component.ComponentUtil.RendererKeyPrefix_";
+ = "org.apache.myfaces.tobago.util.ComponentUtil.RendererKeyPrefix_";
+
+ private static final String PAGE_KEY = "org.apache.myfaces.tobago.Page.Key";
public static final Class[] ACTION_ARGS = {};
public static final Class[] ACTION_LISTENER_ARGS = {ActionEvent.class};
public static final Class[] VALUE_CHANGE_LISTENER_ARGS = {ValueChangeEvent.class};
public static final Class[] VALIDATOR_ARGS = {FacesContext.class, UIComponent.class, Object.class};
- private static final String LIST_SEPARATOR_CHARS = ", ";
+ public static final String LIST_SEPARATOR_CHARS = ", ";
private ComponentUtil() {
}
@@ -154,7 +133,7 @@
public static boolean isInPopup(UIComponent component) {
while (component != null) {
- if (component instanceof UIPopup) {
+ if (component instanceof AbstractUIPopup) {
return true;
}
component = component.getParent();
@@ -165,65 +144,50 @@
public static void resetPage(FacesContext context) {
javax.faces.component.UIViewRoot view = context.getViewRoot();
if (view != null) {
- view.getAttributes().remove(UIPage.COMPONENT_TYPE);
+ view.getAttributes().remove(PAGE_KEY);
}
}
@SuppressWarnings("unchecked")
- public static UIPage findPage(FacesContext context, UIComponent component) {
+ public static AbstractUIPage findPage(FacesContext context, UIComponent component) {
javax.faces.component.UIViewRoot view = context.getViewRoot();
if (view != null) {
- TransientStateHolder stateHolder = (TransientStateHolder) view.getAttributes().get(UIPage.COMPONENT_TYPE);
+ TransientStateHolder stateHolder = (TransientStateHolder) view.getAttributes().get(PAGE_KEY);
if (stateHolder == null || stateHolder.isEmpty()) {
- UIPage page = findPage(component);
+ AbstractUIPage page = findPage(component);
stateHolder = new TransientStateHolder(page);
- context.getViewRoot().getAttributes().put(UIPage.COMPONENT_TYPE, stateHolder);
+ context.getViewRoot().getAttributes().put(PAGE_KEY, stateHolder);
}
- return (UIPage) stateHolder.get();
+ return (AbstractUIPage) stateHolder.get();
} else {
return findPage(component);
}
}
- public static UIPage findPage(UIComponent component) {
+ public static AbstractUIPage findPage(UIComponent component) {
while (component != null) {
- if (component instanceof UIPage) {
- return (UIPage) component;
+ if (component instanceof AbstractUIPage) {
+ return (AbstractUIPage) component;
}
component = component.getParent();
}
return null;
}
- public static void addStyles(UIComponent component, String[] styles) {
- UIPage uiPage = ComponentUtil.findPage(component);
- uiPage.getStyleFiles().addAll(Arrays.asList(styles));
- }
-
- public static void addScripts(UIComponent component, String[] scripts) {
- UIPage uiPage = ComponentUtil.findPage(component);
- uiPage.getScriptFiles().addAll(Arrays.asList(scripts));
- }
-
- public static void addOnloadCommands(UIComponent component, String[] cmds) {
- UIPage uiPage = ComponentUtil.findPage(component);
- uiPage.getOnloadScripts().addAll(Arrays.asList(cmds));
- }
-
- public static UIPage findPage(FacesContext facesContext) {
+ public static AbstractUIPage findPage(FacesContext facesContext) {
return findPageBreadthFirst(facesContext.getViewRoot());
}
- private static UIPage findPageBreadthFirst(UIComponent component) {
+ private static AbstractUIPage findPageBreadthFirst(UIComponent component) {
for (Object o : component.getChildren()) {
UIComponent child = (UIComponent) o;
- if (child instanceof UIPage) {
- return (UIPage) child;
+ if (child instanceof AbstractUIPage) {
+ return (AbstractUIPage) child;
}
}
for (Object o : component.getChildren()) {
UIComponent child = (UIComponent) o;
- UIPage result = findPageBreadthFirst(child);
+ AbstractUIPage result = findPageBreadthFirst(child);
if (result != null) {
return result;
}
@@ -232,10 +196,10 @@
}
- public static UIForm findForm(UIComponent component) {
+ public static AbstractUIForm findForm(UIComponent component) {
while (component != null) {
- if (component instanceof UIForm) {
- return (UIForm) component;
+ if (component instanceof AbstractUIForm) {
+ return (AbstractUIForm) component;
}
component = component.getParent();
}
@@ -246,19 +210,19 @@
* Find all subforms of a component, and collects it.
* It does not find subforms of subforms.
*/
- public static List<UIForm> findSubForms(UIComponent component) {
- List<UIForm> collect = new ArrayList<UIForm>();
+ public static List<AbstractUIForm> findSubForms(UIComponent component) {
+ List<AbstractUIForm> collect = new ArrayList<AbstractUIForm>();
findSubForms(collect, component);
return collect;
}
@SuppressWarnings("unchecked")
- private static void findSubForms(List<UIForm> collect, UIComponent component) {
+ private static void findSubForms(List<AbstractUIForm> collect, UIComponent component) {
Iterator<UIComponent> kids = component.getFacetsAndChildren();
while (kids.hasNext()) {
UIComponent child = kids.next();
- if (child instanceof UIForm) {
- collect.add((UIForm) child);
+ if (child instanceof AbstractUIForm) {
+ collect.add((AbstractUIForm) child);
} else {
findSubForms(collect, child);
}
@@ -300,8 +264,8 @@
while (component != null) {
//log.debug("compoent= " + component.getClientId(FacesContext.getCurrentInstance())
// + " " + component.getRendererType());
- if (component instanceof UIForm) {
- UIForm form = (UIForm) component;
+ if (component instanceof AbstractUIForm) {
+ AbstractUIForm form = (AbstractUIForm) component;
if (form.isSubmitted()) {
//log.debug("in active form = " + form.getClientId(FacesContext.getCurrentInstance()));
return true;
@@ -366,17 +330,7 @@
}
}
- public static void setRenderedPartially(org.apache.myfaces.tobago.component.UICommand command,
- String renderers) {
- if (renderers != null) {
- if (UIComponentTag.isValueReference(renderers)) {
- command.setValueBinding(ATTR_RENDERED_PARTIALLY, createValueBinding(renderers));
- } else {
- String[] components = splitList(renderers);
- command.setRenderedPartially(components);
- }
- }
- }
+
public static ValueBinding createValueBinding(String value) {
return FacesContext.getCurrentInstance().getApplication().createValueBinding(value);
@@ -554,105 +508,6 @@
return myRenderer;
}
- public static String currentValue(UIComponent component) {
- String currentValue = null;
- if (component instanceof ValueHolder) {
- Object value;
- if (component instanceof EditableValueHolder) {
- value = ((EditableValueHolder) component).getSubmittedValue();
- if (value != null) {
- return (String) value;
- }
- }
-
- value = ((ValueHolder) component).getValue();
- if (value != null) {
- Converter converter = ((ValueHolder) component).getConverter();
- if (converter == null) {
- FacesContext context = FacesContext.getCurrentInstance();
- converter = context.getApplication().createConverter(value.getClass());
- }
- if (converter != null) {
- currentValue =
- converter.getAsString(FacesContext.getCurrentInstance(),
- component, value);
- } else {
- currentValue = value.toString();
- }
- }
- }
- return currentValue;
- }
-
- public static List<SelectItem> getSelectItems(UIComponent component) {
-
- ArrayList<SelectItem> list = new ArrayList<SelectItem>();
-
- for (Object o1 : component.getChildren()) {
- UIComponent kid = (UIComponent) o1;
- if (LOG.isDebugEnabled()) {
- LOG.debug("kid " + kid);
- LOG.debug("kid " + kid.getClass().getName());
- }
- if (kid instanceof UISelectItem) {
- Object value = ((UISelectItem) kid).getValue();
- if (value == null) {
- UISelectItem item = (UISelectItem) kid;
- if (kid instanceof org.apache.myfaces.tobago.component.UISelectItem) {
- list.add(new org.apache.myfaces.tobago.model.SelectItem(
- (org.apache.myfaces.tobago.component.UISelectItem) kid));
- } else {
- list.add(new SelectItem(item.getItemValue() == null ? "" : item.getItemValue(),
- item.getItemLabel() != null ? item.getItemLabel() : item.getItemValue().toString(),
- item.getItemDescription()));
- }
- } else if (value instanceof SelectItem) {
- list.add((SelectItem) value);
- } else {
- throw new IllegalArgumentException("TYPE ERROR: value NOT instanceof SelectItem. type="
- + value.getClass().getName());
- }
- } else if (kid instanceof UISelectItems) {
- Object value = ((UISelectItems) kid).getValue();
- if (LOG.isDebugEnabled()) {
- LOG.debug("value " + value);
- if (value != null) {
- LOG.debug("value " + value.getClass().getName());
- }
- }
- if (value == null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("value is null");
- }
- } else if (value instanceof SelectItem) {
- list.add((SelectItem) value);
- } else if (value instanceof SelectItem[]) {
- SelectItem[] items = (SelectItem[]) value;
- list.addAll(Arrays.asList(items));
- } else if (value instanceof Collection) {
- for (Object o : ((Collection) value)) {
- list.add((SelectItem) o);
- }
- } else if (value instanceof Map) {
- for (Object key : ((Map) value).keySet()) {
- if (key != null) {
- Object val = ((Map) value).get(key);
- if (val != null) {
- list.add(new SelectItem(val.toString(), key.toString(), null));
- }
- }
- }
- } else {
- throw new IllegalArgumentException("TYPE ERROR: value NOT instanceof "
- + "SelectItem, SelectItem[], Collection, Map. type="
- + value.getClass().getName());
- }
- }
- }
-
- return list;
- }
-
public static Object findParameter(UIComponent component, String name) {
for (Object o : component.getChildren()) {
UIComponent child = (UIComponent) o;
@@ -670,65 +525,6 @@
return null;
}
- public static String toString(UIComponent component, int offset) {
- return toString(component, offset, false);
- }
-
- private static String toString(UIComponent component, int offset, boolean asFacet) {
- StringBuilder result = new StringBuilder();
- if (component == null) {
- result.append("null");
- } else {
- result.append('\n');
- if (!asFacet) {
- result.append(spaces(offset));
- result.append(toString(component));
- }
- Map facets = component.getFacets();
- if (facets.size() > 0) {
- for (Map.Entry<String, UIComponent> entry : (Set<Map.Entry<String, UIComponent>>) facets.entrySet()) {
- UIComponent facet = entry.getValue();
- result.append('\n');
- result.append(spaces(offset + 1));
- result.append('\"');
- result.append(entry.getKey());
- result.append("\" = ");
- result.append(toString(facet));
- result.append(toString(facet, offset + 1, true));
- }
- }
- for (Object o : component.getChildren()) {
- result.append(toString((UIComponent) o, offset + 1, false));
- }
- }
- return result.toString();
- }
-
- private static String toString(UIComponent component) {
- StringBuilder buf = new StringBuilder(component.getClass().getName());
- buf.append('@');
- buf.append(Integer.toHexString(component.hashCode()));
- buf.append(" ");
- buf.append(component.getRendererType());
- buf.append(" ");
- if (component instanceof javax.faces.component.UIViewRoot) {
- buf.append(((javax.faces.component.UIViewRoot) component).getViewId());
- } else {
- buf.append(component.getId());
- buf.append(" ");
- buf.append(component.getClientId(FacesContext.getCurrentInstance()));
- }
- return buf.toString();
- }
-
- private static String spaces(int n) {
- StringBuilder buffer = new StringBuilder();
- for (int i = 0; i < n; i++) {
- buffer.append(" ");
- }
- return buffer.toString();
- }
-
public static ActionListener createActionListener(String type)
throws JspException {
try {
@@ -800,52 +596,6 @@
valueBinding.setValue(context, value);
}
- public static UIComponent createComponent(String componentType, String rendererType) {
- final FacesContext facesContext = FacesContext.getCurrentInstance();
- return createComponent(facesContext, componentType, rendererType);
- }
-
- public static UIComponent createComponent(FacesContext facesContext, String componentType, String rendererType) {
- UIComponent component
- = facesContext.getApplication().createComponent(componentType);
- component.setRendererType(rendererType);
- return component;
- }
-
- public static UIColumn createTextColumn(String label, String sortable, String align, String value) {
- UIComponent text = createComponent(UIOutput.COMPONENT_TYPE, RENDERER_TYPE_OUT);
- TagUtils.setStringProperty(text, ATTR_VALUE, value);
- TagUtils.setBooleanProperty(text, ATTR_CREATE_SPAN, "false");
- TagUtils.setBooleanProperty(text, ATTR_ESCAPE, "false");
- return createColumn(label, sortable, align, text);
- }
-
- public static UIColumn createColumn(String label, String sortable, String align, UIComponent child) {
- UIColumn column = createColumn(label, sortable, align);
- column.getChildren().add(child);
- return column;
- }
-
- private static UIColumn createColumn(String label, String sortable, String align) {
- UIColumn column = (UIColumn) createComponent(UIColumn.COMPONENT_TYPE, null);
- TagUtils.setStringProperty(column, ATTR_LABEL, label);
- TagUtils.setBooleanProperty(column, ATTR_SORTABLE, sortable);
- TagUtils.setStringProperty(column, ATTR_ALIGN, align);
- return column;
- }
-
- public static UIMenuSelectOne createUIMenuSelectOneFacet(FacesContext facesContext, UICommand command) {
- UIMenuSelectOne radio = null;
- final ValueBinding valueBinding = command.getValueBinding(ATTR_VALUE);
- if (valueBinding != null) {
- radio = (UIMenuSelectOne) createComponent(facesContext,
- UIMenuSelectOne.COMPONENT_TYPE, RENDERER_TYPE_SELECT_ONE_RADIO);
- command.getFacets().put(FACET_ITEMS, radio);
- radio.setValueBinding(ATTR_VALUE, valueBinding);
- }
- return radio;
- }
-
public static boolean hasSelectedValue(List<SelectItem> items, Object value) {
for (SelectItem item : items) {
@@ -856,19 +606,6 @@
return false;
}
- public static UIComponent createUISelectBooleanFacet(FacesContext facesContext, UICommand command) {
- UIComponent checkbox
- = createComponent(facesContext, UISelectBoolean.COMPONENT_TYPE, RENDERER_TYPE_SELECT_BOOLEAN_CHECKBOX);
- command.getFacets().put(FACET_ITEMS, checkbox);
- ValueBinding valueBinding = command.getValueBinding(ATTR_VALUE);
- if (valueBinding != null) {
- checkbox.setValueBinding(ATTR_VALUE, valueBinding);
- } else {
- checkbox.getAttributes().put(ATTR_VALUE, command.getAttributes().get(ATTR_VALUE));
- }
- return checkbox;
- }
-
public static int getIntValue(ValueBinding valueBinding) {
return getAsInt(valueBinding.getValue(FacesContext.getCurrentInstance()));
}
@@ -947,44 +684,6 @@
} */
- public static List<SelectItem> getItemsToRender(javax.faces.component.UISelectOne component) {
- return getItems(component);
- }
-
- public static List<SelectItem> getItemsToRender(javax.faces.component.UISelectMany component) {
- return getItems(component);
- }
-
- private static List<SelectItem> getItems(javax.faces.component.UIInput component) {
-
- List<SelectItem> selectItems = ComponentUtil.getSelectItems(component);
-
- String renderRange = (String)
- component.getAttributes().get(ATTR_RENDER_RANGE_EXTERN);
- if (renderRange == null) {
- renderRange = (String)
- component.getAttributes().get(ATTR_RENDER_RANGE);
- }
- if (renderRange == null) {
- return selectItems;
- }
-
- int[] indices = RangeParser.getIndices(renderRange);
- List<SelectItem> items = new ArrayList<SelectItem>(indices.length);
-
- if (selectItems.size() != 0) {
- for (int indice : indices) {
- items.add(selectItems.get(indice));
- }
- } else {
- LOG.warn("No items found! rendering dummys instead!");
- for (int i = 0; i < indices.length; i++) {
- items.add(new SelectItem(Integer.toString(i), "Item " + i, ""));
- }
- }
- return items;
- }
-
public static void setValidator(EditableValueHolder editableValueHolder, String validator) {
if (validator != null && editableValueHolder.getValidator() == null) {
if (UIComponentTag.isValueReference(validator)) {
@@ -1023,44 +722,7 @@
}
}
- /**
- * @param component
- * @param type
- * @param action
- * @deprecated please use the typesave method {@link #setAction(javax.faces.component.UICommand, String, String)}
- */
- @Deprecated
- public static void setAction(UIComponent component, String type, String action) {
- if (component instanceof UICommand) {
- setAction((UICommand) component, type, action);
- }
- }
-
- public static void setAction(UICommand component, String type, String action) {
- String commandType;
- final FacesContext facesContext = FacesContext.getCurrentInstance();
- final Application application = facesContext.getApplication();
- if (type != null && UIComponentTag.isValueReference(type)) {
- commandType = (String) application.createValueBinding(type).getValue(facesContext);
- } else {
- commandType = type;
- }
- if (commandType != null
- && (commandType.equals(COMMAND_TYPE_NAVIGATE)
- || commandType.equals(COMMAND_TYPE_RESET)
- || commandType.equals(COMMAND_TYPE_SCRIPT))) {
- if (commandType.equals(COMMAND_TYPE_NAVIGATE)) {
- TagUtils.setStringProperty(component, ATTR_ACTION_LINK, action);
- } else if (commandType.equals(COMMAND_TYPE_SCRIPT)) {
- TagUtils.setStringProperty(component, ATTR_ACTION_ONCLICK, action);
- } else {
- LOG.warn("Type reset is not supported");
- }
- } else {
- setAction(component, action);
- }
- }
public static void setAction(ActionSource component, String action) {
if (action != null) {
@@ -1075,30 +737,8 @@
}
}
- /**
- * @param component
- * @param suggestMethod
- * @deprecated please use the typesave method {@link #setSuggestMethodBinding(UIInput, String)}
- */
- @Deprecated
- public static void setSuggestMethodBinding(UIComponent component, String suggestMethod) {
- if (component instanceof UIInputBase) {
- setSuggestMethodBinding((UIInputBase) component, suggestMethod);
- }
- }
- public static void setSuggestMethodBinding(UIInputBase component, String suggestMethod) {
- if (suggestMethod != null) {
- if (UIComponentTag.isValueReference(suggestMethod)) {
- final MethodBinding methodBinding = FacesContext.getCurrentInstance().getApplication()
- .createMethodBinding(suggestMethod, new Class[]{String.class});
- component.setSuggestMethod(methodBinding);
- } else {
- throw new IllegalArgumentException(
- "Must be a valueReference (suggestMethod): " + suggestMethod);
- }
- }
- }
+
public static void setActionListener(ActionSource command, String actionListener) {
final FacesContext facesContext = FacesContext.getCurrentInstance();
@@ -1130,22 +770,6 @@
}
}
-
- public static void setSortActionListener(UIData data, String actionListener) {
- final FacesContext facesContext = FacesContext.getCurrentInstance();
- final Application application = facesContext.getApplication();
- if (actionListener != null) {
- if (UIComponentTag.isValueReference(actionListener)) {
- MethodBinding binding = application.createMethodBinding(
- actionListener, ACTION_LISTENER_ARGS);
- data.setSortActionListener(binding);
- } else {
- throw new IllegalArgumentException(
- "Must be a valueReference (sortActionListener): " + actionListener);
- }
- }
- }
-
public static void setValueBinding(UIComponent component, String name, String state) {
// TODO: check, if it is an writeable object
if (state != null && UIComponentTag.isValueReference(state)) {
@@ -1154,23 +778,6 @@
}
}
- public static void setStateChangeListener(UIData data, String stateChangeListener) {
- final FacesContext facesContext = FacesContext.getCurrentInstance();
- final Application application = facesContext.getApplication();
-
- if (stateChangeListener != null) {
- if (UIComponentTag.isValueReference(stateChangeListener)) {
- Class[] arguments = {SheetStateChangeEvent.class};
- MethodBinding binding
- = application.createMethodBinding(stateChangeListener, arguments);
- data.setStateChangeListener(binding);
- } else {
- throw new IllegalArgumentException(
- "Must be a valueReference (actionListener): " + stateChangeListener);
- }
- }
- }
-
public static String[] getMarkupBinding(FacesContext facesContext, SupportsMarkup component) {
ValueBinding vb = ((UIComponent) component).getValueBinding(ATTR_MARKUP);
@@ -1231,88 +838,6 @@
}
}
return from.findComponent(relativeId);
- }
-
- public static void invokeOnComponent(FacesContext facesContext, String clientId, UIComponent component,
- ContextCallback contextCallback) {
- List<UIComponent> list = new ArrayList<UIComponent>();
- while (component != null) {
- list.add(component);
- component = component.getParent();
- }
- Collections.reverse(list);
- invokeOrPrepare(facesContext, list, clientId, contextCallback);
- }
-
- private static void invokeOrPrepare(FacesContext facesContext, List<UIComponent> list, String clientId,
- ContextCallback contextCallback) {
- if (list.size() == 1) {
- contextCallback.invokeContextCallback(facesContext, list.get(0));
- } else if (list.get(0) instanceof UIData) {
- prepareOnUIData(facesContext, list, clientId, contextCallback);
- } else if (list.get(0) instanceof UIForm) {
- prepareOnUIForm(facesContext, list, clientId, contextCallback);
- } else {
- prepareOnUIComponent(facesContext, list, clientId, contextCallback);
- }
- }
-
- @SuppressWarnings("unchecked")
- private static void prepareOnUIForm(FacesContext facesContext, List<UIComponent> list, String clientId,
- ContextCallback contextCallback) {
- UIComponent currentComponent = list.remove(0);
- if (!(currentComponent instanceof UIForm)) {
- throw new IllegalStateException(currentComponent.getClass().getName());
- }
- // TODO is this needed?
- if (contextCallback instanceof TobagoCallback) {
- if (PhaseId.APPLY_REQUEST_VALUES.equals(((TobagoCallback) contextCallback).getPhaseId())) {
- currentComponent.decode(facesContext);
- }
- }
- UIForm uiForm = (UIForm) currentComponent;
- facesContext.getExternalContext().getRequestMap().put(UIForm.SUBMITTED_MARKER, uiForm.isSubmitted());
- invokeOrPrepare(facesContext, list, clientId, contextCallback);
-
- }
-
- private static void prepareOnUIComponent(FacesContext facesContext, List<UIComponent> list, String clientId,
- ContextCallback contextCallback) {
- list.remove(0);
- invokeOrPrepare(facesContext, list, clientId, contextCallback);
- }
-
- private static void prepareOnUIData(FacesContext facesContext, List<UIComponent> list, String clientId,
- ContextCallback contextCallback) {
- UIComponent currentComponent = list.remove(0);
- if (!(currentComponent instanceof UIData)) {
- throw new IllegalStateException(currentComponent.getClass().getName());
- }
-
- // we may need setRowIndex on UIData
- javax.faces.component.UIData uiData = (javax.faces.component.UIData) currentComponent;
- int oldRowIndex = uiData.getRowIndex();
- String sheetId = uiData.getClientId(facesContext);
- String idRemainder = clientId.substring(sheetId.length());
- LOG.info("idRemainder = \"" + idRemainder + "\"");
- if (idRemainder.matches("^:\\d+:.*")) {
- idRemainder = idRemainder.substring(1);
- int idx = idRemainder.indexOf(":");
- try {
- int rowIndex = Integer.parseInt(idRemainder.substring(0, idx));
- LOG.info("set rowIndex = \"" + rowIndex + "\"");
- uiData.setRowIndex(rowIndex);
- } catch (NumberFormatException e) {
- LOG.error("idRemainder = \"" + idRemainder + "\"", e);
- }
- } else {
- LOG.info("no match for \"^:\\d+:.*\"");
- }
-
- invokeOrPrepare(facesContext, list, clientId, contextCallback);
-
- // we should reset rowIndex on UIData
- uiData.setRowIndex(oldRowIndex);
}
public static String[] splitList(String renderers) {
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtil.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ContextCallback.java (from r636726, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/Callback.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ContextCallback.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ContextCallback.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/Callback.java&r1=636726&r2=644014&rev=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/Callback.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ContextCallback.java Wed Apr 2 12:36:26 2008
@@ -21,6 +21,6 @@
import javax.faces.context.FacesContext;
import javax.faces.component.UIComponent;
-public interface Callback {
- void execute(FacesContext facesContext, UIComponent component);
+public interface ContextCallback {
+ void invokeContextCallback(FacesContext facesContext, UIComponent component);
}
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ContextCallback.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ContextCallback.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/DebugUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/DebugUtils.java?rev=644014&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/DebugUtils.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/DebugUtils.java Wed Apr 2 12:36:26 2008
@@ -0,0 +1,85 @@
+package org.apache.myfaces.tobago.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+import java.util.Set;
+
+
+public class DebugUtils {
+ public static String toString(UIComponent component, int offset) {
+ return toString(component, offset, false);
+ }
+
+ public static String toString(UIComponent component, int offset, boolean asFacet) {
+ StringBuilder result = new StringBuilder();
+ if (component == null) {
+ result.append("null");
+ } else {
+ result.append('\n');
+ if (!asFacet) {
+ result.append(spaces(offset));
+ result.append(toString(component));
+ }
+ Map facets = component.getFacets();
+ if (facets.size() > 0) {
+ for (Map.Entry<String, UIComponent> entry : (Set<Map.Entry<String, UIComponent>>) facets.entrySet()) {
+ UIComponent facet = entry.getValue();
+ result.append('\n');
+ result.append(spaces(offset + 1));
+ result.append('\"');
+ result.append(entry.getKey());
+ result.append("\" = ");
+ result.append(toString(facet));
+ result.append(toString(facet, offset + 1, true));
+ }
+ }
+ for (Object o : component.getChildren()) {
+ result.append(toString((UIComponent) o, offset + 1, false));
+ }
+ }
+ return result.toString();
+ }
+
+ public static String toString(UIComponent component) {
+ StringBuilder buf = new StringBuilder(component.getClass().getName());
+ buf.append('@');
+ buf.append(Integer.toHexString(component.hashCode()));
+ buf.append(" ");
+ buf.append(component.getRendererType());
+ buf.append(" ");
+ if (component instanceof javax.faces.component.UIViewRoot) {
+ buf.append(((javax.faces.component.UIViewRoot) component).getViewId());
+ } else {
+ buf.append(component.getId());
+ buf.append(" ");
+ buf.append(component.getClientId(FacesContext.getCurrentInstance()));
+ }
+ return buf.toString();
+ }
+
+ public static String spaces(int n) {
+ StringBuilder buffer = new StringBuilder();
+ for (int i = 0; i < n; i++) {
+ buffer.append(" ");
+ }
+ return buffer.toString();
+ }
+}
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/DebugUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/DebugUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutInfo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutInfo.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutInfo.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutInfo.java Wed Apr 2 12:36:26 2008
@@ -20,12 +20,12 @@
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.component.HideLayoutToken;
-import org.apache.myfaces.tobago.component.LayoutToken;
-import org.apache.myfaces.tobago.component.LayoutTokens;
-import org.apache.myfaces.tobago.component.PercentLayoutToken;
-import org.apache.myfaces.tobago.component.PixelLayoutToken;
-import org.apache.myfaces.tobago.component.RelativeLayoutToken;
+import org.apache.myfaces.tobago.layout.LayoutToken;
+import org.apache.myfaces.tobago.layout.RelativeLayoutToken;
+import org.apache.myfaces.tobago.layout.LayoutTokens;
+import org.apache.myfaces.tobago.layout.PercentLayoutToken;
+import org.apache.myfaces.tobago.layout.PixelLayoutToken;
+import org.apache.myfaces.tobago.layout.HideLayoutToken;
import java.util.ArrayList;
import java.util.List;
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java Wed Apr 2 12:36:26 2008
@@ -29,10 +29,9 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_LABEL;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_OUT;
-import org.apache.myfaces.tobago.component.ComponentUtil;
-import org.apache.myfaces.tobago.component.UICell;
-import org.apache.myfaces.tobago.component.UIForm;
import org.apache.myfaces.tobago.renderkit.LayoutInformationProvider;
+import org.apache.myfaces.tobago.component.Form;
+import org.apache.myfaces.tobago.component.Cell;
import javax.faces.component.UIComponent;
import javax.faces.component.UINamingContainer;
@@ -199,7 +198,7 @@
} */
// also Forms are transparent for layouting
- return component instanceof UIForm;
+ return component instanceof Form;
}
public static UIComponent getLayoutParent(UIComponent component) {
@@ -224,7 +223,7 @@
} else if (ATTR_LAYOUT_HEIGHT.equals(attribute)) {
cell.getAttributes().remove(ATTR_INNER_HEIGHT);
}
- if (cell instanceof UICell) {
+ if (cell instanceof Cell) {
List<UIComponent> children = addChildren(new ArrayList<UIComponent>(), cell);
for (UIComponent component : children) {
maybeSetLayoutAttribute(component, attribute, value);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ProcessValidationsCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ProcessValidationsCallback.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ProcessValidationsCallback.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ProcessValidationsCallback.java Wed Apr 2 12:36:26 2008
@@ -18,8 +18,8 @@
*/
-import org.apache.myfaces.tobago.component.UIForm;
-import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.AbstractUIForm;
+import org.apache.myfaces.tobago.util.ComponentUtil;
import javax.faces.context.FacesContext;
import javax.faces.component.UIComponent;
@@ -27,12 +27,12 @@
public class ProcessValidationsCallback implements javax.faces.component.ContextCallback {
public void invokeContextCallback(FacesContext facesContext, UIComponent component) {
- if (facesContext.getExternalContext().getRequestMap().get(UIForm.SUBMITTED_MARKER) == null
- || ((Boolean) facesContext.getExternalContext().getRequestMap().get(UIForm.SUBMITTED_MARKER))) {
+ if (facesContext.getExternalContext().getRequestMap().get(AbstractUIForm.SUBMITTED_MARKER) == null
+ || ((Boolean) facesContext.getExternalContext().getRequestMap().get(AbstractUIForm.SUBMITTED_MARKER))) {
component.processValidators(facesContext);
} else {
// if we're not the submitted form, only process subforms.
- for (UIForm subForm : ComponentUtil.findSubForms(component)) {
+ for (AbstractUIForm subForm : ComponentUtil.findSubForms(component)) {
subForm.processValidators(facesContext);
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/StringUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/StringUtil.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/StringUtil.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/StringUtil.java Wed Apr 2 12:36:26 2008
@@ -59,7 +59,7 @@
return list;
}
- public static <T> String toString(List<T> list) {
+ public static <T> String joinWithSurroundingSeparator(List<T> list) {
StringBuilder buffer = new StringBuilder(",");
for (T t : list) {
buffer.append(t);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/UpdateModelValuesCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/UpdateModelValuesCallback.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/UpdateModelValuesCallback.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/UpdateModelValuesCallback.java Wed Apr 2 12:36:26 2008
@@ -18,8 +18,8 @@
*/
-import org.apache.myfaces.tobago.component.UIForm;
-import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.AbstractUIForm;
+import org.apache.myfaces.tobago.util.ComponentUtil;
import javax.faces.context.FacesContext;
import javax.faces.component.UIComponent;
@@ -27,12 +27,12 @@
public class UpdateModelValuesCallback implements javax.faces.component.ContextCallback {
public void invokeContextCallback(FacesContext facesContext, UIComponent component) {
- if (facesContext.getExternalContext().getRequestMap().get(UIForm.SUBMITTED_MARKER) == null
- || ((Boolean) facesContext.getExternalContext().getRequestMap().get(UIForm.SUBMITTED_MARKER))) {
+ if (facesContext.getExternalContext().getRequestMap().get(AbstractUIForm.SUBMITTED_MARKER) == null
+ || ((Boolean) facesContext.getExternalContext().getRequestMap().get(AbstractUIForm.SUBMITTED_MARKER))) {
component.processUpdates(facesContext);
} else {
// if we're not the submitted form, only process subforms.
- for (UIForm subForm : ComponentUtil.findSubForms(component)) {
+ for (AbstractUIForm subForm : ComponentUtil.findSubForms(component)) {
subForm.processUpdates(facesContext);
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/validator/ClearValidatorsActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/validator/ClearValidatorsActionListener.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/validator/ClearValidatorsActionListener.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/validator/ClearValidatorsActionListener.java Wed Apr 2 12:36:26 2008
@@ -24,7 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.util.ComponentUtil;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/validator/FileItemValidator.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/validator/FileItemValidator.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/validator/FileItemValidator.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/validator/FileItemValidator.java Wed Apr 2 12:36:26 2008
@@ -17,7 +17,7 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.component.AbstractFileInput;
+import org.apache.myfaces.tobago.component.AbstractUIFileInput;
import org.apache.myfaces.tobago.util.MessageFactory;
import org.apache.myfaces.tobago.util.ContentType;
import org.apache.commons.fileupload.FileItem;
@@ -49,7 +49,7 @@
private boolean transientValue;
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
- if (value != null && component instanceof AbstractFileInput) {
+ if (value != null && component instanceof AbstractUIFileInput) {
FileItem file = (FileItem) value;
if (maxSize != null && file.getSize() > maxSize) {
Object[] args = {maxSize, component.getId()};
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/ComponentUtilUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/ComponentUtilUnitTest.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/ComponentUtilUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/ComponentUtilUnitTest.java Wed Apr 2 12:36:26 2008
@@ -19,6 +19,7 @@
import junit.framework.TestCase;
import org.junit.Assert;
+import org.apache.myfaces.tobago.util.ComponentUtil;
public class ComponentUtilUnitTest extends TestCase {
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/convert/DurationConverterUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/convert/DurationConverterUnitTest.java?rev=644014&r1=644013&r2=644014&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/convert/DurationConverterUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/convert/DurationConverterUnitTest.java Wed Apr 2 12:36:26 2008
@@ -19,7 +19,7 @@
import junit.framework.TestCase;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_UNIT;
-import org.apache.myfaces.tobago.component.UIInputBase;
+import org.apache.myfaces.tobago.component.UIInput;
import javax.faces.convert.Converter;
@@ -67,7 +67,7 @@
}
private void format(String unit, Long aLong, String string) {
- UIInputBase input = new UIInputBase();
+ UIInput input = new UIInput();
String info = "Formatting numbers:"
+ " unit='" + unit + "'"
+ " long='" + aLong + "'";
@@ -80,7 +80,7 @@
}
private void parse(String unit, Long aLong, String string) {
- UIInputBase input = new UIInputBase();
+ UIInput input = new UIInput();
String info = "Parsing numbers:"
+ " unit='" + unit + "'"
+ " string='" + string + "'";