java.lang.Objectjava.beans.SimpleBeanInfo
com.install4j.api.beaninfo.Install4JBeanInfo
public abstract class Install4JBeanInfo
Base class for bean infos. It is recommended to derive your bean info from one of the derived classes which are specific to screens, actions and form components.
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.
Fields inherited from interface java.beans.BeanInfo |
---|
ICON_COLOR_16x16, ICON_COLOR_32x32, ICON_MONO_16x16, ICON_MONO_32x32 |
Constructor Summary | |
---|---|
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 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 beanClass,
java.lang.Class customizerClass)
Constructor. |
Method Summary | |
---|---|
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 |
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 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ATTRIBUTE_MINIMUM_JAVA_VERSION
setMinimumJavaVersion(String)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_MULTIPLE_INSTANCES_SUPPORTED
Install4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_INSTALLED_FILES_REQUIRED
Install4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_BEAN_CATEGORY
Install4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_COLLAPSED_PROPERTY_CATEGORIES
setCollapsedPropertyCategories(String[])
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_ENUMERATION_MAPPERS
setEnumerationMappers(EnumerationMapper[])
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_PROPERTY_CONVERTERS
setPropertyConverters(PropertyConverter[])
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_PERSISTENCE_DELEGATE_MAP
setPersistenceDelegateMap(java.util.Map)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_CUSTOMIZER_PLACEMENT
setCustomizerPlacement(CustomizerPlacement)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_CUSTOMIZER_ICON
setCustomizerIcon(Icon)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_BEAN_VALIDATOR
setBeanValidator(BeanValidator)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_BEAN_INITIALIZER
setBeanInitializer(BeanInitializer)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_SORT_KEY
Install4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_SEQUENCE_VALIDATOR
setSequenceValidator(SequenceValidator)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_DEFAULT_ROLLBACK_BARRIER
setDefaultRollbackBarrier(boolean)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_DEFAULT_CONDITION_EXPRESSION
setDefaultConditionExpression(String)
,
Constant Field Valuespublic static java.lang.String ATTRIBUTE_ICON_16x16
setIcons(javax.swing.Icon, javax.swing.Icon)
public static java.lang.String ATTRIBUTE_ICON_24x24
setIcons(javax.swing.Icon, javax.swing.Icon)
public static final java.lang.String ATTRIBUTE_NOTICE_PANEL
setNoticePanel(javax.swing.JComponent)
,
Constant Field Valuespublic static final java.lang.String ATTRIBUTE_CATEGORY_SORT_ORDER
setCategorySortOrder(String[])
,
Constant Field ValuesConstructor Detail |
---|
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 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 beanClass)
Install4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class)
with a customizer class of null.
Method Detail |
---|
public void addPropertyDescriptor(Install4JPropertyDescriptor propertyDescriptor)
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 persistenceDelegates)
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 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 checked
BeanValidationException
- if the specified property is emptyisEmpty(String, com.install4j.api.beans.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 checked
BeanValidationException
- if the specified property is emptyisEmpty(String, com.install4j.api.beans.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 checked
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 returned
public 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 returned
public java.beans.PropertyDescriptor findPropertyDescriptor(java.lang.String propertyName)
propertyName
- the name of the property for which the property descriptor should be returned