org.af.commons.install
Class DesktopShortcut

java.lang.Object
  extended by org.af.commons.install.DesktopShortcut
Direct Known Subclasses:
FreeDesktopShortcut, WindowsDesktopShortcut

public abstract class DesktopShortcut
extends Object

Abstract base class to create a shortcut on the desktop. Subclasses provide implementations for different operating systems.


Method Summary
 void addParameter(File param)
          Add a file path as parameter to the executable.
 void addParameter(String param)
          Add a parameter to the executable.
abstract  void create()
          Creates the shortcut.
 String getDescription()
          Returns the description for this shortcut.
 String getExec()
          Returns the targetted executable.
 String getIconpath()
          Return the path to the used icon.
 String getName()
          Returns the visble name of the shortcut.
 File getShortcutDir()
          Returns the directory the shortcut will be created in.
 File getWorkingDir()
          Returns the working directory for the desktop shortcut.
 void setDescription(String description)
          Sets the description for this shortcut.
 void setIconpath(File icon)
          Sets the icon for the desktop shortcut.
 void setIconpath(String iconpath)
          Sets the icon for the desktop entry.
 void setWorkingDir(File workingDir)
          Sets the working directory for the desktop shortcut.
 void setWorkingDir(String workingDir)
          Sets the working directory for the desktop shortcut.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getName

public String getName()
Returns the visble name of the shortcut.

Returns:
The visble name of the shortcut.

getShortcutDir

public File getShortcutDir()
Returns the directory the shortcut will be created in.

Returns:
The directory the shortcut will be created in.

getExec

public String getExec()
Returns the targetted executable.

Returns:
The targetted executable.

addParameter

public void addParameter(String param)
Add a parameter to the executable. Parameters are automatically separated by whitespaces. Don't forget to enclose file paths in extra quotes.

Parameters:
param - added parameter for executable target.

addParameter

public void addParameter(File param)
Add a file path as parameter to the executable. Parameters are automatically separated by whitespaces. Automatically enclosed by quotes.

Parameters:
param - added parameter for executable target.

getIconpath

public String getIconpath()
Return the path to the used icon.

Returns:
Path to used icon.

setIconpath

public void setIconpath(File icon)
Sets the icon for the desktop shortcut.

Parameters:
icon - Icon file for the desktop entry.

setIconpath

public void setIconpath(String iconpath)
Sets the icon for the desktop entry.

Parameters:
iconpath - Absolute path to specify the icon for the desktop entry.

setWorkingDir

public void setWorkingDir(File workingDir)
Sets the working directory for the desktop shortcut.

Parameters:
workingDir - The working directory for the desktop shortcut.

setWorkingDir

public void setWorkingDir(String workingDir)
Sets the working directory for the desktop shortcut.

Parameters:
workingDir - The working directory for the desktop shortcut.

getWorkingDir

public File getWorkingDir()
Returns the working directory for the desktop shortcut.

Returns:
The working directory for the desktop shortcut.

getDescription

public String getDescription()
Returns the description for this shortcut.

Returns:
The description for this shortcut.

setDescription

public void setDescription(String description)
Sets the description for this shortcut.

Parameters:
description - The description for this shortcut.

create

public abstract void create()
                     throws IOException
Creates the shortcut. Call this once after you have passed all relevant settings.

Throws:
IOException - If something bad happens while writing the link.