Class GuiTreasureObserver
java.lang.Object
javafx.application.Application
eu.su.mas.dedale.mas.agents.observerAgent.guiComponents.GuiTreasureObserver
- All Implemented Interfaces:
Serializable
JavaFx frame used to display the backPack's state of each observed agent.
Design pattern Singleton. One Unique frame for one platform
- Author:
- hc
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javafx.application.Application
javafx.application.Application.Parameters
-
Field Summary
Fields inherited from class javafx.application.Application
STYLESHEET_CASPIAN, STYLESHEET_MODENA
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addObservedAgent
(String agentName) Add the agent to the observerGui (do nothing if already present)static GuiTreasureObserver
Design pattern singletonstatic void
void
removeObservedAgent
(String agentName) Remove the agent from the observerGuivoid
start
(javafx.stage.Stage stage) Automatically called when App.launch() is triggeredtoString()
boolean
updateAgentDiamondValue
(String agentName, Integer diamondValue) Set the diamond to its new valueboolean
updateAgentGoldValue
(String agentName, Integer goldValue) Set the gold to its new valueboolean
updateAgentTreasure
(String agentName, Integer gold, Integer diamond) Set the new values for gold and diamonds.Methods inherited from class javafx.application.Application
getHostServices, getParameters, getUserAgentStylesheet, init, launch, launch, notifyPreloader, setUserAgentStylesheet, stop
-
Constructor Details
-
GuiTreasureObserver
public GuiTreasureObserver()
-
-
Method Details
-
main
-
getInstance
Design pattern singleton- Returns:
- Get an instance of the Gui to call the associated update methods. If the instance does not already exist, this method creates it
-
start
public void start(javafx.stage.Stage stage) Automatically called when App.launch() is triggered- Specified by:
start
in classjavafx.application.Application
-
updateAgentTreasure
Set the new values for gold and diamonds. If the agent does not exist, it creates it.- Parameters:
agentName
- localName of the agentgold
- quantity of gold the agent carriesdiamond
- quantity of diamond the agent carries- Returns:
- true is the agent has been updated, false if created
-
updateAgentGoldValue
Set the gold to its new value- Parameters:
agentName
- localName of the agentgoldValue
- new quantity of gold- Returns:
- true if the value has been updated, false otherwise
-
updateAgentDiamondValue
Set the diamond to its new value- Parameters:
agentName
- localNamediamondValue
- quantity of diamond to set- Returns:
- true if the value has been updated, false otherwise
-
addObservedAgent
Add the agent to the observerGui (do nothing if already present)- Parameters:
agentName
- (unique) name of the agent
-
removeObservedAgent
Remove the agent from the observerGui- Parameters:
agentName
- localname of the agent
-
toString
-