Skip to content

Commit

Permalink
https://github.com/rreganjr/Requel/issues/7
Browse files Browse the repository at this point in the history
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 <rreganjr@acm.org>
  • Loading branch information
rreganjr committed Mar 23, 2018
1 parent e07df7c commit 5fde05f
Show file tree
Hide file tree
Showing 16 changed files with 207 additions and 21 deletions.
6 changes: 6 additions & 0 deletions _maven-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
<module>../repository</module>
<module>../nlp</module>
<module>../requel</module>
<module>../nlp-ui</module>
</modules>

<dependencyManagement>
Expand All @@ -113,6 +114,11 @@
<artifactId>nlp</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>com.rreganjr.requel</groupId>
<artifactId>nlp-ui</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>com.rreganjr.requel</groupId>
<artifactId>repository</artifactId>
Expand Down
80 changes: 80 additions & 0 deletions nlp-ui/nlp-ui.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="nlp" />
<orderEntry type="module" module-name="exception" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:3.1.0.GA" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-commons-annotations:3.1.0.GA" level="project" />
<orderEntry type="module" module-name="initializer" />
<orderEntry type="module" module-name="command" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.0.4.RELEASE" level="project" />
<orderEntry type="module" module-name="repository" />
<orderEntry type="library" name="Maven: cglib:cglib-nodep:3.2.5" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.8.13" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.45" level="project" />
<orderEntry type="library" name="Maven: edu.stanford.nlp:stanford-corenlp:3.8.0" level="project" />
<orderEntry type="library" name="Maven: com.apple:AppleJavaExtensions:1.4" level="project" />
<orderEntry type="library" name="Maven: de.jollyday:jollyday:0.4.9" level="project" />
<orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-queryparser:4.10.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-sandbox:4.10.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-analyzers-common:4.10.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-queries:4.10.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-core:4.10.3" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
<orderEntry type="library" name="Maven: com.io7m.xom:xom:1.2.10" level="project" />
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
<orderEntry type="library" name="Maven: xalan:xalan:2.7.2" level="project" />
<orderEntry type="library" name="Maven: xalan:serializer:2.7.2" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.9" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.efficient-java-matrix-library:ejml:0.23" level="project" />
<orderEntry type="library" name="Maven: org.glassfish:javax.json:1.0.4" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.2.0" level="project" />
<orderEntry type="library" name="Maven: edu.stanford.nlp:stanford-corenlp:models:3.8.0" level="project" />
<orderEntry type="library" name="Maven: opennlp:tools:1.5.0" level="project" />
<orderEntry type="library" name="Maven: jwnl:jwnl:1.3.3" level="project" />
<orderEntry type="library" name="Maven: opennlp:maxent:3.0.0" level="project" />
<orderEntry type="library" name="Maven: com.fifesoft:spellchecker:2.6.0" level="project" />
<orderEntry type="library" name="Maven: com.fifesoft:rsyntaxtextarea:2.6.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-orm:5.0.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.0.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-core:5.2.14.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.22.0-GA" level="project" />
<orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss:jandex:2.0.3.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:5.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: commons-digester:commons-digester:2.1" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
<orderEntry type="library" name="Maven: com.nextapp:echo2-app:2.1.1a" level="project" />
<orderEntry type="library" name="Maven: com.rreganjr.echopm:echopm:1.0.0" level="project" />
<orderEntry type="library" name="Maven: echopointng:echopointng:1.0.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.0.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.0.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.0.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
</component>
</module>
54 changes: 54 additions & 0 deletions nlp-ui/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>nlp-ui</artifactId>

<parent>
<groupId>com.rreganjr.requel</groupId>
<artifactId>maven-base</artifactId>
<version>1.0.3</version>
<relativePath>../_maven-base/pom.xml</relativePath>
</parent>

<name>Requel NLP Echo2 User Interface</name>
<description>
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".
</description>

<properties>
</properties>

<dependencies>
<dependency>
<groupId>com.rreganjr.requel</groupId>
<artifactId>nlp</artifactId>
</dependency>

<!-- this is copied to the local maven repo from the lib directory using install-lib-mvn.sh -->
<!-- this is only needed for ResourceBundleHelper in OpenNLPParser, that should probably
not be in a UI module, or I should switch to a Spring alternative.
-->
<dependency>
<groupId>com.nextapp</groupId>
<artifactId>echo2-app</artifactId>
</dependency>
<dependency>
<groupId>com.rreganjr.echopm</groupId>
<artifactId>echopm</artifactId>
</dependency>
<!-- this is copied to the local maven repo from the lib directory using install-lib-mvn.sh -->
<dependency>
<groupId>echopointng</groupId>
<artifactId>echopointng</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
*/
Expand All @@ -43,6 +60,12 @@ public NLPNavigatorPanel(Set<NavigatorTreeNodeFactory> 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();
Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
Expand All @@ -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
Expand Down Expand Up @@ -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);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

<bean id="parserPanelFactory" scope="prototype" class="net.sf.echopm.panel.DefaultPanelFactory">
<constructor-arg index="0"><value type="java.lang.Class">com.rreganjr.nlp.ui.ParserPanel</value></constructor-arg>
<constructor-arg index="1"><util:constant static-field="net.sf.echopm.panel.PanelActionType.Editor"/></constructor-arg>
<constructor-arg index="1"><util:constant static-field="net.sf.echopm.panel.PanelActionType.Unspecified"/></constructor-arg>
<constructor-arg index="2"><util:constant static-field="com.rreganjr.nlp.ui.NLPPanelNames.PARSER_PANEL_NAME"/></constructor-arg>
<constructor-arg index="3">
<util:list>
<ref bean="nlpProcessorFactory"/>
</util:list>
</constructor-arg>
</constructor-arg>
</bean>
<bean id="nlpNavigatorPanel" scope="prototype" class="com.rreganjr.nlp.ui.NLPNavigatorPanel">
<constructor-arg>
Expand Down
1 change: 0 additions & 1 deletion nlp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>nlp</artifactId>
<version>1.0.3</version>

<parent>
<groupId>com.rreganjr.requel</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class NLPProcessorFactoryImpl implements NLPProcessorFactory, Application
private final Map<String, NLPText> processedTextCache = new HashMap<String, NLPText>();

/**
* @param dictionaryRepository
*
*/
public NLPProcessorFactoryImpl() {
}
Expand All @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions requel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<groupId>com.rreganjr.requel</groupId>
<artifactId>nlp</artifactId>
</dependency>
<dependency>
<groupId>com.rreganjr.requel</groupId>
<artifactId>nlp-ui</artifactId>
</dependency>
<dependency>
<groupId>com.rreganjr.requel</groupId>
<artifactId>repository</artifactId>
Expand Down
1 change: 1 addition & 0 deletions requel/requel.iml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:5.0.1.Final" level="project" />
<orderEntry type="module" module-name="nlp-ui" />
<orderEntry type="module" module-name="repository" />
<orderEntry type="library" name="Maven: cglib:cglib-nodep:3.2.5" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.8.13" level="project" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 5fde05f

Please sign in to comment.