Class 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.

    • 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<? extends Bean> beanClass,
                                    java.lang.Class<?> customizerClass)
        Constructor.

        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).

        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. 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
    • 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 minimum 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
      • setPersistenceDelegateMap

        public void setPersistenceDelegateMap​(java.util.Map<? extends java.lang.Class,​? extends java.beans.PersistenceDelegate> 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
      • 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
      • 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
      • 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:
        ATTRIBUTE_DEFAULT_ROLLBACK_BARRIER_EXIT_CODE
      • 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
      • setCategorySortOrder

        public void setCategorySortOrder​(java.lang.String[] categories)
        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

        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,
                                  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, 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