Java Code Examples for javax.faces.component.UIComponent#getParent()
The following examples show how to use
javax.faces.component.UIComponent#getParent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InputRichTextRenderer.java From sakai with Educational Community License v2.0 | 6 votes |
protected void registerWithParent(UIComponent component, String configVar, String clientId) { InitObjectContainer parentContainer = null; UIComponent testContainer = component.getParent(); while (testContainer != null) { if (testContainer instanceof InitObjectContainer) { parentContainer = (InitObjectContainer)testContainer; String script = " resetRichTextEditor(\"" + clientId + "_inputRichText\"," + configVar + ");\n"; parentContainer.addInitScript(script); } testContainer = testContainer.getParent(); } }
Example 2
Source File: FindPartialIdRecursiveExpressionResolver.java From BootsFaces-OSP with Apache License 2.0 | 6 votes |
public List<UIComponent> resolve(UIComponent component, List<UIComponent> parentComponents, String currentId, String originalExpression, String[] parameters) { List<UIComponent> result = new ArrayList<UIComponent>(); for (UIComponent parent : parentComponents) { UIComponent searchRoot = parent; while ((!(searchRoot instanceof UIViewRoot)) && (!(searchRoot instanceof NamingContainer))) { searchRoot = searchRoot.getParent(); } List<UIComponent> c = findIdRecursively(searchRoot, parameters[0]); if (null != c) { result.addAll(c); } } if (result.size() > 0) { return result; } throw new FacesException("Invalid search expression - couldn't find id " + currentId + ". Complete search expression: " + originalExpression); }
Example 3
Source File: FormExpressionResolver.java From BootsFaces-OSP with Apache License 2.0 | 6 votes |
public List<UIComponent> resolve(UIComponent component, List<UIComponent> parentComponents, String currentId, String originalExpression, String[] parameters) { List<UIComponent> result = new ArrayList<UIComponent>(); // for (UIComponent parent : parentComponents) { UIComponent c = component; while (c != null && c.getClass() != UIViewRoot.class) { if (UIForm.class.isAssignableFrom(c.getClass())) { result.add(c); break; } c = c.getParent(); } // } if (result.size() > 0) { return result; } throw new FacesException("Invalid search expression - the component isn't inside a form " + originalExpression); }
Example 4
Source File: DropMenuRenderer.java From BootsFaces-OSP with Apache License 2.0 | 6 votes |
private String determineHtmlTag(UIComponent component, boolean isFlyOutMenu) { String htmlTag = "span"; if (isFlyOutMenu) { htmlTag = "li"; } else { UIComponent parent = component.getParent(); while (parent != null && !C.BSFCOMPONENT.equals(parent.getFamily())) { parent = parent.getParent(); } if (parent instanceof DropButton || parent instanceof NavBar || parent instanceof TabLinks || parent instanceof PillLinks || parent instanceof ListLinks || parent instanceof NavBarLinks || parent instanceof DropMenu || parent instanceof FlyOutMenu) { htmlTag = "li"; } } return htmlTag; }
Example 5
Source File: InputRichTextRenderer.java From sakai with Educational Community License v2.0 | 6 votes |
protected void registerWithParent(UIComponent component, String configVar, String clientId) { InitObjectContainer parentContainer = null; UIComponent testContainer = component.getParent(); while (testContainer != null) { if (testContainer instanceof InitObjectContainer) { parentContainer = (InitObjectContainer)testContainer; String script = " resetRichTextEditor(\"" + clientId + "_inputRichText\"," + configVar + ");\n"; parentContainer.addInitScript(script); } testContainer = testContainer.getParent(); } }
Example 6
Source File: ControlBuilder.java From XPagesExtensionLibrary with Apache License 2.0 | 6 votes |
public static UIComponent buildControl(FacesContext context, DynamicComponentFactory factory, UIComponent parent, IControl control, boolean applyTheme) throws FacesException { // We create the component ad we add it to the parent *before* actually constructing it // This is required by some component, like UIIncludeCompiste, which look for the viewroot in // the control hierarchy. UIComponent component = control.getComponent(); if(component.getParent()==null && parent!=null) { TypedUtil.getChildren(parent).add(component); } // Ok, now we build it MainBuilder builder = new MainBuilder(factory, control, component); UIComponent c = build(context, builder); if(c!=null) { if(applyTheme) { ((FacesContextEx)context).getStyleKit().applyStyles(context, c); } } return c; }
Example 7
Source File: InputRichTextRenderer.java From sakai with Educational Community License v2.0 | 6 votes |
protected void registerWithParent(UIComponent component, String configVar, String clientId) { InitObjectContainer parentContainer = null; UIComponent testContainer = component.getParent(); while (testContainer != null) { if (testContainer instanceof InitObjectContainer) { parentContainer = (InitObjectContainer)testContainer; String script = " resetRichTextEditor(\"" + clientId + "_inputRichText\"," + configVar + ");\n"; parentContainer.addInitScript(script); } testContainer = testContainer.getParent(); } }
Example 8
Source File: InputRichTextRenderer.java From sakai with Educational Community License v2.0 | 6 votes |
protected void registerWithParent(UIComponent component, String configVar, String clientId) { InitObjectContainer parentContainer = null; UIComponent testContainer = component.getParent(); while (testContainer != null) { if (testContainer instanceof InitObjectContainer) { parentContainer = (InitObjectContainer)testContainer; String script = " resetRichTextEditor(\"" + clientId + "_inputRichText\"," + configVar + ");\n"; parentContainer.addInitScript(script); } testContainer = testContainer.getParent(); } }
Example 9
Source File: FindIdExpressionResolver.java From BootsFaces-OSP with Apache License 2.0 | 6 votes |
public List<UIComponent> resolve(UIComponent component, List<UIComponent> parentComponents, String currentId, String originalExpression, String[] parameters) { List<UIComponent> result = new ArrayList<UIComponent>(); for (UIComponent parent : parentComponents) { UIComponent searchRoot = parent; while ((!(searchRoot instanceof UIViewRoot)) && (!(searchRoot instanceof NamingContainer))) { searchRoot = searchRoot.getParent(); } UIComponent c = findId(searchRoot, parameters[0]); if (null != c) { result.add(c); } } if (result.size() > 0) { return result; } throw new FacesException("Invalid search expression - couldn't find id " + currentId + ". Complete search expression: " + originalExpression); }
Example 10
Source File: DateTimePicker.java From BootsFaces-OSP with Apache License 2.0 | 5 votes |
/** * Boolean value to specify if the widget is disabled. * <P> * * @return Returns the value of the attribute, or false, if it hasn't been set * by the JSF file. */ public boolean isDisabled() { if (super.isDisabled()) return true; UIComponent ancestor = getParent(); while (ancestor != null) { if (ancestor instanceof IContentDisabled) { if (((IContentDisabled) ancestor).isContentDisabled()) { return true; } } ancestor = ancestor.getParent(); } return false; }
Example 11
Source File: RendererUtil.java From sakai with Educational Community License v2.0 | 5 votes |
/** Return the form ID of the form containing the given component */ public static String getFormId(FacesContext context, UIComponent component) { while (component != null && !(component instanceof UIForm)) { component = component.getParent(); } if (component instanceof UIForm) return ((UIForm) component).getId(); return null; }
Example 12
Source File: DropMenuRenderer.java From BootsFaces-OSP with Apache License 2.0 | 5 votes |
private boolean isDropMenuChild(UIComponent component) { UIComponent parent = component.getParent(); while (parent != null && !C.BSFCOMPONENT.equals(parent.getFamily())) { parent = parent.getParent(); } return parent instanceof DropMenu; }
Example 13
Source File: DynFormFactory.java From yawl with GNU Lesser General Public License v3.0 | 5 votes |
private void setTopStyle(UIComponent component, int top) { String style = getStyle(component); if (style == null) style = ""; setStyle(component, String.format("%stop:%dpx;", style, top)); Object panel = component.getParent(); if (panel instanceof SubPanel) { ((SubPanel) panel).setContentTop(component, top); } else { _outermostTops.put(component, top); } }
Example 14
Source File: R.java From BootsFaces-OSP with Apache License 2.0 | 5 votes |
/** * Finds the Form Id of a component inside a form. * * @param fc * FacesContext instance * @param c * UIComponent instance * @return */ public static String findComponentFormId(FacesContext fc, UIComponent c) { UIComponent parent = c.getParent(); while (parent != null) { if (parent instanceof UIForm) { return parent.getClientId(fc); } parent = parent.getParent(); } return null; }
Example 15
Source File: ExpressionResolverUtilities.java From BootsFaces-OSP with Apache License 2.0 | 5 votes |
public static String determineQualifiedId(UIComponent component) { String qualifiedId = ""; if (component instanceof NamingContainer) return ""; while (component != null && (!(component instanceof UIViewRoot)) && (!(component instanceof NamingContainer))) { component = component.getParent(); if (component instanceof NamingContainer) qualifiedId = component.getId() + ":" + qualifiedId; } return ":" + qualifiedId; }
Example 16
Source File: HelpSetDefaultActionComponent.java From sakai with Educational Community License v2.0 | 5 votes |
/** * get form * @param component * @return ui form */ private UIForm getForm(UIComponent component) { while (component != null) { if (component instanceof UIForm) { break; } component = component.getParent(); } return (UIForm) component; }
Example 17
Source File: BsfUtils.java From BootsFaces-OSP with Apache License 2.0 | 5 votes |
/** * Get the related form * @param component * @return */ public static UIForm getClosestForm(UIComponent component) { while (component != null) { if (component instanceof UIForm) { return (UIForm) component; } component = component.getParent(); } return null; }
Example 18
Source File: MsgUtilXsp.java From org.openntf.domino with Apache License 2.0 | 5 votes |
/** * parses msgPar and returns it in a wrapped object. Format of msgPar * * <pre> * key * key{@literal @}document * bundleName/key * bundleName/key{@literal @}document * </pre> * * The <code>key</code> represents the "key" in the <code>.properties</code> file or in your custom providers.<br/> * The <code>bundleName</code> is the BundleName. If none is specified, PageName is used. If the name is not full qualified (= contains * at least 2 dots), "org.openntf.domino.xsp.i18n" is used as prefix.<br/> * The <code>document</code> is the document that should be used for formula evaluation. If none is specified, currentDocument is used. * * * @param fc * @param uiComponent * @param msgPar * @return */ private static ParseMsgPars inspectMsgPars(final FacesContext fc, final UIComponent uiComponent, final String msgPar) { String[] parts = msgPar.split("@"); if (parts.length > 2) return null; ParseMsgPars ret = new ParseMsgPars(); if (parts.length == 2) ret.iDocName = parts[1]; parts = parts[0].split("/"); if (parts.length > 2) return null; ret.iKey = parts[parts.length - 1]; if (parts.length == 1) { UIViewRoot uvr = fc.getViewRoot(); if (!(uvr instanceof UIViewRootEx)) throw new RuntimeException("getViewRoot isn't a UIViewRootEx! Can't determine XPage-name!"); String pageName = ((UIViewRootEx) uvr).getPageName(); for (int i = pageName.length() - 1; i >= 0; i--) { char c = pageName.charAt(i); if (c == '.') pageName = pageName.substring(0, i); else if (c == '/') { pageName = pageName.substring(i + 1); break; } } ret.iBundleName = pageName; // .toLowerCase(); } else ret.iBundleName = parts[0]; if (!bundleIsFullQual(ret.iBundleName)) ret.iBundleName = lXSPMsgPkg + "." + ret.iBundleName; boolean case$ = (uiComponent.getParent() == null); // ${msg:...} if (case$ && ret.iDocName != null) throw new RuntimeException("Including a document in ${msg:...} isn't allowed"); if (!case$ && ret.iDocName == null) ret.iDocName = "currentDocument"; return ret; }
Example 19
Source File: ChangeDynamicContentAction.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
/** * @param component * @return */ private UIComponent findHighestAncestor(UIComponent ancestor) { UIComponent last = ancestor; while( null != ancestor ){ last = ancestor; ancestor = ancestor.getParent(); } return last; }
Example 20
Source File: DynFormFactory.java From yawl with GNU Lesser General Public License v3.0 | 4 votes |
private int getContainerWidth(UIComponent component) { UIComponent parent = component.getParent(); if ((parent != null) && (parent instanceof SubPanel)) { return ((SubPanel) parent).getWidth(); } else return PANEL_BASE_WIDTH; }