Package dialog

Class TabbedGUI

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, Runnable, EventListener, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
TemplateGUI

public abstract class TabbedGUI extends JFrame implements Runnable, ActionListener
Abstract class for graphical user interfaces with tabbed panes.
Since:
2007.02.12
See Also:
  • Field Details

    • owner

      protected Component owner
      the owner of this dialog box
    • isprog

      protected boolean isprog
      whether started as an independent program
    • pane

      protected JTabbedPane pane
      the pane for the dialog tabs
    • format

      protected FormatPanel format
      the data format tab
    • domains

      protected DomainsPanel domains
      the domains determination tab
    • terminal

      protected TerminalPanel terminal
      the terminal output tab
    • status

      protected JTextField status
      the status line (for messages)
    • exec

      protected JButton exec
      the execution button
    • executor

      protected util.Executor executor
      the executor for an object or an external program
    • index

      protected int index
      the index of the executed tab
    • start

      protected long start
      the start time for the execution
    • log

      protected transient PrintStream log
      the stream to write progress messages to
  • Constructor Details

    • TabbedGUI

      protected TabbedGUI()
      Constructor.
      Since:
      2023.07.30 (Christian Borgelt)
  • Method Details

    • init

      protected void init(Component owner, boolean isprog)
      Convenience function for the constructors of child classes.
      Parameters:
      owner - the owner of this dialog box
      isprog - whether started as a separate program
      Since:
      2007.02.10 (Christian Borgelt)
    • run

      public abstract void run()
      Create the user interface.

      Following the recommendations in the Java tutorial, the user interface is created in the "run" method, which is invoked from the event queue, in order to avoid problems with threads.

      Specified by:
      run in interface Runnable
      Since:
      2007.02.10 (Christian Borgelt)
    • base

      protected void base(String title)
      Create the basic graphical user interface.
      Parameters:
      title - the title of the dialog box
      Since:
      2007.02.10 (Christian Borgelt)
    • addTab

      public void addTab(String title, DialogPanel panel)
      Add a dialog tab.
      Parameters:
      title - the title of the dialog tab to add
      panel - the dialog tab to add
      Since:
      2007.07.26 (Christian Borgelt)
    • addTab

      public DialogPanel addTab(String title)
      Add an empty dialog tab.
      Parameters:
      title - the title of the dialog tab to add
      Returns:
      the added empty dialog tab
      Since:
      2007.07.26 (Christian Borgelt)
    • getTab

      public DialogPanel getTab(int index)
      Get the tab at a given index.
      Parameters:
      index - the index of the tab to get
      Returns:
      the tab with the given index
      Since:
      2007.07.24 (Christian Borgelt)
    • addFormatTab

      public FormatPanel addFormatTab()
      Add a data format tab.
      Returns:
      the created data format tab
      Since:
      2007.07.26 (Christian Borgelt)
    • addFormatTab

      public FormatPanel addFormatTab(int mode)
      Add a data format tab.
      Parameters:
      mode - the mode of the format tab
      Returns:
      the created data format tab
      Since:
      2007.07.26 (Christian Borgelt)
    • addFormatTab

      public FormatPanel addFormatTab(String title, int mode)
      Add a data format tab.
      Parameters:
      title - the title of the format tab
      mode - the mode of the format tab
      Returns:
      the created data format tab
      Since:
      2007.07.26 (Christian Borgelt)
    • getFormatTab

      public FormatPanel getFormatTab()
      Get the data format tab.
      Returns:
      the created data format tab
      Since:
      2007.07.24 (Christian Borgelt)
    • addDomainsTab

      public DomainsPanel addDomainsTab(int mode)
      Add a domain determination tab.
      Parameters:
      mode - the mode of the domains tab
      Returns:
      the created domains determination tab
      Since:
      2007.07.26 (Christian Borgelt)
    • addDomainsTab

      public DomainsPanel addDomainsTab(String title, int mode)
      Add a domain determination tab.
      Parameters:
      title - the title of the domains tab
      mode - the mode of the domains tab
      Returns:
      the created domains determination tab
      Since:
      2007.07.26 (Christian Borgelt)
    • getDomainsTab

      public DomainsPanel getDomainsTab()
      Get the domains determination tab.
      Returns:
      the created domains determination tab
      Since:
      2007.07.24 (Christian Borgelt)
    • addTerminalTab

      public TerminalPanel addTerminalTab(String title)
      Add a terminal output tab.
      Parameters:
      title - the title of the domains tab
      Returns:
      the created terminal output tab
      Since:
      2014.10.22 (Christian Borgelt)
    • getTerminalTab

      public TerminalPanel getTerminalTab()
      Get the terminal tab.
      Returns:
      the created terminal output tab
      Since:
      2014.10.22 (Christian Borgelt)
    • selectTab

      public void selectTab(int index)
      Set the selected dialog tab.
      Parameters:
      index - the index of the tab to select
      Since:
      2007.07.26 (Christian Borgelt)
    • setFormat

      public void setFormat(FormatPanel fmt)
      set the data format.
      Parameters:
      fmt - the format panel to set the format from
      Since:
      2007.07.26 (Christian Borgelt)
    • setDomainsFile

      public void setDomainsFile(File file)
      Set the domains file.
      Parameters:
      file - the domains file to set
      Since:
      2007.07.24 (Christian Borgelt)
    • setDataFile

      public void setDataFile(File file)
      Set the data file.
      Parameters:
      file - the data file to set
      Since:
      2007.07.24 (Christian Borgelt)
    • setTestFile

      public void setTestFile(File file)
      Set the test file.
      Parameters:
      file - the test file to set
      Since:
      2007.07.24 (Christian Borgelt)
    • getMessage

      public String getMessage()
      Get the message text (status line) of the window.
      Returns:
      the displayed message
      Since:
      2007.07.26 (Christian Borgelt)
    • setMessage

      public void setMessage(String msg)
      Set the message text (status line) of the window.
      Parameters:
      msg - the message to display
      Since:
      2007.03.12 (Christian Borgelt)
    • getFileChooser

      protected JFileChooser getFileChooser()
      Get the file chooser.
      Returns:
      the file chooser
      Since:
      2007.02.12 (Christian Borgelt)
    • getFileName

      protected File getFileName(JTextField text)
      Get a file name and store it in a text field.
      Parameters:
      text - the text field in which to store the file name
      Returns:
      the selected file or null if cancelled
      Since:
      2007.02.12 (Christian Borgelt)
    • getFileName

      protected File getFileName(JTextField text, String title)
      Get a file name and store it in a text field.
      Parameters:
      text - the text field in which to store the file name
      title - the title of the file chooser dialog
      Returns:
      the selected file or null if cancelled
      Since:
      2007.07.26 (Christian Borgelt)
    • showTable

      protected void showTable(JTextField text)
      Show a data table (to be read from a file).
      Parameters:
      text - the text field containing the file name
      Since:
      2007.02.12 (Christian Borgelt)
    • editDomains

      protected void editDomains(JTextField text)
      Edit domain descriptions.
      Parameters:
      text - the text field containing the file name
      Since:
      2007.07.24 (Christian Borgelt)
    • editFile

      protected void editFile(JTextField text)
      Edit a text file.
      Parameters:
      text - the text field containing the file name
      Since:
      2007.02.12 (Christian Borgelt)
    • getPath

      public File getPath()
      Get the path to the external programs.
      Returns:
      the path to the external programs
      Since:
      2007.02.11 (Christian Borgelt)
    • setPath

      public void setPath(File path)
      Set the path to the external programs.
      Parameters:
      path - the path to the external programs
      Since:
      2004.05.25 (Christian Borgelt)
    • createDomainsCmd

      protected String[] createDomainsCmd()
      Create a command to determine attribute domains.

      The command is built according to the settings in the "domains" tab of this tabbed user interface.

      Returns:
      a command to determine attribute domains
      Since:
      2004.05.25 (Christian Borgelt)
    • createDomainsObj

      protected util.Executable createDomainsObj()
      Create a domain finder object.

      The domain finder is configured according to the settings in the "domains" tab of this tabbed user interface.

      Returns:
      a domain finder object
      Since:
      2007.05.08 (Christian Borgelt)
    • createExecutor

      protected abstract util.Executor createExecutor(int i)
      Create the executor for a dialog tab.
      Parameters:
      i - the index of the dialog tab
      Returns:
      the executor for the i-th dialog tab
      Since:
      2007.05.03 (Christian Borgelt)
    • start

      protected void start()
      Execute the current dialog tab.
      Since:
      2007.02.12 (Christian Borgelt)
    • getResultMsg

      protected String getResultMsg()
      Get the result message on successful termination.
      Returns:
      the result message
      Since:
      2007.02.10 (Christian Borgelt)
    • getDomainsMsg

      protected String getDomainsMsg()
      Get the result message of a determination of domains.
      Returns:
      the result message of a determination of domains
      Since:
      2007.07.27 (Christian Borgelt)
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Process an event from the executor.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event - the event to process
      Since:
      2007.02.12 (Christian Borgelt)
    • readLine

      protected String readLine(FileReader reader) throws IOException
      Read a line (of the configuration file).
      Parameters:
      reader - the reader to read from
      Returns:
      the line read
      Throws:
      IOException - if an i/o error occurs or no line could be read
      Since:
      2007.02.24 (Christian Borgelt)
    • readInt

      protected int readInt(FileReader reader) throws IOException
      Read an integer value (from the configuration file).
      Parameters:
      reader - the reader to read from
      Returns:
      the integer value read
      Throws:
      IOException - if an i/o error occurs or no field could be read
      Since:
      2006.07.13 (Christian Borgelt)
    • loadConfig

      protected abstract void loadConfig(File file)
      Load a configuration file and set the input fields.
      Parameters:
      file - the file to load the configuration from
      Since:
      2006.07.13 (Christian Borgelt)
    • saveConfig

      protected abstract void saveConfig(File file)
      Save a configuration file
      Parameters:
      file - the file to save the current configuration to
      Since:
      2006.07.13 (Christian Borgelt)
    • shrinkCmd

      protected static String[] shrinkCmd(String[] cmd, int n)
      Shrink a command to a given length.
      Parameters:
      cmd - the command to shrink
      n - the number of arguments
      Returns:
      the shrunk command
      Since:
      2007.02.16 (Christian Borgelt)