com.izforge.izpack.installer.panel
Class AbstractPanels<T extends AbstractPanelView<V>,V>

java.lang.Object
  extended by com.izforge.izpack.installer.panel.AbstractPanels<T,V>
All Implemented Interfaces:
Panels, PanelViews<T,V>
Direct Known Subclasses:
AutomatedPanels, ConsolePanels, IzPanels

public abstract class AbstractPanels<T extends AbstractPanelView<V>,V>
extends Object
implements PanelViews<T,V>

Abstract implementation of the PanelViews interface.

Author:
Tim Anderson

Constructor Summary
AbstractPanels(List<T> panels, InstallData installData)
          Constructs an AbstractPanels.
 
Method Summary
protected  boolean executeValidationActions(T panel, boolean validate)
          Executes any pre and post-validation actions for a panel.
 int getIndex()
          Returns the current panel index.
 int getNext(boolean visibleOnly)
          Determines if there is another panel after the current index.
 int getNext(int index, boolean visibleOnly)
          Determines if there is another panel after the specified index.
 Panel getPanel()
          Returns the current panel.
 List<Panel> getPanels()
          Returns the panels.
 T getPanelView()
          Returns the current panel view.
 List<T> getPanelViews()
          Returns the panel views.
 int getPrevious(boolean visibleOnly)
          Determines if there is another panel prior to the specified index.
 int getPrevious(int index, boolean visibleOnly)
          Determines if there is another panel prior to the specified index.
 V getView()
          Returns the current view.
 int getVisible()
          Returns the number of visible panels.
 int getVisibleIndex(T panel)
          Returns the index of a visible panel, relative to other visible panels.
 boolean hasNext()
          Determines if there is another panel after the current panel.
 boolean hasPrevious()
          Determines if there is panel prior to the current panel.
 boolean isValid()
          Determines if the current panel is valid.
 boolean next()
          Navigates to the next panel.
 boolean next(boolean validate)
          Navigates to the next panel.
 boolean previous()
          Navigates to the previous panel.
 boolean previous(int index)
          Navigates to the panel before the specified index.
 boolean switchPanel(int newIndex, boolean validate)
          TODO: validate parameter not used - refactor this Switches panels.
protected abstract  boolean switchPanel(T newPanel, T oldPanel)
          Switches panels.
 void writeInstallationRecord(File file, UninstallData uninstallData)
          Writes an XML tree to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPanels

public AbstractPanels(List<T> panels,
                      InstallData installData)
Constructs an AbstractPanels.

Parameters:
panels - the panels
installData -
Method Detail

getPanels

public List<Panel> getPanels()
Returns the panels.

Specified by:
getPanels in interface Panels
Returns:
the panels

getPanel

public Panel getPanel()
Returns the current panel.

Specified by:
getPanel in interface Panels
Returns:
the current panel, or null if there is no current panel

getPanelViews

public List<T> getPanelViews()
Returns the panel views.

Specified by:
getPanelViews in interface PanelViews<T extends AbstractPanelView<V>,V>
Returns:
the panel views

getView

public V getView()
Returns the current view.

Specified by:
getView in interface PanelViews<T extends AbstractPanelView<V>,V>
Returns:
the current view, or null if there is none

getPanelView

public T getPanelView()
Returns the current panel view.

Specified by:
getPanelView in interface PanelViews<T extends AbstractPanelView<V>,V>
Returns:
the current panel view, or null if there is none

isValid

public boolean isValid()
Determines if the current panel is valid.

Specified by:
isValid in interface Panels
Returns:
true if the current panel is valid

getIndex

public int getIndex()
Returns the current panel index.

Specified by:
getIndex in interface Panels
Returns:
the current panel index, or -1 if there is no current panel

hasNext

public boolean hasNext()
Determines if there is another panel after the current panel.

Specified by:
hasNext in interface Panels
Returns:
true if there is another panel

next

public boolean next()
Navigates to the next panel.
Navigation can only occur if the current panel is valid.

Specified by:
next in interface Panels
Returns:
true if the next panel was navigated to

next

public boolean next(boolean validate)
Navigates to the next panel.

Specified by:
next in interface Panels
Parameters:
validate - if true, only move to the next panel if validation succeeds
Returns:
true if the next panel was navigated to

hasPrevious

public boolean hasPrevious()
Determines if there is panel prior to the current panel.

Specified by:
hasPrevious in interface Panels
Returns:
true if there is a panel prior to the current panel

previous

public boolean previous()
Navigates to the previous panel.

Specified by:
previous in interface Panels
Returns:
true if the previous panel was navigated to

previous

public boolean previous(int index)
Navigates to the panel before the specified index.
The target panel must be before the current panel.

Specified by:
previous in interface Panels
Returns:
true if the previous panel was navigated to

getNext

public int getNext(int index,
                   boolean visibleOnly)
Determines if there is another panel after the specified index.

Specified by:
getNext in interface Panels
Parameters:
index - the panel index
visibleOnly - if true, only examine visible panels
Returns:
true if there is another panel

getNext

public int getNext(boolean visibleOnly)
Determines if there is another panel after the current index.

Specified by:
getNext in interface Panels
Parameters:
visibleOnly - if true, only examine visible panels
Returns:
true if there is another panel

getPrevious

public int getPrevious(int index,
                       boolean visibleOnly)
Determines if there is another panel prior to the specified index.

Specified by:
getPrevious in interface Panels
Parameters:
index - the panel index
visibleOnly - if true, only examine visible panels
Returns:
the previous panel index, or -1 if there are no more panels

getPrevious

public int getPrevious(boolean visibleOnly)
Determines if there is another panel prior to the specified index.

Specified by:
getPrevious in interface Panels
Parameters:
visibleOnly - if true, only examine visible panels
Returns:
the previous panel index, or -1 if there are no more panels

getVisibleIndex

public int getVisibleIndex(T panel)
Returns the index of a visible panel, relative to other visible panels.

Specified by:
getVisibleIndex in interface PanelViews<T extends AbstractPanelView<V>,V>
Parameters:
panel - the panel
Returns:
the panel's visible index, or -1 if the panel is not visible

getVisible

public int getVisible()
Returns the number of visible panels.

Specified by:
getVisible in interface Panels
Returns:
the number of visible panels

writeInstallationRecord

public void writeInstallationRecord(File file,
                                    UninstallData uninstallData)
                             throws Exception
Description copied from interface: PanelViews
Writes an XML tree to a file.

Specified by:
writeInstallationRecord in interface PanelViews<T extends AbstractPanelView<V>,V>
Parameters:
file - file of where the auto-install will be placed
uninstallData - used to ensure that the file will be removed by the uninstaller
Throws:
Exception

switchPanel

public boolean switchPanel(int newIndex,
                           boolean validate)
TODO: validate parameter not used - refactor this Switches panels.

Parameters:
newIndex - the index of the new panel
Returns:
true if the switch was successful

switchPanel

protected abstract boolean switchPanel(T newPanel,
                                       T oldPanel)
Switches panels.

Parameters:
newPanel - the panel to switch to
oldPanel - the panel to switch from, or null if there was no prior panel
Returns:
true if the switch was successful

executeValidationActions

protected boolean executeValidationActions(T panel,
                                           boolean validate)
Executes any pre and post-validation actions for a panel.

Parameters:
panel - the panel
validate - if true, validate the panel after executing the pre-validation actions
Returns:
true if the panel is valid


Copyright © 2018. All rights reserved.