Class LoadSpreadSheetDialog
- 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.spreadsheet.LoadSpreadSheetDialog
-
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,RootPaneContainer,WindowConstants
public class LoadSpreadSheetDialog extends BaseDialog
A dialog for loading spreadsheets from disk.- Version:
- $Revision: 11506 $
- 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 ChangeListenerm_AcceptListenerthe listener waiting for the user to accept the input.protected BaseButtonm_ButtonClosethe Close button.protected BaseButtonm_ButtonLoadthe Load button.protected BaseButtonm_ButtonReloadthe button for reloading an existing file.protected ChangeListenerm_CancelListenerthe listener waiting for the user to cancel the dialog.protected BaseComboBoxm_ComboBoxIDthe ID index.protected DefaultComboBoxModelm_ComboBoxIDModelthe ID index model.protected BaseComboBoxm_ComboBoxSortingthe sorting index.protected DefaultComboBoxModelm_ComboBoxSortingModelthe soriting index model.protected Rangem_DefaultAttributeRangethe default range.protected Indexm_DefaultClassIndexthe default class index.protected Indexm_DefaultIDIndexthe default ID index.protected Indexm_DefaultSortIndexthe default sort index.protected SpreadSheetFileChooserPanelm_FilePanelfor selecting the dataset file.protected int[]m_Indicesthe selected indices.protected JListm_ListAdditionalAttributesthe list of additional attribute values to store in the report.protected DefaultListModelm_ListAdditionalAttributesModelthe model for the additional attributes.protected SearchPanelm_SearchPanelthe search panel.protected LoadSpreadSheetDialogm_Selfthe dialog itself.protected SpreadSheetm_Sheetthe full dataset.protected BaseTabbedPanem_TabbedPanethe tabbed pane.protected SpreadSheetTablem_TableDatathe table for displaying the instances.protected BaseTextFieldm_TextAttributeRangethe text field for the attribute range.static StringNO_IDthe "no id" constant.static StringNO_SORTINGthe "no sorting" constant.-
Fields inherited from class adams.gui.core.BaseDialog
m_AfterHideActions, m_AfterShowActions, m_BeforeHideActions, m_BeforeShowActions, m_DisposeCalled, m_LocationBeforeMaximize, m_SizeBeforeMaximize, 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 LoadSpreadSheetDialog(Dialog owner)Creates a modal dialog.LoadSpreadSheetDialog(Dialog owner, String title)Creates a modal dialog.LoadSpreadSheetDialog(Frame owner)Creates a modal dialog.LoadSpreadSheetDialog(Frame owner, String title)Creates a modal dialog.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidacceptSelection()Generates the indices.protected voidbeforeShow()Hook method just before the dialog is made visible.protected voidclose()Closes the dialog.ChangeListenergetAcceptListener()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.ChangeListenergetCancelListener()Returns the listener for the event that the user discarded the input.FilegetCurrent()Returns the current file.RangegetCurrentAttributeRange()Returns the current range of attributes to use.FilegetCurrentDirectory()Returns the current directory in use by the file chooser.intgetCurrentIDIndex()Returns the currently selected ID index.intgetCurrentSortIndex()Returns the currently selected sort index.StringgetDefaultAttributeRange()Returns the default range of attributes to use.StringgetDefaultIDIndex()Returns the default ID index in use.StringgetDefaultSortIndex()Returns the default sort index in use.StringgetFilename()Returns the currently selected filename, "" if none selected.int[]getIndices()Returns the indices of the (actual) selected rows.SpreadSheetgetSpreadSheet()Returns the full spreadsheet, can be null if none loaded.protected voidinitGUI()Initializes the GUI elements.protected voidinitialize()Initializes the members.protected voidloadFile(boolean reload)Loads the file and displays the IDs.protected voidsearch()Performs a search in the fields.voidsetAcceptListener(ChangeListener l)Sets the listener for the event that the user accepts the input.voidsetCancelListener(ChangeListener l)Sets the listener for the event that the user discarded the input.voidsetCurrent(File value)Sets the current file.voidsetCurrentDirectory(File value)Sets the current directory to use for the file chooser.voidsetDefaultAttributeRange(String value)Sets the default range of attributes to use.voidsetDefaultIDIndex(String value)Sets the default ID index to use.voidsetDefaultSortIndex(String value)Sets the default sort index to use.-
Methods inherited from class adams.gui.core.BaseDialog
addAfterHideAction, addAfterShowAction, addBeforeHideAction, addBeforeShowAction, afterHide, afterShow, applyUISettings, beforeHide, canMaximize, canMinimize, dispose, executeAfterHideActions, executeAfterShowActions, executeBeforeHideActions, executeBeforeShowActions, finishInit, getUISettingsApplied, getUISettingsPrefix, maximize, minimize, 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_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 LoadSpreadSheetDialog m_Self
the dialog itself.
-
m_FilePanel
protected SpreadSheetFileChooserPanel m_FilePanel
for selecting the dataset file.
-
m_ButtonReload
protected BaseButton m_ButtonReload
the button for reloading an existing file.
-
m_TableData
protected SpreadSheetTable 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_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_Sheet
protected SpreadSheet m_Sheet
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_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
-
LoadSpreadSheetDialog
public LoadSpreadSheetDialog(Dialog owner)
Creates a modal dialog.- Parameters:
owner- the owning dialog
-
LoadSpreadSheetDialog
public LoadSpreadSheetDialog(Dialog owner, String title)
Creates a modal dialog.- Parameters:
owner- the owning dialogtitle- the title of the dialog
-
LoadSpreadSheetDialog
public LoadSpreadSheetDialog(Frame owner)
Creates a modal dialog.- Parameters:
owner- the owning frame
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classBaseDialog
-
initGUI
protected void initGUI()
Initializes the GUI elements.- Overrides:
initGUIin 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
-
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
-
getSpreadSheet
public SpreadSheet getSpreadSheet()
Returns the full spreadsheet, can be null if none loaded.- Returns:
- the full spreadsheet
-
getIndices
public int[] getIndices()
Returns the indices of the (actual) selected rows.- Returns:
- the indices, null if "Close" was selected
-
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:
beforeShowin 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
-
-