Class Install4JBeanInfo
- All Implemented Interfaces:
BeanInfo
- Direct Known Subclasses:
ActionBeanInfo
,FormComponentBeanInfo
,ScreenBeanInfo
Using this class is not strictly required. In principle, you could also set values for the ATTRIBUTE_*
constants in the bean descriptor
of an unrelated bean info class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from interface java.beans.BeanInfo
ICON_COLOR_16x16, ICON_COLOR_32x32, ICON_MONO_16x16, ICON_MONO_32x32
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Install4JBeanInfo
(String displayName, String shortDescription, String category, boolean multipleInstancesSupported, boolean installedFilesRequired, Integer sortKey, Class<? extends Bean> beanClass) Same asInstall4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class)
with a customizer class ofnull
.protected
Install4JBeanInfo
(String displayName, String shortDescription, String category, boolean multipleInstancesSupported, boolean installedFilesRequired, Integer sortKey, Class<? extends Bean> beanClass, Class<?> customizerClass) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertyDescriptor
(Install4JPropertyDescriptor propertyDescriptor) Add a property descriptor to be returned bygetPropertyDescriptors
.void
checkNotEmpty
(String propertyName, Bean bean) Convenience method for bean validators to assert that a property is not empty.void
checkNotEmpty
(String propertyName, String errorMessage, Bean bean) Convenience method for bean validators to assert that a property is not empty.findPropertyDescriptor
(String propertyName) Convenience method for bean validators to find the property descriptor for a named property.Class
<?> Convenience method to retrieve the bean class specified in the constructor.getPropertyValue
(PropertyDescriptor propertyDescriptor, Bean bean) Convenience method for bean validators to get the property value for a property descriptor.getPropertyValue
(String propertyName, Bean bean) Convenience method for bean validators to get the property value for a named property.boolean
Convenience method for bean validators to check if a property is empty.void
setBeanInitializer
(BeanInitializer beanInitializer) Configures a bean initializer.void
setBeanValidator
(BeanValidator beanValidator) Configures a bean validator.void
setCategorySortOrder
(String... categories) Sets a sort order for property categories of this bean.void
setCollapsedPropertyCategories
(String[] collapsedCategories) Specifies property categories that should be collapsed by default.void
setCustomizerIcon
(Icon customizerIcon) Configures the icon of the customizer tab.void
setCustomizerPlacement
(CustomizerPlacement customizerPlacement) Configures the placement of the customizer.void
setDefaultConditionExpression
(String defaultConditionExpression) Configures the default value for the "Condition expression" property of the bean.void
setDefaultRollbackBarrier
(boolean defaultRollbackBarrier) Configures if the action is a rollback barrier by default.void
setDefaultRollbackBarrierExitCode
(int defaultRollbackBarrierExitCode) Configures the default rollback barrier exit code.void
setEnumerationMappers
(EnumerationMapper[] enumerationMappers) Specifies enumeration mappers for properties of this bean.void
Configures custom icons for the bean.void
setMinimumJavaVersion
(String minimumJavaVersion) Sets the minimum Java version that this bean will work with.void
setNoticePanel
(JComponent noticePanel) Sets a panel that is displayed a notice at the top of the configuration panel.void
setPersistenceDelegateMap
(Map<? extends Class, ? extends PersistenceDelegate> persistenceDelegates) Specifies persistence delegates for this bean.void
setPropertyConverters
(PropertyConverter[] propertyConverters) Specifies property converters for properties of this bean.void
setSequenceValidator
(SequenceValidator sequenceValidator) Configures a sequence validator.Methods inherited from class java.beans.SimpleBeanInfo
getAdditionalBeanInfo, getDefaultEventIndex, getDefaultPropertyIndex, getEventSetDescriptors, getIcon, getMethodDescriptors, loadImage
-
Field Details
-
ATTRIBUTE_MINIMUM_JAVA_VERSION
- See Also:
-
ATTRIBUTE_MULTIPLE_INSTANCES_SUPPORTED
- See Also:
-
ATTRIBUTE_INSTALLED_FILES_REQUIRED
- See Also:
-
ATTRIBUTE_BEAN_CATEGORY
- See Also:
-
ATTRIBUTE_COLLAPSED_PROPERTY_CATEGORIES
- See Also:
-
ATTRIBUTE_ENUMERATION_MAPPERS
- See Also:
-
ATTRIBUTE_PROPERTY_CONVERTERS
- See Also:
-
ATTRIBUTE_PERSISTENCE_DELEGATE_MAP
- See Also:
-
ATTRIBUTE_CUSTOMIZER_PLACEMENT
- See Also:
-
ATTRIBUTE_CUSTOMIZER_ICON
- See Also:
-
ATTRIBUTE_BEAN_VALIDATOR
- See Also:
-
ATTRIBUTE_BEAN_INITIALIZER
- See Also:
-
ATTRIBUTE_SORT_KEY
- See Also:
-
ATTRIBUTE_SEQUENCE_VALIDATOR
- See Also:
-
ATTRIBUTE_DEFAULT_ROLLBACK_BARRIER
- See Also:
-
ATTRIBUTE_DEFAULT_ROLLBACK_BARRIER_EXIT_CODE
- See Also:
-
ATTRIBUTE_DEFAULT_CONDITION_EXPRESSION
- See Also:
-
ATTRIBUTE_ICON_16x16
- See Also:
-
ATTRIBUTE_ICON_24x24
- See Also:
-
ATTRIBUTE_NOTICE_PANEL
- See Also:
-
ATTRIBUTE_CATEGORY_SORT_ORDER
- See Also:
-
-
Constructor Details
-
Install4JBeanInfo
protected Install4JBeanInfo(String displayName, String shortDescription, String category, boolean multipleInstancesSupported, boolean installedFilesRequired, Integer sortKey, Class<? extends Bean> beanClass, Class<?> customizerClass) Constructor.Customizers must descend from
javax.swing.JComponent
. Theirname
property (settable withJComponent#setName(String)
) will be displayed as the tab name next to the default "Properties" tab. You can add multiple tabs if your customizer descends fromjavax.swing.JTabbedPane
. In that case, all its tabs are extracted and added next to the default "Properties" tab, and any icons that are set for the single tabs will also be used in the install4j IDE. If you have properties whose values are exclusively used by the customizer, you can give them an empty display name so that they will not show up in the default "Properties" tab. Additional services for the customizer are available with aCustomizerCallback
, the default placement of the customizer can be controlled withsetCustomizerPlacement(CustomizerPlacement)
.- Parameters:
displayName
- the display name for the bean. This name will be displayed in the list of configured beans as well as in the bean registry dialog.shortDescription
- a short description that will be displayed in the bean registry dialog in HTML format. You do not have to start the description with <html>, it will be prepended automatically.category
- the bean category. This determines the node in the bean registry dialog where the bean will be added. Ifnull
the bean will be added at the top level.multipleInstancesSupported
- if multiple instances of this bean are supportedinstalledFilesRequired
- if this bean requires installed files or not. In the installer, this means that this bean must be placed after the "Install files" action, in the uninstaller this means that this bean must be placed before the "Uninstall files" action.sortKey
- a string that will be used for determining the sort order in the bean registry dialog and the default insertion point in the list of configured beans.beanClass
- the class name of the beancustomizerClass
- the customizer class ornull
if no customizer is available.- See Also:
-
Install4JBeanInfo
protected Install4JBeanInfo(String displayName, String shortDescription, String category, boolean multipleInstancesSupported, boolean installedFilesRequired, Integer sortKey, Class<? extends Bean> beanClass) Same asInstall4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class)
with a customizer class ofnull
.
-
-
Method Details
-
addPropertyDescriptor
Add a property descriptor to be returned bygetPropertyDescriptors
.- Parameters:
propertyDescriptor
- the property descriptor
-
getPropertyDescriptors
- Specified by:
getPropertyDescriptors
in interfaceBeanInfo
- Overrides:
getPropertyDescriptors
in classSimpleBeanInfo
-
getBeanDescriptor
- Specified by:
getBeanDescriptor
in interfaceBeanInfo
- Overrides:
getBeanDescriptor
in classSimpleBeanInfo
-
setIcons
Configures custom icons for the bean. The 16x16 icon will be displayed in the bean registry dialog, the 24x24 icon will be displayed in the list of configured beans.- Parameters:
icon16x16
- the 16x16 iconicon24x24
- the 32x32 icon- See Also:
-
setMinimumJavaVersion
Sets the minimum Java version that this bean will work with. If the minimum Java version for the project is less than this version, the bean cannot be added and an error message is displayed.- Parameters:
minimumJavaVersion
- the minimum Java version- See Also:
-
setCollapsedPropertyCategories
Specifies property categories that should be collapsed by default.- Parameters:
collapsedCategories
- an array with the collapsed categories- See Also:
-
setEnumerationMappers
Specifies enumeration mappers for properties of this bean.- Parameters:
enumerationMappers
- an array with the enumeration mappers- See Also:
-
setPropertyConverters
Specifies property converters for properties of this bean.- Parameters:
propertyConverters
- an array with the property converters- See Also:
-
setPersistenceDelegateMap
public void setPersistenceDelegateMap(Map<? extends Class, ? extends PersistenceDelegate> persistenceDelegates) Specifies persistence delegates for this bean. The keys must be of classjava.lang.Class
and the values of classjava.beans.PersistenceDelegate
. See http://java.sun.com/products/jfc/tsc/articles/persistence4/ for more information on persistence delegates.- Parameters:
persistenceDelegates
- thejava.lang.Class
->java.beans.PersistenceDelegate
map- See Also:
-
setCustomizerPlacement
Configures the placement of the customizer.- Parameters:
customizerPlacement
- the customizer placement- See Also:
-
setCustomizerIcon
Configures the icon of the customizer tab.- Parameters:
customizerIcon
- the icon for the customizer tab- See Also:
-
setBeanValidator
Configures a bean validator.- Parameters:
beanValidator
- the bean validator- See Also:
-
setBeanInitializer
Configures a bean initializer.- Parameters:
beanInitializer
- the bean initializer.- See Also:
-
setSequenceValidator
Configures a sequence validator.- Parameters:
sequenceValidator
- the sequence validator.- See Also:
-
setDefaultRollbackBarrier
public void setDefaultRollbackBarrier(boolean defaultRollbackBarrier) Configures if the action is a rollback barrier by default.- Parameters:
defaultRollbackBarrier
- the default rollback barrier flag- See Also:
-
setDefaultRollbackBarrierExitCode
public void setDefaultRollbackBarrierExitCode(int defaultRollbackBarrierExitCode) Configures the default rollback barrier exit code. Only has an effect if the "Rollback barrier" property is selected by the user.- Parameters:
defaultRollbackBarrierExitCode
- the default rollback barrier type- See Also:
-
setDefaultConditionExpression
Configures the default value for the "Condition expression" property of the bean.- Parameters:
defaultConditionExpression
- the default value- See Also:
-
setNoticePanel
Sets a panel that is displayed a notice at the top of the configuration panel. This panel cannot be used for configuring the bean.- Parameters:
noticePanel
- the panel
-
setCategorySortOrder
Sets a sort order for property categories of this bean. By default, property categories are sorted alphabetically. You can change the sort order for the categories that are passed to this method. Any categories that are not present in this sort order will still be sorted alphabetically and will be shown at the top of the property tree.- Parameters:
categories
- an array with all categories that should be sorted in the order that the categories should appear in the install4j IDE
-
getBeanClass
Convenience method to retrieve the bean class specified in the constructor.- Returns:
- the bean class
-
checkNotEmpty
Convenience method for bean validators to assert that a property is not empty. ABeanValidationException
with an appropriate message is thrown if the property is empty.- Parameters:
propertyName
- the name of the property that should be checkedbean
- the bean whose property should be checked- Throws:
BeanValidationException
- if the specified property is empty- See Also:
-
checkNotEmpty
public void checkNotEmpty(String propertyName, String errorMessage, Bean bean) throws BeanValidationException Convenience method for bean validators to assert that a property is not empty. ABeanValidationException
with the specified error message is thrown if the property is empty.- Parameters:
propertyName
- the name of the property that should be checkederrorMessage
- the error messagebean
- the bean whose property should be checked- Throws:
BeanValidationException
- if the specified property is empty- See Also:
-
isEmpty
Convenience method for bean validators to check if a property is empty.- Parameters:
propertyName
- the name of the property that should be checkedbean
- the bean whose property should be checked- Returns:
true
orfalse
.
-
getPropertyValue
Convenience method for bean validators to get the property value for a property descriptor.- Parameters:
propertyDescriptor
- the property descriptor for which the value should be returnedbean
- the bean for which the value should be returned- Returns:
- the property value or
null
if the property cannot be found
-
getPropertyValue
Convenience method for bean validators to get the property value for a named property.- Parameters:
propertyName
- the name of the property for which the value should be returnedbean
- the bean for which the value should be returned- Returns:
- the property value or
null
if the property cannot be found
-
findPropertyDescriptor
Convenience method for bean validators to find the property descriptor for a named property.- Parameters:
propertyName
- the name of the property for which the property descriptor should be returned- Returns:
- the property descriptor
-