com.yospace.yae.yogi
Class YogiSpin

java.lang.Object
  |
  +--com.yospace.yae.yogi.YogiComponent
        |
        +--com.yospace.yae.yogi.YogiSpin
All Implemented Interfaces:
PropertyChangeListener

public class YogiSpin
extends YogiComponent
implements PropertyChangeListener

A component that represents a spin selection. Data is stored in an underlying YogiList, and is displayed one element at a time.


Field Summary
protected  YogiList list
           
static int PROPERTY_LIST
          Constant for the list property
static int PROPERTY_SELECTION
          Constant for the selection property
 
Fields inherited from class com.yospace.yae.yogi.YogiComponent
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, BORDER_DOTTED, BORDER_NONE, BORDER_PLAIN, BORDER_ROUNDED, BORDER_SOLID, COLOR_BACKGROUND, COLOR_BORDER, COLOR_FOREGROUND, FOCUS_DEFAULT, FOCUS_OFF, FOCUS_ON, PROPERTY_ALIGN, PROPERTY_BORDER_STYLE, PROPERTY_BOUNDS, PROPERTY_COLOR, PROPERTY_CONTEXT_ENABLED, PROPERTY_ENABLED, PROPERTY_FOCUS, PROPERTY_FOCUS_INDEX, PROPERTY_FOCUS_TRAVERSABLE, PROPERTY_FONT, PROPERTY_HOTKEY, PROPERTY_LOCATION, PROPERTY_OPAQUE, PROPERTY_SIZE, PROPERTY_VISIBLE, PROPERTY_X_INSET, PROPERTY_Y_INSET
 
Constructor Summary
YogiSpin()
          Default constructor which creates a default YogiList to store data items.
 
Method Summary
 void add(YogiComponent c)
          Overrides the YogiComponent.add(YogiComponent) method.
 void addItem(java.lang.Object item)
          Convenience method for adding items to the underlying YogiList of data items.
 Rectangle getFocusBounds()
          Finds the bounds of the focussed area by delegating to the underlying YogiList.
 java.lang.Object getItem(int index)
          Convenience method for getting items from the underlying YogiList of data items.
 YogiList getList()
           
 int getSelectedIndex()
           
 void propertyChanged(java.lang.Object source, int propertyCode)
          Provided to implement the PropertyChangeListener interface.
 boolean setFocus(int y)
          Convenience method allowing the spin's list to be focussed.
 void setList(YogiList list)
          Sets the YogiList used to store the data for the YogiSpin.
 void setSelectedIndex(int index)
           
 
Methods inherited from class com.yospace.yae.yogi.YogiComponent
_debugPrintComponents, addPropertyChangeListener, bringForwards, bringInFrontOf, bringToFront, contains, containsComponent, ensureVisible, ensureVisible, findComponentAt, findCurrentFocus, findFirstFocus, findFocusDomainRoot, findFocusDomainRootImpl, findHotkeyComponent, findNextFocus, fireActionPerformedEvent, firePropertyChangeEvent, getAlign, getBorderStyle, getBounds, getColor, getColors, getComponent, getComponent, getComponentCount, getComponentIndex, getComponents, getFocusIndex, getFont, getGlobalLocation, getHeight, getHotkey, getId, getParent, getParent, getTreeLock, getUI, getWidth, getX, getXInset, getY, getYInset, hasFocus, isActive, isContextEnabled, isEnabled, isFocusDomainRoot, isFocusTraversable, isOpaque, isVisible, keyPressed, keyReleased, keyRepeated, paint, paintBackground, paintBorder, paintForeground, pointerDragged, pointerPressed, pointerReleased, remove, remove, removeAll, removePropertyChangeListener, repaint, repaint, repaintAfterRebounding, requestFocus, requestFocus, sendBackwards, sendBehind, sendToBack, setActionListener, setActive, setAlign, setBorderStyle, setBounds, setColor, setColors, setContextEnabled, setDefaultColor, setEnabled, setFocusDomainRoot, setFocusIndex, setFocusTraversable, setFont, setHotkey, setId, setLocation, setNoFocus, setOpaque, setProperty, setSize, setUI, setVisible, setXInset, setYInset, updateUI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_LIST

public static final int PROPERTY_LIST
Constant for the list property

PROPERTY_SELECTION

public static final int PROPERTY_SELECTION
Constant for the selection property

list

protected YogiList list
Constructor Detail

YogiSpin

public YogiSpin()
Default constructor which creates a default YogiList to store data items.
Method Detail

getList

public YogiList getList()

getSelectedIndex

public int getSelectedIndex()

addItem

public void addItem(java.lang.Object item)
Convenience method for adding items to the underlying YogiList of data items.
Parameters:
item - Object to add to the spin.

getItem

public java.lang.Object getItem(int index)
Convenience method for getting items from the underlying YogiList of data items.
Parameters:
index - the index of the required object.
Returns:
Object The object at the specified index. Returns null if the list is null or if the list contains nothing at this index.

setList

public void setList(YogiList list)
Sets the YogiList used to store the data for the YogiSpin.
Parameters:
list - the new list that will store the data for this YogiSpin.

setSelectedIndex

public void setSelectedIndex(int index)

add

public void add(YogiComponent c)
Overrides the YogiComponent.add(YogiComponent) method. If a YogiList is added, this will be used to store the data for the YogiSpin. Otherwise, the object will be added to the list of data for the YogiSpin.
Overrides:
add in class YogiComponent
Following copied from class: com.yospace.yae.yogi.YogiComponent
Parameters:
comp - the component to add.
Throws:
IllegalStateException - if the component comp already has a parent.

propertyChanged

public void propertyChanged(java.lang.Object source,
                            int propertyCode)
Provided to implement the PropertyChangeListener interface.
Specified by:
propertyChanged in interface PropertyChangeListener
Parameters:
source - the event source.
propertyCode - the code of the property being changed.

setFocus

public boolean setFocus(int y)
Convenience method allowing the spin's list to be focussed.
Parameters:
y - the focus y-index.
Returns:
True if the focus has changed, False if the specified indexes were already those with focus.

getFocusBounds

public Rectangle getFocusBounds()
Finds the bounds of the focussed area by delegating to the underlying YogiList.
Overrides:
getFocusBounds in class YogiComponent
Returns:
a Rectangle representing the bounds enclosed by the currently focused component.

Copyright 2002 Yospace Holdings Ltd. All Rights Reserved.