adams.gui.visualization.instance
Class LoadDatasetDialog

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by adams.gui.core.BaseDialog
                          extended by adams.gui.visualization.instance.LoadDatasetDialog
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class LoadDatasetDialog
extends BaseDialog

A dialog for loading datasets from disk.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
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
protected  JButton m_ButtonClose
          the Close button.
protected  JButton m_ButtonLoad
          the Load button.
protected  JButton m_ButtonReload
          the button for reloading an existing file.
protected  JCheckBox m_CheckBoxIncludeDateAttributes
          whether to include date attributes.
protected  JCheckBox m_CheckBoxIncludeNominalAttributes
          whether to include numeric nominal.
protected  JCheckBox m_CheckBoxIncludeNumericAttributes
          whether to include numeric attributes.
protected  JCheckBox m_CheckBoxIncludeRelationalAttributes
          whether to include relational attributes.
protected  JCheckBox m_CheckBoxIncludeStringAttributes
          whether to include string attributes.
protected  JComboBox m_ComboBoxClass
          the class index.
protected  DefaultComboBoxModel m_ComboBoxClassModel
          the class index model.
protected  JComboBox m_ComboBoxSorting
          the sorting index.
protected  DefaultComboBoxModel m_ComboBoxSortingModel
          the soriting index model.
protected  Range m_DefaultAttributeRange
          the default range.
protected  Index m_DefaultClassIndex
          the default class index.
protected  boolean m_DefaultIncludeDateAttributes
          the default for date attributes.
protected  boolean m_DefaultIncludeNominalAttributes
          the default for nominal attributes.
protected  boolean m_DefaultIncludeNumericAttributes
          the default for numeric attributes.
protected  boolean m_DefaultIncludeRelationalAttributes
          the default for relational attributes.
protected  boolean m_DefaultIncludeStringAttributes
          the default for string attributes.
protected  Index m_DefaultSortIndex
          the default sort index.
protected  DatasetFileChooserPanel m_FilePanel
          for selecting the dataset file.
protected  int[] m_Indices
          the selected indices.
protected  weka.core.Instances m_Instances
          the full dataset.
protected  JList m_ListAdditionalAttributes
          the list of additional attribute values to store in the report.
protected  DefaultListModel m_ListAdditionalAttributesModel
          the model for the additional attributes.
protected  SearchPanel m_SearchPanel
          the search panel.
protected  LoadDatasetDialog m_Self
          the dialog itself.
protected  BaseTabbedPane m_TabbedPane
          the tabbed pane.
protected  InstanceTable m_TableData
          the table for displaying the instances.
protected  JTextField m_TextAttributeRange
          the text field for the attribute range.
static String NO_CLASS
          the "no class" constant.
static String NO_SORTING
          the "no sorting" constant.
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPE
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LoadDatasetDialog(Dialog owner)
          Creates a modal dialog.
LoadDatasetDialog(Dialog owner, String title)
          Creates a modal dialog.
LoadDatasetDialog(Frame owner)
          Creates a modal dialog.
LoadDatasetDialog(Frame owner, String title)
          Creates a modal dialog.
 
Method Summary
protected  void acceptSelection()
          Generates the indices.
protected  void beforeShow()
          Hook method just before the dialog is made visible.
protected  void close()
          Closes the dialog.
 int[] getAdditionalAttributes()
          Returns the attributes indices of the original dataset to include in the reports.
 File getCurrent()
          Returns the current file.
 Range getCurrentAttributeRange()
          Returns the current range of attributes to use.
 int getCurrentClassIndex()
          Returns the currently selected class index.
 File getCurrentDirectory()
          Returns the current directory in use by the file chooser.
 int getCurrentSortIndex()
          Returns the currently selected sort index.
 weka.core.Instances getDataset()
          Returns the full dataset, can be null if none loaded.
 String getDefaultAttributeRange()
          Returns the default range of attributes to use.
 String getDefaultClassIndex()
          Returns the default class index in use.
 boolean getDefaultInclueAttributes(int attType)
          Returns the default for the specified attribute type.
 String getDefaultSortIndex()
          Returns the default sort index in use.
 String getFilename()
          Returns the currently selected filename, "" if none selected.
 boolean getIncludeAttributes(int attType)
          Returns whether only numeric attributes should be used.
 int[] getIndices()
          Returns the indices of the (actual) selected rows.
protected  void initGUI()
          Initializes the GUI elements.
protected  void initialize()
          Initializes the members.
protected  void loadFile(boolean reload)
          Loads the file and displays the IDs.
protected  void search()
          Performs a search in the fields.
 void setCurrent(File value)
          Sets the current file.
 void setCurrentDirectory(File value)
          Sets the current directory to use for the file chooser.
 void setDefaultAttributeRange(String value)
          Sets the default range of attributes to use.
 void setDefaultClassIndex(String value)
          Sets the default class index to use.
 void setDefaultIncludeAttributes(int attType, boolean value)
          Sets the default for the specified type of attribute.
 void setDefaultSortIndex(String value)
          Sets the default sort index to use.
 void setIncludeAttributes(int attType, boolean value)
          Sets whether only numeric attributes should be used.
 
Methods inherited from class adams.gui.core.BaseDialog
afterHide, afterShow, beforeHide, finishInit, setVisible
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setResizable, setTitle, setUndecorated, show, toBack
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_CLASS

public static final String NO_CLASS
the "no class" constant.

See Also:
Constant Field Values

NO_SORTING

public static final String NO_SORTING
the "no sorting" constant.

See Also:
Constant Field Values

m_Self

protected LoadDatasetDialog m_Self
the dialog itself.


m_FilePanel

protected DatasetFileChooserPanel m_FilePanel
for selecting the dataset file.


m_ButtonReload

protected JButton m_ButtonReload
the button for reloading an existing file.


m_TableData

protected InstanceTable m_TableData
the table for displaying the instances.


m_ButtonLoad

protected JButton m_ButtonLoad
the Load button.


m_ButtonClose

protected JButton m_ButtonClose
the Close button.


m_SearchPanel

protected SearchPanel m_SearchPanel
the search panel.


m_ComboBoxClass

protected JComboBox m_ComboBoxClass
the class index.


m_ComboBoxClassModel

protected DefaultComboBoxModel m_ComboBoxClassModel
the class index model.


m_ComboBoxSorting

protected JComboBox m_ComboBoxSorting
the sorting index.


m_ComboBoxSortingModel

protected DefaultComboBoxModel m_ComboBoxSortingModel
the soriting index model.


m_ListAdditionalAttributes

protected JList m_ListAdditionalAttributes
the list of additional attribute values to store in the report.


m_ListAdditionalAttributesModel

protected DefaultListModel m_ListAdditionalAttributesModel
the model for the additional attributes.


m_TextAttributeRange

protected JTextField m_TextAttributeRange
the text field for the attribute range.


m_DefaultAttributeRange

protected Range m_DefaultAttributeRange
the default range.


m_CheckBoxIncludeNumericAttributes

protected JCheckBox m_CheckBoxIncludeNumericAttributes
whether to include numeric attributes.


m_CheckBoxIncludeDateAttributes

protected JCheckBox m_CheckBoxIncludeDateAttributes
whether to include date attributes.


m_CheckBoxIncludeNominalAttributes

protected JCheckBox m_CheckBoxIncludeNominalAttributes
whether to include numeric nominal.


m_CheckBoxIncludeStringAttributes

protected JCheckBox m_CheckBoxIncludeStringAttributes
whether to include string attributes.


m_CheckBoxIncludeRelationalAttributes

protected JCheckBox m_CheckBoxIncludeRelationalAttributes
whether to include relational attributes.


m_Instances

protected weka.core.Instances m_Instances
the full dataset.


m_Indices

protected int[] m_Indices
the selected indices.


m_TabbedPane

protected BaseTabbedPane m_TabbedPane
the tabbed pane.


m_DefaultClassIndex

protected Index m_DefaultClassIndex
the default class index.


m_DefaultSortIndex

protected Index m_DefaultSortIndex
the default sort index.


m_DefaultIncludeNumericAttributes

protected boolean m_DefaultIncludeNumericAttributes
the default for numeric attributes.


m_DefaultIncludeDateAttributes

protected boolean m_DefaultIncludeDateAttributes
the default for date attributes.


m_DefaultIncludeNominalAttributes

protected boolean m_DefaultIncludeNominalAttributes
the default for nominal attributes.


m_DefaultIncludeStringAttributes

protected boolean m_DefaultIncludeStringAttributes
the default for string attributes.


m_DefaultIncludeRelationalAttributes

protected boolean m_DefaultIncludeRelationalAttributes
the default for relational attributes.

Constructor Detail

LoadDatasetDialog

public LoadDatasetDialog(Dialog owner)
Creates a modal dialog.

Parameters:
owner - the owning dialog

LoadDatasetDialog

public LoadDatasetDialog(Dialog owner,
                         String title)
Creates a modal dialog.

Parameters:
owner - the owning dialog
title - the title of the dialog

LoadDatasetDialog

public LoadDatasetDialog(Frame owner)
Creates a modal dialog.

Parameters:
owner - the owning frame

LoadDatasetDialog

public LoadDatasetDialog(Frame owner,
                         String title)
Creates a modal dialog.

Parameters:
owner - the owning frame
title - the title of the dialog
Method Detail

initialize

protected void initialize()
Initializes the members.

Overrides:
initialize in class BaseDialog

initGUI

protected void initGUI()
Initializes the GUI elements.

Overrides:
initGUI in class BaseDialog

getAdditionalAttributes

public int[] getAdditionalAttributes()
Returns the attributes indices of the original dataset to include in the reports.

Returns:
the indices of the attributes

setDefaultAttributeRange

public void setDefaultAttributeRange(String value)
Sets the default range of attributes to use.

Parameters:
value - the range

getDefaultAttributeRange

public String getDefaultAttributeRange()
Returns the default range of attributes to use.

Returns:
the range of attributes to use

getCurrentAttributeRange

public Range getCurrentAttributeRange()
Returns the current range of attributes to use.

Returns:
the range of attributes to use

setDefaultClassIndex

public void setDefaultClassIndex(String value)
Sets the default class index to use.

Parameters:
value - the class index, 1-based integer or 'first'/'last', use empty string for none
See Also:
Index

getDefaultClassIndex

public String getDefaultClassIndex()
Returns the default class index in use.

Returns:
the class index, 1-based integer or 'first'/'last', empty string for none
See Also:
Index

getCurrentClassIndex

public int getCurrentClassIndex()
Returns the currently selected class index.

Returns:
the class index, -1 if none selected

setDefaultSortIndex

public void setDefaultSortIndex(String value)
Sets the default sort index to use.

Parameters:
value - the sort index, 1-based integer or 'first'/'last', use empty string for none
See Also:
Index

getDefaultSortIndex

public String getDefaultSortIndex()
Returns the default sort index in use.

Returns:
the sort index, 1-based integer or 'first'/'last', empty string for none
See Also:
Index

getCurrentSortIndex

public int getCurrentSortIndex()
Returns the currently selected sort index.

Returns:
the sort index, -1 if none selected

getDataset

public weka.core.Instances getDataset()
Returns the full dataset, can be null if none loaded.

Returns:
the full dataset

getIndices

public int[] getIndices()
Returns the indices of the (actual) selected rows.

Returns:
the indices, null if "Close" was selected

setDefaultIncludeAttributes

public void setDefaultIncludeAttributes(int attType,
                                        boolean value)
Sets the default for the specified type of attribute.

Parameters:
attType - the attribute type
value - true if to restrict to attribute type by default
See Also:
Attribute

getDefaultInclueAttributes

public boolean getDefaultInclueAttributes(int attType)
Returns the default for the specified attribute type.

Parameters:
attType - the attribute type
Returns:
true if to include to attribute type by default
See Also:
Attribute

setIncludeAttributes

public void setIncludeAttributes(int attType,
                                 boolean value)
Sets whether only numeric attributes should be used.

Parameters:
attType - the attribute type
value - if true then only numeric attributes will be used
See Also:
Attribute

getIncludeAttributes

public boolean getIncludeAttributes(int attType)
Returns whether only numeric attributes should be used.

Parameters:
attType - the attribute type
Returns:
true if only numeric attributes to be used
See Also:
Attribute

getFilename

public String getFilename()
Returns the currently selected filename, "" if none selected.

Returns:
the filename, "" if none selected

loadFile

protected void loadFile(boolean reload)
Loads the file and displays the IDs.

Parameters:
reload - whether we're loading a new file or just reloading the current one

acceptSelection

protected void acceptSelection()
Generates the indices.


search

protected void search()
Performs a search in the fields.


close

protected void close()
Closes the dialog.


beforeShow

protected void beforeShow()
Hook method just before the dialog is made visible.

Overrides:
beforeShow in class BaseDialog

setCurrentDirectory

public void setCurrentDirectory(File value)
Sets the current directory to use for the file chooser.

Parameters:
value - the current directory

getCurrentDirectory

public File getCurrentDirectory()
Returns the current directory in use by the file chooser.

Returns:
the current directory

setCurrent

public void setCurrent(File value)
Sets the current file.

Parameters:
value - the file to set

getCurrent

public File getCurrent()
Returns the current file.

Returns:
the current file


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