Methods | This Package | All Packages

ClassInfo Class

Provides metadata for a component.

package com.ms.wfc.core

public class ClassInfo
implements
IClassInfo

Remarks

ClassInfo provides design-time information about a component class, including the component's properties, events, and attributes. This information is then available to be browsed at run time, such as in the Properties window of the Forms Designer.

To use ClassInfo, a component class provides a public static inner class named ClassInfo, which typically extends the ClassInfo of the component class's superclass. This allows the component to inherit the metadata of the superclass.

Note   Although a ClassInfo is not required to extend the superclass's ClassInfo, it must implement the IClassInfo interface.

The following example shows a portion of the ClassInfo of the Edit control:

public class Edit extends Control 
{
   ...  // Members of class Edit.

   public static class ClassInfo extends Control.ClassInfo
   {
      // Define the properties.
      public static final PropertyInfo autoSize = new PropertyInfo(
         Edit.class, "autoSize", Boolean.TYPE,
         CategoryAttribute.Behavior,
         DefaultValueAttribute.TRUE,
         new DescriptionAttribute("Enables automatic resizing."));

      public static final PropertyInfo backColor = new PropertyInfo(
         com.ms.wfc.ui.Control.ClassInfo.backColor,
         DefaultValueAttribute.COLOR_WINDOW);

      // Define the events.
      public static final EventInfo textChanged = new EventInfo(
         Edit.class,"textChanged", EventHandler.class,
         CategoryAttribute.Behavior,
         new DescriptionAttribute("Occurs when the text property of this control changes."));

      // Specify the default event.
      public String getDefaultEventName() {
         return "textChanged";

      }

      // Add the properties.
      public void getProperties(IProperties props) {
         super.getProperties(props);
         props.add(autoSize);
         props.add(backColor);
      }

      // Add the events.
      public void getEvents(IEvents events) {
         super.getEvents(events);
         events.add(textChanged);
      }
   }
}

See Also   ComponentInfo