[
  {
    "path": ".gitattributes",
    "content": "# Auto detect text files and perform LF normalization\n* text=false\n\n# Custom for Visual Studio\n*.cs     diff=csharp\n\n# Standard to msysgit\n*.doc\t diff=astextplain\n*.DOC\t diff=astextplain\n*.docx diff=astextplain\n*.DOCX diff=astextplain\n*.dot  diff=astextplain\n*.DOT  diff=astextplain\n*.pdf  diff=astextplain\n*.PDF\t diff=astextplain\n*.rtf\t diff=astextplain\n*.RTF\t diff=astextplain\n"
  },
  {
    "path": ".gitignore",
    "content": "# Windows image file caches\nThumbs.db\nehthumbs.db\n\n# Folder config file\nDesktop.ini\n\n# Recycle Bin used on file shares\n$RECYCLE.BIN/\n\n# Windows Installer files\n*.cab\n*.msi\n*.msm\n*.msp\n\n# Windows shortcuts\n*.lnk\n\n# =========================\n# Operating System Files\n# =========================\n\n# OSX\n# =========================\n\n.DS_Store\n.AppleDouble\n.LSOverride\n\n# Thumbnails\n._*\n\n# Files that might appear in the root of a volume\n.DocumentRevisions-V100\n.fseventsd\n.Spotlight-V100\n.TemporaryItems\n.Trashes\n.VolumeIcon.icns\n\n# Directories potentially created on remote AFP share\n.AppleDB\n.AppleDesktop\nNetwork Trash Folder\nTemporary Items\n.apdisk\n\n# maven build directory\ntarget\n.idea\n*.iml\n"
  },
  {
    "path": "LICENSE",
    "content": "           GNU LESSER GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n\n  This version of the GNU Lesser General Public License incorporates\nthe terms and conditions of version 3 of the GNU General Public\nLicense, supplemented by the additional permissions listed below.\n\n  0. Additional Definitions.\n\n  As used herein, \"this License\" refers to version 3 of the GNU Lesser\nGeneral Public License, and the \"GNU GPL\" refers to version 3 of the GNU\nGeneral Public License.\n\n  \"The Library\" refers to a covered work governed by this License,\nother than an Application or a Combined Work as defined below.\n\n  An \"Application\" is any work that makes use of an interface provided\nby the Library, but which is not otherwise based on the Library.\nDefining a subclass of a class defined by the Library is deemed a mode\nof using an interface provided by the Library.\n\n  A \"Combined Work\" is a work produced by combining or linking an\nApplication with the Library.  The particular version of the Library\nwith which the Combined Work was made is also called the \"Linked\nVersion\".\n\n  The \"Minimal Corresponding Source\" for a Combined Work means the\nCorresponding Source for the Combined Work, excluding any source code\nfor portions of the Combined Work that, considered in isolation, are\nbased on the Application, and not on the Linked Version.\n\n  The \"Corresponding Application Code\" for a Combined Work means the\nobject code and/or source code for the Application, including any data\nand utility programs needed for reproducing the Combined Work from the\nApplication, but excluding the System Libraries of the Combined Work.\n\n  1. Exception to Section 3 of the GNU GPL.\n\n  You may convey a covered work under sections 3 and 4 of this License\nwithout being bound by section 3 of the GNU GPL.\n\n  2. Conveying Modified Versions.\n\n  If you modify a copy of the Library, and, in your modifications, a\nfacility refers to a function or data to be supplied by an Application\nthat uses the facility (other than as an argument passed when the\nfacility is invoked), then you may convey a copy of the modified\nversion:\n\n   a) under this License, provided that you make a good faith effort to\n   ensure that, in the event an Application does not supply the\n   function or data, the facility still operates, and performs\n   whatever part of its purpose remains meaningful, or\n\n   b) under the GNU GPL, with none of the additional permissions of\n   this License applicable to that copy.\n\n  3. Object Code Incorporating Material from Library Header Files.\n\n  The object code form of an Application may incorporate material from\na header file that is part of the Library.  You may convey such object\ncode under terms of your choice, provided that, if the incorporated\nmaterial is not limited to numerical parameters, data structure\nlayouts and accessors, or small macros, inline functions and templates\n(ten or fewer lines in length), you do both of the following:\n\n   a) Give prominent notice with each copy of the object code that the\n   Library is used in it and that the Library and its use are\n   covered by this License.\n\n   b) Accompany the object code with a copy of the GNU GPL and this license\n   document.\n\n  4. Combined Works.\n\n  You may convey a Combined Work under terms of your choice that,\ntaken together, effectively do not restrict modification of the\nportions of the Library contained in the Combined Work and reverse\nengineering for debugging such modifications, if you also do each of\nthe following:\n\n   a) Give prominent notice with each copy of the Combined Work that\n   the Library is used in it and that the Library and its use are\n   covered by this License.\n\n   b) Accompany the Combined Work with a copy of the GNU GPL and this license\n   document.\n\n   c) For a Combined Work that displays copyright notices during\n   execution, include the copyright notice for the Library among\n   these notices, as well as a reference directing the user to the\n   copies of the GNU GPL and this license document.\n\n   d) Do one of the following:\n\n       0) Convey the Minimal Corresponding Source under the terms of this\n       License, and the Corresponding Application Code in a form\n       suitable for, and under terms that permit, the user to\n       recombine or relink the Application with a modified version of\n       the Linked Version to produce a modified Combined Work, in the\n       manner specified by section 6 of the GNU GPL for conveying\n       Corresponding Source.\n\n       1) Use a suitable shared library mechanism for linking with the\n       Library.  A suitable mechanism is one that (a) uses at run time\n       a copy of the Library already present on the user's computer\n       system, and (b) will operate properly with a modified version\n       of the Library that is interface-compatible with the Linked\n       Version.\n\n   e) Provide Installation Information, but only if you would otherwise\n   be required to provide such information under section 6 of the\n   GNU GPL, and only to the extent that such information is\n   necessary to install and execute a modified version of the\n   Combined Work produced by recombining or relinking the\n   Application with a modified version of the Linked Version. (If\n   you use option 4d0, the Installation Information must accompany\n   the Minimal Corresponding Source and Corresponding Application\n   Code. If you use option 4d1, you must provide the Installation\n   Information in the manner specified by section 6 of the GNU GPL\n   for conveying Corresponding Source.)\n\n  5. Combined Libraries.\n\n  You may place library facilities that are a work based on the\nLibrary side by side in a single library together with other library\nfacilities that are not Applications and are not covered by this\nLicense, and convey such a combined library under terms of your\nchoice, if you do both of the following:\n\n   a) Accompany the combined library with a copy of the same work based\n   on the Library, uncombined with any other library facilities,\n   conveyed under the terms of this License.\n\n   b) Give prominent notice with the combined library that part of it\n   is a work based on the Library, and explaining where to find the\n   accompanying uncombined form of the same work.\n\n  6. Revised Versions of the GNU Lesser General Public License.\n\n  The Free Software Foundation may publish revised and/or new versions\nof the GNU Lesser General Public License from time to time. Such new\nversions will be similar in spirit to the present version, but may\ndiffer in detail to address new problems or concerns.\n\n  Each version is given a distinguishing version number. If the\nLibrary as you received it specifies that a certain numbered version\nof the GNU Lesser General Public License \"or any later version\"\napplies to it, you have the option of following the terms and\nconditions either of that published version or of any later version\npublished by the Free Software Foundation. If the Library as you\nreceived it does not specify a version number of the GNU Lesser\nGeneral Public License, you may choose any version of the GNU Lesser\nGeneral Public License ever published by the Free Software Foundation.\n\n  If the Library as you received it specifies that a proxy can decide\nwhether future versions of the GNU Lesser General Public License shall\napply, that proxy's public statement of acceptance of any version is\npermanent authorization for you to choose that version for the\nLibrary.\n"
  },
  {
    "path": "README.md",
    "content": "![Anchorfx logo](/src/main/resources/anchorfx.png)\n\n### Docking framework for JavaFX platform\n\n![Anchorfx logo](/src/main/resources/screenshot.png)\n\nAnchorFX is a gratis and open source library for JavaFX to create graphical interfaces with docking features \n\n![Anchorfx logo](https://virtualopenup.files.wordpress.com/2012/05/gnu_lgpl3.png?w=150&h=65)\n#### AnchorFX and its source code is licensed under the GNU Lesser General Public License version 3 and you can make adaptations of this work\n\n#### Features\n\n * Stations and sub stations support\n * Dockable and floatable panels\n * Splitter and Tabs containers support\n * CSS styling\n\n\n#### Usage\n\n##### Create a DockStation\n\n```java\nDockStation station = AnchorageSystem.createStation();\n```\n\nOnce created the station, we can create the panels and hook them to the station\n\n##### Create a DockNode\n\n```java\nPane myPanel...\nDockNode dockNode = AnchorageSystem.createDock(\"My Title\", myPanel);\ndockNode.dock(station, DockNode.DOCK_POSITION.CENTER);\n```\nA DockNode is the window built around your panel. This window has a title and an icon and it can be defined as:\n\n* Closeable\n* Resizable\n* Maximizable\n* Floatable\n\nIf we want to create a node that can not be closed, we will write\n\n```java\ndockNode.closeableProperty().set(false);\n```\n\n##### Get ower DockNode from content panel\n\nTo know the reference of DockNode that contains your panel, implements the DockNodeCreationListener interface in your panel.\n\n```java\nclass MyPanel extends Pane implements DockNodeCreationListener {\n \n    @Override\n    public void onDockNodeCreated(DockNode node) {\n         // now you can work with events of your DockNode \n    }\n\n}\n```\n\n##### Add a DockNode to a Dockstation\n\nTo be visible, a node must be associated with a station. To do this procedure, we use the function dock (...) of DockNode\n\n```java\ndockNode.dock(station, DockNode.DOCK_POSITION.CENTER);\n```\n\nIn this case, the node will be added to the station in a central position. When a station is empty, the location will always be central, otherwise, will be taken the position provided and will be changed the layout\n\nYou may also add a node by specifying the percentage of placement of the divider. This percentage is only effective if the position is provided different from the central\n\n```java\ndockNode.dock(station, DockNode.DOCK_POSITION.CENTER, 0.8);\n```\n\n#### Adding a node over another specific node\n\nAnchorFX provides the possibility to add a node in a generic position respect to another node already present in the station.\nThis feature lets you design a custom layout when your application starts \n\n```java\ndockNode.dock(otherNode, DockNode.DOCK_POSITION.CENTER);\n```\n\n\n##### Create a DockSubStation\n\nA Dock SubStation is a station that also has the functionality of DockNode\nThe nodes that are associated with a DockSubStation can only be moved within the DockSubStation associated.\n\n\n```java\n DockSubStation subStation = AnchorageSystem.createSubStation(station, \"SubStation\");\n dockSubNode.dock(subStation, DockNode.DOCK_POSITION.CENTER);\n \n subStation.dock(station, DockNode.DOCK_POSITION.LEFT,0.7);\n```\n \n \n##### Styling with AnchorFX.css\n \n The file AnchorFX.css located within resource, defines a simple default style\n \n \n ```css\n\n.docknode-title-bar {\n    -fx-background-color: rgb(100,100,100);\n}\n\n.docknode-title-text{\n    -fx-text-fill: rgb(255,255,255);\n}\n\n.docknode-content-panel{\n    -fx-background-color: rgb(100,100,100);\n    -fx-padding: 0\n}\n\n.docknode-floating-stack-container-panel {\n    -fx-background-color: rgb(100,100,100);\n    -fx-padding: 4\n}\n \n.docknode-split-pane {  \n    -fx-padding: 0;  \n} \n\n.docknode-split-pane *.split-pane-divider {  \n    -fx-padding: 2;  \n    -fx-border-color:transparent;\n    -fx-color: darkgray;\n} \n\n.docknode-tab-panel{\n    -fx-padding: 0;\n}\n\n.docknode-command-button{\n    -fx-background-color:transparent;\n    -fx-background-radius: 0,0,0;\n}\n\n.docknode-command-button:hover{\n    -fx-background-color:darkgray;\n}\n\n.docknode-command-button:pressed{\n    -fx-background-color:darkgray;\n}\n\n.docknode-command-button:focused{\n    -fx-background-color:transparent;\n}\n\n.docknode-command-button-close{\n    -fx-background-color:transparent;\n    -fx-background-radius: 0,0,0;\n}\n\n.docknode-command-button-close:pressed{\n    -fx-background-color:red;\n}\n\n.docknode-command-button-close:hover{\n    -fx-background-color:red;\n}\n\n.docknode-command-button-close:focused{\n    -fx-background-color:transparent;\n} \n\n.station {\n    -fx-background-color: rgb(0,0,0);\n    -fx-padding: 0\n}\n\n.substation-title-bar {\n    -fx-background-color: rgb(0,0,0);\n}\n\n.substation-title-text{\n    -fx-text-fill: rgb(255,255,255);\n}\n\n.dockzone-circle-container-selectors {\n    -fx-fill: rgba(0,0,0,0.7);\n}\n\n.dockzone-circle-selector {\n    -fx-fill: rgba(0,0,0,0.8);\n}\n\n.dockzone-rectangle-preview {\n    -fx-fill: rgba(63,138,163,0.8);\n}\n```\n \n \n \n## Explore the examples on test package\n\nThe examples will use the functionality described\n\n * AnchorFX_test.java\n * AnchorFX_substations.java\n * AnchorFX_settings.java\n * AnchorFX_events.java\n * AnchorFX_CommonStations.java\n"
  },
  {
    "path": "pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n    <groupId>com.anchorfx</groupId>\n    <artifactId>anchorfx</artifactId>\n    <version>0.1-SNAPSHOT</version>\n    <packaging>jar</packaging>\n    \n    <properties>\n        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n        <maven.compiler.source>1.8</maven.compiler.source>\n        <maven.compiler.target>1.8</maven.compiler.target>\n    </properties>\n</project>\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/containers/SingleDockContainer.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n*/\r\n\r\npackage com.anchorage.docks.containers;\r\n\r\nimport com.anchorage.docks.containers.common.DockCommons;\r\nimport com.anchorage.docks.containers.interfaces.DockContainableComponent;\r\nimport com.anchorage.docks.containers.interfaces.DockContainer;\r\nimport com.anchorage.docks.containers.subcontainers.DockSplitterContainer;\r\nimport com.anchorage.docks.containers.subcontainers.DockTabberContainer;\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.stations.DockStation;\r\nimport javafx.scene.Node;\r\nimport javafx.scene.layout.StackPane;\r\n\r\npublic class SingleDockContainer extends StackPane implements DockContainer {\r\n    \r\n    private DockContainer container;\r\n     \r\n    \r\n    @Override\r\n    public void putDock(DockNode node, DockNode.DockPosition position, double percentage) {\r\n \r\n        if (getChildren().isEmpty()) {\r\n            getChildren().add(node);\r\n            node.setParentContainer(this);\r\n        } else {\r\n            manageSubContainers(node, position, percentage);\r\n        }\r\n    }\r\n     \r\n    \r\n    @Override\r\n    public void putDock(DockNode node, DockNode nodeTarget, DockNode.DockPosition position, double percentage) {\r\n \r\n        if (getChildren().get(0) == nodeTarget) {\r\n            manageSubContainers(node, position, percentage);\r\n        }\r\n    }\r\n    \r\n    @Override\r\n    public boolean isDockVisible(DockNode node) {\r\n        return true;\r\n    }\r\n    \r\n    @Override\r\n    public int indexOf(Node node) {\r\n        return (getChildren().get(0) == node) ? 0 : -1;\r\n    }\r\n    \r\n    @Override\r\n    public void removeNode(Node node) {\r\n        getChildren().remove(node);\r\n        ((DockContainableComponent) node).setParentContainer(null);\r\n    }\r\n    \r\n    @Override\r\n    public void insertNode(Node node, int index) {\r\n        getChildren().set(index, node);\r\n        \r\n        ((DockContainableComponent) node).setParentContainer(this);\r\n    }\r\n    \r\n    @Override\r\n    public void undock(DockNode node) {\r\n        if (getChildren().get(0) == node) {\r\n            getChildren().remove(node);\r\n            node.setParentContainer(null);\r\n        }\r\n    }\r\n \r\n    private void manageSubContainers(DockNode node, DockNode.DockPosition position, double percentage) {\r\n        Node existNode = getChildren().get(0);\r\n        \r\n        if (DockCommons.isABorderPosition(position)) {\r\n            getChildren().remove(existNode);\r\n            DockSplitterContainer splitter = DockCommons.createSplitter(existNode, node, position, percentage);\r\n            getChildren().add(splitter);\r\n            splitter.setParentContainer(this);\r\n        } else if (existNode instanceof DockTabberContainer) {\r\n            DockTabberContainer tabber = (DockTabberContainer) existNode;\r\n            tabber.putDock(node, DockNode.DockPosition.CENTER, percentage);\r\n        } else if (existNode instanceof DockSplitterContainer) {\r\n            position = DockNode.DockPosition.BOTTOM;\r\n            DockSplitterContainer splitter = (DockSplitterContainer) existNode;\r\n            node.dock((DockStation)this, position);\r\n        } else {\r\n            getChildren().remove(existNode);\r\n            DockTabberContainer tabber = DockCommons.createTabber(existNode, node, position);\r\n            \r\n            getChildren().add(tabber);\r\n            tabber.setParentContainer(this);\r\n        }\r\n    }\r\n    \r\n    @Override\r\n    public void setParentContainer(DockContainer container) {\r\n        this.container = container;\r\n    }\r\n    \r\n    @Override\r\n    public DockContainer getParentContainer() {\r\n        return container;\r\n    }\r\n    \r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/containers/StageFloatable.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\npackage com.anchorage.docks.containers;\r\n\r\nimport static com.anchorage.docks.containers.common.AnchorageSettings.FLOATING_NODE_DROPSHADOW_RADIUS;\r\nimport static com.anchorage.docks.containers.common.AnchorageSettings.FLOATING_NODE_MINIMUM_HEIGHT;\r\nimport static com.anchorage.docks.containers.common.AnchorageSettings.FLOATING_NODE_MINIMUM_WIDTH;\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.stations.DockStation;\r\nimport javafx.event.EventHandler;\r\nimport javafx.geometry.Insets;\r\nimport javafx.geometry.Point2D;\r\nimport javafx.scene.Cursor;\r\nimport javafx.scene.Scene;\r\nimport javafx.scene.SnapshotParameters;\r\nimport javafx.scene.effect.BlurType;\r\nimport javafx.scene.effect.DropShadow;\r\nimport javafx.scene.image.ImageView;\r\nimport javafx.scene.image.WritableImage;\r\nimport javafx.scene.input.MouseEvent;\r\nimport javafx.scene.layout.StackPane;\r\nimport javafx.scene.paint.Color;\r\nimport javafx.stage.Stage;\r\nimport javafx.stage.StageStyle;\r\nimport javafx.stage.Window;\r\n\r\n/**\r\n *\r\n * @author avinerbi\r\n */\r\npublic class StageFloatable extends Stage {\r\n\r\n    private Scene scene;\r\n    private DockNode node;\r\n    private StackPane transparentRootPanel;\r\n    private StackPane stackPanelContainer;\r\n    private Window owner;\r\n\r\n    private Point2D mousePositionStart;\r\n    private EventHandler<MouseEvent> eventsHandler;\r\n\r\n    private double startX;\r\n    private double startWidth;\r\n\r\n    private double startY;\r\n    private double startHeight;\r\n\r\n    private ImageView imageView;\r\n    private WritableImage ghostImage;\r\n\r\n    private StageFloatable() {\r\n\r\n    }\r\n\r\n    public StageFloatable(DockNode node, Window owner, double startX, double startY) {\r\n        this.node = node;\r\n        this.owner = owner;\r\n\r\n        buildUI(startX, startY);\r\n\r\n        setAlwaysOnTop(true);\r\n    }\r\n\r\n    private void setupMouseEvents() {\r\n        eventsHandler = event -> {\r\n\r\n            if (event.getEventType() == MouseEvent.MOUSE_PRESSED) {\r\n                mousePositionStart = new Point2D(event.getScreenX(), event.getScreenY());\r\n                startWidth = getWidth();\r\n                startX = getX();\r\n\r\n                startHeight = getHeight();\r\n                startY = getY();\r\n            }\r\n\r\n            if (event.getEventType() == MouseEvent.MOUSE_MOVED) {\r\n\r\n                boolean sizeRight = valueInRange(event.getX(), stackPanelContainer.getWidth() - stackPanelContainer.getPadding().getLeft(), stackPanelContainer.getWidth());\r\n                boolean sizeLeft = valueInRange(event.getX(), 0, stackPanelContainer.getPadding().getRight());\r\n                boolean sizeTop = valueInRange(event.getY(), 0, stackPanelContainer.getPadding().getTop());\r\n                boolean sizeBottom = valueInRange(event.getY(), stackPanelContainer.getHeight() - stackPanelContainer.getPadding().getBottom(), stackPanelContainer.getHeight());\r\n\r\n                Cursor cursor = changeCursor(sizeLeft, sizeRight, sizeTop, sizeBottom);\r\n\r\n                getScene().setCursor(cursor);\r\n            }\r\n\r\n            if (event.getEventType() == MouseEvent.MOUSE_DRAGGED && (getScene().getCursor() != null && getScene().getCursor() != Cursor.DEFAULT)) {\r\n\r\n                if (getScene().getCursor() == Cursor.E_RESIZE || getScene().getCursor() == Cursor.SE_RESIZE || getScene().getCursor() == Cursor.NE_RESIZE) {\r\n                    if (event.getScreenX() - getX() + FLOATING_NODE_DROPSHADOW_RADIUS > FLOATING_NODE_MINIMUM_WIDTH) {\r\n                        setWidth(event.getScreenX() - getX() + FLOATING_NODE_DROPSHADOW_RADIUS);\r\n                    }\r\n                }\r\n                else if (getScene().getCursor() == Cursor.S_RESIZE || getScene().getCursor() == Cursor.SE_RESIZE || getScene().getCursor() == Cursor.SW_RESIZE) {\r\n                    if (event.getScreenY() - getY() + FLOATING_NODE_DROPSHADOW_RADIUS > FLOATING_NODE_MINIMUM_HEIGHT) {\r\n                        setHeight(event.getScreenY() - getY() + FLOATING_NODE_DROPSHADOW_RADIUS);\r\n                    }\r\n                }\r\n                else if (getScene().getCursor() == Cursor.W_RESIZE || getScene().getCursor() == Cursor.NW_RESIZE || getScene().getCursor() == Cursor.SW_RESIZE) {\r\n\r\n                    double newX = event.getScreenX() - FLOATING_NODE_DROPSHADOW_RADIUS;\r\n                    double newWidth = startX - newX + startWidth;\r\n\r\n                    if (newWidth > FLOATING_NODE_MINIMUM_WIDTH) {\r\n                        setX(newX);\r\n                        setWidth(newWidth);\r\n                    }\r\n\r\n                }\r\n                else if (getScene().getCursor() == Cursor.N_RESIZE || getScene().getCursor() == Cursor.NW_RESIZE || getScene().getCursor() == Cursor.NE_RESIZE) {\r\n\r\n                    double newY = event.getScreenY() - FLOATING_NODE_DROPSHADOW_RADIUS;\r\n                    double newHeight = startY - newY + startHeight;\r\n\r\n                    if (newHeight > FLOATING_NODE_MINIMUM_HEIGHT) {\r\n                        setY(newY);\r\n                        setHeight(newHeight);\r\n                    }\r\n\r\n                }\r\n\r\n            }\r\n            /*\r\n            else if (event.getEventType() == MouseEvent.MOUSE_RELEASED) {\r\n                // TODO: handle this event?\r\n            }\r\n            */\r\n        };\r\n\r\n        stackPanelContainer.addEventFilter(MouseEvent.MOUSE_PRESSED, eventsHandler);\r\n        stackPanelContainer.addEventFilter(MouseEvent.MOUSE_MOVED, eventsHandler);\r\n        stackPanelContainer.addEventFilter(MouseEvent.MOUSE_DRAGGED, eventsHandler);\r\n        stackPanelContainer.addEventFilter(MouseEvent.MOUSE_RELEASED, eventsHandler);\r\n    }\r\n\r\n    public boolean inResizing() {\r\n        return (getScene().getCursor() != null && getScene().getCursor() != Cursor.DEFAULT);\r\n    }\r\n\r\n    private Cursor changeCursor(boolean sizeLeft, boolean sizeRight, boolean sizeTop, boolean sizeBottom) {\r\n        Cursor cursor = Cursor.DEFAULT;\r\n        if (sizeLeft) {\r\n            if (sizeTop) {\r\n                cursor = Cursor.NW_RESIZE;\r\n            }\r\n            else if (sizeBottom) {\r\n                cursor = Cursor.SW_RESIZE;\r\n            }\r\n            else {\r\n                cursor = Cursor.W_RESIZE;\r\n            }\r\n        }\r\n        else if (sizeRight) {\r\n            if (sizeTop) {\r\n                cursor = Cursor.NE_RESIZE;\r\n            }\r\n            else if (sizeBottom) {\r\n                cursor = Cursor.SE_RESIZE;\r\n            }\r\n            else {\r\n                cursor = Cursor.E_RESIZE;\r\n            }\r\n        }\r\n        else if (sizeTop) {\r\n            cursor = Cursor.N_RESIZE;\r\n        }\r\n        else if (sizeBottom) {\r\n            cursor = Cursor.S_RESIZE;\r\n        }\r\n\r\n        return cursor;\r\n    }\r\n\r\n    private boolean valueInRange(double value, double min, double max) {\r\n        return (value >= min && value <= max);\r\n    }\r\n\r\n    private void removeMouseEvents() {\r\n        removeEventFilter(MouseEvent.MOUSE_PRESSED, eventsHandler);\r\n        removeEventFilter(MouseEvent.MOUSE_MOVED, eventsHandler);\r\n        removeEventFilter(MouseEvent.MOUSE_DRAGGED, eventsHandler);\r\n        removeEventFilter(MouseEvent.MOUSE_RELEASED, eventsHandler);\r\n    }\r\n\r\n    private void buildUI(double startX, double startY) {\r\n\r\n        initOwner(owner);\r\n\r\n        setX(startX - FLOATING_NODE_DROPSHADOW_RADIUS);\r\n        setY(startY - FLOATING_NODE_DROPSHADOW_RADIUS);\r\n\r\n        createContainerPanel();\r\n\r\n        initStyle(StageStyle.TRANSPARENT);\r\n\r\n        scene = new Scene(transparentRootPanel, node.getWidth() + FLOATING_NODE_DROPSHADOW_RADIUS * 2,\r\n                          node.getHeight() + FLOATING_NODE_DROPSHADOW_RADIUS * 2,\r\n                          Color.TRANSPARENT);\r\n\r\n        setOnShown(e -> {\r\n\r\n            setWidth(getWidth() + stackPanelContainer.getPadding().getLeft() + stackPanelContainer.getPadding().getRight());\r\n            setHeight(getHeight() + stackPanelContainer.getPadding().getTop() + stackPanelContainer.getPadding().getBottom());\r\n\r\n        });\r\n\r\n        setScene(scene);\r\n\r\n    }\r\n\r\n    private void createContainerPanel() {\r\n\r\n        ghostImage = node.snapshot(new SnapshotParameters(), null);\r\n\r\n        imageView = new ImageView(ghostImage);\r\n\r\n        stackPanelContainer = new StackPane(imageView);\r\n\r\n        transparentRootPanel = new StackPane(stackPanelContainer);\r\n\r\n        transparentRootPanel.setPadding(new Insets(FLOATING_NODE_DROPSHADOW_RADIUS));\r\n\r\n        transparentRootPanel.setStyle(\"-fx-background-color:rgba(0,0,0,0);\");\r\n\r\n        stackPanelContainer.getStyleClass().add(\"docknode-floating-stack-container-panel\");\r\n\r\n        stackPanelContainer.setEffect(new DropShadow(BlurType.GAUSSIAN, new Color(0, 0, 0, 0.6), FLOATING_NODE_DROPSHADOW_RADIUS, 0.2, 0, 0));\r\n\r\n        stackPanelContainer.relocate(FLOATING_NODE_DROPSHADOW_RADIUS, FLOATING_NODE_DROPSHADOW_RADIUS);\r\n    }\r\n\r\n    public void move(double x, double y) {\r\n        setX(x);\r\n        setY(y);\r\n    }\r\n\r\n    public void makeNodeActiveOnFloatableStage() {\r\n\r\n        DockStation station = node.stationProperty().get();  // save the station\r\n\r\n        node.undock();\r\n\r\n        node.stationProperty().set(station); // resume station\r\n\r\n        stackPanelContainer.getChildren().remove(imageView);\r\n\r\n        stackPanelContainer.getChildren().add(node);\r\n\r\n        if (node.resizableProperty().get()) {\r\n            setupMouseEvents();\r\n        }\r\n        \r\n         \r\n    }\r\n\r\n    public void closeStage() {\r\n\r\n        transparentRootPanel.getChildren().removeAll();\r\n        setScene(null);\r\n        hide();\r\n    }\r\n\r\n    public void makeFloatable() {\r\n\r\n    }\r\n\r\n    public Insets getPaddingOffset() {\r\n        return stackPanelContainer.getPadding();\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/containers/common/AnchorageSettings.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\npackage com.anchorage.docks.containers.common;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic class AnchorageSettings {\r\n    public static final int FLOATING_NODE_DROPSHADOW_RADIUS = 10; \r\n    public static final int FLOATING_NODE_MINIMUM_WIDTH = 150;\r\n    public static final int FLOATING_NODE_MINIMUM_HEIGHT = 150;\r\n    \r\n    private static boolean dockingPositionPreview = true;\r\n    \r\n    public static void setDockingPositionPreview(boolean value)\r\n    {\r\n        dockingPositionPreview = value;\r\n    }\r\n\r\n    public static boolean isDockingPositionPreview() {\r\n        return dockingPositionPreview;\r\n    }\r\n    \r\n    \r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/containers/common/DockCommons.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n\r\npackage com.anchorage.docks.containers.common;\r\n\r\nimport com.anchorage.docks.containers.interfaces.DockContainableComponent;\r\nimport com.anchorage.docks.containers.subcontainers.DockSplitterContainer;\r\nimport com.anchorage.docks.containers.subcontainers.DockTabberContainer;\r\nimport com.anchorage.docks.node.DockNode;\r\nimport javafx.geometry.Orientation;\r\nimport javafx.scene.Node;\r\nimport javafx.scene.control.Tab;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic class DockCommons {\r\n\r\n    public static boolean isABorderPosition(DockNode.DockPosition position) {\r\n        return position != DockNode.DockPosition.CENTER;\r\n    }\r\n\r\n    public static DockSplitterContainer createSplitter(Node existNode, Node newNode, DockNode.DockPosition position, double percentage) {\r\n        DockSplitterContainer splitter = createEmptySplitter();\r\n \r\n        if (position == DockNode.DockPosition.BOTTOM || position == DockNode.DockPosition.TOP) {\r\n            splitter.setOrientation(Orientation.VERTICAL);\r\n        }\r\n\r\n        DockContainableComponent existContainableComponent = (DockContainableComponent) existNode;\r\n        DockContainableComponent newContainableComponent = (DockContainableComponent) newNode;\r\n\r\n        existContainableComponent.setParentContainer(splitter);\r\n        newContainableComponent.setParentContainer(splitter);\r\n\r\n        if (position == DockNode.DockPosition.BOTTOM || position == DockNode.DockPosition.RIGHT) {\r\n            splitter.getItems().addAll(existNode, newNode);\r\n        }\r\n        else {\r\n            splitter.getItems().addAll(newNode, existNode);\r\n        }\r\n\r\n        splitter.getStyleClass().add(\"docknode-split-pane\");\r\n        splitter.setDividerPositions(percentage);\r\n        return splitter;\r\n    }\r\n\r\n    public static DockSplitterContainer createEmptySplitter() {\r\n        return new DockSplitterContainer();\r\n    }\r\n\r\n    public static DockTabberContainer createTabber(Node existNode, Node newNode, DockNode.DockPosition position) {\r\n\r\n        if (existNode instanceof DockNode && newNode instanceof DockNode) {\r\n            DockNode existDockNode = (DockNode) existNode;\r\n            DockNode newDockNode = (DockNode) newNode;\r\n\r\n            DockTabberContainer tabber = new DockTabberContainer();\r\n            Tab existTabPanel = new Tab(existDockNode.getContent().titleProperty().get());\r\n            Tab newTabPanel = new Tab(newDockNode.getContent().titleProperty().get());\r\n\r\n            existTabPanel.setOnCloseRequest(event -> {\r\n\r\n                if (existDockNode.getCloseRequestHandler() == null || existDockNode.getCloseRequestHandler().canClose()) {\r\n                    existDockNode.undock();\r\n                    event.consume();\r\n                }\r\n\r\n            });\r\n\r\n            newTabPanel.setOnCloseRequest(event -> {\r\n\r\n                if (newDockNode.getCloseRequestHandler() == null || newDockNode.getCloseRequestHandler().canClose()) {\r\n                    newDockNode.undock();\r\n                    event.consume();\r\n                }\r\n\r\n            });\r\n\r\n            existTabPanel.closableProperty().bind(existDockNode.closeableProperty());\r\n            newTabPanel.closableProperty().bind(newDockNode.closeableProperty());\r\n\r\n            existTabPanel.setContent(existDockNode);\r\n            newTabPanel.setContent(newDockNode);\r\n\r\n            DockContainableComponent existContainableComponent = (DockContainableComponent) existNode;\r\n            DockContainableComponent newContainableComponent = (DockContainableComponent) newNode;\r\n\r\n            existContainableComponent.setParentContainer(tabber);\r\n            newContainableComponent.setParentContainer(tabber);\r\n\r\n            tabber.getTabs().addAll(existTabPanel, newTabPanel);\r\n\r\n            tabber.getStyleClass().add(\"docknode-tab-pane\");\r\n\r\n            newDockNode.ensureVisibility();\r\n\r\n            return tabber;\r\n        }\r\n        return null;\r\n    }\r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/containers/interfaces/DockContainableComponent.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\npackage com.anchorage.docks.containers.interfaces;\r\n \r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic interface DockContainableComponent {\r\n    \r\n    public void setParentContainer(DockContainer container);\r\n    public DockContainer getParentContainer();\r\n    \r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/containers/interfaces/DockContainer.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n\r\npackage com.anchorage.docks.containers.interfaces;\r\n\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.stations.DockStation;\r\nimport javafx.scene.Node;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic interface DockContainer extends DockContainableComponent {\r\n    public void putDock(DockNode node, DockNode.DockPosition position, double percentage);\r\n    public void putDock(DockNode node, DockNode nodeTarget, DockNode.DockPosition position, double percentage);\r\n    \r\n    public void undock(DockNode node);\r\n    \r\n    public int indexOf(Node node);\r\n\r\n    public void insertNode(Node node, int index);\r\n    public void removeNode(Node node);\r\n\r\n    public boolean isDockVisible(DockNode node);\r\n     \r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/containers/subcontainers/DockSplitterContainer.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n\r\npackage com.anchorage.docks.containers.subcontainers;\r\n\r\nimport com.anchorage.docks.containers.common.DockCommons;\r\nimport com.anchorage.docks.containers.interfaces.DockContainableComponent;\r\nimport com.anchorage.docks.containers.interfaces.DockContainer;\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.stations.DockStation;\r\nimport javafx.scene.Node;\r\nimport javafx.scene.control.SplitPane;\r\nimport javafx.scene.layout.BorderPane;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic final class DockSplitterContainer extends SplitPane implements DockContainer {\r\n\r\n    private DockContainer container;\r\n    \r\n   \r\n    @Override\r\n    public void putDock(DockNode node, DockNode.DockPosition position, double percentage)  {\r\n        // NOTHING\r\n    }\r\n  \r\n    \r\n    @Override\r\n    public void putDock(DockNode node, DockNode nodeTarget, DockNode.DockPosition position, double percentage) {\r\n\r\n        // get index of current node target\r\n        int indexOfTarget = getItems().indexOf(nodeTarget);\r\n\r\n        if (DockCommons.isABorderPosition(position)) {\r\n            // create a splitter with node and nodeTarget\r\n            DockSplitterContainer splitter = DockCommons.createSplitter(nodeTarget, node, position,percentage);\r\n\r\n            getChildren().add(splitter);\r\n            splitter.setParentContainer(this);\r\n\r\n            // set the splitter on index of target\r\n            getItems().set(indexOfTarget, splitter);\r\n        } else {\r\n            DockTabberContainer tabber = DockCommons.createTabber(nodeTarget, node, position);\r\n            getChildren().add(tabber);\r\n            tabber.setParentContainer(this);\r\n            getItems().set(indexOfTarget, tabber);\r\n        }\r\n\r\n        // remove target from splitter\r\n        getItems().remove(nodeTarget);\r\n    }\r\n    \r\n    @Override\r\n    public boolean isDockVisible(DockNode node)\r\n    {\r\n        return true;\r\n    }\r\n\r\n    @Override\r\n    public void undock(DockNode node) {\r\n        Node remainingNode = (getItems().get(0) == node) ?  getItems().get(1) : getItems().get(0);\r\n        getItems().remove(remainingNode);\r\n        getItems().remove(node);\r\n        \r\n        // WORKAROUND for bug on split panel. After  getItems().remove(node) the parent of node is not set to null !!!!!\r\n        BorderPane workAroundPane = new BorderPane(node);\r\n        workAroundPane.getChildren().remove(node);\r\n        // END WORKAROUND\r\n \r\n        int indexInsideParent = getParentContainer().indexOf(this);\r\n\r\n        getParentContainer().insertNode(remainingNode, indexInsideParent);\r\n        getParentContainer().removeNode(this);\r\n        \r\n        ((DockContainableComponent) node).setParentContainer(null);\r\n        \r\n    }\r\n\r\n    @Override\r\n    public void insertNode(Node node, int index) {\r\n        getItems().set(index, node);\r\n        ((DockContainableComponent) node).setParentContainer(this);\r\n    }\r\n\r\n    @Override\r\n    public void removeNode(Node node) {\r\n        getItems().remove(node);\r\n        ((DockContainableComponent) node).setParentContainer(null);\r\n    }\r\n\r\n    @Override\r\n    public int indexOf(Node node) {\r\n        return getItems().indexOf(node);\r\n    }\r\n\r\n    @Override\r\n    public void setParentContainer(DockContainer container) {\r\n        this.container = container;\r\n    }\r\n\r\n    @Override\r\n    public DockContainer getParentContainer() {\r\n        return container;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/containers/subcontainers/DockTabberContainer.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n\r\npackage com.anchorage.docks.containers.subcontainers;\r\n\r\nimport com.anchorage.docks.containers.common.DockCommons;\r\nimport com.anchorage.docks.containers.interfaces.DockContainableComponent;\r\nimport com.anchorage.docks.containers.interfaces.DockContainer;\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.stations.DockStation;\r\nimport javafx.scene.Node;\r\nimport javafx.scene.control.Tab;\r\nimport javafx.scene.control.TabPane;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic final class DockTabberContainer extends TabPane implements DockContainer {\r\n\r\n    private DockContainer container;\r\n    \r\n    @Override\r\n    public void putDock(DockNode node, DockNode.DockPosition position, double percentage) {\r\n        Tab newTab = new Tab(node.getContent().titleProperty().get());\r\n        newTab.closableProperty().bind(node.closeableProperty());\r\n        getTabs().add(newTab);\r\n        newTab.setContent(node);\r\n        node.setParentContainer(this);\r\n        node.ensureVisibility();\r\n    }\r\n \r\n    private void createSplitter(DockNode node, DockNode.DockPosition position) {\r\n        DockContainer currentContainer = container;\r\n\r\n        DockSplitterContainer splitter = DockCommons.createSplitter(this, node, position, 0.5);\r\n\r\n        int indexOf = currentContainer.indexOf(this);\r\n\r\n        currentContainer.insertNode(splitter, indexOf);\r\n\r\n        currentContainer.removeNode(this);\r\n\r\n        container = splitter;\r\n    }\r\n\r\n    private Tab getTabByNode(DockNode node) {\r\n        return getTabs().stream().filter(t -> t.getContent() == node).findFirst().get();\r\n    }\r\n\r\n    @Override\r\n    public boolean isDockVisible(DockNode node) {\r\n        Tab nodeTab = getTabByNode(node);\r\n        return getSelectionModel().getSelectedItem() == nodeTab;\r\n    }\r\n\r\n    @Override\r\n    public void putDock(DockNode node, DockNode nodeTarget, DockNode.DockPosition position, double percentage) {\r\n        if (position != DockNode.DockPosition.CENTER) {\r\n            createSplitter(node, position);\r\n        } else {\r\n\r\n            DockContainableComponent containableComponent = (DockContainableComponent) node;\r\n            if (containableComponent.getParentContainer() != this) {\r\n                Tab newTab = new Tab(node.getContent().titleProperty().get());\r\n                newTab.closableProperty().bind(node.closeableProperty());\r\n                getTabs().add(newTab);\r\n                newTab.setContent(node);\r\n                node.setParentContainer(this);\r\n                node.ensureVisibility();\r\n            }\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public int indexOf(Node node) {\r\n        int index = 0;\r\n        boolean found = false;\r\n        for (Tab tab : getTabs()) {\r\n            if (tab.getContent() == node) {\r\n                found = true;\r\n                break;\r\n            }\r\n            index++;\r\n        }\r\n\r\n        return (found) ? index : -1;\r\n    }\r\n\r\n    @Override\r\n    public void undock(DockNode node) {\r\n        int index = indexOf(node);\r\n\r\n        Tab tab = getTabs().get(index);\r\n        getTabs().remove(tab);\r\n\r\n        ((DockContainableComponent) node).setParentContainer(null);\r\n\r\n        if (getTabs().size() == 1) {\r\n            DockNode remainingNode = (DockNode) getTabs().get(0).getContent();\r\n            getTabs().remove(0);\r\n            int indexInsideParent = getParentContainer().indexOf(this);\r\n\r\n            getParentContainer().insertNode(remainingNode, indexInsideParent);\r\n            getParentContainer().removeNode(this);\r\n\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public void insertNode(Node node, int index) {\r\n        // NOTHING\r\n    }\r\n\r\n    @Override\r\n    public void removeNode(Node node) {\r\n        // NOTHING\r\n    }\r\n\r\n    @Override\r\n    public void setParentContainer(DockContainer container) {\r\n        this.container = container;\r\n    }\r\n\r\n    @Override\r\n    public DockContainer getParentContainer() {\r\n        return container;\r\n    }\r\n\r\n    public void manageDragOnSameNode(DockNode node, DockNode.DockPosition position) {\r\n\r\n        if (getTabByNode(node) != null && getTabs().size() == 2) {\r\n            DockNode otherNode = (getTabs().get(0).getContent() == node) ? (DockNode) getTabs().get(1).getContent() : (DockNode) getTabs().get(0).getContent();\r\n            node.undock();\r\n            node.dock(otherNode, position);\r\n        } else if (getTabByNode(node) != null && getTabs().size() > 2) {\r\n\r\n            node.undock();\r\n\r\n            DockContainer currentContainer = container;\r\n\r\n            DockSplitterContainer splitter = DockCommons.createSplitter(this, node, position, 0.5);\r\n\r\n            int indexOf = currentContainer.indexOf(this);\r\n\r\n            currentContainer.insertNode(splitter, indexOf);\r\n\r\n            currentContainer.removeNode(this);\r\n\r\n            container = splitter;\r\n\r\n            node.stationProperty().get().add(node);\r\n        }\r\n    }\r\n\r\n    public void ensureVisibility(DockNode node) {\r\n\r\n        Tab tabNode = getTabByNode(node);\r\n        getSelectionModel().select(tabNode);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/containers/zones/DockZones.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n\r\npackage com.anchorage.docks.containers.zones;\r\n\r\nimport com.anchorage.docks.containers.common.AnchorageSettings;\r\nimport static com.anchorage.docks.containers.common.AnchorageSettings.FLOATING_NODE_DROPSHADOW_RADIUS;\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.node.ui.DockUIPanel;\r\nimport com.anchorage.docks.stations.DockStation;\r\nimport com.anchorage.docks.stations.DockSubStation;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\nimport javafx.animation.Interpolator;\r\nimport javafx.animation.KeyFrame;\r\nimport javafx.animation.KeyValue;\r\nimport javafx.animation.Timeline;\r\nimport javafx.geometry.BoundingBox;\r\nimport javafx.geometry.Bounds;\r\nimport javafx.geometry.Point2D;\r\nimport javafx.scene.Scene;\r\nimport javafx.scene.image.Image;\r\nimport javafx.scene.layout.Pane;\r\nimport javafx.scene.paint.Color;\r\nimport javafx.scene.shape.Circle;\r\nimport javafx.scene.shape.Rectangle;\r\nimport javafx.stage.Stage;\r\nimport javafx.stage.StageStyle;\r\nimport javafx.util.Duration;\r\n\r\n/**\r\n *\r\n * @author avinerbi\r\n */\r\npublic final class DockZones extends Stage {\r\n\r\n    private static final double CIRCLE_RADIUS = 100;\r\n    public static final int OFFSET_IMAGE = 15;\r\n\r\n    ///////// MAIN STAGE SCENE AND ROOT\r\n    private Scene scene;\r\n    private Pane mainRoot;\r\n\r\n    ////////////////////////////////////\r\n    /////////// CIRCLE EXTERNAL STAGE \r\n    private Stage circleStage;\r\n    private Scene circleStageScene;\r\n    private Pane circleStageRoot;\r\n    private Circle circleZone;\r\n    ////////////////////////////////////\r\n\r\n    private static Image dragTopImage;\r\n    private static Image dragBottomImage;\r\n    private static Image dragLeftImage;\r\n    private static Image dragRightImage;\r\n    private static Image dragCenterImage;\r\n\r\n    private List<ZoneSelector> selectors;\r\n\r\n    ///////////////////////////////////////////////\r\n    private DockStation ownerStation;\r\n    private Rectangle currentAreaSelected;\r\n\r\n    private DockNode currentNodeTarget;\r\n    private DockNode nodeToMove;\r\n    private DockNode.DockPosition currentPosition;\r\n\r\n    private ZoneSelector currentZoneSelector = null;\r\n\r\n    private Rectangle rectanglePreview;\r\n    private Timeline opacityAnimationPreview;\r\n\r\n    static {\r\n        dragTopImage = new Image(\"dragtop.png\");\r\n        dragBottomImage = new Image(\"dragbottom.png\");\r\n        dragLeftImage = new Image(\"dragleft.png\");\r\n        dragRightImage = new Image(\"dragright.png\");\r\n        dragCenterImage = new Image(\"dragcenter.png\");\r\n    }\r\n\r\n    private DockZones() {\r\n\r\n    }\r\n\r\n    public DockZones(DockStation station, DockNode nodeToMove) {\r\n\r\n        this.nodeToMove = nodeToMove;\r\n        this.ownerStation = station;\r\n\r\n        initOwner(ownerStation.getStationWindow());\r\n        initStyle(StageStyle.TRANSPARENT);\r\n\r\n        buildUI();\r\n\r\n        buildCircleStage();\r\n        makeSelectors();\r\n        createRectangleForPreview();\r\n\r\n        setAlwaysOnTop(true);\r\n        circleStage.setAlwaysOnTop(true);\r\n    }\r\n\r\n    private void createRectangleForPreview() {\r\n        rectanglePreview = new Rectangle(0, 0, 50, 50);\r\n        rectanglePreview.getStyleClass().add(\"dockzone-rectangle-preview\");\r\n        rectanglePreview.setOpacity(0);\r\n\r\n        opacityAnimationPreview = new Timeline(new KeyFrame(Duration.seconds(0.5), new KeyValue(rectanglePreview.opacityProperty(), 0.5, Interpolator.LINEAR)));\r\n\r\n        opacityAnimationPreview.setAutoReverse(true);\r\n        opacityAnimationPreview.setCycleCount(-1);\r\n\r\n        mainRoot.getChildren().add(rectanglePreview);\r\n\r\n    }\r\n\r\n    private void makeSelectors() {\r\n        selectors = new ArrayList<>();\r\n\r\n        if (ownerStation.getChildren().size() > 0) {\r\n            // selectors of station\r\n            selectors.add(new ZoneSelector(dragTopImage, DockNode.DockPosition.TOP, true, mainRoot, (mainRoot.getWidth() - dragTopImage.getWidth()) / 2, OFFSET_IMAGE));\r\n            selectors.add(new ZoneSelector(dragBottomImage, DockNode.DockPosition.BOTTOM, true, mainRoot, (mainRoot.getWidth() - dragTopImage.getWidth()) / 2, mainRoot.getHeight() - dragBottomImage.getHeight() - OFFSET_IMAGE));\r\n            selectors.add(new ZoneSelector(dragLeftImage, DockNode.DockPosition.LEFT, true, mainRoot, OFFSET_IMAGE, (mainRoot.getHeight() - dragLeftImage.getWidth()) / 2));\r\n            selectors.add(new ZoneSelector(dragRightImage, DockNode.DockPosition.RIGHT, true, mainRoot, (mainRoot.getWidth() - dragRightImage.getWidth() - OFFSET_IMAGE), (mainRoot.getHeight() - dragRightImage.getWidth()) / 2));\r\n\r\n            // selectors of node\r\n            selectors.add(new ZoneSelector(dragTopImage, DockNode.DockPosition.TOP, false, circleStageRoot, (circleStageRoot.getWidth() - dragTopImage.getWidth()) / 2, OFFSET_IMAGE));\r\n            selectors.add(new ZoneSelector(dragBottomImage, DockNode.DockPosition.BOTTOM, false, circleStageRoot, (circleStageRoot.getWidth() - dragBottomImage.getWidth()) / 2, circleStageRoot.getHeight() - dragBottomImage.getHeight() - OFFSET_IMAGE));\r\n            selectors.add(new ZoneSelector(dragLeftImage, DockNode.DockPosition.LEFT, false, circleStageRoot, OFFSET_IMAGE, (circleStageRoot.getHeight() - dragLeftImage.getHeight()) / 2));\r\n            selectors.add(new ZoneSelector(dragRightImage, DockNode.DockPosition.RIGHT, false, circleStageRoot, circleStageRoot.getWidth() - dragRightImage.getWidth() - OFFSET_IMAGE, (circleStageRoot.getHeight() - dragRightImage.getHeight()) / 2));\r\n            selectors.add(new ZoneSelector(dragCenterImage, DockNode.DockPosition.CENTER, false, circleStageRoot, (circleStageRoot.getWidth() - dragCenterImage.getWidth()) / 2, (circleStageRoot.getHeight() - dragCenterImage.getHeight()) / 2));\r\n\r\n        }\r\n        else {\r\n            selectors.add(new ZoneSelector(dragCenterImage, DockNode.DockPosition.CENTER, true, mainRoot, (mainRoot.getWidth() - dragCenterImage.getWidth()) / 2, (mainRoot.getHeight() - dragCenterImage.getHeight()) / 2));\r\n        }\r\n\r\n    }\r\n\r\n    private void buildCircleStage() {\r\n\r\n        circleStage = new Stage();\r\n        circleStage.initStyle(StageStyle.TRANSPARENT);\r\n        circleStage.initOwner(this);\r\n\r\n        circleZone = new Circle(CIRCLE_RADIUS);\r\n        circleZone.setCenterX(CIRCLE_RADIUS);\r\n        circleZone.setCenterY(CIRCLE_RADIUS);\r\n        circleZone.getStyleClass().add(\"dockzone-circle-container-selectors\");\r\n\r\n        circleStageRoot = new Pane(circleZone);\r\n        circleStageRoot.setStyle(\"-fx-background-color:rgba(0,0,0,0);\");\r\n\r\n        circleStageScene = new Scene(circleStageRoot, CIRCLE_RADIUS * 2, CIRCLE_RADIUS * 2, Color.TRANSPARENT);\r\n\r\n        circleStage.setScene(circleStageScene);\r\n\r\n        circleStageRoot.setOpacity(0);\r\n    }\r\n\r\n    private void buildUI() {\r\n\r\n        mainRoot = new Pane();\r\n        mainRoot.setStyle(\"-fx-background-color:rgba(0,0,0,0);\");\r\n\r\n        scene = new Scene(mainRoot, ownerStation.getWidth(), ownerStation.getHeight(), Color.TRANSPARENT);\r\n\r\n        setScene(scene);\r\n\r\n        Point2D screenOrigin = ownerStation.localToScreen(ownerStation.getBoundsInLocal().getMinX(), ownerStation.getBoundsInLocal().getMinY());\r\n\r\n        setX(screenOrigin.getX());\r\n        setY(screenOrigin.getY());\r\n\r\n    }\r\n\r\n    public void showZones() {\r\n        show();\r\n        circleStage.show();\r\n    }\r\n\r\n    public void moveAt(DockNode node) {\r\n\r\n        currentNodeTarget = node;\r\n\r\n        Bounds screenBounds = node.getScreenBounds();\r\n\r\n        if (circleStageRoot.opacityProperty().get() == 0) {\r\n            circleStageRoot.setOpacity(1);\r\n        }\r\n\r\n        circleStage.setX(screenBounds.getMinX() + (screenBounds.getWidth() - circleStageRoot.getWidth()) / 2);\r\n        circleStage.setY(screenBounds.getMinY() + (screenBounds.getHeight() - circleStageRoot.getHeight()) / 2);\r\n\r\n    }\r\n\r\n    public void hideCircleZones() {\r\n\r\n        hidePreview();\r\n\r\n        currentNodeTarget = null;\r\n\r\n        if (currentZoneSelector != null) {\r\n            currentZoneSelector.reset();\r\n        }\r\n\r\n        currentZoneSelector = null;\r\n\r\n        currentPosition = null;\r\n        circleStageRoot.setOpacity(0);\r\n    }\r\n\r\n    private void checkVisibilityConditions() {\r\n        selectors.\r\n                stream().\r\n                forEach(z -> z.setZoneDisabled(false));\r\n\r\n        if (currentNodeTarget == nodeToMove) {\r\n            // disable border zones\r\n            selectors.\r\n                    stream().\r\n                    filter(z -> !z.isStationZone() && z.getPosition() != DockNode.DockPosition.CENTER).\r\n                    forEach(z -> z.setZoneDisabled(true));\r\n        }\r\n    }\r\n\r\n    public boolean searchArea(double x, double y) {\r\n\r\n        checkVisibilityConditions();\r\n\r\n        ZoneSelector selector = selectors.stream()\r\n                .filter(s -> s.overMe(x, y) && !s.isZoneDisabled())\r\n                .findFirst()\r\n                .orElse(null);\r\n\r\n        highLight(selector);\r\n\r\n        if (selector != null && selector != currentZoneSelector) {\r\n            currentZoneSelector = selector;\r\n            makePreview(currentZoneSelector, currentNodeTarget);\r\n            currentPosition = currentZoneSelector.getPosition();\r\n             \r\n        }\r\n        else {\r\n            if (selector == null) {\r\n                hidePreview();\r\n                currentZoneSelector = null;\r\n                currentPosition = null;\r\n            }\r\n        }\r\n        return selector != null;\r\n    }\r\n\r\n    public DockNode getCurrentNodeTarget() {\r\n        return currentNodeTarget;\r\n    }\r\n\r\n    public ZoneSelector getCurrentZoneSelector() {\r\n        return currentZoneSelector;\r\n    }\r\n\r\n    public DockNode getNodeSource() {\r\n        return nodeToMove;\r\n    }\r\n\r\n    public DockNode.DockPosition getCurrentPosition() {\r\n        return currentPosition;\r\n    }\r\n\r\n    private void highLight(ZoneSelector selector) {\r\n\r\n        selectors.stream().forEach(s -> s.reset());\r\n\r\n        if (selector != null) {\r\n            if (selector.isStationZone()) {\r\n                circleStageRoot.setOpacity(0);\r\n            }\r\n            else {\r\n                circleStageRoot.setOpacity(1);\r\n            }\r\n            selector.highLight();\r\n\r\n        }\r\n        else {\r\n            if (rectanglePreview != null) {\r\n                hidePreview();\r\n            }\r\n            currentNodeTarget = null;\r\n        }\r\n    }\r\n\r\n    private DockStation getStation() {\r\n        return ownerStation;\r\n    }\r\n\r\n    private void hidePreview() {\r\n        if (AnchorageSettings.isDockingPositionPreview()) {\r\n            stopAnimatePreview();\r\n            rectanglePreview.setOpacity(0);\r\n        }\r\n    }\r\n\r\n    private void showPreview(Bounds sceneBounds, ZoneSelector selector) {\r\n\r\n        if (selector.getPosition() == DockNode.DockPosition.LEFT) {\r\n\r\n            rectanglePreview.setX(sceneBounds.getMinX());\r\n            rectanglePreview.setY(sceneBounds.getMinY());\r\n            rectanglePreview.setWidth(sceneBounds.getWidth() / 2);\r\n            rectanglePreview.setHeight(sceneBounds.getHeight());\r\n        }\r\n\r\n        if (selector.getPosition() == DockNode.DockPosition.TOP) {\r\n\r\n            rectanglePreview.setX(sceneBounds.getMinX());\r\n            rectanglePreview.setY(sceneBounds.getMinY());\r\n            rectanglePreview.setWidth(sceneBounds.getWidth());\r\n            rectanglePreview.setHeight(sceneBounds.getHeight() / 2);\r\n\r\n        }\r\n\r\n        if (selector.getPosition() == DockNode.DockPosition.RIGHT) {\r\n\r\n            rectanglePreview.setX(sceneBounds.getMinX() + sceneBounds.getWidth() / 2);\r\n            rectanglePreview.setY(sceneBounds.getMinY());\r\n            rectanglePreview.setWidth(sceneBounds.getWidth() / 2);\r\n            rectanglePreview.setHeight(sceneBounds.getHeight());\r\n        }\r\n\r\n        if (selector.getPosition() == DockNode.DockPosition.BOTTOM) {\r\n\r\n            rectanglePreview.setX(sceneBounds.getMinX());\r\n            rectanglePreview.setY(sceneBounds.getMinY() + sceneBounds.getHeight() / 2);\r\n            rectanglePreview.setWidth(sceneBounds.getWidth());\r\n            rectanglePreview.setHeight(sceneBounds.getHeight() / 2);\r\n\r\n        }\r\n\r\n        if (selector.getPosition() == DockNode.DockPosition.CENTER) {\r\n\r\n            rectanglePreview.setX(sceneBounds.getMinX());\r\n            rectanglePreview.setY(sceneBounds.getMinY());\r\n            rectanglePreview.setWidth(sceneBounds.getWidth());\r\n            rectanglePreview.setHeight(sceneBounds.getHeight());\r\n        }\r\n    }\r\n\r\n    private void animatePreview() {\r\n        stopAnimatePreview();\r\n        rectanglePreview.setOpacity(1);\r\n        rectanglePreview.toFront();\r\n        opacityAnimationPreview.play();\r\n    }\r\n\r\n    private void stopAnimatePreview() {\r\n        opacityAnimationPreview.stop();\r\n    }\r\n\r\n    private void makePreview(ZoneSelector selector, DockNode currentNodeTarget) {\r\n\r\n        if (AnchorageSettings.isDockingPositionPreview()) {\r\n\r\n            if (selector.isStationZone()) {\r\n                Bounds sceneBounds = ownerStation.getBoundsInParent();\r\n                showPreview(sceneBounds,selector);\r\n            }\r\n            else {\r\n                Bounds nodeSceneBounds = currentNodeTarget.localToScene(currentNodeTarget.getBoundsInLocal());\r\n                Bounds stationSceneBounds = ownerStation.localToScene(ownerStation.getBoundsInLocal());\r\n                \r\n                Bounds sceneBounds = new BoundingBox(nodeSceneBounds.getMinX()-stationSceneBounds.getMinX(),\r\n                                                     nodeSceneBounds.getMinY()-stationSceneBounds.getMinY(),\r\n                                                     nodeSceneBounds.getWidth(),nodeSceneBounds.getHeight());\r\n                \r\n                if (ownerStation.isSubStation())\r\n                {\r\n                    DockSubStation subStationNode = ownerStation.getDockNodeForSubStation();\r\n                    \r\n                    if (subStationNode.floatingProperty().get())\r\n                    {\r\n                        sceneBounds = new BoundingBox(sceneBounds.getMinX()-FLOATING_NODE_DROPSHADOW_RADIUS-subStationNode.getFloatableStage().getPaddingOffset().getLeft(),\r\n                        sceneBounds.getMinY()-FLOATING_NODE_DROPSHADOW_RADIUS-subStationNode.getFloatableStage().getPaddingOffset().getTop()-DockUIPanel.BAR_HEIGHT,\r\n                        sceneBounds.getWidth(),\r\n                        sceneBounds.getHeight());\r\n                    }\r\n                }\r\n                showPreview(sceneBounds,selector);\r\n            }\r\n\r\n            animatePreview();\r\n        }\r\n\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/containers/zones/ZoneSelector.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n\r\npackage com.anchorage.docks.containers.zones;\r\n\r\nimport com.anchorage.docks.node.DockNode;\r\nimport javafx.geometry.Bounds;\r\nimport javafx.scene.image.Image;\r\nimport javafx.scene.image.ImageView;\r\nimport javafx.scene.layout.Pane;\r\nimport javafx.scene.shape.Circle;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic final class ZoneSelector extends Pane {\r\n    \r\n    private final DockNode.DockPosition position;\r\n    \r\n    private ImageView iconView;\r\n    private Circle iconCircle;\r\n    \r\n    private final boolean stationZone;\r\n    private final Pane parent;\r\n    \r\n    private boolean zoneDisabled = false;\r\n\r\n    public ZoneSelector(Image image, DockNode.DockPosition position, boolean stationZone, Pane parent, double x, double y)\r\n    { \r\n        this.position = position;\r\n        this.stationZone = stationZone;\r\n        this.parent = parent;\r\n          \r\n        buildUI(image,x,y);\r\n    }\r\n    \r\n    public void setZoneDisabled(boolean value)\r\n    {\r\n        zoneDisabled = value;\r\n        setOpacity((value) ? 0 : 1);\r\n    }\r\n    \r\n    public boolean isZoneDisabled()\r\n    {\r\n        return zoneDisabled;\r\n    }\r\n    \r\n    public void reset()\r\n    {\r\n        setOpacity((zoneDisabled) ? 0 : 0.3);\r\n    }\r\n    \r\n    public void highLight()\r\n    {\r\n        setOpacity((zoneDisabled) ? 0 : 1);\r\n    }\r\n    \r\n    private void buildUI(Image image, double x, double y)\r\n    {    \r\n        setPrefWidth(image.getWidth());\r\n        setPrefHeight(image.getHeight());\r\n        \r\n        iconView = new ImageView(image);  \r\n        setStyle(\"-fx-background-color:rgba(0,0,0,0);\");\r\n        \r\n        iconCircle = new Circle(image.getWidth()/2+10);\r\n        iconCircle.setCenterX(getPrefWidth() / 2);\r\n        iconCircle.setCenterY(getPrefHeight() / 2);\r\n        iconCircle.getStyleClass().add(\"dockzone-circle-selector\");\r\n        \r\n        iconView.relocate((getPrefWidth()-image.getWidth()) / 2, (getPrefWidth()-image.getHeight()) / 2);\r\n        \r\n        getChildren().addAll(iconCircle,iconView);\r\n        \r\n        parent.getChildren().add(this);\r\n        relocate(x, y); \r\n    }\r\n    \r\n    \r\n    /**\r\n     * Get the value of stationZone\r\n     *\r\n     * @return the value of stationZone\r\n     */\r\n    public boolean isStationZone() {\r\n        return stationZone;\r\n    }\r\n    \r\n    public boolean overMe(double x, double y)\r\n    {\r\n        Bounds screenBounds = localToScreen(getBoundsInLocal());\r\n        return (screenBounds.contains(x, y));\r\n    }\r\n    \r\n    public DockNode.DockPosition getPosition()\r\n    {\r\n        return position;\r\n    }\r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/node/DockNode.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\npackage com.anchorage.docks.node;\r\n\r\nimport com.anchorage.docks.containers.StageFloatable;\r\nimport static com.anchorage.docks.containers.common.AnchorageSettings.FLOATING_NODE_DROPSHADOW_RADIUS;\r\nimport com.anchorage.docks.node.ui.DockUIPanel;\r\nimport javafx.scene.layout.StackPane;\r\n\r\nimport com.anchorage.docks.containers.interfaces.DockContainableComponent;\r\nimport com.anchorage.docks.containers.interfaces.DockContainer;\r\nimport com.anchorage.docks.containers.subcontainers.DockTabberContainer;\r\nimport com.anchorage.docks.node.interfaces.DockNodeCloseRequestHandler;\r\nimport com.anchorage.docks.node.interfaces.DockNodeCreationListener;\r\nimport com.anchorage.docks.stations.DockStation;\r\nimport com.anchorage.docks.stations.DockSubStation;\r\nimport com.anchorage.system.AnchorageSystem;\r\nimport java.util.Objects;\r\nimport javafx.beans.property.BooleanProperty;\r\nimport javafx.beans.property.ObjectProperty;\r\nimport javafx.beans.property.ReadOnlyBooleanProperty;\r\nimport javafx.beans.property.ReadOnlyBooleanWrapper;\r\nimport javafx.beans.property.ReadOnlyObjectProperty;\r\nimport javafx.beans.property.ReadOnlyObjectWrapper;\r\nimport javafx.beans.property.SimpleBooleanProperty;\r\nimport javafx.beans.property.SimpleObjectProperty;\r\nimport javafx.collections.ObservableList;\r\nimport javafx.geometry.Bounds;\r\nimport javafx.geometry.Point2D;\r\nimport javafx.geometry.Rectangle2D;\r\nimport javafx.scene.image.Image;\r\nimport javafx.scene.layout.Pane;\r\nimport javafx.stage.Screen;\r\nimport javafx.stage.Window;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic class DockNode extends StackPane implements DockContainableComponent {\r\n\r\n    public enum DockPosition {\r\n\r\n        LEFT,\r\n        RIGHT,\r\n        TOP,\r\n        BOTTOM,\r\n        CENTER\r\n    }\r\n\r\n    private DockUIPanel content;\r\n\r\n    private BooleanProperty floatableProperty;\r\n    private BooleanProperty closeableProperty;\r\n    private BooleanProperty resizableProperty;\r\n    private BooleanProperty maximizableProperty;\r\n\r\n    private ObjectProperty<DockStation> station;\r\n    private ReadOnlyBooleanWrapper floatingProperty;\r\n    private ReadOnlyBooleanWrapper draggingProperty;\r\n    private ReadOnlyBooleanWrapper resizingProperty;\r\n    private ReadOnlyBooleanWrapper maximizingProperty;\r\n\r\n    private ReadOnlyObjectWrapper<DockContainer> container;\r\n\r\n    private StageFloatable stageFloatable;\r\n\r\n    private double floatingStateCoordinateX;\r\n    private double floatingStateCoordinateY;\r\n    private double floatingStateWidth;\r\n    private double floatingStateHeight;\r\n\r\n    private DockNodeCloseRequestHandler closeRequestHanlder;\r\n\r\n    private DockNode() {\r\n\r\n        station = new SimpleObjectProperty<>(null);\r\n\r\n        floatableProperty = new SimpleBooleanProperty(true);\r\n        closeableProperty = new SimpleBooleanProperty(true);\r\n        resizableProperty = new SimpleBooleanProperty(true);\r\n        maximizableProperty = new SimpleBooleanProperty(true);\r\n\r\n        floatingProperty = new ReadOnlyBooleanWrapper(false);\r\n        draggingProperty = new ReadOnlyBooleanWrapper(false);\r\n        resizingProperty = new ReadOnlyBooleanWrapper(false);\r\n        maximizingProperty = new ReadOnlyBooleanWrapper(false);\r\n\r\n        container = new ReadOnlyObjectWrapper<>(null);\r\n\r\n    }\r\n\r\n    public DockNode(DockUIPanel node) {\r\n\r\n        this();\r\n\r\n        this.content = node;\r\n\r\n        buildUI(node);\r\n\r\n        callCreationCallBack();\r\n    }\r\n\r\n    private void callCreationCallBack() {\r\n        if (content.getNodeContent() instanceof DockNodeCreationListener) {\r\n            ((DockNodeCreationListener) content.getNodeContent()).onDockNodeCreated(this);\r\n        }\r\n    }\r\n\r\n    public void ensureVisibility() {\r\n        if (container.get() instanceof DockTabberContainer) {\r\n            ((DockTabberContainer) container.get()).ensureVisibility(this);\r\n        }\r\n    }\r\n\r\n    public void setCloseRequestHandler(DockNodeCloseRequestHandler handler) {\r\n        Objects.requireNonNull(handler);\r\n        closeRequestHanlder = handler;\r\n    }\r\n\r\n    public DockNodeCloseRequestHandler getCloseRequestHandler() {\r\n        return closeRequestHanlder;\r\n    }\r\n\r\n    public BooleanProperty floatableProperty() {\r\n        return floatableProperty;\r\n    }\r\n\r\n    public BooleanProperty closeableProperty() {\r\n        return closeableProperty;\r\n    }\r\n\r\n    public BooleanProperty resizableProperty() {\r\n        return resizableProperty;\r\n    }\r\n\r\n    public BooleanProperty maximizableProperty() {\r\n        return maximizableProperty;\r\n    }\r\n\r\n    public ReadOnlyBooleanProperty floatingProperty() {\r\n        return floatingProperty.getReadOnlyProperty();\r\n    }\r\n\r\n    public ReadOnlyBooleanProperty draggingProperty() {\r\n        return draggingProperty.getReadOnlyProperty();\r\n    }\r\n\r\n    public ReadOnlyBooleanProperty maximizingProperty() {\r\n        return maximizingProperty.getReadOnlyProperty();\r\n    }\r\n\r\n    public ReadOnlyObjectProperty<DockContainer> containerProperty() {\r\n        return container.getReadOnlyProperty();\r\n    }\r\n\r\n    public void setIcon(Image icon) {\r\n        content.setIcon(icon);\r\n    }\r\n\r\n    public void restore() {\r\n        if (draggingProperty.get()) {\r\n            closeFloatingStage();\r\n        }\r\n        disableDragging();\r\n    }\r\n\r\n    public boolean isDockVisible() {\r\n        if (containerProperty().get() == null || floatingProperty.get()) {\r\n            return true;\r\n        } else {\r\n            return container.get().isDockVisible(this);\r\n        }\r\n    }\r\n\r\n    public void closeFloatingStage() {\r\n\r\n        if (stageFloatable != null) {\r\n            stageFloatable.closeStage();\r\n            stageFloatable = null;\r\n        }\r\n\r\n        floatingProperty.set(false);\r\n    }\r\n\r\n    public StageFloatable getFloatableStage() {\r\n        return stageFloatable;\r\n    }\r\n\r\n    private void buildUI(DockUIPanel panel) {\r\n        getChildren().add(panel);\r\n        panel.setDockNode(this);\r\n    }\r\n\r\n    public void moveFloatable(double x, double y) {\r\n        if (!maximizingProperty.get()) {\r\n            stageFloatable.move(x, y);\r\n        }\r\n    }\r\n\r\n    public void makeGhostFloatable(Window owner, double x, double y) {\r\n\r\n        if (!floatingProperty.get()) {\r\n\r\n            stageFloatable = new StageFloatable(this, owner, x, y);\r\n            stageFloatable.show();\r\n\r\n            makeTransparent();\r\n        }\r\n\r\n    }\r\n\r\n    public void enableDraggingOnPosition(double x, double y) {\r\n        draggingProperty.set(true);\r\n\r\n        makeGhostFloatable(station.get().getScene().getWindow(), x, y);\r\n\r\n        if (!maximizingProperty().get()) {\r\n            AnchorageSystem.prepareDraggingZoneFor(station.get(), this);\r\n        }\r\n    }\r\n\r\n    public void disableDragging() {\r\n        draggingProperty.set(false);\r\n        makeOpaque();\r\n    }\r\n\r\n    private void makeTransparent() {\r\n        content.setOpacity(0.4);\r\n    }\r\n\r\n    private void makeOpaque() {\r\n        content.setOpacity(1);\r\n    }\r\n\r\n    public void makeNodeActiveOnFloatableStage(Window owner, double x, double y) {\r\n\r\n        disableDragging();\r\n\r\n        if (!floatingProperty.get()) {\r\n\r\n            if (floatableProperty.get()) {\r\n                if (stageFloatable == null) {\r\n                    makeGhostFloatable(owner, x, y);\r\n                }\r\n                stageFloatable.makeNodeActiveOnFloatableStage();\r\n\r\n                floatingProperty.set(true);\r\n\r\n            } else {\r\n                closeFloatingStage();\r\n            }\r\n        }\r\n\r\n    }\r\n\r\n    /**\r\n     * Get the value of station\r\n     *\r\n     * @return the value of station\r\n     */\r\n    public ObjectProperty<DockStation> stationProperty() {\r\n        return station;\r\n    }\r\n\r\n    @Override\r\n    public void setParentContainer(DockContainer container) {\r\n        this.container.set(container);\r\n    }\r\n\r\n    @Override\r\n    public DockContainer getParentContainer() {\r\n        return container.get();\r\n    }\r\n\r\n    public void dockAsFloating(Window owner, DockStation station, double x, double y, double width, double height) {\r\n\r\n        if (stationProperty().get() != null) {\r\n            ensureVisibility();\r\n            return;\r\n        }\r\n\r\n        station.add(this);\r\n        stageFloatable = new StageFloatable(this, owner, x, y);\r\n        stageFloatable.show();\r\n        stageFloatable.setWidth(width);\r\n        stageFloatable.setHeight(height);\r\n        floatingProperty.set(true);\r\n        this.station.set((DockStation) station);\r\n    }\r\n\r\n    public void dock(DockStation station, DockPosition position) {\r\n\r\n        if (stationProperty().get() != null) {\r\n            ensureVisibility();\r\n            return;\r\n        }\r\n\r\n        station.add(this);\r\n        station.putDock(this, position, 0.5);\r\n        this.station.set((DockStation) station);\r\n    }\r\n\r\n    public void dock(DockNode nodeTarget, DockPosition position) {\r\n\r\n        if (stationProperty().get() != null) {\r\n            ensureVisibility();\r\n            return;\r\n        }\r\n\r\n        nodeTarget.stationProperty().get().add(this);\r\n        nodeTarget.getParentContainer().putDock(this, nodeTarget, position, 0.5);\r\n        station.set(nodeTarget.station.get());\r\n    }\r\n\r\n    public void dock(DockStation station, DockPosition position, double percentage) {\r\n\r\n        if (stationProperty().get() != null) {\r\n            ensureVisibility();\r\n            return;\r\n        }\r\n        station.add(this);\r\n        station.putDock(this, position, percentage);\r\n        this.station.set((DockStation) station);\r\n    }\r\n\r\n    public void dock(DockNode nodeTarget, DockPosition position, double percentage) {\r\n\r\n        if (stationProperty().get() != null) {\r\n            ensureVisibility();\r\n            return;\r\n        }\r\n\r\n        nodeTarget.stationProperty().get().add(this);\r\n        nodeTarget.getParentContainer().putDock(this, nodeTarget, position, percentage);\r\n        station.set(nodeTarget.station.get());\r\n    }\r\n\r\n    public void dock(DockSubStation subStation, DockPosition position) {\r\n\r\n        if (stationProperty().get() != null) {\r\n            ensureVisibility();\r\n            return;\r\n        }\r\n\r\n        subStation.putDock(this, position, 0.5);\r\n    }\r\n\r\n    public void dock(DockSubStation subStation, DockPosition position, double percentage) {\r\n\r\n        if (stationProperty().get() != null) {\r\n            ensureVisibility();\r\n            return;\r\n        }\r\n\r\n        subStation.putDock(this, position, percentage);\r\n    }\r\n\r\n    public void undock() {\r\n\r\n        if (stationProperty().get() == null) {\r\n            return;\r\n        }\r\n\r\n        boolean isFloating = floatingProperty.get();\r\n\r\n        restore();\r\n\r\n        if (getParentContainer() != null) {\r\n            getParentContainer().undock(this);\r\n            station.get().remove(this);\r\n        } else if (isFloating) {\r\n            station.get().remove(this);\r\n            station.set(null);\r\n        }\r\n    }\r\n\r\n    public DockUIPanel getContent() {\r\n        return content;\r\n    }\r\n\r\n    @Override\r\n    public String toString() {\r\n        return content.titleProperty().get();\r\n    }\r\n\r\n    public Bounds getSceneBounds() {\r\n        return localToScene(getBoundsInLocal());\r\n    }\r\n\r\n    public Bounds getScreenBounds() {\r\n        return localToScreen(getBoundsInLocal());\r\n    }\r\n\r\n    public boolean checkForTarget(double x, double y) {\r\n\r\n        Point2D screenToScenePoint = getScene().getRoot().screenToLocal(x, y);\r\n        Bounds sceneBounds = getSceneBounds();\r\n        return sceneBounds.contains(screenToScenePoint.getX(), screenToScenePoint.getY());\r\n\r\n    }\r\n\r\n    public boolean insideTabContainer() {\r\n        return container.get() instanceof DockTabberContainer;\r\n    }\r\n\r\n    public void maximizeOrRestore() {\r\n\r\n        if (maximizingProperty.get()) {\r\n            restoreLayout();\r\n        } else {\r\n            maximizeLayout();\r\n        }\r\n\r\n    }\r\n\r\n    public void restoreLayout() {\r\n        if (maximizableProperty.get()) {\r\n            if (floatingProperty.get()) {\r\n                stageFloatable.setX(floatingStateCoordinateX);\r\n                stageFloatable.setY(floatingStateCoordinateY);\r\n                stageFloatable.setWidth(floatingStateWidth);\r\n                stageFloatable.setHeight(floatingStateHeight);\r\n                maximizingProperty.set(false);\r\n            } else if (station.get().restore(this)) {\r\n                maximizingProperty.set(false);\r\n            }\r\n\r\n        }\r\n    }\r\n\r\n    private void moveStateToFullScreen() {\r\n        // Get current screen of the stage      \r\n        ObservableList<Screen> screens = Screen.getScreensForRectangle(new Rectangle2D(stageFloatable.getX(), stageFloatable.getY(), stageFloatable.getWidth(), stageFloatable.getHeight()));\r\n\r\n        // Change stage properties\r\n        Rectangle2D bounds = screens.get(0).getBounds();\r\n        stageFloatable.setX(bounds.getMinX() - FLOATING_NODE_DROPSHADOW_RADIUS);\r\n        stageFloatable.setY(bounds.getMinY() - FLOATING_NODE_DROPSHADOW_RADIUS);\r\n        stageFloatable.setWidth(bounds.getWidth() + FLOATING_NODE_DROPSHADOW_RADIUS * 2);\r\n        stageFloatable.setHeight(bounds.getHeight() + FLOATING_NODE_DROPSHADOW_RADIUS * 2);\r\n    }\r\n\r\n    public void maximizeLayout() {\r\n        if (maximizableProperty.get()) {\r\n            if (floatingProperty.get()) {\r\n                floatingStateCoordinateX = stageFloatable.getX();\r\n                floatingStateCoordinateY = stageFloatable.getY();\r\n                floatingStateWidth = stageFloatable.getWidth();\r\n                floatingStateHeight = stageFloatable.getHeight();\r\n                moveStateToFullScreen();\r\n\r\n                maximizingProperty.set(true);\r\n            } else if (station.get().maximize(this)) {\r\n                maximizingProperty.set(true);\r\n            }\r\n\r\n        }\r\n\r\n    }\r\n \r\n    public boolean isMenuButtonEnable() {\r\n        return content.isMenuButtonEnable();\r\n    }\r\n \r\n \r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/node/interfaces/DockNodeCloseRequestHandler.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\npackage com.anchorage.docks.node.interfaces;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\n\r\n@FunctionalInterface\r\npublic interface DockNodeCloseRequestHandler {\r\n    \r\n    public boolean canClose();\r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/node/interfaces/DockNodeCreationListener.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\npackage com.anchorage.docks.node.interfaces;\r\n\r\nimport com.anchorage.docks.node.DockNode;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic interface DockNodeCreationListener {\r\n    public void onDockNodeCreated(DockNode node);\r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/node/ui/DockCommandsBox.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n\r\npackage com.anchorage.docks.node.ui;\r\n\r\nimport com.anchorage.docks.containers.SingleDockContainer;\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.stations.DockSubStation;\r\nimport javafx.animation.RotateTransition;\r\nimport javafx.geometry.Point2D;\r\nimport javafx.scene.control.Button;\r\nimport javafx.scene.image.Image;\r\nimport javafx.scene.image.ImageView;\r\nimport javafx.scene.layout.HBox;\r\nimport javafx.scene.layout.Pane;\r\nimport javafx.util.Duration;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic class DockCommandsBox extends HBox {\r\n\r\n    private Button closeButton;\r\n    private Button maximizeRestoreButton;\r\n\r\n    private Runnable openAction = null;\r\n    private Runnable hideAction = null;\r\n    private Pane externalContent;\r\n\r\n    private final DockNode node;\r\n    private Button menuButton;\r\n    private boolean isMenuOpen;\r\n\r\n    public DockCommandsBox(DockNode node) {\r\n        this.node = node;\r\n        buildUI();\r\n        setSpacing(0);\r\n        setStyle(\"-fx-background-color:transparent;\");\r\n    }\r\n\r\n    private void changeCommandsState() {\r\n\r\n        if (node instanceof DockSubStation || !node.closeableProperty().get()) {\r\n            closeButton.setMouseTransparent(true);\r\n            closeButton.setOpacity(0.4);\r\n        } else {\r\n            closeButton.setMouseTransparent(false);\r\n            closeButton.setOpacity(1);\r\n        }\r\n\r\n        if (node.getParentContainer() instanceof SingleDockContainer) {\r\n            if (node.maximizableProperty().get()) {\r\n                maximizeRestoreButton.setMouseTransparent(true);\r\n                maximizeRestoreButton.setOpacity(0.4);\r\n            }\r\n\r\n        } else if (node.maximizableProperty().get()) {\r\n            maximizeRestoreButton.setMouseTransparent(false);\r\n            maximizeRestoreButton.setOpacity(1);\r\n        }\r\n    }\r\n\r\n    private void changeStateForFloatingState() {\r\n        if (node.maximizableProperty().get() && node.floatingProperty().get()) {\r\n            maximizeRestoreButton.setMouseTransparent(false);\r\n            maximizeRestoreButton.setOpacity(1);\r\n        } else {\r\n            maximizeRestoreButton.setMouseTransparent(true);\r\n            maximizeRestoreButton.setOpacity(0.4);\r\n        }\r\n\r\n    }\r\n\r\n    private void createCloseButton() {\r\n        Image closeImage = new Image(\"close.png\");\r\n\r\n        closeButton = new Button() {\r\n            @Override\r\n            public void requestFocus() {\r\n            }\r\n        };\r\n\r\n        closeButton.setGraphic(new ImageView(closeImage));\r\n        closeButton.getStyleClass().add(\"docknode-command-button-close\");\r\n\r\n        closeButton.setOnAction(e -> {\r\n\r\n            if (node.getCloseRequestHandler() != null) {\r\n                if (node.getCloseRequestHandler().canClose()) {\r\n                    node.undock();\r\n                }\r\n            }\r\n            else {\r\n                node.undock();\r\n            }\r\n\r\n        });\r\n        \r\n        node.closeableProperty().addListener((observer, oldValue, newValue) -> changeCommandsState());\r\n        node.containerProperty().addListener((observer, oldValue, newValue) -> changeCommandsState());\r\n        node.floatingProperty().addListener((observer, oldValue, newValue) -> changeStateForFloatingState());\r\n        getChildren().add(closeButton);\r\n    }\r\n\r\n    private void createMaxRestoreButton() {\r\n\r\n        Image maximizeImage = new Image(\"maximize.png\");\r\n        Image restoreImage = new Image(\"restore.png\");\r\n\r\n        maximizeRestoreButton = new Button() {\r\n            @Override\r\n            public void requestFocus() {\r\n            }\r\n        };\r\n\r\n        maximizeRestoreButton.setGraphic(new ImageView(maximizeImage));\r\n        maximizeRestoreButton.getStyleClass().add(\"docknode-command-button\");\r\n\r\n        node.maximizingProperty().addListener((observer, oldValue, newValue) -> {\r\n\r\n            if (newValue) {\r\n                maximizeRestoreButton.setGraphic(new ImageView(restoreImage));\r\n            } else {\r\n                maximizeRestoreButton.setGraphic(new ImageView(maximizeImage));\r\n            }\r\n        });\r\n\r\n        maximizeRestoreButton.setOnAction(e -> node.maximizeOrRestore());\r\n\r\n        getChildren().add(maximizeRestoreButton);\r\n\r\n        node.maximizableProperty().addListener((observer, oldValue, newValue) -> {\r\n\r\n            if (newValue) {\r\n                maximizeRestoreButton.setMouseTransparent(false);\r\n                maximizeRestoreButton.setOpacity(1);\r\n            } else {\r\n                maximizeRestoreButton.setMouseTransparent(true);\r\n                maximizeRestoreButton.setOpacity(0.4);\r\n            }\r\n        });\r\n    }\r\n\r\n    private void buildUI() {\r\n       \r\n        createMaxRestoreButton();\r\n        createCloseButton();\r\n    }\r\n \r\n    void enableMenuButton(boolean enable) {\r\n        menuButton.setVisible(enable);\r\n    }\r\n\r\n    boolean isMenuButtonEnable() {\r\n        return menuButton.isVisible();\r\n    }\r\n \r\n    private void showContent(Point2D localToScreen) {\r\n        Popover popover = new Popover(this, externalContent);\r\n        popover.show(localToScreen.getX(), localToScreen.getY());\r\n    }\r\n\r\n    void notifyCloseAction() {\r\n        if (isMenuOpen) {\r\n            isMenuOpen = false;\r\n\r\n            RotateTransition rotate = new RotateTransition(Duration.seconds(0.2), menuButton.getGraphic());\r\n            rotate.setToAngle(0);\r\n            rotate.play();\r\n\r\n            hideAction.run();\r\n        }\r\n    }\r\n\r\n    void notifyOpenAction() {\r\n        RotateTransition rotate = new RotateTransition(Duration.seconds(0.2), menuButton.getGraphic());\r\n        rotate.setToAngle(90);\r\n        rotate.play();\r\n\r\n        openAction.run();\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/node/ui/DockUIPanel.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\npackage com.anchorage.docks.node.ui;\r\n\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.system.AnchorageSystem;\r\nimport java.util.Objects;\r\nimport javafx.beans.property.StringProperty;\r\nimport javafx.geometry.Bounds;\r\nimport javafx.geometry.Point2D;\r\nimport javafx.scene.CacheHint;\r\nimport javafx.scene.Node;\r\nimport javafx.scene.control.Label;\r\nimport javafx.scene.image.Image;\r\nimport javafx.scene.image.ImageView;\r\nimport javafx.scene.input.MouseButton;\r\nimport javafx.scene.input.MouseEvent;\r\nimport javafx.scene.layout.Pane;\r\nimport javafx.scene.layout.StackPane;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic final class DockUIPanel extends Pane {\r\n\r\n    public static final double BAR_HEIGHT = 25;\r\n\r\n    private Node nodeContent;\r\n    private Label titleLabel;\r\n\r\n    private Pane barPanel;\r\n    private StackPane contentPanel;\r\n\r\n    private DockCommandsBox commandsBox;\r\n\r\n    private DockNode node;\r\n\r\n    private Point2D deltaDragging;\r\n\r\n    private boolean subStationStype;\r\n    \r\n    private ImageView iconView;\r\n\r\n    private DockUIPanel() {\r\n\r\n    }\r\n\r\n    public DockUIPanel(String title, Node nodeContent, boolean subStationStype, Image imageIcon) {\r\n\r\n        getStylesheets().add(\"anchorfx.css\");\r\n        \r\n        this.subStationStype = subStationStype;\r\n\r\n        Objects.requireNonNull(nodeContent);\r\n        Objects.requireNonNull(title);\r\n\r\n        this.nodeContent = nodeContent;\r\n\r\n        buildNode(title,imageIcon);\r\n\r\n        installDragEventMananger();\r\n\r\n    }\r\n    \r\n    public void setIcon(Image icon)\r\n    {\r\n        Objects.requireNonNull(icon);\r\n        iconView.setImage(icon);\r\n    }\r\n\r\n    private void makeCommands() {\r\n        commandsBox = new DockCommandsBox(node);\r\n        barPanel.getChildren().add(commandsBox);\r\n\r\n        commandsBox.layoutXProperty().bind(barPanel.prefWidthProperty().subtract(commandsBox.getChildren().size() * 30 + 10));\r\n        commandsBox.setLayoutY(0);\r\n\r\n        titleLabel.prefWidthProperty().bind(commandsBox.layoutXProperty().subtract(10));\r\n    }\r\n\r\n    public void setDockNode(DockNode node) {\r\n        this.node = node;\r\n        makeCommands();\r\n    }\r\n\r\n    public StringProperty titleProperty() {\r\n        return titleLabel.textProperty();\r\n    }\r\n\r\n    private void installDragEventMananger() {\r\n        \r\n        barPanel.setOnMouseClicked(event -> {\r\n            if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2) {\r\n                 node.maximizeOrRestore();\r\n            }\r\n        });\r\n\r\n        barPanel.setOnMouseDragged(event -> {\r\n            if (event.getButton() == MouseButton.PRIMARY) {\r\n                manageDragEvent(event);\r\n            }\r\n        });\r\n        barPanel.setOnMouseReleased(event -> {\r\n            if (event.getButton() == MouseButton.PRIMARY) {\r\n                manageReleaseEvent();\r\n            }\r\n        });\r\n    }\r\n\r\n    private void manageDragEvent(MouseEvent event) {\r\n        if (!node.draggingProperty().get()) {\r\n\r\n            if (!node.maximizingProperty().get()) {\r\n                Bounds bounds = node.localToScreen(barPanel.getBoundsInLocal());\r\n\r\n                deltaDragging = new Point2D(event.getScreenX() - bounds.getMinX(),\r\n                                            event.getScreenY() - bounds.getMinY());\r\n\r\n                node.enableDraggingOnPosition(event.getScreenX() - deltaDragging.getX(), event.getScreenY() - deltaDragging.getY());\r\n            }\r\n\r\n        }\r\n        else {\r\n            if (node.getFloatableStage() != null && !node.getFloatableStage().inResizing() && node.draggingProperty().get()) {\r\n\r\n                if (!node.maximizingProperty().get()) {\r\n                    node.moveFloatable(event.getScreenX() - deltaDragging.getX(),\r\n                                       event.getScreenY() - deltaDragging.getY());\r\n\r\n                    //node.stationProperty().get().searchTargetNode(event.getScreenX(), event.getScreenY());\r\n                    AnchorageSystem.searchTargetNode(event.getScreenX(), event.getScreenY());\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    private void manageReleaseEvent() {\r\n        if (node.draggingProperty().get() && !node.maximizingProperty().get()) {\r\n            AnchorageSystem.finalizeDragging();\r\n        }\r\n    }\r\n\r\n    private void buildNode(String title, Image iconImage) {\r\n\r\n        Objects.requireNonNull(iconImage);\r\n        Objects.requireNonNull(title);\r\n        \r\n        barPanel = new Pane();\r\n\r\n        String titleBarStyle = (!subStationStype) ? \"docknode-title-bar\" : \"substation-title-bar\";\r\n\r\n        barPanel.getStyleClass().add(titleBarStyle);\r\n\r\n        barPanel.setPrefHeight(BAR_HEIGHT);\r\n        barPanel.relocate(0, 0);\r\n        barPanel.prefWidthProperty().bind(widthProperty());\r\n\r\n        titleLabel = new Label(title);\r\n\r\n        String titleTextStyle = (!subStationStype) ? \"docknode-title-text\" : \"substation-title-text\";\r\n        \r\n        iconView = new ImageView(iconImage);\r\n        iconView.setFitWidth(15);\r\n        iconView.setFitHeight(15);\r\n        iconView.setPreserveRatio(false);\r\n        iconView.setSmooth(true);\r\n        iconView.relocate(1,(BAR_HEIGHT-iconView.getFitHeight()) / 2);\r\n         \r\n        titleLabel.getStyleClass().add(titleTextStyle);\r\n        barPanel.getChildren().addAll(iconView,titleLabel);\r\n        titleLabel.relocate(25, 5);\r\n\r\n        contentPanel = new StackPane();\r\n        contentPanel.getStyleClass().add(\"docknode-content-panel\");\r\n        contentPanel.relocate(0, BAR_HEIGHT);\r\n        contentPanel.prefWidthProperty().bind(widthProperty());\r\n        contentPanel.prefHeightProperty().bind(heightProperty().subtract(BAR_HEIGHT));\r\n        contentPanel.getChildren().add(nodeContent);\r\n        \r\n        contentPanel.setCache(true);\r\n        contentPanel.setCacheHint(CacheHint.SPEED);\r\n        \r\n        if (nodeContent instanceof Pane)\r\n        {\r\n            Pane nodeContentPane = (Pane)nodeContent;\r\n            nodeContentPane.setMinHeight(USE_COMPUTED_SIZE);\r\n            nodeContentPane.setMinWidth(USE_COMPUTED_SIZE);\r\n            nodeContentPane.setMaxWidth(USE_COMPUTED_SIZE);\r\n            nodeContentPane.setMaxHeight(USE_COMPUTED_SIZE);\r\n        }\r\n\r\n        getChildren().addAll(barPanel, contentPanel);\r\n    }\r\n\r\n    public StackPane getContentContainer()\r\n    {\r\n        return contentPanel;\r\n    }\r\n    /**\r\n     * Get the value of nodeContent\r\n     *\r\n     * @return the value of nodeContent\r\n     */\r\n    public Node getNodeContent() {\r\n        return nodeContent;\r\n    }\r\n \r\n    public boolean isMenuButtonEnable(){\r\n        return commandsBox.isMenuButtonEnable();\r\n    }\r\n \r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/node/ui/Popover.java",
    "content": "/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\npackage com.anchorage.docks.node.ui;\r\n\r\nimport javafx.animation.FadeTransition;\r\nimport javafx.beans.value.ChangeListener;\r\nimport javafx.event.EventHandler;\r\nimport javafx.scene.Scene;\r\nimport javafx.scene.input.MouseEvent;\r\nimport javafx.scene.layout.Pane;\r\nimport javafx.scene.layout.Region;\r\nimport javafx.scene.paint.Color;\r\nimport javafx.stage.Stage;\r\nimport javafx.stage.StageStyle;\r\nimport javafx.util.Duration;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic class Popover extends Stage {\r\n\r\n    private final Pane content;\r\n    private final Scene scene;\r\n    private DockCommandsBox commandBox;\r\n\r\n    private ChangeListener<Number> positionListener;\r\n    private EventHandler<MouseEvent> eventFilter;\r\n\r\n    public Popover(DockCommandsBox commandBox, Pane content) {\r\n\r\n        this.content = content;\r\n        this.commandBox = commandBox;\r\n        scene = new Scene(content, Color.TRANSPARENT);\r\n        setScene(scene);\r\n\r\n        initStyle(StageStyle.TRANSPARENT);\r\n        initOwner(commandBox.getScene().getWindow());\r\n\r\n        positionListener = (obs, oldvalue, newvalue) -> hideAndNotify();\r\n        eventFilter = evt -> hideAndNotify();\r\n\r\n        setOnShown(e -> {\r\n\r\n            Stage ownerStage = (Stage) commandBox.getScene().getWindow();\r\n\r\n            commandBox.getScene().addEventFilter(MouseEvent.MOUSE_PRESSED, eventFilter);\r\n            ownerStage.xProperty().addListener(positionListener);\r\n            ownerStage.yProperty().addListener(positionListener);\r\n\r\n            content.setOpacity(0);\r\n            FadeTransition fade = new FadeTransition(Duration.seconds(0.2), content);\r\n            fade.setToValue(1);\r\n            fade.play();\r\n\r\n        });\r\n    }\r\n\r\n    public void show(double x, double y) {\r\n        commandBox.notifyOpenAction();\r\n\r\n        setX(x);\r\n        setY(y);\r\n        show();\r\n    }\r\n\r\n    public void hideAndNotify() {\r\n        Stage ownerStage = (Stage) commandBox.getScene().getWindow();\r\n\r\n        ownerStage.xProperty().removeListener(positionListener);\r\n        ownerStage.yProperty().removeListener(positionListener);\r\n        commandBox.getScene().removeEventFilter(MouseEvent.MOUSE_PRESSED, eventFilter);\r\n\r\n        System.out.println(\"hideAndNotify\");\r\n\r\n        hide();\r\n\r\n        scene.setRoot(new Region()); // elimina il content dalla scena\r\n\r\n        commandBox.notifyCloseAction();\r\n    }\r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/stations/DockStation.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\npackage com.anchorage.docks.stations;\r\n\r\nimport com.anchorage.docks.containers.SingleDockContainer;\r\nimport com.anchorage.docks.containers.subcontainers.DockTabberContainer;\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.containers.zones.DockZones;\r\nimport com.anchorage.docks.containers.zones.ZoneSelector;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\nimport java.util.Optional;\r\nimport javafx.scene.Node;\r\nimport javafx.scene.Parent;\r\nimport javafx.scene.Scene;\r\nimport javafx.scene.layout.Pane;\r\nimport javafx.scene.shape.Rectangle;\r\nimport javafx.stage.Window;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic final class DockStation extends SingleDockContainer {\r\n\r\n    private final List<DockNode> nodes;\r\n    private DockZones dockZones;\r\n    private DockNode currentNodeTarget;\r\n\r\n    private Node currentNodeBeforeMaximization;\r\n    private DockNode currentNodeMaximized;\r\n    private Parent currentNodeMaximizedParent;\r\n    private boolean substation;\r\n\r\n    private DockSubStation dockNodeForSubstation;\r\n\r\n    private boolean commonStation;\r\n\r\n    private boolean selected = false;\r\n\r\n    /**\r\n     * Get the value of selected\r\n     *\r\n     * @return the value of selected\r\n     */\r\n    public boolean isSelected() {\r\n        return selected;\r\n    }\r\n\r\n    public DockStation() {\r\n        nodes = new ArrayList<>();\r\n        substation = false;\r\n        buildUI();\r\n    }\r\n\r\n    public DockStation(boolean commonStation) {\r\n        this();\r\n        this.commonStation = commonStation;\r\n    }\r\n\r\n    public boolean isCommonStation() {\r\n        return commonStation;\r\n    }\r\n\r\n    private void buildUI() {\r\n        getStyleClass().add(\"station\");\r\n    }\r\n\r\n    public Window getStationWindow() {\r\n        return getStationScene().getWindow();\r\n    }\r\n\r\n    public Scene getStationScene() {\r\n        return getScene();\r\n    }\r\n\r\n    public boolean isInnerPosition(double x, double y) {\r\n\r\n        Window window = getStationWindow();\r\n        Rectangle bounds = new Rectangle(window.getX(), window.getY(), window.getWidth(), window.getHeight());\r\n        return bounds.contains(x, y);\r\n    }\r\n\r\n    public void prepareZones(DockNode nodeToMove) {\r\n\r\n        if (currentNodeMaximized == null) {\r\n            dockZones = new DockZones(this, nodeToMove);\r\n            dockZones.showZones();\r\n        }\r\n\r\n    }\r\n\r\n    public boolean isSubStation() {\r\n        return substation;\r\n    }\r\n\r\n    public void add(DockNode node) {\r\n        if (!nodes.contains(node)) {\r\n            nodes.add(node);\r\n        }\r\n    }\r\n\r\n    public void remove(DockNode node) {\r\n        if (nodes.contains(node)) {\r\n            nodes.remove(node);\r\n            node.stationProperty().set(null);\r\n        }\r\n    }\r\n\r\n    public void searchTargetNode(double x, double y) {\r\n\r\n        selected = false;\r\n        \r\n        if (currentNodeMaximized != null) {\r\n            return;\r\n        }\r\n\r\n        Optional<DockNode> nodeTarget = nodes.stream()\r\n                .filter(node\r\n                        -> !node.floatingProperty().get()\r\n                        && node.checkForTarget(x, y)\r\n                        && node.isDockVisible()).findFirst();\r\n\r\n        nodeTarget.map(node -> (Runnable) () -> {\r\n\r\n            currentNodeTarget = node;\r\n            dockZones.moveAt(node);\r\n\r\n        }).orElse((Runnable) () -> {\r\n\r\n            if (currentNodeTarget != null) {\r\n                dockZones.hideCircleZones();\r\n\r\n            }\r\n\r\n        }).run();\r\n\r\n        selected = dockZones.searchArea(x, y);\r\n    }\r\n\r\n    public void addOverlay(Node node) {\r\n        getChildren().add(node);\r\n    }\r\n\r\n    public void removeOverlay(Node node) {\r\n        getChildren().remove(node);\r\n    }\r\n\r\n    public void hideZones() {\r\n        dockZones.close();\r\n    }\r\n\r\n    private void manageDragOnSameNode() {\r\n\r\n        DockTabberContainer tabContainer = (DockTabberContainer) dockZones.getCurrentNodeTarget().getParentContainer();\r\n        tabContainer.manageDragOnSameNode(dockZones.getCurrentNodeTarget(), dockZones.getCurrentPosition());\r\n    }\r\n\r\n    public void finalizeDrag() {\r\n\r\n        if (currentNodeMaximized != null) {\r\n            return;\r\n        }\r\n\r\n        ZoneSelector selector = dockZones.getCurrentZoneSelector();\r\n\r\n        if (selector == null) {\r\n            dockZones.getNodeSource().makeNodeActiveOnFloatableStage(getScene().getWindow(), getScene().getX(), getScene().getY());\r\n        }\r\n        else {\r\n            DockNode.DockPosition position = selector.getPosition();\r\n            if (selector.isStationZone()) {\r\n                dockZones.getNodeSource().undock();\r\n                dockZones.getNodeSource().dock(this, position);\r\n            }\r\n            else {\r\n                manageDockDestination();\r\n            }\r\n        }\r\n \r\n    }\r\n\r\n    public void closeZones()\r\n    {\r\n       dockZones.close();\r\n    }\r\n    \r\n    private void manageDockDestination() {\r\n\r\n        if (dockZones.getCurrentNodeTarget() == dockZones.getNodeSource()) {\r\n            if (dockZones.getCurrentNodeTarget().getParentContainer() instanceof DockTabberContainer\r\n                    && dockZones.getCurrentPosition() != DockNode.DockPosition.CENTER) {\r\n                manageDragOnSameNode();\r\n            }\r\n            else {\r\n                dockZones.getNodeSource().restore();\r\n            }\r\n        }\r\n        else {\r\n            dockZones.getNodeSource().undock();\r\n            dockZones.getNodeSource().dock(dockZones.getCurrentNodeTarget(), dockZones.getCurrentPosition());\r\n        }\r\n    }\r\n\r\n    public boolean maximize(DockNode node) {\r\n\r\n        if (!node.maximizingProperty().get() && getChildren().get(0) != node) {\r\n            currentNodeBeforeMaximization = getChildren().get(0);\r\n\r\n            getChildren().remove(0);\r\n\r\n            currentNodeMaximizedParent = node.getParent();\r\n\r\n            getChildren().add(node);\r\n\r\n            currentNodeMaximized = node;\r\n\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n\r\n    public boolean restore(DockNode node) {\r\n        if (currentNodeMaximized != null && currentNodeMaximized == node) {\r\n            Pane panelParent = (Pane) currentNodeMaximizedParent;\r\n            panelParent.getChildren().add(currentNodeMaximized);\r\n\r\n            getChildren().add(currentNodeBeforeMaximization);\r\n\r\n            currentNodeMaximized = null;\r\n            currentNodeBeforeMaximization = null;\r\n\r\n            return true;\r\n        }\r\n        else {\r\n            return false;\r\n        }\r\n\r\n    }\r\n\r\n    public void markAsSubStation(DockSubStation dockNodeForSubstation) {\r\n        substation = true;\r\n        this.dockNodeForSubstation = dockNodeForSubstation;\r\n    }\r\n\r\n    public DockSubStation getDockNodeForSubStation() {\r\n        return dockNodeForSubstation;\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/docks/stations/DockSubStation.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\npackage com.anchorage.docks.stations;\r\n\r\n\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.node.ui.DockUIPanel;\r\nimport javafx.scene.Scene;\r\nimport javafx.stage.Window;\r\n\r\n/**\r\n *\r\n * @author avinerbi\r\n */\r\npublic final class DockSubStation extends DockNode {\r\n    \r\n     private final DockStation substation;\r\n    /**\r\n     * Get the value of station\r\n     *\r\n     * @return the value of station\r\n     */\r\n    \r\n    public DockStation getSubStation() {\r\n        return substation;\r\n    }\r\n\r\n    public Window getStationWindow()\r\n    {\r\n        return stationProperty().get().getStationScene().getWindow();\r\n    }\r\n    \r\n    public Scene getStationScene()\r\n    {\r\n        return stationProperty().get().getStationScene();\r\n    }\r\n    \r\n    public void putDock(DockNode dockNode, DockPosition position, double percentage)  {\r\n        substation.add(dockNode);\r\n        substation.putDock(dockNode, position,percentage);\r\n        dockNode.stationProperty().set(substation);\r\n    }\r\n     \r\n      \r\n    public DockSubStation(DockUIPanel uiPanel) {\r\n        super(uiPanel);\r\n        substation = (DockStation)getContent().getNodeContent();\r\n        substation.markAsSubStation(this);\r\n    }\r\n    \r\n}\r\n"
  },
  {
    "path": "src/main/java/com/anchorage/system/AnchorageSystem.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\npackage com.anchorage.system;\r\n\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.node.ui.DockUIPanel;\r\nimport com.anchorage.docks.stations.DockStation;\r\nimport com.anchorage.docks.stations.DockSubStation;\r\nimport com.sun.javafx.css.StyleManager;\r\nimport javafx.scene.Parent;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\nimport javafx.scene.Node;\r\nimport javafx.scene.image.Image;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic class AnchorageSystem {\r\n\r\n    private static final List<DockStation> stations;\r\n    private static DockNode nodeInDragging;\r\n    private static final Image emptyIconImage;\r\n    private static final Image emptySubstationIconImage;\r\n\r\n    private static DockStation currentStationFromDrag;\r\n\r\n    static {\r\n        stations = new ArrayList<>();\r\n        emptyIconImage = new Image(\"empty.png\");\r\n        emptySubstationIconImage = new Image(\"substation.png\");\r\n    }\r\n\r\n    public static DockStation createStation() {\r\n        DockStation station = new DockStation();\r\n        stations.add(station);\r\n        return station;\r\n    }\r\n\r\n    public static DockStation createCommonStation() {\r\n        DockStation station = new DockStation(true);\r\n        stations.add(station);\r\n        return station;\r\n    }\r\n\r\n    public static DockSubStation createSubStation(DockStation parentStation, String title) {\r\n        DockSubStation station = new DockSubStation(new DockUIPanel(title, new DockStation(), true, emptySubstationIconImage));\r\n        return station;\r\n    }\r\n\r\n    public static DockNode createDock(String title, Node content) {\r\n        DockUIPanel panel = new DockUIPanel(title, content, false, emptyIconImage);\r\n        DockNode container = new DockNode(panel);\r\n        return container;\r\n    }\r\n\r\n    public static DockNode createDock(String title, Parent content, Image icon) {\r\n        DockUIPanel panel = new DockUIPanel(title, content, false, icon);\r\n        DockNode container = new DockNode(panel);\r\n        return container;\r\n    }\r\n\r\n    public static void installDefaultStyle() {\r\n        StyleManager.getInstance()\r\n                .addUserAgentStylesheet(\"AnchorFX.css\");\r\n    }\r\n\r\n    public static void prepareDraggingZoneFor(DockStation station, DockNode source) {\r\n        currentStationFromDrag = station;\r\n        station.prepareZones(source);\r\n        if (currentStationFromDrag.isSubStation())\r\n            return;\r\n        if (station.isCommonStation()) {\r\n            stations.stream().filter(s -> s != station && s.isCommonStation()).forEach(s -> s.prepareZones(source));\r\n        }\r\n    }\r\n\r\n    public static void searchTargetNode(double x, double y) {\r\n        \r\n        if (currentStationFromDrag.isCommonStation() && !currentStationFromDrag.isSubStation()) {\r\n            stations.stream().filter(s -> s.isCommonStation()).forEach(s -> s.searchTargetNode(x, y));\r\n        } else {\r\n            currentStationFromDrag.searchTargetNode(x, y);\r\n        }\r\n    }\r\n\r\n    public static void finalizeDragging() {\r\n        if (currentStationFromDrag.isSubStation()) {\r\n            currentStationFromDrag.closeZones();\r\n            currentStationFromDrag.finalizeDrag();\r\n        } else {\r\n            if (currentStationFromDrag.isCommonStation())\r\n                stations.stream().filter(s -> s.isCommonStation()).forEach(s -> s.closeZones());\r\n            else\r\n                currentStationFromDrag.closeZones();\r\n            \r\n            DockStation selectedStation = stations.stream().filter(s -> s.isSelected()).findFirst().orElse(null);\r\n            if (selectedStation != null && currentStationFromDrag.isCommonStation()) {\r\n                selectedStation.finalizeDrag();\r\n            } else {\r\n                currentStationFromDrag.finalizeDrag();\r\n            }\r\n        }\r\n\r\n    }\r\n}\r\n"
  },
  {
    "path": "src/main/resources/AnchorFX.css",
    "content": "/**\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n/* \r\n    Created on : 27-dic-2015, 13.25.27\r\n    Author     : Alessio Vinerbi\r\n*/\r\n\r\n.docknode-title-bar {\r\n    -fx-background-color: rgb(100,100,100);\r\n}\r\n\r\n.docknode-title-text{\r\n    -fx-text-fill: rgb(255,255,255);\r\n}\r\n\r\n.docknode-content-panel{\r\n    -fx-background-color: rgb(100,100,100);\r\n    -fx-padding: 0\r\n}\r\n\r\n.docknode-floating-stack-container-panel {\r\n    -fx-background-color: rgb(100,100,100);\r\n    -fx-padding: 4\r\n}\r\n \r\n.docknode-split-pane {  \r\n    -fx-padding: 0;  \r\n} \r\n\r\n.docknode-split-pane *.split-pane-divider {  \r\n    -fx-padding: 2;  \r\n    -fx-border-color:transparent;\r\n    -fx-color: darkgray;\r\n} \r\n\r\n.docknode-tab-panel{\r\n    -fx-padding: 0;\r\n}\r\n\r\n.docknode-command-button{\r\n    -fx-background-color:transparent;\r\n    -fx-background-radius: 0,0,0;\r\n}\r\n\r\n.docknode-command-button:hover{\r\n    -fx-background-color:darkgray;\r\n}\r\n\r\n.docknode-command-button:pressed{\r\n    -fx-background-color:darkgray;\r\n}\r\n\r\n.docknode-command-button:focused{\r\n    -fx-background-color:transparent;\r\n}\r\n\r\n.docknode-command-button-close{\r\n    -fx-background-color:transparent;\r\n    -fx-background-radius: 0,0,0;\r\n}\r\n\r\n.docknode-command-button-close:pressed{\r\n    -fx-background-color:red;\r\n}\r\n\r\n.docknode-command-button-close:hover{\r\n    -fx-background-color:red;\r\n}\r\n\r\n.docknode-command-button-close:focused{\r\n    -fx-background-color:transparent;\r\n} \r\n\r\n.station {\r\n    -fx-background-color: rgb(0,0,0);\r\n    -fx-padding: 0\r\n}\r\n\r\n.substation-title-bar {\r\n    -fx-background-color: rgb(0,0,0);\r\n}\r\n\r\n.substation-title-text{\r\n    -fx-text-fill: rgb(255,255,255);\r\n}\r\n\r\n.dockzone-circle-container-selectors {\r\n    -fx-fill: rgba(0,0,0,0.7);\r\n}\r\n\r\n.dockzone-circle-selector {\r\n    -fx-fill: rgba(0,0,0,0.8);\r\n}\r\n\r\n.dockzone-rectangle-preview {\r\n    -fx-fill: rgba(63,138,163,0.8);\r\n}"
  },
  {
    "path": "src/test/java/com/anchorage/demo/AnchorFX_CommonStations.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\npackage com.anchorage.demo;\r\n\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.stations.DockStation;\r\nimport com.anchorage.system.AnchorageSystem;\r\nimport javafx.application.Application;\r\nimport javafx.scene.Scene;\r\nimport javafx.scene.control.TreeItem;\r\nimport javafx.scene.control.TreeView;\r\nimport javafx.stage.Stage;\r\n\r\nimport java.util.Random;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic class AnchorFX_CommonStations extends Application {\r\n\r\n    @Override\r\n    public void start(Stage primaryStage) {\r\n\r\n        DockStation station = AnchorageSystem.createCommonStation();\r\n\r\n        Scene scene = new Scene(station, 500,500);\r\n      \r\n        DockNode node1 = AnchorageSystem.createDock(\"Tree 1\", generateRandomTree());\r\n        node1.dock(station, DockNode.DockPosition.CENTER);\r\n  \r\n        DockNode node2 = AnchorageSystem.createDock(\"Tree 2\", generateRandomTree());\r\n        node2.dock(station, DockNode.DockPosition.RIGHT);\r\n          \r\n        primaryStage.setTitle(\"Station 1\");\r\n        primaryStage.setScene(scene);\r\n        primaryStage.show();\r\n        \r\n        makeSecondStage();\r\n         \r\n        AnchorageSystem.installDefaultStyle();\r\n    }\r\n\r\n    private void makeSecondStage()\r\n    {\r\n        Stage stage = new Stage();\r\n        DockStation station = AnchorageSystem.createCommonStation();\r\n        Scene scene = new Scene(station, 500, 500);\r\n        stage.setScene(scene);\r\n        stage.setTitle(\"Station 2\");\r\n        DockNode node1 = AnchorageSystem.createDock(\"Tree 3\", generateRandomTree());\r\n        node1.dock(station, DockNode.DockPosition.CENTER);\r\n  \r\n        DockNode node2 = AnchorageSystem.createDock(\"Tree 4\", generateRandomTree());\r\n        node2.dock(station, DockNode.DockPosition.RIGHT);\r\n        \r\n        stage.setX(600);\r\n        \r\n        stage.show();\r\n    }\r\n    \r\n    private TreeView<String> generateRandomTree() {\r\n        // create a demonstration tree view to use as the contents for a dock node\r\n        TreeItem<String> root = new TreeItem<String>(\"Root\");\r\n        TreeView<String> treeView = new TreeView<String>(root);\r\n        treeView.setShowRoot(false);\r\n\r\n        // populate the prototype tree with some random nodes\r\n        Random rand = new Random();\r\n        for (int i = 4 + rand.nextInt(8); i > 0; i--) {\r\n            TreeItem<String> treeItem = new TreeItem<String>(\"Item \" + i);\r\n            root.getChildren().add(treeItem);\r\n            for (int j = 2 + rand.nextInt(4); j > 0; j--) {\r\n                TreeItem<String> childItem = new TreeItem<String>(\"Child \" + j);\r\n                treeItem.getChildren().add(childItem);\r\n            }\r\n        }\r\n\r\n        return treeView;\r\n    }\r\n\r\n    /**\r\n     * @param args the command line arguments\r\n     */\r\n    public static void main(String[] args) {\r\n        launch(args);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/test/java/com/anchorage/demo/AnchorFX_events.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n\r\npackage com.anchorage.demo;\r\n\r\nimport com.anchorage.docks.containers.common.AnchorageSettings;\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.node.interfaces.DockNodeCreationListener;\r\nimport com.anchorage.docks.stations.DockStation;\r\nimport com.anchorage.system.AnchorageSystem;\r\nimport javafx.application.Application;\r\nimport javafx.scene.Scene;\r\nimport javafx.scene.control.Label;\r\nimport javafx.scene.layout.VBox;\r\nimport javafx.stage.Stage;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic class AnchorFX_events extends Application {\r\n\r\n    @Override\r\n    public void start(Stage primaryStage) {\r\n\r\n        AnchorageSettings.setDockingPositionPreview(false);\r\n\r\n        DockStation station = AnchorageSystem.createStation();\r\n\r\n        Scene scene = new Scene(station, 1024, 768);\r\n\r\n        DockNode node1 = AnchorageSystem.createDock(\"Events\", new MyPanel());\r\n        node1.dock(station, DockNode.DockPosition.LEFT); \r\n\r\n        \r\n        AnchorageSystem.installDefaultStyle();\r\n\r\n        primaryStage.setTitle(\"AnchorFX \");\r\n        primaryStage.setScene(scene);\r\n        primaryStage.show();\r\n\r\n    } \r\n    /**\r\n     * @param args the command line arguments\r\n     */\r\n    public static void main(String[] args) {\r\n        launch(args);\r\n    }\r\n\r\n}\r\n\r\nclass MyPanel extends VBox implements DockNodeCreationListener {\r\n\r\n    private DockNode myNode;\r\n    private Label floatingLabel;\r\n    private Label draggingLabel;\r\n    private Label maximizedLabel;\r\n  \r\n    \r\n    @Override\r\n    public void onDockNodeCreated(DockNode node) {\r\n        myNode = node;\r\n        \r\n        setSpacing(20);\r\n        \r\n        floatingLabel = new Label(\"Floating : false\");\r\n        myNode.floatingProperty().addListener((ov,oldv,newv)->floatingLabel.setText(\"Floating : \"+newv));\r\n        \r\n        draggingLabel = new Label(\"Dragging : false\");\r\n        myNode.draggingProperty().addListener((ov,oldv,newv)->draggingLabel.setText(\"Dragging : \"+newv));\r\n        \r\n        maximizedLabel = new Label(\"Maximizing : false\");\r\n        myNode.maximizingProperty().addListener((ov,oldv,newv)->maximizedLabel.setText(\"Maximizing : \"+newv));\r\n          \r\n        setStyle(\"-fx-background-color:rgb(200,200,200); -fx-padding:15;\");\r\n        \r\n        getChildren().addAll(floatingLabel,draggingLabel,maximizedLabel);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/test/java/com/anchorage/demo/AnchorFX_settings.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\npackage com.anchorage.demo;\r\n\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.stations.DockStation;\r\nimport com.anchorage.system.AnchorageSystem;\r\nimport javafx.application.Application;\r\nimport javafx.scene.Scene;\r\nimport javafx.scene.control.TreeItem;\r\nimport javafx.scene.control.TreeView;\r\nimport javafx.stage.Stage;\r\n\r\nimport java.util.Random;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic class AnchorFX_settings extends Application {\r\n\r\n    @Override\r\n    public void start(Stage primaryStage) {\r\n\r\n        //AnchorageSettings.setDockingPositionPreview(false);\r\n        \r\n        DockStation station = AnchorageSystem.createStation();\r\n\r\n        Scene scene = new Scene(station,  1024, 768);\r\n\r\n        DockNode node1 = AnchorageSystem.createDock(\"Not floatable\", generateRandomTree());\r\n        node1.dock(station, DockNode.DockPosition.LEFT);\r\n        node1.floatableProperty().set(false);\r\n        \r\n        DockNode node2 = AnchorageSystem.createDock(\"Not resizable\", generateRandomTree());\r\n        node2.dock(station, DockNode.DockPosition.RIGHT);\r\n        node2.resizableProperty().set(false);\r\n        \r\n        DockNode node3 = AnchorageSystem.createDock(\"Not maximizable\", generateRandomTree());\r\n        node3.dock(station, DockNode.DockPosition.TOP);\r\n        node3.maximizableProperty().set(false);\r\n        \r\n        DockNode node4 = AnchorageSystem.createDock(\"Not closeable\", generateRandomTree());\r\n        node4.dock(station, DockNode.DockPosition.BOTTOM);\r\n        node4.closeableProperty().set(false);\r\n\r\n        \r\n\r\n        primaryStage.setTitle(\"AnchorFX \");\r\n        primaryStage.setScene(scene);\r\n        primaryStage.show();\r\n        \r\n        AnchorageSystem.installDefaultStyle();\r\n        \r\n    }\r\n\r\n    private TreeView<String> generateRandomTree() {\r\n        // create a demonstration tree view to use as the contents for a dock node\r\n        TreeItem<String> root = new TreeItem<String>(\"Root\");\r\n        TreeView<String> treeView = new TreeView<String>(root);\r\n        treeView.setShowRoot(false);\r\n\r\n        // populate the prototype tree with some random nodes\r\n        Random rand = new Random();\r\n        for (int i = 4 + rand.nextInt(8); i > 0; i--) {\r\n            TreeItem<String> treeItem = new TreeItem<String>(\"Item \" + i);\r\n            root.getChildren().add(treeItem);\r\n            for (int j = 2 + rand.nextInt(4); j > 0; j--) {\r\n                TreeItem<String> childItem = new TreeItem<String>(\"Child \" + j);\r\n                treeItem.getChildren().add(childItem);\r\n            }\r\n        }\r\n\r\n        return treeView;\r\n    }\r\n\r\n    /**\r\n     * @param args the command line arguments\r\n     */\r\n    public static void main(String[] args) {\r\n        launch(args);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/test/java/com/anchorage/demo/AnchorFX_substations.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\npackage com.anchorage.demo;\r\n\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.stations.DockStation;\r\nimport com.anchorage.docks.stations.DockSubStation;\r\nimport com.anchorage.system.AnchorageSystem;\r\nimport javafx.application.Application;\r\nimport javafx.scene.Scene;\r\nimport javafx.scene.control.TableView;\r\nimport javafx.stage.Stage;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic class AnchorFX_substations extends Application {\r\n\r\n    @Override\r\n    public void start(Stage primaryStage) {\r\n\r\n        DockStation station = AnchorageSystem.createStation();\r\n\r\n        Scene scene = new Scene(station,  1024, 768);\r\n\r\n        DockNode node1 = AnchorageSystem.createDock(\"Node\", new TableView());\r\n        node1.dock(station, DockNode.DockPosition.CENTER);\r\n\r\n        DockSubStation station1 = AnchorageSystem.createSubStation(station, \"SubStation\");\r\n        station1.dock(station, DockNode.DockPosition.LEFT,0.7);\r\n\r\n        DockNode subNode = AnchorageSystem.createDock(\"subNode 1\", new TableView());\r\n        subNode.dock(station1, DockNode.DockPosition.LEFT);\r\n        subNode.floatableProperty().set(false);\r\n\r\n        DockNode subNode2 = AnchorageSystem.createDock(\"subNode 2\", new TableView());\r\n        subNode2.dock(station1, DockNode.DockPosition.LEFT);\r\n\r\n        AnchorageSystem.installDefaultStyle();\r\n\r\n        primaryStage.setTitle(\"AnchorFX SubStation\");\r\n        primaryStage.setScene(scene);\r\n        primaryStage.show();\r\n\r\n        //node4.makeNodeActiveOnFloatableStage();\r\n    }\r\n\r\n    /**\r\n     * @param args the command line arguments\r\n     */\r\n    public static void main(String[] args) {\r\n        launch(args);\r\n    }\r\n\r\n}\r\n"
  },
  {
    "path": "src/test/java/com/anchorage/demo/AnchorFX_test.java",
    "content": "/*\r\n * Copyright 2015-2016 Alessio Vinerbi. All rights reserved.\r\n *\r\n * This library is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU Lesser General Public\r\n * License as published by the Free Software Foundation; either\r\n * version 2.1 of the License, or (at your option) any later version.\r\n *\r\n * This library is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r\n * Lesser General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU Lesser General Public\r\n * License along with this library; if not, write to the Free Software\r\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\r\n * MA 02110-1301  USA\r\n */\r\n/*\r\n * To change this license header, choose License Headers in Project Properties.\r\n * To change this template file, choose Tools | Templates\r\n * and open the template in the editor.\r\n */\r\npackage com.anchorage.demo;\r\n\r\nimport com.anchorage.docks.node.DockNode;\r\nimport com.anchorage.docks.stations.DockStation;\r\nimport com.anchorage.system.AnchorageSystem;\r\nimport javafx.application.Application;\r\nimport javafx.scene.Scene;\r\nimport javafx.scene.control.TreeItem;\r\nimport javafx.scene.control.TreeView;\r\nimport javafx.scene.web.HTMLEditor;\r\nimport javafx.stage.Stage;\r\n\r\nimport java.util.Random;\r\n\r\n/**\r\n *\r\n * @author Alessio\r\n */\r\npublic class AnchorFX_test extends Application {\r\n\r\n    @Override\r\n    public void start(Stage primaryStage) {\r\n\r\n        DockStation station = AnchorageSystem.createStation();\r\n\r\n        Scene scene = new Scene(station, 1024, 768);\r\n        \r\n        DockNode node1 = AnchorageSystem.createDock(\"Not floatable\", new HTMLEditor());\r\n        node1.dock(station, DockNode.DockPosition.LEFT);\r\n        node1.floatableProperty().set(false);\r\n        \r\n        DockNode node2 = AnchorageSystem.createDock(\"Not resizable\", new HTMLEditor());\r\n        node2.dock(station, DockNode.DockPosition.RIGHT);\r\n        node2.resizableProperty().set(false);\r\n        \r\n      \r\n//        DockNode node1 = AnchorageSystem.createDock(\"Tree\", generateRandomTree());\r\n//        node1.dock(station, DockNode.DockPosition.CENTER);\r\n//  \r\n//        DockNode node2 = AnchorageSystem.createDock(\"Editor\", new HTMLEditor());\r\n//        node2.dock(station, DockNode.DockPosition.RIGHT);\r\n//        \r\n//        DockNode node3 = AnchorageSystem.createDock(\"Below the editor\", generateRandomTree());\r\n//        node3.dock(node2, DockNode.DockPosition.BOTTOM,0.8);\r\n\r\n        AnchorageSystem.installDefaultStyle();\r\n\r\n        primaryStage.setTitle(\"AnchorFX\");\r\n        primaryStage.setScene(scene);\r\n        primaryStage.show();\r\n        \r\n//        DockNode node4 = AnchorageSystem.createDock(\"Floating\", new TableView());\r\n//        node4.dockAsFloating(primaryStage, station, 0, 0, 400, 200);\r\n\r\n        \r\n        AnchorageSystem.installDefaultStyle();\r\n    }\r\n\r\n    private TreeView<String> generateRandomTree() {\r\n        // create a demonstration tree view to use as the contents for a dock node\r\n        TreeItem<String> root = new TreeItem<String>(\"Root\");\r\n        TreeView<String> treeView = new TreeView<String>(root);\r\n        treeView.setShowRoot(false);\r\n\r\n        // populate the prototype tree with some random nodes\r\n        Random rand = new Random();\r\n        for (int i = 4 + rand.nextInt(8); i > 0; i--) {\r\n            TreeItem<String> treeItem = new TreeItem<String>(\"Item \" + i);\r\n            root.getChildren().add(treeItem);\r\n            for (int j = 2 + rand.nextInt(4); j > 0; j--) {\r\n                TreeItem<String> childItem = new TreeItem<String>(\"Child \" + j);\r\n                treeItem.getChildren().add(childItem);\r\n            }\r\n        }\r\n\r\n        return treeView;\r\n    }\r\n\r\n    /**\r\n     * @param args the command line arguments\r\n     */\r\n    public static void main(String[] args) {\r\n        launch(args);\r\n    }\r\n\r\n}\r\n"
  }
]