Package weka.gui.arffviewer
Class ArffPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
weka.gui.arffviewer.ArffPanel
- All Implemented Interfaces:
- ActionListener,- MouseListener,- ImageObserver,- MenuContainer,- Serializable,- EventListener,- Accessible,- ChangeListener,- Undoable
public class ArffPanel
extends JPanel
implements ActionListener, ChangeListener, MouseListener, Undoable
A Panel representing an ARFF-Table and the associated filename.
- Version:
- $Revision: 14907 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class javax.swing.JComponentJComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.ComponentComponent.BaselineResizeBehavior
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Stringthe name of the tab for instances that were set directlyFields inherited from class javax.swing.JComponentTOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.ComponentBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserverABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidinvoked when an action occursvoidAdds a ChangeListener to the panelvoidAdd an instance at the currently selected index.voidAdd an instance at the end of the datasetvoidadds the current state of the instances to the undolistvoidsets the current attribute as class attribute, i.e.booleancanUndo()returns whether an undo is possiblevoidclears the search, i.e.voidremoves the undo historyvoidcopies the content of the selection to the clipboardvoiddeletes the currently selected attributevoiddeletes the chosen attributesvoiddeletes the currently selected instancevoiddeletes all the currently selected instancesreturns a list with the attributesreturns the filenamereturns the instances of the panel, if none then NULLbooleanReturns whether to display the attribute index in the header.getTable()returns the table componentgetTitle()returns the title for the Tab, i.e.booleanreturns whether the content of the panel was changedbooleanreturns whether the model is read-onlybooleanreturns whether undo support is enabledvoidInvoked when a mouse button has been pressed and released on a componentvoidInvoked when the mouse enters a component.voidInvoked when the mouse exits a componentvoidInvoked when a mouse button has been pressed on a componentvoidInvoked when a mouse button has been released on a component.voidnotfies all listener of the changevoidRemoves a ChangeListener from the panelvoidrenames the current attributevoidsearch()searches for a string in the cellsvoidsets the weight for the current attributevoidsetChanged(boolean changed) can only reset the changed state to FALSEvoidsetFilename(String filename) sets the filenamevoidsetInstances(Instances data) displays the given instances, i.e.voidAllows setting the weight of the instance at the selected row.voidcalculates the optimal column width for the current columnvoidcalculates the optimal column widths for all columnsvoidsetReadOnly(boolean value) sets whether the model is read-onlyvoidsetShowAttributeIndex(boolean value) Sets whether to display the attribute index in the header.voidsetUndoEnabled(boolean enabled) sets whether undo support is enabledvoidsorts the instances via the currently selected columnvoidInvoked when the target of the listener has changed its state.voidundo()performs an undo actionMethods inherited from class javax.swing.JPanelgetAccessibleContext, getUI, getUIClassID, setUI, updateUIMethods inherited from class javax.swing.JComponentaddAncestorListener, 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, updateMethods inherited from class java.awt.Containeradd, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validateMethods inherited from class java.awt.Componentaction, 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, 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- 
TAB_INSTANCESthe name of the tab for instances that were set directly- See Also:
 
 
- 
- 
Constructor Details- 
ArffPanelpublic ArffPanel()initializes the panel with no data
- 
ArffPanelinitializes the panel and loads the specified file- Parameters:
- filename- the file to load
- loaders- optional varargs loader to use
 
- 
ArffPanelinitializes the panel with the given data- Parameters:
- data- the data to use
 
 
- 
- 
Method Details- 
getTablereturns the table component- Returns:
- the table
 
- 
getTitlereturns the title for the Tab, i.e. the filename- Returns:
- the title for the tab
 
- 
getFilenamereturns the filename- Returns:
- the filename
 
- 
setFilenamesets the filename- Parameters:
- filename- the new filename
 
- 
getInstancesreturns the instances of the panel, if none then NULL- Returns:
- the instances of the panel
 
- 
setInstancesdisplays the given instances, i.e. creates a tab with the title TAB_INSTANCES. if one already exists it closes it.
 if a different instances object is used here, don't forget to clear the undo-history by callingclearUndo()- Parameters:
- data- the instances to display
- See Also:
 
- 
getAttributesreturns a list with the attributes- Returns:
- a list of the attributes
 
- 
setChangedpublic void setChanged(boolean changed) can only reset the changed state to FALSE- Parameters:
- changed- if false, resets the changed state
 
- 
isChangedpublic boolean isChanged()returns whether the content of the panel was changed- Returns:
- true if the content was changed
 
- 
isReadOnlypublic boolean isReadOnly()returns whether the model is read-only- Returns:
- true if model is read-only
 
- 
setReadOnlypublic void setReadOnly(boolean value) sets whether the model is read-only- Parameters:
- value- if true the model is set to read-only
 
- 
setShowAttributeIndexpublic void setShowAttributeIndex(boolean value) Sets whether to display the attribute index in the header.- Parameters:
- value- if true then the attribute indices are displayed in the table header
 
- 
getShowAttributeIndexpublic boolean getShowAttributeIndex()Returns whether to display the attribute index in the header.- Returns:
- true if the attribute indices are displayed in the table header
 
- 
isUndoEnabledpublic boolean isUndoEnabled()returns whether undo support is enabled- Specified by:
- isUndoEnabledin interface- Undoable
- Returns:
- true if undo is enabled
 
- 
setUndoEnabledpublic void setUndoEnabled(boolean enabled) sets whether undo support is enabled- Specified by:
- setUndoEnabledin interface- Undoable
- Parameters:
- enabled- whether to enable/disable undo support
 
- 
clearUndopublic void clearUndo()removes the undo history
- 
canUndopublic boolean canUndo()returns whether an undo is possible
- 
undopublic void undo()performs an undo action
- 
addUndoPointpublic void addUndoPoint()adds the current state of the instances to the undolist- Specified by:
- addUndoPointin interface- Undoable
 
- 
deleteAttributepublic void deleteAttribute()deletes the currently selected attribute
- 
deleteAttributespublic void deleteAttributes()deletes the chosen attributes
- 
attributeAsClasspublic void attributeAsClass()sets the current attribute as class attribute, i.e. it moves it to the end of the attributes
- 
renameAttributepublic void renameAttribute()renames the current attribute
- 
setAttributeWeightpublic void setAttributeWeight()sets the weight for the current attribute
- 
deleteInstancepublic void deleteInstance()deletes the currently selected instance
- 
addInstancepublic void addInstance()Add an instance at the currently selected index. If no instance is selected then adds a new instance at the end of the dataset.
- 
setInstanceWeightpublic void setInstanceWeight()Allows setting the weight of the instance at the selected row.
- 
addInstanceAtEndpublic void addInstanceAtEnd()Add an instance at the end of the dataset
- 
deleteInstancespublic void deleteInstances()deletes all the currently selected instances
- 
sortInstancespublic void sortInstances()sorts the instances via the currently selected column
- 
copyContentpublic void copyContent()copies the content of the selection to the clipboard
- 
searchpublic void search()searches for a string in the cells
- 
clearSearchpublic void clearSearch()clears the search, i.e. resets the found cells
- 
setOptimalColWidthpublic void setOptimalColWidth()calculates the optimal column width for the current column
- 
setOptimalColWidthspublic void setOptimalColWidths()calculates the optimal column widths for all columns
- 
actionPerformedinvoked when an action occurs- Specified by:
- actionPerformedin interface- ActionListener
- Parameters:
- e- the action event
 
- 
mouseClickedInvoked when a mouse button has been pressed and released on a component- Specified by:
- mouseClickedin interface- MouseListener
- Parameters:
- e- the mouse event
 
- 
mouseEnteredInvoked when the mouse enters a component.- Specified by:
- mouseEnteredin interface- MouseListener
- Parameters:
- e- the mouse event
 
- 
mouseExitedInvoked when the mouse exits a component- Specified by:
- mouseExitedin interface- MouseListener
- Parameters:
- e- the mouse event
 
- 
mousePressedInvoked when a mouse button has been pressed on a component- Specified by:
- mousePressedin interface- MouseListener
- Parameters:
- e- the mouse event
 
- 
mouseReleasedInvoked when a mouse button has been released on a component.- Specified by:
- mouseReleasedin interface- MouseListener
- Parameters:
- e- the mouse event
 
- 
stateChangedInvoked when the target of the listener has changed its state.- Specified by:
- stateChangedin interface- ChangeListener
- Parameters:
- e- the change event
 
- 
notifyListenerpublic void notifyListener()notfies all listener of the change
- 
addChangeListenerAdds a ChangeListener to the panel- Parameters:
- l- the listener to add
 
- 
removeChangeListenerRemoves a ChangeListener from the panel- Parameters:
- l- the listener to remove
 
 
-