Class 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. Each GObject has a manager to manage its own attributes.
    Author:
    Zhijie Lan

    create date: 2020/11/6

    See Also:
    Serialized Form
    • 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, x
        y - location, y
        col - paint color
        filled - whether filled
        lineWidth - width of lines
        width - width of the object, if applicable
        height - height of the object, if applicable
        x2 - x2 of the object, if applicable
        y2 - y2 of the object, if applicable
        visible - whether visible
        fontName - font name
        fontSize - font size
        fontStyle - plain, bold, or italic
        textString - 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 the cur_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 into state_Attributes_list at 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