org.lobobrowser.gui
Class NavigatorWindowImpl

java.lang.Object
  extended by org.lobobrowser.gui.NavigatorWindowImpl
All Implemented Interfaces:
WindowCallback, NavigatorWindow

public class NavigatorWindowImpl
extends java.lang.Object
implements NavigatorWindow, WindowCallback

Default implementation of the NavigatorWindow interface.


Nested Class Summary
 class NavigatorWindowImpl.LocalEventDispatch
           
 
Constructor Summary
NavigatorWindowImpl(NavigatorFrame openerFrame, java.lang.String windowId, java.util.Properties properties)
          Constructs a PlatformWindowContextImpl.
 
Method Summary
 void addAddressBarComponent(java.awt.Component addressBar)
          Adds a component to the address bar.
 void addMenu(java.lang.String menuId, javax.swing.JMenu menu)
          Adds a top-level menu to the window.
 void addNavigatorWindowListener(NavigatorWindowListener listener)
          Adds a listener of window events.
 void addSharedToolBarComponent(java.awt.Component toolBarComponent)
          Adds a component to the shared tool bar.
 void addStatusBarComponent(java.awt.Component statusBarComponent)
          Adds a component to the status bar.
 void addToolBar(java.awt.Component toolBar)
          Adds a "tool bar" component to the window.
 boolean back()
           
 boolean canBack()
           
 boolean canCopy()
           
 boolean canForward()
           
 boolean canReload()
           
 void close()
           
 boolean copy()
           
static NavigatorWindowImpl createFromWindowFeatures(NavigatorFrame openerFrame, java.lang.String windowId, java.lang.String windowFeatures)
           
 java.awt.Component createGap()
          Creates a gap component that should be placed between toolbar, address bar or status bar components.
 java.awt.Component createGlueComponent(java.awt.Component wrappedComponent, boolean usingMaxSize)
          Creates a component wrapper that expands to fill its parent's available space.
 void defaultStatusUpdated(NavigatorFrame clientletFrame, java.lang.String value)
           
 void dispose()
          Closes the window.
 boolean forward()
           
 java.util.Collection<java.awt.Component> getAddressBarComponents()
           
 java.awt.Window getAwtWindow()
          Gets the java.awt.Frame instance associated with this NavigatorWindow.
 NavigationEntry[] getBackNavigationEntries()
           
 java.awt.Component getComponent()
          Gets a component that may be used as a parent of prompt dialogs during requests.
 java.lang.Object getComponentLock()
           
 NavigationEntry getCurrentNavigationEntry()
           
 java.lang.String getDefaultStatus()
          Gets the current default status message or null if there's no default.
 NavigationEntry[] getForwardNavigationEntries()
           
 FramePanel getFramePanel()
           
 javax.swing.JMenu getMenu(java.lang.String menuId)
          Gets a menu previously added, typically by another extension with higher priority.
 java.util.Collection<javax.swing.JMenu> getMenus()
           
static java.util.Properties getPropertiesFromWindowFeatures(java.lang.String windowFeatures)
           
 java.util.Collection<java.awt.Component> getSharedToolbarComponents()
           
 java.lang.String getStatus()
          Gets the current window status message.
 java.util.Collection<java.awt.Component> getStatusBarComponents()
           
 java.util.Collection<java.awt.Component> getToolBars()
           
 NavigatorFrame getTopFrame()
          Gets the top frame of this window.
 UserAgent getUserAgent()
          Gets the navigator for the window.
 boolean goTo(NavigationEntry entry)
          Navigates to a NavigationEntry belonging to navigation history in the current session.
 void handleDocumentAccess(NavigatorFrame frame, ClientletResponse response)
          Called when a document has been accessed, but has not yet rendered.
 void handleDocumentAccess(NavigatorFrame frame, ClientletResponse response, boolean okToAddToNavigationList)
           
 void handleDocumentRendering(NavigatorFrame frame, ClientletResponse response, ComponentContent content)
          Called when the document has either rendered or is beginning to be incrementally rendered.
 void handleError(NavigatorFrame frame, ClientletResponse response, java.lang.Throwable exception)
          Invoked when there's a request error.
 boolean hasSource()
           
 boolean isClosed()
           
 void navigate(java.lang.String urlOrPath)
           
 void navigate(java.net.URL url, java.lang.String method, ParameterInfo paramInfo)
           
 boolean reload()
           
 void removeNavigatorWindowListener(NavigatorWindowListener listener)
          Removes a listener previously added with NavigatorWindow.addNavigatorWindowListener(NavigatorWindowListener)
 void setDefaultStatus(NavigatorFrame frame, java.lang.String value)
          Called to set a default status message.
 void setStatus(NavigatorFrame frame, java.lang.String value)
          Called to set a status message.
static void setWindowFactory(WindowFactory wf)
          Changes the WindowFactory that is used to create browser windows.
 void statusUpdated(NavigatorFrame clientletFrame, java.lang.String value)
           
 boolean stop()
           
 void toBack()
           
 void toFront()
           
 void updatePreNavigationProgress(NavigatorProgressEvent event)
           
 void updateProgress(NavigatorProgressEvent event)
          Updates request progress.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NavigatorWindowImpl

public NavigatorWindowImpl(NavigatorFrame openerFrame,
                           java.lang.String windowId,
                           java.util.Properties properties)
Constructs a PlatformWindowContextImpl. It starts out by showing a progress window. Later a new browser window is obtained given the windowId, or created.

Method Detail

setWindowFactory

public static void setWindowFactory(WindowFactory wf)
Changes the WindowFactory that is used to create browser windows.


isClosed

public boolean isClosed()

getFramePanel

public FramePanel getFramePanel()

close

public void close()

updatePreNavigationProgress

public void updatePreNavigationProgress(NavigatorProgressEvent event)

createFromWindowFeatures

public static NavigatorWindowImpl createFromWindowFeatures(NavigatorFrame openerFrame,
                                                           java.lang.String windowId,
                                                           java.lang.String windowFeatures)
Parameters:
windowFeatures - Window features formatted as in the window.open() method of Javascript.

getPropertiesFromWindowFeatures

public static java.util.Properties getPropertiesFromWindowFeatures(java.lang.String windowFeatures)

navigate

public void navigate(java.lang.String urlOrPath)
              throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

navigate

public void navigate(java.net.URL url,
                     java.lang.String method,
                     ParameterInfo paramInfo)

handleError

public void handleError(NavigatorFrame frame,
                        ClientletResponse response,
                        java.lang.Throwable exception)
Description copied from interface: WindowCallback
Invoked when there's a request error.

Specified by:
handleError in interface WindowCallback

handleDocumentAccess

public void handleDocumentAccess(NavigatorFrame frame,
                                 ClientletResponse response)
Description copied from interface: WindowCallback
Called when a document has been accessed, but has not yet rendered. Processing could be cancelled.

Specified by:
handleDocumentAccess in interface WindowCallback

handleDocumentAccess

public void handleDocumentAccess(NavigatorFrame frame,
                                 ClientletResponse response,
                                 boolean okToAddToNavigationList)

canCopy

public boolean canCopy()
Specified by:
canCopy in interface NavigatorWindow

canReload

public boolean canReload()
Specified by:
canReload in interface NavigatorWindow

copy

public boolean copy()
Specified by:
copy in interface NavigatorWindow

getUserAgent

public UserAgent getUserAgent()
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Gets the navigator for the window.

Specified by:
getUserAgent in interface NavigatorWindow

dispose

public void dispose()
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Closes the window.

Specified by:
dispose in interface NavigatorWindow

reload

public boolean reload()
Specified by:
reload in interface NavigatorWindow

stop

public boolean stop()
Specified by:
stop in interface NavigatorWindow

handleDocumentRendering

public void handleDocumentRendering(NavigatorFrame frame,
                                    ClientletResponse response,
                                    ComponentContent content)
Description copied from interface: WindowCallback
Called when the document has either rendered or is beginning to be incrementally rendered.

Specified by:
handleDocumentRendering in interface WindowCallback

updateProgress

public void updateProgress(NavigatorProgressEvent event)
Description copied from interface: WindowCallback
Updates request progress.

Specified by:
updateProgress in interface WindowCallback

getComponent

public java.awt.Component getComponent()
Description copied from interface: WindowCallback
Gets a component that may be used as a parent of prompt dialogs during requests.

Specified by:
getComponent in interface WindowCallback

back

public boolean back()
Specified by:
back in interface NavigatorWindow

forward

public boolean forward()
Specified by:
forward in interface NavigatorWindow

canForward

public boolean canForward()
Specified by:
canForward in interface NavigatorWindow

canBack

public boolean canBack()
Specified by:
canBack in interface NavigatorWindow

toFront

public void toFront()

toBack

public void toBack()

getTopFrame

public NavigatorFrame getTopFrame()
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Gets the top frame of this window.

Specified by:
getTopFrame in interface NavigatorWindow

statusUpdated

public void statusUpdated(NavigatorFrame clientletFrame,
                          java.lang.String value)

defaultStatusUpdated

public void defaultStatusUpdated(NavigatorFrame clientletFrame,
                                 java.lang.String value)

setStatus

public void setStatus(NavigatorFrame frame,
                      java.lang.String value)
Description copied from interface: WindowCallback
Called to set a status message.

Specified by:
setStatus in interface WindowCallback

setDefaultStatus

public void setDefaultStatus(NavigatorFrame frame,
                             java.lang.String value)
Description copied from interface: WindowCallback
Called to set a default status message.

Specified by:
setDefaultStatus in interface WindowCallback

getStatus

public java.lang.String getStatus()
Description copied from interface: WindowCallback
Gets the current window status message.

Specified by:
getStatus in interface WindowCallback

getDefaultStatus

public java.lang.String getDefaultStatus()
Description copied from interface: WindowCallback
Gets the current default status message or null if there's no default.

Specified by:
getDefaultStatus in interface WindowCallback

addAddressBarComponent

public void addAddressBarComponent(java.awt.Component addressBar)
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Adds a component to the address bar. The preferred width of the component is used, whereas its height will be set roughly to the height of the status bar.

Specified by:
addAddressBarComponent in interface NavigatorWindow
See Also:
NavigatorWindow.createGlueComponent(Component, boolean)

addMenu

public void addMenu(java.lang.String menuId,
                    javax.swing.JMenu menu)
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Adds a top-level menu to the window.

Specified by:
addMenu in interface NavigatorWindow
Parameters:
menuId - A globally unique ID for the menu.
menu - A JMenu instance.
See Also:
NavigatorWindow.getMenu(String)

getMenu

public javax.swing.JMenu getMenu(java.lang.String menuId)
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Gets a menu previously added, typically by another extension with higher priority.

Specified by:
getMenu in interface NavigatorWindow
Parameters:
menuId - The unique ID of the menu. The convention in Lobo is to use "lobo." followed by the name of the menu in lower case, with any spaces converted to dots. For example, the ID of the File menu should be "lobo.file". The ID of the Page Services menu should be "lobo.page.services".
Returns:
A JMenu instance.

addSharedToolBarComponent

public void addSharedToolBarComponent(java.awt.Component toolBarComponent)
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Adds a component to the shared tool bar. The preferred width of the component is used, whereas its height will be set roughly to the height of the shared tool bar.

Specified by:
addSharedToolBarComponent in interface NavigatorWindow
See Also:
NavigatorWindow.createGlueComponent(Component, boolean)

addStatusBarComponent

public void addStatusBarComponent(java.awt.Component statusBarComponent)
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Adds a component to the status bar. The preferred width of the component is used, whereas its height will be set roughly to the height of the status bar.

Specified by:
addStatusBarComponent in interface NavigatorWindow
See Also:
NavigatorWindow.createGlueComponent(Component, boolean)

addToolBar

public void addToolBar(java.awt.Component toolBar)
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Adds a "tool bar" component to the window. The preferred height of the tool bar is used, whereas its width will be set roughly to the width of the window.

Specified by:
addToolBar in interface NavigatorWindow
Parameters:
toolBar - A AWT or Swing lightweight.

addNavigatorWindowListener

public void addNavigatorWindowListener(NavigatorWindowListener listener)
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Adds a listener of window events.

Specified by:
addNavigatorWindowListener in interface NavigatorWindow
Parameters:
listener - A listener instance.

removeNavigatorWindowListener

public void removeNavigatorWindowListener(NavigatorWindowListener listener)
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Removes a listener previously added with NavigatorWindow.addNavigatorWindowListener(NavigatorWindowListener)

Specified by:
removeNavigatorWindowListener in interface NavigatorWindow

getAddressBarComponents

public java.util.Collection<java.awt.Component> getAddressBarComponents()

getMenus

public java.util.Collection<javax.swing.JMenu> getMenus()

getSharedToolbarComponents

public java.util.Collection<java.awt.Component> getSharedToolbarComponents()

getStatusBarComponents

public java.util.Collection<java.awt.Component> getStatusBarComponents()

getToolBars

public java.util.Collection<java.awt.Component> getToolBars()

getComponentLock

public java.lang.Object getComponentLock()

createGlueComponent

public java.awt.Component createGlueComponent(java.awt.Component wrappedComponent,
                                              boolean usingMaxSize)
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Creates a component wrapper that expands to fill its parent's available space. It only works if the parent uses a Swing BoxLayout. Examples of components that are wrapped this way are the address combo box and the status message component.

Specified by:
createGlueComponent in interface NavigatorWindow
Parameters:
wrappedComponent - The component that is wrapped by the glue box.
usingMaxSize - Whether the adjacent components have a maximum size that the container should try to use. If this argument is false, it is assumed that the adjacent components can be shrunk to their minimum sizes.

createGap

public java.awt.Component createGap()
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Creates a gap component that should be placed between toolbar, address bar or status bar components.

Specified by:
createGap in interface NavigatorWindow

goTo

public boolean goTo(NavigationEntry entry)
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Navigates to a NavigationEntry belonging to navigation history in the current session. without generating a new entry, in much the same way that NavigatorWindow.back() and NavigatorWindow.forward() work.

Specified by:
goTo in interface NavigatorWindow
Parameters:
entry - A existing NavigationEntry.
Returns:
True if the operation succeeded.

getBackNavigationEntries

public NavigationEntry[] getBackNavigationEntries()
Specified by:
getBackNavigationEntries in interface NavigatorWindow

getForwardNavigationEntries

public NavigationEntry[] getForwardNavigationEntries()
Specified by:
getForwardNavigationEntries in interface NavigatorWindow

getCurrentNavigationEntry

public NavigationEntry getCurrentNavigationEntry()
Specified by:
getCurrentNavigationEntry in interface NavigatorWindow

hasSource

public boolean hasSource()
Specified by:
hasSource in interface NavigatorWindow

getAwtWindow

public java.awt.Window getAwtWindow()
Description copied from interface: org.lobobrowser.ua.NavigatorWindow
Gets the java.awt.Frame instance associated with this NavigatorWindow. In most cases this method will return an instance of javax.swing.JFrame.

Specified by:
getAwtWindow in interface NavigatorWindow


SourceForge.net LogoCopyright © 2005, 2006, 2007 The Lobo Project. All Rights Reserved.
[Lobo Home]