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 2015/12/16 20:23:37 UTC
svn commit: r1720417 [2/3] - in /myfaces/tobago/branches/tobago-3.0.x:
tobago-core/src/main/java/org/apache/myfaces/tobago/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/convert/
tobago-core/src/main/java/org/apache/myfaces/tobago/facel...
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SheetState.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SheetState.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SheetState.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SheetState.java Wed Dec 16 19:23:36 2015
@@ -29,9 +29,9 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-public class SheetState implements Serializable {
+public class SheetState implements Serializable, ScrollPositionState {
- private static final long serialVersionUID = 7765536344426661777L;
+ private static final long serialVersionUID = 2L;
private static final Logger LOG = LoggerFactory.getLogger(SheetState.class);
@@ -43,7 +43,7 @@ public class SheetState implements Seria
private boolean toBeSorted;
private String columnWidths;
private List<Integer> selectedRows;
- private Integer[] scrollPosition;
+ private ScrollPosition scrollPosition;
private ExpandedState expandedState;
private SelectedState selectedState;
@@ -64,7 +64,11 @@ public class SheetState implements Seria
if (selectedState != null) {
selectedState.clear();
}
- scrollPosition = null;
+ if (scrollPosition != null) {
+ scrollPosition.clear();
+ } else {
+ scrollPosition = new ScrollPosition();
+ }
}
public void resetSelected() {
@@ -130,11 +134,11 @@ public class SheetState implements Seria
}
}
- public Integer[] getScrollPosition() {
+ public ScrollPosition getScrollPosition() {
return scrollPosition;
}
- public void setScrollPosition(final Integer[] scrollPosition) {
+ public void setScrollPosition(final ScrollPosition scrollPosition) {
this.scrollPosition = scrollPosition;
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeState.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeState.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeState.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeState.java Wed Dec 16 19:23:36 2015
@@ -21,14 +21,25 @@ package org.apache.myfaces.tobago.model;
import java.io.Serializable;
-public class TreeState implements Serializable {
+public class TreeState implements Serializable, ScrollPositionState {
private ExpandedState expandedState;
private SelectedState selectedState;
+ private ScrollPosition scrollPosition;
+
+ public TreeState() {
+ this(new ExpandedState(2), new SelectedState(), new ScrollPosition());
+ }
public TreeState(final ExpandedState expandedState, final SelectedState selectedState) {
+ this(expandedState, selectedState, new ScrollPosition());
+ }
+
+ public TreeState(
+ final ExpandedState expandedState, final SelectedState selectedState, final ScrollPosition scrollPosition) {
this.expandedState = expandedState;
this.selectedState = selectedState;
+ this.scrollPosition = scrollPosition;
}
public ExpandedState getExpandedState() {
@@ -38,4 +49,8 @@ public class TreeState implements Serial
public SelectedState getSelectedState() {
return selectedState;
}
+
+ public ScrollPosition getScrollPosition() {
+ return scrollPosition;
+ }
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Arias.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Arias.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Arias.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Arias.java Wed Dec 16 19:23:36 2015
@@ -44,7 +44,7 @@ public enum Arias implements MarkupLangu
SETSIZE("aria-setsize"),
SORT("aria-sort");
- private String value;
+ private final String value;
Arias(final String value) {
this.value = value;
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java Wed Dec 16 19:23:36 2015
@@ -33,7 +33,7 @@ public enum DataAttributes implements Ma
COLUMN_INDEX("data-tobago-column-index"),
/**
- * TBD: needed? may replace with VALUE?
+ * TBD: needed? may replace with value?
* Custom command attribute. Is used to mark different client side JavaScript buttons.
* Should only contain the command name as a keyword, for security reasons.
*/
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java Wed Dec 16 19:23:36 2015
@@ -43,10 +43,10 @@ public class ApplyRequestValuesCallback
final UIComponent reload = component.getFacet(Facets.RELOAD);
if (ajaxId != null && ajaxId.equals(component.getClientId(context)) && reload != null && reload.isRendered()
&& ajaxId.equals(FacesContextUtils.getActionId(context))) {
- final Boolean immediate = (Boolean) reload.getAttributes().get(Attributes.IMMEDIATE);
- if (immediate != null && immediate) {
- final Boolean update = (Boolean) reload.getAttributes().get(Attributes.UPDATE);
- if (update != null && !update) {
+ final boolean immediate = ComponentUtils.getBooleanAttribute(reload, Attributes.immediate);
+ if (immediate) {
+ final boolean update = ComponentUtils.getBooleanAttribute(reload, Attributes.update);
+ if (!update) {
final Object response = context.getExternalContext().getResponse();
if (response instanceof HttpServletResponse) {
((HttpServletResponse) response).setStatus(HttpServletResponse.SC_NOT_MODIFIED);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java Wed Dec 16 19:23:36 2015
@@ -21,8 +21,6 @@ package org.apache.myfaces.tobago.util;
import org.apache.commons.collections.CollectionUtils;
import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.Facets;
-import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.component.UISheet;
import org.apache.myfaces.tobago.component.Visual;
import org.apache.myfaces.tobago.context.Markup;
@@ -32,8 +30,6 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.internal.component.AbstractUIInput;
import org.apache.myfaces.tobago.internal.component.AbstractUIPage;
import org.apache.myfaces.tobago.internal.component.AbstractUIPopup;
-import org.apache.myfaces.tobago.internal.util.ArrayUtils;
-import org.apache.myfaces.tobago.internal.util.ObjectUtils;
import org.apache.myfaces.tobago.internal.util.StringUtils;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
@@ -41,16 +37,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.faces.FactoryFinder;
-import javax.faces.application.Application;
import javax.faces.application.FacesMessage;
-import javax.faces.component.ContextCallback;
import javax.faces.component.NamingContainer;
import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIGraphic;
import javax.faces.component.UIInput;
import javax.faces.component.UINamingContainer;
-import javax.faces.component.UIOutput;
import javax.faces.component.UIParameter;
import javax.faces.component.UISelectMany;
import javax.faces.component.UIViewRoot;
@@ -61,7 +53,6 @@ import javax.faces.el.ValueBinding;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
import javax.faces.event.ValueChangeEvent;
-import javax.faces.model.SelectItem;
import javax.faces.render.RenderKit;
import javax.faces.render.RenderKitFactory;
import javax.faces.render.Renderer;
@@ -344,7 +335,7 @@ public final class ComponentUtils {
}
public static UIComponent findFor(final UIComponent component) {
- final String forValue = (String) component.getAttributes().get(Attributes.FOR);
+ final String forValue = getStringAttribute(component, Attributes.forValue);
if (forValue == null) {
return component.getParent();
}
@@ -354,33 +345,11 @@ public final class ComponentUtils {
/**
* Looks for the attribute "for" of the component.
* In case that the value is equals to "@auto" the children of the parent will be
- * checked if they are a UIInput. The "id" of the first one will be used to reset the "for"
- * attribute of the component.
- * @deprecated
- */
- @Deprecated
- public static void evaluateAutoFor(final UIComponent component) {
- final String forComponent = (String) component.getAttributes().get(Attributes.FOR);
- if (LOG.isDebugEnabled()) {
- LOG.debug("for = '" + forComponent + "'");
- }
- if ("@auto".equals(forComponent)) {
- for (final UIComponent child : component.getParent().getChildren()) {
- if (setForToInput(component, child, AbstractUIInput.class, false)) {
- break;
- }
- }
- }
- }
-
- /**
- * Looks for the attribute "for" of the component.
- * In case that the value is equals to "@auto" the children of the parent will be
* checked if they are of the type of the parameter clazz. The "id" of the first one will be used to reset the "for"
* attribute of the component.
*/
public static void evaluateAutoFor(final UIComponent component, final Class<? extends UIComponent> clazz) {
- final String forComponent = (String) component.getAttributes().get(Attributes.FOR);
+ final String forComponent = getStringAttribute(component, Attributes.forValue);
if (LOG.isDebugEnabled()) {
LOG.debug("for = '" + forComponent + "'");
}
@@ -410,7 +379,7 @@ public final class ComponentUtils {
} else {
forComponent = child.getId();
}
- component.getAttributes().put(Attributes.FOR, forComponent);
+ ComponentUtils.setAttribute(component, Attributes.forValue, forComponent);
return true;
}
return false;
@@ -457,8 +426,8 @@ public final class ComponentUtils {
}
public static boolean isOutputOnly(final UIComponent component) {
- return getBooleanAttribute(component, Attributes.DISABLED)
- || getBooleanAttribute(component, Attributes.READONLY);
+ return getBooleanAttribute(component, Attributes.disabled)
+ || getBooleanAttribute(component, Attributes.readonly);
}
public static boolean mayValidate(final UIComponent component) {
@@ -470,61 +439,43 @@ public final class ComponentUtils {
return mayValidate(component);
}
- public static boolean getBooleanAttribute(final UIComponent component, final String name) {
-
- Object bool = component.getAttributes().get(name);
- if (bool == null) {
- return false;
- }
- if (bool instanceof ValueBinding) {
- bool = ((ValueBinding) bool).getValue(FacesContext.getCurrentInstance());
- }
- if (bool instanceof Boolean) {
- return (Boolean) bool;
- } else if (bool instanceof String) {
- LOG.warn("Searching for a boolean, but find a String. Should not happen. "
- + "attribute: '" + name + "' id: '" + component.getClientId(FacesContext.getCurrentInstance())
- + "' comp: '" + component + "'");
- return Boolean.valueOf((String) bool);
- } else {
- LOG.warn("Unknown type '" + bool.getClass().getName()
- + "' for boolean attribute: " + name + " id: " + component.getClientId(FacesContext.getCurrentInstance())
- + " comp: " + component);
- return false;
- }
+ public static Object getAttribute(final UIComponent component, final Attributes name) {
+ return component.getAttributes().get(name.getName());
}
- /**
- * @deprecated since 2.0.0
- */
- @Deprecated
- public static ValueBinding createValueBinding(final String value) {
- return FacesContext.getCurrentInstance().getApplication().createValueBinding(value);
+ public static boolean getBooleanAttribute(final UIComponent component, final Attributes name) {
+ return getBooleanAttribute(component, name, false);
}
- public static Object getAttribute(final UIComponent component, final String name) {
- Object value = component.getAttributes().get(name);
- if (value instanceof ValueBinding) {
- value = ((ValueBinding) value).getValue(FacesContext.getCurrentInstance());
+ public static boolean getBooleanAttribute(
+ final UIComponent component, final Attributes name, final boolean defaultValue) {
+
+ Object bool = component.getAttributes().get(name.getName());
+ if (bool == null) {
+ return defaultValue;
+ } else if (bool instanceof Boolean) {
+ return (Boolean) bool;
+ } else {
+ return Boolean.valueOf(bool.toString());
}
- return value;
}
- public static Object getObjectAttribute(final UIComponent component, final String name) {
- return getAttribute(component, name);
+ public static String getStringAttribute(final UIComponent component, final Attributes name) {
+ return getStringAttribute(component, name, null);
}
- public static String getStringAttribute(final UIComponent component, final String name) {
- return (String) getAttribute(component, name);
+ public static String getStringAttribute(
+ final UIComponent component, final Attributes name, final String defaultValue) {
+ final String result = (String) getAttribute(component, name);
+ return result != null ? result : defaultValue;
}
- public static int getIntAttribute(final UIComponent component, final String name) {
+ public static int getIntAttribute(final UIComponent component, final Attributes name) {
return getIntAttribute(component, name, 0);
}
- public static int getIntAttribute(final UIComponent component, final String name,
- final int defaultValue) {
- final Object integer = component.getAttributes().get(name);
+ public static int getIntAttribute(final UIComponent component, final Attributes name, final int defaultValue) {
+ final Object integer = component.getAttributes().get(name.getName());
if (integer instanceof Number) {
return ((Number) integer).intValue();
} else if (integer instanceof String) {
@@ -543,8 +494,8 @@ public final class ComponentUtils {
}
}
- public static Character getCharacterAttribute(final UIComponent component, final String name) {
- final Object character = component.getAttributes().get(name);
+ public static Character getCharacterAttribute(final UIComponent component, final Attributes name) {
+ final Object character = getAttribute(component, name);
if (character == null) {
return null;
} else if (character instanceof Character) {
@@ -559,6 +510,14 @@ public final class ComponentUtils {
}
}
+ public static void setAttribute(final UIComponent component, final Attributes name, final Object value) {
+ component.getAttributes().put(name.getName(), value);
+ }
+
+ public static void removeAttribute(final UIComponent component, final Attributes name) {
+ component.getAttributes().remove(name.getName());
+ }
+
public static boolean isFacetOf(final UIComponent component, final UIComponent parent) {
for (final Object o : parent.getFacets().keySet()) {
final UIComponent facet = parent.getFacet((String) o);
@@ -622,179 +581,6 @@ public final class ComponentUtils {
}
/**
- * @deprecated since 2.0.0
- */
- @Deprecated
- public static ActionListener createActionListener(final String type) {
- try {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- if (classLoader == null) {
- classLoader = type.getClass().getClassLoader();
- }
- final Class clazz = classLoader.loadClass(type);
- return (ActionListener) clazz.newInstance();
- } catch (final Exception e) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("type=" + type, e);
- }
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @deprecated since 2.0.0
- */
- @Deprecated
- public static UIGraphic getFirstGraphicChild(final UIComponent component) {
- UIGraphic graphic = null;
- for (final UIComponent child : component.getChildren()) {
- if (child instanceof UIGraphic) {
- graphic = (UIGraphic) child;
- break;
- }
- }
- return graphic;
- }
-
- /**
- * @deprecated since 2.0.0
- */
- @Deprecated
- public static boolean isHoverEnabled(final UIComponent component) {
- return ComponentUtils.getBooleanAttribute(component, Attributes.HOVER);
- }
-
- /**
- * @deprecated since 2.0.0
- */
- @Deprecated
- public static UIOutput getFirstNonGraphicChild(final UIComponent component) {
- for (final UIComponent child : component.getChildren()) {
- if (child instanceof UIOutput) {
- return (UIOutput) child;
- }
- }
- return null;
- }
-
- /**
- * @deprecated since 2.0.0
- */
- @Deprecated
- public static String removePx(String value) {
- if (value != null && value.endsWith("px")) {
- value = value.substring(0, value.length() - 2);
- }
- return value;
- }
-
- /**
- * @deprecated since 2.0.0
- */
- @Deprecated
- public static void setValueForValueBinding(final String name, final Object value) {
- final FacesContext context = FacesContext.getCurrentInstance();
- final ValueBinding valueBinding = context.getApplication().createValueBinding(name);
- valueBinding.setValue(context, value);
- }
-
- /**
- * @deprecated Since Tobago 2.0
- */
- @Deprecated
- public static boolean hasSelectedValue(final List<SelectItem> items, final Object value) {
- for (final SelectItem item : items) {
- if (ObjectUtils.equals(item.getValue(), value)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @deprecated since 2.0.0
- */
- @Deprecated
- public static int getIntValue(final ValueBinding valueBinding) {
- return getAsInt(valueBinding.getValue(FacesContext.getCurrentInstance()));
- }
-
- /**
- * @deprecated since 2.0.0
- */
- @Deprecated
- private static int getAsInt(final Object value) {
- final int result;
- if (value instanceof Number) {
- result = ((Number) value).intValue();
- } else if (value instanceof String) {
- result = Integer.parseInt((String) value);
- } else {
- throw new IllegalArgumentException("Can't convert " + value + " to int!");
- }
- return result;
- }
-
- /**
- * @deprecated since 2.0.0
- */
- @Deprecated
- public static String createPickerId(
- final FacesContext facesContext, final UIComponent component, final String postfix) {
- //String id = component.getId();
- final String id = getComponentId(facesContext, component);
- return id + "_picker" + postfix;
- }
-
- /**
- * @deprecated since 2.0.0
- */
- @Deprecated
- public static String getComponentId(final FacesContext facesContext, final UIComponent component) {
- final String id = component.getId();
- //if (id == null) {
- // XXX What is this?
- // id = component.getClientId(facesContext).substring(id.lastIndexOf('_'));
- //}
- return id;
- }
-
- /**
- * Checks if the Component has a label facet and if not creates one with the label attribute.
- * @deprecated since 2.0.0
- */
- @Deprecated
- public static UIComponent provideLabel(final FacesContext facesContext, final UIComponent component) {
- UIComponent label = component.getFacet(Facets.LABEL);
-
- if (label == null) {
- final Map attributes = component.getAttributes();
- Object labelText = component.getValueBinding(Attributes.LABEL);
- if (labelText == null) {
- labelText = attributes.get(Attributes.LABEL);
- }
-
- if (labelText != null) {
- final Application application = FacesContext.getCurrentInstance().getApplication();
- label = application.createComponent(UIOutput.COMPONENT_TYPE);
- label.setRendererType(RendererTypes.LABEL);
- final String idprefix = ComponentUtils.getComponentId(facesContext, component);
- label.setId(idprefix + "_" + Facets.LABEL);
- label.setRendered(true);
-
- if (labelText instanceof ValueBinding) {
- label.setValueBinding(Attributes.VALUE, (ValueBinding) labelText);
- } else {
- label.getAttributes().put(Attributes.VALUE, labelText);
- }
-
- component.getFacets().put(Facets.LABEL, label);
- }
- }
- return label;
- }
-
- /**
* <p>
* The search depends on the number of prefixed colons in the relativeId:
* <dl>
@@ -930,10 +716,10 @@ public final class ComponentUtils {
if (markup == null) {
markup = Markup.NULL;
}
- if (ComponentUtils.getBooleanAttribute(component, Attributes.DISABLED)) {
+ if (ComponentUtils.getBooleanAttribute(component, Attributes.disabled)) {
markup = markup.add(Markup.DISABLED);
}
- if (ComponentUtils.getBooleanAttribute(component, Attributes.READONLY)) {
+ if (ComponentUtils.getBooleanAttribute(component, Attributes.readonly)) {
markup = markup.add(Markup.READONLY);
}
if (component instanceof UIInput) {
@@ -966,23 +752,6 @@ public final class ComponentUtils {
component.setCurrentMarkup(markup.add(component.getCurrentMarkup()));
}
- /**
- * @deprecated since 2.0.0
- */
- @Deprecated
- public static boolean hasChildrenWithMessages(final FacesContext facesContext, final NamingContainer container) {
- if (container instanceof UIComponent) {
- final String clientId = ((UIComponent) container).getClientId(facesContext);
- for (final Iterator ids = facesContext.getClientIdsWithMessages(); ids.hasNext();) {
- final String id = (String) ids.next();
- if (id.startsWith(clientId)) {
- return true;
- }
- }
- }
- return false;
- }
-
public static FacesMessage.Severity getMaximumSeverityOfChildrenMessages(
final FacesContext facesContext, final NamingContainer container) {
if (container instanceof UIComponent) {
@@ -1006,25 +775,6 @@ public final class ComponentUtils {
}
/**
- * @deprecated since 2.0.0
- */
- @Deprecated
- public static String[] getChildrenWithMessages(final FacesContext facesContext, final NamingContainer container) {
- if (container instanceof UIComponent) {
- final List<String> clientIds = new ArrayList<String>();
- final String clientId = ((UIComponent) container).getClientId(facesContext);
- for (final Iterator ids = facesContext.getClientIdsWithMessages(); ids.hasNext();) {
- final String id = (String) ids.next();
- if (id.startsWith(clientId)) {
- clientIds.add(id);
- }
- }
- return clientIds.toArray(new String[clientIds.size()]);
- }
- return ArrayUtils.EMPTY_STRING_ARRAY;
- }
-
- /**
* Adding a data attribute to the component.
* The name must start with "data-", e. g. "data-tobago-foo" or "data-bar"
*/
@@ -1059,14 +809,4 @@ public final class ComponentUtils {
Map<Object, Object> map = getDataAttributes(component);
return map != null ? map.get(name) : null;
}
-
- /**
- * @deprecated since 2.0.0, please use
- * {@link javax.faces.component.UIComponent#invokeOnComponent(javax.faces.context.FacesContext, java.lang.String,
- javax.faces.component.ContextCallback) }
- */
- public static boolean invokeOnComponent(
- final FacesContext context, final UIComponent component, final String clientId, final ContextCallback callback) {
- return component.invokeOnComponent(context, clientId, callback);
- }
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/CreateComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/CreateComponentUtils.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/CreateComponentUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/CreateComponentUtils.java Wed Dec 16 19:23:36 2015
@@ -73,9 +73,9 @@ public final class CreateComponentUtils
facesContext, UIMenuSelectOne.COMPONENT_TYPE, RendererTypes.SELECT_ONE_RADIO, clientId);
//noinspection unchecked
command.getFacets().put(Facets.RADIO, radio);
- final ValueBinding valueBinding = command.getValueBinding(Attributes.VALUE);
+ final ValueBinding valueBinding = command.getValueBinding(Attributes.value.getName());
if (valueBinding != null) {
- radio.setValueBinding(Attributes.VALUE, valueBinding);
+ radio.setValueBinding(Attributes.value.getName(), valueBinding);
} else {
radio.setValue(command.getValue());
}
@@ -93,9 +93,9 @@ public final class CreateComponentUtils
facesContext, ComponentTypes.SELECT_BOOLEAN_CHECKBOX, RendererTypes.SELECT_BOOLEAN_CHECKBOX, clientId);
//noinspection unchecked
command.getFacets().put(Facets.CHECKBOX, checkbox);
- final ValueBinding valueBinding = command.getValueBinding(Attributes.VALUE);
+ final ValueBinding valueBinding = command.getValueBinding(Attributes.value.getName());
if (valueBinding != null) {
- checkbox.setValueBinding(Attributes.VALUE, valueBinding);
+ checkbox.setValueBinding(Attributes.value.getName(), valueBinding);
} else {
//noinspection unchecked
checkbox.setValue(command.getValue());
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java Wed Dec 16 19:23:36 2015
@@ -36,10 +36,10 @@ public class EncodeAjaxCallback implemen
try {
final UIComponent reload = component.getFacet(Facets.RELOAD);
if (reload != null && reload.isRendered()) {
- final Boolean immediate = (Boolean) reload.getAttributes().get(Attributes.IMMEDIATE);
- if (immediate != null && !immediate) {
- final Boolean update = (Boolean) reload.getAttributes().get(Attributes.UPDATE);
- if (update != null && !update) {
+ final Boolean immediate = ComponentUtils.getBooleanAttribute(reload, Attributes.immediate);
+ if (!immediate) {
+ final Boolean update = ComponentUtils.getBooleanAttribute(reload, Attributes.update);
+ if (!update) {
return;
}
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/component/SorterUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/component/SorterUnitTest.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/component/SorterUnitTest.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/component/SorterUnitTest.java Wed Dec 16 19:23:36 2015
@@ -19,7 +19,7 @@
package org.apache.myfaces.tobago.component;
-import org.apache.myfaces.test.mock.MockValueBinding;
+import org.apache.myfaces.test.el.MockValueExpression;
import org.apache.myfaces.tobago.event.SortActionEvent;
import org.apache.myfaces.tobago.internal.config.AbstractTobagoTestBase;
import org.junit.Test;
@@ -48,8 +48,8 @@ public class SorterUnitTest extends Abst
sorter.perform(sortActionEvent);
- link.setValueBinding(Attributes.LABEL,
- new MockValueBinding(getFacesContext().getApplication(), "var.test"));
+ link.setValueExpression(Attributes.label.getName(),
+ new MockValueExpression("var.test", String.class));
sorter.perform(sortActionEvent);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/convert/DurationConverterUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/convert/DurationConverterUnitTest.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/convert/DurationConverterUnitTest.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/convert/DurationConverterUnitTest.java Wed Dec 16 19:23:36 2015
@@ -66,7 +66,7 @@ public class DurationConverterUnitTest {
+ " long='" + aLong + "'";
final String result;
if (unit != null) {
- input.getAttributes().put(Attributes.UNIT, unit);
+ input.getAttributes().put(Attributes.unit.getName(), unit);
}
result = converter.getAsString(null, input, aLong);
Assert.assertEquals(info, string, result);
@@ -79,7 +79,7 @@ public class DurationConverterUnitTest {
+ " string='" + string + "'";
final Long result;
if (unit != null) {
- input.getAttributes().put(Attributes.UNIT, unit);
+ input.getAttributes().put(Attributes.unit.getName(), unit);
}
result = (Long) converter.getAsObject(null, input, string);
Assert.assertEquals(info, aLong, result);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/NumberSliderRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/NumberSliderRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/NumberSliderRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/sandbox/standard/tag/NumberSliderRenderer.java Wed Dec 16 19:23:36 2015
@@ -61,8 +61,8 @@ public class NumberSliderRenderer extend
final String currentValue = getCurrentValue(facesContext, slider);
final boolean readonly = slider.isReadonly();
final boolean disabled = slider.isDisabled();
- final Integer min = ComponentUtils.getIntAttribute(slider, "min");
- final Integer max = ComponentUtils.getIntAttribute(slider, "max");
+ final Integer min = slider.getMin();
+ final Integer max = slider.getMax();
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
// final Style style = slider.getStyle();
@@ -88,7 +88,7 @@ public class NumberSliderRenderer extend
writer.writeClassAttribute(Classes.create(slider), slider.getCustomClass());
HtmlRendererUtils.writeDataAttributes(facesContext, writer, slider);
writer.writeStyleAttribute(slider.getStyle());
- //writer.writeAttribute(HtmlAttributes.BORDER,"1",false);
+ //writer.writeAttribute(HtmlAttributes.border,"1",false);
writer.startElement(HtmlElements.TR);
writer.startElement(HtmlElements.TD);
@@ -129,7 +129,6 @@ public class NumberSliderRenderer extend
}
writer.writeAttribute(HtmlAttributes.READONLY, readonly);
writer.writeAttribute(HtmlAttributes.DISABLED, disabled);
- //writer.writeAttribute(HtmlAttributes.STYLE, null, STYLE);
writer.endElement(HtmlElements.INPUT);
writer.endElement(HtmlElements.TD);
@@ -161,7 +160,7 @@ public class NumberSliderRenderer extend
writer.endElement(HtmlElements.TR);
writer.endElement(HtmlElements.TABLE);
- writeSliderJavaScript(facesContext, slider, writer);
+// writeSliderJavaScript(facesContext, slider, writer);
//HtmlRendererUtils.renderFocusId(facesContext, slider);
}
@@ -199,32 +198,4 @@ public class NumberSliderRenderer extend
final String id = component.getClientId(context);
return id + ComponentUtils.SUB_SEPARATOR + "handle";
}
-
- private void writeSliderJavaScript(
- final FacesContext context, final UIComponent component, final TobagoResponseWriter writer)
- throws IOException {
- final String trackId = getIdForSliderTrack(context, component);
- final String handleId = getIdForSliderHandle(context, component);
- final String inputId = getIdForInputField(context, component);
- final String jsId = component.getClientId(context).replace(":", "_");
- final Integer min = ComponentUtils.getIntAttribute(component, "min");
- final Integer max = ComponentUtils.getIntAttribute(component, "max");
- final String script = " var slider_" + jsId + " = new Control.Slider('" + handleId + "', '" + trackId + "', {\n"
- + " sliderValue:$('" + inputId + "').value,\n"
- + " range : $R(" + min + ", " + max + "),\n"
- + " values: $R(" + min + ", " + max + ").toArray(),\n"
- + " onSlide:function(v) {\n"
- + " $('" + inputId + "').value = v;\n"
- + " },\n"
- + " onChange:function(v) {\n"
- + " $('" + inputId + "').value = v;\n"
- + " }\n"
- + " });\n"
- + "\n"
- + " Event.observe('value', 'change', function() {\n"
- + " slider_" + jsId + ".setValue($('" + inputId + "').value);\n"
- + " });\n";
- writer.writeJavascript(script);
- }
-
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java Wed Dec 16 19:23:36 2015
@@ -105,7 +105,7 @@ public class SplitLayoutRenderer extends
writer.writeIdAttribute(id + POSITION_ID_POSTFIX);
writer.writeNameAttribute(id + POSITION_ID_POSTFIX);
writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN);
-// writer.writeAttribute(HtmlAttributes.VALUE, Integer.toString(position), false);
+// writer.writeAttribute(HtmlAttributes.value, Integer.toString(position), false);
writer.endElement(HtmlElements.INPUT);
writer.endElement(HtmlElements.SPAN);
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java Wed Dec 16 19:23:36 2015
@@ -90,10 +90,10 @@ public class Command {
}
this.action = facetComponent.getClientId(facesContext);
// transition == true is the default
- if (!ComponentUtils.getBooleanAttribute(facetComponent, Attributes.TRANSITION)) {
+ if (!ComponentUtils.getBooleanAttribute(facetComponent, Attributes.transition)) {
this.transition = Boolean.FALSE;
}
- final String target = ComponentUtils.getStringAttribute(facetComponent, Attributes.TARGET);
+ final String target = ComponentUtils.getStringAttribute(facetComponent, Attributes.target);
if (target != null) {
this.target = target;
}
@@ -107,12 +107,12 @@ public class Command {
}
}
- final int delay = ComponentUtils.getIntAttribute(facetComponent, Attributes.DELAY);
+ final int delay = ComponentUtils.getIntAttribute(facetComponent, Attributes.delay);
if (delay > 0) {
this.delay = delay;
}
// omit == false is the default
- if (ComponentUtils.getBooleanAttribute(facetComponent, Attributes.OMIT)) {
+ if (ComponentUtils.getBooleanAttribute(facetComponent, Attributes.omit)) {
this.omit = Boolean.TRUE;
}
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Popup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Popup.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Popup.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Popup.java Wed Dec 16 19:23:36 2015
@@ -44,7 +44,7 @@ public class Popup {
String command = null;
Boolean immediate = null;
- final String popupClose = (String) component.getAttributes().get(Attributes.POPUP_CLOSE);
+ final String popupClose = ComponentUtils.getStringAttribute(component, Attributes.popupClose);
if (popupClose != null) {
command = "close";
immediate = popupClose.equals("immediate");
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxToolBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxToolBarRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxToolBarRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxToolBarRenderer.java Wed Dec 16 19:23:36 2015
@@ -21,6 +21,7 @@ package org.apache.myfaces.tobago.render
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.UIToolBar;
+import org.apache.myfaces.tobago.util.ComponentUtils;
import javax.faces.component.UIComponent;
@@ -29,7 +30,7 @@ public class BoxToolBarRenderer extends
@Override
protected String getLabelPosition(final UIComponent component) {
- final String attribute = (String) component.getAttributes().get(Attributes.LABEL_POSITION);
+ final String attribute = ComponentUtils.getStringAttribute(component, Attributes.labelPosition);
if (UIToolBar.LABEL_BOTTOM.equals(attribute)) {
return UIToolBar.LABEL_RIGHT;
} else {
@@ -39,7 +40,7 @@ public class BoxToolBarRenderer extends
@Override
protected String getIconSize(final UIComponent component) {
- final String attribute = (String) component.getAttributes().get(Attributes.ICON_SIZE);
+ final String attribute = ComponentUtils.getStringAttribute(component, Attributes.iconSize);
if (UIToolBar.ICON_BIG.equals(attribute)) {
return UIToolBar.ICON_SMALL;
} else {
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ButtonRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ButtonRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ButtonRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ButtonRenderer.java Wed Dec 16 19:23:36 2015
@@ -92,7 +92,7 @@ public class ButtonRenderer extends Comm
writer.writeStyleAttribute(button.getStyle());
- final boolean defaultCommand = ComponentUtils.getBooleanAttribute(component, Attributes.DEFAULT_COMMAND);
+ final boolean defaultCommand = ComponentUtils.getBooleanAttribute(component, Attributes.defaultCommand);
// TODO this might be too expensive:
// TODO please put a flag in the ToolBar-handler and Button-handler (facelets-handler)
final boolean insideToolbar = ComponentUtils.findAncestor(component, AbstractUIToolBar.class) != null;
@@ -109,7 +109,7 @@ public class ButtonRenderer extends Comm
}
writer.flush(); // force closing the start tag
- String image = (String) button.getAttributes().get(Attributes.IMAGE);
+ String image = ComponentUtils.getStringAttribute(button, Attributes.image);
HtmlRendererUtils.encodeIconWithLabel(writer, facesContext, image, label, disabled);
writer.endElement(HtmlElements.BUTTON);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/GridLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/GridLayoutRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/GridLayoutRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/GridLayoutRenderer.java Wed Dec 16 19:23:36 2015
@@ -141,7 +141,7 @@ public class GridLayoutRenderer extends
final UIComponent element = cell.getComponent();
StringBuilder builder = new StringBuilder();
builder.append("{");
- final Measure width = Measure.valueOf(element.getAttributes().get(Attributes.WIDTH));
+ final Measure width = Measure.valueOf(ComponentUtils.getAttribute(element, Attributes.width));
if (width != null) {
builder.append("\"width\":");
// builder.append("{\"pixel\":");
@@ -149,7 +149,7 @@ public class GridLayoutRenderer extends
// builder.append("}");
builder.append(",");
}
- final Measure height = Measure.valueOf(element.getAttributes().get(Attributes.HEIGHT));
+ final Measure height = Measure.valueOf(ComponentUtils.getAttribute(element, Attributes.height));
if (height != null) {
builder.append("\"height\":");
// builder.append("{\"pixel\":");
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ImageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ImageRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ImageRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ImageRenderer.java Wed Dec 16 19:23:36 2015
@@ -71,10 +71,7 @@ public class ImageRenderer extends Rende
src = null;
}
- String alt = (String) image.getAttributes().get(Attributes.ALT);
- if (alt == null) {
- alt = "";
- }
+ final String alt = ComponentUtils.getStringAttribute(image, Attributes.alt, "");
if (fontAwesome) {
writer.writeIcon(null, FontAwesomeIconEncoder.generateClass(value)); // todo: should not be static
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java Wed Dec 16 19:23:36 2015
@@ -59,7 +59,7 @@ public class InRenderer extends InputRen
final AbstractUIInput input = (AbstractUIInput) component;
final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, input);
final String currentValue = getCurrentValue(facesContext, input);
- final boolean password = ComponentUtils.getBooleanAttribute(input, Attributes.PASSWORD);
+ final boolean password = ComponentUtils.getBooleanAttribute(input, Attributes.password);
if (LOG.isDebugEnabled()) {
LOG.debug("currentValue = '{}'", StringUtils.toConfidentialString(currentValue, password));
}
@@ -67,7 +67,7 @@ public class InRenderer extends InputRen
final String id = input.getClientId(facesContext);
final boolean readonly = input.isReadonly();
final boolean disabled = input.isDisabled();
- final boolean required = ComponentUtils.getBooleanAttribute(input, Attributes.REQUIRED);
+ final boolean required = ComponentUtils.getBooleanAttribute(input, Attributes.required);
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InputRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InputRendererBase.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InputRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InputRendererBase.java Wed Dec 16 19:23:36 2015
@@ -55,7 +55,7 @@ public abstract class InputRendererBase
if (requestParameterMap.containsKey(clientId)) {
String newValue = requestParameterMap.get(clientId);
if (LOG.isDebugEnabled()) {
- final boolean password = ComponentUtils.getBooleanAttribute(component, Attributes.PASSWORD);
+ final boolean password = ComponentUtils.getBooleanAttribute(component, Attributes.password);
LOG.debug("clientId='{}'", clientId);
LOG.debug("requestParameterMap.get(clientId)='{}'", StringUtils.toConfidentialString(newValue, password));
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LabelLayoutRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LabelLayoutRendererBase.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LabelLayoutRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LabelLayoutRendererBase.java Wed Dec 16 19:23:36 2015
@@ -41,7 +41,7 @@ import java.io.IOException;
/**
* Manages the rendering of the <b>label</b> and the <b>field</b> together with different possibilities for
- * the position of the label (defined by {@link org.apache.myfaces.tobago.component.Attributes#LABEL_LAYOUT}
+ * the position of the label (defined by {@link org.apache.myfaces.tobago.component.Attributes#labelLayout}
*/
public abstract class LabelLayoutRendererBase extends RendererBase {
@@ -182,7 +182,7 @@ public abstract class LabelLayoutRendere
protected void encodeLabel(UIComponent component, TobagoResponseWriter writer, LabelLayout labelLayout)
throws IOException {
// TBD: maybe use an interface for getLabel()
- final String label = ComponentUtils.getStringAttribute(component, Attributes.LABEL);
+ final String label = ComponentUtils.getStringAttribute(component, Attributes.label);
if (StringUtils.isNotBlank(label)) {
writer.startElement(HtmlElements.LABEL);
writer.writeAttribute(HtmlAttributes.FOR, component.getClientId(), false);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java Wed Dec 16 19:23:36 2015
@@ -76,7 +76,7 @@ public class MenuCommandRenderer extends
if (command.getFacet(Facets.CHECKBOX) != null) {
// checkbox menu
final UISelectBooleanCheckbox checkbox = (UISelectBooleanCheckbox) command.getFacet(Facets.CHECKBOX);
- final boolean checked = ComponentUtils.getBooleanAttribute(checkbox, Attributes.VALUE);
+ final boolean checked = ComponentUtils.getBooleanAttribute(checkbox, Attributes.value);
final String image = checked ? "image/MenuCheckmark" : null;
final String hiddenId = checkbox.getClientId(facesContext);
final CommandMap map = new CommandMap(new Command());
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java Wed Dec 16 19:23:36 2015
@@ -52,7 +52,6 @@ import javax.faces.component.UIComponent
import javax.faces.context.FacesContext;
import java.io.IOException;
import java.util.List;
-import java.util.Map;
public class MessagesRenderer extends RendererBase {
@@ -83,7 +82,7 @@ public class MessagesRenderer extends Re
// with id
/*String focusId = null;
Iterator clientIds;
- if (ComponentUtils.getBooleanAttribute(messages, Attributes.GLOBAL_ONLY)) {
+ if (ComponentUtils.getBooleanAttribute(messages, Attributes.globalOnly)) {
ArrayList<String> list = new ArrayList<String>(1);
list.add(null);
clientIds = list.iterator();
@@ -170,23 +169,22 @@ public class MessagesRenderer extends Re
= messages.getId() != null ? messages.getId() + "popup" : facesContext.getViewRoot().createUniqueId();
final UIPopup popup = (UIPopup)
CreateComponentUtils.createComponent(facesContext, UIPopup.COMPONENT_TYPE, RendererTypes.POPUP, id);
- popup.getAttributes().put(Attributes.Z_INDEX, 10);
+ ComponentUtils.setAttribute(popup, Attributes.zIndex, 10);
popup.setRendered(true);
popup.setActivated(true);
popup.onComponentPopulated(facesContext, messages);
FacesContextUtils.addPopup(facesContext, popup);
-
- Map<String, Object> okButtonAttributes = popup.getAttributes();
- okButtonAttributes.put(Attributes.POPUP_RESET, Boolean.TRUE);
+ ComponentUtils.setAttribute(popup, Attributes.popupReset, Boolean.TRUE);
final UIComponent box = CreateComponentUtils.createComponent(
facesContext, UIBox.COMPONENT_TYPE, RendererTypes.BOX);
popup.getChildren().add(box);
box.setId("box");
// TODO: set string resources in renderer
- box.getAttributes().put(Attributes.LABEL, ResourceManagerUtils.getPropertyNotNull(
- facesContext, "tobago", "tobago.message.confirmation.title"));
+ final String label
+ = ResourceManagerUtils.getPropertyNotNull(facesContext, "tobago", "tobago.message.confirmation.title");
+ ComponentUtils.setAttribute(box, Attributes.label, label);
final UIPanel scrollPanel = (UIPanel)
CreateComponentUtils.createComponent(facesContext, UIPanel.COMPONENT_TYPE, "Panel", "messagePanel");
@@ -210,25 +208,11 @@ public class MessagesRenderer extends Re
final UIButton okButton = (UIButton) CreateComponentUtils.createComponent(
facesContext, UIButton.COMPONENT_TYPE, RendererTypes.BUTTON, CLOSE_POPUP);
buttonPanel.getChildren().add(okButton);
- okButtonAttributes = okButton.getAttributes();
- okButtonAttributes.put(Attributes.LABEL, ResourceManagerUtils.getPropertyNotNull(
- facesContext, "tobago", "tobago.message.confirmation.okay"));
- okButtonAttributes.put("popupClose", "immediate");
+ okButton.setLabel(
+ ResourceManagerUtils.getPropertyNotNull(facesContext, "tobago", "tobago.message.confirmation.okay"));
+ ComponentUtils.setAttribute(okButton, Attributes.popupClose, "immediate");
}
- /*
- private void encodeMessagesForId(FacesContext facesContext,
- TobagoResponseWriter writer, String clientId, boolean showSummary, boolean showDetail) throws IOException {
- Iterator iterator = facesContext.getMessages(clientId);
- while (iterator.hasNext()) {
- FacesMessage message = (FacesMessage) iterator.next();
- if (LOG.isDebugEnabled()) {
- LOG.debug("message = " + message.getSummary());
- }
- encodeMessage(writer, message, clientId, showSummary, showDetail);
- }
- }
- */
private void encodeMessage(
final TobagoResponseWriter writer, final UIMessages messages, final FacesMessage message, final String clientId)
throws IOException {
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java Wed Dec 16 19:23:36 2015
@@ -148,7 +148,7 @@ public class PageRenderer extends Render
final boolean preventFrameAttacks = tobagoConfig.isPreventFrameAttacks();
if (!FacesContextUtils.isAjax(facesContext)) {
- final String title = (String) page.getAttributes().get(Attributes.LABEL);
+ final String title = page.getLabel();
writer.startElement(HtmlElements.HEAD);
@@ -286,12 +286,12 @@ public class PageRenderer extends Render
/*
if (ViewHandlerImpl.USE_VIEW_MAP) {
writer.startElement(HtmlElements.INPUT, null);
- writer.writeAttribute(HtmlAttributes.TYPE, "hidden", null);
+ writer.writeAttribute(HtmlAttributes.type, "hidden", null);
writer.writeNameAttribute(ViewHandlerImpl.PAGE_ID);
writer.writeIdAttribute(ViewHandlerImpl.PAGE_ID);
Object value = facesContext.getViewRoot().getAttributes().get(
ViewHandlerImpl.PAGE_ID);
- writer.writeAttribute(HtmlAttributes.VALUE, (value != null ? value : ""), null);
+ writer.writeAttribute(HtmlAttributes.value, (value != null ? value : ""), null);
writer.endElement(HtmlElements.INPUT);
}
*/
@@ -469,7 +469,7 @@ public class PageRenderer extends Render
private void errorMessageForDebugging(final String id, final FacesMessage message, final ResponseWriter writer)
throws IOException {
writer.startElement(HtmlElements.DIV, null);
- writer.writeAttribute(HtmlAttributes.STYLE, "color: red", null);
+ writer.writeAttribute(HtmlAttributes.style, "color: red", null);
writer.write("[");
writer.write(id != null ? id : "null");
writer.write("]");
@@ -500,8 +500,7 @@ public class PageRenderer extends Render
*/
private String getMethod(final UIPage page) {
- final String method = (String) page.getAttributes().get(Attributes.METHOD);
- return method == null ? "post" : method;
+ return ComponentUtils.getStringAttribute(page, Attributes.method, "post");
}
@Override
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ProgressRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ProgressRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ProgressRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ProgressRenderer.java Wed Dec 16 19:23:36 2015
@@ -19,7 +19,6 @@
package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
-import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.UICommand;
import org.apache.myfaces.tobago.component.UIProgress;
import org.apache.myfaces.tobago.renderkit.RendererBase;
@@ -53,7 +52,7 @@ public class ProgressRenderer extends Re
}
final int diff = model.getMaximum() - model.getMinimum();
- Object title = progress.getAttributes().get(Attributes.TIP);
+ Object title = progress.getTip();
final double percent = 100.0 * model.getValue() / diff;
if (title == null && diff > 0) {
title = Integer.toString((int) percent) + " %";
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectReferenceRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectReferenceRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectReferenceRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectReferenceRenderer.java Wed Dec 16 19:23:36 2015
@@ -19,6 +19,7 @@
package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
+import org.apache.myfaces.tobago.util.ComponentUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.myfaces.tobago.component.Attributes;
@@ -36,17 +37,14 @@ public class SelectReferenceRenderer ext
public void encodeEnd(final FacesContext facesContext,
final UIComponent component)
throws IOException {
- final String referenceId = (String)
- component.getAttributes().get(Attributes.FOR);
+ final String referenceId = ComponentUtils.getStringAttribute(component, Attributes.forValue);
final UIComponent reference = component.findComponent(referenceId);
- reference.getAttributes().put(Attributes.RENDER_RANGE_EXTERN,
- component.getAttributes().get(Attributes.RENDER_RANGE));
+ final Object renderRange = ComponentUtils.getAttribute(component, Attributes.renderRange);
+ ComponentUtils.setAttribute(reference, Attributes.renderRangeExtern, renderRange);
RenderUtils.encode(facesContext, reference);
- reference.getAttributes().remove(Attributes.RENDER_RANGE_EXTERN);
+ ComponentUtils.removeAttribute(reference, Attributes.renderRangeExtern);
}
-
}
-
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetPageCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetPageCommandRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetPageCommandRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetPageCommandRenderer.java Wed Dec 16 19:23:36 2015
@@ -46,13 +46,13 @@ public class SheetPageCommandRenderer ex
if (actionId != null && actionId.equals(clientId)) {
- final PageAction action = (PageAction) component.getAttributes().get(Attributes.PAGE_ACTION);
+ final PageAction action = (PageAction) ComponentUtils.getAttribute(component, Attributes.pageAction);
final PageActionEvent event = new PageActionEvent(component.getParent(), action);
switch (action) {
case TO_PAGE:
case TO_ROW:
- Integer target = (Integer) component.getAttributes().get(Attributes.PAGING_TARGET);
+ Integer target = (Integer) ComponentUtils.getAttribute(component, Attributes.pagingTarget);
if (target == null) {
final Map map = facesContext.getExternalContext().getRequestParameterMap();
final Object value = map.get(actionId + ComponentUtils.SUB_SEPARATOR + "value");
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java Wed Dec 16 19:23:36 2015
@@ -118,17 +118,17 @@ public class SheetRenderer extends Rende
facesContext, ComponentTypes.OUT, RendererTypes.OUT, "_col" + i);
out.setTransient(true);
// out.setValue(column.getLabel());
- ValueExpression valueExpression = column.getValueExpression(Attributes.LABEL);
+ ValueExpression valueExpression = column.getValueExpression(Attributes.label.getName());
if (valueExpression != null) {
- out.setValueExpression(Attributes.VALUE, valueExpression);
+ out.setValueExpression(Attributes.value.getName(), valueExpression);
} else {
- out.setValue(column.getAttributes().get(Attributes.LABEL));
+ out.setValue(ComponentUtils.getAttribute(column, Attributes.label));
}
- valueExpression = column.getValueExpression(Attributes.RENDERED);
+ valueExpression = column.getValueExpression(Attributes.rendered.getName());
if (valueExpression != null) {
- out.setValueExpression(Attributes.RENDERED, valueExpression);
+ out.setValueExpression(Attributes.rendered.getName(), valueExpression);
} else {
- out.setRendered((Boolean) column.getAttributes().get(Attributes.RENDERED));
+ out.setRendered(ComponentUtils.getBooleanAttribute(column, Attributes.rendered));
}
header.getChildren().add(out);
i++;
@@ -190,7 +190,7 @@ public class SheetRenderer extends Rende
writer.writeAttribute(HtmlAttributes.VALUE, StringUtils.joinWithSurroundingSeparator(columnWidths), false);
writer.endElement(HtmlElements.INPUT);
- RenderUtils.writeScrollPosition(facesContext, writer, sheet, sheet.getScrollPosition());
+ RenderUtils.writeScrollPosition(facesContext, writer, sheet, sheet.getState());
if (selectable != Selectable.none) {
writer.startElement(HtmlElements.INPUT);
@@ -315,7 +315,7 @@ public class SheetRenderer extends Rende
if (isPure(column)) {
markup = markup.add(Markup.PURE);
}
- final String textAlign = (String) column.getAttributes().get(Attributes.ALIGN);
+ final String textAlign = ComponentUtils.getStringAttribute(column, Attributes.align);
if (textAlign != null) {
switch (TextAlign.valueOf(textAlign)) {
case right:
@@ -352,20 +352,6 @@ public class SheetRenderer extends Rende
} else {
final List<UIComponent> children = sheet.getRenderedChildrenOf(column);
for (final UIComponent grandKid : children) {
- // set height to 0 to prevent use of layoutheight from parent
- grandKid.getAttributes().put(Attributes.LAYOUT_HEIGHT, HEIGHT_0);
- // XXX hotfix
-/* XXX broken
- if (grandKid instanceof LayoutBase) {
- final LayoutBase base = (LayoutBase) grandKid;
- if (base.getLeft() != null) {
- base.setLeft(null);
- }
- if (base.getTop() != null) {
- base.setTop(null);
- }
- }
-*/
EncodeUtils.prepareRendererAll(facesContext, grandKid);
RenderUtils.encode(facesContext, grandKid);
}
@@ -652,7 +638,7 @@ public class SheetRenderer extends Rende
if (requestParameterMap.containsKey(key)) {
final String widths = (String) requestParameterMap.get(key);
if (widths.trim().length() > 0) {
- sheet.getAttributes().put(Attributes.WIDTH_LIST_STRING, widths);
+ ComponentUtils.setAttribute(sheet, Attributes.widthListString, widths);
}
}
@@ -670,10 +656,10 @@ public class SheetRenderer extends Rende
selectedRows = Collections.emptyList();
}
- sheet.getAttributes().put(Attributes.SELECTED_LIST_STRING, selectedRows);
+ ComponentUtils.setAttribute(sheet, Attributes.selectedListString, selectedRows);
}
- RenderUtils.decodeScrollPosition(facesContext, sheet);
+ RenderUtils.decodeScrollPosition(facesContext, sheet, sheet.getState());
RenderUtils.decodedStateOfTreeData(facesContext, sheet);
}
@@ -712,7 +698,7 @@ public class SheetRenderer extends Rende
}
private List<Integer> getSelectedRows(final UISheet data, final SheetState state) {
- List<Integer> selected = (List<Integer>) data.getAttributes().get(Attributes.SELECTED_LIST_STRING);
+ List<Integer> selected = (List<Integer>) ComponentUtils.getAttribute(data, Attributes.selectedListString);
if (selected == null && state != null) {
selected = state.getSelectedRows();
}
@@ -732,7 +718,7 @@ public class SheetRenderer extends Rende
: action.getToken();
final UICommand command = ensurePagingCommand(application, data, facet, action, disabled);
if (target != null) {
- command.getAttributes().put(Attributes.PAGING_TARGET, target);
+ ComponentUtils.setAttribute(command, Attributes.pagingTarget, target);
}
command.setRenderedPartially(new String[]{data.getId()});
@@ -820,10 +806,10 @@ public class SheetRenderer extends Rende
final AbstractUIColumn column = renderedColumnList.get(j);
Icons sorterIcon = null;
Markup markup = Markup.NULL;
- String tip = (String) column.getAttributes().get(Attributes.TIP);
+ String tip = ComponentUtils.getStringAttribute(column, Attributes.tip);
// sorter icons should only displayed when there is only 1 column and not input
if (cell.getColumnSpan() == 1 && cellComponent instanceof UIOut) {
- final boolean sortable = ComponentUtils.getBooleanAttribute(column, Attributes.SORTABLE);
+ final boolean sortable = ComponentUtils.getBooleanAttribute(column, Attributes.sortable);
if (sortable) {
UICommand sortCommand = (UICommand) column.getFacet(Facets.SORTER);
if (sortCommand == null) {
@@ -1009,7 +995,7 @@ public class SheetRenderer extends Rende
final UICommand command
= ensurePagingCommand(application, sheet, Facets.PAGER_PAGE_DIRECT, PageAction.TO_PAGE, false);
- int linkCount = ComponentUtils.getIntAttribute(sheet, Attributes.DIRECT_LINK_COUNT);
+ int linkCount = ComponentUtils.getIntAttribute(sheet, Attributes.directLinkCount);
linkCount--; // current page needs no link
final ArrayList<Integer> prevs = new ArrayList<Integer>(linkCount);
int page = sheet.getCurrentPage() + 1;
@@ -1090,7 +1076,7 @@ public class SheetRenderer extends Rende
command = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
command.setRendererType(RendererTypes.SHEET_PAGE_COMMAND);
command.setRendered(true);
- command.getAttributes().put(Attributes.PAGE_ACTION, action);
+ ComponentUtils.setAttribute(command, Attributes.pageAction, action);
command.setDisabled(disabled);
facets.put(facet, command);
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SuggestRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SuggestRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SuggestRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SuggestRenderer.java Wed Dec 16 19:23:36 2015
@@ -95,7 +95,7 @@ public class SuggestRenderer extends Ren
final String clientId = suggest.getClientId(facesContext);
writer.writeIdAttribute(clientId);
writer.writeNameAttribute(clientId);
- writer.writeAttribute(HtmlAttributes.VALUE, (String) suggest.getAttributes().get(Attributes.VALUE), true);
+ writer.writeAttribute(HtmlAttributes.VALUE, ComponentUtils.getStringAttribute(suggest, Attributes.value), true);
writer.writeAttribute(DataAttributes.SUGGEST_FOR, in.getClientId(facesContext), false);
writer.writeAttribute(DataAttributes.SUGGEST_MIN_CHARS, suggest.getMinimumCharacters());
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java Wed Dec 16 19:23:36 2015
@@ -163,7 +163,7 @@ public class TabGroupRenderer extends Re
// resetting index to 0
closestRenderedTabIndex = 0;
}
- final ValueExpression expression = tabGroup.getValueExpression(Attributes.SELECTED_INDEX);
+ final ValueExpression expression = tabGroup.getValueExpression(Attributes.selectedIndex.getName());
if (expression != null) {
expression.setValue(context.getELContext(), closestRenderedTabIndex);
} else {
@@ -283,7 +283,7 @@ public class TabGroupRenderer extends Re
final UICommand previous = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
previous.setId(viewRoot.createUniqueId());
previous.setRendererType(null);
- previous.getAttributes().put(Attributes.IMAGE, "image/tabPrev");
+ ComponentUtils.setAttribute(previous, Attributes.image, "image/tabPrev");
previous.setOmit(true); // avoid submit
ComponentUtils.putDataAttribute(previous, "tobago-tabgroup-toolbar-prev", "p");
@@ -291,7 +291,7 @@ public class TabGroupRenderer extends Re
final UICommand next = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
next.setId(viewRoot.createUniqueId());
next.setRendererType(null);
- next.getAttributes().put(Attributes.IMAGE, "image/tabNext");
+ ComponentUtils.setAttribute(next, Attributes.image, "image/tabNext");
next.setOmit(true); // avoid submit
ComponentUtils.putDataAttribute(next, "tobago-tabgroup-toolbar-next", "n");
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java Wed Dec 16 19:23:36 2015
@@ -79,12 +79,12 @@ public abstract class ToolBarRendererBas
}
protected String getLabelPosition(final UIComponent component) {
- return (String) component.getAttributes().get(Attributes.LABEL_POSITION);
+ return ComponentUtils.getStringAttribute(component, Attributes.labelPosition);
}
// XXX remove it, after removing subclasses
protected String getIconSize(final UIComponent component) {
- return (String) component.getAttributes().get(Attributes.ICON_SIZE);
+ return ComponentUtils.getStringAttribute(component, Attributes.iconSize);
}
protected boolean isRightAligned(final UIToolBar toolBar) {
@@ -156,7 +156,7 @@ public abstract class ToolBarRendererBas
for (final SelectItem item : items) {
final String labelText = item.getLabel();
if (labelText != null) {
- command.getAttributes().put(Attributes.LABEL, labelText);
+ ComponentUtils.setAttribute(command, Attributes.label, labelText);
} else {
LOG.warn("Menu item has label=null. UICommand.getClientId()=" + command.getClientId(facesContext));
}
@@ -168,10 +168,10 @@ public abstract class ToolBarRendererBas
if (image == null) {
image = "image/1x1";
}
- command.getAttributes().put(Attributes.IMAGE, image);
+ ComponentUtils.setAttribute(command, Attributes.image, image);
if (item.getDescription() != null) {
- command.getAttributes().put(Attributes.TIP, item.getDescription());
+ ComponentUtils.setAttribute(command, Attributes.tip, item.getDescription());
}
final String formattedValue = RenderUtils.getFormattedValue(facesContext, radio, item.getValue());
@@ -210,7 +210,7 @@ public abstract class ToolBarRendererBas
checkbox = CreateComponentUtils.createUISelectBooleanFacetWithId(facesContext, command);
}
- final boolean checked = ComponentUtils.getBooleanAttribute(checkbox, Attributes.VALUE);
+ final boolean checked = ComponentUtils.getBooleanAttribute(checkbox, Attributes.value);
final String clientId = checkbox.getClientId(facesContext);
writer.startElement(HtmlElements.SPAN);
@@ -235,19 +235,16 @@ public abstract class ToolBarRendererBas
return;
}
- final boolean disabled = ComponentUtils.getBooleanAttribute(command, Attributes.DISABLED);
+ final boolean disabled = ComponentUtils.getBooleanAttribute(command, Attributes.disabled);
final LabelWithAccessKey label = command instanceof SupportsAccessKey
- ? new LabelWithAccessKey((SupportsAccessKey) command)
+ ? new LabelWithAccessKey(command)
: new LabelWithAccessKey(command.getLabel());
final AbstractUIMenu dropDownMenu = FacetUtils.getDropDownMenu(command);
// final ResourceManager resources = getResourceManager();
final String labelPosition = getLabelPosition(command.getParent());
final String iconSize = getIconSize(command.getParent());
- String iconName = (String) command.getAttributes().get(Attributes.IMAGE);
- if (iconName == null) {
- iconName = "image/blank";
- }
+ final String iconName = ComponentUtils.getStringAttribute(command, Attributes.image, "image/blank");
final String image = getImage(facesContext, iconName, iconSize, disabled, selected);
final boolean showIcon = !UIToolBar.ICON_OFF.equals(iconSize);
@@ -333,7 +330,7 @@ public abstract class ToolBarRendererBas
if (showDropDownMenu) {
writer.startElement(HtmlElements.IMG);
final boolean dropDownDisabled
- = ComponentUtils.getBooleanAttribute(dropDownMenu, Attributes.DISABLED) || disabled;
+ = ComponentUtils.getBooleanAttribute(dropDownMenu, Attributes.disabled) || disabled;
final String menuImage
= ResourceManagerUtils.getImageOrDisabledImage(facesContext, "image/toolbarButtonMenu", dropDownDisabled);
writer.writeAttribute(HtmlAttributes.SRC, menuImage, false);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeIndentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeIndentRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeIndentRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeIndentRenderer.java Wed Dec 16 19:23:36 2015
@@ -94,7 +94,7 @@ public class TreeIndentRenderer extends
/*
writer.startElement(HtmlElements.IMG, null);
writer.writeClassAttribute(Classes.create(node, "junction"));
- writer.writeAttribute(HtmlAttributes.ALT, "", false);
+ writer.writeAttribute(HtmlAttributes.alt, "", false);
if (junction && showLines) {
writer.writeAttribute("src", perpendicular, true);
} else {
@@ -161,12 +161,12 @@ public class TreeIndentRenderer extends
final String srcOpen = ResourceManagerUtils.getImage(facesContext, "image/" + open);
final String srcClose = ResourceManagerUtils.getImage(facesContext, "image/" + close);
final String src = expanded ? srcOpen : srcClose;
- writer.writeAttribute(HtmlAttributes.SRC, src, true);
+ writer.writeAttribute(HtmlAttributes.src, src, true);
if (folder) {
writer.writeAttribute(DataAttributes.SRC_OPEN, srcOpen, true);
writer.writeAttribute(DataAttributes.SRC_CLOSE, srcClose, true);
}
- writer.writeAttribute(HtmlAttributes.ALT, "", false);
+ writer.writeAttribute(HtmlAttributes.alt, "", false);
writer.endElement(HtmlElements.IMG);
*/
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxNodeRenderer.java?rev=1720417&r1=1720416&r2=1720417&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxNodeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxNodeRenderer.java Wed Dec 16 19:23:36 2015
@@ -120,7 +120,7 @@ public class TreeListboxNodeRenderer ext
writer.startElement(HtmlElements.OPTION);
// todo: define where to store the selection of a tree, node.getValue() seems not to be a god place.
- // writer.writeAttribute(HtmlAttributes.VALUE, node.getValue().toString(), true); // XXX converter?
+ // writer.writeAttribute(HtmlAttributes.value, node.getValue().toString(), true); // XXX converter?
writer.writeAttribute(HtmlAttributes.VALUE, id, true);
writer.writeIdAttribute(id);
writer.writeAttribute(HtmlAttributes.SELECTED, expanded);