From 5fde05f3c9d5af7d4732eebf7a5e47c96134912c Mon Sep 17 00:00:00 2001 From: rreganjr Date: Fri, 23 Mar 2018 01:37:03 -0400 Subject: [PATCH] https://github.com/rreganjr/Requel/issues/7 branch 1.0.3 I moved the nlp ui package out of requel and into a new nlp-ui module. I enabled the nlp nav panel in uiMainConfig.xml but the ParserPanel won't open. I have no idea how to register the panel to appear for the open event. this ui was only for playing with the parser directly and not for working with requirements. Signed-off-by: rreganjr --- _maven-base/pom.xml | 6 ++ nlp-ui/nlp-ui.iml | 80 +++++++++++++++++++ nlp-ui/pom.xml | 54 +++++++++++++ .../rreganjr/nlp/ui/NLPNavigatorPanel.java | 35 ++++++++ .../nlp/ui/NLPNavigatorTreeNodeFactory.java | 5 +- .../com/rreganjr/nlp/ui/NLPPanelNames.java | 0 .../java/com/rreganjr/nlp/ui/ParserPanel.java | 18 ++++- .../src/main/resources/spring/uiNLPConfig.xml | 4 +- nlp/pom.xml | 1 - .../nlp/impl/NLPProcessorFactoryImpl.java | 4 +- requel/pom.xml | 4 + requel/requel.iml | 1 + .../requel/ui/project/ActorEditorPanel.java | 2 +- .../ui/project/ProjectNavigatorPanel.java | 7 +- .../ProjectUserNavigatorTreeNodeFactory.java | 5 +- .../main/resources/spring/uiMainConfig.xml | 2 +- 16 files changed, 207 insertions(+), 21 deletions(-) create mode 100644 nlp-ui/nlp-ui.iml create mode 100644 nlp-ui/pom.xml rename {requel => nlp-ui}/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorPanel.java (53%) rename {requel => nlp-ui}/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorTreeNodeFactory.java (96%) rename {requel => nlp-ui}/src/main/java/com/rreganjr/nlp/ui/NLPPanelNames.java (100%) rename {requel => nlp-ui}/src/main/java/com/rreganjr/nlp/ui/ParserPanel.java (88%) rename {requel => nlp-ui}/src/main/resources/spring/uiNLPConfig.xml (95%) diff --git a/_maven-base/pom.xml b/_maven-base/pom.xml index d3fafd3..a84c55f 100644 --- a/_maven-base/pom.xml +++ b/_maven-base/pom.xml @@ -89,6 +89,7 @@ ../repository ../nlp ../requel + ../nlp-ui @@ -113,6 +114,11 @@ nlp 1.0.3 + + com.rreganjr.requel + nlp-ui + 1.0.3 + com.rreganjr.requel repository diff --git a/nlp-ui/nlp-ui.iml b/nlp-ui/nlp-ui.iml new file mode 100644 index 0000000..b807cc3 --- /dev/null +++ b/nlp-ui/nlp-ui.iml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nlp-ui/pom.xml b/nlp-ui/pom.xml new file mode 100644 index 0000000..05c9cc7 --- /dev/null +++ b/nlp-ui/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + nlp-ui + + + com.rreganjr.requel + maven-base + 1.0.3 + ../_maven-base/pom.xml + + + Requel NLP Echo2 User Interface + + This package has a simple UI for running the parser on a text string. By default it isn't + mapped into the Requel UI. To enable it, in requel/src/resources/spring/uiMainConfig.xml bean + definition for mainNavigationPanelManager uncomment the ref element for "nlpNavigatorPanel". + + + + + + + + com.rreganjr.requel + nlp + + + + + + com.nextapp + echo2-app + + + com.rreganjr.echopm + echopm + + + + echopointng + echopointng + + + + org.springframework + spring-context + + + \ No newline at end of file diff --git a/requel/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorPanel.java b/nlp-ui/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorPanel.java similarity index 53% rename from requel/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorPanel.java rename to nlp-ui/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorPanel.java index 57131e7..6786ca4 100644 --- a/requel/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorPanel.java +++ b/nlp-ui/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorPanel.java @@ -22,6 +22,17 @@ import java.util.Set; +import net.sf.echopm.navigation.NavigatorButton; +import net.sf.echopm.navigation.WorkflowDisposition; +import net.sf.echopm.navigation.event.NavigationEvent; +import net.sf.echopm.navigation.event.OpenPanelEvent; +import net.sf.echopm.panel.PanelActionType; +import nextapp.echo2.app.Alignment; +import nextapp.echo2.app.Component; +import nextapp.echo2.app.Insets; +import nextapp.echo2.app.Row; +import nextapp.echo2.app.event.ActionEvent; +import nextapp.echo2.app.event.ActionListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -35,6 +46,12 @@ public class NLPNavigatorPanel extends NavigatorTreePanel { private static final Log log = LogFactory.getLog(NLPNavigatorPanel.class); static final long serialVersionUID = 0; + /** + * Property name to use in the NLPNavigatorPanel.properties to set the + * label on the new parser button. + */ + public static final String PROP_NEW_PARSER_BUTTON_LABEL = "NewParserButton.Label"; + /** * @param treeNodeFactories */ @@ -43,6 +60,12 @@ public NLPNavigatorPanel(Set treeNodeFactories) { NLPPanelNames.NLP_NAVIGATOR_PANEL_NAME); } + @Override + public void setup() { + add(createButton(PROP_NEW_PARSER_BUTTON_LABEL, "New Parser", NLPPanelNames.PARSER_PANEL_NAME)); + super.setup(); + } + @Override public void dispose() { super.dispose(); @@ -58,4 +81,16 @@ public void setTargetObject(Object targetObject) { public Object getTargetObject() { return this.getClass(); } + + private Component createButton(String labelResourceName, String labelDefault, String panelName) { + String buttonLabel = getResourceBundleHelper(getLocale()).getString(labelResourceName, labelDefault); + NavigationEvent event = new OpenPanelEvent(this, PanelActionType.Unspecified, null, null, panelName, WorkflowDisposition.NewFlow); + NavigatorButton button = new NavigatorButton(buttonLabel, getEventDispatcher(), event); + button.setStyleName(STYLE_NAME_DEFAULT); + Row wrapper = new Row(); + wrapper.setInsets(new Insets(5)); + wrapper.setAlignment(new Alignment(Alignment.CENTER, Alignment.DEFAULT)); + wrapper.add(button); + return wrapper; + } } diff --git a/requel/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorTreeNodeFactory.java b/nlp-ui/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorTreeNodeFactory.java similarity index 96% rename from requel/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorTreeNodeFactory.java rename to nlp-ui/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorTreeNodeFactory.java index bd8cb23..93a9610 100644 --- a/requel/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorTreeNodeFactory.java +++ b/nlp-ui/src/main/java/com/rreganjr/nlp/ui/NLPNavigatorTreeNodeFactory.java @@ -52,15 +52,14 @@ public class NLPNavigatorTreeNodeFactory extends AbstractNavigatorTreeNodeFactor public final static String PROP_PARSER_NODE_LABEL = "ParserNodeLabel"; /** - * @param eventDispatcher + * */ public NLPNavigatorTreeNodeFactory() { super(NLPNavigatorTreeNodeFactory.class.getName(), NLPNavigatorPanel.class); } /** - * @see net.sf.echopm.navigation.tree.NavigatorTreeNodeFactory#createTreeNode(net.sf.echopm.navigation.tree.NavigatorTree, - * java.lang.Object) + * @see net.sf.echopm.navigation.tree.NavigatorTreeNodeFactory#createTreeNode(EventDispatcher, NavigatorTree, Object) */ public MutableTreeNode createTreeNode(EventDispatcher eventDispatcher, NavigatorTree tree, Object object) { diff --git a/requel/src/main/java/com/rreganjr/nlp/ui/NLPPanelNames.java b/nlp-ui/src/main/java/com/rreganjr/nlp/ui/NLPPanelNames.java similarity index 100% rename from requel/src/main/java/com/rreganjr/nlp/ui/NLPPanelNames.java rename to nlp-ui/src/main/java/com/rreganjr/nlp/ui/NLPPanelNames.java diff --git a/requel/src/main/java/com/rreganjr/nlp/ui/ParserPanel.java b/nlp-ui/src/main/java/com/rreganjr/nlp/ui/ParserPanel.java similarity index 88% rename from requel/src/main/java/com/rreganjr/nlp/ui/ParserPanel.java rename to nlp-ui/src/main/java/com/rreganjr/nlp/ui/ParserPanel.java index 7ad9ae9..868a268 100644 --- a/requel/src/main/java/com/rreganjr/nlp/ui/ParserPanel.java +++ b/nlp-ui/src/main/java/com/rreganjr/nlp/ui/ParserPanel.java @@ -20,6 +20,8 @@ */ package com.rreganjr.nlp.ui; +import net.sf.echopm.navigation.event.OpenPanelEvent; +import net.sf.echopm.panel.Panel; import nextapp.echo2.app.Button; import nextapp.echo2.app.TextArea; import nextapp.echo2.app.event.ActionEvent; @@ -49,9 +51,7 @@ public class ParserPanel extends AbstractEditorPanel { private Button parseButton; /** - * @param commandHandler - * @param projectCommandFactory - * @param projectRepository + * @param processorFactory */ public ParserPanel(NLPProcessorFactory processorFactory) { this(ParserPanel.class.getName(), processorFactory); @@ -71,7 +71,7 @@ public ParserPanel(String resourceBundleName, NLPProcessorFactory processorFacto */ @Override public String getTitle() { - String msg = getResourceBundleHelper(getLocale()).getString(PROP_PANEL_TITLE, + String msg = getResourceBundleHelper(getLocale()).getString(Panel.PROP_PANEL_TITLE, "Parser Panel"); return msg; } @@ -85,6 +85,8 @@ public void setup() { PROP_LABEL_PARSE_BUTTON, "Parse"))); parseButton.addActionListener(new ParseListener(this)); parseButton.setEnabled(true); + + getEventDispatcher().addEventTypeActionListener(OpenPanelEvent.class, new NullActionListener()); } @Override @@ -137,4 +139,12 @@ public void actionPerformed(ActionEvent event) { } } + + private static class NullActionListener implements ActionListener { + @Override + public void actionPerformed(ActionEvent actionEvent) { + log.info("action event: " + actionEvent); + } + } + } diff --git a/requel/src/main/resources/spring/uiNLPConfig.xml b/nlp-ui/src/main/resources/spring/uiNLPConfig.xml similarity index 95% rename from requel/src/main/resources/spring/uiNLPConfig.xml rename to nlp-ui/src/main/resources/spring/uiNLPConfig.xml index 2f4b2dc..0200296 100644 --- a/requel/src/main/resources/spring/uiNLPConfig.xml +++ b/nlp-ui/src/main/resources/spring/uiNLPConfig.xml @@ -16,13 +16,13 @@ com.rreganjr.nlp.ui.ParserPanel - + - + diff --git a/nlp/pom.xml b/nlp/pom.xml index 558394f..e7d721c 100644 --- a/nlp/pom.xml +++ b/nlp/pom.xml @@ -4,7 +4,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 nlp - 1.0.3 com.rreganjr.requel diff --git a/nlp/src/main/java/com/rreganjr/nlp/impl/NLPProcessorFactoryImpl.java b/nlp/src/main/java/com/rreganjr/nlp/impl/NLPProcessorFactoryImpl.java index 2142a1e..1a8546f 100644 --- a/nlp/src/main/java/com/rreganjr/nlp/impl/NLPProcessorFactoryImpl.java +++ b/nlp/src/main/java/com/rreganjr/nlp/impl/NLPProcessorFactoryImpl.java @@ -60,7 +60,7 @@ public class NLPProcessorFactoryImpl implements NLPProcessorFactory, Application private final Map processedTextCache = new HashMap(); /** - * @param dictionaryRepository + * */ public NLPProcessorFactoryImpl() { } @@ -78,7 +78,7 @@ protected ApplicationContext getApplicationContext() { } /** - * @see com.rreganjr.nlp.NLPProcessorFactory#createNLPText() + * @see com.rreganjr.nlp.NLPProcessorFactory#createNLPText(String) */ @Override public NLPText createNLPText(String text) { diff --git a/requel/pom.xml b/requel/pom.xml index f991e0b..b448a52 100644 --- a/requel/pom.xml +++ b/requel/pom.xml @@ -32,6 +32,10 @@ com.rreganjr.requel nlp + + com.rreganjr.requel + nlp-ui + com.rreganjr.requel repository diff --git a/requel/requel.iml b/requel/requel.iml index 5d13b35..a7c83d6 100644 --- a/requel/requel.iml +++ b/requel/requel.iml @@ -51,6 +51,7 @@ + diff --git a/requel/src/main/java/com/rreganjr/requel/ui/project/ActorEditorPanel.java b/requel/src/main/java/com/rreganjr/requel/ui/project/ActorEditorPanel.java index 48ac852..d33dac2 100644 --- a/requel/src/main/java/com/rreganjr/requel/ui/project/ActorEditorPanel.java +++ b/requel/src/main/java/com/rreganjr/requel/ui/project/ActorEditorPanel.java @@ -349,7 +349,7 @@ public void actionPerformed(ActionEvent event) { // TODO: it may be better to have different standardized update listeners // for different types of updated or deleted objects associated with the - // input controls like an annotation table or referers. + // input controls like an annotation table or referrers. private static class UpdateListener implements ActionListener { static final long serialVersionUID = 0L; diff --git a/requel/src/main/java/com/rreganjr/requel/ui/project/ProjectNavigatorPanel.java b/requel/src/main/java/com/rreganjr/requel/ui/project/ProjectNavigatorPanel.java index f639376..38eefd6 100644 --- a/requel/src/main/java/com/rreganjr/requel/ui/project/ProjectNavigatorPanel.java +++ b/requel/src/main/java/com/rreganjr/requel/ui/project/ProjectNavigatorPanel.java @@ -50,20 +50,19 @@ public class ProjectNavigatorPanel extends NavigatorTreePanel { /** * Property name to use in the ProjectNavigatorPanel.properties to set the - * lable on the new project button. + * label on the new project button. */ public static final String PROP_NEW_PROJECT_BUTTON_LABEL = "NewProjectButton.Label"; - /** * Property name to use in the ProjectNavigatorPanel.properties to set the - * lable on the import project button. + * label on the import project button. */ public static final String PROP_IMPORT_PROJECT_BUTTON_LABEL = "ImportProjectButton.Label"; /** * Property name to use in the ProjectNavigatorPanel.properties to set the - * lable on the find/open projects button. + * label on the find/open projects button. */ public static final String PROP_FIND_PROJECT_BUTTON_LABEL = "FindProjectButton.Label"; diff --git a/requel/src/main/java/com/rreganjr/requel/ui/project/ProjectUserNavigatorTreeNodeFactory.java b/requel/src/main/java/com/rreganjr/requel/ui/project/ProjectUserNavigatorTreeNodeFactory.java index fa36a5d..0162d7a 100644 --- a/requel/src/main/java/com/rreganjr/requel/ui/project/ProjectUserNavigatorTreeNodeFactory.java +++ b/requel/src/main/java/com/rreganjr/requel/ui/project/ProjectUserNavigatorTreeNodeFactory.java @@ -60,15 +60,14 @@ public class ProjectUserNavigatorTreeNodeFactory extends AbstractNavigatorTreeNo public final static String PROP_PROJECTS_NODE_LABEL = "ProjectsNodeLabel"; /** - * @param eventDispatcher + * */ public ProjectUserNavigatorTreeNodeFactory() { super(ProjectUserNavigatorTreeNodeFactory.class.getName(), User.class); } /** - * @see net.sf.echopm.navigation.tree.NavigatorTreeNodeFactory#createTreeNode(net.sf.echopm.navigation.tree.NavigatorTree, - * java.lang.Object) + * @see net.sf.echopm.navigation.tree.NavigatorTreeNodeFactory#createTreeNode(EventDispatcher, NavigatorTree, Object) */ public MutableTreeNode createTreeNode(EventDispatcher eventDispatcher, NavigatorTree tree, Object object) { diff --git a/requel/src/main/resources/spring/uiMainConfig.xml b/requel/src/main/resources/spring/uiMainConfig.xml index 7c34d2b..7104cff 100644 --- a/requel/src/main/resources/spring/uiMainConfig.xml +++ b/requel/src/main/resources/spring/uiMainConfig.xml @@ -21,7 +21,7 @@ -