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 screen 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 TypeMethodDescriptionvoidThis method is called by the framework just after a screen with this screen style has been activated.final JComponentCreate the UI component for the style.protected abstract JComponentcreateComponent(JComponent styleComponent) Create the UI component for the style.voidThis method is called by the framework just after a screen with this screen style has been deactivated.voidfocusControlButton(ControlButtonType controlButtonType) Called when a control button is focused.protected abstract StringReturns the ID of the nested style.Return the IDs of all nested styles.booleanReturns whether the visual component wants to grow in the horizontal direction.booleanReturns whether the visual component wants to grow in the vertical direction.voidsetControlButtonEnabled(ControlButtonType controlButtonType, boolean enabled) Called when the enabled state of a control button is changed.voidsetControlButtonText(ControlButtonType controlButtonType, String text) Called when a control button text is changed.voidsetControlButtonVisible(ControlButtonType controlButtonType, boolean visible) Called when the visibility of a control button is changed.voidsetStyleContext(StyleContext styleContext) Called by the framework when the current screen changes.voidThis method is called by the framework just before a screen with this screen style is activated.Methods inherited from class AbstractStyle
getAnchor, getContext, getStyleManager, isStandalone, setContextModifier and TypeMethodDescriptionReturns a default value for the anchor of the screen style component.Returns theContextthat the framework has associated with this style inAbstractStyle.setContext(Context).Returns theStyleManager.booleanReturns if the screen style is intended to be applied to installer applications, screens and screen groups.voidsetContext(Context context) This method is called by the framework to set theContextjust after the screen style has been constructed.Methods inherited from class AbstractBean
executeActionListAsync, executeActionListSync, getTextOverrideValue, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceVariables, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, replaceWithTextOverride, rollbackActionListModifier and TypeMethodDescriptionstatic voidexecuteActionListAsync(ActionList actionList, Object... extraScriptParameters) Asynchronously execute an action list.static booleanexecuteActionListSync(ActionList actionList, Object... extraScriptParameters) Synchronously execute an action list.static <T> TgetTextOverrideValue(Bean bean, String propertyName, Class<T> resultType) Get the value for a property for which a text replacement has been configured in the IDE.static FilereplaceVariables(File file) Replace all installer variables and localization keys in a file name.static File[]replaceVariables(File[] files) Replace all installer variables and localization keys in a file array.static StringreplaceVariables(String value) Same asAbstractBean.replaceVariables(String, ReplacementMode, VariableErrorHandlingDescriptor), withReplacementMode.PLAINas the replacement mode andVariableErrorHandlingDescriptor.DEFAULTas the error handling descriptor.static String[]replaceVariables(String[] values) Same asAbstractBean.replaceVariables(String[], VariableErrorHandlingDescriptor), withVariableErrorHandlingDescriptor.DEFAULTas the error handling descriptor.static String[]replaceVariables(String[] values, VariableErrorHandlingDescriptor errorHandlingDescriptor) Replace all installer variables and localization keys in a string array.static StringreplaceVariables(String value, ReplacementMode replacementMode) Same asAbstractBean.replaceVariables(String, ReplacementMode, VariableErrorHandlingDescriptor), withVariableErrorHandlingDescriptor.DEFAULTas the error handling descriptor.static StringreplaceVariables(String value, ReplacementMode replacementMode, VariableErrorHandlingDescriptor errorHandlingDescriptor) Replace all installer variables and localization keys in a string.static StringreplaceVariables(String value, VariableErrorHandlingDescriptor errorHandlingDescriptor) Same asAbstractBean.replaceVariables(String, ReplacementMode, VariableErrorHandlingDescriptor), withReplacementMode.PLAINas the replacement mode.static <T> TreplaceWithTextOverride(Bean bean, String propertyName, T defaultValue, Class resultType) A convenience method forAbstractBean.getTextOverrideValue(Bean, String, Class)that returns a default value if no replacement has been configured.protected booleanreplaceWithTextOverride(String propertyName, boolean defaultValue) protected bytereplaceWithTextOverride(String propertyName, byte defaultValue) protected charreplaceWithTextOverride(String propertyName, char defaultValue) protected doublereplaceWithTextOverride(String propertyName, double defaultValue) protected floatreplaceWithTextOverride(String propertyName, float defaultValue) protected intreplaceWithTextOverride(String propertyName, int defaultValue) protected longreplaceWithTextOverride(String propertyName, long defaultValue) protected shortreplaceWithTextOverride(String propertyName, short defaultValue) protected <T> TreplaceWithTextOverride(String propertyName, T defaultValue, Class resultType) static voidrollbackActionList(ActionList actionList) Roll back an action list.
-
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 aStringproperty user-selectable in the IDE, register it in theBeanInfowith 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 screen style is passed as a parameter.- Returns:
- the UI component
-
setStyleContext
Description copied from interface:StyleContextReceiverCalled by the framework when the current screen changes. This method is called beforeStyle.createComponent()where theStyleContextmay be required for constructing the screen style component.You have to delegate this method call to any nested styles, see
NestedStyleContainerfor more information.- Specified by:
setStyleContextin interfaceStyleContextReceiver- Parameters:
styleContext- the screen style context
-
setControlButtonEnabled
Description copied from interface:ControlButtonContainerCalled when the enabled state of a control button is changed. This is called by the framework as required, but it can also be triggered programmatically by a call toWizardContext.setControlButtonEnabled(ControlButtonType, boolean).- Specified by:
setControlButtonEnabledin interfaceControlButtonContainer- Parameters:
controlButtonType- the control button typeenabled-trueorfalse
-
setControlButtonVisible
Description copied from interface:ControlButtonContainerCalled when the visibility of a control button is changed. This is called by the framework as required, but it can also be triggered programmatically by a call toWizardContext.setControlButtonVisible(ControlButtonType, boolean).- Specified by:
setControlButtonVisiblein interfaceControlButtonContainer- Parameters:
controlButtonType- the control button typevisible-trueorfalse
-
setControlButtonText
Description copied from interface:ControlButtonContainerCalled 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 programmatically by a call toWizardContext.setControlButtonText(ControlButtonType, String).- Specified by:
setControlButtonTextin interfaceControlButtonContainer- Parameters:
controlButtonType- the control button typetext- the text for the button
-
focusControlButton
Description copied from interface:ControlButtonContainerCalled when a control button is focused. This is triggered programmatically by a call toWizardContext.focusControlButton(ControlButtonType).- Specified by:
focusControlButtonin interfaceControlButtonContainer
-
createComponent
Description copied from interface:StyleCreate 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 screen 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:
createComponentin interfaceStyle- Returns:
- the UI component
- See Also:
-
isFillHorizontal
public boolean isFillHorizontal()Description copied from interface:VisualContainerBeanReturns 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 returntruehere. If all your components are fixed-size components, returnfalse.In console or unattended mode, this method is never called.
- Specified by:
isFillHorizontalin interfaceVisualContainerBean- Returns:
trueorfalse.- See Also:
-
isFillVertical
public boolean isFillVertical()Description copied from interface:VisualContainerBeanReturns 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 returntruehere. In that case you would also want to returntrueinisFillHorizontal. If all your components are fixed-size components, returnfalse.In console or unattended mode, this method is never called.
- Specified by:
isFillVerticalin interfaceVisualContainerBean- Returns:
trueorfalse.- See Also:
-
getNestedStyleIds
Description copied from interface:NestedStyleContainerReturn the IDs of all nested styles. This allows the install4j IDE to collect all overridable properties.- Specified by:
getNestedStyleIdsin interfaceNestedStyleContainer- Returns:
- the IDs
-
willActivate
public void willActivate()Description copied from interface:StyleThis method is called by the framework just before a screen with this screen style is activated. This call has to be delegated to nested styles by usingStyleManager.willActivate(Style).- Specified by:
willActivatein interfaceStyle- Overrides:
willActivatein classAbstractStyle- See Also:
-
activated
public void activated()Description copied from interface:StyleThis method is called by the framework just after a screen with this screen style has been activated. This call has to be delegated to nested styles by usingStyleManager.activated(Style)- Specified by:
activatedin interfaceStyle- Overrides:
activatedin classAbstractStyle- See Also:
-
deactivated
public void deactivated()Description copied from interface:StyleThis method is called by the framework just after a screen with this screen style has been deactivated. This call has to be delegated to nested styles by usingStyleManager.deactivated(Style)- Specified by:
deactivatedin interfaceStyle- Overrides:
deactivatedin classAbstractStyle
-