xml.hyperlinks
Class XMLHyperlinkSource

java.lang.Object
  extended by xml.hyperlinks.XMLHyperlinkSource
All Implemented Interfaces:
gatchan.jedit.hyperlinks.HyperlinkSource

public class XMLHyperlinkSource
extends java.lang.Object
implements gatchan.jedit.hyperlinks.HyperlinkSource

Provides hyperlinks from XML attributes. Supported hyperlinks are :

Version:
$Id: XMLHyperlinkSource.java 22580 2012-12-17 16:15:42Z kerik-sf $
Author:
Eric Le Lay

Field Summary
 
Fields inherited from interface gatchan.jedit.hyperlinks.HyperlinkSource
DEFAULT_PROPERTY, NONE, PROPERTY, SERVICE
 
Constructor Summary
XMLHyperlinkSource()
           
 
Method Summary
static gatchan.jedit.hyperlinks.HyperlinkSource create()
           
 gatchan.jedit.hyperlinks.Hyperlink getHyperlink(org.gjt.sp.jedit.Buffer buffer, int offset)
          Returns the hyperlink for the given offset.
 gatchan.jedit.hyperlinks.Hyperlink getHyperlink(org.gjt.sp.jedit.Buffer buffer, int offset, XmlParsedData data, XmlTag asset, boolean isHTML)
          Returns the hyperlink for the given offset.
 gatchan.jedit.hyperlinks.Hyperlink getHyperlinkForAttribute(org.gjt.sp.jedit.Buffer buffer, int offset, java.lang.String tagNS, java.lang.String tagLocalName, java.lang.String attNS, java.lang.String attLocalName, java.lang.String attValue, XmlParsedData data, XmlTag tag, XmlDocument.Attribute att, boolean isHTML)
          recognize hyperlink attributes by their parent element's namespace:localname and/or their namespace:localname
 gatchan.jedit.hyperlinks.Hyperlink getHyperlinkForAttribute(org.gjt.sp.jedit.Buffer buffer, int offset, XmlParsedData data, XmlTag sideKickTag, XmlDocument.Attribute att, boolean isHTML)
          get an hyperlink for an identified XML attribute
 gatchan.jedit.hyperlinks.Hyperlink getHyperlinkForIDREF(org.gjt.sp.jedit.Buffer buffer, XmlParsedData data, java.lang.String id, XmlDocument.Attribute att)
          creates an hyperlink to the location of the element with id (in same or another buffer).
 gatchan.jedit.hyperlinks.Hyperlink getHyperlinkForIDREFS(org.gjt.sp.jedit.Buffer buffer, int offset, XmlParsedData data, java.lang.String attValue, XmlDocument.Attribute att)
          creates an hyperlink to the location of the element with id (in same or another buffer)
 HTMLHyperlinkSource.IsHyperLink isHyperlink(org.gjt.sp.jedit.Buffer buffer, int offset, java.lang.String tagNS, java.lang.String tagLocalName, java.lang.String attNS, java.lang.String attLocalName, java.lang.String attValue, int attStart)
          recognize hyperlink attributes by their parent element's namespace:localname and/or their namespace:localname
 gatchan.jedit.hyperlinks.Hyperlink newJEditOpenFileAndGotoHyperlink(org.gjt.sp.jedit.Buffer buffer, XmlDocument.Attribute att, java.lang.String href, int gotoLine, int gotoCol)
          create an hyperlink for attribute att.
 gatchan.jedit.hyperlinks.Hyperlink newJEditOpenFileHyperlink(org.gjt.sp.jedit.Buffer buffer, XmlDocument.Attribute att, java.lang.String href)
          create an hyperlink for attribute att.
 java.lang.String resolve(java.lang.String uri, org.gjt.sp.jedit.Buffer buffer, int offset, XmlParsedData data, XmlTag tag, boolean useXmlBase)
          resolve a potentially relative uri using xml:base attributes, the buffer's URL, xml.Resolver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLHyperlinkSource

public XMLHyperlinkSource()
Method Detail

getHyperlink

public gatchan.jedit.hyperlinks.Hyperlink getHyperlink(org.gjt.sp.jedit.Buffer buffer,
                                                       int offset)
Returns the hyperlink for the given offset. returns an hyperlink as soon as pointer enters the attribute's value

Specified by:
getHyperlink in interface gatchan.jedit.hyperlinks.HyperlinkSource
Parameters:
buffer - the buffer
offset - the offset
Returns:
the hyperlink (or null if there is no hyperlink)

getHyperlink

public gatchan.jedit.hyperlinks.Hyperlink getHyperlink(org.gjt.sp.jedit.Buffer buffer,
                                                       int offset,
                                                       XmlParsedData data,
                                                       XmlTag asset,
                                                       boolean isHTML)
Returns the hyperlink for the given offset. returns an hyperlink as soon as pointer enters the attribute's value

Parameters:
buffer - the buffer
offset - the offset
data - the parsed data for this buffer
asset - the tag at offset
isHTML - is buffer mode html parsed as xml (to fallback to HTML attributes recognised as hrefs)
Returns:
the hyperlink (or null if there is no hyperlink)

getHyperlinkForAttribute

public gatchan.jedit.hyperlinks.Hyperlink getHyperlinkForAttribute(org.gjt.sp.jedit.Buffer buffer,
                                                                   int offset,
                                                                   XmlParsedData data,
                                                                   XmlTag sideKickTag,
                                                                   XmlDocument.Attribute att,
                                                                   boolean isHTML)
get an hyperlink for an identified XML attribute

Parameters:
buffer - current buffer
offset - offset where an hyperlink is required in current buffer
data - sidekick tree for current buffer
asset - element containing offset
att - parsed attribute
isHTML - we are dealing with an HTML buffer

getHyperlinkForIDREF

public gatchan.jedit.hyperlinks.Hyperlink getHyperlinkForIDREF(org.gjt.sp.jedit.Buffer buffer,
                                                               XmlParsedData data,
                                                               java.lang.String id,
                                                               XmlDocument.Attribute att)
creates an hyperlink to the location of the element with id (in same or another buffer).

Parameters:
buffer - current buffer
data - sidekick tree
id - id we are looking for
att - parsed attribute (for hyperlink boundaries)

getHyperlinkForIDREFS

public gatchan.jedit.hyperlinks.Hyperlink getHyperlinkForIDREFS(org.gjt.sp.jedit.Buffer buffer,
                                                                int offset,
                                                                XmlParsedData data,
                                                                java.lang.String attValue,
                                                                XmlDocument.Attribute att)
creates an hyperlink to the location of the element with id (in same or another buffer)

Parameters:
buffer - current buffer
offset - offset of required hyperlink
data - sidekick tree
attValue - ids in the attribute
att - parsed attribute (for hyperlink boundaries)

isHyperlink

public HTMLHyperlinkSource.IsHyperLink isHyperlink(org.gjt.sp.jedit.Buffer buffer,
                                                   int offset,
                                                   java.lang.String tagNS,
                                                   java.lang.String tagLocalName,
                                                   java.lang.String attNS,
                                                   java.lang.String attLocalName,
                                                   java.lang.String attValue,
                                                   int attStart)
recognize hyperlink attributes by their parent element's namespace:localname and/or their namespace:localname


getHyperlinkForAttribute

public gatchan.jedit.hyperlinks.Hyperlink getHyperlinkForAttribute(org.gjt.sp.jedit.Buffer buffer,
                                                                   int offset,
                                                                   java.lang.String tagNS,
                                                                   java.lang.String tagLocalName,
                                                                   java.lang.String attNS,
                                                                   java.lang.String attLocalName,
                                                                   java.lang.String attValue,
                                                                   XmlParsedData data,
                                                                   XmlTag tag,
                                                                   XmlDocument.Attribute att,
                                                                   boolean isHTML)
recognize hyperlink attributes by their parent element's namespace:localname and/or their namespace:localname


resolve

public java.lang.String resolve(java.lang.String uri,
                                org.gjt.sp.jedit.Buffer buffer,
                                int offset,
                                XmlParsedData data,
                                XmlTag tag,
                                boolean useXmlBase)
resolve a potentially relative uri using xml:base attributes, the buffer's URL, xml.Resolver. Has the effect of opening the cached document if it's in cache (eg. docbook XSD if not in catalog). Maybe this is not desirable, because if there is a relative link in this document, it won't work because the document will be .jedit/dtds/cachexxxxx.xml and not the real url.

Parameters:
uri - text of uri to reach
buffer - current buffer
offset - offset in current buffer where an hyperlink is required
data - SideKick parsed data
tag - SideKick asset
useXmlBase - should xml:base attribute be used to resolve uri (only for XML!)
Returns:
resolved URL

newJEditOpenFileHyperlink

public gatchan.jedit.hyperlinks.Hyperlink newJEditOpenFileHyperlink(org.gjt.sp.jedit.Buffer buffer,
                                                                    XmlDocument.Attribute att,
                                                                    java.lang.String href)
create an hyperlink for attribute att. the hyperlink will span whole attribute value

Parameters:
buffer - current buffer
att - parsed attribute
href - uri to open

newJEditOpenFileAndGotoHyperlink

public gatchan.jedit.hyperlinks.Hyperlink newJEditOpenFileAndGotoHyperlink(org.gjt.sp.jedit.Buffer buffer,
                                                                           XmlDocument.Attribute att,
                                                                           java.lang.String href,
                                                                           int gotoLine,
                                                                           int gotoCol)
create an hyperlink for attribute att. the hyperlink will span whole attribute value

Parameters:
buffer - current buffer
att - parsed attribute
href - uri to open
gotoLine - target line in buffer
gotoCol - target column in buffer

create

public static gatchan.jedit.hyperlinks.HyperlinkSource create()