cobaUI
Class SentenceList

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycobaUI.SentenceList
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

class SentenceList
extends javax.swing.JPanel

SentenceList is a general wrapper for the KB/Revision/Contraction/Entailment-based Integrity Constraint (EB IC)/ Consistency-based Integrity Constraint (CB IC) sentence list. It provides three view formats (default, cnf, dnf) as well as a remove button and a clear-all button.

Author:
Daphne Liu, daphnel@sfu.ca

Nested Class Summary
(package private)  class SentenceList.ClearAllListener
          An action listener for erasing all sentences from the list and logging the removals in the history panel.
(package private)  class SentenceList.CNFListener
          An action listener for the cnf radio button, which displays the sentences in cnf format.
(package private)  class SentenceList.DefaultListener
          An action listener for the default radio button, which displays the sentences in default format.
(package private)  class SentenceList.DNFListener
          An action listener for the dnf radio button, which displays the sentences in dnf format.
(package private)  class SentenceList.MyListDataListener
          A list data listener which (1) enables the remove and clear-all buttons only if the list is non-empty, (2) enables the appropriate "save" menu item when the list contents change, and (3) enables the "Get Parallel Change" button only when there are sentences to be merged, revised, and/or contracted.
(package private)  class SentenceList.RemoveListener
          An action listener for removing the selected sentence from the list.
 
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
(package private) static int CB
          An int representing the CB IC type.
(package private) static int Contractor
          An int representing the Contractor type.
(package private) static int EB
          An int representing the EB IC type.
(package private) static int KB
          An int representing the KB type.
(package private)  javax.swing.DefaultListModel listModel
          The list model for specifying the listener for the data change in JList Items.
(package private)  java.util.Vector LSVec
          The vector of the ListSent objects in this SentenceList.
(package private)  COBAApplet ParentApplet
          A reference to the enclosing applet.
(package private) static int Revisor
          An int representing the Revisor type.
(package private)  short stringFormat
          An int set to indicate the current display format: default, cnf, dnf.
(package private)  java.util.Vector SVec
          The vector of the corresponding ISent objects in this SentenceList.
 
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
(package private) SentenceList(int _type, COBAApplet _parentApp)
          Constructs a new SentenceList of type _type for the enclosing applet _parentApp.
 
Method Summary
(package private)  void activateAfterDecision()
          Reactivates the remove and clear-all buttons after the user's decision to reject or commit the new KB, and only if the SentenceList has at least one sentence.
(package private)  void addRevertedKBSentence(int whichKB, java.lang.String sLabel)
          Parses sLabel as an ISent, creates the corresponding ListSent, and adds the ISent and ListSent to the KB indexed whichKB.
(package private)  void addRevertedSentence(java.lang.String sLabel)
          Parses sLabel as an ISent, creates the corresponding ListSent, and adds the ListSent to the LSVec and the list, and the ISent to the SVec.
(package private)  void addToKB(int whichKB, java.lang.String sLabel)
          Adds the sentence represented by sLabel to the KB indexed whichKB, updates SentenceEditor's whichKB if the KB is new.
(package private)  void addToList(java.lang.String sLabel)
          Parses sLabel as an ISent, checks its consistency if required, creates the corresponding ListSent, and adds the ListSent to LSVec and the list, and the ISent to SVec.
(package private)  void deactivateBeforeDecision()
          Deactivates the remove and clear-all buttons pending the user's decision to reject or commit the new KB.
 void paintComponent(java.awt.Graphics g)
          Resizes, repositions, and redraws all UI components of this SentenceList.
 void removeAll()
          Removes all the sentences from the list, clears the LSVec and the SVec, and updates SentenceEditor's KBBox accordingly.
(package private)  void removeFromList(ListSent s)
          Removes s from LSVec and the list, removes the underlying ISent in s from SVec, and logs the removal if this SentenceList is of either the KB, the EB, or the CB type.
 
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, getPreferredSize, 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, paint, paintBorder, paintChildren, 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, update
 
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, 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

KB

static final int KB
An int representing the KB type.

See Also:
Constant Field Values

Revisor

static final int Revisor
An int representing the Revisor type.

See Also:
Constant Field Values

Contractor

static final int Contractor
An int representing the Contractor type.

See Also:
Constant Field Values

CB

static final int CB
An int representing the CB IC type.

See Also:
Constant Field Values

EB

static final int EB
An int representing the EB IC type.

See Also:
Constant Field Values

ParentApplet

COBAApplet ParentApplet
A reference to the enclosing applet.


listModel

javax.swing.DefaultListModel listModel
The list model for specifying the listener for the data change in JList Items.


LSVec

java.util.Vector LSVec
The vector of the ListSent objects in this SentenceList.


SVec

java.util.Vector SVec
The vector of the corresponding ISent objects in this SentenceList.


stringFormat

short stringFormat
An int set to indicate the current display format: default, cnf, dnf.

Constructor Detail

SentenceList

SentenceList(int _type,
             COBAApplet _parentApp)
Constructs a new SentenceList of type _type for the enclosing applet _parentApp.

Parameters:
_type - an int indicating the type of SentenceList.
_parentApp - a reference to the enclosing applet.
Method Detail

deactivateBeforeDecision

void deactivateBeforeDecision()
Deactivates the remove and clear-all buttons pending the user's decision to reject or commit the new KB.


activateAfterDecision

void activateAfterDecision()
Reactivates the remove and clear-all buttons after the user's decision to reject or commit the new KB, and only if the SentenceList has at least one sentence.


addToKB

void addToKB(int whichKB,
             java.lang.String sLabel)
Adds the sentence represented by sLabel to the KB indexed whichKB, updates SentenceEditor's whichKB if the KB is new.

Parameters:
whichKB - an int representing the index of the KB to which to add the constructed sentence.
sLabel - the string from which to construct a new sentence.

addToList

void addToList(java.lang.String sLabel)
Parses sLabel as an ISent, checks its consistency if required, creates the corresponding ListSent, and adds the ListSent to LSVec and the list, and the ISent to SVec.

This method can be invoked only on a SentenceList of a non-KB type.

Parameters:
sLabel - the string from which to construct a new ISent.

addRevertedSentence

void addRevertedSentence(java.lang.String sLabel)
Parses sLabel as an ISent, creates the corresponding ListSent, and adds the ListSent to the LSVec and the list, and the ISent to the SVec.

This method can be invoked only on a SentenceList of either the EB or the CB type, in reverting to an earlier EB IC or CB IC snapshot.

Parameters:
sLabel - the string from which to construct a new ISent.

addRevertedKBSentence

void addRevertedKBSentence(int whichKB,
                           java.lang.String sLabel)
Parses sLabel as an ISent, creates the corresponding ListSent, and adds the ISent and ListSent to the KB indexed whichKB.

This method can be invoked only on a SentenceList of the KB type, in reverting to an earlier KB snapshot.

Parameters:
whichKB - an int representing the index of the KB to which to add the constructed sentence.
sLabel - the string from which to construct a new ISent.

removeFromList

void removeFromList(ListSent s)
Removes s from LSVec and the list, removes the underlying ISent in s from SVec, and logs the removal if this SentenceList is of either the KB, the EB, or the CB type.

Parameters:
s - the ListSent to be removed from the list.

removeAll

public void removeAll()
Removes all the sentences from the list, clears the LSVec and the SVec, and updates SentenceEditor's KBBox accordingly.


paintComponent

public void paintComponent(java.awt.Graphics g)
Resizes, repositions, and redraws all UI components of this SentenceList.