Package net.officefloor.model
Class AbstractModel
java.lang.Object
net.officefloor.model.AbstractModel
- All Implemented Interfaces:
Model
Provides top level functionality for all model elements.
- Author:
- Daniel Sagenschneider
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> voidaddItemToList(T item, List<T> list, Enum<?> addEvent) Helper method to add an Item to a List.voidAdds aPropertyChangeListenerto this model element.protected <T> voidchangeField(T oldValue, T newValue, Enum<?> changeEvent) Helper method to change a field.voidfirePropertyChange(String property, Object oldValue, Object newValue) Fires a property change event.intgetX()Obtains the X co-ordinate for the model.intgetY()Obtains the Y co-ordinate for the model.protected <T> voidremoveItemFromList(T item, List<T> list, Enum<?> removeEvent) Helper method to remove an Item from a List.voidRemoves aPropertyChangeListenerfrom this model element.voidsetX(int x) Specifies the X co-ordinate for the model.voidsetY(int y) Specifies the Y co-ordinate for the model.
-
Constructor Details
-
AbstractModel
public AbstractModel()
-
-
Method Details
-
firePropertyChange
Fires a property change event.- Parameters:
property- Property related to the event.oldValue- Old value of property.newValue- New value of property.
-
addItemToList
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
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
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:ModelObtains the X co-ordinate for the model. -
setX
public void setX(int x) Description copied from interface:ModelSpecifies the X co-ordinate for the model. -
getY
public int getY()Description copied from interface:ModelObtains the Y co-ordinate for the model. -
setY
public void setY(int y) Description copied from interface:ModelSpecifies the Y co-ordinate for the model. -
addPropertyChangeListener
Description copied from interface:ModelAdds aPropertyChangeListenerto this model element.- Specified by:
addPropertyChangeListenerin interfaceModel- Parameters:
listener-PropertyChangeListenerto this model element.
-
removePropertyChangeListener
Description copied from interface:ModelRemoves aPropertyChangeListenerfrom this model element.- Specified by:
removePropertyChangeListenerin interfaceModel- Parameters:
listener-PropertyChangeListener.
-