1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
package org.eclipse.nebula.widgets.nattable.core.example.impl
import org.eclipse.nebula.widgets.nattable.core.layer.axis.impl.AxisImpl
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
import org.eclipse.nebula.widgets.nattable.core.layer.impl.header.RowHeaderLayer
import org.eclipse.nebula.widgets.nattable.core.layer.impl.viewport.ViewportLayer
class MultiViewportExample extends AbstractNatExample {
override createLayer() {
val bodyLayer = new CompositeLayer => [
val viewportOne = new ViewportLayer => [
underlyingLayer = new DummyLayer(
new AxisImpl(4, 150), // Horizontal axis
new AxisImpl(10, 100) // Vertical axis
)
horizontalAxis.minPixelLocation = 0
horizontalAxis.maxPixelSize = 150
]
val viewportTwo = new ViewportLayer => [
underlyingLayer = new DummyLayer(
new AxisImpl(10, 150), // Horizontal axis
new AxisImpl(10, 100) // Vertical axis
)
verticalAxis = viewportOne.verticalAxis
]
addRow(
viewportOne,
viewportTwo
)
]
val columnHeaderLayer = new ColumnHeaderLayer(bodyLayer.horizontalAxis, new LayerDataAccessorImpl([ layer, columnId, rowId | columnId ]))
val rowHeaderLayer = new RowHeaderLayer(bodyLayer.verticalAxis, new LayerDataAccessorImpl([ layer, columnId, rowId | rowId ]))
val cornerLayer = new DimensionallyDependentLayer(rowHeaderLayer.horizontalAxis, columnHeaderLayer.verticalAxis, new LayerDataAccessorImpl([ layer, columnId, rowId | "" ]))
new CompositeLayer => [
addRow(cornerLayer, columnHeaderLayer)
addRow(rowHeaderLayer, bodyLayer)
]
}
}
|