diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/.ratings index 414c3f689dabd292d551ed27ffa6f9c64076eaff..53183b9893069bde9dd878eab4ffd363c888a311 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/.ratings @@ -1 +1 @@ -AF3FXViewPart.java 0537d9da4643e91b73f442ac7016742e32339c00 YELLOW +AF3FXViewPart.java 3e4510f9e9f86ecf5ba29432342acd50e030aaaa YELLOW diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/AF3FXViewPart.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/AF3FXViewPart.java index 0537d9da4643e91b73f442ac7016742e32339c00..3e4510f9e9f86ecf5ba29432342acd50e030aaaa 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/AF3FXViewPart.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/AF3FXViewPart.java @@ -49,7 +49,7 @@ public abstract class AF3FXViewPart extends FXViewPart { private Pane root; /** Specifies the view part's layout and logic. */ - private ICompositeFXController controller; + private ICompositeFXController<? extends Node, ? extends Node> controller; /** * Constructor. Allows to pass the view's FXML definition file. @@ -64,7 +64,8 @@ public abstract class AF3FXViewPart extends FXViewPart { * if the given FXML file path is not given or if it cannot be found in any of the * source (resource) folders. */ - public AF3FXViewPart(ICompositeFXController controller, String cssLocation) throws Exception { + public AF3FXViewPart(ICompositeFXController<? extends Node, ? extends Node> controller, + String cssLocation) throws Exception { Platform.setImplicitExit(false); this.cssLocation = cssLocation; this.controller = controller; diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/layout/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/layout/.ratings index df418186690889d927e56a9e785aac6e905eb55b..23fa75155d93e7faee5b239eca43f78b0f93f985 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/layout/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/layout/.ratings @@ -1,2 +1,2 @@ -CompositeFXControllerBase.java 76231a81161e0b3fe4566148ab9a9c33ba18a623 YELLOW -ICompositeFXController.java 815dd7b253198af94ed77e506ccbe04bf06ed464 YELLOW +CompositeFXControllerBase.java 3c411746e6d3733d66194506effcc276ad9b5613 YELLOW +ICompositeFXController.java 8476557dedab914c87c2931a09aad8e628463f30 YELLOW diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/layout/CompositeFXControllerBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/layout/CompositeFXControllerBase.java index 76231a81161e0b3fe4566148ab9a9c33ba18a623..3c411746e6d3733d66194506effcc276ad9b5613 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/layout/CompositeFXControllerBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/layout/CompositeFXControllerBase.java @@ -34,36 +34,43 @@ import javafx.scene.layout.AnchorPane; * JavaFX node which can be hierarchically composed. It can be included within another * {@link CompositeFXControllerBase} and might contain other {@link CompositeFXControllerBase}s. * + * @param <T> + * Type of the controlled element itself. + * @param <S> + * Type of the layout elements which can be contained. + * * @author munaro */ -public abstract class CompositeFXControllerBase implements ICompositeFXController { +public abstract class CompositeFXControllerBase<T extends Node, S extends Node> + implements ICompositeFXController<T, S> { /** * JavaFX {@link Node} with the layout specified in the {@link FXML} resource and * associated with a controller of type {@code T}. */ - private Node layout; + private T layout; /** * {@link ICompositeFXController}s to be added to the {@link Node} by the * {@code addContainments} method. */ - private ICompositeFXController[] containments; + private ICompositeFXController<? extends S, ?>[] containments; /** Constructor. */ - public CompositeFXControllerBase(ICompositeFXController... containments) { + @SuppressWarnings("unchecked") + public CompositeFXControllerBase(ICompositeFXController<? extends S, ?>... containments) { this.containments = containments; } /** {@inheritDoc} */ @Override - public Node getLayout() { + public T getLayout() { return layout; } /** {@inheritDoc} */ @Override - public List<ICompositeFXController> getContainments() { + public List<ICompositeFXController<? extends S, ?>> getContainments() { return asList(containments); } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/layout/ICompositeFXController.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/layout/ICompositeFXController.java index 815dd7b253198af94ed77e506ccbe04bf06ed464..8476557dedab914c87c2931a09aad8e628463f30 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/layout/ICompositeFXController.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/layout/ICompositeFXController.java @@ -23,15 +23,20 @@ import javafx.scene.Node; /** * Generic interface for JavaFX controllers which can be hierarchically composed. * + * @param <T> + * Type of the controlled element itself. + * @param <S> + * Type of the layout elements which can be contained. + * * @author munaro */ -public interface ICompositeFXController { +public interface ICompositeFXController<T extends Node, S extends Node> { /** Loads the the JavaFX layout from the specified {@link FXML} resource. */ public void loadLayout(); /** Returns a {@link Node} with the layout. */ - public Node getLayout(); + public T getLayout(); /** Returns the location of the {@link FXML} resource with the layout. */ public String getFXMLLocation(); @@ -40,5 +45,5 @@ public interface ICompositeFXController { public void initialize(); /** Returns the {@link ICompositeFXController} containments. */ - public List<ICompositeFXController> getContainments(); + public List<ICompositeFXController<? extends S, ?>> getContainments(); }