Class WrapperStyle
- All Implemented Interfaces:
Bean
,VisualContainerBean
,ControlButtonContainer
,NestedStyleContainer
,Style
,StyleContextReceiver
When you use this base class, you do not have to handle any life-cycle aspects of the nested style.
See NestedStyleContainer
for more information on nesting styles in general.
The "customCode" sample project contains the class SunnySkyBackgroundStyle
and its associated
BeanInfo
that show you an example of wrapping a user-selected style with a graphical decoration.
For more complex use cases, the source code of WrapperStyle
can be used as a starting point.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is called by the framework just after a screen with this style has been activated.final JComponent
Create the UI component for the style.protected abstract JComponent
createComponent
(JComponent styleComponent) Create the UI component for the style.void
This method is called by the framework just after a screen with this style has been deactivated.void
focusControlButton
(ControlButtonType controlButtonType) Called when a control button is focused.protected abstract String
Returns the ID of the nested style.Return the IDs of all nested styles.boolean
Returns whether the visual component wants to grow in the horizontal direction.boolean
Returns whether the visual component wants to grow in the vertical direction.void
setControlButtonEnabled
(ControlButtonType controlButtonType, boolean enabled) Called when the enabled state of a control button is changed.void
setControlButtonText
(ControlButtonType controlButtonType, String text) Called when a control button text is changed.void
setControlButtonVisible
(ControlButtonType controlButtonType, boolean visible) Called when the visibility of a control button is changed.void
setStyleContext
(StyleContext styleContext) Called by the framework when the current screen changes.void
This method is called by the framework just before a screen with this style is activated.Methods inherited from class com.install4j.api.styles.AbstractStyle
getAnchor, getContext, getStyleManager, isStandalone, setContext
Methods inherited from class com.install4j.api.beans.AbstractBean
executeActionListAsync, executeActionListSync, getTextOverrideValue, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, rollbackActionList
-
Constructor Details
-
WrapperStyle
public WrapperStyle()
-
-
Method Details
-
getNestedStyleId
Returns the ID of the nested style. This method must be implemented by derived classes. To make aString
property user-selectable in the IDE, register it in theBeanInfo
with the special contextInstall4JPropertyDescriptor.CONTEXT_STYLE_ID
.- Returns:
- the ID
-
createComponent
Create the UI component for the style. Has the same responsibility ascreateComponent()
, only that the UI component of the nested style is passed as a parameter.- Returns:
- the UI component
-
setStyleContext
Description copied from interface:StyleContextReceiver
Called by the framework when the current screen changes. This method is called beforeStyle.createComponent()
where theStyleContext
may be required for constructing the style component.You have to delegate this method call to any nested styles, see
NestedStyleContainer
for more information.- Specified by:
setStyleContext
in interfaceStyleContextReceiver
- Parameters:
styleContext
- the style context
-
setControlButtonEnabled
Description copied from interface:ControlButtonContainer
Called when the enabled state of a control button is changed. This is called by the framework as required, but it can also be triggered programatically by a call toWizardContext.setControlButtonEnabled(ControlButtonType, boolean)
.- Specified by:
setControlButtonEnabled
in interfaceControlButtonContainer
- Parameters:
controlButtonType
- the control button typeenabled
-true
orfalse
-
setControlButtonVisible
Description copied from interface:ControlButtonContainer
Called when the visibility of a control button is changed. This is called by the framework as required, but it can also be triggered programatically by a call toWizardContext.setControlButtonVisible(ControlButtonType, boolean)
.- Specified by:
setControlButtonVisible
in interfaceControlButtonContainer
- Parameters:
controlButtonType
- the control button typevisible
-true
orfalse
-
setControlButtonText
Description copied from interface:ControlButtonContainer
Called when a control button text is changed. This is called for all control button types each time when a screen is activated, but it can also be triggered programatically by a call toWizardContext.setControlButtonText(ControlButtonType, String)
.- Specified by:
setControlButtonText
in interfaceControlButtonContainer
- Parameters:
controlButtonType
- the control button typetext
- the text for the button
-
focusControlButton
Description copied from interface:ControlButtonContainer
Called when a control button is focused. This is triggered programatically by a call toWizardContext.focusControlButton(ControlButtonType)
.- Specified by:
focusControlButton
in interfaceControlButtonContainer
-
createComponent
Description copied from interface:Style
Create the UI component for the style. Depending on the return value of theVisualContainerBean.isFillHorizontal()
and theVisualContainerBean.isFillVertical()
methods, the component grows to fill all available horizontal or vertical space. The method must not returnnull
.Never call this method yourself. For nested styles, call
StyleManager.createStyleComponent(Style)
instead.Each style is only instantiated once, and this method is called multiple times for each screen that uses the style. In console or unattended mode, this method is never called.
- Specified by:
createComponent
in interfaceStyle
- Returns:
- the UI component
- See Also:
-
isFillHorizontal
public boolean isFillHorizontal()Description copied from interface:VisualContainerBean
Returns whether the visual component wants to grow in the horizontal direction. If not, the visual component will be aligned at the left of the available space and be sized at its preferred horizontal size. If, for example, you have text fields in your layout that should use as much horizontal space as possible, you should returntrue
here. If all your components are fixed-size components, returnfalse
.In console or unattended mode, this method is never called.
- Specified by:
isFillHorizontal
in interfaceVisualContainerBean
- Returns:
true
orfalse
.- See Also:
-
isFillVertical
public boolean isFillVertical()Description copied from interface:VisualContainerBean
Returns whether the visual component wants to grow in the vertical direction. If not, the visual component will be aligned at the top of the available space and be sized at its preferred vertical size. If, for example, you have a list in your layout that should use as much vertical space as possible, you should returntrue
here. In that case you would also want to returntrue
inisFillHorizontal
. If all your components are fixed-size components, returnfalse
.In console or unattended mode, this method is never called.
- Specified by:
isFillVertical
in interfaceVisualContainerBean
- Returns:
true
orfalse
.- See Also:
-
getNestedStyleIds
Description copied from interface:NestedStyleContainer
Return the IDs of all nested styles. This allows the install4j IDE to collect all overridable properties.- Specified by:
getNestedStyleIds
in interfaceNestedStyleContainer
- Returns:
- the IDs
-
willActivate
public void willActivate()Description copied from interface:Style
This method is called by the framework just before a screen with this style is activated. This call has to be delegated to nested styles by usingStyleManager.willActivate(Style)
.- Specified by:
willActivate
in interfaceStyle
- Overrides:
willActivate
in classAbstractStyle
- See Also:
-
activated
public void activated()Description copied from interface:Style
This method is called by the framework just after a screen with this style has been activated. This call has to be delegated to nested styles by usingStyleManager.activated(Style)
- Specified by:
activated
in interfaceStyle
- Overrides:
activated
in classAbstractStyle
- See Also:
-
deactivated
public void deactivated()Description copied from interface:Style
This method is called by the framework just after a screen with this style has been deactivated. This call has to be delegated to nested styles by usingStyleManager.deactivated(Style)
- Specified by:
deactivated
in interfaceStyle
- Overrides:
deactivated
in classAbstractStyle
-