Package prezoom.controller
Class StateManager
- java.lang.Object
-
- prezoom.controller.StateManager
-
public class StateManager extends Object
This is the class that controls all the state changes in PreZoom.- Author:
- Zhijie Lan
create date: 2020/11/4
-
-
Field Summary
Fields Modifier and Type Field Description private static intcurrent_Statethe current selected stateprivate static inttotal_State_Numberthe total number of states
-
Constructor Summary
Constructors Constructor Description StateManager()
-
Method Summary
Modifier and Type Method Description static voidclearAllStateData()delete all datastatic voiddeleteState(int state)let all state-related class to delete a state, but the last one state cannot be deleted.static intgetCurrent_State()get the current state numberstatic intgetTotal_State_Number()get the total number of statesstatic voidinsertState()let all state-related class to insert a state at the next of the current state, then load the new state datastatic voidreloadSavedData()after loading saved data from saving files, update all needed datastatic voidsetTotal_State_Number(int total_State_Number)set the total state number to the given numberstatic voidswitchState(int state)Set the current state, and callupdateStateData()private static voidupdateStateData()update the state data to the current state including cameraCameraManager.updateCur_CamInfo(), objectsGAttributeManager.updateCur_Attributes()
-
-
-
Method Detail
-
switchState
public static void switchState(int state)
Set the current state, and callupdateStateData()- Parameters:
state- the state index
-
updateStateData
private static void updateStateData()
update the state data to the current state including cameraCameraManager.updateCur_CamInfo(), objectsGAttributeManager.updateCur_Attributes()
-
insertState
public static void insertState()
let all state-related class to insert a state at the next of the current state, then load the new state data
-
deleteState
public static void deleteState(int state)
let all state-related class to delete a state, but the last one state cannot be deleted. If trying to delete the last state, all data will be cleared, and then a brand new state will be created then reload the state data- Parameters:
state- the state index to be deleted- See Also:
StatePanel.deleteStateBtn(int),CameraManager.deleteCamState(int),GObjectManager.deleteStateToGObjects(int),GAttributeManager.deleteAttributeState(int),updateStateData()
-
getCurrent_State
public static int getCurrent_State()
get the current state number- Returns:
- current state, 0-indexed
-
getTotal_State_Number
public static int getTotal_State_Number()
get the total number of states- Returns:
- the total number
-
setTotal_State_Number
public static void setTotal_State_Number(int total_State_Number)
set the total state number to the given number- Parameters:
total_State_Number- the total number of states
-
clearAllStateData
public static void clearAllStateData()
delete all data
-
reloadSavedData
public static void reloadSavedData()
after loading saved data from saving files, update all needed data
-
-