Class ArffViewerMainPanel

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class ArffViewerMainPanel extends JPanel implements ActionListener, 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: 11342 $
Author:
FracPete (fracpete at waikato dot ac dot nz)
See Also:
  • Field Details

  • Constructor Details

    • ArffViewerMainPanel

      public ArffViewerMainPanel(Container parentFrame)
      initializes the object
      Parameters:
      parentFrame - the parent frame (JFrame or JInternalFrame)
  • Method Details

    • getParentFrame

      public JFrame getParentFrame()
      returns the parent frame, if it's a JFrame, otherwise null
      Returns:
      the parent frame
    • getParentInternalFrame

      public JInternalFrame getParentInternalFrame()
      returns the parent frame, if it's a JInternalFrame, otherwise null
      Returns:
      the parent frame
    • setParent

      public void setParent(Container value)
      sets the new parent frame
      Parameters:
      value - the parent frame
    • getMenu

      public JMenuBar getMenu()
      returns the menu bar to be added in a frame
      Returns:
      the menu bar
    • getTabbedPane

      public 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 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 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 String getCurrentFilename()
      returns the filename of the current tab
      Returns:
      the current filename
    • setFilename

      public void setFilename(int index, String filename)
      sets the filename of the specified panel
      Parameters:
      index - the index of the panel
      filename - the new filename
    • setCurrentFilename

      public void setCurrentFilename(String filename)
      sets the filename of the current tab
      Parameters:
      filename - the new filename
    • loadFile

      public void loadFile(String filename, AbstractFileLoader... loaders)
      loads the specified file
      Parameters:
      filename - the file to load
      loaders - optional varargs loader to use
    • 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 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(ActionEvent e)
      invoked when an action occurs
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      e - the action event
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Invoked when the target of the listener has changed its state.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      e - the change event
    • toString

      public String toString()
      returns only the classname
      Overrides:
      toString in class Component
      Returns:
      the classname