kr.ac.kaist.swrc.jhannanum.demo
Class GUIDemo

java.lang.Object
  extended by kr.ac.kaist.swrc.jhannanum.demo.GUIDemo

public class GUIDemo
extends java.lang.Object

This is a GUI-based demo program of the HanNanum that helps users to understand the concept of work flow and use the HanNanum library easily. It shows a window that has components for plug-in pool, work flow, plug-in information, work flow controls, input text and analysis result. Users can easily set up various work flows by drag-and-drop the plug-ins from the plug-in pool to the work flow component, and see the analysis result.

Users can use this GUI demo program by following procedure:
1. Browse the plug-ins in the plug-in pool. The brief information about the selected plug-in will be displayed so that you can refer the information when set the work flow up.
2. Drag and drop plug-ins from the plug-in pool to the list in the work flow considering the phase and type of the plug-in.
- If you want to remove the plug-in on the work flow, simply double click it.
- If you change the order of the supplement plug-ins in each phase, simply drag and drop a plug-in to the position you want.
3. Once you finish to set the work flow up, choose 'Multi-thread Mode' or 'Single-thread Mode'.
4. Click 'Activate the work flow' button.
5. Type or copy-and-past text that you want to analyze into the 'Input Text' area.
6. Click 'Analyze Text' button.
7. You can see the analysis result on 'Result' area.
8. Repeat 5~7 to analyze other text with the activated work flow.
Or click 'Close the work flow' button and go to step 1 to set up new work flow.

Author:
Sangwon Park (hudoni@world.kaist.ac.kr), CILab, SWRC, KAIST

Nested Class Summary
private  class GUIDemo.PluginInfo
          This class has the properties of a HanNanum plug-in.
private  class GUIDemo.PluginListMouseListener
          Event listener for the plug-in selection on the list for the work flow.
private  class GUIDemo.PluginTransferHandler
          Handler for the drag-and-drop functionality of plug-in from the plug-in pool to the work flow.
private  class GUIDemo.PluginTreeSelectionListener
          Event listener for the plug-in selection on the tree view.
private  class GUIDemo.SharedActionHandler
          The event handler that is used in various purpose.
 
Field Summary
private  boolean activated
           
private  javax.swing.JTextArea areaPluginInfo
           
private  javax.swing.JButton buttonActivate
           
private  javax.swing.JButton buttonAnalysis
           
private  javax.swing.JButton buttonReset
           
private  javax.swing.JTextArea inputTextArea
           
private  javax.swing.DefaultListModel listModelMajor2
           
private  javax.swing.DefaultListModel listModelMajor3
           
private  javax.swing.DefaultListModel listModelSupplement1
           
private  javax.swing.DefaultListModel listModelSupplement2
           
private  javax.swing.DefaultListModel listModelSupplement3
           
private  javax.swing.JList listPluginMajor2
           
private  javax.swing.JList listPluginMajor3
           
private  javax.swing.JList listPluginSupplement1
           
private  javax.swing.JList listPluginSupplement2
           
private  javax.swing.JList listPluginSupplement3
           
private  javax.swing.JFrame mainFrame
           
private  javax.swing.JMenuBar menuBar
           
private  javax.swing.JMenu menuFile
           
private  javax.swing.JMenu menuHelp
           
private  javax.swing.JMenuItem menuItemFileOpen
           
private  javax.swing.JMenuItem menuItemHelp
           
private  boolean multiThreadMode
           
private  javax.swing.JTextArea outputTextArea
           
private  java.util.HashMap<java.lang.String,java.lang.String> pluginInfoMap
           
private  javax.swing.JRadioButton radioMultiThread
           
private  javax.swing.JRadioButton radioSingleThread
           
private  GUIDemo.PluginInfo selectedPlugin
           
private  javax.swing.JSplitPane splitPaneBottom
           
private  javax.swing.JSplitPane splitPaneTop
           
private  GUIDemo.PluginInfo tempPlugin
           
private  javax.swing.JTree tree
           
private  Workflow workflow
           
 
Constructor Summary
GUIDemo()
           
 
Method Summary
private  javax.swing.JComponent createPaneCenter()
          Returns a panel for the input and output text areas.
private  javax.swing.JComponent createPaneNorth()
          Setting of the split panel for plug-in pool and the work flow.
private  void createPluginNodes(javax.swing.tree.DefaultMutableTreeNode top)
          Setting of the each plug-in which is in the tree view.
private  javax.swing.JComponent createPluginPool()
          Setting of the plug-in tree view.
private  javax.swing.JComponent createWorkflow()
          Returns the panel for the work flow.
private  java.lang.String getPluginAbstarct(java.lang.String filePath)
          Returns the abstract text for a plug-in from the specified configuration file.
private  void loadPluginInformation()
          It loads the meta information for each plug-in from the configuration files.
static void main(java.lang.String[] args)
          Run this demo program.
 void run()
          Sets the GUI up and launch the demo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mainFrame

private javax.swing.JFrame mainFrame

menuBar

private javax.swing.JMenuBar menuBar

menuFile

private javax.swing.JMenu menuFile

menuHelp

private javax.swing.JMenu menuHelp

menuItemFileOpen

private javax.swing.JMenuItem menuItemFileOpen

menuItemHelp

private javax.swing.JMenuItem menuItemHelp

tree

private javax.swing.JTree tree

pluginInfoMap

private java.util.HashMap<java.lang.String,java.lang.String> pluginInfoMap

listPluginMajor2

private javax.swing.JList listPluginMajor2

listPluginMajor3

private javax.swing.JList listPluginMajor3

listPluginSupplement1

private javax.swing.JList listPluginSupplement1

listPluginSupplement2

private javax.swing.JList listPluginSupplement2

listPluginSupplement3

private javax.swing.JList listPluginSupplement3

listModelMajor2

private javax.swing.DefaultListModel listModelMajor2

listModelMajor3

private javax.swing.DefaultListModel listModelMajor3

listModelSupplement1

private javax.swing.DefaultListModel listModelSupplement1

listModelSupplement2

private javax.swing.DefaultListModel listModelSupplement2

listModelSupplement3

private javax.swing.DefaultListModel listModelSupplement3

areaPluginInfo

private javax.swing.JTextArea areaPluginInfo

inputTextArea

private javax.swing.JTextArea inputTextArea

outputTextArea

private javax.swing.JTextArea outputTextArea

splitPaneTop

private javax.swing.JSplitPane splitPaneTop

splitPaneBottom

private javax.swing.JSplitPane splitPaneBottom

radioMultiThread

private javax.swing.JRadioButton radioMultiThread

radioSingleThread

private javax.swing.JRadioButton radioSingleThread

buttonActivate

private javax.swing.JButton buttonActivate

buttonAnalysis

private javax.swing.JButton buttonAnalysis

buttonReset

private javax.swing.JButton buttonReset

selectedPlugin

private GUIDemo.PluginInfo selectedPlugin

tempPlugin

private GUIDemo.PluginInfo tempPlugin

multiThreadMode

private boolean multiThreadMode

activated

private boolean activated

workflow

private Workflow workflow
Constructor Detail

GUIDemo

public GUIDemo()
Method Detail

main

public static void main(java.lang.String[] args)
Run this demo program.

Parameters:
args -

run

public void run()
Sets the GUI up and launch the demo.


createPaneNorth

private javax.swing.JComponent createPaneNorth()
Setting of the split panel for plug-in pool and the work flow.

Returns:
the split panel

createPluginPool

private javax.swing.JComponent createPluginPool()
Setting of the plug-in tree view.

Returns:
the plug-in tree view

createPluginNodes

private void createPluginNodes(javax.swing.tree.DefaultMutableTreeNode top)
Setting of the each plug-in which is in the tree view.

Parameters:
top - - default top tree node

loadPluginInformation

private void loadPluginInformation()
It loads the meta information for each plug-in from the configuration files.


getPluginAbstarct

private java.lang.String getPluginAbstarct(java.lang.String filePath)
                                    throws JSONException,
                                           java.io.IOException
Returns the abstract text for a plug-in from the specified configuration file.

Parameters:
filePath - - the configuration file for the plug-in written in JSON format
Returns:
the abstract text for the specified plug-in
Throws:
JSONException
java.io.IOException

createWorkflow

private javax.swing.JComponent createWorkflow()
Returns the panel for the work flow.

Returns:
the panel for the work flow

createPaneCenter

private javax.swing.JComponent createPaneCenter()
Returns a panel for the input and output text areas.

Returns:
a panel for the input and output text areas