net.aerith.misao.gui
Class ChartComponent

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JLabel
                          |
                          +--net.aerith.misao.gui.ChartComponent
Direct Known Subclasses:
EdittableChartComponent, SinglePropertyChartComponent

public class ChartComponent
extends javax.swing.JLabel
implements PropertyChangedListener

The ChartComponent represents a GUI component to show a star chart.

See Also:
Serialized Form

Inner Class Summary
protected  class ChartComponent.SaveAsListener
          The SaveAsListener is a listener class of menu selection to save the report in the specified catalog.
protected  class ChartComponent.SaveListener
          The SaveListener is a listener class of menu selection to save the report in a file.
 
Inner classes inherited from class javax.swing.JLabel
javax.swing.JLabel.AccessibleJLabel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent, javax.swing.JComponent.IntVector, javax.swing.JComponent.KeyboardBinding, javax.swing.JComponent.KeyboardState
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
protected  boolean basepoint_at_center
          True if the (0,0) represents the center of the chart.
protected  PlotProperty default_property
          The default properties to plot stars.
protected  int folding_characters
          The number of characters to fold the star data in the dialog.
protected  StarPositionList list
          The list of stars to plot.
protected  java.awt.Image offscreen
          The off screen image.
protected  java.awt.Container pane
          The pane of this component.
protected  java.util.Hashtable plot_properties
          The properties to plot stars.
protected  javax.swing.JPopupMenu popup
          The popup menu.
protected  Size size
          The size of chart.
protected  StarClickListener star_click_listener
          The listener of star click event.
 
Fields inherited from class javax.swing.JLabel
defaultIcon, disabledIcon, disabledIconSet, horizontalAlignment, horizontalTextPosition, iconTextGap, LABELED_BY_PROPERTY, labelFor, mnemonic, text, uiClassID, verticalAlignment, verticalTextPosition
 
Fields inherited from class javax.swing.JComponent
_bounds, accessibleContext, alignmentX, alignmentY, ANCESTOR_USING_BUFFER, ancestorNotifier, autoscroller, border, changeSupport, clientProperties, flags, HAS_FOCUS, IS_DOUBLE_BUFFERED, IS_OPAQUE, IS_PAINTING_TILE, KEYBOARD_BINDINGS_KEY, listenerList, maximumSize, minimumSize, NEXT_FOCUS, paintImmediatelyClip, paintingChild, preferredSize, readObjectCallbacks, REQUEST_FOCUS_DISABLED, tmpRect, TOOL_TIP_TEXT_KEY, ui, uiClassID, UNDEFINED_CONDITION, vetoableChangeSupport, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, maxSize, ncomponents, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, assert, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, serialVersionUID, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
ChartComponent(Size initial_size)
          Constructs an empty ChartComponent.
 
Method Summary
 void draw(java.awt.Graphics g)
          Plots stars in the list on the off screen.
 java.awt.Dimension getPreferredSize()
          Gets the preferred size, considering the zoom level.
protected  PlotProperty getProperty(StarPosition star)
          Gets the property of the specified star.
protected  void initPopupMenu()
          Initializes a popup menu.
 void paint(java.awt.Graphics g)
          Updates the view.
protected  void processMouseEvent(java.awt.event.MouseEvent e)
          Invoked when mouse event occurs.
 void propertyChanged()
          Applies the property change.
 void setBasepointAtCenter()
          Sets a flag so that (0,0) represents the center of the chart.
 void setBasepointAtTopLeft()
          Sets a flag so that (0,0) represents the top left corner.
 void setDefaultProperty(PlotProperty property)
          Sets the default property.
 void setProperty(java.lang.String catalog_name, PlotProperty property)
          Sets the property to plot stars of the specified catalog.
 void setSize(Size new_size)
          Sets the new size.
 void setStarClickListener(StarClickListener listener)
          Sets the listener of star click event.
 void setStarPositionList(StarPositionList new_list)
          Sets the new list of stars.
 void update(java.awt.Graphics g)
          Updates the view.
 
Methods inherited from class javax.swing.JLabel
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI, writeObject
 
Methods inherited from class javax.swing.JComponent
_paintImmediately, , addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, adjustPaintFlags, alwaysOnTop, bindingForKeyStroke, checkIfChildObscuredBySibling, computeVisibleRect, computeVisibleRect, contains, createToolTip, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperties, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getFlag, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, keyboardBindings, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paintWithBuffer, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, readObject, rectangleIsObscured, rectangleIsObscuredBySibling, registerKeyboardAction, registerKeyboardAction, registerWithKeyboardManager, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFlag, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, unregisterWithKeyboardManager
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyOrientation, countComponents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getCursorTarget, getLayout, getMouseEventTarget, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPrint, list, list, locate, minimumSize, nextFocus, paintComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printOneComponent, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setCursor, setFocusOwner, setLayout, transferFocus, updateCursor, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, constructComponentName, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getIntrinsicCursor, getLocale, getLocation, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkit, getToolkitImpl, getTreeLock, getWindowForObject, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isEnabledImpl, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processInputMethodEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

pane

protected java.awt.Container pane
The pane of this component.

offscreen

protected java.awt.Image offscreen
The off screen image.

list

protected StarPositionList list
The list of stars to plot.

size

protected Size size
The size of chart.

plot_properties

protected java.util.Hashtable plot_properties
The properties to plot stars.

default_property

protected PlotProperty default_property
The default properties to plot stars.

popup

protected javax.swing.JPopupMenu popup
The popup menu.

basepoint_at_center

protected boolean basepoint_at_center
True if the (0,0) represents the center of the chart. Otherwise, the (0,0) represents the top left corner.

folding_characters

protected int folding_characters
The number of characters to fold the star data in the dialog.

star_click_listener

protected StarClickListener star_click_listener
The listener of star click event. If null, this chart itself handles the event and shows the star information message box.
Constructor Detail

ChartComponent

public ChartComponent(Size initial_size)
Constructs an empty ChartComponent.
Parameters:
size - the size of chart.
Method Detail

initPopupMenu

protected void initPopupMenu()
Initializes a popup menu. A popup must be created previously.

setBasepointAtCenter

public void setBasepointAtCenter()
Sets a flag so that (0,0) represents the center of the chart.

setBasepointAtTopLeft

public void setBasepointAtTopLeft()
Sets a flag so that (0,0) represents the top left corner.

setDefaultProperty

public void setDefaultProperty(PlotProperty property)
Sets the default property.
Parameters:
property - the default property.

setProperty

public void setProperty(java.lang.String catalog_name,
                        PlotProperty property)
Sets the property to plot stars of the specified catalog. In order to redraw the off screen, here offscreen is set as null. It will be drawn again in update method.
Parameters:
catalog_name - the name of catalog.
property - the property.

setSize

public void setSize(Size new_size)
Sets the new size. In order to redraw the off screen, here offscreen is set as null. It will be drawn again in update method.
Parameters:
new_size - the new size of the chart.

setStarPositionList

public void setStarPositionList(StarPositionList new_list)
Sets the new list of stars. In order to redraw the off screen, here offscreen is set as null. It will be drawn again in update method.
Parameters:
new_list - the new list of stars.

getProperty

protected PlotProperty getProperty(StarPosition star)
Gets the property of the specified star.
Parameters:
star - the star position object.
Returns:
the property of the specified star.

getPreferredSize

public java.awt.Dimension getPreferredSize()
Gets the preferred size, considering the zoom level.
Overrides:
getPreferredSize in class javax.swing.JComponent
Returns:
the preferred size.

setStarClickListener

public void setStarClickListener(StarClickListener listener)
Sets the listener of star click event. If null, this chart itself becomes to handle the event and shows the star information message box.
Parameters:
listener - the listener.

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent e)
Invoked when mouse event occurs. It is to show a click data dialog or popup menu.
Overrides:
processMouseEvent in class java.awt.Component
Parameters:
e - contains the click position.

propertyChanged

public void propertyChanged()
Applies the property change. In order to redraw the off screen, here offscreen is set as null. It will be drawn again in update method.
Specified by:
propertyChanged in interface PropertyChangedListener

paint

public void paint(java.awt.Graphics g)
Updates the view.
Overrides:
paint in class javax.swing.JComponent
Parameters:
g - the Graphics to update.

update

public void update(java.awt.Graphics g)
Updates the view.
Overrides:
update in class javax.swing.JComponent
Parameters:
g - the Graphics to update.

draw

public void draw(java.awt.Graphics g)
Plots stars in the list on the off screen.
Parameters:
g - the Graphics to draw.