cad.simcad.pathfinding.ui.map
Class MapFieldPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--cad.simcad.pathfinding.ui.map.MapDisplayer
                          |
                          +--cad.simcad.pathfinding.ui.map.MapFieldPanel
All Implemented Interfaces:
AbstractMapEventListener, java.util.EventListener, java.awt.image.ImageObserver, MapUIEventListener, java.awt.MenuContainer, PathPlaceEventListener, javax.swing.Scrollable, java.io.Serializable

public class MapFieldPanel
extends MapDisplayer
implements javax.swing.Scrollable, AbstractMapEventListener, PathPlaceEventListener

This is the panel with the map. It implements the MapEventListener interface

Author:
Charles-Philip Bentley
See Also:
Serialized Form

Field Summary
 
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
MapFieldPanel(AStarInterface frame, UIMediator uim, SimMediator sm)
          Creates new form MapFieldPanel
 
Method Summary
 void addObject(PathPlace pp)
           
 void blankMap()
           
 void cellRightClicked(GridCell gc)
           
 void cellSelected(GridCell gc)
           
 void computePath()
           
 void computePath(PathUser pu, PathPlace origin, PathPlace dest)
           
 void computeProductivePath(PathUser pu, PathPlace origin, PathPlace dest)
           
 boolean drawBorder()
           
 int getActiveControlTabbed()
           
 int getBottomY()
           
 boolean getDoWork()
           
 java.awt.Color getFillerColor(Filler fil)
           
 java.awt.Image getFillerImage(Filler fil)
           
 Filler getFillerTypeSelected()
           
 GridCell getFinishCell()
           
 java.awt.Dimension getMinimumSize()
           
 int getMode()
           
 SimObject getObject(MapUnit mu)
          Returns the Object (possibly null) on the MapUnit mu
 java.awt.Image getObjectImage(SimObject so)
           
 java.awt.Dimension getPreferredScrollableViewportSize()
           
 java.awt.Dimension getPreferredSize()
           
 AbstractMap getRenderedMap()
           
 int getRightX()
           
 int getScrollableBlockIncrement(java.awt.Rectangle rectangle, int param, int param2)
           
 boolean getScrollableTracksViewportHeight()
           
 boolean getScrollableTracksViewportWidth()
           
 int getScrollableUnitIncrement(java.awt.Rectangle rectangle, int param, int param2)
           
 Filler getSelectedFiller()
           
 PathUser getSelectedPathUser()
          Returns the a new instance PathUser selected in the user interface
 Selection getSelection()
          Return emptry selection
 GridCell getStartCell()
           
 UIMediator getUIMed()
          Returns the UIMediator
 int getViewableHeight()
           
 int getViewableWidth()
           
 int getXCentered()
           
 int getYCentered()
           
 boolean isShowValues()
           
 boolean isStartSet()
           
 boolean isThereObject(MapUnit pu)
           
 void mapPlaceStateChanged(PathPlaceEvent p)
           
 void newMapOpened(AbstractMap am)
           
 void noticeModeChange(java.lang.String s)
           
 void noticeMouseReleased()
           
 void pathComputed(AbstractMapEvent p)
          This method deal with the event of a computed path, fired by an AbstractMap The AbstractMapEvent object has the computed path
 void redoLastAction()
           
 void refreshAllCells()
           
 void resetAllCells()
          Reset all the cells of the map object this container is rendering We call the resetAllCells on the map object
 void resetFinishCell()
           
 void resetPathCells()
           
 void resetStartCell()
           
 void setDoWork(boolean doWork)
           
 void setDrawBorder(boolean b)
           
 void setEditMode(int mode)
           
 void setFinishCell(GridCell gc)
           
 void setShowCoordinate(boolean b)
           
 void setShowValues(boolean b)
           
 void setSizeOfCells(int value)
           
 void setStartCell(GridCell gc)
          According to flag, if flag is true Set the GridCell given in parameter as the starting cell if flag is false Set the GridCell as a normal cell
 boolean showCoordinate()
           
 boolean showFillerImages()
           
 void shwErrMsg(java.lang.String err)
           
 void updateAllVisualComponents()
           
 void updateMiniMap()
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapFieldPanel

public MapFieldPanel(AStarInterface frame,
                     UIMediator uim,
                     SimMediator sm)
Creates new form MapFieldPanel

Method Detail

setShowValues

public void setShowValues(boolean b)
Specified by:
setShowValues in class MapDisplayer

isShowValues

public boolean isShowValues()

getUIMed

public UIMediator getUIMed()
Returns the UIMediator


getObject

public SimObject getObject(MapUnit mu)
Returns the Object (possibly null) on the MapUnit mu


getFillerImage

public java.awt.Image getFillerImage(Filler fil)

getObjectImage

public java.awt.Image getObjectImage(SimObject so)

cellSelected

public void cellSelected(GridCell gc)

cellRightClicked

public void cellRightClicked(GridCell gc)

addObject

public void addObject(PathPlace pp)

newMapOpened

public void newMapOpened(AbstractMap am)
Specified by:
newMapOpened in interface MapUIEventListener
Specified by:
newMapOpened in class MapDisplayer

isThereObject

public boolean isThereObject(MapUnit pu)

updateAllVisualComponents

public void updateAllVisualComponents()

updateMiniMap

public void updateMiniMap()

shwErrMsg

public void shwErrMsg(java.lang.String err)

getFillerColor

public java.awt.Color getFillerColor(Filler fil)

showFillerImages

public boolean showFillerImages()

getRightX

public int getRightX()
Specified by:
getRightX in class MapDisplayer

getBottomY

public int getBottomY()
Specified by:
getBottomY in class MapDisplayer

getXCentered

public int getXCentered()
Specified by:
getXCentered in class MapDisplayer

getYCentered

public int getYCentered()
Specified by:
getYCentered in class MapDisplayer

getViewableWidth

public int getViewableWidth()
Specified by:
getViewableWidth in class MapDisplayer
Returns:
the number of pixel shown

getViewableHeight

public int getViewableHeight()
Specified by:
getViewableHeight in class MapDisplayer

drawBorder

public boolean drawBorder()

setDrawBorder

public void setDrawBorder(boolean b)
Specified by:
setDrawBorder in class MapDisplayer

setSizeOfCells

public void setSizeOfCells(int value)
Specified by:
setSizeOfCells in class MapDisplayer

setShowCoordinate

public void setShowCoordinate(boolean b)
Specified by:
setShowCoordinate in class MapDisplayer

showCoordinate

public boolean showCoordinate()
Specified by:
showCoordinate in class MapDisplayer

getStartCell

public GridCell getStartCell()

getFinishCell

public GridCell getFinishCell()

setStartCell

public void setStartCell(GridCell gc)
According to flag, if flag is true Set the GridCell given in parameter as the starting cell if flag is false Set the GridCell as a normal cell


setFinishCell

public void setFinishCell(GridCell gc)

resetStartCell

public void resetStartCell()

resetFinishCell

public void resetFinishCell()

blankMap

public void blankMap()
Specified by:
blankMap in class MapDisplayer

resetAllCells

public void resetAllCells()
Reset all the cells of the map object this container is rendering We call the resetAllCells on the map object

Specified by:
resetAllCells in class MapDisplayer

resetPathCells

public void resetPathCells()

refreshAllCells

public void refreshAllCells()

computePath

public void computePath()
Specified by:
computePath in class MapDisplayer

computePath

public void computePath(PathUser pu,
                        PathPlace origin,
                        PathPlace dest)

computeProductivePath

public void computeProductivePath(PathUser pu,
                                  PathPlace origin,
                                  PathPlace dest)

isStartSet

public boolean isStartSet()
Specified by:
isStartSet in class MapDisplayer

getSelectedPathUser

public PathUser getSelectedPathUser()
Returns the a new instance PathUser selected in the user interface

Specified by:
getSelectedPathUser in class MapDisplayer

getSelectedFiller

public Filler getSelectedFiller()

noticeMouseReleased

public void noticeMouseReleased()
Specified by:
noticeMouseReleased in class MapDisplayer

setDoWork

public void setDoWork(boolean doWork)

getDoWork

public boolean getDoWork()

getActiveControlTabbed

public int getActiveControlTabbed()

getMode

public int getMode()
Specified by:
getMode in class MapDisplayer

setEditMode

public void setEditMode(int mode)
Specified by:
setEditMode in class MapDisplayer

noticeModeChange

public void noticeModeChange(java.lang.String s)
Specified by:
noticeModeChange in class MapDisplayer

getPreferredSize

public java.awt.Dimension getPreferredSize()
Specified by:
getPreferredSize in class MapDisplayer

getMinimumSize

public java.awt.Dimension getMinimumSize()
Specified by:
getMinimumSize in class MapDisplayer

getFillerTypeSelected

public Filler getFillerTypeSelected()

getRenderedMap

public AbstractMap getRenderedMap()

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Specified by:
getScrollableTracksViewportWidth in interface javax.swing.Scrollable

getPreferredScrollableViewportSize

public java.awt.Dimension getPreferredScrollableViewportSize()
Specified by:
getPreferredScrollableViewportSize in interface javax.swing.Scrollable

getScrollableUnitIncrement

public int getScrollableUnitIncrement(java.awt.Rectangle rectangle,
                                      int param,
                                      int param2)
Specified by:
getScrollableUnitIncrement in interface javax.swing.Scrollable

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Specified by:
getScrollableTracksViewportHeight in interface javax.swing.Scrollable

getScrollableBlockIncrement

public int getScrollableBlockIncrement(java.awt.Rectangle rectangle,
                                       int param,
                                       int param2)
Specified by:
getScrollableBlockIncrement in interface javax.swing.Scrollable

pathComputed

public void pathComputed(AbstractMapEvent p)
This method deal with the event of a computed path, fired by an AbstractMap The AbstractMapEvent object has the computed path

Specified by:
pathComputed in interface AbstractMapEventListener

mapPlaceStateChanged

public void mapPlaceStateChanged(PathPlaceEvent p)
Specified by:
mapPlaceStateChanged in interface PathPlaceEventListener

getSelection

public Selection getSelection()
Return emptry selection

Specified by:
getSelection in class MapDisplayer

redoLastAction

public void redoLastAction()
Specified by:
redoLastAction in class MapDisplayer

Logo

With the help of www.sourceforge.net and www.info.ucl.ac.be