public abstract class AbstractBrowserBalloon extends AbstractBalloon implements HotSpot, Disposable
Balloon
that displays HTML, JavaScript, and Flash content using the
system's native browser. The balloon's HTML content is specified by calling setText
with an HTML
formatted string. A browser balloon resolves relative URLs
in the HTML content by consulting its
resource resolver. The resource resolver converts a relative URL
to an absolute URL
that
the browser can load. The resource resolver is specified by calling setResourceResolver
, and may be one
of the following: a WebResourceResolver
, a URL
, or a String
containing a valid URL description. If a browser balloon's resource
resolver is null
or is an unrecognized type, the browser interprets relative URLs
as
unresolved references.
Browser Controls
Browser balloons display three default browser controls that enable users to navigate the browser's history back and
forward, and to close the balloon. When the user selects one of these controls, a SelectEvent
is
generated with the PickedObject's
AVKey.ACTION
value set to one of
AVKey.CLOSE
, AVKey.BACK
, or AVKey.FORWARD
. These controls may be enabled or
disabled by calling setDrawBrowserControls
(they are enabled by default), and may be customized by
adding or removing controls from the browser balloon. See getBrowserControls
,
addBrowserControl
, and removeBrowserControl
.
Resize Control
Browser balloons provide a default resize control that is activated by dragging the balloon's border. When the user
drags the border, a SelectEvent
is generated with the PickedObject's AVKey.ACTION
value set
to AVKey.RESIZE
. The PickedObject's
AVKey.BOUNDS
value holds the Balloon's
screen bounds in AWT coordinates (origin at the upper left corner) as a java.awt.Rectangle
. The resize
control may be enabled or disabled by calling setDrawResizeControl
(it is enabled by default).
Balloon Size
The browser balloon's screen width and height are specified as a
object in its Size
BalloonAttributes
. This size may configured in one of the following three modes:
WorldWindow
size.Size
object in its BalloonAttributes
. If the maximum size is null
, the
balloon's width and height are unlimited. The space provided for the balloon's HTML content equal to the balloon's
screen width and height minus the balloon's insets, also specified in its BalloonAttributes
The balloon's width or height (or both) may be configured to fit to the balloon's HTML content by configuring its
BalloonAttributes
with a Size
who's width or height mode is
Size.NATIVE_DIMENSION
or Size.MAINTAIN_ASPECT_RATIO
. When configured in this mode, the
browser balloon's size always fits the HTML content specified at construction or by calling setText
. If
a user action causes the balloon to navigate to another page, the balloon continues to fit to its current HTML
content.
The balloon frame's corner radius and leader width specified in its BalloonAttributes
are limited by the
balloon's size. The corner radius is first limited by the balloon's width and height, then the leader width is
limited by the balloon's width and height minus space taken by rounded corners. For example, if the corner radius is
100 and the width and height are 50 and 100, the actual corner radius used is 25 - half of the rectangle's smallest
dimension. Similarly, if the leader is attached to the rectangle's bottom, its width is limited by the rectangle's
width minus any space used by the balloon's rounded corners.
Hiding the balloon
The balloon can be made visible or invisible by calling setVisible
. The balloon's visibilityAction
determines what happens to the native web browser when the balloon is invisible. The balloon can
either release its native web browser, preventing the native browser from consuming system resources while the
balloon is invisible, or it can retain the native browser. Possible values of visibilityAction
are:
Modifier and Type | Class and Description |
---|---|
static class |
AbstractBrowserBalloon.BrowserControl |
protected static class |
AbstractBrowserBalloon.FrameGeometryInfo
Holds the vertex data and the defining properties of a balloon's frame and leader geometry.
|
protected class |
AbstractBrowserBalloon.OrderedBrowserBalloon |
Modifier and Type | Field and Description |
---|---|
protected java.util.List<AbstractBrowserBalloon.BrowserControl> |
browserControls |
protected static java.awt.Dimension |
DEFAULT_NATIVE_SIZE
The browser balloon's default native size: 400x300.
|
protected static int |
DEFAULT_OUTLINE_PICK_WIDTH
The default outline pick width in pixels.
|
protected static java.lang.String |
DEFAULT_WEB_VIEW_FACTORY
The class name of the default
used to create
the balloon's internal WebView . |
protected boolean |
drawBrowserControls |
protected boolean |
drawResizeControl |
protected boolean |
drawTitleBar |
protected static int |
FRAME_GEOMETRY_ELLIPSE_SLICES
The number of slices used to display a balloon frame as an ellipse: 64.
|
protected static int |
FRAME_GEOMETRY_RECTANGLE_CORNER_SLICES
The number of slices used to display each of a rectangular balloon frame's rounded corners: 16.
|
protected java.awt.Point |
lastPickPoint
The screen coordinate of the last
SelectEvent sent to this balloon's select method. |
protected java.util.HashMap<GlobeStateKey,AbstractBrowserBalloon.OrderedBrowserBalloon> |
orderedRenderables |
protected OGLStackHandler |
osh
Support for setting up and restoring OpenGL state during rendering.
|
protected int |
outlinePickWidth
The line width used to draw the the balloon's outline during picking.
|
protected Layer |
pickLayer
The layer active during the most recent pick pass.
|
protected PickSupport |
pickSupport
Support for setting up and restoring picking state, and resolving the picked object.
|
protected java.lang.Object |
resourceResolver
Indicates the object used to resolve relative resource paths in this browser balloon's HTML content.
|
protected long |
screenBalloonPickFrame |
protected long |
screenBalloonRenderFrame |
protected java.awt.Point |
screenOffset
The location of the balloon's content frame relative to the balloon's screen point in the viewport.
|
protected long |
textUpdateTime
Identifies the time when the balloon text was updated.
|
protected java.lang.String |
visibilityAction
Action that will occur when the balloon is made invisible.
|
protected WebView |
webView
Interface for interacting with the operating system's web browser control.
|
protected java.awt.Dimension |
webViewContentSize
The size of the WebView's HTML content size, in pixels.
|
protected boolean |
webViewCreationFailed
Denotes whether or not an attempt at WebView creation failed.
|
protected long |
webViewTimeStamp
Identifies the frame used to update the WebView's state.
|
activeAttributes, alwaysOnTop, attributes, defaultAttributes, delegateOwner, highlightAttributes, highlighted, maxActiveAltitude, minActiveAltitude, pickEnabled, text, textDecoder, visible
Modifier | Constructor and Description |
---|---|
protected |
AbstractBrowserBalloon(java.lang.String text) |
Modifier and Type | Method and Description |
---|---|
void |
addAllBrowserControls(java.lang.Iterable<? extends AbstractBrowserBalloon.BrowserControl> iterable) |
void |
addBrowserControl(AbstractBrowserBalloon.BrowserControl browserControl) |
AbstractBrowserBalloon.BrowserControl |
addBrowserControl(java.lang.String action,
Offset offset,
java.lang.Object imageSource) |
AbstractBrowserBalloon.BrowserControl |
addBrowserControl(java.lang.String action,
Offset offset,
Size size,
java.lang.Object imageSource) |
protected void |
beginDrawing(DrawContext dc) |
protected boolean |
bindWebViewTexture(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected abstract void |
computeBalloonPoints(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb)
Computes and stores the balloon's model-coordinate and screen-coordinate points.
|
protected java.awt.Rectangle |
computeFramePickRect(java.awt.Rectangle frameRect) |
protected java.awt.Rectangle |
computeFrameRectForWebViewRect(BalloonAttributes activeAttrs,
java.awt.Rectangle webViewRect) |
protected void |
computeGeometry(AbstractBrowserBalloon.OrderedBrowserBalloon obb)
Updates the balloon's screen-coordinate geometry in
frameInfo according to the current screen
bounds, screen offset, and active attributes. |
protected java.awt.Point |
computeOffset(DrawContext dc,
BalloonAttributes activeAttrs,
int width,
int height) |
protected double |
computeOutlinePickWidth()
Computes the line width to use during picking (in pixels).
|
protected java.awt.Dimension |
computeSize(DrawContext dc,
BalloonAttributes activeAttrs)
Computes the size of this balloon's frame in the viewport (on the screen).
|
protected java.awt.Rectangle |
computeWebViewRectForFrameRect(BalloonAttributes activeAttrs,
java.awt.Rectangle frameRect) |
protected java.awt.Point |
convertToWebView(java.lang.Object context,
java.awt.Point point)
Converts the specified screen point from AWT coordinates to local WebView coordinates.
|
protected static java.util.List<AbstractBrowserBalloon.BrowserControl> |
createDefaultBrowserControls()
Returns a list containing the browser balloon's three default browser controls, configured as follows:
Controls
ControlActionOffsetSizeImage Source
Close
AVKey.CLOSE (30, 25) pixels inset from the balloon's upper right
cornerImage source's native size in pixels (16x16)images/browser-close-16x16.gif
BackAVKey.BACK (15, 25) pixels inset from the balloon's upper left
cornerImage source's native size in pixels (16x16)images/browser-back-16x16.gif
ForwardAVKey.FORWARD (35, 25) pixels inset from the balloon's upper left
cornerImage source's native size in pixels (16x16)images/browser-forward-16x16.gif
|
protected java.nio.FloatBuffer |
createFrameVertices(AbstractBrowserBalloon.OrderedBrowserBalloon obb)
Creates the balloon's frame vertex buffer according to the active attributes.
|
protected PickedObject |
createLinkPickedObject(DrawContext dc,
java.awt.Color pickColor,
AVList linkParams) |
protected abstract AbstractBrowserBalloon.OrderedBrowserBalloon |
createOrderedRenderable() |
protected PickedObject |
createPickedObject(DrawContext dc,
java.awt.Color pickColor) |
protected void |
determineWebViewContentSize() |
void |
dispose()
Disposes the balloon's internal
. |
protected void |
disposeWebView() |
protected void |
doDrawOrderedRenderable(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected void |
drawBrowserControl(DrawContext dc,
AbstractBrowserBalloon.BrowserControl control,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected void |
drawBrowserControls(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected void |
drawFrame(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected void |
drawFrameInterior(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb)
Draws this browser balloon's interior geometry in screen-coordinates, with the
WebView's texture
representation applied as an OpenGL decal. |
protected void |
drawFrameOutline(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected void |
drawLinks(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected void |
drawOrderedRenderable(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected void |
drawResizeControl(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb)
Draw pickable regions for the resize controls.
|
protected void |
drawTitleBar(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected void |
drawWebViewLinks(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected void |
endDrawing(DrawContext dc) |
java.awt.Rectangle |
getBounds(DrawContext dc)
Get the balloon bounding
Rectangle using OGL coordinates - bottom-left corner x and y relative
to the WorldWindow bottom-left corner, and the balloon callout width and height. |
java.lang.Iterable<AbstractBrowserBalloon.BrowserControl> |
getBrowserControls() |
java.awt.Cursor |
getCursor()
Returns a
null Cursor, indicating the default cursor should be used when the BrowserBalloon is
active. |
int |
getOutlinePickWidth()
Indicates the outline line width (in pixels) used during picking.
|
java.lang.Object |
getResourceResolver()
Indicates the object used to resolve relative resource paths in this browser balloon's HTML content.
|
java.lang.String |
getVisibilityAction()
Indicates the the action that occurs when the BrowserBalloon is set to invisible.
|
void |
goBack()
Navigate the browser to the previous page in the browsing history.
|
void |
goForward()
Navigate the browser to the next page in the browsing history.
|
protected void |
handleKeyEvent(java.awt.event.KeyEvent event)
Sends the specified
KeyEvent to the balloon's internal WebView . |
protected void |
handleMouseEvent(java.awt.event.MouseEvent event)
Sends the specified
MouseEvent to the balloon's internal WebView . |
protected void |
handleSelectEvent(SelectEvent event)
Sends the specified
SelectEvent to the balloon's internal WebView . |
protected boolean |
intersectsFrustum(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb)
Determines whether the balloon intersects the view frustum.
|
boolean |
isActive()
Indicates whether or not this HotSpot is active.
|
boolean |
isDrawBrowserControls() |
protected boolean |
isDrawBrowserControls(DrawContext dc) |
protected boolean |
isDrawInterior(DrawContext dc) |
protected boolean |
isDrawLinks(DrawContext dc) |
protected boolean |
isDrawOutline(DrawContext dc) |
boolean |
isDrawResizeControl() |
protected boolean |
isDrawResizeControl(DrawContext dc) |
boolean |
isDrawTitleBar() |
protected boolean |
isDrawTitleBar(DrawContext dc) |
void |
keyPressed(java.awt.event.KeyEvent event)
Forwards the key pressed event to the balloon's internal
and consumes the event. |
void |
keyReleased(java.awt.event.KeyEvent event)
Forwards the key released event to the balloon's internal
and consumes the event. |
void |
keyTyped(java.awt.event.KeyEvent event)
Forwards the key typed event to the balloon's internal
and consumes the event. |
protected java.nio.FloatBuffer |
makeDefaultFrameVertices(AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected java.nio.FloatBuffer |
makeEllipseFrameVertices(AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected void |
makeOrderedRenderable(DrawContext dc)
Updates the balloon's per-frame rendering state, and determines whether to queue an ordered renderable for the
balloon.
|
protected java.nio.FloatBuffer |
makeRectangleFrameVertices(AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected void |
makeWebView(DrawContext dc,
java.awt.Dimension frameSize) |
void |
mouseClicked(java.awt.event.MouseEvent event)
Does nothing; BrowserBalloon handles mouse clicked events in
selected . |
void |
mouseDragged(java.awt.event.MouseEvent event)
Does nothing; BrowserBalloon handles mouse dragged events in
selected . |
void |
mouseEntered(java.awt.event.MouseEvent event)
Does nothing; BrowserBalloon does not handle mouse entered events.
|
void |
mouseExited(java.awt.event.MouseEvent event)
Does nothing; BrowserBalloon does not handle mouse exited events.
|
void |
mouseMoved(java.awt.event.MouseEvent event)
Forwards the mouse moved event to the balloon's internal
. |
void |
mousePressed(java.awt.event.MouseEvent event)
Does nothing; BrowserBalloon handles mouse pressed events in
selected . |
void |
mouseReleased(java.awt.event.MouseEvent event)
Does nothing; BrowserBalloon handles mouse released events in
selected . |
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent event)
Forwards the mouse wheel event to the balloon's internal
and consumes the event. |
protected boolean |
mustRegenerateGeometry(AbstractBrowserBalloon.OrderedBrowserBalloon obb)
Indicates whether this balloon's screen-coordinate geometry must be recomputed as a result of a balloon attribute
changing.
|
void |
pick(DrawContext dc,
java.awt.Point pickPoint,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected void |
prepareToDrawInterior(DrawContext dc) |
protected void |
prepareToDrawOutline(DrawContext dc) |
void |
propertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
The property change listener for this instance.
|
void |
removeAllBrowserControls() |
void |
removeBrowserControl(AbstractBrowserBalloon.BrowserControl browserControl) |
void |
render(DrawContext dc)
Causes this
Renderable to render itself using the provided draw context. |
void |
selected(SelectEvent event)
Forwards the
MouseEvent associated with the specified event to the balloon's internal
WebView . |
void |
setActive(boolean active)
Called when this HotSpot is activated or deactivated.
|
void |
setDrawBrowserControls(boolean draw) |
void |
setDrawResizeControl(boolean draw) |
void |
setDrawTitleBar(boolean draw) |
void |
setOutlinePickWidth(int width)
Specifies the outline line width (in pixels) to use during picking.
|
void |
setResourceResolver(java.lang.Object resourceResolver)
Specifies a the object to use when resolving relative resource paths in this browser balloon's HTML content.
|
protected abstract void |
setupDepthTest(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
void |
setVisibilityAction(java.lang.String visibilityAction)
Specifies the action that occurs when this balloon is set to invisible.
|
void |
setVisible(boolean visible)
Set whether the balloon is visible and should be rendered.
|
protected void |
setWebViewContent() |
protected void |
updateRenderState(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
protected void |
updateRenderStateIfNeeded(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb)
Update the balloon's active attributes and points, if that hasn't already been done this frame.
|
protected void |
updateWebView(DrawContext dc,
AbstractBrowserBalloon.OrderedBrowserBalloon obb) |
determineActiveAttributes, getActiveAttributes, getAttributes, getDecodedText, getDelegateOwner, getHighlightAttributes, getMaxActiveAltitude, getMinActiveAltitude, getText, getTextDecoder, isAlwaysOnTop, isHighlighted, isPickEnabled, isVisible, setAlwaysOnTop, setAttributes, setDelegateOwner, setHighlightAttributes, setHighlighted, setMaxActiveAltitude, setMinActiveAltitude, setPickEnabled, setText, setTextDecoder
onMessage
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
protected java.util.List<AbstractBrowserBalloon.BrowserControl> browserControls
protected static final java.awt.Dimension DEFAULT_NATIVE_SIZE
protected static final int DEFAULT_OUTLINE_PICK_WIDTH
protected static final java.lang.String DEFAULT_WEB_VIEW_FACTORY
WebViewFactory
used to create
the balloon's internal WebView
. This factory is used when the configuration does not specify a
WebView factory.protected boolean drawBrowserControls
protected boolean drawResizeControl
protected boolean drawTitleBar
protected static final int FRAME_GEOMETRY_ELLIPSE_SLICES
protected static final int FRAME_GEOMETRY_RECTANGLE_CORNER_SLICES
protected java.awt.Point lastPickPoint
SelectEvent
sent to this balloon's select
method.protected java.util.HashMap<GlobeStateKey,AbstractBrowserBalloon.OrderedBrowserBalloon> orderedRenderables
protected OGLStackHandler osh
protected int outlinePickWidth
DEFAULT_OUTLINE_PICK_WIDTH
.protected Layer pickLayer
protected PickSupport pickSupport
protected java.lang.Object resourceResolver
WebResourceResolver
, URL
, String
containing a valid URL description, or null
to
specify that relative paths should be interpreted as unresolved references. Initially null
.protected long screenBalloonPickFrame
protected long screenBalloonRenderFrame
protected java.awt.Point screenOffset
protected long textUpdateTime
protected java.lang.String visibilityAction
protected WebView webView
null
.protected java.awt.Dimension webViewContentSize
null
or (0, 0)
, indicating that the WebView's
HTML content size is unknown. Initially null
.protected boolean webViewCreationFailed
true
the balloon does not perform
subsequent attempts to create the WebView. Initially false
.protected long webViewTimeStamp
public void addAllBrowserControls(java.lang.Iterable<? extends AbstractBrowserBalloon.BrowserControl> iterable)
public void addBrowserControl(AbstractBrowserBalloon.BrowserControl browserControl)
public AbstractBrowserBalloon.BrowserControl addBrowserControl(java.lang.String action, Offset offset, java.lang.Object imageSource)
public AbstractBrowserBalloon.BrowserControl addBrowserControl(java.lang.String action, Offset offset, Size size, java.lang.Object imageSource)
protected void beginDrawing(DrawContext dc)
protected boolean bindWebViewTexture(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected abstract void computeBalloonPoints(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
dc
- the current draw context.obb
- the ordered browser balloon.protected java.awt.Rectangle computeFramePickRect(java.awt.Rectangle frameRect)
protected java.awt.Rectangle computeFrameRectForWebViewRect(BalloonAttributes activeAttrs, java.awt.Rectangle webViewRect)
protected void computeGeometry(AbstractBrowserBalloon.OrderedBrowserBalloon obb)
frameInfo
according to the current screen
bounds, screen offset, and active attributes.obb
- the ordered browser balloon.protected java.awt.Point computeOffset(DrawContext dc, BalloonAttributes activeAttrs, int width, int height)
protected double computeOutlinePickWidth()
outlinePickWidth
.protected java.awt.Dimension computeSize(DrawContext dc, BalloonAttributes activeAttrs)
null
, the returned size is no larger than the maximum size.dc
- the current draw context.activeAttrs
- the attributes used to compute the balloon's size.protected java.awt.Rectangle computeWebViewRectForFrameRect(BalloonAttributes activeAttrs, java.awt.Rectangle frameRect)
protected java.awt.Point convertToWebView(java.lang.Object context, java.awt.Point point)
point
- The point to convert.context
- the component who's coordinate system the point is in.Point
in the WebView's local coordinate system.protected static java.util.List<AbstractBrowserBalloon.BrowserControl> createDefaultBrowserControls()
Control | Action | Offset | Size | Image Source |
---|---|---|---|---|
Close | AVKey.CLOSE | (30, 25) pixels inset from the balloon's upper right corner | Image source's native size in pixels (16x16) | images/browser-close-16x16.gif |
Back | AVKey.BACK | (15, 25) pixels inset from the balloon's upper left corner | Image source's native size in pixels (16x16) | images/browser-back-16x16.gif |
Forward | AVKey.FORWARD | (35, 25) pixels inset from the balloon's upper left corner | Image source's native size in pixels (16x16) | images/browser-forward-16x16.gif |
protected java.nio.FloatBuffer createFrameVertices(AbstractBrowserBalloon.OrderedBrowserBalloon obb)
obb
- the ordered browser balloon.protected PickedObject createLinkPickedObject(DrawContext dc, java.awt.Color pickColor, AVList linkParams)
protected abstract AbstractBrowserBalloon.OrderedBrowserBalloon createOrderedRenderable()
protected PickedObject createPickedObject(DrawContext dc, java.awt.Color pickColor)
protected void determineWebViewContentSize()
public void dispose()
WebView
. This does nothing
if the balloon is already disposed.dispose
in interface Disposable
protected void disposeWebView()
protected void doDrawOrderedRenderable(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected void drawBrowserControl(DrawContext dc, AbstractBrowserBalloon.BrowserControl control, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected void drawBrowserControls(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected void drawFrame(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected void drawFrameInterior(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
WebView's
texture
representation applied as an OpenGL decal. OpenGL's texture decal mode uses the texture color where the texture's
alpha is 1, and uses the balloon's background color where it's 0. The texture's internal format must be RGBA to
work correctly, and this assumes that the WebView's texture format is RGBA.
If the WebView's
texture cannot be created or cannot be applied for any reason, this displays the
balloon's interior geometry in the balloon's background color without applying the WebView's
texture.
If the specified draw context is in picking mode, this draws the balloon's interior geometry in the current color
and does not apply the WebView's
texture.
dc
- the current draw context.obb
- the ordered browser balloon.protected void drawFrameOutline(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected void drawLinks(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected void drawOrderedRenderable(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected void drawResizeControl(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
dc
- Draw context.obb
- the ordered browser balloon.protected void drawTitleBar(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected void drawWebViewLinks(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected void endDrawing(DrawContext dc)
public java.awt.Rectangle getBounds(DrawContext dc)
Rectangle
using OGL coordinates - bottom-left corner x and y relative
to the WorldWindow
bottom-left corner, and the balloon callout width and height.
The balloon offset from it's reference point is factored in such that the callout leader shape and reference point are included in the bounding rectangle.
public java.lang.Iterable<AbstractBrowserBalloon.BrowserControl> getBrowserControls()
public java.awt.Cursor getCursor()
null
Cursor, indicating the default cursor should be used when the BrowserBalloon is
active. The Cursor is set by the WebView
in response to
mouse moved events.public int getOutlinePickWidth()
setOutlinePickWidth(int)
public java.lang.Object getResourceResolver()
WebResourceResolver
, URL
,
String
containing a valid URL description, or null
to indicate that
relative paths are interpreted as unresolved references.setResourceResolver(Object)
public java.lang.String getVisibilityAction()
setVisibilityAction
for a description of the possible actions.setVisibilityAction(String)
,
setVisible(boolean)
public void goBack()
public void goForward()
protected void handleKeyEvent(java.awt.event.KeyEvent event)
KeyEvent
to the balloon's internal WebView
.
This does nothing if the balloon's internal WebView
is uninitialized.
event
- the event to send.protected void handleMouseEvent(java.awt.event.MouseEvent event)
MouseEvent
to the balloon's internal WebView
. The event's point is
converted from AWT coordinates to the WebView's local coordinate system.
This does nothing if the balloon's internal WebView
is uninitialized.
event
- the event to send.protected void handleSelectEvent(SelectEvent event)
SelectEvent
to the balloon's internal WebView
. The event's
pickPoint
is converted from AWT coordinates to the WebView's local coordinate system.event
- the event to send.protected boolean intersectsFrustum(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
dc
- the current draw context.obb
- the ordered browser balloon.true
If the balloon intersects the frustum, otherwise false
.public boolean isActive()
public boolean isDrawBrowserControls()
protected boolean isDrawBrowserControls(DrawContext dc)
protected boolean isDrawInterior(DrawContext dc)
protected boolean isDrawLinks(DrawContext dc)
protected boolean isDrawOutline(DrawContext dc)
public boolean isDrawResizeControl()
protected boolean isDrawResizeControl(DrawContext dc)
public boolean isDrawTitleBar()
protected boolean isDrawTitleBar(DrawContext dc)
public void keyPressed(java.awt.event.KeyEvent event)
WebView
and consumes the event. This consumes the event so the View
doesn't
respond to it. ThekeyPressed
in interface HotSpot
keyPressed
in interface java.awt.event.KeyListener
event
- The event to forward.public void keyReleased(java.awt.event.KeyEvent event)
WebView
and consumes the event. This consumes the event so the View
doesn't
respond to it.keyReleased
in interface HotSpot
keyReleased
in interface java.awt.event.KeyListener
event
- The event to forward.public void keyTyped(java.awt.event.KeyEvent event)
protected java.nio.FloatBuffer makeDefaultFrameVertices(AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected java.nio.FloatBuffer makeEllipseFrameVertices(AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected void makeOrderedRenderable(DrawContext dc)
updateRenderStateIfNeeded
, and updates its geometry by calling computeGeometry
.
BrowserBalloon separates render state updates from geometry updates for two reasons:
dc
- the current draw context.protected java.nio.FloatBuffer makeRectangleFrameVertices(AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected void makeWebView(DrawContext dc, java.awt.Dimension frameSize)
public void mouseClicked(java.awt.event.MouseEvent event)
selected
.mouseClicked
in interface HotSpot
mouseClicked
in interface java.awt.event.MouseListener
event
- The event to handle.public void mouseDragged(java.awt.event.MouseEvent event)
selected
.mouseDragged
in interface HotSpot
mouseDragged
in interface java.awt.event.MouseMotionListener
event
- The event to handle.public void mouseEntered(java.awt.event.MouseEvent event)
mouseEntered
in interface HotSpot
mouseEntered
in interface java.awt.event.MouseListener
event
- The event to handle.public void mouseExited(java.awt.event.MouseEvent event)
mouseExited
in interface HotSpot
mouseExited
in interface java.awt.event.MouseListener
event
- The event to handle.public void mouseMoved(java.awt.event.MouseEvent event)
WebView
.
This does not consume the event, because the InputHandler
implements the policy for consuming or forwarding mouse moved events to other objects.
Unlike mouse clicked, mouse pressed, and mouse dragged events, mouse move events cannot be forwarded to the
WebView via SelectEvents in selected
, because mouse movement events are not selection events.
mouseMoved
in interface HotSpot
mouseMoved
in interface java.awt.event.MouseMotionListener
event
- The event to forward.public void mousePressed(java.awt.event.MouseEvent event)
selected
.mousePressed
in interface HotSpot
mousePressed
in interface java.awt.event.MouseListener
event
- The event to handle.public void mouseReleased(java.awt.event.MouseEvent event)
selected
.mouseReleased
in interface HotSpot
mouseReleased
in interface java.awt.event.MouseListener
event
- The event to handle.public void mouseWheelMoved(java.awt.event.MouseWheelEvent event)
WebView
and consumes the event. This consumes the event so the View
doesn't
respond to it.
Unlike mouse clicked, mouse pressed, and mouse dragged events, mouse wheel events cannot be forwarded to the
WebView via SelectEvents in selected
, because mouse wheel events are not selection events.
mouseWheelMoved
in interface HotSpot
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
event
- The event to forward.protected boolean mustRegenerateGeometry(AbstractBrowserBalloon.OrderedBrowserBalloon obb)
obb
- the ordered browser balloontrue
if this balloon's geometry must be recomputed, otherwise false
.public void pick(DrawContext dc, java.awt.Point pickPoint, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected void prepareToDrawInterior(DrawContext dc)
protected void prepareToDrawOutline(DrawContext dc)
public void propertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
Overridden to suppress AVKey.REPAINT
property change events sent by the balloon's internal
when WebView
isVisible
returns
false
.
propertyChange
in interface java.beans.PropertyChangeListener
propertyChange
in class WWObjectImpl
propertyChangeEvent
- the eventpublic void removeAllBrowserControls()
public void removeBrowserControl(AbstractBrowserBalloon.BrowserControl browserControl)
public void render(DrawContext dc)
Renderable
Renderable
to render itself using the provided draw context.render
in interface Renderable
dc
- the DrawContext
to be usedDrawContext
public void selected(SelectEvent event)
MouseEvent
associated with the specified event
to the balloon's internal
WebView
. This does not consume the event, because the InputHandler
implements the policy for consuming or forwarding mouse clicked
events to other objects.selected
in interface SelectListener
selected
in interface HotSpot
event
- The event to handle.public void setActive(boolean active)
public void setDrawBrowserControls(boolean draw)
public void setDrawResizeControl(boolean draw)
public void setDrawTitleBar(boolean draw)
public void setOutlinePickWidth(int width)
width
must be zero
or a positive integer. Specifying a pick width of zero effectively disables the picking of the balloon's outline
and its resize control. A larger width than normal typically makes the outline easier to pick.
When the the balloon's resize control is enabled, the outline becomes the resize control and is drawn in the
specified width
. Therefore this value also controls the balloon's resize control width. If the
resize control is disabled by calling
with a value of
setDrawResizeControl(boolean)
false
, this has no effect on the balloon's resize control until it is enabled.
width
- the outline line width (in pixels) to use during picking.java.lang.IllegalArgumentException
- if width
is less than zero.getOutlinePickWidth()
,
setDrawResizeControl(boolean)
public void setResourceResolver(java.lang.Object resourceResolver)
resourceResolver
may be one of the following:
WebResourceResolver
URL
String
containing a valid URL description
If the resourceResolver
is null
or is not one of the recognized types, this browser
balloon interprets relative resource paths as unresolved references.
resourceResolver
- the object to use when resolving relative resource paths in HTML content. May be one of
the following: WebResourceResolver
,
URL
, String
containing a valid URL
description, or null
to specify that relative paths should be interpreted as
unresolved references.getResourceResolver()
protected abstract void setupDepthTest(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
public void setVisibilityAction(java.lang.String visibilityAction)
visibilityAction
- Either AVKey.VISIBILITY_ACTION_RELEASE
or AVKey.VISIBILITY_ACTION_RETAIN
.public void setVisible(boolean visible)
When this balloon is set to invisible, the visibilityAction
determines what happens to the native web
browser that backs the balloon. By default, the browser resources are released when the balloon is not visible.
setVisible
in interface Balloon
setVisible
in class AbstractBalloon
visible
- true if the balloon is visible and should be rendered.setVisibilityAction(String)
protected void setWebViewContent()
protected void updateRenderState(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
protected void updateRenderStateIfNeeded(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)
determineActiveAttributes
and stores the result in activeAttributes
.computeBalloonPoints
.dc
- the current draw context.obb
- the ordered browser balloon to update.protected void updateWebView(DrawContext dc, AbstractBrowserBalloon.OrderedBrowserBalloon obb)