Package weka.gui
Class SetInstancesPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
weka.gui.SetInstancesPanel
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
A panel that displays an instance summary for a set of instances and lets the
user open a set of instances from either a file or URL.
Instances may be obtained either in a batch or incremental fashion. If
incremental reading is used, then the client should obtain the Loader object
(by calling getLoader()) and read the instances one at a time. If batch
loading is used, then SetInstancesPanel will load the data into memory inside
of a separate thread and notify the client when the operation is complete.
The client can then retrieve the instances by calling getInstances().
- Version:
- $Revision: 15301 $
- Author:
- Len Trigg (trigg@cs.waikato.ac.nz)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
the text denoting "no class" in the class combobox.Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
ConstructorDescriptionDefault constructor.SetInstancesPanel
(boolean showZeroInstancesAsUnknown, boolean showClassComboBox, ConverterFileChooser chooser) Create the panel. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a PropertyChangeListener who will be notified of value changes.void
closes the frame, i.e., the visibility is set to false.int
Returns the currently selected class index.Gets the set of instances currently held by the panel.Gets the currently used Loader.Returns the current frame the panel knows of, that it resides in.boolean
Gets whether instances are to be read incrementally or not.Gets the instances summary panel associated with this panel.void
Removes a PropertyChangeListener.void
Updates the set of instances that is currently held by the panel.void
setInstances
(Instances i, boolean showZeroInstancesAsUnknown) Updates the set of instances that is currently held by the panel.void
Queries the user for a file to load instances from, then loads the instances in a background process.void
Queries the user for a URL to load instances from, then loads the instances in a background process.void
setParentFrame
(JFrame parent) Sets the frame, this panel resides in.void
setReadIncrementally
(boolean incremental) Sets whether or not instances should be read incrementally by the Loader.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
NO_CLASS
the text denoting "no class" in the class combobox.- See Also:
-
-
Constructor Details
-
SetInstancesPanel
public SetInstancesPanel()Default constructor. -
SetInstancesPanel
public SetInstancesPanel(boolean showZeroInstancesAsUnknown, boolean showClassComboBox, ConverterFileChooser chooser) Create the panel.- Parameters:
showZeroInstancesAsUnknown
- whether to display zero instances as unknown (e.g., when reading data incrementally)showClassComboBox
- whether to display a combobox allowing the user to choose the class attributechooser
- the file chooser to use (may be null to use the default file chooser)
-
-
Method Details
-
setParentFrame
Sets the frame, this panel resides in. Used for displaying the close button, i.e., the close-button is visible if the given frame is not null.- Parameters:
parent
- the parent frame
-
getParentFrame
Returns the current frame the panel knows of, that it resides in. Can be null.- Returns:
- the current parent frame
-
closeFrame
public void closeFrame()closes the frame, i.e., the visibility is set to false. -
setInstancesFromFileQ
public void setInstancesFromFileQ()Queries the user for a file to load instances from, then loads the instances in a background process. This is done in the IO thread, and an error message is popped up if the IO thread is busy. -
setInstancesFromURLQ
public void setInstancesFromURLQ()Queries the user for a URL to load instances from, then loads the instances in a background process. This is done in the IO thread, and an error message is popped up if the IO thread is busy. -
setInstances
Updates the set of instances that is currently held by the panel.- Parameters:
i
- a value of type 'Instances'
-
setInstances
Updates the set of instances that is currently held by the panel.- Parameters:
i
- a value of type 'Instances'showZeroInstancesAsUnknown
- self-explanatory
-
getInstances
Gets the set of instances currently held by the panel.- Returns:
- a value of type 'Instances'
-
getClassIndex
public int getClassIndex()Returns the currently selected class index.- Returns:
- the class index, -1 if none selected
-
getLoader
Gets the currently used Loader.- Returns:
- a value of type 'Loader'
-
getSummary
Gets the instances summary panel associated with this panel.- Returns:
- the instances summary panel
-
setReadIncrementally
public void setReadIncrementally(boolean incremental) Sets whether or not instances should be read incrementally by the Loader. If incremental reading is used, then the client should obtain the Loader object (by calling getLoader()) and read the instances one at a time. If batch loading is used, then SetInstancesPanel will load the data into memory inside of a separate thread and notify the client when the operation is complete. The client can then retrieve the instances by calling getInstances().- Parameters:
incremental
- true if instances are to be read incrementally
-
getReadIncrementally
public boolean getReadIncrementally()Gets whether instances are to be read incrementally or not.- Returns:
- true if instances are to be read incrementally
-
addPropertyChangeListener
Adds a PropertyChangeListener who will be notified of value changes.- Overrides:
addPropertyChangeListener
in classContainer
- Parameters:
l
- a value of type 'PropertyChangeListener'
-
removePropertyChangeListener
Removes a PropertyChangeListener.- Overrides:
removePropertyChangeListener
in classComponent
- Parameters:
l
- a value of type 'PropertyChangeListener'
-