wxtpages
Class unitGroup

java.lang.Object
  extended byjavax.swing.tree.DefaultMutableTreeNode
      extended bywxtpages.unit
          extended bywxtpages.unitGroup
All Implemented Interfaces:
java.lang.Cloneable, javax.swing.tree.MutableTreeNode, java.io.Serializable, javax.swing.tree.TreeNode

public class unitGroup
extends unit

An instance of unitGroup owns and administrates a group (hierarchy) of pages that belong to one and the same group according to the script. An instance of unitGroup in turn is owned by scripthandler. The unitGroup instances with the owned pages are (re)created each time the script is parsed.

See Also:
Serialized Form

Field Summary
protected  java.util.HashMap m_addressMap
          Addressing to be used for addressrecalculation for this group: tag - attribute pairs. affected by element adressing in script
protected  java.util.Vector m_execCommands
          commands - direct exec's: wxtutil.commandDescrition
protected  java.util.Vector m_secondPhasePages
          Pages that should be built in the second phase of a build process because they contain elements that are depending on established content in other pages
protected  java.util.HashMap m_templateMap
          templates, ID - Absolute URI pairs
protected  java.util.HashMap m_transformationMap
          transformations, ID - Absolute URI pairs
 
Fields inherited from class wxtpages.unit
CONTENT_TYPE, DBCONTENT_TYPE, GROUP_TYPE, m_absoluteUri, m_description, m_Doc, m_GroupMaster, m_lastTimeUsed, m_myElement, m_name, m_optionMap, m_originalUri, m_parameterMap, m_propertyMap, m_txtContent, m_type, PAGE_TYPE, TEMPLATE_TYPE, TEXTCONTENT_TYPE, TRANSFORMATION_TYPE, UNIT_TYPE
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
unitGroup(org.w3c.dom.Element elt, scripthandler scripth)
          Creates a new instance of unitGoup
 
Method Summary
 boolean buildForced(javax.swing.JProgressBar pBar, java.util.Vector units)
          Build everything or selection unconditionally Commands are executed first, before all pages All pages are assembled from scratch.
 boolean buildUpdated(javax.swing.JProgressBar pBar, java.util.Vector buildList)
          Build only pages that have content, template or transformation objects that are updated from an other programs since last build.
protected  void collectFromScript()
          Get some data from the node in the script that defines this group: Attributes: the location that serves as anchor for this group of pages name Siblings: templates, transformations, properties, options, addressing Children: description, common, templates, transformations, properties, options, addressing, execCommands
 void displayProperties(javax.swing.JFrame dialogOwner)
          Show the properties of this unitgroup in a dialog box
 unitPage findPageByName(java.lang.String pagename)
          Find a page in this group with a given name If more than one match, the first found in a preorder traversel is returned
 unitPage findPageByPartialRef(java.lang.String path)
          Find a page in this group whos absolute URI ends with the given pathpart If more than one match, the first found in a preorder traversel is returned
 int getAUniquenumber()
          Get a sufficiently unique integer value to help differentiate between pagelocal anchors in one and the same page with same name
 java.net.URI getBuildAnchorURI()
          Get the anchor for this group, that is the absolute uri we are building pages relative to in this group
 java.lang.String getCommonCatalog()
          Get common catalog (value), that is where the common resources are actually stored for this group.
 java.lang.String getCommonName()
          Get common name, that is what the common catalog is called in files in this group.
 unit getContent(int ix)
          Try to access a contentobject by its index
 indexTable getIndexTableByName(java.lang.String tabname)
          Try to find an indexTable by its name
 int getPageCount()
          Get number of pages in this group
 java.lang.String getPageCountAsString()
          Get number of pages in this group as string
 java.util.Vector getPageLocations()
          Get a list of all pagelocations in the group
 java.util.Vector getPages()
          Get a list of all pages in the group
 scripthandler getScriptHandler()
          Get the scripthandler that administrates this and all other groups in the script.
 unitTemplate getTemplate(java.lang.String tmplt)
          Try to access a template by its id
 unitTransformation getTransformation(java.lang.String trans)
          Try to access a transformation by its id
 boolean prepare(unit p, java.lang.String theCommonName, java.lang.String theCommonValue)
          Prepare this unitGroup with imports from non-content files.
 int registerContent(unit uc)
          Register a unitContent object as found by a page
protected  void registerForSecondPhase(unitPage p)
          Register a page that must be built in a second phase.
 void registerIndexedWord(java.lang.String tabname, java.lang.String word, unitPage page, java.lang.String fragment)
          Register a new entry to an index table
 void registerTemplate(java.lang.String name, unitTemplate ut)
          Register a new template to the hashmap that holds templates: m_templateMap
 void registerTransformation(java.lang.String name, unitTransformation ut)
          Register a new transformation to the hashmap that holds transformations: m_transformationMap
 javax.swing.JPopupMenu setUpPopMenu(javax.swing.JPopupMenu theMenu, javax.swing.JFrame main)
          Set up a popupMenu for this unitGroup.
 boolean templateExist(java.lang.String tmplt)
          Check if a template with a certain ID is registered
 java.lang.String toString()
          m_name as a string representation of this group
 boolean transformationExist(java.lang.String trans)
          Check if a transformation with a certain ID is registered
 
Methods inherited from class wxtpages.unit
addTransformationParameters, browseUnit, build, calculateAbsoluteAddress, controlLinks, correctAllAddressingInDocument, correctAllAddressingInFragment, correctOneCommonLink, correctStyleAttributes, correctStyleElements, correctStyleString, editUnit, establishDom, getAbsoluteUri, getAbsoluteUriAsString, getAsText, getDescription, getDoc, getDocCopy, getEncoding, getFileName, getName, getNodeList, getOption, getOptions, getOriginalAsString, getOriginalUri, getProperties, getReporter, getTransformation, getTransformationAsString, getTransformationID, getTransformationParameterMap, getType, getURItoAsString, isSameAs, isUpdatedAfterUse, killDocument, loadAsText, makeComment, makeImageRefToPage, makeRefToPage, saveFromDOM, setEncoding, setNowAsLastTimeUsed, setReporter, setTransformationFromString, setTransformationId
 
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

m_secondPhasePages

protected java.util.Vector m_secondPhasePages
Pages that should be built in the second phase of a build process because they contain elements that are depending on established content in other pages


m_templateMap

protected java.util.HashMap m_templateMap
templates, ID - Absolute URI pairs


m_transformationMap

protected java.util.HashMap m_transformationMap
transformations, ID - Absolute URI pairs


m_execCommands

protected java.util.Vector m_execCommands
commands - direct exec's: wxtutil.commandDescrition


m_addressMap

protected java.util.HashMap m_addressMap
Addressing to be used for addressrecalculation for this group: tag - attribute pairs. affected by element adressing in script

Constructor Detail

unitGroup

public unitGroup(org.w3c.dom.Element elt,
                 scripthandler scripth)
          throws java.lang.Exception
Creates a new instance of unitGoup

Parameters:
elt - The group-element from the script that defines this group
scripth - The instance of scripthandler that administrates the script and owns this unitGroup instance
Throws:
java.lang.Exception - when the object cannot be established
Method Detail

getBuildAnchorURI

public java.net.URI getBuildAnchorURI()
Get the anchor for this group, that is the absolute uri we are building pages relative to in this group

Returns:
the URI, m_buildAnchor

getCommonName

public java.lang.String getCommonName()
Get common name, that is what the common catalog is called in files in this group. This value is taken from the script, element common

Returns:
the name for common resources in this group, m_commonName

getCommonCatalog

public java.lang.String getCommonCatalog()
Get common catalog (value), that is where the common resources are actually stored for this group. This value is taken from the script, element common

Returns:
the value for common resources in this group,the catlog where common resources are actually stored, m_commonCat

getPageCount

public int getPageCount()
Get number of pages in this group

Returns:
the number of pages in the group, m_pageCount

getPageCountAsString

public java.lang.String getPageCountAsString()
Get number of pages in this group as string

Returns:
the number of pages in the group, as a string

toString

public java.lang.String toString()
m_name as a string representation of this group

Overrides:
toString in class unit
Returns:
A string concateneted from type and name

getTemplate

public unitTemplate getTemplate(java.lang.String tmplt)
Try to access a template by its id

Parameters:
tmplt - The id we want
Returns:
the found unitTemplate object if it exists, null otherwise

registerTemplate

public void registerTemplate(java.lang.String name,
                             unitTemplate ut)
Register a new template to the hashmap that holds templates: m_templateMap

Parameters:
name - The id we will use to access this template
ut - The unitTemplate

templateExist

public boolean templateExist(java.lang.String tmplt)
Check if a template with a certain ID is registered

Parameters:
tmplt - The ID to look for
Returns:
true if it exists, false otherwise

getTransformation

public unitTransformation getTransformation(java.lang.String trans)
Try to access a transformation by its id

Parameters:
trans - The id we want
Returns:
the found unitTransformation object if itexists, null otherwise.

registerTransformation

public void registerTransformation(java.lang.String name,
                                   unitTransformation ut)
Register a new transformation to the hashmap that holds transformations: m_transformationMap

Parameters:
name - The id we will use to access this template
ut - The unitTransformation

transformationExist

public boolean transformationExist(java.lang.String trans)
Check if a transformation with a certain ID is registered

Parameters:
trans - The ID to look for
Returns:
true if it exists, false otherwise

getScriptHandler

public scripthandler getScriptHandler()
Get the scripthandler that administrates this and all other groups in the script.

Returns:
The scripthandler object, theScriptHandler

getContent

public unit getContent(int ix)
Try to access a contentobject by its index

Parameters:
ix - The content object we are looking for
Returns:
the found unitContent or unitRSSContent object if it exists, null otherwise

registerContent

public int registerContent(unit uc)
Register a unitContent object as found by a page

Parameters:
uc - The new unitContent object
Returns:
the index that we may use to access this unitContent-object

getAUniquenumber

public int getAUniquenumber()
Get a sufficiently unique integer value to help differentiate between pagelocal anchors in one and the same page with same name

Returns:
A random integer

getPageLocations

public java.util.Vector getPageLocations()
Get a list of all pagelocations in the group

Returns:
A list of URIs as strings

getPages

public java.util.Vector getPages()
Get a list of all pages in the group

Returns:
a list of unitPage objects

setUpPopMenu

public javax.swing.JPopupMenu setUpPopMenu(javax.swing.JPopupMenu theMenu,
                                           javax.swing.JFrame main)
Set up a popupMenu for this unitGroup. Will offer user to inspect properties

Overrides:
setUpPopMenu in class unit
Parameters:
theMenu - The menu we will prepare
main - The frame that owns the menu
Returns:
A popupMenu customized for this page

displayProperties

public void displayProperties(javax.swing.JFrame dialogOwner)
Show the properties of this unitgroup in a dialog box

Overrides:
displayProperties in class unit
Parameters:
dialogOwner - The frame that will own this dialog.

collectFromScript

protected void collectFromScript()
                          throws java.lang.Exception
Get some data from the node in the script that defines this group: Attributes: the location that serves as anchor for this group of pages name Siblings: templates, transformations, properties, options, addressing Children: description, common, templates, transformations, properties, options, addressing, execCommands

Throws:
java.lang.Exception - When missing location

findPageByName

public unitPage findPageByName(java.lang.String pagename)
Find a page in this group with a given name

If more than one match, the first found in a preorder traversel is returned

Parameters:
pagename - The name of the page we are looking for
Returns:
the found unitPage object, or null if none is found

findPageByPartialRef

public unitPage findPageByPartialRef(java.lang.String path)
Find a page in this group whos absolute URI ends with the given pathpart

If more than one match, the first found in a preorder traversel is returned

Parameters:
path - The part of path we are looking for
Returns:
the found unitPage object, or null if none is found

getIndexTableByName

public indexTable getIndexTableByName(java.lang.String tabname)
Try to find an indexTable by its name

Parameters:
tabname - The name
Returns:
The indexTable if found, null else

registerIndexedWord

public void registerIndexedWord(java.lang.String tabname,
                                java.lang.String word,
                                unitPage page,
                                java.lang.String fragment)
Register a new entry to an index table

Parameters:
tabname - The name of the indextable
word - The word
page - The page
fragment - The fragment

registerForSecondPhase

protected void registerForSecondPhase(unitPage p)
Register a page that must be built in a second phase. This is done when a PI is encountered during build that must be postponed due to collections, indextables, finalpagetoc

Parameters:
p - The unitPage object that is registered

buildForced

public boolean buildForced(javax.swing.JProgressBar pBar,
                           java.util.Vector units)
Build everything or selection unconditionally Commands are executed first, before all pages

All pages are assembled from scratch. All content units are reloaded and all PI's on pages are reevaluated

Parameters:
units - the pages to build, null is all pages
pBar - The progressBar to update
Returns:
true allways

buildUpdated

public boolean buildUpdated(javax.swing.JProgressBar pBar,
                            java.util.Vector buildList)
Build only pages that have content, template or transformation objects that are updated from an other programs since last build. Commands are ignored

Parameters:
pBar - The progress bar that is updated, may be null
buildList - All pages regardless of group which are candidates for building
Returns:
true allways

prepare

public boolean prepare(unit p,
                       java.lang.String theCommonName,
                       java.lang.String theCommonValue)
Prepare this unitGroup with imports from non-content files. Does nothing

Overrides:
prepare in class unit
Parameters:
p - The unit that will use this unit as content, may be null
theCommonName - The name used for common resources in the material
theCommonValue - The value that we will use
Returns:
false if a fatal error occurs during preparation, true otherwise