edu.washington.cs.supple.wlib.java2
Class AbstractImageBasedWidget

java.lang.Object
  extended byedu.washington.cs.supple.render.AbstractWidget
      extended byedu.washington.cs.supple.render.SimpleWidget
          extended byedu.washington.cs.supple.wlib.java2.AbstractImageBasedWidget
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, java.beans.PropertyChangeListener, SwingWidget, UnwrappedWidget, Widget
Direct Known Subclasses:
ImageWidget, SimpleMapWidget

public abstract class AbstractImageBasedWidget
extends SimpleWidget
implements SwingWidget

Author:
kgajos

Field Summary
protected  java.awt.Image curImage
           
protected  javax.swing.ImageIcon curImageIcon
           
protected  int desiredHeight
           
protected  int desiredWidth
           
protected  double downsample
           
static java.lang.String DOWNSAMPLE_PROPERTY
           
protected  int height
           
protected  java.lang.String IMAGE_NOT_AVAILABLE
           
protected  int imageHeight
           
protected  javax.swing.JLabel imageLabel
           
protected  int imageWidth
           
protected  int width
           
 
Fields inherited from class edu.washington.cs.supple.render.AbstractWidget
bag, cost, engaged, object, parent, stateVar, textLabel, type, widgetDescriptor, wrapper
 
Fields inherited from interface edu.washington.cs.supple.render.Widget
MAX_HINT, NO_BORDER, NO_NAME, TOP_LEVEL_WIDGET
 
Constructor Summary
AbstractImageBasedWidget(UiObject object, int width, int height, int desiredWith, int desiredHeight)
           
AbstractImageBasedWidget(UiObject object, WidgetDescriptor wd, WidgetFactory f)
           
 
Method Summary
protected  javax.swing.JComponent createImageLabel(int hints)
           
protected  WidgetDescriptor generateWidgetDescriptor()
          Subclasses can override this method if their widget descriptor include extra information
 double getDownsample()
          returns the factor by which this widget will scale down images from their desired size (as specified in the corresponding ImageType)
protected  void setCurImage(java.awt.Image i)
           
protected  void setCurImage(javax.swing.ImageIcon newIcon)
           
 java.lang.String toString()
           
protected  void updateImage(java.lang.Object o)
          sets the internal var representing the current image to be displayed and updates the widgets
 
Methods inherited from class edu.washington.cs.supple.render.SimpleWidget
childIterator, getEffortEstimate, hasChildren
 
Methods inherited from class edu.washington.cs.supple.render.AbstractWidget
anotherPropertyChanged, clone, clone, disengage, dismissCurrentView, displayDynamic, engage, equals, executeAction, getBag, getConcreteWidget, getConcreteWidget, getCost, getParent, getPath, getSize, getSizeCache, getTextLabel, getType, getUiObject, getWidgetDescriptor, getWidgetProperties, indexChanged, isEngaged, isEquivalent, legalValuesChanged, likelyValuesChanged, propertyChange, rendersObject, reportActionExecutionEvent, reportValueChangedEvent, setBag, setCost, setEnabled, setParent, setSizeCache, setValue, setWrapper, unwrapWidget, valueChanged
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.washington.cs.supple.wlib.java2.SwingWidget
getSwingComponent
 
Methods inherited from interface edu.washington.cs.supple.render.Widget
childIterator, clone, clone, disengage, engage, getBag, getConcreteWidget, getConcreteWidget, getCost, getEffortEstimate, getPath, getSize, getSizeCache, getTextLabel, getType, getUiObject, getWidgetDescriptor, getWidgetProperties, hasChildren, isEngaged, isEquivalent, setBag, setCost, setEnabled, setParent, setSizeCache, setWrapper, unwrapWidget
 

Field Detail

IMAGE_NOT_AVAILABLE

protected java.lang.String IMAGE_NOT_AVAILABLE

DOWNSAMPLE_PROPERTY

public static final java.lang.String DOWNSAMPLE_PROPERTY
See Also:
Constant Field Values

curImage

protected java.awt.Image curImage

curImageIcon

protected javax.swing.ImageIcon curImageIcon

imageLabel

protected javax.swing.JLabel imageLabel

width

protected int width

height

protected int height

desiredWidth

protected int desiredWidth

desiredHeight

protected int desiredHeight

imageWidth

protected int imageWidth

imageHeight

protected int imageHeight

downsample

protected double downsample
Constructor Detail

AbstractImageBasedWidget

public AbstractImageBasedWidget(UiObject object,
                                int width,
                                int height,
                                int desiredWith,
                                int desiredHeight)
Parameters:
object -

AbstractImageBasedWidget

public AbstractImageBasedWidget(UiObject object,
                                WidgetDescriptor wd,
                                WidgetFactory f)
Method Detail

getDownsample

public double getDownsample()
returns the factor by which this widget will scale down images from their desired size (as specified in the corresponding ImageType)

Returns:

generateWidgetDescriptor

protected WidgetDescriptor generateWidgetDescriptor()
Description copied from class: AbstractWidget
Subclasses can override this method if their widget descriptor include extra information

Overrides:
generateWidgetDescriptor in class AbstractWidget
Returns:
a new widget descriptor for this widge

createImageLabel

protected javax.swing.JComponent createImageLabel(int hints)

setCurImage

protected void setCurImage(java.awt.Image i)

setCurImage

protected void setCurImage(javax.swing.ImageIcon newIcon)

updateImage

protected void updateImage(java.lang.Object o)
sets the internal var representing the current image to be displayed and updates the widgets

Parameters:
o - the new image

toString

public java.lang.String toString()
Overrides:
toString in class AbstractWidget