/** * This method is called shortly after {@link #getInstance(FacesContext, LayoutComponent, * UIComponent)}. It provides a place for post-creation initialization to take occur. */ public void init() { // Get the FacesContext FacesContext ctx = FacesContext.getCurrentInstance(); // This is the descriptor for this dynamic TreeNode, it contains all // information (options) necessary for this Adaptor LayoutComponent desc = getLayoutComponent(); // The parent UIComponent UIComponent parent = getParentUIComponent(); Theme theme = ThemeUtilities.getTheme(ctx); _childImageFolder = theme.getImage(ThemeImages.TREE_FOLDER).getPath(); _childImageDocument = theme.getImage(ThemeImages.TREE_DOCUMENT).getPath(); // Get the Object Name Object val = desc.getEvaluatedOption(ctx, "objectName", parent); if (val == null) { throw new IllegalArgumentException("'objectName' must be specified!"); } _objectName = (String) val; // The following method should set the "key" to the node containing all // the children... the children will also have keys which must be // retrievable by the next method (getChildTreeNodeObjects)... these // "keys" will be used by the rest of the methods in this file for // getting information about the TreeNode that should be built. setTreeNodeObject(_objectName); }
/** * This method is called shortly after {@link #getInstance(FacesContext, LayoutComponent, * UIComponent)}. It provides a place for post-creation initialization to take occur. */ public void init() { // Get the FacesContext FacesContext ctx = FacesContext.getCurrentInstance(); // This is the descriptor for this dynamic TreeNode, it contains all // information (options) necessary for this Adaptor LayoutComponent desc = getLayoutComponent(); // The parent UIComponent UIComponent parent = getParentUIComponent(); // Get the Object Name Object val = desc.getEvaluatedOption(ctx, "objectName", parent); if (val == null) { throw new IllegalArgumentException("'objectName' must be specified!"); } _objectName = (String) val; // Get the Method Name val = desc.getEvaluatedOption(ctx, "methodName", parent); if (val == null) { throw new IllegalArgumentException("'methodName' must be specified!"); } _methodName = (String) val; // Get Parameters _paramsArray = null; val = desc.getEvaluatedOption(ctx, "parameters", parent); if (val != null) { if (val instanceof List) { _paramsArray = ((List) val).toArray(); } else { _paramsArray = new Object[] {val}; } } // Get Parameter Types _paramTypesArray = null; val = desc.getEvaluatedOption(ctx, "paramTypes", parent); if (val != null) { if (val instanceof String) { _paramTypesArray = new String[] {(String) val}; } else if (val instanceof List) { _paramTypesArray = (String[]) ((List<String>) val).toArray(new String[0]); } else { throw new IllegalArgumentException("'paramTypes' must be a String or a List of types!"); } } // Get the attribute name for the text (optional) _nameAtt = (String) desc.getEvaluatedOption(ctx, "attributeName", parent); if (_nameAtt != null) { _nameAtt = _nameAtt.trim(); if (_nameAtt.length() == 0) { _nameAtt = null; } } // Get the method name for the text (optional) _nameMethod = (String) desc.getEvaluatedOption(ctx, "attrNameMethod", parent); if (_nameMethod != null) { _nameMethod = _nameMethod.trim(); if (_nameMethod.length() == 0) { _nameMethod = null; } } /* FIXME: See "DynamicTreeNode.java -- The code in getChildObjectNames should be FIXME: broken up between this method and the next (getChildTreeNodeObjects). FIXME: This file should only deal w/ the normal MBean use case. WebServices FIXME: should be handled via WebServiceTreeAdaptor (to be written). */ // The following method should set the "key" to the node containing all // the children... the children will also have keys which must be // retrievable by the next method (getChildTreeNodeObjects)... these // "keys" will be used by the rest of the methods in this file for // getting information about the TreeNode that should be built. String ignored = (String) desc.getEvaluatedOption(ctx, "ignored", parent); if (ignored == null || "false".equals(ignored)) { setTreeNodeObject(_objectName); } else { setTreeNodeObject(null); } }