Package java.beans

Examples of java.beans.BeanInfo


   * @param classifier the classifier to get the global info for
   * @return the global info (synopsis) for the classifier
   * @throws Exception if there is a problem reflecting on the classifier
   */
  protected static String getGlobalInfo(Classifier classifier) throws Exception {
    BeanInfo bi = Introspector.getBeanInfo(classifier.getClass());
    MethodDescriptor[] methods;
    methods = bi.getMethodDescriptors();
    Object[] args = {};
    String result = "\nSynopsis for " + classifier.getClass().getName()
      + ":\n\n";

    for (int i = 0; i < methods.length; i++) {
View Full Code Here


    scrollablePanel.setLayout(gbLayout);
    setVisible(false);
    m_NumEditable = 0;
    m_Target = targ;
    try {
      BeanInfo bi = Introspector.getBeanInfo(m_Target.getClass());
      m_Properties = bi.getPropertyDescriptors();
      m_Methods = bi.getMethodDescriptors();
    } catch (IntrospectionException ex) {
      System.err.println("PropertySheet: Couldn't introspect");
      return;
    }
View Full Code Here

   * @return the generated BeanConnection
   * @throws Exception if something goes wrong
   */
  protected BeanConnection createBeanConnection(int sourcePos, int targetPos, String event, boolean hidden) throws Exception {
    BeanConnection          result;
    BeanInfo                compInfo;
    EventSetDescriptor[]    esds;
    int                     i;
    BeanInstance            instSource;
    BeanInstance            instTarget;

    result = null;
   
    // was there a connection?
    if ( (sourcePos == -1) || (targetPos == -1) )
      return result;
   
    instSource = (BeanInstance) m_BeanInstances.get(sourcePos);
    instTarget = (BeanInstance) m_BeanInstances.get(targetPos);
   
    compInfo = Introspector.getBeanInfo(((BeanInstance) m_BeanInstances.get(sourcePos)).getBean().getClass());
    esds     = compInfo.getEventSetDescriptors();

    for (i = 0; i < esds.length; i++) {
      if (esds[i].getName().equals(event)) {
        result = new BeanConnection(instSource, instTarget, esds[i], m_vectorIndex);
        ((BeanConnection) result).setHidden(hidden);
View Full Code Here

   */
  public static String getGlobalInfo(Object tempBean) {
    // set tool tip text from global info if supplied
    String gi = null;
    try {
      BeanInfo bi = Introspector.getBeanInfo(tempBean.getClass());
      MethodDescriptor [] methods = bi.getMethodDescriptors();
      for (int i = 0; i < methods.length; i++) {
        String name = methods[i].getDisplayName();
        Method meth = methods[i].getMethod();
        if (name.equals("globalInfo")) {
          if (meth.getReturnType().equals(String.class)) {
View Full Code Here

  {
    try
    {
      this.properties = new HashMap();

      final BeanInfo bi = Introspector.getBeanInfo(className);
      final PropertyDescriptor[] propertyDescriptors
          = bi.getPropertyDescriptors();
      for (int i = 0; i < propertyDescriptors.length; i++)
      {
        final PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
        final Method readMethod = propertyDescriptor.getReadMethod();
        final Method writeMethod = propertyDescriptor.getWriteMethod();
View Full Code Here

        logger.warn("Expression '" + expression.getExpressionType() + " is null");
      }

      try
      {
        final BeanInfo beanInfo = expression.getBeanDescriptor();
        if (beanInfo == null)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Cannot get BeanDescriptor: Null");
        }
      }
      catch (IntrospectionException e)
      {
        logger.warn("Expression '" + expression.getExpressionType() + ": Cannot get BeanDescriptor", e);
      }

      final Locale locale = Locale.getDefault();
      final String displayName = expression.getDisplayName(locale);
      if (isValid(displayName, expression.getName()) == false)
      {
        logger.warn("Expression '" + expression.getExpressionType() + ": No valid display name");
      }
      if (expression.isDeprecated())
      {
        deprecatedExpressionsCounter += 1;
        final String deprecateMessage = expression.getDeprecationMessage(locale);
        if (isValid(deprecateMessage, "Use a Formula instead") == false)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": No valid deprecate message");
        }
      }
      final String grouping = expression.getGrouping(locale);
      if (isValid(grouping, "Group") == false)
      {
        logger.warn("Expression '" + expression.getExpressionType() + ": No valid grouping message");
      }

      expressionsByGroup.add(grouping, expression);

      final ExpressionPropertyMetaData[] properties = expression.getPropertyDescriptions();
      for (int j = 0; j < properties.length; j++)
      {
        final ExpressionPropertyMetaData propertyMetaData = properties[j];
        final String name = propertyMetaData.getName();
        if (StringUtils.isEmpty(name))
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property without a name");
        }
        final String propertyDisplayName = propertyMetaData.getDisplayName(locale);
        if (isValid(propertyDisplayName, name) == false)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": No DisplayName");
        }

        final String propertyGrouping = propertyMetaData.getGrouping(locale);
        if (isValid(propertyGrouping, "Group") == false)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Grouping is not valid");
        }
        final int groupingOrdinal = propertyMetaData.getGroupingOrdinal(locale);
        if (groupingOrdinal == Integer.MAX_VALUE)
        {
          if (propertyMetaData instanceof DefaultExpressionMetaData)
          {
            final DefaultExpressionPropertyMetaData demd = (DefaultExpressionPropertyMetaData) propertyMetaData;
            missingProperties.add(demd.getKeyPrefix() + "grouping.ordinal=1000");
          }
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Grouping ordinal is not valid");
        }
        final int ordinal = propertyMetaData.getItemOrdinal(locale);
        if (groupingOrdinal == Integer.MAX_VALUE)
        {
          if (propertyMetaData instanceof DefaultExpressionMetaData)
          {
            final DefaultExpressionPropertyMetaData demd = (DefaultExpressionPropertyMetaData) propertyMetaData;
            missingProperties.add(demd.getKeyPrefix() + "ordinal=1000");
          }
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Ordinal is not valid");
        }
        final String propertyDescription = propertyMetaData.getDescription(locale);
        if (isValid(propertyDescription, "") == false)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Description is not valid");
        }
        final String propertyDeprecated = propertyMetaData.getDeprecationMessage(locale);
        if (isValid(propertyDeprecated, "") == false)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Deprecation is not valid");
        }

        final String role = propertyMetaData.getPropertyRole();
        if (isValid(role, "Value") == false)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Role is not valid");
        }
        final Class propertyType = propertyMetaData.getPropertyType();
        if (propertyType == null)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Property Type is not valid");
        }

        // should not crash!
        final PropertyDescriptor propertyDescriptor = propertyMetaData.getBeanDescriptor();

        if (propertyMetaData.isDeprecated())
        {
          final String deprecateMessage = propertyMetaData.getDeprecationMessage(locale);
          if (isValid(deprecateMessage, "Deprecated") == false)
          {
            logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": No valid deprecate message");
          }
        }

      }

      try
      {
        final BeanInfo beanInfo = Introspector.getBeanInfo(expression.getExpressionType());
        final PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
        for (int propIdx = 0; propIdx < descriptors.length; propIdx++)
        {
          final PropertyDescriptor descriptor = descriptors[propIdx];
          final String key = descriptor.getName();
View Full Code Here

      expressionAttrList.setAttribute(META_NAMESPACE, "expert", "false");
      expressionAttrList.setAttribute(META_NAMESPACE, "hidden", "false");
      expressionAttrList.setAttribute(META_NAMESPACE, "preferred", "false");
      writer.writeTag(META_NAMESPACE, "expression", expressionAttrList, XmlWriter.OPEN);

      final BeanInfo beanInfo = Introspector.getBeanInfo(aClass);
      final PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
      for (int j = 0; j < descriptors.length; j++)
      {
        final PropertyDescriptor descriptor = descriptors[j];
        final String key = descriptor.getName();
View Full Code Here

    for (int i = 0; i < classes.length; i++)
    {
      final Class aClass = classes[i];

      final BeanInfo beanInfo = Introspector.getBeanInfo(aClass);
      final BeanUtility bu = new BeanUtility(aClass.newInstance());
      final PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
      for (int j = 0; j < descriptors.length; j++)
      {
        final PropertyDescriptor descriptor = descriptors[j];
        final String key = descriptor.getName();
View Full Code Here

            }
        }

        for (int i = 0; i < ji.getCount(); i++) {
            String beanName = ji.getName(i);
            BeanInfo bi = ji.getBeanInfo(i);
            Class bc = ji.getBeanClass(i);
            if (bi == null || bc == null) {
                // We couldn't load the bean.
                continue;
            }
View Full Code Here

     * Utility method to obtain the BeanInfo object associated with a
     * bean class that the BeanBox knows about. Returns a null if none
     * found.
     */
    public BeanInfo getBeanInfoForBean(String beanClassName) {
        BeanInfo beanInfo = (BeanInfo) beanInfoMap.get(beanClassName);
        if (beanInfo == null) {
            beanInfo = BeanPanel.findBeanInfo(beanClassName);
            if (beanInfo != null)
                beanInfoMap.put(beanClassName, beanInfo);
        }
View Full Code Here

TOP

Related Classes of java.beans.BeanInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.