|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.umlv.lawrence.GridModel<E>
fr.umlv.lawrence.DefaultGridModel<E>
E - type of cell elements.public class DefaultGridModel<E>
Default implementation of a GridModel whose back end are two ArrayList (for double buffering), where update can either be direct, or using back buffer
| Constructor Summary | |
|---|---|
DefaultGridModel(Collection<? extends E>[][] init)
Construct of GridModel, given its dimension and the initial content of each cells |
|
DefaultGridModel(int width,
int height)
|
|
DefaultGridModel(int width,
int height,
Collection<? extends E> defaultValue)
Construct of GridModel, given its dimension and the initial content of each cells |
|
| Method Summary | |
|---|---|
void |
addDeffered(int x,
int y,
E element)
Add an element to cell (x,y), asking the change to be done in the back buffer, and only displayed by a call to swap(). |
void |
addGridListener(GridListener listener)
Register a GridListener to be notified of changes in the model |
boolean |
contains(Location location)
Returns if a location lies within the model |
int |
getHeight()
|
int |
getWidth()
|
void |
insertDeffered(int x,
int y,
E element,
int position)
Insert an element in cell (x,y), asking the change to be done in the back buffer, and only displayed by a call to swap(). |
void |
removeAtDeffered(int x,
int y,
int position)
remove element to cell (x,y), asking the change to be done in the back buffer, and only displayed by a call to swap(). |
void |
removeDeffered(int x,
int y,
E element)
remove element to cell (x,y), asking the change to be done in the back buffer, and only displayed by a call to swap(). |
void |
removeGridListener(GridListener listener)
Remove a GridListener notified of changes in the model |
void |
setAtDeffered(int x,
int y,
E element,
int position)
set element to cell (x,y), asking the change to be done in the back buffer, and only displayed by a call to swap(). |
void |
setDeffered(int x,
int y,
Collection<? extends E> elements)
Change all elements of cell (x,y), asking the change to be done in the back buffer, and only displayed by a call to swap(). |
void |
setHighligthElement(int x,
int y,
E element)
Set or remove the highlight element at a location. |
void |
setHighligthElement(Location location,
E element)
Set or remove the highlight element at a location. |
void |
swap()
Ask deferred changes to become effective. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultGridModel(int width,
int height,
Collection<? extends E> defaultValue)
height - height of the gridwidth - width of the griddefaultValue - elements of all cells
public DefaultGridModel(int width,
int height)
public DefaultGridModel(Collection<? extends E>[][] init)
init - initial values of the model, first coordinate is abscisse and second is ordinate| Method Detail |
|---|
public int getHeight()
getHeight in class GridModel<E>public int getWidth()
getWidth in class GridModel<E>
public void setHighligthElement(int x,
int y,
E element)
x - the abscissa of the highlight element.y - the ordinate of the highlight element.element - the highlight element or null to remove it.
public void setHighligthElement(Location location,
E element)
location - the location of the highlight element.element - the highlight element or null.
public void addDeffered(int x,
int y,
E element)
swap().
x - x coordinate of the celly - y coordinate of the cellelement - new cell contentswap()
public void insertDeffered(int x,
int y,
E element,
int position)
swap().
x - x coordinate of the celly - y coordinate of the cellelement - new cell contentposition - position to insert the elementswap()
public void setAtDeffered(int x,
int y,
E element,
int position)
swap().
x - x coordinate of the celly - y coordinate of the cellelement - new cell contentposition - position to insert the elementswap()
public void removeDeffered(int x,
int y,
E element)
swap().
x - x coordinate of the celly - y coordinate of the cellelement - to removeswap()
public void removeAtDeffered(int x,
int y,
int position)
swap().
x - x coordinate of the celly - y coordinate of the cellposition - the position of the element in the cell to removeswap()
public void setDeffered(int x,
int y,
Collection<? extends E> elements)
swap().
x - x coordinate of the celly - y coordinate of the cellelements - new cell contentswap()public void swap()
setDeffered(int, int, Collection)public void addGridListener(GridListener listener)
GridModel
addGridListener in class GridModel<E>listener - the GridListener to registerpublic void removeGridListener(GridListener listener)
GridModel
removeGridListener in class GridModel<E>listener - the GridListener to removepublic boolean contains(Location location)
location - the location
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||