Skip to content

Commit ef3aaec

Browse files
maxmax
authored andcommitted
fixes and added onEnterListener
1 parent 125ca68 commit ef3aaec

File tree

15 files changed

+97
-21
lines changed

15 files changed

+97
-21
lines changed

AdvancedTokenField-addon/.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<attribute name="maven.pomderived" value="true"/>
2323
</attributes>
2424
</classpathentry>
25-
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
25+
<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
2626
<attributes>
2727
<attribute name="maven.pomderived" value="true"/>
2828
<attribute name="org.eclipse.jst.component.nondependency" value=""/>

AdvancedTokenField-addon/.project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
</buildCommand>
2828
</buildSpec>
2929
<natures>
30+
<nature>org.eclipse.pde.PluginNature</nature>
3031
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
3132
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
3233
<nature>org.eclipse.jdt.core.javanature</nature>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_ROOT_PATH=target/classes
2+
eclipse.preferences.version=1

AdvancedTokenField-addon/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>com.fo0.advancedtokenfield</groupId>
66
<artifactId>AdvancedTokenField</artifactId>
77
<packaging>bundle</packaging>
8-
<version>0.1.01</version>
8+
<version>0.1.1-SNAPSHOT</version>
99
<name>AdvancedTokenField Add-on</name>
1010

1111
<prerequisites>
@@ -21,8 +21,8 @@
2121
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2222
<maven.compiler.source>1.8</maven.compiler.source>
2323
<maven.compiler.target>1.8</maven.compiler.target>
24-
<vaadin.version>8.1.4</vaadin.version>
25-
<vaadin.plugin.version>8.1.4</vaadin.plugin.version>
24+
<vaadin.version>8.1.7</vaadin.version>
25+
<vaadin.plugin.version>8.1.7</vaadin.plugin.version>
2626

2727
<!-- ZIP Manifest fields -->
2828
<Implementation-Version>${project.version}</Implementation-Version>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.fo0.advancedtokenfield.listener;
2+
3+
import com.fo0.advancedtokenfield.main.Token;
4+
5+
public interface OnEnterListener {
6+
7+
void action(Token token);
8+
9+
}

AdvancedTokenField-addon/src/main/java/com/fo0/advancedtokenfield/main/AdvancedTokenField.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.fo0.advancedtokenfield.interceptor.TokenAddInterceptor;
88
import com.fo0.advancedtokenfield.interceptor.TokenNewItemInterceptor;
99
import com.fo0.advancedtokenfield.interceptor.TokenRemoveInterceptor;
10+
import com.fo0.advancedtokenfield.listener.OnEnterListener;
1011
import com.fo0.advancedtokenfield.listener.TokenAddListener;
1112
import com.fo0.advancedtokenfield.listener.TokenNewItemListener;
1213
import com.fo0.advancedtokenfield.listener.TokenRemoveListener;
@@ -46,6 +47,8 @@ public class AdvancedTokenField extends DDCssLayout {
4647
private TokenAddListener tokenAddListener;
4748
private TokenNewItemListener tokenNewItemListener;
4849

50+
private OnEnterListener enterListener;
51+
4952
private static final String BASE_STYLE = "advancedtokenfield-layouttokens";
5053

5154
public AdvancedTokenField(List<Token> tokens) {
@@ -93,9 +96,15 @@ public boolean isDraggable(Component component) {
9396

9497
@Override
9598
public void handleAction(Object sender, Object target) {
96-
// ignore nulls and empty values
97-
if (inputField.getValue() != null && !inputField.getValue().getValue().isEmpty())
98-
addToken(tokenAddInterceptor.action(inputField.getValue()));
99+
Token tokenValue = inputField.getValue();
100+
101+
if (tokenValue != null && !tokenValue.getValue().isEmpty()) {
102+
addToken(tokenAddInterceptor.action(tokenValue));
103+
}
104+
105+
if (enterListener != null) {
106+
enterListener.action(tokenValue);
107+
}
99108
}
100109
});
101110

@@ -224,6 +233,10 @@ public void addTokenAddNewItemListener(TokenNewItemListener listener) {
224233
this.tokenNewItemListener = listener;
225234
}
226235

236+
public void addOnEnterListener(OnEnterListener listener) {
237+
enterListener = listener;
238+
}
239+
227240
/**
228241
* Interceptors
229242
*/

AdvancedTokenField-demo/.classpath

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
<attribute name="maven.pomderived" value="true"/>
1818
</attributes>
1919
</classpathentry>
20-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
21-
<attributes>
22-
<attribute name="maven.pomderived" value="true"/>
23-
</attributes>
24-
</classpathentry>
2520
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
2621
<attributes>
2722
<attribute name="maven.pomderived" value="true"/>
@@ -30,9 +25,19 @@
3025
</classpathentry>
3126
<classpathentry kind="src" output="target/classes" path="target/generated-resources/gwt">
3227
<attributes>
28+
<attribute name="ignore_optional_problems" value="true"/>
3329
<attribute name="optional" value="true"/>
3430
<attribute name="maven.pomderived" value="true"/>
35-
<attribute name="ignore_optional_problems" value="true"/>
31+
</attributes>
32+
</classpathentry>
33+
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/WildFly 11.0 Runtime">
34+
<attributes>
35+
<attribute name="owner.project.facets" value="jst.web"/>
36+
</attributes>
37+
</classpathentry>
38+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
39+
<attributes>
40+
<attribute name="maven.pomderived" value="true"/>
3641
</attributes>
3742
</classpathentry>
3843
<classpathentry kind="output" path="target/classes"/>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
3+
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
4+
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.jboss.tools.cdi.core.cdibuilder"/>
5+
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
6+
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
7+
</launchConfiguration>

AdvancedTokenField-demo/.project

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,26 @@
1515
<arguments>
1616
</arguments>
1717
</buildCommand>
18+
<buildCommand>
19+
<name>org.jboss.tools.jst.web.kb.kbbuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
25+
<triggers>full,incremental,</triggers>
26+
<arguments>
27+
<dictionary>
28+
<key>LaunchConfigHandle</key>
29+
<value>&lt;project&gt;/.externalToolBuilders/org.jboss.tools.cdi.core.cdibuilder (26).launch</value>
30+
</dictionary>
31+
</arguments>
32+
</buildCommand>
33+
<buildCommand>
34+
<name>org.jboss.tools.ws.jaxrs.metamodelBuilder</name>
35+
<arguments>
36+
</arguments>
37+
</buildCommand>
1838
<buildCommand>
1939
<name>org.eclipse.wst.validation.validationbuilder</name>
2040
<arguments>
@@ -33,5 +53,9 @@
3353
<nature>org.eclipse.m2e.core.maven2Nature</nature>
3454
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
3555
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
56+
<nature>org.jboss.tools.jst.web.kb.kbnature</nature>
57+
<nature>org.jboss.tools.cdi.core.cdinature</nature>
58+
<nature>org.jboss.tools.jsf.jsfnature</nature>
59+
<nature>org.jboss.tools.ws.jaxrs.nature</nature>
3660
</natures>
3761
</projectDescription>

AdvancedTokenField-demo/.settings/org.eclipse.wst.common.component

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
66
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
77
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-resources/gwt"/>
8-
<dependent-module archiveName="AdvancedTokenField-0.1.01.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/AdvancedTokenField-addon/AdvancedTokenField-addon">
9-
<dependency-type>uses</dependency-type>
10-
</dependent-module>
118
<property name="context-root" value="AdvancedTokenField-demo"/>
129
<property name="java-output-path" value="/AdvancedTokenField-demo/target/classes"/>
1310
</wb-module>

0 commit comments

Comments
 (0)