com.izforge.izpack.util.os
Class Unix_Shortcut

java.lang.Object
  extended by com.izforge.izpack.util.os.Shortcut
      extended by com.izforge.izpack.util.os.Unix_Shortcut

public class Unix_Shortcut
extends Shortcut

This is the Implementation of the RFC-Based Desktop-Link. Used in KDE and GNOME.

Author:
marc.eppelmann@reddot.de, Bill Root

Field Summary
 
Fields inherited from class com.izforge.izpack.util.os.Shortcut
ALL_USERS, APPLICATIONS, CURRENT_USER, DESKTOP, HIDE, MAXIMIZED, MINIMIZED, NORMAL, START_MENU, START_UP, uninstaller
 
Constructor Summary
Unix_Shortcut(Resources resources, InstallData installData)
          Constructs a Unix_Shortcut.
 
Method Summary
 String build()
          Builds contents of desktop file.
 void execPostAction()
          Post Exec Action especially for the Unix Root User.
 String getFileName()
          Subclass implementations return the fully qualified file name under which the link is saved on disk.
 String getIconLocation()
          Returns the path of the shortcut icon that will be shown on the desktop.
 int getLinkType()
          Gets the type of link types are:
Shortcut.DESKTOP Shortcut.APPLICATIONS Shortcut.START_MENU Shortcut.START_UP
 List<String> getProgramGroups(int userType)
          Returns a list of currently existing program groups, based on the requested type.
 String getProgramsFolder(int current_user)
          Gets the Programs Folder for the given User.
 int getUserType()
          Gets the user type for the link
 String getWrittenFileName()
           
 void initialize(int aType, String aName)
          This method initializes the object.
 boolean multipleUsers()
          overridden method
 void save()
          Creates and stores the shortcut-files.
 void setArguments(String args)
          Sets the command line arguments that will be passed to the target when the link is activated.
 void setCategories(String theCategories)
          Sets the Categories Field On Unixes
 void setDescription(String description)
          Sets the description string that is used to identify the link in a menu or on the desktop.
 void setEncoding(String aEncoding)
          Sets the Encoding
 void setIconLocation(String path, int index)
          Sets the path of the shortcut icon that will be shown on the desktop.
 void setKdeSubstUID(String trueFalseOrNothing)
          This sets the setKdeSubstUID
 void setKdeUserName(String aUserName)
          This sets the KdeUserName
 void setLinkName(String aName)
          Sets the name shown in a menu or on the desktop for the link.
 void setLinkType(int aType)
          Sets the type of link
 void setMimetype(String aMimeType)
          This sets the Mimetype
 void setProgramGroup(String aGroupName)
          Sets the name of the program group this ShellLinbk should be placed in.
 void setShowCommand(int show)
          Sets the show command that is passed to the target application when the link is activated.
 void setTargetPath(String aPath)
          Sets the absolute path to the shortcut target.
 void setTerminal(String trueFalseOrNothing)
          Sets the terminal
 void setTerminalOptions(String someTerminalOptions)
          This sets the terminals-options
 void setTryExec(String aTryExec)
          Sets the TryExecField on Unixes.
 void setType(String aType)
          This sets the shortcut type
 void setURL(String anUrl)
          This sets the URL
 void setUserType(int aUserType)
          Sets the user type for the link
 void setWorkingDirectory(String aDirectory)
          Sets the working directory for the link target.
 boolean supported()
          Determines if a specific instance of this class supports the creation of shortcuts.
 String toString()
           
 
Methods inherited from class com.izforge.izpack.util.os.Shortcut
cleanUp, getBasePath, getCreateForAll, getHotkey, getRunAsAdministrator, getShowCommand, getWorkingDirectory, setCreateForAll, setHotkey, setRunAsAdministrator, setUninstaller
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Unix_Shortcut

public Unix_Shortcut(Resources resources,
                     InstallData installData)
Constructs a Unix_Shortcut.

Parameters:
resources - the resources
installData - the installation data
Method Detail

build

public String build()
Builds contents of desktop file.


initialize

public void initialize(int aType,
                       String aName)
                throws Exception
Description copied from class: Shortcut
This method initializes the object. It is used as a replacement for the contructor because of the way it is instantiated through the TargetFactory.

Specified by:
initialize in class Shortcut
Parameters:
aType - the type or classification of the program group in which the link should exist.
aName - the name of the shortcut.
Throws:
Exception

supported

public boolean supported()
Description copied from class: Shortcut
Determines if a specific instance of this class supports the creation of shortcuts. The use of this method might seem odd, since one would not implement a flavor of this class that does not actually support the creation of shortcuts. In other words all flavors will in all probability return true. The only version that can be expected to return false is this class itself, since it has no actual implementation for shortcut creation. This is left to OS specific flavors. If the installer is launched on a unsupported OS there will be no appropriate flavor of this class, which will cause this class itself to be instantiated. The client code can now determine by calling this method if the active OS is supported and take appropriate action.

Specified by:
supported in class Shortcut
Returns:
true if the creation of shortcuts is supported, false if this is not supported.

getFileName

public String getFileName()
Description copied from class: Shortcut
Subclass implementations return the fully qualified file name under which the link is saved on disk. Note: this method returns valid results only if the instance was created from a file on disk or after a successful save operation. An instance of this class returns an empty string.

Specified by:
getFileName in class Shortcut
Returns:
an empty String

getProgramGroups

public List<String> getProgramGroups(int userType)
Description copied from class: Shortcut
Returns a list of currently existing program groups, based on the requested type. For example if the type is APPLICATIONS then all the names of the program groups in the Start Menu\Programs menu would be returned.

Specified by:
getProgramGroups in class Shortcut
Parameters:
userType - the type of user for the program group set.
Returns:
a Vector of String objects that represent the names of the existing program groups. It is theoretically possible that this list is empty.
See Also:
Shortcut.APPLICATIONS, Shortcut.START_MENU

getProgramsFolder

public String getProgramsFolder(int current_user)
Description copied from class: Shortcut
Gets the Programs Folder for the given User. This is where to create subfolders or to place or create shortcuts.

Specified by:
getProgramsFolder in class Shortcut
Parameters:
current_user - one of current or all
Returns:
The Foldername or null on unsupported platforms.

multipleUsers

public boolean multipleUsers()
overridden method

Specified by:
multipleUsers in class Shortcut
Returns:
true
See Also:
Shortcut.multipleUsers()

save

public void save()
          throws Exception
Creates and stores the shortcut-files.

Specified by:
save in class Shortcut
Throws:
Exception - error occured
See Also:
Shortcut.save()

execPostAction

public void execPostAction()
Post Exec Action especially for the Unix Root User. which executes the Root ShortCut Shellscript. to copy all ShellScripts to the users Desktop.

Overrides:
execPostAction in class Shortcut

getWrittenFileName

public String getWrittenFileName()

setArguments

public void setArguments(String args)
Description copied from class: Shortcut
Sets the command line arguments that will be passed to the target when the link is activated.

Specified by:
setArguments in class Shortcut
Parameters:
args - the command line arguments

setCategories

public void setCategories(String theCategories)
Description copied from class: Shortcut
Sets the Categories Field On Unixes

Overrides:
setCategories in class Shortcut
Parameters:
theCategories - the categories

setDescription

public void setDescription(String description)
Description copied from class: Shortcut
Sets the description string that is used to identify the link in a menu or on the desktop.

Specified by:
setDescription in class Shortcut
Parameters:
description - the descriptiojn string

setEncoding

public void setEncoding(String aEncoding)
Description copied from class: Shortcut
Sets the Encoding

Overrides:
setEncoding in class Shortcut

setKdeSubstUID

public void setKdeSubstUID(String trueFalseOrNothing)
Description copied from class: Shortcut
This sets the setKdeSubstUID

Overrides:
setKdeSubstUID in class Shortcut
Parameters:
trueFalseOrNothing - exactly "true" or "false" or nothing

setKdeUserName

public void setKdeUserName(String aUserName)
Description copied from class: Shortcut
This sets the KdeUserName

Overrides:
setKdeUserName in class Shortcut
Parameters:
aUserName - The UserName

setIconLocation

public void setIconLocation(String path,
                            int index)
Description copied from class: Shortcut
Sets the path of the shortcut icon that will be shown on the desktop.

Specified by:
setIconLocation in class Shortcut
Parameters:
path - a fully qualified file name of a file that contains the icon.
index - the index of the specific icon to use in the file. If there is only one icon in the file, use an index of 0.

getIconLocation

public String getIconLocation()
Description copied from class: Shortcut
Returns the path of the shortcut icon that will be shown on the desktop.

Specified by:
getIconLocation in class Shortcut
Returns:
icon path

setLinkName

public void setLinkName(String aName)
Description copied from class: Shortcut
Sets the name shown in a menu or on the desktop for the link.

Specified by:
setLinkName in class Shortcut
Parameters:
aName - The name that the link should display on a menu or on the desktop. Do not include a file extension.

setLinkType

public void setLinkType(int aType)
                 throws IllegalArgumentException,
                        UnsupportedEncodingException
Description copied from class: Shortcut
Sets the type of link

Specified by:
setLinkType in class Shortcut
Parameters:
aType - The type of link desired. The following values can be set:
Throws:
IllegalArgumentException - if an an invalid type is passed
UnsupportedEncodingException

getLinkType

public int getLinkType()
Description copied from class: Shortcut
Gets the type of link types are:

Specified by:
getLinkType in class Shortcut

setMimetype

public void setMimetype(String aMimeType)
Description copied from class: Shortcut
This sets the Mimetype

Overrides:
setMimetype in class Shortcut

setProgramGroup

public void setProgramGroup(String aGroupName)
Description copied from class: Shortcut
Sets the name of the program group this ShellLinbk should be placed in.

Specified by:
setProgramGroup in class Shortcut
Parameters:
aGroupName - the name of the program group

setShowCommand

public void setShowCommand(int show)
Description copied from class: Shortcut
Sets the show command that is passed to the target application when the link is activated. The show command determines if the the window will be restored to the previous size, minimized, maximized or visible at all.

Note:
Using HIDE will cause the target window not to show at all. There is not even a button on the taskbar. This is a very useful setting when batch files are used to launch a Java application as it will then appear to run just like any native Windows application.

Specified by:
setShowCommand in class Shortcut
Parameters:
show - the show command. Valid settings are:
See Also:
Shortcut.getShowCommand()

setTargetPath

public void setTargetPath(String aPath)
Description copied from class: Shortcut
Sets the absolute path to the shortcut target.

Specified by:
setTargetPath in class Shortcut
Parameters:
aPath - the fully qualified file name of the target

setUserType

public void setUserType(int aUserType)
Description copied from class: Shortcut
Sets the user type for the link

Specified by:
setUserType in class Shortcut
Parameters:
aUserType - the type of user for the link.
See Also:
Shortcut.CURRENT_USER, Shortcut.ALL_USERS

getUserType

public int getUserType()
Description copied from class: Shortcut
Gets the user type for the link

Specified by:
getUserType in class Shortcut
Returns:
userType
See Also:
Shortcut.CURRENT_USER, Shortcut.ALL_USERS

setWorkingDirectory

public void setWorkingDirectory(String aDirectory)
Description copied from class: Shortcut
Sets the working directory for the link target.

Specified by:
setWorkingDirectory in class Shortcut
Parameters:
aDirectory - the working directory

setTerminal

public void setTerminal(String trueFalseOrNothing)
Description copied from class: Shortcut
Sets the terminal

Overrides:
setTerminal in class Shortcut

setTerminalOptions

public void setTerminalOptions(String someTerminalOptions)
Description copied from class: Shortcut
This sets the terminals-options

Overrides:
setTerminalOptions in class Shortcut

setTryExec

public void setTryExec(String aTryExec)
Description copied from class: Shortcut
Sets the TryExecField on Unixes.

Overrides:
setTryExec in class Shortcut
Parameters:
aTryExec - the try exec command

setType

public void setType(String aType)
Description copied from class: Shortcut
This sets the shortcut type

Overrides:
setType in class Shortcut

setURL

public void setURL(String anUrl)
Description copied from class: Shortcut
This sets the URL

Overrides:
setURL in class Shortcut

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2018. All rights reserved.