Class DialogUtil
- java.lang.Object
-
- ch.sahits.game.openpatrician.display.dialog.service.DialogUtil
-
public class DialogUtil extends java.lang.Object- Author:
- Andi Hotz, (c) Sahits GmbH, 2013 Created on Dec 20, 2013
-
-
Constructor Summary
Constructors Constructor Description DialogUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.scene.layout.Panecenter(javafx.scene.control.Control childNode)Create an element that will layout thechildNodehorizontally centered within a Dialog.javafx.scene.layout.Panecenter(javafx.scene.image.ImageView childNode)Create an element that will layout thechildNodehorizontally centered within a Dialog.javafx.scene.Groupcenter(javafx.scene.layout.Pane childNode)Create an element that will layout thechildNodehorizontally centered within a Dialog.javafx.scene.layout.GridPanecreateGridPaneFromModel(ch.sahits.game.openpatrician.javafx.model.Table model)Create a grid pane based on a model.javafx.event.EventHandler<javafx.scene.input.MouseEvent>createNextActionForShips(javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.IShip> ships, javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.IShip> currentShip)Navigate to the next ship in the catalogue.javafx.event.EventHandler<javafx.scene.input.MouseEvent>createPreviousActionForShips(javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.IShip> ships, javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.IShip> currentShip)Navigate to the previous ship in the catalogue.javafx.scene.layout.GridPanecreateShipInfoOnThreeLines(javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.IShip> currentShip, boolean withShipName, int maxWidth)Create the grid pane for the ship information on three lines.javafx.scene.layout.GridPanecreateShipSelection3LinesForShips(javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.IShip> ships, javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.IShip> currentShip)Create the grid pane for the ship selection on three lines.javafx.scene.layout.PanecreateShipWeaponDisplay(ch.sahits.game.openpatrician.model.ship.IShip ship)Create the weapon display with all weapons and place holders.javafx.scene.NodecreateVerticalSpacer(int heigth)Create a Node that forces vertical spacing.javafx.beans.binding.BooleanBindingenableShipCatalogueForShips(javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.IShip> ships)Boolean binding for the navigation enabling of the ships cataloque.javafx.scene.image.ImagegetStatusIcon(ch.sahits.game.openpatrician.model.ship.EShipTravelState travelState)Retrieve the appropriate icon for the traveling state.intremoveById(javafx.scene.layout.Pane parent, java.lang.String id)Remove a node identified byidfrom the parent and return the index.javafx.scene.layout.Paneright(javafx.scene.control.Control childNode)Create an element that will layout thechildNodeat the right dialog content border.javafx.scene.Groupright(javafx.scene.layout.Pane childNode)Create an element that will layout thechildNodeat the right dialog content border.
-
-
-
Method Detail
-
enableShipCatalogueForShips
public javafx.beans.binding.BooleanBinding enableShipCatalogueForShips(javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.IShip> ships)
Boolean binding for the navigation enabling of the ships cataloque. Only the ships are considered (convoys are excluded)- Parameters:
ships- to be observed.- Returns:
- binding.
-
createNextActionForShips
public javafx.event.EventHandler<javafx.scene.input.MouseEvent> createNextActionForShips(javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.IShip> ships, javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.IShip> currentShip)Navigate to the next ship in the catalogue. Only the ships are considered (convoys are excluded)- Parameters:
ships- in the selectioncurrentShip- current ship- Returns:
- Event handler for the navigation.
-
createPreviousActionForShips
public javafx.event.EventHandler<javafx.scene.input.MouseEvent> createPreviousActionForShips(javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.IShip> ships, javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.IShip> currentShip)Navigate to the previous ship in the catalogue. Only the ships are considered (convoys are excluded)- Parameters:
ships- in the selectioncurrentShip- current ship- Returns:
- Event handler for the navigation.
-
createGridPaneFromModel
public javafx.scene.layout.GridPane createGridPaneFromModel(ch.sahits.game.openpatrician.javafx.model.Table model)
Create a grid pane based on a model.- Parameters:
model- base model- Returns:
- grid pane
-
createShipSelection3LinesForShips
public javafx.scene.layout.GridPane createShipSelection3LinesForShips(javafx.collections.ObservableList<ch.sahits.game.openpatrician.model.ship.IShip> ships, javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.IShip> currentShip)Create the grid pane for the ship selection on three lines. The currently selected ship is the first inships.
+----------+-------------+-------------+-------------+-----------+ | ship type and name | |prevShip | weapon icon | health icon | sailor icon | nextShip| | |weapon amount| health | no. sailors | | +----------+-------------+-------------+-------------+-----------+- Parameters:
ships- observable list of ships through which is to be navigated.currentShip- container to store the currently selected ship. The value will be set as par of the execution.- Returns:
- GridPane displaying ship details like weapon strength, health and crew compliment as well as navigation capabilities through the list of ships.
-
createShipInfoOnThreeLines
public javafx.scene.layout.GridPane createShipInfoOnThreeLines(javafx.beans.property.ObjectProperty<ch.sahits.game.openpatrician.model.ship.IShip> currentShip, boolean withShipName, int maxWidth)Create the grid pane for the ship information on three lines.
+------------+-------------+-------------+-------------+ | ship type and name | optional, triggered by withShipName | knot icon | weapon icon | health icon | sailor icon | | |weapon amount| health | no. sailors | +------------+-------------+-------------+-------------+- Parameters:
currentShip- container to store the currently selected ship. The value will be set as par of the execution.withShipName- flag indicating if the first row should be included.maxWidth- maximum width of the table- Returns:
- GridPane displaying ship details like speed, weapon strength, health and crew compliment.
-
center
public javafx.scene.layout.Pane center(javafx.scene.control.Control childNode)
Create an element that will layout thechildNodehorizontally centered within a Dialog.- Parameters:
childNode- that should be centered- Returns:
- wrapping Pane
-
center
public javafx.scene.layout.Pane center(javafx.scene.image.ImageView childNode)
Create an element that will layout thechildNodehorizontally centered within a Dialog.- Parameters:
childNode- that should be centered- Returns:
- wrapping Pane
-
center
public javafx.scene.Group center(javafx.scene.layout.Pane childNode)
Create an element that will layout thechildNodehorizontally centered within a Dialog.- Parameters:
childNode- that should be centered- Returns:
- wrapping Pane
-
right
public javafx.scene.Group right(javafx.scene.layout.Pane childNode)
Create an element that will layout thechildNodeat the right dialog content border.- Parameters:
childNode- that should be right aligned.- Returns:
- wrapping Pane
-
right
public javafx.scene.layout.Pane right(javafx.scene.control.Control childNode)
Create an element that will layout thechildNodeat the right dialog content border.- Parameters:
childNode- that should be right aligned.- Returns:
- wrapping Pane
-
createVerticalSpacer
public javafx.scene.Node createVerticalSpacer(int heigth)
Create a Node that forces vertical spacing.- Parameters:
heigth- of the spacing node.- Returns:
- Node with specified
heigth.
-
removeById
public int removeById(javafx.scene.layout.Pane parent, java.lang.String id)Remove a node identified byidfrom the parent and return the index.- Parameters:
parent- containing the nodeid- of the id- Returns:
- index in the children of the removed node within id. If the node cannot be found -1 will be returned.
-
createShipWeaponDisplay
public javafx.scene.layout.Pane createShipWeaponDisplay(ch.sahits.game.openpatrician.model.ship.IShip ship)
Create the weapon display with all weapons and place holders.- Parameters:
ship- for which to create the weapon display- Returns:
- pane for the weapon display
-
getStatusIcon
public javafx.scene.image.Image getStatusIcon(ch.sahits.game.openpatrician.model.ship.EShipTravelState travelState)
Retrieve the appropriate icon for the traveling state.- Parameters:
travelState- for which to retrieve the icon- Returns:
- icon.
-
-