org.simbrain.network
Class NetworkPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by edu.umd.cs.piccolo.PCanvas
                  extended by org.simbrain.network.NetworkPanel
All Implemented Interfaces:
PComponent, ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, NetworkListener

public final class NetworkPanel
extends PCanvas
implements NetworkListener, ActionListener

Network panel.

See Also:
Serialized Form

Nested Class Summary
 
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
 
Fields inherited from class edu.umd.cs.piccolo.PCanvas
CURRENT_ZCANVAS, INTERATING_CHANGED_NOTIFICATION
 
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
NetworkPanel()
          Create a new network panel.
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void addGauge()
          Add a gauge which by default gauges all neurons of current network.
 void addNeuron()
          Add a new neural network.
 void addSelectionListener(NetworkSelectionListener l)
          Add the specified network selection listener.
 void alignHorizontal()
          Aligns neurons horizontally.
 void alignVertical()
          Aligns neurons vertically.
 void centerCamera()
          Centers the neural network in the middle of the PCanvas.
 void clampChanged()
          Update clamp toolbar buttons and menu items.
 void clearSelection()
          Clear the selection.
 void closeNetwork()
          Close model network.
 void copy()
          Copy to the clipboard.
 void couplingChanged(NetworkEvent e)
          Notify this listener of a CouplingChanged event.
 JMenu createAlignMenu()
          Return the align sub menu.
protected  JToolBar createClampToolBar()
          Create the clamp tool bar.
(package private)  JMenu createEditMenu()
          Create and return a new Edit menu for this network panel.
protected  JToolBar createEditToolBar()
          Create the edit tool bar.
(package private)  JMenu createFileMenu()
          Create and return a new File menu for this network panel.
(package private)  JMenu createGaugeMenu()
          Create and return a new Gauge menu for this network panel.
(package private)  JMenu createHelpMenu()
          Create and return a new Help menu for this network panel.
(package private)  JMenu createInsertMenu()
          Create and return a new Insert menu for this network panel.
protected  JToolBar createMainToolBar()
          Create the main tool bar.
 JMenu createSelectionMenu()
          Create a selection JMenu.
 JMenu createSpacingMenu()
          Return the space sub menu.
(package private)  JMenu createViewMenu()
          Create and return a new View menu for this network panel.
 void cut()
          Cut to the clipboard.
 void decrementSelectedObjects()
          Decreases neuron and synapse activation levels.
 void deleteSelectedObjects()
          Delete selected itemes.
 NeuronNode findNeuronNode(Neuron n)
          Find the NeuronNode corresponding to a given model Neuron.
 SubnetworkNode findSubnetworkNode(Network net)
          Find the SubnetworkNode corresponding to a given model subnetwork.
 SynapseNode findSynapseNode(Synapse s)
          Find the SynapseNode corresponding to a given model Synapse.
 boolean getAutoZoomMode()
           
 Color getBackgroundColor()
          Get the background color.
 JToolBar getClampToolBar()
           
(package private)  JPopupMenu getContextMenu()
          Return the context menu for this network panel.
 float getCoolColor()
           
 Collection getCoupledNodes()
          Returns model network elements corresponding to selected screen elements.
 String getCurrentDirectory()
          Returns a string representation of the current directory.
 EditMode getEditMode()
          Return the current edit mode for this network panel.
 JToolBar getEditToolBar()
           
 Color getExcitatoryColor()
           
 float getHotColor()
           
 Color getInhibitoryColor()
           
 boolean getInOutMode()
           
 Point2D getLastClickedPosition()
           
 NeuronNode getLastSelectedNeuron()
           
 Color getLineColor()
           
 JToolBar getMainToolBar()
           
 int getMaxDiameter()
           
 int getMinDiameter()
           
 StandardNetwork getNetwork()
           
 NetworkFrame getNetworkFrame()
           
 Collection getNeuronNodes()
          Return a collection of all neuron nodes.
 ArrayList getNodeList()
          Used by Castor.
 double getNudgeAmount()
           
 double getNumberOfPastes()
           
 Collection getPersistentNodes()
          Return a collection of all persistent nodes, that is all neuron nodes and all synapse nodes.
 Collection getSelectedModelElements()
          Returns model network elements corresponding to selected screen elements.
 Collection getSelectedModelNeurons()
          Returns selected Neurons.
 ArrayList getSelectedNeurons()
          Returns selected Neurons.
 ArrayList getSelectedSynapses()
          Returns selected Synapses.
 Collection getSelection()
          Return the selection as a collection of selected elements.
 boolean getShowSubnetOutline()
           
 boolean getShowTime()
           
 Color getSignalColor()
           
 Color getSpikingColor()
           
 Collection getSubnetNodes()
          Return a collection of all subnet nodes.
 Collection getSynapseNodes()
          Return a collection of all synapse nodes.
 boolean getUsingTabs()
           
 Workspace getWorkspace()
          Returns a reference to the workspace.
 Color getZeroWeightColor()
           
 boolean hasChangedSinceLastSave()
           
 void incrementSelectedObjects()
          Increases neuron and synapse activation levels.
 boolean isSelected(Object element)
          Return true if the specified element is selected.
 boolean isSelectionEmpty()
          Return true if the selection is empty.
 void modelCleared(NetworkEvent e)
           
 void networkChanged()
          Update the network, gauges, and world.
 void neuronAdded(NetworkEvent e)
          Notify this listener of a Neuron added event.
 void neuronChanged(NetworkEvent e)
          Notify this listener of a NeuronChanged event.
 void neuronRemoved(NetworkEvent e)
          Notify this listener of a Neuron removed event.
protected  void nudge(int offsetX, int offsetY)
          Nudge selected object.
 void openNetwork(File file)
          Open the specified network.
 void paste()
          Paste from the clipboard.
 void removeSelectionListener(NetworkSelectionListener l)
          Remove the specified network selection listener.
 void repaint()
           
 void resetColors()
          Called by network preferences as preferences are changed.
 void resetSynapseDiameters()
          Called by network preferences as preferences are changed.
 void saveCurrentNetwork()
          Save the current network.
 void saveNetwork(File networkFile)
          Save network to specified file.
 void selectAll()
          Select all elements.
 void setAutoZoomMode(boolean autoZoomMode)
           
 void setBackgroundColor(Color clr)
          Set the background color, store it to user preferences, and repaint the panel.
 void setChangedSinceLastSave(boolean changedSinceLastSave)
          Set to true if this network frame has changed since it was last saved.
 void setCoolColor(float coolColor)
           
 void setEditMode(EditMode editMode)
          Set the current edit mode for this network panel to editMode.
 void setExcitatoryColor(Color excitatoryColor)
           
 void setHotColor(float hotColor)
           
 void setInhibitoryColor(Color inhibitoryColor)
           
 void setInOutMode(boolean inOutMode)
           
 void setLastClickedPosition(Point2D lastLeftClicked)
          Set the last position clicked on screen.
 void setLastSelectedNeuron(NeuronNode lastSelectedNeuron)
           
 void setLineColor(Color lineColor)
           
 void setMaxDiameter(int maxDiameter)
           
 void setMinDiameter(int minDiameter)
           
 void setNetwork(StandardNetwork network)
          Used by Castor.
 void setNodeList(ArrayList list)
          Used by Castor.
 void setNudgeAmount(double nudgeAmount)
           
 void setNumberOfPastes(double numberOfPastes)
           
 void setSelection(Collection elements)
          Set the selection to the specified collection of elements.
 void setShowSubnetOutline(boolean showSubnetOutline)
           
 void setShowTime(boolean showTime)
           
 void setSignalColor(Color signalColor)
           
 void setSpikingColor(Color spikingColor)
           
 void setUsingTabs(boolean usingTabs)
           
 void setZeroWeightColor(Color zeroWeightColor)
           
 boolean showOpenFileDialog()
          Show the dialog for opening a network.
 void showSaveFileDialog()
          Show the dialog for saving a network.
 void showSelectedNeuronProperties()
          Creates and displays the neuron properties dialog.
 void showSelectedSynapseProperties()
          Creates and displays the synapse properties dialog.
 void spaceHorizontal()
          Spaces neurons horizontally.
 void spaceVertical()
          Spaces neurons vertically.
 void subnetAdded(NetworkEvent e)
          Notify this listener of a subnetwork added event.
 void subnetRemoved(NetworkEvent e)
          Notify this listener of a subnetwork removed event.
 void synapseAdded(NetworkEvent e)
          Notify this listener of a Neuron removed event.
 void synapseChanged(NetworkEvent e)
          Notify this listener of a Neuron removed event.
 void synapseRemoved(NetworkEvent e)
          Notify this listener of a Neuron removed event.
 void toggleSelection(Object element)
          Toggle the selected state of the specified element; if it is selected, remove it from the selection, if it is not selected, add it to the selection.
 String toString()
          Returns information about the network in String form.
 
Methods inherited from class edu.umd.cs.piccolo.PCanvas
addInputEventListener, createTimer, getAnimating, getCamera, getInteracting, getLayer, getPanEventHandler, getRoot, getZoomEventHandler, installInputSources, paintComponent, paintImmediately, popCursor, pushCursor, removeInputEventListener, repaint, sendInputEventToInputManager, setAnimatingRenderQuality, setBounds, setCamera, setDefaultRenderQuality, setInteracting, setInteractingRenderQuality, setPanEventHandler, setZoomEventHandler
 
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, 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, 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, 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, getName, 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, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NetworkPanel

public NetworkPanel()
Create a new network panel.

Method Detail

createFileMenu

JMenu createFileMenu()
Create and return a new File menu for this network panel.

Returns:
a new File menu for this network panel

createEditMenu

JMenu createEditMenu()
Create and return a new Edit menu for this network panel.

Returns:
a new Edit menu for this network panel

createInsertMenu

JMenu createInsertMenu()
Create and return a new Insert menu for this network panel.

Returns:
a new Insert menu for this network panel

createViewMenu

JMenu createViewMenu()
Create and return a new View menu for this network panel.

Returns:
a new View menu for this network panel

createSelectionMenu

public JMenu createSelectionMenu()
Create a selection JMenu.

Returns:
the selection menu.

createGaugeMenu

JMenu createGaugeMenu()
Create and return a new Gauge menu for this network panel.

Returns:
a new Gauge menu for this network panel

createHelpMenu

JMenu createHelpMenu()
Create and return a new Help menu for this network panel.

Returns:
a new Help menu for this network panel

getContextMenu

JPopupMenu getContextMenu()
Return the context menu for this network panel.

This context menu should return actions that are appropriate for the network panel as a whole, e.g. actions that change modes, actions that operate on the selection, actions that add new components, etc. Actions specific to a node of interest should be built into a node-specific context menu.

Returns:
the context menu for this network panel

createMainToolBar

protected JToolBar createMainToolBar()
Create the main tool bar.

Returns:
the toolbar.

createEditToolBar

protected JToolBar createEditToolBar()
Create the edit tool bar.

Returns:
the toolbar.

createClampToolBar

protected JToolBar createClampToolBar()
Create the clamp tool bar.

Returns:
the tool bar

createAlignMenu

public JMenu createAlignMenu()
Return the align sub menu.

Returns:
the align sub menu

createSpacingMenu

public JMenu createSpacingMenu()
Return the space sub menu.

Returns:
the space sub menu

getEditMode

public EditMode getEditMode()
Return the current edit mode for this network panel.

Returns:
the current edit mode for this network panel

setEditMode

public void setEditMode(EditMode editMode)
Set the current edit mode for this network panel to editMode.

This is a bound property.

Parameters:
editMode - edit mode for this network panel, must not be null

deleteSelectedObjects

public void deleteSelectedObjects()
Delete selected itemes.


copy

public void copy()
Copy to the clipboard.


cut

public void cut()
Cut to the clipboard.


paste

public void paste()
Paste from the clipboard.


alignHorizontal

public void alignHorizontal()
Aligns neurons horizontally.


alignVertical

public void alignVertical()
Aligns neurons vertically.


spaceHorizontal

public void spaceHorizontal()
Spaces neurons horizontally.


spaceVertical

public void spaceVertical()
Spaces neurons vertically.


showSelectedNeuronProperties

public void showSelectedNeuronProperties()
Creates and displays the neuron properties dialog.


showSelectedSynapseProperties

public void showSelectedSynapseProperties()
Creates and displays the synapse properties dialog.


clearSelection

public void clearSelection()
Clear the selection.


selectAll

public void selectAll()
Select all elements.


isSelectionEmpty

public boolean isSelectionEmpty()
Return true if the selection is empty.

Returns:
true if the selection is empty

isSelected

public boolean isSelected(Object element)
Return true if the specified element is selected.

Parameters:
element - element
Returns:
true if the specified element is selected

getSelection

public Collection getSelection()
Return the selection as a collection of selected elements.

Returns:
the selection as a collection of selected elements

setSelection

public void setSelection(Collection elements)
Set the selection to the specified collection of elements.

Parameters:
elements - elements

toggleSelection

public void toggleSelection(Object element)
Toggle the selected state of the specified element; if it is selected, remove it from the selection, if it is not selected, add it to the selection.

Parameters:
element - element

addSelectionListener

public void addSelectionListener(NetworkSelectionListener l)
Add the specified network selection listener.

Parameters:
l - network selection listener to add

removeSelectionListener

public void removeSelectionListener(NetworkSelectionListener l)
Remove the specified network selection listener.

Parameters:
l - network selection listener to remove

getSelectedNeurons

public ArrayList getSelectedNeurons()
Returns selected Neurons.

Returns:
list of selectedNeurons

getSelectedSynapses

public ArrayList getSelectedSynapses()
Returns selected Synapses.

Returns:
list of selected Synapses

getSelectedModelNeurons

public Collection getSelectedModelNeurons()
Returns selected Neurons.

Returns:
list of selectedNeurons

getSelectedModelElements

public Collection getSelectedModelElements()
Returns model network elements corresponding to selected screen elements.

Returns:
list of selected model elements

getCoupledNodes

public Collection getCoupledNodes()
Returns model network elements corresponding to selected screen elements.

Returns:
list of selected model elements

getNeuronNodes

public Collection getNeuronNodes()
Return a collection of all neuron nodes.

Returns:
a collection of all neuron nodes

getSynapseNodes

public Collection getSynapseNodes()
Return a collection of all synapse nodes.

Returns:
a collection of all synapse nodes

getSubnetNodes

public Collection getSubnetNodes()
Return a collection of all subnet nodes.

Returns:
a collection of all subnet nodes

getPersistentNodes

public Collection getPersistentNodes()
Return a collection of all persistent nodes, that is all neuron nodes and all synapse nodes.

Returns:
a collection of all persistent nodes

resetColors

public void resetColors()
Called by network preferences as preferences are changed. Iterates through screen elemenets and resets relevant colors.


resetSynapseDiameters

public void resetSynapseDiameters()
Called by network preferences as preferences are changed. Iterates through screen elemenets and resets relevant colors.


toString

public String toString()
Returns information about the network in String form.

Overrides:
toString in class Component
Returns:
String description about this NeuronNode.

getNetwork

public StandardNetwork getNetwork()
Returns:
Returns the network.

setNetwork

public void setNetwork(StandardNetwork network)
Used by Castor.

Parameters:
network - The network to set.

getLastClickedPosition

public Point2D getLastClickedPosition()
Returns:
Returns the lastClickedPosition.

centerCamera

public void centerCamera()
Centers the neural network in the middle of the PCanvas.


setLastClickedPosition

public void setLastClickedPosition(Point2D lastLeftClicked)
Set the last position clicked on screen.

Parameters:
lastLeftClicked - The lastClickedPosition to set.

getWorkspace

public Workspace getWorkspace()
Returns a reference to the workspace.

Returns:
a reference to the workspace

modelCleared

public void modelCleared(NetworkEvent e)
See Also:
NetworkListener

addNeuron

public void addNeuron()
Add a new neural network.


neuronAdded

public void neuronAdded(NetworkEvent e)
Description copied from interface: NetworkListener
Notify this listener of a Neuron added event.

Specified by:
neuronAdded in interface NetworkListener
Parameters:
e - event
See Also:
NetworkListener

neuronRemoved

public void neuronRemoved(NetworkEvent e)
Description copied from interface: NetworkListener
Notify this listener of a Neuron removed event.

Specified by:
neuronRemoved in interface NetworkListener
Parameters:
e - event
See Also:
NetworkListener

neuronChanged

public void neuronChanged(NetworkEvent e)
Description copied from interface: NetworkListener
Notify this listener of a NeuronChanged event.

Specified by:
neuronChanged in interface NetworkListener
Parameters:
e - event
See Also:
NetworkListener

synapseAdded

public void synapseAdded(NetworkEvent e)
Description copied from interface: NetworkListener
Notify this listener of a Neuron removed event.

Specified by:
synapseAdded in interface NetworkListener
Parameters:
e - event
See Also:
NetworkListener

synapseRemoved

public void synapseRemoved(NetworkEvent e)
Description copied from interface: NetworkListener
Notify this listener of a Neuron removed event.

Specified by:
synapseRemoved in interface NetworkListener
Parameters:
e - event
See Also:
NetworkListener

subnetAdded

public void subnetAdded(NetworkEvent e)
Description copied from interface: NetworkListener
Notify this listener of a subnetwork added event.

Specified by:
subnetAdded in interface NetworkListener
Parameters:
e - event
See Also:
NetworkListener

subnetRemoved

public void subnetRemoved(NetworkEvent e)
Description copied from interface: NetworkListener
Notify this listener of a subnetwork removed event.

Specified by:
subnetRemoved in interface NetworkListener
Parameters:
e - event
See Also:
NetworkListener

couplingChanged

public void couplingChanged(NetworkEvent e)
Description copied from interface: NetworkListener
Notify this listener of a CouplingChanged event. Pass in a reference to the neuron on which the coupling changed.

Specified by:
couplingChanged in interface NetworkListener
Parameters:
e - Network event
See Also:
NetworkListener

synapseChanged

public void synapseChanged(NetworkEvent e)
Description copied from interface: NetworkListener
Notify this listener of a Neuron removed event.

Specified by:
synapseChanged in interface NetworkListener
Parameters:
e - event
See Also:
NetworkListener

findNeuronNode

public NeuronNode findNeuronNode(Neuron n)
Find the NeuronNode corresponding to a given model Neuron.

Parameters:
n - the model neuron.
Returns:
the correonding NeuronNode.

findSynapseNode

public SynapseNode findSynapseNode(Synapse s)
Find the SynapseNode corresponding to a given model Synapse.

Parameters:
s - the model synapse.
Returns:
the corresponding SynapseNode.

findSubnetworkNode

public SubnetworkNode findSubnetworkNode(Network net)
Find the SubnetworkNode corresponding to a given model subnetwork.

Parameters:
net - the model subnetwork.
Returns:
the corresponding subnetwork nodes, null otherwise.

setLastSelectedNeuron

public void setLastSelectedNeuron(NeuronNode lastSelectedNeuron)
Parameters:
lastSelectedNeuron - The lastSelectedNeuron to set.

getLastSelectedNeuron

public NeuronNode getLastSelectedNeuron()
Returns:
Returns the lastSelectedNeuron.

setBackgroundColor

public void setBackgroundColor(Color clr)
Set the background color, store it to user preferences, and repaint the panel.

Parameters:
clr - new background color for network panel

getBackgroundColor

public Color getBackgroundColor()
Get the background color.

Returns:
the background color

showOpenFileDialog

public boolean showOpenFileDialog()
Show the dialog for opening a network.

Returns:
true if file exists

openNetwork

public void openNetwork(File file)
Open the specified network.

Parameters:
file - the file describing the network to open

showSaveFileDialog

public void showSaveFileDialog()
Show the dialog for saving a network.


saveCurrentNetwork

public void saveCurrentNetwork()
Save the current network.


saveNetwork

public void saveNetwork(File networkFile)
Save network to specified file.

Parameters:
networkFile - the file to save the network to.

repaint

public void repaint()
Overrides:
repaint in class Component
See Also:
PCanvas

getAutoZoomMode

public boolean getAutoZoomMode()
Returns:
Auto zoom mode.

setAutoZoomMode

public void setAutoZoomMode(boolean autoZoomMode)
Parameters:
autoZoomMode - Auto zoom mode.

getNodeList

public ArrayList getNodeList()
Used by Castor.

Returns:
temporary list of persistable PNodes

setNodeList

public void setNodeList(ArrayList list)
Used by Castor.

Parameters:
list - temporary list of persistable PNodes

getNetworkFrame

public NetworkFrame getNetworkFrame()
Returns:
a reference to the parent network frame

getCoolColor

public float getCoolColor()
Returns:
Returns the coolColor.

setCoolColor

public void setCoolColor(float coolColor)
Parameters:
coolColor - The coolColor to set.

getExcitatoryColor

public Color getExcitatoryColor()
Returns:
Returns the excitatoryColor.

setExcitatoryColor

public void setExcitatoryColor(Color excitatoryColor)
Parameters:
excitatoryColor - The excitatoryColor to set.

getHotColor

public float getHotColor()
Returns:
Returns the hotColor.

setHotColor

public void setHotColor(float hotColor)
Parameters:
hotColor - The hotColor to set.

getInhibitoryColor

public Color getInhibitoryColor()
Returns:
Returns the inhibitoryColor.

setInhibitoryColor

public void setInhibitoryColor(Color inhibitoryColor)
Parameters:
inhibitoryColor - The inhibitoryColor to set.

setInOutMode

public void setInOutMode(boolean inOutMode)
Parameters:
inOutMode - The in out mode to set.

getInOutMode

public boolean getInOutMode()
Returns:
Returns the in out mode.

getLineColor

public Color getLineColor()
Returns:
Returns the lineColor.

setLineColor

public void setLineColor(Color lineColor)
Parameters:
lineColor - The lineColor to set.

getNumberOfPastes

public double getNumberOfPastes()
Returns:
Returns the numberOfPastes.

setNumberOfPastes

public void setNumberOfPastes(double numberOfPastes)
Parameters:
numberOfPastes - The numberOfPastes to set.

getShowSubnetOutline

public boolean getShowSubnetOutline()
Returns:
Returns show subnet outline.

setShowSubnetOutline

public void setShowSubnetOutline(boolean showSubnetOutline)
Parameters:
showSubnetOutline - Sets Show subnet outline.

getShowTime

public boolean getShowTime()
Returns:
Returns Show time.

setShowTime

public void setShowTime(boolean showTime)
Parameters:
showTime - Sets the show time.

getSpikingColor

public Color getSpikingColor()
Returns:
Returns the spiking synapse color.

setSpikingColor

public void setSpikingColor(Color spikingColor)
Parameters:
spikingColor - Sets the spiking synapse color.

getNudgeAmount

public double getNudgeAmount()
Returns:
Return the nudge amount.

setNudgeAmount

public void setNudgeAmount(double nudgeAmount)
Parameters:
nudgeAmount - Sets the nudge amount.

getUsingTabs

public boolean getUsingTabs()
Returns:
Returns the isUsingTabs.

setUsingTabs

public void setUsingTabs(boolean usingTabs)
Parameters:
usingTabs - The isUsingTabs to set.

getMaxDiameter

public int getMaxDiameter()
Returns:
Returns the maximum synapse diameter.

setMaxDiameter

public void setMaxDiameter(int maxDiameter)
Parameters:
maxDiameter - Sets the maximum synapse diameter.

getMinDiameter

public int getMinDiameter()
Returns:
Returns the minimum synapse diameter.

setMinDiameter

public void setMinDiameter(int minDiameter)
Parameters:
minDiameter - Sets the minimum synapse diameter.

networkChanged

public void networkChanged()
Update the network, gauges, and world. This is where the main control between components happens. Called by world component (on clicks), and the network-thread.

Specified by:
networkChanged in interface NetworkListener

clampChanged

public void clampChanged()
Update clamp toolbar buttons and menu items.

Specified by:
clampChanged in interface NetworkListener

getCurrentDirectory

public String getCurrentDirectory()
Returns a string representation of the current directory.

Returns:
String representation of current directory

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener
See Also:
ActionListener

incrementSelectedObjects

public void incrementSelectedObjects()
Increases neuron and synapse activation levels.


decrementSelectedObjects

public void decrementSelectedObjects()
Decreases neuron and synapse activation levels.


nudge

protected void nudge(int offsetX,
                     int offsetY)
Nudge selected object.

Parameters:
offsetX - amount to nudge in the x direction (multipled by nudgeAmount)
offsetY - amount to nudge in the y direction (multipled by nudgeAmount)

closeNetwork

public void closeNetwork()
Close model network.


addGauge

public void addGauge()
Add a gauge which by default gauges all neurons of current network.


setChangedSinceLastSave

public void setChangedSinceLastSave(boolean changedSinceLastSave)
Set to true if this network frame has changed since it was last saved.

Parameters:
changedSinceLastSave - true if this network frame has changed since it was last saved

hasChangedSinceLastSave

public boolean hasChangedSinceLastSave()
Returns:
Returns the hasChangedSinceLastSave.

getEditToolBar

public JToolBar getEditToolBar()
Returns:
Returns the edit tool bar.

getMainToolBar

public JToolBar getMainToolBar()
Returns:
Returns the main tool bar.

getClampToolBar

public JToolBar getClampToolBar()
Returns:
the clamp tool bar.

getZeroWeightColor

public Color getZeroWeightColor()
Returns:
the zero weight color.

setZeroWeightColor

public void setZeroWeightColor(Color zeroWeightColor)
Parameters:
zeroWeightColor - Color of the zero weight.

getSignalColor

public Color getSignalColor()
Returns:
the signal synapse color.

setSignalColor

public void setSignalColor(Color signalColor)
Parameters:
signalColor - Color of the signal synapse.