Package weka.gui.arffviewer
Class ArffViewerMainPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- weka.gui.arffviewer.ArffViewerMainPanel
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.event.ChangeListener
public class ArffViewerMainPanel extends javax.swing.JPanel implements java.awt.event.ActionListener, javax.swing.event.ChangeListener
The main panel of the ArffViewer. It has a reference to the menu, that an implementing JFrame only needs to add via the setJMenuBar(JMenuBar) method.- Version:
- $Revision: 9892 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_HEIGHT
the default for heightstatic int
DEFAULT_LEFT
the default for leftstatic int
DEFAULT_TOP
the default for topstatic int
DEFAULT_WIDTH
the default for widthstatic int
HEIGHT
default heightstatic int
WIDTH
default width-
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description ArffViewerMainPanel(java.awt.Container parentFrame)
initializes the object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
invoked when an action occursvoid
attributeAsClass()
sets the current selected Attribute as class attribute, i.e.void
clearSearch()
clears the search, i.e.void
close()
closes the window, i.e., if the parent is not null and implements the WindowListener interface it calls the windowClosing methodvoid
closeAllFiles()
closes all open filesvoid
closeFile()
closes the current tabvoid
closeFile(boolean showCancel)
closes the current tabvoid
copyContent()
copies the content of the selection to the clipboardvoid
deleteAttribute(boolean multiple)
deletes the current selected Attribute or several chosen onesvoid
deleteInstance(boolean multiple)
deletes the current selected Instance or several chosen onesboolean
getConfirmExit()
returns the setting of whether to display a confirm messagebox or not on exitjava.lang.String
getCurrentFilename()
returns the filename of the current tabint
getCurrentIndex()
returns the currently selected tab indexArffPanel
getCurrentPanel()
returns the currently selected panelboolean
getExitOnClose()
returns TRUE if a System.exit(0) is done on a closejava.lang.String
getFilename(int index)
returns the filename of the specified paneljava.lang.String
getFrameTitle()
returns the title (incl.javax.swing.JMenuBar
getMenu()
returns the menu bar to be added in a frameArffPanel
getPanel(int index)
returns the specified panel,null
if index is out of boundsint
getPanelCount()
returns the number of panels currently openjavax.swing.JFrame
getParentFrame()
returns the parent frame, if it's a JFrame, otherwise nulljavax.swing.JInternalFrame
getParentInternalFrame()
returns the parent frame, if it's a JInternalFrame, otherwise nulljavax.swing.JTabbedPane
getTabbedPane()
returns the tabbedpane instanceboolean
isPanelSelected()
checks whether a panel is currently selectedvoid
loadFile()
loads the specified file into the tablevoid
loadFile(java.lang.String filename)
loads the specified filevoid
refresh()
validates and repaints the framevoid
renameAttribute()
renames the current selected Attributevoid
saveFile()
saves the current data into a filevoid
saveFileAs()
saves the current data into a new filevoid
search()
searches for a string in the cellsvoid
setConfirmExit(boolean confirm)
whether to present a MessageBox on Exit or notvoid
setCurrentFilename(java.lang.String filename)
sets the filename of the current tabvoid
setExitOnClose(boolean value)
whether to do a System.exit(0) on closevoid
setFilename(int index, java.lang.String filename)
sets the filename of the specified panelvoid
setOptimalColWidths()
sets the optimal column width for all columnsvoid
setParent(java.awt.Container value)
sets the new parent framejava.lang.String
showAttributes()
displays all the attributes, returns the selected item or NULL if canceledvoid
showProperties()
displays some properties of the instancesvoid
showValues()
displays all the distinct values for an attributevoid
sortInstances()
sorts the current selected attributevoid
stateChanged(javax.swing.event.ChangeEvent e)
Invoked when the target of the listener has changed its state.java.lang.String
toString()
returns only the classnamevoid
undo()
undoes the last actionvoid
updateFrameTitle()
sets the title of the parent frame, if one was provided-
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, 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, 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, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
DEFAULT_WIDTH
public static final int DEFAULT_WIDTH
the default for width- See Also:
- Constant Field Values
-
DEFAULT_HEIGHT
public static final int DEFAULT_HEIGHT
the default for height- See Also:
- Constant Field Values
-
DEFAULT_LEFT
public static final int DEFAULT_LEFT
the default for left- See Also:
- Constant Field Values
-
DEFAULT_TOP
public static final int DEFAULT_TOP
the default for top- See Also:
- Constant Field Values
-
WIDTH
public static final int WIDTH
default width- See Also:
- Constant Field Values
-
HEIGHT
public static final int HEIGHT
default height- See Also:
- Constant Field Values
-
-
Method Detail
-
getParentFrame
public javax.swing.JFrame getParentFrame()
returns the parent frame, if it's a JFrame, otherwise null- Returns:
- the parent frame
-
getParentInternalFrame
public javax.swing.JInternalFrame getParentInternalFrame()
returns the parent frame, if it's a JInternalFrame, otherwise null- Returns:
- the parent frame
-
setParent
public void setParent(java.awt.Container value)
sets the new parent frame- Parameters:
value
- the parent frame
-
getMenu
public javax.swing.JMenuBar getMenu()
returns the menu bar to be added in a frame- Returns:
- the menu bar
-
getTabbedPane
public javax.swing.JTabbedPane getTabbedPane()
returns the tabbedpane instance- Returns:
- the tabbed pane
-
setConfirmExit
public void setConfirmExit(boolean confirm)
whether to present a MessageBox on Exit or not- Parameters:
confirm
- whether a MessageBox pops up or not to confirm exit
-
getConfirmExit
public boolean getConfirmExit()
returns the setting of whether to display a confirm messagebox or not on exit- Returns:
- whether a messagebox is displayed or not
-
setExitOnClose
public void setExitOnClose(boolean value)
whether to do a System.exit(0) on close- Parameters:
value
- enables/disables a System.exit(0) on close
-
getExitOnClose
public boolean getExitOnClose()
returns TRUE if a System.exit(0) is done on a close- Returns:
- true if a System.exit(0) is done on close
-
refresh
public void refresh()
validates and repaints the frame
-
getFrameTitle
public java.lang.String getFrameTitle()
returns the title (incl. filename) for the frame- Returns:
- the frame title
-
updateFrameTitle
public void updateFrameTitle()
sets the title of the parent frame, if one was provided
-
getPanelCount
public int getPanelCount()
returns the number of panels currently open- Returns:
- the number of open panels
-
getPanel
public ArffPanel getPanel(int index)
returns the specified panel,null
if index is out of bounds- Parameters:
index
- the index of the panel- Returns:
- the panel
-
getCurrentIndex
public int getCurrentIndex()
returns the currently selected tab index- Returns:
- the index of the currently selected tab
-
getCurrentPanel
public ArffPanel getCurrentPanel()
returns the currently selected panel- Returns:
- the currently selected panel
-
isPanelSelected
public boolean isPanelSelected()
checks whether a panel is currently selected- Returns:
- true if a panel is currently selected
-
getFilename
public java.lang.String getFilename(int index)
returns the filename of the specified panel- Parameters:
index
- the index of the panel- Returns:
- the filename for the panel
-
getCurrentFilename
public java.lang.String getCurrentFilename()
returns the filename of the current tab- Returns:
- the current filename
-
setFilename
public void setFilename(int index, java.lang.String filename)
sets the filename of the specified panel- Parameters:
index
- the index of the panelfilename
- the new filename
-
setCurrentFilename
public void setCurrentFilename(java.lang.String filename)
sets the filename of the current tab- Parameters:
filename
- the new filename
-
loadFile
public void loadFile(java.lang.String filename)
loads the specified file- Parameters:
filename
- the file to load
-
loadFile
public void loadFile()
loads the specified file into the table
-
saveFile
public void saveFile()
saves the current data into a file
-
saveFileAs
public void saveFileAs()
saves the current data into a new file
-
closeFile
public void closeFile()
closes the current tab
-
closeFile
public void closeFile(boolean showCancel)
closes the current tab- Parameters:
showCancel
- whether to show an additional CANCEL button in the "Want to save changes"-dialog- See Also:
saveChanges(boolean)
-
closeAllFiles
public void closeAllFiles()
closes all open files
-
showProperties
public void showProperties()
displays some properties of the instances
-
close
public void close()
closes the window, i.e., if the parent is not null and implements the WindowListener interface it calls the windowClosing method
-
undo
public void undo()
undoes the last action
-
copyContent
public void copyContent()
copies the content of the selection to the clipboard
-
search
public void search()
searches for a string in the cells
-
clearSearch
public void clearSearch()
clears the search, i.e. resets the found cells
-
renameAttribute
public void renameAttribute()
renames the current selected Attribute
-
attributeAsClass
public void attributeAsClass()
sets the current selected Attribute as class attribute, i.e. it moves it to the end of the attributes
-
deleteAttribute
public void deleteAttribute(boolean multiple)
deletes the current selected Attribute or several chosen ones- Parameters:
multiple
- whether to delete myultiple attributes
-
deleteInstance
public void deleteInstance(boolean multiple)
deletes the current selected Instance or several chosen ones- Parameters:
multiple
- whether to delete multiple instances
-
sortInstances
public void sortInstances()
sorts the current selected attribute
-
showAttributes
public java.lang.String showAttributes()
displays all the attributes, returns the selected item or NULL if canceled- Returns:
- the name of the selected attribute
-
showValues
public void showValues()
displays all the distinct values for an attribute
-
setOptimalColWidths
public void setOptimalColWidths()
sets the optimal column width for all columns
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
invoked when an action occurs- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Parameters:
e
- the action event
-
stateChanged
public void stateChanged(javax.swing.event.ChangeEvent e)
Invoked when the target of the listener has changed its state.- Specified by:
stateChanged
in interfacejavax.swing.event.ChangeListener
- Parameters:
e
- the change event
-
toString
public java.lang.String toString()
returns only the classname- Overrides:
toString
in classjava.awt.Component
- Returns:
- the classname
-
-