Jeospace API

org.jeospace.ui.swt.widgets
Class LatitudeSpider

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.LatitudeSpider
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 LatitudeSpider
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 Latitude 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 may be manipulated by selecting the field text.

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
LatitudeSpider(org.eclipse.swt.widgets.Composite parent)
          Constructor.
LatitudeSpider(org.eclipse.swt.widgets.Composite parent, Latitude initial)
          Constructor.
LatitudeSpider(org.eclipse.swt.widgets.Composite parent, Latitude initial, AngleFormat formatter)
          Constructor.
 
Method Summary
 void addRollListener(Rollable listener)
          Add a listener for Rollable events
 org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
          Override Composite
 Latitude getLatitude()
          Return the Latitude 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 LatitudeSpider 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 removeRollListener(Rollable listener)
          Remove a listener for Rollable events
 void run()
          Routine to update the formatted angle text on the display thread.
 void setAngleFormat(AngleFormat formatter)
          Set the formatter.
 void setLatitude(Latitude newAngle)
          Set the Latitude object to be manipulated by the control.
 void setLayout(org.eclipse.swt.widgets.Layout layout)
          Override Composite, Ignored.
 void setMaximum(Angle maximum)
          Set the maximum value the Latitude object in this control may have.
 void setMinimum(Angle minimum)
          Set the minimum value the Latitude 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

LatitudeSpider

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

There will be no initial limits imposed on the value of the Latitude by this control. However, latitudes by default are limited to a range of +/- 90 degrees. 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.

LatitudeSpider

public LatitudeSpider(org.eclipse.swt.widgets.Composite parent,
                      Latitude initial)
Constructor.

There will be no initial limits imposed on the value of the Latitude by this control. However, latitudes by default are limited to a range of +/- 90 degrees. 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 Latitude object that this control will act on. If null, a new zero value Angle object will be created.

LatitudeSpider

public LatitudeSpider(org.eclipse.swt.widgets.Composite parent,
                      Latitude initial,
                      AngleFormat formatter)
Constructor.

There will be no initial limits imposed on the value of the Latitude by this control. However, latitudes by default are limited to a range of +/- 90 degrees.

Parameters:
parent - - The parent Composite object that this control will be added to.
initial - - The initial Latitude object that this control will act on. If null, a new zero value Latitude object will be created.
formatter - - The AngleFormat object that will format the Latitude 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 'spider' 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 'spider' 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

addRollListener

public void addRollListener(Rollable listener)
Add a listener for Rollable events

Parameters:
listener - the listener

removeRollListener

public void removeRollListener(Rollable listener)
Remove a listener for Rollable events

Parameters:
listener - the listener

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

setLatitude

public void setLatitude(Latitude newAngle)
Set the Latitude object to be manipulated by the control. If the argument is null, the control's display will be cleared and the spinner 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 Latitude object

getLatitude

public Latitude getLatitude()
Return the Latitude object that this control is acting on.

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

setMinimum

public void setMinimum(Angle minimum)
Set the minimum value the Latitude object in this control may have. Note that latitudes by default are limited to a range of +/- 90 degrees. Therefore, setting a minimum value beyond this range will have no effect.

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

getMinimum

public Angle getMinimum()
Return the minimum value. The returned value reflects the setting, not the default limits of a Latitude object.

Returns:
the minimum value

setMaximum

public void setMaximum(Angle maximum)
Set the maximum value the Latitude object in this control may have. Note that latitudes by default are limited to a range of +/-90 degrees. Therefore, setting a maximum value beyond this range will have no effect.

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. The returned value reflects the setting, not the default limits of a Latitude object.

Returns:
the maximum value

refresh

public void refresh()
Reset the formatted text field, without changing the spider parameters. Used when the Latitude 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 LatitudeSpider inside. Can be used for testing.

Parameters:
arg - the command line arguments

Jeospace API

Copyright © 2006 - jeospace.org