Package prezoom.controller
Class GAttributeManager
- java.lang.Object
-
- prezoom.controller.GAttributeManager
-
- All Implemented Interfaces:
Serializable
public class GAttributeManager extends Object implements Serializable
This class is the manager to manage the state related functions for the attributes of graphical objects. EachGObjecthas a manager to manage its own attributes.- Author:
- Zhijie Lan
create date: 2020/11/6
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private GAttributesIcur_Attributesthe attribute for the current state(package private) ArrayList<GAttributesI>state_Attributes_listthe list that store all attributes for each state.
-
Constructor Summary
Constructors Constructor Description GAttributeManager(Double x, Double y, Color col, Boolean filled, Integer lineWidth, Double width, Double height, Double x2, Double y2, Boolean visible, String fontName, Integer fontStyle, Double fontSize, String textString)To construct a manager, the object's attributes will be generated and duplicated from the current state to the end state, but attributes for states before the current state are set to 0, which means the object only exists from the current state.
-
Method Summary
Modifier and Type Method Description voiddeleteAttributeState(int state)delete the attribute of a given statevoidfinishDrawingNew()after drawing, add cloned attributes to the following statesGAttributesIgetCur_Attributes()get the object's attribute for the current stateprivate intgetCurrent_State()get the state from the state managervoidinsertAttributeState()insert a new attribute of a new state intostate_Attributes_listat the current state index.voidupdateCur_Attributes()update thecur_Attributes.
-
-
-
Field Detail
-
state_Attributes_list
ArrayList<GAttributesI> state_Attributes_list
the list that store all attributes for each state.
-
cur_Attributes
private GAttributesI cur_Attributes
the attribute for the current state
-
-
Constructor Detail
-
GAttributeManager
public GAttributeManager(Double x, Double y, Color col, Boolean filled, Integer lineWidth, Double width, Double height, Double x2, Double y2, Boolean visible, String fontName, Integer fontStyle, Double fontSize, String textString)
To construct a manager, the object's attributes will be generated and duplicated from the current state to the end state, but attributes for states before the current state are set to 0, which means the object only exists from the current state.- Parameters:
x- location, xy- location, ycol- paint colorfilled- whether filledlineWidth- width of lineswidth- width of the object, if applicableheight- height of the object, if applicablex2- x2 of the object, if applicabley2- y2 of the object, if applicablevisible- whether visiblefontName- font namefontSize- font sizefontStyle- plain, bold, or italictextString- the text content
-
-
Method Detail
-
getCurrent_State
private int getCurrent_State()
get the state from the state manager- Returns:
- the current state number
-
getCur_Attributes
public GAttributesI getCur_Attributes()
get the object's attribute for the current state- Returns:
- the attribute
-
updateCur_Attributes
public void updateCur_Attributes()
update thecur_Attributes. and add interpolation from previous value to the current value skip if there is no attribute for the current state
-
insertAttributeState
public void insertAttributeState()
insert a new attribute of a new state intostate_Attributes_listat the current state index. The new attribute will clone the previous info of the current state
-
deleteAttributeState
public void deleteAttributeState(int state)
delete the attribute of a given state- Parameters:
state- the state to be deleted
-
finishDrawingNew
public void finishDrawingNew()
after drawing, add cloned attributes to the following states
-
-