com.izforge.izpack.panels
Class ShortcutPanel

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.ShortcutPanel
All Implemented Interfaces:
LayoutConstants, AbstractUIHandler, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ListSelectionListener, javax.swing.SwingConstants

public class ShortcutPanel
extends IzPanel
implements java.awt.event.ActionListener, javax.swing.event.ListSelectionListener

This class implements a panel for the creation of shortcuts. The panel prompts the user to select a program group for shortcuts, accept the creation of desktop shortcuts and actually creates the shortcuts.

Use LateShortcutInstallListener to create the Shortcuts after the Files have been installed.

Version:
$Revision: 2163 $
See Also:
Serialized Form

Nested Class Summary
 
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  javax.swing.JCheckBox allowDesktopShortcut
          UI element to allow the user to decide if shortcuts should be placed on the desktop or not.
private  javax.swing.JRadioButton allUsers
          UI element instruct this panel to create shortcuts for all users
static java.lang.String AUTO_ATTRIBUTE_COMMAND
          AUTO_ATTRIBUTE_COMMAND = "commandLine"
static java.lang.String AUTO_ATTRIBUTE_DESCRIPTION
          AUTO_ATTRIBUTE_DESCRIPTION = "description"
static java.lang.String AUTO_ATTRIBUTE_GROUP
          AUTO_ATTRIBUTE_GROUP = "group"
static java.lang.String AUTO_ATTRIBUTE_ICON
          AUTO_ATTRIBUTE_ICON = "icon"
static java.lang.String AUTO_ATTRIBUTE_ICON_INDEX
          AUTO_ATTRIBUTE_ICON_INDEX = "iconIndex"
static java.lang.String AUTO_ATTRIBUTE_INITIAL_STATE
          AUTO_ATTRIBUTE_INITIAL_STATE = "initialState"
static java.lang.String AUTO_ATTRIBUTE_NAME
          AUTO_ATTRIBUTE_NAME = "name"
static java.lang.String AUTO_ATTRIBUTE_TARGET
          AUTO_ATTRIBUTE_TARGET = "target"
static java.lang.String AUTO_ATTRIBUTE_TYPE
          AUTO_ATTRIBUTE_TYPE "type"
static java.lang.String AUTO_ATTRIBUTE_WORKING_DIR
          AUTO_ATTRIBUTE_WORKING_DIR = "workingDirectory"
static java.lang.String AUTO_KEY_PROGRAM_GROUP
          AUTO_KEY_PROGRAM_GROUP = SPEC_KEY_PROGRAM_GROUP = "programGroup"
static java.lang.String AUTO_KEY_SHORTCUT
          AUTO_KEY_SHORTCUT = SPEC_KEY_SHORTCUT = "shortcut"
(package private)  int col
          internal column counter
private  java.awt.GridBagConstraints constraints
          The contraints object to use whan creating the layout
(package private) static boolean create
          internal flag: create
static java.lang.String CREATE_FOR_ALL
          CREATE_FOR_ALL = "createForAll"
static boolean createImmediately
          May be switched by an installerlistener to false.
private  javax.swing.JCheckBox createShortcuts
          Checkbox to enable/disable to chreate ShortCuts
private  javax.swing.JRadioButton currentUser
          UI element instruct this panel to create shortcuts for the current user only
private  javax.swing.JButton defaultButton
          UI element to allow the user to revert to the default name of the program group
private  java.util.Vector<ExecutableFile> execFiles
          a VectorList of Files wich should be make executable
private  java.util.Vector<java.lang.String> files
          Holds a list of all the shortcut files that have been created.
private static boolean firstTime
           
private  javax.swing.JList groupList
          UI element to present the list of existing program groups for selection
private  int groupLocation
          The location for placign the program group.
private  java.lang.String groupName
          The name chosen by the user for the program group,
private  boolean hasDesktopShortcuts
          Set to true by analyzeShortcutSpec() if there are any desktop shortcuts to create.
private  boolean haveShortcutSpec
          If true it indicates that the spec file is existing and could be read.
private static boolean isRootUser
          internal flag isRootUser
private  java.io.File itsProgramFolder
          Avoids bogus behaviour when the user goes back then returns to this panel.
private  int itsUserType
          itsUserType
private  java.awt.GridBagLayout layout
          The layout for this panel
(package private)  int line
          internal line counter
private  javax.swing.JLabel listLabel
          UI element to label the list of existing program groups
private static java.lang.String LOCATION_APPLICATIONS
          LOCATION_APPLICATIONS=applications
private static java.lang.String LOCATION_START_MENU
          LOCATION_START_MENU = "startMenu"
private  javax.swing.JTextField programGroup
          UI element to present the default name for the program group and to support editing of this name.
private  java.lang.String programGroupComment
          Comment for XDG/unix group
private  java.lang.String programGroupIconFile
          The icon for the group in XDG/unix menu
private  javax.swing.JButton saveButton
          UI element to allow the user to save a text file with the shortcut information
private static ShortcutPanel self
           
private static java.lang.String SEPARATOR_LINE
          SEPARATOR_LINE = "--------------------------------------------------------------------------------";
private static long serialVersionUID
          serialVersionUID = 3256722870838112311L
private  Shortcut shortcut
          the one shortcut instance for reuse in many locations
private  java.util.Vector shortcuts
          A list of ShortcutData> objects.
private  java.util.Vector<java.lang.String> shortCuts
          shortCuts
private  boolean shortcutsToCreate
          If true it indicates that there are shortcuts to create.
private  boolean simulteNotSupported
          This is set to true if the shortcut spec instructs to simulate running on an operating system that is not supported.
private  boolean skipIfNotSupported
          Tells wether to skip if the platform is not supported.
private  XMLElement spec
          The parsed result from reading the XML specification from the file
private static java.lang.String SPEC_ATTRIBUTE_APPLICATIONS
          SPEC_ATTRIBUTE_APPLICATIONS = "applications"
private static java.lang.String SPEC_ATTRIBUTE_COMMAND
          SPEC_ATTRIBUTE_COMMAND = "commandLine"
private static java.lang.String SPEC_ATTRIBUTE_DEFAULT_GROUP
          SPEC_ATTRIBUTE_DEFAULT_GROUP = "defaultName"
private static java.lang.String SPEC_ATTRIBUTE_DESCRIPTION
          SPEC_ATTRIBUTE_DESCRIPTION = "description"
private static java.lang.String SPEC_ATTRIBUTE_DESKTOP
          SPEC_ATTRIBUTE_DESKTOP = "desktop"
static java.lang.String SPEC_ATTRIBUTE_ENCODING
          SPEC_ATTRIBUTE_ENCODING = "encoding"
private static java.lang.String SPEC_ATTRIBUTE_ICON
          SPEC_ATTRIBUTE_ICON "iconFile"
private static java.lang.String SPEC_ATTRIBUTE_ICON_INDEX
          SPEC_ATTRIBUTE_ICON_INDEX "iconIndex"
private static java.lang.String SPEC_ATTRIBUTE_INITIAL_STATE
          SPEC_ATTRIBUTE_INITIAL_STATE = "initialState"
private static java.lang.String SPEC_ATTRIBUTE_INSTALLGROUP
          Support the InstallGroups like in Packs.
static java.lang.String SPEC_ATTRIBUTE_KDE_SUBST_UID
          SPEC_ATTRIBUTE_KDE_SUBST_UID = "KdeSubstUID"
static java.lang.String SPEC_ATTRIBUTE_KDE_USERNAME
          SPEC_ATTRIBUTE_KDE_USERNAME ="KdeUsername"
private static java.lang.String SPEC_ATTRIBUTE_LOCATION
          SPEC_ATTRIBUTE_LOCATION = "location"
static java.lang.String SPEC_ATTRIBUTE_MIMETYPE
          SPEC_ATTRIBUTE_MIMETYPE = "mimetype"
private static java.lang.String SPEC_ATTRIBUTE_NAME
          SPEC_ATTRIBUTE_NAME = "name"
private static java.lang.String SPEC_ATTRIBUTE_PROGRAM_GROUP
          SPEC_ATTRIBUTE_PROGRAM_GROUP = "programGroup"
private static java.lang.String SPEC_ATTRIBUTE_START_MENU
          SPEC_ATTRIBUTE_START_MENU = "startMenu"
private static java.lang.String SPEC_ATTRIBUTE_STARTUP
          SPEC_ATTRIBUTE_STARTUP = "startup"
private static java.lang.String SPEC_ATTRIBUTE_SUBGROUP
          SPEC_ATTRIBUTE_SUBGROUP = "subgroup"
private static java.lang.String SPEC_ATTRIBUTE_TARGET
          SPEC_ATTRIBUTE_TARGET = "target"
static java.lang.String SPEC_ATTRIBUTE_TERMINAL
          SPEC_ATTRIBUTE_TERMINAL = "terminal"
static java.lang.String SPEC_ATTRIBUTE_TERMINAL_OPTIONS
          SPEC_ATTRIBUTE_TERMINAL_OPTIONS = "terminalOptions"
static java.lang.String SPEC_ATTRIBUTE_TYPE
          SPEC_ATTRIBUTE_TYPE = "type"
static java.lang.String SPEC_ATTRIBUTE_URL
          SPEC_ATTRIBUTE_URL = "url"
private static java.lang.String SPEC_ATTRIBUTE_WORKING_DIR
          SPEC_ATTRIBUTE_WORKING_DIR = "workingDirectory"
static java.lang.String SPEC_CATEGORIES
          SPEC_CATEGORIES = "categories"
private static java.lang.String SPEC_FILE_NAME
          The name of the XML file that specifies the shortcuts SPEC_FILE_NAME = "shortcutSpec.xml";
private static java.lang.String SPEC_KEY_NOT_SUPPORTED
          SPEC_KEY_NOT_SUPPORTED = "notSupported"
private static java.lang.String SPEC_KEY_PACKS
          SPEC_KEY_PACKS = "createForPack"
private static java.lang.String SPEC_KEY_PROGRAM_GROUP
          SPEC_KEY_PROGRAM_GROUP = "programGroup"
private static java.lang.String SPEC_KEY_SHORTCUT
          SPEC_KEY_SHORTCUT = "shortcut"
private static java.lang.String SPEC_KEY_SKIP_IFNOT_SUPPORTED
          SPEC_KEY_SKIP_IFNOT_SUPPORTED = "skipIfNotSupported"
static java.lang.String SPEC_TRYEXEC
          SPEC_TRYEXEC = "tryexec"
private static java.lang.String SPEC_VALUE_APPLICATIONS
          SPEC_VALUE_APPLICATIONS = "applications"
private static java.lang.String SPEC_VALUE_MAXIMIZED
          SPEC_VALUE_MAXIMIZED = "maximized"
private static java.lang.String SPEC_VALUE_MINIMIZED
          SPEC_VALUE_MINIMIZED = "minimized"
private static java.lang.String SPEC_VALUE_NO_SHOW
          SPEC_VALUE_NO_SHOW = "noShow"
private static java.lang.String SPEC_VALUE_NORMAL
          SPEC_VALUE_NORMAL = "normal"
private static java.lang.String SPEC_VALUE_START_MENU
          SPEC_VALUE_START_MENU = "startMenu"
private  java.lang.String suggestedProgramGroup
          The default name to use for the program group.
private  javax.swing.JList targetList
          UI element for listing the intended shortcut targets
private static java.lang.String TEXT_FILE_NAME
          The default file name for the text file in which the shortcut information should be stored, in case shortcuts can not be created on a particular target system.
static java.lang.String USER_TYPE
          USER_TYPE = "usertype" to store this information in the automated.xml
 
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, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ShortcutPanel(InstallerFrame parent, InstallData installData)
          Constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          This method represents the ActionListener interface, invoked when an action occurs.
private  javax.swing.JList addList(java.util.Vector<java.lang.String> Entries, int ListModel, javax.swing.JList aJList, int aGridx, int aGridy, int aGridwidth, int aGridheight, int aFill)
          Adds the grouplist to the panel
private  void addToUninstaller()
          Adds all files and directories to the uninstaller.
private  void analyzeShortcutSpec()
          This method analyzes the specifications for creating shortcuts and builds a list of all the Shortcuts that need to be created.
private  void buildAlternateUI()
          This method creates an alternative UI for this panel.
private  void buildUI(java.io.File groups)
          This method creates the UI for this panel.
private  boolean checkConditions(XMLElement shortcutSpec)
          This returns true if a Shortcut should or can be created.
 void createAndRegisterShortcuts()
          Enables Shortcutcreation from outside, e.g. from an InstallerListener.
private  void createShortcuts()
          Creates all shortcuts based on the information in shortcuts.
private  java.lang.String createXDGDirectory(java.lang.String menuName, java.lang.String icon, java.lang.String comment)
           
private  java.lang.String createXDGMenu(java.util.ArrayList shortcuts, java.lang.String menuName)
           
private  java.lang.String fixSeparatorChar(java.lang.String path)
          Replaces any ocurrence of '/' or '\' in a path string with the correct version for the operating system.
static ShortcutPanel getInstance()
          Returns Instance of themself
private  java.io.File getProgramsFolder(int userType)
          Returns the ProgramsFolder for the current User
 java.awt.Dimension getSize()
          Overriding the superclass implementation.
 boolean isValidated()
          Returns true when all selections have valid settings.
 void makeXMLData(XMLElement panelRoot)
          Asks the panel to set its own XML data that can be brought back for an automated installation process.
 void panelActivate()
          Called when the panel is shown to the user.
private  void readShortcutSpec()
          Reads the XML specification for the shortcuts to create.
private  void saveToFile()
          This method saves all shortcut information to a text file.
private  boolean shortcutRequiredFor(java.util.Vector<XMLElement> packs)
          Verifies if the shortcut is required for any of the packs listed.
 void valueChanged(javax.swing.event.ListSelectionEvent event)
          This method is called by the groupList when the user makes a selection.
private  void writeString(java.lang.String str, java.lang.String file)
           
private  void writeXDGMenuFile(java.util.ArrayList desktopFileNames, java.lang.String groupName, java.lang.String icon, java.lang.String comment)
           
 
Methods inherited from class com.izforge.izpack.installer.IzPanel
askQuestion, askQuestion, buildHeadline, completeGridBagLayout, createLabel, createLabel, createLabel, createLabel, createMultiLineLabel, createMultiLineLabel, createMultiLineLabelLang, emitError, emitNotification, emitNotificationFeedback, emitWarning, getClassName, getControlTextFont, getDefaultGridBagConstraints, getI18nStringForClass, getI18nStringForClass, getImageIcon, getInitialFocus, getInstallerFrame, getLAF, getLayoutHelper, getMetadata, getNewGridBagConstraints, getNewGridBagConstraints, getNextXGridBagConstraints, getNextYGridBagConstraints, getNextYGridBagConstraints, getString, getSummaryBody, getSummaryCaption, init, initLayoutHelper, isHidden, panelDeactivate, parseText, resetGridCounter, setDefaultGridBagConstraints, setHidden, setInitialFocus, setMetadata, 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, 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, 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, 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
serialVersionUID = 3256722870838112311L

See Also:
Constant Field Values

SPEC_ATTRIBUTE_KDE_USERNAME

public static final java.lang.String SPEC_ATTRIBUTE_KDE_USERNAME
SPEC_ATTRIBUTE_KDE_USERNAME ="KdeUsername"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_KDE_SUBST_UID

public static final java.lang.String SPEC_ATTRIBUTE_KDE_SUBST_UID
SPEC_ATTRIBUTE_KDE_SUBST_UID = "KdeSubstUID"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_URL

public static final java.lang.String SPEC_ATTRIBUTE_URL
SPEC_ATTRIBUTE_URL = "url"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_TYPE

public static final java.lang.String SPEC_ATTRIBUTE_TYPE
SPEC_ATTRIBUTE_TYPE = "type"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_TERMINAL_OPTIONS

public static final java.lang.String SPEC_ATTRIBUTE_TERMINAL_OPTIONS
SPEC_ATTRIBUTE_TERMINAL_OPTIONS = "terminalOptions"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_TERMINAL

public static final java.lang.String SPEC_ATTRIBUTE_TERMINAL
SPEC_ATTRIBUTE_TERMINAL = "terminal"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_MIMETYPE

public static final java.lang.String SPEC_ATTRIBUTE_MIMETYPE
SPEC_ATTRIBUTE_MIMETYPE = "mimetype"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_ENCODING

public static final java.lang.String SPEC_ATTRIBUTE_ENCODING
SPEC_ATTRIBUTE_ENCODING = "encoding"

See Also:
Constant Field Values

LOCATION_APPLICATIONS

private static final java.lang.String LOCATION_APPLICATIONS
LOCATION_APPLICATIONS=applications

See Also:
Constant Field Values

LOCATION_START_MENU

private static final java.lang.String LOCATION_START_MENU
LOCATION_START_MENU = "startMenu"

See Also:
Constant Field Values

SPEC_CATEGORIES

public static final java.lang.String SPEC_CATEGORIES
SPEC_CATEGORIES = "categories"

See Also:
Constant Field Values

SPEC_TRYEXEC

public static final java.lang.String SPEC_TRYEXEC
SPEC_TRYEXEC = "tryexec"

See Also:
Constant Field Values

SEPARATOR_LINE

private static final java.lang.String SEPARATOR_LINE
SEPARATOR_LINE = "--------------------------------------------------------------------------------";

See Also:
Constant Field Values

TEXT_FILE_NAME

private static final java.lang.String TEXT_FILE_NAME
The default file name for the text file in which the shortcut information should be stored, in case shortcuts can not be created on a particular target system. TEXT_FILE_NAME = "Shortcuts.txt"

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 shortcuts SPEC_FILE_NAME = "shortcutSpec.xml";

See Also:
Constant Field Values

SPEC_KEY_SKIP_IFNOT_SUPPORTED

private static final java.lang.String SPEC_KEY_SKIP_IFNOT_SUPPORTED
SPEC_KEY_SKIP_IFNOT_SUPPORTED = "skipIfNotSupported"

See Also:
Constant Field Values

SPEC_KEY_NOT_SUPPORTED

private static final java.lang.String SPEC_KEY_NOT_SUPPORTED
SPEC_KEY_NOT_SUPPORTED = "notSupported"

See Also:
Constant Field Values

SPEC_KEY_PROGRAM_GROUP

private static final java.lang.String SPEC_KEY_PROGRAM_GROUP
SPEC_KEY_PROGRAM_GROUP = "programGroup"

See Also:
Constant Field Values

SPEC_KEY_SHORTCUT

private static final java.lang.String SPEC_KEY_SHORTCUT
SPEC_KEY_SHORTCUT = "shortcut"

See Also:
Constant Field Values

SPEC_KEY_PACKS

private static final java.lang.String SPEC_KEY_PACKS
SPEC_KEY_PACKS = "createForPack"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_DEFAULT_GROUP

private static final java.lang.String SPEC_ATTRIBUTE_DEFAULT_GROUP
SPEC_ATTRIBUTE_DEFAULT_GROUP = "defaultName"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_INSTALLGROUP

private static final java.lang.String SPEC_ATTRIBUTE_INSTALLGROUP
Support the InstallGroups like in Packs. SPEC_ATTRIBUTE_INSTALLGROUP = "installGroup"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_LOCATION

private static final java.lang.String SPEC_ATTRIBUTE_LOCATION
SPEC_ATTRIBUTE_LOCATION = "location"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_NAME

private static final java.lang.String SPEC_ATTRIBUTE_NAME
SPEC_ATTRIBUTE_NAME = "name"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_SUBGROUP

private static final java.lang.String SPEC_ATTRIBUTE_SUBGROUP
SPEC_ATTRIBUTE_SUBGROUP = "subgroup"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_DESCRIPTION

private static final java.lang.String SPEC_ATTRIBUTE_DESCRIPTION
SPEC_ATTRIBUTE_DESCRIPTION = "description"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_TARGET

private static final java.lang.String SPEC_ATTRIBUTE_TARGET
SPEC_ATTRIBUTE_TARGET = "target"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_COMMAND

private static final java.lang.String SPEC_ATTRIBUTE_COMMAND
SPEC_ATTRIBUTE_COMMAND = "commandLine"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_ICON

private static final java.lang.String SPEC_ATTRIBUTE_ICON
SPEC_ATTRIBUTE_ICON "iconFile"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_ICON_INDEX

private static final java.lang.String SPEC_ATTRIBUTE_ICON_INDEX
SPEC_ATTRIBUTE_ICON_INDEX "iconIndex"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_WORKING_DIR

private static final java.lang.String SPEC_ATTRIBUTE_WORKING_DIR
SPEC_ATTRIBUTE_WORKING_DIR = "workingDirectory"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_INITIAL_STATE

private static final java.lang.String SPEC_ATTRIBUTE_INITIAL_STATE
SPEC_ATTRIBUTE_INITIAL_STATE = "initialState"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_DESKTOP

private static final java.lang.String SPEC_ATTRIBUTE_DESKTOP
SPEC_ATTRIBUTE_DESKTOP = "desktop"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_APPLICATIONS

private static final java.lang.String SPEC_ATTRIBUTE_APPLICATIONS
SPEC_ATTRIBUTE_APPLICATIONS = "applications"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_START_MENU

private static final java.lang.String SPEC_ATTRIBUTE_START_MENU
SPEC_ATTRIBUTE_START_MENU = "startMenu"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_STARTUP

private static final java.lang.String SPEC_ATTRIBUTE_STARTUP
SPEC_ATTRIBUTE_STARTUP = "startup"

See Also:
Constant Field Values

SPEC_ATTRIBUTE_PROGRAM_GROUP

private static final java.lang.String SPEC_ATTRIBUTE_PROGRAM_GROUP
SPEC_ATTRIBUTE_PROGRAM_GROUP = "programGroup"

See Also:
Constant Field Values

SPEC_VALUE_APPLICATIONS

private static final java.lang.String SPEC_VALUE_APPLICATIONS
SPEC_VALUE_APPLICATIONS = "applications"

See Also:
Constant Field Values

SPEC_VALUE_START_MENU

private static final java.lang.String SPEC_VALUE_START_MENU
SPEC_VALUE_START_MENU = "startMenu"

See Also:
Constant Field Values

SPEC_VALUE_NO_SHOW

private static final java.lang.String SPEC_VALUE_NO_SHOW
SPEC_VALUE_NO_SHOW = "noShow"

See Also:
Constant Field Values

SPEC_VALUE_NORMAL

private static final java.lang.String SPEC_VALUE_NORMAL
SPEC_VALUE_NORMAL = "normal"

See Also:
Constant Field Values

SPEC_VALUE_MAXIMIZED

private static final java.lang.String SPEC_VALUE_MAXIMIZED
SPEC_VALUE_MAXIMIZED = "maximized"

See Also:
Constant Field Values

SPEC_VALUE_MINIMIZED

private static final java.lang.String SPEC_VALUE_MINIMIZED
SPEC_VALUE_MINIMIZED = "minimized"

See Also:
Constant Field Values

AUTO_KEY_PROGRAM_GROUP

public static final java.lang.String AUTO_KEY_PROGRAM_GROUP
AUTO_KEY_PROGRAM_GROUP = SPEC_KEY_PROGRAM_GROUP = "programGroup"

See Also:
Constant Field Values

AUTO_KEY_SHORTCUT

public static final java.lang.String AUTO_KEY_SHORTCUT
AUTO_KEY_SHORTCUT = SPEC_KEY_SHORTCUT = "shortcut"

See Also:
Constant Field Values

AUTO_ATTRIBUTE_NAME

public static final java.lang.String AUTO_ATTRIBUTE_NAME
AUTO_ATTRIBUTE_NAME = "name"

See Also:
Constant Field Values

AUTO_ATTRIBUTE_GROUP

public static final java.lang.String AUTO_ATTRIBUTE_GROUP
AUTO_ATTRIBUTE_GROUP = "group"

See Also:
Constant Field Values

AUTO_ATTRIBUTE_TYPE

public static final java.lang.String AUTO_ATTRIBUTE_TYPE
AUTO_ATTRIBUTE_TYPE "type"

See Also:
Constant Field Values

AUTO_ATTRIBUTE_COMMAND

public static final java.lang.String AUTO_ATTRIBUTE_COMMAND
AUTO_ATTRIBUTE_COMMAND = "commandLine"

See Also:
Constant Field Values

AUTO_ATTRIBUTE_DESCRIPTION

public static final java.lang.String AUTO_ATTRIBUTE_DESCRIPTION
AUTO_ATTRIBUTE_DESCRIPTION = "description"

See Also:
Constant Field Values

AUTO_ATTRIBUTE_ICON

public static final java.lang.String AUTO_ATTRIBUTE_ICON
AUTO_ATTRIBUTE_ICON = "icon"

See Also:
Constant Field Values

AUTO_ATTRIBUTE_ICON_INDEX

public static final java.lang.String AUTO_ATTRIBUTE_ICON_INDEX
AUTO_ATTRIBUTE_ICON_INDEX = "iconIndex"

See Also:
Constant Field Values

AUTO_ATTRIBUTE_INITIAL_STATE

public static final java.lang.String AUTO_ATTRIBUTE_INITIAL_STATE
AUTO_ATTRIBUTE_INITIAL_STATE = "initialState"

See Also:
Constant Field Values

AUTO_ATTRIBUTE_TARGET

public static final java.lang.String AUTO_ATTRIBUTE_TARGET
AUTO_ATTRIBUTE_TARGET = "target"

See Also:
Constant Field Values

AUTO_ATTRIBUTE_WORKING_DIR

public static final java.lang.String AUTO_ATTRIBUTE_WORKING_DIR
AUTO_ATTRIBUTE_WORKING_DIR = "workingDirectory"

See Also:
Constant Field Values

CREATE_FOR_ALL

public static final java.lang.String CREATE_FOR_ALL
CREATE_FOR_ALL = "createForAll"

See Also:
Constant Field Values

self

private static ShortcutPanel self

firstTime

private static boolean firstTime

create

static boolean create
internal flag: create


createImmediately

public static boolean createImmediately
May be switched by an installerlistener to false. Installerlistener may then perform the creation of the shortcuts after the files have been installed... Default is true.


isRootUser

private static boolean isRootUser
internal flag isRootUser


execFiles

private java.util.Vector<ExecutableFile> execFiles
a VectorList of Files wich should be make executable


listLabel

private javax.swing.JLabel listLabel
UI element to label the list of existing program groups


groupList

private javax.swing.JList groupList
UI element to present the list of existing program groups for selection


targetList

private javax.swing.JList targetList
UI element for listing the intended shortcut targets


programGroup

private javax.swing.JTextField programGroup
UI element to present the default name for the program group and to support editing of this name.


defaultButton

private javax.swing.JButton defaultButton
UI element to allow the user to revert to the default name of the program group


saveButton

private javax.swing.JButton saveButton
UI element to allow the user to save a text file with the shortcut information


allowDesktopShortcut

private javax.swing.JCheckBox allowDesktopShortcut
UI element to allow the user to decide if shortcuts should be placed on the desktop or not.


createShortcuts

private javax.swing.JCheckBox createShortcuts
Checkbox to enable/disable to chreate ShortCuts


currentUser

private javax.swing.JRadioButton currentUser
UI element instruct this panel to create shortcuts for the current user only


allUsers

private javax.swing.JRadioButton allUsers
UI element instruct this panel to create shortcuts for all users


layout

private java.awt.GridBagLayout layout
The layout for this panel


constraints

private java.awt.GridBagConstraints constraints
The contraints object to use whan creating the layout


suggestedProgramGroup

private java.lang.String suggestedProgramGroup
The default name to use for the program group. This comes from the XML specification.


groupName

private java.lang.String groupName
The name chosen by the user for the program group,


programGroupIconFile

private java.lang.String programGroupIconFile
The icon for the group in XDG/unix menu


programGroupComment

private java.lang.String programGroupComment
Comment for XDG/unix group


groupLocation

private int groupLocation
The location for placign the program group. This is the same as the location (type) of a shortcut, only that it applies to the program group. Note that there are only two locations that make sense as location for a program group:
applications start menu


spec

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


hasDesktopShortcuts

private boolean hasDesktopShortcuts
Set to true by analyzeShortcutSpec() if there are any desktop shortcuts to create.


skipIfNotSupported

private boolean skipIfNotSupported
Tells wether to skip if the platform is not supported.


shortcut

private Shortcut shortcut
the one shortcut instance for reuse in many locations


shortcuts

private java.util.Vector shortcuts
A list of ShortcutData> objects. Each object is the complete specification for one shortcut that must be created.


files

private java.util.Vector<java.lang.String> files
Holds a list of all the shortcut files that have been created. Note: this variable contains valid data only after createShortcuts() has been called. This list is created so that the files can be added to the uninstaller.


shortcutsToCreate

private boolean shortcutsToCreate
If true it indicates that there are shortcuts to create. The value is set by analyzeShortcutSpec()


haveShortcutSpec

private boolean haveShortcutSpec
If true it indicates that the spec file is existing and could be read.


simulteNotSupported

private boolean simulteNotSupported
This is set to true if the shortcut spec instructs to simulate running on an operating system that is not supported.


itsProgramFolder

private java.io.File itsProgramFolder
Avoids bogus behaviour when the user goes back then returns to this panel.


itsUserType

private int itsUserType
itsUserType


USER_TYPE

public static final java.lang.String USER_TYPE
USER_TYPE = "usertype" to store this information in the automated.xml

See Also:
Constant Field Values

shortCuts

private java.util.Vector<java.lang.String> shortCuts
shortCuts


line

int line
internal line counter


col

int col
internal column counter

Constructor Detail

ShortcutPanel

public ShortcutPanel(InstallerFrame parent,
                     InstallData installData)
Constructor.

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

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
This method represents the ActionListener interface, invoked when an action occurs.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event - the action event.

isValidated

public boolean isValidated()
Returns true when all selections have valid settings. This indicates that it is legal to procede to the next panel.

Overrides:
isValidated in class IzPanel
Returns:
true if it is legal to procede to the next panel, otherwise false.

panelActivate

public void panelActivate()
Called when the panel is shown to the user.

Overrides:
panelActivate in class IzPanel

getProgramsFolder

private java.io.File getProgramsFolder(int userType)
Returns the ProgramsFolder for the current User

Parameters:
userType - DOCUMENT ME!
Returns:
The Basedir

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent event)
This method is called by the groupList when the user makes a selection. It updates the content of the programGroup with the result of the selection.

Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener
Parameters:
event - the list selection event

readShortcutSpec

private void readShortcutSpec()
                       throws java.lang.Exception
Reads the XML specification for the shortcuts to create. The result is stored in spec.

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

analyzeShortcutSpec

private void analyzeShortcutSpec()
This method analyzes the specifications for creating shortcuts and builds a list of all the Shortcuts that need to be created.


checkConditions

private boolean checkConditions(XMLElement shortcutSpec)
This returns true if a Shortcut should or can be created. Returns false to suppress Creation

Parameters:
shortcutSpec -
Returns:
true if condtion is resolved positive - currently unimplemented: returns always true.

createAndRegisterShortcuts

public void createAndRegisterShortcuts()
Enables Shortcutcreation from outside, e.g. from an InstallerListener. The Installerlistener can switch the flag "createImmediately" to false on initialisation, and call this method when afterpacks is performed. This makes only sense, if the ShorcutPanel is displayed before the files are copied onto the disk.


createXDGMenu

private java.lang.String createXDGMenu(java.util.ArrayList shortcuts,
                                       java.lang.String menuName)

createXDGDirectory

private java.lang.String createXDGDirectory(java.lang.String menuName,
                                            java.lang.String icon,
                                            java.lang.String comment)

writeXDGMenuFile

private void writeXDGMenuFile(java.util.ArrayList desktopFileNames,
                              java.lang.String groupName,
                              java.lang.String icon,
                              java.lang.String comment)

writeString

private void writeString(java.lang.String str,
                         java.lang.String file)

createShortcuts

private void createShortcuts()
Creates all shortcuts based on the information in shortcuts.


shortcutRequiredFor

private boolean shortcutRequiredFor(java.util.Vector<XMLElement> packs)
Verifies if the shortcut is required for any of the packs listed. The shortcut 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 the schortcut should be created if the pack is actually installed.
Returns:
true if the shortcut is required for at least on pack in the list, otherwise returns false.

fixSeparatorChar

private java.lang.String fixSeparatorChar(java.lang.String path)
Replaces any ocurrence of '/' or '\' in a path string with the correct version for the operating system.

Parameters:
path - a system path
Returns:
a path string that uniformely uses the proper version of the separator character.

buildUI

private void buildUI(java.io.File groups)
This method creates the UI for this panel.

Parameters:
groups - A Vector that contains Strings with all the names of the existing program groups. These will be placed in the groupList.

addList

private javax.swing.JList addList(java.util.Vector<java.lang.String> Entries,
                                  int ListModel,
                                  javax.swing.JList aJList,
                                  int aGridx,
                                  int aGridy,
                                  int aGridwidth,
                                  int aGridheight,
                                  int aFill)
Adds the grouplist to the panel

Parameters:
Entries - the entries to display
ListModel - the model to use
aJList - the JList to use
aGridx - The X position in the gridbag layout.
aGridy - The Y position in the gridbag layout.
aGridwidth - the gridwith to use in the gridbag layout.
aGridheight - the gridheight to use in the gridbag layout.
aFill - the FILL to use in the gridbag layout.
Returns:
the filled JList

buildAlternateUI

private void buildAlternateUI()
This method creates an alternative UI for this panel. This UI can be used when the creation of shortcuts is not supported on the target system. It displays an apology for the inability to create shortcuts on this system, along with information about the intended targets. In addition, there is a button that allows the user to save more complete information in a text file. Based on this information the user might be able to create the necessary shortcut him or herself. At least there will be information about how to launch the application.


getSize

public java.awt.Dimension getSize()
Overriding the superclass implementation. This method returns the size of the container.

Overrides:
getSize in class java.awt.Component
Returns:
the size of the container

saveToFile

private void saveToFile()
This method saves all shortcut information to a text file.


addToUninstaller

private void addToUninstaller()
Adds all files and directories to the uninstaller.


getInstance

public static ShortcutPanel getInstance()
Returns Instance of themself


makeXMLData

public void makeXMLData(XMLElement panelRoot)
Description copied from class: IzPanel
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.