edu.cs.ai.kreator.ui
Interface KreatorUserInterface

All Known Implementing Classes:
GraphicalUserInterface

public interface KreatorUserInterface

This interface has to be implemented by every UI. It provides the controller and other utilizing classes with an interface to give the user information, ask him questions, etc

Author:
Niklas Wulf

Field Summary
static int APPROVE_OPTION
           
static int CANCEL_OPTION
           
static java.awt.Font CONSOLE_FONT
           
static int NO_OPTION
           
static int OK_OPTION
           
static int YES_OPTION
           
 
Method Summary
 void cleanStainedStatus(DataFile dataFile)
          Resets the DataFile's stained status.
 void closeFile(DataFile file)
          Closes the DataFile's representation in the user interface.
 void closeProject()
          Closes the currently opened project in the user interface
 void copy()
          Copies text from the currently active text component.
 void cut()
          Cuts text from the currently active text component.
 void doRedo()
          Redoes the last reverted action in the currently active text component.
 void doUndo()
          Reverts the last action in the currently active text component.
 void find()
          Shows a quick find dialog for the currently active text component.
 void findAndReplace()
          Shows a find-and-replace dialog for the currently active text component.
 void findNext()
          Continues a search in the currently active text component.
 KreatorConsole getConsole()
          Returns the currently selected console.
 ConsoleTabbedPane getConsoleTabbedPane()
          Returns the GUI's ConsoleTabbedPane.
 DataFile getCurrentOpenFile()
          Returns the currently opened DataFile or null if no file is open.
 java.util.List<DataFile> getCurrentOpenFiles()
          Returns a list of the currently opened DataFiles.
 KreatorConsole getDefaultConsole()
          Returns the default (always present) console.
 KreatorFileChooser getFileChooser()
          Creates a KreatorFileChooser.
 java.lang.String getFileContent(DataFile file)
          Returns the editor content of a given DataFile or "" if the file is not opened in the user interface.
 javax.swing.JTextPane getLoggingTextPane()
          Returns the logger's TextPane.
 DataFile getSelectedFileFromTree()
          Returns the DataFile which is currently selected in the project container or null if no file is selected.
 javax.swing.JTextArea getSystemTextArea()
          Returns the loggingArea where System.in and/or System.err are redirected.
 void init()
          Initializes the user interface.
 boolean isOpen(DataFile file)
          Returns true if the given DataFile is currently opened.
 void openFile(DataFile file)
          Opens a given DataFile in the user interface (e.g. as a new tab).
 void openProject(Project project)
          Opens the given project in the GUI.
 void packAndShow()
          Shows the GUI
 void paste()
          Pastes text into the currently active text component.
 void setProgress(int progress)
          Shows the user some progress indicator.
 void setStatusText(java.lang.String text)
          Show the user some status text.
 void showAboutDialog()
          Shows an about dialog.
 void showErrorDialog(java.lang.String text, java.lang.String title)
          Shows a simple error dialog.
 void showGenerateDataDialog(KnowledgebaseFile kfile)
          Shows a generate data dialog for the given knowledge base.
 void showInfoPane(java.lang.String text)
          Shows a simple dialog with an okay button
 java.lang.String showInputDialog(java.lang.String text, java.lang.String value)
          Shows an input dialog.
 void showLaTeXWindow(java.lang.String text, java.lang.String fileName)
          Shows a simple text message with a close button.
 void showLearnDialog(SampleCollection sfile)
          Shows a learning dialog for the given sample collection.
 void showPreferences()
          Shows KReator's preferences dialog.
 void showQueryDialog(KnowledgebaseFile kfile)
          Shows a query dialog for the given knowledge base.
 int showYesNoCancelOptionPane(java.lang.String text, java.lang.String title)
          Shows a dialog with a yes, no and cancel option.
 int showYesNoOptionPane(java.lang.String text, java.lang.String title)
          Shows a dialog with a yes and no option.
 int[] showYesNoOptionPane(java.lang.String text, java.lang.String title, java.lang.String checkBoxText)
          Shows a dialog with a yes and no option and a check box
 void shutDown()
          Shuts down the GUI.
 

Field Detail

YES_OPTION

static final int YES_OPTION
See Also:
Constant Field Values

NO_OPTION

static final int NO_OPTION
See Also:
Constant Field Values

CANCEL_OPTION

static final int CANCEL_OPTION
See Also:
Constant Field Values

OK_OPTION

static final int OK_OPTION
See Also:
Constant Field Values

APPROVE_OPTION

static final int APPROVE_OPTION
See Also:
Constant Field Values

CONSOLE_FONT

static final java.awt.Font CONSOLE_FONT
Method Detail

init

void init()
Initializes the user interface.


packAndShow

void packAndShow()
Shows the GUI


shutDown

void shutDown()
Shuts down the GUI. Simply destroys the GUI.
Everything necessary for KReator's shutdown is in KreatorMain#shutdown().


openProject

void openProject(Project project)
Opens the given project in the GUI.

Parameters:
project - The Project to open.

closeProject

void closeProject()
Closes the currently opened project in the user interface


getCurrentOpenFile

DataFile getCurrentOpenFile()
Returns the currently opened DataFile or null if no file is open.

Returns:
the currently opened DataFile or null if no file is open.

getCurrentOpenFiles

java.util.List<DataFile> getCurrentOpenFiles()
Returns a list of the currently opened DataFiles.

Returns:
a list of the currently opened DataFiles.

isOpen

boolean isOpen(DataFile file)
Returns true if the given DataFile is currently opened.

Parameters:
file - The file for which should be checked if it is currently opened.
Returns:
true if the given DataFile is currently opened.

getSelectedFileFromTree

DataFile getSelectedFileFromTree()
                                 throws DataFileNotGeneratedException
Returns the DataFile which is currently selected in the project container or null if no file is selected.

Returns:
the DataFile which is currently selected in the project container or null if no file is selected.
Throws:
DataFileNotGeneratedException

getFileContent

java.lang.String getFileContent(DataFile file)
Returns the editor content of a given DataFile or "" if the file is not opened in the user interface.

Parameters:
kfile - The DataFile to get the editor content for.
Returns:
The editor content of a given DataFile or "" if the file is not opened in the user interface.

openFile

void openFile(DataFile file)
Opens a given DataFile in the user interface (e.g. as a new tab).

Parameters:
kfile - The DataFile to be opened.

closeFile

void closeFile(DataFile file)
Closes the DataFile's representation in the user interface.

Parameters:
kfile - The DataFile to be closed.

cleanStainedStatus

void cleanStainedStatus(DataFile dataFile)
Resets the DataFile's stained status. (e.g. when it has been saved).

Parameters:
file - The DataFile which stained status should be reset.

setProgress

void setProgress(int progress)
Shows the user some progress indicator.

Parameters:
progress - can be:
1-100: Show progress. 0: Show indeterminate progress. -1: Don't show any progress bar.

setStatusText

void setStatusText(java.lang.String text)
Show the user some status text.

Parameters:
text -

showYesNoCancelOptionPane

int showYesNoCancelOptionPane(java.lang.String text,
                              java.lang.String title)
Shows a dialog with a yes, no and cancel option.

Parameters:
text - The text in this dialog
title - The title of the dialog
Returns:
either YES_OPTION, NO_OPTION or CANCEL_OPTION

showYesNoOptionPane

int showYesNoOptionPane(java.lang.String text,
                        java.lang.String title)
Shows a dialog with a yes and no option.

Parameters:
text - The text in this dialog
title - The title of the dialog
Returns:
either YES_OPTION or NO_OPTION

showYesNoOptionPane

int[] showYesNoOptionPane(java.lang.String text,
                          java.lang.String title,
                          java.lang.String checkBoxText)
Shows a dialog with a yes and no option and a check box

Parameters:
text - The text in this dialog
title - The title of the dialog
checkBoxText - The text next to the check box
Returns:
An array with two values: The first element is either YES_OPTION or NO_OPTION depending on the button the user clicked The second element is either YES_OPTION, if the check box was checked or NO_OPTION, if the box was not checked

showInfoPane

void showInfoPane(java.lang.String text)
Shows a simple dialog with an okay button

Parameters:
text - The text of the dialog

showInputDialog

java.lang.String showInputDialog(java.lang.String text,
                                 java.lang.String value)
Shows an input dialog.

Parameters:
text - The text next to the input text field.
value - The text inside the input text field.
Returns:
the text inside the input text field when the user confirms the dialog

getFileChooser

KreatorFileChooser getFileChooser()
Creates a KreatorFileChooser. You can set the dialog's options before showing it.

Returns:

showErrorDialog

void showErrorDialog(java.lang.String text,
                     java.lang.String title)
Shows a simple error dialog.

Parameters:
text - The text of the dialog.
title - The title of the dialog

showQueryDialog

void showQueryDialog(KnowledgebaseFile kfile)
Shows a query dialog for the given knowledge base.

Parameters:
kfile - The knowledge base to be queried.

showGenerateDataDialog

void showGenerateDataDialog(KnowledgebaseFile kfile)
Shows a generate data dialog for the given knowledge base.

Parameters:
kfile - The knowledge base to generate data from.

showLearnDialog

void showLearnDialog(SampleCollection sfile)
Shows a learning dialog for the given sample collection.

Parameters:
sfile - The sample collection to learn from.

showPreferences

void showPreferences()
Shows KReator's preferences dialog.


showAboutDialog

void showAboutDialog()
Shows an about dialog.


showLaTeXWindow

void showLaTeXWindow(java.lang.String text,
                     java.lang.String fileName)
Shows a simple text message with a close button.

Parameters:
text - The text of the window.
fileName - The file name which will be exported to latex.

cut

void cut()
Cuts text from the currently active text component. If no text component has focus or the text component is not editable this does nothing.


copy

void copy()
Copies text from the currently active text component. If no text component has focus this does nothing.


paste

void paste()
Pastes text into the currently active text component. If no text component has focus or the text component is not editable this does nothing.


doUndo

void doUndo()
Reverts the last action in the currently active text component. If no text component has focus or the text component is not editable this does nothing.


doRedo

void doRedo()
Redoes the last reverted action in the currently active text component. If no text component has focus or the text component is not editable this does nothing.


find

void find()
Shows a quick find dialog for the currently active text component. If no text component has focus this does nothing.


findNext

void findNext()
Continues a search in the currently active text component. If no text component has focus or there is no ongoing search this does nothing.


findAndReplace

void findAndReplace()
Shows a find-and-replace dialog for the currently active text component. If no text component has focus this does nothing.


getSystemTextArea

javax.swing.JTextArea getSystemTextArea()
Returns the loggingArea where System.in and/or System.err are redirected.

Returns:
the loggingArea where System.in and/or System.err are redirected.

getLoggingTextPane

javax.swing.JTextPane getLoggingTextPane()
Returns the logger's TextPane.

Returns:
the logger's TextPane.

getConsoleTabbedPane

ConsoleTabbedPane getConsoleTabbedPane()
Returns the GUI's ConsoleTabbedPane.

Returns:
the GUI's ConsoleTabbedPane.

getConsole

KreatorConsole getConsole()
Returns the currently selected console.

Returns:
the currently selected console.

getDefaultConsole

KreatorConsole getDefaultConsole()
Returns the default (always present) console.

Returns:
the default (always present) console.