org.ceryle.ui.graph
Class Compositor
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.ceryle.ui.graph.Compositor
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible
public class Compositor
- extends JPanel
An Object given the responsibility of managing content extraction
and metadata handling for Topics having an occurrence to be composed
as part of a composite document. This class extends JPanel so that
it may itself be used as its own displayed report. The processing
Thread does not begin until report() is called.
Following instantiation, the tasks
are:
- Get the topic.
- Determine how many occurrences it has.
- Determine if there are more than one, if one is the selected occurrence.
- Get the selected occurrence (as a document).
- Get the content type (which will determine processing).
- Get the document title.
- Get the system identifier.
- Get the content (as a DOM).
- Process the content to produce a usable fragment.
- Create a summary.
The Compositor is also a JPanel containing displayable information, about
the availability of the Topic Occurrence, metadata about the occurrence,
and status of the processing. It is suitable for inclusion in a report list.
- Since:
- JDK1.4
- Version:
- $Id: Compositor.java,v 3.16 2007-06-20 01:28:21 altheim Exp $
- Author:
- Murray Altheim
- See Also:
- Serialized Form
|
Nested Class Summary |
protected class |
Compositor.Gatherer
Internal class extends Thread to process a Topic for reporting. |
|
Method Summary |
int |
getContentLength()
Return the projected size of the content. |
protected String |
getLocator()
Returns the document locator value. |
Occurrence |
getSelectedOccurrence()
Returns the selected occurrence (the one to use for content), or null if not set. |
int |
getStatus()
Returns the current status. |
Topic |
getTopic()
Return this Compositor's Topic. |
protected XNode |
getXNode()
Returns the XNode of the opened Occurrence, null if unavailable. |
boolean |
isFragment()
Returns true if this Compositor's content is considered an XHTML fragment. |
protected boolean |
isIncluded()
Returns the included status of this Compositor. |
protected void |
openOccurrence(Occurrence occur)
Extracts the content of the provided Occurrence, setting up a Reader
with its contents. |
void |
prepare()
Prepares the previously-obtained PlainDocument to extract and process
its content, setting up a Reader for write(Writer). |
void |
processURI(String uriref)
Load content referenced by the URI. |
void |
report()
Start the reporting Thread. |
protected void |
setContentLength(int len,
boolean approx)
Sets the size message. |
protected void |
setContentType(MIME type)
Sets the content type message. |
protected void |
setDocumentTitle(String s)
Sets the document title message. |
protected void |
setIncluded(boolean included)
Sets the included status of this Compositor to the provided value. |
protected void |
setLabel(String s,
int index)
Sets the Topic label message. |
protected void |
setLocator(String s)
Sets the document locator message. |
void |
setSelected(boolean selected)
Displays that this Compositor is selected in the list. |
boolean |
setSelectedOccurrence(Occurrence occur,
boolean query)
Set the selected occurrence (the one to use for content) to the provided Occurrence. |
protected void |
setStatus(String s,
int status)
Sets the status and message. |
protected void |
setXNode(XNode xnode)
Sets the XNode of the opened Occurrence. |
boolean |
write(Writer out)
Writes the content to the provided Writer. |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
tmproc
protected TopicMapProcessor tmproc
mh
protected MessageHandler mh
m_xnode
protected XNode m_xnode
m_topic
protected Topic m_topic
btn_included
protected JCheckBox btn_included
fld_size
protected JLabel fld_size
fld_label
protected JLabel fld_label
label_title
protected JLabel label_title
fld_title
protected JLabel fld_title
label_sysid
protected JLabel label_sysid
fld_sysid
protected JLabel fld_sysid
fld_ctype
protected JLabel fld_ctype
label_status
protected JLabel label_status
Compositor
public Compositor(Composer comp,
TopicMapProcessor tmprocessor,
Topic topic,
boolean included)
- Constructor for a Compositor, with the parent Composer and Topic to be
processed.
- Parameters:
comp - the parent Composer.topic - the Topic to be processed.
report
public void report()
- Start the reporting Thread.
isFragment
public boolean isFragment()
- Returns true if this Compositor's content is considered an XHTML fragment.
openOccurrence
protected void openOccurrence(Occurrence occur)
- Extracts the content of the provided Occurrence, setting up a Reader
with its contents. This can then be written using write(Writer).
processURI
public void processURI(String uriref)
- Load content referenced by the URI.
This involves first determining the protocol for opening the resource,
then determining its type to open the correct view pane. If the current
view is a DocumentView, opens any text format into it, otherwise opens
a new DocumentView. LTM, XTM, and other graph formats are opened
into a new GraphView.
prepare
public void prepare()
- Prepares the previously-obtained PlainDocument to extract and process
its content, setting up a Reader for write(Writer).
write
public boolean write(Writer out)
throws IOException
- Writes the content to the provided Writer. This will then close the Reader.
- Returns:
- true if the content is successfully written (actually, throws an exception if not)
- Throws:
IOException
setXNode
protected void setXNode(XNode xnode)
- Sets the XNode of the opened Occurrence. This is used to obtain some metadata;
the main content should already have been set via the PlainDocument, but if
the MIME type is XHTML we have access to the DOM from the XNode.
getXNode
protected XNode getXNode()
- Returns the XNode of the opened Occurrence, null if unavailable.
setStatus
protected void setStatus(String s,
int status)
- Sets the status and message. Sets the background color according to the status.
If the supplied String is null, the current text is not changed.
getStatus
public int getStatus()
- Returns the current status.
setSelectedOccurrence
public boolean setSelectedOccurrence(Occurrence occur,
boolean query)
- Set the selected occurrence (the one to use for content) to the provided Occurrence.
If null, allows user setting of the 'selected' Occurrence for the Topic.
- Returns:
- true if an Occurrence has been selected.
setIncluded
protected void setIncluded(boolean included)
- Sets the included status of this Compositor to the provided value.
isIncluded
protected boolean isIncluded()
- Returns the included status of this Compositor.
getSelectedOccurrence
public Occurrence getSelectedOccurrence()
- Returns the selected occurrence (the one to use for content), or null if not set.
getTopic
public Topic getTopic()
- Return this Compositor's Topic.
setContentLength
protected void setContentLength(int len,
boolean approx)
- Sets the size message. The size is in characters, and will be converted
to Kilo or Mega as appropriate.
If approx is true, the value will be preceded by a tilde to
indicate approximate size. If the value of len is negative and
the value of approx is false, this will just refresh the display
with the current value. A negative/approx=true value will set it to 'unknown'.
getContentLength
public int getContentLength()
- Return the projected size of the content. If this is unknown, a zero value is returned.
setLabel
protected void setLabel(String s,
int index)
- Sets the Topic label message. A null value will set it to 'unknown'.
If the index value is greater than zero, the value will enumerate the
title, e.g., "3. title", where index=3.
setDocumentTitle
protected void setDocumentTitle(String s)
- Sets the document title message. A null value will set it to 'unknown'.
setLocator
protected void setLocator(String s)
- Sets the document locator message. A null value will set it to 'unknown'.
getLocator
protected String getLocator()
- Returns the document locator value. A null value will be returned if not set.
setContentType
protected void setContentType(MIME type)
- Sets the content type message. A null value will set it to 'unknown'.
setSelected
public void setSelected(boolean selected)
- Displays that this Compositor is selected in the list.
The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.