|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
fr.lip6.sma.simulacion.app.map.MapPanel
fr.lip6.sma.simulacion.app.map.MapMultiCellPanel
public abstract class MapMultiCellPanel
Classe de base pour décomposer une carte de jeu en zones appelée "cell"s. Motivations: découpler la gestion des agents de celle des interactions, fournir un moyen de localisation de haut niveau, gestion locale des agents.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
private Map |
mAgentsCells
Map of the cell of agents. |
private MapCell[][] |
mCells
The cell map. |
private MapMultiCellController |
mController
Controller of the map and its cells |
private MapMultiCellModel |
mModel
Model to the map data. |
private int |
mNumCellX
Number of cells on the map, X axis. |
private int |
mNumCellY
Number of cells on the map, Y axis. |
private MapShapesModel |
mShapesModel
Model to the shapes of the agents. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
MapMultiCellPanel(MapMultiCellModel inModel,
MapMultiCellGameController inGameController,
MapPanelListener inMapListener,
String inLocalAgentName,
MapShapesModel inShapesModel)
Constructor from models, a controller, a map listener and the name of the local agent. |
Method Summary | |
---|---|
void |
addNotify()
Method called when the map is shown. |
protected abstract MapCell |
createMapCell(int inXCoord,
int inYCoord)
Création d'une cellule pour la carte. |
private void |
doUpdateAgentPosition(String inAgentName,
Point inOldPosition,
Point inNewPosition)
Update the position of an agent. |
MapCell |
getCell(Point inPosition)
Retrieve a cell from a position. |
Point |
getLocationFromString(String inLocationProperty)
Détermine la position à partir d'une chaîne. |
protected void |
initCells()
Initialize the cells. |
void |
propertyChange(PropertyChangeEvent inEvent)
Inherited from the PropertyChangeListener class. |
void |
removeNotify()
Method called when the map is removed. |
private void |
updateAgentPosition(String inAgentName,
Point inOldPosition,
Point inNewPosition)
Update the position of an agent. |
protected void |
updateSelection(Set inSelectedAgents)
Méthode appelée lorsque la sélection a changé. |
Methods inherited from class fr.lip6.sma.simulacion.app.map.MapPanel |
---|
getAllowMultipleSelection, getLocalAgentName, getMapListener, getSelectedAgents, getSelectedAgentsSet, isAgentOnMap, selectAgent, selectAgents, setAllowMultipleSelection |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final MapMultiCellController mController
private final MapMultiCellModel mModel
private final MapShapesModel mShapesModel
private final MapCell[][] mCells
private final Map mAgentsCells
private final int mNumCellX
private final int mNumCellY
Constructor Detail |
---|
public MapMultiCellPanel(MapMultiCellModel inModel, MapMultiCellGameController inGameController, MapPanelListener inMapListener, String inLocalAgentName, MapShapesModel inShapesModel)
inModel
- model for the map.inGameController
- controller for the map.inMapListener
- référence sur le gestionnaire.inLocalAgentName
- nom de l'agent local.inShapesModel
- model avec les formes des agents.Method Detail |
---|
protected void initCells()
public void addNotify()
addNotify
in class JComponent
public void removeNotify()
removeNotify
in class JComponent
public Point getLocationFromString(String inLocationProperty)
inLocationProperty
- chaîne pour la position (dans le fichier XML)
protected final void updateSelection(Set inSelectedAgents)
updateSelection
in class MapPanel
inSelectedAgents
- la liste des noms des agents sélectionnés. (le processus léger
courant possde le moniteur dessus).public MapCell getCell(Point inPosition)
inPosition
- position of the cell to retrieve.
private void updateAgentPosition(String inAgentName, Point inOldPosition, Point inNewPosition)
inAgentName
- name of the agent.inOldPosition
- old position of the agent.inNewPosition
- new position of the agent.private void doUpdateAgentPosition(String inAgentName, Point inOldPosition, Point inNewPosition)
inAgentName
- name of the agent.inOldPosition
- old position of the agent, null
if the
agent appeared.inNewPosition
- new position of the agent, null
if the
agent disappeared.public void propertyChange(PropertyChangeEvent inEvent)
propertyChange
in interface PropertyChangeListener
inEvent
- The event to process.protected abstract MapCell createMapCell(int inXCoord, int inYCoord)
inXCoord
- coordonnée X de la cellule.inYCoord
- coordonnée Y de la cellule.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |