Developer Notes

Development tools

We use the following tools for NatTable development:

Development environment setup - step by step

Download and install the development tools listed above.

Checking out the code and building from the command line

You should check out the code outside of Eclipse so you can preserve the hierarchical directory structure. Use the following command to check out the trunk code:

svn checkout https://nattable.svn.sourceforge.net/svnroot/nattable/trunk

Note: we will refer to the location where you checked out the NatTable trunk code as NATTABLE_TRUNK

To build from the command line, first execute the following commands from the NATTABLE_TRUNK/nattable directory:

mvn -f deps/pom.xml clean install
mvn -f net.sourceforge.nattable.parent/pom.xml clean install

The first command is to wrap non-OSGi jar dependencies (Apache Poi) as OSGi bundles. The second actually builds NatTable.

Importing projects into Eclipse

The first thing you will need to do is import the NatTable projects into Eclipse:

  • select File -> Import from the menubar
  • choose General -> Existing Projects into Workspace
  • click Next
  • Select root directory: (NATTABLE_TRUNK/nattable)
  • click Finish

Setting the target platform

  • Copy 3rd party dependencies:
    • If you have m2eclipse installed, you can right-click on the Copy dependencies.launch file in the target-platform project and select 'Run As->Copy dependencies'
    • Otherwise, you can run

      mvn dependency:copy-dependencies -DoutputDirectory=dependencies

      from the command line from within in the target-platform project directory

  • Open the nattable.target file in the target-platform project
  • Click on the 'Set as Target Platform' link in the upper-right corner.

All of the projects should now compile cleanly.

Additional Eclipse setup/tips

Code formatting

Please use the Eclipse formatter profile in net.sourceforge.nattable/dev_config/NatTable_style.xml. Import this and set as the active profile in Eclipse in the Java -> Code Style -> Formatter preferences page.

Setting up Mylyn

Here's how to set up mylyn to connect to the Jira bug tracker. The URL for the NatTable Jira is: http://nattable.org/jira

Source code organization

NatTable source is divided into the following projects:

  • net.sourceforge.nattable.core - Core NatTable code
  • net.sourceforge.nattable.extension.glazedlists - NatTable extensions for working with GlazedLists
  • net.sourceforge.nattable.examples - example programs

In addition there are also various test projects. All of these projects are packaged as Eclipse plugins/OSGi bundles.

Code conventions

  • Interfaces are prefixed with 'I', e.g. INatTableModel

Comments

Target project mistake

"
Open the nattable.target file in the net.sourceforge.nattable.core project
"

This is incorrect. The file that needs to be opened is under the target-platform project.

how to find selectedIndex of a row and thus extract data from it

I've a problem to use the NatTable Grid i.e. High Performance SWT Grid which I downloaded from http://sourceforge.net/projects/nattable/files/NatTable/. I can load the data into this NatTable Grid, but I don't know(or find any method in NatTable) how to find the selected row's index as we do in case of Nebula Grid/SWT table. Moreover, how to extract the data from this Grid after filling it, so that the extracted row data can be loaded into an ArrayList. Please, somebody tell me the way I should follow to achieve these functionalities in NatTable.
Sorry if it's not right place to ask a question.
sristi