Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.fm.gui
Class fmHyperlinkRouter  view fmHyperlinkRouter download fmHyperlinkRouter.java

java.lang.Object
  extended bycom.fm.gui.fmHyperlinkRouter
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.HyperlinkListener

public class fmHyperlinkRouter
extends java.lang.Object
implements javax.swing.event.HyperlinkListener

Entities of class handle hyperlink events within GUI components.

The fmHyperlinkRouter serves as a hyperlink event router. Entities of the class handle link update event, then scan own table of prefix handlers and if URL starts with one of prefixes defined in this table the event is routed to appropriate prefix handler handler. If no prefix handler is defined the URL will be served by external or internal browser respectively.

The prefix handler is a HyperLinkListener entity, which performs some specific operations with link which starts with handler specific prefix.

It's assumed that only one handler for the prefix exists in the router configuration. This is done to avoid overlapped actions of handlers of the same type


Field Summary
private  java.lang.String browserCmd
           
private  java.util.HashMap prefixHandlers
           
 
Constructor Summary
fmHyperlinkRouter(java.lang.String extCmd)
          Constructor.
fmHyperlinkRouter(java.lang.String extCmd, java.util.HashMap handlers)
          Constructor.
 
Method Summary
 void hyperlinkUpdate(javax.swing.event.HyperlinkEvent e)
          Called when a hypertext link is updated.
 void setBrowserCommand(java.lang.String brCmd)
          Set browser's command
 void setPrefixHandler(java.lang.String prefix, javax.swing.event.HyperlinkListener handler)
          Set handler for prefix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

browserCmd

private java.lang.String browserCmd

prefixHandlers

private java.util.HashMap prefixHandlers
Constructor Detail

fmHyperlinkRouter

public fmHyperlinkRouter(java.lang.String extCmd)
Constructor.

If extCmd is null then editor component will handle URL by using setPage method of the JEditorPane component.


fmHyperlinkRouter

public fmHyperlinkRouter(java.lang.String extCmd,
                         java.util.HashMap handlers)
Constructor.

If extCmd is null then editor component will handle URL by using setPage method of the JEditorPane component.

Method Detail

hyperlinkUpdate

public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent e)
Called when a hypertext link is updated.

Specified by:
hyperlinkUpdate in interface javax.swing.event.HyperlinkListener

setPrefixHandler

public void setPrefixHandler(java.lang.String prefix,
                             javax.swing.event.HyperlinkListener handler)
Set handler for prefix

Note tha new handler always replaces existing if any.


setBrowserCommand

public void setBrowserCommand(java.lang.String brCmd)
Set browser's command