org.problets.domain.model.output.view
Class OutputStreamView

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.problets.domain.model.output.view.OutputStreamView
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable, GUIConstants

public class OutputStreamView
extends javax.swing.JPanel
implements javax.swing.Scrollable, java.awt.event.MouseListener, GUIConstants

To create a panel that will allow the user to see LineOutputs

Author:
Brian Kunert, Amruth Kumar
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static java.lang.String OUTPUT_MODIFIED_EVENT
           
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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 org.problets.domain.state.GUIConstants
BACKGROUND_COLOR, CORRECT_COLOR, hugeFont, INCORRECT_COLOR, largeBoldFont, largeFont, PARTIAL_COLOR, regularFont
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
OutputStreamView(java.awt.event.ActionListener inParent, java.util.Vector inModel)
          Constructor to initializes the Vector with LineOutputViews
 
Method Summary
 void addLineOutput(LineOutput lOutput)
          Adds a LineOutputView to the end of the outputView Vector and decides how to repaint the component.
 void clearAll()
          Clears the OutputStreamView of LineOutputViews
 java.awt.Dimension getPreferredScrollableViewportSize()
          Scrollable interface override
 int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
          Scrollable Interface override
 boolean getScrollableTracksViewportHeight()
          Scrollable interface override
 boolean getScrollableTracksViewportWidth()
          Scrollable interface override
 int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
          Scrollable interface override
 int getSelectedIndex()
          Get the index of the selected LineOutputView
 void insertLineOutput(LineOutput lOutput, int loc)
          Inserts a LineOutputView into the Vector and decides how to repaint the component.
static void main(java.lang.String[] args)
           
 void mouseClicked(java.awt.event.MouseEvent evt)
          MouseListener overrides
 void mouseEntered(java.awt.event.MouseEvent evt)
           
 void mouseExited(java.awt.event.MouseEvent evt)
           
 void mousePressed(java.awt.event.MouseEvent evt)
          Handles when the user clicks on a LineOutputView
 void mouseReleased(java.awt.event.MouseEvent evt)
          Handles when the mouse button has been released
 void paintComponent(java.awt.Graphics g)
          Paints this component on the screen
 void removeLineOutput(int index)
          Removes a LineOutputView from this component and decides how to repaint it.
 void removeLineOutput(LineOutput lOutput)
          Removes the view corresponding to the LineOutput object
 void showBorder(int index, boolean isShown)
          Set the LineOutputView as selected.
 void update(java.util.Vector inModel)
          Updates the output for this view
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OUTPUT_MODIFIED_EVENT

public static final java.lang.String OUTPUT_MODIFIED_EVENT
See Also:
Constant Field Values
Constructor Detail

OutputStreamView

public OutputStreamView(java.awt.event.ActionListener inParent,
                        java.util.Vector inModel)
Constructor to initializes the Vector with LineOutputViews

Method Detail

paintComponent

public void paintComponent(java.awt.Graphics g)
Paints this component on the screen

Overrides:
paintComponent in class javax.swing.JComponent

mousePressed

public void mousePressed(java.awt.event.MouseEvent evt)
Handles when the user clicks on a LineOutputView

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent evt)
Handles when the mouse button has been released

Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent evt)
MouseListener overrides

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent evt)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent evt)
Specified by:
mouseExited in interface java.awt.event.MouseListener

getSelectedIndex

public int getSelectedIndex()
Get the index of the selected LineOutputView


getScrollableBlockIncrement

public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
                                       int orientation,
                                       int direction)
Scrollable Interface override

Specified by:
getScrollableBlockIncrement in interface javax.swing.Scrollable

getScrollableUnitIncrement

public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
                                      int orientation,
                                      int direction)
Scrollable interface override

Specified by:
getScrollableUnitIncrement in interface javax.swing.Scrollable

getPreferredScrollableViewportSize

public java.awt.Dimension getPreferredScrollableViewportSize()
Scrollable interface override

Specified by:
getPreferredScrollableViewportSize in interface javax.swing.Scrollable

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Scrollable interface override

Specified by:
getScrollableTracksViewportWidth in interface javax.swing.Scrollable

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Scrollable interface override

Specified by:
getScrollableTracksViewportHeight in interface javax.swing.Scrollable

update

public void update(java.util.Vector inModel)
Updates the output for this view


addLineOutput

public void addLineOutput(LineOutput lOutput)
Adds a LineOutputView to the end of the outputView Vector and decides how to repaint the component. Applications should call this function to make sure the component gets repainted properly


insertLineOutput

public void insertLineOutput(LineOutput lOutput,
                             int loc)
Inserts a LineOutputView into the Vector and decides how to repaint the component. Applications should call this method to insert LineOutputViews to make sure the component gets repainted properly.


removeLineOutput

public void removeLineOutput(LineOutput lOutput)
Removes the view corresponding to the LineOutput object


removeLineOutput

public void removeLineOutput(int index)
Removes a LineOutputView from this component and decides how to repaint it. Applications should call this method to make sure that the component gets repainted properly


clearAll

public void clearAll()
Clears the OutputStreamView of LineOutputViews


showBorder

public void showBorder(int index,
                       boolean isShown)
Set the LineOutputView as selected. Allows the Border of the LineOutputView to be shown


main

public static void main(java.lang.String[] args)