Enterprise Information Portal APIs

com.ibm.mm.beans.gui
Class CMBDocumentViewer

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.ibm.mm.beans.gui.CMBDocumentViewer
All Implemented Interfaces:
CMBViewDocumentListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class CMBDocumentViewer
extends javax.swing.JComponent
implements CMBViewDocumentListener

The CMBDocumentViewer bean provides capabilities to view documents by either launching or embedding content-type specific document viewers. There are two types of viewers supported:

  1. Java-based viewers. These viewers must extend the class CMBJavaDocumentViewer.
  2. Non-Java viewers. Any executable may be launched as a viewer for a particular content-type.

If the Visible property is set to false, the viewer is always displayed in a separate window. If the Visible property is true, the viewer will be displayed within the display region of the CMBDocumentViewer bean if possible. (Currently, this is only possible for Java-based viewers.)

Viewer Specification

There are two ways to specify viewers:

  1. In EIP Administration, specify the viewers using the MIME Type to Application Association Editor. This is selected by choosing "MIME to Appl. Editor" from the "Tools" menu. For Java-based viewers, the application name should be the Java class name, including the ".class" suffix. For executables, the application name should be the name of the executable.
  2. Using the Mime2App property on CMBDocumentViewer. This property can be set to an instance of a Properties object that maps the MIME types to application names.
In cases where a viewer is specified for a MIME type in both EIP Administration and using the Mime2App property, the specification using the Mime2App will take precedence.

Default Viewers

If no viewer is specified for a particular content type, a default viewer will be launched. For documents from OnDemand, the OnDemand client (in view-only mode) is launched. Documents from all other content servers will be viewed using the Content Manager viewer. The Content Manager viewer also provides display and editing of annotations. To edit annotations, select "Edit Document" from the "File" menu of the viewer.

See Also:
CMBJavaDocumentViewer, Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.ibm.mm.beans.gui.CMBViewDocumentListener
copyright
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CMBDocumentViewer()
          Creates a document viewer.
 
Method Summary
 void addDocumentClosedListener(CMBDocumentClosedListener listener)
          Adds the specified listener to receive document closed events.
 void addDocumentOpenedListener(CMBDocumentOpenedListener listener)
          Adds the specified listener to receive document opened events.
 void addDocumentOpenFailedListener(CMBDocumentOpenFailedListener listener)
          Adds the specified listener to receive document open failed events.
 void addHelpListener(CMBHelpListener listener)
          Adds the specified listener to receive Help events.
 void closeDocument(CMBItem document)
          Close a document being viewed.
 CMBConnection getConnection()
          Gets the CMBConnection bean associated with this document viewer.
 CMBItem[] getDocuments()
          Gets the CMBItem objects representing the documents being displayed internally.
 java.util.Properties getMime2App()
          returns a Properties object mapping MIME context types to the names of the external viewer(s) to use for the types.
 boolean isDocumentJavaViewable(CMBItem document)
          returns true if the document can be viewed by Java, within the visible space of the viewer.
 boolean isFocusTraversable()
          Overridden to allow focus to the component
 void onViewDocument(CMBViewDocumentEvent event)
          Implementation of CMBViewDocumentListener, to simplify connecting to the CMBSearchResultsViewer and CMBFolderViewer beans.
 void printDocument(CMBItem document)
          Print a document.
 void refresh()
          Refresh the documents being viewed.
 void removeDocumentClosedListener(CMBDocumentClosedListener listener)
          Removes the specified listener so that it no longer receives document closed events.
 void removeDocumentOpenedListener(CMBDocumentOpenedListener listener)
          Removes the specified listener so that it no longer receives document opened events.
 void removeDocumentOpenFailedListener(CMBDocumentOpenFailedListener listener)
          Removes the specified listener so that it no longer receives document open failed events.
 void removeHelpListener(CMBHelpListener listener)
          Removes the specified listener so that it no longer receives Help events.
 void setBackground(java.awt.Color newColor)
          Overridden to set background of contained controls
 void setConnection(CMBConnection newConnection)
          Sets the CMBConnection bean associated with this document viewer.
 void setCursor(java.awt.Cursor newCursor)
          Overridden to set cursor of contained controls
 void setDocuments(CMBItem[] newDocuments)
          Sets the documents being displayed.
 void setEnabled(boolean newEnable)
          Overridden to disable contained controls
 void setFont(java.awt.Font newFont)
          Overridden to set font of contained controls
 void setForeground(java.awt.Color newColor)
          Overridden to set foreground of contained controls
 void setLayout(java.awt.LayoutManager mgr)
          Overridden to disable changing of the layout manager.
 void setMime2App(java.util.Properties viewers)
          sets the Properties object containing entries that map MIME context types to the names of external viewer(s) to use the types.
 void setOpaque(boolean newOpaque)
          Overridden to set opaque on contained controls
 void setToolTipText(java.lang.String newTooltip)
          Overridden to set tooltip text on contained controls
 void showDocument(CMBItem document)
          display the document.
 void terminate()
          Shuts down the VI viewer and OnDemand client if they were started in order to display documents externally.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CMBDocumentViewer

public CMBDocumentViewer()
Creates a document viewer.
Method Detail

getConnection

public CMBConnection getConnection()
Gets the CMBConnection bean associated with this document viewer.

setConnection

public void setConnection(CMBConnection newConnection)
Sets the CMBConnection bean associated with this document viewer.

getDocuments

public CMBItem[] getDocuments()
Gets the CMBItem objects representing the documents being displayed internally.

setDocuments

public void setDocuments(CMBItem[] newDocuments)
Sets the documents being displayed.
Parameters:
newDocuments - an array of CMBItem objects for the documents to display.

getMime2App

public java.util.Properties getMime2App()
returns a Properties object mapping MIME context types to the names of the external viewer(s) to use for the types. This will initially have the values as specified in sysadmin.

setMime2App

public void setMime2App(java.util.Properties viewers)
sets the Properties object containing entries that map MIME context types to the names of external viewer(s) to use the types.
Parameters:
viewers - a Properties file mapping MIME context types to viewer executables.

refresh

public void refresh()
Refresh the documents being viewed.

showDocument

public void showDocument(CMBItem document)
display the document. The document will be displayed internally if possible and if an external viewer for the MIME-type of the document has not been specified (using Mime2App property). Otherwise, the document will be displayed externally (i.e., in a separate viewer).
Parameters:
document - the document to be displayed.

closeDocument

public void closeDocument(CMBItem document)
Close a document being viewed.

printDocument

public void printDocument(CMBItem document)
Print a document. This is only supported for documents viewed by the Content Manager viewer.

isDocumentJavaViewable

public boolean isDocumentJavaViewable(CMBItem document)
returns true if the document can be viewed by Java, within the visible space of the viewer.

onViewDocument

public void onViewDocument(CMBViewDocumentEvent event)
Implementation of CMBViewDocumentListener, to simplify connecting to the CMBSearchResultsViewer and CMBFolderViewer beans.
Specified by:
onViewDocument in interface CMBViewDocumentListener
Parameters:
event - event object containing documents to view
See Also:
CMBViewDocumentListener, CMBSearchResultsViewer, CMBFolderViewer

terminate

public void terminate()
Shuts down the VI viewer and OnDemand client if they were started in order to display documents externally. Also kills any other external viewers (launched according to mime2app) and cleans up temporary files.

addHelpListener

public void addHelpListener(CMBHelpListener listener)
Adds the specified listener to receive Help events.

removeHelpListener

public void removeHelpListener(CMBHelpListener listener)
Removes the specified listener so that it no longer receives Help events.

addDocumentOpenedListener

public void addDocumentOpenedListener(CMBDocumentOpenedListener listener)
Adds the specified listener to receive document opened events.

removeDocumentOpenedListener

public void removeDocumentOpenedListener(CMBDocumentOpenedListener listener)
Removes the specified listener so that it no longer receives document opened events.

addDocumentOpenFailedListener

public void addDocumentOpenFailedListener(CMBDocumentOpenFailedListener listener)
Adds the specified listener to receive document open failed events.

removeDocumentOpenFailedListener

public void removeDocumentOpenFailedListener(CMBDocumentOpenFailedListener listener)
Removes the specified listener so that it no longer receives document open failed events.

addDocumentClosedListener

public void addDocumentClosedListener(CMBDocumentClosedListener listener)
Adds the specified listener to receive document closed events.

removeDocumentClosedListener

public void removeDocumentClosedListener(CMBDocumentClosedListener listener)
Removes the specified listener so that it no longer receives document closed events.

setLayout

public void setLayout(java.awt.LayoutManager mgr)
Overridden to disable changing of the layout manager.
Overrides:
setLayout in class java.awt.Container

isFocusTraversable

public boolean isFocusTraversable()
Overridden to allow focus to the component
Overrides:
isFocusTraversable in class javax.swing.JComponent

setForeground

public void setForeground(java.awt.Color newColor)
Overridden to set foreground of contained controls
Overrides:
setForeground in class javax.swing.JComponent

setBackground

public void setBackground(java.awt.Color newColor)
Overridden to set background of contained controls
Overrides:
setBackground in class javax.swing.JComponent

setFont

public void setFont(java.awt.Font newFont)
Overridden to set font of contained controls
Overrides:
setFont in class javax.swing.JComponent

setCursor

public void setCursor(java.awt.Cursor newCursor)
Overridden to set cursor of contained controls
Overrides:
setCursor in class java.awt.Component

setOpaque

public void setOpaque(boolean newOpaque)
Overridden to set opaque on contained controls
Overrides:
setOpaque in class javax.swing.JComponent

setToolTipText

public void setToolTipText(java.lang.String newTooltip)
Overridden to set tooltip text on contained controls
Overrides:
setToolTipText in class javax.swing.JComponent

setEnabled

public void setEnabled(boolean newEnable)
Overridden to disable contained controls
Overrides:
setEnabled in class javax.swing.JComponent

EIP JavaBeans

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.