Class ArffPanel

    • Field Detail

      • TAB_INSTANCES

        public static final String TAB_INSTANCES
        the name of the tab for instances that were set directly
        See Also:
        Constant Field Values
    • Constructor Detail

      • ArffPanel

        public ArffPanel()
        initializes the panel with no data
      • ArffPanel

        public ArffPanel​(String filename,
                         AbstractFileLoader... loaders)
        initializes the panel and loads the specified file
        Parameters:
        filename - the file to load
        loaders - optional varargs loader to use
      • ArffPanel

        public ArffPanel​(Instances data)
        initializes the panel with the given data
        Parameters:
        data - the data to use
    • Method Detail

      • getTable

        public ArffTable getTable()
        returns the table component
        Returns:
        the table
      • getTitle

        public String getTitle()
        returns the title for the Tab, i.e. the filename
        Returns:
        the title for the tab
      • getFilename

        public String getFilename()
        returns the filename
        Returns:
        the filename
      • setFilename

        public void setFilename​(String filename)
        sets the filename
        Parameters:
        filename - the new filename
      • getInstances

        public Instances getInstances()
        returns the instances of the panel, if none then NULL
        Returns:
        the instances of the panel
      • setInstances

        public void setInstances​(Instances data)
        displays 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 calling clearUndo()
        Parameters:
        data - the instances to display
        See Also:
        TAB_INSTANCES, clearUndo()
      • getAttributes

        public Vector<String> getAttributes()
        returns a list with the attributes
        Returns:
        a list of the attributes
      • setChanged

        public void setChanged​(boolean changed)
        can only reset the changed state to FALSE
        Parameters:
        changed - if false, resets the changed state
      • isChanged

        public boolean isChanged()
        returns whether the content of the panel was changed
        Returns:
        true if the content was changed
      • isReadOnly

        public boolean isReadOnly()
        returns whether the model is read-only
        Returns:
        true if model is read-only
      • setReadOnly

        public void setReadOnly​(boolean value)
        sets whether the model is read-only
        Parameters:
        value - if true the model is set to read-only
      • setShowAttributeIndex

        public 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
      • getShowAttributeIndex

        public boolean getShowAttributeIndex()
        Returns whether to display the attribute index in the header.
        Returns:
        true if the attribute indices are displayed in the table header
      • isUndoEnabled

        public boolean isUndoEnabled()
        returns whether undo support is enabled
        Specified by:
        isUndoEnabled in interface Undoable
        Returns:
        true if undo is enabled
      • setUndoEnabled

        public void setUndoEnabled​(boolean enabled)
        sets whether undo support is enabled
        Specified by:
        setUndoEnabled in interface Undoable
        Parameters:
        enabled - whether to enable/disable undo support
      • clearUndo

        public void clearUndo()
        removes the undo history
        Specified by:
        clearUndo in interface Undoable
      • canUndo

        public boolean canUndo()
        returns whether an undo is possible
        Specified by:
        canUndo in interface Undoable
        Returns:
        true if undo is possible
      • undo

        public void undo()
        performs an undo action
        Specified by:
        undo in interface Undoable
      • addUndoPoint

        public void addUndoPoint()
        adds the current state of the instances to the undolist
        Specified by:
        addUndoPoint in interface Undoable
      • deleteAttribute

        public void deleteAttribute()
        deletes the currently selected attribute
      • deleteAttributes

        public void deleteAttributes()
        deletes the chosen attributes
      • attributeAsClass

        public void attributeAsClass()
        sets the current attribute as class attribute, i.e. it moves it to the end of the attributes
      • renameAttribute

        public void renameAttribute()
        renames the current attribute
      • setAttributeWeight

        public void setAttributeWeight()
        sets the weight for the current attribute
      • deleteInstance

        public void deleteInstance()
        deletes the currently selected instance
      • addInstance

        public 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.
      • setInstanceWeight

        public void setInstanceWeight()
        Allows setting the weight of the instance at the selected row.
      • addInstanceAtEnd

        public void addInstanceAtEnd()
        Add an instance at the end of the dataset
      • deleteInstances

        public void deleteInstances()
        deletes all the currently selected instances
      • sortInstances

        public void sortInstances()
        sorts the instances via the currently selected column
      • 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
      • setOptimalColWidth

        public void setOptimalColWidth()
        calculates the optimal column width for the current column
      • setOptimalColWidths

        public void setOptimalColWidths()
        calculates the optimal column widths for all columns
      • mouseClicked

        public void mouseClicked​(MouseEvent e)
        Invoked when a mouse button has been pressed and released on a component
        Specified by:
        mouseClicked in interface MouseListener
        Parameters:
        e - the mouse event
      • mouseEntered

        public void mouseEntered​(MouseEvent e)
        Invoked when the mouse enters a component.
        Specified by:
        mouseEntered in interface MouseListener
        Parameters:
        e - the mouse event
      • mouseExited

        public void mouseExited​(MouseEvent e)
        Invoked when the mouse exits a component
        Specified by:
        mouseExited in interface MouseListener
        Parameters:
        e - the mouse event
      • mousePressed

        public void mousePressed​(MouseEvent e)
        Invoked when a mouse button has been pressed on a component
        Specified by:
        mousePressed in interface MouseListener
        Parameters:
        e - the mouse event
      • mouseReleased

        public void mouseReleased​(MouseEvent e)
        Invoked when a mouse button has been released on a component.
        Specified by:
        mouseReleased in interface MouseListener
        Parameters:
        e - the mouse 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
      • notifyListener

        public void notifyListener()
        notfies all listener of the change
      • addChangeListener

        public void addChangeListener​(ChangeListener l)
        Adds a ChangeListener to the panel
        Parameters:
        l - the listener to add
      • removeChangeListener

        public void removeChangeListener​(ChangeListener l)
        Removes a ChangeListener from the panel
        Parameters:
        l - the listener to remove