Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.greenstone.gatherer.gui.browser
Class GHTMLPane  view GHTMLPane download GHTMLPane.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.greenstone.gatherer.gui.browser.GHTMLPane
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, HTMLViewPane, javax.swing.event.HyperlinkListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable

public class GHTMLPane
extends javax.swing.JPanel
implements HTMLViewPane, javax.swing.event.HyperlinkListener, java.beans.PropertyChangeListener

Class Name: GHTMLPane Description: To provide a most basic implementation of the HTMLViewPane. Its rendering performance may be poor, but it will fully support all methods defined in the interface.


Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
(package private)  java.util.Vector back_pages
          back_pages - Vector of pages that have been visited.
(package private)  java.lang.Object control
           
(package private)  org.greenstone.gatherer.util.GURL current_url
          current_page - the URL of the currently shown page.
(package private)  boolean follow_links
          follow_links - does the class automatically follow hyperlinks.
(package private)  java.util.Vector forward_pages
          Vector of pages that have been backed up from.
(package private)  org.greenstone.gatherer.Gatherer gatherer
          gatherer - a reference to the main class of Gatherer for messaging.
(package private)  javax.swing.event.EventListenerList listeners
          the list of listeners associated with this class.
(package private)  boolean ready
          ready - has the view finished rendering the current URL.
(package private)  javax.swing.JEditorPane view
          view - the JEditorPane the page content will be rendered on to.
 
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.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GHTMLPane(org.greenstone.gatherer.Gatherer gatherer, java.lang.Object control)
          Constructor - collects initial settings, lays out view, renders initial URL.
 
Method Summary
 void addGBrowserListener(GBrowserListener listener)
          Add a GBrowserListener to this browser.
 void afterDisplay()
           
 boolean back()
          Back tells the browser to display a previous page if there is one.
 boolean canBack()
          CanBack is used to determine if there are further pages to 'back' to, and based on the result whether the functionality should be available
 boolean canForward()
          CanForward performs approximately the same duty as canBack except, of course, in the opposite direction.
 boolean canStop()
          CanStop determines whether the stop functionality is available.
 java.awt.image.BufferedImage capture()
          Capture is used to grab a buffered image of the current graphics context of the HTML pane.
 org.greenstone.gatherer.util.GURL current()
          When called this method returns the URL of the resource currently being displayed (or rendered).
protected  void fireActionFailed(org.greenstone.gatherer.util.GURL url)
           
protected  void fireControlsChanged()
           
protected  void fireHyperlinkClick(org.greenstone.gatherer.util.GURL url)
           
protected  void fireRenderBegun(org.greenstone.gatherer.util.GURL url)
           
protected  void fireRenderComplete(org.greenstone.gatherer.util.GURL url)
           
protected  void fireStatusChange(org.greenstone.gatherer.util.GURL url)
           
 void followHyperlinks(boolean value)
          This method is used to tell the HTML pane whether it should attempt to follow hyperlinks when a user clicks them.
 boolean forward()
          Forward is a call for the HTMLViewPane implementation to move forward one page in its browser history.
 java.awt.Component getContent()
          Since you can't add an interface to a component hierarchy this method is required to get a reference of the actual rendering component.
 javax.swing.JProgressBar getProgress()
          If called, getProgressBar should return a reference to a JProgress bar.
 void hyperlinkUpdate(javax.swing.event.HyperlinkEvent event)
          When a hyperlink event is fired we handle it in one of several ways, based on the event type.
 boolean isReady()
          Before attempting to issue futher instructions to the HTML pane, Gatherer must first ensure that its ready.
 void propertyChange(java.beans.PropertyChangeEvent evt)
          Fired after a Bean's property has changed.
 void removeGBrowserListener(GBrowserListener listener)
          Remove a GBrowserListener from this browser.
 void setEnabled(boolean value)
          SetEnabled is used to temporarily prevent further user interaction with the pane.
private  void setPage(org.greenstone.gatherer.util.GURL url)
           
 boolean show(org.greenstone.gatherer.util.GURL url)
          Precondition: ready = true
 boolean show(java.lang.String filename)
          Show, in both of its forms, allows Gatherer to display a certain URL or file in the HTML pane.
 boolean stop()
          Stop() kills the current rendering.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, swapComponents, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

follow_links

boolean follow_links
follow_links - does the class automatically follow hyperlinks.


ready

boolean ready
ready - has the view finished rendering the current URL.


listeners

javax.swing.event.EventListenerList listeners
the list of listeners associated with this class.


gatherer

org.greenstone.gatherer.Gatherer gatherer
gatherer - a reference to the main class of Gatherer for messaging.


view

javax.swing.JEditorPane view
view - the JEditorPane the page content will be rendered on to.


control

java.lang.Object control

current_url

org.greenstone.gatherer.util.GURL current_url
current_page - the URL of the currently shown page.


back_pages

java.util.Vector back_pages
back_pages - Vector of pages that have been visited.


forward_pages

java.util.Vector forward_pages
Vector of pages that have been backed up from. Reset whenever a new url 'path' is entered.

Constructor Detail

GHTMLPane

public GHTMLPane(org.greenstone.gatherer.Gatherer gatherer,
                 java.lang.Object control)
Constructor - collects initial settings, lays out view, renders initial URL.

Method Detail

addGBrowserListener

public void addGBrowserListener(GBrowserListener listener)
Description copied from interface: HTMLViewPane
Add a GBrowserListener to this browser.

Specified by:
addGBrowserListener in interface HTMLViewPane

afterDisplay

public void afterDisplay()
Specified by:
afterDisplay in interface HTMLViewPane

back

public boolean back()
Description copied from interface: HTMLViewPane
Back tells the browser to display a previous page if there is one. All implementations of HTMLViewPane should remember pages visited within this session, and react appropriately to calls to this function. Any caller of back should then immediately call canBack to determine if the function should be enabled.

Specified by:
back in interface HTMLViewPane

canBack

public boolean canBack()
Description copied from interface: HTMLViewPane
CanBack is used to determine if there are further pages to 'back' to, and based on the result whether the functionality should be available

Specified by:
canBack in interface HTMLViewPane

canForward

public boolean canForward()
Description copied from interface: HTMLViewPane
CanForward performs approximately the same duty as canBack except, of course, in the opposite direction.

Specified by:
canForward in interface HTMLViewPane

canStop

public boolean canStop()
Description copied from interface: HTMLViewPane
CanStop determines whether the stop functionality is available. In general you have to be doing something before you can stop it!

Specified by:
canStop in interface HTMLViewPane

capture

public java.awt.image.BufferedImage capture()
Description copied from interface: HTMLViewPane
Capture is used to grab a buffered image of the current graphics context of the HTML pane. Note that this may not actually be feasible in embedded applications such as Mozilla, as the apllication has a seperate graphics buffer.

Specified by:
capture in interface HTMLViewPane

current

public org.greenstone.gatherer.util.GURL current()
Description copied from interface: HTMLViewPane
When called this method returns the URL of the resource currently being displayed (or rendered). If no resource has been requested the return URL is null. The URL can point to local files, web-based resources etc.

Specified by:
current in interface HTMLViewPane

followHyperlinks

public void followHyperlinks(boolean value)
Description copied from interface: HTMLViewPane
This method is used to tell the HTML pane whether it should attempt to follow hyperlinks when a user clicks them. Whether this is set or not the fetch method should still be called by the HTML pane implementation apon a hyperlink click.

Specified by:
followHyperlinks in interface HTMLViewPane

forward

public boolean forward()
Description copied from interface: HTMLViewPane
Forward is a call for the HTMLViewPane implementation to move forward one page in its browser history. It should react appropriately to calls to this method and should retain a history of forward pages.

Specified by:
forward in interface HTMLViewPane

getContent

public java.awt.Component getContent()
Since you can't add an interface to a component hierarchy this method is required to get a reference of the actual rendering component.

Specified by:
getContent in interface HTMLViewPane

getProgress

public javax.swing.JProgressBar getProgress()
Description copied from interface: HTMLViewPane
If called, getProgressBar should return a reference to a JProgress bar. The HTML pane is then resposible for updating the progress bar for its lifetime whereapon the caller will dispose of it. If no page is currently being downloaded/rendered then the call should return null.

Specified by:
getProgress in interface HTMLViewPane

hyperlinkUpdate

public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent event)
When a hyperlink event is fired we handle it in one of several ways, based on the event type. Enters and exits get fired off as messages to the listeners so they can update their status bars. Clicks also fire status changes, but their event messages include the GURLs incase we to do something special to them. Furthermore if follow hyperlinks is set the browser is responsible for loading up the newly designated url.

Specified by:
hyperlinkUpdate in interface javax.swing.event.HyperlinkListener

isReady

public boolean isReady()
Description copied from interface: HTMLViewPane
Before attempting to issue futher instructions to the HTML pane, Gatherer must first ensure that its ready. A pane should always be responsive but there are foreseeable times when an interrupt to go to a new page may cause the renderer to become unstable, or perhaps a user is filling out a form and thus shouldn't be pre-empted.

Specified by:
isReady in interface HTMLViewPane

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Description copied from interface: java.beans.PropertyChangeListener
Fired after a Bean's property has changed.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

removeGBrowserListener

public void removeGBrowserListener(GBrowserListener listener)
Description copied from interface: HTMLViewPane
Remove a GBrowserListener from this browser.

Specified by:
removeGBrowserListener in interface HTMLViewPane

setEnabled

public void setEnabled(boolean value)
Description copied from interface: HTMLViewPane
SetEnabled is used to temporarily prevent further user interaction with the pane. This may be caused by certain user requests in other parts of Gatherer or is called when a modal dialogue is opened by the Gatherer application. Any implementation of setEnabled should in turn call an equivent method within its subcomponents and update its appearance to indicate its current state (ie greyed out boxes or background, wait cursor).

Specified by:
setEnabled in interface HTMLViewPane

show

public boolean show(java.lang.String filename)
Description copied from interface: HTMLViewPane
Show, in both of its forms, allows Gatherer to display a certain URL or file in the HTML pane.

Specified by:
show in interface HTMLViewPane

show

public boolean show(org.greenstone.gatherer.util.GURL url)
Precondition: ready = true

Specified by:
show in interface HTMLViewPane

stop

public boolean stop()
Description copied from interface: HTMLViewPane
Stop() kills the current rendering.

Specified by:
stop in interface HTMLViewPane

fireActionFailed

protected void fireActionFailed(org.greenstone.gatherer.util.GURL url)

fireControlsChanged

protected void fireControlsChanged()

fireHyperlinkClick

protected void fireHyperlinkClick(org.greenstone.gatherer.util.GURL url)

fireRenderBegun

protected void fireRenderBegun(org.greenstone.gatherer.util.GURL url)

fireRenderComplete

protected void fireRenderComplete(org.greenstone.gatherer.util.GURL url)

fireStatusChange

protected void fireStatusChange(org.greenstone.gatherer.util.GURL url)

setPage

private void setPage(org.greenstone.gatherer.util.GURL url)