adams.gui.visualization.instance
Class InstanceComparePanel

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 adams.gui.core.BasePanel
                      extended by adams.gui.visualization.instance.InstanceComparePanel
All Implemented Interfaces:
CleanUpHandler, StatusMessageHandler, MenuBarProvider, ImageObserver, MenuContainer, Serializable, Accessible

public class InstanceComparePanel
extends BasePanel
implements StatusMessageHandler, CleanUpHandler, MenuBarProvider

A tool for comparing two datasets visually.

Version:
$Revision: 4584 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Nested Class Summary
static class InstanceComparePanel.DatasetIndexer
          Helper class for indexing the rows of a dataset.
static class InstanceComparePanel.DatasetPanel
          Specialized panel for loading dataset and setting various parameters.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String FILENAME
          the name of the props file.
protected  JLabel m_LabelRows
          the label for the combobox.
protected  BaseList m_ListRows
          the JLiast with the rows.
protected  DefaultListModel m_ListRowsModel
          the model for the combobox with the rows.
protected  JMenuBar m_MenuBar
          the menu bar.
protected  JMenuItem m_MenuItemLoadRecent1
          the recent file menu item (first file).
protected  JMenuItem m_MenuItemLoadRecent2
          the recent file menu item (second file).
protected  JMenuItem m_MenuItemReload
          the reload menu item.
protected  InstancePanel m_PanelComparison
          the panel for displaying the two instances.
protected  InstanceComparePanel.DatasetPanel m_PanelDataset1
          the panel for the first dataset.
protected  InstanceComparePanel.DatasetPanel m_PanelDataset2
          the panel for the second dataset.
protected  InstancePanel m_PanelDifference
          the panel with the difference.
protected static Properties m_Properties
          the properties.
protected  RecentFilesHandler m_RecentFilesHandler1
          the recent files handler.
protected  RecentFilesHandler m_RecentFilesHandler2
          the recent files handler.
protected  ReportFactory.Table m_ReportTable
          the table with the report.
protected  List<String> m_RowIndex
          the internal index.
protected  BaseStatusBar m_StatusBar
          for displaying error messages.
static String SESSION_FILE_1
          the file to store the recent files in (first file).
static String SESSION_FILE_2
          the file to store the recent files in (second file).
 
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.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
InstanceComparePanel()
           
 
Method Summary
 void cleanUp()
          Cleans up data structures, frees up memory.
 void close()
          closes the dialog/frame.
 String getFirstAttributeRange()
          Returns the first attribute range.
 File getFirstDataset()
          Returns the first dataset.
 String getFirstRowIndex()
          Returns the first row index.
 JMenuBar getMenuBar()
          Creates a menu bar (singleton per panel object).
static Properties getProperties()
          Returns the properties that define the editor.
 String getSecondAttributeRange()
          Returns the second attribute range.
 File getSecondDataset()
          Returns the second dataset.
 String getSecondRowIndex()
          Returns the second row index.
protected  void initGUI()
          Initializes the widgets.
protected  void initialize()
          Initializes the members.
protected  void performComparison()
          Performs the comparison between the rows from the two datasets.
 void reload()
          Reloads the datasets.
 void setFirstAttributeRange(String value)
          Sets the first attribute range ('first' and 'last' can be used as well).
 void setFirstDataset(File value)
          Sets the first dataset.
 void setFirstRowIndex(String value)
          Sets the first row index ('first' and 'last' can be used as well).
 void setSecondAttributeRange(String value)
          Sets the second attribute range ('second' and 'last' can be used as well).
 void setSecondDataset(File value)
          Sets the second dataset.
 void setSecondRowIndex(String value)
          Sets the second row index ('second' and 'last' can be used as well).
 void showStatus(String msg)
          Displays a message.
protected  List<String> trimIDs(List<String> list)
          Removes the leading 0s.
protected  void updateMenu()
          updates the enabled state of the menu items.
protected  void updateRows()
          Updates the combobox with the rows.
 
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, finishInit, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, main, setParentTitle, setVisible
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FILENAME

public static final String FILENAME
the name of the props file.

See Also:
Constant Field Values

SESSION_FILE_1

public static final String SESSION_FILE_1
the file to store the recent files in (first file).

See Also:
Constant Field Values

SESSION_FILE_2

public static final String SESSION_FILE_2
the file to store the recent files in (second file).

See Also:
Constant Field Values

m_Properties

protected static Properties m_Properties
the properties.


m_PanelDataset1

protected InstanceComparePanel.DatasetPanel m_PanelDataset1
the panel for the first dataset.


m_PanelDataset2

protected InstanceComparePanel.DatasetPanel m_PanelDataset2
the panel for the second dataset.


m_PanelComparison

protected InstancePanel m_PanelComparison
the panel for displaying the two instances.


m_PanelDifference

protected InstancePanel m_PanelDifference
the panel with the difference.


m_LabelRows

protected JLabel m_LabelRows
the label for the combobox.


m_ListRows

protected BaseList m_ListRows
the JLiast with the rows.


m_ListRowsModel

protected DefaultListModel m_ListRowsModel
the model for the combobox with the rows.


m_ReportTable

protected ReportFactory.Table m_ReportTable
the table with the report.


m_StatusBar

protected BaseStatusBar m_StatusBar
for displaying error messages.


m_RowIndex

protected List<String> m_RowIndex
the internal index.


m_MenuBar

protected JMenuBar m_MenuBar
the menu bar.


m_MenuItemReload

protected JMenuItem m_MenuItemReload
the reload menu item.


m_MenuItemLoadRecent1

protected JMenuItem m_MenuItemLoadRecent1
the recent file menu item (first file).


m_MenuItemLoadRecent2

protected JMenuItem m_MenuItemLoadRecent2
the recent file menu item (second file).


m_RecentFilesHandler1

protected RecentFilesHandler m_RecentFilesHandler1
the recent files handler.


m_RecentFilesHandler2

protected RecentFilesHandler m_RecentFilesHandler2
the recent files handler.

Constructor Detail

InstanceComparePanel

public InstanceComparePanel()
Method Detail

initialize

protected void initialize()
Initializes the members.

Overrides:
initialize in class BasePanel

initGUI

protected void initGUI()
Initializes the widgets.

Overrides:
initGUI in class BasePanel

getMenuBar

public JMenuBar getMenuBar()
Creates a menu bar (singleton per panel object). Can be used in frames.

Specified by:
getMenuBar in interface MenuBarProvider
Returns:
the menu bar

updateMenu

protected void updateMenu()
updates the enabled state of the menu items.


reload

public void reload()
Reloads the datasets.


close

public void close()
closes the dialog/frame.


trimIDs

protected List<String> trimIDs(List<String> list)
Removes the leading 0s.

Parameters:
list - the list to process
Returns:
the processed list

updateRows

protected void updateRows()
Updates the combobox with the rows.


performComparison

protected void performComparison()
Performs the comparison between the rows from the two datasets.


showStatus

public void showStatus(String msg)
Displays a message.

Specified by:
showStatus in interface StatusMessageHandler
Parameters:
msg - the message to display

setFirstDataset

public void setFirstDataset(File value)
Sets the first dataset.

Parameters:
value - the first dataset

getFirstDataset

public File getFirstDataset()
Returns the first dataset.

Returns:
the first dataset

setFirstAttributeRange

public void setFirstAttributeRange(String value)
Sets the first attribute range ('first' and 'last' can be used as well).

Parameters:
value - the attribute range

getFirstAttributeRange

public String getFirstAttributeRange()
Returns the first attribute range.

Returns:
the attribute range

setFirstRowIndex

public void setFirstRowIndex(String value)
Sets the first row index ('first' and 'last' can be used as well).

Parameters:
value - the index of the row attribute

getFirstRowIndex

public String getFirstRowIndex()
Returns the first row index.

Returns:
the index of the row attribute (1-based, 'first', 'last')

setSecondDataset

public void setSecondDataset(File value)
Sets the second dataset.

Parameters:
value - the second dataset

getSecondDataset

public File getSecondDataset()
Returns the second dataset.

Returns:
the second dataset

setSecondAttributeRange

public void setSecondAttributeRange(String value)
Sets the second attribute range ('second' and 'last' can be used as well).

Parameters:
value - the attribute range

getSecondAttributeRange

public String getSecondAttributeRange()
Returns the second attribute range.

Returns:
the attribute range

setSecondRowIndex

public void setSecondRowIndex(String value)
Sets the second row index ('second' and 'last' can be used as well).

Parameters:
value - the index of the row attribute

getSecondRowIndex

public String getSecondRowIndex()
Returns the second row index.

Returns:
the index of the row attribute (2-based, 'second', 'last')

cleanUp

public void cleanUp()
Cleans up data structures, frees up memory.

Specified by:
cleanUp in interface CleanUpHandler

getProperties

public static Properties getProperties()
Returns the properties that define the editor.

Returns:
the properties


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.