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 2016/01/20 14:50:18 UTC
svn commit: r1725722 - 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/event/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/comp...
Author: lofwyr
Date: Wed Jan 20 13:50:18 2016
New Revision: 1725722
URL: http://svn.apache.org/viewvc?rev=1725722&view=rev
Log:
TOBAGO-1501: Refactoring: using further enums
* class Facets -> enum
Modified:
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PopupFacetActionListener.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutUtils.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/CreateComponentUtils.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacetUtils.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxRenderer.java
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
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SeparatorRenderer.java
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
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
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
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java?rev=1725722&r1=1725721&r2=1725722&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Facets.java Wed Jan 20 13:50:18 2016
@@ -19,42 +19,143 @@
package org.apache.myfaces.tobago.component;
-public final class Facets {
+public enum Facets {
+ action,
+ change,
+ checkbox,
+ click,
+ complete,
+ confirmation,
+ constraints,
+ contextMenu,
+ dropDownMenu,
+ label,
+ /**
+ * @deprecated since 3.0.0. The layout manager tag should surround the content instead.
+ */
+ @Deprecated
+ layout,
+ layoutDefault,
+ menuBar,
+ pagerPage,
+ pagerPageDirect,
+ pagerRow,
+ popup,
+ radio,
+ reload,
+ resize,
+ sorter,
+ toolBar;
+
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String ACTION = "action";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String CHANGE = "change";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String CHECKBOX = "checkbox";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String CLICK = "click";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String COMPLETE = "complete";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String CONFIRMATION = "confirmation";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String CONSTRAINTS = "constraints";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String CONTEXT_MENU = "contextMenu";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String DROP_DOWN_MENU = "dropDownMenu";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String LABEL = "label";
/**
- * @deprecated since 3.0.0. The layout manager tag should surround the content instead.
+ * @deprecated since 3.0.0. The layout manager tag should surround the content instead. Try to use the enum.
*/
+ @Deprecated
public static final String LAYOUT = "layout";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String LAYOUT_DEFAULT = "layoutDefault";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String MENUBAR = "menuBar";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String PAGER_PAGE = "pagerPage";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String PAGER_PAGE_DIRECT = "pagerPageDirect";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String PAGER_ROW = "pagerRow";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String POPUP = "popup";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String RADIO = "radio";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String RELOAD = "reload";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String RESIZE = "resize";
+ /**
+ * @deprecated since 3.0.0. Try to use the enum.
+ */
+ @Deprecated
public static final String SORTER = "sorter";
- public static final String TOOL_BAR = "toolBar";
-
- private Facets() {
- // to prevent instantiation
- }
-
/**
- * @deprecated since 2.0.0. Please use {@link #POPUP}
- * Using compatible names for backward compatibility.
+ * @deprecated since 3.0.0. Try to use the enum.
*/
@Deprecated
- public static final String PICKER_POPUP = POPUP;
+ public static final String TOOL_BAR = "toolBar";
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PopupFacetActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PopupFacetActionListener.java?rev=1725722&r1=1725721&r2=1725722&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PopupFacetActionListener.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/event/PopupFacetActionListener.java Wed Jan 20 13:50:18 2016
@@ -19,10 +19,11 @@
package org.apache.myfaces.tobago.event;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.internal.component.AbstractUIPopup;
+import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -34,7 +35,7 @@ public class PopupFacetActionListener ex
@Override
protected AbstractUIPopup getPopup(final ActionEvent actionEvent) {
- final UIComponent component = actionEvent.getComponent().getFacet(Facets.POPUP);
+ final UIComponent component = ComponentUtils.getFacet(actionEvent.getComponent(), Facets.popup);
if (component instanceof AbstractUIPopup) {
return (AbstractUIPopup) component;
} else if (component != null) {
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java?rev=1725722&r1=1725721&r2=1725722&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java Wed Jan 20 13:50:18 2016
@@ -42,7 +42,7 @@ public abstract class AbstractUICommand
private Boolean parentOfCommands;
public void onComponentPopulated(final FacesContext facesContext, final UIComponent parent) {
- final AbstractUIPopup popup = (AbstractUIPopup) getFacet(Facets.POPUP);
+ final AbstractUIPopup popup = (AbstractUIPopup) ComponentUtils.getFacet(this, Facets.popup);
if (popup != null) {
if (!ComponentUtils.containsPopupActionListener(this)) {
addActionListener(new PopupFacetActionListener());
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java?rev=1725722&r1=1725721&r2=1725722&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISection.java Wed Jan 20 13:50:18 2016
@@ -39,7 +39,7 @@ public abstract class AbstractUISection
public String getLabelToRender() {
- final UIComponent facet = getFacet(Facets.LABEL);
+ final UIComponent facet = ComponentUtils.getFacet(this, Facets.label);
if (facet instanceof UIOutput) {
return String.valueOf(((UIOutput) facet).getValue());
} else if (facet != null) {
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java?rev=1725722&r1=1725721&r2=1725722&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java Wed Jan 20 13:50:18 2016
@@ -29,6 +29,7 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.event.TabChangeEvent;
import org.apache.myfaces.tobago.event.TabChangeListener;
import org.apache.myfaces.tobago.event.TabChangeSource2;
+import org.apache.myfaces.tobago.util.ComponentUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -121,7 +122,7 @@ public abstract class AbstractUITabGroup
if (getRenderedIndex() == index) {
tab.processDecodes(context);
} else {
- UIComponent facet = tab.getFacet(Facets.TOOL_BAR);
+ UIComponent facet = ComponentUtils.getFacet(tab, Facets.toolBar);
if (facet != null) {
facet.processDecodes(context);
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutUtils.java?rev=1725722&r1=1725721&r2=1725722&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/layout/LayoutUtils.java Wed Jan 20 13:50:18 2016
@@ -21,6 +21,7 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.Visual;
+import org.apache.myfaces.tobago.util.ComponentUtils;
import javax.faces.component.UIComponent;
import java.util.ArrayList;
@@ -90,7 +91,7 @@ public final class LayoutUtils {
base = component;
}
- final UIComponent layoutFacet = base.getFacet(Facets.LAYOUT);
+ final UIComponent layoutFacet = ComponentUtils.getFacet(base, Facets.layout);
if (layoutFacet != null) {
return layoutFacet;
} else {
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=1725722&r1=1725721&r2=1725722&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 Jan 20 13:50:18 2016
@@ -40,7 +40,7 @@ public class ApplyRequestValuesCallback
public void invokeContextCallback(final FacesContext context, final UIComponent component) {
if (FacesContextUtils.isAjax(context)) {
final String ajaxId = FacesContextUtils.getAjaxComponentId(context);
- final UIComponent reload = component.getFacet(Facets.RELOAD);
+ final UIComponent reload = ComponentUtils.getFacet(component, Facets.reload);
if (ajaxId != null && ajaxId.equals(component.getClientId(context)) && reload != null && reload.isRendered()
&& ajaxId.equals(FacesContextUtils.getActionId(context))) {
final boolean immediate = ComponentUtils.getBooleanAttribute(reload, Attributes.immediate);
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=1725722&r1=1725721&r2=1725722&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 Jan 20 13:50:18 2016
@@ -21,6 +21,7 @@ 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.UISheet;
import org.apache.myfaces.tobago.component.Visual;
import org.apache.myfaces.tobago.context.Markup;
@@ -269,9 +270,9 @@ public final class ComponentUtils {
* Searches the component tree beneath the component and return the first component matching the type.
*/
public static <T extends UIComponent> T findFacetDescendant(
- final UIComponent component, final String facet, final Class<T> type) {
+ final UIComponent component, final Facets facet, final Class<T> type) {
- final UIComponent facetComponent = component.getFacet(facet);
+ final UIComponent facetComponent = component.getFacet(facet.name());
if (facetComponent != null) {
if (type.isAssignableFrom(facetComponent.getClass())) {
return (T) facetComponent;
@@ -518,6 +519,14 @@ public final class ComponentUtils {
component.getAttributes().remove(name.getName());
}
+ public static UIComponent getFacet(final UIComponent component, final Facets facet) {
+ return component.getFacet(facet.name());
+ }
+
+ public static void setFacet(final UIComponent component, final Facets facet, final UIComponent child) {
+ component.getFacets().put(facet.name(), child);
+ }
+
public static boolean isFacetOf(final UIComponent component, final UIComponent parent) {
for (final Object o : parent.getFacets().keySet()) {
final UIComponent facet = parent.getFacet((String) o);
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=1725722&r1=1725721&r2=1725722&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 Jan 20 13:50:18 2016
@@ -72,7 +72,7 @@ public final class CreateComponentUtils
final UIMenuSelectOne radio = (UIMenuSelectOne) createComponent(
facesContext, UIMenuSelectOne.COMPONENT_TYPE, RendererTypes.SELECT_ONE_RADIO, clientId);
//noinspection unchecked
- command.getFacets().put(Facets.RADIO, radio);
+ ComponentUtils.setFacet(command, Facets.radio, radio);
final ValueBinding valueBinding = command.getValueBinding(Attributes.value.getName());
if (valueBinding != null) {
radio.setValueBinding(Attributes.value.getName(), valueBinding);
@@ -92,7 +92,7 @@ public final class CreateComponentUtils
final AbstractUISelectBooleanCheckbox checkbox = (AbstractUISelectBooleanCheckbox) createComponent(
facesContext, UISelectBooleanCheckbox.COMPONENT_TYPE, RendererTypes.SELECT_BOOLEAN_CHECKBOX, clientId);
//noinspection unchecked
- command.getFacets().put(Facets.CHECKBOX, checkbox);
+ ComponentUtils.setFacet(command, Facets.checkbox, checkbox);
final ValueBinding valueBinding = command.getValueBinding(Attributes.value.getName());
if (valueBinding != null) {
checkbox.setValueBinding(Attributes.value.getName(), valueBinding);
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=1725722&r1=1725721&r2=1725722&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 Jan 20 13:50:18 2016
@@ -34,7 +34,7 @@ public class EncodeAjaxCallback implemen
public void invokeContextCallback(final FacesContext facesContext, final UIComponent component) {
try {
- final UIComponent reload = component.getFacet(Facets.RELOAD);
+ final UIComponent reload = ComponentUtils.getFacet(component, Facets.reload);
if (reload != null && reload.isRendered()) {
final Boolean immediate = ComponentUtils.getBooleanAttribute(reload, Attributes.immediate);
if (!immediate) {
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacetUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacetUtils.java?rev=1725722&r1=1725721&r2=1725722&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacetUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacetUtils.java Wed Jan 20 13:50:18 2016
@@ -36,21 +36,21 @@ public final class FacetUtils {
* A type save utility to get the facet <code>contextMenu</code> from a component.
*/
public static AbstractUIMenu getContextMenu(final UIComponent component) {
- return (AbstractUIMenu) component.getFacet(Facets.CONTEXT_MENU);
+ return (AbstractUIMenu) ComponentUtils.getFacet(component, Facets.contextMenu);
}
public static void setContextMenu(final UIComponent component, final AbstractUIMenu menu) {
- component.getFacets().put(Facets.CONTEXT_MENU, menu);
+ ComponentUtils.setFacet(component, Facets.contextMenu, menu);
}
/**
* A type save utility to get the facet <code>dropDownMenu</code> from a component.
*/
public static AbstractUIMenu getDropDownMenu(final UIComponent component) {
- return (AbstractUIMenu) component.getFacet(Facets.DROP_DOWN_MENU);
+ return (AbstractUIMenu) ComponentUtils.getFacet(component, Facets.dropDownMenu);
}
public static void setDropDownMenu(final UIComponent component, final AbstractUIMenu menu) {
- component.getFacets().put(Facets.DROP_DOWN_MENU, menu);
+ ComponentUtils.setFacet(component, Facets.dropDownMenu, menu);
}
}
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=1725722&r1=1725721&r2=1725722&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 Jan 20 13:50:18 2016
@@ -118,7 +118,7 @@ public class Command {
}
private static String getConfirmation(final AbstractUICommand command) {
- final ValueHolder facet = (ValueHolder) command.getFacet(Facets.CONFIRMATION);
+ final ValueHolder facet = (ValueHolder) ComponentUtils.getFacet(command, Facets.confirmation);
return facet != null ? "" + facet.getValue() : null;
}
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/BoxRenderer.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/BoxRenderer.java?rev=1725722&r1=1725721&r2=1725722&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/BoxRenderer.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/BoxRenderer.java Wed Jan 20 13:50:18 2016
@@ -48,10 +48,10 @@ public class BoxRenderer extends BoxRend
final UIBox box = (UIBox) component;
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
- final UIComponent label = box.getFacet(Facets.LABEL);
+ final UIComponent label = ComponentUtils.getFacet(box, Facets.label);
final String labelString = box.getLabel();
- final UIPanel toolbar = (UIPanel) box.getFacet(Facets.TOOL_BAR); //XXX todo
+ final UIPanel toolbar = (UIPanel) ComponentUtils.getFacet(box, Facets.toolBar); //XXX todo
writer.startElement(HtmlElements.DIV);
writer.writeClassAttribute(
@@ -84,7 +84,7 @@ public class BoxRenderer extends BoxRend
writer.endElement(HtmlElements.DIV);
}
- final UIMenuBar menuBar = ComponentUtils.findFacetDescendant(box, Facets.MENUBAR, UIMenuBar.class);
+ final UIMenuBar menuBar = ComponentUtils.findFacetDescendant(box, Facets.menuBar, UIMenuBar.class);
if (menuBar != null) {
RenderUtils.encode(facesContext, menuBar);
}
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=1725722&r1=1725721&r2=1725722&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 Jan 20 13:50:18 2016
@@ -73,9 +73,10 @@ public class MenuCommandRenderer extends
final boolean disabled = command.isDisabled();
final boolean firstLevel = RendererTypes.MENU_BAR.equals(command.getParent().getRendererType());
- if (command.getFacet(Facets.CHECKBOX) != null) {
+ if (ComponentUtils.getFacet(command, Facets.checkbox) != null) {
// checkbox menu
- final UISelectBooleanCheckbox checkbox = (UISelectBooleanCheckbox) command.getFacet(Facets.CHECKBOX);
+ final UISelectBooleanCheckbox checkbox
+ = (UISelectBooleanCheckbox) ComponentUtils.getFacet(command, Facets.checkbox);
final boolean checked = ComponentUtils.getBooleanAttribute(checkbox, Attributes.value);
final String image = checked ? "image/MenuCheckmark" : null;
final String hiddenId = checkbox.getClientId(facesContext);
@@ -84,10 +85,10 @@ public class MenuCommandRenderer extends
encodeItem(facesContext, writer,
command, menu, label, map, disabled, firstLevel, image, null, "selectBoolean", command.getClientId());
encodeHidden(writer, hiddenId, checked);
- } else if (command.getFacet(Facets.RADIO) != null) {
+ } else if (ComponentUtils.getFacet(command, Facets.radio) != null) {
// radio menu
final String clientId = command.getClientId(facesContext);
- final UISelectOne radio = (UISelectOne) command.getFacet(Facets.RADIO);
+ final UISelectOne radio = (UISelectOne) ComponentUtils.getFacet(command, Facets.radio);
final String hiddenId = radio.getClientId(facesContext);
for (final SelectItem item : SelectItemUtils.getItemIterator(facesContext, radio)) {
final boolean checked = ObjectUtils.equals(item.getValue(), radio.getValue());
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/PanelRenderer.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/PanelRenderer.java?rev=1725722&r1=1725721&r2=1725722&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/PanelRenderer.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/PanelRenderer.java Wed Jan 20 13:50:18 2016
@@ -30,6 +30,7 @@ import org.apache.myfaces.tobago.renderk
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
+import org.apache.myfaces.tobago.util.ComponentUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
@@ -70,7 +71,7 @@ public class PanelRenderer extends Rende
// TODO check ajax id?
if (!FacesContextUtils.isAjax(facesContext)) {
- final UIComponent facetReload = panel.getFacet(Facets.RELOAD);
+ final UIComponent facetReload = ComponentUtils.getFacet(panel, Facets.reload);
if (facetReload != null && facetReload instanceof UIReload && facetReload.isRendered()) {
final UIReload update = (UIReload) facetReload;
writer.writeAttribute(DataAttributes.RELOAD, Integer.toString(update.getFrequency()), 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/SeparatorRenderer.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/SeparatorRenderer.java?rev=1725722&r1=1725721&r2=1725722&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/SeparatorRenderer.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/SeparatorRenderer.java Wed Jan 20 13:50:18 2016
@@ -28,6 +28,7 @@ import org.apache.myfaces.tobago.renderk
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
import org.apache.myfaces.tobago.renderkit.html.HtmlRoleValues;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
+import org.apache.myfaces.tobago.util.ComponentUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
@@ -65,7 +66,7 @@ public class SeparatorRenderer extends R
private String getLabel(final UISeparator separator) {
String label = separator.getLabel();
- final UIComponent facet = separator.getFacet(Facets.LABEL);
+ final UIComponent facet = ComponentUtils.getFacet(separator, Facets.label);
if (label == null && facet != null) {
label = String.valueOf(((UILabel) facet).getValue());
}
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=1725722&r1=1725721&r2=1725722&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 Jan 20 13:50:18 2016
@@ -150,7 +150,7 @@ public class SheetRenderer extends Rende
HtmlRendererUtils.writeDataAttributes(facesContext, writer, sheet);
writer.writeClassAttribute(Classes.create(sheet), sheet.getCustomClass());
writer.writeStyleAttribute(sheet.getStyle());
- final UIComponent facetReload = sheet.getFacet(Facets.RELOAD);
+ final UIComponent facetReload = ComponentUtils.getFacet(sheet, Facets.reload);
if (facetReload != null && facetReload instanceof UIReload && facetReload.isRendered()) {
final UIReload update = (UIReload) facetReload;
writer.writeAttribute(DataAttributes.RELOAD, update.getFrequency());
@@ -409,7 +409,8 @@ public class SheetRenderer extends Rende
// show row range
final Markup showRowRange = markupForLeftCenterRight(sheet.getShowRowRange());
if (showRowRange != Markup.NULL) {
- final UICommand command = ensurePagingCommand(application, sheet, Facets.PAGER_ROW, PageAction.TO_ROW, false);
+ final UICommand command
+ = ensurePagingCommand(application, sheet, Facets.pagerRow.name(), PageAction.TO_ROW, false);
final String pagerCommandId = command.getClientId(facesContext);
writer.startElement(HtmlElements.UL);
@@ -499,7 +500,8 @@ public class SheetRenderer extends Rende
// show page range
final Markup showPageRange = markupForLeftCenterRight(sheet.getShowPageRange());
if (showPageRange != Markup.NULL) {
- final UICommand command = ensurePagingCommand(application, sheet, Facets.PAGER_PAGE, PageAction.TO_PAGE, false);
+ final UICommand command
+ = ensurePagingCommand(application, sheet, Facets.pagerPage.name(), PageAction.TO_PAGE, false);
final String pagerCommandId = command.getClientId(facesContext);
writer.startElement(HtmlElements.UL);
@@ -814,13 +816,13 @@ public class SheetRenderer extends Rende
if (cell.getColumnSpan() == 1 && cellComponent instanceof UIOut) {
final boolean sortable = ComponentUtils.getBooleanAttribute(column, Attributes.sortable);
if (sortable) {
- UICommand sortCommand = (UICommand) column.getFacet(Facets.SORTER);
+ UICommand sortCommand = (UICommand) ComponentUtils.getFacet(column, Facets.sorter);
if (sortCommand == null) {
final String columnId = column.getClientId(facesContext);
final String sorterId = columnId.substring(columnId.lastIndexOf(":") + 1) + "_" + UISheet.SORTER_ID;
sortCommand = (UICommand) CreateComponentUtils.createComponent(
facesContext, UICommand.COMPONENT_TYPE, RendererTypes.LINK, sorterId);
- column.getFacets().put(Facets.SORTER, sortCommand);
+ ComponentUtils.setFacet(column, Facets.sorter, sortCommand);
}
String[] clientIds = ComponentUtils.evaluateClientIds(facesContext, sheet, sheet.getRenderedPartially());
if (clientIds.length == 0) {
@@ -975,7 +977,7 @@ public class SheetRenderer extends Rende
toolBar.setRendererType("TabGroupToolBar");
toolBar.setTransient(true);
toolBar.getChildren().add(dropDown);
- sheet.getFacets().put(Facets.TOOL_BAR, toolBar);
+ ComponentUtils.setFacet(sheet, Facets.toolBar, toolBar);
return toolBar;
}
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=1725722&r1=1725721&r2=1725722&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 Jan 20 13:50:18 2016
@@ -247,7 +247,7 @@ public class TabGroupRenderer extends Re
}
writer.endElement(HtmlElements.A);
- final UIPanel toolbar = (UIPanel) tab.getFacet(Facets.TOOL_BAR);
+ final UIPanel toolbar = (UIPanel) ComponentUtils.getFacet(tab, Facets.toolBar);
if (toolbar != null) {
renderTabToolbar(facesContext, writer, tab, toolbar);
}
@@ -338,7 +338,7 @@ public class TabGroupRenderer extends Re
toolBar.getChildren().add(previous);
toolBar.getChildren().add(next);
toolBar.getChildren().add(all);
- tabGroup.getFacets().put(Facets.TOOL_BAR, toolBar);
+ ComponentUtils.setFacet(tabGroup, Facets.toolBar, toolBar);
return toolBar;
}
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=1725722&r1=1725721&r2=1725722&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 Jan 20 13:50:18 2016
@@ -116,9 +116,9 @@ public abstract class ToolBarRendererBas
} else if (command instanceof SelectOneCommand) {
renderSelectOne(facesContext, toolBar, command, writer);
} else {
- if (command.getFacet(Facets.RADIO) != null) {
+ if (ComponentUtils.getFacet(command, Facets.radio) != null) {
renderSelectOne(facesContext, toolBar, command, writer);
- } else if (command.getFacet(Facets.CHECKBOX) != null) {
+ } else if (ComponentUtils.getFacet(command, Facets.checkbox) != null) {
renderSelectBoolean(facesContext, toolBar, command, writer);
} else {
final CommandMap map = new CommandMap(new Command(facesContext, command));
@@ -136,7 +136,7 @@ public abstract class ToolBarRendererBas
final List<SelectItem> items;
- UIMenuSelectOne radio = (UIMenuSelectOne) command.getFacet(Facets.RADIO);
+ UIMenuSelectOne radio = (UIMenuSelectOne) ComponentUtils.getFacet(command, Facets.radio);
if (radio == null) {
items = SelectItemUtils.getItemList(facesContext, command);
radio = CreateComponentUtils.createUIMenuSelectOneFacet(facesContext, command);
@@ -205,7 +205,7 @@ public abstract class ToolBarRendererBas
final FacesContext facesContext, final UIToolBar toolBar, final AbstractUICommand command,
final TobagoResponseWriter writer) throws IOException {
- UIComponent checkbox = command.getFacet(Facets.CHECKBOX);
+ UIComponent checkbox = ComponentUtils.getFacet(command, Facets.checkbox);
if (checkbox == null) {
checkbox = CreateComponentUtils.createUISelectBooleanFacetWithId(facesContext, command);
}