Getting started

Install

You can install NatTable to your environment by simply downloading it here and putting it into the dropins folder manually.

Note that currently NatTable is not included in Nebula releases and the p2 Update Site is not finished yet. You need to download and install the NatTable JARs manually until we solved the dependency issues with the help of the Orbit team. We hope this will soon be fixed and we can provide a fully functional p2 Update Site for Nebula NatTable.

Examples

One of the best ways to get familiar with it is to see example code. There are lots of examples in the org.eclipse.nebula.widgets.nattable.examples package.

Running the examples

Download and run NatTableExamples-xx.jar (executable jar file). It launches NatTableExamples.java which aggregates the examples in a tabbed window and shows the associated source code.

Note that the NatTableExamples jar does not contain SWT, so you need to include the appropriate SWT jars for your platform on the command line, e.g.:

java -cp org.eclipse.swt.win32.win32.x86_.jar;NatTableExamples.jar org.eclipse.nebula.widgets.nattable.examples.NatTableExamples

Developer

You can also download the source code and contribute it to NatTable. The following information will help you set up your development environment. The development tools with minimum versions that are used by the NatTable team are listed below.

  • JDK 1.6
  • Eclipse 3.5
  • Maven 3 with Tycho
  • Git

After all of these tools are installed you can download the NatTable sources via Git with the following command:

git clone git://git.eclipse.org/gitroot/nattable/org.eclipse.nebula.widgets.nattable.git

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

To build from the command line, you need to execute the following command from the NATTABLE_TRUNK/nattable directory:

mvn -f org.eclipse.nebula.widgets.nattable.parent/pom.xml clean install

If you are working on a codebase prior 1.0.0 you will need to execute the following command before you are trying to build NatTable the first time. It is needed to wrap non-OSGi jar dependencies (Apache Poi) as OSGi bundles.

mvn -f deps/pom.xml clean install
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.

Code formatting

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

Source code organization

NatTable source is divided into the following projects:

  • org.eclipse.nebula.widgets.nattable.core - Core NatTable code
  • org.eclipse.nebula.widgets.nattable.extension.glazedlists - NatTable extensions for GlazedLists
  • org.eclipse.nebula.widgets.nattable.extension.poi - NatTable extensions for Apache POI
  • org.eclipse.nebula.widgets.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