net.xoetrope.deprecated.xui.wmf
Class XWmf

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by net.xoetrope.deprecated.xui.wmf.XWmf
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, XContentHolder

public class XWmf
extends java.awt.Canvas
implements java.io.Serializable, XContentHolder

Core class for rendering the WMF image. Allows several WMF or WMF graphics files to be played into a single graphics context.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int BRUSH
           
static int FONT
           
static int NULL_BRUSH
           
static int NULL_PEN
           
static int PALETTE
           
static int PEN
           
 
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
XWmf()
          Basic constructor, initializes the storage.
XWmf(boolean bInit)
          Basic constructor for use by Genny.
 
Method Summary
 void add(java.lang.Object c, java.lang.Object constraint)
          Add a child component
 void addURL(java.lang.String _url)
          Adds a url and reads the corresponding file.
 void addUrl(java.net.URL newUrl)
          Adds a url and reads the corresponding file.
 void drawCrossHairs(java.awt.Graphics g, int x, int y)
          This method must be called by derived classes at the end of their paint method.
 java.lang.Object getChildComponent(int i)
          Get a child component
 java.lang.String getURL()
          Returns the first url if any.
 java.net.URL getUrl(int idx)
          Returns the current url.
 java.lang.String getURL(int idx)
          Returns the current url.
 int getXPos()
          Gets the relative mouse position within bounds of the image taking account of zooming and panning.
 int getYPos()
          Gets the relative mouse position within bounds of the image taking account of zooming and panning.
 void init()
          Initializes the storage, add listeners for mouse motion and keyboard handling.
 void paint(java.awt.Graphics g)
          Renders the WMF image(s).
 void pan(int xPercent, int yPercent)
          Pans the image by the specified percentages, withing the range -80 to 20.
 void remove(java.lang.Object c)
          Remove a child component
 void reset()
          Resets the internal storage and the coordinate system.
 void setContent(java.lang.String content)
          Wraps addUrl to allow the url to be set as a string
 void setNextAttributes(java.lang.Object attribs)
          Set the attributes for the next component being added
 void setup(java.lang.String name, int preferredWidth, int preferredHeight, java.util.Hashtable params)
          Setup the container
 void setXPos(int newXPos)
           
 void setYPos(int newYPos)
           
 void zoom(int percent)
          Zooms in or out on the image within the range of 25 to 400 percent of the original image size.
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.xoetrope.xui.XContentHolder
doLayout, getName
 

Field Detail

PEN

public static final int PEN
See Also:
Constant Field Values

BRUSH

public static final int BRUSH
See Also:
Constant Field Values

FONT

public static final int FONT
See Also:
Constant Field Values

NULL_PEN

public static final int NULL_PEN
See Also:
Constant Field Values

NULL_BRUSH

public static final int NULL_BRUSH
See Also:
Constant Field Values

PALETTE

public static final int PALETTE
See Also:
Constant Field Values
Constructor Detail

XWmf

public XWmf()
Basic constructor, initializes the storage.


XWmf

public XWmf(boolean bInit)
Basic constructor for use by Genny.

Method Detail

getChildComponent

public java.lang.Object getChildComponent(int i)
Get a child component

Specified by:
getChildComponent in interface XContentHolder
Parameters:
i - the index of the child within the container
Returns:
the child component

setNextAttributes

public void setNextAttributes(java.lang.Object attribs)
Set the attributes for the next component being added

Specified by:
setNextAttributes in interface XContentHolder
Parameters:
attribs - a table of attributes

add

public void add(java.lang.Object c,
                java.lang.Object constraint)
Add a child component

Specified by:
add in interface XContentHolder
Parameters:
c - the child component
constraint - the layout constraint

remove

public void remove(java.lang.Object c)
Remove a child component

Specified by:
remove in interface XContentHolder
Parameters:
c - the child component

setup

public void setup(java.lang.String name,
                  int preferredWidth,
                  int preferredHeight,
                  java.util.Hashtable params)
Setup the container

Specified by:
setup in interface XContentHolder
Parameters:
name - set the container name
preferredWidth - the desired width
preferredHeight - the desired height
params - a table of extra properties

init

public void init()
          throws java.io.IOException
Initializes the storage, add listeners for mouse motion and keyboard handling.

Throws:
java.io.IOException

reset

public void reset()
Resets the internal storage and the coordinate system.


paint

public void paint(java.awt.Graphics g)
Renders the WMF image(s).

Overrides:
paint in class java.awt.Canvas

setContent

public void setContent(java.lang.String content)
Wraps addUrl to allow the url to be set as a string

Specified by:
setContent in interface XContentHolder
Parameters:
content - the URL string

addUrl

public void addUrl(java.net.URL newUrl)
Adds a url and reads the corresponding file.


getUrl

public java.net.URL getUrl(int idx)
Returns the current url.


addURL

public void addURL(java.lang.String _url)
Adds a url and reads the corresponding file.


getURL

public java.lang.String getURL(int idx)
Returns the current url.


getURL

public java.lang.String getURL()
Returns the first url if any.


getXPos

public int getXPos()
Gets the relative mouse position within bounds of the image taking account of zooming and panning.

Returns:
the x position in the range 0 to 1000

getYPos

public int getYPos()
Gets the relative mouse position within bounds of the image taking account of zooming and panning.

Returns:
the y position in the range 0 to 1000

setXPos

public void setXPos(int newXPos)

setYPos

public void setYPos(int newYPos)

drawCrossHairs

public void drawCrossHairs(java.awt.Graphics g,
                           int x,
                           int y)
This method must be called by derived classes at the end of their paint method.

Parameters:
x - the mouse x position.
y - the mouse y position.

pan

public void pan(int xPercent,
                int yPercent)
Pans the image by the specified percentages, withing the range -80 to 20. This ensures that a portion of the image is always visible

Parameters:
xPercent - the amount by which to pan as a percent of the image width.
yPercent - the amount by which to pan as a percent of the image height.

zoom

public void zoom(int percent)
Zooms in or out on the image within the range of 25 to 400 percent of the original image size.

Parameters:
percent - the new size of the image as a percentage of the original size.