Commit 352d07c6 authored by alexander.weigl's avatar alexander.weigl 🐼
Browse files

Weigl jdk10

parent bb3d81e0
# This is the Gradle build system for JVM applications # This is the Gradle build system for JVM applications
# https://gradle.org/ # https://gradle.org/
# https://github.com/gradle/gradle # https://github.com/gradle/gradle
image: key-dev-jdk8 image: key-dev-jdk10
cache: cache:
paths: paths:
...@@ -13,13 +13,15 @@ cache: ...@@ -13,13 +13,15 @@ cache:
# runtime for each build is more reliable since the runtime is completely # runtime for each build is more reliable since the runtime is completely
# isolated from any previous builds. # isolated from any previous builds.
variables: variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false" GRADLE_OPTS: "-Dorg.gradle.daemon=false \
--add-modules java.xml.bind \
'-Dorg.gradle.jvmargs=--add-modules java.xml.bind'"
GIT_SSL_NO_VERIFY: "true"
before_script: before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle - export GRADLE_USER_HOME=`pwd`/.gradle
# - export GRADLE_OPTS="-Dorg.gradle.daemon=false --add-modules java.xml.bind '-Dorg.gradle.jvmargs=--add-modules java.xml.bind'"
variables:
GIT_SSL_NO_VERIFY: "true"
stages: stages:
- build - build
...@@ -39,10 +41,26 @@ build:jdk9: ...@@ -39,10 +41,26 @@ build:jdk9:
- .gradle - .gradle
build:jdk10:
stage: build
image: key-dev-jdk10
script: gradle --build-cache assemble
allow_failure: true
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
build:jdk8: build:jdk8:
stage: build stage: build
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
script: gradle --build-cache assemble script: gradle --build-cache assemble
image: key-dev-jdk8 image: key-dev-jdk8
cache: cache:
key: "$CI_COMMIT_REF_NAME" key: "$CI_COMMIT_REF_NAME"
policy: push policy: push
......
package org.dockfx;
import java.util.LinkedList;
import java.util.Properties;
/**
* ContentHolder has common functions for storing persistent object for node
*
* @author HongKee Moon
*/
public class ContentHolder
{
/**
* The enum ContentHolder Type.
*/
public enum Type {
/**
* The SplitPane.
*/
SplitPane,
/**
* The TabPane.
*/
TabPane,
/**
* The Collection.
*/
Collection,
/**
* The FloatingNode.
*/
FloatingNode,
/**
* The DockNode.
*/
DockNode
}
String name;
Properties properties;
LinkedList children;
Type type;
public ContentHolder()
{
}
public ContentHolder( String name, Type type )
{
this.name = name;
this.properties = new Properties();
this.children = new LinkedList();
this.type = type;
}
public void addProperty( Object key, Object value )
{
properties.put( key, value );
}
public void addChild( Object child )
{
children.add( child );
}
public String getName()
{
return name;
}
public void setName( String name )
{
this.name = name;
}
public Properties getProperties()
{
return properties;
}
public void setProperties( Properties properties )
{
this.properties = properties;
}
public LinkedList getChildren()
{
return children;
}
public void setChildren( LinkedList children )
{
this.children = children;
}
public Type getType()
{
return type;
}
public void setType( Type type )
{
this.type = type;
}
}
package org.dockfx;
/**
* To support the delayed open process for some specific applications, this interface implementation is used.
*/
public interface DelayOpenHandler {
public DockNode open(String nodeName);
}
...@@ -30,7 +30,7 @@ import javafx.scene.Node; ...@@ -30,7 +30,7 @@ import javafx.scene.Node;
import javafx.scene.input.PickResult; import javafx.scene.input.PickResult;
/** /**
* Base class for DockFX events. Each DockFX event has associated an event source, event target and * Base class for DockFX events. Each DockFX event has an associated event source, event target and
* an event type. The event source specifies for an event handler the object on which that handler * an event type. The event source specifies for an event handler the object on which that handler
* has been registered and which sent the event to it. The event target defines the path through * has been registered and which sent the event to it. The event target defines the path through
* which the event will travel when posted. The event type provides additional classification to * which the event will travel when posted. The event type provides additional classification to
......
/** /**
* @file DockNode.java * @file DockNode.java
* @brief Class implementing basic dock node with floating and styling. * @brief Class implementing basic dock node with floating and styling.
*
* @section License * @section License
* * <p>
* This file is a part of the DockFX Library. Copyright (C) 2015 Robert B. Colton * This file is a part of the DockFX Library. Copyright (C) 2015 Robert B. Colton
* * <p>
* This program is free software: you can redistribute it and/or modify it under the terms * This program is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation, * of the GNU Lesser General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version. * either version 3 of the License, or (at your option) any later version.
* * <p>
* This program is distributed in the hope that it will be useful, but WITHOUT ANY * This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* * <p>
* You should have received a copy of the GNU Lesser General Public License along with this * You should have received a copy of the GNU Lesser General Public License along with this
* program. If not, see <http://www.gnu.org/licenses/>. * program. If not, see <http://www.gnu.org/licenses/>.
**/ **/
package org.dockfx; package org.dockfx;
import javafx.stage.WindowEvent; import javafx.beans.binding.BooleanBinding;
import org.dockfx.viewControllers.DockFXViewController; import javafx.beans.property.*;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.css.PseudoClass; import javafx.css.PseudoClass;
import javafx.event.EventHandler; import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.geometry.Point2D; import javafx.geometry.Point2D;
import javafx.geometry.Rectangle2D; import javafx.geometry.Rectangle2D;
import javafx.scene.Cursor; import javafx.scene.Cursor;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Priority; import javafx.scene.layout.Priority;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.stage.Screen; import javafx.stage.Screen;
import javafx.stage.Stage; import javafx.stage.Stage;
import javafx.stage.StageStyle; import javafx.stage.StageStyle;
import javafx.stage.Window; import javafx.stage.Window;
import org.dockfx.pane.DockNodeTab;
/** /**
* Base class for a dock node that provides the layout of the content along with a title bar and a * Base class for a dock node that provides the layout of the content along with a title bar and a
* styled border. The dock node can be detached and floated or closed and removed from the layout. * styled border. The dock node can be detached and floated or closed and removed from the layout.
* Dragging behavior is implemented through the title bar. * Dragging behavior is implemented through the title bar.
* *
* @since DockFX 0.1 * @since DockFX 0.1
*/ */
public class DockNode extends VBox implements EventHandler<MouseEvent> { public class DockNode extends VBox implements EventHandler<MouseEvent> {
/** /**
* The style this dock node should use on its stage when set to floating. * CSS pseudo class selector representing whether this node is currently floating.
*/ */
private StageStyle stageStyle = StageStyle.UNDECORATED; private static final PseudoClass FLOATING_PSEUDO_CLASS = PseudoClass.getPseudoClass("floating");
/** /**
* The stage that this dock node is currently using when floating. * CSS pseudo class selector representing whether this node is currently docked.
*/ */
private Stage stage; private static final PseudoClass DOCKED_PSEUDO_CLASS = PseudoClass.getPseudoClass("docked");
/**
/** * CSS pseudo class selector representing whether this node is currently maximized.
* The contents of the dock node, i.e. a TreeView or ListView. */
*/ private static final PseudoClass MAXIMIZED_PSEUDO_CLASS = PseudoClass.getPseudoClass("maximized");
private Node contents; /**
/** * The style this dock node should use on its stage when set to floating.
* The title bar that implements our dragging and state manipulation. */
*/ private StageStyle stageStyle = StageStyle.TRANSPARENT;
private DockTitleBar dockTitleBar; /**
/** * The stage that this dock node is currently using when floating.
* The border pane used when floating to provide a styled custom border. */
*/ private Stage stage;
private BorderPane borderPane; /**
* The contents of the dock node, i.e. a TreeView or ListView.
/** */
* The dock pane this dock node belongs to when not floating. private Node contents;
*/ /**
private DockPane dockPane; * The title bar that implements our dragging and state manipulation.
*/
/** private DockTitleBar dockTitleBar;
* View controller of node inside this DockNode /**
*/ * The border pane used when floating to provide a styled custom border.
private DockFXViewController viewController; */
private BorderPane borderPane;
/** /**
* Keep window state before its maximizing. * The dock pane this dock node belongs to when not floating.
*/ */
private double widthBeforeMaximizing; private DockPane dockPane;
private double heightBeforeMaximizing; /**
private double xPosBeforeMaximizing; * Boolean property maintaining whether this node is currently maximized.
private double yPosBeforeMaximizing; *
* @defaultValue false
/** */
* CSS pseudo class selector representing whether this node is currently floating. private BooleanProperty maximizedProperty = new SimpleBooleanProperty(false) {
*/
private static final PseudoClass FLOATING_PSEUDO_CLASS = PseudoClass.getPseudoClass("floating"); @Override
/** protected void invalidated() {
* CSS pseudo class selector representing whether this node is currently docked. DockNode.this.pseudoClassStateChanged(MAXIMIZED_PSEUDO_CLASS, get());
*/ if (borderPane != null) {
private static final PseudoClass DOCKED_PSEUDO_CLASS = PseudoClass.getPseudoClass("docked"); borderPane.pseudoClassStateChanged(MAXIMIZED_PSEUDO_CLASS, get());
/** }
* CSS pseudo class selector representing whether this node is currently maximized.
*/ stage.setMaximized(get());
private static final PseudoClass MAXIMIZED_PSEUDO_CLASS = PseudoClass.getPseudoClass("maximized");
// TODO: This is a work around to fill the screen bounds and not overlap the task bar when
/** // the window is undecorated as in Visual Studio. A similar work around needs applied for
* Boolean property maintaining whether this node is currently maximized. // JFrame in Swing. http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4737788
* // Bug report filed:
* @defaultValue false // https://bugs.openjdk.java.net/browse/JDK-8133330
*/ if (this.get()) {
private BooleanProperty maximizedProperty = new SimpleBooleanProperty(false) { Screen screen = Screen
.getScreensForRectangle(stage.getX(), stage.getY(), stage.getWidth(), stage.getHeight())
.get(0);
Rectangle2D bounds = screen.getVisualBounds();
stage.setX(bounds.getMinX());
stage.setY(bounds.getMinY());
stage.setWidth(bounds.getWidth());
stage.setHeight(bounds.getHeight());
}
}
@Override @Override
protected void invalidated() { public String getName() {
DockNode.this.pseudoClassStateChanged(MAXIMIZED_PSEUDO_CLASS, get()); return "maximized";
if (borderPane != null) { }
borderPane.pseudoClassStateChanged(MAXIMIZED_PSEUDO_CLASS, get()); };
} private ObjectProperty<Node> graphicProperty = new SimpleObjectProperty<Node>() {
@Override
if (!get()) { public String getName() {
stage.setX(xPosBeforeMaximizing); return "graphic";
stage.setY(yPosBeforeMaximizing); }
stage.setWidth(widthBeforeMaximizing); };
stage.setHeight(heightBeforeMaximizing); private StringProperty titleProperty = new SimpleStringProperty("Dock") {
}else{ @Override
widthBeforeMaximizing = stage.getWidth(); public String getName() {
heightBeforeMaximizing = stage.getHeight(); return "title";
xPosBeforeMaximizing = stage.getX(); }
yPosBeforeMaximizing = stage.getY(); };
} private BooleanProperty customTitleBarProperty = new SimpleBooleanProperty(true) {
@Override
// TODO: This is a work around to fill the screen bounds and not overlap the task bar when public String getName() {
// the window is undecorated as in Visual Studio. A similar work around needs applied for return "customTitleBar";
// JFrame in Swing. http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4737788 }
// Bug report filed: };
// https://bugs.openjdk.java.net/browse/JDK-8133330 private BooleanProperty floatingProperty = new SimpleBooleanProperty(false) {
if (this.get()) { @Override
Screen screen = Screen protected void invalidated() {
.getScreensForRectangle(stage.getX(), stage.getY(), stage.getWidth(), stage.getHeight()) DockNode.this.pseudoClassStateChanged(FLOATING_PSEUDO_CLASS, get());
.get(0); if (borderPane != null) {
Rectangle2D bounds = screen.getVisualBounds(); borderPane.pseudoClassStateChanged(FLOATING_PSEUDO_CLASS, get());
}
stage.setX(bounds.getMinX()); }
stage.setY(bounds.getMinY());
stage.setWidth(bounds.getWidth());
stage.setHeight(bounds.getHeight());
}
}
@Override @Override
public String getName() { public String getName() {
return "maximized"; return "floating";
} }
}; };
private BooleanProperty floatableProperty = new SimpleBooleanProperty(true) {
public DockNode(Node contents, String title, Node graphic, DockFXViewController controller) { @Override
initializeDockNode(contents, title, graphic, controller); public String getName() {
} return "floatable";
}
/** };
* Creates a default DockNode with a default title bar and layout. private BooleanProperty closableProperty = new SimpleBooleanProperty(true) {
* @Override
* @param contents The contents of the dock node which may be a tree or another scene graph node. public String getName() {
* @param title The caption title of this dock node which maintains bidirectional state with the return "closable";
* title bar and stage. }
* @param graphic The caption graphic of this dock node which maintains bidirectional state with };
* the title bar and stage. private BooleanProperty stageResizableProperty = new SimpleBooleanProperty(true) {
*/ @Override
public DockNode(Node contents, String title, Node graphic) { public String getName() {
this(contents, title, graphic, null); return "resizable";
} }
};
/** private BooleanProperty dockedProperty = new SimpleBooleanProperty(false) {
* Creates a default DockNode with a default title bar and layout. @Override
* protected void invalidated() {
* @param contents The contents of the dock node which may be a tree or another scene graph node. if (get()) {
* @param title The caption title of this dock node which maintains bidirectional state with the if (dockTitleBar != null) {
* title bar and stage. dockTitleBar.setVisible(true);
*/ dockTitleBar.setManaged(true);
public DockNode(Node contents, String title) { }
this(contents, title, null); }
}
DockNode.this.pseudoClassStateChanged(DOCKED_PSEUDO_CLASS, get());
/** }
* Creates a default DockNode with a default title bar and layout.
* @Override
* @param contents The contents of the dock node which may be a tree or another scene graph node. public String getName() {
*/ return "docked";
public DockNode(Node contents) { }
this(contents, null, null); };
} /**
* The last position of the mouse that was within the minimum layout bounds.
/** */
* private Point2D sizeLast;
* Creates a default DockNode with contents loaded from FXMLFile at provided path. /**
* * Whether we are currently resizing in a given direction.
* @param FXMLPath path to fxml file. */
* @param title The caption title of this dock node which maintains bidirectional state with the private boolean sizeWest = false, sizeEast = false, sizeNorth = false, sizeSouth = false;
* title bar and stage.
* @param graphic The caption title of this dock node which maintains bidirectional state with the /**
* title bar and stage. * Creates a default DockNode with a default title bar and layout.
*/ *
public DockNode(String FXMLPath, String title, Node graphic) { * @param contents The contents of the dock node which may be a tree or another scene graph node.
FXMLLoader loader = loadNode(FXMLPath); * @param title The caption title of this dock node which maintains bidirectional state with the
initializeDockNode(loader.getRoot(), title, graphic, loader.getController()); * title bar and stage.
} * @param graphic The caption graphic of this dock node which maintains bidirectional state with
* the title bar and stage.
/** */
* Creates a default DockNode with contents loaded from FXMLFile at provided path. public DockNode(Node contents, String title, Node graphic) {
* this.titleProperty.setValue(title);
* @param FXMLPath path to fxml file. this.graphicProperty.setValue(graphic);
* @param title The caption title of this dock node which maintains bidirectional state with the this.contents = contents;
* title bar and stage.
*/ dockTitleBar = new DockTitleBar(this);
public DockNode(String FXMLPath, String title) {
this(FXMLPath, title, null); getChildren().addAll(dockTitleBar, contents);