Package adams.gui.visualization.instance
Class LoadDatasetDialog
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- javax.swing.JDialog
-
- adams.gui.core.BaseDialog
-
- 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$
- 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, Window.Type
-
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
Fields Modifier and Type Field Description protected ChangeListener
m_AcceptListener
the listener waiting for the user to accept the input.protected BaseButton
m_ButtonClose
the Close button.protected BaseButton
m_ButtonLoad
the Load button.protected BaseButton
m_ButtonReload
the button for reloading an existing file.protected ChangeListener
m_CancelListener
the listener waiting for the user to cancel the dialog.protected BaseCheckBox
m_CheckBoxIncludeDateAttributes
whether to include date attributes.protected BaseCheckBox
m_CheckBoxIncludeNominalAttributes
whether to include numeric nominal.protected BaseCheckBox
m_CheckBoxIncludeNumericAttributes
whether to include numeric attributes.protected BaseCheckBox
m_CheckBoxIncludeRelationalAttributes
whether to include relational attributes.protected BaseCheckBox
m_CheckBoxIncludeStringAttributes
whether to include string attributes.protected BaseComboBox
m_ComboBoxClass
the class index.protected DefaultComboBoxModel
m_ComboBoxClassModel
the class index model.protected BaseComboBox
m_ComboBoxID
the ID index.protected DefaultComboBoxModel
m_ComboBoxIDModel
the ID index model.protected BaseComboBox
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 Index
m_DefaultIDIndex
the default ID 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 BaseTextField
m_TextAttributeRange
the text field for the attribute range.static String
NO_CLASS
the "no class" constant.static String
NO_ID
the "no id" constant.static String
NO_SORTING
the "no sorting" constant.-
Fields inherited from class adams.gui.core.BaseDialog
m_AfterHideActions, m_AfterShowActions, m_BeforeHideActions, m_BeforeShowActions, m_DisposeCalled, m_UISettingsApplied, m_UISettingsPrefix, m_UISettingsStored
-
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
acceptSelection()
Generates the indices.protected void
beforeShow()
Hook method just before the dialog is made visible.protected void
close()
Closes the dialog.ChangeListener
getAcceptListener()
Returns the listener for the event that the user accepts the input.int[]
getAdditionalAttributes()
Returns the attributes indices of the original dataset to include in the reports.ChangeListener
getCancelListener()
Returns the listener for the event that the user discarded the input.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
getCurrentIDIndex()
Returns the currently selected ID index.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.String
getDefaultIDIndex()
Returns the default ID 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
setAcceptListener(ChangeListener l)
Sets the listener for the event that the user accepts the input.void
setCancelListener(ChangeListener l)
Sets the listener for the event that the user discarded the input.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
setDefaultIDIndex(String value)
Sets the default ID 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
addAfterHideAction, addAfterShowAction, addBeforeHideAction, addBeforeShowAction, afterHide, afterShow, applyUISettings, beforeHide, dispose, executeAfterHideActions, executeAfterShowActions, executeBeforeHideActions, executeBeforeShowActions, finishInit, getUISettingsApplied, getUISettingsPrefix, pack, removeAfterHideAction, removeAfterShowAction, removeBeforeHideAction, removeBeforeShowAction, setLocationRelativeTo, setUISettingsPrefix, setUISettingsPrefix, setVisible, storeUISettings
-
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, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBack
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setMinimumSize, setModalExclusionType, setSize, setSize, setType, 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, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
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
-
NO_ID
public static final String NO_ID
the "no id" 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 BaseButton m_ButtonReload
the button for reloading an existing file.
-
m_TableData
protected InstanceTable m_TableData
the table for displaying the instances.
-
m_ButtonLoad
protected BaseButton m_ButtonLoad
the Load button.
-
m_ButtonClose
protected BaseButton m_ButtonClose
the Close button.
-
m_SearchPanel
protected SearchPanel m_SearchPanel
the search panel.
-
m_ComboBoxClass
protected BaseComboBox m_ComboBoxClass
the class index.
-
m_ComboBoxClassModel
protected DefaultComboBoxModel m_ComboBoxClassModel
the class index model.
-
m_ComboBoxSorting
protected BaseComboBox m_ComboBoxSorting
the sorting index.
-
m_ComboBoxSortingModel
protected DefaultComboBoxModel m_ComboBoxSortingModel
the soriting index model.
-
m_ComboBoxID
protected BaseComboBox m_ComboBoxID
the ID index.
-
m_ComboBoxIDModel
protected DefaultComboBoxModel m_ComboBoxIDModel
the ID 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 BaseTextField m_TextAttributeRange
the text field for the attribute range.
-
m_DefaultAttributeRange
protected Range m_DefaultAttributeRange
the default range.
-
m_CheckBoxIncludeNumericAttributes
protected BaseCheckBox m_CheckBoxIncludeNumericAttributes
whether to include numeric attributes.
-
m_CheckBoxIncludeDateAttributes
protected BaseCheckBox m_CheckBoxIncludeDateAttributes
whether to include date attributes.
-
m_CheckBoxIncludeNominalAttributes
protected BaseCheckBox m_CheckBoxIncludeNominalAttributes
whether to include numeric nominal.
-
m_CheckBoxIncludeStringAttributes
protected BaseCheckBox m_CheckBoxIncludeStringAttributes
whether to include string attributes.
-
m_CheckBoxIncludeRelationalAttributes
protected BaseCheckBox 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_DefaultIDIndex
protected Index m_DefaultIDIndex
the default ID 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.
-
m_AcceptListener
protected ChangeListener m_AcceptListener
the listener waiting for the user to accept the input.
-
m_CancelListener
protected ChangeListener m_CancelListener
the listener waiting for the user to cancel the dialog.
-
-
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 dialogtitle
- the title of the dialog
-
LoadDatasetDialog
public LoadDatasetDialog(Frame owner)
Creates a modal dialog.- Parameters:
owner
- the owning frame
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classBaseDialog
-
initGUI
protected void initGUI()
Initializes the GUI elements.- Overrides:
initGUI
in classBaseDialog
-
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
-
setDefaultIDIndex
public void setDefaultIDIndex(String value)
Sets the default ID index to use.- Parameters:
value
- the ID index, 1-based integer or 'first'/'last', use empty string for none- See Also:
Index
-
getDefaultIDIndex
public String getDefaultIDIndex()
Returns the default ID index in use.- Returns:
- the ID index, 1-based integer or 'first'/'last', empty string for none
- See Also:
Index
-
getCurrentIDIndex
public int getCurrentIDIndex()
Returns the currently selected ID index.- Returns:
- the ID 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 typevalue
- 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 typevalue
- 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 classBaseDialog
-
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
-
setAcceptListener
public void setAcceptListener(ChangeListener l)
Sets the listener for the event that the user accepts the input.- Parameters:
l
- the listener to use
-
getAcceptListener
public ChangeListener getAcceptListener()
Returns the listener for the event that the user accepts the input.- Returns:
- the listener in use, null if none set
-
setCancelListener
public void setCancelListener(ChangeListener l)
Sets the listener for the event that the user discarded the input.- Parameters:
l
- the listener to use
-
getCancelListener
public ChangeListener getCancelListener()
Returns the listener for the event that the user discarded the input.- Returns:
- the listener in use, null if none set
-
-