initial contribution of IGraphicsContext
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.core.test/META-INF/MANIFEST.MF index 0079b34..d1e272f 100644 --- a/org.eclipse.nebula.widgets.nattable.core.test/META-INF/MANIFEST.MF +++ b/org.eclipse.nebula.widgets.nattable.core.test/META-INF/MANIFEST.MF
@@ -14,5 +14,5 @@ org.eclipse.nebula.widgets.nattable.test.fixture.group, org.eclipse.nebula.widgets.nattable.test.fixture.layer, org.eclipse.nebula.widgets.nattable.test.integration -Require-Bundle: org.junit4 +Require-Bundle: org.junit;bundle-version="4.11.0" Bundle-Vendor: Eclipse Nebula NatTable
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/geometry/RectangleTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/geometry/RectangleTest.java new file mode 100644 index 0000000..8ca41c7 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/core/geometry/RectangleTest.java
@@ -0,0 +1,580 @@ +package org.eclipse.nebula.widgets.nattable.core.geometry; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.math.BigInteger; +import java.util.HashSet; +import java.util.Set; + +import org.junit.Test; + +public class RectangleTest { + + // equals testing + + @Test + public void pixelRectanglesShouldBeEqual() { + PixelRectangle rect1 = new PixelRectangle(20, 20, 100, 100); + PixelRectangle rect2 = new PixelRectangle(20, 20, 100, 100); + + assertEquals(rect1, rect2); + } + + @Test + public void pixelRectanglesShouldNotBeEqual() { + PixelRectangle rect1 = new PixelRectangle(20, 20, 100, 100); + PixelRectangle rect2 = new PixelRectangle(10, 10, 90, 90); + + assertFalse("rectangles are equal", rect1.equals(rect2)); + } + + @Test + public void positionRectanglesShouldBeEqual() { + PositionRectangle rect1 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + PositionRectangle rect2 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + + assertEquals(rect1, rect2); + } + + @Test + public void positionRectanglesShouldNotBeEqual() { + PositionRectangle rect1 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + PositionRectangle rect2 = new PositionRectangle( + BigInteger.valueOf(10), + BigInteger.valueOf(10), + BigInteger.valueOf(90), + BigInteger.valueOf(90)); + + assertFalse("rectangles are equal", rect1.equals(rect2)); + } + + // hashCode testing + + @Test + public void pixelRectanglesHashCode() { + PixelRectangle rect1 = new PixelRectangle(20, 20, 100, 100); + PixelRectangle rect2 = new PixelRectangle(20, 20, 100, 100); + + Set<PixelRectangle> set = new HashSet<PixelRectangle>(); + set.add(rect1); + set.add(rect2); + + assertEquals(1, set.size()); + + PixelRectangle rect3 = new PixelRectangle(10, 10, 90, 90); + set.add(rect3); + + assertEquals(2, set.size()); + } + + @Test + public void positionRectanglesHashCode() { + PositionRectangle rect1 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + PositionRectangle rect2 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + + Set<PositionRectangle> set = new HashSet<PositionRectangle>(); + set.add(rect1); + set.add(rect2); + + assertEquals(1, set.size()); + + PositionRectangle rect3 = new PositionRectangle( + BigInteger.valueOf(10), + BigInteger.valueOf(10), + BigInteger.valueOf(90), + BigInteger.valueOf(90)); + set.add(rect3); + + assertEquals(2, set.size()); + } + + // empty + + @Test + public void pixelRectangleShouldBeEmpty() { + PixelRectangle rect = new PixelRectangle(20, 20, 100, 100); + assertFalse("rectangle is empty", rect.isEmpty()); + + rect = new PixelRectangle(20, 20, 100, -10); + assertTrue("rectangle is not empty", rect.isEmpty()); + + rect = new PixelRectangle(20, 20, -10, 100); + assertTrue("rectangle is not empty", rect.isEmpty()); + + rect = new PixelRectangle(20, 20, -10, -10); + assertTrue("rectangle is not empty", rect.isEmpty()); + } + + @Test + public void positionRectangleShouldBeEmpty() { + PositionRectangle rect = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + assertFalse("rectangle is empty", rect.isEmpty()); + + rect = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(-10)); + assertTrue("rectangle is not empty", rect.isEmpty()); + + rect = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(-10), + BigInteger.valueOf(100)); + assertTrue("rectangle is not empty", rect.isEmpty()); + + rect = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(-10), + BigInteger.valueOf(-10)); + assertTrue("rectangle is not empty", rect.isEmpty()); + } + + // contains + + @Test(expected = IllegalArgumentException.class) + public void pixelRectangleContainsNull() { + PixelRectangle rect = new PixelRectangle(20, 20, 100, 100); + rect.contains(null); + } + + @Test + public void pixelRectangleShouldContainCoordinate() { + PixelRectangle rect = new PixelRectangle(20, 20, 100, 100); + + PixelCoordinate coord = new PixelCoordinate(20, 20); + assertTrue("retangle does not contain coordinate " + coord, rect.contains(coord)); + + coord = new PixelCoordinate(100, 100); + assertTrue("retangle does not contain coordinate " + coord, rect.contains(coord)); + + coord = new PixelCoordinate(40, 40); + assertTrue("retangle does not contain coordinate " + coord, rect.contains(coord)); + } + + @Test + public void pixelRectangleShouldNotContainCoordinate() { + PixelRectangle rect = new PixelRectangle(20, 20, 100, 100); + + PixelCoordinate coord = new PixelCoordinate(19, 19); + assertFalse("retangle does not contain coordinate " + coord, rect.contains(coord)); + + coord = new PixelCoordinate(121, 121); + assertFalse("retangle does contain coordinate " + coord, rect.contains(coord)); + + coord = new PixelCoordinate(10, 40); + assertFalse("retangle does contain coordinate " + coord, rect.contains(coord)); + + coord = new PixelCoordinate(40, 140); + assertFalse("retangle does contain coordinate " + coord, rect.contains(coord)); + } + + @Test(expected = IllegalArgumentException.class) + public void positionRectangleContainsNull() { + PositionRectangle rect = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + rect.contains(null); + } + + @Test + public void positionRectangleShouldContainCoordinate() { + PositionRectangle rect = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + + PositionCoordinate coord = new PositionCoordinate(BigInteger.valueOf(20), BigInteger.valueOf(20)); + assertTrue("retangle does not contain coordinate " + coord, rect.contains(coord)); + + coord = new PositionCoordinate(BigInteger.valueOf(100), BigInteger.valueOf(100)); + assertTrue("retangle does not contain coordinate " + coord, rect.contains(coord)); + + coord = new PositionCoordinate(BigInteger.valueOf(40), BigInteger.valueOf(40)); + assertTrue("retangle does not contain coordinate " + coord, rect.contains(coord)); + } + + @Test + public void positionRectangleShouldNotContainCoordinate() { + PositionRectangle rect = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + + PositionCoordinate coord = new PositionCoordinate(BigInteger.valueOf(19), BigInteger.valueOf(19)); + assertFalse("retangle does not contain coordinate " + coord, rect.contains(coord)); + + coord = new PositionCoordinate(BigInteger.valueOf(121), BigInteger.valueOf(121)); + assertFalse("retangle does contain coordinate " + coord, rect.contains(coord)); + + coord = new PositionCoordinate(BigInteger.valueOf(10), BigInteger.valueOf(40)); + assertFalse("retangle does contain coordinate " + coord, rect.contains(coord)); + + coord = new PositionCoordinate(BigInteger.valueOf(40), BigInteger.valueOf(140)); + assertFalse("retangle does contain coordinate " + coord, rect.contains(coord)); + } + + // add - modify the current rectangle + + @Test + public void pixelRectangleShouldAddSmaller() { + PixelRectangle rect1 = new PixelRectangle(20, 20, 100, 100); + PixelRectangle rect2 = new PixelRectangle(40, 40, 80, 80); + + rect1.add(rect2); + + assertEquals(20, rect1.x, 0); + assertEquals(20, rect1.y, 0); + assertEquals(100, rect1.width, 0); + assertEquals(100, rect1.height, 0); + } + + @Test + public void pixelRectangleShouldAddBigger() { + PixelRectangle rect1 = new PixelRectangle(20, 20, 100, 100); + PixelRectangle rect2 = new PixelRectangle(0, 0, 120, 120); + + rect1.add(rect2); + + assertEquals(0, rect1.x, 0); + assertEquals(0, rect1.y, 0); + assertEquals(120, rect1.width, 0); + assertEquals(120, rect1.height, 0); + } + + @Test + public void positionRectangleShouldAddSmaller() { + PositionRectangle rect1 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + PositionRectangle rect2 = new PositionRectangle( + BigInteger.valueOf(40), + BigInteger.valueOf(40), + BigInteger.valueOf(80), + BigInteger.valueOf(80)); + + rect1.add(rect2); + + assertEquals(BigInteger.valueOf(20), rect1.x); + assertEquals(BigInteger.valueOf(20), rect1.y); + assertEquals(BigInteger.valueOf(100), rect1.width); + assertEquals(BigInteger.valueOf(100), rect1.height); + } + + @Test + public void positionRectangleShouldAddBigger() { + PositionRectangle rect1 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + PositionRectangle rect2 = new PositionRectangle( + BigInteger.valueOf(0), + BigInteger.valueOf(0), + BigInteger.valueOf(120), + BigInteger.valueOf(120)); + + rect1.add(rect2); + + assertEquals(BigInteger.valueOf(0), rect1.x); + assertEquals(BigInteger.valueOf(0), rect1.y); + assertEquals(BigInteger.valueOf(120), rect1.width); + assertEquals(BigInteger.valueOf(120), rect1.height); + } + + // union - return a new rectangle + + @Test + public void pixelRectangleShouldUnionSmaller() { + PixelRectangle rect1 = new PixelRectangle(20, 20, 100, 100); + PixelRectangle rect2 = new PixelRectangle(40, 40, 80, 80); + + PixelRectangle union = rect1.union(rect2); + + assertEquals(20, union.x, 0); + assertEquals(20, union.y, 0); + assertEquals(100, union.width, 0); + assertEquals(100, union.height, 0); + } + + @Test + public void pixelRectangleShouldUnionBigger() { + PixelRectangle rect1 = new PixelRectangle(20, 20, 100, 100); + PixelRectangle rect2 = new PixelRectangle(0, 0, 120, 120); + + PixelRectangle union = rect1.union(rect2); + + assertEquals(0, union.x, 0); + assertEquals(0, union.y, 0); + assertEquals(120, union.width, 0); + assertEquals(120, union.height, 0); + } + + @Test + public void positionRectangleShouldUnionSmaller() { + PositionRectangle rect1 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + PositionRectangle rect2 = new PositionRectangle( + BigInteger.valueOf(40), + BigInteger.valueOf(40), + BigInteger.valueOf(80), + BigInteger.valueOf(80)); + + PositionRectangle union = rect1.union(rect2); + + assertEquals(BigInteger.valueOf(20), union.x); + assertEquals(BigInteger.valueOf(20), union.y); + assertEquals(BigInteger.valueOf(100), union.width); + assertEquals(BigInteger.valueOf(100), union.height); + } + + @Test + public void positionRectangleShouldUnionBigger() { + PositionRectangle rect1 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + PositionRectangle rect2 = new PositionRectangle( + BigInteger.valueOf(0), + BigInteger.valueOf(0), + BigInteger.valueOf(120), + BigInteger.valueOf(120)); + + PositionRectangle union = rect1.union(rect2); + + assertEquals(BigInteger.valueOf(0), union.x); + assertEquals(BigInteger.valueOf(0), union.y); + assertEquals(BigInteger.valueOf(120), union.width); + assertEquals(BigInteger.valueOf(120), union.height); + } + + // intersect + + @Test + public void pixelRectanglesShouldIntersect() { + PixelRectangle rect1 = new PixelRectangle(20, 20, 100, 100); + PixelRectangle rect2 = new PixelRectangle(60, 60, 100, 100); + + assertTrue("rectangles do not intersect", rect1.intersects(rect2)); + + rect1.intersect(rect2); + + assertEquals(60, rect1.x, 0); + assertEquals(60, rect1.y, 0); + assertEquals(60, rect1.width, 0); + assertEquals(60, rect1.height, 0); + } + + @Test + public void pixelRectanglesShouldIntersect2() { + PixelRectangle rect1 = new PixelRectangle(20, 20, 100, 100); + PixelRectangle rect2 = new PixelRectangle(60, 60, 100, 100); + + assertTrue("rectangles do not intersect", rect2.intersects(rect1)); + + rect2.intersect(rect1); + + assertEquals(60, rect2.x, 0); + assertEquals(60, rect2.y, 0); + assertEquals(60, rect2.width, 0); + assertEquals(60, rect2.height, 0); + } + + @Test + public void pixelRectanglesShouldProvideIntersection() { + PixelRectangle rect1 = new PixelRectangle(20, 20, 100, 100); + PixelRectangle rect2 = new PixelRectangle(60, 60, 100, 100); + + assertTrue("rectangles do not intersect", rect1.intersects(rect2)); + + PixelRectangle inter = rect1.intersection(rect2); + + assertEquals(60, inter.x, 0); + assertEquals(60, inter.y, 0); + assertEquals(60, inter.width, 0); + assertEquals(60, inter.height, 0); + } + + @Test + public void pixelRectanglesShouldProvideIntersection2() { + PixelRectangle rect1 = new PixelRectangle(20, 20, 100, 100); + PixelRectangle rect2 = new PixelRectangle(60, 60, 100, 100); + + assertTrue("rectangles do not intersect", rect2.intersects(rect1)); + + PixelRectangle inter = rect1.intersection(rect2); + + assertEquals(60, inter.x, 0); + assertEquals(60, inter.y, 0); + assertEquals(60, inter.width, 0); + assertEquals(60, inter.height, 0); + } + + @Test + public void pixelRectanglesShouldNotIntersect() { + PixelRectangle rect1 = new PixelRectangle(20, 20, 40, 40); + PixelRectangle rect2 = new PixelRectangle(60, 60, 100, 100); + + assertFalse("rectangles do intersect", rect1.intersects(rect2)); + + rect1.intersect(rect2); + + assertEquals(60, rect1.x, 0); + assertEquals(60, rect1.y, 0); + assertEquals(0, rect1.width, 0); + assertEquals(0, rect1.height, 0); + } + + @Test + public void positionRectanglesShouldIntersect() { + PositionRectangle rect1 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + PositionRectangle rect2 = new PositionRectangle( + BigInteger.valueOf(60), + BigInteger.valueOf(60), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + + assertTrue("rectangles do not intersect", rect1.intersects(rect2)); + + rect1.intersect(rect2); + + assertEquals(BigInteger.valueOf(60), rect1.x); + assertEquals(BigInteger.valueOf(60), rect1.y); + assertEquals(BigInteger.valueOf(60), rect1.width); + assertEquals(BigInteger.valueOf(60), rect1.height); + } + + @Test + public void positionRectanglesShouldIntersect2() { + PositionRectangle rect1 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + PositionRectangle rect2 = new PositionRectangle( + BigInteger.valueOf(60), + BigInteger.valueOf(60), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + + assertTrue("rectangles do not intersect", rect2.intersects(rect1)); + + rect2.intersect(rect1); + + assertEquals(BigInteger.valueOf(60), rect2.x); + assertEquals(BigInteger.valueOf(60), rect2.y); + assertEquals(BigInteger.valueOf(60), rect2.width); + assertEquals(BigInteger.valueOf(60), rect2.height); + } + + @Test + public void positionRectanglesShouldProvideIntersection() { + PositionRectangle rect1 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + PositionRectangle rect2 = new PositionRectangle( + BigInteger.valueOf(60), + BigInteger.valueOf(60), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + + assertTrue("rectangles do not intersect", rect1.intersects(rect2)); + + PositionRectangle inter = rect1.intersection(rect2); + + assertEquals(BigInteger.valueOf(60), inter.x); + assertEquals(BigInteger.valueOf(60), inter.y); + assertEquals(BigInteger.valueOf(60), inter.width); + assertEquals(BigInteger.valueOf(60), inter.height); + } + + @Test + public void positionRectanglesShouldProvideIntersection2() { + PositionRectangle rect1 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + PositionRectangle rect2 = new PositionRectangle( + BigInteger.valueOf(60), + BigInteger.valueOf(60), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + + assertTrue("rectangles do not intersect", rect2.intersects(rect1)); + + PositionRectangle inter = rect1.intersection(rect2); + + assertEquals(BigInteger.valueOf(60), inter.x); + assertEquals(BigInteger.valueOf(60), inter.y); + assertEquals(BigInteger.valueOf(60), inter.width); + assertEquals(BigInteger.valueOf(60), inter.height); + } + + @Test + public void positionRectanglesShouldNotIntersect() { + PositionRectangle rect1 = new PositionRectangle( + BigInteger.valueOf(20), + BigInteger.valueOf(20), + BigInteger.valueOf(40), + BigInteger.valueOf(40)); + PositionRectangle rect2 = new PositionRectangle( + BigInteger.valueOf(60), + BigInteger.valueOf(60), + BigInteger.valueOf(100), + BigInteger.valueOf(100)); + + assertFalse("rectangles do intersect", rect1.intersects(rect2)); + + rect1.intersect(rect2); + + assertEquals(BigInteger.valueOf(60), rect1.x); + assertEquals(BigInteger.valueOf(60), rect1.y); + assertEquals(BigInteger.valueOf(0), rect1.width); + assertEquals(BigInteger.valueOf(0), rect1.height); + } +}
diff --git a/org.eclipse.nebula.widgets.nattable.core/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.core/META-INF/MANIFEST.MF index 7678d2f..a5a2c9c 100644 --- a/org.eclipse.nebula.widgets.nattable.core/META-INF/MANIFEST.MF +++ b/org.eclipse.nebula.widgets.nattable.core/META-INF/MANIFEST.MF
@@ -23,6 +23,8 @@ org.eclipse.nebula.widgets.nattable.copy.action;version="2.0.0", org.eclipse.nebula.widgets.nattable.copy.command;version="2.0.0", org.eclipse.nebula.widgets.nattable.copy.serializing;version="2.0.0", + org.eclipse.nebula.widgets.nattable.core.geometry;version="2.0.0", + org.eclipse.nebula.widgets.nattable.core.ui.rendering;version="2.0.0", org.eclipse.nebula.widgets.nattable.data;version="2.0.0", org.eclipse.nebula.widgets.nattable.data.convert;version="2.0.0", org.eclipse.nebula.widgets.nattable.data.validate;version="2.0.0", @@ -73,6 +75,7 @@ org.eclipse.nebula.widgets.nattable.hover.config;version="2.0.0", org.eclipse.nebula.widgets.nattable.layer;version="2.0.0", org.eclipse.nebula.widgets.nattable.layer.cell;version="2.0.0", + org.eclipse.nebula.widgets.nattable.layer.command;version="2.0.0", org.eclipse.nebula.widgets.nattable.layer.config;version="2.0.0", org.eclipse.nebula.widgets.nattable.layer.event;version="2.0.0", org.eclipse.nebula.widgets.nattable.layer.stack;version="2.0.0", @@ -140,7 +143,6 @@ org.eclipse.nebula.widgets.nattable.ui.matcher;version="2.0.0", org.eclipse.nebula.widgets.nattable.ui.menu;version="2.0.0", org.eclipse.nebula.widgets.nattable.ui.mode;version="2.0.0", - org.eclipse.nebula.widgets.nattable.ui.rendering;version="2.0.0", org.eclipse.nebula.widgets.nattable.ui.util;version="2.0.0", org.eclipse.nebula.widgets.nattable.util;version="2.0.0", org.eclipse.nebula.widgets.nattable.viewport;version="2.0.0", @@ -169,4 +171,4 @@ org.eclipse.swt.program, org.eclipse.swt.widgets Bundle-Vendor: Eclipse Nebula NatTable -Require-Bundle: org.eclipse.equinox.common;bundle-version="3.5.1" +Require-Bundle: org.eclipse.equinox.common;bundle-version="3.6.0"
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelCoordinate.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelCoordinate.java new file mode 100644 index 0000000..c2e61c8 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelCoordinate.java
@@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2014 Dirk Fauth, Edwin Park. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation + * Edwin Park <esp1@cornell.edu> - initial API and implementation + ******************************************************************************/ +package org.eclipse.nebula.widgets.nattable.core.geometry; + +/** + * Instances of this class represent places on the (x, y) coordinate plane. It + * is used to identify a pixel coordinate for drawing operations via graphics + * context. The values for x and y are stored as double values because newer UI + * toolkits use doubles to identify coordinates to support scaling. + * <p> + * Note that the x and y values are final. + * </p> + * <p> + * There might be an implementation for this in every UI toolkit, like + * org.eclipse.swt.graphics.Point or java.awt.Point, but they are dependent to + * the UI toolkit because of their package and inheritance. That's why we + * re-implemented it again to make use of it in NatTable core without any + * further dependencies. + * </p> + */ +public class PixelCoordinate { + + /** + * the x coordinate of the point + */ + public final double x; + + /** + * the y coordinate of the point + */ + public final double y; + + /** + * Constructs a new pixel coordinate with the given x and y coordinates. + * + * @param x + * the x coordinate of the new point + * @param y + * the y coordinate of the new point + */ + public PixelCoordinate(double x, double y) { + this.x = x; + this.y = y; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + long temp; + temp = Double.doubleToLongBits(this.x); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits(this.y); + result = prime * result + (int) (temp ^ (temp >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PixelCoordinate other = (PixelCoordinate) obj; + if (Double.doubleToLongBits(this.x) != Double.doubleToLongBits(other.x)) + return false; + if (Double.doubleToLongBits(this.y) != Double.doubleToLongBits(other.y)) + return false; + return true; + } + + @Override + public String toString() { + return "PixelCoordinate {" + this.x + ", " + this.y + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + +}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelRectangle.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelRectangle.java new file mode 100644 index 0000000..ddd1915 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PixelRectangle.java
@@ -0,0 +1,341 @@ +/******************************************************************************* + * Copyright (c) 2014 Dirk Fauth, Edwin Park. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation + * Edwin Park <esp1@cornell.edu> - initial API and implementation + ******************************************************************************/ +package org.eclipse.nebula.widgets.nattable.core.geometry; + +/** + * Instances of this class represent rectangular areas in an (x, y) coordinate + * system. The top left corner of the rectangle is specified by its x and y + * values, and the extent of the rectangle is specified by its width and height. + * The values are stored as double values because newer UI toolkits use doubles + * to identify coordinates to support scaling. + * <p> + * There might be an implementation for this in every UI toolkit, like + * org.eclipse.swt.graphics.Rectangle or java.awt.Rectangle, but they are + * dependent to the UI toolkit because of their package and inheritance. That's + * why we re-implemented it again to make use of it in NatTable core without any + * further dependencies. + * </p> + */ +public class PixelRectangle { + + /** + * the x coordinate of the rectangle + */ + public double x; + + /** + * the y coordinate of the rectangle + */ + public double y; + + /** + * the width of the rectangle + */ + public double width; + + /** + * the height of the rectangle + */ + public double height; + + /** + * Construct a new instance of this class given the x, y, width and height + * values. + * + * @param x + * the x coordinate of the origin of the rectangle + * @param y + * the y coordinate of the origin of the rectangle + * @param width + * the width of the rectangle + * @param height + * the height of the rectangle + */ + public PixelRectangle(double x, double y, double width, double height) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } + + /** + * Destructively replaces the x, y, width and height values in the receiver + * with ones which represent the union of the rectangles specified by the + * receiver and the given rectangle. + * <p> + * The union of two rectangles is the smallest single rectangle that + * completely covers both of the areas covered by the two given rectangles. + * </p> + * + * @param rect + * the rectangle to merge with the receiver + * + * @throws IllegalArgumentException + * if the specified rectangle is <code>null</code> + */ + public void add(PixelRectangle rect) { + if (rect == null) + throw new IllegalArgumentException("rectangle can not be null"); //$NON-NLS-1$ + double left = this.x < rect.x ? this.x : rect.x; + double top = this.y < rect.y ? this.y : rect.y; + double lhs = this.x + this.width; + double rhs = rect.x + rect.width; + double right = lhs > rhs ? lhs : rhs; + lhs = this.y + this.height; + rhs = rect.y + rect.height; + double bottom = lhs > rhs ? lhs : rhs; + this.x = left; + this.y = top; + this.width = right - left; + this.height = bottom - top; + } + + /** + * Returns <code>true</code> if the point specified by the arguments is + * inside the area specified by the receiver, and <code>false</code> + * otherwise. + * + * @param x + * the x coordinate of the point to test for containment + * @param y + * the y coordinate of the point to test for containment + * @return <code>true</code> if the rectangle contains the point and + * <code>false</code> otherwise + */ + public boolean contains(double x, double y) { + return (x >= this.x) && (y >= this.y) && x < (this.x + this.width) && y < (this.y + this.height); + } + + /** + * Returns <code>true</code> if the given pixel coordinate is inside the + * area specified by the receiver, and <code>false</code> otherwise. + * + * @param pt + * the point to test for containment + * @return <code>true</code> if the rectangle contains the point and + * <code>false</code> otherwise + * + * @throws IllegalArgumentException + * if the specified point is <code>null</code> + */ + public boolean contains(PixelCoordinate pt) { + if (pt == null) + throw new IllegalArgumentException("pixel coordinate can not be null"); //$NON-NLS-1$ + return contains(pt.x, pt.y); + } + + /** + * Returns <code>true</code> if the receiver does not cover any area in the + * (x, y) coordinate plane, and <code>false</code> if the receiver does + * cover some area in the plane. + * <p> + * A rectangle is considered to <em>cover area</em> in the (x, y) coordinate + * plane if both its width and height are non-zero. + * </p> + * + * @return <code>true</code> if the receiver is empty, and + * <code>false</code> otherwise + */ + public boolean isEmpty() { + return (this.width <= 0) || (this.height <= 0); + } + + /** + * Destructively replaces the x, y, width and height values in the receiver + * with ones which represent the intersection of the rectangles specified by + * the receiver and the given rectangle. + * + * @param rect + * the rectangle to intersect with the receiver + * + * @throws IllegalArgumentException + * if the specified rectangle is <code>null</code> + */ + public void intersect(PixelRectangle rect) { + if (rect == null) + throw new IllegalArgumentException("rectangle can not be null"); //$NON-NLS-1$ + if (this == rect) + return; + double left = this.x > rect.x ? this.x : rect.x; + double top = this.y > rect.y ? this.y : rect.y; + double lhs = this.x + this.width; + double rhs = rect.x + rect.width; + double right = lhs < rhs ? lhs : rhs; + lhs = this.y + this.height; + rhs = rect.y + rect.height; + double bottom = lhs < rhs ? lhs : rhs; + this.x = right < left ? 0 : left; + this.y = bottom < top ? 0 : top; + this.width = right < left ? 0 : right - left; + this.height = bottom < top ? 0 : bottom - top; + } + + /** + * Returns a new rectangle which represents the intersection of the receiver + * and the given rectangle. + * <p> + * The intersection of two rectangles is the rectangle that covers the area + * which is contained within both rectangles. + * </p> + * + * @param rect + * the rectangle to intersect with the receiver + * @return the intersection of the receiver and the argument + * + * @throws IllegalArgumentException + * if the specified rectangle is <code>null</code> + */ + public PixelRectangle intersection(PixelRectangle rect) { + if (rect == null) + throw new IllegalArgumentException("rectangle can not be null"); //$NON-NLS-1$ + if (this == rect) + return new PixelRectangle(this.x, this.y, this.width, this.height); + double left = this.x > rect.x ? this.x : rect.x; + double top = this.y > rect.y ? this.y : rect.y; + double lhs = this.x + this.width; + double rhs = rect.x + rect.width; + double right = lhs < rhs ? lhs : rhs; + lhs = this.y + this.height; + rhs = rect.y + rect.height; + double bottom = lhs < rhs ? lhs : rhs; + return new PixelRectangle( + right < left ? 0 : left, + bottom < top ? 0 : top, + right < left ? 0 : right - left, + bottom < top ? 0 : bottom - top); + } + + /** + * Returns <code>true</code> if the rectangle described by the arguments + * intersects with the receiver and <code>false</code> otherwise. + * <p> + * Two rectangles intersect if the area of the rectangle representing their + * intersection is not empty. + * </p> + * + * @param x + * the x coordinate of the origin of the rectangle + * @param y + * the y coordinate of the origin of the rectangle + * @param width + * the width of the rectangle + * @param height + * the height of the rectangle + * @return <code>true</code> if the rectangle intersects with the receiver, + * and <code>false</code> otherwise + * + * @see #intersection(PixelRectangle) + * @see #isEmpty() + */ + public boolean intersects(double x, double y, double width, double height) { + return (x < this.x + this.width) && (y < this.y + this.height) && + (x + width > this.x) && (y + height > this.y); + } + + /** + * Returns <code>true</code> if the given rectangle intersects with the + * receiver and <code>false</code> otherwise. + * <p> + * Two rectangles intersect if the area of the rectangle representing their + * intersection is not empty. + * </p> + * + * @param rect + * the rectangle to test for intersection + * @return <code>true</code> if the rectangle intersects with the receiver, + * and <code>false</code> otherwise + * + * @throws IllegalArgumentException + * if the specified rectangle is <code>null</code> + * + * @see #intersection(PixelRectangle) + * @see #isEmpty() + */ + public boolean intersects(PixelRectangle rect) { + if (rect == null) + throw new IllegalArgumentException("rectangle can not be null"); //$NON-NLS-1$ + return rect == this || intersects(rect.x, rect.y, rect.width, rect.height); + } + + /** + * Returns a new rectangle which represents the union of the receiver and + * the given rectangle. + * <p> + * The union of two rectangles is the smallest single rectangle that + * completely covers both of the areas covered by the two given rectangles. + * </p> + * + * @param rect + * the rectangle to perform union with + * @return the union of the receiver and the argument + * + * @throws IllegalArgumentException + * if the specified rectangle is <code>null</code> + * + * @see #add(PixelRectangle) + */ + public PixelRectangle union(PixelRectangle rect) { + if (rect == null) + throw new IllegalArgumentException("rectangle can not be null"); //$NON-NLS-1$ + double left = this.x < rect.x ? this.x : rect.x; + double top = this.y < rect.y ? this.y : rect.y; + double lhs = this.x + this.width; + double rhs = rect.x + rect.width; + double right = lhs > rhs ? lhs : rhs; + lhs = this.y + this.height; + rhs = rect.y + rect.height; + double bottom = lhs > rhs ? lhs : rhs; + return new PixelRectangle(left, top, right - left, bottom - top); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + long temp; + temp = Double.doubleToLongBits(this.height); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits(this.width); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits(this.x); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits(this.y); + result = prime * result + (int) (temp ^ (temp >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PixelRectangle other = (PixelRectangle) obj; + if (Double.doubleToLongBits(this.height) != Double.doubleToLongBits(other.height)) + return false; + if (Double.doubleToLongBits(this.width) != Double.doubleToLongBits(other.width)) + return false; + if (Double.doubleToLongBits(this.x) != Double.doubleToLongBits(other.x)) + return false; + if (Double.doubleToLongBits(this.y) != Double.doubleToLongBits(other.y)) + return false; + return true; + } + + @Override + public String toString() { + return "PixelRectangle {" + this.x + ", " + this.y + ", " + this.width + ", " + this.height + "}"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + } + +}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionCoordinate.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionCoordinate.java new file mode 100644 index 0000000..7d2f80f --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionCoordinate.java
@@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2014 Dirk Fauth, Edwin Park. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation + * Edwin Park <esp1@cornell.edu> - initial API and implementation + ******************************************************************************/ +package org.eclipse.nebula.widgets.nattable.core.geometry; + +import java.math.BigInteger; + +/** + * Instances of this class represent places on the (x, y) coordinate plane. It + * is used to identify a layer coordinate (column/row) in NatTable. + * <p> + * Note that the x and y values are final. + * </p> + */ +public class PositionCoordinate { + + /** + * the x coordinate of the point + */ + public final BigInteger x; + + /** + * the y coordinate of the point + */ + public final BigInteger y; + + /** + * Constructs a new position coordinate with the given x and y coordinates. + * + * @param x + * the x coordinate of the new point + * @param y + * the y coordinate of the new point + */ + public PositionCoordinate(BigInteger x, BigInteger y) { + this.x = x; + this.y = y; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.x == null) ? 0 : this.x.hashCode()); + result = prime * result + ((this.y == null) ? 0 : this.y.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PositionCoordinate other = (PositionCoordinate) obj; + if (this.x == null) { + if (other.x != null) + return false; + } else if (!this.x.equals(other.x)) + return false; + if (this.y == null) { + if (other.y != null) + return false; + } else if (!this.y.equals(other.y)) + return false; + return true; + } + + @Override + public String toString() { + return "PositionCoordinate {" + this.x + ", " + this.y + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + +}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionRectangle.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionRectangle.java new file mode 100644 index 0000000..8239b77 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/geometry/PositionRectangle.java
@@ -0,0 +1,391 @@ +/******************************************************************************* + * Copyright (c) 2014 Dirk Fauth, Edwin Park. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation + * Edwin Park <esp1@cornell.edu> - initial API and implementation + ******************************************************************************/ +package org.eclipse.nebula.widgets.nattable.core.geometry; + +import java.math.BigInteger; + +/** + * Instances of this class represent rectangular areas in an (x, y) coordinate + * system. The top left corner of the rectangle is specified by its x and y + * values, and the extent of the rectangle is specified by its width and height. + * The values are stored as BigInteger values because newer UI toolkits use + * BigIntegers to identify coordinates to support scaling. + * <p> + * There might be an implementation for this in every UI toolkit, like + * org.eclipse.swt.graphics.Rectangle or java.awt.Rectangle, but they are + * dependent to the UI toolkit because of their package and inheritance. That's + * why we re-implemented it again to make use of it in NatTable core without any + * further dependencies. + * </p> + */ +public class PositionRectangle { + + private static final BigInteger NONE = BigInteger.valueOf(-1); + + /** + * the x coordinate of the rectangle + */ + public BigInteger x; + + /** + * the y coordinate of the rectangle + */ + public BigInteger y; + + /** + * the width of the rectangle + */ + public BigInteger width; + + /** + * the height of the rectangle + */ + public BigInteger height; + + /** + * Construct a new instance of this class given the x, y, width and height + * values. + * <p> + * This constructor is used for backwards compatibility because the layers + * are not yet updated for huge data sets and still use <code>int</code> to + * identify coordinates. + * </p> + * + * @param x + * the x coordinate of the origin of the rectangle + * @param y + * the y coordinate of the origin of the rectangle + * @param width + * the width of the rectangle + * @param height + * the height of the rectangle + */ + public PositionRectangle(Integer x, Integer y, Integer width, Integer height) { + this.x = x != null ? BigInteger.valueOf(x) : NONE; + this.y = y != null ? BigInteger.valueOf(y) : NONE; + this.width = width != null ? BigInteger.valueOf(width) : NONE; + this.height = height != null ? BigInteger.valueOf(height) : NONE; + } + + /** + * Construct a new instance of this class given the x, y, width and height + * values. + * + * @param x + * the x coordinate of the origin of the rectangle + * @param y + * the y coordinate of the origin of the rectangle + * @param width + * the width of the rectangle + * @param height + * the height of the rectangle + */ + public PositionRectangle(BigInteger x, BigInteger y, BigInteger width, BigInteger height) { + this.x = x != null ? x : NONE; + this.y = y != null ? y : NONE; + this.width = width != null ? width : NONE; + this.height = height != null ? height : NONE; + } + + /** + * Destructively replaces the x, y, width and height values in the receiver + * with ones which represent the union of the rectangles specified by the + * receiver and the given rectangle. + * <p> + * The union of two rectangles is the smallest single rectangle that + * completely covers both of the areas covered by the two given rectangles. + * </p> + * + * @param rect + * the rectangle to merge with the receiver + * + * @throws IllegalArgumentException + * if the specified rectangle is <code>null</code> + */ + public void add(PositionRectangle rect) { + if (rect == null) + throw new IllegalArgumentException("rectangle can not be null"); //$NON-NLS-1$ + BigInteger left = this.x.min(rect.x); + BigInteger top = this.y.min(rect.y); + BigInteger lhs = this.x.add(this.width); + BigInteger rhs = rect.x.add(rect.width); + BigInteger right = lhs.max(rhs); + lhs = this.y.add(this.height); + rhs = rect.y.add(rect.height); + BigInteger bottom = lhs.max(rhs); + this.x = left; + this.y = top; + this.width = right.subtract(left); + this.height = bottom.subtract(top); + } + + /** + * Returns <code>true</code> if the point specified by the arguments is + * inside the area specified by the receiver, and <code>false</code> + * otherwise. + * + * @param x + * the x coordinate of the point to test for containment + * @param y + * the y coordinate of the point to test for containment + * @return <code>true</code> if the rectangle contains the point and + * <code>false</code> otherwise + * + * @throws IllegalArgumentException + * if on of the specified coordinates is <code>null</code> + */ + public boolean contains(BigInteger x, BigInteger y) { + if (x == null || y == null) + throw new IllegalArgumentException("coordinates can not be null"); //$NON-NLS-1$ + return (x.compareTo(this.x) >= 0) + && (y.compareTo(this.y) >= 0) + && (x.compareTo(this.x.add(this.width)) < 0) + && (y.compareTo(this.y.add(this.height)) < 0); + } + + /** + * Returns <code>true</code> if the given pixel coordinate is inside the + * area specified by the receiver, and <code>false</code> otherwise. + * + * @param pt + * the point to test for containment + * @return <code>true</code> if the rectangle contains the point and + * <code>false</code> otherwise + * + * @throws IllegalArgumentException + * if the specified point is <code>null</code> + */ + public boolean contains(PositionCoordinate pt) { + if (pt == null) + throw new IllegalArgumentException("pixel coordinate can not be null"); //$NON-NLS-1$ + return contains(pt.x, pt.y); + } + + /** + * Returns <code>true</code> if the receiver does not cover any area in the + * (x, y) coordinate plane, and <code>false</code> if the receiver does + * cover some area in the plane. + * <p> + * A rectangle is considered to <em>cover area</em> in the (x, y) coordinate + * plane if both its width and height are non-zero. + * </p> + * + * @return <code>true</code> if the receiver is empty, and + * <code>false</code> otherwise + */ + public boolean isEmpty() { + return (this.width.compareTo(BigInteger.ZERO) <= 0) + || (this.height.compareTo(BigInteger.ZERO) <= 0); + } + + /** + * Destructively replaces the x, y, width and height values in the receiver + * with ones which represent the intersection of the rectangles specified by + * the receiver and the given rectangle. + * + * @param rect + * the rectangle to intersect with the receiver + * + * @throws IllegalArgumentException + * if the specified rectangle is <code>null</code> + */ + public void intersect(PositionRectangle rect) { + if (rect == null) + throw new IllegalArgumentException("rectangle can not be null"); //$NON-NLS-1$ + if (this == rect) + return; + BigInteger left = this.x.max(rect.x); + BigInteger top = this.y.max(rect.y); + BigInteger lhs = this.x.add(this.width); + BigInteger rhs = rect.x.add(rect.width); + BigInteger right = lhs.min(rhs); + lhs = this.y.add(this.height); + rhs = rect.y.add(rect.height); + BigInteger bottom = lhs.min(rhs); + this.x = right.compareTo(left) < 0 ? BigInteger.ZERO : left; + this.y = bottom.compareTo(top) < 0 ? BigInteger.ZERO : top; + this.width = right.compareTo(left) < 0 ? BigInteger.ZERO : right.subtract(left); + this.height = bottom.compareTo(top) < 0 ? BigInteger.ZERO : bottom.subtract(top); + } + + /** + * Returns a new rectangle which represents the intersection of the receiver + * and the given rectangle. + * <p> + * The intersection of two rectangles is the rectangle that covers the area + * which is contained within both rectangles. + * </p> + * + * @param rect + * the rectangle to intersect with the receiver + * @return the intersection of the receiver and the argument + * + * @throws IllegalArgumentException + * if the specified rectangle is <code>null</code> + */ + public PositionRectangle intersection(PositionRectangle rect) { + if (rect == null) + throw new IllegalArgumentException("rectangle can not be null"); //$NON-NLS-1$ + if (this == rect) + return new PositionRectangle(this.x, this.y, this.width, this.height); + BigInteger left = this.x.max(rect.x); + BigInteger top = this.y.max(rect.y); + BigInteger lhs = this.x.add(this.width); + BigInteger rhs = rect.x.add(rect.width); + BigInteger right = lhs.min(rhs); + lhs = this.y.add(this.height); + rhs = rect.y.add(rect.height); + BigInteger bottom = lhs.min(rhs); + return new PositionRectangle( + right.compareTo(left) < 0 ? BigInteger.ZERO : left, + bottom.compareTo(top) < 0 ? BigInteger.ZERO : top, + right.compareTo(left) < 0 ? BigInteger.ZERO : right.subtract(left), + bottom.compareTo(top) < 0 ? BigInteger.ZERO : bottom.subtract(top)); + } + + /** + * Returns <code>true</code> if the rectangle described by the arguments + * intersects with the receiver and <code>false</code> otherwise. + * <p> + * Two rectangles intersect if the area of the rectangle representing their + * intersection is not empty. + * </p> + * + * @param x + * the x coordinate of the origin of the rectangle + * @param y + * the y coordinate of the origin of the rectangle + * @param width + * the width of the rectangle + * @param height + * the height of the rectangle + * @return <code>true</code> if the rectangle intersects with the receiver, + * and <code>false</code> otherwise + * + * @see #intersection(PositionRectangle) + * @see #isEmpty() + * + * @throws IllegalArgumentException + * if on of the specified values is <code>null</code> + */ + public boolean intersects(BigInteger x, BigInteger y, BigInteger width, BigInteger height) { + if (x == null || y == null || width == null || height == null) + throw new IllegalArgumentException("none of the values can be null"); //$NON-NLS-1$ + return (x.compareTo(this.x.add(this.width)) < 0) && (y.compareTo(this.y.add(this.height)) < 0) && + (x.add(width).compareTo(this.x) > 0) && (y.add(height).compareTo(this.y) > 0); + } + + /** + * Returns <code>true</code> if the given rectangle intersects with the + * receiver and <code>false</code> otherwise. + * <p> + * Two rectangles intersect if the area of the rectangle representing their + * intersection is not empty. + * </p> + * + * @param rect + * the rectangle to test for intersection + * @return <code>true</code> if the rectangle intersects with the receiver, + * and <code>false</code> otherwise + * + * @throws IllegalArgumentException + * if the specified rectangle is <code>null</code> + * + * @see #intersection(PositionRectangle) + * @see #isEmpty() + */ + public boolean intersects(PositionRectangle rect) { + if (rect == null) + throw new IllegalArgumentException("rectangle can not be null"); //$NON-NLS-1$ + return rect == this || intersects(rect.x, rect.y, rect.width, rect.height); + } + + /** + * Returns a new rectangle which represents the union of the receiver and + * the given rectangle. + * <p> + * The union of two rectangles is the smallest single rectangle that + * completely covers both of the areas covered by the two given rectangles. + * </p> + * + * @param rect + * the rectangle to perform union with + * @return the union of the receiver and the argument + * + * @throws IllegalArgumentException + * if the specified rectangle is <code>null</code> + * + * @see #add(PositionRectangle) + */ + public PositionRectangle union(PositionRectangle rect) { + if (rect == null) + throw new IllegalArgumentException("rectangle can not be null"); //$NON-NLS-1$ + BigInteger left = this.x.min(rect.x); + BigInteger top = this.y.min(rect.y); + BigInteger lhs = this.x.add(this.width); + BigInteger rhs = rect.x.add(rect.width); + BigInteger right = lhs.max(rhs); + lhs = this.y.add(this.height); + rhs = rect.y.add(rect.height); + BigInteger bottom = lhs.max(rhs); + return new PositionRectangle(left, top, right.subtract(left), bottom.subtract(top)); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.height == null) ? 0 : this.height.hashCode()); + result = prime * result + ((this.width == null) ? 0 : this.width.hashCode()); + result = prime * result + ((this.x == null) ? 0 : this.x.hashCode()); + result = prime * result + ((this.y == null) ? 0 : this.y.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PositionRectangle other = (PositionRectangle) obj; + if (this.height == null) { + if (other.height != null) + return false; + } else if (!this.height.equals(other.height)) + return false; + if (this.width == null) { + if (other.width != null) + return false; + } else if (!this.width.equals(other.width)) + return false; + if (this.x == null) { + if (other.x != null) + return false; + } else if (!this.x.equals(other.x)) + return false; + if (this.y == null) { + if (other.y != null) + return false; + } else if (!this.y.equals(other.y)) + return false; + return true; + } + + @Override + public String toString() { + return "PositionRectangle {" + this.x + ", " + this.y + ", " + this.width + ", " + this.height + "}"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + } + +}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/Color.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/Color.java new file mode 100644 index 0000000..7ab38a2 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/Color.java
@@ -0,0 +1,117 @@ +/******************************************************************************* + * Copyright (c) 2014, 2015 Dirk Fauth, Edwin Park. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation + * Edwin Park <esp1@cornell.edu> - initial API and implementation + ******************************************************************************/ +package org.eclipse.nebula.widgets.nattable.core.ui.rendering; + +/** + * UI independent implementation for a rgb based color that transports the + * necessary information to create a color instance for a specific UI toolkit. + */ +public class Color { + + /** + * the red component, in the range {@code 0-255} + */ + public final int red; + /** + * the green component, in the range {@code 0-255} + */ + public final int green; + /** + * the blue component, in the range {@code 0-255} + */ + public final int blue; + /** + * the opacity component, in the range {@code 0.0-1.0} + */ + public final double opacity; + /** + * The native color object for the UI toolkit in use, that matches this + * {@link Color} instance. Used to reduce the amount of UI toolkit color + * objects on rendering. + */ + private Object nativeColor; + + /** + * Creates a color with the specified RGB values in the range {@code 0-255}, + * and a opacity of {@code 1.0} (respectively {@code 255}). + * + * @param red + * the red component, in the range {@code 0-255} + * @param green + * the green component, in the range {@code 0-255} + * @param blue + * the blue component, in the range {@code 0-255} + */ + public Color(int red, int green, int blue) { + this(red, green, blue, 1.0); + } + + /** + * Creates a color with the specified RGB values in the range {@code 0-255}, + * and a given opacity in the range {@code 0-255}. The opacity value will be + * calculated to a double value in the range {@code 0.0-1.0}. + * + * @param red + * the red component, in the range {@code 0-255} + * @param green + * the green component, in the range {@code 0-255} + * @param blue + * the blue component, in the range {@code 0-255} + * @param opacity + * the opacity component, in the range {@code 0-255} + */ + public Color(int red, int green, int blue, int opacity) { + this(red, green, blue, Double.valueOf(opacity / 255)); + } + + /** + * Creates a color with the specified RGB values in the range {@code 0-255}, + * and a given opacity in the range {@code 0.0-1.0}. + * + * @param red + * the red component, in the range {@code 0-255} + * @param green + * the green component, in the range {@code 0-255} + * @param blue + * the blue component, in the range {@code 0-255} + * @param opacity + * the opacity component, in the range {@code 0.0-1.0} + */ + public Color(int red, int green, int blue, double opacity) { + this.red = red; + this.green = green; + this.blue = blue; + this.opacity = opacity; + } + + /** + * @return the native color object for the UI toolkit in use, that matches + * this {@link Color} instance. + */ + public Object getNativeColor() { + return this.nativeColor; + } + + /** + * Set the native color object for the UI toolkit in use, that matches this + * {@link Color} instance. Will be called by the {@link GraphicsContext} + * implementation the first time the corresponding native color object is + * retrieved. + * + * @param nativeColor + * the native color object for the UI toolkit in use, that + * matches this {@link Color} instance. + */ + public void setNativeColor(Object nativeColor) { + this.nativeColor = nativeColor; + } +}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/Font.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/Font.java new file mode 100644 index 0000000..26b359a --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/Font.java
@@ -0,0 +1,174 @@ +/******************************************************************************* + * Copyright (c) 2015 Dirk Fauth. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation + ******************************************************************************/ +package org.eclipse.nebula.widgets.nattable.core.ui.rendering; + +/** + * UI independent implementation for a font that transports the necessary + * information to create a font instance for a specific UI toolkit. + */ +public class Font { + + /** + * Note that not every UI toolkit supports every {@link FontStyle}. For SWT + * for example, only NORMAL, BOLD and ITALIC are supported. The others will + * be translated to the closest matching ones. + */ + public enum FontStyle { + /** + * represents the regular font posture + */ + REGULAR, + /** + * represents the italic font posture + */ + ITALIC, + /** + * represents the black font weight + */ + BLACK, + /** + * represents the bold font weight + */ + BOLD, + /** + * represents the extra bold font weight + */ + EXTRA_BOLD, + /** + * represents the extra light font weight + */ + EXTRA_LIGHT, + /** + * represents the light font weight + */ + LIGHT, + /** + * represents the medium font weight + */ + MEDIUM, + /** + * represents the normal font weight + */ + NORMAL, + /** + * represents the semi bold font weight + */ + SEMI_BOLD, + /** + * represents the thin font weight + */ + THIN + } + + /** + * the name of the font family + */ + public final String name; + /** + * the font height + */ + public final double height; + /** + * the font styles + */ + public final FontStyle[] style; + /** + * The native font object for the UI toolkit in use, that matches this + * {@link Font} instance. Used to reduce the amount of UI toolkit font + * objects on rendering. + */ + private Object nativeFont; + + /** + * Create a {@link Font} instance that will use the default font of the UI + * toolkit (typically the system default font). + */ + public Font() { + this(null, -1, null); + } + + /** + * Create a {@link Font} instance that will search for a font with the given + * font family name and the default font size (typically the system default + * font size). + * + * @param name + * the name of the font family + */ + public Font(String name) { + this(name, -1, null); + } + + /** + * Create a {@link Font} instance that will use the default font of the UI + * toolkit (typically the system default font) and the given font height. + * + * @param height + * the font height + */ + public Font(double height) { + this(null, height, null); + } + + /** + * Create a {@link Font} instance that will search for a font with the given + * font family name and the given font size. + * + * @param name + * the name of the font family + * @param height + * the font height + */ + public Font(String name, double height) { + this(name, height, null); + } + + /** + * Create a {@link Font} instance that will search for a font with the given + * font family name, the given font size and the font styles for font weight + * and font posture. + * + * @param name + * the name of the font family + * @param height + * the font height + * @param style + * array of {@link FontStyle} values for font weight and font + * posture. + */ + public Font(String name, double height, FontStyle[] style) { + this.name = name; + this.height = height; + this.style = style; + } + + /** + * @return the native font object for the UI toolkit in use, that matches + * this {@link Font} instance. + */ + public Object getNativeFont() { + return this.nativeFont; + } + + /** + * Set the native font object for the UI toolkit in use, that matches this + * {@link Font} instance. Will be called by the {@link GraphicsContext} + * implementation the first time the corresponding native font object is + * retrieved. + * + * @param nativeFont + * the native font object for the UI toolkit in use, that matches + * this {@link Font} instance. + */ + public void setNativeFont(Object nativeFont) { + this.nativeFont = nativeFont; + } +}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/GraphicsContext.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/GraphicsContext.java new file mode 100644 index 0000000..34a3167 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/GraphicsContext.java
@@ -0,0 +1,265 @@ +/******************************************************************************* + * Copyright (c) 2014 Dirk Fauth, Edwin Park. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation + * Edwin Park <esp1@cornell.edu> - initial API and implementation + ******************************************************************************/ +package org.eclipse.nebula.widgets.nattable.core.ui.rendering; + +import org.eclipse.nebula.widgets.nattable.core.geometry.PixelRectangle; +import org.eclipse.nebula.widgets.nattable.style.IStyle; + +/** + * Interface for implementing a proxy to a UI toolkit dependent graphics context + * implementation. The graphics context is at the end the on who paints lines + * shapes etc. to the canvas to create the NatTable. + * + * e.g. org.eclipse.swt.graphics.GC + * + */ +public interface GraphicsContext { + + /** + * Takes the styling attributes of an {@link IStyle} and applies them to the + * UI toolkit graphics context. + * <p> + * It is a good practice to store the current state of the graphics context + * prior to calling this method. Use {@link GraphicsContext#pushState()} for + * this. + * </p> + * <p> + * After the drawing operations are done it is also good practice to reset + * the applied settings using {@link GraphicsContext#popState()}. + * </p> + * + * @param style + * {@link IStyle} instance containing the style information that + * should be used in the following painting operations. + */ + void initStyle(IStyle style); + + /** + * Draws the specified text at the position specified by x and y + * coordinates. Ensure that drawing the text doesn't draw a background and + * line delimiters are handled correctly. + * + * @param text + * The text to draw. + * @param x + * the x coordinate of the top left corner of the rectangular + * area where the text is to be drawn + * @param y + * the y coordinate of the top left corner of the rectangular + * area where the text is to be drawn + */ + void drawText(String text, double x, double y); + + /** + * Draws a line, using the foreground color, between the points ( + * <code>x1</code>, <code>y1</code>) and (<code>x2</code>, <code>y2</code>). + * + * @param x1 + * the first point's x coordinate + * @param y1 + * the first point's y coordinate + * @param x2 + * the second point's x coordinate + * @param y2 + * the second point's y coordinate + */ + void drawLine(double x1, double y1, double x2, double y2); + + /** + * Draws a rectangle with the specified bounds using the foreground color. + * + * @param rect + * The rectangle's pixel bounds. + */ + void drawRectangle(PixelRectangle rect); + + /** + * Fills the specified rectangular pixel area with the background color. + * + * @param rect + * The rectangle's pixel bounds. + */ + void fillRectangle(PixelRectangle rect); + + /** + * Returns the calculated pixel width of the given string if drawn in the + * current font in the receiver. Tab expansion and carriage return + * processing are performed. + * <p> + * + * @param text + * the text to measure + * @return the width in pixels + */ + double calculateTextWidth(String text); + + /** + * Returns the height of the font currently being used by the receiver, + * measured in pixels. A font's height is the sum of its ascent, descent and + * leading area. + * + * @return The height of the font currently being used. + */ + double getFontHeight(); + + // State + + /** + * Saves the current graphics context property state and pushes it onto a + * stack. + */ + void pushState(); + + /** + * Pops the last saved graphics context state and restores all properties + * back to what they were when that state was saved. + */ + void popState(); + + /** + * Returns the bounding rectangle of the receiver's clipping region. If no + * clipping region is set, the return value will be a rectangle which covers + * the entire bounds of the object the receiver is drawing on. + * + * @return The bounding rectangle of the clipping region. + */ + PixelRectangle getClipping(); + + /** + * Sets the area of the receiver which can be changed by drawing operations + * to the rectangular area specified by the argument. Specifying null for + * the rectangle reverts the receiver's clipping area to its original value. + * + * @param clipBounds + * The clipping rectangle or <code>null</code>. + */ + void setClipping(PixelRectangle clipBounds); + + /** + * Set the foreground color. + * + * @param foregroundColor + * The new foreground color to use. + */ + void setForeground(Color foregroundColor); + + /** + * Set the background color. + * + * @param backgroundColor + * The new background color to use. + */ + void setBackground(Color backgroundColor); + + /** + * Transforms the given NatTable {@link Color} to the UI toolkit dependent + * color implementation instance. Used internally to operate with UI toolkit + * dependent color instances. + * <p> + * For optimization, this method should also set the UI toolkit dependent + * color instance as native value to the {@link Color} instance. This way + * resource allocation and the number of created objects is reduced. + * </p> + * <p> + * Note: On overriding you can return the specific color implementation of + * the UI toolkit to avoid later casting operations. + * </p> + * + * @param color + * The NatTable {@link Color} that transports the necessary + * information to build up a UI dependent color object. + * @return A UI toolkit color instance. + */ + Object getUiColor(Color color); + + // TODO + // void setLineStyle(int style); + // + // void setLineDash(int dash); + // + // void setLineWidth(int width); + // + // void setAntialias(int antialias); + // + // void setTextAntialias(int antialias); + + /** + * Set the font. + * + * @param font + * The new font to use. + */ + void setFont(Font font); + + /** + * Transforms the given NatTable {@link Font} to the UI toolkit dependent + * font implementation instance. Used internally to operate with UI toolkit + * dependent font instances. + * <p> + * For optimization, this method should also set the UI toolkit dependent + * font instance as native value to the {@link Font} instance. This way + * resource allocation and the number of created objects is reduced. + * </p> + * <p> + * Note: On overriding you can return the specific font implementation of + * the UI toolkit to avoid later casting operations. + * </p> + * + * @param font + * The NatTable {@link Font} that transports the necessary + * information to build up a UI dependent font object. + * @return A UI toolkit font instance. + */ + Object getUiFont(Font font); + + /** + * Draws the given image at the specified coordinates. + * + * @param image + * the image to draw + * @param x + * the x coordinate of where to draw + * @param y + * the y coordinate of where to draw + */ + void drawImage(Image image, double x, double y); + + /** + * Transforms the given NatTable {@link Image} to the UI toolkit dependent + * image implementation instance. Used internally to operate with UI toolkit + * dependent image instances. + * <p> + * For optimization, this method should also set the UI toolkit dependent + * image instance as native value to the {@link Image} instance. This way + * resource allocation and the number of created objects is reduced. + * </p> + * <p> + * Note: On overriding you can return the specific image implementation of + * the UI toolkit to avoid later casting operations. + * </p> + * + * @param image + * The NatTable {@link Image} that transports the necessary + * information to build up a UI dependent image object. + * @return A UI toolkit image instance. + */ + Object getUiImage(Image image); + + /** + * Sets the current transform. + * + * @param transform + * The transformation that should be applied or <code>null</code> + * to reset an applied transformation. + */ + void setTransform(Transform transform); +}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/Image.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/Image.java new file mode 100644 index 0000000..5b4f503 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/Image.java
@@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2015 Dirk Fauth. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation + ******************************************************************************/ +package org.eclipse.nebula.widgets.nattable.core.ui.rendering; + +import java.net.URL; + +import org.eclipse.nebula.widgets.nattable.util.GUIHelper; + +/** + * UI independent implementation for an image that should be rendered in a + * NatTable. It simply transports the {@link URL} that points to the image. The + * {@link GraphicsContext} implementation for a specific UI toolkit is + * responsible to load the corresponding image object. + * <p> + * For optimization purposes regarding object creation and resource allocation, + * the {@link GraphicsContext} will set the UI toolkit native image + * representation to the {@link Image}. This way images only need to be loaded + * once. + * </p> + */ +public class Image { + + /** + * the {@link URL} that points to the image file + */ + public final URL url; + /** + * The native image object for the UI toolkit in use, that matches this + * {@link Image} instance. Used to reduce the amount of UI toolkit image + * objects and corresponding resource allocation on rendering. + */ + private Object nativeImage; + + // TODO boolean flag need upscaling + + // TODO on init check for scaling + + /** + * Create an {@link Image} that points to a NatTable internal image. + * + * @param name + * the name of the NatTable internal image + */ + public Image(String name) { + this(GUIHelper.getInternalImageUrl(name)); + } + + /** + * Create an {@link Image} that points to an image located at the specified + * {@link URL}. + * + * @param url + * the {@link URL} that points to the image file + */ + public Image(URL url) { + this.url = url; + } + + /** + * @return the native image object for the UI toolkit in use, that matches + * this {@link Image} instance. + */ + public Object getNativeImage() { + return this.nativeImage; + } + + /** + * Set the native image object for the UI toolkit in use, that matches this + * {@link Image} instance. Will be called by the {@link GraphicsContext} + * implementation the first time the corresponding native image object is + * retrieved. + * + * @param nativeImage + * the native image object for the UI toolkit in use, that + * matches this {@link Image} instance. + */ + public void setNativeImage(Object nativeImage) { + this.nativeImage = nativeImage; + } +}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/Transform.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/Transform.java new file mode 100644 index 0000000..6aead8c --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/ui/rendering/Transform.java
@@ -0,0 +1,119 @@ +package org.eclipse.nebula.widgets.nattable.core.ui.rendering; + +/** + * Wrapper class to transport transformation informations that can be used to + * create a UI toolkit dependent transformation. + */ +public class Transform { + + private Float angle; + + private Float scaleX; + private Float scaleY; + + private Float offsetX; + private Float offsetY; + + /** + * Modifies the receiver so that it represents a transformation that is + * equivalent to its previous transformation rotated by the specified angle. + * The angle is specified in degrees and for the identity transform 0 + * degrees is at the 3 o'clock position. A positive value indicates a + * clockwise rotation while a negative value indicates a counter-clockwise + * rotation. + * + * @param angle + * the angle to rotate the transformation by + */ + public void rotate(float angle) { + this.angle = angle; + } + + /** + * Modifies the receiver so that it represents a transformation that is + * equivalent to its previous transformation scaled by (scaleX, scaleY). + * + * @param scaleX + * the amount to scale in the X direction + * @param scaleY + * the amount to scale in the Y direction + */ + public void scale(float scaleX, float scaleY) { + this.scaleX = scaleX; + this.scaleY = scaleY; + } + + /** + * Modifies the receiver so that it represents a transformation that is + * equivalent to its previous transformation translated by (offsetX, + * offsetY). + * + * @param offsetX + * the distance to translate in the X direction + * @param offsetY + * the distance to translate in the Y direction + */ + public void translate(float offsetX, float offsetY) { + this.offsetX = offsetX; + this.offsetY = offsetY; + } + + /** + * @return <code>true</code> if this transformation is configured for + * rotation + */ + public boolean hasRotation() { + return this.angle != null; + } + + /** + * @return <code>true</code> if this transformation is configured for + * scaling + */ + public boolean hasScaling() { + return this.scaleX != null && this.scaleY != null; + } + + /** + * @return <code>true</code> if this transformation is configured for + * translation + */ + public boolean hasTranslation() { + return this.offsetX != null && this.offsetY != null; + } + + /** + * @return the angle to rotate the transformation by + */ + public float getAngle() { + return this.angle; + } + + /** + * @return the amount to scale in the X direction + */ + public float getScaleX() { + return this.scaleX; + } + + /** + * @return the amount to scale in the Y direction + */ + public float getScaleY() { + return this.scaleY; + } + + /** + * @return the distance to translate in the X direction + */ + public float getOffsetX() { + return this.offsetX; + } + + /** + * @return the distance to translate in the Y direction + */ + public float getOffsetY() { + return this.offsetY; + } +}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/util/GUIHelper.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/util/GUIHelper.java index 05afe07..9ecda9b 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/util/GUIHelper.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/util/GUIHelper.java
@@ -210,6 +210,33 @@ public static Image getImageByURL(String key, URL url) { return image; } + public static URL getScaledImageURL(URL url) { + if (needScaling()) { + // modify url to contain scaling information in filename + // create the matching URL for the scaled image + String urlString = url.toString(); + int extIndex = urlString.lastIndexOf('.'); + String ext = urlString.substring(extIndex, urlString.length()); + String base = urlString.substring(0, extIndex); + + // check if there is a upscaled image available + try { + URL scaleURL = new URL(base + getScalingImageSuffix() + ext); + URLConnection con = scaleURL.openConnection(); + con.connect(); + // as the connection could be established, the file exists + // this check is working in plain SWT aswell as in the OSGi + // context + return scaleURL; + } catch (IOException e) { + // do nothing, there is no upscaled image available, so we + // simply use the given URL + } + } + // scaling is not necessary, so just return the given URL + return url; + } + /** * Returns the {@link Image} representation of a NatTable internal image * resource. @@ -281,9 +308,10 @@ public static ImageDescriptor getImageDescriptor(String imageName) { * there is no image found for the given name at the internal image * resource location. */ - private static URL getInternalImageUrl(String imageName) { + public static URL getInternalImageUrl(String imageName) { for (String dir : IMAGE_DIRS) { for (String ext : IMAGE_EXTENSIONS) { + // TODO remove direct scaling information addition // add search for scaled image // e.g. imageName = checkbox --> // org/eclipse/nebula/widgets/nattable/images/checkbox_128_128.png
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/META-INF/MANIFEST.MF index 0f27f1c..06631f2 100644 --- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/META-INF/MANIFEST.MF +++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists.test/META-INF/MANIFEST.MF
@@ -5,7 +5,7 @@ Bundle-Version: 1.2.0.qualifier Fragment-Host: org.eclipse.nebula.widgets.nattable.extension.glazedlists Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: org.junit4 +Require-Bundle: org.junit;bundle-version="4.11.0" Import-Package: org.eclipse.jface.viewers, org.eclipse.nebula.widgets.nattable.extension.glazedlists.filterrow, org.eclipse.nebula.widgets.nattable.filterrow.command,
diff --git a/org.eclipse.nebula.widgets.nattable.ui.javafx/.classpath b/org.eclipse.nebula.widgets.nattable.ui.javafx/.classpath new file mode 100644 index 0000000..eca7bdb --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.javafx/.classpath
@@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath>
diff --git a/org.eclipse.nebula.widgets.nattable.ui.javafx/.project b/org.eclipse.nebula.widgets.nattable.ui.javafx/.project new file mode 100644 index 0000000..30f5a2e --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.javafx/.project
@@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.nebula.widgets.nattable.ui.javafx</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription>
diff --git a/org.eclipse.nebula.widgets.nattable.ui.javafx/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.nebula.widgets.nattable.ui.javafx/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..73d1d24 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.javafx/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,291 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=1 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=64 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=240 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/org.eclipse.nebula.widgets.nattable.ui.javafx/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.nebula.widgets.nattable.ui.javafx/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..04015e6 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.javafx/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,62 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_NatTable +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=true +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=true +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_type_arguments=false +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.use_type_arguments=false
diff --git a/org.eclipse.nebula.widgets.nattable.ui.javafx/.settings/org.eclipse.pde.core.prefs b/org.eclipse.nebula.widgets.nattable.ui.javafx/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 0000000..f29e940 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.javafx/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false
diff --git a/org.eclipse.nebula.widgets.nattable.ui.javafx/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.ui.javafx/META-INF/MANIFEST.MF new file mode 100644 index 0000000..8df5b03 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.javafx/META-INF/MANIFEST.MF
@@ -0,0 +1,47 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: NatTable JavaFX UI +Bundle-SymbolicName: org.eclipse.nebula.widgets.nattable.ui.javafx +Bundle-Version: 2.0.0.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Eclipse-ExtensibleAPI: true +Bundle-Vendor: Eclipse Nebula NatTable +Import-Package: com.sun.javafx.tk;version="2.2.0", + javafx.animation;version="2.2.0", + javafx.application;version="2.2.0", + javafx.beans;version="2.2.0", + javafx.beans.binding;version="2.2.0", + javafx.beans.property;version="2.2.0", + javafx.beans.property.adapter;version="2.2.0", + javafx.beans.value;version="2.2.0", + javafx.collections;version="2.2.0", + javafx.collections.transformation;version="8.0.0", + javafx.concurrent;version="2.2.0", + javafx.css;version="8.0.0", + javafx.embed.swing;version="2.2.0", + javafx.embed.swt;version="2.2.0", + javafx.event;version="2.2.0", + javafx.fxml;version="2.2.0", + javafx.geometry;version="2.2.0", + javafx.print;version="8.0.0", + javafx.scene;version="2.2.0", + javafx.scene.canvas;version="2.2.0", + javafx.scene.chart;version="2.2.0", + javafx.scene.control;version="2.2.0", + javafx.scene.control.cell;version="2.2.0", + javafx.scene.effect;version="2.2.0", + javafx.scene.image;version="2.2.0", + javafx.scene.input;version="2.2.0", + javafx.scene.layout;version="2.2.0", + javafx.scene.media;version="2.2.0", + javafx.scene.paint;version="2.2.0", + javafx.scene.shape;version="2.2.0", + javafx.scene.text;version="2.2.0", + javafx.scene.transform;version="2.2.0", + javafx.scene.web;version="2.2.0", + javafx.stage;version="2.2.0", + javafx.util;version="2.2.0", + javafx.util.converter;version="2.2.0", + org.eclipse.nebula.widgets.nattable.core.geometry;version="2.0.0", + org.eclipse.nebula.widgets.nattable.core.ui.rendering;version="2.0.0", + org.eclipse.nebula.widgets.nattable.style;version="2.0.0"
diff --git a/org.eclipse.nebula.widgets.nattable.ui.javafx/build.properties b/org.eclipse.nebula.widgets.nattable.ui.javafx/build.properties new file mode 100644 index 0000000..34d2e4d --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.javafx/build.properties
@@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .
diff --git a/org.eclipse.nebula.widgets.nattable.ui.javafx/src/org/eclipse/nebula/widgets/nattable/ui/javafx/FXGraphicsContext.java b/org.eclipse.nebula.widgets.nattable.ui.javafx/src/org/eclipse/nebula/widgets/nattable/ui/javafx/FXGraphicsContext.java new file mode 100644 index 0000000..d2013a9 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.javafx/src/org/eclipse/nebula/widgets/nattable/ui/javafx/FXGraphicsContext.java
@@ -0,0 +1,332 @@ +/******************************************************************************* + * Copyright (c) 2014 Dirk Fauth, Edwin Park. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation + * Edwin Park <esp1@cornell.edu> - initial API and implementation + ******************************************************************************/ +package org.eclipse.nebula.widgets.nattable.ui.javafx; + +import java.io.IOException; +import java.io.InputStream; + +import javafx.geometry.Bounds; +import javafx.geometry.VPos; +import javafx.scene.effect.BlendMode; +import javafx.scene.paint.Paint; +import javafx.scene.shape.FillRule; +import javafx.scene.shape.StrokeLineCap; +import javafx.scene.shape.StrokeLineJoin; +import javafx.scene.text.FontPosture; +import javafx.scene.text.FontWeight; +import javafx.scene.text.TextAlignment; +import javafx.scene.transform.Affine; + +import org.eclipse.nebula.widgets.nattable.core.geometry.PixelRectangle; +import org.eclipse.nebula.widgets.nattable.core.ui.rendering.Color; +import org.eclipse.nebula.widgets.nattable.core.ui.rendering.Font; +import org.eclipse.nebula.widgets.nattable.core.ui.rendering.Font.FontStyle; +import org.eclipse.nebula.widgets.nattable.core.ui.rendering.GraphicsContext; +import org.eclipse.nebula.widgets.nattable.core.ui.rendering.Image; +import org.eclipse.nebula.widgets.nattable.core.ui.rendering.Transform; +import org.eclipse.nebula.widgets.nattable.style.IStyle; + +import com.sun.javafx.tk.FontMetrics; +import com.sun.javafx.tk.Toolkit; + +@SuppressWarnings("restriction") +public class FXGraphicsContext implements GraphicsContext { + + /** + * The JavaFX {@link javafx.scene.canvas.GraphicsContext} which is proxied + * by this implementation. + */ + private javafx.scene.canvas.GraphicsContext gc; + + private boolean activeClipping; + + /** + * + * @param gc + * The JavaFX {@link javafx.scene.canvas.GraphicsContext} that + * should be proxied by this implementation. + */ + public FXGraphicsContext(javafx.scene.canvas.GraphicsContext gc) { + this.gc = gc; + } + + @Override + public void initStyle(IStyle style) { + // TODO Auto-generated method stub + + } + + @Override + public void drawText(String text, double x, double y) { + this.gc.strokeText(text, x, y); + } + + @Override + public void drawLine(double x1, double y1, double x2, double y2) { + this.gc.strokeLine(x1, y1, x2, y2); + } + + @Override + public void drawRectangle(PixelRectangle rect) { + this.gc.strokeRect(rect.x, rect.y, rect.width, rect.height); + } + + @Override + public void fillRectangle(PixelRectangle rect) { + this.gc.fillRect(rect.x, rect.y, rect.width, rect.height); + } + + @Override + public double calculateTextWidth(String text) { + // as there is no other way to get font metrics we need to use internal + // API here + FontMetrics metrics = Toolkit.getToolkit().getFontLoader().getFontMetrics(this.gc.getFont()); + return metrics.computeStringWidth(text); + } + + @Override + public double getFontHeight() { + // as there is no other way to get font metrics we need to use internal + // API here + FontMetrics metrics = Toolkit.getToolkit().getFontLoader().getFontMetrics(this.gc.getFont()); + return metrics.getLineHeight(); + } + + @Override + public void pushState() { + this.gc.save(); + } + + @Override + public void popState() { + this.gc.restore(); + } + + @Override + public PixelRectangle getClipping() { + return getPixelRectangle(this.gc.getCanvas().getBoundsInLocal()); + } + + @Override + public void setClipping(PixelRectangle clipBounds) { + resetClip(); + + if (clipBounds != null) { + this.activeClipping = true; + + this.gc.save(); + this.gc.beginPath(); + + // if this isn't working well, we need to check the following link + // again + // http://git.eclipse.org/c/efxclipse/org.eclipse.efxclipse.git/tree/experimental/swt/org.eclipse.fx.runtime.swt/src/org/eclipse/swt/internal/CanvasGC.java + this.gc.rect(clipBounds.x, clipBounds.y, clipBounds.width, clipBounds.height); + + this.gc.clip(); + this.gc.closePath(); + } + } + + private void resetClip() { + if (this.activeClipping) { + // Read state of other values + double globalAlpha = this.gc.getGlobalAlpha(); + BlendMode blendop = this.gc.getGlobalBlendMode(); + Affine transform = this.gc.getTransform(); + Paint fill = this.gc.getFill(); + Paint stroke = this.gc.getStroke(); + double linewidth = this.gc.getLineWidth(); + StrokeLineCap linecap = this.gc.getLineCap(); + StrokeLineJoin linejoin = this.gc.getLineJoin(); + double miterlimit = this.gc.getMiterLimit(); + javafx.scene.text.Font font = this.gc.getFont(); + TextAlignment textalign = this.gc.getTextAlign(); + VPos textbaseline = this.gc.getTextBaseline(); + FillRule fillRule = this.gc.getFillRule(); + + // pop the last state from the stack because the clipping is a + // common rendering attribute + this.gc.restore(); + + this.gc.setGlobalAlpha(globalAlpha); + this.gc.setGlobalBlendMode(blendop); + this.gc.setTransform(transform); + this.gc.setFill(fill); + this.gc.setStroke(stroke); + this.gc.setLineWidth(linewidth); + this.gc.setLineCap(linecap); + this.gc.setLineJoin(linejoin); + this.gc.setMiterLimit(miterlimit); + this.gc.setFont(font); + this.gc.setTextAlign(textalign); + this.gc.setTextBaseline(textbaseline); + this.gc.setFillRule(fillRule); + + this.activeClipping = false; + } + } + + private PixelRectangle getPixelRectangle(Bounds rectangle) { + return new PixelRectangle(rectangle.getMinX(), rectangle.getMinY(), rectangle.getWidth(), rectangle.getHeight()); + } + + @Override + public void setForeground(Color foregroundColor) { + this.gc.setStroke(getUiColor(foregroundColor)); + } + + @Override + public void setBackground(Color backgroundColor) { + this.gc.setFill(getUiColor(backgroundColor)); + } + + @Override + public javafx.scene.paint.Color getUiColor(Color color) { + if (color.getNativeColor() == null) { + color.setNativeColor(javafx.scene.paint.Color.rgb(color.red, color.green, color.blue, color.opacity)); + } + if (!(color.getNativeColor() instanceof javafx.scene.paint.Color)) { + throw new IllegalStateException("native color instance in color wrapper is invalid"); + } + return (javafx.scene.paint.Color) color.getNativeColor(); + } + + @Override + public void setFont(Font font) { + this.gc.setFont(getUiFont(font)); + } + + @Override + public javafx.scene.text.Font getUiFont(Font font) { + if (font.getNativeFont() == null) { + // if all attributes are not set, use the default font + if (font.name == null && font.height == -1 && font.style == null) { + font.setNativeFont(javafx.scene.text.Font.getDefault()); + } + else { + if (font.name != null && font.height == -1 && font.style == null) { + font.setNativeFont(javafx.scene.text.Font.font(font.name)); + } + else if (font.name == null && font.height >= 0 && font.style == null) { + font.setNativeFont(javafx.scene.text.Font.font(font.height)); + } + else if (font.name != null && font.height >= 0 && font.style == null) { + font.setNativeFont(javafx.scene.text.Font.font(font.name, font.height)); + } + else if (font.style != null) { + javafx.scene.text.Font defaultFont = javafx.scene.text.Font.getDefault(); + String fontName = (font.name == null) ? defaultFont.getName() : font.name; + double height = (font.height == -1) ? defaultFont.getSize() : font.height; + + FontPosture posture = null; + FontWeight weight = null; + for (FontStyle style : font.style) { + switch (style) { + case ITALIC: + posture = FontPosture.ITALIC; + break; + case REGULAR: + posture = FontPosture.REGULAR; + break; + case BLACK: + weight = FontWeight.BLACK; + break; + case BOLD: + weight = FontWeight.BOLD; + break; + case EXTRA_BOLD: + weight = FontWeight.EXTRA_BOLD; + break; + case EXTRA_LIGHT: + weight = FontWeight.EXTRA_LIGHT; + break; + case LIGHT: + weight = FontWeight.LIGHT; + break; + case MEDIUM: + weight = FontWeight.MEDIUM; + break; + case NORMAL: + weight = FontWeight.NORMAL; + break; + case SEMI_BOLD: + weight = FontWeight.SEMI_BOLD; + break; + case THIN: + weight = FontWeight.THIN; + break; + } + } + + if (posture != null && weight != null) { + font.setNativeFont(javafx.scene.text.Font.font(fontName, weight, posture, height)); + } + else if (posture != null && weight == null) { + font.setNativeFont(javafx.scene.text.Font.font(fontName, posture, height)); + } + else if (posture == null && weight != null) { + font.setNativeFont(javafx.scene.text.Font.font(fontName, weight, height)); + } + } + } + } + if (!(font.getNativeFont() instanceof javafx.scene.text.Font)) { + throw new IllegalStateException("native font instance in font wrapper is invalid"); + } + return (javafx.scene.text.Font) font.getNativeFont(); + } + + @Override + public void drawImage(Image image, double x, double y) { + this.gc.drawImage(getUiImage(image), x, y); + } + + @Override + public javafx.scene.image.Image getUiImage(Image image) { + if (image.getNativeImage() == null) { + // TODO check scaling + try (InputStream in = image.url.openStream()) { + image.setNativeImage(new javafx.scene.image.Image(in)); + } catch (IOException e) { + // TODO logging + } + } + if (!(image.getNativeImage() instanceof javafx.scene.image.Image)) { + throw new IllegalStateException("native image instance in image wrapper is invalid"); + } + return (javafx.scene.image.Image) image.getNativeImage(); + } + + @Override + public void setTransform(Transform transform) { + if (transform == null) { + // TODO reset transformation - need to be tested + this.gc.rotate(0); + this.gc.scale(0, 0); + this.gc.translate(0, 0); + } + else { + if (transform.hasRotation()) { + this.gc.rotate(transform.getAngle()); + } + + if (transform.hasScaling()) { + this.gc.scale(transform.getScaleX(), transform.getScaleY()); + } + + if (transform.hasTranslation()) { + this.gc.translate(transform.getOffsetX(), transform.getOffsetY()); + } + } + } + +}
diff --git a/org.eclipse.nebula.widgets.nattable.ui.swt/.classpath b/org.eclipse.nebula.widgets.nattable.ui.swt/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.swt/.classpath
@@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath>
diff --git a/org.eclipse.nebula.widgets.nattable.ui.swt/.project b/org.eclipse.nebula.widgets.nattable.ui.swt/.project new file mode 100644 index 0000000..68f02dd --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.swt/.project
@@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.nebula.widgets.nattable.ui.swt</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription>
diff --git a/org.eclipse.nebula.widgets.nattable.ui.swt/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.nebula.widgets.nattable.ui.swt/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..e76440a --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.swt/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,291 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=1 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=64 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=240 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/org.eclipse.nebula.widgets.nattable.ui.swt/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.nebula.widgets.nattable.ui.swt/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..04015e6 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.swt/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,62 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_NatTable +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=true +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=true +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_type_arguments=false +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.use_type_arguments=false
diff --git a/org.eclipse.nebula.widgets.nattable.ui.swt/.settings/org.eclipse.pde.core.prefs b/org.eclipse.nebula.widgets.nattable.ui.swt/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 0000000..f29e940 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.swt/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false
diff --git a/org.eclipse.nebula.widgets.nattable.ui.swt/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.ui.swt/META-INF/MANIFEST.MF new file mode 100644 index 0000000..42661e7 --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.swt/META-INF/MANIFEST.MF
@@ -0,0 +1,32 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: NatTable SWT UI +Bundle-SymbolicName: org.eclipse.nebula.widgets.nattable.ui.swt +Bundle-Version: 2.0.0.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Eclipse-ExtensibleAPI: true +Import-Package: org.apache.commons.logging;version="[1.0.0,2.0.0)", + org.eclipse.core.commands.common, + org.eclipse.jface.action, + org.eclipse.jface.dialogs, + org.eclipse.jface.fieldassist, + org.eclipse.jface.layout, + org.eclipse.jface.menus, + org.eclipse.jface.resource, + org.eclipse.jface.util, + org.eclipse.jface.viewers, + org.eclipse.jface.window, + org.eclipse.nebula.widgets.nattable.core.geometry;version="2.0.0", + org.eclipse.nebula.widgets.nattable.core.ui.rendering;version="2.0.0", + org.eclipse.nebula.widgets.nattable.style;version="2.0.0", + org.eclipse.swt, + org.eclipse.swt.custom, + org.eclipse.swt.dnd, + org.eclipse.swt.events, + org.eclipse.swt.graphics, + org.eclipse.swt.layout, + org.eclipse.swt.printing, + org.eclipse.swt.program, + org.eclipse.swt.widgets +Require-Bundle: org.eclipse.equinox.common;bundle-version="3.6.0" +Bundle-Vendor: Eclipse Nebula NatTable
diff --git a/org.eclipse.nebula.widgets.nattable.ui.swt/build.properties b/org.eclipse.nebula.widgets.nattable.ui.swt/build.properties new file mode 100644 index 0000000..34d2e4d --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.swt/build.properties
@@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .
diff --git a/org.eclipse.nebula.widgets.nattable.ui.swt/src/org/eclipse/nebula/widgets/nattable/ui/swt/SWTGraphicsContext.java b/org.eclipse.nebula.widgets.nattable.ui.swt/src/org/eclipse/nebula/widgets/nattable/ui/swt/SWTGraphicsContext.java new file mode 100644 index 0000000..7a3d25c --- /dev/null +++ b/org.eclipse.nebula.widgets.nattable.ui.swt/src/org/eclipse/nebula/widgets/nattable/ui/swt/SWTGraphicsContext.java
@@ -0,0 +1,283 @@ +/******************************************************************************* + * Copyright (c) 2014 Dirk Fauth, Edwin Park. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation + * Edwin Park <esp1@cornell.edu> - initial API and implementation + ******************************************************************************/ +package org.eclipse.nebula.widgets.nattable.ui.swt; + +import java.net.URL; +import java.util.HashMap; +import java.util.Map; +import java.util.Stack; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.nebula.widgets.nattable.core.geometry.PixelRectangle; +import org.eclipse.nebula.widgets.nattable.core.ui.rendering.Color; +import org.eclipse.nebula.widgets.nattable.core.ui.rendering.Font; +import org.eclipse.nebula.widgets.nattable.core.ui.rendering.Font.FontStyle; +import org.eclipse.nebula.widgets.nattable.core.ui.rendering.GraphicsContext; +import org.eclipse.nebula.widgets.nattable.core.ui.rendering.Image; +import org.eclipse.nebula.widgets.nattable.core.ui.rendering.Transform; +import org.eclipse.nebula.widgets.nattable.style.IStyle; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Display; + +/** + * Proxy implementation of {@link GraphicsContext} to provide the drawing + * capabilities by SWT {@link GC} so the NatTable can be painted using this. + */ +public class SWTGraphicsContext implements GraphicsContext { + + private static final String KEY_PREFIX = SWTGraphicsContext.class.getCanonicalName() + "."; //$NON-NLS-1$ + + enum GraphicsProperties { + FOREGROUND_COLOR, + BACKGROUND_COLOR, + ALPHA, + CLIP_BOUNDS, + TRANSFORM, + LINE_STYLE, + LINE_DASH, + LINE_WIDTH + } + + private Stack<Map<GraphicsProperties, Object>> stateStack = new Stack<Map<GraphicsProperties, Object>>(); + + /** + * The SWT {@link GC} which is proxied by this implementation. + */ + private GC gc; + + /** + * + * @param gc + * The SWT {@link GC} that should be proxied by this + * implementation. + */ + public SWTGraphicsContext(GC gc) { + this.gc = gc; + } + + @Override + public void initStyle(IStyle style) { + // TODO Auto-generated method stub + + } + + @Override + public void drawText(String text, double x, double y) { + this.gc.drawText(text, (int) x, (int) y, SWT.DRAW_TRANSPARENT | SWT.DRAW_DELIMITER); + } + + @Override + public void drawLine(double x1, double y1, double x2, double y2) { + this.gc.drawLine((int) x1, (int) y1, (int) x2, (int) y2); + } + + @Override + public void drawRectangle(PixelRectangle rect) { + this.gc.drawRectangle((int) rect.x, (int) rect.y, (int) rect.width, (int) rect.height); + } + + @Override + public void fillRectangle(PixelRectangle rect) { + this.gc.fillRectangle((int) rect.x, (int) rect.y, (int) rect.width, (int) rect.height); + } + + @Override + public double calculateTextWidth(String text) { + return this.gc.textExtent(text).x; + } + + @Override + public double getFontHeight() { + return this.gc.getFontMetrics().getHeight(); + } + + @Override + public void pushState() { + Map<GraphicsProperties, Object> props = new HashMap<GraphicsProperties, Object>(); + props.put(GraphicsProperties.FOREGROUND_COLOR, this.gc.getForeground()); + props.put(GraphicsProperties.BACKGROUND_COLOR, this.gc.getBackground()); + props.put(GraphicsProperties.ALPHA, this.gc.getAlpha()); + props.put(GraphicsProperties.CLIP_BOUNDS, this.gc.getClipping()); + + // TODO remember the transform wrapper if any is active + // props.put(GraphicsProperties.TRANSFORM, null); + + this.stateStack.push(props); + } + + @Override + public void popState() { + Map<GraphicsProperties, Object> props = this.stateStack.pop(); + this.gc.setForeground((org.eclipse.swt.graphics.Color) props.get(GraphicsProperties.FOREGROUND_COLOR)); + this.gc.setBackground((org.eclipse.swt.graphics.Color) props.get(GraphicsProperties.BACKGROUND_COLOR)); + this.gc.setAlpha((Integer) props.get(GraphicsProperties.ALPHA)); + this.gc.setClipping((Rectangle) props.get(GraphicsProperties.CLIP_BOUNDS)); + } + + @Override + public PixelRectangle getClipping() { + return getPixelRectangle(this.gc.getClipping()); + } + + @Override + public void setClipping(PixelRectangle clipBounds) { + this.gc.setClipping(getUiRectangle(clipBounds)); + } + + @Override + public void setForeground(Color foregroundColor) { + this.gc.setForeground(getUiColor(foregroundColor)); + // TODO set alpha + } + + @Override + public void setBackground(Color backgroundColor) { + this.gc.setBackground(getUiColor(backgroundColor)); + // TODO set alpha + } + + @Override + public org.eclipse.swt.graphics.Color getUiColor(Color color) { + if (color.getNativeColor() == null) { + String key = KEY_PREFIX + "_COLOR_" + color.red + "_" + color.green + "_" + color.blue; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + if (!JFaceResources.getColorRegistry().hasValueFor(key)) { + JFaceResources.getColorRegistry().put(key, new RGB(color.red, color.green, color.blue)); + } + color.setNativeColor(JFaceResources.getColorRegistry().get(key)); + } + if (color.getNativeColor() == null || !(color.getNativeColor() instanceof org.eclipse.swt.graphics.Color)) { + throw new IllegalStateException("native color instance in color wrapper is invalid"); + } + return (org.eclipse.swt.graphics.Color) color.getNativeColor(); + } + + @Override + public void setFont(Font font) { + this.gc.setFont(getUiFont(font)); + } + + @Override + public org.eclipse.swt.graphics.Font getUiFont(Font font) { + if (font.getNativeFont() == null) { + // if all attributes are not set, use the default font + if (font.name == null && font.height == -1 && font.style == null) { + font.setNativeFont(Display.getDefault().getSystemFont()); + } + else { + FontData defaultFontData = Display.getDefault().getSystemFont().getFontData()[0]; + String fontName = (font.name == null) ? defaultFontData.getName() : font.name; + int height = (font.height == -1) ? defaultFontData.getHeight() : Double.valueOf(font.height).intValue(); + int fontStyle = SWT.NORMAL; + + // calculate font style + if (font.style != null) { + for (FontStyle style : font.style) { + if (FontStyle.ITALIC.equals(style)) { + fontStyle = fontStyle | SWT.ITALIC; + } + else if (FontStyle.BOLD.equals(style) + || FontStyle.EXTRA_BOLD.equals(style) + || FontStyle.SEMI_BOLD.equals(style)) { + fontStyle = fontStyle | SWT.BOLD; + } + } + } + + FontData data = new FontData(fontName, height, fontStyle); + String key = data.toString(); + if (!JFaceResources.getFontRegistry().hasValueFor(key)) { + JFaceResources.getFontRegistry().put(key, new FontData[] { data }); + } + font.setNativeFont(JFaceResources.getFontRegistry().get(key)); + } + } + if (!(font.getNativeFont() instanceof org.eclipse.swt.graphics.Font)) { + throw new IllegalStateException("native font instance in font wrapper is invalid"); + } + return (org.eclipse.swt.graphics.Font) font.getNativeFont(); + } + + @Override + public void drawImage(Image image, double x, double y) { + this.gc.drawImage(getUiImage(image), Double.valueOf(x).intValue(), Double.valueOf(y).intValue()); + } + + @Override + public org.eclipse.swt.graphics.Image getUiImage(Image image) { + if (image.getNativeImage() == null) { + // key = filename + String key = image.url.toString(); + key = key.substring(key.lastIndexOf('/') + 1, key.lastIndexOf('.')); + + ImageDescriptor descriptor = JFaceResources.getImageRegistry().getDescriptor(key); + if (descriptor == null) { + URL url = image.url; + // TODO check if scaling is necessary + // if (GUIHelper.needScaling()) + + descriptor = ImageDescriptor.createFromURL(url); + + // TODO or upscale + + JFaceResources.getImageRegistry().put(key, ImageDescriptor.createFromURL(url)); + } + image.setNativeImage(JFaceResources.getImage(key)); + } + if (image.getNativeImage() == null || !(image.getNativeImage() instanceof org.eclipse.swt.graphics.Image)) { + throw new IllegalStateException("native image instance in image wrapper is invalid"); + } + return (org.eclipse.swt.graphics.Image) image.getNativeImage(); + } + + private Rectangle getUiRectangle(PixelRectangle rectangle) { + return new Rectangle( + (int) rectangle.x, + (int) rectangle.y, + (int) rectangle.width, + (int) rectangle.height); + } + + private PixelRectangle getPixelRectangle(Rectangle rectangle) { + return new PixelRectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height); + } + + @Override + public void setTransform(Transform transform) { + if (transform == null) { + this.gc.setTransform(null); + } + else { + org.eclipse.swt.graphics.Transform uiTransform = + new org.eclipse.swt.graphics.Transform(this.gc.getDevice()); + + if (transform.hasRotation()) { + uiTransform.rotate(transform.getAngle()); + } + + if (transform.hasScaling()) { + uiTransform.scale(transform.getScaleX(), transform.getScaleY()); + } + + if (transform.hasTranslation()) { + uiTransform.translate(transform.getOffsetX(), transform.getOffsetY()); + } + + this.gc.setTransform(uiTransform); + } + } + +}
diff --git a/target-platform/target-platform.target b/target-platform/target-platform.target index 0a8d8c3..34537f6 100644 --- a/target-platform/target-platform.target +++ b/target-platform/target-platform.target
@@ -1,13 +1,19 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<?pde version="3.8"?><target name="NatTable Target" sequenceNumber="11"> +<?pde version="3.8"?><target name="NatTable Target" sequenceNumber="17"> <locations> -<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit"> -<unit id="org.eclipse.sdk.ide" version="3.6.2.M20110210-1200"/> -<repository location="http://download.eclipse.org/releases/helios"/> +<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit"> +<unit id="org.eclipse.fx.runtime.feature.feature.group" version="1.1.0.201411050703"/> +<repository location="http://download.eclipse.org/efxclipse/runtime-released/1.1.0/site"/> </location> -<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit"> +<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit"> +<unit id="org.eclipse.sdk.ide" version="4.4.1.M20140925-0400"/> +<repository location="http://download.eclipse.org/releases/luna/"/> +</location> +<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit"> <unit id="org.apache.poi" version="3.9.0.v201405241750"/> +<unit id="org.apache.commons.codec.source" version="1.6.0.v201305230611"/> <unit id="ca.odell.glazedlists.source" version="1.9.0.v201303080712"/> +<unit id="org.apache.commons.codec" version="1.6.0.v201305230611"/> <unit id="ca.odell.glazedlists" version="1.9.0.v201303080712"/> <unit id="org.apache.poi.source" version="3.9.0.v201405241750"/> <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/"/>