public abstract class Install4JBeanInfo
extends java.beans.SimpleBeanInfo
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.
Modifier | Constructor and Description |
---|---|
protected |
Install4JBeanInfo(java.lang.String displayName,
java.lang.String shortDescription,
java.lang.String category,
boolean multipleInstancesSupported,
boolean installedFilesRequired,
java.lang.Integer sortKey,
java.lang.Class<? extends Bean> beanClass)
Same as
Install4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class) with a customizer class of null . |
protected |
Install4JBeanInfo(java.lang.String displayName,
java.lang.String shortDescription,
java.lang.String category,
boolean multipleInstancesSupported,
boolean installedFilesRequired,
java.lang.Integer sortKey,
java.lang.Class<? extends Bean> beanClass,
java.lang.Class<?> customizerClass)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyDescriptor(Install4JPropertyDescriptor propertyDescriptor)
Add a property descriptor to be returned by
getPropertyDescriptors . |
void |
checkNotEmpty(java.lang.String propertyName,
Bean bean)
Convenience method for bean validators to assert that a property is not empty.
|
void |
checkNotEmpty(java.lang.String propertyName,
java.lang.String errorMessage,
Bean bean)
Convenience method for bean validators to assert that a property is not empty.
|
java.beans.PropertyDescriptor |
findPropertyDescriptor(java.lang.String propertyName)
Convenience method for bean validators to find the property descriptor for a named property.
|
java.lang.Class<?> |
getBeanClass()
Convenience method to retrieve the bean class specified in the constructor.
|
java.beans.BeanDescriptor |
getBeanDescriptor() |
java.beans.PropertyDescriptor[] |
getPropertyDescriptors() |
java.lang.Object |
getPropertyValue(java.beans.PropertyDescriptor propertyDescriptor,
Bean bean)
Convenience method for bean validators to get the property value for a property descriptor.
|
java.lang.Object |
getPropertyValue(java.lang.String propertyName,
Bean bean)
Convenience method for bean validators to get the property value for a named property.
|
boolean |
isEmpty(java.lang.String propertyName,
Bean bean)
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(java.lang.String[] categories)
Sets a sort order for property categories of this bean.
|
void |
setCollapsedPropertyCategories(java.lang.String[] collapsedCategories)
Specifies property categories that should be collapsed by default.
|
void |
setCustomizerIcon(javax.swing.Icon customizerIcon)
Configures the icon of the customizer tab.
|
void |
setCustomizerPlacement(CustomizerPlacement customizerPlacement)
Configures the placement of the customizer.
|
void |
setDefaultConditionExpression(java.lang.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 |
setIcons(javax.swing.Icon icon16x16,
javax.swing.Icon icon24x24)
Configures custom icons for the bean.
|
void |
setMinimumJavaVersion(java.lang.String minimumJavaVersion)
Sets the minimum Java version that this bean will work with.
|
void |
setNoticePanel(javax.swing.JComponent noticePanel)
Sets a panel that is displayed a notice at the top of the configuration panel.
|
void |
setPersistenceDelegateMap(java.util.Map<? extends java.lang.Class,? extends java.beans.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.
|
public static final java.lang.String ATTRIBUTE_MINIMUM_JAVA_VERSION
public static final java.lang.String ATTRIBUTE_MULTIPLE_INSTANCES_SUPPORTED
public static final java.lang.String ATTRIBUTE_INSTALLED_FILES_REQUIRED
public static final java.lang.String ATTRIBUTE_BEAN_CATEGORY
public static final java.lang.String ATTRIBUTE_COLLAPSED_PROPERTY_CATEGORIES
public static final java.lang.String ATTRIBUTE_ENUMERATION_MAPPERS
public static final java.lang.String ATTRIBUTE_PROPERTY_CONVERTERS
public static final java.lang.String ATTRIBUTE_PERSISTENCE_DELEGATE_MAP
public static final java.lang.String ATTRIBUTE_CUSTOMIZER_PLACEMENT
public static final java.lang.String ATTRIBUTE_CUSTOMIZER_ICON
setCustomizerIcon(Icon)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_BEAN_VALIDATOR
public static final java.lang.String ATTRIBUTE_BEAN_INITIALIZER
public static final java.lang.String ATTRIBUTE_SORT_KEY
public static final java.lang.String ATTRIBUTE_SEQUENCE_VALIDATOR
public static final java.lang.String ATTRIBUTE_DEFAULT_ROLLBACK_BARRIER
public static final java.lang.String ATTRIBUTE_DEFAULT_ROLLBACK_BARRIER_EXIT_CODE
public static final java.lang.String ATTRIBUTE_DEFAULT_CONDITION_EXPRESSION
public static final java.lang.String ATTRIBUTE_ICON_16x16
setIcons(Icon, Icon)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_ICON_24x24
setIcons(Icon, Icon)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_NOTICE_PANEL
setNoticePanel(JComponent)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_CATEGORY_SORT_ORDER
protected Install4JBeanInfo(java.lang.String displayName, java.lang.String shortDescription, java.lang.String category, boolean multipleInstancesSupported, boolean installedFilesRequired, java.lang.Integer sortKey, java.lang.Class<? extends Bean> beanClass, java.lang.Class<?> customizerClass)
Customizers must descend from javax.swing.JComponent
. Their name
property (settable with JComponent#setName(String)
)
will be displayed as the tab name next to the default "Properties" tab. You can add multiple tabs if your customizer descends from
javax.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 be 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 a
CustomizerCallback
, the default placement of the customizer can be controlled with
setCustomizerPlacement(CustomizerPlacement)
.
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. If null
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 use 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 or null
if no customizer is available.ATTRIBUTE_BEAN_CATEGORY
,
ATTRIBUTE_MULTIPLE_INSTANCES_SUPPORTED
,
ATTRIBUTE_INSTALLED_FILES_REQUIRED
,
ATTRIBUTE_SORT_KEY
,
CustomizerCallback
protected Install4JBeanInfo(java.lang.String displayName, java.lang.String shortDescription, java.lang.String category, boolean multipleInstancesSupported, boolean installedFilesRequired, java.lang.Integer sortKey, java.lang.Class<? extends Bean> beanClass)
Install4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class)
with a customizer class of null
.public void addPropertyDescriptor(Install4JPropertyDescriptor propertyDescriptor)
getPropertyDescriptors
.propertyDescriptor
- the property descriptorpublic java.beans.PropertyDescriptor[] getPropertyDescriptors()
getPropertyDescriptors
in interface java.beans.BeanInfo
getPropertyDescriptors
in class java.beans.SimpleBeanInfo
public java.beans.BeanDescriptor getBeanDescriptor()
getBeanDescriptor
in interface java.beans.BeanInfo
getBeanDescriptor
in class java.beans.SimpleBeanInfo
public void setIcons(javax.swing.Icon icon16x16, javax.swing.Icon icon24x24)
icon16x16
- the 16x16 iconicon24x24
- the 32x32 iconATTRIBUTE_ICON_16x16
,
ATTRIBUTE_ICON_24x24
public void setMinimumJavaVersion(java.lang.String minimumJavaVersion)
minimumJavaVersion
- the minimum Java versionATTRIBUTE_MINIMUM_JAVA_VERSION
public void setCollapsedPropertyCategories(java.lang.String[] collapsedCategories)
collapsedCategories
- an array with the collapsed categoriesInstall4JPropertyDescriptor.setPropertyCategory(String)
,
ATTRIBUTE_COLLAPSED_PROPERTY_CATEGORIES
public void setEnumerationMappers(EnumerationMapper[] enumerationMappers)
enumerationMappers
- an array with the enumeration mappersEnumerationMapper
,
ATTRIBUTE_ENUMERATION_MAPPERS
public void setPropertyConverters(PropertyConverter[] propertyConverters)
propertyConverters
- an array with the property convertersPropertyConverter
,
ATTRIBUTE_PROPERTY_CONVERTERS
public void setPersistenceDelegateMap(java.util.Map<? extends java.lang.Class,? extends java.beans.PersistenceDelegate> persistenceDelegates)
java.lang.Class
and the values of class java.beans.PersistenceDelegate
.
See http://java.sun.com/products/jfc/tsc/articles/persistence4/
for more information on persistence delegates.persistenceDelegates
- the java.lang.Class
-> java.beans.PersistenceDelegate
mapATTRIBUTE_PERSISTENCE_DELEGATE_MAP
public void setCustomizerPlacement(CustomizerPlacement customizerPlacement)
customizerPlacement
- the customizer placementInstall4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class)
,
ATTRIBUTE_CUSTOMIZER_PLACEMENT
public void setCustomizerIcon(javax.swing.Icon customizerIcon)
customizerIcon
- the icon for the customizer tabATTRIBUTE_CUSTOMIZER_ICON
public void setBeanValidator(BeanValidator beanValidator)
beanValidator
- the bean validatorBeanValidator
,
ATTRIBUTE_BEAN_VALIDATOR
public void setBeanInitializer(BeanInitializer beanInitializer)
beanInitializer
- the bean initializer.BeanInitializer
,
ATTRIBUTE_BEAN_INITIALIZER
public void setSequenceValidator(SequenceValidator sequenceValidator)
sequenceValidator
- the sequence validator.SequenceValidator
,
ATTRIBUTE_SEQUENCE_VALIDATOR
public void setDefaultRollbackBarrier(boolean defaultRollbackBarrier)
defaultRollbackBarrier
- the default rollback barrier flagATTRIBUTE_DEFAULT_ROLLBACK_BARRIER
public void setDefaultRollbackBarrierExitCode(int defaultRollbackBarrierExitCode)
defaultRollbackBarrierExitCode
- the default rollback barrier typeATTRIBUTE_DEFAULT_ROLLBACK_BARRIER_EXIT_CODE
public void setDefaultConditionExpression(java.lang.String defaultConditionExpression)
defaultConditionExpression
- the default valueATTRIBUTE_DEFAULT_CONDITION_EXPRESSION
public void setNoticePanel(javax.swing.JComponent noticePanel)
noticePanel
- the panelpublic void setCategorySortOrder(java.lang.String[] categories)
categories
- an array with all categories that should be sorted in the order that the categories should appear
in the install4j IDEpublic java.lang.Class<?> getBeanClass()
public void checkNotEmpty(java.lang.String propertyName, Bean bean) throws BeanValidationException
BeanValidationException
with an appropriate message is thrown if the property is empty.propertyName
- the name of the property that should be checkedbean
- the bean whose property should be checkedBeanValidationException
- if the specified property is emptyisEmpty(String, Bean)
,
BeanValidator
public void checkNotEmpty(java.lang.String propertyName, java.lang.String errorMessage, Bean bean) throws BeanValidationException
BeanValidationException
with the specified error message is thrown if the property is empty.propertyName
- the name of the property that should be checkederrorMessage
- the error messagebean
- the bean whose property should be checkedBeanValidationException
- if the specified property is emptyisEmpty(String, Bean)
,
BeanValidator
public boolean isEmpty(java.lang.String propertyName, Bean bean)
propertyName
- the name of the property that should be checkedbean
- the bean whose property should be checkedtrue
or false
.public java.lang.Object getPropertyValue(java.beans.PropertyDescriptor propertyDescriptor, Bean bean)
propertyDescriptor
- the property descriptor for which the value should be returnedbean
- the bean for which the value should be returnednull
if the property cannot be foundpublic java.lang.Object getPropertyValue(java.lang.String propertyName, Bean bean)
propertyName
- the name of the property for which the value should be returnedbean
- the bean for which the value should be returnednull
if the property cannot be foundpublic java.beans.PropertyDescriptor findPropertyDescriptor(java.lang.String propertyName)
propertyName
- the name of the property for which the property descriptor should be returned