Jeospace API

org.jeospace.ui.swt.widgets
Class AngleSpider

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.eclipse.swt.widgets.Composite
                  extended byorg.jeospace.ui.swt.widgets.JeospaceComp
                      extended byorg.jeospace.ui.swt.widgets.AngleSpider
All Implemented Interfaces:
org.eclipse.swt.events.DisposeListener, org.eclipse.swt.graphics.Drawable, java.util.EventListener, org.eclipse.swt.events.MouseListener, java.lang.Runnable, org.eclipse.swt.events.SelectionListener, org.eclipse.swt.internal.SWTEventListener

public class AngleSpider
extends JeospaceComp
implements org.eclipse.swt.events.DisposeListener, org.eclipse.swt.events.MouseListener, org.eclipse.swt.events.SelectionListener, java.lang.Runnable

A compound widget for manipulating Angle values. A spider provides a combination of conventional spinner and slider widget functionality. The control can continuously increase (or decrease) the value of the angle object (like a spinner) and by dragging the slider control, the amount of the increment (or decrement) value can be dynamically changed.

The style of the angle displayed is determined by the AngleFormat object that the control is instantiated with. The angle object may be a multi-field object depending on the formatting specified. Individual fields are manipulated by selecting the field text then using the widget's controls.

Version:
$Revision: 1.2 $
Author:
Rex Melton

Field Summary
 
Fields inherited from class org.jeospace.ui.swt.widgets.JeospaceComp
listenerArray, NULL_LISTENER_ARRAY
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
AngleSpider(org.eclipse.swt.widgets.Composite parent)
          Constructor.
AngleSpider(org.eclipse.swt.widgets.Composite parent, Angle initial)
          Constructor.
AngleSpider(org.eclipse.swt.widgets.Composite parent, Angle initial, AngleFormat formatter)
          Constructor.
 
Method Summary
 org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
          Override Composite
 Angle getAngle()
          Return the Angle object that this control is acting on.
 Angle getMaximum()
          Return the maximum value.
 Angle getMinimum()
          Return the minimum value.
static void main(java.lang.String[] arg)
          Create a Shell with an AngleSpider inside.
 void mouseDoubleClick(org.eclipse.swt.events.MouseEvent me)
          Sent when a mouse button is double clicked.
 void mouseDown(org.eclipse.swt.events.MouseEvent me)
          Sent when a mouse button is pressed.
 void mouseUp(org.eclipse.swt.events.MouseEvent me)
          Sent when a mouse button is released.
 void refresh()
          Reset the formatted text field, without changing the spider parameters.
 void run()
          Routine to update the formatted angle text on the display thread.
 void setAngle(Angle newAngle)
          Set the Angle object to be manipulated by the control.
 void setAngleFormat(AngleFormat formatter)
          Set the formatter.
 void setLayout(org.eclipse.swt.widgets.Layout layout)
          Override Composite, Ignored.
 void setMaximum(Angle maximum)
          Set the maximum value the Angle object in this control may have.
 void setMinimum(Angle minimum)
          Set the minimum value the Angle object in this control may have.
 void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent se)
          Ignored.
 void widgetDisposed(org.eclipse.swt.events.DisposeEvent de)
          Clean up our listeners and timer threads
 void widgetSelected(org.eclipse.swt.events.SelectionEvent se)
          Handler for selection events.
 
Methods inherited from class org.jeospace.ui.swt.widgets.JeospaceComp
addValueChangeListener, fireValueChangeEvent, removeValueChangeListener
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AngleSpider

public AngleSpider(org.eclipse.swt.widgets.Composite parent)
Constructor.

An initial Angle object will be created with a value of zero. There will be no limits imposed on the value of the Angle. An AngleFormat object with the style AngleFormatStyle.ANGLE will be created as the formatter.

Parameters:
parent - - The parent Composite object that this control will be added to.

AngleSpider

public AngleSpider(org.eclipse.swt.widgets.Composite parent,
                   Angle initial)
Constructor.

There will be no limits imposed on the value of the Angle. An AngleFormat object with the style AngleFormatStyle.ANGLE will be created as the formatter.

Parameters:
parent - The parent Composite object that this control will be added to.
initial - The initial Angle object that this control will act on. If null, a new zero value Angle object will be created.

AngleSpider

public AngleSpider(org.eclipse.swt.widgets.Composite parent,
                   Angle initial,
                   AngleFormat formatter)
Constructor.

There will be no limits imposed on the value of the Angle.

Parameters:
parent - The parent Composite object that this control will be added to.
initial - The initial Angle object that this control will act on. If null, a new zero value Angle object will be created.
formatter - The AngleFormat object that will format the Angle object for display. If null, an AngleFormat object with the style AngleFormatStyle.ANGLE will be created.
Method Detail

setLayout

public void setLayout(org.eclipse.swt.widgets.Layout layout)
Override Composite, Ignored.


computeSize

public org.eclipse.swt.graphics.Point computeSize(int wHint,
                                                  int hHint,
                                                  boolean changed)
Override Composite


widgetDisposed

public void widgetDisposed(org.eclipse.swt.events.DisposeEvent de)
Clean up our listeners and timer threads

Specified by:
widgetDisposed in interface org.eclipse.swt.events.DisposeListener

widgetSelected

public void widgetSelected(org.eclipse.swt.events.SelectionEvent se)
Handler for selection events. This gets the scale values.

Specified by:
widgetSelected in interface org.eclipse.swt.events.SelectionListener
Parameters:
se - the event descriptor generated by the selected widget

widgetDefaultSelected

public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent se)
Ignored.

Specified by:
widgetDefaultSelected in interface org.eclipse.swt.events.SelectionListener

mouseDoubleClick

public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent me)
Sent when a mouse button is double clicked. Ignored.

Specified by:
mouseDoubleClick in interface org.eclipse.swt.events.MouseListener

mouseDown

public void mouseDown(org.eclipse.swt.events.MouseEvent me)
Sent when a mouse button is pressed. Used to implement 'spinner' functionality.

Specified by:
mouseDown in interface org.eclipse.swt.events.MouseListener
Parameters:
me - the event descriptor

mouseUp

public void mouseUp(org.eclipse.swt.events.MouseEvent me)
Sent when a mouse button is released. Used to implement 'spinner' functionality.

Specified by:
mouseUp in interface org.eclipse.swt.events.MouseListener
Parameters:
me - the event descriptor

run

public void run()
Routine to update the formatted angle text on the display thread.

Specified by:
run in interface java.lang.Runnable

setAngleFormat

public void setAngleFormat(AngleFormat formatter)
Set the formatter. If a value of null is supplied as the argument, an AngleFormat object with the style AngleFormatStyle.ANGLE will be used.

Parameters:
formatter - The AngleFormat object

setAngle

public void setAngle(Angle newAngle)
Set the Angle object to be manipulated by the control. If the argument is null, the control's display will be cleared and the spider functionality disabled. If the argument is non-null and the new value is less than the minimum or greater than the maximum, then the Angle object will be set to the minimum or maximum value (respectively).

Parameters:
newAngle - The new angle value

getAngle

public Angle getAngle()
Return the Angle object that this control is acting on.

Returns:
the Angle object. null will be returned if the Angle has been set to null.

setMinimum

public void setMinimum(Angle minimum)
Set the minimum value the Angle object in this control may have.

Parameters:
minimum - An Angle object containing the minimum value for the Angle in this control. A value of null will set the minimum value for the control to it's greatest negative value.

getMinimum

public Angle getMinimum()
Return the minimum value.

Returns:
the minimum value

setMaximum

public void setMaximum(Angle maximum)
Set the maximum value the Angle object in this control may have.

Parameters:
maximum - An Angle object containing the maximum value for the Angle in this control. A value of null will set the maximum value for the control to it's greatest positive value.

getMaximum

public Angle getMaximum()
Return the maximum value.

Returns:
the maximum value

refresh

public void refresh()
Reset the formatted text field, without changing the spider parameters. Used when the Angle object has been modified external to this widget and the displayed text should be updated.


main

public static void main(java.lang.String[] arg)
Create a Shell with an AngleSpider inside. Can be used for testing.

Parameters:
arg - - Command line arguments, none necessary.

Jeospace API

Copyright © 2006 - jeospace.org