NASA World Wind

gov.nasa.worldwind.util.webview
Class AbstractWebView

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.util.webview.AbstractWebView
All Implemented Interfaces:
AVList, Disposable, MessageListener, WebView, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
MacWebView, WindowsWebView

public abstract class AbstractWebView
extends WWObjectImpl
implements WebView, Disposable

Abstract base class for WebView implementations.


Field Summary
protected  boolean active
          Indicates whether the WebView is active.
protected  Dimension frameSize
          The size of the WebView frame in pixels.
protected  WWTexture textureRep
          The WebView's current texture representation.
 
Constructor Summary
AbstractWebView()
           
 
Method Summary
protected abstract  WWTexture createTextureRepresentation(DrawContext dc)
          Create a texture representation of the WebView.
protected abstract  void doSetFrameSize(Dimension size)
           
protected  void finalize()
          Overridden to ensure that the WebView's native resources are disposed when the WebView is reclaimed by the garbage collector.
 Dimension getFrameSize()
          Returns the size in pixels of this WebView's frame.
 WWTexture getTextureRepresentation(DrawContext dc)
          Returns a layed out and rendered representation of the WebView's content as a WWTexture.
 boolean isActive()
          Indicates whether or not this WebView is active.
 void propertyChange(PropertyChangeEvent event)
          The property change listener for this instance.
 void setActive(boolean active)
          Called when this WebView is activated or deactivated.
 void setFrameSize(Dimension size)
          Specifies the size in pixels of this WebView's frame.
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
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
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.util.webview.WebView
getBackgroundColor, getContentSize, getContentURL, getLinks, getMinContentSize, goBack, goForward, sendEvent, setBackgroundColor, setHTMLString, setHTMLString, setHTMLString, setMinContentSize
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from interface gov.nasa.worldwind.Disposable
dispose
 

Field Detail

active

protected boolean active
Indicates whether the WebView is active.


frameSize

protected Dimension frameSize
The size of the WebView frame in pixels. Initially null, indicating the default size is used.


textureRep

protected WWTexture textureRep
The WebView's current texture representation. Lazily created in getTextureRepresentation(gov.nasa.worldwind.render.DrawContext).

Constructor Detail

AbstractWebView

public AbstractWebView()
Method Detail

createTextureRepresentation

protected abstract WWTexture createTextureRepresentation(DrawContext dc)
Create a texture representation of the WebView.

Parameters:
dc - draw context.
Returns:
A texture representation of the WebView contents.

doSetFrameSize

protected abstract void doSetFrameSize(Dimension size)

finalize

protected void finalize()
                 throws Throwable
Overridden to ensure that the WebView's native resources are disposed when the WebView is reclaimed by the garbage collector. This does nothing if the WebView's owner has already called Disposable.dispose().

Overrides:
finalize in class Object
Throws:
Throwable

getFrameSize

public Dimension getFrameSize()
Returns the size in pixels of this WebView's frame. This returns null if this WebView's frame size is unspecified.

Specified by:
getFrameSize in interface WebView
Returns:
the size of this WebView's frame in pixels, or null if it's unspecified.
See Also:
WebView.setFrameSize(java.awt.Dimension)

getTextureRepresentation

public WWTexture getTextureRepresentation(DrawContext dc)
Returns a layed out and rendered representation of the WebView's content as a WWTexture. The texture's image source is the WebView, and its dimensions are large enough to capture the WebView's frame size (see WebView.setFrameSize(java.awt.Dimension).

On machines that support non-power-of-two sized textures, the texture's dimensions are always equal to the WebView's frame size. Otherwise, the texture's dimensions are the smallest power-of-two that captures the WebView's frame size.

Specified by:
getTextureRepresentation in interface WebView
Parameters:
dc - The draw context the WebView is associated with.
Returns:
a rendered representation of the WebView's frame as a WWTexture.

isActive

public boolean isActive()
Indicates whether or not this WebView is active. The WebView only receives input events when it is active.

Specified by:
isActive in interface WebView
Returns:
true if this WebView is active, false if not.

propertyChange

public void propertyChange(PropertyChangeEvent event)
Description copied from class: WWObjectImpl
The property change listener for this instance. Receives property change notifications that this instance has registered with other property change notifiers.

Specified by:
propertyChange in interface PropertyChangeListener
Overrides:
propertyChange in class WWObjectImpl
Parameters:
event - the event

setActive

public void setActive(boolean active)
Called when this WebView is activated or deactivated. The WebView only receives input events when it is active.

Specified by:
setActive in interface WebView
Parameters:
active - true if this WebView is being activated. false if this WebView is being deactivated.
See Also:
WebView.sendEvent(java.awt.event.InputEvent)

setFrameSize

public void setFrameSize(Dimension size)
Specifies the size in pixels of this WebView's frame.

Specified by:
setFrameSize in interface WebView
Parameters:
size - the size of this WebView's frame in pixels.

NASA World Wind