install4j API

com.install4j.api.beaninfo
Class Install4JBeanInfo

java.lang.Object
  extended by java.beans.SimpleBeanInfo
      extended by com.install4j.api.beaninfo.Install4JBeanInfo
All Implemented Interfaces:
java.beans.BeanInfo
Direct Known Subclasses:
ActionBeanInfo, FormComponentBeanInfo, ScreenBeanInfo

public abstract class Install4JBeanInfo
extends java.beans.SimpleBeanInfo

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.


Field Summary
static java.lang.String ATTRIBUTE_BEAN_CATEGORY
           
static java.lang.String ATTRIBUTE_BEAN_INITIALIZER
           
static java.lang.String ATTRIBUTE_BEAN_VALIDATOR
           
static java.lang.String ATTRIBUTE_COLLAPSED_PROPERTY_CATEGORIES
           
static java.lang.String ATTRIBUTE_CUSTOMIZER_ICON
           
static java.lang.String ATTRIBUTE_CUSTOMIZER_PLACEMENT
           
static java.lang.String ATTRIBUTE_DEFAULT_CONDITION_EXPRESSION
           
static java.lang.String ATTRIBUTE_DEFAULT_ROLLBACK_BARRIER
           
static java.lang.String ATTRIBUTE_ENUMERATION_MAPPERS
           
static java.lang.String ATTRIBUTE_ICON_16x16
           
static java.lang.String ATTRIBUTE_ICON_24x24
           
static java.lang.String ATTRIBUTE_INSTALLED_FILES_REQUIRED
           
static java.lang.String ATTRIBUTE_MINIMUM_JAVA_VERSION
           
static java.lang.String ATTRIBUTE_MULTIPLE_INSTANCES_SUPPORTED
           
static java.lang.String ATTRIBUTE_NOTICE_PANEL
           
static java.lang.String ATTRIBUTE_PERSISTENCE_DELEGATE_MAP
           
static java.lang.String ATTRIBUTE_PROPERTY_CONVERTERS
           
static java.lang.String ATTRIBUTE_SEQUENCE_VALIDATOR
           
static java.lang.String ATTRIBUTE_SORT_KEY
           
 
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 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

ATTRIBUTE_MINIMUM_JAVA_VERSION

public static final java.lang.String ATTRIBUTE_MINIMUM_JAVA_VERSION
See Also:
setMinimumJavaVersion(String), Constant Field Values

ATTRIBUTE_MULTIPLE_INSTANCES_SUPPORTED

public static final java.lang.String ATTRIBUTE_MULTIPLE_INSTANCES_SUPPORTED
See Also:
Install4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class), Constant Field Values

ATTRIBUTE_INSTALLED_FILES_REQUIRED

public static final java.lang.String ATTRIBUTE_INSTALLED_FILES_REQUIRED
See Also:
Install4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class), Constant Field Values

ATTRIBUTE_BEAN_CATEGORY

public static final java.lang.String ATTRIBUTE_BEAN_CATEGORY
See Also:
Install4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class), Constant Field Values

ATTRIBUTE_COLLAPSED_PROPERTY_CATEGORIES

public static final java.lang.String ATTRIBUTE_COLLAPSED_PROPERTY_CATEGORIES
See Also:
setCollapsedPropertyCategories(String[]), Constant Field Values

ATTRIBUTE_ENUMERATION_MAPPERS

public static final java.lang.String ATTRIBUTE_ENUMERATION_MAPPERS
See Also:
setEnumerationMappers(EnumerationMapper[]), Constant Field Values

ATTRIBUTE_PROPERTY_CONVERTERS

public static final java.lang.String ATTRIBUTE_PROPERTY_CONVERTERS
See Also:
setPropertyConverters(PropertyConverter[]), Constant Field Values

ATTRIBUTE_PERSISTENCE_DELEGATE_MAP

public static final java.lang.String ATTRIBUTE_PERSISTENCE_DELEGATE_MAP
See Also:
setPersistenceDelegateMap(java.util.Map), Constant Field Values

ATTRIBUTE_CUSTOMIZER_PLACEMENT

public static final java.lang.String ATTRIBUTE_CUSTOMIZER_PLACEMENT
See Also:
setCustomizerPlacement(CustomizerPlacement), Constant Field Values

ATTRIBUTE_CUSTOMIZER_ICON

public static final java.lang.String ATTRIBUTE_CUSTOMIZER_ICON
See Also:
setCustomizerIcon(Icon), Constant Field Values

ATTRIBUTE_BEAN_VALIDATOR

public static final java.lang.String ATTRIBUTE_BEAN_VALIDATOR
See Also:
setBeanValidator(BeanValidator), Constant Field Values

ATTRIBUTE_BEAN_INITIALIZER

public static final java.lang.String ATTRIBUTE_BEAN_INITIALIZER
See Also:
setBeanInitializer(BeanInitializer), Constant Field Values

ATTRIBUTE_SORT_KEY

public static final java.lang.String ATTRIBUTE_SORT_KEY
See Also:
Install4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class), Constant Field Values

ATTRIBUTE_SEQUENCE_VALIDATOR

public static final java.lang.String ATTRIBUTE_SEQUENCE_VALIDATOR
See Also:
setSequenceValidator(SequenceValidator), Constant Field Values

ATTRIBUTE_DEFAULT_ROLLBACK_BARRIER

public static final java.lang.String ATTRIBUTE_DEFAULT_ROLLBACK_BARRIER
See Also:
setDefaultRollbackBarrier(boolean), Constant Field Values

ATTRIBUTE_DEFAULT_CONDITION_EXPRESSION

public static final java.lang.String ATTRIBUTE_DEFAULT_CONDITION_EXPRESSION
See Also:
setDefaultConditionExpression(String), Constant Field Values

ATTRIBUTE_ICON_16x16

public static java.lang.String ATTRIBUTE_ICON_16x16
See Also:
setIcons(javax.swing.Icon, javax.swing.Icon)

ATTRIBUTE_ICON_24x24

public static java.lang.String ATTRIBUTE_ICON_24x24
See Also:
setIcons(javax.swing.Icon, javax.swing.Icon)

ATTRIBUTE_NOTICE_PANEL

public static final java.lang.String ATTRIBUTE_NOTICE_PANEL
See Also:
setNoticePanel(javax.swing.JComponent), Constant Field Values
Constructor Detail

Install4JBeanInfo

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.

Customizers must descend from javax.swing.JComponent. Their name property (settable with JComponentsetName(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).

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.
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 supported
installedFilesRequired - 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 bean
customizerClass - the customizer class or null if no customizer is available.
See Also:
ATTRIBUTE_BEAN_CATEGORY, ATTRIBUTE_MULTIPLE_INSTANCES_SUPPORTED, ATTRIBUTE_INSTALLED_FILES_REQUIRED, ATTRIBUTE_SORT_KEY, CustomizerCallback

Install4JBeanInfo

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.

noinspection
JavaDoc
Method Detail

addPropertyDescriptor

public void addPropertyDescriptor(Install4JPropertyDescriptor propertyDescriptor)
Add a property descriptor to be returned by getPropertyDescriptors.

Parameters:
propertyDescriptor - the property descriptor

getPropertyDescriptors

public java.beans.PropertyDescriptor[] getPropertyDescriptors()
Specified by:
getPropertyDescriptors in interface java.beans.BeanInfo
Overrides:
getPropertyDescriptors in class java.beans.SimpleBeanInfo

getBeanDescriptor

public java.beans.BeanDescriptor getBeanDescriptor()
Specified by:
getBeanDescriptor in interface java.beans.BeanInfo
Overrides:
getBeanDescriptor in class java.beans.SimpleBeanInfo

setIcons

public void setIcons(javax.swing.Icon icon16x16,
                     javax.swing.Icon icon24x24)
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 icon
icon24x24 - the 32x32 icon
See Also:
ATTRIBUTE_ICON_16x16, ATTRIBUTE_ICON_24x24

setMinimumJavaVersion

public void setMinimumJavaVersion(java.lang.String minimumJavaVersion)
Sets the minimum Java version that this bean will work with. If the mimimum Java version for the project is less that this version, the bean cannot be added and an error message is displayed.

Parameters:
minimumJavaVersion - the minimum Java version
See Also:
ATTRIBUTE_MINIMUM_JAVA_VERSION

setCollapsedPropertyCategories

public void setCollapsedPropertyCategories(java.lang.String[] collapsedCategories)
Specifies property categories that should be collapsed by default.

Parameters:
collapsedCategories - an array with the collapsed categories
See Also:
Install4JPropertyDescriptor.setPropertyCategory(String), ATTRIBUTE_COLLAPSED_PROPERTY_CATEGORIES

setEnumerationMappers

public void setEnumerationMappers(EnumerationMapper[] enumerationMappers)
Specifies enumeration mappers for properties of this bean.

Parameters:
enumerationMappers - an array with the enumeration mappers
See Also:
EnumerationMapper, ATTRIBUTE_ENUMERATION_MAPPERS

setPropertyConverters

public void setPropertyConverters(PropertyConverter[] propertyConverters)
Specifies property converters for properties of this bean.

Parameters:
propertyConverters - an array with the property converters
See Also:
PropertyConverter, ATTRIBUTE_PROPERTY_CONVERTERS

setPersistenceDelegateMap

public void setPersistenceDelegateMap(java.util.Map persistenceDelegates)
Specifies persistence delegates for this bean. The keys must be of class 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.

Parameters:
persistenceDelegates - the java.lang.Class -> java.beans.PersistenceDelegate map
See Also:
ATTRIBUTE_PERSISTENCE_DELEGATE_MAP

setCustomizerPlacement

public void setCustomizerPlacement(CustomizerPlacement customizerPlacement)
Configures the placement of the customizer.

Parameters:
customizerPlacement - the customizer placement
See Also:
Install4JBeanInfo(String, String, String, boolean, boolean, Integer, Class, Class), ATTRIBUTE_CUSTOMIZER_PLACEMENT

setCustomizerIcon

public void setCustomizerIcon(javax.swing.Icon customizerIcon)
Configures the icon of the customizer tab.

Parameters:
customizerIcon - the icon for the customizer tab
See Also:
ATTRIBUTE_CUSTOMIZER_ICON

setBeanValidator

public void setBeanValidator(BeanValidator beanValidator)
Configures a bean validator.

Parameters:
beanValidator - the bean validator
See Also:
BeanValidator, ATTRIBUTE_BEAN_VALIDATOR

setBeanInitializer

public void setBeanInitializer(BeanInitializer beanInitializer)
Configures a bean initializer.

Parameters:
beanInitializer - the bean initializer.
See Also:
BeanInitializer, ATTRIBUTE_BEAN_INITIALIZER

setSequenceValidator

public void setSequenceValidator(SequenceValidator sequenceValidator)
Configures a sequence validator.

Parameters:
sequenceValidator - the sequence validator.
See Also:
SequenceValidator, ATTRIBUTE_SEQUENCE_VALIDATOR

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:
ATTRIBUTE_DEFAULT_ROLLBACK_BARRIER

setDefaultConditionExpression

public void setDefaultConditionExpression(java.lang.String defaultConditionExpression)
Configures the default value for the "Condition expression" property of the bean.

Parameters:
defaultConditionExpression - the default value
See Also:
ATTRIBUTE_DEFAULT_CONDITION_EXPRESSION

setNoticePanel

public void setNoticePanel(javax.swing.JComponent noticePanel)
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

getBeanClass

public java.lang.Class getBeanClass()
Convenience method to retrieve the bean class specified in the constructor.

Returns:
the bean class

checkNotEmpty

public void checkNotEmpty(java.lang.String propertyName,
                          Bean bean)
                   throws BeanValidationException
Convenience method for bean validators to assert that a property is not empty. A BeanValidationException with an appropriate message is thrown if the property is empty.

Parameters:
propertyName - the name of the property that should be checked
bean - the bean whose property should be checked
Throws:
BeanValidationException - if the specified property is empty
See Also:
isEmpty(String, com.install4j.api.beans.Bean), BeanValidator

checkNotEmpty

public void checkNotEmpty(java.lang.String propertyName,
                          java.lang.String errorMessage,
                          Bean bean)
                   throws BeanValidationException
Convenience method for bean validators to assert that a property is not empty. A BeanValidationException with the specified error message is thrown if the property is empty.

Parameters:
propertyName - the name of the property that should be checked
errorMessage - the error message
bean - the bean whose property should be checked
Throws:
BeanValidationException - if the specified property is empty
See Also:
isEmpty(String, com.install4j.api.beans.Bean), BeanValidator

isEmpty

public boolean isEmpty(java.lang.String propertyName,
                       Bean bean)
Convenience method for bean validators to check if a property is empty.

Parameters:
propertyName - the name of the property that should be checked
bean - the bean whose property should be checked
Returns:
true or false.

getPropertyValue

public java.lang.Object getPropertyValue(java.beans.PropertyDescriptor propertyDescriptor,
                                         Bean bean)
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 returned
bean - the bean for which the value should be returned
Returns:
the property value or null if the property cannot be found

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String propertyName,
                                         Bean bean)
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 returned
bean - the bean for which the value should be returned
Returns:
the property value or null if the property cannot be found

findPropertyDescriptor

public java.beans.PropertyDescriptor findPropertyDescriptor(java.lang.String propertyName)
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

install4j API