Package org.xj3d.ui.awt.widgets
Class SwingLocationToolbar
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.xj3d.ui.awt.widgets.SwingLocationToolbar
- All Implemented Interfaces:
ActionListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,BrowserCoreListener
,FileHandler
public class SwingLocationToolbar
extends JPanel
implements ActionListener, FileHandler, BrowserCoreListener
A swing panel that implements the capabilities of the URL/Location
toolbar.
- Version:
- $Revision: 1.13 $
- Author:
- Justin Couch
- See Also:
-
Nested Class Summary
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
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
accessibleContext, 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
ConstructorsConstructorDescriptionSwingLocationToolbar
(BrowserCore core, WorldLoaderManager wlm, boolean urlReadOnly, boolean showOpenButton, boolean showReloadButton, String contentDir, Properties skinProperties, org.j3d.util.ErrorReporter reporter) Create an instance of the panel configured to show or hide the controls as described.SwingLocationToolbar
(BrowserCore core, WorldLoaderManager wlm, boolean urlReadOnly, boolean showOpenButton, boolean showReloadButton, String contentDir, org.j3d.util.ErrorReporter reporter) Create an instance of the panel configured to show or hide the controls as described. -
Method Summary
Modifier and TypeMethodDescriptionvoid
An action has been performed.void
The browser has been disposed.void
browserInitialized
(VRMLScene scene) The browser has been initialised with new content.void
The browser has been shut down and the previous content is no longer valid.org.j3d.util.ErrorReporter
Fetch the error handler so that application code can post messages too.Get the Open Action.Get the Reload Action.void
Change the panels content to the provided URL.void
loadURL
(InputSource src) Change the panels content to the provided URL.void
setProgressListener
(org.ietf.uri.event.ProgressListener listener) Set a progress listener for download progress.void
setThrottle
(FramerateThrottle throttle) Set a Frame throttler.void
urlLoadFailed
(String msg) The tried to load a URL and failed.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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
SwingLocationToolbar
public SwingLocationToolbar(BrowserCore core, WorldLoaderManager wlm, boolean urlReadOnly, boolean showOpenButton, boolean showReloadButton, String contentDir, org.j3d.util.ErrorReporter reporter) Create an instance of the panel configured to show or hide the controls as described.- Parameters:
core
- The browser core implementation to send scene loads towlm
- the loading managerurlReadOnly
- true to make the location bar read onlyshowOpenButton
- true to put an open button with the URL location barshowReloadButton
- true to put a reload button with the URL location barcontentDir
- initial directory to load content from. Must be a full path.reporter
- The reporter instance to use or null
-
SwingLocationToolbar
public SwingLocationToolbar(BrowserCore core, WorldLoaderManager wlm, boolean urlReadOnly, boolean showOpenButton, boolean showReloadButton, String contentDir, Properties skinProperties, org.j3d.util.ErrorReporter reporter) Create an instance of the panel configured to show or hide the controls as described.- Parameters:
core
- The browser core implementation to send scene loads towlm
- the loading managerurlReadOnly
- true to make the location bar read onlyshowOpenButton
- true to put an open button with the URL location barshowReloadButton
- true to put a reload button with the URL location barcontentDir
- initial directory to load content from. Must be a full path.skinProperties
- Customisation of the browser buttons etcreporter
- The reporter instance to use or null
-
-
Method Details
-
getOpenAction
-
getReloadAction
-
browserInitialized
Description copied from interface:BrowserCoreListener
The browser has been initialised with new content. The content given is found in the accompanying scene and description.- Specified by:
browserInitialized
in interfaceBrowserCoreListener
- Parameters:
scene
- The scene of the new content
-
urlLoadFailed
The tried to load a URL and failed. It is typically because none of the URLs resolved to anything valid or there were network failures.- Specified by:
urlLoadFailed
in interfaceBrowserCoreListener
- Parameters:
msg
- An error message to go with the failure
-
browserShutdown
public void browserShutdown()The browser has been shut down and the previous content is no longer valid.- Specified by:
browserShutdown
in interfaceBrowserCoreListener
-
browserDisposed
public void browserDisposed()The browser has been disposed.- Specified by:
browserDisposed
in interfaceBrowserCoreListener
-
getErrorReporter
public org.j3d.util.ErrorReporter getErrorReporter()Fetch the error handler so that application code can post messages too.- Specified by:
getErrorReporter
in interfaceFileHandler
- Returns:
- The current error handler instance
-
loadURL
Change the panels content to the provided URL.- Specified by:
loadURL
in interfaceFileHandler
- Parameters:
url
- The URL to load.- Throws:
IOException
- On a failed load or badly formatted URL
-
loadURL
Change the panels content to the provided URL.- Parameters:
src
- The source representation to load- Throws:
IOException
- On a failed load or badly formatted URL
-
actionPerformed
An action has been performed. This is the Go button being pressed. Grab the URL and check with the file to see if it exists first as a local file, and then try to make a URL of it. Finally, if this all works, call the abstract gotoLocation method.- Specified by:
actionPerformed
in interfaceActionListener
- Parameters:
evt
- The event that caused this method to be called.
-
setProgressListener
public void setProgressListener(org.ietf.uri.event.ProgressListener listener) Set a progress listener for download progress. Null will clear.- Parameters:
listener
- The progress listener.
-
setThrottle
Set a Frame throttler. Null is ok.- Parameters:
throttle
- the frame rate throttle
-