Class CityPlayerProxyJFX

  • All Implemented Interfaces:
    ICityPlayerProxyJFX

    public class CityPlayerProxyJFX
    extends java.lang.Object
    implements ICityPlayerProxyJFX
    State information of the player, the city and the ships. This instance is tied to the ClientViewState.
    • Field Detail

      • city

        private javafx.beans.property.ObjectProperty<ICity> city
      • playersVessels

        private javafx.collections.ObservableList<INavigableVessel> playersVessels
        List holding all ships owned by the player currently present in the city
      • playersShips

        private javafx.beans.binding.ListBinding<IShip> playersShips
      • clientServerEventBus

        @Autowired
        @Qualifier("serverClientEventBus")
        private com.google.common.eventbus.AsyncEventBus clientServerEventBus
      • clientEventBus

        @Autowired
        @Qualifier("clientEventBus")
        private com.google.common.eventbus.AsyncEventBus clientEventBus
      • activeShip

        private javafx.beans.property.ObjectProperty<INavigableVessel> activeShip
        Reference the active ship of the player
    • Constructor Detail

      • CityPlayerProxyJFX

        public CityPlayerProxyJFX​(ICity city,
                                  IHumanPlayer player,
                                  INavigableVessel activeShip)
        /** Constructor initializing the city and the player with one ship in port.
        Parameters:
        city - behind the proxy
        player - human player behind the proxy
        activeShip - active ship behind the proxy.
    • Method Detail

      • register

        @PostConstruct
        private void register()
      • unregister

        @PreDestroy
        private void unregister()
      • activateShip

        public void activateShip​(INavigableVessel ship)
        Activate a ship. If the ship is not one of the players or not in port or not available an IllegalArgumentException will be thrown
        Specified by:
        activateShip in interface ICityPlayerProxyJFX
        Parameters:
        ship - that is to be activated.
        Throws:
        java.lang.IllegalArgumentException - if the ship cannot be activated due to its non existence
      • getPlayersNavalVessels

        public javafx.collections.ObservableList<INavigableVessel> getPlayersNavalVessels()
        Description copied from interface: ICityPlayerProxyJFX
        Retrieve the list of all ships of the player currently in the port. This list may also contain for examples convoys that are not owned by the player, but the player has a ship in that convoy.
        Specified by:
        getPlayersNavalVessels in interface ICityPlayerProxyJFX
        Returns:
        list of the players ships
      • getPlayersShips

        public javafx.collections.ObservableList<IShip> getPlayersShips()
        Description copied from interface: ICityPlayerProxyJFX
        Retrieve the actual ships of the player.
        Specified by:
        getPlayersShips in interface ICityPlayerProxyJFX
        Returns:
        Observable list of the player's ships.
      • handleShipLeavesPort

        public void handleShipLeavesPort​(ShipLeavingPort event)
      • postLoad

        public void postLoad()
        Execute after savegame was loaded triggered from the ClientViewState.
      • handleShipConstructionFinished

        public void handleShipConstructionFinished​(ShipConstructionFinishedEvent event)
        Handle the event where a ships construction is finished, by adding the ship to the players ships, if the city is the current city. At this point the new ship has been added to the fleet.
        Parameters:
        event - for the finishing of a ship construction