framework
Class POIElement

java.lang.Object
  extended by no.tellu.cdlc.gui.GuiElement
      extended by framework.POIElement
All Implemented Interfaces:
no.tellu.cdlc.gui.ElementListner

public class POIElement
extends no.tellu.cdlc.gui.GuiElement

POIElement.java

Draws the points of interest in a map. The POIs can be selected by pressing the number (1-9) they are represented by. When a POI is selected, a popup with some information is drawn. Choosing POIs is done by pressing the fire button.

The POIElement is used together with MapElement and MapLayout in a panel.


Field Summary
 
Fields inherited from class no.tellu.cdlc.gui.GuiElement
ANY, DECIMAL, EMAILADDR, NUMERIC, PASSWORD, PASSWORD_NUMERIC, PHONENUMBER, URL
 
Constructor Summary
POIElement(java.lang.String elementId, int mapWidth, int mapHeight, MapObject map, int maxNumberOfPOIsToSave)
          Constructor POIElement
 
Method Summary
 void deleteSavedPOI()
          Deletes a saved POI
 boolean fire(int arg0)
          Saves the selected POI if it is not saved, deletes it otherwise.
 int getMaxNumberOfPOIsToSave()
           
 int getPOIIndexInSavedVector(POIObject poiObjectOnMap)
          Finds the index number of a POI in the saved POIs vector
 java.util.Vector getSavedPOIs()
           
 POIObject getSelectedPOI()
           
 boolean numberPressed(int key)
          Keeps control of which kindergarten is selected by the user.
 void paint(javax.microedition.lcdui.Graphics g, boolean selected)
          Paints the selectable and not selectable points of interest.
 boolean savePOI()
          Saves a POI in the saved POIs vector
 void setMaxNumberOfPOIsToSave(int maxNumberOfPOIsToChoose)
          Sets the highest number of kindergartens possible to save.
 void setSavedPOIs(java.util.Vector savedPOIs)
          Sets the saved POIs.
 void setSelectedPOI(POIObject selectedPOI)
          Sets the selected point of interest.
 
Methods inherited from class no.tellu.cdlc.gui.GuiElement
backPressed, callbackAction, changeFont, charPressed, clearButton, clearFields, contains, countCharactersToWidth, countCharactersToWidth, drawBorder, drawBorder, drawString, drawString, elementLayoutManager, getComponentAt, getCurrGuiElement, getElement, getElementId, getFieldColour, getFieldType, getFont, getFontColour, getHeight, getHelpString, getInnerheight, getInnerWidth, getInsetBottom, getInsetLeft, getInsetRight, getInsetTop, getLabel, getLineColour, getMaxCharacters, getMaxHeight, getMaxWidth, getMinCharacters, getParent, getPreferredHeight, getPreferredWidth, getSoundFileName, getValue, getWidth, getWidtOfString, getWidtOfString, getX, getY, init, isAllElementsComplete, isBorderVisible, isEditable, isFocused, isHidden, isInputValidated, isLayoutNeeded, isMaximumSizeSet, isPreferredHeightSizeSet, isPreferredSizeSet, isPreferredWidhtSizeSet, isSelectable, isVisible, moveDown, moveLeft, moveRight, moveToShow, moveUp, paint, paint, poundPressed, remove, replaceTabInString, setAutoLayout, setBorderVisible, setBounds, setDrawBackground, setEditable, setElementId, setElementListner, setElementPosition, setFieldType, setFocused, setFont, setFrameSize, setGroupElement, setHeight, setHelpString, setHidden, setInsetBottom, setInsetLeft, setInsetRight, setInsets, setInsetTop, setLabel, setLayoutNeeded, setLayoutNeeded, setMaxCharacters, setMaximumSize, setMinCharacters, setParent, setPreferredSize, setSelectable, setSize, setSoundFileName, setWidth, setX, setY, starPressed, truncate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

POIElement

public POIElement(java.lang.String elementId,
                  int mapWidth,
                  int mapHeight,
                  MapObject map,
                  int maxNumberOfPOIsToSave)
Constructor POIElement

Parameters:
elementId - The id of the object of this class
mapHeight - The map height to be set
map - The object containing the map information
maxNumberOfPOIsToSave - The maximum number of POIS that can be saved
Method Detail

paint

public void paint(javax.microedition.lcdui.Graphics g,
                  boolean selected)
Paints the selectable and not selectable points of interest.

Overrides:
paint in class no.tellu.cdlc.gui.GuiElement

savePOI

public boolean savePOI()
Saves a POI in the saved POIs vector

Returns:
false if the POI already has been saved, true otherwise

deleteSavedPOI

public void deleteSavedPOI()
Deletes a saved POI


getPOIIndexInSavedVector

public int getPOIIndexInSavedVector(POIObject poiObjectOnMap)
Finds the index number of a POI in the saved POIs vector

Parameters:
poiObjectOnMap - the POI to be searched for
Returns:
the index number or -1 if the POI isn't in the vector

getSavedPOIs

public java.util.Vector getSavedPOIs()
Returns:
the vector with saved points of interest

setSavedPOIs

public void setSavedPOIs(java.util.Vector savedPOIs)
Sets the saved POIs.

Parameters:
savedPOIs - the vector with saved POIs

numberPressed

public boolean numberPressed(int key)
Keeps control of which kindergarten is selected by the user.

Overrides:
numberPressed in class no.tellu.cdlc.gui.GuiElement

fire

public boolean fire(int arg0)
Saves the selected POI if it is not saved, deletes it otherwise.

Overrides:
fire in class no.tellu.cdlc.gui.GuiElement

getMaxNumberOfPOIsToSave

public int getMaxNumberOfPOIsToSave()
Returns:
the highest number of kindergartens possible to save.

setMaxNumberOfPOIsToSave

public void setMaxNumberOfPOIsToSave(int maxNumberOfPOIsToChoose)
Sets the highest number of kindergartens possible to save.

Parameters:
maxNumberOfPOIsToChoose - the highest number of kindergartens possible to save

getSelectedPOI

public POIObject getSelectedPOI()
Returns:
the selected point of interest

setSelectedPOI

public void setSelectedPOI(POIObject selectedPOI)
Sets the selected point of interest.

Parameters:
selectedPOI - the point of interest to be set as selected