Class CommonBeanInfo

    • Field Detail

      • TAG_DROP_HANDLER_KEY

        public static final java.lang.String TAG_DROP_HANDLER_KEY
        See Also:
        Constant Field Values
      • DOUBLE_CLICK_CUSTOMIZER_KEY

        public static final java.lang.String DOUBLE_CLICK_CUSTOMIZER_KEY
        Use this as a key on your bean descriptor whose value is your customizer's VALUE_NAME to make double-clicking on your bean open up that customizer.
        See Also:
        Constant Field Values
      • DOUBLE_CLICK_HANDLER

        public static final java.lang.String DOUBLE_CLICK_HANDLER
        Use this as a key on your bean descriptor whose value is an instance of DoubleClickHandler, and that double-click handler will be called on double-clicks of instances of this bean
        See Also:
        Constant Field Values
      • EDIT_CLICK_HANDLER

        public static final java.lang.String EDIT_CLICK_HANDLER
        Use this as a key on your bean descriptor whose value is an instance of DoubleClickHandler, and that edit-click will be called when your bean is edit-clicked. An edit-click is a click on an already selected component.
        See Also:
        Constant Field Values
      • RIGHT_CLICK_HANDLER

        public static final java.lang.String RIGHT_CLICK_HANDLER
        Use this key on your bean descriptor if you want to add custom actions to the right-click menu of your component. The value should be an instance of ComponentPopupInitializer.
        See Also:
        Constant Field Values
      • SECURITY_RESTRICTIONS

        public static final java.lang.String SECURITY_RESTRICTIONS
        This key is used on the bean descriptor to hold a List<ComponentRestriction> that are compatible with this bean type. CommonBeanInfo will automatically add the following:
        • A VisibilityRestriction to any bean that exposes its visible property.
        • An EnabledRestriction to any bean that is a --something or other for new enabled stuff--
        • An OverlayRestriction to any bean that is a QualityMonitor.
        See Also:
        Constant Field Values
      • TERM_FINDER_CLASS

        public static final java.lang.String TERM_FINDER_CLASS
        The class that should be instantiated as a custom translation term finder. If not set, a standard component finder will be used.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CommonBeanInfo

        public CommonBeanInfo​(java.lang.Class c)
        Use this constructor for components with no customizers
      • CommonBeanInfo

        @Deprecated
        public CommonBeanInfo​(java.lang.Class c,
                              java.lang.Class customizer)
        Deprecated.
      • CommonBeanInfo

        public CommonBeanInfo​(java.lang.Class c,
                              CustomizerDescriptor... custDesc)
        Use this constructor if your component uses customizers. Common customizers have static descriptors available. For example, your subclass might call this constructor as follows if it has dynamic properties and styles:

         super(MyComponent.class,
           new CustomizerDescriptor[] {
             DynamicPropertyProviderCustomizer.VALUE_DESCRIPTOR,
             StyleCustomizer.VALUE_DESCRIPTOR });
         
    • Method Detail

      • installTagDropHandler

        protected void installTagDropHandler()

        Called during construction to install a SQLTags drop handler for this component. A SQLTags drop handler is stored as a property on the BeanDescriptor with the key "tagDropHandler", and must implement TagDropHandler.

        The default implementation of this function calls createTagDropHandler(). If that function returns a subclass of DefaultTagDropHandler, then it will also call configureTagDropHandler(DefaultTagDropHandler). If you override this function, then both createTagDropHandler() and configureTagDropHandler() will not be used.

        Typically you won't override this function. Most implementations will override configureTagDropHandler(DefaultTagDropHandler) to simply set-up the default tag drop handler for the component.

      • createTagDropHandler

        protected TagDropHandler createTagDropHandler()
        Creates the tag drop handler to be installed for this component. Default implementation creates a DefaultTagDropHandler
      • configureTagDropHandler

        protected void configureTagDropHandler​(DefaultTagDropHandler handler)

        Subclasses should override this to add custom mappings to the default tag drop handler. By default the only mapping installed is to bind the component's toolTipText property to the tag's Tooltip property.

        Example. Suppose your component has an integer property named "myValue " and when a SQLTag was dropped on your component you want to set up a tag binding for "myValue" to the sqltag's value. You'd configure the tag drop handler like this:

         handler.addBinding(TagProp.Value, "myValue");
         

      • initComponentRestrictions

        protected void initComponentRestrictions​(java.util.List<ComponentRestriction> restrictions)
        Adds appropriate restrictions based on the bean's attributes.
        See Also:
        SECURITY_RESTRICTIONS
      • initProperties

        protected void initProperties()
                               throws java.beans.IntrospectionException

        CommonBeanInfo adds common properties, such as:

        • preferredSize (hidden, for serialization)
        • bounds (hidden, for serialization)
        • name
        • componentEnabled if the component is an EnabledEx
        • visible
        • border
        • toolTipText
        • font
        • foreground
        • background
        • opaque

        It is typical to override this function and then call super(). If you want to hide some of these functions, call removeProp with their names. After that you can add your own properties.

        Remember, only properties you add here will be serialized on your component. All properties must have proper getter/setter functions. If you need a property to be serialized but not shown, use the HIDDEN_MASK. If you want to expose a read-only bound property, use HIDDEN_MASK | BOUND_MASK.

        Overrides:
        initProperties in class DefaultBeanInfo
        Throws:
        java.beans.IntrospectionException
        See Also:
        addCursorCode(), addDataQuality(), addVisualProps()
      • addCursorCode

        protected void addCursorCode()
                              throws java.beans.IntrospectionException
        Adds the cursorCode property with correct enum translation, with no special flags
        Throws:
        java.beans.IntrospectionException
      • addCursorCode

        protected void addCursorCode​(int flags)
                              throws java.beans.IntrospectionException
        Throws:
        java.beans.IntrospectionException
      • addDataQuality

        protected void addDataQuality()
                               throws java.beans.IntrospectionException
        Adds the dataQuality property using BOUND_MASK | EXPERT_MASK
        Throws:
        java.beans.IntrospectionException
      • addRotation

        protected void addRotation()
                            throws java.beans.IntrospectionException,
                                   java.lang.SecurityException
        Adds the rotation property
        Throws:
        java.beans.IntrospectionException
        java.lang.SecurityException
      • addVisualProps

        protected void addVisualProps()
                               throws java.beans.IntrospectionException,
                                      java.lang.SecurityException
        Adds rotation property
        Throws:
        java.beans.IntrospectionException
        java.lang.SecurityException
      • initEventSets

        protected void initEventSets()
                              throws java.beans.IntrospectionException

        Called to add the event sets that this component will fire and should be handled by user scripting. By default this implementation adds common JComponent events scuh as propertyChange, mouse, and mouseMotion

        To add a new eventSet, call DefaultBeanInfo.addEventSet(Class, String, Class, String) or one of its overloads.

        Overrides:
        initEventSets in class DefaultBeanInfo
        Throws:
        java.beans.IntrospectionException
      • addJComponentEventSets

        public static void addJComponentEventSets​(DefaultBeanInfo info)
                                           throws java.beans.IntrospectionException
        Adds propertyChange, mouse, and mouseMotion events sets. This is automatically called by the default implementation of initEventSets()
        Throws:
        java.beans.IntrospectionException
      • addInputEventSets

        public static void addInputEventSets​(DefaultBeanInfo info)
                                      throws java.beans.IntrospectionException
        Adds focus and key events
        Throws:
        java.beans.IntrospectionException
      • addFocusEvents

        protected static void addFocusEvents​(DefaultBeanInfo info)
                                      throws java.beans.IntrospectionException
        Call this in to initEventSets() add focus events to your component.
        Throws:
        java.beans.IntrospectionException
      • addKeyEvents

        protected static void addKeyEvents​(DefaultBeanInfo info)
                                    throws java.beans.IntrospectionException
        Call this in to initEventSets() add key events to your component.
        Throws:
        java.beans.IntrospectionException