Class AbstractInstallerOrUninstallerScreen
- java.lang.Object
-
- com.install4j.api.beans.AbstractBean
-
- com.install4j.api.screens.AbstractInstallerOrUninstallerScreen
-
- All Implemented Interfaces:
Bean,VisualContainerBean,InstallerEventListener,InstallerScreen,Screen,UninstallerScreen
public abstract class AbstractInstallerOrUninstallerScreen extends AbstractBean implements InstallerScreen, UninstallerScreen, InstallerEventListener
Abstract base class for screens that can be used in the installer or uninstaller. All methods that have a reasonable default answer are overridden in the class. This class saves the context that is set by the framework and provides getters for it.
-
-
Constructor Summary
Constructors Constructor Description AbstractInstallerOrUninstallerScreen()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivated()Called by the framework just after the screen has been activated.booleancancel()Called when the user clicks the "Cancel" button for this screen.voiddeactivated()Called by the framework just after the screen has been deactivated.AnchorgetAnchor()Returns a default value for the anchor of the screen component.ContextgetContext()Returns theContextthat the framework has associated with this custom screen in eithersetInstallerContextorsetUninstallerContext.InstallerContextgetInstallerContext()Returns theInstallerContextthat the framework has associated with this custom screen insetInstallerContext.ProgressInterfacegetProgressInterface(ProgressInterface defaultProgressInterface)Replace the default progress interface for actions with a custom progress interface.UninstallerContextgetUninstallerContext()Returns theUninstallerContextthat the framework has associated with this custom screen insetUninstallerContext.booleanhandleConsole(Console console)Handle the console mode.booleanhandleUnattended()Handle the unattended mode.voidinstallerEvent(InstallerEvent event)Called when an installer event is fired.booleanisCancelVisible()Returns whether the "Cancel" button is visible or not for this screen.booleanisCreateLazily()This method is called by the framework to determine if the screen should only be created when it is shown.booleanisHidden()Returns whether this screen should be hidden.booleanisHiddenForNext()Returns whether this screen should be hidden when the user traverses screens in the forward direction.booleanisHiddenForPrevious()Returns whether this screen should be hidden when the user traverses screens in the backward direction.booleanisNextVisible()Returns whether the "Next" button is visible or not for this screen.booleanisPreviousVisible()Returns whether the "Back" button is visible or not for this screen.booleannext()Called when the user clicks the "Next" button for this screen.booleanprevious()Called when the user clicks the "Back" button for this screen.voidsetInstallerContext(InstallerContext context)This method is called by the framework to set theInstallerContextjust after the screen has been constructed.voidsetUninstallerContext(UninstallerContext context)This method is called by the framework to set theUninstallerContext.voidwillActivate()Called by the framework just before the screen is activated.-
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.install4j.api.screens.Screen
createComponent, getSubTitle, getTitle
-
Methods inherited from interface com.install4j.api.beans.VisualContainerBean
isFillHorizontal, isFillVertical
-
-
-
-
Method Detail
-
setInstallerContext
public void setInstallerContext(InstallerContext context)
Description copied from interface:InstallerScreenThis method is called by the framework to set theInstallerContextjust after the screen has been constructed.- Specified by:
setInstallerContextin interfaceInstallerScreen- Parameters:
context- the installer context.
-
setUninstallerContext
public void setUninstallerContext(UninstallerContext context)
Description copied from interface:UninstallerScreenThis method is called by the framework to set theUninstallerContext.- Specified by:
setUninstallerContextin interfaceUninstallerScreen- Parameters:
context- the uninstaller context.
-
isNextVisible
public boolean isNextVisible()
Description copied from interface:ScreenReturns whether the "Next" button is visible or not for this screen. If you just want to disable the button initially, please overrideactivateand invokesetNextButtonEnabledin theWizardContextthat is available from theContextin GUI mode.In console or unattended mode, this method is never called.
- Specified by:
isNextVisiblein interfaceScreen- Returns:
trueorfalse. Default istrue.- See Also:
WizardContext
-
isPreviousVisible
public boolean isPreviousVisible()
Description copied from interface:ScreenReturns whether the "Back" button is visible or not for this screen. If you just want to disable the button initially, please overrideactivateand invokesetPreviousButtonEnabledin theWizardContextthat is available from theContextin GUI mode.In console or unattended mode, this method is never called.
- Specified by:
isPreviousVisiblein interfaceScreen- Returns:
trueorfalse. Default istrue.- See Also:
WizardContext
-
isCancelVisible
public boolean isCancelVisible()
Description copied from interface:ScreenReturns whether the "Cancel" button is visible or not for this screen. If you just want to disable the button initially, please overrideactivateand invokesetCancelButtonEnabledin theWizardContextthat is available from theContextin GUI mode.In console or unattended mode, this method is never called.
- Specified by:
isCancelVisiblein interfaceScreen- Returns:
trueorfalse. Default istrue.- See Also:
WizardContext
-
isHiddenForNext
public boolean isHiddenForNext()
Description copied from interface:ScreenReturns whether this screen should be hidden when the user traverses screens in the forward direction.This method is also called in console or unattended mode.
- Specified by:
isHiddenForNextin interfaceScreen- Returns:
trueorfalse.
-
isHiddenForPrevious
public boolean isHiddenForPrevious()
Description copied from interface:ScreenReturns whether this screen should be hidden when the user traverses screens in the backward direction.This method is also called in console or unattended mode.
- Specified by:
isHiddenForPreviousin interfaceScreen- Returns:
trueorfalse.
-
activated
public void activated()
Description copied from interface:ScreenCalled by the framework just after the screen has been activated. Override this method to perform any special initialization.In console or unattended mode, this method is never called.
-
deactivated
public void deactivated()
Description copied from interface:ScreenCalled by the framework just after the screen has been deactivated. Override this method to perform any special cleanup.In console or unattended mode, this method is never called.
- Specified by:
deactivatedin interfaceScreen
-
installerEvent
public void installerEvent(InstallerEvent event)
Description copied from interface:InstallerEventListenerCalled when an installer event is fired.- Specified by:
installerEventin interfaceInstallerEventListener- Parameters:
event- the event
-
next
public boolean next()
Description copied from interface:ScreenCalled when the user clicks the "Next" button for this screen. You can veto the change to the next screen if you returnfalse.In console or unattended mode, this method is never called.
-
previous
public boolean previous()
Description copied from interface:ScreenCalled when the user clicks the "Back" button for this screen. You can veto the change to the previous screen if you returnfalse.In console or unattended mode, this method is never called.
-
cancel
public boolean cancel()
Description copied from interface:ScreenCalled when the user clicks the "Cancel" button for this screen. You can veto the cancel action if you returnfalse.
-
willActivate
public void willActivate()
Description copied from interface:ScreenCalled by the framework just before the screen is activated. Override this method to perform any special initialization.In console or unattended mode, this method is never called.
- Specified by:
willActivatein interfaceScreen
-
getAnchor
public Anchor getAnchor()
Returns a default value for the anchor of the screen component.- Specified by:
getAnchorin interfaceVisualContainerBean- Returns:
Anchor.NORTHWEST- See Also:
VisualContainerBean.getAnchor()
-
isHidden
public boolean isHidden()
Description copied from interface:ScreenReturns whether this screen should be hidden. If this method returnstrue, it overrides the results ofisHiddenForNextandisHiddenForPrevious.This method is also called in console or unattended mode.
- Specified by:
isHiddenin interfaceScreen- Returns:
trueorfalse.- See Also:
Screen.isHiddenForNext(),Screen.isHiddenForPrevious()
-
handleUnattended
public boolean handleUnattended()
Description copied from interface:ScreenHandle the unattended mode. This method is called when the screen is traversed in unattended mode. There is no way to interact with the user. This method might be necessary to mirror some behavior from the GUI mode, such as setting installer variables or configuring actions.- Specified by:
handleUnattendedin interfaceScreen- Returns:
- whether the installer or uninstaller can proceed with the next screen or whether the process should be cancelled.
-
handleConsole
public boolean handleConsole(Console console) throws UserCanceledException
Description copied from interface:ScreenHandle the console mode. This method is called when the screen is entered in console mode. You can use theConsoleobject to interact with the user and replicate the GUI functionality on the terminal.If this screen has a form panel (i.e.
hasFormPanel()returnstrue), you should callFormEnvironment.handleConsolein this method to handle console mode for the contained form components.- Specified by:
handleConsolein interfaceScreen- Parameters:
console- theConsoleobject- Returns:
- whether the installer or uninstaller can proceed with the next screen or whether the process should be cancelled.
- Throws:
UserCanceledException- if the user cancels a question or notice. These exceptions are thrown by methods in theConsoleobject.- See Also:
FormEnvironment.handleConsole(Console)
-
getProgressInterface
public ProgressInterface getProgressInterface(ProgressInterface defaultProgressInterface)
Description copied from interface:ScreenReplace the default progress interface for actions with a custom progress interface. When associated actions are run for a screen, a default progress interface is passed to them. If your screen has the possibility to show progress information, you can return a different progress interface here. Typically you would only implement methods regarding status and detail messages as well as methods that apply to a progress bar, other methods can be delegated to the default progress interface. This is the strategy employed by the "Installation screen" and the customizable "Progress screens".- Specified by:
getProgressInterfacein interfaceScreen- Parameters:
defaultProgressInterface- the default progress interface- Returns:
- the replaced progress interface
-
isCreateLazily
public boolean isCreateLazily()
Description copied from interface:ScreenThis method is called by the framework to determine if the screen should only be created when it is shown. By default all screens provided by install4 are not created lazily. If you depend on custom code, that has to be installed beforeScreen.createComponent()can be called, then you should returntruein this method.If you have many screens that are created lazily and want to initialize them all at once, maybe after the "Install files" action, you can call
Context.initializeLazilyCreatedScreens().- Specified by:
isCreateLazilyin interfaceScreen- Returns:
trueorfalse.
-
getInstallerContext
public InstallerContext getInstallerContext()
Returns theInstallerContextthat the framework has associated with this custom screen insetInstallerContext.- Returns:
- the installer context or
nullif this screen is running in an uninstaller.
-
getUninstallerContext
public UninstallerContext getUninstallerContext()
Returns theUninstallerContextthat the framework has associated with this custom screen insetUninstallerContext.- Returns:
- the uninstaller context or
nullif this screen is running in an installer.
-
getContext
public Context getContext()
Returns theContextthat the framework has associated with this custom screen in eithersetInstallerContextorsetUninstallerContext.- Returns:
- the context.
-
-