switching core back to int positions; added adapters for big layers/axes
diff --git a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/BigLayerExample.xtend b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/BigLayerExample.xtend
index 24de2f8..4e306a2 100644
--- a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/BigLayerExample.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/BigLayerExample.xtend
@@ -1,9 +1,11 @@
package org.eclipse.nebula.widgets.nattable.core.example.impl.big
+import java.math.BigDecimal
+import java.math.BigInteger
import org.eclipse.nebula.widgets.nattable.core.example.impl.AbstractNatExample
-import org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.AxisImpl
+import org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.BigAxisImpl
+import org.eclipse.nebula.widgets.nattable.core.layer.impl.BigDummyLayer
import org.eclipse.nebula.widgets.nattable.core.layer.impl.DimensionallyDependentLayer
-import org.eclipse.nebula.widgets.nattable.core.layer.impl.DummyLayer
import org.eclipse.nebula.widgets.nattable.core.layer.impl.LayerDataAccessorImpl
import org.eclipse.nebula.widgets.nattable.core.layer.impl.composite.CompositeLayer
import org.eclipse.nebula.widgets.nattable.core.layer.impl.header.ColumnHeaderLayer
@@ -11,6 +13,11 @@
import org.eclipse.nebula.widgets.nattable.core.layer.impl.viewport.ViewportLayer
class BigLayerExample extends AbstractNatExample {
+
+ val static MILLION = 1000 * 1000L
+ val static BILLION = 1000 * MILLION
+ val static TRILLION = 1000 * BILLION
+ val static QUADRILLION = 1000 * TRILLION
override getDescription() {
'''
@@ -19,10 +26,10 @@
}
override createLayer() {
- val bodyLayer = new ViewportLayer(new DummyLayer(
+ val bodyLayer = new ViewportLayer(new BigDummyLayer(
// quadrillion, trillion, billion, million, thousand, hundred
- new AxisImpl(10L * 1000 * 1000 * 1000 * 1000 * 1000, 200), // Horizontal axis
- new AxisImpl(10L * 1000 * 1000 * 1000 * 1000 * 1000, 100) // Vertical axis
+ new BigAxisImpl(BigInteger::valueOf(10 * QUADRILLION), BigDecimal::valueOf(200)), // Horizontal axis
+ new BigAxisImpl(BigInteger::valueOf(10 * QUADRILLION), BigDecimal::valueOf(100)) // Vertical axis
))
val columnHeaderLayer = new ColumnHeaderLayer(bodyLayer.horizontalAxis, new LayerDataAccessorImpl([ layer, columnId, rowId | columnId ]))
diff --git a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/index/node/AbstractIndexNode.xtend b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/index/node/AbstractIndexNode.xtend
index 05b7957..01c791a 100644
--- a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/index/node/AbstractIndexNode.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/index/node/AbstractIndexNode.xtend
@@ -10,8 +10,21 @@
this.displayName = displayName
}
+ override getPath() { path }
+
override getDisplayName() {
displayName ?: path.substring(path.lastIndexOf('/') + 1)
}
+ override equals(Object that) {
+ switch (that) {
+ IndexNode: this.path == that.path
+ default: false
+ }
+ }
+
+ override hashCode() {
+ path.hashCode
+ }
+
}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/index/node/IndexNode.xtend b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/index/node/IndexNode.xtend
index 663e80a..11ff84f 100644
--- a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/index/node/IndexNode.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/index/node/IndexNode.xtend
@@ -4,6 +4,7 @@
interface IndexNode {
+ def String getPath()
def String getDisplayName()
def List<String> getChildNodeNames()
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/AxisTest.xtend b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/AxisTest.xtend
index 44c13dd..ee4bb1b 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/AxisTest.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/AxisTest.xtend
@@ -1,7 +1,6 @@
package org.eclipse.nebula.widgets.nattable.core.layer
import java.io.Serializable
-import java.math.BigDecimal
import java.util.List
import org.eclipse.nebula.widgets.nattable.core.layer.axis.Axis
@@ -12,23 +11,19 @@
class AxisTest {
def static testAxis(Axis axis, List<? extends Serializable> expectedIds, List<Double> expectedPixels) {
- testBigAxis("", axis, expectedIds, expectedPixels.map[ new BigDecimal(it) ])
+ testAxis("", axis, expectedIds, expectedPixels)
}
def static testAxis(String axisName, Axis axis, List<? extends Serializable> expectedIds, List<Double> expectedPixels) {
- testBigAxis(axisName, axis, expectedIds, expectedPixels.map[ new BigDecimal(it) ])
- }
-
- def static testBigAxis(String axisName, Axis axis, List<? extends Serializable> expectedIds, List<BigDecimal> expectedPixels) {
// Segment count
assertEquals('''«axisName» getSegmentCount''', expectedIds.size, axis.segmentCount)
// Start pixel of segment position
for (segmentPosition : 0 .. expectedIds.size)
- assertEquals('''«axisName» getStartPixelOfSegmentPosition(«segmentPosition»)''', expectedPixels.get(segmentPosition), axis.getStartPixelOfSegmentPosition(segmentPosition))
+ assertEquals('''«axisName» getStartPixelOfSegmentPosition(«segmentPosition»)''', expectedPixels.get(segmentPosition), axis.getStartPixelOfSegmentPosition(segmentPosition), 0)
// Segment position of pixel location
- assertEquals('''«axisName» < range getSegmentPositionOfPixelLocation(«expectedPixels.get(0) - BigDecimal::ONE»)''', -1, axis.getSegmentPositionOfPixelLocation(expectedPixels.get(0) - new BigDecimal(1)))
+ assertEquals('''«axisName» < range getSegmentPositionOfPixelLocation(«expectedPixels.get(0) - 1»)''', -1, axis.getSegmentPositionOfPixelLocation(expectedPixels.get(0) - 1))
for (segmentPosition : 0 ..< expectedIds.size) {
val pixelLocation = expectedPixels.get(segmentPosition)
assertEquals('''«axisName» getSegmentPositionOfPixelLocation(«pixelLocation»)''', segmentPosition, axis.getSegmentPositionOfPixelLocation(pixelLocation))
@@ -44,7 +39,7 @@
assertEquals('''«axisName» getSegmentPositionOfId(«segmentId»)''', expectedIds.indexOf(segmentId), axis.getSegmentPositionOfId(segmentId))
// Pixel size
- assertEquals('''«axisName» pixelSize''', expectedPixels.get(expectedPixels.size - 1) - expectedPixels.get(0), axis.pixelSize)
+ assertEquals('''«axisName» pixelSize''', expectedPixels.get(expectedPixels.size - 1) - expectedPixels.get(0), axis.pixelSize, 0)
}
}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/ResizeAxisTest.xtend b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/ResizeAxisTest.xtend
index cc7a427..d679d10 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/ResizeAxisTest.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/ResizeAxisTest.xtend
@@ -18,7 +18,7 @@
def void baseline() {
testAxis(
axis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -29,7 +29,7 @@
testAxis(
axis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 100.0, 125.0, 225.0, 325.0 ]
)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/hideshow/HideShowAxisTest.xtend b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/hideshow/HideShowAxisTest.xtend
index 1b4de96..d6719ea 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/hideshow/HideShowAxisTest.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/hideshow/HideShowAxisTest.xtend
@@ -23,14 +23,14 @@
testAxis(
"underlyingAxis",
underlyingAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
testAxis(
"hideShowAxis",
hideShowAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -42,7 +42,7 @@
testAxis(
"hide",
hideShowAxis,
- #[ 1L, 2L, 3L ],
+ #[ 1, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0 ]
)
@@ -51,7 +51,7 @@
testAxis(
"show",
hideShowAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -63,7 +63,7 @@
testAxis(
"hide",
hideShowAxis,
- #[ 0L, 2L, 3L ],
+ #[ 0, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0 ]
)
@@ -72,7 +72,7 @@
testAxis(
"show",
hideShowAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -84,7 +84,7 @@
testAxis(
"hide",
hideShowAxis,
- #[ 0L, 1L, 2L ],
+ #[ 0, 1, 2 ],
#[ 0.0, 100.0, 200.0, 300.0 ]
)
@@ -93,7 +93,7 @@
testAxis(
"show",
hideShowAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -105,7 +105,7 @@
testAxis(
"hide 3",
hideShowAxis,
- #[ 0L, 1L, 2L ],
+ #[ 0, 1, 2 ],
#[ 0.0, 100.0, 200.0, 300.0 ]
)
@@ -114,7 +114,7 @@
testAxis(
"hide 0",
hideShowAxis,
- #[ 1L, 2L ],
+ #[ 1, 2 ],
#[ 0.0, 100.0, 200.0 ]
)
@@ -123,7 +123,7 @@
testAxis(
"hide 1",
hideShowAxis,
- #[ 2L ],
+ #[ 2 ],
#[ 0.0, 100.0 ]
)
@@ -132,7 +132,7 @@
testAxis(
"show 1",
hideShowAxis,
- #[ 1L, 2L ],
+ #[ 1, 2 ],
#[ 0.0, 100.0, 200.0 ]
)
@@ -141,7 +141,7 @@
testAxis(
"show 3",
hideShowAxis,
- #[ 1L, 2L, 3L ],
+ #[ 1, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0 ]
)
@@ -150,7 +150,7 @@
testAxis(
"show 0",
hideShowAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/reorder/ReorderAxisTest.xtend b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/reorder/ReorderAxisTest.xtend
index 3d38b3e..5327ac9 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/reorder/ReorderAxisTest.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/reorder/ReorderAxisTest.xtend
@@ -23,14 +23,14 @@
testAxis(
"underlyingAxis",
underlyingAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
testAxis(
"reorderAxis",
reorderAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -42,7 +42,7 @@
testAxis(
"reorderAxis",
reorderAxis,
- #[ 1L, 2L, 0L, 3L ],
+ #[ 1, 2, 0, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -54,7 +54,7 @@
testAxis(
"reorderAxis",
reorderAxis,
- #[ 1L, 2L, 3L, 0L ],
+ #[ 1, 2, 3, 0 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -66,7 +66,7 @@
testAxis(
"reorderAxis",
reorderAxis,
- #[ 2L, 0L, 1L, 3L ],
+ #[ 2, 0, 1, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -78,7 +78,7 @@
testAxis(
"reorderAxis",
reorderAxis,
- #[ 0L, 2L, 1L, 3L ],
+ #[ 0, 2, 1, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -90,7 +90,7 @@
testAxis(
"reorderAxis",
reorderAxis,
- #[ 0L, 2L, 1L, 3L ],
+ #[ 0, 2, 1, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -102,7 +102,7 @@
testAxis(
"reorderAxis",
reorderAxis,
- #[ 0L, 2L, 3L, 1L ],
+ #[ 0, 2, 3, 1 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -114,7 +114,7 @@
testAxis(
"reorderAxis",
reorderAxis,
- #[ 3L, 0L, 1L, 2L ],
+ #[ 3, 0, 1, 2 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -126,7 +126,7 @@
testAxis(
"reorderAxis",
reorderAxis,
- #[ 0L, 1L, 3L, 2L ],
+ #[ 0, 1, 3, 2 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayerTest.xtend b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayerTest.xtend
index aefb8c1..68bb301 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayerTest.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayerTest.xtend
@@ -42,14 +42,14 @@
testAxis(
"bodyLayer.horizontalAxis",
bodyLayer.horizontalAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 200.0, 400.0, 600.0, 800.0 ]
)
testAxis(
"bodyLayer.verticalAxis",
bodyLayer.verticalAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -59,14 +59,14 @@
testAxis(
"columnHeaderLayer.horizontalAxis",
columnHeaderLayer.horizontalAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 200.0, 400.0, 600.0, 800.0 ]
)
testAxis(
"columnHeaderLayer.verticalAxis",
columnHeaderLayer.verticalAxis,
- #[ 0L ],
+ #[ 0 ],
#[ 0.0, 20.0 ]
)
}
@@ -76,14 +76,14 @@
testAxis(
"rowHeaderLayer.horizontalAxis",
rowHeaderLayer.horizontalAxis,
- #[ 0L ],
+ #[ 0 ],
#[ 0.0, 20.0 ]
)
testAxis(
"rowHeaderLayer.verticalAxis",
rowHeaderLayer.verticalAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 100.0, 200.0, 300.0, 400.0 ]
)
}
@@ -93,14 +93,14 @@
testAxis(
"cornerLayer.horizontalAxis",
cornerLayer.horizontalAxis,
- #[ 0L ],
+ #[ 0 ],
#[ 0.0, 20.0 ]
)
testAxis(
"cornerLayer.verticalAxis",
cornerLayer.verticalAxis,
- #[ 0L ],
+ #[ 0 ],
#[ 0.0, 20.0 ]
)
}
@@ -110,14 +110,14 @@
testAxis(
"compositeLayer.horizontalAxis",
compositeLayer.horizontalAxis,
- #[ 0L, 0L, 1L, 2L, 3L ],
+ #[ 0, 0, 1, 2, 3 ],
#[ 0.0, 20.0, 220.0, 420.0, 620.0, 820.0 ]
)
testAxis(
"compositeLayer.verticalAxis",
compositeLayer.verticalAxis,
- #[ 0L, 0L, 1L, 2L, 3L ],
+ #[ 0, 0, 1, 2, 3 ],
#[ 0.0, 20.0, 120.0, 220.0, 320.0, 420.0 ]
)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportAxisTest.xtend b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportAxisTest.xtend
index 5bbd328..99d1e9e 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportAxisTest.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportAxisTest.xtend
@@ -1,10 +1,12 @@
package org.eclipse.nebula.widgets.nattable.core.layer.impl.viewport
import org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.AxisImpl
+import org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.NotSoBigAxis
import org.junit.Before
import org.junit.Test
import static org.eclipse.nebula.widgets.nattable.core.layer.AxisTest.*
+import static extension org.eclipse.nebula.widgets.nattable.core.layer.axis.AxisInvariants.*
class ViewportAxisTest {
@@ -21,7 +23,7 @@
setPixelSizeOfSegmentPosition(7, 2)
setPixelSizeOfSegmentPosition(13, 3)
]
- viewportAxis = new ViewportAxis(underlyingAxis, null)
+ viewportAxis = new ViewportAxis(new NotSoBigAxis(underlyingAxis), null)
}
@Test
@@ -31,16 +33,25 @@
testAxis(
"underlyingAxis",
underlyingAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 2.0, 5.0, 12.0, 25.0 ]
)
+ // By default, viewport visible pixel size is 10
+ testAxis(
+ "viewportAxis",
+ viewportAxis,
+ #[ 0, 1, 2 ],
+ #[ 0.0, 2.0, 5.0, 12.0 ]
+ )
+
+ viewportAxis.visiblePixelSize = underlyingAxis.pixelSize
// segment position: | 0 | 1 | 2 | 3 |
// pixel location: 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4
testAxis(
"viewportAxis",
viewportAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ 0.0, 2.0, 5.0, 12.0, 25.0 ]
)
}
@@ -54,7 +65,7 @@
viewportAxis.visiblePixelSize = 5
testAxis(
viewportAxis,
- #[ 0L, 1L ],
+ #[ 0, 1 ],
#[ 0.0, 2.0, 5.0 ]
)
}
@@ -69,7 +80,7 @@
viewportAxis.visiblePixelSize = 23
testAxis(
viewportAxis,
- #[ 1L, 2L, 3L ],
+ #[ 1, 2, 3 ],
#[ 0.0, 3.0, 10.0, 23.0 ]
)
}
@@ -84,7 +95,7 @@
viewportAxis.visiblePixelSize = 10
testAxis(
viewportAxis,
- #[ 1L, 2L ],
+ #[ 1, 2 ],
#[ 0.0, 3.0, 10.0 ]
)
}
@@ -99,7 +110,7 @@
viewportAxis.visiblePixelSize = 8
testAxis(
viewportAxis,
- #[ 0L, 1L, 2L ],
+ #[ 0, 1, 2 ],
#[ 0.0, 2.0, 5.0, 12.0 ]
)
}
@@ -114,7 +125,7 @@
viewportAxis.visiblePixelSize = 17
testAxis(
viewportAxis,
- #[ 2L, 3L ],
+ #[ 2, 3 ],
#[ -3.0, 4.0, 17.0 ]
)
}
@@ -129,7 +140,7 @@
viewportAxis.visiblePixelSize = 10
testAxis(
viewportAxis,
- #[ 3L ],
+ #[ 3 ],
#[ -5.0, 8.0 ]
)
}
@@ -144,7 +155,7 @@
viewportAxis.visiblePixelSize = 15
testAxis(
viewportAxis,
- #[ 1L, 2L, 3L ],
+ #[ 1, 2, 3 ],
#[ -2.0, 1.0, 8.0, 21.0 ]
)
}
@@ -160,7 +171,7 @@
testAxis(
"before expand",
viewportAxis,
- #[ 1L, 2L ],
+ #[ 1, 2 ],
#[ -2.0, 1.0, 8.0 ]
)
@@ -173,7 +184,7 @@
testAxis(
"after expand",
viewportAxis,
- #[ 1L, 2L, 3L ],
+ #[ 1, 2, 3 ],
#[ -2.0, 1.0, 8.0, 21.0 ]
)
}
@@ -189,7 +200,7 @@
testAxis(
"before expand",
viewportAxis,
- #[ 1L, 2L ],
+ #[ 1, 2 ],
#[ -2.0, 1.0, 8.0 ]
)
@@ -202,7 +213,7 @@
testAxis(
"after expand",
viewportAxis,
- #[ 0L, 1L, 2L, 3L ],
+ #[ 0, 1, 2, 3 ],
#[ -1.0, 1.0, 4.0, 11.0, 24.0 ]
)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/BigPositionCoordinate.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/BigPositionCoordinate.xtend
new file mode 100644
index 0000000..b5d3aae
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/BigPositionCoordinate.xtend
@@ -0,0 +1,12 @@
+package org.eclipse.nebula.widgets.nattable.core.geometry
+
+import java.math.BigInteger
+
+/**
+ * A layer coordinate position (column, row).
+ */
+@Data
+class BigPositionCoordinate {
+ BigInteger columnPosition
+ BigInteger rowPosition
+}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/BigPositionRectangle.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/BigPositionRectangle.xtend
new file mode 100644
index 0000000..38bd9f6
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/BigPositionRectangle.xtend
@@ -0,0 +1,30 @@
+package org.eclipse.nebula.widgets.nattable.core.geometry
+
+import java.math.BigInteger
+
+/**
+ * A rectangle in layer position coordinates (column, row).
+ */
+class BigPositionRectangle {
+
+ val BigPositionCoordinate positionOrigin
+ val BigInteger positionWidth
+ val BigInteger positionHeight
+
+ new(BigInteger columnPosition, BigInteger rowPosition, BigInteger positionWidth, BigInteger positionHeight) {
+ this.positionOrigin = new BigPositionCoordinate(columnPosition, rowPosition)
+ this.positionWidth = positionWidth
+ this.positionHeight = positionHeight
+ }
+
+ def getOriginPosition() { positionOrigin }
+ def getColumnPosition() { positionOrigin.columnPosition }
+ def getRowPosition() { positionOrigin.rowPosition }
+ def getWidth() { positionWidth }
+ def getHeight() { positionHeight }
+
+ override toString() {
+ '''[«class.name» column: «positionOrigin.columnPosition», row: «positionOrigin.rowPosition», width: «positionWidth», height: «positionHeight»]'''
+ }
+
+}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelArea.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelArea.xtend
index 2fd4893..016c37b 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelArea.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelArea.xtend
@@ -1,18 +1,12 @@
package org.eclipse.nebula.widgets.nattable.core.geometry
-import java.math.BigDecimal
-
@Data
class PixelArea {
- BigDecimal width
- BigDecimal height
+ double width
+ double height
new(double width, double height) {
- this(new BigDecimal(width), new BigDecimal(height))
- }
-
- new(BigDecimal width, BigDecimal height) {
_width = width
_height = height
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelCoordinate.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelCoordinate.xtend
index 6ca693a..df81871 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelCoordinate.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelCoordinate.xtend
@@ -1,12 +1,10 @@
package org.eclipse.nebula.widgets.nattable.core.geometry
-import java.math.BigDecimal
-
/**
* A pixel coordinate (x, y).
*/
@Data
class PixelCoordinate {
- BigDecimal x
- BigDecimal y
+ double x
+ double y
}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelRectangle.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelRectangle.xtend
index e6ce08a..b12d2d2 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelRectangle.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelRectangle.xtend
@@ -1,20 +1,14 @@
package org.eclipse.nebula.widgets.nattable.core.geometry
-import java.math.BigDecimal
-
/**
* A rectangle in pixel dimensions.
*/
class PixelRectangle {
val PixelCoordinate pixelOrigin
- val BigDecimal pixelWidth
- val BigDecimal pixelHeight
+ val double pixelWidth
+ val double pixelHeight
new(double xPixel, double yPixel, double pixelWidth, double pixelHeight) {
- this(new BigDecimal(xPixel), new BigDecimal(yPixel), new BigDecimal(pixelWidth), new BigDecimal(pixelHeight))
- }
-
- new(BigDecimal xPixel, BigDecimal yPixel, BigDecimal pixelWidth, BigDecimal pixelHeight) {
this.pixelOrigin = new PixelCoordinate(xPixel, yPixel)
this.pixelWidth = pixelWidth
this.pixelHeight = pixelHeight
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelRectangleInvariants.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelRectangleInvariants.xtend
index 93b481e..ecb015a 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelRectangleInvariants.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelRectangleInvariants.xtend
@@ -1,15 +1,15 @@
package org.eclipse.nebula.widgets.nattable.core.geometry
-import java.math.BigDecimal
+import static java.lang.Math.*
class PixelRectangleInvariants {
def static PixelRectangle intersect(PixelRectangle rect1, PixelRectangle rect2) {
- val startX = rect1.x.max(rect2.x)
- val startY = rect1.y.max(rect2.y)
- val endX = rect1.x + rect1.width.min(rect2.x + rect2.width)
- val endY = rect1.y + rect1.height.min(rect2.y + rect2.height)
- new PixelRectangle(startX, startY, BigDecimal::ZERO.max(endX - startX), BigDecimal::ZERO.max(endY - startY))
+ val startX = max(rect1.x, rect2.x)
+ val startY = max(rect1.y, rect2.y)
+ val endX = min(rect1.x + rect1.width, rect2.x + rect2.width)
+ val endY = min(rect1.y + rect1.height, rect2.y + rect2.height)
+ new PixelRectangle(startX, startY, max(0, endX - startX), max(0, endY - startY))
}
def static boolean isEmpty(PixelRectangle rect) {
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionCoordinate.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionCoordinate.xtend
index 274cd01..78c872d 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionCoordinate.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionCoordinate.xtend
@@ -5,6 +5,6 @@
*/
@Data
class PositionCoordinate {
- long columnPosition
- long rowPosition
+ int columnPosition
+ int rowPosition
}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionRectangle.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionRectangle.xtend
index 131f69b..42a0f89 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionRectangle.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionRectangle.xtend
@@ -4,11 +4,12 @@
* A rectangle in layer position coordinates (column, row).
*/
class PositionRectangle {
- val PositionCoordinate positionOrigin
- val long positionWidth
- val long positionHeight
- new(long columnPosition, long rowPosition, long positionWidth, long positionHeight) {
+ val PositionCoordinate positionOrigin
+ val int positionWidth
+ val int positionHeight
+
+ new(int columnPosition, int rowPosition, int positionWidth, int positionHeight) {
this.positionOrigin = new PositionCoordinate(columnPosition, rowPosition)
this.positionWidth = positionWidth
this.positionHeight = positionHeight
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/BigLayer.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/BigLayer.xtend
new file mode 100644
index 0000000..7132c19
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/BigLayer.xtend
@@ -0,0 +1,30 @@
+package org.eclipse.nebula.widgets.nattable.core.layer
+
+import java.math.BigInteger
+import org.eclipse.nebula.widgets.nattable.core.command.CommandHandler
+import org.eclipse.nebula.widgets.nattable.core.event.EventListener
+import org.eclipse.nebula.widgets.nattable.core.event.EventSource
+import org.eclipse.nebula.widgets.nattable.core.layer.axis.BigAxis
+import org.eclipse.nebula.widgets.nattable.core.layer.cell.BigCell
+
+/**
+ * A two-dimensional rectangular region of cells.
+ */
+interface BigLayer extends CommandHandler, EventSource, EventListener {
+
+ /**
+ * @return The Axis that characterizes the horizontal dimension of this layer.
+ */
+ def BigAxis getHorizontalAxis()
+
+ /**
+ * @return The Axis that characterizes the vertical dimension of this layer.
+ */
+ def BigAxis getVerticalAxis()
+
+ /**
+ * @return The Cell at the given column and row position in this layer.
+ */
+ def BigCell getCell(BigInteger columnPosition, BigInteger rowPosition)
+
+}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/Layer.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/Layer.xtend
index 7c334bf..f7e3569 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/Layer.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/Layer.xtend
@@ -24,6 +24,6 @@
/**
* @return The Cell at the given column and row position in this layer.
*/
- def Cell getCell(long columnPosition, long rowPosition)
+ def Cell getCell(int columnPosition, int rowPosition)
}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/LayerInvariants.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/LayerInvariants.xtend
index 0b28778..ce743d2 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/LayerInvariants.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/LayerInvariants.xtend
@@ -1,6 +1,5 @@
package org.eclipse.nebula.widgets.nattable.core.layer
-import java.math.BigDecimal
import org.eclipse.nebula.widgets.nattable.core.geometry.PixelArea
import org.eclipse.nebula.widgets.nattable.core.geometry.PixelRectangle
@@ -17,15 +16,15 @@
layer.horizontalAxis.segmentCount
}
- def static getColumnIdOfPosition(Layer layer, long columnPosition) {
+ def static getColumnIdOfPosition(Layer layer, int columnPosition) {
layer.horizontalAxis.getIdOfSegmentPosition(columnPosition)
}
- def static getStartXPixelOfColumnPosition(Layer layer, long columnPosition) {
+ def static getStartXPixelOfColumnPosition(Layer layer, int columnPosition) {
layer.horizontalAxis.getStartPixelOfSegmentPosition(columnPosition)
}
- def static getPixelWidthOfColumn(Layer layer, long columnPosition) {
+ def static getPixelWidthOfColumn(Layer layer, int columnPosition) {
layer.horizontalAxis.getPixelSizeOfSegmentPosition(columnPosition)
}
@@ -33,7 +32,7 @@
layer.horizontalAxis.pixelSize
}
- def static getColumnPositionOfXPixel(Layer layer, BigDecimal xPixel) {
+ def static getColumnPositionOfXPixel(Layer layer, double xPixel) {
layer.horizontalAxis.getSegmentPositionOfPixelLocation(xPixel)
}
@@ -43,15 +42,15 @@
layer.verticalAxis.segmentCount
}
- def static getRowIdOfPosition(Layer layer, long rowPosition) {
+ def static getRowIdOfPosition(Layer layer, int rowPosition) {
layer.verticalAxis.getIdOfSegmentPosition(rowPosition)
}
- def static getStartYPixelOfRowPosition(Layer layer, long rowPosition) {
+ def static getStartYPixelOfRowPosition(Layer layer, int rowPosition) {
layer.verticalAxis.getStartPixelOfSegmentPosition(rowPosition)
}
- def static getPixelHeightOfRow(Layer layer, long rowPosition) {
+ def static getPixelHeightOfRow(Layer layer, int rowPosition) {
layer.verticalAxis.getPixelSizeOfSegmentPosition(rowPosition)
}
@@ -59,7 +58,7 @@
layer.verticalAxis.pixelSize
}
- def static getRowPositionOfYPixel(Layer layer, BigDecimal yPixel) {
+ def static getRowPositionOfYPixel(Layer layer, double yPixel) {
layer.verticalAxis.getSegmentPositionOfPixelLocation(yPixel)
}
@@ -69,7 +68,7 @@
layer.horizontalAxis.containsSegmentPosition(columnPosition) && layer.verticalAxis.containsSegmentPosition(rowPosition)
}
- def static boolean containsPixelLocation(Layer layer, BigDecimal xPixel, BigDecimal yPixel) {
+ def static boolean containsPixelLocation(Layer layer, double xPixel, double yPixel) {
layer.horizontalAxis.containsPixelLocation(xPixel) && layer.verticalAxis.containsPixelLocation(yPixel)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/Axis.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/Axis.xtend
index f77173e..604e878 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/Axis.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/Axis.xtend
@@ -1,7 +1,6 @@
package org.eclipse.nebula.widgets.nattable.core.layer.axis
import java.io.Serializable
-import java.math.BigDecimal
import org.eclipse.nebula.widgets.nattable.core.event.EventListener
import org.eclipse.nebula.widgets.nattable.core.event.EventSource
@@ -13,7 +12,7 @@
/**
* @return The number of segments on this axis.
*/
- def long getSegmentCount()
+ def int getSegmentCount()
/**
* Gets the start pixel location of the segment at the given position. This function must be defined for all valid segment position
@@ -24,7 +23,7 @@
* @param segmentPosition
* @return The start pixel location of the given segment position.
*/
- def BigDecimal getStartPixelOfSegmentPosition(long segmentPosition)
+ def double getStartPixelOfSegmentPosition(int segmentPosition)
/**
* Gets the position of the segment that is nearest to the the given pixel location.
@@ -34,18 +33,18 @@
* If the given pixel location is less than 0, the segment position returned will be -1.
* If the given pixel location is greater than the size of the axis, then the last segment position + 1 will be returned (= segment count).
*/
- def long getSegmentPositionOfPixelLocation(BigDecimal pixelLocation)
+ def int getSegmentPositionOfPixelLocation(double pixelLocation)
/**
* @param segmentPosition
* @return The identifier associated with the given segment position.
*/
- def Serializable getIdOfSegmentPosition(long segmentPosition)
+ def Serializable getIdOfSegmentPosition(int segmentPosition)
/**
* @param segmentId
* @return The position of the segment associated with the given segment identifier.
*/
- def long getSegmentPositionOfId(Serializable segmentId)
+ def int getSegmentPositionOfId(Serializable segmentId)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/AxisInvariants.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/AxisInvariants.xtend
index 681ed54..1914ed2 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/AxisInvariants.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/AxisInvariants.xtend
@@ -1,7 +1,5 @@
package org.eclipse.nebula.widgets.nattable.core.layer.axis
-import java.math.BigDecimal
-
/**
* A set of useful utility functions that calculate invariants that must hold for any Axis.
*/
@@ -11,15 +9,15 @@
axis.getStartPixelOfSegmentPosition(axis.segmentCount) - axis.getStartPixelOfSegmentPosition(0)
}
- def static getPixelSizeOfSegmentPosition(Axis axis, long segmentPosition) {
+ def static getPixelSizeOfSegmentPosition(Axis axis, int segmentPosition) {
axis.getStartPixelOfSegmentPosition(segmentPosition + 1) - axis.getStartPixelOfSegmentPosition(segmentPosition)
}
- def static boolean containsPixelLocation(Axis axis, BigDecimal pixelLocation) {
- pixelLocation >= BigDecimal::ZERO && pixelLocation < axis.getStartPixelOfSegmentPosition(axis.segmentCount)
+ def static boolean containsPixelLocation(Axis axis, double pixelLocation) {
+ pixelLocation >= 0 && pixelLocation < axis.getStartPixelOfSegmentPosition(axis.segmentCount)
}
- def static boolean containsSegmentPosition(Axis axis, long segmentPosition) {
+ def static boolean containsSegmentPosition(Axis axis, int segmentPosition) {
segmentPosition >= 0 && segmentPosition < axis.segmentCount
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/BigAxis.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/BigAxis.xtend
new file mode 100644
index 0000000..5562c61
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/BigAxis.xtend
@@ -0,0 +1,52 @@
+package org.eclipse.nebula.widgets.nattable.core.layer.axis
+
+import java.io.Serializable
+import java.math.BigDecimal
+import java.math.BigInteger
+import org.eclipse.nebula.widgets.nattable.core.event.EventListener
+import org.eclipse.nebula.widgets.nattable.core.event.EventSource
+
+/**
+ * Represents a linear dimension (e.g. horizontal, vertical) that is composed of segments (e.g. columns, rows).
+ */
+interface BigAxis extends EventSource, EventListener {
+
+ /**
+ * @return The number of segments on this axis.
+ */
+ def BigInteger getSegmentCount()
+
+ /**
+ * Gets the start pixel location of the segment at the given position. This function must be defined for all valid segment position
+ * values and <em>also</em> for segment position = segment count. Technically the segment count is not a valid segment position because
+ * segment positions are 0-indexed and range from 0 to segment count - 1. However, the 'start' pixel location of the segment position after
+ * the last segment is used to calculate the pixel size of the last segment, and also the overall pixel size of the axis.
+ *
+ * @param segmentPosition
+ * @return The start pixel location of the given segment position.
+ */
+ def BigDecimal getStartPixelOfSegmentPosition(BigInteger segmentPosition)
+
+ /**
+ * Gets the position of the segment that is nearest to the the given pixel location.
+ *
+ * @param pixelLocation
+ * @return The position of the segment that contains the given pixel location.
+ * If the given pixel location is less than 0, the segment position returned will be -1.
+ * If the given pixel location is greater than the size of the axis, then the last segment position + 1 will be returned (= segment count).
+ */
+ def BigInteger getSegmentPositionOfPixelLocation(BigDecimal pixelLocation)
+
+ /**
+ * @param segmentPosition
+ * @return The identifier associated with the given segment position.
+ */
+ def Serializable getIdOfSegmentPosition(BigInteger segmentPosition)
+
+ /**
+ * @param segmentId
+ * @return The position of the segment associated with the given segment identifier.
+ */
+ def BigInteger getSegmentPositionOfId(Serializable segmentId)
+
+}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/BigAxisInvariants.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/BigAxisInvariants.xtend
new file mode 100644
index 0000000..4ee0083
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/BigAxisInvariants.xtend
@@ -0,0 +1,27 @@
+package org.eclipse.nebula.widgets.nattable.core.layer.axis
+
+import java.math.BigDecimal
+import java.math.BigInteger
+
+/**
+ * A set of useful utility functions that calculate invariants that must hold for any Axis.
+ */
+class BigAxisInvariants {
+
+ def static getPixelSize(BigAxis axis) {
+ axis.getStartPixelOfSegmentPosition(axis.segmentCount) - axis.getStartPixelOfSegmentPosition(BigInteger::ZERO)
+ }
+
+ def static getPixelSizeOfSegmentPosition(BigAxis axis, BigInteger segmentPosition) {
+ axis.getStartPixelOfSegmentPosition(segmentPosition + BigInteger::ONE) - axis.getStartPixelOfSegmentPosition(segmentPosition)
+ }
+
+ def static boolean containsPixelLocation(BigAxis axis, BigDecimal pixelLocation) {
+ pixelLocation >= BigDecimal::ZERO && pixelLocation < axis.getStartPixelOfSegmentPosition(axis.segmentCount)
+ }
+
+ def static boolean containsSegmentPosition(BigAxis axis, BigInteger segmentPosition) {
+ segmentPosition >= BigInteger::ZERO && segmentPosition < axis.segmentCount
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/AxisImpl.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/AxisImpl.xtend
index a3c9932..10332ef 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/AxisImpl.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/AxisImpl.xtend
@@ -1,7 +1,6 @@
package org.eclipse.nebula.widgets.nattable.core.layer.axis.impl
import java.io.Serializable
-import java.math.BigDecimal
import java.util.TreeMap
import static extension org.eclipse.nebula.widgets.nattable.core.layer.axis.AxisInvariants.*
@@ -11,26 +10,22 @@
*/
class AxisImpl extends AbstractAxis {
- long segmentCount
- BigDecimal defaultSegmentSize
- val segmentSizeMap = new TreeMap<Long, BigDecimal> // segment Position -> pixel size
+ int segmentCount
+ double defaultSegmentSize
+ val segmentSizeMap = new TreeMap<Integer, Double> // segment Position -> pixel size
new() {}
- new(long segmentCount, double defaultSegmentSize) {
- this(segmentCount, new BigDecimal(defaultSegmentSize))
- }
-
- new(long segmentCount, BigDecimal defaultSegmentSize) {
+ new(int segmentCount, double defaultSegmentSize) {
setSegmentCount(segmentCount)
setDefaultSegmentSize(defaultSegmentSize)
}
- def void setSegmentCount(long segmentCount) {
+ def void setSegmentCount(int segmentCount) {
this.segmentCount = segmentCount
}
- def void setDefaultSegmentSize(BigDecimal defaultSegmentSize) {
+ def void setDefaultSegmentSize(double defaultSegmentSize) {
this.defaultSegmentSize = defaultSegmentSize
}
@@ -40,35 +35,35 @@
segmentCount
}
- override getStartPixelOfSegmentPosition(long segmentPosition) {
- if (segmentPosition < 0) return -BigDecimal::ONE
- else if (segmentPosition == 0) return BigDecimal::ZERO
- else if (segmentSizeMap.empty) return new BigDecimal(segmentPosition) * defaultSegmentSize
+ override getStartPixelOfSegmentPosition(int segmentPosition) {
+ if (segmentPosition < 0) return -1
+ else if (segmentPosition == 0) return 0
+ else if (segmentSizeMap.empty) return segmentPosition * defaultSegmentSize
else {
var numResizedSegments = 0
- var resizeAggregate = BigDecimal::ZERO
+ var resizeAggregate = 0.0
- for (resizedSegmentPosition : segmentSizeMap.subMap(0L, segmentPosition).keySet) {
+ for (resizedSegmentPosition : segmentSizeMap.subMap(0, segmentPosition).keySet) {
numResizedSegments = numResizedSegments + 1
resizeAggregate = resizeAggregate + segmentSizeMap.get(resizedSegmentPosition)
}
- return (new BigDecimal(segmentPosition - numResizedSegments) * defaultSegmentSize) + resizeAggregate
+ return ((segmentPosition - numResizedSegments) * defaultSegmentSize) + resizeAggregate
}
}
- override getSegmentPositionOfPixelLocation(BigDecimal pixelLocation) {
- if (pixelLocation < BigDecimal::ZERO) return -1
+ override getSegmentPositionOfPixelLocation(double pixelLocation) {
+ if (pixelLocation < 0) return -1
else if (pixelLocation == 0) return 0
else if (pixelLocation >= pixelSize) return segmentCount
- else if (segmentSizeMap.empty) return (pixelLocation / defaultSegmentSize).longValue
- else return findSegmentPositionOfPixelLocation(pixelLocation, BigDecimal::ZERO, pixelSize, 0, segmentCount)
+ else if (segmentSizeMap.empty) return (pixelLocation / defaultSegmentSize) as int
+ else return findSegmentPositionOfPixelLocation(pixelLocation, 0, pixelSize, 0, segmentCount)
}
- def private long findSegmentPositionOfPixelLocation(BigDecimal pixelLocation, BigDecimal fromPixel, BigDecimal toPixel, long fromSegmentPosition, long toSegmentPosition) {
+ def private int findSegmentPositionOfPixelLocation(double pixelLocation, double fromPixel, double toPixel, int fromSegmentPosition, int toSegmentPosition) {
// guess segment position = pixelLocation / size of guess region
- val guessSegmentSize = (toPixel - fromPixel) / new BigDecimal(toSegmentPosition - fromSegmentPosition)
- val guessSegmentPosition = fromSegmentPosition + ((pixelLocation - fromPixel) / guessSegmentSize).longValue
+ val guessSegmentSize = (toPixel - fromPixel) / (toSegmentPosition - fromSegmentPosition)
+ val guessSegmentPosition = fromSegmentPosition + ((pixelLocation - fromPixel) / guessSegmentSize) as int
// find start/end pixel of guessed segment position
val startPixel = getStartPixelOfSegmentPosition(guessSegmentPosition)
@@ -82,26 +77,22 @@
return guessSegmentPosition
}
- override getIdOfSegmentPosition(long segmentPosition) {
+ override getIdOfSegmentPosition(int segmentPosition) {
segmentPosition
}
override getSegmentPositionOfId(Serializable segmentId) {
if (segmentId != null)
- return (segmentId as Number).longValue
+ return (segmentId as Number).intValue
else
return -1
}
//
- def void setPixelSizeOfSegmentPosition(double size, long segmentPosition) {
- setPixelSizeOfSegmentPosition(new BigDecimal(size), segmentPosition)
- }
-
- def void setPixelSizeOfSegmentPosition(BigDecimal size, long segmentPosition) {
+ def void setPixelSizeOfSegmentPosition(double size, int segmentPosition) {
if (!containsSegmentPosition(segmentPosition)) throw new IllegalArgumentException('''segment position «segmentPosition» is not contained in this axis''')
- if (size < BigDecimal::ZERO) throw new IllegalArgumentException("size must be >= 0")
+ if (size < 0) throw new IllegalArgumentException("size must be >= 0")
segmentSizeMap.put(segmentPosition, size)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/BigAxisImpl.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/BigAxisImpl.xtend
new file mode 100644
index 0000000..9a04513
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/BigAxisImpl.xtend
@@ -0,0 +1,64 @@
+package org.eclipse.nebula.widgets.nattable.core.layer.axis.impl
+
+import java.io.Serializable
+import java.math.BigDecimal
+import java.math.BigInteger
+import org.eclipse.nebula.widgets.nattable.core.event.AbstractEventSourceSink
+import org.eclipse.nebula.widgets.nattable.core.layer.axis.BigAxis
+
+import static extension org.eclipse.nebula.widgets.nattable.core.layer.axis.BigAxisInvariants.*
+
+/**
+ * A simple Axis implementation.
+ */
+class BigAxisImpl extends AbstractEventSourceSink implements BigAxis {
+
+ BigInteger segmentCount
+ BigDecimal defaultSegmentSize
+
+ new() {}
+
+ new(BigInteger segmentCount, BigDecimal defaultSegmentSize) {
+ setSegmentCount(segmentCount)
+ setDefaultSegmentSize(defaultSegmentSize)
+ }
+
+ def void setSegmentCount(BigInteger segmentCount) {
+ this.segmentCount = segmentCount
+ }
+
+ def void setDefaultSegmentSize(BigDecimal defaultSegmentSize) {
+ this.defaultSegmentSize = defaultSegmentSize
+ }
+
+ // Axis interface
+
+ override getSegmentCount() {
+ segmentCount
+ }
+
+ override getStartPixelOfSegmentPosition(BigInteger segmentPosition) {
+ if (segmentPosition < BigInteger::ZERO) return -BigDecimal::ONE
+ else if (segmentPosition == 0) return BigDecimal::ZERO
+ else return new BigDecimal(segmentPosition) * defaultSegmentSize
+ }
+
+ override getSegmentPositionOfPixelLocation(BigDecimal pixelLocation) {
+ if (pixelLocation < BigDecimal::ZERO) return -BigInteger::ONE
+ else if (pixelLocation == BigDecimal::ZERO) return BigInteger::ZERO
+ else if (pixelLocation >= pixelSize) return segmentCount
+ else return (pixelLocation / defaultSegmentSize).toBigInteger
+ }
+
+ override getIdOfSegmentPosition(BigInteger segmentPosition) {
+ segmentPosition
+ }
+
+ override getSegmentPositionOfId(Serializable segmentId) {
+ if (segmentId != null)
+ return BigInteger::valueOf((segmentId as Number).longValue)
+ else
+ return -BigInteger::ONE
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/NotSoBigAxis.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/NotSoBigAxis.xtend
new file mode 100644
index 0000000..164f288
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/NotSoBigAxis.xtend
@@ -0,0 +1,53 @@
+package org.eclipse.nebula.widgets.nattable.core.layer.axis.impl
+
+import java.io.Serializable
+import java.math.BigDecimal
+import java.math.BigInteger
+import org.eclipse.nebula.widgets.nattable.core.event.Event
+import org.eclipse.nebula.widgets.nattable.core.event.EventListener
+import org.eclipse.nebula.widgets.nattable.core.layer.axis.Axis
+import org.eclipse.nebula.widgets.nattable.core.layer.axis.BigAxis
+
+import static extension org.eclipse.nebula.widgets.nattable.core.math.BigIntegerExtensions.*
+
+class NotSoBigAxis implements BigAxis {
+
+ val Axis axis
+
+ new(Axis axis) {
+ this.axis = axis
+ }
+
+ override getSegmentCount() {
+ BigInteger::valueOf(axis.segmentCount)
+ }
+
+ override getStartPixelOfSegmentPosition(BigInteger segmentPosition) {
+ BigDecimal::valueOf(axis.getStartPixelOfSegmentPosition(segmentPosition.intValueExact))
+ }
+
+ override getSegmentPositionOfPixelLocation(BigDecimal pixelLocation) {
+ BigInteger::valueOf(axis.getSegmentPositionOfPixelLocation(pixelLocation.doubleValue))
+ }
+
+ override getIdOfSegmentPosition(BigInteger segmentPosition) {
+ axis.getIdOfSegmentPosition(segmentPosition.intValueExact)
+ }
+
+ override getSegmentPositionOfId(Serializable segmentId) {
+ BigInteger::valueOf(axis.getSegmentPositionOfId(segmentId))
+ }
+
+ override addEventListener(EventListener listener) {
+ axis.addEventListener(listener)
+ }
+
+ override removeEventListener(EventListener listener) {
+ axis.removeEventListener(listener)
+ }
+
+ override handleEvent(Event event) {
+ axis.handleEvent(event)
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/hideshow/HideShowAxis.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/hideshow/HideShowAxis.xtend
index 8665fd4..b30c74a 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/hideshow/HideShowAxis.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/hideshow/HideShowAxis.xtend
@@ -1,7 +1,6 @@
package org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.hideshow
import java.io.Serializable
-import java.math.BigDecimal
import java.util.HashMap
import java.util.TreeMap
import org.eclipse.nebula.widgets.nattable.core.layer.axis.Axis
@@ -16,8 +15,8 @@
*/
class HideShowAxis extends AbstractAxis {
- val hiddenSegmentPositionToIdMap = new TreeMap<Long, Serializable>
- val segmentPositionToStartPixelMap = new HashMap<Long, BigDecimal>
+ val hiddenSegmentPositionToIdMap = new TreeMap<Integer, Serializable>
+ val segmentPositionToStartPixelMap = new HashMap<Integer, Double>
Axis underlyingAxis
@@ -37,12 +36,12 @@
underlyingAxis.segmentCount - hiddenSegmentPositionToIdMap.size
}
- override getStartPixelOfSegmentPosition(long segmentPosition) {
+ override getStartPixelOfSegmentPosition(int segmentPosition) {
val startPixel = segmentPositionToStartPixelMap.get(segmentPosition)
if (startPixel != null)
return startPixel
else {
- var aggregateSize = BigDecimal::ZERO
+ var aggregateSize = 0.0
var position = 0
while (position < segmentPosition) {
@@ -57,8 +56,8 @@
}
}
- override getSegmentPositionOfPixelLocation(BigDecimal pixelLocation) {
- if (pixelLocation < BigDecimal::ZERO) return -1
+ override getSegmentPositionOfPixelLocation(double pixelLocation) {
+ if (pixelLocation < 0) return -1
var segmentPosition = 0
while (segmentPosition <= segmentCount) {
@@ -72,9 +71,9 @@
}
// TODO Optimize. Cache?
- override getIdOfSegmentPosition(long segmentPosition) {
- var numHiddenSegments = 0L
- var fromPosition = 0L
+ override getIdOfSegmentPosition(int segmentPosition) {
+ var numHiddenSegments = 0
+ var fromPosition = 0
var toPosition = segmentPosition
while (toPosition < underlyingAxis.segmentCount) {
@@ -93,7 +92,7 @@
override getSegmentPositionOfId(Serializable segmentId) {
val underlyingSegmentPosition = underlyingAxis.getSegmentPositionOfId(segmentId)
- underlyingSegmentPosition - hiddenSegmentPositionToIdMap.subMap(0L, underlyingSegmentPosition).size
+ underlyingSegmentPosition - hiddenSegmentPositionToIdMap.subMap(0, underlyingSegmentPosition).size
}
//
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/reorder/ReorderAxis.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/reorder/ReorderAxis.xtend
index e339c2b..7abe9df 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/reorder/ReorderAxis.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/axis/impl/reorder/ReorderAxis.xtend
@@ -7,7 +7,6 @@
import org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.AbstractAxis
import static extension org.eclipse.nebula.widgets.nattable.core.layer.axis.AxisInvariants.*
-import java.math.BigDecimal
/**
* An axis that allows reordering of its segments.
@@ -17,7 +16,7 @@
class ReorderAxis extends AbstractAxis {
val List<Serializable> reorderedSegmentIds = newArrayList
- val Map<Long, BigDecimal> segmentPositionToStartPixelMap = newHashMap
+ val Map<Integer, Double> segmentPositionToStartPixelMap = newHashMap
Axis underlyingAxis
@@ -43,12 +42,12 @@
underlyingAxis.segmentCount
}
- override getStartPixelOfSegmentPosition(long segmentPosition) {
+ override getStartPixelOfSegmentPosition(int segmentPosition) {
val startPixel = segmentPositionToStartPixelMap.get(segmentPosition)
if (startPixel != null)
return startPixel
else {
- var aggregateSize = BigDecimal::ZERO
+ var aggregateSize = 0.0
var position = 0
while (position < segmentPosition) {
@@ -63,8 +62,8 @@
}
}
- override getSegmentPositionOfPixelLocation(BigDecimal pixelLocation) {
- if (pixelLocation < BigDecimal::ZERO) return -1
+ override getSegmentPositionOfPixelLocation(double pixelLocation) {
+ if (pixelLocation < 0) return -1
var segmentPosition = 0
while (segmentPosition <= segmentCount) {
@@ -77,8 +76,8 @@
return segmentCount
}
- override getIdOfSegmentPosition(long segmentPosition) {
- reorderedSegmentIds.get(segmentPosition as int)
+ override getIdOfSegmentPosition(int segmentPosition) {
+ reorderedSegmentIds.get(segmentPosition)
}
override getSegmentPositionOfId(Serializable segmentId) {
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/BigCell.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/BigCell.xtend
new file mode 100644
index 0000000..d2ce45b
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/BigCell.xtend
@@ -0,0 +1,32 @@
+package org.eclipse.nebula.widgets.nattable.core.layer.cell
+
+import org.eclipse.nebula.widgets.nattable.core.geometry.BigPositionRectangle
+import org.eclipse.nebula.widgets.nattable.core.layer.BigLayer
+
+/**
+ * Represents a particular cell within a Layer.
+ */
+interface BigCell {
+
+ /**
+ * @return The Layer that this cell belongs to.
+ */
+ def BigLayer getLayer()
+
+ /**
+ * @return The position bounds of this cell within its layer. These bounds will consist of an origin column and row position
+ * and a column and row span.
+ */
+ def BigPositionRectangle getPositionBounds()
+
+ /**
+ * @return The data value associated with this cell.
+ */
+ def Object getDataValue()
+
+ /**
+ * Sets a new value for the data associated with this cell.
+ */
+ def void setDataValue(Object newValue)
+
+}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/AbstractCell.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/AbstractCell.xtend
index 7696c0a..6ceb088 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/AbstractCell.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/AbstractCell.xtend
@@ -12,11 +12,11 @@
val Layer layer
val PositionRectangle positionBounds
- new(Layer layer, long columnPosition, long rowPosition) {
+ new(Layer layer, int columnPosition, int rowPosition) {
this(layer, columnPosition, rowPosition, 1, 1)
}
- new(Layer layer, long columnPosition, long rowPosition, long columnSpan, long rowSpan) {
+ new(Layer layer, int columnPosition, int rowPosition, int columnSpan, int rowSpan) {
this.layer = layer
this.positionBounds = new PositionRectangle(columnPosition, rowPosition, columnSpan, rowSpan)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/BigReadOnlyCell.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/BigReadOnlyCell.xtend
new file mode 100644
index 0000000..8e90db8
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/BigReadOnlyCell.xtend
@@ -0,0 +1,34 @@
+package org.eclipse.nebula.widgets.nattable.core.layer.cell.impl
+
+import java.math.BigInteger
+import org.eclipse.nebula.widgets.nattable.core.geometry.BigPositionRectangle
+import org.eclipse.nebula.widgets.nattable.core.layer.BigLayer
+import org.eclipse.nebula.widgets.nattable.core.layer.cell.BigCell
+
+/**
+ * A simple Cell that supports reading but not writing its data value.
+ */
+class BigReadOnlyCell implements BigCell {
+
+ val BigLayer layer
+ val BigPositionRectangle positionBounds
+ val Object dataValue
+
+ new(BigLayer layer, BigInteger columnPosition, BigInteger rowPosition, Object dataValue) {
+ this.layer = layer
+ this.positionBounds = new BigPositionRectangle(columnPosition, rowPosition, BigInteger::ONE, BigInteger::ONE)
+ this.dataValue = dataValue
+ }
+
+ // Cell interface
+
+ override getLayer() { layer }
+ override getPositionBounds() { positionBounds }
+
+ override getDataValue() { dataValue }
+
+ override setDataValue(Object newValue) {
+ throw new UnsupportedOperationException("TODO: auto-generated method stub")
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/LayerDataAccessorCell.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/LayerDataAccessorCell.xtend
index 4da5c34..c9d7112 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/LayerDataAccessorCell.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/LayerDataAccessorCell.xtend
@@ -12,7 +12,7 @@
val LayerDataAccessor layerDataAccessor
- new(Layer layer, long columnPosition, long rowPosition, LayerDataAccessor layerDataAccessor) {
+ new(Layer layer, int columnPosition, int rowPosition, LayerDataAccessor layerDataAccessor) {
super(layer, columnPosition, rowPosition)
this.layerDataAccessor = layerDataAccessor
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/NotSoBigCell.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/NotSoBigCell.xtend
new file mode 100644
index 0000000..dd244f1
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/NotSoBigCell.xtend
@@ -0,0 +1,34 @@
+package org.eclipse.nebula.widgets.nattable.core.layer.cell.impl
+
+import java.math.BigInteger
+import org.eclipse.nebula.widgets.nattable.core.geometry.BigPositionRectangle
+import org.eclipse.nebula.widgets.nattable.core.layer.cell.BigCell
+import org.eclipse.nebula.widgets.nattable.core.layer.cell.Cell
+import org.eclipse.nebula.widgets.nattable.core.layer.impl.NotSoBigLayer
+
+class NotSoBigCell implements BigCell {
+
+ val Cell cell
+
+ new(Cell cell) {
+ this.cell = cell
+ }
+
+ override getLayer() {
+ new NotSoBigLayer(cell.layer)
+ }
+
+ override getPositionBounds() {
+ val bounds = cell.positionBounds
+ new BigPositionRectangle(BigInteger::valueOf(bounds.columnPosition), BigInteger::valueOf(bounds.rowPosition), BigInteger::valueOf(bounds.width), BigInteger::valueOf(bounds.height))
+ }
+
+ override getDataValue() {
+ cell.dataValue
+ }
+
+ override setDataValue(Object newValue) {
+ cell.dataValue = newValue
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/ReadOnlyCell.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/ReadOnlyCell.xtend
index d869358..de34212 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/ReadOnlyCell.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/cell/impl/ReadOnlyCell.xtend
@@ -9,7 +9,7 @@
val Object dataValue
- new(Layer layer, long columnPosition, long rowPosition, Object dataValue) {
+ new(Layer layer, int columnPosition, int rowPosition, Object dataValue) {
super(layer, columnPosition, rowPosition)
this.dataValue = dataValue
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/BigDummyLayer.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/BigDummyLayer.xtend
new file mode 100644
index 0000000..02f9bac
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/BigDummyLayer.xtend
@@ -0,0 +1,50 @@
+package org.eclipse.nebula.widgets.nattable.core.layer.impl
+
+import java.math.BigInteger
+import org.eclipse.nebula.widgets.nattable.core.command.Command
+import org.eclipse.nebula.widgets.nattable.core.event.AbstractEventSourceSink
+import org.eclipse.nebula.widgets.nattable.core.layer.BigLayer
+import org.eclipse.nebula.widgets.nattable.core.layer.axis.BigAxis
+import org.eclipse.nebula.widgets.nattable.core.layer.cell.impl.BigReadOnlyCell
+
+/**
+ * A layer whose cell data values are strings indicating their column and row identifiers.
+ */
+class BigDummyLayer extends AbstractEventSourceSink implements BigLayer {
+
+ BigAxis horizontalAxis
+ BigAxis verticalAxis
+
+ new() {}
+
+ new(BigAxis horizontalAxis, BigAxis verticalAxis) {
+ setHorizontalAxis(horizontalAxis)
+ setVerticalAxis(verticalAxis)
+ }
+
+ def void setHorizontalAxis(BigAxis horizontalAxis) {
+ this.horizontalAxis = horizontalAxis
+ this.horizontalAxis.addEventListener(this)
+ }
+
+ def void setVerticalAxis(BigAxis verticalAxis) {
+ this.verticalAxis = verticalAxis
+ this.verticalAxis.addEventListener(this)
+ }
+
+ // Layer interface
+
+ override getHorizontalAxis() { horizontalAxis }
+ override getVerticalAxis() { verticalAxis }
+
+ override getCell(BigInteger columnPosition, BigInteger rowPosition) {
+ val columnId = horizontalAxis.getIdOfSegmentPosition(columnPosition)
+ val rowId = verticalAxis.getIdOfSegmentPosition(rowPosition)
+ new BigReadOnlyCell(this, columnPosition, rowPosition, '''Column «columnId», Row «rowId»''')
+ }
+
+ override doCommand(Command command) {
+ // Do nothing
+ }
+
+}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/CellLayerPainter.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/CellLayerPainter.xtend
index f77fd2c..16c1302 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/CellLayerPainter.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/CellLayerPainter.xtend
@@ -1,6 +1,5 @@
package org.eclipse.nebula.widgets.nattable.core.layer.impl
-import java.math.BigDecimal
import org.eclipse.nebula.widgets.nattable.core.geometry.PixelArea
import org.eclipse.nebula.widgets.nattable.core.geometry.PixelRectangle
import org.eclipse.nebula.widgets.nattable.core.graphics.GraphicsContext
@@ -22,23 +21,23 @@
// LayerPainter interface
override paintLayer(Layer layer, PixelArea layerPaintArea, GraphicsContext gc) {
- val layerPixelBounds = new PixelRectangle(BigDecimal::ZERO, BigDecimal::ZERO, layerPaintArea.width, layerPaintArea.height)
+ val layerPixelBounds = new PixelRectangle(0, 0, layerPaintArea.width, layerPaintArea.height)
val clipBounds = gc.clipBounds
// Clear background
gc.clearRectangle(layerPixelBounds)
val fromColumnPosition = max(layer.getColumnPositionOfXPixel(clipBounds.x), 0)
- val toColumnPosition = min(layer.getColumnPositionOfXPixel(clipBounds.x + clipBounds.width - BigDecimal::ONE), layer.columnCount - 1)
+ val toColumnPosition = min(layer.getColumnPositionOfXPixel(clipBounds.x + clipBounds.width - 1), layer.columnCount - 1)
val columnRange = toColumnPosition - fromColumnPosition
val fromRowPosition = max(layer.getRowPositionOfYPixel(clipBounds.y), 0)
- val toRowPosition = min(layer.getRowPositionOfYPixel(clipBounds.y + clipBounds.height - BigDecimal::ONE), layer.rowCount - 1)
+ val toRowPosition = min(layer.getRowPositionOfYPixel(clipBounds.y + clipBounds.height - 1), layer.rowCount - 1)
val rowRange = toRowPosition - fromRowPosition
if (columnRange >= 0 && columnRange <= Integer::MAX_VALUE && rowRange >= 0 && rowRange <= Integer::MAX_VALUE) {
- for (columnOffset : 0 .. columnRange as int)
- for (rowOffset : 0 .. rowRange as int) {
+ for (columnOffset : 0 .. columnRange)
+ for (rowOffset : 0 .. rowRange) {
val cell = layer.getCell(fromColumnPosition + columnOffset, fromRowPosition + rowOffset)
gc.pushState
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/DimensionallyDependentLayer.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/DimensionallyDependentLayer.xtend
index db5918c..7cccb08 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/DimensionallyDependentLayer.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/DimensionallyDependentLayer.xtend
@@ -35,7 +35,7 @@
override getHorizontalAxis() { horizontalAxis }
override getVerticalAxis() { verticalAxis }
- override getCell(long columnPosition, long rowPosition) {
+ override getCell(int columnPosition, int rowPosition) {
new LayerDataAccessorCell(this, columnPosition, rowPosition, layerDataAccessor)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/DummyLayer.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/DummyLayer.xtend
index 25856eb..8314bb2 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/DummyLayer.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/DummyLayer.xtend
@@ -33,7 +33,7 @@
override getHorizontalAxis() { horizontalAxis }
override getVerticalAxis() { verticalAxis }
- override getCell(long columnPosition, long rowPosition) {
+ override getCell(int columnPosition, int rowPosition) {
val columnId = horizontalAxis.getIdOfSegmentPosition(columnPosition)
val rowId = verticalAxis.getIdOfSegmentPosition(rowPosition)
new ReadOnlyCell(this, columnPosition, rowPosition, '''Column «columnId», Row «rowId»''')
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/GridLineCellLayerPainter.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/GridLineCellLayerPainter.xtend
index ff923ff..526c9aa 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/GridLineCellLayerPainter.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/GridLineCellLayerPainter.xtend
@@ -1,6 +1,5 @@
package org.eclipse.nebula.widgets.nattable.core.layer.impl
-import java.math.BigDecimal
import org.eclipse.nebula.widgets.nattable.core.geometry.PixelArea
import org.eclipse.nebula.widgets.nattable.core.geometry.PixelRectangle
import org.eclipse.nebula.widgets.nattable.core.graphics.Color
@@ -32,8 +31,8 @@
new PixelRectangle(
pixelBounds.x,
pixelBounds.y,
- pixelBounds.width - BigDecimal::ONE,
- pixelBounds.height - BigDecimal::ONE
+ pixelBounds.width - 1,
+ pixelBounds.height - 1
)
}
@@ -55,8 +54,8 @@
val toRowPosition = min(layer.getRowPositionOfYPixel(clipBounds.y + clipBounds.height), layer.rowCount)
val rowRange = toRowPosition - fromRowPosition
if (rowRange >= 0 && rowRange <= Integer::MAX_VALUE)
- for (rowOffset : 0 .. rowRange as int) {
- val y = (layer.getStartYPixelOfRowPosition(fromRowPosition + rowOffset) - BigDecimal::ONE).doubleValue
+ for (rowOffset : 0 .. rowRange) {
+ val y = (layer.getStartYPixelOfRowPosition(fromRowPosition + rowOffset) - 1).doubleValue
gc.drawLine(
0, y,
pixelWidth, y
@@ -68,8 +67,8 @@
val toColumnPosition = min(layer.getColumnPositionOfXPixel(clipBounds.x + clipBounds.width), layer.columnCount)
val columnRange = toColumnPosition - fromColumnPosition
if (columnRange >= 0 && columnRange <= Integer::MAX_VALUE)
- for (columnOffset : 0 .. columnRange as int) {
- val x = (layer.getStartXPixelOfColumnPosition(fromColumnPosition + columnOffset) - BigDecimal::ONE).doubleValue
+ for (columnOffset : 0 .. columnRange) {
+ val x = (layer.getStartXPixelOfColumnPosition(fromColumnPosition + columnOffset) - 1).doubleValue
gc.drawLine(
x, 0,
x, pixelHeight
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/ListRowDataLayer.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/ListRowDataLayer.xtend
index 2d86b7d..aaf29de 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/ListRowDataLayer.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/ListRowDataLayer.xtend
@@ -45,9 +45,9 @@
override getHorizontalAxis() { horizontalAxis }
override getVerticalAxis() { verticalAxis }
- override getCell(long columnPosition, long rowPosition) {
+ override getCell(int columnPosition, int rowPosition) {
if (rowPosition <= Integer::MAX_VALUE) {
- val rowObject = list.get(rowPosition as int)
+ val rowObject = list.get(rowPosition)
val propertyId = horizontalAxis.getIdOfSegmentPosition(columnPosition)
val value = rowObject.getPropertyValue(propertyId)
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/NotSoBigLayer.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/NotSoBigLayer.xtend
new file mode 100644
index 0000000..ed21098
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/NotSoBigLayer.xtend
@@ -0,0 +1,58 @@
+package org.eclipse.nebula.widgets.nattable.core.layer.impl
+
+import java.math.BigInteger
+import org.eclipse.nebula.widgets.nattable.core.command.Command
+import org.eclipse.nebula.widgets.nattable.core.event.Event
+import org.eclipse.nebula.widgets.nattable.core.event.EventListener
+import org.eclipse.nebula.widgets.nattable.core.layer.BigLayer
+import org.eclipse.nebula.widgets.nattable.core.layer.Layer
+import org.eclipse.nebula.widgets.nattable.core.layer.axis.BigAxis
+import org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.NotSoBigAxis
+import org.eclipse.nebula.widgets.nattable.core.layer.cell.impl.NotSoBigCell
+
+import static extension org.eclipse.nebula.widgets.nattable.core.math.BigIntegerExtensions.*
+
+class NotSoBigLayer implements BigLayer {
+
+ val Layer layer
+
+ BigAxis horizontalAxis
+ BigAxis verticalAxis
+
+ new(Layer layer) {
+ this.layer = layer
+ }
+
+ override getHorizontalAxis() {
+ if (horizontalAxis == null)
+ horizontalAxis = new NotSoBigAxis(layer.horizontalAxis)
+ horizontalAxis
+ }
+
+ override getVerticalAxis() {
+ if (verticalAxis == null)
+ verticalAxis = new NotSoBigAxis(layer.verticalAxis)
+ verticalAxis
+ }
+
+ override getCell(BigInteger columnPosition, BigInteger rowPosition) {
+ new NotSoBigCell(layer.getCell(columnPosition.intValueExact, rowPosition.intValueExact))
+ }
+
+ override doCommand(Command command) {
+ layer.doCommand(command)
+ }
+
+ override addEventListener(EventListener listener) {
+ layer.addEventListener(listener)
+ }
+
+ override removeEventListener(EventListener listener) {
+ layer.removeEventListener(listener)
+ }
+
+ override handleEvent(Event event) {
+ layer.handleEvent(event)
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeAxis.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeAxis.xtend
index f922df8..8f812bb 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeAxis.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeAxis.xtend
@@ -1,7 +1,6 @@
package org.eclipse.nebula.widgets.nattable.core.layer.impl.composite
import java.io.Serializable
-import java.math.BigDecimal
import org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.AbstractAxis
import static extension org.eclipse.nebula.widgets.nattable.core.layer.axis.AxisInvariants.*
@@ -28,12 +27,12 @@
// Axis interface
override getSegmentCount() {
- subLayers.fold(0L, [ acc, layer | acc + layer.axis.segmentCount ])
+ subLayers.fold(0, [ acc, layer | acc + layer.axis.segmentCount ])
}
- override getStartPixelOfSegmentPosition(long segmentPosition) {
- var segmentOffset = 0L
- var pixelOffset = BigDecimal::ZERO
+ override getStartPixelOfSegmentPosition(int segmentPosition) {
+ var segmentOffset = 0
+ var pixelOffset = 0.0
for (subLayer : subLayers) {
val subAxis = subLayer.axis
@@ -49,12 +48,12 @@
pixelOffset
}
- override getSegmentPositionOfPixelLocation(BigDecimal pixelLocation) {
- if (pixelLocation < BigDecimal::ZERO) return -1
+ override getSegmentPositionOfPixelLocation(double pixelLocation) {
+ if (pixelLocation < 0) return -1
if (pixelLocation >= pixelSize) return segmentCount
- var segmentOffset = 0L
- var pixelOffset = BigDecimal::ZERO
+ var segmentOffset = 0
+ var pixelOffset = 0.0
for (subLayer : subLayers) {
val subAxis = subLayer.axis
@@ -70,8 +69,8 @@
segmentOffset
}
- override getIdOfSegmentPosition(long segmentPosition) {
- var segmentOffset = 0L
+ override getIdOfSegmentPosition(int segmentPosition) {
+ var segmentOffset = 0
for (subLayer : subLayers) {
val subAxis = subLayer.axis
@@ -87,7 +86,7 @@
}
override getSegmentPositionOfId(Serializable segmentId) {
- var segmentOffset = 0L
+ var segmentOffset = 0
for (subLayer : subLayers) {
val subAxis = subLayer.axis
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeCell.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeCell.xtend
index c43878e..717834f 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeCell.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeCell.xtend
@@ -7,10 +7,10 @@
val CompositeLayer compositeLayer
val Cell subLayerCell
- val long columnPositionOffset
- val long rowPositionOffset
+ val int columnPositionOffset
+ val int rowPositionOffset
- new(CompositeLayer compositeLayer, Cell subLayerCell, long columnPositionOffset, long rowPositionOffset) {
+ new(CompositeLayer compositeLayer, Cell subLayerCell, int columnPositionOffset, int rowPositionOffset) {
this.compositeLayer = compositeLayer
this.subLayerCell = subLayerCell
this.columnPositionOffset = columnPositionOffset
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayer.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayer.xtend
index 9ddcc0e..828a356 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayer.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayer.xtend
@@ -46,7 +46,7 @@
override CompositeAxis getHorizontalAxis() { horizontalAxis }
override CompositeAxis getVerticalAxis() { verticalAxis }
- override getCell(long columnPosition, long rowPosition) {
+ override getCell(int columnPosition, int rowPosition) {
val xLayoutInfo = horizontalAxis.getSubLayerLayoutPositionInfo(columnPosition)
val yLayoutInfo = verticalAxis.getSubLayerLayoutPositionInfo(rowPosition)
@@ -64,11 +64,11 @@
//
- def private CompositeLayoutInfo getSubLayerLayoutPositionInfo(CompositeAxis compositeAxis, long segmentPosition) {
+ def private CompositeLayoutInfo getSubLayerLayoutPositionInfo(CompositeAxis compositeAxis, int segmentPosition) {
val subLayers = compositeAxis.subLayers
val axisAccessor = compositeAxis.axisAccessor
- var segmentOffset = 0L
+ var segmentOffset = 0
for (layoutPosition : 0 ..< subLayers.size) {
val axis = axisAccessor.getAxis(subLayers.get(layoutPosition))
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayerPainter.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayerPainter.xtend
index 7f3b989..9de07f5 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayerPainter.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayerPainter.xtend
@@ -1,6 +1,5 @@
package org.eclipse.nebula.widgets.nattable.core.layer.impl.composite
-import java.math.BigDecimal
import javax.inject.Inject
import org.eclipse.nebula.widgets.nattable.core.geometry.PixelArea
import org.eclipse.nebula.widgets.nattable.core.geometry.PixelRectangle
@@ -15,12 +14,12 @@
@Inject extension PainterFactory
override paintLayer(CompositeLayer compositeLayer, PixelArea layerPaintArea, GraphicsContext gc) {
- var yOffset = BigDecimal::ZERO
+ var yOffset = 0.0
for (compositeRowPosition : 0 ..< compositeLayer.rows.size) {
val compositeRow = compositeLayer.rows.get(compositeRowPosition)
val isLastCompositeRow = compositeRowPosition == compositeLayer.rows.size - 1
- var xOffset = BigDecimal::ZERO
+ var xOffset = 0.0
for (compositeColumnPosition : 0 ..< compositeRow.childLayers.size) {
val childLayer = compositeRow.childLayers.get(compositeColumnPosition)
val isLastCompositeColumn = compositeColumnPosition == compositeRow.childLayers.size - 1
@@ -32,7 +31,7 @@
val pixelHeight = if (isLastCompositeRow) layerPaintArea.height - yOffset else childLayer.pixelHeight
val childLayerPaintArea = new PixelArea(pixelWidth, pixelHeight)
- gc.clipBounds = new PixelRectangle(BigDecimal::ZERO, BigDecimal::ZERO, pixelWidth, pixelHeight)
+ gc.clipBounds = new PixelRectangle(0, 0, pixelWidth, pixelHeight)
childLayer.layerPainter.paintLayer(childLayer, childLayerPaintArea, gc)
gc.popState
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayoutInfo.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayoutInfo.xtend
index 4d895a6..61ee7a2 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayoutInfo.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayoutInfo.xtend
@@ -4,6 +4,6 @@
class CompositeLayoutInfo {
int layoutPosition
- long segmentOffset
+ int segmentOffset
}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/header/ColumnHeaderLayer.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/header/ColumnHeaderLayer.xtend
index f6fbc43..08987dc 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/header/ColumnHeaderLayer.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/header/ColumnHeaderLayer.xtend
@@ -39,7 +39,7 @@
override getHorizontalAxis() { horizontalAxis }
override getVerticalAxis() { verticalAxis }
- override getCell(long columnPosition, long rowPosition) {
+ override getCell(int columnPosition, int rowPosition) {
new LayerDataAccessorCell(this, columnPosition, rowPosition, layerDataAccessor)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/header/RowHeaderLayer.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/header/RowHeaderLayer.xtend
index b12fdbc..39b3077 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/header/RowHeaderLayer.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/header/RowHeaderLayer.xtend
@@ -39,7 +39,7 @@
override getHorizontalAxis() { horizontalAxis }
override getVerticalAxis() { verticalAxis }
- override getCell(long columnPosition, long rowPosition) {
+ override getCell(int columnPosition, int rowPosition) {
new LayerDataAccessorCell(this, columnPosition, rowPosition, layerDataAccessor)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportAxis.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportAxis.xtend
index 5badd5c..ee390d5 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportAxis.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportAxis.xtend
@@ -2,14 +2,16 @@
import java.io.Serializable
import java.math.BigDecimal
-import org.eclipse.nebula.widgets.nattable.core.layer.axis.Axis
+import java.math.BigInteger
+import org.eclipse.nebula.widgets.nattable.core.layer.axis.BigAxis
import org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.AbstractAxis
-import static extension org.eclipse.nebula.widgets.nattable.core.layer.axis.AxisInvariants.*
+import static extension org.eclipse.nebula.widgets.nattable.core.layer.axis.BigAxisInvariants.*
+import static extension org.eclipse.nebula.widgets.nattable.core.math.BigIntegerExtensions.*
class ViewportAxis extends AbstractAxis {
- val Axis underlyingAxis
+ val BigAxis underlyingAxis
val ViewportAxisListener viewportAxisListener
/**
@@ -20,7 +22,7 @@
BigDecimal pixelOrigin = BigDecimal::ZERO
- new(Axis underlyingAxis, ViewportAxisListener viewportAxisListener) {
+ new(BigAxis underlyingAxis, ViewportAxisListener viewportAxisListener) {
this.underlyingAxis = underlyingAxis
this.viewportAxisListener = viewportAxisListener
}
@@ -29,7 +31,7 @@
def getVisiblePixelSize() {
if (visiblePixelSize >= BigDecimal::ZERO) visiblePixelSize
- else underlyingAxis.pixelSize
+ else BigDecimal::TEN
}
def setVisiblePixelSize(double visiblePixelSize) {
@@ -51,7 +53,7 @@
viewportAxisListener?.viewportAxisChanged
}
- def long getOriginSegmentPosition() {
+ def getOriginSegmentPosition() {
underlyingAxis.getSegmentPositionOfPixelLocation(pixelOrigin)
}
@@ -68,26 +70,27 @@
val endPixel = pixelOrigin + getVisiblePixelSize
val endSegmentPosition = underlyingAxis.getSegmentPositionOfPixelLocation(endPixel)
val isEndPixelInsideEndSegment = endPixel > underlyingAxis.getStartPixelOfSegmentPosition(endSegmentPosition) && endPixel < underlyingAxis.getStartPixelOfSegmentPosition(underlyingAxis.segmentCount)
- (endSegmentPosition + if (isEndPixelInsideEndSegment) 1 else 0) - originSegmentPosition
+ val segmentCount = endSegmentPosition - originSegmentPosition
+ segmentCount.intValueExact + if (isEndPixelInsideEndSegment) 1 else 0
}
- override getStartPixelOfSegmentPosition(long segmentPosition) {
- underlyingAxis.getStartPixelOfSegmentPosition(originSegmentPosition + segmentPosition) - pixelOrigin
+ override getStartPixelOfSegmentPosition(int segmentPosition) {
+ (underlyingAxis.getStartPixelOfSegmentPosition(originSegmentPosition + BigInteger::valueOf(segmentPosition)) - pixelOrigin).doubleValue
}
- override getSegmentPositionOfPixelLocation(BigDecimal pixelLocation) {
- val underlyingPixelLocation = pixelOrigin + pixelLocation
+ override getSegmentPositionOfPixelLocation(double pixelLocation) {
+ val underlyingPixelLocation = pixelOrigin + BigDecimal::valueOf(pixelLocation)
if (underlyingPixelLocation < BigDecimal::ZERO) return -1
- if (underlyingPixelLocation >= underlyingAxis.pixelSize) return segmentCount
- underlyingAxis.getSegmentPositionOfPixelLocation(underlyingPixelLocation) - originSegmentPosition
+ if (underlyingPixelLocation >= underlyingAxis.pixelSize) return getSegmentCount()
+ (underlyingAxis.getSegmentPositionOfPixelLocation(underlyingPixelLocation) - originSegmentPosition).intValueExact
}
- override getIdOfSegmentPosition(long segmentPosition) {
- underlyingAxis.getIdOfSegmentPosition(originSegmentPosition + segmentPosition)
+ override getIdOfSegmentPosition(int segmentPosition) {
+ underlyingAxis.getIdOfSegmentPosition(originSegmentPosition + BigInteger::valueOf(segmentPosition))
}
override getSegmentPositionOfId(Serializable segmentId) {
- underlyingAxis.getSegmentPositionOfId(segmentId) - originSegmentPosition
+ (underlyingAxis.getSegmentPositionOfId(segmentId) - originSegmentPosition).intValueExact
}
}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportCell.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportCell.xtend
index f936ebd..13e9e51 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportCell.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportCell.xtend
@@ -1,15 +1,18 @@
package org.eclipse.nebula.widgets.nattable.core.layer.impl.viewport
+import java.math.BigInteger
import org.eclipse.nebula.widgets.nattable.core.geometry.PositionRectangle
import org.eclipse.nebula.widgets.nattable.core.layer.cell.Cell
+import static extension org.eclipse.nebula.widgets.nattable.core.math.BigIntegerExtensions.*
+
class ViewportCell implements Cell {
val ViewportLayer viewportLayer
- val long columnPosition
- val long rowPosition
+ val int columnPosition
+ val int rowPosition
- new(ViewportLayer viewportLayer, long columnPosition, long rowPosition) {
+ new(ViewportLayer viewportLayer, int columnPosition, int rowPosition) {
this.viewportLayer = viewportLayer
this.columnPosition = columnPosition
this.rowPosition = rowPosition
@@ -20,10 +23,10 @@
override getPositionBounds() {
val underlyingPositionBounds = underlyingCell.positionBounds
new PositionRectangle(
- underlyingPositionBounds.columnPosition - viewportLayer.horizontalAxis.originSegmentPosition,
- underlyingPositionBounds.rowPosition - viewportLayer.verticalAxis.originSegmentPosition,
- underlyingPositionBounds.width,
- underlyingPositionBounds.height
+ (underlyingPositionBounds.columnPosition - viewportLayer.horizontalAxis.originSegmentPosition).intValueExact,
+ (underlyingPositionBounds.rowPosition - viewportLayer.verticalAxis.originSegmentPosition).intValueExact,
+ underlyingPositionBounds.width.intValueExact,
+ underlyingPositionBounds.height.intValueExact
)
}
@@ -37,8 +40,8 @@
def getUnderlyingCell() {
viewportLayer.underlyingLayer.getCell(
- viewportLayer.horizontalAxis.originSegmentPosition + columnPosition,
- viewportLayer.verticalAxis.originSegmentPosition + rowPosition
+ viewportLayer.horizontalAxis.originSegmentPosition + BigInteger::valueOf(columnPosition),
+ viewportLayer.verticalAxis.originSegmentPosition + BigInteger::valueOf(rowPosition)
)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportLayer.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportLayer.xtend
index 1de8c01..7f79f19 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportLayer.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/viewport/ViewportLayer.xtend
@@ -1,22 +1,32 @@
package org.eclipse.nebula.widgets.nattable.core.layer.impl.viewport
import org.eclipse.nebula.widgets.nattable.core.geometry.PixelRectangle
+import org.eclipse.nebula.widgets.nattable.core.layer.BigLayer
import org.eclipse.nebula.widgets.nattable.core.layer.Layer
import org.eclipse.nebula.widgets.nattable.core.layer.impl.AbstractLayer
+import org.eclipse.nebula.widgets.nattable.core.layer.impl.NotSoBigLayer
class ViewportLayer extends AbstractLayer {
- Layer underlyingLayer
+ BigLayer underlyingLayer
ViewportAxis horizontalAxis
ViewportAxis verticalAxis
new() {}
new(Layer underlyingLayer) {
+ this(new NotSoBigLayer(underlyingLayer))
+ }
+
+ new(BigLayer underlyingLayer) {
setUnderlyingLayer(underlyingLayer)
}
def void setUnderlyingLayer(Layer underlyingLayer) {
+ setUnderlyingLayer(new NotSoBigLayer(underlyingLayer))
+ }
+
+ def void setUnderlyingLayer(BigLayer underlyingLayer) {
this.underlyingLayer = underlyingLayer
this.underlyingLayer.addEventListener(this)
@@ -29,14 +39,14 @@
verticalAxis.visiblePixelSize = visiblePixelRectangle.height
}
- def Layer getUnderlyingLayer() { underlyingLayer }
+ def BigLayer getUnderlyingLayer() { underlyingLayer }
// Layer interface
override ViewportAxis getHorizontalAxis() { horizontalAxis }
override ViewportAxis getVerticalAxis() { verticalAxis }
- override getCell(long columnPosition, long rowPosition) {
+ override getCell(int columnPosition, int rowPosition) {
new ViewportCell(this, columnPosition, rowPosition)
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/math/BigIntegerExtensions.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/math/BigIntegerExtensions.xtend
new file mode 100644
index 0000000..3c3ccc0
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/math/BigIntegerExtensions.xtend
@@ -0,0 +1,14 @@
+package org.eclipse.nebula.widgets.nattable.core.math
+
+import java.math.BigInteger
+
+class BigIntegerExtensions {
+
+ def static int intValueExact(BigInteger bigInteger) {
+ if (bigInteger > BigInteger::valueOf(Integer::MAX_VALUE))
+ throw new IllegalStateException('''Segment count «bigInteger» exceeds integer range''')
+ else
+ bigInteger.intValue
+ }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.renderer.swt.example/src/org/eclipse/nebula/widgets/nattable/renderer/swt/example/SWTNatExamplesRunner.xtend b/org.eclipse.nebula.widgets.nattable.renderer.swt.example/src/org/eclipse/nebula/widgets/nattable/renderer/swt/example/SWTNatExamplesRunner.xtend
index 904ed73..6fe0259 100644
--- a/org.eclipse.nebula.widgets.nattable.renderer.swt.example/src/org/eclipse/nebula/widgets/nattable/renderer/swt/example/SWTNatExamplesRunner.xtend
+++ b/org.eclipse.nebula.widgets.nattable.renderer.swt.example/src/org/eclipse/nebula/widgets/nattable/renderer/swt/example/SWTNatExamplesRunner.xtend
@@ -1,7 +1,6 @@
package org.eclipse.nebula.widgets.nattable.renderer.swt.example
import com.google.inject.Guice
-import com.google.inject.Injector
import java.util.HashMap
import org.eclipse.jface.viewers.TreeSelection
import org.eclipse.jface.viewers.TreeViewer
@@ -30,8 +29,6 @@
//
- val extension Injector injector = Guice::createInjector(new SWTNatTableModule)
-
val int shellWidth
val int shellHeight
@@ -87,8 +84,7 @@
// Stop
exampleNode.natExample.stop
- val exampleControl = exampleControlMap.get(exampleNode)
- exampleControl.dispose
+ exampleControlMap.remove(exampleNode)?.dispose
}
tabFolder.dispose
@@ -105,7 +101,7 @@
// Create example control
val exampleControl = new SWTNatTable(tabComposite) => [
- it.injectMembers
+ Guice::createInjector(new SWTNatTableModule).injectMembers(it)
layoutData = new GridData(GridData::FILL_BOTH)
layer = node.natExample.createLayer
]
@@ -134,13 +130,9 @@
node.natExample.stop
// Dispose associated control
- val control = exampleControlMap.get(node)
- if (control != null && !control.disposed) {
+ val control = exampleControlMap.remove(node)
+ if (control != null && !control.disposed)
control.dispose
- }
-
- // Remove from map
- exampleControlMap.remove(node)
])
]
diff --git a/org.eclipse.nebula.widgets.nattable.renderer.swt.test/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/AbstractScrollBarHandlerTest.xtend b/org.eclipse.nebula.widgets.nattable.renderer.swt.test/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/AbstractScrollBarHandlerTest.xtend
index 4b79de3..6a94a4e 100644
--- a/org.eclipse.nebula.widgets.nattable.renderer.swt.test/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/AbstractScrollBarHandlerTest.xtend
+++ b/org.eclipse.nebula.widgets.nattable.renderer.swt.test/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/AbstractScrollBarHandlerTest.xtend
@@ -1,8 +1,9 @@
package org.eclipse.nebula.widgets.nattable.renderer.swt.layer.viewport
import java.math.BigDecimal
-import org.eclipse.nebula.widgets.nattable.core.layer.axis.Axis
-import org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.AxisImpl
+import java.math.BigInteger
+import org.eclipse.nebula.widgets.nattable.core.layer.axis.BigAxis
+import org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.BigAxisImpl
import org.eclipse.nebula.widgets.nattable.core.layer.impl.viewport.ViewportAxis
import org.eclipse.swt.widgets.ScrollBar
import org.junit.Before
@@ -12,17 +13,13 @@
abstract class AbstractScrollBarHandlerTest {
- Axis underlyingAxis
+ BigAxis underlyingAxis
protected ScrollBar scrollBar
protected ViewportAxis viewportAxis
protected ScrollBarHandler scrollBarHandler
- new(long segmentCount, double defaultSegmentSize) {
- this(segmentCount, new BigDecimal(defaultSegmentSize))
- }
-
- new(long segmentCount, BigDecimal defaultSegmentSize) {
- underlyingAxis = new AxisImpl(segmentCount, defaultSegmentSize)
+ new(BigInteger segmentCount, BigDecimal defaultSegmentSize) {
+ underlyingAxis = new BigAxisImpl(segmentCount, defaultSegmentSize)
}
@Before
diff --git a/org.eclipse.nebula.widgets.nattable.renderer.swt.test/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/ScrollBarHandlerRangeLargerThanIntTest.xtend b/org.eclipse.nebula.widgets.nattable.renderer.swt.test/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/ScrollBarHandlerRangeLargerThanIntTest.xtend
index f908fd2..59f4aca 100644
--- a/org.eclipse.nebula.widgets.nattable.renderer.swt.test/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/ScrollBarHandlerRangeLargerThanIntTest.xtend
+++ b/org.eclipse.nebula.widgets.nattable.renderer.swt.test/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/ScrollBarHandlerRangeLargerThanIntTest.xtend
@@ -1,6 +1,8 @@
package org.eclipse.nebula.widgets.nattable.renderer.swt.layer.viewport
import java.math.BigDecimal
+import java.math.BigInteger
+import java.math.MathContext
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.runners.MockitoJUnitRunner
@@ -8,21 +10,20 @@
import static org.junit.Assert.*
import static org.mockito.Mockito.*
-import static extension org.eclipse.nebula.widgets.nattable.core.layer.axis.AxisInvariants.*
-import java.math.MathContext
+import static extension org.eclipse.nebula.widgets.nattable.core.layer.axis.BigAxisInvariants.*
@RunWith(typeof(MockitoJUnitRunner))
class ScrollBarHandlerRangeLargerThanIntTest extends AbstractScrollBarHandlerTest {
- val static MILLION = 1000L * 1000
- val static BILLION = 1000L * MILLION
- val static TRILLION = 1000L * BILLION
- val static QUADRILLION = 1000L * TRILLION
+ val static MILLION = 1000 * 1000L
+ val static BILLION = 1000 * MILLION
+ val static TRILLION = 1000 * BILLION
+ val static QUADRILLION = 1000 * TRILLION
//
new() {
- super(1 * QUADRILLION, 200)
+ super(BigInteger::valueOf(1 * QUADRILLION), BigDecimal::valueOf(200))
}
@Test
diff --git a/org.eclipse.nebula.widgets.nattable.renderer.swt.test/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/ScrollBarHandlerRangeSmallerThanIntTest.xtend b/org.eclipse.nebula.widgets.nattable.renderer.swt.test/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/ScrollBarHandlerRangeSmallerThanIntTest.xtend
index ece8eb0..f9cc2c9 100644
--- a/org.eclipse.nebula.widgets.nattable.renderer.swt.test/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/ScrollBarHandlerRangeSmallerThanIntTest.xtend
+++ b/org.eclipse.nebula.widgets.nattable.renderer.swt.test/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/ScrollBarHandlerRangeSmallerThanIntTest.xtend
@@ -1,6 +1,7 @@
package org.eclipse.nebula.widgets.nattable.renderer.swt.layer.viewport
import java.math.BigDecimal
+import java.math.BigInteger
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.runners.MockitoJUnitRunner
@@ -8,13 +9,13 @@
import static org.junit.Assert.*
import static org.mockito.Mockito.*
-import static extension org.eclipse.nebula.widgets.nattable.core.layer.axis.AxisInvariants.*
+import static extension org.eclipse.nebula.widgets.nattable.core.layer.axis.BigAxisInvariants.*
@RunWith(typeof(MockitoJUnitRunner))
class ScrollBarHandlerRangeSmallerThanIntTest extends AbstractScrollBarHandlerTest {
new() {
- super(10, 200)
+ super(BigInteger::valueOf(10), BigDecimal::valueOf(200))
}
@Test
@@ -53,7 +54,7 @@
when(scrollBar.selection).thenReturn(1990)
scrollBarHandler.updateViewportOrigin
- assertTrue('''viewport origin «viewportAxis.pixelOrigin» + visible pixel size «viewportAxis.visiblePixelSize» should be >= underlying axis pixel size «viewportAxis.underlyingAxis.pixelSize»''', viewportAxis.pixelOrigin + viewportAxis.visiblePixelSize >= new BigDecimal(2000))
+ assertTrue('''viewport origin «viewportAxis.pixelOrigin» + visible pixel size «viewportAxis.visiblePixelSize» should be >= underlying axis pixel size «viewportAxis.underlyingAxis.pixelSize»''', viewportAxis.pixelOrigin + viewportAxis.visiblePixelSize >= BigDecimal::valueOf(2000))
}
}
\ No newline at end of file
diff --git a/org.eclipse.nebula.widgets.nattable.renderer.swt/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/SWTViewportLayerPainter.xtend b/org.eclipse.nebula.widgets.nattable.renderer.swt/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/SWTViewportLayerPainter.xtend
index fc621ee..1534e6f 100644
--- a/org.eclipse.nebula.widgets.nattable.renderer.swt/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/SWTViewportLayerPainter.xtend
+++ b/org.eclipse.nebula.widgets.nattable.renderer.swt/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/SWTViewportLayerPainter.xtend
@@ -1,6 +1,5 @@
package org.eclipse.nebula.widgets.nattable.renderer.swt.layer.viewport
-import java.math.BigDecimal
import org.eclipse.nebula.widgets.nattable.core.geometry.PixelArea
import org.eclipse.nebula.widgets.nattable.core.geometry.PixelRectangle
import org.eclipse.nebula.widgets.nattable.core.graphics.GraphicsContext
@@ -22,9 +21,9 @@
override paintLayer(ViewportLayer viewportLayer, PixelArea layerPaintArea, GraphicsContext gc) {
val swtGC = gc as SWTGraphicsContext
- viewportLayer.visiblePixelRectangle = new PixelRectangle(new BigDecimal(0), new BigDecimal(0), layerPaintArea.width, layerPaintArea.height)
+ viewportLayer.visiblePixelRectangle = new PixelRectangle(0, 0, layerPaintArea.width, layerPaintArea.height)
- if (viewportCanvas == null) {
+ if (viewportCanvas == null || viewportCanvas.disposed) {
viewportCanvas = new Canvas(swtGC.SWTComposite, SWT::H_SCROLL.bitwiseOr(SWT::V_SCROLL))
// Paint listener
diff --git a/org.eclipse.nebula.widgets.nattable.renderer.swt/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/ScrollBarHandler.xtend b/org.eclipse.nebula.widgets.nattable.renderer.swt/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/ScrollBarHandler.xtend
index 34c9e3c..bdbc006 100644
--- a/org.eclipse.nebula.widgets.nattable.renderer.swt/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/ScrollBarHandler.xtend
+++ b/org.eclipse.nebula.widgets.nattable.renderer.swt/src/org/eclipse/nebula/widgets/nattable/renderer/swt/layer/viewport/ScrollBarHandler.xtend
@@ -8,6 +8,7 @@
import static extension java.lang.Math.*
import static extension org.eclipse.nebula.widgets.nattable.core.layer.axis.AxisInvariants.*
+import static extension org.eclipse.nebula.widgets.nattable.core.layer.axis.BigAxisInvariants.*
class ScrollBarHandler implements Listener {
@@ -91,7 +92,7 @@
scrollBar.pageIncrement = Math::max(minPageIncrement, thumbSize.intValue)
// Increment by size of segment 0 or 1/4 of visible pixel size, whichever is smaller
- val pixelIncrement = viewportAxis.getPixelSizeOfSegmentPosition(0).min(visiblePixelSize / new BigDecimal(4))
+ val pixelIncrement = viewportAxis.getPixelSizeOfSegmentPosition(0).min(visiblePixelSize.doubleValue / 4)
scrollBar.increment = minIncrement.max((pixelIncrement * intPerPixelRatio).intValue)
scrollBar.selection = (viewportOrigin * intPerPixelRatio).intValue