java.lang.Objectcom.install4j.api.context.WizardIndex
public class WizardIndex
A wizard index is used to configure a display of overall installation progress on the left side of the wizard. Note that you can configure the wizard index on each screen in the install4j IDE. For more complex scenarios this API is provided.
By default, no wizard index is set. You can set a wizard index by calling
WizardContext.setWizardIndex(WizardIndex)
in a script.
If you install the wizard context in the "Pre-activation script" property, it will be used for the current screen.
When installed in any other scripts, set the wizard screen will become active once the next screen is shown.
The current wizard index is persistent, meaning that it will remain in place for all subsequent screens until the index key of the wizard is changed or the wizard index is set to null again. A simple usage scenario is given below:
context.getWizardContext().setWizardIndex(new WizardIndex(new String[] {"Gather Requirements", "Installation", "Service Setup"}));in the "Pre-activation" script of that screen. When the wizard context is set that way, the keys for the index steps are auto-generated and set to "1", "2" and "3". If they should be mnemonic, use the 2-arg constructor where you can specify an array with keys as the second argument. When you install the wizard index, the first step is highlighted automatically.
context.getWizardContext().setWizardIndexKey("2");to highlight step 2 ("Installation") and
context.getWizardContext().setWizardIndexKey("3");to highlight step 3 ("Service setup").
Advanced tasks:
context.getWizardContext().setWizardIndex(null);
new WizardIndex(new String[] {...}}.maxWidth(400).minWidth(50)
context.getWizardContext().setWizardIndex(new WizardIndex(new String[] {"Installation type"})).partiallyDefined(true);In the "Validation expression" of the screen, you then skip to to two different sequences of screens, depending on the selected installation type. In the first screens of each sequence, install new wizard indices with their full respective contents, but repeat the "Installation type" entry and set the selected wizard index key to the second element immediately. In this way, # the partially defined wizard index expands to the full content on the second screen.
Constructor Summary | |
---|---|
WizardIndex(java.lang.String[] stepNames)
Construct a wizard index with the specified step names and auto-generate the index keys to the strings "1", "2", "3", and so on. |
|
WizardIndex(java.lang.String[] stepNames,
java.lang.String[] keys)
Construct a wizard index with the specified step names and index keys. |
Method Summary | |
---|---|
WizardIndex |
background(java.awt.Color background)
Sets the background color of the index panel. |
WizardIndex |
backgroundImage(java.io.File backgroundImage)
Sets the background image file. |
WizardIndex |
backgroundImageAnchor(Anchor anchor)
Sets the anchor for the background image file. |
WizardIndex |
foreground(java.awt.Color foreground)
Sets the foreground color of the index panel. |
java.awt.Color |
getBackground()
Returns the background color of the index panel |
java.io.File |
getBackgroundImage()
Returns the background image file. |
Anchor |
getBackgroundImageAnchor()
Returns the anchor for the background image file. |
java.awt.Color |
getForeground()
Returns the foreground color of the index panel used for the text color |
java.lang.String |
getInitialKey()
Returns the key of the step name that should be initially selected |
java.lang.String[] |
getKeys()
Returns the index keys |
int |
getMaxWidth()
Returns the maximum width of the index panel |
int |
getMinWidth()
Returns the minimum width of the index panel. |
java.lang.String[] |
getStepNames()
Returns the step names |
WizardIndex |
initialKey(java.lang.String initialKey)
Sets the key of the step name that should be initially selected. |
boolean |
isNumbered()
Returns if numbers should be added in front of each index step. |
boolean |
isPartiallyDefined()
Returns of the wizard index is partially defined. |
WizardIndex |
maxWidth(int maxWidth)
Sets the maximum width of the index panel. |
WizardIndex |
minWidth(int minWidth)
Sets the minimum width of the index panel. |
WizardIndex |
numbered(boolean numbered)
Sets if numbers should be added in front of each index step. |
WizardIndex |
partiallyDefined(boolean partiallyDefined)
Sets if the wizard index should be partially defined. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WizardIndex(java.lang.String[] stepNames)
stepNames
- the displayed step namespublic WizardIndex(java.lang.String[] stepNames, java.lang.String[] keys)
stepNames
- the displayed step nameskeys
- the keys for the step names, to be used in WizardContext.setWizardIndexKey(String)
Method Detail |
---|
public java.lang.String[] getStepNames()
public java.lang.String[] getKeys()
public boolean isPartiallyDefined()
public WizardIndex partiallyDefined(boolean partiallyDefined)
partiallyDefined
- if partially defined
public int getMaxWidth()
public WizardIndex maxWidth(int maxWidth)
maxWidth
- the maximum width in pixels
public int getMinWidth()
public WizardIndex minWidth(int minWidth)
minWidth
- the minimum width
public boolean isNumbered()
public WizardIndex numbered(boolean numbered)
numbered
- true or false
public java.awt.Color getBackground()
public WizardIndex background(java.awt.Color background)
background
- the background color
public java.awt.Color getForeground()
public WizardIndex foreground(java.awt.Color foreground)
foreground
- the foreground color
public java.io.File getBackgroundImage()
public WizardIndex backgroundImage(java.io.File backgroundImage)
backgroundImage
- the image file
public Anchor getBackgroundImageAnchor()
public WizardIndex backgroundImageAnchor(Anchor anchor)
anchor
- the anchor
public java.lang.String getInitialKey()
public WizardIndex initialKey(java.lang.String initialKey)
initialKey
- the key