Restructuring of NatTable project structure
Moved internal data model and fixture implementations out of the test
and example projects to the dataset project, to cleanup the dependencies
Change-Id: I927be16615326bb365f5c4a782397e25775005f6
Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com>
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.core.test/META-INF/MANIFEST.MF
index 0f3c1b0..82b6ae7 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.nebula.widgets.nattable.core.test/META-INF/MANIFEST.MF
@@ -6,13 +6,15 @@
Fragment-Host: org.eclipse.nebula.widgets.nattable.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.eclipse.core.commands.common,
+ org.eclipse.nebula.widgets.nattable.dataset.fixture.data,
+ org.eclipse.nebula.widgets.nattable.dataset.person,
+ org.hamcrest.core,
+ org.junit,
org.osgi.framework
-Export-Package: org.eclipse.nebula.widgets.nattable.test.data,
- org.eclipse.nebula.widgets.nattable.test.fixture,
+Export-Package: org.eclipse.nebula.widgets.nattable.test.fixture,
org.eclipse.nebula.widgets.nattable.test.fixture.command,
org.eclipse.nebula.widgets.nattable.test.fixture.data,
org.eclipse.nebula.widgets.nattable.test.fixture.group,
org.eclipse.nebula.widgets.nattable.test.fixture.layer,
org.eclipse.nebula.widgets.nattable.test.integration
-Require-Bundle: org.junit4
Bundle-Vendor: Eclipse Nebula NatTable
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/BlinkLayerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/BlinkLayerTest.java
index 5d41d6d..481b64c 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/BlinkLayerTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/BlinkLayerTest.java
@@ -14,20 +14,22 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.BlinkingRowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator;
import org.eclipse.nebula.widgets.nattable.layer.event.PropertyUpdateEvent;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.BlinkingRowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture;
import org.eclipse.swt.widgets.Display;
import org.junit.Before;
@@ -59,9 +61,18 @@
this.propertyChangeListener = getPropertyChangeListener();
this.dataLayer = new DataLayer(this.listDataProvider);
- this.layerUnderTest = new BlinkLayer<BlinkingRowDataFixture>(this.dataLayer,
- this.listDataProvider, BlinkingRowDataFixture.rowIdAccessor,
- columnPropertyAccessor, this.configRegistry);
+ this.layerUnderTest = new BlinkLayer<BlinkingRowDataFixture>(
+ this.dataLayer,
+ this.listDataProvider,
+ new IRowIdAccessor<BlinkingRowDataFixture>() {
+
+ @Override
+ public Serializable getRowId(BlinkingRowDataFixture rowObject) {
+ return rowObject.getSecurity_id();
+ }
+ },
+ columnPropertyAccessor,
+ this.configRegistry);
this.layerUnderTest.blinkingEnabled = true;
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/UpdateEventsCacheTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/UpdateEventsCacheTest.java
index deb3d8c..2614934 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/UpdateEventsCacheTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/blink/UpdateEventsCacheTest.java
@@ -13,13 +13,13 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.io.Serializable;
import java.util.concurrent.Executors;
-import org.eclipse.nebula.widgets.nattable.blink.CellKeyStrategyImpl;
-import org.eclipse.nebula.widgets.nattable.blink.UpdateEventsCache;
+import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.layer.event.PropertyUpdateEvent;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture;
import org.junit.Before;
import org.junit.Test;
@@ -37,7 +37,14 @@
@Before
public void setup() {
this.cache = new UpdateEventsCache<RowDataFixture>(
- RowDataFixture.rowIdAccessor, new CellKeyStrategyImpl(),
+ new IRowIdAccessor<RowDataFixture>() {
+
+ @Override
+ public Serializable getRowId(RowDataFixture rowObject) {
+ return rowObject.getSecurity_description();
+ }
+ },
+ new CellKeyStrategyImpl(),
Executors.newSingleThreadScheduledExecutor());
this.bean1 = RowDataListFixture.getList().get(0);
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnChooser/ColumnChooserUtilsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnChooser/ColumnChooserUtilsTest.java
index 06e9f75..e0733ca 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnChooser/ColumnChooserUtilsTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/columnChooser/ColumnChooserUtilsTest.java
@@ -21,12 +21,12 @@
import org.eclipse.nebula.widgets.nattable.columnChooser.ColumnChooserUtils;
import org.eclipse.nebula.widgets.nattable.columnChooser.ColumnEntry;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer;
import org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.test.fixture.ColumnEntriesFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.test.fixture.layer.ColumnHeaderLayerFixture;
import org.junit.Before;
import org.junit.Test;
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/FilterListDataProviderTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/FilterListDataProviderTest.java
index 660737b..e2a058a 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/FilterListDataProviderTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/data/FilterListDataProviderTest.java
@@ -16,8 +16,8 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IRowDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/command/RowSelectionEditUtilsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/command/RowSelectionEditUtilsTest.java
index bebf722..b1d6043 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/command/RowSelectionEditUtilsTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/edit/command/RowSelectionEditUtilsTest.java
@@ -28,6 +28,8 @@
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultBooleanDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.edit.ActiveCellEditorRegistry;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.editor.CheckBoxCellEditor;
@@ -39,8 +41,6 @@
import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture;
import org.junit.Before;
import org.junit.Test;
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/BoxingStyleTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/BoxingStyleTest.java
index 627fdef..8d17608 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/BoxingStyleTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/painter/cell/BoxingStyleTest.java
@@ -14,6 +14,9 @@
import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.PricingTypeBean;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.grid.cell.AlternatingRowConfigLabelAccumulator;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer;
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
@@ -24,8 +27,6 @@
import org.eclipse.nebula.widgets.nattable.style.Style;
import org.eclipse.nebula.widgets.nattable.style.VerticalAlignmentEnum;
import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.PricingTypeBean;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
@@ -153,7 +154,8 @@
cell.getDisplayMode(),
cell.getConfigLabels().getLabels())
.getAttributeValue(
- CellStyleAttributes.VERTICAL_ALIGNMENT).name());
+ CellStyleAttributes.VERTICAL_ALIGNMENT)
+ .name());
}
@Test
@@ -162,12 +164,29 @@
IConfigRegistry configRegistry = new ConfigRegistry();
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
- PricingTypeBean.getDisplayConverter());
+ new DisplayConverter() {
+
+ @Override
+ public Object canonicalToDisplayValue(Object canonicalValue) {
+ if (canonicalValue == null) {
+ return null;
+ } else {
+ return canonicalValue.toString().equals("MN") ? "Manual" : "Automatic";
+ }
+ }
+
+ @Override
+ public Object displayToCanonicalValue(Object displayValue) {
+ return displayValue.toString().equals("Manual") ? new PricingTypeBean("MN") : new PricingTypeBean("AT");
+ }
+
+ });
NatTableFixture natTableFixture = new NatTableFixture(
new DefaultGridLayer(RowDataListFixture.getList(),
RowDataListFixture.getPropertyNames(),
- RowDataListFixture.getPropertyToLabelMap()), false);
+ RowDataListFixture.getPropertyToLabelMap()),
+ false);
natTableFixture.setConfigRegistry(configRegistry);
natTableFixture.configure();
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/AutoResizeColumnsTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/AutoResizeColumnsTest.java
index c303d23..4302b3e 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/AutoResizeColumnsTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/resize/AutoResizeColumnsTest.java
@@ -16,6 +16,7 @@
import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer;
import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer;
@@ -31,7 +32,6 @@
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.style.Style;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.util.GCFactory;
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/EditTraversalStrategyUpDownTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/EditTraversalStrategyUpDownTest.java
index f0b7b66..5854617 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/EditTraversalStrategyUpDownTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/EditTraversalStrategyUpDownTest.java
@@ -23,6 +23,8 @@
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.validate.DefaultDataValidator;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.command.EditSelectionCommand;
import org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditBindings;
@@ -33,8 +35,6 @@
import org.eclipse.nebula.widgets.nattable.layer.cell.RowOverrideLabelAccumulator;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.test.integration.SWTUtils;
import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer;
import org.eclipse.swt.SWT;
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/PreserveSelectionModelStructuralChangeEventHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/PreserveSelectionModelStructuralChangeEventHandlerTest.java
index b863cfa..198abc9 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/PreserveSelectionModelStructuralChangeEventHandlerTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/PreserveSelectionModelStructuralChangeEventHandlerTest.java
@@ -24,6 +24,8 @@
import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.hideshow.command.ColumnHideCommand;
import org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand;
import org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllColumnsCommand;
@@ -36,8 +38,6 @@
import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand;
import org.eclipse.nebula.widgets.nattable.selection.preserve.PreserveSelectionModel;
import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture;
import org.junit.Before;
import org.junit.Test;
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionModelStructuralChangeEventHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionModelStructuralChangeEventHandlerTest.java
index d457d7e..5c5c3c2 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionModelStructuralChangeEventHandlerTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionModelStructuralChangeEventHandlerTest.java
@@ -22,6 +22,8 @@
import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent;
import org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent;
@@ -29,8 +31,6 @@
import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand;
import org.eclipse.nebula.widgets.nattable.selection.event.RowSelectionEvent;
import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture;
import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture;
import org.junit.Before;
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionTraversalTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionTraversalTest.java
index a49d963..09badef 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionTraversalTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/RowSelectionTraversalTest.java
@@ -19,11 +19,11 @@
import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum;
import org.eclipse.nebula.widgets.nattable.selection.command.MoveSelectionCommand;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer;
import org.junit.After;
import org.junit.Before;
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionModelStructuralChangeEventHandlerTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionModelStructuralChangeEventHandlerTest.java
index 9560484..e255090 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionModelStructuralChangeEventHandlerTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/selection/SelectionModelStructuralChangeEventHandlerTest.java
@@ -21,6 +21,8 @@
import org.eclipse.nebula.widgets.nattable.data.IRowDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.hideshow.event.HideColumnPositionsEvent;
import org.eclipse.nebula.widgets.nattable.hideshow.event.HideRowPositionsEvent;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
@@ -30,8 +32,6 @@
import org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack;
import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand;
import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture;
import org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture;
import org.junit.Assert;
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/sort/SortStatePersistorTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/sort/SortStatePersistorTest.java
index 9815e88..9f5daec 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/sort/SortStatePersistorTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/sort/SortStatePersistorTest.java
@@ -16,13 +16,13 @@
import java.util.Properties;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
import org.eclipse.nebula.widgets.nattable.sort.ISortModel;
import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum;
import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer;
import org.eclipse.nebula.widgets.nattable.sort.SortStatePersistor;
import org.eclipse.nebula.widgets.nattable.sort.SortStatePersistor.SortState;
import org.eclipse.nebula.widgets.nattable.test.fixture.SortModelFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture;
import org.junit.Before;
import org.junit.Test;
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/summaryrow/SummaryRowIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/summaryrow/SummaryRowIntegrationTest.java
index 2eaca35..28d75e0 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/summaryrow/SummaryRowIntegrationTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/summaryrow/SummaryRowIntegrationTest.java
@@ -22,6 +22,9 @@
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.PricingTypeBean;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.layer.ILayer;
@@ -37,9 +40,6 @@
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.summaryrow.command.CalculateSummaryRowValuesCommand;
import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.PricingTypeBean;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture;
import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer;
import org.eclipse.swt.graphics.Rectangle;
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/data/PersonService.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/data/PersonService.java
deleted file mode 100644
index 2d5002b..0000000
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/data/PersonService.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Original authors and others - initial API and implementation
- ******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.test.data;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Random;
-
-import org.eclipse.nebula.widgets.nattable.test.data.Person.Gender;
-
-/**
- * Class that acts as service for accessing numerous {@link Person}s. The values
- * are randomly put together out of names and places from "The Simpsons"
- */
-public class PersonService {
-
- static String[] maleNames = { "Bart", "Homer", "Lenny", "Carl", "Waylon",
- "Ned", "Timothy", "Rodd", "Todd" };
- static String[] femaleNames = { "Marge", "Lisa", "Maggie", "Edna", "Helen",
- "Jessica", "Maude" };
- static String[] lastNames = { "Simpson", "Leonard", "Carlson", "Smithers",
- "Flanders", "Krabappel", "Lovejoy" };
-
- /**
- * Creates a list of random {@link Person}s.
- *
- * @param numberOfPersons
- * The number of {@link Person}s that should be generated.
- * @return A list containing the given amount of random generated persons.
- */
- public static List<Person> getRandomPersons(int numberOfPersons) {
- List<Person> result = new ArrayList<Person>();
-
- for (int i = 0; i < numberOfPersons; i++) {
- result.add(createPerson(i));
- }
-
- return result;
- }
-
- /**
- * Creates a fixed list of {@link Person}s.
- */
- public static List<Person> getFixedPersons() {
- List<Person> result = new ArrayList<Person>();
-
- // create 10 Simpsons
- // 3 Homer
- result.add(new Person(1, maleNames[1], lastNames[0], Gender.MALE, true,
- new Date(), 100d));
- result.add(new Person(2, maleNames[1], lastNames[0], Gender.MALE, true,
- new Date(), 100d));
- result.add(new Person(3, maleNames[1], lastNames[0], Gender.MALE, true,
- new Date(), 100d));
- // 3 Bart
- result.add(new Person(4, maleNames[0], lastNames[0], Gender.MALE,
- false, new Date(), 100d));
- result.add(new Person(5, maleNames[0], lastNames[0], Gender.MALE,
- false, new Date(), 100d));
- result.add(new Person(6, maleNames[0], lastNames[0], Gender.MALE,
- false, new Date(), 100d));
- // 2 Marge
- result.add(new Person(7, femaleNames[0], lastNames[0], Gender.FEMALE,
- true, new Date(), 100d));
- result.add(new Person(8, femaleNames[0], lastNames[0], Gender.FEMALE,
- true, new Date(), 100d));
- // 2 Lisa
- result.add(new Person(9, femaleNames[1], lastNames[0], Gender.FEMALE,
- false, new Date(), 100d));
- result.add(new Person(10, femaleNames[1], lastNames[0], Gender.FEMALE,
- false, new Date(), 100d));
-
- // create 8 Flanders
- // 2 Ned
- result.add(new Person(11, maleNames[5], lastNames[4], Gender.MALE,
- true, new Date(), 100d));
- result.add(new Person(12, maleNames[5], lastNames[4], Gender.MALE,
- true, new Date(), 100d));
- // 2 Maude
- result.add(new Person(13, femaleNames[6], lastNames[4], Gender.FEMALE,
- true, new Date(), 100d));
- result.add(new Person(14, femaleNames[6], lastNames[4], Gender.FEMALE,
- true, new Date(), 100d));
- // 2 Rod
- result.add(new Person(15, maleNames[7], lastNames[4], Gender.MALE,
- false, new Date(), 100d));
- result.add(new Person(16, maleNames[7], lastNames[4], Gender.MALE,
- false, new Date(), 100d));
- // 2 Tod
- result.add(new Person(17, maleNames[8], lastNames[4], Gender.MALE,
- false, new Date(), 100d));
- result.add(new Person(18, maleNames[8], lastNames[4], Gender.MALE,
- false, new Date(), 100d));
-
- return result;
- }
-
- /**
- * Creates a fixed list of {@link Person}s with a few null values.
- */
- public static List<Person> getFixedPersonsWithNull() {
- List<Person> result = new ArrayList<Person>();
-
- // create 5 Simpsons
- // 2 Homer
- result.add(new Person(1, maleNames[1], lastNames[0], Gender.MALE, true,
- new Date(), 100d));
- result.add(new Person(3, maleNames[1], lastNames[0], Gender.MALE, true,
- new Date(), 100d));
- // 2 Marge
- result.add(new Person(7, femaleNames[0], lastNames[0], Gender.FEMALE,
- true, new Date(), 100d));
- result.add(new Person(8, femaleNames[0], lastNames[0], Gender.FEMALE,
- true, new Date(), 100d));
- // 1 Bart without money
- result.add(new Person(7, femaleNames[0], lastNames[0], Gender.FEMALE,
- true, new Date(), null));
-
- // create 2 Flanders without last name
- // 1 Ned
- result.add(new Person(11, maleNames[5], null, Gender.MALE,
- true, new Date(), 100d));
- // 1 Maude
- result.add(new Person(13, femaleNames[6], null, Gender.FEMALE,
- true, new Date(), 100d));
-
- return result;
- }
-
- public static List<Person> getFixedMixedPersons() {
- List<Person> result = new ArrayList<Person>();
-
- result.add(new Person(21, maleNames[0], lastNames[2], Gender.MALE,
- true, new Date(), 100d));
- result.add(new Person(22, maleNames[1], lastNames[2], Gender.MALE,
- true, new Date(), 100d));
- result.add(new Person(23, maleNames[5], lastNames[2], Gender.MALE,
- true, new Date(), 100d));
- result.add(new Person(24, femaleNames[0], lastNames[2], Gender.FEMALE,
- false, new Date(), 100d));
- result.add(new Person(25, femaleNames[6], lastNames[2], Gender.FEMALE,
- false, new Date(), 100d));
-
- // add doubles
- result.add(new Person(30, maleNames[1], lastNames[0], Gender.MALE,
- true, new Date(), 100d));
- result.add(new Person(31, maleNames[1], lastNames[0], Gender.MALE,
- true, new Date(), 100d));
- result.add(new Person(32, maleNames[1], lastNames[2], Gender.MALE,
- true, new Date(), 100d));
- result.add(new Person(33, maleNames[1], lastNames[2], Gender.MALE,
- true, new Date(), 100d));
-
- return result;
- }
-
- /**
- * Creates a random person out of names which are taken from "The Simpsons"
- * and enrich them with random generated married state and birthday date.
- *
- * @return
- */
- private static Person createPerson(int id) {
- Random randomGenerator = new Random();
-
- Person result = new Person(id);
- result.setGender(Gender.values()[randomGenerator.nextInt(2)]);
-
- if (result.getGender().equals(Gender.MALE)) {
- result.setFirstName(maleNames[randomGenerator.nextInt(maleNames.length)]);
- } else {
- result.setFirstName(femaleNames[randomGenerator.nextInt(femaleNames.length)]);
- }
-
- result.setLastName(lastNames[randomGenerator.nextInt(lastNames.length)]);
- result.setMarried(randomGenerator.nextBoolean());
-
- int month = randomGenerator.nextInt(12);
- int day = 0;
- if (month == 2) {
- day = randomGenerator.nextInt(28);
- } else {
- day = randomGenerator.nextInt(30);
- }
- int year = 1920 + randomGenerator.nextInt(90);
-
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- try {
- result.setBirthday(sdf.parse("" + year + "-" + month + "-" + day));
- } catch (ParseException e) {
- e.printStackTrace();
- }
-
- result.setMoney(randomGenerator.nextDouble() * 100);
- return result;
- }
-}
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/KittenDataProviderFixture.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/KittenDataProviderFixture.java
deleted file mode 100644
index ea9377d..0000000
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/KittenDataProviderFixture.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Original authors and others - initial API and implementation
- ******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.test.fixture.data;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.nebula.widgets.nattable.data.IColumnAccessor;
-import org.eclipse.nebula.widgets.nattable.data.IRowDataProvider;
-import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
-
-/**
- * DataProvider that provides for real row objects.
- */
-public class KittenDataProviderFixture implements
- IRowDataProvider<KittenDataProviderFixture.Kitten> {
-
- private List<Kitten> kittens = new ArrayList<Kitten>();
-
- private IColumnAccessor<Kitten> columnAccessor = new IColumnAccessor<Kitten>() {
-
- @Override
- public int getColumnCount() {
- return 5;
- }
-
- @Override
- @SuppressWarnings("boxing")
- public Object getDataValue(Kitten k, int columnIndex) {
- if (columnIndex == 0)
- return k.getName();
- else if (columnIndex == 1)
- return k.getAge();
- else if (columnIndex == 2)
- return k.getColor();
- else if (columnIndex == 3)
- return k.getWeight();
- else if (columnIndex == 4)
- return k.getFavoriteToy();
- else
- throw new IllegalArgumentException("unknown column "
- + columnIndex);
- }
-
- @Override
- public void setDataValue(Kitten rowObj, int columnIndex, Object newValue) {
- throw new UnsupportedOperationException();
- }
-
- };
-
- private IRowIdAccessor<KittenDataProviderFixture.Kitten> rowIdAccessor = new IRowIdAccessor<KittenDataProviderFixture.Kitten>() {
- @Override
- public Serializable getRowId(Kitten k) {
- return k.getName();
- }
- };
-
- public KittenDataProviderFixture() {
- this.kittens.add(new Kitten("Tabitha", 2, "Orange", .5, "Grass"));
- this.kittens.add(new Kitten("Midnighter", 3, "Black", .7, "Tabitha"));
- this.kittens.add(new Kitten("Lightning", 1, "Black and White", .25, "Wind"));
- }
-
- @Override
- public int getColumnCount() {
- return this.columnAccessor.getColumnCount();
- }
-
- @Override
- public int getRowCount() {
- return this.kittens.size();
- }
-
- @Override
- public Object getDataValue(int columnIndex, int rowIndex) {
- return this.columnAccessor.getDataValue(getRowObject(rowIndex), columnIndex);
- }
-
- @Override
- public void setDataValue(int columnIndex, int rowIndex, Object newValue) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Kitten getRowObject(int rowIndex) {
- return this.kittens.get(rowIndex);
- }
-
- @Override
- public int indexOfRowObject(Kitten rowObject) {
- return this.kittens.indexOf(rowObject);
- }
-
- public IColumnAccessor<Kitten> getColumnAccessor() {
- return this.columnAccessor;
- }
-
- public IRowIdAccessor<Kitten> getRowIdAccessor() {
- return this.rowIdAccessor;
- }
-
- public static class Kitten {
-
- private String name;
-
- private int age;
-
- private String color;
-
- private double weight;
-
- private String favoriteToy;
-
- public Kitten(String name, int age, String color, double weight,
- String favoriteToy) {
- if (name == null || color == null || favoriteToy == null)
- throw new IllegalArgumentException("null");
- this.name = name;
- this.age = age;
- this.color = color;
- this.weight = weight;
- this.favoriteToy = favoriteToy;
- }
-
- public String getName() {
- return this.name;
- }
-
- public int getAge() {
- return this.age;
- }
-
- public String getColor() {
- return this.color;
- }
-
- public double getWeight() {
- return this.weight;
- }
-
- public String getFavoriteToy() {
- return this.favoriteToy;
- }
- }
-
-}
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/PricingTypeBean.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/PricingTypeBean.java
deleted file mode 100644
index 29d32ec..0000000
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/PricingTypeBean.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Original authors and others - initial API and implementation
- ******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.test.fixture.data;
-
-import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
-import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
-
-/**
- * Bean representing the pricing type. Used as the canonical data source for the
- * combo box - used to test the canonical to display conversion
- */
-public class PricingTypeBean implements Comparable<PricingTypeBean> {
- public String type;
-
- public PricingTypeBean(String type) {
- this.type = type;
- }
-
- @Override
- public String toString() {
- return this.type;
- }
-
- /**
- * Format: Items displayed in the Combo <-> Canonical value
- */
- public static IDisplayConverter getDisplayConverter() {
- return new DisplayConverter() {
- @Override
- public Object canonicalToDisplayValue(Object canonicalValue) {
- if (canonicalValue == null) {
- return null;
- } else {
- return canonicalValue.toString().equals("MN") ? "Manual"
- : "Automatic";
- }
- }
-
- @Override
- public Object displayToCanonicalValue(Object displayValue) {
- return displayValue.toString().equals("Manual") ? new PricingTypeBean(
- "MN") : new PricingTypeBean("AT");
- }
- };
- }
-
- @Override
- public int compareTo(PricingTypeBean o) {
- return this.toString().compareTo(o.toString());
- }
-
-}
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/RowDataFixture.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/RowDataFixture.java
deleted file mode 100644
index 935cd10..0000000
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/RowDataFixture.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Original authors and others - initial API and implementation
- ******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.test.fixture.data;
-
-import static org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture.PRICING_MANUAL;
-import static org.eclipse.nebula.widgets.nattable.util.ObjectUtils.getRandomDate;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
-import org.eclipse.nebula.widgets.nattable.util.ObjectUtils;
-
-public class RowDataFixture {
-
- public String security_id;
- public String security_description;
- public String rating;
- public Date issue_date;
- public PricingTypeBean pricing_type;
- public double bid_price;
- public double ask_price;
- public int lot_size;
- public boolean publish_flag;
-
- public double high52Week;
- public double low52Week;
- public double eps;
- public double volume;
- public double marketCap;
- public double institutionOwned;
-
- public String field20;
- public String field21;
- public String field22;
- public String field23;
- public String field24;
- public String field25;
- public String field26;
- public String field27;
- public String field28;
- public String field29;
- public String field30;
-
- public boolean field31;
- public boolean field32;
- public Date field33;
- public Date field34;
- public double field35;
- public double field36;
- public double field37;
- public double field38;
- public double field39;
- public double field40;
-
- public static final IRowIdAccessor<RowDataFixture> rowIdAccessor = new IRowIdAccessor<RowDataFixture>() {
- @Override
- public Serializable getRowId(RowDataFixture rowObject) {
- return rowObject.getSecurity_description();
- }
- };
-
- public RowDataFixture(String security_id, String security_description,
- String rating, Date issue_date, PricingTypeBean pricing_type,
- double bid_price, double ask_price, int lot_size,
- boolean publish_flag, double high52Week, double low52Week,
- double eps, double volume, double marketCap, double institutionOwned) {
- super();
- this.security_id = security_id;
- this.security_description = security_description;
- this.rating = rating;
- this.issue_date = issue_date;
- this.pricing_type = pricing_type;
- this.bid_price = bid_price;
- this.ask_price = ask_price;
- this.lot_size = lot_size;
- this.publish_flag = publish_flag;
- this.high52Week = high52Week;
- this.low52Week = low52Week;
- this.eps = eps;
- this.volume = volume;
- this.marketCap = marketCap;
- this.institutionOwned = institutionOwned;
-
- // Filler
- this.field20 = "field20";
- this.field21 = "field21";
- this.field22 = "field22";
- this.field23 = "field23";
- this.field24 = "field24";
- this.field25 = "field25";
- this.field26 = "field26";
- this.field27 = "field27";
- this.field28 = "field28";
- this.field29 = "field29";
- this.field30 = "field30";
-
- this.field31 = true;
- this.field32 = false;
- this.field33 = new Date(45124575);
- this.field34 = new Date(754512457);
- this.field35 = 350000;
- this.field36 = 360000;
- this.field37 = 370000;
- this.field38 = 380000;
- this.field39 = 390000;
- this.field40 = 400000;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- RowDataFixture other = (RowDataFixture) obj;
- if (this.issue_date == null) {
- if (other.issue_date != null)
- return false;
- } else if (!this.issue_date.equals(other.issue_date))
- return false;
- if (this.security_id == null) {
- if (other.security_id != null)
- return false;
- } else if (!this.security_id.equals(other.security_id))
- return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((this.issue_date == null) ? 0 : this.issue_date.hashCode());
- result = prime * result + ((this.security_id == null) ? 0 : this.security_id.hashCode());
- return result;
- }
-
- /**
- * Convenience method to quickly get a new instance
- */
- public static RowDataFixture getInstance(String descrition, String rating) {
- return new RowDataFixture("US" + ObjectUtils.getRandomNumber(1000),
- descrition, rating, getRandomDate(), PRICING_MANUAL, 1.000, 10,
- 1000, true, 1.00, 1.01, -.01, 1000, 1000, 1000D);
- }
-
- @Override
- public String toString() {
- return "RowDataFixture [security_id=" + this.security_id + ", security_description=" + this.security_description + ", rating=" + this.rating
- + ", issue_date="
- + this.issue_date + ", pricing_type=" + this.pricing_type + ", bid_price=" + this.bid_price + ", ask_price=" + this.ask_price + ", lot_size="
- + this.lot_size
- + ", publish_flag=" + this.publish_flag + ", high52Week=" + this.high52Week + ", low52Week=" + this.low52Week + ", eps=" + this.eps
- + ", volume=" + this.volume
- + ", marketCap=" + this.marketCap + ", institutionOwned=" + this.institutionOwned + ", field20=" + this.field20 + ", field21=" + this.field21
- + ", field22="
- + this.field22 + ", field23=" + this.field23 + ", field24=" + this.field24 + ", field25=" + this.field25 + ", field26=" + this.field26
- + ", field27=" + this.field27
- + ", field28=" + this.field28 + ", field29=" + this.field29 + ", field30=" + this.field30 + ", field31=" + this.field31 + ", field32="
- + this.field32 + ", field33="
- + this.field33 + ", field34=" + this.field34 + ", field35=" + this.field35 + ", field36=" + this.field36 + ", field37=" + this.field37
- + ", field38=" + this.field38
- + ", field39=" + this.field39 + ", field40=" + this.field40 + "]";
- }
-
- public String getSecurity_id() {
- return this.security_id;
- }
-
- public void setSecurity_id(String security_id) {
- this.security_id = security_id;
- }
-
- public String getSecurity_description() {
- return this.security_description;
- }
-
- public void setSecurity_description(String security_description) {
- this.security_description = security_description;
- }
-
- public String getRating() {
- return this.rating;
- }
-
- public void setRating(String rating) {
- this.rating = rating;
- }
-
- public Date getIssue_date() {
- return this.issue_date;
- }
-
- public void setIssue_date(Date issue_date) {
- this.issue_date = issue_date;
- }
-
- public PricingTypeBean getPricing_type() {
- return this.pricing_type;
- }
-
- public void setPricing_type(PricingTypeBean pricing_type) {
- this.pricing_type = pricing_type;
- }
-
- public double getBid_price() {
- return this.bid_price;
- }
-
- public void setBid_price(double bid_price) {
- this.bid_price = bid_price;
- }
-
- public double getAsk_price() {
- return this.ask_price;
- }
-
- public void setAsk_price(double ask_price) {
- this.ask_price = ask_price;
- }
-
- public int getLot_size() {
- return this.lot_size;
- }
-
- public void setLot_size(int lot_size) {
- this.lot_size = lot_size;
- }
-
- public boolean isPublish_flag() {
- return this.publish_flag;
- }
-
- public void setPublish_flag(boolean publish_flag) {
- this.publish_flag = publish_flag;
- }
-
- public double getSpread() {
- return this.ask_price - this.bid_price;
- }
-
- public double getHigh52Week() {
- return this.high52Week;
- }
-
- public void setHigh52Week(double high52Week) {
- this.high52Week = high52Week;
- }
-
- public double getLow52Week() {
- return this.low52Week;
- }
-
- public void setLow52Week(double low52Week) {
- this.low52Week = low52Week;
- }
-
- public double getEps() {
- return this.eps;
- }
-
- public void setEps(double eps) {
- this.eps = eps;
- }
-
- public double getVolume() {
- return this.volume;
- }
-
- public void setVolume(double volume) {
- this.volume = volume;
- }
-
- public double getMarketCap() {
- return this.marketCap;
- }
-
- public void setMarketCap(double marketCap) {
- this.marketCap = marketCap;
- }
-
- public double getInstitutionOwned() {
- return this.institutionOwned;
- }
-
- public void setInstitutionOwned(double institutionOwned) {
- this.institutionOwned = institutionOwned;
- }
-
- public String getField20() {
- return this.field20;
- }
-
- public void setField20(String field20) {
- this.field20 = field20;
- }
-
- public String getField21() {
- return this.field21;
- }
-
- public void setField21(String field21) {
- this.field21 = field21;
- }
-
- public String getField22() {
- return this.field22;
- }
-
- public void setField22(String field22) {
- this.field22 = field22;
- }
-
- public String getField23() {
- return this.field23;
- }
-
- public void setField23(String field23) {
- this.field23 = field23;
- }
-
- public String getField24() {
- return this.field24;
- }
-
- public void setField24(String field24) {
- this.field24 = field24;
- }
-
- public String getField25() {
- return this.field25;
- }
-
- public void setField25(String field25) {
- this.field25 = field25;
- }
-
- public String getField26() {
- return this.field26;
- }
-
- public void setField26(String field26) {
- this.field26 = field26;
- }
-
- public String getField27() {
- return this.field27;
- }
-
- public void setField27(String field27) {
- this.field27 = field27;
- }
-
- public String getField28() {
- return this.field28;
- }
-
- public void setField28(String field28) {
- this.field28 = field28;
- }
-
- public String getField29() {
- return this.field29;
- }
-
- public void setField29(String field29) {
- this.field29 = field29;
- }
-
- public String getField30() {
- return this.field30;
- }
-
- public void setField30(String field30) {
- this.field30 = field30;
- }
-
- public boolean isField31() {
- return this.field31;
- }
-
- public void setField31(boolean field31) {
- this.field31 = field31;
- }
-
- public boolean isField32() {
- return this.field32;
- }
-
- public void setField32(boolean field32) {
- this.field32 = field32;
- }
-
- public Date getField33() {
- return this.field33;
- }
-
- public void setField33(Date field33) {
- this.field33 = field33;
- }
-
- public Date getField34() {
- return this.field34;
- }
-
- public void setField34(Date field34) {
- this.field34 = field34;
- }
-
- public double getField35() {
- return this.field35;
- }
-
- public void setField35(double field35) {
- this.field35 = field35;
- }
-
- public double getField36() {
- return this.field36;
- }
-
- public void setField36(double field36) {
- this.field36 = field36;
- }
-
- public double getField37() {
- return this.field37;
- }
-
- public void setField37(double field37) {
- this.field37 = field37;
- }
-
- public double getField38() {
- return this.field38;
- }
-
- public void setField38(double field38) {
- this.field38 = field38;
- }
-
- public double getField39() {
- return this.field39;
- }
-
- public void setField39(double field39) {
- this.field39 = field39;
- }
-
- public double getField40() {
- return this.field40;
- }
-
- public void setField40(double field40) {
- this.field40 = field40;
- }
-}
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/RowDataListFixture.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/RowDataListFixture.java
deleted file mode 100644
index b4e3ab1..0000000
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/RowDataListFixture.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Original authors and others - initial API and implementation
- ******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.test.fixture.data;
-
-import static org.eclipse.nebula.widgets.nattable.util.ObjectUtils.getRandomDate;
-import static org.eclipse.nebula.widgets.nattable.util.ObjectUtils.getRandomNumber;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-public class RowDataListFixture {
-
- public static final String LOT_SIZE_PROP_NAME = "lot_size";
- public static final String SECURITY_ID_PROP_NAME = "security_id";
- public static final String SECURITY_DESCRIPTION_PROP_NAME = "security_description";
- public static final String RATING_PROP_NAME = "rating";
- public static final String ISSUE_DATE_PROP_NAME = "issue_date";
- public static final String PRICING_TYPE_PROP_NAME = "pricing_type";
- public static final String BID_PRICE_PROP_NAME = "bid_price";
- public static final String ASK_PRICE_PROP_NAME = "ask_price";
- public static final String SPREAD_PROP_NAME = "spread";
- public static final String PUBLISH_FLAG_PROP_NAME = "publish_flag";
-
- public static final String HIGH_52_WEEK_PROP_NAME = "high52Week";
- public static final String LOW_52_WEEK_PROP_NAME = "low52Week";
- public static final String EPS_PROP_NAME = "eps";
- public static final String VOLUME_PROP_NAME = "volume";
- public static final String MARKET_CAP_PROP_NAME = "marketCap";
- public static final String INSTITUTION_OWNED_PROP_NAME = "institutionOwned";
-
- public static final String FIELD_20_PROP_NAME = "field20";
- public static final String FIELD_21_PROP_NAME = "field21";
- public static final String FIELD_22_PROP_NAME = "field22";
- public static final String FIELD_23_PROP_NAME = "field23";
- public static final String FIELD_24_PROP_NAME = "field24";
- public static final String FIELD_25_PROP_NAME = "field25";
- public static final String FIELD_26_PROP_NAME = "field26";
- public static final String FIELD_27_PROP_NAME = "field27";
- public static final String FIELD_28_PROP_NAME = "field28";
- public static final String FIELD_29_PROP_NAME = "field29";
- public static final String FIELD_30_PROP_NAME = "field30";
-
- public static final String FIELD_31_PROP_NAME = "field31";
- public static final String FIELD_32_PROP_NAME = "field32";
- public static final String FIELD_33_PROP_NAME = "field33";
- public static final String FIELD_34_PROP_NAME = "field34";
- public static final String FIELD_35_PROP_NAME = "field35";
- public static final String FIELD_36_PROP_NAME = "field36";
- public static final String FIELD_37_PROP_NAME = "field37";
- public static final String FIELD_38_PROP_NAME = "field38";
- public static final String FIELD_39_PROP_NAME = "field39";
- public static final String FIELD_40_PROP_NAME = "field40";
-
- public static final PricingTypeBean PRICING_MANUAL = new PricingTypeBean(
- "MN");
- public static final PricingTypeBean PRICING_AUTO = new PricingTypeBean("AT");
-
- /**
- * @return list containing 13 {@link RowDataFixture}. The ISIN is unique and
- * randomly generated.
- */
- public static List<RowDataFixture> getList() {
- List<RowDataFixture> listFixture = new ArrayList<RowDataFixture>();
- listFixture.addAll(Arrays.asList(new RowDataFixture("US"
- + getRandomNumber(), "B Ford Motor", "a", new Date(),
- PRICING_MANUAL, 4.7912, 20, 1500000, true, 6.75, 1.01, -7.03,
- 114000000, 2000000000, 5000000000D), new RowDataFixture("ABC"
- + getRandomNumber(), "A Alphabet Co.", "AAA", getRandomDate(),
- PRICING_AUTO, 1.23456, 10, 10000, true, 5.124, .506, 1.233,
- 2000000, 50000000, 4500000), new RowDataFixture("US"
- + getRandomNumber(), "C General Electric Co", "B",
- getRandomDate(), PRICING_MANUAL, 10.1244, 30, 1500000, false,
- 30.74, 5.73, 1.62, 93350000, 142000000, 70000000),
- new RowDataFixture("US" + getRandomNumber(),
- "E Nissan Motor Co., Ltd.", "AA", getRandomDate(),
- PRICING_MANUAL, 7.7891, 50, 80000, true, 17.97, 5.59,
- 0.50, 489000, 250000000, 250000), new RowDataFixture(
- "US" + getRandomNumber(), "D Toyota Motor Corp.",
- "aaa", getRandomDate(), PRICING_MANUAL, 62.5789, 40,
- 450000, true, 104.40, 55.41, -2.85, 849000, 1242000000,
- 2000000), new RowDataFixture("US" + getRandomNumber(),
- "F Honda Motor Co., Ltd.", "aa", getRandomDate(),
- PRICING_MANUAL, 23.7125, 60, 6500000, false, 36.29,
- 17.35, -21.83, 1050000, 53000000, 70000),
- new RowDataFixture("US" + getRandomNumber(),
- "G General Motors Corporation", "B-", getRandomDate(),
- PRICING_MANUAL, 2.9811, 70, 2585000, true, 18.18, .27,
- .110, 58714700, 25900000, 2800000),
- new RowDataFixture("US" + getRandomNumber(), "H Yahoo! Inc",
- "C", new Date(), PRICING_AUTO, 12.9811, 80, 99000,
- true, 26.86, 8.94, 0.00, 22000000, 22740000000D,
- 14000000000D), new RowDataFixture("US"
- + getRandomNumber(), "I Microsoft", "BB",
- getRandomDate(), PRICING_AUTO, 22.5506, 90, 6250000,
- false, 29.57, 14.87, 1.74, 57000000, 196000000000D,
- 80000000000D), new RowDataFixture("US"
- + getRandomNumber(), "J Google Inc.", "AAA",
- getRandomDate(), PRICING_AUTO, 330.9315, 100, 8550000,
- true, 579.10, 247.30, 13.67, 3000000, 136000000000D,
- 70000000000D), new RowDataFixture("US"
- + getRandomNumber(), "K Research In Motion Limited",
- "AA", getRandomDate(), PRICING_MANUAL, 43.0311, 110,
- 55000, true, 150.30, 44.23, 3.67, 587295, 51000000000D,
- 0), new RowDataFixture("US" + getRandomNumber(),
- "L Apple Inc.", "AAA", getRandomDate(), PRICING_AUTO,
- 102.4817, 120, 115000, false, 186.78, 78.20, 1.67,
- 17000000, 125000000000D, 14000000000D),
- new RowDataFixture("US" + getRandomNumber(), "M Nokia Corp.",
- "A-", getRandomDate(), PRICING_AUTO, 12.0500, 130,
- 315000, true, 28.34, 8.47, 1.08, 17390000,
- 58400000000D, 10000000000D)));
-
- return listFixture;
- }
-
- public static List<RowDataFixture> getList(int listSize) {
- List<RowDataFixture> largeList = new ArrayList<RowDataFixture>();
- final int smallListSize = getList().size();
-
- for (int i = 0; i < listSize / smallListSize; i++) {
- largeList.addAll(getList());
- }
- final int remainder = listSize % smallListSize;
- largeList.addAll(getList().subList(0, remainder));
- return largeList;
- }
-
- public static String[] getPropertyNames() {
- return new String[] {
- SECURITY_ID_PROP_NAME, // string w/format validation AAA000
- SECURITY_DESCRIPTION_PROP_NAME, // free text
- RATING_PROP_NAME, // combo: aaa, aa, a, etc
- ISSUE_DATE_PROP_NAME, // date w/formatting
- PRICING_TYPE_PROP_NAME, // combo: manual, automatic
- BID_PRICE_PROP_NAME, // float w/decimal place formatting
- // (ticking)
- ASK_PRICE_PROP_NAME, // float w/decimal place formatting
- // (ticking)
- SPREAD_PROP_NAME, // calculated: ask - bid (ticking)
- LOT_SIZE_PROP_NAME, // integer (ticking)
- PUBLISH_FLAG_PROP_NAME, HIGH_52_WEEK_PROP_NAME,
- LOW_52_WEEK_PROP_NAME, EPS_PROP_NAME, VOLUME_PROP_NAME,
- MARKET_CAP_PROP_NAME, INSTITUTION_OWNED_PROP_NAME,
- FIELD_20_PROP_NAME, FIELD_21_PROP_NAME, FIELD_22_PROP_NAME,
- FIELD_23_PROP_NAME, FIELD_24_PROP_NAME, FIELD_25_PROP_NAME,
- FIELD_26_PROP_NAME, FIELD_27_PROP_NAME, FIELD_28_PROP_NAME,
- FIELD_29_PROP_NAME, FIELD_30_PROP_NAME, FIELD_31_PROP_NAME,
- FIELD_32_PROP_NAME, FIELD_33_PROP_NAME, FIELD_34_PROP_NAME,
- FIELD_35_PROP_NAME, FIELD_36_PROP_NAME, FIELD_37_PROP_NAME,
- FIELD_38_PROP_NAME, FIELD_39_PROP_NAME, FIELD_40_PROP_NAME };
- }
-
- public static Map<String, String> getPropertyToLabelMap() {
- Map<String, String> propertyToLabelMap = new LinkedHashMap<String, String>();
- propertyToLabelMap.put(SECURITY_ID_PROP_NAME, "ISIN");
- propertyToLabelMap.put(SECURITY_DESCRIPTION_PROP_NAME, "Sec Desc");
- // rating
- propertyToLabelMap.put(ISSUE_DATE_PROP_NAME, "Issue Date");
- propertyToLabelMap.put(PRICING_TYPE_PROP_NAME, "Pricing Type");
- propertyToLabelMap.put(BID_PRICE_PROP_NAME, "Bid");
- propertyToLabelMap.put(ASK_PRICE_PROP_NAME, "Ask");
- // spread
- propertyToLabelMap.put(LOT_SIZE_PROP_NAME, "Size (mil)");
- propertyToLabelMap.put(PUBLISH_FLAG_PROP_NAME, "Publish");
-
- propertyToLabelMap.put(HIGH_52_WEEK_PROP_NAME, "52 Week High");
- propertyToLabelMap.put(LOW_52_WEEK_PROP_NAME, "52 Week Low");
- propertyToLabelMap.put(EPS_PROP_NAME, "EPS");
- propertyToLabelMap.put(VOLUME_PROP_NAME, "Volume");
- propertyToLabelMap.put(MARKET_CAP_PROP_NAME, "Market Cap.");
- propertyToLabelMap
- .put(INSTITUTION_OWNED_PROP_NAME, "Institution Owned");
-
- propertyToLabelMap.put(FIELD_20_PROP_NAME, "Field 20");
- propertyToLabelMap.put(FIELD_21_PROP_NAME, "Field 21");
- propertyToLabelMap.put(FIELD_22_PROP_NAME, "Field 22");
- propertyToLabelMap.put(FIELD_23_PROP_NAME, "Field 23");
- propertyToLabelMap.put(FIELD_24_PROP_NAME, "Field 24");
- propertyToLabelMap.put(FIELD_25_PROP_NAME, "Field 25");
- propertyToLabelMap.put(FIELD_26_PROP_NAME, "Field 26");
- propertyToLabelMap.put(FIELD_27_PROP_NAME, "Field 27");
- propertyToLabelMap.put(FIELD_28_PROP_NAME, "Field 28");
- propertyToLabelMap.put(FIELD_29_PROP_NAME, "Field 29");
- propertyToLabelMap.put(FIELD_30_PROP_NAME, "Field 30");
-
- propertyToLabelMap.put(FIELD_31_PROP_NAME, "Field 31");
- propertyToLabelMap.put(FIELD_32_PROP_NAME, "Field 32");
- propertyToLabelMap.put(FIELD_33_PROP_NAME, "Field 33");
- propertyToLabelMap.put(FIELD_34_PROP_NAME, "Field 34");
- propertyToLabelMap.put(FIELD_35_PROP_NAME, "Field 35");
- propertyToLabelMap.put(FIELD_36_PROP_NAME, "Field 36");
- propertyToLabelMap.put(FIELD_37_PROP_NAME, "Field 37");
- propertyToLabelMap.put(FIELD_38_PROP_NAME, "Field 38");
- propertyToLabelMap.put(FIELD_39_PROP_NAME, "Field 39");
- propertyToLabelMap.put(FIELD_40_PROP_NAME, "Field 40");
-
- return propertyToLabelMap;
- }
-
- public static List<String> getPropertyNamesAsList() {
- return Arrays.asList(RowDataListFixture.getPropertyNames());
- }
-
- /**
- * Get the index of the property name. This will be same as the order in
- * which the columns/properties were initially supplied.
- */
- public static int getColumnIndexOfProperty(String propertyName) {
- return RowDataListFixture.getPropertyNamesAsList()
- .indexOf(propertyName);
- }
-}
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/EditIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/EditIntegrationTest.java
index 5e9d9ad..dea3c60 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/EditIntegrationTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/integration/EditIntegrationTest.java
@@ -27,6 +27,8 @@
import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator;
import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.PricingTypeBean;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.edit.ActiveCellEditorRegistry;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.command.EditCellCommand;
@@ -57,8 +59,6 @@
import org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.PricingTypeBean;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer;
import org.eclipse.nebula.widgets.nattable.widget.NatCombo;
import org.eclipse.swt.SWT;
diff --git a/org.eclipse.nebula.widgets.nattable.dataset/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.dataset/META-INF/MANIFEST.MF
index c220e64..00077c7 100644
--- a/org.eclipse.nebula.widgets.nattable.dataset/META-INF/MANIFEST.MF
+++ b/org.eclipse.nebula.widgets.nattable.dataset/META-INF/MANIFEST.MF
@@ -1,12 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: NatTable Dataset Utilities
+Bundle-Name: NatTable Dataset Utilities (internal usage)
Bundle-SymbolicName: org.eclipse.nebula.widgets.nattable.dataset
Bundle-Version: 1.4.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Export-Package: org.eclipse.nebula.widgets.nattable.dataset.generator,
- org.eclipse.nebula.widgets.nattable.dataset.pricing,
- org.eclipse.nebula.widgets.nattable.dataset.pricing.valuegenerator,
- org.eclipse.nebula.widgets.nattable.dataset.valuegenerator
+Export-Package: org.eclipse.nebula.widgets.nattable.dataset;version="1.4.0",
+ org.eclipse.nebula.widgets.nattable.dataset.fixture.data;version="1.4.0",
+ org.eclipse.nebula.widgets.nattable.dataset.generator;version="1.4.0",
+ org.eclipse.nebula.widgets.nattable.dataset.person;version="1.4.0",
+ org.eclipse.nebula.widgets.nattable.dataset.pricing;version="1.4.0",
+ org.eclipse.nebula.widgets.nattable.dataset.pricing.valuegenerator;version="1.4.0",
+ org.eclipse.nebula.widgets.nattable.dataset.valuegenerator;version="1.4.0"
Bundle-Vendor: Eclipse Nebula NatTable
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/EventData.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/EventData.java
similarity index 90%
rename from org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/EventData.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/EventData.java
index 3b5a7af..3623f04 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/EventData.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/EventData.java
@@ -1,21 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.examples.data;
+package org.eclipse.nebula.widgets.nattable.dataset;
import java.util.Date;
-/**
- * @author Dirk Fauth
- *
- */
public class EventData {
private String title;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/NumberValues.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/NumberValues.java
similarity index 95%
rename from org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/NumberValues.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/NumberValues.java
index 2ae921a..7703501 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/NumberValues.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/NumberValues.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.examples.data;
+package org.eclipse.nebula.widgets.nattable.dataset;
public class NumberValues {
private int columnOneNumber;
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/BlinkingRowDataFixture.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/BlinkingRowDataFixture.java
similarity index 88%
rename from org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/BlinkingRowDataFixture.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/BlinkingRowDataFixture.java
index ac1511b..4fe30d0 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/BlinkingRowDataFixture.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/BlinkingRowDataFixture.java
@@ -8,16 +8,13 @@
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.test.fixture.data;
+package org.eclipse.nebula.widgets.nattable.dataset.fixture.data;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
-
/**
* Bean wired with a property change listener for Glazed lists. See Glazed Lists
* ObservableElementList Screencast for details
@@ -28,13 +25,6 @@
private PropertyChangeSupport support = new PropertyChangeSupport(this);
private final PropertyChangeListener changeListener;
- public static final IRowIdAccessor<BlinkingRowDataFixture> rowIdAccessor = new IRowIdAccessor<BlinkingRowDataFixture>() {
- @Override
- public Serializable getRowId(BlinkingRowDataFixture rowObject) {
- return rowObject.getSecurity_description();
- }
- };
-
public BlinkingRowDataFixture(PropertyChangeListener changeListener, RowDataFixture rowDataFixture) {
super(rowDataFixture.getSecurity_id(),
rowDataFixture.getSecurity_description(),
diff --git a/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/PricingTypeBean.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/PricingTypeBean.java
new file mode 100644
index 0000000..91878a0
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/PricingTypeBean.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Original authors and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Original authors and others - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.nebula.widgets.nattable.dataset.fixture.data;
+
+/**
+ * Bean representing the pricing type. Used as the canonical data source for the
+ * combo box - used to test the canonical to display conversion
+ */
+public class PricingTypeBean implements Comparable<PricingTypeBean> {
+ public String type;
+
+ public PricingTypeBean(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return this.type;
+ }
+
+ @Override
+ public int compareTo(PricingTypeBean o) {
+ return this.toString().compareTo(o.toString());
+ }
+
+}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/stock/RowDataFixture.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/RowDataFixture.java
similarity index 92%
rename from org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/stock/RowDataFixture.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/RowDataFixture.java
index 71acc48..4558207 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/stock/RowDataFixture.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/RowDataFixture.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,15 +8,12 @@
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.examples.data.stock;
+package org.eclipse.nebula.widgets.nattable.dataset.fixture.data;
-import static org.eclipse.nebula.widgets.nattable.util.ObjectUtils.getRandomDate;
+import static org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture.PRICING_MANUAL;
-import java.io.Serializable;
import java.util.Date;
-
-import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
-import org.eclipse.nebula.widgets.nattable.util.ObjectUtils;
+import java.util.Random;
public class RowDataFixture {
@@ -60,13 +57,6 @@
public double field39;
public double field40;
- public static final IRowIdAccessor<RowDataFixture> rowIdAccessor = new IRowIdAccessor<RowDataFixture>() {
- @Override
- public Serializable getRowId(RowDataFixture rowObject) {
- return rowObject.getSecurity_description();
- }
- };
-
public RowDataFixture(String security_id, String security_description,
String rating, Date issue_date, PricingTypeBean pricing_type,
double bid_price, double ask_price, int lot_size,
@@ -115,15 +105,6 @@
}
@Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((this.issue_date == null) ? 0 : this.issue_date.hashCode());
- result = prime * result + ((this.security_id == null) ? 0 : this.security_id.hashCode());
- return result;
- }
-
- @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -145,14 +126,45 @@
return true;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((this.issue_date == null) ? 0 : this.issue_date.hashCode());
+ result = prime * result + ((this.security_id == null) ? 0 : this.security_id.hashCode());
+ return result;
+ }
+
/**
* Convenience method to quickly get a new instance
*/
public static RowDataFixture getInstance(String descrition, String rating) {
- return new RowDataFixture("US" + ObjectUtils.getRandomNumber(1000),
- descrition, rating, getRandomDate(),
- RowDataListFixture.PRICING_MANUAL, 1.000, 10, 1000, true, 1.00,
- 1.01, -.01, 1000, 1000, 1000D);
+ return new RowDataFixture("US" + getRandomNumber(1000),
+ descrition, rating, getRandomDate(), PRICING_MANUAL, 1.000, 10,
+ 1000, true, 1.00, 1.01, -.01, 1000, 1000, 1000D);
+ }
+
+ private static final Random RANDOM = new Random();
+
+ /**
+ * @return a random Date
+ */
+ public static Date getRandomDate() {
+ return new Date(RANDOM.nextLong());
+ }
+
+ /**
+ * @return 4 digit random Integer number
+ */
+ public static int getRandomNumber() {
+ return RANDOM.nextInt(10000);
+ }
+
+ /**
+ * @return random Integer number between 0 and parameter max
+ */
+ public static int getRandomNumber(int max) {
+ return RANDOM.nextInt(max);
}
@Override
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/stock/RowDataListFixture.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/RowDataListFixture.java
similarity index 75%
rename from org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/stock/RowDataListFixture.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/RowDataListFixture.java
index 398b56d..baf0f75 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/stock/RowDataListFixture.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/RowDataListFixture.java
@@ -8,10 +8,7 @@
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.examples.data.stock;
-
-import static org.eclipse.nebula.widgets.nattable.util.ObjectUtils.getRandomDate;
-import static org.eclipse.nebula.widgets.nattable.util.ObjectUtils.getRandomNumber;
+package org.eclipse.nebula.widgets.nattable.dataset.fixture.data;
import java.util.ArrayList;
import java.util.Arrays;
@@ -73,52 +70,61 @@
*/
public static List<RowDataFixture> getList() {
List<RowDataFixture> listFixture = new ArrayList<RowDataFixture>();
- listFixture.addAll(Arrays.asList(new RowDataFixture("US"
- + getRandomNumber(), "B Ford Motor", "a", new Date(),
- PRICING_MANUAL, 4.7912, 20, 1500000, true, 6.75, 1.01, -7.03,
- 114000000, 2000000000, 5000000000D), new RowDataFixture("ABC"
- + getRandomNumber(), "A Alphabet Co.", "AAA", getRandomDate(),
- PRICING_AUTO, 1.23456, 10, 10000, true, 5.124, .506, 1.233,
- 2000000, 50000000, 4500000), new RowDataFixture("US"
- + getRandomNumber(), "C General Electric Co", "B",
- getRandomDate(), PRICING_MANUAL, 10.1244, 30, 1500000, false,
- 30.74, 5.73, 1.62, 93350000, 142000000, 70000000),
- new RowDataFixture("US" + getRandomNumber(),
- "E Nissan Motor Co., Ltd.", "AA", getRandomDate(),
+ listFixture.addAll(Arrays.asList(
+ new RowDataFixture("US"
+ + RowDataFixture.getRandomNumber(), "B Ford Motor", "a", new Date(),
+ PRICING_MANUAL, 4.7912, 20, 1500000, true, 6.75, 1.01, -7.03,
+ 114000000, 2000000000, 5000000000D),
+ new RowDataFixture("ABC"
+ + RowDataFixture.getRandomNumber(), "A Alphabet Co.", "AAA", RowDataFixture.getRandomDate(),
+ PRICING_AUTO, 1.23456, 10, 10000, true, 5.124, .506, 1.233,
+ 2000000, 50000000, 4500000),
+ new RowDataFixture("US"
+ + RowDataFixture.getRandomNumber(), "C General Electric Co", "B",
+ RowDataFixture.getRandomDate(), PRICING_MANUAL, 10.1244, 30, 1500000, false,
+ 30.74, 5.73, 1.62, 93350000, 142000000, 70000000),
+ new RowDataFixture("US" + RowDataFixture.getRandomNumber(),
+ "E Nissan Motor Co., Ltd.", "AA", RowDataFixture.getRandomDate(),
PRICING_MANUAL, 7.7891, 50, 80000, true, 17.97, 5.59,
- 0.50, 489000, 250000000, 250000), new RowDataFixture(
- "US" + getRandomNumber(), "D Toyota Motor Corp.",
- "aaa", getRandomDate(), PRICING_MANUAL, 62.5789, 40,
+ 0.50, 489000, 250000000, 250000),
+ new RowDataFixture(
+ "US" + RowDataFixture.getRandomNumber(), "D Toyota Motor Corp.",
+ "aaa", RowDataFixture.getRandomDate(), PRICING_MANUAL, 62.5789, 40,
450000, true, 104.40, 55.41, -2.85, 849000, 1242000000,
- 2000000), new RowDataFixture("US" + getRandomNumber(),
- "F Honda Motor Co., Ltd.", "aa", getRandomDate(),
+ 2000000),
+ new RowDataFixture("US" + RowDataFixture.getRandomNumber(),
+ "F Honda Motor Co., Ltd.", "aa", RowDataFixture.getRandomDate(),
PRICING_MANUAL, 23.7125, 60, 6500000, false, 36.29,
17.35, -21.83, 1050000, 53000000, 70000),
- new RowDataFixture("US" + getRandomNumber(),
- "G General Motors Corporation", "B-", getRandomDate(),
+ new RowDataFixture("US" + RowDataFixture.getRandomNumber(),
+ "G General Motors Corporation", "B-", RowDataFixture.getRandomDate(),
PRICING_MANUAL, 2.9811, 70, 2585000, true, 18.18, .27,
.110, 58714700, 25900000, 2800000),
- new RowDataFixture("US" + getRandomNumber(), "H Yahoo! Inc",
+ new RowDataFixture("US" + RowDataFixture.getRandomNumber(), "H Yahoo! Inc",
"C", new Date(), PRICING_AUTO, 12.9811, 80, 99000,
true, 26.86, 8.94, 0.00, 22000000, 22740000000D,
- 14000000000D), new RowDataFixture("US"
- + getRandomNumber(), "I Microsoft", "BB",
- getRandomDate(), PRICING_AUTO, 22.5506, 90, 6250000,
+ 14000000000D),
+ new RowDataFixture("US"
+ + RowDataFixture.getRandomNumber(), "I Microsoft", "BB",
+ RowDataFixture.getRandomDate(), PRICING_AUTO, 22.5506, 90, 6250000,
false, 29.57, 14.87, 1.74, 57000000, 196000000000D,
- 80000000000D), new RowDataFixture("US"
- + getRandomNumber(), "J Google Inc.", "AAA",
- getRandomDate(), PRICING_AUTO, 330.9315, 100, 8550000,
+ 80000000000D),
+ new RowDataFixture("US"
+ + RowDataFixture.getRandomNumber(), "J Google Inc.", "AAA",
+ RowDataFixture.getRandomDate(), PRICING_AUTO, 330.9315, 100, 8550000,
true, 579.10, 247.30, 13.67, 3000000, 136000000000D,
- 70000000000D), new RowDataFixture("US"
- + getRandomNumber(), "K Research In Motion Limited",
- "AA", getRandomDate(), PRICING_MANUAL, 43.0311, 110,
+ 70000000000D),
+ new RowDataFixture("US"
+ + RowDataFixture.getRandomNumber(), "K Research In Motion Limited",
+ "AA", RowDataFixture.getRandomDate(), PRICING_MANUAL, 43.0311, 110,
55000, true, 150.30, 44.23, 3.67, 587295, 51000000000D,
- 0), new RowDataFixture("US" + getRandomNumber(),
- "L Apple Inc.", "AAA", getRandomDate(), PRICING_AUTO,
+ 0),
+ new RowDataFixture("US" + RowDataFixture.getRandomNumber(),
+ "L Apple Inc.", "AAA", RowDataFixture.getRandomDate(), PRICING_AUTO,
102.4817, 120, 115000, false, 186.78, 78.20, 1.67,
17000000, 125000000000D, 14000000000D),
- new RowDataFixture("US" + getRandomNumber(), "M Nokia Corp.",
- "A-", getRandomDate(), PRICING_AUTO, 12.0500, 130,
+ new RowDataFixture("US" + RowDataFixture.getRandomNumber(), "M Nokia Corp.",
+ "A-", RowDataFixture.getRandomDate(), PRICING_AUTO, 12.0500, 130,
315000, true, 28.34, 8.47, 1.08, 17390000,
58400000000D, 10000000000D)));
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/RowGroupDataFixture.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/RowGroupDataFixture.java
similarity index 93%
rename from org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/RowGroupDataFixture.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/RowGroupDataFixture.java
index 346c322..1f55e77 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/RowGroupDataFixture.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/RowGroupDataFixture.java
@@ -8,17 +8,12 @@
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.test.fixture.data;
+package org.eclipse.nebula.widgets.nattable.dataset.fixture.data;
-import static org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture.PRICING_MANUAL;
-import static org.eclipse.nebula.widgets.nattable.util.ObjectUtils.getRandomDate;
+import static org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture.PRICING_MANUAL;
-import java.io.Serializable;
import java.util.Date;
-import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
-import org.eclipse.nebula.widgets.nattable.util.ObjectUtils;
-
/**
* Duplicated from the {@link RowDataListFixture} as the overriden hashcode and
* equals in the RowDataFixture doesn't play nicely with hashmaps used in the
@@ -69,13 +64,6 @@
public double field39;
public double field40;
- public static final IRowIdAccessor<RowGroupDataFixture> rowIdAccessor = new IRowIdAccessor<RowGroupDataFixture>() {
- @Override
- public Serializable getRowId(RowGroupDataFixture rowObject) {
- return rowObject.getSecurity_description();
- }
- };
-
public RowGroupDataFixture(String security_id, String security_description,
String rating, Date issue_date, PricingTypeBean pricing_type,
double bid_price, double ask_price, int lot_size,
@@ -150,8 +138,8 @@
public static RowGroupDataFixture getInstance(String descrition,
String rating) {
return new RowGroupDataFixture(
- "US" + ObjectUtils.getRandomNumber(1000), descrition, rating,
- getRandomDate(), PRICING_MANUAL, 1.000, 10, 1000, true, 1.00,
+ "US" + RowDataFixture.getRandomNumber(1000), descrition, rating,
+ RowDataFixture.getRandomDate(), PRICING_MANUAL, 1.000, 10, 1000, true, 1.00,
1.01, -.01, 1000, 1000, 1000D);
}
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/RowGroupDataListFixture.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/RowGroupDataListFixture.java
similarity index 78%
rename from org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/RowGroupDataListFixture.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/RowGroupDataListFixture.java
index 86e8018..d8d7b65 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/fixture/data/RowGroupDataListFixture.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/fixture/data/RowGroupDataListFixture.java
@@ -8,10 +8,7 @@
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.test.fixture.data;
-
-import static org.eclipse.nebula.widgets.nattable.util.ObjectUtils.getRandomDate;
-import static org.eclipse.nebula.widgets.nattable.util.ObjectUtils.getRandomNumber;
+package org.eclipse.nebula.widgets.nattable.dataset.fixture.data;
import java.util.ArrayList;
import java.util.Arrays;
@@ -71,8 +68,7 @@
public static final String FIELD_39_PROP_NAME = "field39";
public static final String FIELD_40_PROP_NAME = "field40";
- public static final PricingTypeBean PRICING_MANUAL = new PricingTypeBean(
- "MN");
+ public static final PricingTypeBean PRICING_MANUAL = new PricingTypeBean("MN");
public static final PricingTypeBean PRICING_AUTO = new PricingTypeBean("AT");
/**
@@ -81,54 +77,60 @@
*/
public static List<RowGroupDataFixture> getList() {
List<RowGroupDataFixture> listFixture = new ArrayList<RowGroupDataFixture>();
- listFixture.addAll(Arrays.asList(new RowGroupDataFixture("US"
- + getRandomNumber(), "B Ford Motor", "a", new Date(),
- PRICING_MANUAL, 4.7912, 20, 1500000, true, 6.75, 1.01, -7.03,
- 114000000, 2000000000, 5000000000D), new RowGroupDataFixture(
- "ABC" + getRandomNumber(), "A Alphabet Co.", "AAA",
- getRandomDate(), PRICING_AUTO, 1.23456, 10, 10000, true, 5.124,
- .506, 1.233, 2000000, 50000000, 4500000),
- new RowGroupDataFixture("US" + getRandomNumber(),
- "C General Electric Co", "B", getRandomDate(),
+ listFixture.addAll(Arrays.asList(
+ new RowGroupDataFixture("US"
+ + RowDataFixture.getRandomNumber(), "B Ford Motor", "a", new Date(),
+ PRICING_MANUAL, 4.7912, 20, 1500000, true, 6.75, 1.01, -7.03,
+ 114000000, 2000000000, 5000000000D),
+ new RowGroupDataFixture(
+ "ABC" + RowDataFixture.getRandomNumber(), "A Alphabet Co.", "AAA",
+ RowDataFixture.getRandomDate(), PRICING_AUTO, 1.23456, 10, 10000, true, 5.124,
+ .506, 1.233, 2000000, 50000000, 4500000),
+ new RowGroupDataFixture("US" + RowDataFixture.getRandomNumber(),
+ "C General Electric Co", "B", RowDataFixture.getRandomDate(),
PRICING_MANUAL, 10.1244, 30, 1500000, false, 30.74,
5.73, 1.62, 93350000, 142000000, 70000000),
- new RowGroupDataFixture("US" + getRandomNumber(),
- "E Nissan Motor Co., Ltd.", "AA", getRandomDate(),
+ new RowGroupDataFixture("US" + RowDataFixture.getRandomNumber(),
+ "E Nissan Motor Co., Ltd.", "AA", RowDataFixture.getRandomDate(),
PRICING_MANUAL, 7.7891, 50, 80000, true, 17.97, 5.59,
0.50, 489000, 250000000, 250000),
- new RowGroupDataFixture("US" + getRandomNumber(),
- "D Toyota Motor Corp.", "aaa", getRandomDate(),
+ new RowGroupDataFixture("US" + RowDataFixture.getRandomNumber(),
+ "D Toyota Motor Corp.", "aaa", RowDataFixture.getRandomDate(),
PRICING_MANUAL, 62.5789, 40, 450000, true, 104.40,
55.41, -2.85, 849000, 1242000000, 2000000),
- new RowGroupDataFixture("US" + getRandomNumber(),
- "F Honda Motor Co., Ltd.", "aa", getRandomDate(),
+ new RowGroupDataFixture("US" + RowDataFixture.getRandomNumber(),
+ "F Honda Motor Co., Ltd.", "aa", RowDataFixture.getRandomDate(),
PRICING_MANUAL, 23.7125, 60, 6500000, false, 36.29,
17.35, -21.83, 1050000, 53000000, 70000),
- new RowGroupDataFixture("US" + getRandomNumber(),
- "G General Motors Corporation", "B-", getRandomDate(),
+ new RowGroupDataFixture("US" + RowDataFixture.getRandomNumber(),
+ "G General Motors Corporation", "B-", RowDataFixture.getRandomDate(),
PRICING_MANUAL, 2.9811, 70, 2585000, true, 18.18, .27,
.110, 58714700, 25900000, 2800000),
- new RowGroupDataFixture("US" + getRandomNumber(),
+ new RowGroupDataFixture("US" + RowDataFixture.getRandomNumber(),
"H Yahoo! Inc", "C", new Date(), PRICING_AUTO, 12.9811,
80, 99000, true, 26.86, 8.94, 0.00, 22000000,
- 22740000000D, 14000000000D), new RowGroupDataFixture(
- "US" + getRandomNumber(), "I Microsoft", "BB",
- getRandomDate(), PRICING_AUTO, 22.5506, 90, 6250000,
+ 22740000000D, 14000000000D),
+ new RowGroupDataFixture(
+ "US" + RowDataFixture.getRandomNumber(), "I Microsoft", "BB",
+ RowDataFixture.getRandomDate(), PRICING_AUTO, 22.5506, 90, 6250000,
false, 29.57, 14.87, 1.74, 57000000, 196000000000D,
- 80000000000D), new RowGroupDataFixture("US"
- + getRandomNumber(), "J Google Inc.", "AAA",
- getRandomDate(), PRICING_AUTO, 330.9315, 100, 8550000,
+ 80000000000D),
+ new RowGroupDataFixture("US"
+ + RowDataFixture.getRandomNumber(), "J Google Inc.", "AAA",
+ RowDataFixture.getRandomDate(), PRICING_AUTO, 330.9315, 100, 8550000,
true, 579.10, 247.30, 13.67, 3000000, 136000000000D,
- 70000000000D), new RowGroupDataFixture("US"
- + getRandomNumber(), "K Research In Motion Limited",
- "AA", getRandomDate(), PRICING_MANUAL, 43.0311, 110,
+ 70000000000D),
+ new RowGroupDataFixture("US"
+ + RowDataFixture.getRandomNumber(), "K Research In Motion Limited",
+ "AA", RowDataFixture.getRandomDate(), PRICING_MANUAL, 43.0311, 110,
55000, true, 150.30, 44.23, 3.67, 587295, 51000000000D,
- 0), new RowGroupDataFixture("US" + getRandomNumber(),
- "L Apple Inc.", "AAA", getRandomDate(), PRICING_AUTO,
+ 0),
+ new RowGroupDataFixture("US" + RowDataFixture.getRandomNumber(),
+ "L Apple Inc.", "AAA", RowDataFixture.getRandomDate(), PRICING_AUTO,
102.4817, 120, 115000, false, 186.78, 78.20, 1.67,
17000000, 125000000000D, 14000000000D),
- new RowGroupDataFixture("US" + getRandomNumber(),
- "M Nokia Corp.", "A-", getRandomDate(), PRICING_AUTO,
+ new RowGroupDataFixture("US" + RowDataFixture.getRandomNumber(),
+ "M Nokia Corp.", "A-", RowDataFixture.getRandomDate(), PRICING_AUTO,
12.0500, 130, 315000, true, 28.34, 8.47, 1.08,
17390000, 58400000000D, 10000000000D)));
diff --git a/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/generator/NatTableDataGenerator.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/generator/NatTableDataGenerator.java
index 9d132e7..e7fe3cb 100644
--- a/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/generator/NatTableDataGenerator.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/generator/NatTableDataGenerator.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
+ * Copyright (c) 2012, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
@@ -47,11 +47,11 @@
public NatTableDataGenerator() {}
private void initColumnDataTypes() {
- columnDataTypes = new ArrayList<ColumnDataType>();
- for (int i = 0; i < numCols; i++) {
+ this.columnDataTypes = new ArrayList<ColumnDataType>();
+ for (int i = 0; i < this.numCols; i++) {
ColumnDataType dataType = ColumnDataType.values()[(int) (Math
.random() * ColumnDataType.values().length)];
- columnDataTypes.add(dataType);
+ this.columnDataTypes.add(dataType);
}
}
@@ -59,19 +59,19 @@
try {
BufferedWriter out = new BufferedWriter(new FileWriter(fileName));
// first write the data types
- for (int i = 0; i < columnDataTypes.size(); i++) {
- ColumnDataType dataType = columnDataTypes.get(i);
+ for (int i = 0; i < this.columnDataTypes.size(); i++) {
+ ColumnDataType dataType = this.columnDataTypes.get(i);
out.write(dataType.toString());
- out.write(i == columnDataTypes.size() - 1 ? "" : ",");
+ out.write(i == this.columnDataTypes.size() - 1 ? "" : ",");
}
out.newLine();
String text = "Writing to " + fileName;
int charsWritten = text.length();
System.out.print(text);
- for (int i = 0; i < numRows; i++) {
- for (int j = 0; j < numCols; j++) {
- ColumnDataType dataType = columnDataTypes.get(j);
+ for (int i = 0; i < this.numRows; i++) {
+ for (int j = 0; j < this.numCols; j++) {
+ ColumnDataType dataType = this.columnDataTypes.get(j);
ColumnValueBean<?> value = null;
switch (dataType) {
case STRING_DATA:
@@ -87,9 +87,9 @@
: value.getValue().toString();
stringValue = "".equals(stringValue) ? " " : stringValue;
out.write(stringValue);
- out.write(j == numCols - 1 ? "" : ",");
+ out.write(j == this.numCols - 1 ? "" : ",");
}
- if (i % numCols == 0) {
+ if (i % this.numCols == 0) {
System.out.print(".");
charsWritten++;
}
@@ -120,7 +120,7 @@
String stringFromFile = bro.readLine();
while (stringFromFile != null) // end of the file
{
- numRows++;
+ this.numRows++;
stringFromFile = bro.readLine(); // read next line
}
bro.close();
@@ -131,7 +131,7 @@
ioexception.printStackTrace();
System.exit(-1);
}
- numRows--; // first row contains the data types of the columns
+ this.numRows--; // first row contains the data types of the columns
}
public TableDataProvider loadData(final String fileName) {
@@ -140,9 +140,11 @@
getNumRows(fileName);
Object[][] tableData = null;
+ FileReader fro = null;
+ BufferedReader bro = null;
try {
- FileReader fro = new FileReader(fileName);
- BufferedReader bro = new BufferedReader(fro);
+ fro = new FileReader(fileName);
+ bro = new BufferedReader(fro);
// declare String variable and prime the read
String stringFromFile = bro.readLine();
@@ -155,8 +157,8 @@
if (!columnDataTypesRead) {
columnDataTypesRead = true;
dataTypes = parseDataTypes(stringFromFile);
- numCols = dataTypes.size();
- tableData = new Object[numCols][numRows];
+ this.numCols = dataTypes.size();
+ tableData = new Object[this.numCols][this.numRows];
} else {
if (dataTypes == null || dataTypes.size() == 0)
throw new IllegalStateException(
@@ -169,18 +171,24 @@
System.out.print(".");
}
System.out.println("done");
- bro.close();
} catch (FileNotFoundException filenotfoundexxption) {
System.out.println(fileName + ", does not exist");
System.exit(-1);
- }
-
- catch (IOException ioexception) {
+ } catch (IOException ioexception) {
ioexception.printStackTrace();
System.exit(-1);
+ } finally {
+ if (bro != null) {
+ try {
+ bro.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+ }
}
- return new TableDataProvider(tableData, numCols, numRows);
+ return new TableDataProvider(tableData, this.numCols, this.numRows);
}
private void addRow(Object[][] tableData, int curRow,
@@ -218,7 +226,7 @@
private T value;
public T getValue() {
- return value;
+ return this.value;
}
public void setValue(T value) {
@@ -232,7 +240,7 @@
@Override
public Double getValue() {
- return value;
+ return this.value;
}
@Override
@@ -247,7 +255,7 @@
@Override
public String getValue() {
- return value;
+ return this.value;
}
@Override
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/Address.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/Address.java
similarity index 93%
rename from org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/Address.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/Address.java
index 87976cc..81c6ddd 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/Address.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/Address.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.examples.data.person;
+package org.eclipse.nebula.widgets.nattable.dataset.person;
public class Address {
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/DataModelConstants.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/DataModelConstants.java
similarity index 75%
rename from org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/DataModelConstants.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/DataModelConstants.java
index 688963f..62af04d 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/DataModelConstants.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/DataModelConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.examples.data.person;
+package org.eclipse.nebula.widgets.nattable.dataset.person;
public class DataModelConstants {
@@ -40,12 +40,22 @@
public static final String CITY_PROPERTYNAME = "city";
public static final String[] PERSON_PROPERTY_NAMES = {
- FIRSTNAME_PROPERTYNAME, LASTNAME_PROPERTYNAME, GENDER_PROPERTYNAME,
- MARRIED_PROPERTYNAME, BIRTHDAY_PROPERTYNAME };
+ FIRSTNAME_PROPERTYNAME,
+ LASTNAME_PROPERTYNAME,
+ GENDER_PROPERTYNAME,
+ MARRIED_PROPERTYNAME,
+ BIRTHDAY_PROPERTYNAME
+ };
public static final String[] PERSONWITHADDRESS_PROPERTY_NAMES = {
- FIRSTNAME_PROPERTYNAME, LASTNAME_PROPERTYNAME, GENDER_PROPERTYNAME,
- MARRIED_PROPERTYNAME, BIRTHDAY_PROPERTYNAME, STREET_PROPERTYNAME,
- HOUSENUMBER_PROPERTYNAME, POSTALCODE_PROPERTYNAME,
- CITY_PROPERTYNAME };
+ FIRSTNAME_PROPERTYNAME,
+ LASTNAME_PROPERTYNAME,
+ GENDER_PROPERTYNAME,
+ MARRIED_PROPERTYNAME,
+ BIRTHDAY_PROPERTYNAME,
+ STREET_PROPERTYNAME,
+ HOUSENUMBER_PROPERTYNAME,
+ POSTALCODE_PROPERTYNAME,
+ CITY_PROPERTYNAME
+ };
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/ExtendedPersonWithAddress.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/ExtendedPersonWithAddress.java
similarity index 81%
rename from org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/ExtendedPersonWithAddress.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/ExtendedPersonWithAddress.java
index 3bac9c7..8e82251 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/ExtendedPersonWithAddress.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/ExtendedPersonWithAddress.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,23 +8,17 @@
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.examples.data.person;
+package org.eclipse.nebula.widgets.nattable.dataset.person;
import java.util.Date;
import java.util.List;
-/**
- * @author Dirk Fauth
- *
- */
public class ExtendedPersonWithAddress extends PersonWithAddress {
private String password;
- private String description;
private List<String> favouriteFood;
private List<String> favouriteDrinks;
private int age;
- private double money;
private String filename;
@SuppressWarnings("deprecation")
@@ -102,21 +96,6 @@
}
/**
- * @return the description
- */
- public String getDescription() {
- return this.description;
- }
-
- /**
- * @param description
- * the description to set
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
* @return the age
*/
public int getAge() {
@@ -132,21 +111,6 @@
}
/**
- * @return the money
- */
- public double getMoney() {
- return this.money;
- }
-
- /**
- * @param money
- * the money to set
- */
- public void setMoney(double money) {
- this.money = money;
- }
-
- /**
* @return the filename
*/
public String getFilename() {
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/data/Person.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/Person.java
similarity index 71%
rename from org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/data/Person.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/Person.java
index 9a0a7a8..4c76b99 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/test/data/Person.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/Person.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.test.data;
+package org.eclipse.nebula.widgets.nattable.dataset.person;
import java.util.Date;
@@ -23,14 +23,36 @@
private Gender gender;
private boolean married;
private Date birthday;
- private Double money;
+ protected Double money;
+ protected String description;
public Person(int id) {
this.id = id;
}
- public Person(int id, String firstName, String lastName, Gender gender,
- boolean married, Date birthday, Double money) {
+ public Person(
+ int id,
+ String firstName,
+ String lastName,
+ Gender gender,
+ boolean married,
+ Date birthday) {
+ this.id = id;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.gender = gender;
+ this.married = married;
+ this.birthday = birthday;
+ }
+
+ public Person(
+ int id,
+ String firstName,
+ String lastName,
+ Gender gender,
+ boolean married,
+ Date birthday,
+ Double money) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
@@ -136,4 +158,19 @@
public void setMoney(Double money) {
this.money = money;
}
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return this.description;
+ }
+
+ /**
+ * @param description
+ * the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/PersonService.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/PersonService.java
similarity index 61%
rename from org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/PersonService.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/PersonService.java
index 78c4959..2c1ed58 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/PersonService.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/PersonService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,29 +8,28 @@
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.examples.data.person;
+package org.eclipse.nebula.widgets.nattable.dataset.person;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import java.util.Random;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
/**
* Class that acts as service for accessing numerous {@link Person}s. The values
* are randomly put together out of names and places from "The Simpsons"
- *
- * @author Dirk Fauth
*/
public class PersonService {
static String[] maleNames = { "Bart", "Homer", "Lenny", "Carl", "Waylon",
- "Ned", "Timothy" };
+ "Ned", "Timothy", "Rodd", "Todd" };
static String[] femaleNames = { "Marge", "Lisa", "Maggie", "Edna", "Helen",
- "Jessica" };
+ "Jessica", "Maude" };
static String[] lastNames = { "Simpson", "Leonard", "Carlson", "Smithers",
"Flanders", "Krabappel", "Lovejoy" };
static String[] streetNames = new String[] { "Evergreen Terrace",
@@ -47,6 +46,139 @@
+ "magna aliquyam erat, sed diam voluptua.";
/**
+ * Creates a list of random {@link Person}s.
+ *
+ * @param numberOfPersons
+ * The number of {@link Person}s that should be generated.
+ * @return A list containing the given amount of random generated persons.
+ */
+ public static List<Person> getRandomPersons(int numberOfPersons) {
+ List<Person> result = new ArrayList<Person>();
+
+ for (int i = 0; i < numberOfPersons; i++) {
+ result.add(createPerson(i));
+ }
+
+ return result;
+ }
+
+ /**
+ * Creates a fixed list of {@link Person}s.
+ */
+ public static List<Person> getFixedPersons() {
+ List<Person> result = new ArrayList<Person>();
+
+ // create 10 Simpsons
+ // 3 Homer
+ result.add(new Person(1, maleNames[1], lastNames[0], Gender.MALE, true,
+ new Date(), 100d));
+ result.add(new Person(2, maleNames[1], lastNames[0], Gender.MALE, true,
+ new Date(), 100d));
+ result.add(new Person(3, maleNames[1], lastNames[0], Gender.MALE, true,
+ new Date(), 100d));
+ // 3 Bart
+ result.add(new Person(4, maleNames[0], lastNames[0], Gender.MALE,
+ false, new Date(), 100d));
+ result.add(new Person(5, maleNames[0], lastNames[0], Gender.MALE,
+ false, new Date(), 100d));
+ result.add(new Person(6, maleNames[0], lastNames[0], Gender.MALE,
+ false, new Date(), 100d));
+ // 2 Marge
+ result.add(new Person(7, femaleNames[0], lastNames[0], Gender.FEMALE,
+ true, new Date(), 100d));
+ result.add(new Person(8, femaleNames[0], lastNames[0], Gender.FEMALE,
+ true, new Date(), 100d));
+ // 2 Lisa
+ result.add(new Person(9, femaleNames[1], lastNames[0], Gender.FEMALE,
+ false, new Date(), 100d));
+ result.add(new Person(10, femaleNames[1], lastNames[0], Gender.FEMALE,
+ false, new Date(), 100d));
+
+ // create 8 Flanders
+ // 2 Ned
+ result.add(new Person(11, maleNames[5], lastNames[4], Gender.MALE,
+ true, new Date(), 100d));
+ result.add(new Person(12, maleNames[5], lastNames[4], Gender.MALE,
+ true, new Date(), 100d));
+ // 2 Maude
+ result.add(new Person(13, femaleNames[6], lastNames[4], Gender.FEMALE,
+ true, new Date(), 100d));
+ result.add(new Person(14, femaleNames[6], lastNames[4], Gender.FEMALE,
+ true, new Date(), 100d));
+ // 2 Rod
+ result.add(new Person(15, maleNames[7], lastNames[4], Gender.MALE,
+ false, new Date(), 100d));
+ result.add(new Person(16, maleNames[7], lastNames[4], Gender.MALE,
+ false, new Date(), 100d));
+ // 2 Tod
+ result.add(new Person(17, maleNames[8], lastNames[4], Gender.MALE,
+ false, new Date(), 100d));
+ result.add(new Person(18, maleNames[8], lastNames[4], Gender.MALE,
+ false, new Date(), 100d));
+
+ return result;
+ }
+
+ /**
+ * Creates a fixed list of {@link Person}s with a few null values.
+ */
+ public static List<Person> getFixedPersonsWithNull() {
+ List<Person> result = new ArrayList<Person>();
+
+ // create 5 Simpsons
+ // 2 Homer
+ result.add(new Person(1, maleNames[1], lastNames[0], Gender.MALE, true,
+ new Date(), 100d));
+ result.add(new Person(3, maleNames[1], lastNames[0], Gender.MALE, true,
+ new Date(), 100d));
+ // 2 Marge
+ result.add(new Person(7, femaleNames[0], lastNames[0], Gender.FEMALE,
+ true, new Date(), 100d));
+ result.add(new Person(8, femaleNames[0], lastNames[0], Gender.FEMALE,
+ true, new Date(), 100d));
+ // 1 Bart without money
+ result.add(new Person(7, femaleNames[0], lastNames[0], Gender.FEMALE,
+ true, new Date(), null));
+
+ // create 2 Flanders without last name
+ // 1 Ned
+ result.add(new Person(11, maleNames[5], null, Gender.MALE,
+ true, new Date(), 100d));
+ // 1 Maude
+ result.add(new Person(13, femaleNames[6], null, Gender.FEMALE,
+ true, new Date(), 100d));
+
+ return result;
+ }
+
+ public static List<Person> getFixedMixedPersons() {
+ List<Person> result = new ArrayList<Person>();
+
+ result.add(new Person(21, maleNames[0], lastNames[2], Gender.MALE,
+ true, new Date(), 100d));
+ result.add(new Person(22, maleNames[1], lastNames[2], Gender.MALE,
+ true, new Date(), 100d));
+ result.add(new Person(23, maleNames[5], lastNames[2], Gender.MALE,
+ true, new Date(), 100d));
+ result.add(new Person(24, femaleNames[0], lastNames[2], Gender.FEMALE,
+ false, new Date(), 100d));
+ result.add(new Person(25, femaleNames[6], lastNames[2], Gender.FEMALE,
+ false, new Date(), 100d));
+
+ // add doubles
+ result.add(new Person(30, maleNames[1], lastNames[0], Gender.MALE,
+ true, new Date(), 100d));
+ result.add(new Person(31, maleNames[1], lastNames[0], Gender.MALE,
+ true, new Date(), 100d));
+ result.add(new Person(32, maleNames[1], lastNames[2], Gender.MALE,
+ true, new Date(), 100d));
+ result.add(new Person(33, maleNames[1], lastNames[2], Gender.MALE,
+ true, new Date(), 100d));
+
+ return result;
+ }
+
+ /**
* Creates a list of {@link Person}s.
*
* @param numberOfPersons
@@ -107,18 +239,16 @@
*
* @return
*/
- public static Person createPerson(int id) {
+ private static Person createPerson(int id) {
Random randomGenerator = new Random();
Person result = new Person(id);
result.setGender(Gender.values()[randomGenerator.nextInt(2)]);
if (result.getGender().equals(Gender.MALE)) {
- result.setFirstName(maleNames[randomGenerator
- .nextInt(maleNames.length)]);
+ result.setFirstName(maleNames[randomGenerator.nextInt(maleNames.length)]);
} else {
- result.setFirstName(femaleNames[randomGenerator
- .nextInt(femaleNames.length)]);
+ result.setFirstName(femaleNames[randomGenerator.nextInt(femaleNames.length)]);
}
result.setLastName(lastNames[randomGenerator.nextInt(lastNames.length)]);
@@ -133,14 +263,14 @@
}
int year = 1920 + randomGenerator.nextInt(90);
- SimpleDateFormat sdf = new SimpleDateFormat(
- DataModelConstants.DATE_FORMAT_PATTERN);
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
result.setBirthday(sdf.parse("" + year + "-" + month + "-" + day));
} catch (ParseException e) {
e.printStackTrace();
}
+ result.setMoney(randomGenerator.nextDouble() * 100);
return result;
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/PersonWithAddress.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/PersonWithAddress.java
similarity index 69%
rename from org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/PersonWithAddress.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/PersonWithAddress.java
index 514b78a..eda4751 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/PersonWithAddress.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/PersonWithAddress.java
@@ -8,7 +8,7 @@
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.examples.data.person;
+package org.eclipse.nebula.widgets.nattable.dataset.person;
import java.util.Date;
@@ -16,15 +16,25 @@
private Address address;
- public PersonWithAddress(int id, String firstName, String lastName,
- Gender gender, boolean married, Date birthday, Address address) {
+ public PersonWithAddress(
+ int id,
+ String firstName,
+ String lastName,
+ Gender gender,
+ boolean married,
+ Date birthday,
+ Address address) {
super(id, firstName, lastName, gender, married, birthday);
this.address = address;
}
public PersonWithAddress(Person person, Address address) {
- super(person.getId(), person.getFirstName(), person.getLastName(),
- person.getGender(), person.isMarried(), person.getBirthday());
+ super(person.getId(),
+ person.getFirstName(),
+ person.getLastName(),
+ person.getGender(),
+ person.isMarried(),
+ person.getBirthday());
this.address = address;
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/Person.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/SimplePerson.java
similarity index 67%
rename from org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/Person.java
rename to org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/SimplePerson.java
index 0791669..3280ad7 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/Person.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/person/SimplePerson.java
@@ -8,7 +8,7 @@
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.examples.fixtures;
+package org.eclipse.nebula.widgets.nattable.dataset.person;
import java.util.Arrays;
import java.util.Date;
@@ -17,12 +17,12 @@
/**
* Object representation of a row in the table
*/
-public class Person {
+public class SimplePerson {
private int id;
private String name;
private Date birthDate;
- public Person(int id, String name, Date birthDate) {
+ public SimplePerson(int id, String name, Date birthDate) {
this.id = id;
this.name = name;
this.birthDate = birthDate;
@@ -40,12 +40,12 @@
return this.birthDate;
}
- public static List<Person> getList() {
+ public static List<SimplePerson> getList() {
return Arrays.asList(
- new Person(100, "Mickey Mouse", new Date(1000000)), new Person(
- 110, "Batman", new Date(2000000)), new Person(120,
- "Bender", new Date(3000000)), new Person(130,
- "Cartman", new Date(4000000)), new Person(140,
+ new SimplePerson(100, "Mickey Mouse", new Date(1000000)), new SimplePerson(
+ 110, "Batman", new Date(2000000)), new SimplePerson(120,
+ "Bender", new Date(3000000)), new SimplePerson(130,
+ "Cartman", new Date(4000000)), new SimplePerson(140,
"Dogbert", new Date(5000000)));
}
}
diff --git a/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/pricing/PricingDataFileLoader.java b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/pricing/PricingDataFileLoader.java
index f14a56f..75decc6 100644
--- a/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/pricing/PricingDataFileLoader.java
+++ b/org.eclipse.nebula.widgets.nattable.dataset/src/org/eclipse/nebula/widgets/nattable/dataset/pricing/PricingDataFileLoader.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
@@ -21,16 +21,21 @@
public List<T> loadDataFromFile() throws IOException {
List<T> data = new ArrayList<T>();
- int i = 0;
- DelimitedFileReader reader = new DelimitedFileReader(
- new BufferedReader(new InputStreamReader(
- PricingDataFileLoader.class
- .getResourceAsStream("pricing_data.txt"))),
- '\t');
- if (reader.ready() && reader.markSupported()) {
- while (reader.read() > 0) {
- i++;
- parseTabDelimitedLine(reader.getTabbedLineRead(), data);
+ DelimitedFileReader reader = null;
+ try {
+ reader = new DelimitedFileReader(
+ new BufferedReader(new InputStreamReader(
+ PricingDataFileLoader.class
+ .getResourceAsStream("pricing_data.txt"))),
+ '\t');
+ if (reader.ready() && reader.markSupported()) {
+ while (reader.read() > 0) {
+ parseTabDelimitedLine(reader.getTabbedLineRead(), data);
+ }
+ }
+ } finally {
+ if (reader != null) {
+ reader.close();
}
}
return data;
@@ -62,14 +67,14 @@
* bean.setPriceChange(extractDoubleFromToken(tabs.nextToken()));
* bean.setYieldChange(extractDoubleFromToken(tabs.nextToken()));
* bean.setSpreadChange(extractDoubleFromToken(tabs.nextToken()));
- *
- * bean.setBasisPointValue(extractDoubleFromToken(tabs.nextToken()));
- * bean.setModDuration(extractDoubleFromToken(tabs.nextToken()));
+ *
+ * bean.setBasisPointValue(extractDoubleFromToken(tabs.nextToken()))
+ * ; bean.setModDuration(extractDoubleFromToken(tabs.nextToken()));
* bean.setConvexity(extractDoubleFromToken(tabs.nextToken()));
* bean.setComments(extractStringFromToken(tabs.nextToken()));
* bean.setNativeTradingGroup
* (extractStringFromToken(tabs.nextToken()));
- *
+ *
* bean.setTgPosition(extractDoubleFromToken(tabs.nextToken()));
* bean.setTgPL(extractDoubleFromToken(tabs.nextToken()));
* bean.setTgClosingPL(extractDoubleFromToken(tabs.nextToken()));
@@ -123,6 +128,6 @@
System.out.println("string: " + token);
return token == null
|| (token.trim().equals("") || token.trim().equals("\t")) ? null
- : token;
+ : token;
}
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/pom.xml b/org.eclipse.nebula.widgets.nattable.examples/pom.xml
index 5f433ae..9cbca6e 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/pom.xml
+++ b/org.eclipse.nebula.widgets.nattable.examples/pom.xml
@@ -26,26 +26,11 @@
<build>
<plugins>
<plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>target-platform-configuration</artifactId>
- <version>${tycho-version}</version>
- <configuration>
- <dependency-resolution>
- <extraRequirements>
- <requirement>
- <type>eclipse-plugin</type>
- <id>org.eclipse.nebula.widgets.nattable.core.test</id>
- <versionRange>0.0.0</versionRange>
- </requirement>
- </extraRequirements>
- </dependency-resolution>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
+ <includePluginDependencies>true</includePluginDependencies>
<mainClass>org.eclipse.nebula.widgets.nattable.examples.NatTableExamples</mainClass>
<arguments>
<argument>--createIndex</argument>
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_300_Data/_302_CustomColumnPropertyAccessorExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_300_Data/_302_CustomColumnPropertyAccessorExample.java
index 44b1c7a..b53d9c4 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_300_Data/_302_CustomColumnPropertyAccessorExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_300_Data/_302_CustomColumnPropertyAccessorExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._300_Data;
@@ -19,11 +19,11 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.DataModelConstants;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.DataModelConstants;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -39,16 +39,12 @@
/**
* Example showing how to implement and use a custom IColumnPropertyAccessor.
- *
- * @author Dirk Fauth
- *
*/
public class _302_CustomColumnPropertyAccessorExample extends
AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner.run(600, 400,
- new _302_CustomColumnPropertyAccessorExample());
+ StandaloneNatExampleRunner.run(600, 400, new _302_CustomColumnPropertyAccessorExample());
}
@Override
@@ -58,23 +54,30 @@
@Override
public Control createExampleControl(Composite parent) {
- IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor = new PersonWithAddressColumnPropertyAccessor();
+ IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor =
+ new PersonWithAddressColumnPropertyAccessor();
- IDataProvider bodyDataProvider = new ListDataProvider<PersonWithAddress>(
- PersonService.getPersonsWithAddress(10), columnPropertyAccessor);
- final DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
- final SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
- ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
+ IDataProvider bodyDataProvider =
+ new ListDataProvider<PersonWithAddress>(
+ PersonService.getPersonsWithAddress(10),
+ columnPropertyAccessor);
+ final DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
+ final SelectionLayer selectionLayer =
+ new SelectionLayer(bodyDataLayer);
+ ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(
- createColumnHeaderDataProvider()), viewportLayer,
- selectionLayer);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(
+ new DataLayer(createColumnHeaderDataProvider()),
+ viewportLayer,
+ selectionLayer);
// set the region labels to make default configurations work, e.g.
// selection
CompositeLayer compositeLayer = new CompositeLayer(1, 2);
- compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
- columnHeaderLayer, 0, 0);
+ compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 0, 0);
compositeLayer.setChildLayer(GridRegion.BODY, viewportLayer, 0, 1);
return new NatTable(parent, compositeLayer);
@@ -90,43 +93,38 @@
* approach is to implement a completely new {@link IDataProvider}
*/
protected IDataProvider createColumnHeaderDataProvider() {
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday", "street", "housenumber", "postalCode",
- "city" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday",
+ "street",
+ "housenumber",
+ "postalCode",
+ "city"
+ };
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
- propertyToLabelMap.put(DataModelConstants.FIRSTNAME_PROPERTYNAME,
- "Firstname");
- propertyToLabelMap.put(DataModelConstants.LASTNAME_PROPERTYNAME,
- "Lastname");
- propertyToLabelMap
- .put(DataModelConstants.GENDER_PROPERTYNAME, "Gender");
- propertyToLabelMap.put(DataModelConstants.MARRIED_PROPERTYNAME,
- "Married");
- propertyToLabelMap.put(DataModelConstants.BIRTHDAY_PROPERTYNAME,
- "Birthday");
- propertyToLabelMap
- .put(DataModelConstants.STREET_PROPERTYNAME, "Street");
- propertyToLabelMap.put(DataModelConstants.HOUSENUMBER_PROPERTYNAME,
- "Housenumber");
- propertyToLabelMap.put(DataModelConstants.POSTALCODE_PROPERTYNAME,
- "Postal Code");
+ propertyToLabelMap.put(DataModelConstants.FIRSTNAME_PROPERTYNAME, "Firstname");
+ propertyToLabelMap.put(DataModelConstants.LASTNAME_PROPERTYNAME, "Lastname");
+ propertyToLabelMap.put(DataModelConstants.GENDER_PROPERTYNAME, "Gender");
+ propertyToLabelMap.put(DataModelConstants.MARRIED_PROPERTYNAME, "Married");
+ propertyToLabelMap.put(DataModelConstants.BIRTHDAY_PROPERTYNAME, "Birthday");
+ propertyToLabelMap.put(DataModelConstants.STREET_PROPERTYNAME, "Street");
+ propertyToLabelMap.put(DataModelConstants.HOUSENUMBER_PROPERTYNAME, "Housenumber");
+ propertyToLabelMap.put(DataModelConstants.POSTALCODE_PROPERTYNAME, "Postal Code");
propertyToLabelMap.put(DataModelConstants.CITY_PROPERTYNAME, "City");
- return new DefaultColumnHeaderDataProvider(propertyNames,
- propertyToLabelMap);
+ return new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
}
/**
* This is an implementation for a custom IColumnPropertyAccessor to access
* PersonWithAddress objects in a NatTable. It is used for the
* ListDataProvider in the body aswell as for the column header labels.
- *
- * @author Dirk Fauth
- *
*/
- class PersonWithAddressColumnPropertyAccessor implements
- IColumnPropertyAccessor<PersonWithAddress> {
+ class PersonWithAddressColumnPropertyAccessor implements IColumnPropertyAccessor<PersonWithAddress> {
@Override
public Object getDataValue(PersonWithAddress rowObject, int columnIndex) {
@@ -202,9 +200,7 @@
@Override
public int getColumnIndex(String propertyName) {
- return Arrays.asList(
- DataModelConstants.PERSONWITHADDRESS_PROPERTY_NAMES)
- .indexOf(propertyName);
+ return Arrays.asList(DataModelConstants.PERSONWITHADDRESS_PROPERTY_NAMES).indexOf(propertyName);
}
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_300_Data/_303_CalculatedDataExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_300_Data/_303_CalculatedDataExample.java
index 717ea4f..2d778bb 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_300_Data/_303_CalculatedDataExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_300_Data/_303_CalculatedDataExample.java
@@ -28,9 +28,9 @@
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.PercentageDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_300_Data/_306_CalculatedFormulaDataExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_300_Data/_306_CalculatedFormulaDataExample.java
index cc3ecf5..a60f51e 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_300_Data/_306_CalculatedFormulaDataExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_300_Data/_306_CalculatedFormulaDataExample.java
@@ -33,9 +33,9 @@
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.PercentageDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.formula.FormulaDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_4221_NatGridLayerPainterExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_4221_NatGridLayerPainterExample.java
index d0d1255..d8f64cd 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_4221_NatGridLayerPainterExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_4221_NatGridLayerPainterExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._400_Configuration;
@@ -16,9 +16,9 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.painter.layer.NatGridLayerPainter;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_4222_CellPainterExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_4222_CellPainterExample.java
index b28eebb..cf654d1 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_4222_CellPainterExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_4222_CellPainterExample.java
@@ -26,10 +26,10 @@
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.ExtendedPersonWithAddress;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_423_ThemeStylingExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_423_ThemeStylingExample.java
index 8b2302a..623031b 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_423_ThemeStylingExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_423_ThemeStylingExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._400_Configuration;
@@ -19,10 +19,10 @@
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_4451_CrossValidationGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_4451_CrossValidationGridExample.java
index ae1e741..31a40bb 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_4451_CrossValidationGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_4451_CrossValidationGridExample.java
@@ -31,10 +31,10 @@
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDateDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator;
import org.eclipse.nebula.widgets.nattable.data.validate.ValidationFailedException;
+import org.eclipse.nebula.widgets.nattable.dataset.EventData;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.config.DialogErrorHandling;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.EventData;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_446_EditErrorHandlingExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_446_EditErrorHandlingExample.java
index 144991e..06e78a7 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_446_EditErrorHandlingExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_446_EditErrorHandlingExample.java
@@ -25,10 +25,10 @@
import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator;
import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
import org.eclipse.nebula.widgets.nattable.data.validate.ValidationFailedException;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.config.DialogErrorHandling;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_4471_EditorTraversalExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_4471_EditorTraversalExample.java
index 59c7a0e..0caa02f 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_4471_EditorTraversalExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_4471_EditorTraversalExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,14 +29,14 @@
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDateDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.editor.CheckBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.DateCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_447_EditorExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_447_EditorExample.java
index 5199178..87137ef 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_447_EditorExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_400_Configuration/_440_Editing/_447_EditorExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -34,6 +34,9 @@
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.editor.CheckBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
@@ -44,9 +47,6 @@
import org.eclipse.nebula.widgets.nattable.edit.gui.FileDialogCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.ExtendedPersonWithAddress;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_501_Data/_5011_DataLayerExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_501_Data/_5011_DataLayerExample.java
index 95b096f..b54dad4 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_501_Data/_5011_DataLayerExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_501_Data/_5011_DataLayerExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._501_Data;
@@ -17,9 +17,9 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.swt.SWT;
@@ -32,9 +32,6 @@
/**
* Simple example showing the DataLayer.
- *
- * @author Dirk Fauth
- *
*/
public class _5011_DataLayerExample extends AbstractNatExample {
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_501_Data/_5015_AutomaticDataSpanningExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_501_Data/_5015_AutomaticDataSpanningExample.java
index a1b3a0e..f0ee6f1 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_501_Data/_5015_AutomaticDataSpanningExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_501_Data/_5015_AutomaticDataSpanningExample.java
@@ -23,8 +23,8 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.layer.SpanningDataLayer;
import org.eclipse.nebula.widgets.nattable.persistence.command.DisplayPersistenceDialogCommandHandler;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_503_Compositions/_5031_VerticalCompositionExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_503_Compositions/_5031_VerticalCompositionExample.java
index 61cf5f4..c648484 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_503_Compositions/_5031_VerticalCompositionExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_503_Compositions/_5031_VerticalCompositionExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._503_Compositions;
@@ -19,9 +19,9 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -36,9 +36,6 @@
/**
* Example showing a NatTable that contains a column header and a body layer.
- *
- * @author Dirk Fauth
- *
*/
public class _5031_VerticalCompositionExample extends AbstractNatExample {
@@ -55,8 +52,12 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -66,26 +67,27 @@
propertyToLabelMap.put("married", "Married");
propertyToLabelMap.put("birthday", "Birthday");
- IColumnPropertyAccessor<Person> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<Person>(
- propertyNames);
+ IColumnPropertyAccessor<Person> columnPropertyAccessor =
+ new ReflectiveColumnPropertyAccessor<Person>(propertyNames);
final List<Person> data = PersonService.getPersons(10);
- IDataProvider bodyDataProvider = new ListDataProvider<Person>(data,
- columnPropertyAccessor);
+ IDataProvider bodyDataProvider =
+ new ListDataProvider<Person>(data, columnPropertyAccessor);
final DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
final SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(
- new DefaultColumnHeaderDataProvider(propertyNames,
- propertyToLabelMap)), viewportLayer, selectionLayer);
+ ILayer columnHeaderLayer = new ColumnHeaderLayer(
+ new DataLayer(
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap)),
+ viewportLayer,
+ selectionLayer);
// set the region labels to make default configurations work, e.g.
// selection
CompositeLayer compositeLayer = new CompositeLayer(1, 2);
- compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
- columnHeaderLayer, 0, 0);
+ compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 0, 0);
compositeLayer.setChildLayer(GridRegion.BODY, viewportLayer, 0, 1);
return new NatTable(parent, compositeLayer);
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_503_Compositions/_5032_HorizontalCompositionExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_503_Compositions/_5032_HorizontalCompositionExample.java
index cd3a2f8..1711b0d 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_503_Compositions/_5032_HorizontalCompositionExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_503_Compositions/_5032_HorizontalCompositionExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._503_Compositions;
@@ -17,9 +17,9 @@
import org.eclipse.nebula.widgets.nattable.data.IRowDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider;
@@ -35,15 +35,11 @@
/**
* Example showing a NatTable that contains a row header and a body layer.
- *
- * @author Dirk Fauth
- *
*/
public class _5032_HorizontalCompositionExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner.run(600, 400,
- new _5032_HorizontalCompositionExample());
+ StandaloneNatExampleRunner.run(600, 400, new _5032_HorizontalCompositionExample());
}
@Override
@@ -54,29 +50,34 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday" };
- IColumnPropertyAccessor<Person> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<Person>(
- propertyNames);
+ IColumnPropertyAccessor<Person> columnPropertyAccessor =
+ new ReflectiveColumnPropertyAccessor<Person>(propertyNames);
final List<Person> data = PersonService.getPersons(10);
- IRowDataProvider<Person> bodyDataProvider = new ListDataProvider<Person>(
- data, columnPropertyAccessor);
+ IRowDataProvider<Person> bodyDataProvider =
+ new ListDataProvider<Person>(data, columnPropertyAccessor);
final DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
final SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
ILayer rowHeaderLayer = new RowHeaderLayer(
- new DefaultRowHeaderDataLayer(new DefaultRowHeaderDataProvider(
- bodyDataProvider)), viewportLayer, selectionLayer);
+ new DefaultRowHeaderDataLayer(
+ new DefaultRowHeaderDataProvider(bodyDataProvider)),
+ viewportLayer,
+ selectionLayer);
// set the region labels to make default configurations work, e.g.
// selection
CompositeLayer compositeLayer = new CompositeLayer(2, 1);
- compositeLayer.setChildLayer(GridRegion.ROW_HEADER, rowHeaderLayer, 0,
- 0);
+ compositeLayer.setChildLayer(GridRegion.ROW_HEADER, rowHeaderLayer, 0, 0);
compositeLayer.setChildLayer(GridRegion.BODY, viewportLayer, 1, 0);
return new NatTable(parent, compositeLayer);
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_503_Compositions/_5033_GridLayerExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_503_Compositions/_5033_GridLayerExample.java
index c2d3bd5..83a9048 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_503_Compositions/_5033_GridLayerExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_503_Compositions/_5033_GridLayerExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._503_Compositions;
@@ -19,9 +19,9 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
@@ -39,9 +39,6 @@
/**
* Example showing a NatTable grid composition.
- *
- * @author Dirk Fauth
- *
*/
public class _5033_GridLayerExample extends AbstractNatExample {
@@ -58,8 +55,12 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -69,39 +70,45 @@
propertyToLabelMap.put("married", "Married");
propertyToLabelMap.put("birthday", "Birthday");
- IColumnPropertyAccessor<Person> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<Person>(
- propertyNames);
+ IColumnPropertyAccessor<Person> columnPropertyAccessor =
+ new ReflectiveColumnPropertyAccessor<Person>(propertyNames);
final List<Person> data = PersonService.getPersons(10);
// create the body layer stack
- IDataProvider bodyDataProvider = new ListDataProvider<Person>(data,
- columnPropertyAccessor);
+ IDataProvider bodyDataProvider =
+ new ListDataProvider<Person>(data, columnPropertyAccessor);
final DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
final SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
// create the column header layer stack
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(
- columnHeaderDataProvider), viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ ILayer columnHeaderLayer = new ColumnHeaderLayer(
+ new DataLayer(
+ columnHeaderDataProvider),
+ viewportLayer,
+ selectionLayer);
// create the row header layer stack
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(new DataLayer(
- rowHeaderDataProvider, 40, 20), viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ ILayer rowHeaderLayer = new RowHeaderLayer(
+ new DataLayer(rowHeaderDataProvider, 40, 20),
+ viewportLayer,
+ selectionLayer);
// create the corner layer stack
- ILayer cornerLayer = new CornerLayer(new DataLayer(
- new DefaultCornerDataProvider(columnHeaderDataProvider,
- rowHeaderDataProvider)), rowHeaderLayer,
+ ILayer cornerLayer = new CornerLayer(
+ new DataLayer(
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider)),
+ rowHeaderLayer,
columnHeaderLayer);
// create the grid layer composed with the prior created layer stacks
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(viewportLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
return new NatTable(parent, gridLayer);
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5041_ViewportLayerExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5041_ViewportLayerExample.java
index 793a8bc..bb6c86a 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5041_ViewportLayerExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5041_ViewportLayerExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._504_Viewport;
@@ -15,9 +15,9 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer;
@@ -26,15 +26,11 @@
/**
* Simple example showing the viewport.
- *
- * @author Dirk Fauth
- *
*/
public class _5041_ViewportLayerExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner.run(600, 400,
- new _5041_ViewportLayerExample());
+ StandaloneNatExampleRunner.run(600, 400, new _5041_ViewportLayerExample());
}
@Override
@@ -45,12 +41,11 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday", "address.street", "address.housenumber",
- "address.postalCode", "address.city" };
+ String[] propertyNames = { "firstName", "lastName", "gender", "married", "birthday",
+ "address.street", "address.housenumber", "address.postalCode", "address.city" };
- IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor = new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(
- propertyNames);
+ IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor =
+ new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(propertyNames);
IDataProvider bodyDataProvider = new ListDataProvider<PersonWithAddress>(
PersonService.getPersonsWithAddress(50), columnPropertyAccessor);
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5042_HorizontalSplitViewportExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5042_HorizontalSplitViewportExample.java
index ed70ae2..de93032 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5042_HorizontalSplitViewportExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5042_HorizontalSplitViewportExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@gogglemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._504_Viewport;
@@ -15,9 +15,9 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.layer.CompositeLayer;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
@@ -44,15 +44,11 @@
/**
* Example showing how to implement NatTable that contains two horizontal split
* viewports.
- *
- * @author Dirk Fauth
- *
*/
public class _5042_HorizontalSplitViewportExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner.run(600, 400,
- new _5042_HorizontalSplitViewportExample());
+ StandaloneNatExampleRunner.run(600, 400, new _5042_HorizontalSplitViewportExample());
}
@Override
@@ -64,12 +60,11 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday", "address.street", "address.housenumber",
- "address.postalCode", "address.city" };
+ String[] propertyNames = { "firstName", "lastName", "gender", "married", "birthday",
+ "address.street", "address.housenumber", "address.postalCode", "address.city" };
- IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor = new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(
- propertyNames);
+ IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor =
+ new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(propertyNames);
IDataProvider bodyDataProvider = new ListDataProvider<PersonWithAddress>(
PersonService.getPersonsWithAddress(50), columnPropertyAccessor);
@@ -77,18 +72,15 @@
// use a cell layer painter that is configured for left clipping
// this ensures that the rendering works correctly for split viewports
- bodyDataLayer
- .setLayerPainter(new GridLineCellLayerPainter(true, false));
+ bodyDataLayer.setLayerPainter(new GridLineCellLayerPainter(true, false));
// create a ViewportLayer for the left part of the table and configure
- // it to only contain
- // the first 5 columns
+ // it to only contain the first 5 columns
final ViewportLayer viewportLayerLeft = new ViewportLayer(bodyDataLayer);
viewportLayerLeft.setMaxColumnPosition(5);
// create a ViewportLayer for the right part of the table and configure
- // it to only contain
- // the last 4 columns
+ // it to only contain the last 4 columns
ViewportLayer viewportLayerRight = new ViewportLayer(bodyDataLayer);
viewportLayerRight.setMinColumnPosition(5);
@@ -98,28 +90,23 @@
compositeLayer.setChildLayer("REGION_B", viewportLayerRight, 1, 0);
// in order to make printing and exporting work correctly you need to
- // register the following
- // command handlers
+ // register the following command handlers
// although in this example printing and exporting is not enabled, we
// show the registering
- compositeLayer
- .registerCommandHandler(new MultiTurnViewportOnCommandHandler(
- viewportLayerLeft, viewportLayerRight));
- compositeLayer
- .registerCommandHandler(new MultiTurnViewportOffCommandHandler(
- viewportLayerLeft, viewportLayerRight));
+ compositeLayer.registerCommandHandler(
+ new MultiTurnViewportOnCommandHandler(viewportLayerLeft, viewportLayerRight));
+ compositeLayer.registerCommandHandler(
+ new MultiTurnViewportOffCommandHandler(viewportLayerLeft, viewportLayerRight));
// set the width of the left viewport to only showing 2 columns at the
// same time
int leftWidth = bodyDataLayer.getStartXOfColumnPosition(2);
// as the CompositeLayer is setting a IClientAreaProvider for the
- // composition
- // we need to set a special ClientAreaAdapter after the creation of the
- // CompositeLayer
- // to support split viewports
- ClientAreaAdapter leftClientAreaAdapter = new ClientAreaAdapter(
- viewportLayerLeft.getClientAreaProvider());
+ // composition we need to set a special ClientAreaAdapter after the
+ // creation of the CompositeLayer to support split viewports
+ ClientAreaAdapter leftClientAreaAdapter =
+ new ClientAreaAdapter(viewportLayerLeft.getClientAreaProvider());
leftClientAreaAdapter.setWidth(leftWidth);
viewportLayerLeft.setClientAreaProvider(leftClientAreaAdapter);
@@ -144,9 +131,8 @@
createSplitSliders(composite, viewportLayerLeft, viewportLayerRight);
// add an IOverlayPainter to ensure the right border of the left
- // viewport always
- // this is necessary because the left border of layer stacks is not
- // rendered by default
+ // viewport always this is necessary because the left border of layer
+ // stacks is not rendered by default
natTable.addOverlayPainter(new IOverlayPainter() {
@Override
@@ -154,8 +140,7 @@
Color beforeColor = gc.getForeground();
gc.setForeground(GUIHelper.COLOR_GRAY);
int viewportBorderX = viewportLayerLeft.getWidth() - 1;
- gc.drawLine(viewportBorderX, 0, viewportBorderX,
- layer.getHeight() - 1);
+ gc.drawLine(viewportBorderX, 0, viewportBorderX, layer.getHeight() - 1);
gc.setForeground(beforeColor);
}
});
@@ -163,8 +148,8 @@
return composite;
}
- private void createSplitSliders(Composite natTableParent,
- final ViewportLayer left, final ViewportLayer right) {
+ private void createSplitSliders(
+ Composite natTableParent, final ViewportLayer left, final ViewportLayer right) {
Composite sliderComposite = new Composite(natTableParent, SWT.NONE);
GridData gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
@@ -186,8 +171,7 @@
Composite sliderLeftComposite = new Composite(sliderComposite, SWT.NONE) {
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
- int width = ((ClientAreaAdapter) left.getClientAreaProvider())
- .getWidth();
+ int width = ((ClientAreaAdapter) left.getClientAreaProvider()).getWidth();
return new Point(width, 17);
}
};
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5043_VerticalSplitViewportExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5043_VerticalSplitViewportExample.java
index b99c1cd..c99157f 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5043_VerticalSplitViewportExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5043_VerticalSplitViewportExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._504_Viewport;
@@ -15,9 +15,9 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.layer.CompositeLayer;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
@@ -44,15 +44,11 @@
/**
* Example showing how to implement NatTable that contains two vertical split
* viewports.
- *
- * @author Dirk Fauth
- *
*/
public class _5043_VerticalSplitViewportExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner.run(600, 400,
- new _5043_VerticalSplitViewportExample());
+ StandaloneNatExampleRunner.run(600, 400, new _5043_VerticalSplitViewportExample());
}
@Override
@@ -64,12 +60,11 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday", "address.street", "address.housenumber",
- "address.postalCode", "address.city" };
+ String[] propertyNames = { "firstName", "lastName", "gender", "married", "birthday",
+ "address.street", "address.housenumber", "address.postalCode", "address.city" };
- IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor = new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(
- propertyNames);
+ IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor =
+ new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(propertyNames);
IDataProvider bodyDataProvider = new ListDataProvider<PersonWithAddress>(
PersonService.getPersonsWithAddress(50), columnPropertyAccessor);
@@ -77,18 +72,15 @@
// use a cell layer painter that is configured for left clipping
// this ensures that the rendering works correctly for split viewports
- bodyDataLayer
- .setLayerPainter(new GridLineCellLayerPainter(false, true));
+ bodyDataLayer.setLayerPainter(new GridLineCellLayerPainter(false, true));
// create a ViewportLayer for the top part of the table and configure it
- // to only contain
- // the first 10 rows
+ // to only contain the first 10 rows
final ViewportLayer viewportLayerTop = new ViewportLayer(bodyDataLayer);
viewportLayerTop.setMaxRowPosition(10);
// create a ViewportLayer for the bottom part of the table and configure
- // it to only contain
- // the last rows
+ // it to only contain the last rows
ViewportLayer viewportLayerBottom = new ViewportLayer(bodyDataLayer);
viewportLayerBottom.setMinRowPosition(10);
@@ -98,28 +90,22 @@
compositeLayer.setChildLayer("REGION_B", viewportLayerBottom, 0, 1);
// in order to make printing and exporting work correctly you need to
- // register the following
- // command handlers
- // although in this example printing and exporting is not enabled, we
- // show the registering
- compositeLayer
- .registerCommandHandler(new MultiTurnViewportOnCommandHandler(
- viewportLayerTop, viewportLayerBottom));
- compositeLayer
- .registerCommandHandler(new MultiTurnViewportOffCommandHandler(
- viewportLayerTop, viewportLayerBottom));
+ // register the following command handlers although in this example
+ // printing and exporting is not enabled, we show the registering
+ compositeLayer.registerCommandHandler(
+ new MultiTurnViewportOnCommandHandler(viewportLayerTop, viewportLayerBottom));
+ compositeLayer.registerCommandHandler(
+ new MultiTurnViewportOffCommandHandler(viewportLayerTop, viewportLayerBottom));
// set the height of the top viewport to only showing 2 rows at the same
// time
int topHeight = bodyDataLayer.getStartYOfRowPosition(2);
// as the CompositeLayer is setting a IClientAreaProvider for the
- // composition
- // we need to set a special ClientAreaAdapter after the creation of the
- // CompositeLayer
- // to support split viewports
- ClientAreaAdapter topClientAreaAdapter = new ClientAreaAdapter(
- viewportLayerTop.getClientAreaProvider());
+ // composition we need to set a special ClientAreaAdapter after the
+ // creation of the CompositeLayer to support split viewports
+ ClientAreaAdapter topClientAreaAdapter =
+ new ClientAreaAdapter(viewportLayerTop.getClientAreaProvider());
topClientAreaAdapter.setHeight(topHeight);
viewportLayerTop.setClientAreaProvider(topClientAreaAdapter);
@@ -144,9 +130,8 @@
createSplitSliders(composite, viewportLayerTop, viewportLayerBottom);
// add an IOverlayPainter to ensure the right border of the left
- // viewport always
- // this is necessary because the left border of layer stacks is not
- // rendered by default
+ // viewport always this is necessary because the left border of layer
+ // stacks is not rendered by default
natTable.addOverlayPainter(new IOverlayPainter() {
@Override
@@ -154,8 +139,7 @@
Color beforeColor = gc.getForeground();
gc.setForeground(GUIHelper.COLOR_GRAY);
int viewportBorderY = viewportLayerTop.getHeight() - 1;
- gc.drawLine(0, viewportBorderY, layer.getWidth() - 1,
- viewportBorderY);
+ gc.drawLine(0, viewportBorderY, layer.getWidth() - 1, viewportBorderY);
gc.setForeground(beforeColor);
}
});
@@ -163,8 +147,8 @@
return composite;
}
- private void createSplitSliders(Composite natTableParent,
- final ViewportLayer top, final ViewportLayer bottom) {
+ private void createSplitSliders(
+ Composite natTableParent, final ViewportLayer top, final ViewportLayer bottom) {
Composite sliderComposite = new Composite(natTableParent, SWT.NONE);
GridData gridData = new GridData();
gridData.verticalAlignment = GridData.FILL;
@@ -186,8 +170,7 @@
Composite sliderTopComposite = new Composite(sliderComposite, SWT.NONE) {
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
- int height = ((ClientAreaAdapter) top.getClientAreaProvider())
- .getHeight();
+ int height = ((ClientAreaAdapter) top.getClientAreaProvider()).getHeight();
return new Point(17, height);
}
};
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5044_HorizontalSplitViewportGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5044_HorizontalSplitViewportGridExample.java
index 4a06ac3..9af58b2 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5044_HorizontalSplitViewportGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_504_Viewport/_5044_HorizontalSplitViewportGridExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._504_Viewport;
@@ -23,9 +23,9 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
@@ -78,18 +78,13 @@
/**
* Example showing how to implement NatTable that contains two horizontal split
* viewports in a grid.
- *
- * @author Dirk Fauth
- *
*/
-public class _5044_HorizontalSplitViewportGridExample extends
- AbstractNatExample {
+public class _5044_HorizontalSplitViewportGridExample extends AbstractNatExample {
public static final int SPLIT_COLUMN_INDEX = 5;
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner.run(600, 400,
- new _5044_HorizontalSplitViewportGridExample());
+ StandaloneNatExampleRunner.run(600, 400, new _5044_HorizontalSplitViewportGridExample());
}
@Override
@@ -101,9 +96,8 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday", "address.street", "address.housenumber",
- "address.postalCode", "address.city" };
+ String[] propertyNames = { "firstName", "lastName", "gender", "married", "birthday",
+ "address.street", "address.housenumber", "address.postalCode", "address.city" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -117,8 +111,8 @@
propertyToLabelMap.put("address.postalCode", "Postal Code");
propertyToLabelMap.put("address.city", "City");
- IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor = new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(
- propertyNames);
+ IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor =
+ new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(propertyNames);
final BodyLayerStack<PersonWithAddress> bodyLayer = new BodyLayerStack<PersonWithAddress>(
PersonService.getPersonsWithAddress(50), columnPropertyAccessor);
@@ -132,56 +126,51 @@
bodyLayer, bodyLayer.getSelectionLayer());
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- final DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- final AbstractLayer columnHeaderLayer = new ColumnHeaderLayer(
- columnHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ final DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ final AbstractLayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
// Use this special layer painter that supports rendering of split
- // viewports although
- // the ColumnHeaderLayer is not split. Here is some custom calculation
- // included that
- // might not work correctly in case there are column groups or other
- // spanning involved.
+ // viewports although the ColumnHeaderLayer is not split. Here is some
+ // custom calculation included that might not work correctly in case
+ // there are column groups or other spanning involved.
columnHeaderLayer.setLayerPainter(new CellLayerPainter() {
@Override
protected boolean isClipLeft(int position) {
// check position-1 because of the row header column count
// as the body is a composite layer, the default transformation
// for the grid is not working correctly
- int index = LayerUtil.convertColumnPosition(columnHeaderLayer,
- position - 1, columnHeaderDataLayer);
+ int index = LayerUtil.convertColumnPosition(
+ columnHeaderLayer, position - 1, columnHeaderDataLayer);
return (index > SPLIT_COLUMN_INDEX);
}
@Override
- protected void paintCell(ILayerCell cell, GC gc,
- IConfigRegistry configRegistry) {
+ protected void paintCell(ILayerCell cell, GC gc, IConfigRegistry configRegistry) {
ILayer layer = cell.getLayer();
int columnPosition = cell.getColumnPosition();
int rowPosition = cell.getRowPosition();
- ICellPainter cellPainter = layer.getCellPainter(columnPosition,
- rowPosition, cell, configRegistry);
- Rectangle adjustedCellBounds = layer.getLayerPainter()
- .adjustCellBounds(columnPosition, rowPosition,
- cell.getBounds());
+ ICellPainter cellPainter = layer.getCellPainter(
+ columnPosition, rowPosition, cell, configRegistry);
+ Rectangle adjustedCellBounds = layer
+ .getLayerPainter()
+ .adjustCellBounds(columnPosition, rowPosition, cell.getBounds());
if (cellPainter != null) {
Rectangle originalClipping = gc.getClipping();
int startX = getStartXOfColumnPosition(columnPosition);
int startY = getStartYOfRowPosition(rowPosition);
- int endX = getStartXOfColumnPosition(cell
- .getOriginColumnPosition() + cell.getColumnSpan());
- int endY = getStartYOfRowPosition(cell
- .getOriginRowPosition() + cell.getRowSpan());
+ int endX = getStartXOfColumnPosition(cell.getOriginColumnPosition() + cell.getColumnSpan());
+ int endY = getStartYOfRowPosition(cell.getOriginRowPosition() + cell.getRowSpan());
// correct position of first column in right region
// find the last visible column in left region
- int viewportBorderX = bodyLayer.getViewportLayerLeft()
- .getClientAreaWidth() + rowHeaderLayer.getWidth();
+ int viewportBorderX = bodyLayer.getViewportLayerLeft().getClientAreaWidth()
+ + rowHeaderLayer.getWidth();
if (isClipLeft(columnPosition) && startX < viewportBorderX) {
startX = viewportBorderX;
}
@@ -189,20 +178,16 @@
&& startX > viewportBorderX) {
startX = viewportBorderX;
}
- if (isClipLeft(cell.getOriginColumnPosition()
- + cell.getColumnSpan())
+ if (isClipLeft(cell.getOriginColumnPosition() + cell.getColumnSpan())
&& endX < viewportBorderX) {
endX = viewportBorderX;
}
- Rectangle cellClipBounds = originalClipping
- .intersection(new Rectangle(startX, startY, endX
- - startX, endY - startY));
- gc.setClipping(cellClipBounds
- .intersection(adjustedCellBounds));
+ Rectangle cellClipBounds = originalClipping.intersection(
+ new Rectangle(startX, startY, endX - startX, endY - startY));
+ gc.setClipping(cellClipBounds.intersection(adjustedCellBounds));
- cellPainter.paintCell(cell, gc, adjustedCellBounds,
- configRegistry);
+ cellPainter.paintCell(cell, gc, adjustedCellBounds, configRegistry);
gc.setClipping(originalClipping);
}
@@ -210,26 +195,27 @@
});
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- final ILayer cornerLayer = new CornerLayer(cornerDataLayer,
- rowHeaderLayer, columnHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ final ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(bodyLayer, columnHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(bodyLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
// in order to make printing and exporting work correctly you need to
- // register the following
- // command handlers
- gridLayer.registerCommandHandler(new MultiTurnViewportOnCommandHandler(
- bodyLayer.getViewportLayerLeft(), bodyLayer
- .getViewportLayerRight()));
- gridLayer
- .registerCommandHandler(new MultiTurnViewportOffCommandHandler(
- bodyLayer.getViewportLayerLeft(), bodyLayer
- .getViewportLayerRight()));
+ // register the following command handlers
+ gridLayer.registerCommandHandler(
+ new MultiTurnViewportOnCommandHandler(
+ bodyLayer.getViewportLayerLeft(),
+ bodyLayer.getViewportLayerRight()));
+ gridLayer.registerCommandHandler(
+ new MultiTurnViewportOffCommandHandler(
+ bodyLayer.getViewportLayerLeft(),
+ bodyLayer.getViewportLayerRight()));
// Wrap NatTable in composite so we can slap on the external horizontal
// sliders
@@ -263,10 +249,9 @@
public void paintOverlay(GC gc, ILayer layer) {
Color beforeColor = gc.getForeground();
gc.setForeground(GUIHelper.COLOR_GRAY);
- int viewportBorderX = bodyLayer.getViewportLayerLeft()
- .getWidth() + rowHeaderLayer.getWidth() - 1;
- gc.drawLine(viewportBorderX, 0, viewportBorderX,
- layer.getHeight() - 1);
+ int viewportBorderX = bodyLayer.getViewportLayerLeft().getWidth()
+ + rowHeaderLayer.getWidth() - 1;
+ gc.drawLine(viewportBorderX, 0, viewportBorderX, layer.getHeight() - 1);
gc.setForeground(beforeColor);
}
});
@@ -278,9 +263,9 @@
return composite;
}
- private void createSplitSliders(Composite natTableParent,
- final ILayer rowHeaderLayer, final ViewportLayer left,
- final ViewportLayer right) {
+ private void createSplitSliders(
+ Composite natTableParent, final ILayer rowHeaderLayer,
+ final ViewportLayer left, final ViewportLayer right) {
Composite sliderComposite = new Composite(natTableParent, SWT.NONE);
GridData gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
@@ -302,8 +287,7 @@
Composite sliderLeftComposite = new Composite(sliderComposite, SWT.NONE) {
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
- int width = ((ClientAreaAdapter) left.getClientAreaProvider())
- .getWidth();
+ int width = ((ClientAreaAdapter) left.getClientAreaProvider()).getWidth();
width += rowHeaderLayer.getWidth();
return new Point(width, 17);
}
@@ -346,46 +330,36 @@
private final ViewportLayer viewportLayerLeft;
private final ViewportLayer viewportLayerRight;
- public BodyLayerStack(List<T> values,
- IColumnPropertyAccessor<T> columnPropertyAccessor) {
- this.bodyDataProvider = new ListDataProvider<T>(values,
- columnPropertyAccessor);
+ public BodyLayerStack(List<T> values, IColumnPropertyAccessor<T> columnPropertyAccessor) {
+ this.bodyDataProvider = new ListDataProvider<T>(values, columnPropertyAccessor);
DataLayer bodyDataLayer = new DataLayer(getBodyDataProvider());
// use our custom reorder drag mode configuration instead of the
- // default to
- // suppress the ability to move a column from one viewport to the
- // other
- ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
- bodyDataLayer, false);
- columnReorderLayer
- .addConfiguration(new AbstractUiBindingConfiguration() {
+ // default to suppress the ability to move a column from one
+ // viewport to the other
+ ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(bodyDataLayer, false);
+ columnReorderLayer.addConfiguration(new AbstractUiBindingConfiguration() {
- @Override
- public void configureUiBindings(
- UiBindingRegistry uiBindingRegistry) {
- uiBindingRegistry.registerMouseDragMode(
- MouseEventMatcher
- .columnHeaderLeftClick(SWT.NONE),
- new AggregateDragMode(
- new CellDragMode(),
- new SplitViewportColumnReorderDragMode()));
- }
- });
+ @Override
+ public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
+ uiBindingRegistry.registerMouseDragMode(
+ MouseEventMatcher.columnHeaderLeftClick(SWT.NONE),
+ new AggregateDragMode(
+ new CellDragMode(),
+ new SplitViewportColumnReorderDragMode()));
+ }
+ });
- this.columnHideShowLayer = new ColumnHideShowLayer(
- columnReorderLayer);
+ this.columnHideShowLayer = new ColumnHideShowLayer(columnReorderLayer);
this.selectionLayer = new SelectionLayer(this.columnHideShowLayer);
// use a cell layer painter that is configured for left clipping
// this ensures that the rendering works correctly for split
// viewports
- this.selectionLayer.setLayerPainter(new SelectionLayerPainter(true,
- false));
+ this.selectionLayer.setLayerPainter(new SelectionLayerPainter(true, false));
// create a ViewportLayer for the left part of the table and
- // configure it to only contain
- // the first 5 columns
+ // configure it to only contain the first 5 columns
this.viewportLayerLeft = new ViewportLayer(this.selectionLayer) {
@Override
public int getMaxColumnPosition() {
@@ -394,8 +368,7 @@
};
// create a ViewportLayer for the right part of the table and
- // configure it to only contain
- // the last 4 columns
+ // configure it to only contain the last 4 columns
this.viewportLayerRight = new ViewportLayer(this.selectionLayer) {
@Override
public int getMinColumnPosition() {
@@ -404,16 +377,13 @@
};
// as the min column position is calculated dynamically we need to
// set the minimum origin manually
- int newMinOriginX = this.selectionLayer
- .getStartXOfColumnPosition(getNumberOfLeftColumns());
+ int newMinOriginX = this.selectionLayer.getStartXOfColumnPosition(getNumberOfLeftColumns());
this.viewportLayerRight.setMinimumOriginX(newMinOriginX);
// create a CompositeLayer that contains both ViewportLayers
CompositeLayer compositeLayer = new CompositeLayer(2, 1);
- compositeLayer.setChildLayer("REGION_A", getViewportLayerLeft(), 0,
- 0);
- compositeLayer.setChildLayer("REGION_B", getViewportLayerRight(),
- 1, 0);
+ compositeLayer.setChildLayer("REGION_A", getViewportLayerLeft(), 0, 0);
+ compositeLayer.setChildLayer("REGION_B", getViewportLayerRight(), 1, 0);
// set the width of the left viewport to only showing 2 columns at
// the same time
@@ -422,17 +392,16 @@
// as the CompositeLayer is setting a IClientAreaProvider for the
// composition
// we need to set a special ClientAreaAdapter after the creation of
- // the CompositeLayer
- // to support split viewports
- ClientAreaAdapter leftClientAreaAdapter = new ClientAreaAdapter(
- getViewportLayerLeft().getClientAreaProvider());
+ // the CompositeLayer to support split viewports
+ ClientAreaAdapter leftClientAreaAdapter =
+ new ClientAreaAdapter(getViewportLayerLeft().getClientAreaProvider());
leftClientAreaAdapter.setWidth(leftWidth);
getViewportLayerLeft().setClientAreaProvider(leftClientAreaAdapter);
// register configuration to avoid reordering of columns between the
// split viewports
- registerCommandHandler(new SplitViewportColumnReorderCommandHandler(
- getViewportLayerLeft()));
+ registerCommandHandler(
+ new SplitViewportColumnReorderCommandHandler(getViewportLayerLeft()));
setUnderlyingLayer(compositeLayer);
}
@@ -480,16 +449,13 @@
private ViewportLayer viewportLeft;
- public SplitViewportColumnReorderCommandHandler(
- ViewportLayer viewportLeft) {
+ public SplitViewportColumnReorderCommandHandler(ViewportLayer viewportLeft) {
this.viewportLeft = viewportLeft;
}
@Override
protected boolean doCommand(ColumnReorderCommand command) {
- if ((command.getFromColumnPosition() < this.viewportLeft
- .getColumnCount()) != (command.getToColumnPosition() < this.viewportLeft
- .getColumnCount())) {
+ if ((command.getFromColumnPosition() < this.viewportLeft.getColumnCount()) != (command.getToColumnPosition() < this.viewportLeft.getColumnCount())) {
// Bail out if trying to reorder from region A to B or vice
// versa
return true;
@@ -515,10 +481,8 @@
int dragFromGridColumnPosition, int dragToGridColumnPosition) {
if (((NatTable) natLayer).getCursor() == null) {
- int fromColumnIndex = natLayer
- .getColumnIndexByPosition(dragFromGridColumnPosition);
- int toColumnIndex = natLayer
- .getColumnIndexByPosition(dragToGridColumnPosition);
+ int fromColumnIndex = natLayer.getColumnIndexByPosition(dragFromGridColumnPosition);
+ int toColumnIndex = natLayer.getColumnIndexByPosition(dragToGridColumnPosition);
// ensure that dragging over split viewport borders is not
// allowed
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5051_SelectionLayerExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5051_SelectionLayerExample.java
index c49235a..1b68847 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5051_SelectionLayerExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5051_SelectionLayerExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._505_Selection;
@@ -15,9 +15,9 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
@@ -28,15 +28,11 @@
/**
* Simple example showing the SelectionLayer.
- *
- * @author Dirk Fauth
- *
*/
public class _5051_SelectionLayerExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner.run(600, 400,
- new _5051_SelectionLayerExample());
+ StandaloneNatExampleRunner.run(600, 400, new _5051_SelectionLayerExample());
}
@Override
@@ -47,12 +43,11 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday", "address.street", "address.housenumber",
- "address.postalCode", "address.city" };
+ String[] propertyNames = { "firstName", "lastName", "gender", "married", "birthday",
+ "address.street", "address.housenumber", "address.postalCode", "address.city" };
- IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor = new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(
- propertyNames);
+ IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor =
+ new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(propertyNames);
IDataProvider bodyDataProvider = new ListDataProvider<PersonWithAddress>(
PersonService.getPersonsWithAddress(50), columnPropertyAccessor);
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5052_RowSelectionExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5052_RowSelectionExample.java
index b7c0ee7..84bc31d 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5052_RowSelectionExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5052_RowSelectionExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2014 Dirk Fauth and others.
+ * Copyright (c) 2013, 2014, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,9 +23,9 @@
import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5053_SelectionEventsExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5053_SelectionEventsExample.java
index ffe7c90..d9e7d4f 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5053_SelectionEventsExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5053_SelectionEventsExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._505_Selection;
@@ -22,9 +22,9 @@
import org.eclipse.nebula.widgets.nattable.data.IRowDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
@@ -51,15 +51,11 @@
/**
* Example showing custom selection event handling in a NatTable grid
* composition.
- *
- * @author Dirk Fauth
- *
*/
public class _5053_SelectionEventsExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner.run(600, 400,
- new _5053_SelectionEventsExample());
+ StandaloneNatExampleRunner.run(600, 400, new _5053_SelectionEventsExample());
}
@Override
@@ -71,8 +67,12 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -82,46 +82,58 @@
propertyToLabelMap.put("married", "Married");
propertyToLabelMap.put("birthday", "Birthday");
- IColumnPropertyAccessor<Person> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<Person>(
- propertyNames);
+ IColumnPropertyAccessor<Person> columnPropertyAccessor =
+ new ReflectiveColumnPropertyAccessor<Person>(propertyNames);
final List<Person> data = PersonService.getPersons(10);
// create the body layer stack
- final IRowDataProvider<Person> bodyDataProvider = new ListDataProvider<Person>(
- data, columnPropertyAccessor);
- final DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
- final SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
- ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
+ final IRowDataProvider<Person> bodyDataProvider =
+ new ListDataProvider<Person>(data, columnPropertyAccessor);
+ final DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
+ final SelectionLayer selectionLayer =
+ new SelectionLayer(bodyDataLayer);
+ ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
// create the column header layer stack
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(
- columnHeaderDataProvider), viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(
+ new DataLayer(columnHeaderDataProvider),
+ viewportLayer,
+ selectionLayer);
// create the row header layer stack
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
ILayer rowHeaderLayer = new RowHeaderLayer(
- new DefaultRowHeaderDataLayer(new DefaultRowHeaderDataProvider(
- bodyDataProvider)), viewportLayer, selectionLayer);
+ new DefaultRowHeaderDataLayer(
+ new DefaultRowHeaderDataProvider(bodyDataProvider)),
+ viewportLayer,
+ selectionLayer);
// create the corner layer stack
- ILayer cornerLayer = new CornerLayer(new DataLayer(
- new DefaultCornerDataProvider(columnHeaderDataProvider,
- rowHeaderDataProvider)), rowHeaderLayer,
+ ILayer cornerLayer = new CornerLayer(
+ new DataLayer(
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider)),
+ rowHeaderLayer,
columnHeaderLayer);
// create the grid layer composed with the prior created layer stacks
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(
+ viewportLayer,
+ columnHeaderLayer,
+ rowHeaderLayer,
+ cornerLayer);
final NatTable natTable = new NatTable(parent, gridLayer);
// Events are fired whenever selection occurs. These can be use to
- // trigger
- // external actions as required.
+ // trigger external actions as required.
//
// This adds a custom ILayerListener that will listen and handle
// selection events on NatTable level
@@ -142,17 +154,14 @@
cellEvent.getRowPosition()));
} else if (event instanceof ColumnSelectionEvent) {
ColumnSelectionEvent columnEvent = (ColumnSelectionEvent) event;
- log("Selected Column: "
- + columnEvent.getColumnPositionRanges());
+ log("Selected Column: " + columnEvent.getColumnPositionRanges());
} else if (event instanceof RowSelectionEvent) {
// directly ask the SelectionLayer about the selected rows
// and access the data via IRowDataProvider
- Collection<Range> selections = selectionLayer
- .getSelectedRowPositions();
- StringBuilder builder = new StringBuilder(
- "Selected Persons: ").append(
- selectionLayer.getSelectedRowPositions()).append(
- "[");
+ Collection<Range> selections = selectionLayer.getSelectedRowPositions();
+ StringBuilder builder = new StringBuilder("Selected Persons: ")
+ .append(selectionLayer.getSelectedRowPositions())
+ .append("[");
for (Range r : selections) {
for (int i = r.start; i < r.end; i++) {
Person p = bodyDataProvider.getRowObject(i);
@@ -160,7 +169,8 @@
if (!builder.toString().endsWith("[")) {
builder.append(", ");
}
- builder.append(p.getFirstName()).append(" ")
+ builder.append(p.getFirstName())
+ .append(" ")
.append(p.getLastName());
}
}
@@ -173,8 +183,7 @@
// Layout widgets
parent.setLayout(new GridLayout(1, true));
- natTable.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
- true));
+ natTable.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
// add a log area to the example to show the log entries
setupTextArea(parent);
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5054_SelectionProviderExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5054_SelectionProviderExample.java
index e1d557c..ec79355 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5054_SelectionProviderExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5054_SelectionProviderExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._505_Selection;
@@ -34,9 +34,9 @@
import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -70,9 +70,6 @@
/**
* Example showing how to use JFace ISelectionProvider with a NatTable grid
* composition.
- *
- * @author Dirk Fauth
- *
*/
public class _5054_SelectionProviderExample extends AbstractNatExample {
@@ -81,8 +78,7 @@
private boolean isFirstSelectionProvider = true;
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner.run(600, 400,
- new _5054_SelectionProviderExample());
+ StandaloneNatExampleRunner.run(600, 400, new _5054_SelectionProviderExample());
}
@Override
@@ -105,8 +101,8 @@
propertyToLabelMap.put("lastName", "Lastname");
propertyToLabelMap.put("firstName", "Firstname");
- IColumnPropertyAccessor<Person> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<Person>(
- propertyNames);
+ IColumnPropertyAccessor<Person> columnPropertyAccessor =
+ new ReflectiveColumnPropertyAccessor<Person>(propertyNames);
IRowIdAccessor<Person> rowIdAccessor = new IRowIdAccessor<Person>() {
@Override
@@ -117,51 +113,52 @@
// create the first table
// create the body layer stack
- final IRowDataProvider<Person> firstBodyDataProvider = new ListDataProvider<Person>(
- getSimpsonsList(), columnPropertyAccessor);
- final DataLayer firstBodyDataLayer = new DataLayer(
- firstBodyDataProvider);
- final SelectionLayer firstSelectionLayer = new SelectionLayer(
- firstBodyDataLayer);
- ViewportLayer firstViewportLayer = new ViewportLayer(
- firstSelectionLayer);
+ final IRowDataProvider<Person> firstBodyDataProvider =
+ new ListDataProvider<Person>(getSimpsonsList(), columnPropertyAccessor);
+ final DataLayer firstBodyDataLayer =
+ new DataLayer(firstBodyDataProvider);
+ final SelectionLayer firstSelectionLayer =
+ new SelectionLayer(firstBodyDataLayer);
+ ViewportLayer firstViewportLayer =
+ new ViewportLayer(firstSelectionLayer);
// use a RowSelectionModel that will perform row selections and is able
// to identify a row via unique ID
- firstSelectionLayer.setSelectionModel(new RowSelectionModel<Person>(
- firstSelectionLayer, firstBodyDataProvider, rowIdAccessor));
+ firstSelectionLayer.setSelectionModel(
+ new RowSelectionModel<Person>(
+ firstSelectionLayer,
+ firstBodyDataProvider,
+ rowIdAccessor));
// create the column header layer stack
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer firstColumnHeaderDataLayer = new DataLayer(
- columnHeaderDataProvider);
- ColumnHeaderLayer firstColumnHeaderLayer = new ColumnHeaderLayer(
- firstColumnHeaderDataLayer, firstViewportLayer,
- firstSelectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer firstColumnHeaderDataLayer =
+ new DataLayer(columnHeaderDataProvider);
+ ColumnHeaderLayer firstColumnHeaderLayer =
+ new ColumnHeaderLayer(
+ firstColumnHeaderDataLayer,
+ firstViewportLayer,
+ firstSelectionLayer);
// register custom label styling to indicate if the table is active
- firstColumnHeaderDataLayer
- .setConfigLabelAccumulator(new IConfigLabelAccumulator() {
- @Override
- public void accumulateConfigLabels(LabelStack configLabels,
- int columnPosition, int rowPosition) {
- if (_5054_SelectionProviderExample.this.isFirstSelectionProvider) {
- configLabels.addLabelOnTop(ACTIVE_LABEL);
- }
- }
- });
+ firstColumnHeaderDataLayer.setConfigLabelAccumulator(new IConfigLabelAccumulator() {
+ @Override
+ public void accumulateConfigLabels(
+ LabelStack configLabels, int columnPosition, int rowPosition) {
+ if (_5054_SelectionProviderExample.this.isFirstSelectionProvider) {
+ configLabels.addLabelOnTop(ACTIVE_LABEL);
+ }
+ }
+ });
// set the region labels to make default configurations work, e.g.
// selection
CompositeLayer firstCompositeLayer = new CompositeLayer(1, 2);
- firstCompositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
- firstColumnHeaderLayer, 0, 0);
- firstCompositeLayer.setChildLayer(GridRegion.BODY, firstViewportLayer,
- 0, 1);
+ firstCompositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, firstColumnHeaderLayer, 0, 0);
+ firstCompositeLayer.setChildLayer(GridRegion.BODY, firstViewportLayer, 0, 1);
- final NatTable firstNatTable = new NatTable(panel, firstCompositeLayer,
- false);
+ final NatTable firstNatTable = new NatTable(panel, firstCompositeLayer, false);
firstNatTable.addConfiguration(new DefaultNatTableStyleConfiguration());
firstNatTable.addConfiguration(new ActiveTableStyleConfiguration());
@@ -175,52 +172,55 @@
// create the second table
// create the body layer stack
- final IRowDataProvider<Person> secondBodyDataProvider = new ListDataProvider<Person>(
- getFlandersList(), columnPropertyAccessor);
- final DataLayer secondBodyDataLayer = new DataLayer(
- secondBodyDataProvider);
- final SelectionLayer secondSelectionLayer = new SelectionLayer(
- secondBodyDataLayer);
- ViewportLayer secondViewportLayer = new ViewportLayer(
- secondSelectionLayer);
+ final IRowDataProvider<Person> secondBodyDataProvider =
+ new ListDataProvider<Person>(getFlandersList(), columnPropertyAccessor);
+ final DataLayer secondBodyDataLayer =
+ new DataLayer(secondBodyDataProvider);
+ final SelectionLayer secondSelectionLayer =
+ new SelectionLayer(secondBodyDataLayer);
+ ViewportLayer secondViewportLayer =
+ new ViewportLayer(secondSelectionLayer);
// use a RowSelectionModel that will perform row selections and is able
// to identify a row via unique ID
- secondSelectionLayer.setSelectionModel(new RowSelectionModel<Person>(
- secondSelectionLayer, secondBodyDataProvider, rowIdAccessor));
+ secondSelectionLayer.setSelectionModel(
+ new RowSelectionModel<Person>(
+ secondSelectionLayer,
+ secondBodyDataProvider,
+ rowIdAccessor));
// create the column header layer stack
- DataLayer secondColumnHeaderDataLayer = new DataLayer(
- columnHeaderDataProvider);
- ILayer secondColumnHeaderLayer = new ColumnHeaderLayer(
- secondColumnHeaderDataLayer, secondViewportLayer,
- secondSelectionLayer);
+ DataLayer secondColumnHeaderDataLayer =
+ new DataLayer(columnHeaderDataProvider);
+ ILayer secondColumnHeaderLayer =
+ new ColumnHeaderLayer(
+ secondColumnHeaderDataLayer,
+ secondViewportLayer,
+ secondSelectionLayer);
// register custom label styling to indicate if the table is active
- secondColumnHeaderDataLayer
- .setConfigLabelAccumulator(new IConfigLabelAccumulator() {
- @Override
- public void accumulateConfigLabels(LabelStack configLabels,
- int columnPosition, int rowPosition) {
- if (!_5054_SelectionProviderExample.this.isFirstSelectionProvider) {
- configLabels.addLabelOnTop(ACTIVE_LABEL);
- }
- }
- });
+ secondColumnHeaderDataLayer.setConfigLabelAccumulator(new IConfigLabelAccumulator() {
+ @Override
+ public void accumulateConfigLabels(
+ LabelStack configLabels, int columnPosition, int rowPosition) {
+ if (!_5054_SelectionProviderExample.this.isFirstSelectionProvider) {
+ configLabels.addLabelOnTop(ACTIVE_LABEL);
+ }
+ }
+ });
// set the region labels to make default configurations work, e.g.
// selection
CompositeLayer secondCompositeLayer = new CompositeLayer(1, 2);
- secondCompositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
- secondColumnHeaderLayer, 0, 0);
- secondCompositeLayer.setChildLayer(GridRegion.BODY,
- secondViewportLayer, 0, 1);
+ secondCompositeLayer.setChildLayer(
+ GridRegion.COLUMN_HEADER, secondColumnHeaderLayer, 0, 0);
+ secondCompositeLayer.setChildLayer(
+ GridRegion.BODY, secondViewportLayer, 0, 1);
- final NatTable secondNatTable = new NatTable(panel,
- secondCompositeLayer, false);
+ final NatTable secondNatTable =
+ new NatTable(panel, secondCompositeLayer, false);
- secondNatTable
- .addConfiguration(new DefaultNatTableStyleConfiguration());
+ secondNatTable.addConfiguration(new DefaultNatTableStyleConfiguration());
secondNatTable.addConfiguration(new ActiveTableStyleConfiguration());
secondNatTable.configure();
@@ -231,31 +231,32 @@
secondNatTable.addOverlayPainter(new NatTableBorderOverlayPainter());
// set ISelectionProvider
- final RowSelectionProvider<Person> selectionProvider = new RowSelectionProvider<Person>(
- firstSelectionLayer, firstBodyDataProvider);
+ final RowSelectionProvider<Person> selectionProvider =
+ new RowSelectionProvider<Person>(
+ firstSelectionLayer,
+ firstBodyDataProvider);
// add a listener to the selection provider, in an Eclipse application
- // you would do this
- // e.g. getSite().getPage().addSelectionListener()
- selectionProvider
- .addSelectionChangedListener(new ISelectionChangedListener() {
+ // you would do this e.g. getSite().getPage().addSelectionListener()
+ selectionProvider.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- log("Selection changed:");
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ log("Selection changed:");
- IStructuredSelection selection = (IStructuredSelection) event
- .getSelection();
- @SuppressWarnings("rawtypes")
- Iterator it = selection.iterator();
- while (it.hasNext()) {
- Person selected = (Person) it.next();
- log(" " + selected.getFirstName() + " "
- + selected.getLastName());
- }
- }
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ @SuppressWarnings("rawtypes")
+ Iterator it = selection.iterator();
+ while (it.hasNext()) {
+ Person selected = (Person) it.next();
+ log(" "
+ + selected.getFirstName()
+ + " "
+ + selected.getLastName());
+ }
+ }
- });
+ });
// layout widgets
GridDataFactory.fillDefaults().grab(true, true).applyTo(firstNatTable);
@@ -264,8 +265,7 @@
// add a region for buttons
Composite buttonArea = new Composite(panel, SWT.NONE);
buttonArea.setLayout(new RowLayout());
- GridDataFactory.fillDefaults().grab(true, false).span(2, 1)
- .applyTo(buttonArea);
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(buttonArea);
// create a button to enable selection provider change
Button button = new Button(buttonArea, SWT.PUSH);
@@ -273,18 +273,17 @@
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- _5054_SelectionProviderExample.this.isFirstSelectionProvider = !_5054_SelectionProviderExample.this.isFirstSelectionProvider;
+ _5054_SelectionProviderExample.this.isFirstSelectionProvider =
+ !_5054_SelectionProviderExample.this.isFirstSelectionProvider;
if (_5054_SelectionProviderExample.this.isFirstSelectionProvider) {
- selectionProvider.updateSelectionProvider(
- firstSelectionLayer, firstBodyDataProvider);
+ selectionProvider.updateSelectionProvider(firstSelectionLayer, firstBodyDataProvider);
} else {
- selectionProvider.updateSelectionProvider(
- secondSelectionLayer, secondBodyDataProvider);
+ selectionProvider.updateSelectionProvider(secondSelectionLayer, secondBodyDataProvider);
}
// refresh both tables to update the active rendering in the
- // column header
- // this is not necessary for updating the selection provider
+ // column header/ this is not necessary for updating the
+ // selection provider
firstNatTable.doCommand(new VisualRefreshCommand());
secondNatTable.doCommand(new VisualRefreshCommand());
}
@@ -292,8 +291,7 @@
// add a log area to the example to show the log entries
Text output = setupTextArea(panel);
- GridDataFactory.fillDefaults().grab(true, true).span(2, 1)
- .applyTo(output);
+ GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(output);
return panel;
}
@@ -301,16 +299,11 @@
private List<Person> getSimpsonsList() {
List<Person> result = new ArrayList<Person>();
- result.add(new Person(1, "Homer", "Simpson", Gender.MALE, true,
- new Date()));
- result.add(new Person(2, "Marge", "Simpson", Gender.FEMALE, true,
- new Date()));
- result.add(new Person(3, "Bart", "Simpson", Gender.MALE, false,
- new Date()));
- result.add(new Person(4, "Lisa", "Simpson", Gender.FEMALE, false,
- new Date()));
- result.add(new Person(5, "Maggie", "Simpson", Gender.FEMALE, false,
- new Date()));
+ result.add(new Person(1, "Homer", "Simpson", Gender.MALE, true, new Date()));
+ result.add(new Person(2, "Marge", "Simpson", Gender.FEMALE, true, new Date()));
+ result.add(new Person(3, "Bart", "Simpson", Gender.MALE, false, new Date()));
+ result.add(new Person(4, "Lisa", "Simpson", Gender.FEMALE, false, new Date()));
+ result.add(new Person(5, "Maggie", "Simpson", Gender.FEMALE, false, new Date()));
return result;
}
@@ -318,14 +311,10 @@
private List<Person> getFlandersList() {
List<Person> result = new ArrayList<Person>();
- result.add(new Person(6, "Ned", "Flanders", Gender.MALE, true,
- new Date()));
- result.add(new Person(7, "Maude", "Flanders", Gender.FEMALE, true,
- new Date()));
- result.add(new Person(8, "Rod", "Flanders", Gender.MALE, false,
- new Date()));
- result.add(new Person(9, "Todd", "Flanders", Gender.MALE, false,
- new Date()));
+ result.add(new Person(6, "Ned", "Flanders", Gender.MALE, true, new Date()));
+ result.add(new Person(7, "Maude", "Flanders", Gender.FEMALE, true, new Date()));
+ result.add(new Person(8, "Rod", "Flanders", Gender.MALE, false, new Date()));
+ result.add(new Person(9, "Todd", "Flanders", Gender.MALE, false, new Date()));
return result;
}
@@ -335,17 +324,23 @@
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
IStyle style = new Style();
- style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
+ style.setAttributeValue(
+ CellStyleAttributes.BACKGROUND_COLOR,
GUIHelper.COLOR_BLUE);
- style.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR,
+ style.setAttributeValue(
+ CellStyleAttributes.FOREGROUND_COLOR,
GUIHelper.COLOR_WHITE);
configRegistry.registerConfigAttribute(
- CellConfigAttributes.CELL_STYLE, style, DisplayMode.NORMAL,
+ CellConfigAttributes.CELL_STYLE,
+ style,
+ DisplayMode.NORMAL,
ACTIVE_LABEL);
configRegistry.registerConfigAttribute(
- CellConfigAttributes.CELL_STYLE, style, DisplayMode.SELECT,
+ CellConfigAttributes.CELL_STYLE,
+ style,
+ DisplayMode.SELECT,
ACTIVE_LABEL);
}
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5055_SelectionTraversalExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5055_SelectionTraversalExample.java
index 0c8a50f..5a58077 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5055_SelectionTraversalExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_505_Selection/_5055_SelectionTraversalExample.java
@@ -26,6 +26,8 @@
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultBooleanDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDateDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditBindings;
import org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditConfiguration;
@@ -33,8 +35,6 @@
import org.eclipse.nebula.widgets.nattable.edit.editor.DateCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5061_SimpleHoverStylingExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5061_SimpleHoverStylingExample.java
index 987ef04..77271b2 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5061_SimpleHoverStylingExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5061_SimpleHoverStylingExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._506_Hover;
@@ -16,9 +16,9 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
@@ -37,15 +37,11 @@
/**
* Simple example showing how to add the {@link HoverLayer} to a simple layer
* composition.
- *
- * @author Dirk Fauth
- *
*/
public class _5061_SimpleHoverStylingExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner.run(600, 400,
- new _5061_SimpleHoverStylingExample());
+ StandaloneNatExampleRunner.run(600, 400, new _5061_SimpleHoverStylingExample());
}
@Override
@@ -56,17 +52,22 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday" };
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(10), propertyNames);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(
+ PersonService.getPersons(10),
+ propertyNames);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
HoverLayer hoverLayer = new HoverLayer(bodyDataLayer, false);
@@ -84,8 +85,7 @@
NatTable natTable = new NatTable(parent, viewportLayer, false);
// as the autoconfiguration of the NatTable is turned off, we have to
- // add the
- // DefaultNatTableStyleConfiguration manually
+ // add the DefaultNatTableStyleConfiguration manually
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
// add the style configuration for hover
@@ -95,20 +95,24 @@
public void configureRegistry(IConfigRegistry configRegistry) {
// style that is applied when cells are hovered
Style style = new Style();
- style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
+ style.setAttributeValue(
+ CellStyleAttributes.BACKGROUND_COLOR,
GUIHelper.COLOR_YELLOW);
configRegistry.registerConfigAttribute(
- CellConfigAttributes.CELL_STYLE, style,
+ CellConfigAttributes.CELL_STYLE,
+ style,
DisplayMode.HOVER);
// style that is applied when selected cells are hovered
style = new Style();
- style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
+ style.setAttributeValue(
+ CellStyleAttributes.BACKGROUND_COLOR,
GUIHelper.COLOR_GREEN);
configRegistry.registerConfigAttribute(
- CellConfigAttributes.CELL_STYLE, style,
+ CellConfigAttributes.CELL_STYLE,
+ style,
DisplayMode.SELECT_HOVER);
}
});
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5062_CompositeHoverStylingExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5062_CompositeHoverStylingExample.java
index d9e0f0f..aee323d 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5062_CompositeHoverStylingExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5062_CompositeHoverStylingExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._506_Hover;
@@ -19,9 +19,9 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
@@ -52,8 +52,7 @@
public class _5062_CompositeHoverStylingExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner.run(600, 400,
- new _5062_CompositeHoverStylingExample());
+ StandaloneNatExampleRunner.run(600, 400, new _5062_CompositeHoverStylingExample());
}
@Override
@@ -65,8 +64,12 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -81,8 +84,10 @@
// AbstractIndexLayerTransform and setting the ViewportLayer
// as underlying layer. But in this case using the ViewportLayer
// directly as body layer is also working.
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(10), propertyNames);
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(
+ PersonService.getPersons(10),
+ propertyNames);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
HoverLayer hoverLayer = new HoverLayer(bodyDataLayer);
SelectionLayer selectionLayer = new SelectionLayer(hoverLayer);
@@ -90,13 +95,19 @@
// build the column header layer
IDataProvider columnHeaderDataProvider =
- new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ new DefaultColumnHeaderDataProvider(
+ propertyNames,
+ propertyToLabelMap);
DataLayer columnHeaderDataLayer =
new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
HoverLayer columnHoverLayer =
new HoverLayer(columnHeaderDataLayer, false);
ColumnHeaderLayer columnHeaderLayer =
- new ColumnHeaderLayer(columnHoverLayer, viewportLayer, selectionLayer, false);
+ new ColumnHeaderLayer(
+ columnHoverLayer,
+ viewportLayer,
+ selectionLayer,
+ false);
// add ColumnHeaderHoverLayerConfiguration to ensure that hover styling
// and resizing is working together
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5063_GridBodyHoverStylingExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5063_GridBodyHoverStylingExample.java
index 864ddd7..0f3f89a 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5063_GridBodyHoverStylingExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5063_GridBodyHoverStylingExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._506_Hover;
@@ -19,9 +19,9 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -51,9 +51,6 @@
* Simple example showing how to add the {@link HoverLayer} to a grid layer
* composition. This example only show how to add hover styling to the body of a
* grid.
- *
- * @author Dirk Fauth
- *
*/
public class _5063_GridBodyHoverStylingExample extends AbstractNatExample {
@@ -70,8 +67,12 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -83,61 +84,81 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(10), propertyNames);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(
+ PersonService.getPersons(10),
+ propertyNames);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
HoverLayer hoverLayer = new HoverLayer(bodyDataLayer);
SelectionLayer selectionLayer = new SelectionLayer(hoverLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(
- columnHeaderDataLayer, viewportLayer, selectionLayer, false);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(
+ propertyNames,
+ propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ColumnHeaderLayer columnHeaderLayer =
+ new ColumnHeaderLayer(
+ columnHeaderDataLayer,
+ viewportLayer,
+ selectionLayer,
+ false);
// add ColumnHeaderHoverLayerConfiguration to ensure that hover styling
// and resizing is working together
- columnHeaderLayer
- .addConfiguration(new ColumnHeaderHoverLayerConfiguration(null));
+ columnHeaderLayer.addConfiguration(
+ new ColumnHeaderHoverLayerConfiguration(null));
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer, false);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ RowHeaderLayer rowHeaderLayer =
+ new RowHeaderLayer(
+ rowHeaderDataLayer,
+ viewportLayer,
+ selectionLayer,
+ false);
// add RowHeaderHoverLayerConfiguration to ensure that hover styling and
// resizing is working together
- rowHeaderLayer.addConfiguration(new RowHeaderHoverLayerConfiguration(
- null));
+ rowHeaderLayer.addConfiguration(
+ new RowHeaderHoverLayerConfiguration(null));
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- columnHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(
+ columnHeaderDataProvider,
+ rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(
+ cornerDataLayer,
+ rowHeaderLayer,
+ columnHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(
+ viewportLayer,
+ columnHeaderLayer,
+ rowHeaderLayer,
+ cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
NatTable natTable = new NatTable(parent, gridLayer, false);
// as the autoconfiguration of the NatTable is turned off, we have to
- // add the
- // DefaultNatTableStyleConfiguration manually
+ // add the DefaultNatTableStyleConfiguration manually
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
// add the style configuration for hover
@@ -146,11 +167,13 @@
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
Style style = new Style();
- style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
+ style.setAttributeValue(
+ CellStyleAttributes.BACKGROUND_COLOR,
GUIHelper.COLOR_YELLOW);
configRegistry.registerConfigAttribute(
- CellConfigAttributes.CELL_STYLE, style,
+ CellConfigAttributes.CELL_STYLE,
+ style,
DisplayMode.HOVER);
}
});
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5064_GridHeaderHoverStylingExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5064_GridHeaderHoverStylingExample.java
index 18721a2..0717dd4 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5064_GridHeaderHoverStylingExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5064_GridHeaderHoverStylingExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._506_Hover;
@@ -20,9 +20,9 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
@@ -75,8 +75,12 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5065_GridHoverStylingExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5065_GridHoverStylingExample.java
index d60da2c..91ae08b 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5065_GridHoverStylingExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_506_Hover/_5065_GridHoverStylingExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._506_Hover;
@@ -19,9 +19,9 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_507_HideShow/_5071_ColumnHideShowExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_507_HideShow/_5071_ColumnHideShowExample.java
index 951457b..513e326 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_507_HideShow/_5071_ColumnHideShowExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_507_HideShow/_5071_ColumnHideShowExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._507_HideShow;
@@ -16,9 +16,9 @@
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -44,9 +44,6 @@
* Simple example showing how to add the {@link ColumnHideShowLayer} to the
* layer composition of a grid and how to add the corresponding actions to the
* column header menu.
- *
- * @author Dirk Fauth
- *
*/
public class _5071_ColumnHideShowExample extends AbstractNatExample {
@@ -65,8 +62,12 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -78,52 +79,71 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(10), propertyNames);
- DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
- ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(
- bodyDataLayer);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(
+ PersonService.getPersons(10),
+ propertyNames);
+ DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
+ ColumnHideShowLayer columnHideShowLayer =
+ new ColumnHideShowLayer(bodyDataLayer);
SelectionLayer selectionLayer = new SelectionLayer(columnHideShowLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(
+ propertyNames,
+ propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(
+ columnHeaderDataLayer,
+ viewportLayer,
+ selectionLayer);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(
+ rowHeaderDataLayer,
+ viewportLayer,
+ selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- columnHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(
+ columnHeaderDataProvider,
+ rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(
+ cornerDataLayer,
+ rowHeaderLayer,
+ columnHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(
+ viewportLayer,
+ columnHeaderLayer,
+ rowHeaderLayer,
+ cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
NatTable natTable = new NatTable(parent, gridLayer, false);
// as the autoconfiguration of the NatTable is turned off, we have to
- // add the
- // DefaultNatTableStyleConfiguration manually
+ // add the DefaultNatTableStyleConfiguration manually
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
// add the header menu configuration for adding the column header menu
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_507_HideShow/_5072_RowHideShowExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_507_HideShow/_5072_RowHideShowExample.java
index 2343719..cd5cf92 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_507_HideShow/_5072_RowHideShowExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_507_HideShow/_5072_RowHideShowExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._507_HideShow;
@@ -16,9 +16,9 @@
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -44,9 +44,6 @@
* Simple example showing how to add the {@link RowHideShowLayer} to the layer
* composition of a grid and how to add the corresponding actions to the row
* header menu.
- *
- * @author Dirk Fauth
- *
*/
public class _5072_RowHideShowExample extends AbstractNatExample {
@@ -65,8 +62,12 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -78,51 +79,52 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(10), propertyNames);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(
+ PersonService.getPersons(10),
+ propertyNames);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
RowHideShowLayer rowHideShowLayer = new RowHideShowLayer(bodyDataLayer);
SelectionLayer selectionLayer = new SelectionLayer(rowHideShowLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- columnHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(viewportLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
NatTable natTable = new NatTable(parent, gridLayer, false);
// as the autoconfiguration of the NatTable is turned off, we have to
- // add the
- // DefaultNatTableStyleConfiguration manually
+ // add the DefaultNatTableStyleConfiguration manually
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
// add the header menu configuration for adding the column header menu
@@ -131,7 +133,8 @@
@Override
protected PopupMenuBuilder createRowHeaderMenu(NatTable natTable) {
- return new PopupMenuBuilder(natTable).withHideRowMenuItem()
+ return new PopupMenuBuilder(natTable)
+ .withHideRowMenuItem()
.withShowAllRowsMenuItem();
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_507_HideShow/_5073_ColumnAndRowHideShowExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_507_HideShow/_5073_ColumnAndRowHideShowExample.java
index 4d37ef4..cc79b95 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_507_HideShow/_5073_ColumnAndRowHideShowExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_507_HideShow/_5073_ColumnAndRowHideShowExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._507_HideShow;
@@ -17,9 +17,9 @@
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -52,9 +52,6 @@
*
* Also adds the functionality to manage NatTable states to proof that the
* visibility states are stored and loaded correctly.
- *
- * @author Dirk Fauth
- *
*/
public class _5073_ColumnAndRowHideShowExample extends AbstractNatExample {
@@ -76,8 +73,12 @@
Composite panel = new Composite(parent, SWT.NONE);
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -89,55 +90,56 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(10), propertyNames);
- DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
- ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(
- bodyDataLayer);
- RowHideShowLayer rowHideShowLayer = new RowHideShowLayer(
- columnHideShowLayer);
- final SelectionLayer selectionLayer = new SelectionLayer(
- rowHideShowLayer);
- final ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(PersonService.getPersons(10), propertyNames);
+ DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
+ ColumnHideShowLayer columnHideShowLayer =
+ new ColumnHideShowLayer(bodyDataLayer);
+ RowHideShowLayer rowHideShowLayer =
+ new RowHideShowLayer(columnHideShowLayer);
+ final SelectionLayer selectionLayer =
+ new SelectionLayer(rowHideShowLayer);
+ final ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- columnHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(viewportLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
final NatTable natTable = new NatTable(panel, gridLayer, false);
// as the autoconfiguration of the NatTable is turned off, we have to
- // add the
- // DefaultNatTableStyleConfiguration manually
+ // add the DefaultNatTableStyleConfiguration manually
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
// add the header menu configuration for adding the column header menu
@@ -147,14 +149,16 @@
@Override
protected PopupMenuBuilder createColumnHeaderMenu(NatTable natTable) {
return super.createColumnHeaderMenu(natTable)
- .withHideColumnMenuItem().withShowAllColumnsMenuItem()
+ .withHideColumnMenuItem()
+ .withShowAllColumnsMenuItem()
.withStateManagerMenuItemProvider();
}
@Override
protected PopupMenuBuilder createRowHeaderMenu(NatTable natTable) {
return super.createRowHeaderMenu(natTable)
- .withHideRowMenuItem().withShowAllRowsMenuItem()
+ .withHideRowMenuItem()
+ .withShowAllRowsMenuItem()
.withStateManagerMenuItemProvider();
}
@@ -171,9 +175,8 @@
GridDataFactory.fillDefaults().grab(true, true).applyTo(panel);
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
- gridLayer
- .registerCommandHandler(new DisplayPersistenceDialogCommandHandler(
- natTable));
+ gridLayer.registerCommandHandler(
+ new DisplayPersistenceDialogCommandHandler(natTable));
return panel;
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_508_Reorder/_5081_ColumnReorderExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_508_Reorder/_5081_ColumnReorderExample.java
index cb4dea3..669ea7e 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_508_Reorder/_5081_ColumnReorderExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_508_Reorder/_5081_ColumnReorderExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._508_Reorder;
@@ -15,9 +15,9 @@
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -40,9 +40,6 @@
/**
* Simple example showing how to add the {@link ColumnReorderLayer} to the layer
* composition of a grid.
- *
- * @author Dirk Fauth
- *
*/
public class _5081_ColumnReorderExample extends AbstractNatExample {
@@ -59,8 +56,13 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday"
+ };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -72,44 +74,66 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(10), propertyNames);
- DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
- ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
- bodyDataLayer);
- SelectionLayer selectionLayer = new SelectionLayer(columnReorderLayer);
- ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(
+ PersonService.getPersons(10),
+ propertyNames);
+ DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
+ ColumnReorderLayer columnReorderLayer =
+ new ColumnReorderLayer(bodyDataLayer);
+ SelectionLayer selectionLayer =
+ new SelectionLayer(columnReorderLayer);
+ ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(
+ propertyNames,
+ propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(
+ columnHeaderDataLayer,
+ viewportLayer,
+ selectionLayer);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(
+ rowHeaderDataLayer,
+ viewportLayer,
+ selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- columnHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(
+ columnHeaderDataProvider,
+ rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(
+ cornerDataLayer,
+ rowHeaderLayer,
+ columnHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(
+ viewportLayer,
+ columnHeaderLayer,
+ rowHeaderLayer,
+ cornerLayer);
NatTable natTable = new NatTable(parent, gridLayer);
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_508_Reorder/_5082_RowReorderExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_508_Reorder/_5082_RowReorderExample.java
index df7e5db..7c58baf 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_508_Reorder/_5082_RowReorderExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_508_Reorder/_5082_RowReorderExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._508_Reorder;
@@ -16,9 +16,9 @@
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -41,9 +41,6 @@
/**
* Simple example showing how to add the {@link RowReorderLayer} to the layer
* composition of a grid.
- *
- * @author Dirk Fauth
- *
*/
public class _5082_RowReorderExample extends AbstractNatExample {
@@ -60,8 +57,12 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -73,46 +74,48 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
final List<Person> contents = PersonService.getPersons(10);
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- contents, propertyNames);
- final DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
- final RowReorderLayer rowReorderLayer = new RowReorderLayer(
- bodyDataLayer);
- final SelectionLayer selectionLayer = new SelectionLayer(
- rowReorderLayer);
- ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(contents, propertyNames);
+ final DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
+ final RowReorderLayer rowReorderLayer =
+ new RowReorderLayer(bodyDataLayer);
+ final SelectionLayer selectionLayer =
+ new SelectionLayer(rowReorderLayer);
+ ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- columnHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(viewportLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
return new NatTable(parent, gridLayer);
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_508_Reorder/_5083_ColumnAndRowReorderExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_508_Reorder/_5083_ColumnAndRowReorderExample.java
index 326de98..01c1c19 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_508_Reorder/_5083_ColumnAndRowReorderExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_508_Reorder/_5083_ColumnAndRowReorderExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._508_Reorder;
@@ -17,9 +17,9 @@
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -51,9 +51,6 @@
*
* Also adds the functionality to manage NatTable states to proof that the
* visibility states are stored and loaded correctly.
- *
- * @author Dirk Fauth
- *
*/
public class _5083_ColumnAndRowReorderExample extends AbstractNatExample {
@@ -74,8 +71,13 @@
Composite panel = new Composite(parent, SWT.NONE);
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday"
+ };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -87,55 +89,56 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(10), propertyNames);
- DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
- ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
- bodyDataLayer);
- RowReorderLayer rowReorderLayer = new RowReorderLayer(
- columnReorderLayer);
- final SelectionLayer selectionLayer = new SelectionLayer(
- rowReorderLayer);
- final ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(PersonService.getPersons(10), propertyNames);
+ DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
+ ColumnReorderLayer columnReorderLayer =
+ new ColumnReorderLayer(bodyDataLayer);
+ RowReorderLayer rowReorderLayer =
+ new RowReorderLayer(columnReorderLayer);
+ final SelectionLayer selectionLayer =
+ new SelectionLayer(rowReorderLayer);
+ final ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- columnHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(viewportLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
final NatTable natTable = new NatTable(panel, gridLayer, false);
// as the autoconfiguration of the NatTable is turned off, we have to
- // add the
- // DefaultNatTableStyleConfiguration manually
+ // add the DefaultNatTableStyleConfiguration manually
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
// add the corner menu configuration for adding the view management
@@ -153,9 +156,8 @@
GridDataFactory.fillDefaults().grab(true, true).applyTo(panel);
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
- gridLayer
- .registerCommandHandler(new DisplayPersistenceDialogCommandHandler(
- natTable));
+ gridLayer.registerCommandHandler(
+ new DisplayPersistenceDialogCommandHandler(natTable));
return panel;
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_509_SortHeaderLayerExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_509_SortHeaderLayerExample.java
index bf30384..446f8e1 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_509_SortHeaderLayerExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_509_SortHeaderLayerExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,11 +25,11 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Address;
+import org.eclipse.nebula.widgets.nattable.dataset.person.DataModelConstants;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Address;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.DataModelConstants;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_511_Grouping/_5111_ColumnGroupingExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_511_Grouping/_5111_ColumnGroupingExample.java
index 8c05fef..b12b862 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_511_Grouping/_5111_ColumnGroupingExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_511_Grouping/_5111_ColumnGroupingExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013, 2014 Dirk Fauth and others.
+ * Copyright (c) 2013, 2014, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
* Roman Flueckiger <roman.flueckiger@mac.com> - added example implementation for Bug 451486
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._511_Grouping;
@@ -22,9 +22,9 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.ExtendedPersonWithAddress;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -101,7 +101,8 @@
propertyToLabelMap.put("favouriteFood", "Food");
propertyToLabelMap.put("favouriteDrinks", "Drinks");
- IColumnPropertyAccessor<ExtendedPersonWithAddress> columnPropertyAccessor = new ExtendedReflectiveColumnPropertyAccessor<ExtendedPersonWithAddress>(propertyNames);
+ IColumnPropertyAccessor<ExtendedPersonWithAddress> columnPropertyAccessor =
+ new ExtendedReflectiveColumnPropertyAccessor<ExtendedPersonWithAddress>(propertyNames);
ColumnGroupModel columnGroupModel = new ColumnGroupModel();
@@ -110,20 +111,34 @@
// AbstractIndexLayerTransform and setting the ViewportLayer as
// underlying layer. But in this case using the ViewportLayer
// directly as body layer is also working.
- IDataProvider bodyDataProvider = new ListDataProvider<ExtendedPersonWithAddress>(PersonService.getExtendedPersonsWithAddress(10), columnPropertyAccessor);
- DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
- ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(bodyDataLayer);
- ColumnGroupReorderLayer columnGroupReorderLayer = new ColumnGroupReorderLayer(columnReorderLayer, columnGroupModel);
- ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(columnGroupReorderLayer);
- ColumnGroupExpandCollapseLayer columnGroupExpandCollapseLayer = new ColumnGroupExpandCollapseLayer(columnHideShowLayer, columnGroupModel);
- final SelectionLayer selectionLayer = new SelectionLayer(columnGroupExpandCollapseLayer);
- ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
+ IDataProvider bodyDataProvider =
+ new ListDataProvider<ExtendedPersonWithAddress>(
+ PersonService.getExtendedPersonsWithAddress(10),
+ columnPropertyAccessor);
+ DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
+ ColumnReorderLayer columnReorderLayer =
+ new ColumnReorderLayer(bodyDataLayer);
+ ColumnGroupReorderLayer columnGroupReorderLayer =
+ new ColumnGroupReorderLayer(columnReorderLayer, columnGroupModel);
+ ColumnHideShowLayer columnHideShowLayer =
+ new ColumnHideShowLayer(columnGroupReorderLayer);
+ ColumnGroupExpandCollapseLayer columnGroupExpandCollapseLayer =
+ new ColumnGroupExpandCollapseLayer(columnHideShowLayer, columnGroupModel);
+ final SelectionLayer selectionLayer =
+ new SelectionLayer(columnGroupExpandCollapseLayer);
+ ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
- ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
- ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(columnHeaderLayer, selectionLayer, columnGroupModel);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ColumnHeaderLayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
+ ColumnGroupHeaderLayer columnGroupHeaderLayer =
+ new ColumnGroupHeaderLayer(columnHeaderLayer, selectionLayer, columnGroupModel);
// configure the column groups
columnGroupHeaderLayer.addColumnsIndexesToGroup("Person", 0, 1, 2, 3);
@@ -135,17 +150,24 @@
columnGroupHeaderLayer.setGroupUnbreakable(1);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, columnGroupHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, columnGroupHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer, columnGroupHeaderLayer, rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(viewportLayer, columnGroupHeaderLayer, rowHeaderLayer, cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
@@ -159,7 +181,9 @@
@Override
protected PopupMenuBuilder createColumnHeaderMenu(NatTable natTable) {
PopupMenuBuilder builder = super.createColumnHeaderMenu(natTable).withColumnChooserMenuItem();
- builder.withEnabledState(PopupMenuBuilder.HIDE_COLUMN_MENU_ITEM_ID, new VisibleColumnsRemaining(selectionLayer));
+ builder.withEnabledState(
+ PopupMenuBuilder.HIDE_COLUMN_MENU_ITEM_ID,
+ new VisibleColumnsRemaining(selectionLayer));
return builder;
}
});
@@ -173,7 +197,12 @@
natTable.addConfiguration(new AbstractUiBindingConfiguration() {
@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
- uiBindingRegistry.registerFirstMouseDownBinding(new MouseEventMatcher(SWT.NONE, GridRegion.COLUMN_GROUP_HEADER, MouseEventMatcher.RIGHT_BUTTON), new PopupMenuAction(columnGroupHeaderMenu));
+ uiBindingRegistry.registerFirstMouseDownBinding(
+ new MouseEventMatcher(
+ SWT.NONE,
+ GridRegion.COLUMN_GROUP_HEADER,
+ MouseEventMatcher.RIGHT_BUTTON),
+ new PopupMenuAction(columnGroupHeaderMenu));
}
});
@@ -192,8 +221,16 @@
// });
// Register column chooser
- DisplayColumnChooserCommandHandler columnChooserCommandHandler = new DisplayColumnChooserCommandHandler(
- selectionLayer, columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer, columnGroupHeaderLayer, columnGroupModel, false, true);
+ DisplayColumnChooserCommandHandler columnChooserCommandHandler =
+ new DisplayColumnChooserCommandHandler(
+ selectionLayer,
+ columnHideShowLayer,
+ columnHeaderLayer,
+ columnHeaderDataLayer,
+ columnGroupHeaderLayer,
+ columnGroupModel,
+ false,
+ true);
viewportLayer.registerCommandHandler(columnChooserCommandHandler);
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_511_Grouping/_5112_TwoLevelColumnGroupingExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_511_Grouping/_5112_TwoLevelColumnGroupingExample.java
index 95524fb..f7de654 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_511_Grouping/_5112_TwoLevelColumnGroupingExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_511_Grouping/_5112_TwoLevelColumnGroupingExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers._511_Grouping;
@@ -18,9 +18,9 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.ExtendedPersonWithAddress;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
@@ -49,15 +49,11 @@
* Simple example showing how to add the {@link ColumnGroupHeaderLayer} and the
* {@link ColumnGroupGroupHeaderLayer} to the layer composition of a grid and
* how to add the corresponding actions to the column header menu.
- *
- * @author Dirk Fauth
- *
*/
public class _5112_TwoLevelColumnGroupingExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner
- .run(new _5112_TwoLevelColumnGroupingExample());
+ StandaloneNatExampleRunner.run(new _5112_TwoLevelColumnGroupingExample());
}
@Override
@@ -93,43 +89,45 @@
propertyToLabelMap.put("favouriteFood", "Food");
propertyToLabelMap.put("favouriteDrinks", "Drinks");
- IColumnPropertyAccessor<ExtendedPersonWithAddress> columnPropertyAccessor = new ExtendedReflectiveColumnPropertyAccessor<ExtendedPersonWithAddress>(
- propertyNames);
+ IColumnPropertyAccessor<ExtendedPersonWithAddress> columnPropertyAccessor =
+ new ExtendedReflectiveColumnPropertyAccessor<ExtendedPersonWithAddress>(propertyNames);
ColumnGroupModel columnGroupModel = new ColumnGroupModel();
ColumnGroupModel sndColumnGroupModel = new ColumnGroupModel();
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IDataProvider bodyDataProvider = new ListDataProvider<ExtendedPersonWithAddress>(
- PersonService.getExtendedPersonsWithAddress(10),
- columnPropertyAccessor);
- DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
- ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
- bodyDataLayer);
- ColumnGroupReorderLayer columnGroupReorderLayer = new ColumnGroupReorderLayer(
- columnReorderLayer, columnGroupModel);
- ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(
- columnGroupReorderLayer);
- ColumnGroupExpandCollapseLayer columnGroupExpandCollapseLayer = new ColumnGroupExpandCollapseLayer(
- columnHideShowLayer, sndColumnGroupModel, columnGroupModel);
- SelectionLayer selectionLayer = new SelectionLayer(
- columnGroupExpandCollapseLayer);
- ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IDataProvider bodyDataProvider =
+ new ListDataProvider<ExtendedPersonWithAddress>(
+ PersonService.getExtendedPersonsWithAddress(10),
+ columnPropertyAccessor);
+ DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
+ ColumnReorderLayer columnReorderLayer =
+ new ColumnReorderLayer(bodyDataLayer);
+ ColumnGroupReorderLayer columnGroupReorderLayer =
+ new ColumnGroupReorderLayer(columnReorderLayer, columnGroupModel);
+ ColumnHideShowLayer columnHideShowLayer =
+ new ColumnHideShowLayer(columnGroupReorderLayer);
+ ColumnGroupExpandCollapseLayer columnGroupExpandCollapseLayer =
+ new ColumnGroupExpandCollapseLayer(columnHideShowLayer, sndColumnGroupModel, columnGroupModel);
+ SelectionLayer selectionLayer =
+ new SelectionLayer(columnGroupExpandCollapseLayer);
+ ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
- ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(
- columnHeaderLayer, selectionLayer, columnGroupModel);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
+ ColumnGroupHeaderLayer columnGroupHeaderLayer =
+ new ColumnGroupHeaderLayer(columnHeaderLayer, selectionLayer, columnGroupModel);
// configure the column groups
columnGroupHeaderLayer.addColumnsIndexesToGroup("Person", 0, 1, 2, 3);
@@ -137,38 +135,36 @@
columnGroupHeaderLayer.addColumnsIndexesToGroup("Facts", 8, 9, 10);
columnGroupHeaderLayer.addColumnsIndexesToGroup("Personal", 11, 12, 13);
columnGroupHeaderLayer.setStaticColumnIndexesByGroup("Person", 0, 1);
- columnGroupHeaderLayer
- .setStaticColumnIndexesByGroup("Address", 4, 5, 6);
+ columnGroupHeaderLayer.setStaticColumnIndexesByGroup("Address", 4, 5, 6);
columnGroupHeaderLayer.setGroupUnbreakable(1);
- ColumnGroupGroupHeaderLayer sndGroup = new ColumnGroupGroupHeaderLayer(
- columnGroupHeaderLayer, selectionLayer, sndColumnGroupModel);
+ ColumnGroupGroupHeaderLayer sndGroup =
+ new ColumnGroupGroupHeaderLayer(columnGroupHeaderLayer, selectionLayer, sndColumnGroupModel);
- sndGroup.addColumnsIndexesToGroup("PersonWithAddress", 0, 1, 2, 3, 4,
- 5, 6, 7);
- sndGroup.addColumnsIndexesToGroup("Additional Information", 8, 9, 10,
- 11, 12, 13);
+ sndGroup.addColumnsIndexesToGroup("PersonWithAddress", 0, 1, 2, 3, 4, 5, 6, 7);
+ sndGroup.addColumnsIndexesToGroup("Additional Information", 8, 9, 10, 11, 12, 13);
sndGroup.setStaticColumnIndexesByGroup("PersonWithAddress", 0, 1);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- sndGroup);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, sndGroup);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer, sndGroup,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(viewportLayer, sndGroup, rowHeaderLayer, cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_511_Grouping/_5113_RowGroupingExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_511_Grouping/_5113_RowGroupingExample.java
index b1c3a1b..fcf5ecb 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_511_Grouping/_5113_RowGroupingExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_511_Grouping/_5113_RowGroupingExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
+ * Copyright (c) 2012, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,9 +19,9 @@
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.data.IRowDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -53,8 +53,7 @@
public class _5113_RowGroupingExample extends AbstractNatExample {
public static void main(String[] args) {
- StandaloneNatExampleRunner
- .run(800, 400, new _5113_RowGroupingExample());
+ StandaloneNatExampleRunner.run(800, 400, new _5113_RowGroupingExample());
}
@Override
@@ -82,57 +81,57 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IRowDataProvider<Person> bodyDataProvider = new DefaultBodyDataProvider<Person>(
- getStaticPersonList(), propertyNames);
- DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IRowDataProvider<Person> bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(getStaticPersonList(), propertyNames);
+ DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
- ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
- bodyDataLayer);
- ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(
- columnReorderLayer);
+ ColumnReorderLayer columnReorderLayer =
+ new ColumnReorderLayer(bodyDataLayer);
+ ColumnHideShowLayer columnHideShowLayer =
+ new ColumnHideShowLayer(columnReorderLayer);
- RowHideShowLayer rowHideShowLayer = new RowHideShowLayer(
- columnHideShowLayer);
+ RowHideShowLayer rowHideShowLayer =
+ new RowHideShowLayer(columnHideShowLayer);
RowGroupModel<Person> rowGroupModel = new RowGroupModel<Person>();
rowGroupModel.setDataProvider(bodyDataProvider);
- RowGroupExpandCollapseLayer<Person> rowExpandCollapseLayer = new RowGroupExpandCollapseLayer<Person>(
- rowHideShowLayer, rowGroupModel);
+ RowGroupExpandCollapseLayer<Person> rowExpandCollapseLayer =
+ new RowGroupExpandCollapseLayer<Person>(rowHideShowLayer, rowGroupModel);
- SelectionLayer selectionLayer = new SelectionLayer(
- rowExpandCollapseLayer);
- ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
+ SelectionLayer selectionLayer =
+ new SelectionLayer(rowExpandCollapseLayer);
+ ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
// Column header
- DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DefaultColumnHeaderDataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- defaultColumnHeaderDataProvider);
- ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(
- columnHeaderDataLayer, viewportLayer, selectionLayer);
+ DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DefaultColumnHeaderDataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(defaultColumnHeaderDataProvider);
+ ColumnHeaderLayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
// Row header
- DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
+ DefaultRowHeaderDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DefaultRowHeaderDataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
- RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer, false);
+ RowHeaderLayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer, false);
rowHeaderLayer.addConfiguration(new RowHeaderConfiguration());
- RowGroupHeaderLayer<Person> rowGroupHeaderLayer = new RowGroupHeaderLayer<Person>(
- rowHeaderLayer, selectionLayer, rowGroupModel);
+ RowGroupHeaderLayer<Person> rowGroupHeaderLayer =
+ new RowGroupHeaderLayer<Person>(rowHeaderLayer, selectionLayer, rowGroupModel);
rowGroupHeaderLayer.setColumnWidth(20);
// Create a group of rows for the model.
- RowGroup<Person> rowGroup = new RowGroup<Person>(rowGroupModel,
- "Simpson", false);
+ RowGroup<Person> rowGroup = new RowGroup<Person>(rowGroupModel, "Simpson", false);
rowGroup.addMemberRow(bodyDataProvider.getRowObject(0));
rowGroup.addStaticMemberRow(bodyDataProvider.getRowObject(1));
rowGroup.addMemberRow(bodyDataProvider.getRowObject(2));
@@ -154,15 +153,16 @@
rowGroupModel.addRowGroup(rowGroup);
// Corner
- final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- defaultColumnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer,
- rowGroupHeaderLayer, columnHeaderLayer);
+ final DefaultCornerDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(defaultColumnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowGroupHeaderLayer, columnHeaderLayer);
// Grid
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowGroupHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(viewportLayer, columnHeaderLayer, rowGroupHeaderLayer, cornerLayer);
NatTable natTable = new NatTable(parent, gridLayer, false);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
@@ -179,38 +179,25 @@
List<Person> result = new ArrayList<Person>();
// create some persons
- result.add(new Person(1, "Homer", "Simpson", Gender.MALE, true,
- new Date()));
- result.add(new Person(2, "Marge", "Simpson", Gender.FEMALE, true,
- new Date()));
- result.add(new Person(3, "Bart", "Simpson", Gender.MALE, false,
- new Date()));
- result.add(new Person(4, "Lisa", "Simpson", Gender.FEMALE, false,
- new Date()));
- result.add(new Person(5, "Maggie", "Simpson", Gender.FEMALE, false,
- new Date()));
+ result.add(new Person(1, "Homer", "Simpson", Gender.MALE, true, new Date()));
+ result.add(new Person(2, "Marge", "Simpson", Gender.FEMALE, true, new Date()));
+ result.add(new Person(3, "Bart", "Simpson", Gender.MALE, false, new Date()));
+ result.add(new Person(4, "Lisa", "Simpson", Gender.FEMALE, false, new Date()));
+ result.add(new Person(5, "Maggie", "Simpson", Gender.FEMALE, false, new Date()));
- result.add(new Person(6, "Ned", "Flanders", Gender.MALE, true,
- new Date()));
- result.add(new Person(7, "Maude", "Flanders", Gender.FEMALE, true,
- new Date()));
- result.add(new Person(8, "Rod", "Flanders", Gender.MALE, false,
- new Date()));
- result.add(new Person(9, "Todd", "Flanders", Gender.MALE, false,
- new Date()));
+ result.add(new Person(6, "Ned", "Flanders", Gender.MALE, true, new Date()));
+ result.add(new Person(7, "Maude", "Flanders", Gender.FEMALE, true, new Date()));
+ result.add(new Person(8, "Rod", "Flanders", Gender.MALE, false, new Date()));
+ result.add(new Person(9, "Todd", "Flanders", Gender.MALE, false, new Date()));
- result.add(new Person(10, "Timothy", "Lovejoy", Gender.MALE, true,
- new Date()));
- result.add(new Person(11, "Helen", "Lovejoy", Gender.FEMALE, true,
- new Date()));
- result.add(new Person(12, "Jessica", "Lovejoy", Gender.FEMALE, false,
- new Date()));
+ result.add(new Person(10, "Timothy", "Lovejoy", Gender.MALE, true, new Date()));
+ result.add(new Person(11, "Helen", "Lovejoy", Gender.FEMALE, true, new Date()));
+ result.add(new Person(12, "Jessica", "Lovejoy", Gender.FEMALE, false, new Date()));
return result;
}
- private class RowHeaderConfiguration extends
- DefaultRowHeaderLayerConfiguration {
+ private class RowHeaderConfiguration extends DefaultRowHeaderLayerConfiguration {
@Override
protected void addRowHeaderUIBindings() {
// We're suppressing the row resize bindings.
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5121_SummaryRowExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5121_SummaryRowExample.java
index 830de4a..206b547 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5121_SummaryRowExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5121_SummaryRowExample.java
@@ -21,8 +21,8 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5122_SummaryRowGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5122_SummaryRowGridExample.java
index c6b58eb..0ebee2a 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5122_SummaryRowGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5122_SummaryRowGridExample.java
@@ -24,8 +24,8 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5123_SummaryRowPositionExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5123_SummaryRowPositionExample.java
index 42eab16..1b34800 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5123_SummaryRowPositionExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5123_SummaryRowPositionExample.java
@@ -22,8 +22,8 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.layer.CompositeLayer;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5124_SummaryRowPositionGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5124_SummaryRowPositionGridExample.java
index 069d4d8..3a73638 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5124_SummaryRowPositionGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_512_SummaryRow/_5124_SummaryRowPositionGridExample.java
@@ -25,8 +25,8 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_513_FreezeExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_513_FreezeExample.java
index 0cf6930..ef63fba 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_513_FreezeExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_500_Layers/_513_FreezeExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._500_Layers;
@@ -18,9 +18,9 @@
import org.eclipse.nebula.widgets.nattable.columnChooser.command.DisplayColumnChooserCommandHandler;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.freeze.CompositeFreezeLayer;
import org.eclipse.nebula.widgets.nattable.freeze.FreezeLayer;
@@ -55,9 +55,6 @@
*
* Also adds the functionality to manage NatTable states to proof that the
* visibility states are stored and loaded correctly.
- *
- * @author Dirk Fauth
- *
*/
public class _513_FreezeExample extends AbstractNatExample {
@@ -79,8 +76,12 @@
Composite panel = new Composite(parent, SWT.NONE);
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday" };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -92,59 +93,63 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(10), propertyNames);
- DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
- ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
- bodyDataLayer);
- ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(
- columnReorderLayer);
- final SelectionLayer selectionLayer = new SelectionLayer(
- columnHideShowLayer);
- final ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(
+ PersonService.getPersons(10),
+ propertyNames);
+ DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
+ ColumnReorderLayer columnReorderLayer =
+ new ColumnReorderLayer(bodyDataLayer);
+ ColumnHideShowLayer columnHideShowLayer =
+ new ColumnHideShowLayer(columnReorderLayer);
+ final SelectionLayer selectionLayer =
+ new SelectionLayer(columnHideShowLayer);
+ final ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
- final FreezeLayer freezeLayer = new FreezeLayer(selectionLayer);
- final CompositeFreezeLayer compositeFreezeLayer = new CompositeFreezeLayer(
- freezeLayer, viewportLayer, selectionLayer);
+ final FreezeLayer freezeLayer =
+ new FreezeLayer(selectionLayer);
+ final CompositeFreezeLayer compositeFreezeLayer =
+ new CompositeFreezeLayer(freezeLayer, viewportLayer, selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(
- columnHeaderDataLayer, compositeFreezeLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ColumnHeaderLayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, compositeFreezeLayer, selectionLayer);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- compositeFreezeLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, compositeFreezeLayer, selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- columnHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(compositeFreezeLayer,
- columnHeaderLayer, rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(compositeFreezeLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
final NatTable natTable = new NatTable(panel, gridLayer, false);
// as the autoconfiguration of the NatTable is turned off, we have to
- // add the
- // DefaultNatTableStyleConfiguration manually
+ // add the DefaultNatTableStyleConfiguration manually
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new DefaultFreezeGridBindings());
@@ -154,15 +159,16 @@
@Override
protected PopupMenuBuilder createColumnHeaderMenu(NatTable natTable) {
return super.createColumnHeaderMenu(natTable)
- .withHideColumnMenuItem().withShowAllColumnsMenuItem()
- .withColumnChooserMenuItem();
+ .withHideColumnMenuItem()
+ .withShowAllColumnsMenuItem()
+ .withColumnChooserMenuItem();
}
@Override
protected PopupMenuBuilder createCornerMenu(NatTable natTable) {
return super.createCornerMenu(natTable)
.withShowAllColumnsMenuItem()
- .withStateManagerMenuItemProvider();
+ .withStateManagerMenuItemProvider();
}
});
natTable.configure();
@@ -171,13 +177,17 @@
GridDataFactory.fillDefaults().grab(true, true).applyTo(panel);
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
- gridLayer
- .registerCommandHandler(new DisplayPersistenceDialogCommandHandler(
- natTable));
+ gridLayer.registerCommandHandler(
+ new DisplayPersistenceDialogCommandHandler(natTable));
- DisplayColumnChooserCommandHandler columnChooserCommandHandler = new DisplayColumnChooserCommandHandler(
- selectionLayer, columnHideShowLayer, columnHeaderLayer,
- columnHeaderDataLayer, null, null);
+ DisplayColumnChooserCommandHandler columnChooserCommandHandler =
+ new DisplayColumnChooserCommandHandler(
+ selectionLayer,
+ columnHideShowLayer,
+ columnHeaderLayer,
+ columnHeaderDataLayer,
+ null,
+ null);
gridLayer.registerCommandHandler(columnChooserCommandHandler);
return panel;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_602_GlazedListsSortingExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_602_GlazedListsSortingExample.java
index b77d206..e00b5be 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_602_GlazedListsSortingExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_602_GlazedListsSortingExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._600_GlazedLists;
@@ -24,9 +24,9 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
@@ -62,9 +62,6 @@
/**
* Example showing how to add the {@link SortHeaderLayer} to the layer
* composition of a grid that is using GlazedList for sorting operations.
- *
- * @author Dirk Fauth
- *
*/
public class _602_GlazedListsSortingExample extends AbstractNatExample {
@@ -104,74 +101,96 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer
// directly as body layer is also working.
- EventList<Person> persons = GlazedLists.eventList(PersonService
- .getPersons(10));
- SortedList<Person> sortedList = new SortedList<Person>(persons, null);
+ EventList<Person> persons =
+ GlazedLists.eventList(PersonService.getPersons(10));
+ SortedList<Person> sortedList =
+ new SortedList<Person>(persons, null);
- IColumnPropertyAccessor<Person> accessor = new ReflectiveColumnPropertyAccessor<Person>(
- propertyNames);
- IDataProvider bodyDataProvider = new ListDataProvider<Person>(
- sortedList, accessor);
- DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
+ IColumnPropertyAccessor<Person> accessor =
+ new ReflectiveColumnPropertyAccessor<Person>(propertyNames);
+ IDataProvider bodyDataProvider =
+ new ListDataProvider<Person>(sortedList, accessor);
+ DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
- GlazedListsEventLayer<Person> eventLayer = new GlazedListsEventLayer<Person>(
- bodyDataLayer, sortedList);
+ GlazedListsEventLayer<Person> eventLayer =
+ new GlazedListsEventLayer<Person>(bodyDataLayer, sortedList);
- ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
- eventLayer);
- ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(
- columnReorderLayer);
- SelectionLayer selectionLayer = new SelectionLayer(columnHideShowLayer);
- ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
+ ColumnReorderLayer columnReorderLayer =
+ new ColumnReorderLayer(eventLayer);
+ ColumnHideShowLayer columnHideShowLayer =
+ new ColumnHideShowLayer(columnReorderLayer);
+ SelectionLayer selectionLayer =
+ new SelectionLayer(columnHideShowLayer);
+ ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(
+ columnHeaderDataLayer,
+ viewportLayer,
+ selectionLayer);
// add default column labels to the label stack
// need to be done on the column header data layer, otherwise the label
- // stack does not
- // contain the necessary labels at the time the comparator is searched
- columnHeaderDataLayer
- .setConfigLabelAccumulator(new ColumnLabelAccumulator());
+ // stack does not contain the necessary labels at the time the
+ // comparator is searched
+ columnHeaderDataLayer.setConfigLabelAccumulator(new ColumnLabelAccumulator());
ConfigRegistry configRegistry = new ConfigRegistry();
// add the SortHeaderLayer to the column header layer stack
// as we use GlazedLists, we use the GlazedListsSortModel which
- // delegates
- // the sorting to the SortedList
- final SortHeaderLayer<Person> sortHeaderLayer = new SortHeaderLayer<Person>(
- columnHeaderLayer, new GlazedListsSortModel<Person>(sortedList,
- accessor, configRegistry, columnHeaderDataLayer));
+ // delegates the sorting to the SortedList
+ final SortHeaderLayer<Person> sortHeaderLayer =
+ new SortHeaderLayer<Person>(
+ columnHeaderLayer,
+ new GlazedListsSortModel<Person>(
+ sortedList,
+ accessor,
+ configRegistry,
+ columnHeaderDataLayer));
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(
+ rowHeaderDataLayer,
+ viewportLayer,
+ selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- sortHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(
+ columnHeaderDataProvider,
+ rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(
+ cornerDataLayer,
+ rowHeaderLayer,
+ sortHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer, sortHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(
+ viewportLayer,
+ sortHeaderLayer,
+ rowHeaderLayer,
+ cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
@@ -180,8 +199,7 @@
natTable.setConfigRegistry(configRegistry);
// as the autoconfiguration of the NatTable is turned off, we have to
- // add the
- // DefaultNatTableStyleConfiguration manually
+ // add the DefaultNatTableStyleConfiguration manually
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
// override the default sort configuration and change the mouse bindings
// to sort on a single click
@@ -198,29 +216,31 @@
configRegistry.registerConfigAttribute(
SortConfigAttributes.SORT_COMPARATOR,
new Comparator<String>() {
- @Override
- public int compare(String o1, String o2) {
+ @Override
+ public int compare(String o1, String o2) {
- // check the sort order
- boolean sortDesc = sortHeaderLayer
- .getSortModel().getSortDirection(1)
- .equals(SortDirectionEnum.DESC);
- if ("Simpson".equals(o1)
- && !"Simpson".equals(o2)) {
- return sortDesc ? 1 : -1;
- } else if (!"Simpson".equals(o1)
- && "Simpson".equals(o2)) {
- return sortDesc ? -1 : 1;
- }
- return o1.compareToIgnoreCase(o2);
- }
- }, DisplayMode.NORMAL,
+ // check the sort order
+ boolean sortDesc = sortHeaderLayer
+ .getSortModel().getSortDirection(1)
+ .equals(SortDirectionEnum.DESC);
+ if ("Simpson".equals(o1)
+ && !"Simpson".equals(o2)) {
+ return sortDesc ? 1 : -1;
+ } else if (!"Simpson".equals(o1)
+ && "Simpson".equals(o2)) {
+ return sortDesc ? -1 : 1;
+ }
+ return o1.compareToIgnoreCase(o2);
+ }
+ },
+ DisplayMode.NORMAL,
ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 1);
// Register null comparator to disable sorting for gender column
configRegistry.registerConfigAttribute(
SortConfigAttributes.SORT_COMPARATOR,
- new NullComparator(), DisplayMode.NORMAL,
+ new NullComparator(),
+ DisplayMode.NORMAL,
ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2);
}
});
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6031_GlazedListsFilterExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6031_GlazedListsFilterExample.java
index fd58c34..33a72cc 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6031_GlazedListsFilterExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6031_GlazedListsFilterExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._600_GlazedLists._603_Filter;
@@ -25,14 +25,14 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.DataModelConstants;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.DataModelConstants;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow.DefaultGlazedListsFilterStrategy;
@@ -71,9 +71,6 @@
/**
* Simple example showing how to add the filter row to the layer composition of
* a grid that is using GlazedLists FilterList for filtering.
- *
- * @author Dirk Fauth
- *
*/
public class _6031_GlazedListsFilterExample extends AbstractNatExample {
@@ -110,54 +107,67 @@
propertyToLabelMap.put("address.postalCode", "Postal Code");
propertyToLabelMap.put("address.city", "City");
- IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor = new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(
- propertyNames);
+ IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor =
+ new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(propertyNames);
- BodyLayerStack<PersonWithAddress> bodyLayerStack = new BodyLayerStack<PersonWithAddress>(
- PersonService.getPersonsWithAddress(50), columnPropertyAccessor);
+ BodyLayerStack<PersonWithAddress> bodyLayerStack =
+ new BodyLayerStack<PersonWithAddress>(
+ PersonService.getPersonsWithAddress(50),
+ columnPropertyAccessor);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- bodyLayerStack, bodyLayerStack.getSelectionLayer());
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(
+ columnHeaderDataLayer,
+ bodyLayerStack,
+ bodyLayerStack.getSelectionLayer());
// Note: The column header layer is wrapped in a filter row composite.
// This plugs in the filter row functionality
- FilterRowHeaderComposite<PersonWithAddress> filterRowHeaderLayer = new FilterRowHeaderComposite<PersonWithAddress>(
- new DefaultGlazedListsFilterStrategy<PersonWithAddress>(
- bodyLayerStack.getFilterList(), columnPropertyAccessor,
- configRegistry), columnHeaderLayer,
- columnHeaderDataLayer.getDataProvider(), configRegistry);
+ FilterRowHeaderComposite<PersonWithAddress> filterRowHeaderLayer =
+ new FilterRowHeaderComposite<PersonWithAddress>(
+ new DefaultGlazedListsFilterStrategy<PersonWithAddress>(
+ bodyLayerStack.getFilterList(),
+ columnPropertyAccessor,
+ configRegistry),
+ columnHeaderLayer,
+ columnHeaderDataLayer.getDataProvider(),
+ configRegistry);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyLayerStack.getBodyDataProvider());
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- bodyLayerStack, bodyLayerStack.getSelectionLayer());
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyLayerStack.getBodyDataProvider());
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(
+ rowHeaderDataLayer,
+ bodyLayerStack,
+ bodyLayerStack.getSelectionLayer());
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- filterRowHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, filterRowHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(bodyLayerStack,
- filterRowHeaderLayer, rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(bodyLayerStack, filterRowHeaderLayer, rowHeaderLayer, cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
NatTable natTable = new NatTable(parent, gridLayer, false);
// as the autoconfiguration of the NatTable is turned off, we have to
- // add the
- // DefaultNatTableStyleConfiguration and the ConfigRegistry manually
+ // add the DefaultNatTableStyleConfiguration and the ConfigRegistry
+ // manually
natTable.setConfigRegistry(configRegistry);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
// add filter row configuration
@@ -173,8 +183,8 @@
natTable.configure();
- natTable.registerCommandHandler(new DisplayPersistenceDialogCommandHandler(
- natTable));
+ natTable.registerCommandHandler(
+ new DisplayPersistenceDialogCommandHandler(natTable));
return natTable;
}
@@ -193,29 +203,26 @@
private final SelectionLayer selectionLayer;
- public BodyLayerStack(List<T> values,
- IColumnPropertyAccessor<T> columnPropertyAccessor) {
+ public BodyLayerStack(List<T> values, IColumnPropertyAccessor<T> columnPropertyAccessor) {
// wrapping of the list to show into GlazedLists
// see http://publicobject.com/glazedlists/ for further information
EventList<T> eventList = GlazedLists.eventList(values);
- TransformedList<T, T> rowObjectsGlazedList = GlazedLists
- .threadSafeList(eventList);
+ TransformedList<T, T> rowObjectsGlazedList = GlazedLists.threadSafeList(eventList);
// use the SortedList constructor with 'null' for the Comparator
- // because the Comparator
- // will be set by configuration
- SortedList<T> sortedList = new SortedList<T>(rowObjectsGlazedList,
- null);
+ // because the Comparator will be set by configuration
+ SortedList<T> sortedList = new SortedList<T>(rowObjectsGlazedList, null);
// wrap the SortedList with the FilterList
this.filterList = new FilterList<T>(sortedList);
- this.bodyDataProvider = new ListDataProvider<T>(this.filterList,
- columnPropertyAccessor);
- DataLayer bodyDataLayer = new DataLayer(getBodyDataProvider());
+ this.bodyDataProvider =
+ new ListDataProvider<T>(this.filterList, columnPropertyAccessor);
+ DataLayer bodyDataLayer =
+ new DataLayer(getBodyDataProvider());
// layer for event handling of GlazedLists and PropertyChanges
- GlazedListsEventLayer<T> glazedListsEventLayer = new GlazedListsEventLayer<T>(
- bodyDataLayer, this.filterList);
+ GlazedListsEventLayer<T> glazedListsEventLayer =
+ new GlazedListsEventLayer<T>(bodyDataLayer, this.filterList);
this.selectionLayer = new SelectionLayer(glazedListsEventLayer);
ViewportLayer viewportLayer = new ViewportLayer(getSelectionLayer());
@@ -239,8 +246,6 @@
/**
* The configuration to enable the edit mode for the grid and additional
* edit configurations like converters and validators.
- *
- * @author Dirk Fauth
*/
class FilterRowConfiguration extends AbstractRegistryConfiguration {
@@ -251,17 +256,16 @@
// immediately commits on key press
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR,
- new FilterRowTextCellEditor(), DisplayMode.NORMAL,
+ new FilterRowTextCellEditor(),
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
+ DataModelConstants.FIRSTNAME_COLUMN_POSITION);
// register a combo box cell editor for the gender column in the
- // filter row
- // the label is set automatically to the value of
+ // filter row the label is set automatically to the value of
// FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + column
// position
- ICellEditor comboBoxCellEditor = new ComboBoxCellEditor(
- Arrays.asList(Gender.FEMALE, Gender.MALE));
+ ICellEditor comboBoxCellEditor = new ComboBoxCellEditor(Arrays.asList(Gender.FEMALE, Gender.MALE));
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR, comboBoxCellEditor,
DisplayMode.NORMAL,
@@ -269,12 +273,10 @@
+ DataModelConstants.GENDER_COLUMN_POSITION);
// register a combo box cell editor for the married column in the
- // filter row
- // the label is set automatically to the value of
+ // filter row the label is set automatically to the value of
// FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + column
// position
- comboBoxCellEditor = new ComboBoxCellEditor(Arrays.asList(
- Boolean.TRUE, Boolean.FALSE));
+ comboBoxCellEditor = new ComboBoxCellEditor(Arrays.asList(Boolean.TRUE, Boolean.FALSE));
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR, comboBoxCellEditor,
DisplayMode.NORMAL,
@@ -283,19 +285,22 @@
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
- new DefaultIntegerDisplayConverter(), DisplayMode.NORMAL,
+ new DefaultIntegerDisplayConverter(),
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
+ DataModelConstants.HOUSENUMBER_COLUMN_POSITION);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
- TextMatchingMode.EXACT, DisplayMode.NORMAL,
+ TextMatchingMode.EXACT,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
+ DataModelConstants.GENDER_COLUMN_POSITION);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
- TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL,
+ TextMatchingMode.REGULAR_EXPRESSION,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
+ DataModelConstants.HOUSENUMBER_COLUMN_POSITION);
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6033_GlazedListsStaticFilterExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6033_GlazedListsStaticFilterExample.java
index 73e80aa..51d81de 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6033_GlazedListsStaticFilterExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6033_GlazedListsStaticFilterExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._600_GlazedLists._603_Filter;
@@ -25,14 +25,14 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.DataModelConstants;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.DataModelConstants;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow.DefaultGlazedListsStaticFilterStrategy;
@@ -73,15 +73,11 @@
* Simple example showing how to add the filter row to the layer composition of
* a grid that is using GlazedLists FilterList for filtering. This example also
* shows how to combine the filter row with static filtering.
- *
- * @author Dirk Fauth
- *
*/
public class _6033_GlazedListsStaticFilterExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner
- .run(new _6033_GlazedListsStaticFilterExample());
+ StandaloneNatExampleRunner.run(new _6033_GlazedListsStaticFilterExample());
}
@Override
@@ -115,65 +111,87 @@
propertyToLabelMap.put("address.postalCode", "Postal Code");
propertyToLabelMap.put("address.city", "City");
- IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor = new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(
- propertyNames);
+ IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor =
+ new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(propertyNames);
- BodyLayerStack<PersonWithAddress> bodyLayerStack = new BodyLayerStack<PersonWithAddress>(
- PersonService.getPersonsWithAddress(50), columnPropertyAccessor);
+ BodyLayerStack<PersonWithAddress> bodyLayerStack =
+ new BodyLayerStack<PersonWithAddress>(
+ PersonService.getPersonsWithAddress(50),
+ columnPropertyAccessor);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- bodyLayerStack, bodyLayerStack.getSelectionLayer());
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(
+ columnHeaderDataLayer,
+ bodyLayerStack,
+ bodyLayerStack.getSelectionLayer());
// add a static filter to always sort out persons with last name
// Flanders
- DefaultGlazedListsStaticFilterStrategy<PersonWithAddress> filterStrategy = new DefaultGlazedListsStaticFilterStrategy<PersonWithAddress>(
- bodyLayerStack.getFilterList(), columnPropertyAccessor,
- configRegistry);
+ DefaultGlazedListsStaticFilterStrategy<PersonWithAddress> filterStrategy =
+ new DefaultGlazedListsStaticFilterStrategy<PersonWithAddress>(
+ bodyLayerStack.getFilterList(),
+ columnPropertyAccessor,
+ configRegistry);
filterStrategy.addStaticFilter(new Matcher<PersonWithAddress>() {
@Override
public boolean matches(PersonWithAddress person) {
- return !(person.getLastName() != null && person.getLastName()
- .equals("Flanders"));
+ return !(person.getLastName() != null && person.getLastName().equals("Flanders"));
}
});
// Note: The column header layer is wrapped in a filter row composite.
// This plugs in the filter row functionality
- FilterRowHeaderComposite<PersonWithAddress> filterRowHeaderLayer = new FilterRowHeaderComposite<PersonWithAddress>(
- filterStrategy, columnHeaderLayer,
- columnHeaderDataLayer.getDataProvider(), configRegistry);
+ FilterRowHeaderComposite<PersonWithAddress> filterRowHeaderLayer =
+ new FilterRowHeaderComposite<PersonWithAddress>(
+ filterStrategy,
+ columnHeaderLayer,
+ columnHeaderDataLayer.getDataProvider(),
+ configRegistry);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyLayerStack.getBodyDataProvider());
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- bodyLayerStack, bodyLayerStack.getSelectionLayer());
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyLayerStack.getBodyDataProvider());
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(
+ rowHeaderDataLayer,
+ bodyLayerStack,
+ bodyLayerStack.getSelectionLayer());
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- filterRowHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(
+ columnHeaderDataProvider,
+ rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(
+ cornerDataLayer,
+ rowHeaderLayer,
+ filterRowHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(bodyLayerStack,
- filterRowHeaderLayer, rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(
+ bodyLayerStack,
+ filterRowHeaderLayer,
+ rowHeaderLayer,
+ cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
NatTable natTable = new NatTable(parent, gridLayer, false);
// as the autoconfiguration of the NatTable is turned off, we have to
- // add the
- // DefaultNatTableStyleConfiguration and the ConfigRegistry manually
+ // add the DefaultNatTableStyleConfiguration and the ConfigRegistry
+ // manually
natTable.setConfigRegistry(configRegistry);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
// add filter row configuration
@@ -189,8 +207,8 @@
natTable.configure();
- natTable.registerCommandHandler(new DisplayPersistenceDialogCommandHandler(
- natTable));
+ natTable.registerCommandHandler(
+ new DisplayPersistenceDialogCommandHandler(natTable));
return natTable;
}
@@ -209,29 +227,25 @@
private final SelectionLayer selectionLayer;
- public BodyLayerStack(List<T> values,
- IColumnPropertyAccessor<T> columnPropertyAccessor) {
+ public BodyLayerStack(List<T> values, IColumnPropertyAccessor<T> columnPropertyAccessor) {
// wrapping of the list to show into GlazedLists
// see http://publicobject.com/glazedlists/ for further information
EventList<T> eventList = GlazedLists.eventList(values);
- TransformedList<T, T> rowObjectsGlazedList = GlazedLists
- .threadSafeList(eventList);
+ TransformedList<T, T> rowObjectsGlazedList = GlazedLists.threadSafeList(eventList);
// use the SortedList constructor with 'null' for the Comparator
- // because the Comparator
- // will be set by configuration
- SortedList<T> sortedList = new SortedList<T>(rowObjectsGlazedList,
- null);
+ // because the Comparator will be set by configuration
+ SortedList<T> sortedList = new SortedList<T>(rowObjectsGlazedList, null);
// wrap the SortedList with the FilterList
this.filterList = new FilterList<T>(sortedList);
- this.bodyDataProvider = new ListDataProvider<T>(this.filterList,
- columnPropertyAccessor);
+ this.bodyDataProvider =
+ new ListDataProvider<T>(this.filterList, columnPropertyAccessor);
DataLayer bodyDataLayer = new DataLayer(getBodyDataProvider());
// layer for event handling of GlazedLists and PropertyChanges
- GlazedListsEventLayer<T> glazedListsEventLayer = new GlazedListsEventLayer<T>(
- bodyDataLayer, this.filterList);
+ GlazedListsEventLayer<T> glazedListsEventLayer =
+ new GlazedListsEventLayer<T>(bodyDataLayer, this.filterList);
this.selectionLayer = new SelectionLayer(glazedListsEventLayer);
ViewportLayer viewportLayer = new ViewportLayer(getSelectionLayer());
@@ -255,8 +269,6 @@
/**
* The configuration to enable the edit mode for the grid and additional
* edit configurations like converters and validators.
- *
- * @author Dirk Fauth
*/
class FilterRowConfiguration extends AbstractRegistryConfiguration {
@@ -267,17 +279,16 @@
// immediately commits on key press
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR,
- new FilterRowTextCellEditor(), DisplayMode.NORMAL,
+ new FilterRowTextCellEditor(),
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
+ DataModelConstants.FIRSTNAME_COLUMN_POSITION);
// register a combo box cell editor for the gender column in the
- // filter row
- // the label is set automatically to the value of
+ // filter row the label is set automatically to the value of
// FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + column
// position
- ICellEditor comboBoxCellEditor = new ComboBoxCellEditor(
- Arrays.asList(Gender.FEMALE, Gender.MALE));
+ ICellEditor comboBoxCellEditor = new ComboBoxCellEditor(Arrays.asList(Gender.FEMALE, Gender.MALE));
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR, comboBoxCellEditor,
DisplayMode.NORMAL,
@@ -285,33 +296,36 @@
+ DataModelConstants.GENDER_COLUMN_POSITION);
// register a combo box cell editor for the married column in the
- // filter row
- // the label is set automatically to the value of
+ // filter row the label is set automatically to the value of
// FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + column
// position
comboBoxCellEditor = new ComboBoxCellEditor(Arrays.asList(
Boolean.TRUE, Boolean.FALSE));
configRegistry.registerConfigAttribute(
- EditConfigAttributes.CELL_EDITOR, comboBoxCellEditor,
+ EditConfigAttributes.CELL_EDITOR,
+ comboBoxCellEditor,
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
+ DataModelConstants.MARRIED_COLUMN_POSITION);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
- new DefaultIntegerDisplayConverter(), DisplayMode.NORMAL,
+ new DefaultIntegerDisplayConverter(),
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
+ DataModelConstants.HOUSENUMBER_COLUMN_POSITION);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
- TextMatchingMode.EXACT, DisplayMode.NORMAL,
+ TextMatchingMode.EXACT,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
+ DataModelConstants.GENDER_COLUMN_POSITION);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
- TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL,
+ TextMatchingMode.REGULAR_EXPRESSION,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX
+ DataModelConstants.HOUSENUMBER_COLUMN_POSITION);
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6034_ExcelLikeFilterRowExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6034_ExcelLikeFilterRowExample.java
index 4b2eb04..c966bd0 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6034_ExcelLikeFilterRowExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6034_ExcelLikeFilterRowExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._600_GlazedLists._603_Filter;
@@ -26,12 +26,12 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Address;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Address;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow.ComboBoxFilterRowHeaderComposite;
@@ -71,9 +71,6 @@
/**
* Example showing how to add the filter row to the layer composition of a grid
* that looks like the Excel filter.
- *
- * @author Dirk Fauth
- *
*/
public class _6034_ExcelLikeFilterRowExample extends AbstractNatExample {
@@ -113,52 +110,74 @@
propertyToLabelMap.put("address.postalCode", "Postal Code");
propertyToLabelMap.put("address.city", "City");
- IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor = new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(
- propertyNames);
+ IColumnPropertyAccessor<PersonWithAddress> columnPropertyAccessor =
+ new ExtendedReflectiveColumnPropertyAccessor<PersonWithAddress>(propertyNames);
- final BodyLayerStack<PersonWithAddress> bodyLayerStack = new BodyLayerStack<PersonWithAddress>(
- PersonService.getPersonsWithAddress(50), columnPropertyAccessor);
+ final BodyLayerStack<PersonWithAddress> bodyLayerStack =
+ new BodyLayerStack<PersonWithAddress>(
+ PersonService.getPersonsWithAddress(50),
+ columnPropertyAccessor);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- bodyLayerStack, bodyLayerStack.getSelectionLayer());
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(
+ columnHeaderDataLayer,
+ bodyLayerStack,
+ bodyLayerStack.getSelectionLayer());
- ComboBoxFilterRowHeaderComposite<PersonWithAddress> filterRowHeaderLayer = new ComboBoxFilterRowHeaderComposite<PersonWithAddress>(
- bodyLayerStack.getFilterList(),
- bodyLayerStack.getGlazedListsEventLayer(),
- bodyLayerStack.getSortedList(), columnPropertyAccessor,
- columnHeaderLayer, columnHeaderDataProvider, configRegistry);
+ ComboBoxFilterRowHeaderComposite<PersonWithAddress> filterRowHeaderLayer =
+ new ComboBoxFilterRowHeaderComposite<PersonWithAddress>(
+ bodyLayerStack.getFilterList(),
+ bodyLayerStack.getGlazedListsEventLayer(),
+ bodyLayerStack.getSortedList(),
+ columnPropertyAccessor,
+ columnHeaderLayer,
+ columnHeaderDataProvider,
+ configRegistry);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyLayerStack.getBodyDataProvider());
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- bodyLayerStack, bodyLayerStack.getSelectionLayer());
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyLayerStack.getBodyDataProvider());
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(
+ rowHeaderDataLayer,
+ bodyLayerStack,
+ bodyLayerStack.getSelectionLayer());
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- filterRowHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(
+ columnHeaderDataProvider,
+ rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(
+ cornerDataLayer,
+ rowHeaderLayer,
+ filterRowHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(bodyLayerStack,
- filterRowHeaderLayer, rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(
+ bodyLayerStack,
+ filterRowHeaderLayer,
+ rowHeaderLayer,
+ cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
NatTable natTable = new NatTable(container, gridLayer, false);
// as the autoconfiguration of the NatTable is turned off, we have to
- // add the
- // DefaultNatTableStyleConfiguration and the ConfigRegistry manually
+ // add the DefaultNatTableStyleConfiguration and the ConfigRegistry
+ // manually
natTable.setConfigRegistry(configRegistry);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
@@ -183,8 +202,8 @@
natTable.configure();
- natTable.registerCommandHandler(new DisplayPersistenceDialogCommandHandler(
- natTable));
+ natTable.registerCommandHandler(
+ new DisplayPersistenceDialogCommandHandler(natTable));
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
@@ -225,35 +244,32 @@
private final SelectionLayer selectionLayer;
- public BodyLayerStack(List<T> values,
- IColumnPropertyAccessor<T> columnPropertyAccessor) {
+ public BodyLayerStack(List<T> values, IColumnPropertyAccessor<T> columnPropertyAccessor) {
// wrapping of the list to show into GlazedLists
// see http://publicobject.com/glazedlists/ for further information
EventList<T> eventList = GlazedLists.eventList(values);
- TransformedList<T, T> rowObjectsGlazedList = GlazedLists
- .threadSafeList(eventList);
+ TransformedList<T, T> rowObjectsGlazedList = GlazedLists.threadSafeList(eventList);
// use the SortedList constructor with 'null' for the Comparator
- // because the Comparator
- // will be set by configuration
+ // because the Comparator will be set by configuration
this.sortedList = new SortedList<T>(rowObjectsGlazedList, null);
// wrap the SortedList with the FilterList
this.filterList = new FilterList<T>(this.sortedList);
- this.bodyDataProvider = new ListDataProvider<T>(this.filterList,
- columnPropertyAccessor);
+ this.bodyDataProvider =
+ new ListDataProvider<T>(this.filterList, columnPropertyAccessor);
this.bodyDataLayer = new DataLayer(getBodyDataProvider());
// layer for event handling of GlazedLists and PropertyChanges
- this.glazedListsEventLayer = new GlazedListsEventLayer<T>(
- this.bodyDataLayer, this.filterList);
+ this.glazedListsEventLayer =
+ new GlazedListsEventLayer<T>(this.bodyDataLayer, this.filterList);
this.selectionLayer = new SelectionLayer(getGlazedListsEventLayer());
ViewportLayer viewportLayer = new ViewportLayer(getSelectionLayer());
FreezeLayer freezeLayer = new FreezeLayer(this.selectionLayer);
- CompositeFreezeLayer compositeFreezeLayer = new CompositeFreezeLayer(
- freezeLayer, viewportLayer, this.selectionLayer);
+ CompositeFreezeLayer compositeFreezeLayer =
+ new CompositeFreezeLayer(freezeLayer, viewportLayer, this.selectionLayer);
setUnderlyingLayer(compositeFreezeLayer);
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_604_Tree/_6041_TreeGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_604_Tree/_6041_TreeGridExample.java
index 647f73f..41a07b7 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_604_Tree/_6041_TreeGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_604_Tree/_6041_TreeGridExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013, 2014 Dirk Fauth and others.
+ * Copyright (c) 2013, 2014, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
* Roman Flueckiger <roman.flueckiger@mac.com> - added expand/collapse key bindings
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._600_GlazedLists._604_Tree;
@@ -28,9 +28,9 @@
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDateDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.tree.GlazedListTreeData;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_604_Tree/_6042_TreeStructureGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_604_Tree/_6042_TreeStructureGridExample.java
index 832f8ee..5538531 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_604_Tree/_6042_TreeStructureGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_604_Tree/_6042_TreeStructureGridExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2014 Dirk Fauth and others.
+ * Copyright (c) 2013, 2014, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,9 +31,9 @@
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDateDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.tree.GlazedListTreeData;
@@ -144,7 +144,7 @@
PersonService.getPersonsWithAddress(5),
columnPropertyAccessor,
new PersonWithAddressTwoLevelTreeFormat());
- // new PersonWithAddressTreeFormat());
+ // new PersonWithAddressTreeFormat());
// build the column header layer
IDataProvider columnHeaderDataProvider =
@@ -217,7 +217,8 @@
new PaddingDecorator(
new IndentedTreeImagePainter(10,
null, CellEdgeEnum.LEFT, treeImagePainter,
- false, 2, true), 0, 5, 0, 5, false));
+ false, 2, true),
+ 0, 5, 0, 5, false));
configRegistry.registerConfigAttribute(
TreeConfigAttributes.TREE_STRUCTURE_PAINTER,
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_605_GroupBy/_6051_GroupByExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_605_GroupBy/_6051_GroupByExample.java
index e83f89a..72df8cc 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_605_GroupBy/_6051_GroupByExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_605_GroupBy/_6051_GroupByExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._600_GlazedLists._605_GroupBy;
@@ -20,9 +20,9 @@
import org.eclipse.nebula.widgets.nattable.data.ExtendedReflectiveColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonWithAddress;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByDataLayer;
@@ -168,65 +168,65 @@
.withStateManagerMenuItemProvider()
.withMenuItemProvider(new IMenuItemProvider() {
+ @Override
+ public void addMenuItem(NatTable natTable, Menu popupMenu) {
+ MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
+ menuItem.setText("Toggle Group By Header"); //$NON-NLS-1$
+ menuItem.setEnabled(true);
+
+ menuItem.addSelectionListener(new SelectionAdapter() {
@Override
- public void addMenuItem(NatTable natTable, Menu popupMenu) {
- MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
- menuItem.setText("Toggle Group By Header"); //$NON-NLS-1$
- menuItem.setEnabled(true);
-
- menuItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- groupByHeaderLayer.setVisible(!groupByHeaderLayer.isVisible());
- }
- });
- }
- }).withMenuItemProvider(new IMenuItemProvider() {
-
- @Override
- public void addMenuItem(final NatTable natTable, Menu popupMenu) {
- MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
- menuItem.setText("Collapse All"); //$NON-NLS-1$
- menuItem.setEnabled(true);
-
- menuItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- natTable.doCommand(new TreeCollapseAllCommand());
- }
- });
- }
- }).withMenuItemProvider(new IMenuItemProvider() {
-
- @Override
- public void addMenuItem(final NatTable natTable, Menu popupMenu) {
- MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
- menuItem.setText("Expand All"); //$NON-NLS-1$
- menuItem.setEnabled(true);
-
- menuItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- natTable.doCommand(new TreeExpandAllCommand());
- }
- });
- }
- }).withMenuItemProvider(new IMenuItemProvider() {
-
- @Override
- public void addMenuItem(final NatTable natTable, Menu popupMenu) {
- MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
- menuItem.setText("Expand to Level 2"); //$NON-NLS-1$
- menuItem.setEnabled(true);
-
- menuItem.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- natTable.doCommand(new TreeExpandToLevelCommand(2));
- }
- });
+ public void widgetSelected(SelectionEvent event) {
+ groupByHeaderLayer.setVisible(!groupByHeaderLayer.isVisible());
}
});
+ }
+ }).withMenuItemProvider(new IMenuItemProvider() {
+
+ @Override
+ public void addMenuItem(final NatTable natTable, Menu popupMenu) {
+ MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
+ menuItem.setText("Collapse All"); //$NON-NLS-1$
+ menuItem.setEnabled(true);
+
+ menuItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ natTable.doCommand(new TreeCollapseAllCommand());
+ }
+ });
+ }
+ }).withMenuItemProvider(new IMenuItemProvider() {
+
+ @Override
+ public void addMenuItem(final NatTable natTable, Menu popupMenu) {
+ MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
+ menuItem.setText("Expand All"); //$NON-NLS-1$
+ menuItem.setEnabled(true);
+
+ menuItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ natTable.doCommand(new TreeExpandAllCommand());
+ }
+ });
+ }
+ }).withMenuItemProvider(new IMenuItemProvider() {
+
+ @Override
+ public void addMenuItem(final NatTable natTable, Menu popupMenu) {
+ MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
+ menuItem.setText("Expand to Level 2"); //$NON-NLS-1$
+ menuItem.setEnabled(true);
+
+ menuItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ natTable.doCommand(new TreeExpandToLevelCommand(2));
+ }
+ });
+ }
+ });
}
});
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_605_GroupBy/_6053_GroupBySummaryExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_605_GroupBy/_6053_GroupBySummaryExample.java
index a7c50d7..8f6b4ac 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_605_GroupBy/_6053_GroupBySummaryExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_605_GroupBy/_6053_GroupBySummaryExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._600_GlazedLists._605_GroupBy;
@@ -27,10 +27,10 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.ExtendedPersonWithAddress;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
+import org.eclipse.nebula.widgets.nattable.examples._600_GlazedLists._605_GroupBy._6052_GroupByCustomTypesExample.MyRowObject.Gender;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_606_GlazedListsRowHideShowExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_606_GlazedListsRowHideShowExample.java
index 882e779..46949f8 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_606_GlazedListsRowHideShowExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_606_GlazedListsRowHideShowExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._600_GlazedLists;
@@ -21,9 +21,9 @@
import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.DetailGlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.hideshow.GlazedListsRowHideShowLayer;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_751_CopyExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_751_CopyExample.java
index d63cbcf..71a50c4 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_751_CopyExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_751_CopyExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._700_AdditionalFunctions;
@@ -18,9 +18,9 @@
import org.eclipse.nebula.widgets.nattable.copy.command.CopyDataCommandHandler;
import org.eclipse.nebula.widgets.nattable.copy.command.CopyDataToClipboardCommand;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -44,11 +44,6 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-/**
- *
- * @author Dirk Fauth
- *
- */
public class _751_CopyExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
@@ -94,48 +89,65 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(100), propertyNames);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(PersonService.getPersons(100), propertyNames);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(
+ columnHeaderDataLayer,
+ viewportLayer,
+ selectionLayer);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(
+ rowHeaderDataLayer,
+ viewportLayer,
+ selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- columnHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(
+ columnHeaderDataProvider,
+ rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(
+ cornerDataLayer,
+ rowHeaderLayer,
+ columnHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(
+ viewportLayer,
+ columnHeaderLayer,
+ rowHeaderLayer,
+ cornerLayer);
// register a CopyDataCommandHandler that also copies the headers and
- // uses
- // the configured IDisplayConverters
- CopyDataCommandHandler copyHandler = new CopyDataCommandHandler(
- selectionLayer, columnHeaderDataLayer, rowHeaderDataLayer);
+ // uses the configured IDisplayConverters
+ CopyDataCommandHandler copyHandler =
+ new CopyDataCommandHandler(
+ selectionLayer,
+ columnHeaderDataLayer,
+ rowHeaderDataLayer);
copyHandler.setCopyFormattedText(true);
gridLayer.registerCommandHandler(copyHandler);
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_761_PrintExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_761_PrintExample.java
index 7929856..079f27c 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_761_PrintExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_761_PrintExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._700_AdditionalFunctions;
@@ -17,9 +17,9 @@
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
@@ -36,11 +36,6 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-/**
- *
- * @author Dirk Fauth
- *
- */
public class _761_PrintExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
@@ -85,16 +80,17 @@
propertyToLabelMap.put("married", "Married");
propertyToLabelMap.put("birthday", "Birthday");
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(100), propertyNames);
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(
+ PersonService.getPersons(100), propertyNames);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
// add the PrintCommandHandler to the ViewportLayer in order to make
// printing work
- viewportLayer.registerCommandHandler(new PrintCommandHandler(
- viewportLayer));
+ viewportLayer.registerCommandHandler(
+ new PrintCommandHandler(viewportLayer));
final NatTable natTable = new NatTable(gridPanel, viewportLayer, false);
@@ -111,8 +107,10 @@
addColumnButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- natTable.doCommand(new PrintCommand(natTable
- .getConfigRegistry(), natTable.getShell()));
+ natTable.doCommand(
+ new PrintCommand(
+ natTable.getConfigRegistry(),
+ natTable.getShell()));
}
});
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_771_ExcelExportExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_771_ExcelExportExample.java
index 89a5e1e..1cf499e 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_771_ExcelExportExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_771_ExcelExportExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._700_AdditionalFunctions;
@@ -17,9 +17,9 @@
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.export.command.ExportCommand;
import org.eclipse.nebula.widgets.nattable.export.command.ExportCommandHandler;
@@ -38,11 +38,6 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-/**
- *
- * @author Dirk Fauth
- *
- */
public class _771_ExcelExportExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
@@ -84,8 +79,8 @@
propertyToLabelMap.put("married", "Married");
propertyToLabelMap.put("birthday", "Birthday");
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(10), propertyNames);
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(PersonService.getPersons(10), propertyNames);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
@@ -94,8 +89,7 @@
// add the ExportCommandHandler to the ViewportLayer in order to make
// exporting work
- viewportLayer.registerCommandHandler(new ExportCommandHandler(
- viewportLayer));
+ viewportLayer.registerCommandHandler(new ExportCommandHandler(viewportLayer));
final NatTable natTable = new NatTable(gridPanel, viewportLayer, false);
@@ -114,8 +108,10 @@
addColumnButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- natTable.doCommand(new ExportCommand(natTable
- .getConfigRegistry(), natTable.getShell()));
+ natTable.doCommand(
+ new ExportCommand(
+ natTable.getConfigRegistry(),
+ natTable.getShell()));
}
});
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_772_GridExcelExportExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_772_GridExcelExportExample.java
index a830d70..fa845b6 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_772_GridExcelExportExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_772_GridExcelExportExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._700_AdditionalFunctions;
@@ -16,9 +16,9 @@
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.export.command.ExportCommand;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
@@ -43,11 +43,6 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-/**
- *
- * @author Dirk Fauth
- *
- */
public class _772_GridExcelExportExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
@@ -92,42 +87,42 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(10), propertyNames);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(PersonService.getPersons(10), propertyNames);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- columnHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(viewportLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
final NatTable natTable = new NatTable(gridPanel, gridLayer);
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
@@ -137,8 +132,10 @@
addColumnButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- natTable.doCommand(new ExportCommand(natTable
- .getConfigRegistry(), natTable.getShell()));
+ natTable.doCommand(
+ new ExportCommand(
+ natTable.getConfigRegistry(),
+ natTable.getShell()));
}
});
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_773_GridExcelExportFormatterExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_773_GridExcelExportFormatterExample.java
index ab91daa..dbef86d 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_773_GridExcelExportFormatterExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_773_GridExcelExportFormatterExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._700_AdditionalFunctions;
@@ -21,9 +21,9 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.export.ExportConfigAttributes;
import org.eclipse.nebula.widgets.nattable.export.IExportFormatter;
@@ -57,16 +57,10 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-/**
- *
- * @author Dirk Fauth
- *
- */
public class _773_GridExcelExportFormatterExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner
- .run(new _773_GridExcelExportFormatterExample());
+ StandaloneNatExampleRunner.run(new _773_GridExcelExportFormatterExample());
}
@Override
@@ -107,42 +101,42 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<Person>(
- PersonService.getPersons(10), propertyNames);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<Person>(PersonService.getPersons(10), propertyNames);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- columnHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(viewportLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
final NatTable natTable = new NatTable(gridPanel, gridLayer, false);
@@ -155,37 +149,41 @@
exporter.setApplyVerticalTextConfiguration(true);
exporter.setApplyBackgroundColor(false);
configRegistry.registerConfigAttribute(
- ExportConfigAttributes.EXPORTER, exporter);
+ ExportConfigAttributes.EXPORTER,
+ exporter);
configRegistry.registerConfigAttribute(
- ExportConfigAttributes.DATE_FORMAT, "dd.MM.yyyy");
+ ExportConfigAttributes.DATE_FORMAT,
+ "dd.MM.yyyy");
// register a custom formatter to the body of the grid
// you could also implement different formatter for different
// columns by using the label mechanism
configRegistry.registerConfigAttribute(
ExportConfigAttributes.EXPORT_FORMATTER,
- new ExampleExportFormatter(), DisplayMode.NORMAL,
+ new ExampleExportFormatter(),
+ DisplayMode.NORMAL,
GridRegion.BODY);
configRegistry.registerConfigAttribute(
ExportConfigAttributes.EXPORT_FORMATTER,
new IExportFormatter() {
- @Override
- public Object formatForExport(ILayerCell cell,
- IConfigRegistry configRegistry) {
- // simply return the data value which is an
- // integer for the row header
- // doing this avoids the default conversion to
- // string for export
- return cell.getDataValue();
- }
- }, DisplayMode.NORMAL, GridRegion.ROW_HEADER);
+ @Override
+ public Object formatForExport(ILayerCell cell, IConfigRegistry configRegistry) {
+ // simply return the data value which is an
+ // integer for the row header doing this avoids the
+ // default conversion to string for export
+ return cell.getDataValue();
+ }
+ },
+ DisplayMode.NORMAL,
+ GridRegion.ROW_HEADER);
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_PAINTER,
- new BeveledBorderDecorator(new VerticalTextPainter(
- false, true, true)), DisplayMode.NORMAL,
+ new BeveledBorderDecorator(
+ new VerticalTextPainter(false, true, true)),
+ DisplayMode.NORMAL,
GridRegion.COLUMN_HEADER);
}
@@ -200,8 +198,10 @@
addColumnButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- natTable.doCommand(new ExportCommand(natTable
- .getConfigRegistry(), natTable.getShell()));
+ natTable.doCommand(
+ new ExportCommand(
+ natTable.getConfigRegistry(),
+ natTable.getShell()));
}
});
@@ -210,8 +210,7 @@
class ExampleExportFormatter implements IExportFormatter {
@Override
- public Object formatForExport(ILayerCell cell,
- IConfigRegistry configRegistry) {
+ public Object formatForExport(ILayerCell cell, IConfigRegistry configRegistry) {
Object data = cell.getDataValue();
if (data != null) {
try {
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_774_MultiExportExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_774_MultiExportExample.java
index d93c1fd..f1ef101 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_774_MultiExportExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_774_MultiExportExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._700_AdditionalFunctions;
@@ -23,9 +23,9 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.export.ExportConfigAttributes;
import org.eclipse.nebula.widgets.nattable.export.IExportFormatter;
@@ -63,11 +63,6 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-/**
- *
- * @author Dirk Fauth
- *
- */
public class _774_MultiExportExample extends AbstractNatExample {
public static String COLUMN_ONE_LABEL = "ColumnOneLabel";
@@ -113,16 +108,14 @@
propertyToLabelMap.put("married", "Married");
propertyToLabelMap.put("birthday", "Birthday");
- GridLayer grid = createGrid(propertyNames, propertyToLabelMap,
- PersonService.getPersons(5));
+ GridLayer grid = createGrid(propertyNames, propertyToLabelMap, PersonService.getPersons(5));
final NatTable natTable = new NatTable(gridPanel, grid, false);
// add labels to show that alignment configurations are also exported
// correctly
- final ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(
- grid.getBodyLayer());
- ((AbstractLayer) grid.getBodyLayer())
- .setConfigLabelAccumulator(columnLabelAccumulator);
+ final ColumnOverrideLabelAccumulator columnLabelAccumulator =
+ new ColumnOverrideLabelAccumulator(grid.getBodyLayer());
+ ((AbstractLayer) grid.getBodyLayer()).setConfigLabelAccumulator(columnLabelAccumulator);
columnLabelAccumulator.registerColumnOverrides(0, COLUMN_ONE_LABEL);
columnLabelAccumulator.registerColumnOverrides(1, COLUMN_TWO_LABEL);
@@ -134,21 +127,27 @@
style.setAttributeValue(
CellStyleAttributes.HORIZONTAL_ALIGNMENT,
HorizontalAlignmentEnum.LEFT);
- style.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT,
+ style.setAttributeValue(
+ CellStyleAttributes.VERTICAL_ALIGNMENT,
VerticalAlignmentEnum.TOP);
configRegistry.registerConfigAttribute(
- CellConfigAttributes.CELL_STYLE, style,
- DisplayMode.NORMAL, COLUMN_ONE_LABEL);
+ CellConfigAttributes.CELL_STYLE,
+ style,
+ DisplayMode.NORMAL,
+ COLUMN_ONE_LABEL);
style = new Style();
style.setAttributeValue(
CellStyleAttributes.HORIZONTAL_ALIGNMENT,
HorizontalAlignmentEnum.RIGHT);
- style.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT,
+ style.setAttributeValue(
+ CellStyleAttributes.VERTICAL_ALIGNMENT,
VerticalAlignmentEnum.BOTTOM);
configRegistry.registerConfigAttribute(
- CellConfigAttributes.CELL_STYLE, style,
- DisplayMode.NORMAL, COLUMN_TWO_LABEL);
+ CellConfigAttributes.CELL_STYLE,
+ style,
+ DisplayMode.NORMAL,
+ COLUMN_TWO_LABEL);
}
});
@@ -162,29 +161,33 @@
new HSSFExcelExporter());
configRegistry.registerConfigAttribute(
- ExportConfigAttributes.DATE_FORMAT, "dd.MM.yyyy");
+ ExportConfigAttributes.DATE_FORMAT,
+ "dd.MM.yyyy");
// register a custom formatter to the body of the grid
// you could also implement different formatter for different
// columns by using the label mechanism
configRegistry.registerConfigAttribute(
ExportConfigAttributes.EXPORT_FORMATTER,
- new ExampleExportFormatter(), DisplayMode.NORMAL,
+ new ExampleExportFormatter(),
+ DisplayMode.NORMAL,
GridRegion.BODY);
configRegistry.registerConfigAttribute(
ExportConfigAttributes.EXPORT_FORMATTER,
new IExportFormatter() {
+
@Override
- public Object formatForExport(ILayerCell cell,
- IConfigRegistry configRegistry) {
+ public Object formatForExport(ILayerCell cell, IConfigRegistry configRegistry) {
// simply return the data value which is an
// integer for the row header
// doing this avoids the default conversion to
// string for export
return cell.getDataValue();
}
- }, DisplayMode.NORMAL, GridRegion.ROW_HEADER);
+ },
+ DisplayMode.NORMAL,
+ GridRegion.ROW_HEADER);
}
});
@@ -211,13 +214,14 @@
valuesToShow.add(createNumberValues());
valuesToShow.add(createNumberValues());
- final NatTable numberNatTable = new NatTable(gridPanel, createGrid(
- numberPropertyNames, numberPropertyToLabelMap, valuesToShow),
- false);
+ final NatTable numberNatTable =
+ new NatTable(
+ gridPanel,
+ createGrid(numberPropertyNames, numberPropertyToLabelMap, valuesToShow),
+ false);
// adding this configuration adds the styles and the painters to use
- numberNatTable
- .addConfiguration(new DefaultNatTableStyleConfiguration());
+ numberNatTable.addConfiguration(new DefaultNatTableStyleConfiguration());
numberNatTable.addConfiguration(new AbstractRegistryConfiguration() {
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
@@ -229,29 +233,30 @@
ExportConfigAttributes.EXPORT_FORMATTER,
new IExportFormatter() {
@Override
- public Object formatForExport(ILayerCell cell,
- IConfigRegistry configRegistry) {
+ public Object formatForExport(ILayerCell cell, IConfigRegistry configRegistry) {
// simply return the data value which is an
- // integer for the row header
- // doing this avoids the default conversion to
- // string for export
+ // integer for the row header doing this avoids the
+ // default conversion to string for export
return cell.getDataValue();
}
- }, DisplayMode.NORMAL, GridRegion.BODY);
+ },
+ DisplayMode.NORMAL,
+ GridRegion.BODY);
configRegistry.registerConfigAttribute(
ExportConfigAttributes.EXPORT_FORMATTER,
new IExportFormatter() {
- @Override
- public Object formatForExport(ILayerCell cell,
- IConfigRegistry configRegistry) {
- // simply return the data value which is an
- // integer for the row header
- // doing this avoids the default conversion to
- // string for export
- return cell.getDataValue();
- }
- }, DisplayMode.NORMAL, GridRegion.ROW_HEADER);
+ @Override
+ public Object formatForExport(ILayerCell cell,
+ IConfigRegistry configRegistry) {
+ // simply return the data value which is an
+ // integer for the row header doing this avoids the
+ // default conversion to string for export
+ return cell.getDataValue();
+ }
+ },
+ DisplayMode.NORMAL,
+ GridRegion.ROW_HEADER);
}
});
@@ -267,8 +272,7 @@
export.put("Persons", natTable);
export.put("Numbers", numberNatTable);
new NatExporter(Display.getCurrent().getActiveShell())
- .exportMultipleNatTables(new HSSFExcelExporter(),
- export);
+ .exportMultipleNatTables(new HSSFExcelExporter(), export);
}
});
@@ -279,42 +283,41 @@
Map<String, String> propertyToLabelMap, List<T> values) {
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
- IDataProvider bodyDataProvider = new DefaultBodyDataProvider<T>(values,
- propertyNames);
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
+ IDataProvider bodyDataProvider =
+ new DefaultBodyDataProvider<T>(values, propertyNames);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- columnHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// build the grid layer
- return new GridLayer(viewportLayer, columnHeaderLayer, rowHeaderLayer,
- cornerLayer);
+ return new GridLayer(viewportLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
}
private NumberValues createNumberValues() {
@@ -329,8 +332,7 @@
class ExampleExportFormatter implements IExportFormatter {
@Override
- public Object formatForExport(ILayerCell cell,
- IConfigRegistry configRegistry) {
+ public Object formatForExport(ILayerCell cell, IConfigRegistry configRegistry) {
Object data = cell.getDataValue();
if (data != null) {
try {
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_781_DragAndDropExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_781_DragAndDropExample.java
index 1af0214..7723250 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_781_DragAndDropExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_700_AdditionalFunctions/_781_DragAndDropExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2014 Dirk Fauth and others.
+ * Copyright (c) 2014, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._700_AdditionalFunctions;
@@ -25,10 +25,10 @@
import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DummyColumnHeaderDataProvider;
@@ -53,10 +53,6 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-/**
- * @author Dirk Fauth
- *
- */
public class _781_DragAndDropExample extends AbstractNatExample {
private NatTable firstNatTable;
@@ -108,49 +104,54 @@
propertyToLabelMap.put("firstName", "Firstname");
propertyToLabelMap.put("lastName", "Lastname");
- IColumnPropertyAccessor<Person> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<Person>(
- propertyNames);
+ IColumnPropertyAccessor<Person> columnPropertyAccessor =
+ new ReflectiveColumnPropertyAccessor<Person>(propertyNames);
- IRowDataProvider<Person> bodyDataProvider = new ListDataProvider<Person>(
- data, columnPropertyAccessor);
+ IRowDataProvider<Person> bodyDataProvider =
+ new ListDataProvider<Person>(data, columnPropertyAccessor);
final DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
ColumnReorderLayer reorderLayer = new ColumnReorderLayer(bodyDataLayer);
final SelectionLayer selectionLayer = new SelectionLayer(reorderLayer);
// set row selection model with single selection enabled
selectionLayer.setSelectionModel(new RowSelectionModel<Person>(
- selectionLayer, bodyDataProvider, new IRowIdAccessor<Person>() {
+ selectionLayer,
+ bodyDataProvider,
+ new IRowIdAccessor<Person>() {
@Override
public Serializable getRowId(Person rowObject) {
return rowObject.getId();
}
- }, false));
+ },
+ false));
ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(
- new DummyColumnHeaderDataProvider(bodyDataProvider)),
- viewportLayer, selectionLayer);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(
+ new DataLayer(
+ new DummyColumnHeaderDataProvider(bodyDataProvider)),
+ viewportLayer,
+ selectionLayer);
CompositeLayer compositeLayer = new CompositeLayer(1, 2);
- compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
- columnHeaderLayer, 0, 0);
+ compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 0, 0);
compositeLayer.setChildLayer(GridRegion.BODY, viewportLayer, 0, 1);
NatTable natTable = new NatTable(parent, compositeLayer);
// add DnD support
- DragAndDropSupport dndSupport = new DragAndDropSupport(natTable,
- selectionLayer, data);
+ DragAndDropSupport dndSupport =
+ new DragAndDropSupport(natTable, selectionLayer, data);
Transfer[] transfer = { TextTransfer.getInstance() };
natTable.addDragSupport(DND.DROP_COPY, transfer, dndSupport);
natTable.addDropSupport(DND.DROP_COPY, transfer, dndSupport);
// adding a full border
- natTable.addOverlayPainter(new NatTableBorderOverlayPainter(natTable
- .getConfigRegistry()));
+ natTable.addOverlayPainter(
+ new NatTableBorderOverlayPainter(natTable.getConfigRegistry()));
return natTable;
}
@@ -166,8 +167,7 @@
private static final String DATA_SEPARATOR = "|";
private final SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
- public DragAndDropSupport(NatTable natTable,
- SelectionLayer selectionLayer, List<Person> data) {
+ public DragAndDropSupport(NatTable natTable, SelectionLayer selectionLayer, List<Person> data) {
this.natTable = natTable;
this.selectionLayer = selectionLayer;
this.data = data;
@@ -177,8 +177,7 @@
public void dragStart(DragSourceEvent event) {
if (this.selectionLayer.getSelectedRowCount() == 0) {
event.doit = false;
- } else if (!this.natTable.getRegionLabelsByXY(event.x, event.y)
- .hasLabel(GridRegion.BODY)) {
+ } else if (!this.natTable.getRegionLabelsByXY(event.x, event.y).hasLabel(GridRegion.BODY)) {
event.doit = false;
}
}
@@ -187,13 +186,13 @@
@Override
public void dragSetData(DragSourceEvent event) {
// we know that we use the RowSelectionModel with single selection
- List<Person> selection = ((RowSelectionModel<Person>) this.selectionLayer
- .getSelectionModel()).getSelectedRowObjects();
+ List<Person> selection = ((RowSelectionModel<Person>) this.selectionLayer.getSelectionModel()).getSelectedRowObjects();
if (!selection.isEmpty()) {
this.draggedPerson = selection.get(0);
StringBuilder builder = new StringBuilder();
- builder.append(this.draggedPerson.getId()).append(DATA_SEPARATOR)
+ builder.append(this.draggedPerson.getId())
+ .append(DATA_SEPARATOR)
.append(this.draggedPerson.getFirstName())
.append(DATA_SEPARATOR)
.append(this.draggedPerson.getLastName())
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_801_VerticalCompositionWithFeaturesExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_801_VerticalCompositionWithFeaturesExample.java
index b1a094c..655f71e 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_801_VerticalCompositionWithFeaturesExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_801_VerticalCompositionWithFeaturesExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._800_Integration;
@@ -32,14 +32,14 @@
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultBooleanDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditBindings;
import org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditConfiguration;
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.export.command.ExportCommandHandler;
import org.eclipse.nebula.widgets.nattable.export.config.DefaultExportBindings;
@@ -79,16 +79,11 @@
/**
* Example showing a NatTable that contains a column header and a body layer. It
* adds sorting, filtering, editing, copy, print and export features.
- *
- * @author Dirk Fauth
- *
*/
-public class _801_VerticalCompositionWithFeaturesExample extends
- AbstractNatExample {
+public class _801_VerticalCompositionWithFeaturesExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner.run(600, 400,
- new _801_VerticalCompositionWithFeaturesExample());
+ StandaloneNatExampleRunner.run(600, 400, new _801_VerticalCompositionWithFeaturesExample());
}
@Override
@@ -120,8 +115,13 @@
GridDataFactory.fillDefaults().grab(false, false).applyTo(buttonPanel);
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday"
+ };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -131,55 +131,64 @@
propertyToLabelMap.put("married", "Married");
propertyToLabelMap.put("birthday", "Birthday");
- IColumnPropertyAccessor<Person> columnPropertyAccessor = new ExtendedReflectiveColumnPropertyAccessor<Person>(
- propertyNames);
+ IColumnPropertyAccessor<Person> columnPropertyAccessor =
+ new ExtendedReflectiveColumnPropertyAccessor<Person>(propertyNames);
List<Person> values = PersonService.getPersons(10);
final EventList<Person> eventList = GlazedLists.eventList(values);
- TransformedList<Person, Person> rowObjectsGlazedList = GlazedLists
- .threadSafeList(eventList);
+ TransformedList<Person, Person> rowObjectsGlazedList = GlazedLists.threadSafeList(eventList);
// use the SortedList constructor with 'null' for the Comparator because
- // the Comparator
- // will be set by configuration
- SortedList<Person> sortedList = new SortedList<Person>(
- rowObjectsGlazedList, null);
+ // the Comparator will be set by configuration
+ SortedList<Person> sortedList = new SortedList<Person>(rowObjectsGlazedList, null);
// wrap the SortedList with the FilterList
FilterList<Person> filterList = new FilterList<Person>(sortedList);
- IRowDataProvider<Person> bodyDataProvider = new ListDataProvider<Person>(
- filterList, columnPropertyAccessor);
+ IRowDataProvider<Person> bodyDataProvider =
+ new ListDataProvider<Person>(filterList, columnPropertyAccessor);
final DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
bodyDataLayer.setConfigLabelAccumulator(new ColumnLabelAccumulator());
- GlazedListsEventLayer<Person> eventLayer = new GlazedListsEventLayer<Person>(
- bodyDataLayer, filterList);
- final SelectionLayer selectionLayer = new SelectionLayer(eventLayer);
- ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
+ GlazedListsEventLayer<Person> eventLayer =
+ new GlazedListsEventLayer<Person>(bodyDataLayer, filterList);
+ final SelectionLayer selectionLayer =
+ new SelectionLayer(eventLayer);
+ ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
+
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
// add sorting
- SortHeaderLayer<Person> sortHeaderLayer = new SortHeaderLayer<Person>(
- columnHeaderLayer, new GlazedListsSortModel<Person>(sortedList,
- columnPropertyAccessor, configRegistry,
- columnHeaderDataLayer), false);
+ SortHeaderLayer<Person> sortHeaderLayer =
+ new SortHeaderLayer<Person>(
+ columnHeaderLayer,
+ new GlazedListsSortModel<Person>(
+ sortedList,
+ columnPropertyAccessor,
+ configRegistry,
+ columnHeaderDataLayer),
+ false);
// add the filter row functionality
- final FilterRowHeaderComposite<Person> filterRowHeaderLayer = new FilterRowHeaderComposite<Person>(
- new DefaultGlazedListsFilterStrategy<Person>(filterList,
- columnPropertyAccessor, configRegistry),
- sortHeaderLayer, columnHeaderDataProvider, configRegistry);
+ final FilterRowHeaderComposite<Person> filterRowHeaderLayer =
+ new FilterRowHeaderComposite<Person>(
+ new DefaultGlazedListsFilterStrategy<Person>(
+ filterList,
+ columnPropertyAccessor,
+ configRegistry),
+ sortHeaderLayer,
+ columnHeaderDataProvider,
+ configRegistry);
// set the region labels to make default configurations work, e.g.
// editing, selection
CompositeLayer compositeLayer = new CompositeLayer(1, 2);
- compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER,
- filterRowHeaderLayer, 0, 0);
+ compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, filterRowHeaderLayer, 0, 0);
compositeLayer.setChildLayer(GridRegion.BODY, viewportLayer, 0, 1);
// add edit configurations
@@ -187,13 +196,13 @@
compositeLayer.addConfiguration(new DefaultEditBindings());
// add print support
- compositeLayer.registerCommandHandler(new PrintCommandHandler(
- compositeLayer));
+ compositeLayer.registerCommandHandler(
+ new PrintCommandHandler(compositeLayer));
compositeLayer.addConfiguration(new DefaultPrintBindings());
// add excel export support
- compositeLayer.registerCommandHandler(new ExportCommandHandler(
- compositeLayer));
+ compositeLayer.registerCommandHandler(
+ new ExportCommandHandler(compositeLayer));
compositeLayer.addConfiguration(new DefaultExportBindings());
final NatTable natTable = new NatTable(gridPanel, compositeLayer, false);
@@ -217,23 +226,25 @@
// birthday is never editable
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITABLE_RULE,
- IEditableRule.NEVER_EDITABLE, DisplayMode.NORMAL,
+ IEditableRule.NEVER_EDITABLE,
+ DisplayMode.NORMAL,
ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4);
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR,
- new ComboBoxCellEditor(Arrays.asList(Gender.FEMALE,
- Gender.MALE)), DisplayMode.NORMAL,
+ new ComboBoxCellEditor(Arrays.asList(Gender.FEMALE, Gender.MALE)),
+ DisplayMode.NORMAL,
ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
- getGenderBooleanConverter(), DisplayMode.NORMAL,
+ getGenderBooleanConverter(),
+ DisplayMode.NORMAL,
ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2);
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR,
- new ComboBoxCellEditor(Arrays.asList(Boolean.TRUE,
- Boolean.FALSE)), DisplayMode.NORMAL,
+ new ComboBoxCellEditor(Arrays.asList(Boolean.TRUE, Boolean.FALSE)),
+ DisplayMode.NORMAL,
ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 3);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
@@ -246,8 +257,8 @@
natTable.configure();
- final RowSelectionProvider<Person> selectionProvider = new RowSelectionProvider<Person>(
- selectionLayer, bodyDataProvider, false);
+ final RowSelectionProvider<Person> selectionProvider =
+ new RowSelectionProvider<Person>(selectionLayer, bodyDataProvider, false);
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
@@ -261,8 +272,7 @@
if (natTable.getActiveCellEditor() != null) {
natTable.commitAndCloseActiveCellEditor();
}
- Person item = (Person) ((IStructuredSelection) selectionProvider
- .getSelection()).getFirstElement();
+ Person item = (Person) ((IStructuredSelection) selectionProvider.getSelection()).getFirstElement();
eventList.remove(item);
}
});
@@ -289,8 +299,7 @@
@Override
public Object displayToCanonicalValue(Object displayValue) {
- Boolean displayBoolean = Boolean.valueOf(displayValue
- .toString());
+ Boolean displayBoolean = Boolean.valueOf(displayValue.toString());
return displayBoolean ? Gender.MALE : Gender.FEMALE;
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_802_CalculatingGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_802_CalculatingGridExample.java
index 0125fa8..1f0f8da 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_802_CalculatingGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_802_CalculatingGridExample.java
@@ -28,9 +28,9 @@
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.PercentageDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_803_CachedCalculatingGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_803_CachedCalculatingGridExample.java
index 649d55d..63d8632 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_803_CachedCalculatingGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_803_CachedCalculatingGridExample.java
@@ -30,9 +30,9 @@
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.PercentageDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_804_GlazedListsEditorExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_804_GlazedListsEditorExample.java
index d00406d..7406dcf 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_804_GlazedListsEditorExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_804_GlazedListsEditorExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -33,6 +33,9 @@
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.editor.CheckBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
@@ -42,9 +45,6 @@
import org.eclipse.nebula.widgets.nattable.edit.gui.FileDialogCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.ExtendedPersonWithAddress;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_806_SortableColumnGroupingExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_806_SortableColumnGroupingExample.java
index 93fceb7..786c063 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_806_SortableColumnGroupingExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_806_SortableColumnGroupingExample.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Dirk Fauth <dirk.fauth@gmail.com> - initial API and implementation
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples._800_Integration;
@@ -20,9 +20,9 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
@@ -59,15 +59,11 @@
* layer composition of a grid and how to add the corresponding actions to the
* column header menu. This example also adds the ability to sort the data
* model.
- *
- * @author Dirk Fauth
- *
*/
public class _806_SortableColumnGroupingExample extends AbstractNatExample {
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner
- .run(new _806_SortableColumnGroupingExample());
+ StandaloneNatExampleRunner.run(new _806_SortableColumnGroupingExample());
}
@Override
@@ -81,8 +77,13 @@
@Override
public Control createExampleControl(Composite parent) {
// property names of the Person class
- String[] propertyNames = { "firstName", "lastName", "gender",
- "married", "birthday" };
+ String[] propertyNames = {
+ "firstName",
+ "lastName",
+ "gender",
+ "married",
+ "birthday"
+ };
// mapping from property to label, needed for column header labels
Map<String, String> propertyToLabelMap = new HashMap<String, String>();
@@ -96,51 +97,56 @@
// build the body layer stack
// Usually you would create a new layer stack by extending
- // AbstractIndexLayerTransform and
- // setting the ViewportLayer as underlying layer. But in this case using
- // the ViewportLayer
- // directly as body layer is also working.
+ // AbstractIndexLayerTransform and setting the ViewportLayer as
+ // underlying layer. But in this case using the ViewportLayer directly
+ // as body layer is also working.
- EventList<Person> persons = GlazedLists.eventList(PersonService
- .getPersons(10));
+ EventList<Person> persons = GlazedLists.eventList(PersonService.getPersons(10));
SortedList<Person> sortedList = new SortedList<Person>(persons, null);
- IColumnPropertyAccessor<Person> accessor = new ReflectiveColumnPropertyAccessor<Person>(
- propertyNames);
- IDataProvider bodyDataProvider = new ListDataProvider<Person>(
- sortedList, accessor);
- DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
+ IColumnPropertyAccessor<Person> accessor =
+ new ReflectiveColumnPropertyAccessor<Person>(propertyNames);
+ IDataProvider bodyDataProvider =
+ new ListDataProvider<Person>(sortedList, accessor);
+ DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
- GlazedListsEventLayer<Person> eventLayer = new GlazedListsEventLayer<Person>(
- bodyDataLayer, sortedList);
+ GlazedListsEventLayer<Person> eventLayer =
+ new GlazedListsEventLayer<Person>(bodyDataLayer, sortedList);
- ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
- eventLayer);
- ColumnGroupReorderLayer columnGroupReorderLayer = new ColumnGroupReorderLayer(
- columnReorderLayer, columnGroupModel);
- ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(
- columnGroupReorderLayer);
- ColumnGroupExpandCollapseLayer columnGroupExpandCollapseLayer = new ColumnGroupExpandCollapseLayer(
- columnHideShowLayer, columnGroupModel);
- SelectionLayer selectionLayer = new SelectionLayer(
- columnGroupExpandCollapseLayer);
- ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
+ ColumnReorderLayer columnReorderLayer =
+ new ColumnReorderLayer(eventLayer);
+ ColumnGroupReorderLayer columnGroupReorderLayer =
+ new ColumnGroupReorderLayer(columnReorderLayer, columnGroupModel);
+ ColumnHideShowLayer columnHideShowLayer =
+ new ColumnHideShowLayer(columnGroupReorderLayer);
+ ColumnGroupExpandCollapseLayer columnGroupExpandCollapseLayer =
+ new ColumnGroupExpandCollapseLayer(columnHideShowLayer, columnGroupModel);
+ SelectionLayer selectionLayer =
+ new SelectionLayer(columnGroupExpandCollapseLayer);
+ ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
// build the column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ILayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
ConfigRegistry configRegistry = new ConfigRegistry();
- SortHeaderLayer<Person> sortHeaderLayer = new SortHeaderLayer<Person>(
- columnHeaderLayer, new GlazedListsSortModel<Person>(sortedList,
- accessor, configRegistry, columnHeaderDataLayer));
+ SortHeaderLayer<Person> sortHeaderLayer =
+ new SortHeaderLayer<Person>(
+ columnHeaderLayer,
+ new GlazedListsSortModel<Person>(
+ sortedList,
+ accessor,
+ configRegistry,
+ columnHeaderDataLayer));
- ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(
- sortHeaderLayer, selectionLayer, columnGroupModel);
+ ColumnGroupHeaderLayer columnGroupHeaderLayer =
+ new ColumnGroupHeaderLayer(sortHeaderLayer, selectionLayer, columnGroupModel);
// configure the column groups
columnGroupHeaderLayer.addColumnsIndexesToGroup("Name", 0, 1);
@@ -148,23 +154,24 @@
columnGroupHeaderLayer.setGroupUnbreakable(1);
// build the row header layer
- IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer);
+ IDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer);
// build the corner layer
- IDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- columnGroupHeaderLayer);
+ IDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, columnGroupHeaderLayer);
// build the grid layer
- GridLayer gridLayer = new GridLayer(viewportLayer,
- columnGroupHeaderLayer, rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(viewportLayer, columnGroupHeaderLayer, rowHeaderLayer, cornerLayer);
// turn the auto configuration off as we want to add our header menu
// configuration
@@ -173,8 +180,7 @@
natTable.setConfigRegistry(configRegistry);
// as the autoconfiguration of the NatTable is turned off, we have to
- // add the
- // DefaultNatTableStyleConfiguration manually
+ // add the DefaultNatTableStyleConfiguration manually
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new SingleClickSortConfiguration());
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_807_SortableFilterableColumnGroupExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_807_SortableFilterableColumnGroupExample.java
index cec6f4d..6e40b1b 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_807_SortableFilterableColumnGroupExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_807_SortableFilterableColumnGroupExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
+ * Copyright (c) 2012, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,14 +26,14 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.person.DataModelConstants;
+import org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.DataModelConstants;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.ExtendedPersonWithAddress;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_808_SortableGroupByWithFilterExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_808_SortableGroupByWithFilterExample.java
index 59a3720..3d0b4a6 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_808_SortableGroupByWithFilterExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_808_SortableGroupByWithFilterExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,12 +28,12 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Address;
+import org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Address;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.ExtendedPersonWithAddress;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
@@ -400,8 +400,7 @@
person = new Person(42, "Clancy", "Wiggum", Gender.MALE, true, new Date());
entry = new ExtendedPersonWithAddress(person, address,
- "XXXL", "It is Chief Wiggum", 0, new
- ArrayList<String>(), new ArrayList<String>());
+ "XXXL", "It is Chief Wiggum", 0, new ArrayList<String>(), new ArrayList<String>());
bodyLayerStack.getEventList().add(entry);
person = new Person(42, "Sarah", "Wiggum", Gender.FEMALE, true, new Date());
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_809_GroupBySummarySummaryRowExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_809_GroupBySummarySummaryRowExample.java
index 61a5ccf..43e3aa4 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_809_GroupBySummarySummaryRowExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_809_GroupBySummarySummaryRowExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2014 Dirk Fauth and others.
+ * Copyright (c) 2013, 2014, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,9 +30,9 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.ExtendedPersonWithAddress;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_810_SortableGroupByFilterColumnGroupAndFreezeExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_810_SortableGroupByFilterColumnGroupAndFreezeExample.java
index 4043a28..ed69733 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_810_SortableGroupByFilterColumnGroupAndFreezeExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_810_SortableGroupByFilterColumnGroupAndFreezeExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Dirk Fauth and others.
+ * Copyright (c) 2013, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,12 +35,12 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Address;
+import org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Address;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.ExtendedPersonWithAddress;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_811_GroupBySummaryFixedSummaryRowExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_811_GroupBySummaryFixedSummaryRowExample.java
index 49b6092..a08d450 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_811_GroupBySummaryFixedSummaryRowExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_811_GroupBySummaryFixedSummaryRowExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Dirk Fauth and others.
+ * Copyright (c) 2014, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,9 +29,9 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.ExtendedPersonWithAddress;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.export.ExportConfigAttributes;
import org.eclipse.nebula.widgets.nattable.export.action.ExportAction;
@@ -192,7 +192,8 @@
columnHeaderLayer,
new GlazedListsSortModel<ExtendedPersonWithAddress>(
bodyLayerStack.getSortedList(), columnPropertyAccessor,
- configRegistry, columnHeaderDataLayer), false);
+ configRegistry, columnHeaderDataLayer),
+ false);
// connect sortModel to GroupByDataLayer to support sorting by group by
// summary values
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_812_EditableGroupBySummarySummaryRowExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_812_EditableGroupBySummarySummaryRowExample.java
index 897ce67..47dca21 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_812_EditableGroupBySummarySummaryRowExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_800_Integration/_812_EditableGroupBySummarySummaryRowExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2014 Dirk Fauth and others.
+ * Copyright (c) 2013, 2014, 2015 Dirk Fauth and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -36,6 +36,8 @@
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.validate.DefaultDataValidator;
+import org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.command.EditCellCommandHandler;
import org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand;
@@ -44,8 +46,6 @@
import org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.event.InlineCellEditEventHandler;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.ExtendedPersonWithAddress;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.export.config.DefaultExportBindings;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
@@ -214,7 +214,8 @@
columnHeaderLayer,
new GlazedListsSortModel<ExtendedPersonWithAddress>(
bodyLayerStack.getSortedList(), columnPropertyAccessor,
- configRegistry, columnHeaderDataLayer), false);
+ configRegistry, columnHeaderDataLayer),
+ false);
// connect sortModel to GroupByDataLayer to support sorting by group by
// summary values
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/Person.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/Person.java
deleted file mode 100644
index 5b66568..0000000
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/person/Person.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Original authors and others - initial API and implementation
- ******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.examples.data.person;
-
-import java.util.Date;
-
-public class Person {
- public enum Gender {
- MALE, FEMALE
- }
-
- private final int id;
- private String firstName;
- private String lastName;
- private Gender gender;
- private boolean married;
- private Date birthday;
-
- public Person(int id) {
- this.id = id;
- }
-
- public Person(int id, String firstName, String lastName, Gender gender,
- boolean married, Date birthday) {
- this.id = id;
- this.firstName = firstName;
- this.lastName = lastName;
- this.gender = gender;
- this.married = married;
- this.birthday = birthday;
- }
-
- /**
- * @return the id
- */
- public int getId() {
- return this.id;
- }
-
- /**
- * @return the firstName
- */
- public String getFirstName() {
- return this.firstName;
- }
-
- /**
- * @param firstName
- * the firstName to set
- */
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- /**
- * @return the lastName
- */
- public String getLastName() {
- return this.lastName;
- }
-
- /**
- * @param lastName
- * the lastName to set
- */
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- /**
- * @return the gender
- */
- public Gender getGender() {
- return this.gender;
- }
-
- /**
- * @param gender
- * the gender to set
- */
- public void setGender(Gender gender) {
- this.gender = gender;
- }
-
- /**
- * @return the married
- */
- public boolean isMarried() {
- return this.married;
- }
-
- /**
- * @param married
- * the married to set
- */
- public void setMarried(boolean married) {
- this.married = married;
- }
-
- /**
- * @return the birthday
- */
- public Date getBirthday() {
- return this.birthday;
- }
-
- /**
- * @param birthday
- * the birthday to set
- */
- public void setBirthday(Date birthday) {
- this.birthday = birthday;
- }
-}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/stock/PricingTypeBean.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/stock/PricingTypeBean.java
deleted file mode 100644
index 08790f2..0000000
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/data/stock/PricingTypeBean.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Original authors and others - initial API and implementation
- ******************************************************************************/
-package org.eclipse.nebula.widgets.nattable.examples.data.stock;
-
-import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
-import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
-
-/**
- * Bean representing the pricing type. Used as the canonical data source for the
- * combo box - used to test the canonical to display conversion
- */
-public class PricingTypeBean implements Comparable<PricingTypeBean> {
- public String type;
-
- public PricingTypeBean(String type) {
- this.type = type;
- }
-
- @Override
- public String toString() {
- return this.type;
- }
-
- /**
- * Format: Items displayed in the Combo <-> Canonical value
- */
- public static IDisplayConverter getDisplayConverter() {
- return new DisplayConverter() {
- @Override
- public Object canonicalToDisplayValue(Object canonicalValue) {
- if (canonicalValue == null) {
- return null;
- } else {
- return canonicalValue.toString().equals("MN") ? "Manual"
- : "Automatic";
- }
- }
-
- @Override
- public Object displayToCanonicalValue(Object displayValue) {
- return displayValue.toString().equals("Manual") ? new PricingTypeBean(
- "MN") : new PricingTypeBean("AT");
- }
- };
- }
-
- @Override
- public int compareTo(PricingTypeBean o) {
- return this.toString().compareTo(o.toString());
- }
-
-}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_001_Getting_Started.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_001_Getting_Started.java
index 3b7a478..09d9d3c 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_001_Getting_Started.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_001_Getting_Started.java
@@ -20,8 +20,8 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.SimplePerson;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.fixtures.Person;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
@@ -76,11 +76,11 @@
}
private IDataProvider setupBodyDataProvider() {
- final List<Person> people = Arrays.asList(new Person(100,
- "Mickey Mouse", new Date(1000000)), new Person(110, "Batman",
+ final List<SimplePerson> people = Arrays.asList(new SimplePerson(100,
+ "Mickey Mouse", new Date(1000000)), new SimplePerson(110, "Batman",
new Date(2000000)),
- new Person(120, "Bender", new Date(3000000)), new Person(130,
- "Cartman", new Date(4000000)), new Person(140,
+ new SimplePerson(120, "Bender", new Date(3000000)), new SimplePerson(130,
+ "Cartman", new Date(4000000)), new SimplePerson(140,
"Dogbert", new Date(5000000)));
this.propertyToLabels = new HashMap<String, String>();
@@ -89,8 +89,8 @@
this.propertyToLabels.put("birthDate", "DOB");
this.propertyNames = new String[] { "id", "name", "birthDate" };
- return new ListDataProvider<Person>(people,
- new ReflectiveColumnPropertyAccessor<Person>(this.propertyNames));
+ return new ListDataProvider<SimplePerson>(people,
+ new ReflectiveColumnPropertyAccessor<SimplePerson>(this.propertyNames));
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_100_Layers/TreeGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_100_Layers/TreeGridExample.java
index 3c196be..0b12b3a 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_100_Layers/TreeGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_100_Layers/TreeGridExample.java
@@ -22,11 +22,11 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.DetailGlazedListsEventLayer;
-import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsDataProvider;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.tree.GlazedListTreeData;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.tree.GlazedListTreeRowModel;
@@ -100,7 +100,7 @@
new DatumTreeFormat(sortModel), new DatumExpansionModel());
GlazedListTreeData<Datum> treeData = new GlazedListTreeData<Datum>(treeList);
- GlazedListsDataProvider<Datum> bodyDataProvider = new GlazedListsDataProvider<Datum>(
+ ListDataProvider<Datum> bodyDataProvider = new ListDataProvider<Datum>(
treeList, columnPropertyAccessor);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
@@ -207,8 +207,92 @@
@Override
public Comparator<Datum> getComparator(int depth) {
+ final Comparator<Datum> dComp = GlazedLists.beanPropertyComparator(Datum.class, "foo");
+ Comparator<Datum> test = new Comparator<TreeGridExample.Datum>() {
+
+ @Override
+ public int compare(Datum o1, Datum o2) {
+ int result = 0;
+ if (o1.getParent() != null && o2.getParent() != null) {
+ // test the depth
+ Integer o1Depth = depth(o1);
+ Integer o2Depth = depth(o2);
+
+ // result = o1Depth.compareTo(o2Depth);
+ // if (result == 0) {
+ // result = dComp.compare(o1.getParent(),
+ // o2.getParent());
+ // }
+ // else {
+ // FIXME correct order for different levels
+ if (o1Depth > o2Depth) {
+ result = dComp.compare(o1.getParent(), o2);
+ if (result == 0) {
+ // we have a parent-child relationship
+ return 1;
+ }
+ }
+ else {
+ result = dComp.compare(o1, o2.getParent());
+ if (result == 0) {
+ // we have a parent-child relationship
+ return -1;
+ }
+ }
+ // }
+ }
+ else if (!isRoot(o1) && isRoot(o2)) {
+ result = dComp.compare(getRoot(o1), o2);
+ if (result == 0) {
+ // the given root and the root of the child are
+ // equal
+ // therefore the child is "lower" than the root
+ result = -1;
+ }
+ }
+ else if (isRoot(o1) && !isRoot(o2)) {
+ result = dComp.compare(o1, getRoot(o2));
+ if (result == 0) {
+ // the given root and the root of the child are
+ // equal
+ // therefore the child is "bigger" than the root
+ result = 1;
+ }
+ }
+ else if (isRoot(o1) && isRoot(o2)) {
+ return dComp.compare(o1, o2);
+ }
+ return result;
+ }
+
+ int depth(Datum datum) {
+ int d = 0;
+ while (datum.getParent() != null) {
+ d++;
+ datum = datum.getParent();
+ }
+ return d;
+ }
+
+ boolean isRoot(Datum datum) {
+ return datum.getParent() == null;
+ }
+
+ Datum getRoot(Datum datum) {
+ Datum result = datum;
+
+ while (!isRoot(result)) {
+ result = result.getParent();
+ }
+
+ return result;
+ }
+ };
+
+ // return test;
return new SortableTreeComparator<Datum>(
- GlazedLists.beanPropertyComparator(Datum.class, "foo"),
+ test,
+ // GlazedLists.beanPropertyComparator(Datum.class, "foo"),
this.sortModel);
}
}
@@ -287,7 +371,7 @@
}
private void createDatums() {
- createDatum(null, "root", 1);
+ createDatum(null, "root", 2);
createDatum("root", "A", 10);
createDatum("A", "A.1", 100);
createDatum("A", "A.2", 110);
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_100_Layers/_101_Header/DynamicColumnHeaderHeightExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_100_Layers/_101_Header/DynamicColumnHeaderHeightExample.java
index 1441f61..6738ffd 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_100_Layers/_101_Header/DynamicColumnHeaderHeightExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_100_Layers/_101_Header/DynamicColumnHeaderHeightExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,9 +26,13 @@
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.PricingTypeBean;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
+import org.eclipse.nebula.widgets.nattable.examples.fixtures.PricingTypeBeanDisplayConverter;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.export.ExportConfigAttributes;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow.DefaultGlazedListsFilterStrategy;
@@ -56,9 +60,6 @@
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.style.Style;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.PricingTypeBean;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration;
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder;
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
@@ -98,43 +99,39 @@
IConfigRegistry configRegistry = new ConfigRegistry();
// Underlying data source
- EventList<RowDataFixture> eventList = GlazedLists
- .eventList(RowDataListFixture.getList(200));
- FilterList<RowDataFixture> filterList = new FilterList<RowDataFixture>(
- eventList);
+ EventList<RowDataFixture> eventList = GlazedLists.eventList(RowDataListFixture.getList(200));
+ FilterList<RowDataFixture> filterList = new FilterList<RowDataFixture>(eventList);
String[] propertyNames = RowDataListFixture.getPropertyNames();
- Map<String, String> propertyToLabelMap = RowDataListFixture
- .getPropertyToLabelMap();
+ Map<String, String> propertyToLabelMap = RowDataListFixture.getPropertyToLabelMap();
// Body
- IColumnPropertyAccessor<RowDataFixture> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<RowDataFixture>(
- propertyNames);
- ListDataProvider<RowDataFixture> bodyDataProvider = new ListDataProvider<RowDataFixture>(
- filterList, columnPropertyAccessor);
- DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
- ColumnGroupBodyLayerStack bodyLayer = new ColumnGroupBodyLayerStack(
- bodyDataLayer, this.columnGroupModel);
+ IColumnPropertyAccessor<RowDataFixture> columnPropertyAccessor =
+ new ReflectiveColumnPropertyAccessor<RowDataFixture>(propertyNames);
+ ListDataProvider<RowDataFixture> bodyDataProvider =
+ new ListDataProvider<RowDataFixture>(filterList, columnPropertyAccessor);
+ DataLayer bodyDataLayer =
+ new DataLayer(bodyDataProvider);
+ ColumnGroupBodyLayerStack bodyLayer =
+ new ColumnGroupBodyLayerStack(bodyDataLayer, this.columnGroupModel);
- ColumnOverrideLabelAccumulator bodyLabelAccumulator = new ColumnOverrideLabelAccumulator(
- bodyDataLayer);
+ ColumnOverrideLabelAccumulator bodyLabelAccumulator =
+ new ColumnOverrideLabelAccumulator(bodyDataLayer);
bodyDataLayer.setConfigLabelAccumulator(bodyLabelAccumulator);
- bodyLabelAccumulator
- .registerColumnOverrides(
- RowDataListFixture
- .getColumnIndexOfProperty(RowDataListFixture.PRICING_TYPE_PROP_NAME),
- "PRICING_TYPE_PROP_NAME");
+ bodyLabelAccumulator.registerColumnOverrides(
+ RowDataListFixture.getColumnIndexOfProperty(RowDataListFixture.PRICING_TYPE_PROP_NAME),
+ "PRICING_TYPE_PROP_NAME");
// Column header
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- this.columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- bodyLayer, bodyLayer.getSelectionLayer());
- ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(
- this.columnHeaderLayer, bodyLayer.getSelectionLayer(),
- this.columnGroupModel);
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ this.columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
+ ColumnGroupHeaderLayer columnGroupHeaderLayer =
+ new ColumnGroupHeaderLayer(
+ this.columnHeaderLayer, bodyLayer.getSelectionLayer(),
+ this.columnGroupModel);
columnGroupHeaderLayer.addColumnsIndexesToGroup("Group 1", 1, 2);
@@ -144,53 +141,59 @@
// Note: The column header layer is wrapped in a filter row composite.
// This plugs in the filter row functionality
- final FilterRowHeaderComposite<RowDataFixture> filterRowHeaderLayer = new FilterRowHeaderComposite<RowDataFixture>(
- new DefaultGlazedListsFilterStrategy<RowDataFixture>(
- filterList, columnPropertyAccessor, configRegistry),
- columnGroupHeaderLayer, columnHeaderDataProvider,
- configRegistry);
+ final FilterRowHeaderComposite<RowDataFixture> filterRowHeaderLayer =
+ new FilterRowHeaderComposite<RowDataFixture>(
+ new DefaultGlazedListsFilterStrategy<RowDataFixture>(filterList, columnPropertyAccessor, configRegistry),
+ columnGroupHeaderLayer,
+ columnHeaderDataProvider,
+ configRegistry);
filterRowHeaderLayer.setFilterRowVisible(false);
- ColumnOverrideLabelAccumulator labelAccumulator = new ColumnOverrideLabelAccumulator(
- columnHeaderDataLayer);
+ ColumnOverrideLabelAccumulator labelAccumulator =
+ new ColumnOverrideLabelAccumulator(columnHeaderDataLayer);
columnHeaderDataLayer.setConfigLabelAccumulator(labelAccumulator);
// Register labels
- labelAccumulator.registerColumnOverrides(RowDataListFixture
- .getColumnIndexOfProperty(RowDataListFixture.RATING_PROP_NAME),
+ labelAccumulator.registerColumnOverrides(
+ RowDataListFixture.getColumnIndexOfProperty(RowDataListFixture.RATING_PROP_NAME),
"CUSTOM_COMPARATOR_LABEL");
// Row header
- final DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- bodyLayer, bodyLayer.getSelectionLayer());
+ final DefaultRowHeaderDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DefaultRowHeaderDataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
// Corner
- final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- filterRowHeaderLayer);
+ final DefaultCornerDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, filterRowHeaderLayer);
// Grid
- GridLayer gridLayer = new GridLayer(bodyLayer, filterRowHeaderLayer,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(bodyLayer, filterRowHeaderLayer, rowHeaderLayer, cornerLayer);
NatTable natTable = new NatTable(parent, gridLayer, false);
// Register create column group command handler
// Register column chooser
- DisplayColumnChooserCommandHandler columnChooserCommandHandler = new DisplayColumnChooserCommandHandler(
- bodyLayer.getSelectionLayer(),
- bodyLayer.getColumnHideShowLayer(), this.columnHeaderLayer,
- columnHeaderDataLayer, columnGroupHeaderLayer, this.columnGroupModel);
+ DisplayColumnChooserCommandHandler columnChooserCommandHandler =
+ new DisplayColumnChooserCommandHandler(
+ bodyLayer.getSelectionLayer(),
+ bodyLayer.getColumnHideShowLayer(),
+ this.columnHeaderLayer,
+ columnHeaderDataLayer,
+ columnGroupHeaderLayer,
+ this.columnGroupModel);
bodyLayer.registerCommandHandler(columnChooserCommandHandler);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
@@ -220,16 +223,14 @@
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- filterRowHeaderLayer.setFilterRowVisible(!filterRowHeaderLayer
- .isFilterRowVisible());
+ filterRowHeaderLayer.setFilterRowVisible(!filterRowHeaderLayer.isFilterRowVisible());
}
});
return natTable;
}
- public static class FilterRowCustomConfiguration extends
- AbstractRegistryConfiguration {
+ public static class FilterRowCustomConfiguration extends AbstractRegistryConfiguration {
final DefaultDoubleDisplayConverter doubleDisplayConverter = new DefaultDoubleDisplayConverter();
@@ -238,45 +239,46 @@
// Configure custom comparator on the rating column
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_COMPARATOR,
- getIngnorecaseComparator(), DisplayMode.NORMAL,
+ getIngnorecaseComparator(),
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 2);
// If threshold comparison is used we have to convert the string
- // entered by the
- // user to the correct underlying type (double), so that it can be
- // compared
+ // entered by the user to the correct underlying type (double), so
+ // that it can be compared
// Configure Bid column
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
- this.doubleDisplayConverter, DisplayMode.NORMAL,
+ this.doubleDisplayConverter,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 5);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
- TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL,
+ TextMatchingMode.REGULAR_EXPRESSION,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 5);
// Configure Ask column
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
- this.doubleDisplayConverter, DisplayMode.NORMAL,
+ this.doubleDisplayConverter,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 6);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
- TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL,
+ TextMatchingMode.REGULAR_EXPRESSION,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 6);
// Configure a combo box on the pricing type column
// Register a combo box editor to be displayed in the filter row
- // cell
- // when a value is selected from the combo, the object is converted
- // to a string
- // using the converter (registered below)
+ // cell when a value is selected from the combo, the object is
+ // converted to a string using the converter (registered below)
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR,
- new ComboBoxCellEditor(Arrays.asList(new PricingTypeBean(
- "MN"), new PricingTypeBean("AT"))),
+ new ComboBoxCellEditor(Arrays.asList(new PricingTypeBean("MN"), new PricingTypeBean("AT"))),
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4);
@@ -286,26 +288,32 @@
// box
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
- PricingTypeBean.getDisplayConverter(), DisplayMode.NORMAL,
+ new PricingTypeBeanDisplayConverter(),
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
- PricingTypeBean.getDisplayConverter(), DisplayMode.NORMAL,
+ new PricingTypeBeanDisplayConverter(),
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
- PricingTypeBean.getDisplayConverter(), DisplayMode.NORMAL,
+ new PricingTypeBeanDisplayConverter(),
+ DisplayMode.NORMAL,
"PRICING_TYPE_PROP_NAME");
// Shade the row to be slightly darker than the blue background.
final Style rowStyle = new Style();
- rowStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
+ rowStyle.setAttributeValue(
+ CellStyleAttributes.BACKGROUND_COLOR,
GUIHelper.getColor(197, 212, 231));
configRegistry.registerConfigAttribute(
- CellConfigAttributes.CELL_STYLE, rowStyle,
- DisplayMode.NORMAL, GridRegion.FILTER_ROW);
+ CellConfigAttributes.CELL_STYLE,
+ rowStyle,
+ DisplayMode.NORMAL,
+ GridRegion.FILTER_ROW);
}
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/Applying_style_to_a_cell.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/Applying_style_to_a_cell.java
index 9982228..9d678bc 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/Applying_style_to_a_cell.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/Applying_style_to_a_cell.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
+ * Copyright (c) 2012, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,6 +15,7 @@
import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.fixtures.SelectionExampleGridLayer;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
@@ -24,7 +25,6 @@
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.style.Style;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -34,8 +34,7 @@
private static final String CELL_LABEL = "Cell_LABEL";
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner
- .run(600, 400, new Applying_style_to_a_cell());
+ StandaloneNatExampleRunner.run(600, 400, new Applying_style_to_a_cell());
}
@Override
@@ -59,8 +58,8 @@
// Label accumulator - adds labels to all cells with the given data
// value
- CellOverrideLabelAccumulator<RowDataFixture> cellLabelAccumulator = new CellOverrideLabelAccumulator<RowDataFixture>(
- gridLayer.getBodyDataProvider());
+ CellOverrideLabelAccumulator<RowDataFixture> cellLabelAccumulator =
+ new CellOverrideLabelAccumulator<RowDataFixture>(gridLayer.getBodyDataProvider());
cellLabelAccumulator.registerOverride("AAA", 2, CELL_LABEL);
// Register your cell style, against the label applied to the cell
@@ -71,8 +70,7 @@
// Register label accumulator
bodyDataLayer.setConfigLabelAccumulator(cellLabelAccumulator);
- gridLayer.getSelectionLayer().addConfiguration(
- new DefaultSelectionLayerConfiguration());
+ gridLayer.getSelectionLayer().addConfiguration(new DefaultSelectionLayerConfiguration());
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.setConfigRegistry(configRegistry);
@@ -83,21 +81,28 @@
private void addColumnHighlight(IConfigRegistry configRegistry) {
Style style = new Style();
- style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
+ style.setAttributeValue(
+ CellStyleAttributes.BACKGROUND_COLOR,
GUIHelper.COLOR_RED);
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, // attribute
- // to
- // apply
- style, // value of the attribute
- DisplayMode.NORMAL, // apply during normal rendering i.e not
- // during selection or edit
- CELL_LABEL); // apply the above for all cells with this label
+ configRegistry.registerConfigAttribute(
+ // attribute to apply
+ CellConfigAttributes.CELL_STYLE,
+ // value of the attribute
+ style,
+ // apply during normal rendering i.e not
+ // during selection or edit
+ DisplayMode.NORMAL,
+ // apply the above for all cells with this label
+ CELL_LABEL);
// Override the selection style on the highlighted cells.
// Note: This is achieved by specifying the display mode.
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE,
- style, DisplayMode.SELECT, CELL_LABEL);
+ configRegistry.registerConfigAttribute(
+ CellConfigAttributes.CELL_STYLE,
+ style,
+ DisplayMode.SELECT,
+ CELL_LABEL);
}
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/CellPainterDecorator_Example.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/CellPainterDecorator_Example.java
index 5c3ea79..d044338 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/CellPainterDecorator_Example.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/CellPainterDecorator_Example.java
@@ -21,8 +21,8 @@
import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/Rendereing_a_cell_as_a_button.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/Rendereing_a_cell_as_a_button.java
index c560760..2249b09 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/Rendereing_a_cell_as_a_button.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/Rendereing_a_cell_as_a_button.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
+ * Copyright (c) 2012, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,6 +17,7 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.fixtures.SelectionExampleGridLayer;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
@@ -30,7 +31,6 @@
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.style.Style;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
import org.eclipse.nebula.widgets.nattable.ui.action.IMouseAction;
import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
@@ -52,8 +52,7 @@
private SelectionExampleGridLayer gridLayer;
public static void main(String[] args) throws Exception {
- StandaloneNatExampleRunner.run(600, 400,
- new Rendereing_a_cell_as_a_button());
+ StandaloneNatExampleRunner.run(600, 400, new Rendereing_a_cell_as_a_button());
}
@Override
@@ -72,10 +71,9 @@
DataLayer bodyDataLayer = this.gridLayer.getBodyDataLayer();
// Step 1: Create a label accumulator - adds custom labels to all cells
- // which we
- // wish to render differently. In this case render as a button.
- ColumnOverrideLabelAccumulator cellLabelAccumulator = new ColumnOverrideLabelAccumulator(
- bodyDataLayer);
+ // which we wish to render differently. In this case render as a button.
+ ColumnOverrideLabelAccumulator cellLabelAccumulator =
+ new ColumnOverrideLabelAccumulator(bodyDataLayer);
cellLabelAccumulator.registerColumnOverrides(2, CUSTOM_CELL_LABEL);
// Step 2: Register label accumulator
@@ -84,8 +82,7 @@
// Step 3: Register your custom cell painter, cell style, against the
// label applied to the cell.
addButtonToColumn(configRegistry, natTable);
- natTable.addConfiguration(new ButtonClickConfiguration<RowDataFixture>(
- this.buttonPainter));
+ natTable.addConfiguration(new ButtonClickConfiguration<RowDataFixture>(this.buttonPainter));
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new DebugMenuConfiguration(natTable));
@@ -95,22 +92,22 @@
// Layout SWT widgets. Not relevant to example code.
parent.setLayout(new GridLayout(1, true));
- natTable.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
- true));
+ natTable.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
setupTextArea(parent);
return natTable;
}
- private void addButtonToColumn(IConfigRegistry configRegistry,
- Composite parent) {
- this.buttonPainter = new ButtonCellPainter(new CellPainterDecorator(
- new TextPainter(), CellEdgeEnum.RIGHT, new ImagePainter(
- GUIHelper.getImage("preferences"))));
+ private void addButtonToColumn(IConfigRegistry configRegistry, Composite parent) {
+ this.buttonPainter = new ButtonCellPainter(
+ new CellPainterDecorator(
+ new TextPainter(), CellEdgeEnum.RIGHT, new ImagePainter(GUIHelper.getImage("preferences"))));
configRegistry.registerConfigAttribute(
- CellConfigAttributes.CELL_PAINTER, this.buttonPainter,
- DisplayMode.NORMAL, CUSTOM_CELL_LABEL);
+ CellConfigAttributes.CELL_PAINTER,
+ this.buttonPainter,
+ DisplayMode.NORMAL,
+ CUSTOM_CELL_LABEL);
// Add your listener to the button
this.buttonPainter.addClickListener(new MyMouseAction());
@@ -118,13 +115,20 @@
// Set the color of the cell. This is picked up by the button painter to
// style the button
Style style = new Style();
- style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
+ style.setAttributeValue(
+ CellStyleAttributes.BACKGROUND_COLOR,
GUIHelper.COLOR_WHITE);
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE,
- style, DisplayMode.NORMAL, CUSTOM_CELL_LABEL);
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE,
- style, DisplayMode.SELECT, CUSTOM_CELL_LABEL);
+ configRegistry.registerConfigAttribute(
+ CellConfigAttributes.CELL_STYLE,
+ style,
+ DisplayMode.NORMAL,
+ CUSTOM_CELL_LABEL);
+ configRegistry.registerConfigAttribute(
+ CellConfigAttributes.CELL_STYLE,
+ style,
+ DisplayMode.SELECT,
+ CUSTOM_CELL_LABEL);
}
/**
@@ -134,15 +138,12 @@
@Override
public void run(NatTable natTable, MouseEvent event) {
- NatEventData eventData = NatEventData
- .createInstanceFromEvent(event);
- int rowIndex = natTable.getRowIndexByPosition(eventData
- .getRowPosition());
- int columnIndex = natTable.getColumnIndexByPosition(eventData
- .getColumnPosition());
+ NatEventData eventData = NatEventData.createInstanceFromEvent(event);
+ int rowIndex = natTable.getRowIndexByPosition(eventData.getRowPosition());
+ int columnIndex = natTable.getColumnIndexByPosition(eventData.getColumnPosition());
- ListDataProvider<RowDataFixture> dataProvider = Rendereing_a_cell_as_a_button.this.gridLayer
- .getBodyDataProvider();
+ ListDataProvider<RowDataFixture> dataProvider =
+ Rendereing_a_cell_as_a_button.this.gridLayer.getBodyDataProvider();
Object rowObject = dataProvider.getRowObject(rowIndex);
Object cellData = dataProvider.getDataValue(columnIndex, rowIndex);
@@ -167,13 +168,14 @@
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
// Match a mouse event on the body, when the left button is clicked
// and the custom cell label is present
- CellLabelMouseEventMatcher mouseEventMatcher = new CellLabelMouseEventMatcher(
- GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON,
- Rendereing_a_cell_as_a_button.CUSTOM_CELL_LABEL);
+ CellLabelMouseEventMatcher mouseEventMatcher =
+ new CellLabelMouseEventMatcher(
+ GridRegion.BODY,
+ MouseEventMatcher.LEFT_BUTTON,
+ Rendereing_a_cell_as_a_button.CUSTOM_CELL_LABEL);
// Inform the button painter of the click.
- uiBindingRegistry.registerMouseDownBinding(mouseEventMatcher,
- this.buttonCellPainter);
+ uiBindingRegistry.registerMouseDownBinding(mouseEventMatcher, this.buttonCellPainter);
}
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_103_Events/BlinkingGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_103_Events/BlinkingGridExample.java
index b04ce4d..acc62eb 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_103_Events/BlinkingGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_103_Events/BlinkingGridExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
+ * Copyright (c) 2012, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
package org.eclipse.nebula.widgets.nattable.examples.examples._103_Events;
import java.beans.PropertyChangeListener;
+import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -28,8 +29,11 @@
import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.BlinkingRowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
@@ -44,8 +48,6 @@
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.style.Style;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.BlinkingRowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -71,50 +73,57 @@
@Override
public Control createExampleControl(Composite parent) {
final String[] propertyNames = RowDataListFixture.getPropertyNames();
- final Map<String, String> propertyToLabelMap = RowDataListFixture
- .getPropertyToLabelMap();
+ final Map<String, String> propertyToLabelMap = RowDataListFixture.getPropertyToLabelMap();
ConfigRegistry configRegistry = new ConfigRegistry();
// Body
LinkedList<BlinkingRowDataFixture> rowData = new LinkedList<BlinkingRowDataFixture>();
- EventList<BlinkingRowDataFixture> eventList = GlazedLists
- .eventList(rowData);
- ObservableElementList<BlinkingRowDataFixture> observableElementList = new ObservableElementList<BlinkingRowDataFixture>(
- eventList,
- GlazedLists.beanConnector(BlinkingRowDataFixture.class));
- IColumnPropertyAccessor<BlinkingRowDataFixture> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<BlinkingRowDataFixture>(
- propertyNames);
- this.bodyDataProvider = new ListDataProvider<BlinkingRowDataFixture>(
- observableElementList, columnPropertyAccessor);
+ EventList<BlinkingRowDataFixture> eventList = GlazedLists.eventList(rowData);
+ ObservableElementList<BlinkingRowDataFixture> observableElementList =
+ new ObservableElementList<BlinkingRowDataFixture>(
+ eventList,
+ GlazedLists.beanConnector(BlinkingRowDataFixture.class));
+ IColumnPropertyAccessor<BlinkingRowDataFixture> columnPropertyAccessor =
+ new ReflectiveColumnPropertyAccessor<BlinkingRowDataFixture>(propertyNames);
+ this.bodyDataProvider =
+ new ListDataProvider<BlinkingRowDataFixture>(observableElementList, columnPropertyAccessor);
final DataLayer bodyLayer = new DataLayer(this.bodyDataProvider);
- GlazedListsEventLayer<BlinkingRowDataFixture> glazedListsEventLayer = new GlazedListsEventLayer<BlinkingRowDataFixture>(
- bodyLayer, observableElementList);
- BlinkLayer<BlinkingRowDataFixture> blinkingLayer = new BlinkLayer<BlinkingRowDataFixture>(
- glazedListsEventLayer, this.bodyDataProvider,
- BlinkingRowDataFixture.rowIdAccessor, columnPropertyAccessor,
- configRegistry);
+ GlazedListsEventLayer<BlinkingRowDataFixture> glazedListsEventLayer =
+ new GlazedListsEventLayer<BlinkingRowDataFixture>(bodyLayer, observableElementList);
+ BlinkLayer<BlinkingRowDataFixture> blinkingLayer =
+ new BlinkLayer<BlinkingRowDataFixture>(
+ glazedListsEventLayer,
+ this.bodyDataProvider,
+ new IRowIdAccessor<BlinkingRowDataFixture>() {
+ @Override
+ public Serializable getRowId(BlinkingRowDataFixture rowObject) {
+ return rowObject.getSecurity_description();
+ }
+ },
+ columnPropertyAccessor,
+ configRegistry);
registerBlinkingConfigCells(configRegistry);
insertRowData(glazedListsEventLayer, this.bodyDataProvider);
// Column header
- final DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
+ final DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
// Row header
- final DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- this.bodyDataProvider);
+ final DefaultRowHeaderDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(this.bodyDataProvider);
// Corner
- final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- defaultColumnHeaderDataProvider, rowHeaderDataProvider);
+ final DefaultCornerDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(defaultColumnHeaderDataProvider, rowHeaderDataProvider);
// Grid
- GridLayer gridLayer = new DefaultGridLayer(blinkingLayer,
- new DefaultColumnHeaderDataLayer(
- defaultColumnHeaderDataProvider),
+ GridLayer gridLayer = new DefaultGridLayer(
+ blinkingLayer,
+ new DefaultColumnHeaderDataLayer(defaultColumnHeaderDataProvider),
new DefaultRowHeaderDataLayer(rowHeaderDataProvider),
new DataLayer(cornerDataProvider));
@@ -139,18 +148,24 @@
BlinkingGridExample.this.scheduledThreadPool = Executors.newScheduledThreadPool(1);
// Fire updates to indexes 1,3,5
- BlinkingGridExample.this.scheduledThreadPool.scheduleAtFixedRate(new DataPumper(
- BlinkingGridExample.this.bodyDataProvider, 1, 3, 5), 500L, 5000L,
+ BlinkingGridExample.this.scheduledThreadPool.scheduleAtFixedRate(
+ new DataPumper(BlinkingGridExample.this.bodyDataProvider, 1, 3, 5),
+ 500L,
+ 5000L,
TimeUnit.MILLISECONDS);
// while they are still blinking update index 1
- BlinkingGridExample.this.scheduledThreadPool.scheduleAtFixedRate(new DataPumper(
- BlinkingGridExample.this.bodyDataProvider, 1), 750L, 5000L,
+ BlinkingGridExample.this.scheduledThreadPool.scheduleAtFixedRate(
+ new DataPumper(BlinkingGridExample.this.bodyDataProvider, 1),
+ 750L,
+ 5000L,
TimeUnit.MILLISECONDS);
// While the above are still blinking update indexes 2,8
- BlinkingGridExample.this.scheduledThreadPool.scheduleAtFixedRate(new DataPumper(
- BlinkingGridExample.this.bodyDataProvider, 2, 8), 1000L, 5000L,
+ BlinkingGridExample.this.scheduledThreadPool.scheduleAtFixedRate(
+ new DataPumper(BlinkingGridExample.this.bodyDataProvider, 2, 8),
+ 1000L,
+ 5000L,
TimeUnit.MILLISECONDS);
}
});
@@ -163,21 +178,30 @@
private void registerBlinkingConfigCells(ConfigRegistry configRegistry) {
configRegistry.registerConfigAttribute(
- BlinkConfigAttributes.BLINK_RESOLVER, getBlinkResolver(),
+ BlinkConfigAttributes.BLINK_RESOLVER,
+ getBlinkResolver(),
DisplayMode.NORMAL);
// Bg color styles to be used for blinking cells
Style cellStyle = new Style();
- cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
+ cellStyle.setAttributeValue(
+ CellStyleAttributes.BACKGROUND_COLOR,
GUIHelper.COLOR_GREEN);
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE,
- cellStyle, DisplayMode.NORMAL, BLINK_UP_CONFIG_LABEL);
+ configRegistry.registerConfigAttribute(
+ CellConfigAttributes.CELL_STYLE,
+ cellStyle,
+ DisplayMode.NORMAL,
+ BLINK_UP_CONFIG_LABEL);
cellStyle = new Style();
- cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
+ cellStyle.setAttributeValue(
+ CellStyleAttributes.BACKGROUND_COLOR,
GUIHelper.COLOR_RED);
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE,
- cellStyle, DisplayMode.NORMAL, BLINK_DOWN_CONFIG_LABEL);
+ configRegistry.registerConfigAttribute(
+ CellConfigAttributes.CELL_STYLE,
+ cellStyle,
+ DisplayMode.NORMAL,
+ BLINK_DOWN_CONFIG_LABEL);
}
/**
@@ -193,17 +217,16 @@
public String[] resolve(Object oldValue, Object newValue) {
double old = ((Double) oldValue).doubleValue();
double latest = ((Double) newValue).doubleValue();
- this.configLabels[0] = (latest > old ? BLINK_UP_CONFIG_LABEL
- : BLINK_DOWN_CONFIG_LABEL);
+ this.configLabels[0] = (latest > old ? BLINK_UP_CONFIG_LABEL : BLINK_DOWN_CONFIG_LABEL);
return this.configLabels;
};
};
}
- private void insertRowData(PropertyChangeListener changeListener,
+ private void insertRowData(
+ PropertyChangeListener changeListener,
ListDataProvider<BlinkingRowDataFixture> dataProvider) {
- List<BlinkingRowDataFixture> listFixture = BlinkingRowDataFixture
- .getList(changeListener);
+ List<BlinkingRowDataFixture> listFixture = BlinkingRowDataFixture.getList(changeListener);
for (BlinkingRowDataFixture rowObject : listFixture) {
dataProvider.getList().add(rowObject);
}
@@ -218,8 +241,7 @@
ListDataProvider<BlinkingRowDataFixture> dataProvider;
private final int[] rowIndexes;
- DataPumper(ListDataProvider<BlinkingRowDataFixture> dataProvider,
- final int... rowIndexes) {
+ DataPumper(ListDataProvider<BlinkingRowDataFixture> dataProvider, final int... rowIndexes) {
this.dataProvider = dataProvider;
this.rowIndexes = rowIndexes;
}
@@ -231,8 +253,8 @@
public void run() {
for (int i = 0; i < DataPumper.this.rowIndexes.length; i++) {
double nextPrice = BlinkingGridExample.this.random.nextInt(1000);
- BlinkingRowDataFixture rowObject = DataPumper.this.dataProvider
- .getRowObject(DataPumper.this.rowIndexes[i]);
+ BlinkingRowDataFixture rowObject =
+ DataPumper.this.dataProvider.getRowObject(DataPumper.this.rowIndexes[i]);
rowObject.setAsk_price(nextPrice);
}
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_103_Events/Real_time_data_updates.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_103_Events/Real_time_data_updates.java
index 1323e72..455399c 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_103_Events/Real_time_data_updates.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_103_Events/Real_time_data_updates.java
@@ -22,6 +22,8 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.fixtures.GlazedListsGridLayer;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
@@ -32,8 +34,6 @@
import org.eclipse.nebula.widgets.nattable.selection.config.RowOnlySelectionBindings;
import org.eclipse.nebula.widgets.nattable.selection.config.RowOnlySelectionConfiguration;
import org.eclipse.nebula.widgets.nattable.sort.config.SingleClickSortConfiguration;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -95,7 +95,8 @@
this.nattable.addConfiguration(new SingleClickSortConfiguration());
SelectionLayer selectionLayer = glazedListsGridLayer
- .getBodyLayerStack().getSelectionLayer();
+ .getBodyLayerStack()
+ .getSelectionLayer();
ListDataProvider<RowDataFixture> bodyDataProvider = glazedListsGridLayer
.getBodyDataProvider();
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_104_Styling/_001_Custom_styling_of_specific_cells.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_104_Styling/_001_Custom_styling_of_specific_cells.java
index b95df6de..d82e996 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_104_Styling/_001_Custom_styling_of_specific_cells.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_104_Styling/_001_Custom_styling_of_specific_cells.java
@@ -22,8 +22,8 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.SimplePerson;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.fixtures.Person;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DummyColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer;
@@ -67,16 +67,16 @@
@Override
public Control createExampleControl(Composite parent) {
- List<Person> myList = new ArrayList<Person>();
+ List<SimplePerson> myList = new ArrayList<SimplePerson>();
for (int i = 1; i <= 100; i++) {
- myList.add(new Person(i, "Joe" + i, new Date()));
+ myList.add(new SimplePerson(i, "Joe" + i, new Date()));
}
String[] propertyNames = { "id", "name", "birthDate" };
- IColumnPropertyAccessor<Person> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<Person>(
+ IColumnPropertyAccessor<SimplePerson> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<SimplePerson>(
propertyNames);
- ListDataProvider<Person> listDataProvider = new ListDataProvider<Person>(
+ ListDataProvider<SimplePerson> listDataProvider = new ListDataProvider<SimplePerson>(
myList, columnPropertyAccessor);
DefaultGridLayer gridLayer = new DefaultGridLayer(listDataProvider,
new DummyColumnHeaderDataProvider(listDataProvider));
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/CalculatingGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/CalculatingGridExample.java
index fcfb1a8..48b3cda 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/CalculatingGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/CalculatingGridExample.java
@@ -28,9 +28,9 @@
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.PercentageDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/CrossValidationGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/CrossValidationGridExample.java
index 1843d6f..efb54c6 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/CrossValidationGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/CrossValidationGridExample.java
@@ -31,10 +31,10 @@
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDateDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator;
import org.eclipse.nebula.widgets.nattable.data.validate.ValidationFailedException;
+import org.eclipse.nebula.widgets.nattable.dataset.EventData;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.config.DialogErrorHandling;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.EventData;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/EditErrorHandlingExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/EditErrorHandlingExample.java
index f99d71a..3720567 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/EditErrorHandlingExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/EditErrorHandlingExample.java
@@ -25,10 +25,10 @@
import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator;
import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
import org.eclipse.nebula.widgets.nattable.data.validate.ValidationFailedException;
+import org.eclipse.nebula.widgets.nattable.dataset.NumberValues;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.config.DialogErrorHandling;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.NumberValues;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/EditableGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/EditableGridExample.java
index f407145..91d6bd4 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/EditableGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/EditableGridExample.java
@@ -32,6 +32,8 @@
import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator;
import org.eclipse.nebula.widgets.nattable.data.validate.DefaultNumericDataValidator;
import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.PricingTypeBean;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.action.ToggleCheckBoxColumnAction;
import org.eclipse.nebula.widgets.nattable.edit.editor.CheckBoxCellEditor;
@@ -39,6 +41,7 @@
import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
+import org.eclipse.nebula.widgets.nattable.examples.fixtures.PricingTypeBeanDisplayConverter;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer;
@@ -56,8 +59,6 @@
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum;
import org.eclipse.nebula.widgets.nattable.style.Style;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.PricingTypeBean;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
import org.eclipse.nebula.widgets.nattable.ui.matcher.CellPainterMouseEventMatcher;
import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
@@ -307,7 +308,7 @@
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
- PricingTypeBean.getDisplayConverter(), DisplayMode.NORMAL,
+ new PricingTypeBeanDisplayConverter(), DisplayMode.NORMAL,
FORMAT_PRICING_TYPE_CONFIG_LABEL);
}
@@ -518,7 +519,8 @@
.getColumnIndexOfProperty(RowDataListFixture.BID_PRICE_PROP_NAME);
double bidPrice = ((Double) dataProvider.getDataValue(
indexOfBidPrice, rowIndex)).doubleValue();
- double askPrice = Double.valueOf(newValue.toString())
+ double askPrice = Double
+ .valueOf(newValue.toString())
.doubleValue();
return askPrice > bidPrice;
} catch (Exception ex) {
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/EditorExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/EditorExample.java
index 95c7630..9ce3e30 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/EditorExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_110_Editing/EditorExample.java
@@ -30,6 +30,9 @@
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person.Gender;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.editor.CheckBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
@@ -39,9 +42,6 @@
import org.eclipse.nebula.widgets.nattable.edit.gui.FileDialogCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.ExtendedPersonWithAddress;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.Person.Gender;
-import org.eclipse.nebula.widgets.nattable.examples.data.person.PersonService;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_120_Selection/Selection_events.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_120_Selection/Selection_events.java
index 9039fb2..eeb1ecf 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_120_Selection/Selection_events.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_120_Selection/Selection_events.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
+ * Copyright (c) 2012, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,6 +15,7 @@
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.fixtures.SelectionExampleGridLayer;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
@@ -28,7 +29,6 @@
import org.eclipse.nebula.widgets.nattable.selection.event.CellSelectionEvent;
import org.eclipse.nebula.widgets.nattable.selection.event.ColumnSelectionEvent;
import org.eclipse.nebula.widgets.nattable.selection.event.RowSelectionEvent;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
import org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration;
import org.eclipse.nebula.widgets.nattable.util.ObjectUtils;
import org.eclipse.swt.layout.GridData;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_130_Sorting/SortableGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_130_Sorting/SortableGridExample.java
index 1ee42fb..8ba8424 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_130_Sorting/SortableGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_130_Sorting/SortableGridExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,6 +19,8 @@
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.config.IConfiguration;
import org.eclipse.nebula.widgets.nattable.config.NullComparator;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.PersistentNatExampleWrapper;
import org.eclipse.nebula.widgets.nattable.examples.fixtures.GlazedListsGridLayer;
@@ -31,8 +33,6 @@
import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer;
import org.eclipse.nebula.widgets.nattable.sort.config.SingleClickSortConfiguration;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration;
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder;
import org.eclipse.swt.widgets.Composite;
@@ -84,14 +84,16 @@
*/
@Override
public Control createExampleControl(Composite parent) {
- EventList<RowDataFixture> eventList = GlazedLists
- .eventList(RowDataListFixture.getList());
+ EventList<RowDataFixture> eventList = GlazedLists.eventList(RowDataListFixture.getList());
this.rowObjectsGlazedList = GlazedLists.threadSafeList(eventList);
ConfigRegistry configRegistry = new ConfigRegistry();
- GlazedListsGridLayer<RowDataFixture> glazedListsGridLayer = new GlazedListsGridLayer<RowDataFixture>(
- this.rowObjectsGlazedList, RowDataListFixture.getPropertyNames(),
- RowDataListFixture.getPropertyToLabelMap(), configRegistry);
+ GlazedListsGridLayer<RowDataFixture> glazedListsGridLayer =
+ new GlazedListsGridLayer<RowDataFixture>(
+ this.rowObjectsGlazedList,
+ RowDataListFixture.getPropertyNames(),
+ RowDataListFixture.getPropertyToLabelMap(),
+ configRegistry);
this.nattable = new NatTable(parent, glazedListsGridLayer, false);
@@ -99,11 +101,12 @@
this.nattable.addConfiguration(new DefaultNatTableStyleConfiguration());
// Change the default sort key bindings. Note that 'auto configure' was
- // turned off
- // for the SortHeaderLayer (setup in the GlazedListsGridLayer)
+ // turned off for the SortHeaderLayer (setup in the
+ // GlazedListsGridLayer)
this.nattable.addConfiguration(new SingleClickSortConfiguration());
- this.nattable.addConfiguration(getCustomComparatorConfiguration(glazedListsGridLayer
- .getColumnHeaderLayerStack().getDataLayer()));
+ this.nattable.addConfiguration(
+ getCustomComparatorConfiguration(
+ glazedListsGridLayer.getColumnHeaderLayerStack().getDataLayer()));
this.nattable.addConfiguration(new DefaultSelectionStyleConfiguration());
this.nattable.addConfiguration(new HeaderMenuConfiguration(this.nattable) {
@@ -117,12 +120,10 @@
this.nattable.configure();
// add the DisplayPersistenceDialogCommandHandler with the created
- // NatTable instance after configure()
- // so all configuration and states are correctly applied before storing
- // the default state
- glazedListsGridLayer
- .registerCommandHandler(new DisplayPersistenceDialogCommandHandler(
- this.nattable));
+ // NatTable instance after configure() so all configuration and states
+ // are correctly applied before storing the default state
+ glazedListsGridLayer.registerCommandHandler(
+ new DisplayPersistenceDialogCommandHandler(this.nattable));
return this.nattable;
}
@@ -131,44 +132,39 @@
* columnHeaderDataLayer - since, the SortHeaderLayer will resolve cell
* labels with respect to its underlying layer i.e columnHeaderDataLayer
*/
- private IConfiguration getCustomComparatorConfiguration(
- final AbstractLayer columnHeaderDataLayer) {
+ private IConfiguration getCustomComparatorConfiguration(final AbstractLayer columnHeaderDataLayer) {
return new AbstractRegistryConfiguration() {
@Override
public void configureRegistry(IConfigRegistry configRegistry) {
// Add label accumulator
- ColumnOverrideLabelAccumulator labelAccumulator = new ColumnOverrideLabelAccumulator(
- columnHeaderDataLayer);
- columnHeaderDataLayer
- .setConfigLabelAccumulator(labelAccumulator);
+ ColumnOverrideLabelAccumulator labelAccumulator =
+ new ColumnOverrideLabelAccumulator(columnHeaderDataLayer);
+ columnHeaderDataLayer.setConfigLabelAccumulator(labelAccumulator);
// Register labels
- labelAccumulator
- .registerColumnOverrides(
- RowDataListFixture
- .getColumnIndexOfProperty(RowDataListFixture.RATING_PROP_NAME),
- CUSTOM_COMPARATOR_LABEL);
+ labelAccumulator.registerColumnOverrides(
+ RowDataListFixture.getColumnIndexOfProperty(RowDataListFixture.RATING_PROP_NAME),
+ CUSTOM_COMPARATOR_LABEL);
- labelAccumulator
- .registerColumnOverrides(
- RowDataListFixture
- .getColumnIndexOfProperty(RowDataListFixture.ASK_PRICE_PROP_NAME),
- NO_SORT_LABEL);
+ labelAccumulator.registerColumnOverrides(
+ RowDataListFixture.getColumnIndexOfProperty(RowDataListFixture.ASK_PRICE_PROP_NAME),
+ NO_SORT_LABEL);
// Register custom comparator
configRegistry.registerConfigAttribute(
SortConfigAttributes.SORT_COMPARATOR,
- getCustomComparator(), DisplayMode.NORMAL,
+ getCustomComparator(),
+ DisplayMode.NORMAL,
CUSTOM_COMPARATOR_LABEL);
// Register null comparator to disable sort
- configRegistry
- .registerConfigAttribute(
- SortConfigAttributes.SORT_COMPARATOR,
- new NullComparator(), DisplayMode.NORMAL,
- NO_SORT_LABEL);
+ configRegistry.registerConfigAttribute(
+ SortConfigAttributes.SORT_COMPARATOR,
+ new NullComparator(),
+ DisplayMode.NORMAL,
+ NO_SORT_LABEL);
}
};
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_131_Filtering/FilterRowGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_131_Filtering/FilterRowGridExample.java
index 1eef5ac..cebc5a7 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_131_Filtering/FilterRowGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_131_Filtering/FilterRowGridExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,11 +24,13 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.PricingTypeBean;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.PersistentNatExampleWrapper;
import org.eclipse.nebula.widgets.nattable.examples.fixtures.FilterRowExampleGridLayer;
+import org.eclipse.nebula.widgets.nattable.examples.fixtures.PricingTypeBeanDisplayConverter;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.filterrow.FilterIconPainter;
import org.eclipse.nebula.widgets.nattable.filterrow.FilterRowDataLayer;
@@ -40,7 +42,6 @@
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.style.Style;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.PricingTypeBean;
import org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration;
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
import org.eclipse.swt.widgets.Composite;
@@ -49,8 +50,7 @@
public class FilterRowGridExample extends AbstractNatExample {
public static void main(String[] args) {
- StandaloneNatExampleRunner.run(new PersistentNatExampleWrapper(
- new FilterRowGridExample()));
+ StandaloneNatExampleRunner.run(new PersistentNatExampleWrapper(new FilterRowGridExample()));
}
@Override
@@ -73,8 +73,10 @@
CellStyleAttributes.BACKGROUND_COLOR,
GUIHelper.getColor(197, 212, 231));
configRegistry.registerConfigAttribute(
- CellConfigAttributes.CELL_STYLE, rowStyle,
- DisplayMode.NORMAL, GridRegion.FILTER_ROW);
+ CellConfigAttributes.CELL_STYLE,
+ rowStyle,
+ DisplayMode.NORMAL,
+ GridRegion.FILTER_ROW);
}
});
@@ -84,8 +86,7 @@
return natTable;
}
- public static class FilterRowCustomConfiguration extends
- AbstractRegistryConfiguration {
+ public static class FilterRowCustomConfiguration extends AbstractRegistryConfiguration {
final DefaultDoubleDisplayConverter doubleDisplayConverter = new DefaultDoubleDisplayConverter();
@@ -94,51 +95,53 @@
// override the default filter row configuration for painter
configRegistry.registerConfigAttribute(
CELL_PAINTER,
- new FilterRowPainter(new FilterIconPainter(GUIHelper
- .getImage("filter"))), NORMAL, FILTER_ROW);
+ new FilterRowPainter(
+ new FilterIconPainter(GUIHelper.getImage("filter"))),
+ NORMAL, FILTER_ROW);
// Configure custom comparator on the rating column
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_COMPARATOR,
- getIngnorecaseComparator(), DisplayMode.NORMAL,
+ getIngnorecaseComparator(),
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 2);
// If threshold comparison is used we have to convert the string
- // entered by the
- // user to the correct underlying type (double), so that it can be
- // compared
+ // entered by the user to the correct underlying type (double), so
+ // that it can be compared
// Configure Bid column
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
- this.doubleDisplayConverter, DisplayMode.NORMAL,
+ this.doubleDisplayConverter,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 5);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
- TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL,
+ TextMatchingMode.REGULAR_EXPRESSION,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 5);
// Configure Ask column
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
- this.doubleDisplayConverter, DisplayMode.NORMAL,
+ this.doubleDisplayConverter,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 6);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
- TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL,
+ TextMatchingMode.REGULAR_EXPRESSION,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 6);
// Configure a combo box on the pricing type column
// Register a combo box editor to be displayed in the filter row
- // cell
- // when a value is selected from the combo, the object is converted
- // to a string
- // using the converter (registered below)
+ // cell when a value is selected from the combo, the object is
+ // converted to a string using the converter (registered below)
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR,
- new ComboBoxCellEditor(Arrays.asList(new PricingTypeBean(
- "MN"), new PricingTypeBean("AT"))),
+ new ComboBoxCellEditor(Arrays.asList(new PricingTypeBean("MN"), new PricingTypeBean("AT"))),
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4);
@@ -148,17 +151,20 @@
// box
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
- PricingTypeBean.getDisplayConverter(), DisplayMode.NORMAL,
+ new PricingTypeBeanDisplayConverter(),
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
- PricingTypeBean.getDisplayConverter(), DisplayMode.NORMAL,
+ new PricingTypeBeanDisplayConverter(),
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
- PricingTypeBean.getDisplayConverter(), DisplayMode.NORMAL,
+ new PricingTypeBeanDisplayConverter(),
+ DisplayMode.NORMAL,
"PRICING_TYPE_PROP_NAME");
}
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_131_Filtering/StaticFilterGridExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_131_Filtering/StaticFilterGridExample.java
index 78d9f40..f2a10e5 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_131_Filtering/StaticFilterGridExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_131_Filtering/StaticFilterGridExample.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
+ * Copyright (c) 2012, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,11 +21,13 @@
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.PricingTypeBean;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.PersistentNatExampleWrapper;
import org.eclipse.nebula.widgets.nattable.examples.examples._110_Editing.EditableGridExample;
+import org.eclipse.nebula.widgets.nattable.examples.fixtures.PricingTypeBeanDisplayConverter;
import org.eclipse.nebula.widgets.nattable.examples.fixtures.StaticFilterExampleGridLayer;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.filterrow.FilterRowDataLayer;
@@ -34,7 +36,6 @@
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.PricingTypeBean;
import org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -42,8 +43,7 @@
public class StaticFilterGridExample extends AbstractNatExample {
public static void main(String[] args) {
- StandaloneNatExampleRunner.run(new PersistentNatExampleWrapper(
- new StaticFilterGridExample()));
+ StandaloneNatExampleRunner.run(new PersistentNatExampleWrapper(new StaticFilterGridExample()));
}
@Override
@@ -59,8 +59,7 @@
@Override
public Control createExampleControl(Composite parent) {
IConfigRegistry configRegistry = new ConfigRegistry();
- StaticFilterExampleGridLayer underlyingLayer = new StaticFilterExampleGridLayer(
- configRegistry);
+ StaticFilterExampleGridLayer underlyingLayer = new StaticFilterExampleGridLayer(configRegistry);
DataLayer bodyDataLayer = underlyingLayer.getBodyDataLayer();
IDataProvider dataProvider = underlyingLayer.getBodyDataProvider();
@@ -68,8 +67,7 @@
// NOTE: Register the accumulator on the body data layer.
// This ensures that the labels are bound to the column index and are
// unaffected by column order.
- final ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(
- bodyDataLayer);
+ final ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(bodyDataLayer);
bodyDataLayer.setConfigLabelAccumulator(columnLabelAccumulator);
NatTable natTable = new NatTable(parent, underlyingLayer, false);
@@ -78,8 +76,7 @@
// natTable.addConfiguration(new DebugMenuConfiguration(natTable));
natTable.addConfiguration(new FilterRowCustomConfiguration());
- natTable.addConfiguration(EditableGridExample
- .editableGridConfiguration(columnLabelAccumulator, dataProvider));
+ natTable.addConfiguration(EditableGridExample.editableGridConfiguration(columnLabelAccumulator, dataProvider));
natTable.setConfigRegistry(configRegistry);
natTable.configure();
@@ -87,8 +84,7 @@
return natTable;
}
- static class FilterRowCustomConfiguration extends
- AbstractRegistryConfiguration {
+ static class FilterRowCustomConfiguration extends AbstractRegistryConfiguration {
final DefaultDoubleDisplayConverter doubleDisplayConverter = new DefaultDoubleDisplayConverter();
@@ -97,45 +93,46 @@
// Configure custom comparator on the rating column
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_COMPARATOR,
- getIngnorecaseComparator(), DisplayMode.NORMAL,
+ getIngnorecaseComparator(),
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 2);
// If threshold comparison is used we have to convert the string
- // entered by the
- // user to the correct underlying type (double), so that it can be
- // compared
+ // entered by the user to the correct underlying type (double), so
+ // that it can be compared
// Configure Bid column
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
- this.doubleDisplayConverter, DisplayMode.NORMAL,
+ this.doubleDisplayConverter,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 5);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
- TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL,
+ TextMatchingMode.REGULAR_EXPRESSION,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 5);
// Configure Ask column
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
- this.doubleDisplayConverter, DisplayMode.NORMAL,
+ this.doubleDisplayConverter,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 6);
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.TEXT_MATCHING_MODE,
- TextMatchingMode.REGULAR_EXPRESSION, DisplayMode.NORMAL,
+ TextMatchingMode.REGULAR_EXPRESSION,
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 6);
// Configure a combo box on the pricing type column
// Register a combo box editor to be displayed in the filter row
- // cell
- // when a value is selected from the combo, the object is converted
- // to a string
- // using the converter (registered below)
+ // cell when a value is selected from the combo, the object is
+ // converted to a string using the converter (registered below)
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITOR,
- new ComboBoxCellEditor(Arrays.asList(new PricingTypeBean(
- "MN"), new PricingTypeBean("AT"))),
+ new ComboBoxCellEditor(Arrays.asList(new PricingTypeBean("MN"), new PricingTypeBean("AT"))),
DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4);
@@ -145,17 +142,20 @@
// box
configRegistry.registerConfigAttribute(
FilterRowConfigAttributes.FILTER_DISPLAY_CONVERTER,
- PricingTypeBean.getDisplayConverter(), DisplayMode.NORMAL,
+ new PricingTypeBeanDisplayConverter(),
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
- PricingTypeBean.getDisplayConverter(), DisplayMode.NORMAL,
+ new PricingTypeBeanDisplayConverter(),
+ DisplayMode.NORMAL,
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 4);
configRegistry.registerConfigAttribute(
CellConfigAttributes.DISPLAY_CONVERTER,
- PricingTypeBean.getDisplayConverter(), DisplayMode.NORMAL,
+ new PricingTypeBeanDisplayConverter(),
+ DisplayMode.NORMAL,
"PRICING_TYPE_PROP_NAME");
}
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_000_Column_groups.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_000_Column_groups.java
index 9e36ce3..908517b 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_000_Column_groups.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_000_Column_groups.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,6 +18,8 @@
import org.eclipse.nebula.widgets.nattable.config.AbstractUiBindingConfiguration;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.export.ExportConfigAttributes;
@@ -38,8 +40,6 @@
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.layer.ILayer;
import org.eclipse.nebula.widgets.nattable.layer.stack.ColumnGroupBodyLayerStack;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
import org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration;
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_001_Two_level_column_groups.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_001_Two_level_column_groups.java
index 8e7dc87..3b5d126 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_001_Two_level_column_groups.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_001_Two_level_column_groups.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
+ * Copyright (c) 2012, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,6 +15,8 @@
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.columnChooser.command.DisplayColumnChooserCommandHandler;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
@@ -33,8 +35,6 @@
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.layer.ILayer;
import org.eclipse.nebula.widgets.nattable.layer.stack.ColumnGroupBodyLayerStack;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration;
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder;
import org.eclipse.swt.widgets.Composite;
@@ -43,8 +43,7 @@
public class _001_Two_level_column_groups extends AbstractNatExample {
public static void main(String[] args) {
- StandaloneNatExampleRunner.run(800, 400,
- new _001_Two_level_column_groups());
+ StandaloneNatExampleRunner.run(800, 400, new _001_Two_level_column_groups());
}
private final ColumnGroupModel columnGroupModel = new ColumnGroupModel();
@@ -57,78 +56,83 @@
// Body
String[] propertyNames = RowDataListFixture.getPropertyNames();
- Map<String, String> propertyToLabelMap = RowDataListFixture
- .getPropertyToLabelMap();
- DefaultBodyDataProvider<RowDataFixture> bodyDataProvider = new DefaultBodyDataProvider<RowDataFixture>(
- RowDataListFixture.getList(2000), propertyNames);
- ColumnGroupBodyLayerStack bodyLayer = new ColumnGroupBodyLayerStack(
- new DataLayer(bodyDataProvider), this.sndColumnGroupModel,
- this.columnGroupModel);
+ Map<String, String> propertyToLabelMap = RowDataListFixture.getPropertyToLabelMap();
+ DefaultBodyDataProvider<RowDataFixture> bodyDataProvider =
+ new DefaultBodyDataProvider<RowDataFixture>(RowDataListFixture.getList(2000), propertyNames);
+ ColumnGroupBodyLayerStack bodyLayer =
+ new ColumnGroupBodyLayerStack(
+ new DataLayer(bodyDataProvider),
+ this.sndColumnGroupModel,
+ this.columnGroupModel);
// Column header
- DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DefaultColumnHeaderDataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- defaultColumnHeaderDataProvider);
- this.columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer,
- bodyLayer, bodyLayer.getSelectionLayer());
- ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(
- this.columnHeaderLayer, bodyLayer.getSelectionLayer(),
- this.columnGroupModel);
+ DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DefaultColumnHeaderDataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(defaultColumnHeaderDataProvider);
+ this.columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
+ ColumnGroupHeaderLayer columnGroupHeaderLayer =
+ new ColumnGroupHeaderLayer(
+ this.columnHeaderLayer, bodyLayer.getSelectionLayer(),
+ this.columnGroupModel);
columnGroupHeaderLayer.addColumnsIndexesToGroup("Group 1", 1, 2);
- columnGroupHeaderLayer.addColumnsIndexesToGroup("UnBreakable group 2",
- 4, 5, 6, 7);
- columnGroupHeaderLayer.addColumnsIndexesToGroup("UnBreakable group 3",
- 8, 9, 10);
+ columnGroupHeaderLayer.addColumnsIndexesToGroup("UnBreakable group 2", 4, 5, 6, 7);
+ columnGroupHeaderLayer.addColumnsIndexesToGroup("UnBreakable group 3", 8, 9, 10);
columnGroupHeaderLayer.addColumnsIndexesToGroup("Group 4", 11, 12, 13);
- columnGroupHeaderLayer.addColumnsIndexesToGroup("Group 5", 14, 15, 16,
- 17);
+ columnGroupHeaderLayer.addColumnsIndexesToGroup("Group 5", 14, 15, 16, 17);
columnGroupHeaderLayer.setGroupUnbreakable(4);
columnGroupHeaderLayer.setGroupUnbreakable(8);
columnGroupHeaderLayer.setGroupAsCollapsed(11);
- ColumnGroupGroupHeaderLayer sndGroup = new ColumnGroupGroupHeaderLayer(
- columnGroupHeaderLayer, bodyLayer.getSelectionLayer(),
- this.sndColumnGroupModel);
+ ColumnGroupGroupHeaderLayer sndGroup =
+ new ColumnGroupGroupHeaderLayer(
+ columnGroupHeaderLayer,
+ bodyLayer.getSelectionLayer(),
+ this.sndColumnGroupModel);
sndGroup.addColumnsIndexesToGroup("GroupGroup 1", 1, 2, 3, 4, 5, 6, 7);
- sndGroup.addColumnsIndexesToGroup("GroupGroup 2", 11, 12, 13, 14, 15,
- 16, 17);
+ sndGroup.addColumnsIndexesToGroup("GroupGroup 2", 11, 12, 13, 14, 15, 16, 17);
sndGroup.setStaticColumnIndexesByGroup("GroupGroup 1", 1, 2);
// Row header
- final DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- bodyLayer, bodyLayer.getSelectionLayer());
+ final DefaultRowHeaderDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DefaultRowHeaderDataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ ILayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
// Corner
- final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- defaultColumnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer,
- sndGroup);
+ final DefaultCornerDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(defaultColumnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, sndGroup);
// Grid
- GridLayer gridLayer = new GridLayer(bodyLayer, sndGroup,
- rowHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(bodyLayer, sndGroup, rowHeaderLayer, cornerLayer);
NatTable natTable = new NatTable(parent, gridLayer, false);
// Register create column group command handler
// Register column chooser
- DisplayColumnChooserCommandHandler columnChooserCommandHandler = new DisplayColumnChooserCommandHandler(
- bodyLayer.getSelectionLayer(),
- bodyLayer.getColumnHideShowLayer(), this.columnHeaderLayer,
- columnHeaderDataLayer, columnGroupHeaderLayer, this.columnGroupModel);
+ DisplayColumnChooserCommandHandler columnChooserCommandHandler =
+ new DisplayColumnChooserCommandHandler(
+ bodyLayer.getSelectionLayer(),
+ bodyLayer.getColumnHideShowLayer(),
+ this.columnHeaderLayer,
+ columnHeaderDataLayer,
+ columnGroupHeaderLayer,
+ this.columnGroupModel);
bodyLayer.registerCommandHandler(columnChooserCommandHandler);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_010_Column_categories.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_010_Column_categories.java
index b9bdaa8..6906b84 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_010_Column_categories.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_010_Column_categories.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
+ * Copyright (c) 2012, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,15 +13,15 @@
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.columnCategories.ChooseColumnsFromCategoriesCommandHandler;
import org.eclipse.nebula.widgets.nattable.columnCategories.ColumnCategoriesModel;
+import org.eclipse.nebula.widgets.nattable.columnCategories.Node;
import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.fixtures.GlazedListsGridLayer;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack;
-import org.eclipse.nebula.widgets.nattable.test.fixture.ColumnCategoriesModelFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration;
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder;
import org.eclipse.swt.widgets.Composite;
@@ -60,7 +60,9 @@
}
this.gridLayer = new GlazedListsGridLayer<RowDataFixture>(
GlazedLists.eventList(RowDataListFixture.getList()),
- propertyNames, RowDataListFixture.getPropertyToLabelMap(), configRegistry);
+ propertyNames,
+ RowDataListFixture.getPropertyToLabelMap(),
+ configRegistry);
NatTable natTable = new NatTable(parent, this.gridLayer, false);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
@@ -89,4 +91,34 @@
this.gridLayer.getColumnHeaderLayerStack().getDataLayer(),
model));
}
+
+ class ColumnCategoriesModelFixture extends ColumnCategoriesModel {
+
+ private static final long serialVersionUID = 1001L;
+
+ public static final String CATEGORY_A_LABEL = "a";
+ public static final String CATEGORY_B_LABEL = "b";
+ public static final String CATEGORY_B1_LABEL = "b1";
+ public static final String CATEGORY_B2_LABEL = "b2";
+ public static final String CATEGORY_C_LABEL = "c";
+
+ public ColumnCategoriesModelFixture() {
+ Node root = addRootCategory("Root");
+ root.addChildColumnIndexes(17, 18, 19);
+
+ // a
+ Node A = addCategory(root, CATEGORY_A_LABEL);
+ A.addChildColumnIndexes(0, 2, 3, 4, 5, 6);
+
+ // b
+ Node B = root.addChildCategory(CATEGORY_B_LABEL);
+ B.addChildCategory(CATEGORY_B1_LABEL).addChildColumnIndexes(7, 8);
+ B.addChildCategory(CATEGORY_B2_LABEL).addChildColumnIndexes(9, 10, 11);
+
+ // c
+ Node C = root.addChildCategory(CATEGORY_C_LABEL);
+ addColumnsToCategory(C, 12, 13, 14, 15, 16);
+ }
+
+ }
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_100_Row_groups.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_100_Row_groups.java
index 63fc76b..87851f7 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_100_Row_groups.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_100_Row_groups.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
+ * Copyright (c) 2012, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,6 +14,8 @@
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowGroupDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowGroupDataListFixture;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultBodyDataProvider;
@@ -37,8 +39,6 @@
import org.eclipse.nebula.widgets.nattable.layer.config.DefaultRowHeaderLayerConfiguration;
import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer;
import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowGroupDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowGroupDataListFixture;
import org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration;
import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer;
import org.eclipse.swt.widgets.Composite;
@@ -62,69 +62,68 @@
// Body
String[] propertyNames = RowGroupDataListFixture.getPropertyNames();
- Map<String, String> propertyToLabelMap = RowGroupDataListFixture
- .getPropertyToLabelMap();
+ Map<String, String> propertyToLabelMap = RowGroupDataListFixture.getPropertyToLabelMap();
- DefaultBodyDataProvider<RowGroupDataFixture> bodyDataProvider = new DefaultBodyDataProvider<RowGroupDataFixture>(
- RowGroupDataListFixture.getList(2000), propertyNames);
+ DefaultBodyDataProvider<RowGroupDataFixture> bodyDataProvider =
+ new DefaultBodyDataProvider<RowGroupDataFixture>(RowGroupDataListFixture.getList(2000), propertyNames);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
- ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
- bodyDataLayer);
- ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(
- columnReorderLayer);
+ ColumnReorderLayer columnReorderLayer =
+ new ColumnReorderLayer(bodyDataLayer);
+ ColumnHideShowLayer columnHideShowLayer =
+ new ColumnHideShowLayer(columnReorderLayer);
- RowHideShowLayer rowHideShowLayer = new RowHideShowLayer(
- columnHideShowLayer);
- RowGroupModel<RowGroupDataFixture> rowGroupModel = new RowGroupModel<RowGroupDataFixture>();
+ RowHideShowLayer rowHideShowLayer =
+ new RowHideShowLayer(columnHideShowLayer);
+ RowGroupModel<RowGroupDataFixture> rowGroupModel =
+ new RowGroupModel<RowGroupDataFixture>();
rowGroupModel.setDataProvider(bodyDataProvider);
- RowGroupExpandCollapseLayer<RowGroupDataFixture> rowExpandCollapseLayer = new RowGroupExpandCollapseLayer<RowGroupDataFixture>(
- rowHideShowLayer, rowGroupModel);
+ RowGroupExpandCollapseLayer<RowGroupDataFixture> rowExpandCollapseLayer =
+ new RowGroupExpandCollapseLayer<RowGroupDataFixture>(rowHideShowLayer, rowGroupModel);
- SelectionLayer selectionLayer = new SelectionLayer(
- rowExpandCollapseLayer);
- ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
+ SelectionLayer selectionLayer =
+ new SelectionLayer(rowExpandCollapseLayer);
+ ViewportLayer viewportLayer =
+ new ViewportLayer(selectionLayer);
// Column header
- DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DefaultColumnHeaderDataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- defaultColumnHeaderDataProvider);
- ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(
- columnHeaderDataLayer, viewportLayer, selectionLayer);
+ DefaultColumnHeaderDataProvider defaultColumnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DefaultColumnHeaderDataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(defaultColumnHeaderDataProvider);
+ ColumnHeaderLayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, viewportLayer, selectionLayer);
// Row header
- DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataProvider);
- DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
+ DefaultRowHeaderDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataProvider);
+ DefaultRowHeaderDataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
- RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- viewportLayer, selectionLayer, false);
+ RowHeaderLayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, viewportLayer, selectionLayer, false);
rowHeaderLayer.addConfiguration(new RowHeaderConfiguration());
- RowGroupHeaderLayer<RowGroupDataFixture> rowGroupHeaderLayer = new RowGroupHeaderLayer<RowGroupDataFixture>(
- rowHeaderLayer, selectionLayer, rowGroupModel);
+ RowGroupHeaderLayer<RowGroupDataFixture> rowGroupHeaderLayer =
+ new RowGroupHeaderLayer<RowGroupDataFixture>(rowHeaderLayer, selectionLayer, rowGroupModel);
rowGroupHeaderLayer.setColumnWidth(20);
// Create a group of rows for the model.
- RowGroup<RowGroupDataFixture> rowGroup = new RowGroup<RowGroupDataFixture>(
- rowGroupModel, "Group 1", true);
+ RowGroup<RowGroupDataFixture> rowGroup =
+ new RowGroup<RowGroupDataFixture>(rowGroupModel, "Group 1", true);
rowGroup.addStaticMemberRow(bodyDataProvider.getRowObject(1));
rowGroup.addMemberRow(bodyDataProvider.getRowObject(2));
rowGroupModel.addRowGroup(rowGroup);
- rowGroup = new RowGroup<RowGroupDataFixture>(rowGroupModel, "Group 2",
- true);
+ rowGroup = new RowGroup<RowGroupDataFixture>(rowGroupModel, "Group 2", true);
rowGroup.addStaticMemberRow(bodyDataProvider.getRowObject(11));
rowGroup.addMemberRow(bodyDataProvider.getRowObject(12));
rowGroup.addMemberRow(bodyDataProvider.getRowObject(13));
rowGroupModel.addRowGroup(rowGroup);
- rowGroup = new RowGroup<RowGroupDataFixture>(rowGroupModel, "Group 3",
- false);
+ rowGroup = new RowGroup<RowGroupDataFixture>(rowGroupModel, "Group 3", false);
rowGroup.addMemberRow(bodyDataProvider.getRowObject(18));
rowGroup.addMemberRow(bodyDataProvider.getRowObject(19));
rowGroup.addStaticMemberRow(bodyDataProvider.getRowObject(20));
@@ -132,15 +131,16 @@
// Corner
- final DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- defaultColumnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(cornerDataLayer,
- rowGroupHeaderLayer, columnHeaderLayer);
+ final DefaultCornerDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(defaultColumnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ ILayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowGroupHeaderLayer, columnHeaderLayer);
// Grid
- GridLayer gridLayer = new GridLayer(viewportLayer, columnHeaderLayer,
- rowGroupHeaderLayer, cornerLayer);
+ GridLayer gridLayer =
+ new GridLayer(viewportLayer, columnHeaderLayer, rowGroupHeaderLayer, cornerLayer);
NatTable natTable = new NatTable(parent, gridLayer, false);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
@@ -150,8 +150,7 @@
return natTable;
}
- private class RowHeaderConfiguration extends
- DefaultRowHeaderLayerConfiguration {
+ private class RowHeaderConfiguration extends DefaultRowHeaderLayerConfiguration {
@Override
protected void addRowHeaderUIBindings() {
// We're suppressing the row resize bindings.
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_200_Group_by.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_200_Group_by.java
index a61e41d..dd746b4 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_200_Group_by.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_150_Column_and_row_grouping/_200_Group_by.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,13 +18,15 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.runner.StandaloneNatExampleRunner;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByConfigAttributes;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByDataLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByHeaderLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByHeaderMenuConfiguration;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByModel;
-import org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByConfigAttributes;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.summary.SummationGroupBySummaryProvider;
import org.eclipse.nebula.widgets.nattable.freeze.CompositeFreezeLayer;
import org.eclipse.nebula.widgets.nattable.freeze.FreezeLayer;
@@ -44,8 +46,6 @@
import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer;
import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.tree.TreeLayer;
import org.eclipse.nebula.widgets.nattable.ui.menu.DebugMenuConfiguration;
import org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration;
@@ -81,99 +81,96 @@
comp.setLayout(new GridLayout(1, false));
// Underlying data source
- EventList<RowDataFixture> eventList = GlazedLists
- .eventList(RowDataListFixture.getList(200));
+ EventList<RowDataFixture> eventList =
+ GlazedLists.eventList(RowDataListFixture.getList(200));
String[] propertyNames = RowDataListFixture.getPropertyNames();
- Map<String, String> propertyToLabelMap = RowDataListFixture
- .getPropertyToLabelMap();
- IColumnPropertyAccessor<RowDataFixture> reflectiveColumnPropertyAccessor = new ReflectiveColumnPropertyAccessor<RowDataFixture>(
- propertyNames);
+ Map<String, String> propertyToLabelMap =
+ RowDataListFixture.getPropertyToLabelMap();
+ IColumnPropertyAccessor<RowDataFixture> reflectiveColumnPropertyAccessor =
+ new ReflectiveColumnPropertyAccessor<RowDataFixture>(propertyNames);
GroupByModel groupByModel = new GroupByModel();
// Summary
ConfigRegistry configRegistry = new ConfigRegistry();
- configRegistry
- .registerConfigAttribute(
- GroupByConfigAttributes.GROUP_BY_SUMMARY_PROVIDER,
- new SummationGroupBySummaryProvider<RowDataFixture>(
- reflectiveColumnPropertyAccessor),
- DisplayMode.NORMAL,
- GroupByDataLayer.GROUP_BY_COLUMN_PREFIX
- + RowDataListFixture
- .getColumnIndexOfProperty(RowDataListFixture.LOT_SIZE_PROP_NAME));
+ configRegistry.registerConfigAttribute(
+ GroupByConfigAttributes.GROUP_BY_SUMMARY_PROVIDER,
+ new SummationGroupBySummaryProvider<RowDataFixture>(reflectiveColumnPropertyAccessor),
+ DisplayMode.NORMAL,
+ GroupByDataLayer.GROUP_BY_COLUMN_PREFIX
+ + RowDataListFixture.getColumnIndexOfProperty(RowDataListFixture.LOT_SIZE_PROP_NAME));
- GroupByDataLayer<RowDataFixture> bodyDataLayer = new GroupByDataLayer<RowDataFixture>(
- groupByModel, eventList, reflectiveColumnPropertyAccessor,
- configRegistry);
+ GroupByDataLayer<RowDataFixture> bodyDataLayer =
+ new GroupByDataLayer<RowDataFixture>(
+ groupByModel, eventList, reflectiveColumnPropertyAccessor, configRegistry);
// Body layer
- ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(
- bodyDataLayer);
- ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(
- columnReorderLayer);
- SelectionLayer selectionLayer = new SelectionLayer(columnHideShowLayer);
+ ColumnReorderLayer columnReorderLayer =
+ new ColumnReorderLayer(bodyDataLayer);
+ ColumnHideShowLayer columnHideShowLayer =
+ new ColumnHideShowLayer(columnReorderLayer);
+ SelectionLayer selectionLayer =
+ new SelectionLayer(columnHideShowLayer);
- TreeLayer treeLayer = new TreeLayer(selectionLayer,
- bodyDataLayer.getTreeRowModel());
+ TreeLayer treeLayer =
+ new TreeLayer(selectionLayer, bodyDataLayer.getTreeRowModel());
FreezeLayer freeze = new FreezeLayer(treeLayer);
ViewportLayer viewportLayer = new ViewportLayer(treeLayer);
- CompositeFreezeLayer compFreeze = new CompositeFreezeLayer(freeze,
- viewportLayer, selectionLayer);
+ CompositeFreezeLayer compFreeze =
+ new CompositeFreezeLayer(freeze, viewportLayer, selectionLayer);
// Column header layer
- final IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- final DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(
- columnHeaderDataLayer, compFreeze, selectionLayer);
+ final IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ final DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ColumnHeaderLayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, compFreeze, selectionLayer);
// Note: The column header layer is wrapped in a filter row composite.
// This plugs in the filter row functionality
- ColumnOverrideLabelAccumulator labelAccumulator = new ColumnOverrideLabelAccumulator(
- columnHeaderDataLayer);
+ ColumnOverrideLabelAccumulator labelAccumulator =
+ new ColumnOverrideLabelAccumulator(columnHeaderDataLayer);
columnHeaderDataLayer.setConfigLabelAccumulator(labelAccumulator);
bodyDataLayer.setConfigLabelAccumulator(labelAccumulator);
// Register labels
- labelAccumulator.registerColumnOverrides(RowDataListFixture
- .getColumnIndexOfProperty(RowDataListFixture.RATING_PROP_NAME),
+ labelAccumulator.registerColumnOverrides(
+ RowDataListFixture.getColumnIndexOfProperty(RowDataListFixture.RATING_PROP_NAME),
"CUSTOM_COMPARATOR_LABEL");
// Row header layer
- DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- bodyDataLayer.getDataProvider());
- DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- compFreeze, selectionLayer);
+ DefaultRowHeaderDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(bodyDataLayer.getDataProvider());
+ DefaultRowHeaderDataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ RowHeaderLayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, compFreeze, selectionLayer);
// Corner layer
- DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- CornerLayer cornerLayer = new CornerLayer(cornerDataLayer,
- rowHeaderLayer, columnHeaderLayer);
+ DefaultCornerDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ CornerLayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// Grid
- GridLayer gridLayer = new GridLayer(compFreeze, columnHeaderLayer,
- rowHeaderLayer, cornerLayer, false);
+ GridLayer gridLayer =
+ new GridLayer(compFreeze, columnHeaderLayer, rowHeaderLayer, cornerLayer, false);
CompositeLayer compositeGridLayer = new CompositeLayer(1, 2);
- final GroupByHeaderLayer groupByHeaderLayer = new GroupByHeaderLayer(
- groupByModel, gridLayer, columnHeaderDataProvider);
- compositeGridLayer.setChildLayer(GroupByHeaderLayer.GROUP_BY_REGION,
- groupByHeaderLayer, 0, 0);
+ final GroupByHeaderLayer groupByHeaderLayer =
+ new GroupByHeaderLayer(groupByModel, gridLayer, columnHeaderDataProvider);
+ compositeGridLayer.setChildLayer(GroupByHeaderLayer.GROUP_BY_REGION, groupByHeaderLayer, 0, 0);
compositeGridLayer.setChildLayer("Grid", gridLayer, 0, 1);
NatTable natTable = new NatTable(comp, compositeGridLayer, false);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
- natTable.addConfiguration(new GroupByHeaderMenuConfiguration(natTable,
- groupByHeaderLayer));
+ natTable.addConfiguration(new GroupByHeaderMenuConfiguration(natTable, groupByHeaderLayer));
natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
natTable.addConfiguration(new DebugMenuConfiguration(natTable));
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_900_Everything_but_the_kitchen_sink.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_900_Everything_but_the_kitchen_sink.java
index 3459129..3dbda8f 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_900_Everything_but_the_kitchen_sink.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_900_Everything_but_the_kitchen_sink.java
@@ -10,11 +10,10 @@
******************************************************************************/
package org.eclipse.nebula.widgets.nattable.examples.examples;
-import static org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture.ASK_PRICE_PROP_NAME;
-import static org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture.getColumnIndexOfProperty;
import static org.eclipse.nebula.widgets.nattable.util.ObjectUtils.isNotNull;
import java.beans.PropertyChangeListener;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@@ -35,7 +34,10 @@
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.config.IConfiguration;
import org.eclipse.nebula.widgets.nattable.data.IRowDataProvider;
+import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.BlinkingRowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.examples.AbstractNatExample;
import org.eclipse.nebula.widgets.nattable.examples.PersistentNatExampleWrapper;
import org.eclipse.nebula.widgets.nattable.examples.examples._110_Editing.EditableGridExample;
@@ -63,8 +65,6 @@
import org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowConfigAttributes;
import org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowLayer;
import org.eclipse.nebula.widgets.nattable.summaryrow.SummationSummaryProvider;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.BlinkingRowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.ui.menu.HeaderMenuConfiguration;
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder;
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
@@ -126,9 +126,17 @@
SortedList<BlinkingRowDataFixture> sortedList = new SortedList<BlinkingRowDataFixture>(
filterList, null);
- FullFeaturedBodyLayerStack<BlinkingRowDataFixture> bodyLayer = new FullFeaturedBodyLayerStack<BlinkingRowDataFixture>(
- sortedList, BlinkingRowDataFixture.rowIdAccessor,
- propertyNames, configRegistry, columnGroupModel);
+ FullFeaturedBodyLayerStack<BlinkingRowDataFixture> bodyLayer =
+ new FullFeaturedBodyLayerStack<BlinkingRowDataFixture>(
+ sortedList,
+ new IRowIdAccessor<BlinkingRowDataFixture>() {
+
+ @Override
+ public Serializable getRowId(BlinkingRowDataFixture rowObject) {
+ return rowObject.getSecurity_description();
+ }
+ },
+ propertyNames, configRegistry, columnGroupModel);
this.bodyDataProvider = bodyLayer.getBodyDataProvider();
this.propertyChangeListener = bodyLayer.getGlazedListEventsLayer();
@@ -386,7 +394,8 @@
if (DataUpdater.this.dataProvider.getRowCount() > index) {
BlinkingRowDataFixture rowObject = DataUpdater.this.dataProvider
.getRowObject(index);
- // System.out.println("Ask: "+rowObject.getAsk_price()+" --> "+nextAsk);
+ // System.out.println("Ask:
+ // "+rowObject.getAsk_price()+" --> "+nextAsk);
rowObject.setAsk_price(nextAsk);
rowObject.setBid_price(-1 * nextAsk);
}
@@ -412,12 +421,13 @@
new SummationSummaryProvider(this.dataProvider),
DisplayMode.NORMAL,
SummaryRowLayer.DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX
- + getColumnIndexOfProperty(ASK_PRICE_PROP_NAME));
+ + RowDataListFixture.getColumnIndexOfProperty(RowDataListFixture.ASK_PRICE_PROP_NAME));
// No Summary by default
configRegistry.registerConfigAttribute(
SummaryRowConfigAttributes.SUMMARY_PROVIDER,
- ISummaryProvider.NONE, DisplayMode.NORMAL,
+ ISummaryProvider.NONE,
+ DisplayMode.NORMAL,
SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL);
}
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/FilterRowExampleGridLayer.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/FilterRowExampleGridLayer.java
index 73ef160..b7320f1 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/FilterRowExampleGridLayer.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/FilterRowExampleGridLayer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,6 +17,8 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow.DefaultGlazedListsFilterStrategy;
import org.eclipse.nebula.widgets.nattable.filterrow.FilterRowHeaderComposite;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
@@ -31,9 +33,6 @@
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator;
import org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
-import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.FilterList;
@@ -47,70 +46,67 @@
super(true);
// Underlying data source
- EventList<RowDataFixture> eventList = GlazedLists
- .eventList(RowDataListFixture.getList());
- FilterList<RowDataFixture> filterList = new FilterList<RowDataFixture>(
- eventList);
+ EventList<RowDataFixture> eventList = GlazedLists.eventList(RowDataListFixture.getList());
+ FilterList<RowDataFixture> filterList = new FilterList<RowDataFixture>(eventList);
String[] propertyNames = RowDataListFixture.getPropertyNames();
- Map<String, String> propertyToLabelMap = RowDataListFixture
- .getPropertyToLabelMap();
+ Map<String, String> propertyToLabelMap = RowDataListFixture.getPropertyToLabelMap();
// Body layer
- IColumnPropertyAccessor<RowDataFixture> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<RowDataFixture>(
- propertyNames);
- this.bodyDataProvider = new ListDataProvider<RowDataFixture>(filterList,
- columnPropertyAccessor);
- DataLayer bodyDataLayer = new DataLayer(this.bodyDataProvider);
- DefaultBodyLayerStack bodyLayer = new DefaultBodyLayerStack(
- bodyDataLayer);
- ColumnOverrideLabelAccumulator bodyLabelAccumulator = new ColumnOverrideLabelAccumulator(
- bodyDataLayer);
+ IColumnPropertyAccessor<RowDataFixture> columnPropertyAccessor =
+ new ReflectiveColumnPropertyAccessor<RowDataFixture>(propertyNames);
+ this.bodyDataProvider =
+ new ListDataProvider<RowDataFixture>(filterList, columnPropertyAccessor);
+ DataLayer bodyDataLayer =
+ new DataLayer(this.bodyDataProvider);
+ DefaultBodyLayerStack bodyLayer =
+ new DefaultBodyLayerStack(bodyDataLayer);
+ ColumnOverrideLabelAccumulator bodyLabelAccumulator =
+ new ColumnOverrideLabelAccumulator(bodyDataLayer);
bodyDataLayer.setConfigLabelAccumulator(bodyLabelAccumulator);
- bodyLabelAccumulator
- .registerColumnOverrides(
- RowDataListFixture
- .getColumnIndexOfProperty(RowDataListFixture.PRICING_TYPE_PROP_NAME),
- "PRICING_TYPE_PROP_NAME");
+ bodyLabelAccumulator.registerColumnOverrides(
+ RowDataListFixture.getColumnIndexOfProperty(RowDataListFixture.PRICING_TYPE_PROP_NAME),
+ "PRICING_TYPE_PROP_NAME");
// Column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(
- columnHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ColumnHeaderLayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
// Note: The column header layer is wrapped in a filter row composite.
// This plugs in the filter row functionality
- FilterRowHeaderComposite<RowDataFixture> filterRowHeaderLayer = new FilterRowHeaderComposite<RowDataFixture>(
- new DefaultGlazedListsFilterStrategy<RowDataFixture>(
- filterList, columnPropertyAccessor, configRegistry),
- columnHeaderLayer, columnHeaderDataProvider, configRegistry);
+ FilterRowHeaderComposite<RowDataFixture> filterRowHeaderLayer =
+ new FilterRowHeaderComposite<RowDataFixture>(
+ new DefaultGlazedListsFilterStrategy<RowDataFixture>(filterList, columnPropertyAccessor, configRegistry),
+ columnHeaderLayer, columnHeaderDataProvider, configRegistry);
- ColumnOverrideLabelAccumulator labelAccumulator = new ColumnOverrideLabelAccumulator(
- columnHeaderDataLayer);
+ ColumnOverrideLabelAccumulator labelAccumulator =
+ new ColumnOverrideLabelAccumulator(columnHeaderDataLayer);
columnHeaderDataLayer.setConfigLabelAccumulator(labelAccumulator);
// Register labels
- labelAccumulator.registerColumnOverrides(RowDataListFixture
- .getColumnIndexOfProperty(RowDataListFixture.RATING_PROP_NAME),
+ labelAccumulator.registerColumnOverrides(
+ RowDataListFixture.getColumnIndexOfProperty(RowDataListFixture.RATING_PROP_NAME),
"CUSTOM_COMPARATOR_LABEL");
// Row header layer
- DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- this.bodyDataProvider);
- DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- bodyLayer, bodyLayer.getSelectionLayer());
+ DefaultRowHeaderDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(this.bodyDataProvider);
+ DefaultRowHeaderDataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ RowHeaderLayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
// Corner layer
- DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- CornerLayer cornerLayer = new CornerLayer(cornerDataLayer,
- rowHeaderLayer, filterRowHeaderLayer);
+ DefaultCornerDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ CornerLayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, filterRowHeaderLayer);
// Grid
setBodyLayer(bodyLayer);
@@ -119,9 +115,4 @@
setRowHeaderLayer(rowHeaderLayer);
setCornerLayer(cornerLayer);
}
-
- @Override
- public void setClientAreaProvider(IClientAreaProvider clientAreaProvider) {
- super.setClientAreaProvider(clientAreaProvider);
- }
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/PricingTypeBeanDisplayConverter.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/PricingTypeBeanDisplayConverter.java
new file mode 100644
index 0000000..543b7d8
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/PricingTypeBeanDisplayConverter.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Original authors and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Original authors and others - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.nebula.widgets.nattable.examples.fixtures;
+
+import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.PricingTypeBean;
+
+public class PricingTypeBeanDisplayConverter extends DisplayConverter {
+
+ @Override
+ public Object canonicalToDisplayValue(Object canonicalValue) {
+ if (canonicalValue == null) {
+ return null;
+ } else {
+ return canonicalValue.toString().equals("MN") ? "Manual" : "Automatic";
+ }
+ }
+
+ @Override
+ public Object displayToCanonicalValue(Object displayValue) {
+ return displayValue.toString().equals("Manual") ? new PricingTypeBean("MN") : new PricingTypeBean("AT");
+ }
+
+}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/SelectionExampleGridLayer.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/SelectionExampleGridLayer.java
index 0bcd7da..a9bf745 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/SelectionExampleGridLayer.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/SelectionExampleGridLayer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
+ * Copyright (c) 2012, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,6 +16,8 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider;
@@ -27,9 +29,6 @@
import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
-import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.GlazedLists;
@@ -43,42 +42,41 @@
public SelectionExampleGridLayer() {
super(true);
- EventList<RowDataFixture> eventList = GlazedLists
- .eventList(RowDataListFixture.getList());
+ EventList<RowDataFixture> eventList = GlazedLists.eventList(RowDataListFixture.getList());
String[] propertyNames = RowDataListFixture.getPropertyNames();
- Map<String, String> propertyToLabelMap = RowDataListFixture
- .getPropertyToLabelMap();
+ Map<String, String> propertyToLabelMap = RowDataListFixture.getPropertyToLabelMap();
- IColumnPropertyAccessor<RowDataFixture> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<RowDataFixture>(
- propertyNames);
- this.bodyDataProvider = new ListDataProvider<RowDataFixture>(eventList,
- columnPropertyAccessor);
+ IColumnPropertyAccessor<RowDataFixture> columnPropertyAccessor =
+ new ReflectiveColumnPropertyAccessor<RowDataFixture>(propertyNames);
+ this.bodyDataProvider =
+ new ListDataProvider<RowDataFixture>(eventList, columnPropertyAccessor);
this.bodyDataLayer = new DataLayer(this.bodyDataProvider);
this.bodyLayer = new SelectionExampleBodyLayerStack(this.bodyDataLayer);
// Column header
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- this.columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(
- this.columnHeaderDataLayer, this.bodyLayer, this.bodyLayer.getSelectionLayer());
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ this.columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ColumnHeaderLayer columnHeaderLayer =
+ new ColumnHeaderLayer(this.columnHeaderDataLayer, this.bodyLayer, this.bodyLayer.getSelectionLayer());
// Row header
- DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- this.bodyDataProvider);
- DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- this.bodyLayer, this.bodyLayer.getSelectionLayer());
+ DefaultRowHeaderDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(this.bodyDataProvider);
+ DefaultRowHeaderDataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ RowHeaderLayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, this.bodyLayer, this.bodyLayer.getSelectionLayer());
// Corner
- DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- CornerLayer cornerLayer = new CornerLayer(cornerDataLayer,
- rowHeaderLayer, columnHeaderLayer);
+ DefaultCornerDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ CornerLayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);
// Grid
setBodyLayer(this.bodyLayer);
@@ -87,11 +85,6 @@
setCornerLayer(cornerLayer);
}
- @Override
- public void setClientAreaProvider(IClientAreaProvider clientAreaProvider) {
- super.setClientAreaProvider(clientAreaProvider);
- }
-
public SelectionLayer getSelectionLayer() {
return this.bodyLayer.getSelectionLayer();
}
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/StaticFilterExampleGridLayer.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/StaticFilterExampleGridLayer.java
index 9afe997..95fa930 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/StaticFilterExampleGridLayer.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/fixtures/StaticFilterExampleGridLayer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2015 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,6 +17,8 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow.DefaultGlazedListsStaticFilterStrategy;
@@ -35,9 +37,6 @@
import org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack;
import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer;
import org.eclipse.nebula.widgets.nattable.sort.config.SingleClickSortConfiguration;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
-import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.FilterList;
@@ -55,24 +54,22 @@
super(true);
// Underlying data source
- EventList<RowDataFixture> eventList = GlazedLists
- .eventList(RowDataListFixture.getList());
- TransformedList<RowDataFixture, RowDataFixture> rowObjectsGlazedList = GlazedLists
- .threadSafeList(eventList);
- SortedList<RowDataFixture> sortedList = new SortedList<RowDataFixture>(
- rowObjectsGlazedList, null);
- FilterList<RowDataFixture> filterList = new FilterList<RowDataFixture>(
- sortedList);
+ EventList<RowDataFixture> eventList =
+ GlazedLists.eventList(RowDataListFixture.getList());
+ TransformedList<RowDataFixture, RowDataFixture> rowObjectsGlazedList =
+ GlazedLists.threadSafeList(eventList);
+ SortedList<RowDataFixture> sortedList =
+ new SortedList<RowDataFixture>(rowObjectsGlazedList, null);
+ FilterList<RowDataFixture> filterList =
+ new FilterList<RowDataFixture>(sortedList);
String[] propertyNames = RowDataListFixture.getPropertyNames();
- Map<String, String> propertyToLabelMap = RowDataListFixture
- .getPropertyToLabelMap();
+ Map<String, String> propertyToLabelMap = RowDataListFixture.getPropertyToLabelMap();
// Body layer
- IColumnPropertyAccessor<RowDataFixture> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<RowDataFixture>(
- propertyNames);
+ IColumnPropertyAccessor<RowDataFixture> columnPropertyAccessor =
+ new ReflectiveColumnPropertyAccessor<RowDataFixture>(propertyNames);
- this.bodyDataProvider = new ListDataProvider<RowDataFixture>(filterList,
- columnPropertyAccessor);
+ this.bodyDataProvider = new ListDataProvider<RowDataFixture>(filterList, columnPropertyAccessor);
// add a static filter that only shows RowDataFixtures with a rating
// other than "AAA"
// bodyDataProvider = new
@@ -85,32 +82,32 @@
// };
this.bodyDataLayer = new DataLayer(this.bodyDataProvider);
- GlazedListsEventLayer<RowDataFixture> glazedListsEventLayer = new GlazedListsEventLayer<RowDataFixture>(
- this.bodyDataLayer, eventList);
- DefaultBodyLayerStack bodyLayer = new DefaultBodyLayerStack(
- glazedListsEventLayer);
- ColumnOverrideLabelAccumulator bodyLabelAccumulator = new ColumnOverrideLabelAccumulator(
- this.bodyDataLayer);
+ GlazedListsEventLayer<RowDataFixture> glazedListsEventLayer =
+ new GlazedListsEventLayer<RowDataFixture>(this.bodyDataLayer, eventList);
+ DefaultBodyLayerStack bodyLayer =
+ new DefaultBodyLayerStack(glazedListsEventLayer);
+ ColumnOverrideLabelAccumulator bodyLabelAccumulator =
+ new ColumnOverrideLabelAccumulator(this.bodyDataLayer);
this.bodyDataLayer.setConfigLabelAccumulator(bodyLabelAccumulator);
- bodyLabelAccumulator
- .registerColumnOverrides(
- RowDataListFixture
- .getColumnIndexOfProperty(RowDataListFixture.PRICING_TYPE_PROP_NAME),
- "PRICING_TYPE_PROP_NAME");
+ bodyLabelAccumulator.registerColumnOverrides(
+ RowDataListFixture.getColumnIndexOfProperty(RowDataListFixture.PRICING_TYPE_PROP_NAME),
+ "PRICING_TYPE_PROP_NAME");
// Column header layer
- IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
- propertyNames, propertyToLabelMap);
- DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(
- columnHeaderDataProvider);
- ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(
- columnHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
+ IDataProvider columnHeaderDataProvider =
+ new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
+ DataLayer columnHeaderDataLayer =
+ new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
+ ColumnHeaderLayer columnHeaderLayer =
+ new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
- SortHeaderLayer<RowDataFixture> sortHeaderLayer = new SortHeaderLayer<RowDataFixture>(
- columnHeaderLayer, new GlazedListsSortModel<RowDataFixture>(
- sortedList, columnPropertyAccessor, configRegistry,
- columnHeaderDataLayer), false);
+ SortHeaderLayer<RowDataFixture> sortHeaderLayer =
+ new SortHeaderLayer<RowDataFixture>(
+ columnHeaderLayer,
+ new GlazedListsSortModel<RowDataFixture>(
+ sortedList, columnPropertyAccessor, configRegistry, columnHeaderDataLayer),
+ false);
sortHeaderLayer.addConfiguration(new SingleClickSortConfiguration());
// Note: The column header layer is wrapped in a filter row composite.
@@ -120,8 +117,9 @@
// new
// DefaultGlazedListsFilterStrategy<RowDataFixture>(autoFilterMatcherEditor,
// columnPropertyAccessor, configRegistry);
- DefaultGlazedListsStaticFilterStrategy<RowDataFixture> filterStrategy = new DefaultGlazedListsStaticFilterStrategy<RowDataFixture>(
- filterList, columnPropertyAccessor, configRegistry);
+ DefaultGlazedListsStaticFilterStrategy<RowDataFixture> filterStrategy =
+ new DefaultGlazedListsStaticFilterStrategy<RowDataFixture>(
+ filterList, columnPropertyAccessor, configRegistry);
filterStrategy.addStaticFilter(new Matcher<RowDataFixture>() {
@Override
@@ -130,33 +128,34 @@
}
});
- FilterRowHeaderComposite<RowDataFixture> filterRowHeaderLayer = new FilterRowHeaderComposite<RowDataFixture>(
- filterStrategy, sortHeaderLayer, columnHeaderDataProvider,
- configRegistry);
+ FilterRowHeaderComposite<RowDataFixture> filterRowHeaderLayer =
+ new FilterRowHeaderComposite<RowDataFixture>(
+ filterStrategy, sortHeaderLayer, columnHeaderDataProvider, configRegistry);
- ColumnOverrideLabelAccumulator labelAccumulator = new ColumnOverrideLabelAccumulator(
- columnHeaderDataLayer);
+ ColumnOverrideLabelAccumulator labelAccumulator =
+ new ColumnOverrideLabelAccumulator(columnHeaderDataLayer);
columnHeaderDataLayer.setConfigLabelAccumulator(labelAccumulator);
// Register labels
- labelAccumulator.registerColumnOverrides(RowDataListFixture
- .getColumnIndexOfProperty(RowDataListFixture.RATING_PROP_NAME),
+ labelAccumulator.registerColumnOverrides(
+ RowDataListFixture.getColumnIndexOfProperty(RowDataListFixture.RATING_PROP_NAME),
"CUSTOM_COMPARATOR_LABEL");
// Row header layer
- DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
- this.bodyDataProvider);
- DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(
- rowHeaderDataProvider);
- RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- bodyLayer, bodyLayer.getSelectionLayer());
+ DefaultRowHeaderDataProvider rowHeaderDataProvider =
+ new DefaultRowHeaderDataProvider(this.bodyDataProvider);
+ DefaultRowHeaderDataLayer rowHeaderDataLayer =
+ new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
+ RowHeaderLayer rowHeaderLayer =
+ new RowHeaderLayer(rowHeaderDataLayer, bodyLayer, bodyLayer.getSelectionLayer());
// Corner layer
- DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
- columnHeaderDataProvider, rowHeaderDataProvider);
- DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- CornerLayer cornerLayer = new CornerLayer(cornerDataLayer,
- rowHeaderLayer, filterRowHeaderLayer);
+ DefaultCornerDataProvider cornerDataProvider =
+ new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider);
+ DataLayer cornerDataLayer =
+ new DataLayer(cornerDataProvider);
+ CornerLayer cornerLayer =
+ new CornerLayer(cornerDataLayer, rowHeaderLayer, filterRowHeaderLayer);
// Grid
setBodyLayer(bodyLayer);
@@ -166,11 +165,6 @@
setCornerLayer(cornerLayer);
}
- @Override
- public void setClientAreaProvider(IClientAreaProvider clientAreaProvider) {
- super.setClientAreaProvider(clientAreaProvider);
- }
-
public ListDataProvider<RowDataFixture> getBodyDataProvider() {
return this.bodyDataProvider;
}
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/.classpath b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/.classpath
index 121e527..ad32c83 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/.classpath
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/META-INF/MANIFEST.MF
index 2d900fa..be28013 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/META-INF/MANIFEST.MF
@@ -5,24 +5,19 @@
Bundle-Version: 1.4.0.qualifier
Fragment-Host: org.eclipse.nebula.widgets.nattable.extension.glazedlists
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.junit4
Import-Package: org.eclipse.jface.viewers,
- org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow,
- org.eclipse.nebula.widgets.nattable.filterrow.command,
- org.eclipse.nebula.widgets.nattable.filterrow.event,
- org.eclipse.nebula.widgets.nattable.group,
- org.eclipse.nebula.widgets.nattable.hideshow,
- org.eclipse.nebula.widgets.nattable.hideshow.command,
- org.eclipse.nebula.widgets.nattable.hideshow.event,
- org.eclipse.nebula.widgets.nattable.reorder,
- org.eclipse.nebula.widgets.nattable.selection,
- org.eclipse.nebula.widgets.nattable.selection.command,
- org.eclipse.nebula.widgets.nattable.selection.config,
- org.eclipse.nebula.widgets.nattable.selection.event,
- org.eclipse.nebula.widgets.nattable.test.data,
- org.eclipse.nebula.widgets.nattable.test.fixture,
- org.eclipse.nebula.widgets.nattable.test.fixture.data,
+ org.eclipse.nebula.widgets.nattable.dataset.fixture.data;version="1.4.0",
+ org.eclipse.nebula.widgets.nattable.dataset.person;version="1.4.0",
+ org.eclipse.nebula.widgets.nattable.filterrow.event;version="1.4.0",
+ org.eclipse.nebula.widgets.nattable.group;version="1.4.0",
+ org.eclipse.nebula.widgets.nattable.reorder;version="1.4.0",
+ org.eclipse.nebula.widgets.nattable.selection;version="1.4.0",
+ org.eclipse.nebula.widgets.nattable.selection.command;version="1.4.0",
+ org.eclipse.nebula.widgets.nattable.selection.event;version="1.4.0",
org.eclipse.nebula.widgets.nattable.test.fixture.layer,
org.eclipse.nebula.widgets.nattable.test.integration,
- org.eclipse.nebula.widgets.nattable.viewport
+ org.eclipse.nebula.widgets.nattable.viewport;version="1.4.0",
+ org.hamcrest.core,
+ org.junit
Bundle-Vendor: Eclipse Nebula NatTable
+Require-Bundle: ca.odell.glazedlists;bundle-version="1.9.0"
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/GlazedListsEventLayerTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/GlazedListsEventLayerTest.java
index 26b035c..1d17e8d 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/GlazedListsEventLayerTest.java
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/GlazedListsEventLayerTest.java
@@ -13,14 +13,13 @@
import java.util.List;
import org.eclipse.nebula.widgets.nattable.command.DisposeResourcesCommand;
-import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.BlinkingRowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.DataLayerFixture;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture;
import org.eclipse.nebula.widgets.nattable.layer.event.PropertyUpdateEvent;
import org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.BlinkingRowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowDataLayerTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowDataLayerTest.java
index f3acdb3..41c98b3 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowDataLayerTest.java
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowDataLayerTest.java
@@ -20,17 +20,17 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.DataLayerFixture;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture;
import org.eclipse.nebula.widgets.nattable.filterrow.FilterRowDataLayer;
import org.eclipse.nebula.widgets.nattable.filterrow.command.ClearAllFiltersCommand;
import org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand;
import org.eclipse.nebula.widgets.nattable.filterrow.command.ToggleFilterRowCommand;
import org.eclipse.nebula.widgets.nattable.filterrow.config.DefaultFilterRowConfiguration;
import org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture;
import org.junit.Before;
import org.junit.Test;
@@ -62,7 +62,8 @@
this.filterList,
new ReflectiveColumnPropertyAccessor<RowDataFixture>(
RowDataListFixture.getPropertyNames()),
- this.configRegistry), this.columnHeaderLayer,
+ this.configRegistry),
+ this.columnHeaderLayer,
this.columnHeaderLayer.getDataProvider(), this.configRegistry);
this.listener = new LayerListenerFixture();
this.layerUnderTest.addLayerListener(this.listener);
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowDataProviderTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowDataProviderTest.java
index e2675e1..9ce70c1 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowDataProviderTest.java
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowDataProviderTest.java
@@ -20,6 +20,10 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.convert.DefaultDoubleDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.DataLayerFixture;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture;
import org.eclipse.nebula.widgets.nattable.filterrow.FilterRowDataLayer;
import org.eclipse.nebula.widgets.nattable.filterrow.FilterRowDataProvider;
import org.eclipse.nebula.widgets.nattable.filterrow.TextMatchingMode;
@@ -27,10 +31,6 @@
import org.eclipse.nebula.widgets.nattable.filterrow.config.FilterRowConfigAttributes;
import org.eclipse.nebula.widgets.nattable.filterrow.event.FilterAppliedEvent;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture;
import org.junit.Before;
import org.junit.Test;
@@ -61,7 +61,8 @@
this.filterList,
new ReflectiveColumnPropertyAccessor<RowDataFixture>(
RowDataListFixture.getPropertyNames()),
- this.configRegistry), this.columnHeaderLayer,
+ this.configRegistry),
+ this.columnHeaderLayer,
this.columnHeaderLayer.getDataProvider(), this.configRegistry);
}
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowHeaderCompositeTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowHeaderCompositeTest.java
index bd3c233..7788c08 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowHeaderCompositeTest.java
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/FilterRowHeaderCompositeTest.java
@@ -14,17 +14,17 @@
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.edit.command.UpdateDataCommand;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.DataLayerFixture;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture;
import org.eclipse.nebula.widgets.nattable.filterrow.FilterRowHeaderComposite;
import org.eclipse.nebula.widgets.nattable.filterrow.command.ClearAllFiltersCommand;
import org.eclipse.nebula.widgets.nattable.filterrow.command.ClearFilterCommand;
import org.eclipse.nebula.widgets.nattable.filterrow.command.ToggleFilterRowCommand;
import org.eclipse.nebula.widgets.nattable.filterrow.config.DefaultFilterRowConfiguration;
import org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -57,7 +57,8 @@
this.filterList,
new ReflectiveColumnPropertyAccessor<RowDataFixture>(
RowDataListFixture.getPropertyNames()),
- this.configRegistry), this.columnHeaderLayer,
+ this.configRegistry),
+ this.columnHeaderLayer,
this.columnHeaderLayer.getDataProvider(), this.configRegistry);
this.listener = new LayerListenerFixture();
this.layerUnderTest.addLayerListener(this.listener);
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/BaseDataLayerFixture.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/BaseDataLayerFixture.java
new file mode 100644
index 0000000..8eb4948
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/BaseDataLayerFixture.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Original authors and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Original authors and others - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
+import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
+import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator;
+
+/**
+ * A DataLayer for use in unit tests with a pre-canned
+ */
+public class BaseDataLayerFixture extends DataLayer {
+
+ public BaseDataLayerFixture() {
+ this(5, 7);
+ }
+
+ public BaseDataLayerFixture(int colCount, int rowCount) {
+ setDataProvider(initDataProvider(colCount, rowCount));
+ initCellLabelAccumulator();
+ }
+
+ private IDataProvider initDataProvider(final int colCount,
+ final int rowCount) {
+ return new IDataProvider() {
+ Map<String, Object> dataStore = new HashMap<String, Object>();
+
+ @Override
+ public int getColumnCount() {
+ return colCount;
+ }
+
+ @Override
+ public int getRowCount() {
+ return rowCount;
+ }
+
+ @Override
+ public Object getDataValue(int columnIndex, int rowIndex) {
+ String key = "[" + columnIndex + ", " + rowIndex + "]";
+ if (this.dataStore.get(key) == null) {
+ return key;
+ } else {
+ return this.dataStore.get(key);
+ }
+ }
+
+ @Override
+ public void setDataValue(int columnIndex, int rowIndex,
+ Object newValue) {
+ this.dataStore.put("[" + columnIndex + ", " + rowIndex + "]",
+ newValue);
+ }
+
+ };
+ }
+
+ private void initCellLabelAccumulator() {
+ setConfigLabelAccumulator(new IConfigLabelAccumulator() {
+
+ @Override
+ public void accumulateConfigLabels(LabelStack configLabels,
+ int columnPosition, int rowPosition) {
+ configLabels.addLabel("DEFAULT");
+ }
+
+ });
+ }
+
+}
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/DataLayerFixture.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/DataLayerFixture.java
new file mode 100644
index 0000000..7a88118
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/DataLayerFixture.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Original authors and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Original authors and others - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture;
+
+import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+
+/**
+ * A DataLayer for use in unit tests with a pre-canned
+ *
+ * Default column layout: DO NOT FORMAT !
+ *
+ * Position: 0 1 2 3 4 Width : 150 100 35 100 80 -------|------|----|------|----
+ *
+ * Default Row layout: Position | Height 0 | 40 1 | 70 2 | 25 3 | 40 4 | 50 5 |
+ * 40 6 | 100
+ */
+public class DataLayerFixture extends BaseDataLayerFixture {
+
+ public DataLayerFixture(int colCount, int rowCount, int colWidth,
+ int rowHeight) {
+ super(colCount, rowCount);
+ setDefaultColumnWidth(colWidth);
+ setDefaultRowHeight(rowHeight);
+ }
+
+ public DataLayerFixture(int preferedColumnWidth, int preferedRowHeight) {
+ setDefaultColumnWidth(preferedColumnWidth);
+ setDefaultRowHeight(preferedRowHeight);
+ }
+
+ public DataLayerFixture() {
+ setDefaultColumnWidth(100);
+ setColumnWidthByPosition(0, 150);
+ setColumnWidthByPosition(2, 35);
+ setColumnWidthByPosition(4, 80);
+
+ setDefaultRowHeight(40);
+ setRowHeightByPosition(1, 70);
+ setRowHeightByPosition(2, 25);
+ setRowHeightByPosition(4, 50);
+ setRowHeightByPosition(6, 100);
+ }
+
+ @Override
+ public IDataProvider getDataProvider() {
+ return this.dataProvider;
+ }
+
+ @Override
+ public String toString() {
+ return "DataLayerFixture";
+ }
+}
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/InitializeClientAreaCommandFixture.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/InitializeClientAreaCommandFixture.java
new file mode 100644
index 0000000..aeeab6a
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/InitializeClientAreaCommandFixture.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Original authors and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Original authors and others - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture;
+
+import org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand;
+
+public class InitializeClientAreaCommandFixture extends ClientAreaResizeCommand {
+
+ public InitializeClientAreaCommandFixture() {
+ super(ViewportLayerFixture.DEFAULT_SCROLLABLE);
+ }
+}
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/LayerListenerFixture.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/LayerListenerFixture.java
new file mode 100644
index 0000000..db86136
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/LayerListenerFixture.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Original authors and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Original authors and others - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.nebula.widgets.nattable.layer.ILayerListener;
+import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent;
+
+/**
+ * This class helps us test the event flow by providing access to the
+ * ILayerEvent fired.
+ */
+public class LayerListenerFixture implements ILayerListener {
+
+ // Received events are kept in order
+ private final List<ILayerEvent> receivedEvents = new LinkedList<ILayerEvent>();
+
+ @Override
+ public void handleLayerEvent(ILayerEvent event) {
+ this.receivedEvents.add(event);
+ }
+
+ public List<ILayerEvent> getReceivedEvents() {
+ return this.receivedEvents;
+ }
+
+ public void clearReceivedEvents() {
+ this.receivedEvents.clear();
+ }
+
+ public int getEventsCount() {
+ return this.receivedEvents.size();
+ }
+
+ public boolean containsInstanceOf(Class<? extends ILayerEvent> class1) {
+ for (ILayerEvent inEvent : this.receivedEvents) {
+ if (inEvent.getClass().getName().equals(class1.getName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public ILayerEvent getReceivedEvent(Class<? extends ILayerEvent> class1) {
+ for (ILayerEvent inEvent : this.receivedEvents) {
+ if (inEvent.getClass().getName().equals(class1.getName())) {
+ return inEvent;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/NatTableFixture.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/NatTableFixture.java
new file mode 100644
index 0000000..3c1705c
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/NatTableFixture.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Original authors and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Original authors and others - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture;
+
+import org.eclipse.nebula.widgets.nattable.NatTable;
+import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.config.IEditableRule;
+import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
+import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
+import org.eclipse.nebula.widgets.nattable.layer.ILayer;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator;
+import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent;
+import org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+public class NatTableFixture extends NatTable {
+
+ private static final int DEFAULT_HEIGHT = 400;
+ private static final int DEFAULT_WIDTH = 600;
+
+ private int eventCount = 0;
+ private boolean updated = false;
+ private ColumnOverrideLabelAccumulator columnLabelAccumulator;
+
+ public NatTableFixture() {
+ super(new Shell(), new DummyGridLayerStack(), true);
+ initClientArea();
+ }
+
+ public NatTableFixture(ILayer underlyingLayer) {
+ this(underlyingLayer, true);
+ }
+
+ public NatTableFixture(Shell shell, ILayer underlyingLayer) {
+ super(shell, underlyingLayer, true);
+ initClientArea();
+ }
+
+ public NatTableFixture(Shell shell, ILayer underlyingLayer, int width,
+ int height) {
+ super(shell, underlyingLayer, true);
+ initClientArea(width, height);
+ }
+
+ public NatTableFixture(ILayer underlyingLayer, boolean autoconfigure) {
+ super(new Shell(Display.getDefault()), underlyingLayer, autoconfigure);
+ initClientArea();
+ }
+
+ public NatTableFixture(ILayer underlyingLayer, int width, int height,
+ boolean autoconfigure) {
+ super(new Shell(Display.getDefault()), underlyingLayer, autoconfigure);
+ initClientArea(width, height);
+ }
+
+ private void initClientArea() {
+ initClientArea(DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ }
+
+ private void initClientArea(int width, int height) {
+ setSize(width, height);
+ doCommand(new InitializeClientAreaCommandFixture());
+ }
+
+ @Override
+ public void handleLayerEvent(ILayerEvent event) {
+ super.handleLayerEvent(event);
+ this.eventCount++;
+ }
+
+ @Override
+ public void updateResize() {
+ this.updated = true;
+ }
+
+ public int getEventCount() {
+ return this.eventCount;
+ }
+
+ public boolean isUpdated() {
+ return this.updated;
+ }
+
+ // Convenience methods for tests
+
+ public void registerLabelOnColumn(DataLayer bodyDataLayer, int columnIndex,
+ String columnLabel) {
+ getColumnLabelAccumulator(bodyDataLayer).registerColumnOverrides(
+ columnIndex, columnLabel);
+ }
+
+ public void registerLabelOnColumnHeader(DataLayer columnHeaderDataLayer,
+ int columnIndex, String columnLabel) {
+ getColumnLabelAccumulator(columnHeaderDataLayer)
+ .registerColumnOverrides(columnIndex, columnLabel);
+ }
+
+ private ColumnOverrideLabelAccumulator getColumnLabelAccumulator(
+ DataLayer dataLayer) {
+ if (this.columnLabelAccumulator == null) {
+ this.columnLabelAccumulator = new ColumnOverrideLabelAccumulator(
+ dataLayer);
+ dataLayer.setConfigLabelAccumulator(this.columnLabelAccumulator);
+ }
+ return this.columnLabelAccumulator;
+ }
+
+ public void scrollToColumn(int gridColumnPosition) {
+ DummyGridLayerStack gridLayer = (DummyGridLayerStack) getUnderlyingLayerByPosition(
+ 1, 1);
+ ViewportLayer viewportLayer = gridLayer.getBodyLayer()
+ .getViewportLayer();
+ viewportLayer.invalidateHorizontalStructure();
+ viewportLayer.setOriginX(viewportLayer
+ .getStartXOfColumnPosition(gridColumnPosition));
+ }
+
+ public void scrollToRow(int gridRowPosition) {
+ DummyGridLayerStack gridLayer = (DummyGridLayerStack) getUnderlyingLayerByPosition(
+ 1, 1);
+ ViewportLayer viewportLayer = gridLayer.getBodyLayer()
+ .getViewportLayer();
+ viewportLayer.invalidateVerticalStructure();
+ viewportLayer.setOriginY(viewportLayer
+ .getStartYOfRowPosition(gridRowPosition));
+ }
+
+ public void enableEditingOnAllCells() {
+ getConfigRegistry().registerConfigAttribute(
+ EditConfigAttributes.CELL_EDITABLE_RULE,
+ IEditableRule.ALWAYS_EDITABLE, DisplayMode.EDIT);
+ }
+
+ @Override
+ public ConfigRegistry getConfigRegistry() {
+ return (ConfigRegistry) super.getConfigRegistry();
+ }
+
+}
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/ViewportLayerFixture.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/ViewportLayerFixture.java
new file mode 100644
index 0000000..3de4780
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/fixture/ViewportLayerFixture.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Original authors and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Original authors and others - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture;
+
+import org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer;
+import org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider;
+import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Scrollable;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Viewport fixtures to enable testing with various configurations.
+ */
+public class ViewportLayerFixture extends ViewportLayer {
+
+ public static Rectangle DEFAULT_CLIENT_AREA = new Rectangle(0, 0, 200, 100);
+ public static IClientAreaProvider DEFAULT_CLIENT_AREA_PROVIDER = getClientAreaProvider(DEFAULT_CLIENT_AREA);
+ public static Scrollable DEFAULT_SCROLLABLE = scrollable();
+
+ /**
+ * Default Xtor
+ */
+ public ViewportLayerFixture() {
+ super(new DataLayerFixture());
+ setClientAreaProvider(getClientAreaProvider(DEFAULT_CLIENT_AREA));
+ }
+
+ public ViewportLayerFixture(IUniqueIndexLayer underlingLayer) {
+ super(underlingLayer);
+ setClientAreaProvider(getClientAreaProvider(new Rectangle(0, 0, 1000,
+ 1000)));
+ doCommand(new InitializeClientAreaCommandFixture());
+ }
+
+ /**
+ * Xtor Fixture with all columns equal width and all rows equal height.
+ */
+ public ViewportLayerFixture(int width, int height) {
+ super(new DataLayerFixture(width, height));
+ }
+
+ /**
+ * Xtor Fixture with all columns equal width and all rows equal height.
+ *
+ * @param colCount
+ * total number of columns
+ * @param rowCount
+ * total number of rows
+ */
+ public ViewportLayerFixture(int colCount, int rowCount,
+ int defaultColWidth, int defaultRowHeight) {
+ super(new DataLayerFixture(colCount, rowCount, defaultColWidth,
+ defaultRowHeight));
+ setClientAreaProvider(DEFAULT_CLIENT_AREA_PROVIDER);
+ }
+
+ /**
+ * Xtor Provide your own <i>clientArea</i>
+ */
+ public ViewportLayerFixture(final Rectangle clientArea) {
+ super(new DataLayerFixture());
+ setClientAreaProvider(getClientAreaProvider(clientArea));
+ }
+
+ private static IClientAreaProvider getClientAreaProvider(
+ final Rectangle clientArea) {
+ return new IClientAreaProvider() {
+ @Override
+ public Rectangle getClientArea() {
+ return clientArea;
+ }
+ };
+ }
+
+ private static Scrollable scrollable() {
+ return new Composite(new Shell(Display.getDefault()), SWT.H_SCROLL
+ | SWT.V_SCROLL);
+ }
+}
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerSummaryRowConcurrencyTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerSummaryRowConcurrencyTest.java
index a9ae0eb..efa27b0 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerSummaryRowConcurrencyTest.java
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerSummaryRowConcurrencyTest.java
@@ -22,10 +22,14 @@
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.IColumnAccessor;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.NatTableFixture;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByDataLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByModel;
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.layer.CompositeLayer;
+import org.eclipse.nebula.widgets.nattable.layer.ILayerListener;
+import org.eclipse.nebula.widgets.nattable.layer.event.CellVisualChangeEvent;
+import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent;
import org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.summaryrow.DefaultSummaryRowConfiguration;
@@ -33,7 +37,6 @@
import org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowConfigAttributes;
import org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowLayer;
import org.eclipse.nebula.widgets.nattable.summaryrow.SummationSummaryProvider;
-import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture;
import org.junit.Before;
import org.junit.Test;
@@ -44,6 +47,7 @@
public class GroupByDataLayerSummaryRowConcurrencyTest {
private FixedSummaryRowLayer summaryRowLayer;
+ private int calcCount = 0;
class Value {
int value;
@@ -127,6 +131,17 @@
@Test
public void shouldCorrectlyCalculateSummaryValues() {
+
+ this.summaryRowLayer.addLayerListener(new ILayerListener() {
+
+ @Override
+ public synchronized void handleLayerEvent(ILayerEvent event) {
+ if (event instanceof CellVisualChangeEvent) {
+ GroupByDataLayerSummaryRowConcurrencyTest.this.calcCount++;
+ }
+ }
+ });
+
assertNull(this.summaryRowLayer.getDataValueByPosition(0, 0));
assertNull(this.summaryRowLayer.getDataValueByPosition(1, 0));
assertNull(this.summaryRowLayer.getDataValueByPosition(2, 0));
@@ -139,11 +154,14 @@
assertNull(this.summaryRowLayer.getDataValueByPosition(9, 0));
assertNull(this.summaryRowLayer.getDataValueByPosition(10, 0));
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ while (this.calcCount < 11) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
+
assertEquals(55.0, this.summaryRowLayer.getDataValueByPosition(0, 0));
assertEquals(55.0, this.summaryRowLayer.getDataValueByPosition(1, 0));
assertEquals(55.0, this.summaryRowLayer.getDataValueByPosition(2, 0));
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerTest.java
index 871967d..2c0311f 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerTest.java
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupby/GroupByDataLayerTest.java
@@ -23,6 +23,8 @@
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByComparator;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByConfigAttributes;
@@ -41,8 +43,6 @@
import org.eclipse.nebula.widgets.nattable.sort.SortConfigAttributes;
import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.nebula.widgets.nattable.test.data.Person;
-import org.eclipse.nebula.widgets.nattable.test.data.PersonService;
import org.junit.Before;
import org.junit.Test;
@@ -277,8 +277,7 @@
assertEquals(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column, stack.getLabels().get(0));
assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.getLabels().get(1));
assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.getLabels().get(2));
- }
- else {
+ } else {
assertFalse("groupBy object label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT));
assertFalse("groupBy column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column));
}
@@ -317,8 +316,7 @@
assertEquals(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column, stack.getLabels().get(2));
assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.getLabels().get(3));
assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.getLabels().get(4));
- }
- else {
+ } else {
assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY));
assertFalse("groupBy summary column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column));
@@ -327,8 +325,7 @@
assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.getLabels().get(1));
assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.getLabels().get(2));
}
- }
- else {
+ } else {
assertFalse("groupBy object label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT));
assertFalse("groupBy column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column));
assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY));
@@ -373,8 +370,7 @@
assertEquals(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column, stack.getLabels().get(3));
assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.getLabels().get(4));
assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.getLabels().get(5));
- }
- else {
+ } else {
// respect the label order
assertEquals(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column, stack.getLabels().get(0));
assertEquals(GroupByDataLayer.GROUP_BY_SUMMARY, stack.getLabels().get(1));
@@ -382,8 +378,7 @@
assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.getLabels().get(3));
assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.getLabels().get(4));
}
- }
- else {
+ } else {
assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY));
assertFalse("groupBy summary column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY_COLUMN_PREFIX + column));
@@ -392,8 +387,7 @@
assertEquals(GroupByDataLayer.GROUP_BY_OBJECT, stack.getLabels().get(1));
assertEquals(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + column, stack.getLabels().get(2));
}
- }
- else {
+ } else {
assertFalse("groupBy object label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_OBJECT));
assertFalse("groupBy column label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_COLUMN_PREFIX + column));
assertFalse("groupBy summary label found", stack.hasLabel(GroupByDataLayer.GROUP_BY_SUMMARY));
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/HideMultipleColumnsIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/HideMultipleColumnsIntegrationTest.java
index 4935e78..3257550 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/HideMultipleColumnsIntegrationTest.java
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/HideMultipleColumnsIntegrationTest.java
@@ -12,13 +12,13 @@
import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.LayerListenerFixture;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.NatTableFixture;
import org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand;
import org.eclipse.nebula.widgets.nattable.hideshow.event.HideColumnPositionsEvent;
import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent;
-import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture;
import org.junit.Assert;
import org.junit.Test;
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/RowSelectionIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/RowSelectionIntegrationTest.java
index 7a27875..e684c2d 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/RowSelectionIntegrationTest.java
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/RowSelectionIntegrationTest.java
@@ -28,6 +28,9 @@
import org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate;
import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.NatTableFixture;
import org.eclipse.nebula.widgets.nattable.layer.ILayerListener;
import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent;
import org.eclipse.nebula.widgets.nattable.selection.RowSelectionModel;
@@ -39,9 +42,6 @@
import org.eclipse.nebula.widgets.nattable.selection.event.CellSelectionEvent;
import org.eclipse.nebula.widgets.nattable.sort.command.SortColumnCommand;
import org.eclipse.nebula.widgets.nattable.sort.config.DefaultSortConfiguration;
-import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.util.ArrayUtil;
import org.junit.Assert;
import org.junit.Before;
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/SWTUtils.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/SWTUtils.java
new file mode 100644
index 0000000..02afd33
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/SWTUtils.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Original authors and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Original authors and others - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.nebula.widgets.nattable.extension.glazedlists.test.integration;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Widget;
+
+public class SWTUtils {
+
+ public static final int NO_CLICK = 0;
+ public static final int LEFT_MOUSE_BUTTON = 1;
+ public static final int RIGHT_MOUSE_BUTTON = 3;
+ public static final int ONE_CLICK = 1;
+
+ public static void leftClickOnCombo(int x, int y, int stateMask,
+ Control control) {
+ Event leftClickEvent = getLeftClickEvent(x, y, stateMask, control);
+ control.notifyListeners(SWT.MouseDown, leftClickEvent);
+ control.notifyListeners(SWT.MouseUp, leftClickEvent);
+ }
+
+ public static void selectInCombo(int x, int y, int stateMask,
+ Control control) {
+ Event leftClickEvent = getLeftClickEvent(x, y, stateMask, control);
+ control.notifyListeners(SWT.Selection, leftClickEvent);
+ }
+
+ public static void leftClick(int x, int y, int stateMask, Widget nattable) {
+ Event leftClickEvent = getLeftClickEvent(x, y, stateMask, nattable);
+
+ nattable.notifyListeners(SWT.MouseDown, leftClickEvent);
+ nattable.notifyListeners(SWT.MouseUp, leftClickEvent);
+ }
+
+ public static Event getLeftClickEvent(int x, int y, int stateMask,
+ Widget nattable) {
+ Event event = new Event();
+ event.time = (int) System.currentTimeMillis();
+ event.widget = nattable;
+ event.display = nattable.getDisplay();
+ event.x = x;
+ event.y = y;
+ event.button = LEFT_MOUSE_BUTTON;
+ event.stateMask = stateMask;
+ event.count = ONE_CLICK;
+ return event;
+ }
+
+ public static void pressCharKey(char c, Widget natTable) {
+ natTable.notifyListeners(SWT.KeyDown, keyEventWithChar(c));
+ }
+
+ public static void pressKey(int keyCode, Widget natTable) {
+ natTable.notifyListeners(SWT.KeyDown, keyEvent(keyCode));
+ }
+
+ public static void pressKey(int keyCode, int stateMask, Widget natTable) {
+ natTable.notifyListeners(SWT.KeyDown, keyEventWithModifier(keyCode, stateMask));
+ }
+
+ public static void pressKeyOnControl(int keyCode, Control control) {
+ control.notifyListeners(SWT.KeyDown, keyEvent(keyCode));
+ }
+
+ public static void pressKeyOnControl(int keyCode, int stateMask, Control control) {
+ control.notifyListeners(SWT.KeyDown, keyEventWithModifier(keyCode, stateMask));
+ }
+
+ public static Event keyEvent(int keyCode) {
+ return keyEventWithModifier(keyCode, SWT.NONE);
+ }
+
+ public static Event keyEventWithModifier(int keyCode, int stateMask) {
+ Event event = new Event();
+ event.type = SWT.KeyDown;
+ event.keyCode = keyCode;
+ event.stateMask = stateMask;
+ return event;
+ }
+
+ public static Event keyEventWithChar(char c) {
+ Event event = new Event();
+ event.type = SWT.KeyDown;
+ event.character = c;
+ event.stateMask = SWT.NONE;
+ return event;
+ }
+
+ /**
+ * Some of the tests do not run on Unix, due to issues with Xvfb. This check
+ * helps skipping those tests.
+ */
+ public static boolean isRunningOnUnix() {
+ return System.getProperty("os.name").equals("Linux");
+ }
+
+}
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/SortIntegrationTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/SortIntegrationTest.java
index e13d48c..289e051 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/SortIntegrationTest.java
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/test/integration/SortIntegrationTest.java
@@ -21,14 +21,13 @@
import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry;
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
import org.eclipse.nebula.widgets.nattable.config.NullComparator;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
+import org.eclipse.nebula.widgets.nattable.extension.glazedlists.fixture.NatTableFixture;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.sort.SortConfigAttributes;
import org.eclipse.nebula.widgets.nattable.sort.config.DefaultSortConfiguration;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
-import org.eclipse.nebula.widgets.nattable.test.integration.SWTUtils;
import org.eclipse.swt.SWT;
import org.junit.After;
import org.junit.Before;
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/tree/GlazedListTreeRowModelExpandCollapseTest.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/tree/GlazedListTreeRowModelExpandCollapseTest.java
index 711a31a..3b7776b 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/tree/GlazedListTreeRowModelExpandCollapseTest.java
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/tree/GlazedListTreeRowModelExpandCollapseTest.java
@@ -22,8 +22,8 @@
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
-import org.eclipse.nebula.widgets.nattable.test.data.Person;
-import org.eclipse.nebula.widgets.nattable.test.data.PersonService;
+import org.eclipse.nebula.widgets.nattable.dataset.person.Person;
+import org.eclipse.nebula.widgets.nattable.dataset.person.PersonService;
import org.junit.Before;
import org.junit.Test;
@@ -174,13 +174,11 @@
assertFalse(
MessageFormat.format("Node at index {0} is collapsed", i),
this.treeRowModel.isCollapsed(i));
- }
- else if (this.treeList.get(i) instanceof FirstNameGroup) {
+ } else if (this.treeList.get(i) instanceof FirstNameGroup) {
assertTrue(
MessageFormat.format("Node at index {0} is expanded", i),
this.treeRowModel.isCollapsed(i));
- }
- else {
+ } else {
// there should be no other values visible right now
fail("Another object than LastNameGroup and FirstNameGroup is visible");
}
@@ -191,10 +189,12 @@
AtomicInteger counter = new AtomicInteger();
Map<String, LastNameGroup> lastNames = new HashMap<String, LastNameGroup>();
+
{
this.lastNames.put("Simpsons", new LastNameGroup(1, "Simpsons"));
this.lastNames.put("Flanders", new LastNameGroup(2, "Flanders"));
}
+
Map<String, FirstNameGroup> firstNames = new HashMap<String, FirstNameGroup>();
@Override
diff --git a/org.eclipse.nebula.widgets.nattable.test.performance/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.test.performance/META-INF/MANIFEST.MF
index ebb0e2c..220f889 100644
--- a/org.eclipse.nebula.widgets.nattable.test.performance/META-INF/MANIFEST.MF
+++ b/org.eclipse.nebula.widgets.nattable.test.performance/META-INF/MANIFEST.MF
@@ -5,9 +5,9 @@
Bundle-Version: 1.1.1.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: ca.odell.glazedlists,
- org.eclipse.nebula.widgets.nattable.test.fixture.data,
org.eclipse.nebula.widgets.nattable,
org.eclipse.nebula.widgets.nattable.data,
+ org.eclipse.nebula.widgets.nattable.dataset.fixture.data,
org.eclipse.nebula.widgets.nattable.extension.glazedlists,
org.eclipse.nebula.widgets.nattable.grid,
org.eclipse.nebula.widgets.nattable.grid.data,
diff --git a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ListDataProviderPerformanceTest.java b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ListDataProviderPerformanceTest.java
index 115a1c7..faaf5e3 100644
--- a/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ListDataProviderPerformanceTest.java
+++ b/org.eclipse.nebula.widgets.nattable.test.performance/src/org/eclipse/nebula/widgets/nattable/test/performance/ListDataProviderPerformanceTest.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Original authors and others - initial API and implementation
******************************************************************************/
@@ -15,16 +15,17 @@
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture;
+import org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataListFixture;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataFixture;
-import org.eclipse.nebula.widgets.nattable.test.fixture.data.RowDataListFixture;
import org.junit.Assert;
import org.junit.Test;
import ca.odell.glazedlists.GlazedLists;
+@SuppressWarnings("deprecation")
public class ListDataProviderPerformanceTest extends
AbstractLayerPerformanceTest {
@@ -34,7 +35,7 @@
List<RowDataFixture> largeList = RowDataListFixture.getList(26000);
Assert.assertTrue(largeList.size() > 25000);
- layer = new DefaultGridLayer(largeList,
+ this.layer = new DefaultGridLayer(largeList,
RowDataListFixture.getPropertyNames(),
RowDataListFixture.getPropertyToLabelMap());
}
@@ -57,7 +58,7 @@
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
propertyNames, propertyToLabelMap);
- layer = new DefaultGridLayer(glazedListsDataProvider,
+ this.layer = new DefaultGridLayer(glazedListsDataProvider,
columnHeaderDataProvider);
}
}