Example usage for java.beans PropertyDescriptor PropertyDescriptor

List of usage examples for java.beans PropertyDescriptor PropertyDescriptor

Introduction

In this page you can find the example usage for java.beans PropertyDescriptor PropertyDescriptor.

Prototype

public PropertyDescriptor(String propertyName, Class<?> beanClass, String readMethodName,
        String writeMethodName) throws IntrospectionException 

Source Link

Document

This constructor takes the name of a simple property, and method names for reading and writing the property.

Usage

From source file:info.magnolia.cms.taglibs.util.ImgTagBeanInfo.java

/**
 * Instantiate a property descriptor for the given property.
 * @param propertyName property name/*from w ww .  ja  v a2s. c om*/
 * @return property descriptor
 * @throws IntrospectionException if the given property is not valid
 */
private PropertyDescriptor createPropertyDescriptor(String propertyName) throws IntrospectionException {
    return new PropertyDescriptor(propertyName, ImgTag.class, null,
            "set" + StringUtils.capitalize(propertyName));
}

From source file:gov.nih.nci.cbiit.cmts.core.ElementMeta.java

@Override
public PropertiesResult getPropertyDescriptors() throws Exception {
    Class<?> beanClass = this.getClass();
    List<PropertyDescriptor> propList = new ArrayList<PropertyDescriptor>();

    propList.add(new PropertyDescriptor("Choice Element", beanClass, "isIsChoice", null));
    propList.add(new PropertyDescriptor("Chosen", beanClass, "isIsChosen", null));
    propList.add(new PropertyDescriptor("Enabled", beanClass, "isIsEnabled", null));
    propList.add(new PropertyDescriptor("minOccurs", beanClass, "getMinOccurs", null));
    propList.add(new PropertyDescriptor("maxOccurs", beanClass, "getMaxOccurs", null));
    propList.add(new PropertyDescriptor("Multiplicity Index", beanClass, "getMultiplicityIndex", null));
    propList.add(new PropertyDescriptor("Recursive", beanClass, "isIsRecursive", null));
    propList.add(new PropertyDescriptor("Simple Type", beanClass, "isIsSimple", null));

    if (concreteDataType != null)
        propList.add(new PropertyDescriptor("Concrete Data Type", beanClass, "getConcreteDataType", null));
    propList.add(new PropertyDescriptor("Annotation", beanClass, "getAnnotationString", null));
    propList.add(new PropertyDescriptor("Documentation", beanClass, "getDocumentation", null));
    propList.add(new PropertyDescriptor("Application Info", beanClass, "getAppInfo", null));
    PropertiesResult result = super.getPropertyDescriptors();
    result.addPropertyDescriptors(this, propList);
    return result;
}

From source file:facebean.FaceBeanBeanInfo.java

private static PropertyDescriptor[] getPdescriptor() {
    PropertyDescriptor[] properties = new PropertyDescriptor[101];

    try {/*from   ww  w  .j  a  v a 2 s  .c  om*/
        properties[PROPERTY_accessibleContext] = new PropertyDescriptor("accessibleContext",
                facebean.FaceBean.class, "getAccessibleContext", null); // NOI18N
        properties[PROPERTY_accessibleContext].setHidden(true);
        properties[PROPERTY_actionMap] = new PropertyDescriptor("actionMap", facebean.FaceBean.class,
                "getActionMap", "setActionMap"); // NOI18N
        properties[PROPERTY_actionMap].setHidden(true);
        properties[PROPERTY_alignmentX] = new PropertyDescriptor("alignmentX", facebean.FaceBean.class,
                "getAlignmentX", "setAlignmentX"); // NOI18N
        properties[PROPERTY_alignmentX].setHidden(true);
        properties[PROPERTY_alignmentY] = new PropertyDescriptor("alignmentY", facebean.FaceBean.class,
                "getAlignmentY", "setAlignmentY"); // NOI18N
        properties[PROPERTY_alignmentY].setHidden(true);
        properties[PROPERTY_ancestorListeners] = new PropertyDescriptor("ancestorListeners",
                facebean.FaceBean.class, "getAncestorListeners", null); // NOI18N
        properties[PROPERTY_ancestorListeners].setHidden(true);
        properties[PROPERTY_autoscrolls] = new PropertyDescriptor("autoscrolls", facebean.FaceBean.class,
                "getAutoscrolls", "setAutoscrolls"); // NOI18N
        properties[PROPERTY_autoscrolls].setHidden(true);
        properties[PROPERTY_background] = new PropertyDescriptor("background", facebean.FaceBean.class,
                "getBackground", "setBackground"); // NOI18N
        properties[PROPERTY_background].setPreferred(true);
        properties[PROPERTY_backgroundSet] = new PropertyDescriptor("backgroundSet", facebean.FaceBean.class,
                "isBackgroundSet", null); // NOI18N
        properties[PROPERTY_backgroundSet].setHidden(true);
        properties[PROPERTY_baselineResizeBehavior] = new PropertyDescriptor("baselineResizeBehavior",
                facebean.FaceBean.class, "getBaselineResizeBehavior", null); // NOI18N
        properties[PROPERTY_baselineResizeBehavior].setHidden(true);
        properties[PROPERTY_border] = new PropertyDescriptor("border", facebean.FaceBean.class, "getBorder",
                "setBorder"); // NOI18N
        properties[PROPERTY_border].setHidden(true);
        properties[PROPERTY_bounds] = new PropertyDescriptor("bounds", facebean.FaceBean.class, "getBounds",
                "setBounds"); // NOI18N
        properties[PROPERTY_bounds].setHidden(true);
        properties[PROPERTY_colorModel] = new PropertyDescriptor("colorModel", facebean.FaceBean.class,
                "getColorModel", null); // NOI18N
        properties[PROPERTY_colorModel].setHidden(true);
        properties[PROPERTY_component] = new IndexedPropertyDescriptor("component", facebean.FaceBean.class,
                null, null, "getComponent", null); // NOI18N
        properties[PROPERTY_component].setHidden(true);
        properties[PROPERTY_componentCount] = new PropertyDescriptor("componentCount", facebean.FaceBean.class,
                "getComponentCount", null); // NOI18N
        properties[PROPERTY_componentCount].setHidden(true);
        properties[PROPERTY_componentListeners] = new PropertyDescriptor("componentListeners",
                facebean.FaceBean.class, "getComponentListeners", null); // NOI18N
        properties[PROPERTY_componentListeners].setHidden(true);
        properties[PROPERTY_componentOrientation] = new PropertyDescriptor("componentOrientation",
                facebean.FaceBean.class, "getComponentOrientation", "setComponentOrientation"); // NOI18N
        properties[PROPERTY_componentOrientation].setHidden(true);
        properties[PROPERTY_componentPopupMenu] = new PropertyDescriptor("componentPopupMenu",
                facebean.FaceBean.class, "getComponentPopupMenu", "setComponentPopupMenu"); // NOI18N
        properties[PROPERTY_componentPopupMenu].setHidden(true);
        properties[PROPERTY_components] = new PropertyDescriptor("components", facebean.FaceBean.class,
                "getComponents", null); // NOI18N
        properties[PROPERTY_components].setHidden(true);
        properties[PROPERTY_containerListeners] = new PropertyDescriptor("containerListeners",
                facebean.FaceBean.class, "getContainerListeners", null); // NOI18N
        properties[PROPERTY_containerListeners].setHidden(true);
        properties[PROPERTY_cursor] = new PropertyDescriptor("cursor", facebean.FaceBean.class, "getCursor",
                "setCursor"); // NOI18N
        properties[PROPERTY_cursor].setHidden(true);
        properties[PROPERTY_cursorSet] = new PropertyDescriptor("cursorSet", facebean.FaceBean.class,
                "isCursorSet", null); // NOI18N
        properties[PROPERTY_cursorSet].setHidden(true);
        properties[PROPERTY_debugGraphicsOptions] = new PropertyDescriptor("debugGraphicsOptions",
                facebean.FaceBean.class, "getDebugGraphicsOptions", "setDebugGraphicsOptions"); // NOI18N
        properties[PROPERTY_debugGraphicsOptions].setHidden(true);
        properties[PROPERTY_displayable] = new PropertyDescriptor("displayable", facebean.FaceBean.class,
                "isDisplayable", null); // NOI18N
        properties[PROPERTY_displayable].setHidden(true);
        properties[PROPERTY_doubleBuffered] = new PropertyDescriptor("doubleBuffered", facebean.FaceBean.class,
                "isDoubleBuffered", "setDoubleBuffered"); // NOI18N
        properties[PROPERTY_doubleBuffered].setHidden(true);
        properties[PROPERTY_dropTarget] = new PropertyDescriptor("dropTarget", facebean.FaceBean.class,
                "getDropTarget", "setDropTarget"); // NOI18N
        properties[PROPERTY_dropTarget].setHidden(true);
        properties[PROPERTY_enabled] = new PropertyDescriptor("enabled", facebean.FaceBean.class, "isEnabled",
                "setEnabled"); // NOI18N
        properties[PROPERTY_enabled].setHidden(true);
        properties[PROPERTY_focusable] = new PropertyDescriptor("focusable", facebean.FaceBean.class,
                "isFocusable", "setFocusable"); // NOI18N
        properties[PROPERTY_focusable].setHidden(true);
        properties[PROPERTY_focusCycleRoot] = new PropertyDescriptor("focusCycleRoot", facebean.FaceBean.class,
                "isFocusCycleRoot", "setFocusCycleRoot"); // NOI18N
        properties[PROPERTY_focusCycleRoot].setHidden(true);
        properties[PROPERTY_focusCycleRootAncestor] = new PropertyDescriptor("focusCycleRootAncestor",
                facebean.FaceBean.class, "getFocusCycleRootAncestor", null); // NOI18N
        properties[PROPERTY_focusCycleRootAncestor].setHidden(true);
        properties[PROPERTY_focusListeners] = new PropertyDescriptor("focusListeners", facebean.FaceBean.class,
                "getFocusListeners", null); // NOI18N
        properties[PROPERTY_focusListeners].setHidden(true);
        properties[PROPERTY_focusOwner] = new PropertyDescriptor("focusOwner", facebean.FaceBean.class,
                "isFocusOwner", null); // NOI18N
        properties[PROPERTY_focusOwner].setHidden(true);
        properties[PROPERTY_focusTraversable] = new PropertyDescriptor("focusTraversable",
                facebean.FaceBean.class, "isFocusTraversable", null); // NOI18N
        properties[PROPERTY_focusTraversable].setHidden(true);
        properties[PROPERTY_focusTraversalKeys] = new IndexedPropertyDescriptor("focusTraversalKeys",
                facebean.FaceBean.class, null, null, null, "setFocusTraversalKeys"); // NOI18N
        properties[PROPERTY_focusTraversalKeys].setHidden(true);
        properties[PROPERTY_focusTraversalKeysEnabled] = new PropertyDescriptor("focusTraversalKeysEnabled",
                facebean.FaceBean.class, "getFocusTraversalKeysEnabled", "setFocusTraversalKeysEnabled"); // NOI18N
        properties[PROPERTY_focusTraversalKeysEnabled].setHidden(true);
        properties[PROPERTY_focusTraversalPolicy] = new PropertyDescriptor("focusTraversalPolicy",
                facebean.FaceBean.class, "getFocusTraversalPolicy", "setFocusTraversalPolicy"); // NOI18N
        properties[PROPERTY_focusTraversalPolicy].setHidden(true);
        properties[PROPERTY_focusTraversalPolicyProvider] = new PropertyDescriptor(
                "focusTraversalPolicyProvider", facebean.FaceBean.class, "isFocusTraversalPolicyProvider",
                "setFocusTraversalPolicyProvider"); // NOI18N
        properties[PROPERTY_focusTraversalPolicyProvider].setHidden(true);
        properties[PROPERTY_focusTraversalPolicySet] = new PropertyDescriptor("focusTraversalPolicySet",
                facebean.FaceBean.class, "isFocusTraversalPolicySet", null); // NOI18N
        properties[PROPERTY_focusTraversalPolicySet].setHidden(true);
        properties[PROPERTY_font] = new PropertyDescriptor("font", facebean.FaceBean.class, "getFont",
                "setFont"); // NOI18N
        properties[PROPERTY_font].setHidden(true);
        properties[PROPERTY_fontSet] = new PropertyDescriptor("fontSet", facebean.FaceBean.class, "isFontSet",
                null); // NOI18N
        properties[PROPERTY_fontSet].setHidden(true);
        properties[PROPERTY_foreground] = new PropertyDescriptor("foreground", facebean.FaceBean.class,
                "getForeground", "setForeground"); // NOI18N
        properties[PROPERTY_foreground].setPreferred(true);
        properties[PROPERTY_foregroundSet] = new PropertyDescriptor("foregroundSet", facebean.FaceBean.class,
                "isForegroundSet", null); // NOI18N
        properties[PROPERTY_foregroundSet].setHidden(true);
        properties[PROPERTY_graphics] = new PropertyDescriptor("graphics", facebean.FaceBean.class,
                "getGraphics", null); // NOI18N
        properties[PROPERTY_graphics].setHidden(true);
        properties[PROPERTY_graphicsConfiguration] = new PropertyDescriptor("graphicsConfiguration",
                facebean.FaceBean.class, "getGraphicsConfiguration", null); // NOI18N
        properties[PROPERTY_graphicsConfiguration].setHidden(true);
        properties[PROPERTY_height] = new PropertyDescriptor("height", facebean.FaceBean.class, "getHeight",
                null); // NOI18N
        properties[PROPERTY_height].setHidden(true);
        properties[PROPERTY_hierarchyBoundsListeners] = new PropertyDescriptor("hierarchyBoundsListeners",
                facebean.FaceBean.class, "getHierarchyBoundsListeners", null); // NOI18N
        properties[PROPERTY_hierarchyBoundsListeners].setHidden(true);
        properties[PROPERTY_hierarchyListeners] = new PropertyDescriptor("hierarchyListeners",
                facebean.FaceBean.class, "getHierarchyListeners", null); // NOI18N
        properties[PROPERTY_hierarchyListeners].setHidden(true);
        properties[PROPERTY_ignoreRepaint] = new PropertyDescriptor("ignoreRepaint", facebean.FaceBean.class,
                "getIgnoreRepaint", "setIgnoreRepaint"); // NOI18N
        properties[PROPERTY_ignoreRepaint].setHidden(true);
        properties[PROPERTY_inheritsPopupMenu] = new PropertyDescriptor("inheritsPopupMenu",
                facebean.FaceBean.class, "getInheritsPopupMenu", "setInheritsPopupMenu"); // NOI18N
        properties[PROPERTY_inheritsPopupMenu].setHidden(true);
        properties[PROPERTY_inputContext] = new PropertyDescriptor("inputContext", facebean.FaceBean.class,
                "getInputContext", null); // NOI18N
        properties[PROPERTY_inputContext].setHidden(true);
        properties[PROPERTY_inputMap] = new PropertyDescriptor("inputMap", facebean.FaceBean.class,
                "getInputMap", null); // NOI18N
        properties[PROPERTY_inputMap].setHidden(true);
        properties[PROPERTY_inputMethodListeners] = new PropertyDescriptor("inputMethodListeners",
                facebean.FaceBean.class, "getInputMethodListeners", null); // NOI18N
        properties[PROPERTY_inputMethodListeners].setHidden(true);
        properties[PROPERTY_inputMethodRequests] = new PropertyDescriptor("inputMethodRequests",
                facebean.FaceBean.class, "getInputMethodRequests", null); // NOI18N
        properties[PROPERTY_inputMethodRequests].setHidden(true);
        properties[PROPERTY_inputVerifier] = new PropertyDescriptor("inputVerifier", facebean.FaceBean.class,
                "getInputVerifier", "setInputVerifier"); // NOI18N
        properties[PROPERTY_inputVerifier].setHidden(true);
        properties[PROPERTY_insets] = new PropertyDescriptor("insets", facebean.FaceBean.class, "getInsets",
                null); // NOI18N
        properties[PROPERTY_insets].setHidden(true);
        properties[PROPERTY_keyListeners] = new PropertyDescriptor("keyListeners", facebean.FaceBean.class,
                "getKeyListeners", null); // NOI18N
        properties[PROPERTY_keyListeners].setHidden(true);
        properties[PROPERTY_layout] = new PropertyDescriptor("layout", facebean.FaceBean.class, "getLayout",
                "setLayout"); // NOI18N
        properties[PROPERTY_layout].setHidden(true);
        properties[PROPERTY_lightweight] = new PropertyDescriptor("lightweight", facebean.FaceBean.class,
                "isLightweight", null); // NOI18N
        properties[PROPERTY_lightweight].setHidden(true);
        properties[PROPERTY_locale] = new PropertyDescriptor("locale", facebean.FaceBean.class, "getLocale",
                "setLocale"); // NOI18N
        properties[PROPERTY_locale].setHidden(true);
        properties[PROPERTY_location] = new PropertyDescriptor("location", facebean.FaceBean.class,
                "getLocation", "setLocation"); // NOI18N
        properties[PROPERTY_location].setHidden(true);
        properties[PROPERTY_locationOnScreen] = new PropertyDescriptor("locationOnScreen",
                facebean.FaceBean.class, "getLocationOnScreen", null); // NOI18N
        properties[PROPERTY_locationOnScreen].setHidden(true);
        properties[PROPERTY_managingFocus] = new PropertyDescriptor("managingFocus", facebean.FaceBean.class,
                "isManagingFocus", null); // NOI18N
        properties[PROPERTY_managingFocus].setHidden(true);
        properties[PROPERTY_maximumSize] = new PropertyDescriptor("maximumSize", facebean.FaceBean.class,
                "getMaximumSize", "setMaximumSize"); // NOI18N
        properties[PROPERTY_maximumSize].setHidden(true);
        properties[PROPERTY_maximumSizeSet] = new PropertyDescriptor("maximumSizeSet", facebean.FaceBean.class,
                "isMaximumSizeSet", null); // NOI18N
        properties[PROPERTY_maximumSizeSet].setHidden(true);
        properties[PROPERTY_minimumSize] = new PropertyDescriptor("minimumSize", facebean.FaceBean.class,
                "getMinimumSize", "setMinimumSize"); // NOI18N
        properties[PROPERTY_minimumSize].setHidden(true);
        properties[PROPERTY_minimumSizeSet] = new PropertyDescriptor("minimumSizeSet", facebean.FaceBean.class,
                "isMinimumSizeSet", null); // NOI18N
        properties[PROPERTY_minimumSizeSet].setHidden(true);
        properties[PROPERTY_mouseListeners] = new PropertyDescriptor("mouseListeners", facebean.FaceBean.class,
                "getMouseListeners", null); // NOI18N
        properties[PROPERTY_mouseListeners].setHidden(true);
        properties[PROPERTY_mouseMotionListeners] = new PropertyDescriptor("mouseMotionListeners",
                facebean.FaceBean.class, "getMouseMotionListeners", null); // NOI18N
        properties[PROPERTY_mouseMotionListeners].setHidden(true);
        properties[PROPERTY_mousePosition] = new PropertyDescriptor("mousePosition", facebean.FaceBean.class,
                "getMousePosition", null); // NOI18N
        properties[PROPERTY_mousePosition].setHidden(true);
        properties[PROPERTY_mouseWheelListeners] = new PropertyDescriptor("mouseWheelListeners",
                facebean.FaceBean.class, "getMouseWheelListeners", null); // NOI18N
        properties[PROPERTY_mouseWheelListeners].setHidden(true);
        properties[PROPERTY_mouthWidth] = new PropertyDescriptor("mouthWidth", facebean.FaceBean.class,
                "getMouthWidth", "setMouthWidth"); // NOI18N
        properties[PROPERTY_mouthWidth].setPreferred(true);
        properties[PROPERTY_name] = new PropertyDescriptor("name", facebean.FaceBean.class, "getName",
                "setName"); // NOI18N
        properties[PROPERTY_name].setHidden(true);
        properties[PROPERTY_nextFocusableComponent] = new PropertyDescriptor("nextFocusableComponent",
                facebean.FaceBean.class, "getNextFocusableComponent", "setNextFocusableComponent"); // NOI18N
        properties[PROPERTY_nextFocusableComponent].setHidden(true);
        properties[PROPERTY_opaque] = new PropertyDescriptor("opaque", facebean.FaceBean.class, "isOpaque",
                "setOpaque"); // NOI18N
        properties[PROPERTY_opaque].setHidden(true);
        properties[PROPERTY_optimizedDrawingEnabled] = new PropertyDescriptor("optimizedDrawingEnabled",
                facebean.FaceBean.class, "isOptimizedDrawingEnabled", null); // NOI18N
        properties[PROPERTY_optimizedDrawingEnabled].setHidden(true);
        properties[PROPERTY_paintingForPrint] = new PropertyDescriptor("paintingForPrint",
                facebean.FaceBean.class, "isPaintingForPrint", null); // NOI18N
        properties[PROPERTY_paintingForPrint].setHidden(true);
        properties[PROPERTY_paintingTile] = new PropertyDescriptor("paintingTile", facebean.FaceBean.class,
                "isPaintingTile", null); // NOI18N
        properties[PROPERTY_paintingTile].setHidden(true);
        properties[PROPERTY_parent] = new PropertyDescriptor("parent", facebean.FaceBean.class, "getParent",
                null); // NOI18N
        properties[PROPERTY_parent].setHidden(true);
        properties[PROPERTY_peer] = new PropertyDescriptor("peer", facebean.FaceBean.class, "getPeer", null); // NOI18N
        properties[PROPERTY_peer].setHidden(true);
        properties[PROPERTY_preferredSize] = new PropertyDescriptor("preferredSize", facebean.FaceBean.class,
                "getPreferredSize", "setPreferredSize"); // NOI18N
        properties[PROPERTY_preferredSize].setHidden(true);
        properties[PROPERTY_preferredSizeSet] = new PropertyDescriptor("preferredSizeSet",
                facebean.FaceBean.class, "isPreferredSizeSet", null); // NOI18N
        properties[PROPERTY_preferredSizeSet].setHidden(true);
        properties[PROPERTY_propertyChangeListeners] = new PropertyDescriptor("propertyChangeListeners",
                facebean.FaceBean.class, "getPropertyChangeListeners", null); // NOI18N
        properties[PROPERTY_propertyChangeListeners].setHidden(true);
        properties[PROPERTY_registeredKeyStrokes] = new PropertyDescriptor("registeredKeyStrokes",
                facebean.FaceBean.class, "getRegisteredKeyStrokes", null); // NOI18N
        properties[PROPERTY_registeredKeyStrokes].setHidden(true);
        properties[PROPERTY_requestFocusEnabled] = new PropertyDescriptor("requestFocusEnabled",
                facebean.FaceBean.class, "isRequestFocusEnabled", "setRequestFocusEnabled"); // NOI18N
        properties[PROPERTY_requestFocusEnabled].setHidden(true);
        properties[PROPERTY_rootPane] = new PropertyDescriptor("rootPane", facebean.FaceBean.class,
                "getRootPane", null); // NOI18N
        properties[PROPERTY_rootPane].setHidden(true);
        properties[PROPERTY_showing] = new PropertyDescriptor("showing", facebean.FaceBean.class, "isShowing",
                null); // NOI18N
        properties[PROPERTY_showing].setHidden(true);
        properties[PROPERTY_size] = new PropertyDescriptor("size", facebean.FaceBean.class, "getSize",
                "setSize"); // NOI18N
        properties[PROPERTY_size].setHidden(true);
        properties[PROPERTY_toolkit] = new PropertyDescriptor("toolkit", facebean.FaceBean.class, "getToolkit",
                null); // NOI18N
        properties[PROPERTY_toolkit].setHidden(true);
        properties[PROPERTY_toolTipText] = new PropertyDescriptor("toolTipText", facebean.FaceBean.class,
                "getToolTipText", "setToolTipText"); // NOI18N
        properties[PROPERTY_toolTipText].setHidden(true);
        properties[PROPERTY_topLevelAncestor] = new PropertyDescriptor("topLevelAncestor",
                facebean.FaceBean.class, "getTopLevelAncestor", null); // NOI18N
        properties[PROPERTY_topLevelAncestor].setHidden(true);
        properties[PROPERTY_transferHandler] = new PropertyDescriptor("transferHandler",
                facebean.FaceBean.class, "getTransferHandler", "setTransferHandler"); // NOI18N
        properties[PROPERTY_transferHandler].setHidden(true);
        properties[PROPERTY_treeLock] = new PropertyDescriptor("treeLock", facebean.FaceBean.class,
                "getTreeLock", null); // NOI18N
        properties[PROPERTY_treeLock].setHidden(true);
        properties[PROPERTY_UIClassID] = new PropertyDescriptor("UIClassID", facebean.FaceBean.class,
                "getUIClassID", null); // NOI18N
        properties[PROPERTY_UIClassID].setHidden(true);
        properties[PROPERTY_valid] = new PropertyDescriptor("valid", facebean.FaceBean.class, "isValid", null); // NOI18N
        properties[PROPERTY_valid].setHidden(true);
        properties[PROPERTY_validateRoot] = new PropertyDescriptor("validateRoot", facebean.FaceBean.class,
                "isValidateRoot", null); // NOI18N
        properties[PROPERTY_validateRoot].setHidden(true);
        properties[PROPERTY_verifyInputWhenFocusTarget] = new PropertyDescriptor("verifyInputWhenFocusTarget",
                facebean.FaceBean.class, "getVerifyInputWhenFocusTarget", "setVerifyInputWhenFocusTarget"); // NOI18N
        properties[PROPERTY_verifyInputWhenFocusTarget].setHidden(true);
        properties[PROPERTY_vetoableChangeListeners] = new PropertyDescriptor("vetoableChangeListeners",
                facebean.FaceBean.class, "getVetoableChangeListeners", null); // NOI18N
        properties[PROPERTY_vetoableChangeListeners].setHidden(true);
        properties[PROPERTY_visible] = new PropertyDescriptor("visible", facebean.FaceBean.class, "isVisible",
                "setVisible"); // NOI18N
        properties[PROPERTY_visible].setHidden(true);
        properties[PROPERTY_visibleRect] = new PropertyDescriptor("visibleRect", facebean.FaceBean.class,
                "getVisibleRect", null); // NOI18N
        properties[PROPERTY_visibleRect].setHidden(true);
        properties[PROPERTY_width] = new PropertyDescriptor("width", facebean.FaceBean.class, "getWidth", null); // NOI18N
        properties[PROPERTY_width].setHidden(true);
        properties[PROPERTY_x] = new PropertyDescriptor("x", facebean.FaceBean.class, "getX", null); // NOI18N
        properties[PROPERTY_x].setHidden(true);
        properties[PROPERTY_y] = new PropertyDescriptor("y", facebean.FaceBean.class, "getY", null); // NOI18N
        properties[PROPERTY_y].setHidden(true);
    } catch (IntrospectionException e) {
        e.printStackTrace();
    } //GEN-HEADEREND:Properties

    // Here you can add code for customizing the properties array.

    return properties;
}

From source file:de.xwic.appkit.webbase.table.DefaultColumnLabelProvider.java

/**
 * @throws IntrospectionException /*from   w  w w .  j  a va  2 s.  c o  m*/
 * 
 */
private void buildReadPath(Object element) throws IntrospectionException {
    StringTokenizer stk = new StringTokenizer(column.getPropertyId(), ".");
    readMethods = new Method[stk.countTokens()];

    int idx = 0;
    Class<?> clazz = element.getClass();
    while (stk.hasMoreTokens()) {
        String propertyName = stk.nextToken();

        PropertyDescriptor desc = new PropertyDescriptor(propertyName, clazz, makeGetterName(propertyName),
                null);
        clazz = desc.getPropertyType();
        readMethods[idx++] = desc.getReadMethod();
    }
    propertyEditor = PropertyEditorManager.findEditor(clazz);
    baseClass = element.getClass();
}

From source file:it.cnr.icar.eric.server.security.authorization.RegistryAttributeFinderModule.java

/**
 * Handles attributes as defined ebRIM for Any RegistryObject.
 * Used by subject, resource and action attributes handling methods.
 *//*from   w  w  w.j  a  va  2 s . c  om*/
EvaluationResult handleRegistryObjectAttribute(Object obj, Stack<?> attributeStack, URI type,
        EvaluationCtx context) {
    EvaluationResult evaluationResult = null;
    try {
        String attr = (String) attributeStack.pop();
        ServerRequestContext requestContext = AuthorizationServiceImpl.getRequestContext(context);
        log.trace("handleRegistryObjectAttribute: obj=" + obj.toString() + " attrubute = " + attr);

        if (requestContext != null && obj != null) {
            @SuppressWarnings("unused")
            RegistryRequestType registryRequest = requestContext.getCurrentRegistryRequest();

            //Now invoke a get method to get the value for attribute being sought
            Class<? extends Object> clazz = obj.getClass();
            @SuppressWarnings("unused")
            String clazzName = clazz.getName();
            PropertyDescriptor propDesc = new PropertyDescriptor(attr, clazz, getReadMethodName(attr), null);
            Method method = propDesc.getReadMethod();
            Object attrValObj = method.invoke(obj, (java.lang.Object[]) null);

            if (attrValObj instanceof Collection) {
                HashSet<AttributeValue> attrValueObjectIds = new HashSet<AttributeValue>();
                Iterator<?> iter = ((Collection<?>) attrValObj).iterator();
                while (iter.hasNext()) {
                    //??Dangerous assumption that Collection is a Collection of IdentifiableTypes
                    String attrValueObjectId = ((IdentifiableType) iter.next()).getId();
                    attrValueObjectIds.add(makeAttribute(attrValueObjectId, type));
                }
                evaluationResult = makeBag(attrValueObjectIds, type);
            } else {
                //See if more pointer chasing needs to be done or (!attributeStack.empty()) 
                if (!attributeStack.empty()) {
                    String id = (String) attrValObj;
                    RegistryObjectType ro = AuthorizationServiceImpl.getInstance()
                            .getRegistryObject(requestContext, id, false);
                    if (ro == null) {
                        throw new ObjectNotFoundException(id, "RegistryObject");
                    }
                    evaluationResult = handleRegistryObjectAttribute(ro, attributeStack, type, context);
                } else {
                    AttributeValue attrVal = makeAttribute(attrValObj, type);
                    evaluationResult = makeBag(attrVal, type);
                }
            }
        }
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (IntrospectionException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (ParseException e) {
        e.printStackTrace();
    } catch (ParsingException e) {
        e.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    } catch (RegistryException e) {
        e.printStackTrace();
    }

    return evaluationResult;
}

From source file:org.etudes.ambrosia.impl.UiPropertyReference.java

/**
 * Read the configured selector value from the entity.
 * /*w  w w  . j  a v a2  s  .  c  om*/
 * @param context
 *        The context.
 * @param entity
 *        The entity to read from.
 * @param selector
 *        The selector name.
 * @return The selector value object found, or null if not.
 */
protected Object getValue(Context context, Object entity, String property) {
    // if no selector named, just use the entity
    if (property == null)
        return entity;

    // if the property is an index reference
    if (property.startsWith("[") && property.endsWith("]")) {
        return getIndexValue(entity, decode(property.substring(1, property.length() - 1)));
    }

    // another form of index, taking the index value from the nested references
    if (property.startsWith("{") && property.endsWith("}")) {
        try {
            String propertiesIndex = property.substring(1, property.length() - 1);
            int i = Integer.parseInt(propertiesIndex);
            PropertyReference ref = this.properties.get(i);
            String index = ref.read(context, entity);

            return getIndexValue(entity, index);
        } catch (NumberFormatException e) {
        } catch (IndexOutOfBoundsException e) {
        }
    }

    // form a "getFoo()" based getter method name
    StringBuffer getter = new StringBuffer("get" + property);
    getter.setCharAt(3, getter.substring(3, 4).toUpperCase().charAt(0));

    try {
        // use this form, providing the getter name and no setter, so we can support properties that are read-only
        PropertyDescriptor pd = new PropertyDescriptor(property, entity.getClass(), getter.toString(), null);
        Method read = pd.getReadMethod();
        Object value = read.invoke(entity, (Object[]) null);
        return value;
    } catch (IntrospectionException ie) {
        M_log.warn("getValue: method: " + property + " object: " + entity.getClass(), ie);
        return null;
    } catch (IllegalAccessException ie) {
        M_log.warn("getValue: method: " + property + " object: " + entity.getClass(), ie);
        return null;
    } catch (IllegalArgumentException ie) {
        M_log.warn("getValue: method: " + property + " object: " + entity.getClass(), ie);
        return null;
    } catch (InvocationTargetException ie) {
        M_log.warn("getValue: method: " + property + " object: " + entity.getClass(), ie);
        return null;
    }
}

From source file:org.etudes.ambrosia.impl.UiPropertyReference.java

/**
 * Write the value for FileItem (commons file upload) values.
 * /*from   ww w  .j av  a  2s  .c  om*/
 * @param entity
 *        The entity to write to.
 * @param property
 *        The property to set.
 * @param value
 *        The value to write.
 */
protected void setFileValue(Object entity, String property, FileItem value) {
    // form a "setFoo()" based setter method name
    StringBuffer setter = new StringBuffer("set" + property);
    setter.setCharAt(3, setter.substring(3, 4).toUpperCase().charAt(0));

    try {
        // use this form, providing the setter name and no getter, so we can support properties that are write-only
        PropertyDescriptor pd = new PropertyDescriptor(property, entity.getClass(), null, setter.toString());
        Method write = pd.getWriteMethod();
        Object[] params = new Object[1];

        Class[] paramTypes = write.getParameterTypes();
        if ((paramTypes != null) && (paramTypes.length == 1)) {
            // single value boolean
            if (paramTypes[0] != FileItem.class) {
                M_log.warn(
                        "setFileValue: target not expecting FileItem: " + entity.getClass() + " " + property);
                return;
            }

            params[0] = value;
            write.invoke(entity, params);
        } else {
            M_log.warn("setFileValue: method: " + property + " object: " + entity.getClass()
                    + " : no one parameter setter method defined");
        }
    } catch (IntrospectionException ie) {
        M_log.warn("setFileValue: method: " + property + " object: " + entity.getClass() + " : " + ie);
    } catch (IllegalAccessException ie) {
        M_log.warn("setFileValue: method: " + property + " object: " + entity.getClass() + " :" + ie);
    } catch (IllegalArgumentException ie) {
        M_log.warn("setFileValue: method: " + property + " object: " + entity.getClass() + " :" + ie);
    } catch (InvocationTargetException ie) {
        M_log.warn("setFileValue: method: " + property + " object: " + entity.getClass() + " :" + ie);
    }
}

From source file:org.etudes.ambrosia.impl.UiPropertyReference.java

/**
 * Write the value./*from   ww w.j a  v  a  2 s .  com*/
 * 
 * @param entity
 *        The entity to write to.
 * @param property
 *        The property to set.
 * @param value
 *        The value to write.
 */
protected void setValue(Object entity, String property, String[] valueSource) {
    // form a "setFoo()" based setter method name
    StringBuffer setter = new StringBuffer("set" + property);
    setter.setCharAt(3, setter.substring(3, 4).toUpperCase().charAt(0));

    // unformat the values - in any are invalid, give up
    String[] value = null;
    try {
        if (valueSource != null) {
            value = new String[valueSource.length];
            for (int i = 0; i < valueSource.length; i++) {
                value[i] = StringUtil.trimToNull(unFormat(valueSource[i]));
            }
        }
    } catch (IllegalArgumentException e) {
        return;
    }

    try {
        // use this form, providing the setter name and no getter, so we can support properties that are write-only
        PropertyDescriptor pd = new PropertyDescriptor(property, entity.getClass(), null, setter.toString());
        Method write = pd.getWriteMethod();
        Object[] params = new Object[1];
        params[0] = null;

        Class[] paramTypes = write.getParameterTypes();
        if ((paramTypes != null) && (paramTypes.length == 1)) {
            // single value boolean
            if (paramTypes[0] == Boolean.class) {
                params[0] = ((value != null) && (value[0] != null))
                        ? Boolean.valueOf(StringUtil.trimToZero(value[0]))
                        : null;
            }

            // multiple value boolean
            else if (paramTypes[0] == Boolean[].class) {
                if (value != null) {
                    Boolean[] values = new Boolean[value.length];
                    for (int i = 0; i < value.length; i++) {
                        values[i] = Boolean.valueOf(StringUtil.trimToZero(value[i]));
                    }
                    params[0] = values;
                }
            }

            // single value long
            else if (paramTypes[0] == Long.class) {
                params[0] = ((value != null) && (value[0] != null))
                        ? Long.valueOf(StringUtil.trimToZero(value[0]))
                        : null;
            }

            // multiple value long
            else if (paramTypes[0] == Long[].class) {
                if (value != null) {
                    Long[] values = new Long[value.length];
                    for (int i = 0; i < value.length; i++) {
                        values[i] = Long.valueOf(StringUtil.trimToZero(value[i]));
                    }
                    params[0] = values;
                }
            }

            // single value int
            else if (paramTypes[0] == Integer.class) {
                params[0] = ((value != null) && (value[0] != null))
                        ? Integer.valueOf(StringUtil.trimToZero(value[0]))
                        : null;
            }

            // multiple value int
            else if (paramTypes[0] == Integer[].class) {
                if (value != null) {
                    Integer[] values = new Integer[value.length];
                    for (int i = 0; i < value.length; i++) {
                        values[i] = Integer.valueOf(StringUtil.trimToZero(value[i]));
                    }
                    params[0] = values;
                }
            }

            // single value Date
            else if (paramTypes[0] == Date.class) {
                // assume a long ms format
                params[0] = ((value != null) && (value[0] != null)) ? new Date(Long.parseLong(value[0])) : null;
            }

            // multiple value Date
            else if (paramTypes[0] == Date[].class) {
                if (value != null) {
                    Date[] values = new Date[value.length];
                    for (int i = 0; i < value.length; i++) {
                        // assume a long ms format
                        values[i] = new Date(Long.parseLong(value[i]));
                    }
                    params[0] = values;
                }
            }

            // single value string
            else if (paramTypes[0] == String.class) {
                params[0] = ((value != null) && (value[0] != null)) ? StringUtil.trimToNull(value[0]) : null;
            }

            // multiple value string
            else if (paramTypes[0] == String[].class) {
                // trim it
                if (value != null) {
                    for (int i = 0; i < value.length; i++) {
                        value[i] = StringUtil.trimToNull(value[i]);
                    }
                }

                params[0] = value;
            }

            // single value enum
            else if (paramTypes[0].isEnum()) {
                if ((value == null) || (value[0] == null)) {
                    params[0] = null;
                } else {
                    Object[] constants = paramTypes[0].getEnumConstants();
                    if (constants != null) {
                        // see if value matches any of these
                        for (Object o : constants) {
                            if (o.toString().equals(value[0])) {
                                params[0] = o;
                                break;
                            }
                        }
                    }
                }
            }

            // single value float
            else if (paramTypes[0] == Float.class) {
                params[0] = ((value != null) && (value[0] != null))
                        ? Float.valueOf(StringUtil.trimToZero(value[0]))
                        : null;
            }

            // multiple value float
            else if (paramTypes[0] == Float[].class) {
                if (value != null) {
                    Float[] values = new Float[value.length];
                    for (int i = 0; i < value.length; i++) {
                        values[i] = Float.valueOf(StringUtil.trimToZero(value[i]));
                    }
                    params[0] = values;
                }
            }

            // multiple value string in list
            else if (paramTypes[0] == List.class) {
                if (value != null) {
                    // trim it into a List
                    List valueList = new ArrayList(value.length);
                    if (value != null) {
                        for (int i = 0; i < value.length; i++) {
                            String v = StringUtil.trimToNull(value[i]);
                            if (v != null) {
                                valueList.add(v);
                            }
                        }
                    }

                    params[0] = valueList;
                }
            }

            // multiple value string in set
            else if (paramTypes[0] == Set.class) {
                if (value != null) {
                    // trim it into a List
                    Set valueSet = new HashSet(value.length);
                    for (int i = 0; i < value.length; i++) {
                        String v = StringUtil.trimToNull(value[i]);
                        if (v != null) {
                            valueSet.add(v);
                        }
                    }

                    params[0] = valueSet;
                }
            }

            // TODO: other types
            else {
                M_log.warn("setValue: unhandled setter parameter type - not set: " + paramTypes[0]);
                return;
            }

            write.invoke(entity, params);
        } else {
            M_log.warn("setValue: method: " + property + " object: " + entity.getClass()
                    + " : no one parameter setter method defined");
        }
    } catch (NumberFormatException ie) {
    } catch (IntrospectionException ie) {
        M_log.warn("setValue: method: " + property + " object: " + entity.getClass(), ie);
    } catch (IllegalAccessException ie) {
        M_log.warn("setValue: method: " + property + " object: " + entity.getClass(), ie);
    } catch (IllegalArgumentException ie) {
        M_log.warn("setValue: method: " + property + " object: " + entity.getClass(), ie);
    } catch (InvocationTargetException ie) {
        M_log.warn("setValue: method: " + property + " object: " + entity.getClass(), ie);
    }
}