Class AbstractModel

java.lang.Object
net.officefloor.model.AbstractModel
All Implemented Interfaces:
Model

public class AbstractModel extends Object implements Model
Provides top level functionality for all model elements.
Author:
Daniel Sagenschneider
  • Constructor Details

    • AbstractModel

      public AbstractModel()
  • Method Details

    • firePropertyChange

      public void firePropertyChange(String property, Object oldValue, Object newValue)
      Fires a property change event.
      Parameters:
      property - Property related to the event.
      oldValue - Old value of property.
      newValue - New value of property.
    • addItemToList

      protected <T> void addItemToList(T item, List<T> list, Enum<?> addEvent)
      Helper method to add an Item to a List.
      Type Parameters:
      T - Item type.
      Parameters:
      item - Item to add to list.
      list - List to have item to add.
      addEvent - Event to fire on item being added.
    • removeItemFromList

      protected <T> void removeItemFromList(T item, List<T> list, Enum<?> removeEvent)
      Helper method to remove an Item from a List.
      Type Parameters:
      T - Item type.
      Parameters:
      item - Item to remove from list.
      list - List to have item removed.
      removeEvent - Event to fire on item being removed.
    • changeField

      protected <T> void changeField(T oldValue, T newValue, Enum<?> changeEvent)
      Helper method to change a field.
      Type Parameters:
      T - Value type.
      Parameters:
      oldValue - Old value of field.
      newValue - New value of field.
      changeEvent - Event to fire if field is being changed.
    • getX

      public int getX()
      Description copied from interface: Model
      Obtains the X co-ordinate for the model.
      Specified by:
      getX in interface Model
      Returns:
      X co-ordinate for the model.
    • setX

      public void setX(int x)
      Description copied from interface: Model
      Specifies the X co-ordinate for the model.
      Specified by:
      setX in interface Model
      Parameters:
      x - X co-ordinate for the model.
    • getY

      public int getY()
      Description copied from interface: Model
      Obtains the Y co-ordinate for the model.
      Specified by:
      getY in interface Model
      Returns:
      Y co-ordinate for the model.
    • setY

      public void setY(int y)
      Description copied from interface: Model
      Specifies the Y co-ordinate for the model.
      Specified by:
      setY in interface Model
      Parameters:
      y - Y co-ordinate for the model.
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Description copied from interface: Model
      Adds a PropertyChangeListener to this model element.
      Specified by:
      addPropertyChangeListener in interface Model
      Parameters:
      listener - PropertyChangeListener to this model element.
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Description copied from interface: Model
      Removes a PropertyChangeListener from this model element.
      Specified by:
      removePropertyChangeListener in interface Model
      Parameters:
      listener - PropertyChangeListener.