Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Synapsim.core
Class Block  view Block download Block.java

java.lang.Object
  extended bySynapsim.core.Block
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class Block
extends java.lang.Object
implements java.awt.event.ActionListener


Field Summary
protected  BlockCollection blocks
           
protected  BlockDaemon daemon
           
protected  java.util.Map inputs
           
protected  javax.swing.JPopupMenu menu
           
private  java.util.Map menuListeners
           
protected  java.util.Map outputs
           
protected  java.util.Map properties
           
private static java.lang.String PROPERTIES_MENU_NAME
           
protected  javax.swing.JMenu propertiesMenu
           
private static java.lang.Boolean PROPERTY_NAME_DEFAULTREADONLY
           
private static java.lang.Object PROPERTY_NAME_DEFAULTVALUE
           
private static java.lang.String PROPERTY_NAME_FRIENDLYNAME
           
static java.lang.String PROPERTY_NAME_NAME
           
private static java.lang.String PROPERTY_NAME_TYPE
           
private static java.lang.String REMOVE_MENUITEM_NAME
           
protected  BlockWidget widget
           
 
Constructor Summary
Block()
           
Block(java.lang.String name, BlockCollection blockContainer)
          This is the constructor that should be user in normal conditions
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          This method is invoked when an action occurs.
protected  void addInput(java.lang.String inputname)
          Adds a new input object to this block.
 void addMenuItem(java.lang.String label, BlockMenuListener listener)
           
protected  void addOutput(java.lang.String outputname)
          Adds a new output object to this block.
 void addOutputConnection(java.lang.String outputName, java.lang.String inputObjRef)
          Associates an output of this block to the input of another block
 boolean canPersist()
           
 BlockCollection getBlocks()
           
 java.lang.String getClassName()
           
 BlockCollection getCollection()
          Returns the reference to the block container to wich this block belongs to.
 java.lang.String getFullName()
          Returns the fully qualified name of this block.
 BlockInput getInputByName(java.lang.String inputName)
           
 java.lang.Object getInputData(java.lang.String inputname)
          This method returns the data of a given input
 java.util.Map getInputs()
           
 java.lang.String getName()
          Returns the name of this block.
 int getNumInputs()
          Returns the number of inputs associated with this block.
 int getNumOutputs()
          Returns the number of outputs associated with this block.
 BlockOutput getOutputByName(java.lang.String outputName)
           
 java.util.Map getOutputs()
           
 java.util.Map getProperties()
           
 BlockProperty getProperty(java.lang.String name)
           
 BlockProperty getPropertyByFriendlyName(java.lang.String friendlyName)
           
 BlockProperty getPropertyByName(java.lang.String name)
           
 BlockWidget getWidget()
          Returns a reference to the contained widget
protected  java.util.Map newDefaultPropertySet()
           
 void persistData(java.io.BufferedWriter bw)
           
 void persistedData(java.io.BufferedReader br)
           
 void popMenu(int x, int y)
           
private  void rebuildMenu()
           
protected  void rebuildPropertiesMenu()
           
protected  void removeInput(java.lang.String inputname)
          Removes an input object form this block.
protected  void removeOutput(java.lang.String outputname)
          Removes an output object form this block.
 void setAllInputs(java.lang.Object data)
          This method sets all the inputs of the block.
 void setAllOutputs(java.lang.Object data)
          This method sets all the outputs of the block.
 void setBlockCollection(BlockCollection blocks)
          Changes the reference of the container to which this block belongs to.
 void setCollection(BlockCollection blocks)
          Changes the block container to which this block belongs to.
 void setDaemon(BlockDaemon daemon)
          Changes the reference of the contained daemon.
 void setInputData(java.lang.String inputname, java.lang.Object data)
          Sets the data object contained by the specified input.
 void setName(java.lang.String name)
          Changes the name of this block WARNING! All references to this block in other blocks must be updated!
 void setOutputData(java.lang.String outputName, java.lang.Object data)
          This method sets the data of a given output
 void start()
          This method starts the BlockDaemon of the block
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REMOVE_MENUITEM_NAME

private static final java.lang.String REMOVE_MENUITEM_NAME
See Also:
Constant Field Values

PROPERTIES_MENU_NAME

private static final java.lang.String PROPERTIES_MENU_NAME
See Also:
Constant Field Values

PROPERTY_NAME_NAME

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

PROPERTY_NAME_FRIENDLYNAME

private static final java.lang.String PROPERTY_NAME_FRIENDLYNAME
See Also:
Constant Field Values

PROPERTY_NAME_DEFAULTVALUE

private static final java.lang.Object PROPERTY_NAME_DEFAULTVALUE

PROPERTY_NAME_TYPE

private static final java.lang.String PROPERTY_NAME_TYPE

PROPERTY_NAME_DEFAULTREADONLY

private static final java.lang.Boolean PROPERTY_NAME_DEFAULTREADONLY

inputs

protected java.util.Map inputs

outputs

protected java.util.Map outputs

properties

protected java.util.Map properties

blocks

protected BlockCollection blocks

widget

protected BlockWidget widget

daemon

protected BlockDaemon daemon

menu

protected javax.swing.JPopupMenu menu

propertiesMenu

protected javax.swing.JMenu propertiesMenu

menuListeners

private java.util.Map menuListeners
Constructor Detail

Block

public Block()

Block

public Block(java.lang.String name,
             BlockCollection blockContainer)
This is the constructor that should be user in normal conditions

Method Detail

newDefaultPropertySet

protected java.util.Map newDefaultPropertySet()

getInputs

public java.util.Map getInputs()

getOutputs

public java.util.Map getOutputs()

getWidget

public BlockWidget getWidget()
Returns a reference to the contained widget


setBlockCollection

public void setBlockCollection(BlockCollection blocks)
Changes the reference of the container to which this block belongs to.


setDaemon

public void setDaemon(BlockDaemon daemon)
Changes the reference of the contained daemon.


getCollection

public BlockCollection getCollection()
Returns the reference to the block container to wich this block belongs to.


getProperty

public BlockProperty getProperty(java.lang.String name)

getProperties

public java.util.Map getProperties()

setName

public void setName(java.lang.String name)
Changes the name of this block WARNING! All references to this block in other blocks must be updated!


getName

public java.lang.String getName()
Returns the name of this block.


getFullName

public java.lang.String getFullName()
Returns the fully qualified name of this block. By now, there's only one level of blocks and no sub-block support, but in the future, this function must do something like this: if this block has no parent return name else return parent.getFullName() + name fi


setCollection

public void setCollection(BlockCollection blocks)
Changes the block container to which this block belongs to.


addOutputConnection

public void addOutputConnection(java.lang.String outputName,
                                java.lang.String inputObjRef)
                         throws BlockIONotFoundException
Associates an output of this block to the input of another block


getNumInputs

public int getNumInputs()
Returns the number of inputs associated with this block.


getNumOutputs

public int getNumOutputs()
Returns the number of outputs associated with this block.


setInputData

public void setInputData(java.lang.String inputname,
                         java.lang.Object data)
                  throws BlockIONotFoundException
Sets the data object contained by the specified input.


setAllInputs

public void setAllInputs(java.lang.Object data)
This method sets all the inputs of the block.


setAllOutputs

public void setAllOutputs(java.lang.Object data)
This method sets all the outputs of the block.


getInputData

public java.lang.Object getInputData(java.lang.String inputname)
                              throws BlockIONotFoundException
This method returns the data of a given input


addInput

protected void addInput(java.lang.String inputname)
Adds a new input object to this block. This method is intended to be used only by the contained daemon.


addOutput

protected void addOutput(java.lang.String outputname)
Adds a new output object to this block. This method is intended to be used only by the contained daemon.


removeInput

protected void removeInput(java.lang.String inputname)
Removes an input object form this block. This method is intended to be used only by the contained daemon.


removeOutput

protected void removeOutput(java.lang.String outputname)
Removes an output object form this block. This method is intended to be used only by the contained daemon.


setOutputData

public void setOutputData(java.lang.String outputName,
                          java.lang.Object data)
                   throws BlockIONotFoundException
This method sets the data of a given output


getInputByName

public BlockInput getInputByName(java.lang.String inputName)

getOutputByName

public BlockOutput getOutputByName(java.lang.String outputName)

start

public void start()
This method starts the BlockDaemon of the block


rebuildMenu

private void rebuildMenu()

rebuildPropertiesMenu

protected void rebuildPropertiesMenu()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Description copied from interface: java.awt.event.ActionListener
This method is invoked when an action occurs.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

getPropertyByName

public BlockProperty getPropertyByName(java.lang.String name)

getPropertyByFriendlyName

public BlockProperty getPropertyByFriendlyName(java.lang.String friendlyName)

addMenuItem

public void addMenuItem(java.lang.String label,
                        BlockMenuListener listener)

popMenu

public void popMenu(int x,
                    int y)

canPersist

public boolean canPersist()

getClassName

public java.lang.String getClassName()

getBlocks

public BlockCollection getBlocks()

persistData

public void persistData(java.io.BufferedWriter bw)
                 throws java.io.IOException

persistedData

public void persistedData(java.io.BufferedReader br)
                   throws java.io.IOException