uk.ac.ic.doc.automed.p2p.editor
Class KQueryMain.QueryEditorHelper

java.lang.Object
  extended by uk.ac.ic.doc.automed.p2p.editor.KQueryMain.QueryEditorHelper
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
Enclosing class:
KQueryMain

public class KQueryMain.QueryEditorHelper
extends java.lang.Object
implements java.awt.event.ActionListener

Handle the event in which user has typed in keyword phrases that are used for constructing the query trees. We support two basic phrases:

  1. path: a sequence of keywords separated by a demiliter, e.g. author-title-year
  2. parent-children: a keyword followed by a set of keywords enclosed in a pair of in parentheses, which are treated as children nodes of that keyword e.g. title(author,year) (same as the above)

Author:
Duc Le

Field Summary
(package private)  java.lang.String defaultType
           
private static java.lang.String DELIM_LIST
           
private static java.lang.String DELIM_NAME
           
private static java.lang.String DELIM_PATH
           
private static java.lang.String DELIM_PC
           
private static java.lang.String DELIM_SPACE
           
private  java.awt.Point kp
           
private static java.lang.String NAME_PRIME
           
private  javax.swing.text.JTextComponent txtCom
           
(package private) static double vgap
           
 
Constructor Summary
KQueryMain.QueryEditorHelper(javax.swing.text.JTextComponent txtCom)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Implements the ActionListener interface.
private  GNode addKeyword(java.lang.String w)
          Process an input keyword name to either create it or retrieve it for data type update (if already exists).
 void addNewKeyword(GNode child, GNode parent, GraphUI gui)
          Add a new keyword node, and connects it to an existing node
 void addNewKeyword(GNode nknode, GraphUI gui)
          Add a new keyword as a new node in the query graph.
Draw the k-node, adds to the query graph and draw edges that connect this new k-node to all other nodes of the graph.
 GEdge addNewKeywordEdge(GNode child, GNode parent, GraphUI gui)
          Add a k-edge between two existing k-nodes.
 void clear()
           
 GNode getGNode(java.lang.String kw, GraphUI gui)
          Check if a keyword exists in the user graph.
 java.awt.Point getNextNodePoint(GraphUI gui)
          Obtain the next point to draw a knode based on the points of the existing nodes.
 Graph getQuery()
          Return the query object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

txtCom

private javax.swing.text.JTextComponent txtCom

vgap

static final double vgap
See Also:
Constant Field Values

kp

private java.awt.Point kp

DELIM_SPACE

private static final java.lang.String DELIM_SPACE
See Also:
Constant Field Values

DELIM_PATH

private static final java.lang.String DELIM_PATH
See Also:
Constant Field Values

DELIM_NAME

private static final java.lang.String DELIM_NAME
See Also:
Constant Field Values

DELIM_PC

private static final java.lang.String DELIM_PC
See Also:
Constant Field Values

DELIM_LIST

private static final java.lang.String DELIM_LIST
See Also:
Constant Field Values

NAME_PRIME

private static final java.lang.String NAME_PRIME
See Also:
Constant Field Values

defaultType

final java.lang.String defaultType
See Also:
Constant Field Values
Constructor Detail

KQueryMain.QueryEditorHelper

public KQueryMain.QueryEditorHelper(javax.swing.text.JTextComponent txtCom)
Method Detail

addKeyword

private GNode addKeyword(java.lang.String w)
Process an input keyword name to either create it or retrieve it for data type update (if already exists).

Parameters:
w -
Returns:

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Implements the ActionListener interface. This method is invoked when the user has entered a keyword definition on the GUI (e.g. via a text box)

Specified by:
actionPerformed in interface java.awt.event.ActionListener

getGNode

public GNode getGNode(java.lang.String kw,
                      GraphUI gui)
Check if a keyword exists in the user graph.

Parameters:
kq -
gui -

getQuery

public Graph getQuery()
Return the query object

Returns:

addNewKeyword

public void addNewKeyword(GNode nknode,
                          GraphUI gui)
Add a new keyword as a new node in the query graph.
Draw the k-node, adds to the query graph and draw edges that connect this new k-node to all other nodes of the graph.

Parameters:
kw -
gui -

addNewKeywordEdge

public GEdge addNewKeywordEdge(GNode child,
                               GNode parent,
                               GraphUI gui)
Add a k-edge between two existing k-nodes.

Parameters:
child -
parent -
gui -

addNewKeyword

public void addNewKeyword(GNode child,
                          GNode parent,
                          GraphUI gui)
Add a new keyword node, and connects it to an existing node

Parameters:
child -
existing -
gui -

getNextNodePoint

public java.awt.Point getNextNodePoint(GraphUI gui)
Obtain the next point to draw a knode based on the points of the existing nodes.

Returns:

clear

public void clear()