public abstract class WrapperStyle extends AbstractStyle implements NestedStyleContainer
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 and Description |
---|
WrapperStyle() |
Modifier and Type | Method and Description |
---|---|
void |
activated()
This method is called by the framework just after a screen with this style has been activated.
|
javax.swing.JComponent |
createComponent()
Create the UI component for the style.
|
protected abstract javax.swing.JComponent |
createComponent(javax.swing.JComponent styleComponent)
Create the UI component for the style.
|
void |
deactivated()
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 java.lang.String |
getNestedStyleId()
Returns the ID of the nested style.
|
java.util.Collection<java.lang.String> |
getNestedStyleIds()
Return the IDs of all nested styles.
|
boolean |
isFillHorizontal()
Returns whether the visual component wants to grow in the horizontal direction.
|
boolean |
isFillVertical()
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,
java.lang.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 |
willActivate()
This method is called by the framework just before a screen with this style is activated.
|
getAnchor, getContext, getStyleManager, isStandalone, setContext
executeActionListAsync, executeActionListSync, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceVariables, rollbackActionList
protected abstract java.lang.String getNestedStyleId()
String
property user-selectable in the IDE, register it in the BeanInfo
with the special context
Install4JPropertyDescriptor.CONTEXT_STYLE_ID
.protected abstract javax.swing.JComponent createComponent(javax.swing.JComponent styleComponent)
createComponent()
, only that the UI component of the nested style is passed as a parameter.public void setStyleContext(StyleContext styleContext)
StyleContextReceiver
Style.createComponent()
where the StyleContext
may be required for constructing the style component.
You have to delegate this method call to any nested styles, see NestedStyleContainer
for more information.
setStyleContext
in interface StyleContextReceiver
styleContext
- the style contextpublic void setControlButtonEnabled(ControlButtonType controlButtonType, boolean enabled)
ControlButtonContainer
WizardContext.setControlButtonEnabled(ControlButtonType, boolean)
.setControlButtonEnabled
in interface ControlButtonContainer
controlButtonType
- the control button typeenabled
- true
or false
public void setControlButtonVisible(ControlButtonType controlButtonType, boolean visible)
ControlButtonContainer
WizardContext.setControlButtonVisible(ControlButtonType, boolean)
.setControlButtonVisible
in interface ControlButtonContainer
controlButtonType
- the control button typevisible
- true
or false
public void setControlButtonText(ControlButtonType controlButtonType, java.lang.String text)
ControlButtonContainer
WizardContext.setControlButtonText(ControlButtonType, String)
.setControlButtonText
in interface ControlButtonContainer
controlButtonType
- the control button typetext
- the text for the buttonpublic void focusControlButton(ControlButtonType controlButtonType)
ControlButtonContainer
WizardContext.focusControlButton(ControlButtonType)
.focusControlButton
in interface ControlButtonContainer
public final javax.swing.JComponent createComponent()
Style
VisualContainerBean.isFillHorizontal()
and the
VisualContainerBean.isFillVertical()
methods, the component grows to fill all available horizontal or vertical space.
The method must not return null
.
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.
createComponent
in interface Style
VisualContainerBean.isFillHorizontal()
,
VisualContainerBean.isFillVertical()
,
NestedStyleContainer
public boolean isFillHorizontal()
VisualContainerBean
true
here. If all your components
are fixed-size components, return false
.
In console or unattended mode, this method is never called.
isFillHorizontal
in interface VisualContainerBean
true
or false
.VisualContainerBean.isFillVertical()
public boolean isFillVertical()
VisualContainerBean
true
here. In that case
you would also want to return true
in isFillHorizontal
. If all
your components are fixed-size components, return false
.
In console or unattended mode, this method is never called.
isFillVertical
in interface VisualContainerBean
true
or false
.VisualContainerBean.isFillHorizontal()
public java.util.Collection<java.lang.String> getNestedStyleIds()
NestedStyleContainer
getNestedStyleIds
in interface NestedStyleContainer
public void willActivate()
Style
StyleManager.willActivate(Style)
.willActivate
in interface Style
willActivate
in class AbstractStyle
Screen.willActivate()
public void activated()
Style
StyleManager.activated(Style)
activated
in interface Style
activated
in class AbstractStyle
Screen.activated()
public void deactivated()
Style
StyleManager.deactivated(Style)
deactivated
in interface Style
deactivated
in class AbstractStyle