org.simbrain.world.dataworld
Class DataWorld

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.simbrain.world.World
                      extended by org.simbrain.world.dataworld.DataWorld
All Implemented Interfaces:
KeyListener, MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, Agent

public class DataWorld
extends World
implements MouseListener, Agent, KeyListener

DataWorld creates a table and then adds it to the viewport.

Author:
rbartley
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static boolean editButtons
          Edit buttons boolean.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
DataWorld(DataWorldFrame ws)
          Creates a new instance of the data world.
 
Method Summary
 JPopupMenu buildPopupMenu()
           
 void completedInputRound()
          Use when a full set of stimuli has been gathered, to initiate post-stimulus gathering activties.
 void displayRandomizeDialog()
          Displays the randomize dialog.
 ArrayList getAgentList()
          Dataworlds contain one agent, themselves.
 boolean getColumnIteration()
           
 int getCurrentRow()
           
 int getLowerBound()
           
 TableModel getModel()
           
 JMenu getMotorCommandMenu(ActionListener al)
          Unused stub; data worlds don't receive commands.
 String getName()
          Return the name of this agent.
 DataWorldFrame getParentFrame()
           
 World getParentWorld()
          Dataworlds are agents, hence this returns itself.
 Point getSelectedPoint()
           
 JMenu getSensorIdMenu(ActionListener al)
          Returns a menu with on id, "Column X" for each column.
 double getStimulus(String[] sensorId)
          Returns the value in the given column of the table uses the current row.
 JTable getTable()
           
 String getType()
          Return the type of this world.
 int getUpperBound()
           
 String getWorldName()
          Return the name of this world.
 void incrementCurrentRow()
          Increment current row by 1.
 void incrementUsingLastColumn()
          Increment a number of times equal to the last column.
 boolean isIterationMode()
           
 void keyPressed(KeyEvent arg0)
          Responds to key pressed events.
 void keyReleased(KeyEvent arg0)
          Responds to key released events.
 void keyTyped(KeyEvent arg0)
          Responds to key typed events.
 void mouseClicked(MouseEvent e)
          Responds to mouse clicked event.
 void mouseEntered(MouseEvent e)
          Responds to mouse entered events.
 void mouseExited(MouseEvent e)
          Responds to mouse exited event.
 void mousePressed(MouseEvent e)
          Responds to mouse pressed event.
 void mouseReleased(MouseEvent e)
          Responds to mouse released event.
 Double randomInteger()
           
 void randomize()
          Randomizes the values.
 void resetModel(String[][] data)
          Resets the model.
 void setColumnIteration(boolean columnIteration)
           
 void setCurrentRow(int currentRow)
          Sets the current row.
 void setIterationMode(boolean iterationMode)
           
 void setLowerBound(int lowerBound)
          Sets the lower bound value.
 void setModel(TableModel model)
           
 void setMotorCommand(String[] commandList, double value)
          Unused stub; data worlds don't receive commands.
 void setParentFrame(DataWorldFrame parentFrame)
           
 void setSelectedPoint(Point selectedPoint)
          Sets the selected point.
 void setTable(JTable table)
           
 void setUpperBound(int upperBound)
          Sets the upper bound value.
 void setWorldName(String name)
           
 
Methods inherited from class org.simbrain.world.World
addWorldListener, fireWorldChanged, removeWorldListener
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, 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, removePropertyChangeListener, removePropertyChangeListener, 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
 

Field Detail

editButtons

public static boolean editButtons
Edit buttons boolean.

Constructor Detail

DataWorld

public DataWorld(DataWorldFrame ws)
Creates a new instance of the data world.

Parameters:
ws - World frame to create a new data world within
Method Detail

resetModel

public void resetModel(String[][] data)
Resets the model.

Parameters:
data - Data to reset

mouseClicked

public void mouseClicked(MouseEvent e)
Responds to mouse clicked event.

Specified by:
mouseClicked in interface MouseListener
Parameters:
e - Mouse event

mousePressed

public void mousePressed(MouseEvent e)
Responds to mouse pressed event.

Specified by:
mousePressed in interface MouseListener
Parameters:
e - Mouse event

mouseReleased

public void mouseReleased(MouseEvent e)
Responds to mouse released event.

Specified by:
mouseReleased in interface MouseListener
Parameters:
e - Mouse event

mouseEntered

public void mouseEntered(MouseEvent e)
Responds to mouse entered events.

Specified by:
mouseEntered in interface MouseListener
Parameters:
e - Mouse event

mouseExited

public void mouseExited(MouseEvent e)
Responds to mouse exited event.

Specified by:
mouseExited in interface MouseListener
Parameters:
e - Mouse event

buildPopupMenu

public JPopupMenu buildPopupMenu()
Returns:
The pop up menu to be built.

getType

public String getType()
Description copied from class: World
Return the type of this world.

Specified by:
getType in class World
Returns:
World type.

getName

public String getName()
Description copied from interface: Agent
Return the name of this agent.

Specified by:
getName in interface Agent
Overrides:
getName in class Component
Returns:
Name of data world.

getParentFrame

public DataWorldFrame getParentFrame()
Returns:
Returns the parentFrame.

setParentFrame

public void setParentFrame(DataWorldFrame parentFrame)
Parameters:
parentFrame - The parentFrame to set.

getTable

public JTable getTable()
Returns:
Returns the table.

setTable

public void setTable(JTable table)
Parameters:
table - The table to set.

getAgentList

public ArrayList getAgentList()
Dataworlds contain one agent, themselves.

Specified by:
getAgentList in class World
Returns:
Returns the agentList.

getParentWorld

public World getParentWorld()
Dataworlds are agents, hence this returns itself.

Specified by:
getParentWorld in interface Agent
Returns:
Returns the world this agent is associated with, itself

randomize

public void randomize()
Randomizes the values.


randomInteger

public Double randomInteger()
Returns:
A random integer.

displayRandomizeDialog

public void displayRandomizeDialog()
Displays the randomize dialog.


setMotorCommand

public void setMotorCommand(String[] commandList,
                            double value)
Unused stub; data worlds don't receive commands.

Specified by:
setMotorCommand in interface Agent
Parameters:
commandList - List of commands
value - Value

getMotorCommandMenu

public JMenu getMotorCommandMenu(ActionListener al)
Unused stub; data worlds don't receive commands.

Specified by:
getMotorCommandMenu in class World
Parameters:
al - Action listener
Returns:
a menu of motor command for this world

getStimulus

public double getStimulus(String[] sensorId)
Returns the value in the given column of the table uses the current row.

Specified by:
getStimulus in interface Agent
Parameters:
sensorId - Sensor identification
Returns:
the stimulus for this agent

incrementUsingLastColumn

public void incrementUsingLastColumn()
Increment a number of times equal to the last column.


incrementCurrentRow

public void incrementCurrentRow()
Increment current row by 1.


getSensorIdMenu

public JMenu getSensorIdMenu(ActionListener al)
Returns a menu with on id, "Column X" for each column.

Specified by:
getSensorIdMenu in class World
Parameters:
al - Action listener
Returns:
a menu of sensor ids for this world

getWorldName

public String getWorldName()
Description copied from class: World
Return the name of this world.

Specified by:
getWorldName in class World
Returns:
Returns the name.

setWorldName

public void setWorldName(String name)
Parameters:
name - The name to set.

getModel

public TableModel getModel()
Returns:
Returns the model.

setModel

public void setModel(TableModel model)
Parameters:
model - The model to set.

getLowerBound

public int getLowerBound()
Returns:
The lower bound.

setLowerBound

public void setLowerBound(int lowerBound)
Sets the lower bound value.

Parameters:
lowerBound - Value to set

getUpperBound

public int getUpperBound()
Returns:
The upper bound value.

setUpperBound

public void setUpperBound(int upperBound)
Sets the upper bound value.

Parameters:
upperBound - Value to set

getCurrentRow

public int getCurrentRow()
Returns:
The current row value.

setCurrentRow

public void setCurrentRow(int currentRow)
Sets the current row.

Parameters:
currentRow - Value to set

getSelectedPoint

public Point getSelectedPoint()
Returns:
The selected point.

setSelectedPoint

public void setSelectedPoint(Point selectedPoint)
Sets the selected point.

Parameters:
selectedPoint - Valuet to set

keyTyped

public void keyTyped(KeyEvent arg0)
Responds to key typed events.

Specified by:
keyTyped in interface KeyListener
Parameters:
arg0 - Key event

keyPressed

public void keyPressed(KeyEvent arg0)
Responds to key pressed events.

Specified by:
keyPressed in interface KeyListener
Parameters:
arg0 - Key event

keyReleased

public void keyReleased(KeyEvent arg0)
Responds to key released events.

Specified by:
keyReleased in interface KeyListener
Parameters:
arg0 - Key event

completedInputRound

public void completedInputRound()
Description copied from interface: Agent
Use when a full set of stimuli has been gathered, to initiate post-stimulus gathering activties.

Specified by:
completedInputRound in interface Agent
See Also:
Agent

isIterationMode

public boolean isIterationMode()
Returns:
Returns the iterationMode.

setIterationMode

public void setIterationMode(boolean iterationMode)
Parameters:
iterationMode - The iterationMode to set.

getColumnIteration

public boolean getColumnIteration()
Returns:
Returns the columnIteration.

setColumnIteration

public void setColumnIteration(boolean columnIteration)
Parameters:
columnIteration - The columnIteration to set.