public class DataPanel extends JPanel implements ActionListener, ChangeListener, MouseListener, weka.core.Undoable
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static String |
TAB_INSTANCES
the name of the tab for instances that were set directly
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
DataPanel()
initializes the panel with no data
|
DataPanel(weka.core.Instances data)
initializes the panel with the given data
|
DataPanel(String filename,
weka.core.converters.AbstractFileLoader... loaders)
initializes the panel and loads the specified file
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e)
invoked when an action occurs
|
void |
addChangeListener(ChangeListener l)
Adds a ChangeListener to the panel
|
void |
addInstance()
Add an instance at the currently selected index.
|
void |
addInstanceAtEnd()
Add an instance at the end of the dataset
|
void |
addUndoPoint()
adds the current state of the instances to the undolist
|
void |
attributeAsClass()
sets the current attribute as class attribute, i.e.
|
boolean |
canUndo()
returns whether an undo is possible
|
void |
clearSearch()
clears the search, i.e.
|
void |
clearUndo()
removes the undo history
|
void |
copyContent()
copies the content of the selection to the clipboard
|
protected void |
createPanel()
creates all the components in the frame
|
void |
deleteAttribute()
deletes the currently selected attribute
|
void |
deleteAttributes()
deletes the chosen attributes
|
void |
deleteInstance()
deletes the currently selected instance
|
void |
deleteInstances()
deletes all the currently selected instances
|
Vector<String> |
getAttributes()
returns a list with the attributes
|
String |
getFilename()
returns the filename
|
weka.core.Instances |
getInstances()
returns the instances of the panel, if none then NULL
|
boolean |
getShowAttributeIndex()
Returns whether to display the attribute index in the header.
|
DataTable |
getTable()
returns the table component
|
String |
getTitle()
returns the title for the Tab, i.e.
|
protected void |
initialize()
any member variables are initialized here
|
boolean |
isChanged()
returns whether the content of the panel was changed
|
boolean |
isReadOnly()
returns whether the model is read-only
|
boolean |
isUndoEnabled()
returns whether undo support is enabled
|
void |
mouseClicked(MouseEvent e)
Invoked when a mouse button has been pressed and released on a component
|
void |
mouseEntered(MouseEvent e)
Invoked when the mouse enters a component.
|
void |
mouseExited(MouseEvent e)
Invoked when the mouse exits a component
|
void |
mousePressed(MouseEvent e)
Invoked when a mouse button has been pressed on a component
|
void |
mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component.
|
void |
notifyListener()
notfies all listener of the change
|
void |
removeChangeListener(ChangeListener l)
Removes a ChangeListener from the panel
|
void |
renameAttribute()
renames the current attribute
|
void |
search()
searches for a string in the cells
|
void |
setChanged(boolean changed)
can only reset the changed state to FALSE
|
void |
setFilename(String filename)
sets the filename
|
void |
setInstances(weka.core.Instances data)
displays the given instances, i.e.
|
void |
setOptimalColWidth()
calculates the optimal column width for the current column
|
void |
setOptimalColWidths()
calculates the optimal column widths for all columns
|
void |
setReadOnly(boolean value)
sets whether the model is read-only
|
void |
setShowAttributeIndex(boolean value)
Sets whether to display the attribute index in the header.
|
void |
setUndoEnabled(boolean enabled)
sets whether undo support is enabled
|
void |
sortInstances()
sorts the instances via the currently selected column
|
void |
stateChanged(ChangeEvent e)
Invoked when the target of the listener has changed its state.
|
void |
undo()
performs an undo action
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, 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, getPeer, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final String TAB_INSTANCES
public DataPanel()
public DataPanel(String filename, weka.core.converters.AbstractFileLoader... loaders)
filename
- the file to loadloaders
- optional varargs loader to usepublic DataPanel(weka.core.Instances data)
data
- the data to useprotected void initialize()
protected void createPanel()
public DataTable getTable()
public String getTitle()
public String getFilename()
public void setFilename(String filename)
filename
- the new filenamepublic weka.core.Instances getInstances()
public void setInstances(weka.core.Instances data)
clearUndo()
data
- the instances to displayTAB_INSTANCES
,
clearUndo()
public Vector<String> getAttributes()
public void setChanged(boolean changed)
changed
- if false, resets the changed statepublic boolean isChanged()
public boolean isReadOnly()
public void setReadOnly(boolean value)
value
- if true the model is set to read-onlypublic void setShowAttributeIndex(boolean value)
value
- if true then the attribute indices are displayed in the table
headerpublic boolean getShowAttributeIndex()
public boolean isUndoEnabled()
isUndoEnabled
in interface weka.core.Undoable
public void setUndoEnabled(boolean enabled)
setUndoEnabled
in interface weka.core.Undoable
enabled
- whether to enable/disable undo supportpublic void clearUndo()
clearUndo
in interface weka.core.Undoable
public boolean canUndo()
canUndo
in interface weka.core.Undoable
public void undo()
undo
in interface weka.core.Undoable
public void addUndoPoint()
addUndoPoint
in interface weka.core.Undoable
public void deleteAttribute()
public void deleteAttributes()
public void attributeAsClass()
public void renameAttribute()
public void deleteInstance()
public void addInstance()
public void addInstanceAtEnd()
public void deleteInstances()
public void sortInstances()
public void copyContent()
public void search()
public void clearSearch()
public void setOptimalColWidth()
public void setOptimalColWidths()
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
e
- the action eventpublic void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
e
- the mouse eventpublic void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
e
- the mouse eventpublic void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
e
- the mouse eventpublic void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
e
- the mouse eventpublic void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
e
- the mouse eventpublic void stateChanged(ChangeEvent e)
stateChanged
in interface ChangeListener
e
- the change eventpublic void notifyListener()
public void addChangeListener(ChangeListener l)
l
- the listener to addpublic void removeChangeListener(ChangeListener l)
l
- the listener to removeCopyright © 2017. All Rights Reserved.