com.izforge.izpack.panels
Class UserInputPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.izforge.izpack.installer.IzPanel
                      extended by com.izforge.izpack.panels.UserInputPanel
All Implemented Interfaces:
LayoutConstants, AbstractUIHandler, java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.ItemListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.SwingConstants

public class UserInputPanel
extends IzPanel
implements java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.FocusListener

See Also:
Serialized Form

Nested Class Summary
private  class UserInputPanel.SearchField
          This class encapsulates a lot of search field functionality.
private static class UserInputPanel.TextValuePair
          This class can be used to associate a text string and a (text) value.
 
Nested classes/interfaces inherited from class com.izforge.izpack.installer.IzPanel
IzPanel.Filler
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private static java.lang.String ALIGNMENT
           
protected static java.lang.String ATTRIBUTE_CONDITIONID_NAME
           
protected static java.lang.String ATTRIBUTE_VARIABLE_NAME
           
protected static java.lang.String ATTRIBUTE_VARIABLE_VALUE
           
private static java.lang.String BOLD
           
private  java.util.Vector<javax.swing.ButtonGroup> buttonGroups
          Holds the references to all radio button groups
private static java.lang.String CENTER
           
private static java.lang.String CHECK_FIELD
           
protected static java.lang.String CLASS
           
private static java.lang.String COMBO_CHOICE
           
private static java.lang.String COMBO_FIELD
           
private static java.lang.String COMBO_VALUE
           
private static java.lang.String DESCRIPTION
           
private static java.lang.String DIR_FIELD
           
private static java.lang.String DIVIDER_FIELD
           
private  java.util.Vector<UIElement> elements
           
private  java.util.Vector<UserInputPanel.TextValuePair> entries
          Holds all user inputs for use in automated installation
private  boolean eventsActivated
           
private static java.lang.String FALSE
           
private static java.lang.String FAMILY
           
private static java.lang.String FIELD_NODE_ID
           
private static java.lang.String FILE_FIELD
           
private  boolean haveSpec
           
protected static java.lang.String ICON_KEY
           
private static java.lang.String INSTANCE_IDENTIFIER
           
private static int instanceCount
           
protected  int instanceNumber
           
private static java.lang.String ITALICS
           
protected static java.lang.String KEY
           
private static java.lang.String LANG_FILE_NAME
           
private  LocaleDatabase langpack
           
private static java.lang.String LEFT
           
private static java.lang.String MULTIPLE_FILE_FIELD
           
private static java.lang.String NAME
           
private static java.lang.String NODE_ID
          how the spec node for a specific panel is identified
private static java.lang.String OS
           
private  boolean packsDefined
          If there is a possibility that some UI elements will not get added we can not allow to go back to the PacksPanel, because the process of building the UI is not reversable.
private  javax.swing.JPanel panel
           
protected static java.lang.String PANEL_IDENTIFIER
           
private  InstallerFrame parentFrame
           
private  java.util.Vector<PasswordGroup> passwordGroups
          Holds the references to all password field groups
private  java.util.Vector passwordGroupsRead
          used for temporary storage of references to password groups that have already been read in a given read cycle.
private static java.lang.String PROCESSOR
           
private static java.lang.String PWD_FIELD
           
private static java.lang.String PWD_INPUT
           
private static java.lang.String PWD_SIZE
           
private static java.lang.String RADIO_CHOICE
           
private static java.lang.String RADIO_FIELD
           
private static java.lang.String RADIO_VALUE
           
private static java.lang.String REVALIDATE
           
private static java.lang.String RIGHT
           
private static java.lang.String RULE_DISPLAY_FORMAT
           
private static java.lang.String RULE_ENCRYPTED
           
private static java.lang.String RULE_FIELD
           
private static java.lang.String RULE_LAYOUT
           
protected static java.lang.String RULE_PARAM
           
protected static java.lang.String RULE_PARAM_NAME
           
protected static java.lang.String RULE_PARAM_VALUE
           
private static java.lang.String RULE_PLAIN_STRING
           
private static java.lang.String RULE_RESULT_FORMAT
           
private static java.lang.String RULE_SEPARATOR
           
private static java.lang.String RULE_SPECIAL_SEPARATOR
           
private static java.lang.String SEARCH_CHECKFILENAME
           
private static java.lang.String SEARCH_CHOICE
           
private static java.lang.String SEARCH_DIRECTORY
           
private static java.lang.String SEARCH_FIELD
           
private static java.lang.String SEARCH_FILE
           
private static java.lang.String SEARCH_FILENAME
           
private static java.lang.String SEARCH_PARENTDIR
           
private static java.lang.String SEARCH_RESULT
           
private static java.lang.String SEARCH_TYPE
           
private static java.lang.String SEARCH_VALUE
           
private  java.util.Vector<UserInputPanel.SearchField> searchFields
          Used to track search fields.
private static java.lang.String SELECTEDPACKS
           
private static long serialVersionUID
           
private static java.lang.String SET
           
private static java.lang.String SIZE
           
private static java.lang.String SPACE_FIELD
           
private  IXMLElement spec
          The parsed result from reading the XML specification from the file
private static java.lang.String SPEC
           
private static java.lang.String SPEC_FILE_NAME
          The name of the XML file that specifies the panel layout
private static java.lang.String STATIC_TEXT
           
protected static java.lang.String TEXT
           
private static java.lang.String TEXT_FIELD
           
private static java.lang.String TEXT_ROWS
           
private static java.lang.String TEXT_SIZE
           
private static java.lang.String TITLE_FIELD
           
private static java.lang.String TOP
           
private static java.lang.String TOPBUFFER
           
private static java.lang.String TRUE
           
private static java.lang.String TYPE
           
private static java.lang.String UNSELECTEDPACKS
           
private  boolean validating
           
protected static java.lang.String VALIDATOR
           
private static java.lang.String VARIABLE
           
protected static java.lang.String VARIABLE_NODE
           
 
Fields inherited from class com.izforge.izpack.installer.IzPanel
COLS_1, d, D, headline, HEADLINE, headLineLabel, hidden, idata, initialFocus, layoutHelper, metadata, myClassname, myFullClassname, myPrefix, parent, ROWS_1, X_ORIGIN, Y_ORIGIN
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.izforge.izpack.util.AbstractUIHandler
ANSWER_CANCEL, ANSWER_NO, ANSWER_YES, CHOICES_YES_NO, CHOICES_YES_NO_CANCEL
 
Fields inherited from interface com.izforge.izpack.gui.LayoutConstants
ABSOLUTE_STRETCH, ALL_GAP, AUTOMATIC_GAP, CONTROL_CONSTRAINT, CONTROL_GAP, CONTROL_TO_LABEL_GAP, CONTROL_TO_TEXT_GAP, CURRENT_COLUMN, CURRENT_ROW, DEFAULT_CONTROL_ALIGNMENT, DEFAULT_LABEL_ALIGNMENT, DEFAULT_TEXT_ALIGNMENT, FILL_OUT_COLUMN_HEIGHT, FILL_OUT_COLUMN_SIZE, FILL_OUT_COLUMN_WIDTH, FILLER1_GAP, FILLER13_GAP, FILLER2_GAP, FILLER4_GAP, FILLER5_GAP, FULL_COLUMN_STRETCH, FULL_LINE_COMPONENT_CONSTRAINT, FULL_LINE_CONTROL_CONSTRAINT, FULL_LINE_STRETCH, GAP_LOAD_MARKER, LABEL_CONSTRAINT, LABEL_GAP, LABEL_TO_CONTROL_GAP, LABEL_TO_TEXT_GAP, NEXT_COLUMN, NEXT_LINE, NEXT_ROW, NO_FILL_OUT_COLUMN, NO_GAP, NO_STRETCH, PARAGRAPH_GAP, RELATIVE_STRETCH, TEXT_CONSTRAINT, TEXT_GAP, TEXT_TO_CONTROL_GAP, TEXT_TO_LABEL_GAP, TOP_GAP, XDUMMY_CONSTRAINT, XY_VARIABLE_CONSTRAINT, YDUMMY_CONSTRAINT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, EAST, HORIZONTAL, LEADING, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, SOUTH, SOUTH_EAST, SOUTH_WEST, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
UserInputPanel(InstallerFrame parent, InstallData installData)
          Constructs a UserInputPanel.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
private  void addCheckBox(IXMLElement spec)
          Adds a chackbox to the list of UI elements.
private  void addComboBox(IXMLElement spec)
          Adds a combo box to the list of UI elements.
private  void addDescription(IXMLElement spec, java.util.Vector<IXMLElement> forPacks, java.util.Vector<IXMLElement> forOs)
          Adds a description to the list of UI elements.
private  void addDirectoryField(IXMLElement field)
           
private  void addDivider(IXMLElement spec)
          Adds a dividing line to the list of UI elements act as separator.
private  void addFileField(IXMLElement field)
           
private  void addMultipleFileField(IXMLElement field)
           
private  void addPasswordField(IXMLElement spec)
          Adds one or more password fields to the list of UI elements.
private  void addRadioButton(IXMLElement spec)
          Adds a radio button set to the list of UI elements.
private  void addRuleField(IXMLElement spec)
          Adds a rule field to the list of UI elements.
private  void addSearch(IXMLElement spec)
          Adds a search field to the list of UI elements.
private  void addSpace(IXMLElement spec)
          Adds a dummy field to the list of UI elements to act as spacer.
private  void addText(IXMLElement spec)
          Adds text to the list of UI elements
private  void addTextField(IXMLElement spec)
          Adds a text field to the list of UI elements
private  void addTitle(IXMLElement spec)
          Adds the title to the panel.
private  java.util.List<ValidatorContainer> analyzeValidator(IXMLElement specElement)
           
private  void buildUI()
          Builds the UI and makes it ready for display
private  void createBuiltInVariableConditions(java.lang.String variable)
           
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
private  int getAlignment(IXMLElement element)
          Retreives the alignment setting for the IXMLElement.
private  boolean getBoolean(IXMLElement element, java.lang.String attribute, boolean defaultValue)
          Retrieves the value of a boolean attribute.
private  float getFloat(IXMLElement element, java.lang.String attribute, float defaultValue)
          Retrieves the value of a floating point attribute.
protected  java.lang.String getIconName(IXMLElement element)
           
private  java.lang.String getText(IXMLElement element)
          Extracts the text from an IXMLElement.
protected  void init()
           
 boolean isValidated()
          Indicates wether the panel has been validated or not.
private  boolean itemRequiredFor(java.util.Vector<IXMLElement> packs)
          Verifies if an item is required for any of the packs listed.
 boolean itemRequiredForOs(java.util.Vector<IXMLElement> os)
          Verifies if an item is required for the operating system the installer executed.
private  boolean itemRequiredForUnselected(java.util.Vector<IXMLElement> packs)
          Verifies if an item is required for any of the packs listed.
 void itemStateChanged(java.awt.event.ItemEvent arg0)
           
 void makeXMLData(IXMLElement panelRoot)
          Asks the panel to set its own XML data that can be brought back for an automated installation process.
 void panelActivate()
          This method is called when the panel becomes active.
private  boolean readCheckBox(UIElement field)
          Reads the content of the checkbox field and substitutes the associated variable.
private  boolean readComboBox(UIElement field)
          Reads the content of the combobox field and substitutes the associated variable.
private  boolean readDirectoryField(UIElement field)
           
private  boolean readFileField(UIElement field)
           
private  boolean readInput()
          Reads the input data from all UI elements and sets the associated variables.
private  boolean readMultipleFileField(UIElement field)
           
private  boolean readPasswordField(UIElement field)
          Reads the content of the password field and substitutes the associated variable.
private  boolean readRadioButton(UIElement field)
          Reads the content of the radio button field and substitutes the associated variable.
private  boolean readRuleField(UIElement field)
          Reads the data from the rule input field and sets the associated variable.
private  boolean readSearch(UIElement field)
          Reads the content of the search field and substitutes the associated variable.
private  void readSpec()
          Reads the XML specification for the panel layout.
private  boolean readTextField(UIElement field)
          Reads data from the text field and sets the associated variable.
private  void showMessageDialog(InstallerFrame parentFrame, java.lang.String message, java.lang.String caption, int messageType)
          Show localized message dialog basing on given parameters.
private  void showWarningMessageDialog(InstallerFrame parentFrame, java.lang.String message)
          Show localized warning message dialog basing on given parameters.
private  void updateDialog()
           
protected  void updateUIElements()
           
protected  void updateVariables()
           
 
Methods inherited from class com.izforge.izpack.installer.IzPanel
addPostValidationAction, addPreActivationAction, addPreValidationAction, askQuestion, askQuestion, buildHeadline, canShowHelp, completeGridBagLayout, createLabel, createLabel, createLabel, createLabel, createMultiLineLabel, createMultiLineLabel, createMultiLineLabelLang, emitError, emitErrorAndBlockNext, emitNotification, emitNotificationFeedback, emitWarning, executePostValidationActions, executePreActivationActions, executePreValidationActions, getClassName, getControlTextFont, getDefaultGridBagConstraints, getHelpUrl, getI18nStringForClass, getI18nStringForClass, getImageIcon, getInitialFocus, getInstallerFrame, getLAF, getLayoutHelper, getMetadata, getNewGridBagConstraints, getNewGridBagConstraints, getNextXGridBagConstraints, getNextYGridBagConstraints, getNextYGridBagConstraints, getString, getSummaryBody, getSummaryCaption, getValidationService, init, initLayoutHelper, isHidden, panelDeactivate, panelValidated, parseText, resetGridCounter, setDefaultGridBagConstraints, setHelps, setHidden, setInitialFocus, setMetadata, setValidationService, showHelp, startGridBagLayout
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

ICON_KEY

protected static final java.lang.String ICON_KEY
See Also:
Constant Field Values

SPEC_FILE_NAME

private static final java.lang.String SPEC_FILE_NAME
The name of the XML file that specifies the panel layout

See Also:
Constant Field Values

LANG_FILE_NAME

private static final java.lang.String LANG_FILE_NAME
See Also:
Constant Field Values

NODE_ID

private static final java.lang.String NODE_ID
how the spec node for a specific panel is identified

See Also:
Constant Field Values

FIELD_NODE_ID

private static final java.lang.String FIELD_NODE_ID
See Also:
Constant Field Values

INSTANCE_IDENTIFIER

private static final java.lang.String INSTANCE_IDENTIFIER
See Also:
Constant Field Values

PANEL_IDENTIFIER

protected static final java.lang.String PANEL_IDENTIFIER
See Also:
Constant Field Values

TYPE

private static final java.lang.String TYPE
See Also:
Constant Field Values

DESCRIPTION

private static final java.lang.String DESCRIPTION
See Also:
Constant Field Values

VARIABLE

private static final java.lang.String VARIABLE
See Also:
Constant Field Values

TEXT

protected static final java.lang.String TEXT
See Also:
Constant Field Values

KEY

protected static final java.lang.String KEY
See Also:
Constant Field Values

SPEC

private static final java.lang.String SPEC
See Also:
Constant Field Values

SET

private static final java.lang.String SET
See Also:
Constant Field Values

REVALIDATE

private static final java.lang.String REVALIDATE
See Also:
Constant Field Values

TOPBUFFER

private static final java.lang.String TOPBUFFER
See Also:
Constant Field Values

TRUE

private static final java.lang.String TRUE
See Also:
Constant Field Values

FALSE

private static final java.lang.String FALSE
See Also:
Constant Field Values

ALIGNMENT

private static final java.lang.String ALIGNMENT
See Also:
Constant Field Values

LEFT

private static final java.lang.String LEFT
See Also:
Constant Field Values

CENTER

private static final java.lang.String CENTER
See Also:
Constant Field Values

RIGHT

private static final java.lang.String RIGHT
See Also:
Constant Field Values

TOP

private static final java.lang.String TOP
See Also:
Constant Field Values

ITALICS

private static final java.lang.String ITALICS
See Also:
Constant Field Values

BOLD

private static final java.lang.String BOLD
See Also:
Constant Field Values

SIZE

private static final java.lang.String SIZE
See Also:
Constant Field Values

VALIDATOR

protected static final java.lang.String VALIDATOR
See Also:
Constant Field Values

PROCESSOR

private static final java.lang.String PROCESSOR
See Also:
Constant Field Values

CLASS

protected static final java.lang.String CLASS
See Also:
Constant Field Values

TITLE_FIELD

private static final java.lang.String TITLE_FIELD
See Also:
Constant Field Values

TEXT_FIELD

private static final java.lang.String TEXT_FIELD
See Also:
Constant Field Values

TEXT_SIZE

private static final java.lang.String TEXT_SIZE
See Also:
Constant Field Values

TEXT_ROWS

private static final java.lang.String TEXT_ROWS
See Also:
Constant Field Values

STATIC_TEXT

private static final java.lang.String STATIC_TEXT
See Also:
Constant Field Values

COMBO_FIELD

private static final java.lang.String COMBO_FIELD
See Also:
Constant Field Values

COMBO_CHOICE

private static final java.lang.String COMBO_CHOICE
See Also:
Constant Field Values

COMBO_VALUE

private static final java.lang.String COMBO_VALUE
See Also:
Constant Field Values

RADIO_FIELD

private static final java.lang.String RADIO_FIELD
See Also:
Constant Field Values

RADIO_CHOICE

private static final java.lang.String RADIO_CHOICE
See Also:
Constant Field Values

RADIO_VALUE

private static final java.lang.String RADIO_VALUE
See Also:
Constant Field Values

SPACE_FIELD

private static final java.lang.String SPACE_FIELD
See Also:
Constant Field Values

DIVIDER_FIELD

private static final java.lang.String DIVIDER_FIELD
See Also:
Constant Field Values

CHECK_FIELD

private static final java.lang.String CHECK_FIELD
See Also:
Constant Field Values

RULE_FIELD

private static final java.lang.String RULE_FIELD
See Also:
Constant Field Values

RULE_LAYOUT

private static final java.lang.String RULE_LAYOUT
See Also:
Constant Field Values

RULE_SEPARATOR

private static final java.lang.String RULE_SEPARATOR
See Also:
Constant Field Values

RULE_RESULT_FORMAT

private static final java.lang.String RULE_RESULT_FORMAT
See Also:
Constant Field Values

RULE_PLAIN_STRING

private static final java.lang.String RULE_PLAIN_STRING
See Also:
Constant Field Values

RULE_DISPLAY_FORMAT

private static final java.lang.String RULE_DISPLAY_FORMAT
See Also:
Constant Field Values

RULE_SPECIAL_SEPARATOR

private static final java.lang.String RULE_SPECIAL_SEPARATOR
See Also:
Constant Field Values

RULE_ENCRYPTED

private static final java.lang.String RULE_ENCRYPTED
See Also:
Constant Field Values

RULE_PARAM_NAME

protected static final java.lang.String RULE_PARAM_NAME
See Also:
Constant Field Values

RULE_PARAM_VALUE

protected static final java.lang.String RULE_PARAM_VALUE
See Also:
Constant Field Values

RULE_PARAM

protected static final java.lang.String RULE_PARAM
See Also:
Constant Field Values

PWD_FIELD

private static final java.lang.String PWD_FIELD
See Also:
Constant Field Values

PWD_INPUT

private static final java.lang.String PWD_INPUT
See Also:
Constant Field Values

PWD_SIZE

private static final java.lang.String PWD_SIZE
See Also:
Constant Field Values

SEARCH_FIELD

private static final java.lang.String SEARCH_FIELD
See Also:
Constant Field Values

FILE_FIELD

private static final java.lang.String FILE_FIELD
See Also:
Constant Field Values

DIR_FIELD

private static final java.lang.String DIR_FIELD
See Also:
Constant Field Values

SEARCH_CHOICE

private static final java.lang.String SEARCH_CHOICE
See Also:
Constant Field Values

SEARCH_FILENAME

private static final java.lang.String SEARCH_FILENAME
See Also:
Constant Field Values

SEARCH_RESULT

private static final java.lang.String SEARCH_RESULT
See Also:
Constant Field Values

SEARCH_VALUE

private static final java.lang.String SEARCH_VALUE
See Also:
Constant Field Values

SEARCH_TYPE

private static final java.lang.String SEARCH_TYPE
See Also:
Constant Field Values

SEARCH_FILE

private static final java.lang.String SEARCH_FILE
See Also:
Constant Field Values

SEARCH_DIRECTORY

private static final java.lang.String SEARCH_DIRECTORY
See Also:
Constant Field Values

SEARCH_PARENTDIR

private static final java.lang.String SEARCH_PARENTDIR
See Also:
Constant Field Values

SEARCH_CHECKFILENAME

private static final java.lang.String SEARCH_CHECKFILENAME
See Also:
Constant Field Values

SELECTEDPACKS

private static final java.lang.String SELECTEDPACKS
See Also:
Constant Field Values

UNSELECTEDPACKS

private static final java.lang.String UNSELECTEDPACKS
See Also:
Constant Field Values

ATTRIBUTE_CONDITIONID_NAME

protected static final java.lang.String ATTRIBUTE_CONDITIONID_NAME
See Also:
Constant Field Values

VARIABLE_NODE

protected static final java.lang.String VARIABLE_NODE
See Also:
Constant Field Values

ATTRIBUTE_VARIABLE_NAME

protected static final java.lang.String ATTRIBUTE_VARIABLE_NAME
See Also:
Constant Field Values

ATTRIBUTE_VARIABLE_VALUE

protected static final java.lang.String ATTRIBUTE_VARIABLE_VALUE
See Also:
Constant Field Values

NAME

private static final java.lang.String NAME
See Also:
Constant Field Values

OS

private static final java.lang.String OS
See Also:
Constant Field Values

FAMILY

private static final java.lang.String FAMILY
See Also:
Constant Field Values

MULTIPLE_FILE_FIELD

private static final java.lang.String MULTIPLE_FILE_FIELD
See Also:
Constant Field Values

instanceCount

private static int instanceCount

instanceNumber

protected int instanceNumber

packsDefined

private boolean packsDefined
If there is a possibility that some UI elements will not get added we can not allow to go back to the PacksPanel, because the process of building the UI is not reversable. This variable keeps track if any packs have been defined and will be used to make a decision for locking the 'previous' button.


parentFrame

private InstallerFrame parentFrame

spec

private IXMLElement spec
The parsed result from reading the XML specification from the file


haveSpec

private boolean haveSpec

buttonGroups

private java.util.Vector<javax.swing.ButtonGroup> buttonGroups
Holds the references to all radio button groups


passwordGroups

private java.util.Vector<PasswordGroup> passwordGroups
Holds the references to all password field groups


passwordGroupsRead

private java.util.Vector passwordGroupsRead
used for temporary storage of references to password groups that have already been read in a given read cycle.


searchFields

private java.util.Vector<UserInputPanel.SearchField> searchFields
Used to track search fields. Contains SearchField references.


entries

private java.util.Vector<UserInputPanel.TextValuePair> entries
Holds all user inputs for use in automated installation


langpack

private LocaleDatabase langpack

validating

private boolean validating

eventsActivated

private boolean eventsActivated

elements

private java.util.Vector<UIElement> elements

panel

private javax.swing.JPanel panel
Constructor Detail

UserInputPanel

public UserInputPanel(InstallerFrame parent,
                      InstallData installData)
Constructs a UserInputPanel.

Parameters:
parent - reference to the application frame
installData - shared information about the installation
Method Detail

createBuiltInVariableConditions

private void createBuiltInVariableConditions(java.lang.String variable)

init

protected void init()

analyzeValidator

private java.util.List<ValidatorContainer> analyzeValidator(IXMLElement specElement)

addDirectoryField

private void addDirectoryField(IXMLElement field)

addMultipleFileField

private void addMultipleFileField(IXMLElement field)

addFileField

private void addFileField(IXMLElement field)

updateUIElements

protected void updateUIElements()

isValidated

public boolean isValidated()
Indicates wether the panel has been validated or not. The installer won't let the user go further through the installation process until the panel is validated. Default behavior is to return true.

Overrides:
isValidated in class IzPanel
Returns:
A boolean stating wether the panel has been validated or not.

panelActivate

public void panelActivate()
This method is called when the panel becomes active.

Overrides:
panelActivate in class IzPanel

makeXMLData

public void makeXMLData(IXMLElement panelRoot)
Asks the panel to set its own XML data that can be brought back for an automated installation process. Use it as a blackbox if your panel needs to do something even in automated mode.

Overrides:
makeXMLData in class IzPanel
Parameters:
panelRoot - The XML root element of the panels blackbox tree.

buildUI

private void buildUI()
Builds the UI and makes it ready for display


readInput

private boolean readInput()
Reads the input data from all UI elements and sets the associated variables.

Returns:
true if the operation is successdul, otherwise false.

readDirectoryField

private boolean readDirectoryField(UIElement field)

readFileField

private boolean readFileField(UIElement field)

readMultipleFileField

private boolean readMultipleFileField(UIElement field)

readSpec

private void readSpec()
               throws java.lang.Exception
Reads the XML specification for the panel layout. The result is stored in spec.

Throws:
java.lang.Exception - for any problems in reading the specification

addTitle

private void addTitle(IXMLElement spec)
Adds the title to the panel. There can only be one title, if mutiple titles are defined, they keep overwriting what has already be defined, so that the last definition is the one that prevails.

Parameters:
spec - a IXMLElement containing the specification for the title.

getIconName

protected java.lang.String getIconName(IXMLElement element)

addRuleField

private void addRuleField(IXMLElement spec)
Adds a rule field to the list of UI elements.

Parameters:
spec - a IXMLElement containing the specification for the rule field.

readRuleField

private boolean readRuleField(UIElement field)
Reads the data from the rule input field and sets the associated variable.

Parameters:
field - the object array that holds the details of the field.
Returns:
true if there was no problem reading the data or if there was an irrecovarable problem. If there was a problem that can be corrected by the operator, an error dialog is popped up and false is returned.

addTextField

private void addTextField(IXMLElement spec)
Adds a text field to the list of UI elements

Parameters:
spec - a IXMLElement containing the specification for the text field.

readTextField

private boolean readTextField(UIElement field)
Reads data from the text field and sets the associated variable.

Parameters:
field - the object array that holds the details of the field.
Returns:
true if there was no problem reading the data or if there was an irrecovarable problem. If there was a problem that can be corrected by the operator, an error dialog is popped up and false is returned.

addComboBox

private void addComboBox(IXMLElement spec)
Adds a combo box to the list of UI elements.
This is a complete example of a valid XML specification

 <p/>
 <p/>
 <p/>
      <field type="combo" variable="testVariable">
        <description text="Description for the combo box" id="a key for translated text"/>
        <spec text="label" id="key for the label"/>
          <choice text="choice 1" id="" value="combo box 1"/>
          <choice text="choice 2" id="" value="combo box 2" set="true"/>
          <choice text="choice 3" id="" value="combo box 3"/>
          <choice text="choice 4" id="" value="combo box 4"/>
        </spec>
      </field>
 <p/>
 <p/>
 <p/>
 

Parameters:
spec - a IXMLElement containing the specification for the combo box.

readComboBox

private boolean readComboBox(UIElement field)
Reads the content of the combobox field and substitutes the associated variable.

Parameters:
field - the object array that holds the details of the field.
Returns:
true if there was no problem reading the data or if there was an irrecovarable problem. If there was a problem that can be corrected by the operator, an error dialog is popped up and false is returned.

addRadioButton

private void addRadioButton(IXMLElement spec)
Adds a radio button set to the list of UI elements.
This is a complete example of a valid XML specification

 <p/>
 <p/>
 <p/>
      <field type="radio" variable="testVariable">
        <description text="Description for the radio buttons" id="a key for translated text"/>
        <spec text="label" id="key for the label"/>
          <choice text="radio 1" id="" value=""/>
          <choice text="radio 2" id="" value="" set="true"/>
          <choice text="radio 3" id="" value=""/>
          <choice text="radio 4" id="" value=""/>
          <choice text="radio 5" id="" value=""/>
        </spec>
      </field>
 <p/>
 <p/>
 <p/>
 

Parameters:
spec - a IXMLElement containing the specification for the radio button set.

readRadioButton

private boolean readRadioButton(UIElement field)
Reads the content of the radio button field and substitutes the associated variable.

Parameters:
field - the object array that holds the details of the field.
Returns:
true if there was no problem reading the data or if there was an irrecovarable problem. If there was a problem that can be corrected by the operator, an error dialog is popped up and false is returned.

addPasswordField

private void addPasswordField(IXMLElement spec)
Adds one or more password fields to the list of UI elements.
This is a complete example of a valid XML specification

 <p/>
 <p/>
 <p/>
      <field type="password" variable="testVariable">
        <description align="left" txt="Please enter your password" id="a key for translated text"/>
        <spec>
          <pwd txt="Password" id="key for the label" size="10" set=""/>
          <pwd txt="Retype password" id="another key for the label" size="10" set=""/>
        </spec>
        <validator class="com.izforge.sample.PWDValidator" txt="Both versions of the password must match" id="key for the error text"/>
        <processor class="com.izforge.sample.PWDEncryptor"/>
      </field>
 <p/>
 
Additionally, parameters and multiple validators can be used to provide separate validation and error messages for each case.
 <p/>
    <field type="password" align="left" variable="keystore.password">
      <spec>
        <pwd txt="Keystore Password:" size="25" set=""/>
        <pwd txt="Retype Password:" size="25" set=""/>
      </spec>
      <validator class="com.izforge.izpack.util.PasswordEqualityValidator" txt="Both keystore passwords must match." id="key for the error text"/>
      <validator class="com.izforge.izpack.util.PasswordKeystoreValidator" txt="Could not validate keystore with password and alias provided." id="key for the error text">
        <param name="keystoreFile" value="${existing.ssl.keystore}"/>
        <param name="keystoreType" value="JKS"/>
        <param name="keystoreAlias" value="${keystore.key.alias}"/>
      </validator>
    </field>
 <p/>
 

Parameters:
spec - a IXMLElement containing the specification for the set of password fields.

readPasswordField

private boolean readPasswordField(UIElement field)
Reads the content of the password field and substitutes the associated variable.

Parameters:
field - a password group that manages one or more passord fields.
Returns:
true if there was no problem reading the data or if there was an irrecovarable problem. If there was a problem that can be corrected by the operator, an error dialog is popped up and false is returned.

addCheckBox

private void addCheckBox(IXMLElement spec)
Adds a chackbox to the list of UI elements.

Parameters:
spec - a IXMLElement containing the specification for the checkbox.

readCheckBox

private boolean readCheckBox(UIElement field)
Reads the content of the checkbox field and substitutes the associated variable.

Parameters:
field - the object array that holds the details of the field.
Returns:
true if there was no problem reading the data or if there was an irrecovarable problem. If there was a problem that can be corrected by the operator, an error dialog is popped up and false is returned.

addSearch

private void addSearch(IXMLElement spec)
Adds a search field to the list of UI elements.

This is a complete example of a valid XML specification

 <p/>
 <p/>
 <p/>
      <field type="search" variable="testVariable">
        <description text="Description for the search field" id="a key for translated text"/>
        <spec text="label" id="key for the label" filename="the_file_to_search" result="directory" /> <!-- values for result: directory, file -->
          <choice dir="directory1" set="true" /> <!-- default value -->
          <choice dir="dir2" />
        </spec>
      </field>
 <p/>
 <p/>
 <p/>
 

Parameters:
spec - a IXMLElement containing the specification for the search field

readSearch

private boolean readSearch(UIElement field)
Reads the content of the search field and substitutes the associated variable.

Parameters:
field - the object array that holds the details of the field.
Returns:
true if there was no problem reading the data or if there was an irrecovarable problem. If there was a problem that can be corrected by the operator, an error dialog is popped up and false is returned.

addText

private void addText(IXMLElement spec)
Adds text to the list of UI elements

Parameters:
spec - a IXMLElement containing the specification for the text.

addSpace

private void addSpace(IXMLElement spec)
Adds a dummy field to the list of UI elements to act as spacer.

Parameters:
spec - a IXMLElement containing other specifications. At present this information is not used but might be in future versions.

addDivider

private void addDivider(IXMLElement spec)
Adds a dividing line to the list of UI elements act as separator.

Parameters:
spec - a IXMLElement containing additional specifications.

addDescription

private void addDescription(IXMLElement spec,
                            java.util.Vector<IXMLElement> forPacks,
                            java.util.Vector<IXMLElement> forOs)
Adds a description to the list of UI elements.

Parameters:
spec - a IXMLElement containing the specification for the description.

getBoolean

private boolean getBoolean(IXMLElement element,
                           java.lang.String attribute,
                           boolean defaultValue)
Retrieves the value of a boolean attribute. If the attribute is found and the values equals the value of the constant TRUE then true is returned. If it equals FALSE the false is returned. In all other cases, including when the attribute is not found, the default value is returned.

Parameters:
element - the IXMLElement to search for the attribute.
attribute - the attribute to search for
defaultValue - the default value to use if the attribute does not exist or a illegal value was discovered.
Returns:
true if the attribute is found and the value equals the the constant TRUE. < if the attribute is FALSE. In all other cases the default value is returned.

getFloat

private float getFloat(IXMLElement element,
                       java.lang.String attribute,
                       float defaultValue)
Retrieves the value of a floating point attribute. If the attribute is not found or the value is non-numeric then the default value is returned.

Parameters:
element - the IXMLElement to search for the attribute.
attribute - the attribute to search for
defaultValue - the default value to use in case the attribute does not exist.
Returns:
the value of the attribute. If the attribute is not found or the content is not a legal integer, then the default value is returned.

getText

private java.lang.String getText(IXMLElement element)
Extracts the text from an IXMLElement. The text must be defined in the resource file under the key defined in the id attribute or as value of the attribute txt.

Parameters:
element - the IXMLElement from which to extract the text.
Returns:
The text defined in the IXMLElement. If no text can be located, null is returned.

getAlignment

private int getAlignment(IXMLElement element)
Retreives the alignment setting for the IXMLElement. The default value in case the ALIGNMENT attribute is not found or the value is illegal is TwoColumnConstraints.LEFT.

Parameters:
element - the IXMLElement from which to extract the alignment setting.
Returns:
the alignement setting for the IXMLElement. The value is either TwoColumnConstraints.LEFT, TwoColumnConstraints.CENTER or TwoColumnConstraints.RIGHT.
See Also:
TwoColumnConstraints

itemRequiredForOs

public boolean itemRequiredForOs(java.util.Vector<IXMLElement> os)
Verifies if an item is required for the operating system the installer executed. The configuration for this feature is:
<os family="unix"/>

Note:
If the list of the os is empty then true is always returnd.

Parameters:
os - The Vector of Strings. containing the os names
Returns:
true if the item is required for the os, otherwise returns false.

itemRequiredFor

private boolean itemRequiredFor(java.util.Vector<IXMLElement> packs)
Verifies if an item is required for any of the packs listed. An item is required for a pack in the list if that pack is actually selected for installation.

Note:
If the list of selected packs is empty then true is always returnd. The same is true if the packs list is empty.

Parameters:
packs - a Vector of Strings. Each of the strings denotes a pack for which an item should be created if the pack is actually installed.
Returns:
true if the item is required for at least one pack in the list, otherwise returns false.

itemRequiredForUnselected

private boolean itemRequiredForUnselected(java.util.Vector<IXMLElement> packs)
Verifies if an item is required for any of the packs listed. An item is required for a pack in the list if that pack is actually NOT selected for installation.

Note:
If the list of selected packs is empty then true is always returnd. The same is true if the packs list is empty.

Parameters:
packs - a Vector of Strings. Each of the strings denotes a pack for which an item should be created if the pack is actually installed.
Returns:
true if the item is required for at least one pack in the list, otherwise returns false.

updateVariables

protected void updateVariables()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

showMessageDialog

private void showMessageDialog(InstallerFrame parentFrame,
                               java.lang.String message,
                               java.lang.String caption,
                               int messageType)
Show localized message dialog basing on given parameters.

Parameters:
parentFrame - The parent frame.
message - The message to print out in dialog box.
caption - The caption of dialog box.
messageType - The message type (JOptionPane.*_MESSAGE)

showWarningMessageDialog

private void showWarningMessageDialog(InstallerFrame parentFrame,
                                      java.lang.String message)
Show localized warning message dialog basing on given parameters.

Parameters:
parentFrame - parent frame.
message - the message to print out in dialog box.

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent arg0)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener

updateDialog

private void updateDialog()

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener