com.izforge.izpack.panels.shortcut
Class ShortcutPanelLogic

java.lang.Object
  extended by com.izforge.izpack.panels.shortcut.ShortcutPanelLogic
All Implemented Interfaces:
CleanupClient

public class ShortcutPanelLogic
extends Object
implements CleanupClient

This class implements a the logic for the creation of shortcuts. The logic is used in the ShortcutPanel, ShortcutPanelAutomationHelper.

Version:
$Revision: 1.2 $

Constructor Summary
ShortcutPanelLogic(InstallData installData, Resources resources, UninstallData uninstallData, Housekeeper housekeeper, TargetFactory factory, InstallerListeners listeners, PlatformModelMatcher matcher)
          Constructs a ShortcutPanelLogic.
 
Method Summary
 boolean allowProgramGroup()
           
 boolean canCreateShortcuts()
          If specifications were valid than we can create shortcuts.
 void cleanUp()
          Called by Housekeeper to cleanup after installation.
 void createAndRegisterShortcuts()
          Creates the shortcuts
 List<IXMLElement> getAutoinstallXMLData(IXMLElement panelRoot)
           
 String getCreateDesktopShortcutsPrompt()
          Helper to return a prompt to create desktop shortcuts.
 String getCreateForAllUsersPrompt()
           
 String getCreateForCurrentUserPrompt()
           
 String getCreateForUserPrompt()
           
 String getCreateShortcutsPrompt()
          Helper to format a message to create shortcuts for the current platform.
 String getCreateStartupShortcutsPrompt()
           
 Vector<String> getDefaultGroup()
           
 List<String> getProgramGroups(int user)
           
 File getProgramsFolder(int user)
          Returns the ProgramsFolder for the current User
 String getSuggestedProgramGroup()
           
 List<String> getTargets()
           
 int getUserType()
           
 boolean hasDesktopShortcuts()
           
 boolean hasStartupShortcuts()
           
 boolean initUserType()
          Initialises the user type.
 boolean isCreateShortcutsImmediately()
           
 boolean isDefaultCurrentUserFlag()
           
 boolean isDesktopShortcutCheckboxSelected()
          Determines if the desktop shortcut checkbox is enabled.
 boolean isPreviousDisabled()
           
 boolean isStartupShortcutCheckboxSelected()
           
 boolean isSupported()
           
 boolean isSupportingMultipleUsers()
           
 void refreshShortcutData()
          Refresh the shortcut data.
 void saveToFile(File file)
          This method saves all shortcut information to a text file.
 void setAutoinstallXMLData(IXMLElement panelRoot)
          Reads the xml content for automated installations.
 void setCreateDesktopShortcuts(boolean createDesktopShortcuts)
           
 void setCreateMenuShortcuts(boolean createMenuShortcuts)
           
 void setCreateStartupShortcuts(boolean createStartupShortcuts)
           
 void setGroupName(String groupName)
           
 void setPlatform(Platform platform)
          Shortcut Panel should know what platform it is dealing with.
 void setSuggestedProgramGroup(String suggestedProgramGroup)
           
 void setUserType(int userType)
           
 boolean skipIfNotSupported()
           
 String verifyProgramGroup(String groupName)
          Validate that groupName is a valid directory path
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShortcutPanelLogic

public ShortcutPanelLogic(InstallData installData,
                          Resources resources,
                          UninstallData uninstallData,
                          Housekeeper housekeeper,
                          TargetFactory factory,
                          InstallerListeners listeners,
                          PlatformModelMatcher matcher)
                   throws Exception
Constructs a ShortcutPanelLogic.

Parameters:
installData - the installation data
resources - the resources
uninstallData - the uninstallation data
housekeeper - the house keeper
factory - the factory for platform-specific implementations
matcher - the platform-model matcher
Throws:
Exception - for any error
Method Detail

refreshShortcutData

public void refreshShortcutData()
                         throws Exception
Refresh the shortcut data. Should be done every time the shortcut panel is visited as variables can change, and we need to make the appropriate substitutions.

Throws:
Exception - an error occurred

createAndRegisterShortcuts

public void createAndRegisterShortcuts()
Creates the shortcuts


getProgramGroups

public List<String> getProgramGroups(int user)
Parameters:
user - type of the user Shortcut.ALL_USERS or Shortcut.CURRENT_USER
Returns:
a list of progrma group names.

getDefaultGroup

public Vector<String> getDefaultGroup()

getProgramsFolder

public File getProgramsFolder(int user)
Returns the ProgramsFolder for the current User

Parameters:
user - type of the user Shortcut.ALL_USERS or Shortcut.CURRENT_USER
Returns:
The basedir

getSuggestedProgramGroup

public String getSuggestedProgramGroup()
Returns:
the suggested program group

setSuggestedProgramGroup

public void setSuggestedProgramGroup(String suggestedProgramGroup)
Parameters:
suggestedProgramGroup - name of the suggested program group

getTargets

public List<String> getTargets()
Returns:
alist of all shortcut targets

getUserType

public int getUserType()

getAutoinstallXMLData

public List<IXMLElement> getAutoinstallXMLData(IXMLElement panelRoot)
Parameters:
panelRoot - root element
Returns:
a list of xml child elements to write a autoinstall.xml file for later execution

setAutoinstallXMLData

public void setAutoinstallXMLData(IXMLElement panelRoot)
Reads the xml content for automated installations.

Parameters:
panelRoot - specifies the xml elemnt for this panel

isDefaultCurrentUserFlag

public final boolean isDefaultCurrentUserFlag()
Returns:
true if current user is the default for the panel otherwise false

hasDesktopShortcuts

public boolean hasDesktopShortcuts()
Returns:
true if we have desktop shortcuts in the spec otherwise false

hasStartupShortcuts

public boolean hasStartupShortcuts()

setCreateDesktopShortcuts

public void setCreateDesktopShortcuts(boolean createDesktopShortcuts)
Parameters:
createDesktopShortcuts - flag

setCreateStartupShortcuts

public void setCreateStartupShortcuts(boolean createStartupShortcuts)

setCreateMenuShortcuts

public final void setCreateMenuShortcuts(boolean createMenuShortcuts)
Parameters:
createMenuShortcuts -

skipIfNotSupported

public boolean skipIfNotSupported()
Returns:
true if we skip shortcut panel and shortcut creation if this is not supported on the current OS otherwise false

isPreviousDisabled

public boolean isPreviousDisabled()
Returns:
true if previous nav button is disabled otherwise false

isSupported

public boolean isSupported()
Returns:
true if shortcut creation is supported otherwise false

isSupportingMultipleUsers

public boolean isSupportingMultipleUsers()
Returns:
true if we support multiple users otherwise false

cleanUp

public void cleanUp()
Called by Housekeeper to cleanup after installation.

Specified by:
cleanUp in interface CleanupClient

saveToFile

public void saveToFile(File file)
This method saves all shortcut information to a text file. TODO: Show an error dialog if fail to write

Parameters:
file - to save the information to

setGroupName

public void setGroupName(String groupName)
Parameters:
groupName - Name of the group where the shortcuts are placed in

setUserType

public void setUserType(int userType)
Parameters:
userType - Shortcut.CURRENT_USER Shortcut.ALL_USERS

initUserType

public boolean initUserType()
Initialises the user type.

Returns:
true if the current user has permissions to write to the All Users programs folder.

isDesktopShortcutCheckboxSelected

public boolean isDesktopShortcutCheckboxSelected()
Determines if the desktop shortcut checkbox is enabled.

Returns:
true if the desktop shortcut checkbox is enabled

isStartupShortcutCheckboxSelected

public boolean isStartupShortcutCheckboxSelected()

getCreateShortcutsPrompt

public String getCreateShortcutsPrompt()
Helper to format a message to create shortcuts for the current platform.

Returns:
a formatted message

getCreateDesktopShortcutsPrompt

public String getCreateDesktopShortcutsPrompt()
Helper to return a prompt to create desktop shortcuts.

Returns:
the desktop shortcut prompt

getCreateStartupShortcutsPrompt

public String getCreateStartupShortcutsPrompt()

getCreateForUserPrompt

public String getCreateForUserPrompt()

getCreateForAllUsersPrompt

public String getCreateForAllUsersPrompt()

getCreateForCurrentUserPrompt

public String getCreateForCurrentUserPrompt()

verifyProgramGroup

public String verifyProgramGroup(String groupName)
Validate that groupName is a valid directory path

Parameters:
groupName -
Returns:

isCreateShortcutsImmediately

public final boolean isCreateShortcutsImmediately()
Returns:
true it the shortcuts will be created after clicking next, otherwise false

setPlatform

public void setPlatform(Platform platform)
Shortcut Panel should know what platform it is dealing with.

Parameters:
platform -

canCreateShortcuts

public boolean canCreateShortcuts()
If specifications were valid than we can create shortcuts.

Returns:

allowProgramGroup

public boolean allowProgramGroup()


Copyright © 2018. All rights reserved.