How to write a new tool for sluice (The table package)

Writing a new tool for sluice is easy, providing you understand the TableView protocol and has some knowledge of java beans.
A tool is sieve is a java bean that is extended to handle the TableView protocol, and that has a User Interface (UI). There are two ways of implementing a new tool: To fuse the UI and the tool in one class, or to have the UI and the tool behavior in separate classes. The first approach makes sense in cases where the main purpose of the tool is visualization, like drawing a histogram or showing the content of a table, and uses few UI components. The second approach is better when the tool has a UI made of  interface widgets that have a complicate dependency.

Implementation:

  1. Fuse the UI and the tool in one class:
    To take this path you make your class to inherit from sieve.sluice.TableViewJComponent. This class is a swing JPane that also has the default behavior for TableViews, as sieve.sluice.views.DefaultTableView does. To see how it works, take a look at the source code in sieve.nuggets.BoxPlot.java and sieve.nuggets.BoxPlotBeanInfo.
  2. Have the UI and the tool behavior in separate classes:
    In this case you will need 3 classes:

    Since a tool in sluice (and in sieve in general) is a bean, the class implementing the UI will be a customizer. When sieve creates a new instance of a tool (bean), it checks for the existence of a customizer for that tool; if it finds one it will use it as the visible component of the tool. There is nothing in particular about this customizer, it needs to follow the same set of rules any other bean customizer would follow.

    Examples:

    You do not need to start from scratch if you want to write a new tool. The files TableViewTool.java, TableViewToolCustomizer.java and TableViewToolBeanInfo.java are skeletons for the classes to implement the TableView behavior, the User Interface and the BeanInfo, respectively. The code is commented to tell where you need to add the behavior for your particular tool.