gluu
静的公開メンバ関数 | 非公開メンバ関数 | 静的非公開メンバ関数 | 全メンバ一覧
org.gluu.oxtrust.util.jsf.FacesComponentUtility クラス
org.gluu.oxtrust.util.jsf.FacesComponentUtility 連携図
Collaboration graph

静的公開メンバ関数

static String getMessageFromBundle (final String messageId)
 
static void resetInputComponents (String rootCompId)
 
static void dumpComponentsTree (List< UIComponent > componetns, int level)
 
static void dumpComponentsTree ()
 
static UIComponent findComponentById (String compId)
 

非公開メンバ関数

 FacesComponentUtility ()
 

静的非公開メンバ関数

static ClassLoader getClassLoader ()
 
static void resetInputComponents (UIComponent rootUIComponent)
 
static UIComponent findComponentById (List< UIComponent > components, String compId)
 

詳解

Functions to work with UIComponents

著者
Yuriy Movchan Date: 08.10.2011

構築子と解体子

◆ FacesComponentUtility()

org.gluu.oxtrust.util.jsf.FacesComponentUtility.FacesComponentUtility ( )
inlineprivate
25  {
26  }

関数詳解

◆ dumpComponentsTree() [1/2]

static void org.gluu.oxtrust.util.jsf.FacesComponentUtility.dumpComponentsTree ( List< UIComponent >  componetns,
int  level 
)
inlinestatic
85  {
86  if ((componetns == null) || (componetns.size() == 0)) {
87  return;
88  }
89 
90  StringBuffer levelString = new StringBuffer();
91  for (int i = 0; i < level; i++) {
92  levelString.append(" ");
93  }
94 
95  for (UIComponent comp : componetns) {
96  System.out.println(levelString + comp.getId());
97  if (comp.getChildCount() > 0) {
98  dumpComponentsTree(comp.getChildren(), level++);
99  }
100  }
101  }
static void dumpComponentsTree()
Definition: FacesComponentUtility.java:103

◆ dumpComponentsTree() [2/2]

static void org.gluu.oxtrust.util.jsf.FacesComponentUtility.dumpComponentsTree ( )
inlinestatic
103  {
104  dumpComponentsTree(FacesContext.getCurrentInstance().getViewRoot().getChildren(), 0);
105  }
static void dumpComponentsTree()
Definition: FacesComponentUtility.java:103

◆ findComponentById() [1/2]

static UIComponent org.gluu.oxtrust.util.jsf.FacesComponentUtility.findComponentById ( String  compId)
inlinestatic
107  {
108  return findComponentById(FacesContext.getCurrentInstance().getViewRoot().getChildren(), compId);
109  }
static UIComponent findComponentById(String compId)
Definition: FacesComponentUtility.java:107

◆ findComponentById() [2/2]

static UIComponent org.gluu.oxtrust.util.jsf.FacesComponentUtility.findComponentById ( List< UIComponent >  components,
String  compId 
)
inlinestaticprivate
111  {
112  if ((components == null) || (components.size() == 0)) {
113  return null;
114  }
115 
116  for (UIComponent comp : components) {
117  if (compId.equals(comp.getId())) {
118  return comp;
119  }
120  UIComponent tempResult = findComponentById(comp.getChildren(), compId);
121  if (tempResult != null) {
122  return tempResult;
123  }
124  }
125 
126  return null;
127  }
static UIComponent findComponentById(String compId)
Definition: FacesComponentUtility.java:107

◆ getClassLoader()

static ClassLoader org.gluu.oxtrust.util.jsf.FacesComponentUtility.getClassLoader ( )
inlinestaticprivate
55  {
56  ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
57  if (classLoader == null) {
58  return FacesComponentUtility.class.getClassLoader();
59  }
60  return classLoader;
61  }
FacesComponentUtility()
Definition: FacesComponentUtility.java:25

◆ getMessageFromBundle()

static String org.gluu.oxtrust.util.jsf.FacesComponentUtility.getMessageFromBundle ( final String  messageId)
inlinestatic

Get the field label.

引数
messageIdid of message in the resourcebundle
戻り値
Message from the Message Source.

Look for formId.fieldName, e.g., EmployeeForm.firstName.

35  {
36  FacesContext context = FacesContext.getCurrentInstance();
37  Locale locale = context.getViewRoot().getLocale();
38 
39  String bundleName = context.getApplication().getMessageBundle();
40 
41  ResourceBundle bundle = ResourceBundle.getBundle(bundleName, locale, getClassLoader());
42 
45  String label = null;
46  try {
47  label = bundle.getString(messageId);
48  return label;
49  } catch (MissingResourceException e) {
50  }
51 
52  return label;
53  }
static ClassLoader getClassLoader()
Definition: FacesComponentUtility.java:55

◆ resetInputComponents() [1/2]

static void org.gluu.oxtrust.util.jsf.FacesComponentUtility.resetInputComponents ( String  rootCompId)
inlinestatic
63  {
64  UIComponent rootUIComponent = findComponentById(rootCompId);
65  resetInputComponents(rootUIComponent);
66  }
static UIComponent findComponentById(String compId)
Definition: FacesComponentUtility.java:107
static void resetInputComponents(String rootCompId)
Definition: FacesComponentUtility.java:63

◆ resetInputComponents() [2/2]

static void org.gluu.oxtrust.util.jsf.FacesComponentUtility.resetInputComponents ( UIComponent  rootUIComponent)
inlinestaticprivate
68  {
69  if ((rootUIComponent == null) || (rootUIComponent.getChildCount() == 0)) {
70  return;
71  }
72 
73  for (UIComponent comp : rootUIComponent.getChildren()) {
74  if (comp instanceof UIInput) {
75  UIInput uiInput = (UIInput) comp;
76  uiInput.setSubmittedValue(null);
77  uiInput.setValid(true);
78  uiInput.setLocalValueSet(false);
79  uiInput.resetValue();
80  }
82  }
83  }
static void resetInputComponents(String rootCompId)
Definition: FacesComponentUtility.java:63

このクラス詳解は次のファイルから抽出されました: