|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--gui.ChartComp
This class is an extension of a JPanel. It's backgound is that of scale map corresponding to real world GPS coordinates. Agents are drawn on the JPanel, and can be dragged around the map. also wirelss ranges are drawn on each Agent if requested by the iSIM user.
Nested Class Summary |
Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
private util.ChartData |
chartdata
The chart data that contains map display and gps information. |
private boolean |
clicked
True if when user clicks to move an agent on map. |
private controller.Controller |
controller
The controller of the simulation. |
private java.util.Date |
doubleclick
A time for keeping track of double-clicking. |
private java.awt.Image |
img
Holds the map image. |
private java.awt.Point |
pos
The point of key/center agent for drawing. |
private gui.PropDialog |
propDialog
A Dialog Window for display User information. |
private boolean |
ranges
True if this JComponent is to display wireless ranges. |
private int |
x_offset
Offset position on an agent when mouse-dragging. |
private int |
y_offset
Offset position on an agent when mouse-dragging. |
Fields inherited from class javax.swing.JPanel |
|
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.Container |
|
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 | |
ChartComp(controller.Controller controller,
boolean ranges)
The constructor sets up mouse listeners and sets up its own variables with the given ones. |
Method Summary | |
private double |
diff(java.awt.Point p1,
java.awt.Point p2)
This method returns the pixel distance between two points. |
(package private) void |
draw(java.awt.Graphics g,
java.util.Vector users,
java.util.Vector points)
|
util.ChartData |
getChartData()
This method returns the chartdata kept inside this object used for turning pixel coordinates into real GPS coordinates. |
java.awt.Dimension |
getPreferredSize()
This method returns our preferred size which should be the size of the map image that this object displays. |
void |
loadChart(java.lang.String name)
This method loads new chart data, by first reading the given xml file which contains map name and reference point information. |
void |
mouseClicked(java.awt.event.MouseEvent e)
This method checks for two kinds of mouse clicks. |
void |
mouseDragged(java.awt.event.MouseEvent e)
This method is for moving an Agent around on the map. |
void |
mouseEntered(java.awt.event.MouseEvent e)
This method not used. |
void |
mouseExited(java.awt.event.MouseEvent e)
This method not used. |
void |
mouseMoved(java.awt.event.MouseEvent e)
This method not used. |
void |
mousePressed(java.awt.event.MouseEvent e)
This method is used to get the offset position when we click and drag an agent on the map. |
void |
mouseReleased(java.awt.event.MouseEvent e)
This method lets the object know that the user has released from a mouse drag. |
void |
movePoint(int x,
int y)
|
void |
paint()
|
void |
paint(java.awt.Graphics g)
|
void |
plottPos(java.awt.Point pos,
java.util.Vector users,
java.util.Vector points)
|
void |
readData(java.lang.String file_name)
This method loads new chart data, by first reading the given xml file which contains map name and reference point information. |
void |
setRanges(boolean ranges)
This method to tell this object whether or not it should paint the wireless range for each agent in the simulation. |
void |
timeOut()
|
void |
update(java.awt.Graphics g)
|
void |
updatePos(java.awt.Point pos,
java.util.Vector users,
java.util.Vector points)
|
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
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, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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 |
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 |
Field Detail |
private controller.Controller controller
private util.ChartData chartdata
private boolean clicked
private boolean ranges
private java.awt.Image img
private java.awt.Point pos
private int x_offset
private int y_offset
private java.util.Date doubleclick
private gui.PropDialog propDialog
Constructor Detail |
public ChartComp(controller.Controller controller, boolean ranges)
controller
- The controller of simulation.ranges
- True if displaying wireless ranges.Method Detail |
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
void draw(java.awt.Graphics g, java.util.Vector users, java.util.Vector points)
public void plottPos(java.awt.Point pos, java.util.Vector users, java.util.Vector points)
public void updatePos(java.awt.Point pos, java.util.Vector users, java.util.Vector points)
public void movePoint(int x, int y)
public void timeOut()
public void update(java.awt.Graphics g)
update
in class javax.swing.JComponent
public void paint()
public void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
e
- The incoming MouseEvent containing button and point info.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
e
- The incoming MouseEvent containing button and point info.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
e
- The incoming MouseEvent containing button and point info.public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
e
- The incoming MouseEvent containing button and point info.public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
e
- public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
e
- public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
e
- public void setRanges(boolean ranges)
ranges
- True if want to show wireless ranges.private double diff(java.awt.Point p1, java.awt.Point p2)
p1
- The first point.p2
- The second point.public util.ChartData getChartData()
public void loadChart(java.lang.String name)
name
- file name for new data to use.public void readData(java.lang.String file_name)
file_name
- Name of XML file that contains new ChartData info.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |