uic.widgets.html
Class HTMLObserverAdapter

java.lang.Object
  extended by uic.widgets.html.HTMLObserverAdapter
All Implemented Interfaces:
HTMLObserver

public class HTMLObserverAdapter
extends Object
implements HTMLObserver

A default implementation of the HTMLObserver interface. All methods in this class are null-ops. Users of this class need only override those methods of interest.

See Also:
HTMLObserver

Constructor Summary
HTMLObserverAdapter()
           
 
Method Summary
 void formSubmitUpdate(HTMLPane pane, URL docBaseURL, int method, String action, String data)
          Notification that a form submission has been initiated.
 void historyUpdate(HTMLPane pane, int position)
          Notification of a change in position within the Pane's document history.
 void linkActivatedUpdate(HTMLPane pane, URL url, String targetFrame, String jName)
          Notification that a hyperlink has been activated via the keyboard or mouse.
 void linkFocusedUpdate(HTMLPane pane, URL url)
          Notification that a hyperlink has received or lost keyboard/mouse focus.
 void showNewFrameRequest(HTMLPane pane, String targetFrame, URL url)
          Notification for a new HTMLPane to be created with the specified top-level frame name and showing the specified document.
 void statusUpdate(HTMLPane pane, int status, URL url, int value, String message)
          Gives general notifications of events or errors which are occuring within the Pane.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLObserverAdapter

public HTMLObserverAdapter()
Method Detail

linkActivatedUpdate

public void linkActivatedUpdate(HTMLPane pane,
                                URL url,
                                String targetFrame,
                                String jName)
Description copied from interface: HTMLObserver
Notification that a hyperlink has been activated via the keyboard or mouse. If the jname argument is null the link will be automatically followed by the calling Pane, unless the URL protocol is 'mailto', which the Pane cannot currently handle. If the jname argument is not null the pane will not attempt to follow the link, allowing it to be handled here.

Specified by:
linkActivatedUpdate in interface HTMLObserver
Parameters:
pane - the HTMLPane which has called this method
url - the URL of the link that has been activated
targetFrame - the name of the frame where the contents of the URL are to be displayed
jName - A name given to the link so it can be handled outside the calling Pane

linkFocusedUpdate

public void linkFocusedUpdate(HTMLPane pane,
                              URL url)
Description copied from interface: HTMLObserver
Notification that a hyperlink has received or lost keyboard/mouse focus. This method is called when there has been a change in focus. If the URL sent is not null then a new link has now received focus. If the URL is null then a link which previously had focus has now lost it, and no link is currently focused.

This method can be used, for example, to update a status display which shows the currently focused link on the user's screen.

Specified by:
linkFocusedUpdate in interface HTMLObserver
Parameters:
pane - the HTMLPane which has called this method
url - the URL of the focused link, or null if no link has the focus

statusUpdate

public void statusUpdate(HTMLPane pane,
                         int status,
                         URL url,
                         int value,
                         String message)
Description copied from interface: HTMLObserver
Gives general notifications of events or errors which are occuring within the Pane. Apart from the DOC_LENGTH status argument listed below, the value argument sent will be the nesting level of the frame initiating this call. A nesting of 0 indicates the Pane's top level frame has made the call. Often you will only be interested in calls from the top level frame. For example, if a frameset document is loading you may get the DOC_LOADED status call several times, but the one that really counts is the frame 0 call, and this is never sent until all sub-frames have finished loading.

The current status arguments sent to this method are:

Specified by:
statusUpdate in interface HTMLObserver
Parameters:
pane - the HTMLPane which has called this method
status - the status code of the update
url - a URL related to the status code
value - a value related to the status code
message - a message related to the status code

formSubmitUpdate

public void formSubmitUpdate(HTMLPane pane,
                             URL docBaseURL,
                             int method,
                             String action,
                             String data)
Description copied from interface: HTMLObserver
Notification that a form submission has been initiated. Whether the Pane handles the submission directly depends on whether handleFormSubmission is enabled or disabled by the Config object controlling the Pane.

The method argument will be either HTMLConstants.V_GET, HTMLConstants.V_POST, or HTMLConstants.V_JFORM
If the argument is V_JFORM then the Pane will take no action, irrespective of whether handleFormSubmission is enabled. This allows the programmer to treat this method as a pseudo actionListener for controls placed within documents.

The data argument sent to this method is an x-www-form-urlencoded concatenated string of the form results gathered from successful form controls.

Specified by:
formSubmitUpdate in interface HTMLObserver
Parameters:
pane - the HTMLPane which has called this method
docBaseURL - the URL of the document containing the form, possibly modified by the <BASE> tag
method - a code for the form method - GET, POST or JFORM
action - the value of the action attribute (if any) specified in the FORM tag
data - the concatenated, encoded form results
See Also:
HTMLConfig.setHandleFormSubmission(boolean)

historyUpdate

public void historyUpdate(HTMLPane pane,
                          int position)
Description copied from interface: HTMLObserver
Notification of a change in position within the Pane's document history. This method's primary purpose is to allow the programmer to enable/disable controls which navigate the Pane's history. Note that it is possible for the Pane to be simultaneously at the top and bottom of its history (when the Pane has only shown a single document for example). It's easiest to show how you might use this method with some simple pseudo-code:
if (position == HTMLConstants.AT_HISTORY_MIDDLE) {
    //...enable both the 'back' and 'forward' buttons
} else {
    if ((position & HTMLConstants.AT_HISTORY_TOP) > 0) {
        //...disable the 'forward' button
    } else {
        //...enable the 'forward' button
    }
    if ((position & HTMLConstants.AT_HISTORY_BOTTOM) > 0) {
        //...disable the 'back' button
    } else {
        //...enable the 'back' button
    }
}

Specified by:
historyUpdate in interface HTMLObserver
Parameters:
pane - the HTMLPane which has called this method
position - a value denoting the current position within the Pane's history

showNewFrameRequest

public void showNewFrameRequest(HTMLPane pane,
                                String targetFrame,
                                URL url)
Description copied from interface: HTMLObserver
Notification for a new HTMLPane to be created with the specified top-level frame name and showing the specified document.

This method will be only be called if handleNewFrames is disabled in the Config object controlling the Pane. The need for a new frame occurs when an HTML anchor or other tag specifies that a URL should be displayed in a frame which has a name unknown to the Pane, or when the reserved HTML name "_blank" is specified.

Specified by:
showNewFrameRequest in interface HTMLObserver
Parameters:
pane - the HTMLPane which has called this method
targetFrame - the name to be given to the top-level frame of the new Pane, or null if no name has been specified
url - the URL of the document to be displayed in the new Pane
See Also:
HTMLConfig.setHandleNewFrames(boolean)


Copyright © 2002-2004 Thomas Zander Available under the Free Apache licence