Version: 1.1.1

ca.ucalgary.seahawk.gui
Class MobyContentGUI

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by ca.ucalgary.seahawk.gui.MobyContentGUI
All Implemented Interfaces:
ActionListener, ComponentListener, KeyListener, MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, MobyRequestEventHandler

public class MobyContentGUI
extends JFrame
implements ActionListener, ComponentListener, KeyListener, MobyRequestEventHandler, MouseListener

Main interface component: textually displays the data in a MOBY content XML document. For details on embedding in your own app, please see the documentation.

Author:
Paul Gordon (gordonp@ucalgary.ca)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
 
Field Summary
static String BACK_BUTTON_NAME
           
static String CLIPBOARD_TAB_TOOLTIP
           
static String CLOSE_OTHERS_OPTION
           
static String CLOSE_TAB_OPTION
           
static String DEFAULT_STARTUP_PAGE_RESOURCE
           
static String DEFAULT_STATUS_MSG
           
static String DEFAULT_XSLT_CONVERTER_URL
           
static String FILE_CHOOSER_OPEN_TITLE
           
static String FILE_OPEN_OPTION
           
static String FILE_OPEN_OPTION_NAME
           
static String FILTER_BUTTON_NAME
           
static String FORWARD_BUTTON_MSG
           
static String FORWARD_BUTTON_NAME
           
static String HELP_BUTTON_NAME
           
static int MAX_TAB_NAME_LENGTH
           
static String OPEN_BUTTON_NAME
           
static String OPEN_OPTION_NAME
           
static String PRINT_BUTTON_NAME
           
static String RESOURCE_SYSTEM_PROPERTY
           
static String SAVE_BUTTON_NAME
           
static String SEAHAWK_NS_PREFIX
           
static String SEAHAWK_NS_URI
           
static String SEAHAWK_XPATH_ATTR
           
static String SERVICE_INPUT_MAGIC
          if URL starts with this, it's a service input payload spec of the form "url\tproviderURI\tserviceName"
static String SETTINGS_BUTTON_NAME
           
static String TAB_TOOLTIP
           
static String TABBED_PANE_NAME
           
static String WEB_ADDR_DIALOG_TITLE
           
static String WEB_OPEN_OPTION
           
static String WEB_OPEN_OPTION_NAME
           
 
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MobyContentGUI(MobyServicesGUI mgui)
          Constructor for a standalone visual interface.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Called when a tab option (close) is selected
 MobyDataObjectSet addToClipboard(MobyDataInstance itemToAdd)
          Adds the given data to the Seahawk clipboard object collection.
 boolean allTabsVisible()
           
 MobyContentInstance callService(MobyService service, MobyContentInstance inEnvelope)
           
 void clearClipboard()
          Removes any existing data from the clipboard.
 void componentHidden(ComponentEvent e)
           
 void componentMoved(ComponentEvent e)
           
 void componentResized(ComponentEvent e)
          Makes the panels of the tabbed pane have a preferred size to fit within the frame
 void componentShown(ComponentEvent e)
           
static Document convertHTMLToXHTML(byte[] responseBody)
           
static void destroy()
          Method to be called when an applet is being decommissioned.
 MobyService findService(String providerURI, String serviceName)
           
 int getActiveTab()
           
 Dimension getContentSize()
          Calculates the approximate space available for the content on a pane (i.e. frame size - tab size - status bar)
 MobyContentPane getCurrentPane()
          Returns the current tab's display component, mostly for testing purposes.
 URL getCurrentURL()
          Returns the URL of the document that is the source of the current tab's display
 DocumentBuilder getDocumentBuilder()
           
 CentralImpl getMobyCentralImpl()
           
 Acme.Serve.Serve getServletContainer()
           
 JLabel getStatusComponent()
           
 JPanel getToolbar()
           
 Transformer getTransformer()
           
 void goBackward()
           
 void goForward()
           
 boolean isShowingFailure()
          Reports whetehr the current tab (if any is showing) is displaying a failure, such as network or protocol failure while requesting a service.
 void keyPressed(KeyEvent e)
          Implemented to provide paste functionality (control-v or the paste button on a Sun keyboard), since the editor panes are not editable and therefore by default do not respond to paste events.
 void keyReleased(KeyEvent e)
           
 void keyTyped(KeyEvent e)
           
 void loadPaneFromObject(MobyContentInstance mci, boolean useDefaultHandler)
          Load a Seahawk browser tab with the data held in the given MobyContentInstance.
 void loadPaneFromURL(URL u, boolean useDefaultHandler)
           
static void main(String[] argv)
           
 void mouseClicked(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void openDocument()
          Displays the choice to the user to open a file or URL.
 void printCurrentPane()
           
 int processCGIResults(byte[] responseBody, String contentType)
           
 void processEvent(MobyRequestEvent mre)
           
 int processServiceResults(Node responseDOM)
          This method is called by the Programming-by-example (PBE) system when we have the response from a service that's being semantically wrapped.
 boolean removeFromClipboard(MobyDataInstance itemToDelete)
           
 void saveCurrentPane()
           
 void serviceWrapped(String providerURI, String serviceName, MobyDataJob sampleData)
          Called after a service has been created by the wrapping system, with the intention that the new service should be called and included in the browsing session.
 void setActiveTab(int index)
           
static void setDefaultAppCloseOperation(int code)
          Value to be passed to application JFrame
 void setForwardButtonToolTip(String msg)
          Allow others to set the forward navigation button message.
 void setServletContainer(Acme.Serve.Serve sc)
          A shared resource for proxying requests such as WSDL PBE wrapping
 void setStatus(String msg)
           
 int showHelpTab()
           
 void showWebDialog(boolean useDefaultHandler)
           
 void start(MobyRequestEvent requestEvent)
          Called by MOBYRequest when the service request is being sent.
 void stop(MobyRequest request, int requestID)
          If a client, denotes the end of a service request.
 void stopServletContainer()
          Explicitly stop the servlet container, if running, that is used for WSDL service wrapping.
 void updateHistory(MobyContentPane pane)
          A pane whose history list has changed should call this method to ensure the forward and backward buttons are properly set to reflect the change.
 void updateHistoryButtons()
           
 
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

BACK_BUTTON_NAME

public static final String BACK_BUTTON_NAME
See Also:
Constant Field Values

FORWARD_BUTTON_NAME

public static final String FORWARD_BUTTON_NAME
See Also:
Constant Field Values

FORWARD_BUTTON_MSG

public static final String FORWARD_BUTTON_MSG
See Also:
Constant Field Values

OPEN_BUTTON_NAME

public static final String OPEN_BUTTON_NAME
See Also:
Constant Field Values

SAVE_BUTTON_NAME

public static final String SAVE_BUTTON_NAME
See Also:
Constant Field Values

FILTER_BUTTON_NAME

public static final String FILTER_BUTTON_NAME
See Also:
Constant Field Values

PRINT_BUTTON_NAME

public static final String PRINT_BUTTON_NAME
See Also:
Constant Field Values

HELP_BUTTON_NAME

public static final String HELP_BUTTON_NAME
See Also:
Constant Field Values

SETTINGS_BUTTON_NAME

public static final String SETTINGS_BUTTON_NAME
See Also:
Constant Field Values

OPEN_OPTION_NAME

public static final String OPEN_OPTION_NAME
See Also:
Constant Field Values

FILE_OPEN_OPTION_NAME

public static final String FILE_OPEN_OPTION_NAME
See Also:
Constant Field Values

WEB_OPEN_OPTION_NAME

public static final String WEB_OPEN_OPTION_NAME
See Also:
Constant Field Values

TABBED_PANE_NAME

public static final String TABBED_PANE_NAME
See Also:
Constant Field Values

FILE_CHOOSER_OPEN_TITLE

public static final String FILE_CHOOSER_OPEN_TITLE
See Also:
Constant Field Values

WEB_ADDR_DIALOG_TITLE

public static final String WEB_ADDR_DIALOG_TITLE
See Also:
Constant Field Values

DEFAULT_STATUS_MSG

public static final String DEFAULT_STATUS_MSG
See Also:
Constant Field Values

RESOURCE_SYSTEM_PROPERTY

public static final String RESOURCE_SYSTEM_PROPERTY
See Also:
Constant Field Values

DEFAULT_STARTUP_PAGE_RESOURCE

public static final String DEFAULT_STARTUP_PAGE_RESOURCE
See Also:
Constant Field Values

DEFAULT_XSLT_CONVERTER_URL

public static final String DEFAULT_XSLT_CONVERTER_URL
See Also:
Constant Field Values

MAX_TAB_NAME_LENGTH

public static final int MAX_TAB_NAME_LENGTH
See Also:
Constant Field Values

CLIPBOARD_TAB_TOOLTIP

public static final String CLIPBOARD_TAB_TOOLTIP
See Also:
Constant Field Values

TAB_TOOLTIP

public static final String TAB_TOOLTIP
See Also:
Constant Field Values

CLOSE_TAB_OPTION

public static final String CLOSE_TAB_OPTION
See Also:
Constant Field Values

CLOSE_OTHERS_OPTION

public static final String CLOSE_OTHERS_OPTION
See Also:
Constant Field Values

FILE_OPEN_OPTION

public static final String FILE_OPEN_OPTION
See Also:
Constant Field Values

WEB_OPEN_OPTION

public static final String WEB_OPEN_OPTION
See Also:
Constant Field Values

SEAHAWK_NS_URI

public static final String SEAHAWK_NS_URI
See Also:
Constant Field Values

SEAHAWK_NS_PREFIX

public static final String SEAHAWK_NS_PREFIX
See Also:
Constant Field Values

SEAHAWK_XPATH_ATTR

public static final String SEAHAWK_XPATH_ATTR
See Also:
Constant Field Values

SERVICE_INPUT_MAGIC

public static final String SERVICE_INPUT_MAGIC
if URL starts with this, it's a service input payload spec of the form "url\tproviderURI\tserviceName"

See Also:
Constant Field Values
Constructor Detail

MobyContentGUI

public MobyContentGUI(MobyServicesGUI mgui)
Constructor for a standalone visual interface.

Method Detail

getServletContainer

public Acme.Serve.Serve getServletContainer()

setServletContainer

public void setServletContainer(Acme.Serve.Serve sc)
A shared resource for proxying requests such as WSDL PBE wrapping


processCGIResults

public int processCGIResults(byte[] responseBody,
                             String contentType)
                      throws Exception
Throws:
Exception

convertHTMLToXHTML

public static Document convertHTMLToXHTML(byte[] responseBody)

processServiceResults

public int processServiceResults(Node responseDOM)
                          throws Exception
This method is called by the Programming-by-example (PBE) system when we have the response from a service that's being semantically wrapped. To help the user out with the wrapping, we'll see if the MOB rules pick up any MOBY objects in the data. Otherwise they'll have to do extra steps to cast the returned data, etc..

Returns:
the number of Moby objects found in the data.
Throws:
Exception

stopServletContainer

public void stopServletContainer()
                          throws IOException
Explicitly stop the servlet container, if running, that is used for WSDL service wrapping.

Throws:
IOException

allTabsVisible

public boolean allTabsVisible()

getToolbar

public JPanel getToolbar()

getTransformer

public Transformer getTransformer()

getDocumentBuilder

public DocumentBuilder getDocumentBuilder()

keyPressed

public void keyPressed(KeyEvent e)
Implemented to provide paste functionality (control-v or the paste button on a Sun keyboard), since the editor panes are not editable and therefore by default do not respond to paste events.

Specified by:
keyPressed in interface KeyListener

keyReleased

public void keyReleased(KeyEvent e)
Specified by:
keyReleased in interface KeyListener

keyTyped

public void keyTyped(KeyEvent e)
Specified by:
keyTyped in interface KeyListener

start

public void start(MobyRequestEvent requestEvent)
Called by MOBYRequest when the service request is being sent. We can create the GUI and wait message here.

Specified by:
start in interface MobyRequestEventHandler

getContentSize

public Dimension getContentSize()
Calculates the approximate space available for the content on a pane (i.e. frame size - tab size - status bar)


setStatus

public void setStatus(String msg)

componentHidden

public void componentHidden(ComponentEvent e)
Specified by:
componentHidden in interface ComponentListener

componentMoved

public void componentMoved(ComponentEvent e)
Specified by:
componentMoved in interface ComponentListener

componentShown

public void componentShown(ComponentEvent e)
Specified by:
componentShown in interface ComponentListener

componentResized

public void componentResized(ComponentEvent e)
Makes the panels of the tabbed pane have a preferred size to fit within the frame

Specified by:
componentResized in interface ComponentListener

stop

public void stop(MobyRequest request,
                 int requestID)
Description copied from interface: MobyRequestEventHandler
If a client, denotes the end of a service request. If a server, denotes that the server is shutting down/this event handler should terminate.

Specified by:
stop in interface MobyRequestEventHandler

processEvent

public void processEvent(MobyRequestEvent mre)
Specified by:
processEvent in interface MobyRequestEventHandler

setForwardButtonToolTip

public void setForwardButtonToolTip(String msg)
Allow others to set the forward navigation button message. If set the null, the default tooltip is used.


updateHistoryButtons

public void updateHistoryButtons()

updateHistory

public void updateHistory(MobyContentPane pane)
A pane whose history list has changed should call this method to ensure the forward and backward buttons are properly set to reflect the change.


goBackward

public void goBackward()

goForward

public void goForward()

isShowingFailure

public boolean isShowingFailure()
Reports whetehr the current tab (if any is showing) is displaying a failure, such as network or protocol failure while requesting a service.


getCurrentURL

public URL getCurrentURL()
Returns the URL of the document that is the source of the current tab's display


getCurrentPane

public MobyContentPane getCurrentPane()
Returns the current tab's display component, mostly for testing purposes.


printCurrentPane

public void printCurrentPane()

getMobyCentralImpl

public CentralImpl getMobyCentralImpl()

saveCurrentPane

public void saveCurrentPane()

showHelpTab

public int showHelpTab()
Returns:
the tab index for the help tab

openDocument

public void openDocument()
Displays the choice to the user to open a file or URL. Choice callback will call either showFileDialog or showWebDialog.


showWebDialog

public void showWebDialog(boolean useDefaultHandler)

findService

public MobyService findService(String providerURI,
                               String serviceName)
                        throws Exception
Throws:
Exception

callService

public MobyContentInstance callService(MobyService service,
                                       MobyContentInstance inEnvelope)
                                throws Exception
Throws:
Exception

serviceWrapped

public void serviceWrapped(String providerURI,
                           String serviceName,
                           MobyDataJob sampleData)
                    throws Exception
Called after a service has been created by the wrapping system, with the intention that the new service should be called and included in the browsing session.

Throws:
Exception

loadPaneFromObject

public void loadPaneFromObject(MobyContentInstance mci,
                               boolean useDefaultHandler)
                        throws Exception
Load a Seahawk browser tab with the data held in the given MobyContentInstance. Note that this methods take a snapshot of the data when it is passed in. Subsequent changes to the MobyContentInstance will not be reflected in the Seahawk display.

Throws:
Exception - if a temporary file cannot be written or read

loadPaneFromURL

public void loadPaneFromURL(URL u,
                            boolean useDefaultHandler)

actionPerformed

public void actionPerformed(ActionEvent e)
Called when a tab option (close) is selected

Specified by:
actionPerformed in interface ActionListener

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener

getActiveTab

public int getActiveTab()

setActiveTab

public void setActiveTab(int index)

removeFromClipboard

public boolean removeFromClipboard(MobyDataInstance itemToDelete)

addToClipboard

public MobyDataObjectSet addToClipboard(MobyDataInstance itemToAdd)
Adds the given data to the Seahawk clipboard object collection.

Parameters:
itemToAdd - if null, method simply returns the current clipboard contents
Returns:
the contents of the main clipboard query after the addition, or null if the clipboard does not exist for some reason

clearClipboard

public void clearClipboard()
Removes any existing data from the clipboard.


setDefaultAppCloseOperation

public static void setDefaultAppCloseOperation(int code)
Value to be passed to application JFrame


main

public static void main(String[] argv)

destroy

public static void destroy()
Method to be called when an applet is being decommissioned.


getStatusComponent

public JLabel getStatusComponent()

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010