chrriis.dj.nativeswing.swtimpl.components
Class DefaultWebBrowserDecorator

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by chrriis.dj.nativeswing.swtimpl.components.WebBrowserDecorator
                      extended by chrriis.dj.nativeswing.swtimpl.components.DefaultWebBrowserDecorator
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class DefaultWebBrowserDecorator
extends WebBrowserDecorator

A default web browser decorator, which can actually be subclassed for simple customization.

Author:
Christopher Deckers
See Also:
Serialized Form

Nested Class Summary
 class DefaultWebBrowserDecorator.WebBrowserButtonBar
          The bar containing the buttons.
static class DefaultWebBrowserDecorator.WebBrowserDecoratorComponentType
           
 class DefaultWebBrowserDecorator.WebBrowserLocationBar
          The bar containing the location field.
 class DefaultWebBrowserDecorator.WebBrowserMenuBar
          The menu bar.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DefaultWebBrowserDecorator(JWebBrowser webBrowser, Component renderingComponent)
           
 
Method Summary
protected  void addButtonBarComponents(DefaultWebBrowserDecorator.WebBrowserButtonBar buttonBar)
          Add the components that compose the button bar.
protected  void addLocationBarComponents(DefaultWebBrowserDecorator.WebBrowserLocationBar locationBar)
          Add the components that compose the location bar.
protected  void addMenuBarComponents(DefaultWebBrowserDecorator.WebBrowserMenuBar menuBar)
          Add the components (most likely menus) that compose the menu bar.
protected  String askLocation()
          Ask the user, by default using an option pane (input dialog), the location to open.
protected  void configureComponent(JComponent c, DefaultWebBrowserDecorator.WebBrowserDecoratorComponentType componentType)
          Configure a component (its text, icon, tooltip, etc.).
 void configureForWebBrowserWindow(JWebBrowserWindow webBrowserWindow)
          Configure the decorator for integration of the web browser in a web browser window.
protected  Border getInnerAreaBorder()
          Return the border to use for the inner area, which by default return a border if at least one of the bars is visible.
protected  JWebBrowser getWebBrowser()
           
 boolean isButtonBarVisible()
          Indicate whether the button bar is visible.
 boolean isLocationBarVisible()
          Indicate whether the location bar is visible.
 boolean isMenuBarVisible()
          Indicate whether the menu bar is visible.
 boolean isStatusBarVisible()
          Indicate whether the status bar is visible.
 void setButtonBarVisible(boolean isButtonBarVisible)
          Set whether the button bar is visible.
 void setLocationBarVisible(boolean isLocationBarVisible)
          Set whether the location bar is visible.
 void setMenuBarVisible(boolean isMenuBarVisible)
          Set whether the menu bar is visible.
 void setStatusBarVisible(boolean isStatusBarVisible)
          Set whether the status bar is visible.
protected  void setWebBrowserWindowIcon(JWebBrowserWindow webBrowserWindow)
           
protected  void setWebBrowserWindowTitle(JWebBrowserWindow webBrowserWindow, String pageTitle)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultWebBrowserDecorator

public DefaultWebBrowserDecorator(JWebBrowser webBrowser,
                                  Component renderingComponent)
Method Detail

addButtonBarComponents

protected void addButtonBarComponents(DefaultWebBrowserDecorator.WebBrowserButtonBar buttonBar)
Add the components that compose the button bar. Overriden versions do not need to call their super implementation, instead they can selectively add certain default components, for example: buttonBar.add(buttonBar.getBackButton()).


addLocationBarComponents

protected void addLocationBarComponents(DefaultWebBrowserDecorator.WebBrowserLocationBar locationBar)
Add the components that compose the location bar.
Overriden versions do not need to call their super implementation, instead they can selectively add certain default components, for example: locationBar.add(locationBar.getLocationField()).


addMenuBarComponents

protected void addMenuBarComponents(DefaultWebBrowserDecorator.WebBrowserMenuBar menuBar)
Add the components (most likely menus) that compose the menu bar.
Overriden versions do not need to call their super implementation, instead they can selectively add certain default components, for example: menuBar.add(menuBar.getFileMenu()).

Parameters:
menuBar - the bar to add the components to.

getWebBrowser

protected JWebBrowser getWebBrowser()

getInnerAreaBorder

protected Border getInnerAreaBorder()
Return the border to use for the inner area, which by default return a border if at least one of the bars is visible. Note that this method is called every time the visibility of a bar changes.


setStatusBarVisible

public void setStatusBarVisible(boolean isStatusBarVisible)
Set whether the status bar is visible.

Specified by:
setStatusBarVisible in class WebBrowserDecorator
Parameters:
isStatusBarVisible - true if the status bar should be visible, false otherwise.

isStatusBarVisible

public boolean isStatusBarVisible()
Indicate whether the status bar is visible.

Specified by:
isStatusBarVisible in class WebBrowserDecorator
Returns:
true if the status bar is visible.

setMenuBarVisible

public void setMenuBarVisible(boolean isMenuBarVisible)
Set whether the menu bar is visible.

Specified by:
setMenuBarVisible in class WebBrowserDecorator
Parameters:
isMenuBarVisible - true if the menu bar should be visible, false otherwise.

isMenuBarVisible

public boolean isMenuBarVisible()
Indicate whether the menu bar is visible.

Specified by:
isMenuBarVisible in class WebBrowserDecorator
Returns:
true if the menu bar is visible.

setButtonBarVisible

public void setButtonBarVisible(boolean isButtonBarVisible)
Set whether the button bar is visible.

Specified by:
setButtonBarVisible in class WebBrowserDecorator
Parameters:
isButtonBarVisible - true if the button bar should be visible, false otherwise.

isButtonBarVisible

public boolean isButtonBarVisible()
Indicate whether the button bar is visible.

Specified by:
isButtonBarVisible in class WebBrowserDecorator
Returns:
true if the button bar is visible.

setLocationBarVisible

public void setLocationBarVisible(boolean isLocationBarVisible)
Set whether the location bar is visible.

Specified by:
setLocationBarVisible in class WebBrowserDecorator
Parameters:
isLocationBarVisible - true if the location bar should be visible, false otherwise.

isLocationBarVisible

public boolean isLocationBarVisible()
Indicate whether the location bar is visible.

Specified by:
isLocationBarVisible in class WebBrowserDecorator
Returns:
true if the location bar is visible.

configureForWebBrowserWindow

public void configureForWebBrowserWindow(JWebBrowserWindow webBrowserWindow)
Description copied from class: WebBrowserDecorator
Configure the decorator for integration of the web browser in a web browser window.

Specified by:
configureForWebBrowserWindow in class WebBrowserDecorator

setWebBrowserWindowTitle

protected void setWebBrowserWindowTitle(JWebBrowserWindow webBrowserWindow,
                                        String pageTitle)

setWebBrowserWindowIcon

protected void setWebBrowserWindowIcon(JWebBrowserWindow webBrowserWindow)

askLocation

protected String askLocation()
Ask the user, by default using an option pane (input dialog), the location to open.


configureComponent

protected void configureComponent(JComponent c,
                                  DefaultWebBrowserDecorator.WebBrowserDecoratorComponentType componentType)
Configure a component (its text, icon, tooltip, etc.).