org.sourceforge.espro.elicitation
Class BarScale

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by org.sourceforge.espro.elicitation.ElicitationMethod
                  extended by org.sourceforge.espro.elicitation.PointMethod
                      extended by org.sourceforge.espro.elicitation.BarScale
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, ModelInterface

public class BarScale
extends PointMethod

Title: BarScale

Description: This method is represented by a vertical scale without any labels and a slider pointing to the scale. The BarScale has an inner area (colored orange) which indicates the estimated probability. In other words, the height of this inner area corresponds to the estimated probability and changes when the slider is moved. For estimating a probability, the user can click at the desired position on the scale with the mouse or drag the slider with the mouse on the desired scale position. Changing the position of the slider also changes the height of the inner area. If the user thinks the probability to be elicited is 1, the inner rectangle has the same height as the baseline. If the user thinks the probability to be elicited is 0, the height of the inner rectangle is 0 and therefor you do not see the inner area of the scale. All other estimated probabilities are somewhere between these two extremes.

Copyright: Copyright (c) 2006

Company:

Version:
2.0 Martin Kaffanke took the original version Daniela Wurhofer and rewrote it to make it scalable to the actual space the widget.
Author:
Daniela Wurhofer, Martin Kaffanke
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
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
 
Fields inherited from class org.sourceforge.espro.elicitation.PointMethod
value
 
Fields inherited from class org.sourceforge.espro.elicitation.ElicitationMethod
frozen, g2, pcs
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
BarScale()
          default-constructor
BarScale(java.lang.String name, java.lang.String category)
          Creates a new BarScale object.
 
Method Summary
protected  void addSelfListeners()
          DOCUMENT ME!
 void drawRectangles()
          Method for drawing the baseline of the scale and an inner rectangle of the scale.
 void drawSlider()
          Method for drawing a slider and an invisible slider.
 java.awt.Color getBackgroundColor()
          DOCUMENT ME!
 java.awt.Color getForegroundColor()
          DOCUMENT ME!
 double getSliderYPos()
          Method for returning the actual y-coordinate of the slider's peak.
protected  void initialize()
          DOCUMENT ME!
 boolean isShowSlider()
          DOCUMENT ME!
 void moveSlider(int x, int y)
          Moves slider to the actual mouse-position by dragging the mouse.
 void moveSliderByClick(int x, int y)
          Moves slider to the actual mouse-position by clicking in the baseline of the scale.
 void paintComponent(java.awt.Graphics g)
          Overridden Method for painting the scale on the panel.
 void setBackgroundColor(java.awt.Color backgroundColor)
          DOCUMENT ME!
 void setForegroundColor(java.awt.Color foregroundColor)
          DOCUMENT ME!
 void setShowSlider(boolean showSlider)
          DOCUMENT ME!
 
Methods inherited from class org.sourceforge.espro.elicitation.PointMethod
getValue, setValue
 
Methods inherited from class org.sourceforge.espro.elicitation.ElicitationMethod
addPropertyChangeListener, addPropertyChangeListener, getCategory, getName, isEdit, isFrozen, removePropertyChangeListener, removePropertyChangeListener, setEdit, setFrozen, smothed
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BarScale

public BarScale()
default-constructor


BarScale

public BarScale(java.lang.String name,
                java.lang.String category)
Creates a new BarScale object.

Parameters:
name - DOCUMENT ME!
category - DOCUMENT ME!
Method Detail

drawRectangles

public void drawRectangles()
Method for drawing the baseline of the scale and an inner rectangle of the scale. The baseline is represented by a rectangle and represents the scale-area on which can be clicked with the mouse. The height of the inner rectangle corresponds to the estimated probability and therefor changes when the slider is moved. If the user thinks the probability to be elicited is 1, the inner rectangle has the same height as the baseline. If the user thinks the probability to be elicited is 0, the height of the inner rectangle is 0 and therefor you do not see the inner rectangle. All other estimated probabilities are somewhere between these two extremes.


drawSlider

public void drawSlider()
Method for drawing a slider and an invisible slider. The sliders are both represented as polygons with a peak. The invisible slider overlaps the slider and represents the slide-area which can be dragged with the mouse.


getBackgroundColor

public java.awt.Color getBackgroundColor()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getForegroundColor

public java.awt.Color getForegroundColor()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getSliderYPos

public double getSliderYPos()
Method for returning the actual y-coordinate of the slider's peak.

Returns:
y-coordinate of slider

isShowSlider

public boolean isShowSlider()
DOCUMENT ME!

Returns:
DOCUMENT ME!

moveSlider

public void moveSlider(int x,
                       int y)
Moves slider to the actual mouse-position by dragging the mouse.

Parameters:
x - x-coordinate of mouse
y - y-coordinate of mouse

moveSliderByClick

public void moveSliderByClick(int x,
                              int y)
Moves slider to the actual mouse-position by clicking in the baseline of the scale.

Parameters:
x - x-coordinate of mouse
y - y-coordinate of mouse

paintComponent

public void paintComponent(java.awt.Graphics g)
Overridden Method for painting the scale on the panel. Paints the baseline of the scale (rectangle) without any labels and a slider.

Overrides:
paintComponent in class ElicitationMethod
Parameters:
g - Graphics2D-object

setBackgroundColor

public void setBackgroundColor(java.awt.Color backgroundColor)
DOCUMENT ME!

Parameters:
backgroundColor - DOCUMENT ME!

setForegroundColor

public void setForegroundColor(java.awt.Color foregroundColor)
DOCUMENT ME!

Parameters:
foregroundColor - DOCUMENT ME!

setShowSlider

public void setShowSlider(boolean showSlider)
DOCUMENT ME!

Parameters:
showSlider - DOCUMENT ME!

addSelfListeners

protected void addSelfListeners()
DOCUMENT ME!

Overrides:
addSelfListeners in class ElicitationMethod

initialize

protected void initialize()
DOCUMENT ME!

Specified by:
initialize in class ElicitationMethod