fr.umlv.unitex
Class UnitexFrame

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by fr.umlv.unitex.UnitexFrame
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class UnitexFrame
extends javax.swing.JFrame

This is the main frame of the Unitex system.

Author:
Sébastien Paumier
See Also:
Serialized Form

Field Summary
static java.awt.datatransfer.Clipboard clip
          The clipboard used to copy and paste text and graph box selections.
static javax.swing.JDesktopPane desktop
          The desktop of the frame.
static java.lang.Integer DOCLAYER
          Layer used to display document internal frames
 java.awt.dnd.DropTarget dropTarget
          This object is used to enable drag-and-drop, so that the user can pick up texts, graphs and dictionaries from a file explorer.
static UnitexFrame mainFrame
          The main frame of the system.
 
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
UnitexFrame()
          This method initializes the system by a call to the Config.initConfig() method.
 
Method Summary
static void addInternalFrame(javax.swing.JInternalFrame frame)
           
 void arrangeIcons()
          Arranges all the iconified frames that are on the desktop.
 javax.swing.JMenu buildDELAMenu()
          Creates the "DELA" menu.
 javax.swing.JMenu buildEditMenu()
          Creates the "Edit" menu.
 javax.swing.JMenu buildFsGraphMenu()
          Creates the "FSGraph" menu.
 javax.swing.JMenu buildInfoMenu()
          Creates the "Info" menu.
 javax.swing.JMenu buildLexiconGrammarMenu()
          Creates the "Lexicon-Grammar" menu.
 void buildMenus()
          Builds the menu bar.
 javax.swing.JMenu buildTextMenu()
          Creates the "Text" menu.
 javax.swing.JMenu buildWindowsMenu()
          Creates the "Windows" menu.
 void cascadeFrames()
          Cascades all the frames that are on the desktop and that are not iconified.
 void closeAll()
          Closes all GraphFrame s that are on the desktop.
 void closeAllConcordanceFrames()
          Closes all the ConcordanceFrame that are on the desktop.
 void closeDELA()
          Closes the current dictionary.
 void closeText()
          Closes the current corpus.
 void compileAndFlattenGraph()
          Shows a window that offers the user to compile and flatten a graph.
 void compileGraph()
          Compiles the current focused GraphFrame.
 void compileGraphMorpheme()
           
 void compressDELA()
          Compresses the current dictionary.
 void createNewGraphFrame()
          Creates and adds to the desktop a new GraphFrame.
static javax.swing.JInternalFrame getCurrentFocusedFrame()
           
static GraphFrame getCurrentFocusedGraphFrame()
           
static javax.swing.JDesktopPane getDesktop()
           
 GraphFrame graphIsAllreadyOpen(java.io.File grf)
          Tests if a graph is allready open on the desktop.
 void loadGraph(java.io.File grf)
          loads a graph.
 void openDELA()
          Shows a dialog box to select a dictionary.
 void openGraph()
          Shows a dialog box to select on or more graphs.
 void openLexiconGrammarTable()
          Shows a dialog box to select a lexicon-grammar table.
 void openTaggedText()
          Shows a dialog box to select a tagged corpus.
 void openText()
          Shows a dialog box to select a corpus.
 void pageSetup()
          Launch the page setup for printing.
 void printAllFrames()
          Prints all the GraphFrame s that are on the desktop.
 void printFrame(GraphFrame g)
          Prints a GraphFrame.
 void printTextAutomatonFrame(TextAutomatonFrame g)
          Prints a TextAutomatonFrame.
 void quit()
          This method is called when the user tries to close the main window, or when he clicks on the "Quit Unitex" item in the "Text" menu.
static void removeInternalFrame(javax.swing.JInternalFrame f)
           
 void saveAllGraphs()
          Saves all GraphFrame s that are on the desktop.
 boolean saveAsGraph(GraphFrame f)
          Opens a "Save As" dialog box to save a graph.
 boolean saveGraph(GraphFrame f)
          If the graph has no name, the saveAsGraph(GraphFrame) is called.
 void sortDELA()
          Sorts the current dictionary.
 void tileFrames()
          Tiles all the frames that are on the desktop and that are not iconified.
 
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

dropTarget

public java.awt.dnd.DropTarget dropTarget
This object is used to enable drag-and-drop, so that the user can pick up texts, graphs and dictionaries from a file explorer.


desktop

public static javax.swing.JDesktopPane desktop
The desktop of the frame.


DOCLAYER

public static final java.lang.Integer DOCLAYER
Layer used to display document internal frames


clip

public static java.awt.datatransfer.Clipboard clip
The clipboard used to copy and paste text and graph box selections.


mainFrame

public static UnitexFrame mainFrame
The main frame of the system.

Constructor Detail

UnitexFrame

public UnitexFrame()
This method initializes the system by a call to the Config.initConfig() method. Then, the main frame and all the sub-frames are created. The sub-frames are set to be invisible when the system starts.

Method Detail

addInternalFrame

public static void addInternalFrame(javax.swing.JInternalFrame frame)

buildMenus

public void buildMenus()
Builds the menu bar.


buildTextMenu

public javax.swing.JMenu buildTextMenu()
Creates the "Text" menu.

Returns:
this menu.

buildDELAMenu

public javax.swing.JMenu buildDELAMenu()
Creates the "DELA" menu.

Returns:
this menu.

buildFsGraphMenu

public javax.swing.JMenu buildFsGraphMenu()
Creates the "FSGraph" menu.

Returns:
this menu.

buildLexiconGrammarMenu

public javax.swing.JMenu buildLexiconGrammarMenu()
Creates the "Lexicon-Grammar" menu.

Returns:
this menu.

buildEditMenu

public javax.swing.JMenu buildEditMenu()
Creates the "Edit" menu.

Returns:
this menu.

buildWindowsMenu

public javax.swing.JMenu buildWindowsMenu()
Creates the "Windows" menu.

Returns:
this menu.

buildInfoMenu

public javax.swing.JMenu buildInfoMenu()
Creates the "Info" menu.

Returns:
this menu.

quit

public void quit()
This method is called when the user tries to close the main window, or when he clicks on the "Quit Unitex" item in the "Text" menu.


createNewGraphFrame

public void createNewGraphFrame()
Creates and adds to the desktop a new GraphFrame.


pageSetup

public void pageSetup()
Launch the page setup for printing.


printFrame

public void printFrame(GraphFrame g)
Prints a GraphFrame.

Parameters:
g - the GraphFrame to be printed.

printTextAutomatonFrame

public void printTextAutomatonFrame(TextAutomatonFrame g)
Prints a TextAutomatonFrame.

Parameters:
g - the TextAutomatonFrame to be printed.

printAllFrames

public void printAllFrames()
Prints all the GraphFrame s that are on the desktop.


openText

public void openText()
Shows a dialog box to select a corpus. If a corpus is selected, it is opened with a call to the Text.loadCorpus(String) method.


openTaggedText

public void openTaggedText()
Shows a dialog box to select a tagged corpus. If a corpus is selected, it is opened with a call to the Text.loadCorpus(String) method.


openGraph

public void openGraph()
Shows a dialog box to select on or more graphs. The selected graphs are opened with a call to the loadGraph(String,String,String) method.


openLexiconGrammarTable

public void openLexiconGrammarTable()
Shows a dialog box to select a lexicon-grammar table. If a table is selected, a LexiconGrammarTableFrame object is created.


graphIsAllreadyOpen

public GraphFrame graphIsAllreadyOpen(java.io.File grf)
Tests if a graph is allready open on the desktop.

Parameters:
grf - the name of the graph
Returns:
the GraphFrame if the graph is allready open, or null otherwise

loadGraph

public void loadGraph(java.io.File grf)
loads a graph. If the graph is allready open, its GraphFrame is focused, otherwise, a new GraphFrame is created, added to the desktop and focused.

Parameters:
grf - the complete name of the graph: path and file name

saveAsGraph

public boolean saveAsGraph(GraphFrame f)
Opens a "Save As" dialog box to save a graph. The graph is actually saved by a call to the GraphFrame.saveGraph(String) method.

Parameters:
f - the GraphFrame to be saved

saveGraph

public boolean saveGraph(GraphFrame f)
If the graph has no name, the saveAsGraph(GraphFrame) is called. Otherwise, the graph is saved by a call to the GraphFrame.saveGraph(String) method.

Parameters:
f - the GraphFrame to be saved

saveAllGraphs

public void saveAllGraphs()
Saves all GraphFrame s that are on the desktop.


closeAll

public void closeAll()
Closes all GraphFrame s that are on the desktop.


compileGraph

public void compileGraph()
Compiles the current focused GraphFrame. If the graph is unsaved, an error message is shown and nothing is done; otherwise the compilation process is launched through the creation of a ProcessInfoFrame object.


compileAndFlattenGraph

public void compileAndFlattenGraph()
Shows a window that offers the user to compile and flatten a graph. If the user clicks on the "OK" button, the compilation process is launched through the creation of a ProcessInfoFrame object.


compileGraphMorpheme

public void compileGraphMorpheme()

openDELA

public void openDELA()
Shows a dialog box to select a dictionary. If a dictionary is selected, it is opened with a call to the DelaFrame.loadDela(String) method.


sortDELA

public void sortDELA()
Sorts the current dictionary. The external program "SortTxt" is called through the creation of a ProcessInfoFrame object.


compressDELA

public void compressDELA()
Compresses the current dictionary. The external program "Compress" is called through the creation of a ProcessInfoFrame object.


closeDELA

public void closeDELA()
Closes the current dictionary.


closeText

public void closeText()
Closes the current corpus. All the associated frames (text tokens, text dictionaries, text automaton, etc) are closed.


closeAllConcordanceFrames

public void closeAllConcordanceFrames()
Closes all the ConcordanceFrame that are on the desktop.


tileFrames

public void tileFrames()
Tiles all the frames that are on the desktop and that are not iconified.


cascadeFrames

public void cascadeFrames()
Cascades all the frames that are on the desktop and that are not iconified.


arrangeIcons

public void arrangeIcons()
Arranges all the iconified frames that are on the desktop.


getDesktop

public static javax.swing.JDesktopPane getDesktop()

getCurrentFocusedFrame

public static javax.swing.JInternalFrame getCurrentFocusedFrame()

getCurrentFocusedGraphFrame

public static GraphFrame getCurrentFocusedGraphFrame()

removeInternalFrame

public static void removeInternalFrame(javax.swing.JInternalFrame f)