diff -r 548f1c1ae41f javafx-ui-common/src/javafx/scene/shape/Path.java --- a/javafx-ui-common/src/javafx/scene/shape/Path.java Mon Jan 16 14:15:36 2012 +0400 +++ b/javafx-ui-common/src/javafx/scene/shape/Path.java Tue Jan 17 13:08:40 2012 +0100 @@ -26,6 +26,7 @@ import com.sun.javafx.sg.PGPath; import com.sun.javafx.tk.Toolkit; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import javafx.beans.value.WritableValue; import javafx.scene.paint.Paint; @@ -95,6 +96,18 @@ } } } + + /** + * Creates new instance of Path + * @param elements The collection of the elements of the Path + */ + public Path(Collection elements) { + if (elements != null) { + for (PathElement element : elements) { + this.getElements().add(element); + } + } + } static com.sun.javafx.sg.PGPath.FillRule toPGFillRule(FillRule rule) { if (rule == FillRule.NON_ZERO) { diff -r 548f1c1ae41f javafx-ui-common/test/unit/javafx/scene/shape/PathTest.java --- a/javafx-ui-common/test/unit/javafx/scene/shape/PathTest.java Mon Jan 16 14:15:36 2012 +0400 +++ b/javafx-ui-common/test/unit/javafx/scene/shape/PathTest.java Tue Jan 17 13:08:40 2012 +0100 @@ -19,6 +19,8 @@ import com.sun.javafx.geom.Path2D; import com.sun.javafx.geom.PathIterator; import com.sun.javafx.pgstub.StubPath; +import java.util.ArrayList; +import java.util.List; public class PathTest { @@ -33,7 +35,23 @@ assertSame(two, path.getElements().get(1)); assertSame(three, path.getElements().get(2)); } - + + @Test public void testListConstructor() { + PathElement one = new MoveTo(10, 10); + PathElement two = new LineTo(20, 20); + PathElement three = new MoveTo(30, 30); + + List listOfElements = new ArrayList(); + listOfElements.add(one); + listOfElements.add(two); + listOfElements.add(three); + Path path = new Path(listOfElements); + assertEquals(3, path.getElements().size()); + assertSame(one, path.getElements().get(0)); + assertSame(two, path.getElements().get(1)); + assertSame(three, path.getElements().get(2)); + } + @Test public void testBoundPropertySync_FillRule() throws Exception { ObjectProperty v = new SimpleObjectProperty(FillRule.EVEN_ODD); Path path = new Path();