public class Shortcut extends Object
TargetFactory
Modifier and Type | Field and Description |
---|---|
static int |
ALL_USERS
identifies the user type as valid for all users
|
static int |
APPLICATIONS |
private Boolean |
createForAll
indicates that this shortcut should be created for all users or only me
|
static int |
CURRENT_USER
identifies the user type as the current user
|
static int |
DESKTOP |
static int |
HIDE
Hide the window when starting.
|
static int |
MAXIMIZED
Show the window maximized when starting.
|
static int |
MINIMIZED |
static int |
NORMAL
Show the window 'normal' when starting.
|
static int |
START_MENU |
static int |
START_UP |
Constructor and Description |
---|
Shortcut() |
Modifier and Type | Method and Description |
---|---|
String |
getBasePath()
Returns the base path of the shortcut depending on type.
|
Boolean |
getCreateForAll()
Gets the create for All Flag
|
String |
getDirectoryCreated()
Subclass implementations return the path of the directory where the link file is stored, if
it was necessary during the previous save operation to create the directory.
|
String |
getFileName()
Subclass implementations return the fully qualified file name under which the link is saved
on disk.
|
int |
getHotkey()
Gets the link hotKey
|
String |
getIconLocation()
returns icon Location
|
int |
getLinkType()
|
Vector |
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 |
getShowCommand() |
int |
getUserType()
Gets the user type for the link
|
String |
getWorkingDirectory()
Gets the working directory for the link target.
|
void |
initialize(int type,
String name)
This method initializes the object.
|
boolean |
multipleUsers()
Returns
true if the target OS supports current user and all users. |
void |
save()
Saves this link.
|
void |
setArguments(String arguments)
Sets the command line arguments that will be passed to the target when the link is activated.
|
void |
setCreateForAll(Boolean aCreateForAll)
Sets the flag which indicates, that this should created for all.
|
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 string)
Sets the Encoding
|
void |
setHotkey(int hotkey)
Sets the link hotKey
|
void |
setIconLocation(String path,
int index)
Sets the location of the icon that is shown for the shortcut on the desktop.
|
void |
setKdeSubstUID(String string)
This sets the KdeSubstUID
|
void |
setLinkName(String name)
Sets the name shown in a menu or on the desktop for the link.
|
void |
setLinkType(int type)
Sets the type of link
|
void |
setMimetype(String string)
This sets the Mimetype
|
void |
setProgramGroup(String groupName)
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 path)
Sets the absolute path to the shortcut target.
|
void |
setTerminal(String string)
Sets the terminal
|
void |
setTerminalOptions(String string)
This sets the terminals-options
|
void |
setType(String string)
This sets the shortcut type
|
void |
setURL(String string)
This sets the URL
|
void |
setUserType(int type)
Sets the user type for the link
|
void |
setWorkingDirectory(String dir)
Sets the working directory for the link target.
|
boolean |
supported()
Determines if a specific instance of this class supports the creation of shortcuts.
|
public static final int APPLICATIONS
public static final int START_MENU
public static final int DESKTOP
public static final int START_UP
public static final int HIDE
public static final int NORMAL
public static final int MINIMIZED
public static final int MAXIMIZED
public static final int CURRENT_USER
public static final int ALL_USERS
private Boolean createForAll
public Shortcut()
public void initialize(int type, String name) throws Exception
TargetFactory
.type
- the type or classification of the program group in which the link should exist.name
- the name of the shortcut.Exception
public String getBasePath() throws Exception
Exception
setLinkType(int)
,
setUserType(int)
public Vector getProgramGroups(int userType)
APPLICATIONS
then all the names of the program groups in the
Start Menu\Programs menu would be returned.userType
- the type of user for the program group set.Vector
of String
objects that represent the names of
the existing program groups. It is theoretically possible that this list is empty.APPLICATIONS
,
START_MENU
public String getFileName()
String
public String getDirectoryCreated()
null
if no save operation was carried out or there was no need to
create a directory during the previous save operation.null
.public boolean multipleUsers()
true
if the target OS supports current user and all users.true
if the target OS supports current and all users.public boolean supported()
true
if the creation of shortcuts is supported, false
if this is not supported.public void setArguments(String arguments)
arguments
- the command line argumentspublic void setDescription(String description)
description
- the descriptiojn stringpublic void setIconLocation(String path, int index)
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.public String getIconLocation()
public void setProgramGroup(String groupName)
groupName
- the name of the program grouppublic void setShowCommand(int show)
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.show
- the show command. Valid settings are: getShowCommand()
public int getShowCommand()
public void setTargetPath(String path)
path
- the fully qualified file name of the targetpublic void setWorkingDirectory(String dir)
dir
- the working directorypublic String getWorkingDirectory()
public void setLinkName(String name)
name
- The name that the link should display on a menu or on the desktop. Do not include
a file extension.public int getLinkType()
public void setLinkType(int type) throws IllegalArgumentException, UnsupportedEncodingException
type
- The type of link desired. The following values can be set:IllegalArgumentException
- if an an invalid type is passedUnsupportedEncodingException
public void setUserType(int type)
type
- the type of user for the link.CURRENT_USER
,
ALL_USERS
public int getUserType()
CURRENT_USER
,
ALL_USERS
public void save() throws Exception
Exception
- if problems are encounteredpublic int getHotkey()
public void setHotkey(int hotkey)
hotkey
- public void setEncoding(String string)
string
- public void setMimetype(String string)
string
- public void setTerminal(String string)
string
- public void setTerminalOptions(String string)
string
- public void setKdeSubstUID(String string)
string
- public String getProgramsFolder(int current_user)
current_user
- one of current or allpublic void setCreateForAll(Boolean aCreateForAll)
aCreateForAll
- A Flag - Set to true, if to create for All.public Boolean getCreateForAll()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses