|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.cs.ai.kreator.ui.gui.components.controller.QueryPreviewGuideController
public class QueryPreviewGuideController
This class is a Mediator on a set of controls defined in PreviewGuideControls
.
It previews and observes the construction of a query. The user can click hyperlinks in the html Preview Pane or use the
keyboard to navigate between different states of construction and items in the "workList".
Subclasses defining new states should overload at least the following methods to ensure correct navigation:
- applyWorkListSelection
- processStateNavigation
- onHyperlinkEvent
to extend functionality overloading the following methods is important:
- isValid
- switchState
- checkStateValid
- reset(String reason)
to customize output of the subclass can use the default output structure and overload the methods:
- buildPreviewOutput
- buildGuideOutput
- buildErrorOutput
also see protected member: doLabel
but if you want a real custom output without the structure defined by the base class overload:
- updateOutput
See EvidencePreviewGuideController
for an example sub class implementation.
PreviewGuideControls
Nested Class Summary | |
---|---|
protected class |
QueryPreviewGuideController.KeyListener
KeyListner class for extended keyboard interpretation. |
protected class |
QueryPreviewGuideController.ParameterPair
Implementation of a pair: It connect a parameter type and a constant to a complete parameter. |
Field Summary | |
---|---|
static int |
ACTION_CHANGED
|
static int |
ACTION_DO
|
protected boolean |
allowConstantAppending
|
protected java.lang.String |
doLabel
|
protected boolean |
internalStateChange
|
protected LanguageFactory |
language
reference to the actual used language |
protected static java.lang.String |
LINK_ID_DO
Url for link to execute a valid query. |
protected static java.lang.String |
LINK_ID_PREDICATE
Url for link to switch into select a predicate state. |
protected static java.lang.String |
LINK_ID_PREFIX_PARAMETER
Url prefix for a link to switch to select parameter state, the index of the predicate will be added to the end of the prefix. |
protected javax.swing.JEditorPane |
outputPane
|
protected java.util.List<QueryPreviewGuideController.ParameterPair> |
parameters
List of selected parameters of the actual predicate. |
protected GeneralizedPredicate |
predicate
reference to the actual selected predicate |
protected int |
state
The current state of the controller. |
protected static int |
STATE_NO_KNOWLEDGEBASE
State_ID: No valid knowledge base is selected yet. |
protected static int |
STATE_PREDICATE
State_ID: User selects a query predicate. |
protected UserAppendRemoveList |
workList
|
Constructor Summary | |
---|---|
QueryPreviewGuideController(PreviewGuideControls controls)
|
Method Summary | |
---|---|
boolean |
addActionListener(java.awt.event.ActionListener listener)
|
protected boolean |
applyWorkListSelection()
This method apply the selection change in the work list. |
protected java.lang.String |
buildErrorOutput()
Proofs if a error occurs if this the case builds an output string Overload this method for your custom error message output. |
protected java.lang.String |
buildGuideOutput()
Builds the guide line output helping the user performing the next step. |
protected java.lang.String |
buildPreviewOutput()
Builds the preview output string showing the user what he had constructed so far. |
protected void |
changeWorkListContent(java.util.List<?> content)
Helper method: Changes the content of the workList and preselects a parameter object. |
protected void |
checkStateValid(int newState)
|
Query |
getQuery()
|
protected int |
getStateCount()
|
protected void |
informActionListener(int id)
|
boolean |
isValid()
|
protected void |
onHyperlinkEvent(javax.swing.event.HyperlinkEvent e)
Decide what to do if the user clicks a hyperlink Sub classes defining more hyperlinks should override this method to add the wished functionality when the user clicks on the link. |
protected void |
processStateNavigation(java.awt.event.KeyEvent event)
Navigate through different states by a given KeyEvent. |
boolean |
removeActionListener(java.awt.event.ActionListener listener)
|
void |
reset()
Resets the state of the preview guide |
void |
reset(LanguageFactory language)
|
void |
reset(java.lang.String reason)
|
void |
setLanguage(LanguageFactory language)
Changes the language this query preview guide is working with. |
protected void |
setParameter(Constant c)
Helper method: Sets a new parameter. |
protected void |
switchState(int newState)
Switch the current state to newState |
protected void |
updateOutput()
Updates the output of the QueryOutput Pane. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected LanguageFactory language
protected GeneralizedPredicate predicate
protected java.util.List<QueryPreviewGuideController.ParameterPair> parameters
protected int state
protected java.lang.String doLabel
protected javax.swing.JEditorPane outputPane
protected UserAppendRemoveList workList
protected boolean allowConstantAppending
protected boolean internalStateChange
public static final int ACTION_DO
public static final int ACTION_CHANGED
protected static final int STATE_NO_KNOWLEDGEBASE
protected static final int STATE_PREDICATE
protected static final java.lang.String LINK_ID_PREDICATE
protected static final java.lang.String LINK_ID_PREFIX_PARAMETER
protected static final java.lang.String LINK_ID_DO
Constructor Detail |
---|
public QueryPreviewGuideController(PreviewGuideControls controls)
Method Detail |
---|
public boolean addActionListener(java.awt.event.ActionListener listener)
public boolean removeActionListener(java.awt.event.ActionListener listener)
protected int getStateCount()
public void setLanguage(LanguageFactory language)
language
- reference to the new languagepublic void reset()
public void reset(java.lang.String reason)
public void reset(LanguageFactory language)
public Query getQuery()
public boolean isValid()
protected void informActionListener(int id)
protected void switchState(int newState)
newState
- protected void checkStateValid(int newState)
protected java.lang.String buildErrorOutput()
protected java.lang.String buildPreviewOutput()
protected java.lang.String buildGuideOutput()
protected void updateOutput()
protected void setParameter(Constant c)
c
- new constant for the parameter.protected void changeWorkListContent(java.util.List<?> content)
content
- new list contentprotected boolean applyWorkListSelection()
protected void processStateNavigation(java.awt.event.KeyEvent event)
event
- reference to the KeyEventprotected void onHyperlinkEvent(javax.swing.event.HyperlinkEvent e)
e
- Reference to the HyperLinkEvent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |