Class InvestigatorPanel

  • All Implemented Interfaces:
    adams.core.CleanUpHandler, adams.core.StatusMessageHandler, adams.gui.core.MenuBarProvider, ImageObserver, MenuContainer, Serializable, Accessible

    public class InvestigatorPanel
    extends adams.gui.workspace.AbstractWorkspacePanel
    implements adams.core.StatusMessageHandler, adams.core.CleanUpHandler
    The main panel for the Investigator.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • FILENAME_SHORTCUTS

        public static final String FILENAME_SHORTCUTS
        the name of the shortcut props file.
        See Also:
        Constant Field Values
      • m_Properties

        protected static adams.core.Properties m_Properties
        the properties.
      • m_ShortcutProperties

        protected static adams.core.Properties m_ShortcutProperties
        the shortcut properties.
      • m_StatusBar

        protected adams.gui.core.BaseStatusBar m_StatusBar
        the status bar.
      • m_MenuBar

        protected JMenuBar m_MenuBar
        the menu bar.
      • m_MenuFileSources

        protected adams.gui.core.BaseMenu m_MenuFileSources
        the submenu for a sources.
      • m_ActionFileClose

        protected adams.gui.action.BaseAction m_ActionFileClose
        the action for closing the investigator.
      • m_MenuItemOptionsUndoEnabled

        protected JCheckBoxMenuItem m_MenuItemOptionsUndoEnabled
        the menu item for enabling/disabling undo.
      • m_MenuItemOptionsCalculateModelSize

        protected JCheckBoxMenuItem m_MenuItemOptionsCalculateModelSize
        the menu item for enabling/disabling model size calculation.
      • m_MenuItemOptionsSortAttributeNames

        protected JCheckBoxMenuItem m_MenuItemOptionsSortAttributeNames
        the menu item for enabling/disabling sorting of attribute names.
      • m_ActionFileClear

        protected adams.gui.action.BaseAction m_ActionFileClear
        the action for clearing all datasets.
      • m_ActionFileOpen

        protected adams.gui.action.BaseAction m_ActionFileOpen
        the action for loading a dataset.
      • m_ActionFileClassAttribute

        protected adams.gui.action.BaseAction m_ActionFileClassAttribute
        the action for selecting the class attribute heuristic.
      • m_ActionFileRelationName

        protected adams.gui.action.BaseAction m_ActionFileRelationName
        the action for selecting the relation name heuristic.
      • m_ActionFileStopJob

        protected adams.gui.action.BaseAction m_ActionFileStopJob
        the action for stopping a job.
      • m_MenuTabNewTab

        protected adams.gui.core.BaseMenu m_MenuTabNewTab
        the submenu for a new tab.
      • m_ActionTabCopyTab

        protected adams.gui.action.BaseAction m_ActionTabCopyTab
        the action for copying a tab.
      • m_ActionTabSaveParameters

        protected adams.gui.action.BaseAction m_ActionTabSaveParameters
        the action for saving parmeters of a tab.
      • m_ActionTabLoadParameters

        protected adams.gui.action.BaseAction m_ActionTabLoadParameters
        the action for loading parameters for a tab.
      • m_ActionTabCloseTab

        protected adams.gui.action.BaseAction m_ActionTabCloseTab
        the action for closing a tab.
      • m_ActionTabUndoCloseTab

        protected adams.gui.action.BaseAction m_ActionTabUndoCloseTab
        the action for undoing closed a tab.
      • m_ActionTabCloseAllTabs

        protected adams.gui.action.BaseAction m_ActionTabCloseAllTabs
        the action for closing all tabs.
      • m_FileChooser

        protected WekaFileChooser m_FileChooser
        the filechooser for datasets.
      • m_RecentFilesHandler

        protected adams.gui.core.RecentFilesHandlerWithCommandline<JMenu> m_RecentFilesHandler
        the recent files handler.
      • m_StatusBarDateFormat

        protected adams.core.DateFormat m_StatusBarDateFormat
        for timestamps in the statusbar.
      • m_Worker

        protected Thread m_Worker
        for executing operations (loading files etc).
    • Constructor Detail

      • InvestigatorPanel

        public InvestigatorPanel()
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class adams.gui.workspace.AbstractWorkspacePanel
      • initGUI

        protected void initGUI()
        Initializes the widgets.
        Overrides:
        initGUI in class adams.gui.core.BasePanel
      • addDefaultTabs

        public void addDefaultTabs()
        Adds the default tabs.
      • initActions

        protected void initActions()
        Initializes the actions.
      • updateActions

        protected void updateActions()
        Updates the actions.
      • getMenuBar

        public JMenuBar getMenuBar()
        Creates a menu bar (singleton per panel object). Can be used in frames.
        Specified by:
        getMenuBar in interface adams.gui.core.MenuBarProvider
        Specified by:
        getMenuBar in class adams.gui.workspace.AbstractWorkspacePanel
        Returns:
        the menu bar
      • updateTitle

        protected void updateTitle()
        Updates the title of the dialog.
        Specified by:
        updateTitle in class adams.gui.workspace.AbstractWorkspacePanel
      • updateMenu

        protected void updateMenu()
        updates the enabled state of the menu items.
        Specified by:
        updateMenu in class adams.gui.workspace.AbstractWorkspacePanel
      • getDefaultTitle

        protected String getDefaultTitle()
        Returns the default title.
        Specified by:
        getDefaultTitle in class adams.gui.workspace.AbstractWorkspacePanel
        Returns:
        the default title
      • isBusy

        public boolean isBusy()
        Returns whether the tab is busy.
        Returns:
        true if busy
      • startExecution

        public boolean startExecution​(InvestigatorJob job)
        Starts a job.
        Parameters:
        job - the job to execute
      • stopExecution

        public void stopExecution()
        Stops the evaluation.
      • executionFinished

        public void executionFinished()
        Gets called when a job finishes.
      • getTimestampPrefix

        protected String getTimestampPrefix()
        Return the timestamp prefix for logs.
        Returns:
        the prefix
      • logMessage

        public void logMessage​(String msg)
        Logs the message.
        Specified by:
        logMessage in class adams.gui.workspace.AbstractWorkspacePanel
        Parameters:
        msg - the log message
      • logAndShowMessage

        public void logAndShowMessage​(String msg)
        Logs the error message and shows it in the status bar.
        Parameters:
        msg - the error message
      • logError

        public void logError​(String msg,
                             String title)
        Logs the error message and also displays an error dialog.
        Specified by:
        logError in class adams.gui.workspace.AbstractWorkspacePanel
        Parameters:
        msg - the error message
        title - the title for the dialog
      • getLog

        public StringBuilder getLog()
        Returns the internal log buffer.
        Returns:
        the buffer
      • clearLog

        public void clearLog()
        Empties the log.
      • getData

        public DataContainerList getData()
        Returns the currently loaded data.
        Returns:
        the data
      • fireDataChange

        public void fireDataChange​(WekaInvestigatorDataEvent e)
        Notifies all the tabs that the data has changed.
        Parameters:
        e - the event to send
      • getTabbedPane

        public InvestigatorTabbedPane getTabbedPane()
        Returns the underlying tabbed pane.
        Returns:
        the tabbed pane
      • updateClassAttribute

        public weka.core.Instances updateClassAttribute​(weka.core.Instances data)
        Updates the class attribute, if not set.
        Parameters:
        data - the data to update
        Returns:
        the (potentially) updated data
      • updateRelationName

        public weka.core.Instances updateRelationName​(File file,
                                                      weka.core.Instances data)
        Updates the relation name.
        Parameters:
        file - the file the data was loaded from
        data - the data to update
        Returns:
        the (potentially) updated data
      • addRecentFile

        public String addRecentFile​(File file,
                                    weka.core.converters.AbstractFileLoader loader)
        Adds the specified file/loader combination to the recent files list.
        Parameters:
        file - the file to add
        loader - the associated loader, if null uses auto-detect for loader
        Returns:
        null if successful or no recent files being managed, otherwise error message
      • clear

        public void clear()
        Removes all currently loaded datasets.
      • openFile

        public void openFile()
        Lets user select a dataset.
      • openFile

        public void openFile​(File file)
        Lets user select a dataset.
      • openRecent

        public void openRecent​(adams.gui.event.RecentItemEvent<JMenu,​adams.gui.core.RecentFilesHandlerWithCommandline.Setup> e)
        For opening a recently used file.
        Parameters:
        e - the event
      • chooseClassAttributeHeuristic

        public void chooseClassAttributeHeuristic()
        Lets the user choose the class attribute heuristic.
      • setClassAttributeHeuristic

        public void setClassAttributeHeuristic​(AbstractClassAttributeHeuristic value)
        Sets the class attribute heuristic.
        Parameters:
        value - the heuristic
      • getClassAttributeHeuristic

        public AbstractClassAttributeHeuristic getClassAttributeHeuristic()
        Returns the current class attribute heuristic.
        Returns:
        the heuristic
      • chooseRelationNameHeuristic

        public void chooseRelationNameHeuristic()
        Lets the user choose the relation name heuristic.
      • setRelationNameHeuristic

        public void setRelationNameHeuristic​(AbstractRelationNameHeuristic value)
        Sets the relation name heuristic.
        Parameters:
        value - the heuristic
      • getRelationNameHeuristic

        public AbstractRelationNameHeuristic getRelationNameHeuristic()
        Returns the current relation name heuristic.
        Returns:
        the heuristic
      • isUndoEnabled

        public boolean isUndoEnabled()
        Returns whether undo is enabled.
        Returns:
        true if enabled
      • setUndoEnabled

        public void setUndoEnabled​(boolean value)
        Sets the undo state.
        Parameters:
        value - true if to enable
      • toggleUndo

        protected void toggleUndo()
        Toggles the undo state.
      • calculateModelSize

        public boolean calculateModelSize()
        Returns whether model sizes should get calculated.
        Returns:
        true if to calculate
      • setSortAttributeNames

        public void setSortAttributeNames​(boolean value)
        Sets whether to sort the attribute names.
        Parameters:
        value - true if to sort
      • getSortAttributeNames

        public boolean getSortAttributeNames()
        Returns whether to sort the attribute names.
        Returns:
        true if to sort
      • toggleSortAttributeNames

        protected void toggleSortAttributeNames()
        Toggles the "sort attribute names" option.
      • showStatus

        public void showStatus​(String msg)
        Displays a message.
        Specified by:
        showStatus in interface adams.core.StatusMessageHandler
        Parameters:
        msg - the message to display
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
        Specified by:
        cleanUp in interface adams.core.CleanUpHandler
        Overrides:
        cleanUp in class adams.gui.workspace.AbstractWorkspacePanel
      • getProperties

        public static adams.core.Properties getProperties()
        Returns the properties that define the investigator.
        Returns:
        the properties
      • getShortcutProperties

        public static adams.core.Properties getShortcutProperties()
        Returns the properties that define the shortcuts.
        Returns:
        the properties