View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.myfaces.tobago.component;
21  
22  import org.apache.myfaces.tobago.context.TobagoFacesContext;
23  import org.apache.myfaces.tobago.event.SheetStateChangeEvent;
24  import org.apache.myfaces.tobago.internal.util.Deprecation;
25  import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
26  import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
27  import org.apache.myfaces.tobago.util.ComponentUtils;
28  import org.apache.myfaces.tobago.util.CreateComponentUtils;
29  import org.apache.myfaces.tobago.util.DebugUtils;
30  
31  import javax.faces.application.Application;
32  import javax.faces.component.ActionSource;
33  import javax.faces.component.EditableValueHolder;
34  import javax.faces.component.UICommand;
35  import javax.faces.component.UIComponent;
36  import javax.faces.component.UIGraphic;
37  import javax.faces.component.UIOutput;
38  import javax.faces.component.ValueHolder;
39  import javax.faces.context.FacesContext;
40  import javax.faces.el.MethodBinding;
41  import javax.faces.el.ValueBinding;
42  import javax.faces.event.ActionEvent;
43  import javax.faces.event.ActionListener;
44  import javax.faces.event.ValueChangeEvent;
45  import javax.faces.model.SelectItem;
46  import javax.faces.webapp.UIComponentTag;
47  import javax.servlet.jsp.JspException;
48  import java.util.ArrayList;
49  import java.util.Arrays;
50  import java.util.List;
51  
52  /**
53   * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
54   */
55  @Deprecated
56  public class ComponentUtil {
57  
58    /**
59     * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
60     */
61    @Deprecated
62    public static final Class[] ACTION_ARGS = {};
63    /**
64     * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
65     */
66    @Deprecated
67    public static final Class[] ACTION_LISTENER_ARGS = {ActionEvent.class};
68    /**
69     * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
70     */
71    @Deprecated
72    public static final Class[] VALUE_CHANGE_LISTENER_ARGS = {ValueChangeEvent.class};
73    /**
74     * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
75     */
76    @Deprecated
77    public static final Class[] VALIDATOR_ARGS = {FacesContext.class, UIComponent.class, Object.class};
78  
79    /**
80     * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
81     */
82    @Deprecated
83    private ComponentUtil() {
84    }
85  
86    /**
87     * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
88     */
89    @Deprecated
90    public static boolean hasErrorMessages(final FacesContext context) {
91      return ComponentUtils.hasErrorMessages(context);
92    }
93  
94    /**
95     * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
96     */
97    @Deprecated
98    public static boolean containsPopupActionListener(final javax.faces.component.UICommand command) {
99      return ComponentUtils.containsPopupActionListener(command);
100   }
101 
102   /**
103    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
104    */
105   @Deprecated
106   public static String getFacesMessageAsString(final FacesContext facesContext, final UIComponent component) {
107     return ComponentUtils.getFacesMessageAsString(facesContext, component);
108   }
109 
110   /**
111    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
112    */
113   @Deprecated
114   public static boolean isInPopup(final UIComponent component) {
115     return ComponentUtils.isInPopup(component);
116   }
117 
118   /**
119    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
120    */
121   @Deprecated
122   public static void resetPage(final FacesContext context) {
123     ComponentUtils.resetPage(context);
124   }
125 
126   /**
127    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
128    */
129   @Deprecated
130   public static UIPage findPage(final FacesContext context, final UIComponent component) {
131     return (UIPage) ComponentUtils.findPage(context, component);
132   }
133 
134   /**
135    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
136    */
137   @Deprecated
138   public static UIPage findPage(final UIComponent component) {
139     return (UIPage) ComponentUtils.findPage(component);
140   }
141 
142   /**
143    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
144    */
145   @Deprecated
146   public static void addStyles(final UIComponent component, final String[] styles) {
147     ((TobagoFacesContext) FacesContext.getCurrentInstance()).getStyleFiles().addAll(Arrays.asList(styles));
148   }
149 
150   /**
151    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
152    */
153   @Deprecated
154   public static void addScripts(final UIComponent component, final String[] scripts) {
155     ((TobagoFacesContext) FacesContext.getCurrentInstance()).getScriptFiles().addAll(Arrays.asList(scripts));
156   }
157 
158   /**
159    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
160    */
161   @Deprecated
162   public static void addOnloadCommands(final UIComponent component, final String[] cmds) {
163     ((TobagoFacesContext) FacesContext.getCurrentInstance()).getOnloadScripts().addAll(Arrays.asList(cmds));
164   }
165 
166   /**
167    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
168    */
169   @Deprecated
170   public static UIPage findPage(final FacesContext facesContext) {
171     return (UIPage) ComponentUtils.findPage(facesContext);
172   }
173 
174   /**
175    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
176    */
177   @Deprecated
178   public static UIForm findForm(final UIComponent component) {
179     return (UIForm) ComponentUtils.findForm(component);
180   }
181 
182   /**
183    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
184    */
185   @Deprecated
186   public static List<UIForm> findSubForms(final UIComponent component) {
187     return new ArrayList<UIForm>((List) ComponentUtils.findSubForms(component));
188   }
189 
190   /**
191    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
192    */
193   @Deprecated
194   public static <T extends UIComponent> T findDescendant(final UIComponent component, final Class<T> type) {
195     return ComponentUtils.findDescendant(component, type);
196   }
197 
198   /**
199    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
200    */
201   @Deprecated
202   public static String findClientIdFor(final UIComponent component, final FacesContext facesContext) {
203     return ComponentUtils.findClientIdFor(component, facesContext);
204   }
205 
206   /**
207    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
208    */
209   @Deprecated
210   public static UIComponent findFor(final UIComponent component) {
211     return ComponentUtils.findFor(component);
212   }
213 
214   /**
215    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
216    */
217   @Deprecated
218   public static boolean isInActiveForm(final UIComponent component) {
219     return ComponentUtils.isInActiveForm(component);
220   }
221 
222   /**
223    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
224    */
225   @Deprecated
226   public static boolean isError(final javax.faces.component.UIInput uiInput) {
227     return ComponentUtils.isError(uiInput);
228   }
229 
230   /**
231    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
232    */
233   @Deprecated
234   public static boolean isError(final UIComponent component) {
235     return ComponentUtils.isError(component);
236   }
237 
238   /**
239    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
240    */
241   @Deprecated
242   public static boolean isOutputOnly(final UIComponent component) {
243     return ComponentUtils.isOutputOnly(component);
244   }
245 
246   /**
247    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
248    */
249   @Deprecated
250   public static boolean mayValidate(final UIComponent component) {
251     return ComponentUtils.mayValidate(component);
252   }
253 
254   /**
255    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
256    */
257   @Deprecated
258   public static boolean mayUpdateModel(final UIComponent component) {
259     return ComponentUtils.mayUpdateModel(component);
260   }
261 
262   /**
263    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
264    */
265   @Deprecated
266   public static boolean getBooleanAttribute(final UIComponent component, final String name) {
267     return ComponentUtils.getBooleanAttribute(component, name);
268   }
269 
270   /**
271    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
272    */
273   @Deprecated
274   public static void setRenderedPartially(
275       final org.apache.myfaces.tobago.component.UICommand command, final String renderers) {
276     ((SupportsRenderedPartially) command).setRenderedPartially(new String[]{renderers});
277   }
278 
279   /**
280    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
281    */
282   @Deprecated
283   public static void setStyleClasses(final UIComponent component, final String styleClasses) {
284     ComponentUtils.setStyleClasses(component, styleClasses);
285   }
286 
287   /**
288    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
289    */
290   @Deprecated
291   public static void setMarkup(final UIComponent markupComponent, final String markup) {
292     ComponentUtils.setMarkup(markupComponent, markup);
293   }
294 
295   /**
296    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
297    */
298   @Deprecated
299   public static Object getAttribute(final UIComponent component, final String name) {
300     return ComponentUtils.getAttribute(component, name);
301   }
302 
303   /**
304    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
305    */
306   @Deprecated
307   public static String getStringAttribute(final UIComponent component, final String name) {
308     return ComponentUtils.getStringAttribute(component, name);
309   }
310 
311   /**
312    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
313    */
314   @Deprecated
315   public static int getIntAttribute(final UIComponent component, final String name) {
316     return getIntAttribute(component, name, 0);
317   }
318 
319   /**
320    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
321    */
322   @Deprecated
323   public static int getIntAttribute(final UIComponent component, final String name, final int defaultValue) {
324     return ComponentUtils.getIntAttribute(component, name, defaultValue);
325   }
326 
327   /**
328    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
329    */
330   @Deprecated
331   public static Character getCharacterAttribute(final UIComponent component, final String name) {
332     return ComponentUtils.getCharacterAttribute(component, name);
333   }
334 
335   /**
336    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
337    */
338   @Deprecated
339   public static boolean isFacetOf(final UIComponent component, final UIComponent parent) {
340     return ComponentUtils.isFacetOf(component, parent);
341   }
342 
343   /**
344    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
345    */
346   @Deprecated
347   public static LayoutComponentRendererBase getRenderer(final FacesContext facesContext, final UIComponent component) {
348     return (LayoutComponentRendererBase) ComponentUtils.getRenderer(facesContext, component);
349   }
350 
351   /**
352    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
353    */
354   @Deprecated
355   public static LayoutComponentRendererBase getRenderer(
356       final FacesContext facesContext, final String family, final String rendererType) {
357     return (LayoutComponentRendererBase) ComponentUtils.getRenderer(facesContext, family, rendererType);
358   }
359 
360   /**
361    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
362    */
363   @Deprecated
364   public static String currentValue(final UIComponent component) {
365     return RenderUtils.currentValue(component);
366   }
367 
368   /**
369    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
370    */
371   @Deprecated
372   public static List<SelectItem> getSelectItems(final UIComponent component) {
373     return RenderUtils.getSelectItems(component);
374   }
375 
376   /**
377    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
378    */
379   @Deprecated
380   public static Object findParameter(final UIComponent component, final String name) {
381     return ComponentUtils.findParameter(component, name);
382   }
383 
384   /**
385    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
386    */
387   @Deprecated
388   public static String toString(final UIComponent component, final int offset) {
389     return DebugUtils.toString(component, offset);
390   }
391 
392   /**
393    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
394    */
395   @Deprecated
396   public static ActionListener createActionListener(final String type) throws JspException {
397     return ComponentUtils.createActionListener(type);
398   }
399 
400   /**
401    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
402    */
403   @Deprecated
404   public static UIGraphic getFirstGraphicChild(final UIComponent component) {
405     return ComponentUtils.getFirstGraphicChild(component);
406   }
407 
408   /**
409    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
410    */
411   @Deprecated
412   public static boolean isHoverEnabled(final UIComponent component) {
413     Deprecation.LOG.error("no longer supported");
414     return ComponentUtils.getBooleanAttribute(component, Attributes.HOVER);
415   }
416 
417   /**
418    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
419    */
420   @Deprecated
421   public static UIOutput getFirstNonGraphicChild(final UIComponent component) {
422     return ComponentUtils.getFirstNonGraphicChild(component);
423   }
424 
425   /**
426    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
427    */
428   @Deprecated
429   public static void setIntegerSizeProperty(final UIComponent component, final String name, final String value) {
430     ComponentUtils.setIntegerSizeProperty(component, name, value);
431   }
432 
433   /**
434    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
435    */
436   @Deprecated
437   public static String removePx(final String value) {
438     return ComponentUtils.removePx(value);
439   }
440 
441   /**
442    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
443    */
444   @Deprecated
445   public static void setIntegerProperty(final UIComponent component, final String name, final String value) {
446     if (value != null) {
447       if (UIComponentTag.isValueReference(value)) {
448         component.setValueBinding(name, createValueBinding(value));
449       } else {
450         component.getAttributes().put(name, new Integer(value));
451       }
452     }
453   }
454 
455   /**
456    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
457    */
458   @Deprecated
459   public static void setBooleanProperty(final UIComponent component, final String name, final String value) {
460     if (value != null) {
461       if (UIComponentTag.isValueReference(value)) {
462         component.setValueBinding(name, createValueBinding(value));
463       } else {
464         component.getAttributes().put(name, Boolean.valueOf(value));
465       }
466     }
467   }
468 
469   /**
470    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
471    */
472   @Deprecated
473   public static void setStringProperty(final UIComponent component, final String name, final String value) {
474     if (value != null) {
475       if (UIComponentTag.isValueReference(value)) {
476         component.setValueBinding(name, createValueBinding(value));
477       } else {
478         component.getAttributes().put(name, value);
479       }
480     }
481   }
482 
483   /**
484    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
485    */
486   @Deprecated
487   public static void setValueForValueBinding(final String name, final Object value) {
488     ComponentUtils.setValueForValueBinding(name, value);
489   }
490 
491   /**
492    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
493    */
494   @Deprecated
495   public static ValueBinding createValueBinding(final String value) {
496     return ComponentUtils.createValueBinding(value);
497   }
498 
499   /**
500    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
501    */
502   @Deprecated
503   public static String getValueFromEl(String script) {
504     if (UIComponentTag.isValueReference(script)) {
505       final ValueBinding valueBinding = ComponentUtils.createValueBinding(script);
506       script = (String) valueBinding.getValue(FacesContext.getCurrentInstance());
507     }
508     return script;
509   }
510 
511   /**
512    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
513    */
514   @Deprecated
515   public static UIComponent createComponent(final String componentType, final String rendererType, final String id) {
516     return CreateComponentUtils.createComponent(componentType, rendererType, id);
517   }
518 
519   /**
520    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
521    */
522   @Deprecated
523   public static UIComponent createComponent(
524       final FacesContext facesContext, final String componentType,
525       final String rendererType, final String id) {
526     return CreateComponentUtils.createComponent(facesContext, componentType, rendererType, id);
527   }
528 
529   /**
530    * Please use createComponent(FacesContext facesContext, String componentType, String rendererType, String id)
531    *
532    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
533    */
534   @Deprecated
535   public static UIComponent createComponent(
536       final FacesContext facesContext, final String componentType, final String rendererType) {
537     return createComponent(facesContext, componentType, rendererType, null);
538   }
539 
540   /**
541    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
542    */
543   @Deprecated
544   public static UIColumn createTextColumn(
545       final String label, final String sortable, final String align, final String value, final String id) {
546     return (UIColumn) CreateComponentUtils.createTextColumn(label, sortable, align, value, id);
547   }
548 
549   /**
550    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
551    */
552   @Deprecated
553   public static UIColumn createColumn(
554       final String label, final String sortable, final String align, final UIComponent child) {
555     return (UIColumn) CreateComponentUtils.createColumn(label, sortable, align, child);
556   }
557 
558   /**
559    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
560    */
561   @Deprecated
562   public static UIColumn createColumn(
563       final String label, final String sortable, final String align, final UIComponent child, final String id) {
564     return (UIColumn) CreateComponentUtils.createColumn(label, sortable, align, child, id);
565   }
566 
567   /**
568    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
569    */
570   @Deprecated
571   public static UIMenuSelectOne createUIMenuSelectOneFacet(
572       final FacesContext facesContext, final UICommand command, final String id) {
573     return CreateComponentUtils.createUIMenuSelectOneFacet(facesContext, command, id);
574   }
575 
576   /**
577    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
578    */
579   @Deprecated
580   public static boolean hasSelectedValue(final List<SelectItem> items, final Object value) {
581     return ComponentUtils.hasSelectedValue(items, value);
582   }
583 
584   /**
585    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
586    */
587   @Deprecated
588   public static UIComponent createUISelectBooleanFacet(
589       final FacesContext facesContext, final UICommand command, final String id) {
590     return CreateComponentUtils.createUISelectBooleanFacet(facesContext, command, id);
591   }
592 
593   /**
594    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
595    */
596   @Deprecated
597   public static int getIntValue(final ValueBinding valueBinding) {
598     return ComponentUtils.getIntValue(valueBinding);
599   }
600 
601   /**
602    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
603    */
604   @Deprecated
605   public static String createPickerId(
606       final FacesContext facesContext, final UIComponent component, final String postfix) {
607     return ComponentUtils.createPickerId(facesContext, component, postfix);
608   }
609 
610   /**
611    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
612    */
613   @Deprecated
614   public static String getComponentId(final FacesContext facesContext, final UIComponent component) {
615     return ComponentUtils.getComponentId(facesContext, component);
616   }
617 
618   /**
619    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
620    */
621   @Deprecated
622   public static UIComponent provideLabel(final FacesContext facesContext, final UIComponent component) {
623     return ComponentUtils.provideLabel(facesContext, component);
624   }
625 
626   /**
627    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
628    */
629   @Deprecated
630   public static List<SelectItem> getItemsToRender(final javax.faces.component.UISelectOne component) {
631     return RenderUtils.getItemsToRender(component);
632   }
633 
634   /**
635    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
636    */
637   @Deprecated
638   public static List<SelectItem> getItemsToRender(final javax.faces.component.UISelectMany component) {
639     return RenderUtils.getItemsToRender(component);
640   }
641 
642   /**
643    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
644    */
645   @Deprecated
646   public static void setValidator(final EditableValueHolder editableValueHolder, final String validator) {
647     ComponentUtils.setValidator(editableValueHolder, validator);
648   }
649 
650   /**
651    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
652    */
653   @Deprecated
654   public static void setConverter(final ValueHolder valueHolder, final String converterId) {
655     ComponentUtils.setConverter(valueHolder, converterId);
656   }
657 
658   /**
659    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
660    */
661   @Deprecated
662   public static void setAction(final UICommand component, final String type, final String action) {
663     ComponentUtils.setAction(component, action);
664   }
665 
666   /**
667    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
668    */
669   @Deprecated
670   public static void setSuggestMethodBinding(final UIIn component, final String suggestMethod) {
671     if (suggestMethod != null) {
672       if (UIComponentTag.isValueReference(suggestMethod)) {
673         final MethodBinding methodBinding = FacesContext.getCurrentInstance().getApplication()
674             .createMethodBinding(suggestMethod, new Class[]{String.class});
675         component.setSuggestMethod(methodBinding);
676       } else {
677         throw new IllegalArgumentException(
678             "Must be a valueReference (suggestMethod): " + suggestMethod);
679       }
680     }
681   }
682 
683   /**
684    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
685    */
686   @Deprecated
687   public static void setActionListener(final ActionSource command, final String actionListener) {
688     ComponentUtils.setActionListener(command, actionListener);
689   }
690 
691   /**
692    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
693    */
694   @Deprecated
695   public static void setValueChangeListener(final EditableValueHolder valueHolder, final String valueChangeListener) {
696     ComponentUtils.setValueChangeListener(valueHolder, valueChangeListener);
697   }
698 
699   /**
700    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
701    */
702   @Deprecated
703   public static void setValueBinding(final UIComponent component, final String name, final String state) {
704     ComponentUtils.setValueBinding(component, name, state);
705   }
706 
707   /**
708    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
709    */
710   @Deprecated
711   public static void setStateChangeListener(final UISheet data, final String stateChangeListener) {
712     final FacesContext facesContext = FacesContext.getCurrentInstance();
713     final Application application = facesContext.getApplication();
714 
715     if (stateChangeListener != null) {
716       if (UIComponentTag.isValueReference(stateChangeListener)) {
717         final Class[] arguments = {SheetStateChangeEvent.class};
718         final MethodBinding binding
719             = application.createMethodBinding(stateChangeListener, arguments);
720         data.setStateChangeListener(binding);
721       } else {
722         throw new IllegalArgumentException(
723             "Must be a valueReference (actionListener): " + stateChangeListener);
724       }
725     }
726   }
727 
728   /**
729    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
730    */
731   @Deprecated
732   public static String[] getMarkupBinding(final FacesContext facesContext, final SupportsMarkup component) {
733     return ComponentUtils.getMarkupBinding(facesContext, component);
734   }
735 
736   /**
737    * @deprecated Since Tobago 1.5 please use {@link ComponentUtils}
738    */
739   @Deprecated
740   public static UIComponent findComponent(final UIComponent from, final String relativeId) {
741     return ComponentUtils.findComponent(from, relativeId);
742   }
743 }