public class CommonBeanInfo extends DefaultBeanInfo
initProperties()
and DefaultBeanInfo.getIcon(int)
. You may also override initEventSets()
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CAT_APPEARANCE |
static java.lang.String |
CAT_BEHAVIOR |
static java.lang.String |
CAT_COMMON |
static java.lang.String |
CAT_DATA |
static java.lang.String |
CAT_DEPRECATED |
static java.lang.String |
CAT_LAYOUT |
static java.lang.String |
CAT_POSITION |
static 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.
|
static 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
|
static 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.
|
static 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.
|
static 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.
|
static java.lang.String |
TAG_DROP_HANDLER_KEY |
static java.lang.String |
TERM_FINDER_CLASS
The class that should be instantiated as a custom translation term finder.
|
beanClass, BOUND_MASK, CATEGORY_KEY, CONSTRAINED_MASK, DISPLAY_ORDER_KEY, EXPERT_MASK, HIDDEN_MASK, log, NO_MASK, NOT_BINDABLE_KEY, NOT_BINDABLE_MASK, NOT_TRANSLATABLE_KEY, NOT_TRANSLATABLE_MASK, PREFERRED_MASK, PREFFERED_MASK, TRANSIENT_KEY, TRANSIENT_MASK
Constructor and Description |
---|
CommonBeanInfo(java.lang.Class c)
Use this constructor for components with no customizers
|
CommonBeanInfo(java.lang.Class c,
java.lang.Class customizer)
Deprecated.
|
CommonBeanInfo(java.lang.Class c,
CustomizerDescriptor... custDesc)
Use this constructor if your component uses customizers.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addCursorCode()
Adds the cursorCode property with correct enum translation, with no special flags
|
protected void |
addCursorCode(int flags) |
protected void |
addDataQuality()
Adds the dataQuality property using BOUND_MASK | EXPERT_MASK
|
protected static void |
addFocusEvents(DefaultBeanInfo info)
Call this in to
initEventSets() add focus events to your component. |
static void |
addInputEventSets(DefaultBeanInfo info)
Adds focus and key events
|
static void |
addJComponentEventSets(DefaultBeanInfo info)
Adds propertyChange, mouse, and mouseMotion events sets.
|
protected static void |
addKeyEvents(DefaultBeanInfo info)
Call this in to
initEventSets() add key events to your component. |
protected void |
addRotation()
Adds the rotation property
|
protected void |
addVisualProps()
Adds rotation and antialias properties
|
protected void |
configureTagDropHandler(DefaultTagDropHandler handler)
Subclasses should override this to add custom mappings to the default tag drop handler.
|
protected TagDropHandler |
createTagDropHandler()
Creates the tag drop handler to be installed for this component.
|
protected void |
initComponentRestrictions(java.util.List<ComponentRestriction> restrictions)
Adds appropriate restrictions based on the bean's attributes.
|
protected void |
initEventSets()
Called to add the event sets that this component will fire and should be handled by user scripting.
|
protected void |
initProperties()
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
|
protected void |
installTagDropHandler()
Called during construction to install a SQLTags drop handler for this component.
|
addBoundProp, addBoundProp, addEnumProp, addEnumProp, addEnumProp, addEnumProp, addEventSet, addEventSet, addEventSet, addEventSet, addMethod, addMethod, addMethod, addProp, addProp, addProp, addProp, addProp, addTransientProp, addTransientProp, addTransientProp, createProp, createProp, createProp, findProperty, getBeanDescriptor, getEventSetDescriptors, getIcon, getIconPath, getIconPrefix, getIconResource, getMethodDescriptors, getPropertyDescriptors, initDesc, initMethods, removeProp, setBackgroundProperty, setBackgroundProperty, setFlags, setFlags, setForegroundProperty, setForegroundProperty, toString
public static final java.lang.String TAG_DROP_HANDLER_KEY
public static final java.lang.String DOUBLE_CLICK_CUSTOMIZER_KEY
public static final java.lang.String DOUBLE_CLICK_HANDLER
public static final java.lang.String EDIT_CLICK_HANDLER
public static final java.lang.String RIGHT_CLICK_HANDLER
public static final java.lang.String SECURITY_RESTRICTIONS
public static final java.lang.String TERM_FINDER_CLASS
public static final java.lang.String CAT_COMMON
public static final java.lang.String CAT_APPEARANCE
public static final java.lang.String CAT_POSITION
public static final java.lang.String CAT_BEHAVIOR
public static final java.lang.String CAT_DATA
public static final java.lang.String CAT_LAYOUT
public static final java.lang.String CAT_DEPRECATED
public CommonBeanInfo(java.lang.Class c)
@Deprecated public CommonBeanInfo(java.lang.Class c, java.lang.Class customizer)
public CommonBeanInfo(java.lang.Class c, CustomizerDescriptor... custDesc)
super(MyComponent.class, new CustomizerDescriptor[] { DynamicPropertyProviderCustomizer.VALUE_DESCRIPTOR, StyleCustomizer.VALUE_DESCRIPTOR });
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.
protected TagDropHandler createTagDropHandler()
DefaultTagDropHandler
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");
protected void initComponentRestrictions(java.util.List<ComponentRestriction> restrictions)
SECURITY_RESTRICTIONS
protected void initProperties() throws java.beans.IntrospectionException
CommonBeanInfo adds common properties, such as:
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.
initProperties
in class DefaultBeanInfo
java.beans.IntrospectionException
addCursorCode()
,
addDataQuality()
,
addVisualProps()
protected void addCursorCode() throws java.beans.IntrospectionException
java.beans.IntrospectionException
protected void addCursorCode(int flags) throws java.beans.IntrospectionException
java.beans.IntrospectionException
protected void addDataQuality() throws java.beans.IntrospectionException
java.beans.IntrospectionException
protected void addRotation() throws java.beans.IntrospectionException, java.lang.SecurityException
java.beans.IntrospectionException
java.lang.SecurityException
protected void addVisualProps() throws java.beans.IntrospectionException, java.lang.SecurityException
java.beans.IntrospectionException
java.lang.SecurityException
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.
initEventSets
in class DefaultBeanInfo
java.beans.IntrospectionException
public static void addJComponentEventSets(DefaultBeanInfo info) throws java.beans.IntrospectionException
initEventSets()
java.beans.IntrospectionException
public static void addInputEventSets(DefaultBeanInfo info) throws java.beans.IntrospectionException
java.beans.IntrospectionException
protected static void addFocusEvents(DefaultBeanInfo info) throws java.beans.IntrospectionException
initEventSets()
add focus events to your component.java.beans.IntrospectionException
protected static void addKeyEvents(DefaultBeanInfo info) throws java.beans.IntrospectionException
initEventSets()
add key events to your component.java.beans.IntrospectionException