Skip to content
Snippets Groups Projects
Commit c42cfa39 authored by Alexander Diewald's avatar Alexander Diewald
Browse files

JavaFX: YELLOW

* Add an abstract method for "initialize()".
* Fixed comments.

Issue-Ref: 3463
Issue-Url: https://af3-developer.fortiss.org/issues/3463


Signed-off-by: default avatarAlexander Diewald <diewald@fortiss.org>
parent a692586c
No related branches found
No related tags found
1 merge request!10JavaFX: Add Single-Node View support.
AF3FXViewPart.java 10100de78c542858792cb51a7c3cfe7e55ec95d7 YELLOW AF3FXViewPart.java 96871186e27ace44069441dbf7ac8ebcd7753390 YELLOW
...@@ -30,6 +30,7 @@ import org.apache.commons.lang3.SystemUtils; ...@@ -30,6 +30,7 @@ import org.apache.commons.lang3.SystemUtils;
import org.eclipse.fx.ui.workbench3.FXViewPart; import org.eclipse.fx.ui.workbench3.FXViewPart;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
/** /**
* Base class to create eclipse (SWT-based) views using JavaFX GUI elements. This class requires * Base class to create eclipse (SWT-based) views using JavaFX GUI elements. This class requires
...@@ -61,11 +62,7 @@ public abstract class AF3FXViewPart extends FXViewPart { // NO_UCD ...@@ -61,11 +62,7 @@ public abstract class AF3FXViewPart extends FXViewPart { // NO_UCD
private Pane root; private Pane root;
/** /**
* TODO(JE): Is this comment correct? No FXML def is passed here. Additionally, it would be * Constructor that is intended for {@link ViewPart}s which host a single view/node/control.
* beneficial to mention here that a default definition is used when using this Constructor.
*
*
* Constructor. Allows to pass the view's FXML definition file along with style.
* *
* @param viewerClass * @param viewerClass
* Class implementing the {@link AF3FXViewPart} to load resources from its containing * Class implementing the {@link AF3FXViewPart} to load resources from its containing
...@@ -79,6 +76,8 @@ public abstract class AF3FXViewPart extends FXViewPart { // NO_UCD ...@@ -79,6 +76,8 @@ public abstract class AF3FXViewPart extends FXViewPart { // NO_UCD
*/ */
public AF3FXViewPart(Class<? extends AF3FXViewPart> viewerClass, String cssLocation) public AF3FXViewPart(Class<? extends AF3FXViewPart> viewerClass, String cssLocation)
throws Exception { throws Exception {
// Initializing the base constructor with "null" for the FXML file indicates a
// single-view/node/control usecase.
this(viewerClass, null, cssLocation); this(viewerClass, null, cssLocation);
} }
...@@ -165,6 +164,17 @@ public abstract class AF3FXViewPart extends FXViewPart { // NO_UCD ...@@ -165,6 +164,17 @@ public abstract class AF3FXViewPart extends FXViewPart { // NO_UCD
// Not needed. // Not needed.
} }
/**
* Init method that is called after the JavaFX toolkit has been launched. The initialize method
* is needed for single-node/view/control {@link ViewPart}s and for controls in a FXML-based
* view that require an initial configuration. If no initial configuration is required place a
* stub.
* <p>
* For FXML, the initialize method is called via the JavaFX framework. Otherwise, it is called
* via reflection from this class.
*/
protected abstract void initialize();
/** /**
* Adds a single {@link Node} to this view. It embeds the given {@link Node} to the * Adds a single {@link Node} to this view. It embeds the given {@link Node} to the
* {@link AnchorPane} of this view and stretches it to the borders of the view. * {@link AnchorPane} of this view and stretches it to the borders of the view.
...@@ -196,11 +206,9 @@ public abstract class AF3FXViewPart extends FXViewPart { // NO_UCD ...@@ -196,11 +206,9 @@ public abstract class AF3FXViewPart extends FXViewPart { // NO_UCD
} }
/** /**
* TODO(JE): Please check correctness of first sentence. I guess there is a 'not' missing. * Sets the native look of the target platform to not break the UI experience. Most of the UI
* * code is based on SWT which uses a platform native look. Currently, Windows 8&10, Windows 7,
* Sets the native look of the target platform to break the UI. Most of the UI code is based on * and MacOS X native looks are supported.
* SWT which uses a platform native look. Currently, Windows 8&10, Windows 7, and MacOS X native
* looks are supported.
*/ */
private void setNativeLook(Pane pane) { private void setNativeLook(Pane pane) {
if(SystemUtils.IS_OS_WINDOWS_10 || SystemUtils.IS_OS_WINDOWS_8) { if(SystemUtils.IS_OS_WINDOWS_10 || SystemUtils.IS_OS_WINDOWS_8) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment