org.pietschy.command
Class CommandHyperlinkListener
java.lang.Object
org.pietschy.command.CommandHyperlinkListener
- HyperlinkListener
public class CommandHyperlinkListener
extends java.lang.Object
implements HyperlinkListener
A
javax.swing.event.HyperlinkListener
that will interogate the href of the
link and fire the appropriate command. Commands can be specified in the
anchor using the following syntax
command://my.command.id?hintName1=hintValue,hintName2=hintVale
A simple command would be specified using
command://my.command.name
The
command:// protocol is not registered with the standard URL infrastructure.
The
buildAnchorString
method can be used to create a correctly formatted URL
string from a specified command.
CommandHyperlinkListener
public CommandHyperlinkListener()
CommandHyperlinkListener
public CommandHyperlinkListener(CommandManager commandManager)
Creates a new
HyperlinkListener
that will search for commands using the
specified
CommandManager
.
commandManager
- the container used to locate commands.
buildAnchorString
public static String buildAnchorString(ActionCommand command)
Builds an <a> tag for the specified command using the commands text attribute to
populate the links text and the short description to populate the tooltip. The "html"
face is used if specified, the default face is used otherwise.
command
- the command to be activated by the link
- a formated <a> tag to be inserted into html.
buildAnchorString
public static String buildAnchorString(ActionCommand command,
Map hints)
Builds an <a> tag for the specified command using the commands text attribute to
populate the links text and the short description to populate the tooltip. The "html"
face is used if specified, the default face is used otherwise.
command
- the command to be activated by the linkhints
- a map of hints to be specified to the command when it executes.
- a formated <a> tag to be inserted into html.
buildAnchorString
public static String buildAnchorString(ActionCommand command,
Map hints,
String text)
buildAnchorString
public static String buildAnchorString(ActionCommand command,
Map hints,
String text,
String toolTip)
buildAnchorString
public static String buildAnchorString(ActionCommand command,
String text)
Builds an <a> tag for the specified command but that uses the specified text instead
of the Commands normal text.
command
- the command to be activated by the linktext
- the text to display
- a formated <a> tag to be inserted into html.
getCommandIdFromUrl
protected String getCommandIdFromUrl(String url)
getHints
protected Map getHints(String url)
getPopupFor
protected JPopupMenu getPopupFor(CommandGroup group)
hyperlinkUpdate
public void hyperlinkUpdate(HyperlinkEvent e)
main
public static void main(String[] args)