Class TreeTableModel

java.lang.Object
likelihoodDetectionModule.TreeTableModel
All Implemented Interfaces:
TreeModel

public class TreeTableModel extends Object implements TreeModel
The TreeTableModel represents a LikelihoodDetectionParameters object (which contains module parameters and an ArrayList of TargetConfiguration objects) as a node-based tree for use with a JTree. This model is intended to be placed within a JTable to represent a tree within the first column of a table (specifically, the first column of the TreeTable). It implements the standard Java TreeModel interface. The JTree that this model is used for is the TreeTableCellRenderer that is embedded within the TreeTable.
See Also:
  • Constructor Details

    • TreeTableModel

      public TreeTableModel(AcquisitionSettings acquisitionSettings, int channelMap)
      Instantiates a new tree table model. This constructor only takes in the acquisition settings and the channel map because those are static with respect to configuration while the dialog is open. The actual likelihood detection parameters that the dialog is to represent will be set via the setTargetConfigurations() method.
      Parameters:
      acquisitionSettings - the acquisition settings
      channelMap - the channel map
  • Method Details

    • getAcquisitionSettings

      public AcquisitionSettings getAcquisitionSettings()
      Gets the acquisition settings that are associated with the parameters.
      Returns:
      the acquisition settings
    • setAcquisitionSettings

      public void setAcquisitionSettings(AcquisitionSettings acquisitionSettings)
    • getChannelMap

      public int getChannelMap()
      Gets the channel map that the user has selected.
      Returns:
      the channel map
    • targetConfigurationNames

      public ArrayList<String> targetConfigurationNames()
      Returns an ArrayList of the target configuration names.
      Returns:
      the array listinvalid input: '<' string>
    • createNewTargetConfiguration

      public void createNewTargetConfiguration(String identifier)
      Creates a new target configuration using the identifier specified. This identifier should be unique to the module. Note that this object does not enforce the uniqueness.
      Parameters:
      identifier - the identifier string
    • deleteTargetConfiguration

      public void deleteTargetConfiguration(String identifier)
      Delete the target configuration specified by the identifier. If the configuration is not found, this method is a no-op.
      Parameters:
      identifier - the identifier
    • getTargetConfiguration

      public TargetConfiguration getTargetConfiguration(String identifier)
      Gets the target configuration identified by the string. This will return null if the configuration is not found.
      Parameters:
      identifier - the identifier
      Returns:
      the target configuration
    • addTargetConfiguration

      public void addTargetConfiguration(TargetConfiguration config)
      Adds the target configuration.
      Parameters:
      config - the config
    • getBandNames

      public ArrayList<String> getBandNames()
      Gets the band names used.
      Returns:
      the band names
    • createNewSignalBand

      public void createNewSignalBand(String bandId, String configId)
      Creates a new signal band for the target configuration specified. The signal band name should be unique for this target configuration. The object does not enforce the uniqueness.
      Parameters:
      bandId - The band's unique identifier.
      configId - The target configuration's unique identifier.
    • createNewGuardBand

      public void createNewGuardBand(String bandId, String configId)
      Creates a new guard band for the target configuration specified. The guard band name should be unique for this target configuration. The object does not enforce the uniqueness.
      Parameters:
      bandId - The guard band's unique identifier.
      configId - The target configuration's unique identifier.
    • deleteGuardBandFrom

      public void deleteGuardBandFrom(String bandName, String configName)
      Delete the specified guard band from the target configuration indicated. If the target configuration or the guard band is not found, this function does nothing.
      Parameters:
      bandName - The guard band's unique identifier.
      configName - The target configuration's unique identifier.
    • deleteSignalBandFrom

      public void deleteSignalBandFrom(String bandName, String configName)
      Delete the specified signal band from the indicated target configuration. If the target configuration or the signal band are not found, this function does nothing.
      Parameters:
      bandName - The signal band's unique identifier.
      configName - The target configuration's unique identifier.
    • setTargetConfigurations

      public void setTargetConfigurations(ArrayList<TargetConfiguration> configs)
      Sets the TargetConfigurations that are being managed by the model.
      Parameters:
      configs - An ArrayList of TargetConfigurations.
    • getPathToRoot

      public TreeNode[] getPathToRoot(TreeNode aNode)
      Builds the parents of node up to and including the root node, where the original node is the last element in the returned array. The length of the returned array gives the node's depth in the tree.
      Parameters:
      aNode - the TreeNode to get the path for
      Returns:
      the path to root
    • setConfigurationDialogSettings

      public void setConfigurationDialogSettings(ConfigurationDialogSettings settings)
      Sets the configuration dialog settings that are to be preserved with the LikelihoodDetectionParameters.
      Parameters:
      settings - The new configuration dialog settings.
    • getDialogSettings

      public ConfigurationDialogSettings getDialogSettings()
      Gets the dialog settings.
      Returns:
      the dialog settings
    • setConfigurationDialogExpandedState

      public void setConfigurationDialogExpandedState(String state)
      Sets the configuration dialog expanded state.
      Parameters:
      state - the new configuration dialog expanded state
    • getTargetConfigurations

      public ArrayList<TargetConfiguration> getTargetConfigurations()
      Returns the current state of the internal representation of the configuration data as an ArrayList of TargetConfiguration objects.
      Returns:
      the target configurations
    • getSignalBandNames

      public Vector<String> getSignalBandNames(String configIdentifier)
      Gets the signal band names in use for the specified target configuration identifier. If the identifier is not found, the resulting vector will be empty.
      Parameters:
      configIdentifier - The target configuration's unique identifier.
      Returns:
      the signal band names
    • getTargetConfigurationNameForAssociatedBandNode

      public String getTargetConfigurationNameForAssociatedBandNode(likelihoodDetectionModule.AssociatedBandNode n)
      Gets the target configuration name for associated band node. This is used when trying to figure out what signal band names are available to be associated with. If a match is not found, null is returned.
      Parameters:
      n - The associated band node in the internal representation.
      Returns:
      the target configuration name that contains this associated band node
    • getChildCount

      public int getChildCount(Object node)
      Implementation of getChildCount from the TreeModel interface.
      Specified by:
      getChildCount in interface TreeModel
      Parameters:
      node - the node
      Returns:
      the child count
      See Also:
    • getChild

      public Object getChild(Object node, int child)
      Implementation of getChild from the TreeModel interface.
      Specified by:
      getChild in interface TreeModel
      Parameters:
      node - the node
      child - the child
      Returns:
      the child
      See Also:
    • getRoot

      public Object getRoot()
      Implementation of getRoot from the TreeModel interface.
      Specified by:
      getRoot in interface TreeModel
      Returns:
      the root
      See Also:
    • isLeaf

      public boolean isLeaf(Object node)
      Implementation of isLeaf from the TreeModel interface.
      Specified by:
      isLeaf in interface TreeModel
      Parameters:
      node - the node
      Returns:
      true, if checks if is leaf
      See Also:
    • valueForPathChanged

      public void valueForPathChanged(TreePath path, Object newValue)
      Empty implementation of valueForPathChanged from the TreeModel interface.
      Specified by:
      valueForPathChanged in interface TreeModel
      Parameters:
      path - the path
      newValue - the new value
      See Also:
    • getIndexOfChild

      public int getIndexOfChild(Object parent, Object child)
      Implementation of TreeModel.getIndexOfChild()
      Specified by:
      getIndexOfChild in interface TreeModel
      Parameters:
      parent - the parent
      child - the child
      Returns:
      the index of child
      See Also:
    • addTreeModelListener

      public void addTreeModelListener(TreeModelListener l)
      Adds a listener for TreeModel events.
      Specified by:
      addTreeModelListener in interface TreeModel
      Parameters:
      l - the l
    • removeTreeModelListener

      public void removeTreeModelListener(TreeModelListener l)
      Removes a listener for TreeModel events.
      Specified by:
      removeTreeModelListener in interface TreeModel
      Parameters:
      l - the l
    • getColumnClass

      public Class getColumnClass(int column)
      Implementation of TreeModel.getColumnClass.
      Parameters:
      column - the column
      Returns:
      the column class
      See Also:
    • isCellEditable

      public boolean isCellEditable(Object node, int column)
      Implementation of TreeModel.isCellEditable.
      Parameters:
      node - the node
      column - the column
      Returns:
      true, if checks if is cell editable
      See Also:
    • setValueAt

      public void setValueAt(Object aValue, Object node, int column)
      Implementation of TreeModel.setValueAt(). This changes the value of a node.
      Parameters:
      aValue - the a value
      node - the node
      column - the column
      See Also:
    • getColumnCount

      public int getColumnCount()
      Implementation of TreeModel.getColumnCount(). For the purposes of the Likelihood detection configuration widget, the TreeModel is always two columns.
      Returns:
      the column count
    • getColumnName

      public String getColumnName(int column)
      Implementation of TreeModel.getColumnName.
      Parameters:
      column - the column
      Returns:
      the column name
      See Also:
    • getValueAt

      public Object getValueAt(Object node, int column)
      Implementation of TreeModel.getValueAt(). The value that gets returned depends on the type of node in the representation being queried about.
      Parameters:
      node - the node
      column - the column
      Returns:
      the value at
      See Also: