|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.tree.DefaultMutableTreeNode
wxtpages.unit
Base class for document-units. The class implements basic addressing dombuilding, load/save functionality. Inherits from DefaultMutableTreeNode.
Field Summary | |
static java.lang.String |
CONTENT_TYPE
|
static java.lang.String |
DBCONTENT_TYPE
|
static java.lang.String |
GROUP_TYPE
|
protected java.net.URI |
m_absoluteUri
The uri as calculated based on the original uri and the anchor available from the owning group |
protected java.lang.String |
m_description
Description as from script. |
protected org.w3c.dom.Document |
m_Doc
Content as DOM-tree. |
protected unitGroup |
m_GroupMaster
The group object that "owns" this unit. |
protected long |
m_lastTimeUsed
The last time this unit was used |
protected org.w3c.dom.Element |
m_myElement
The element node in the script that defines this unit |
protected java.lang.String |
m_name
name of this unit. m_type is used for anonymous units |
protected java.util.HashMap |
m_optionMap
Options available for this unit: name - value pairs |
protected java.net.URI |
m_originalUri
The uri as used in constructor, normally the address given in the script |
protected java.util.HashMap |
m_parameterMap
Parameters and default values for actual transformation. |
protected java.util.HashMap |
m_propertyMap
Properties available for this unit: name - value pairs |
protected java.lang.String |
m_txtContent
Content as text |
protected java.lang.String |
m_type
A string defining type of unit. |
static java.lang.String |
PAGE_TYPE
|
static java.lang.String |
TEMPLATE_TYPE
|
static java.lang.String |
TEXTCONTENT_TYPE
|
static java.lang.String |
TRANSFORMATION_TYPE
|
static java.lang.String |
UNIT_TYPE
string constants defining type of unit |
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode |
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject |
Constructor Summary | |
unit(unitGroup master,
org.w3c.dom.Element elt,
reporter rep)
Creates a new instance of unit |
Method Summary | |
void |
addTransformationParameters(java.util.HashMap transparams)
Append new paramters to the transformation associated with this unit |
void |
browseUnit(java.awt.event.ActionEvent evt)
What to do when we want to browse this unit in a browser. |
boolean |
build()
Build this unit. |
protected boolean |
calculateAbsoluteAddress(java.lang.String location)
Try to calculate the absolute URI based on the given location and the anchor address held by this units owning group The construction of an absolute URI is necessary for a unit to be reckognized and used. |
void |
controlLinks(java.util.Vector tagAttList,
boolean includeAbsolutes)
Checking all links according to list of tags and matching attribute |
void |
correctAllAddressingInDocument(org.w3c.dom.Document thisDoc,
java.net.URI baseUri,
java.util.Vector adrList)
Correct all relevant links in the nodes of a Document. |
void |
correctAllAddressingInFragment(org.w3c.dom.Node theN,
java.net.URI baseUri,
java.util.Vector adrList)
Correct all relevant links in the nodes of a fragment. |
protected java.lang.String |
correctOneCommonLink(java.net.URI baseUri,
java.lang.String S,
java.lang.String commonName,
java.lang.String commonValue)
Correct the link as found in a string |
void |
correctStyleAttributes(org.w3c.dom.Node theN)
Correct common resources in style-attributes, not elements |
void |
correctStyleElements()
Correct common resources in styles in style-elements, not attributes |
java.lang.String |
correctStyleString(java.lang.String styleString)
Correct common resources in a style string |
void |
displayProperties(javax.swing.JFrame dialogOwner)
Show the properties of this unit in a dialog box. |
void |
editUnit(java.awt.event.ActionEvent evt)
What to do when we want to open this unit in an editor. |
protected boolean |
establishDom()
Attempt to establish the DOM for this unit. |
java.net.URI |
getAbsoluteUri()
Get the absolute URI for this unit as an URI |
java.lang.String |
getAbsoluteUriAsString()
Get the absolute URI for this unit as a string |
java.lang.String |
getAsText()
Get the units content as String. |
java.lang.String |
getDescription()
Get the descrition as found in the script |
org.w3c.dom.Document |
getDoc()
Returns the DOM Attempts to build the dom if necessary |
org.w3c.dom.Document |
getDocCopy()
Returns a deep copy of the DOM Attempts to build the dom if necessary |
java.lang.String |
getEncoding()
Get the encoding |
java.lang.String |
getFileName()
Get the short filename |
java.lang.String |
getName()
Get the name |
org.w3c.dom.NodeList |
getNodeList(command cmd)
Get list of all selected nodes. |
java.lang.String |
getOption(java.lang.String key)
Get a spesific option |
java.util.HashMap |
getOptions()
Get the options that are active for this unit. |
java.lang.String |
getOriginalAsString()
Get the original (given when constructed) URI for this unit as a string |
java.net.URI |
getOriginalUri()
Get the original (given when constructed) URI for this unit as a string |
java.util.HashMap |
getProperties()
Get the properties that are active for this unit. |
reporter |
getReporter()
get the reporter for this unit |
unitTransformation |
getTransformation()
Get the transformation for this unit Transformations are used on input on contentfiles and templates, and on output on pages |
java.lang.String |
getTransformationAsString()
Get the URI of transformation for this unit as a String. |
java.lang.String |
getTransformationID()
Get the id for this units transformation Transformations are used on input on contentfiles and templates, and on output on pages |
java.util.HashMap |
getTransformationParameterMap()
Get the transformationparameters for this unit |
java.lang.String |
getType()
Get the type of unit |
java.lang.String |
getURItoAsString(unit U)
How to refer to the given unit from this unit |
boolean |
isSameAs(unit uc)
Decides if two content files may be reused as DOM The condition is that they have same absolute URI, the same transformation (if any) and the same transformation parameters (if any) |
boolean |
isUpdatedAfterUse()
Decides if this unit has been updated from an other program since it was last used by this program instance. |
void |
killDocument()
Take it down, destroy text and DOM |
boolean |
loadAsText()
Loading this unit as a text |
org.w3c.dom.Comment |
makeComment(java.lang.String s)
Produce a legal XML-comment |
org.w3c.dom.Element |
makeImageRefToPage(unit P,
java.lang.String imagepath,
java.lang.String alt,
java.lang.String targetFrame)
Produce a refelement ( a ) to the given page The imagepath is searced for common resources and adjusted accordingly. |
org.w3c.dom.Element |
makeRefToPage(unit P,
java.lang.String txt,
java.lang.String targetFrame)
Produce a refelement( a ) to the given page |
boolean |
prepare(unit p,
java.lang.String theCommonName,
java.lang.String theCommonValue)
Prepare this unit with PI-imports with named URI's. |
void |
saveFromDOM()
Saving from DOM-tree, take transformation into account |
void |
setEncoding(java.lang.String enc)
Set the encoding in m_optionMap |
void |
setNowAsLastTimeUsed()
Makes a note of current time as last time used |
void |
setReporter(reporter rep)
set the reporter for this unit |
void |
setTransformationFromString(java.lang.String transString)
Set a transformation for this unit |
void |
setTransformationId(java.lang.String transid)
Set the transformation ID for this unit |
javax.swing.JPopupMenu |
setUpPopMenu(javax.swing.JPopupMenu theMenu,
javax.swing.JFrame main)
Produce a popupMenu for this unit. |
java.lang.String |
toString()
Get the name of this unit |
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode |
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String UNIT_TYPE
public static final java.lang.String GROUP_TYPE
public static final java.lang.String PAGE_TYPE
public static final java.lang.String TEMPLATE_TYPE
public static final java.lang.String TRANSFORMATION_TYPE
public static final java.lang.String CONTENT_TYPE
public static final java.lang.String TEXTCONTENT_TYPE
public static final java.lang.String DBCONTENT_TYPE
protected java.lang.String m_type
protected unitGroup m_GroupMaster
protected java.lang.String m_txtContent
protected org.w3c.dom.Document m_Doc
protected java.lang.String m_name
protected java.lang.String m_description
protected org.w3c.dom.Element m_myElement
protected long m_lastTimeUsed
protected java.net.URI m_originalUri
protected java.net.URI m_absoluteUri
protected java.util.HashMap m_optionMap
protected java.util.HashMap m_propertyMap
protected java.util.HashMap m_parameterMap
Constructor Detail |
public unit(unitGroup master, org.w3c.dom.Element elt, reporter rep)
master
- The owning unitGroup-object, null if this is a unitGroupelt
- The element in the script that describes this unitMethod Detail |
public java.lang.String getName()
public reporter getReporter()
public void setReporter(reporter rep)
rep
- The reporterpublic java.lang.String getEncoding()
public void setEncoding(java.lang.String enc)
enc
- The encoding to be setpublic java.lang.String getType()
public java.lang.String getDescription()
public java.net.URI getAbsoluteUri()
public java.lang.String getFileName()
public java.lang.String getAbsoluteUriAsString()
public java.net.URI getOriginalUri()
public java.lang.String getOriginalAsString()
public java.lang.String toString()
DefaultMutableTreeNode.getUserObject()
public java.util.HashMap getOptions()
public java.lang.String getOption(java.lang.String key)
key
- The key
public java.util.HashMap getProperties()
public java.lang.String getTransformationID()
Transformations are used on input on contentfiles and templates, and on output on pages
public unitTransformation getTransformation()
Transformations are used on input on contentfiles and templates, and on output on pages
public java.lang.String getTransformationAsString()
Transformations are used on input on contentfiles and templates, and on output on pages
public void setTransformationId(java.lang.String transid)
transid
- The new value for the transformation IDpublic void addTransformationParameters(java.util.HashMap transparams)
transparams
- The new parameter as name-value pairspublic org.w3c.dom.NodeList getNodeList(command cmd)
cmd
- The command that describes the parameetrs
public org.w3c.dom.Comment makeComment(java.lang.String s)
s
- The string in the comment
public javax.swing.JPopupMenu setUpPopMenu(javax.swing.JPopupMenu theMenu, javax.swing.JFrame main)
theMenu
- The menu we will preparemain
- The frame that owns the menu
public void displayProperties(javax.swing.JFrame dialogOwner)
dialogOwner
- The frame that will own this dialog.public void editUnit(java.awt.event.ActionEvent evt)
evt
- The event that triggered this actionpublic void browseUnit(java.awt.event.ActionEvent evt)
evt
- The evente that triggrede this actionpublic boolean isUpdatedAfterUse()
public void setNowAsLastTimeUsed()
public org.w3c.dom.Document getDoc()
public org.w3c.dom.Document getDocCopy()
public java.lang.String getURItoAsString(unit U)
U
- The unit we will refer to from this unit
public java.util.HashMap getTransformationParameterMap()
public void killDocument()
public boolean isSameAs(unit uc)
uc
- The unitContent object to compare with
protected boolean calculateAbsoluteAddress(java.lang.String location)
The construction of an absolute URI is necessary for a unit to be reckognized and used. Failing to calculate an absolute URI is considered a fatal error.
location
- The given unit as given in script or found otherwise
public void setTransformationFromString(java.lang.String transString) throws java.lang.Exception
transString
- A string that stems either from an element or a command
java.lang.Exception
public boolean prepare(unit p, java.lang.String theCommonName, java.lang.String theCommonValue)
p
- The unit that will use this unit as content, may not be nulltheCommonName
- The name used for common resources in the materialtheCommonValue
- The value that we will use
public boolean build()
protected boolean establishDom()
public boolean loadAsText()
public java.lang.String getAsText()
public void saveFromDOM()
public org.w3c.dom.Element makeRefToPage(unit P, java.lang.String txt, java.lang.String targetFrame) throws org.w3c.dom.DOMException
targetFrame
- The target frameP
- The page we are refering totxt
- The text that will show
org.w3c.dom.DOMException
- when we cannot make the Elementpublic org.w3c.dom.Element makeImageRefToPage(unit P, java.lang.String imagepath, java.lang.String alt, java.lang.String targetFrame)
The imagepath is searced for common resources and adjusted accordingly. A title attribute is added based on the page's description
targetFrame
- The target frameP
- The page we are referring toimagepath
- Path to the image that will represent the linkalt
- String to the alt attribute in the img element. If null the image name is used.
public void correctAllAddressingInFragment(org.w3c.dom.Node theN, java.net.URI baseUri, java.util.Vector adrList)
theN
- The fragment we will investigatebaseUri
- The uri we will use as an anchoradrList
- The uri's we assume may be current basepublic void correctAllAddressingInDocument(org.w3c.dom.Document thisDoc, java.net.URI baseUri, java.util.Vector adrList)
baseUri
- The uri we will use as an anchoradrList
- The uri's we assume may be current baseprotected java.lang.String correctOneCommonLink(java.net.URI baseUri, java.lang.String S, java.lang.String commonName, java.lang.String commonValue)
baseUri
- The URI which is used as an anchorS
- the string we attempt to correctcommonName
- The name of the catalog we are looking for in S. We will detect and remove ../'s preceding the namecommonValue
- The value we will replace commonName with
public void correctStyleElements()
public void correctStyleAttributes(org.w3c.dom.Node theN)
theN
- The Node we investigatepublic java.lang.String correctStyleString(java.lang.String styleString)
styleString
- The string we investigate
public void controlLinks(java.util.Vector tagAttList, boolean includeAbsolutes)
includeAbsolutes
- true if absolute links are to be checkedtagAttList
- List of tags and attributes to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |