Class ShipModelForShipList
- java.lang.Object
-
- ch.sahits.game.openpatrician.display.dialog.ship.ShipModelForShipList
-
public class ShipModelForShipList extends java.lang.Object
UI model for an entry in the ship list dialog.- Author:
- Andi Hotz, (c) Sahits GmbH, 2018 Created on Jul 12, 2018
-
-
Field Summary
Fields Modifier and Type Field Description private Locale
locale
private org.springframework.context.MessageSource
messageSource
private IShip
ship
private ShipService
shipService
private TravellingVessels
travellingVessels
-
Constructor Summary
Constructors Constructor Description ShipModelForShipList(IShip ship)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.beans.binding.StringBinding
destination()
Destination city name of the travel.int
getHealth()
Retrieve the ships health.java.util.Optional<ShipModelForShipList>
getParent()
If the ship belongs to a convoy retrieve the parent ship.java.lang.String
getShipName()
Retrieve the name of the ship.EShipType
getShipType()
Retrieve the ship type.int
getValue()
Get the ship's value.boolean
isAutotrading()
Check if the ship is on an auto trade route.boolean
isPlayersShip(IHumanPlayer player)
Check if the represented ship belongs to the current player.javafx.beans.binding.IntegerBinding
loadedWares()
Binding of the loaded amount of wares in barrels.javafx.beans.property.ObjectProperty<EShipTravelState>
travelingState()
Property of the travel state.
-
-
-
Field Detail
-
ship
private final IShip ship
-
shipService
@Autowired private ShipService shipService
-
travellingVessels
@Autowired private TravellingVessels travellingVessels
-
messageSource
@Autowired private org.springframework.context.MessageSource messageSource
-
locale
@Autowired private Locale locale
-
-
Constructor Detail
-
ShipModelForShipList
public ShipModelForShipList(IShip ship)
-
-
Method Detail
-
getParent
public java.util.Optional<ShipModelForShipList> getParent()
If the ship belongs to a convoy retrieve the parent ship.- Returns:
- Optional parent reference, not present when a vessel has no parent (i.e. not a convoy member)
-
getShipName
public java.lang.String getShipName()
Retrieve the name of the ship.- Returns:
- ship name.
-
getShipType
public EShipType getShipType()
Retrieve the ship type.- Returns:
- ship type.
-
travelingState
public javafx.beans.property.ObjectProperty<EShipTravelState> travelingState()
Property of the travel state.- Returns:
- observable of the travel state
-
destination
public javafx.beans.binding.StringBinding destination()
Destination city name of the travel. This may be an empty string.- Returns:
- string binding representing the destination
-
getHealth
public int getHealth()
Retrieve the ships health.- Returns:
- ship health.
-
loadedWares
public javafx.beans.binding.IntegerBinding loadedWares()
Binding of the loaded amount of wares in barrels.- Returns:
- loaded ware binding.
-
getValue
public int getValue()
Get the ship's value.- Returns:
- ship value.
-
isPlayersShip
public boolean isPlayersShip(IHumanPlayer player)
Check if the represented ship belongs to the current player.- Parameters:
player
- to check against owner- Returns:
- true if player and ship owner match
-
isAutotrading
public boolean isAutotrading()
Check if the ship is on an auto trade route.- Returns:
- true if the ship is on a trade route.
-
-