gui
Class MapBox

java.lang.Object
  extended by gui.dialog.JAPDialog
      extended by gui.MapBox
All Implemented Interfaces:
IDialogOptions, java.awt.image.ImageObserver, java.awt.MenuContainer, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class MapBox
extends JAPDialog
implements javax.swing.event.ChangeListener

This class provides a dialog showing a map section loaded from Yahoo(R) according to the specified latitude and longitude.


Nested Class Summary
private  class MapBox.SiteParser
          A subclass of javax.swing.text.html.HTMLEditorKit.ParserCallback that parses the HTML page requested from http://maps.yahoo.com and searches for the URL of the actual map image.
 
Nested classes/interfaces inherited from class gui.dialog.JAPDialog
JAPDialog.AbstractLinkedURLAdapter, JAPDialog.ILinkedInformation, JAPDialog.LinkedCheckBox, JAPDialog.LinkedHelpContext, JAPDialog.LinkedInformation, JAPDialog.LinkedInformationAdapter, JAPDialog.LinkedURLCheckBox, JAPDialog.Options
 
Field Summary
private static java.lang.String KEY
          Key that is needed for querying maps
private  javax.swing.JButton m_btnClose
          Close button
private  javax.swing.JLabel m_lblMap
          The label containing the map in form of an ImageIcon
private  java.lang.String m_sImageSize
          Desired size of the map image
private  java.lang.String m_sImageURL
          The URL pointing to the map image
private  java.lang.String m_sLatitude
          The latitude of the center of the map
private  javax.swing.JSlider m_sldZoom
          The slider for adjusting zoom level
private  java.lang.String m_sLongitude
          The longitude of the center of the map
private static java.lang.String MSG_CLOSE
           
private static java.lang.String MSG_ERROR_WHILE_LOADING
          Messages
private static java.lang.String MSG_PLEASE_WAIT
           
private static java.lang.String MSG_TITLE
           
private static java.lang.String MSG_ZOOM
           
 
Fields inherited from class gui.dialog.JAPDialog
FORMAT_DEFAULT_SCREEN, FORMAT_GOLDEN_RATIO_PHI, FORMAT_WIDE_SCREEN, MSG_BTN_PROCEED, MSG_BTN_RETRY, MSG_ERROR_UNDISPLAYABLE, MSG_ERROR_UNKNOWN, MSG_TITLE_CONFIRMATION, MSG_TITLE_ERROR, MSG_TITLE_INFO, MSG_TITLE_WARNING, XML_ATTR_OPTIMIZED_FORMAT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Fields inherited from interface gui.dialog.IDialogOptions
MESSAGE_TYPE_ERROR, MESSAGE_TYPE_INFORMATION, MESSAGE_TYPE_PLAIN, MESSAGE_TYPE_QUESTION, MESSAGE_TYPE_WARNING, OPTION_TYPE_CANCEL, OPTION_TYPE_DEFAULT, OPTION_TYPE_EMPTY, OPTION_TYPE_OK_CANCEL, OPTION_TYPE_YES_NO, OPTION_TYPE_YES_NO_CANCEL, RETURN_VALUE_CANCEL, RETURN_VALUE_CLOSED, RETURN_VALUE_NO, RETURN_VALUE_OK, RETURN_VALUE_UNINITIALIZED, RETURN_VALUE_YES
 
Constructor Summary
MapBox(java.awt.Component parent, java.lang.String lat, java.lang.String lon, int level)
          Constructs a new MapBox instance.
 
Method Summary
private  void refresh()
          Contact Google Maps to (re-)load the map.
 void setGeo(java.lang.String a_latitude, java.lang.String a_longitude)
          Sets the coordinates to be displayed on the map.
 void setVisible(boolean a_bVisible)
          Shows or hides the dialog.
 void stateChanged(javax.swing.event.ChangeEvent e)
           
 
Methods inherited from class gui.dialog.JAPDialog
addComponentListener, addWindowListener, dispose, doClosingOnContentPaneCancel, getAccessibleContext, getContentPane, getDefaultCloseOperation, getFont, getGlassPane, getInsets, getJMenuBar, getLayeredPane, getLocation, getName, getOptimizedFormat, getOptimizedFormatDelta, getOptimizedFormatDelta, getOptimizedFormatInternal, getOwner, getParentComponent, getPreferredSize, getRootPane, getScreenBounds, getSize, getTitle, imageUpdate, isClosingOnContentPaneCancel, isConsoleOnly, isDisposed, isEnabled, isModal, isResizable, isVisible, moveToUpRightCorner, pack, postEvent, remove, removeComponentListener, removeWindowListener, requestFocus, resetAutomaticLocation, restoreLocation, restoreSize, retrieveErrorMessage, setAlwaysOnTop, setConsoleOnly, setContentPane, setDefaultCloseOperation, setDockable, setEnabled, setGlassPane, setJMenuBar, setLayeredPane, setLocation, setLocation, setLocationCenteredOn, setLocationCenteredOnOwner, setLocationCenteredOnParent, setLocationCenteredOnScreen, setLocationRelativeToOwner, setModal, setName, setOptimizedFormat, setResizable, setSize, setSize, setTitle, setVisible, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showConfirmDialog, showErrorDialog, showErrorDialog, showErrorDialog, showErrorDialog, showErrorDialog, showErrorDialog, showErrorDialog, showErrorDialog, showErrorDialog, showErrorDialog, showErrorDialog, showErrorDialog, showErrorDialog, showErrorDialog, showErrorDialog, showMessageDialog, showMessageDialog, showMessageDialog, showMessageDialog, showMessageDialog, showMessageDialog, showMessageDialog, showMessageDialog, showMessageDialog, showMessageDialog, showMessageDialog, showMessageDialog, showMessageDialog, showMessageDialog, showMessageDialog, showMessageDialog, showWarningDialog, showWarningDialog, showWarningDialog, showWarningDialog, showWarningDialog, showWarningDialog, showWarningDialog, showWarningDialog, showYesNoDialog, showYesNoDialog, showYesNoDialog, showYesNoDialog, showYesNoDialog, showYesNoDialog, showYesNoDialog, showYesNoDialog, toBack, toFront, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MSG_ERROR_WHILE_LOADING

private static final java.lang.String MSG_ERROR_WHILE_LOADING
Messages


MSG_PLEASE_WAIT

private static final java.lang.String MSG_PLEASE_WAIT

MSG_CLOSE

private static final java.lang.String MSG_CLOSE

MSG_TITLE

private static final java.lang.String MSG_TITLE

MSG_ZOOM

private static final java.lang.String MSG_ZOOM

m_lblMap

private javax.swing.JLabel m_lblMap
The label containing the map in form of an ImageIcon


m_sldZoom

private javax.swing.JSlider m_sldZoom
The slider for adjusting zoom level


m_btnClose

private javax.swing.JButton m_btnClose
Close button


m_sImageURL

private java.lang.String m_sImageURL
The URL pointing to the map image


KEY

private static final java.lang.String KEY
Key that is needed for querying maps

See Also:
Constant Field Values

m_sLatitude

private java.lang.String m_sLatitude
The latitude of the center of the map


m_sLongitude

private java.lang.String m_sLongitude
The longitude of the center of the map


m_sImageSize

private java.lang.String m_sImageSize
Desired size of the map image

Constructor Detail

MapBox

public MapBox(java.awt.Component parent,
              java.lang.String lat,
              java.lang.String lon,
              int level)
Constructs a new MapBox instance.

Parameters:
parent - The parent of the dialog window
lat - The latitude of the point to show on the map
lon - The longitude of the point to show on the map
level - The zoom level to be set (0 - 19)
Throws:
java.lang.Exception - If an error occurs
Method Detail

setGeo

public void setGeo(java.lang.String a_latitude,
                   java.lang.String a_longitude)
            throws java.io.IOException
Sets the coordinates to be displayed on the map.

Parameters:
a_latitude - The latitude
a_longitude - The longitude
Throws:
java.io.IOException - If an error occurs while reading the map from www.mapquest.com

setVisible

public void setVisible(boolean a_bVisible)
Description copied from class: JAPDialog
Shows or hides the dialog. If shown, the dialog is centered over the parent component. Subclasses may override this method to change this centering behaviour.

Overrides:
setVisible in class JAPDialog
Parameters:
a_bVisible - 'true' shows the dialog; 'false' hides it

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener

refresh

private void refresh()
Contact Google Maps to (re-)load the map.

Throws:
java.io.IOException - If an error occurs while retrieving the web site