org.sump.analyzer.tools
Class Base

java.lang.Object
  extended by org.sump.analyzer.tools.Base
All Implemented Interfaces:
Tool
Direct Known Subclasses:
I2CProtocolAnalysis, SPIProtocolAnalysis, StateAnalysis

public abstract class Base
extends java.lang.Object
implements Tool

Abstract base class that may be used for tools.

This class is provided for convenience to ease implementing new tools and reduce the redundancy for commonly used methods.

For details about the methods required for tools, see Tool interface.

Version:
0.7
Author:
Michael "Mr. Sump" Poppitz

Constructor Summary
Base()
           
 
Method Summary
abstract  java.lang.String getName()
          Is called to get the name for the menu entry.
 void init(java.awt.Frame frame)
          Does nothing.
abstract  CapturedData process(CapturedData data)
          This method is invoked when the tool is selected from the Tools menu.
 CapturedData process(CapturedData data, int group, int channel, int position)
          Calls process(CapturedData data).
 void selectByIndex(javax.swing.JComboBox box, java.lang.String index)
          Selects the item of a combo box at the given index.
 void selectByValue(javax.swing.JComboBox box, java.lang.String value)
          Selects the first item of the combo box that matches the given string value.
 void selectByValue(javax.swing.JComboBox box, java.lang.String[] entries, java.lang.String value)
          Selects the item of a combo box whose index corresponds to a string array index matching the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base

public Base()
Method Detail

getName

public abstract java.lang.String getName()
Description copied from interface: Tool
Is called to get the name for the menu entry. The name must be unique among all tools. Should end in "..." if it opens a dialog window.

Specified by:
getName in interface Tool
Returns:
name for this tool

init

public void init(java.awt.Frame frame)
Does nothing. If initialization is needed it must be overwritten.

Specified by:
init in interface Tool
Parameters:
frame - ignored

process

public abstract CapturedData process(CapturedData data)
Description copied from interface: Tool
This method is invoked when the tool is selected from the Tools menu. It should request any missing information using a dialog and perform the tool's actual task.

Specified by:
process in interface Tool
Parameters:
data - currently displayed captured data
Returns:
new CapturedData if provided data has been altered or null otherwise

process

public CapturedData process(CapturedData data,
                            int group,
                            int channel,
                            int position)
Calls process(CapturedData data).

Specified by:
process in interface Tool
Parameters:
data - currently displayed captured data
group - channel group at the mouse position where the menu was openend
channel - number of channel at the mouse position where the menu was openend
position - number of sample at the mouse position where the menu was openend
Returns:
new CapturedData if provided data has been altered or null otherwise

selectByValue

public void selectByValue(javax.swing.JComboBox box,
                          java.lang.String[] entries,
                          java.lang.String value)
Selects the item of a combo box whose index corresponds to a string array index matching the given value.

Parameters:
box - combo box where the entry should be selected
entries - list of strings corresponding to combo box entries
value - value to be searched for in string array and highlighted in combo box

selectByValue

public void selectByValue(javax.swing.JComboBox box,
                          java.lang.String value)
Selects the first item of the combo box that matches the given string value.

Parameters:
box - combo box where the entry should be selected
value - value to be searched for in string array and highlighted in combo box

selectByIndex

public void selectByIndex(javax.swing.JComboBox box,
                          java.lang.String index)
Selects the item of a combo box at the given index.

Parameters:
box - combo box where the entry should be selected
index - string containing integer to be used as index for selected item in combo box