Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<?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/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.vaadin</groupId>
<artifactId>resetbuttonfortextfield-root</artifactId>
<packaging>pom</packaging>
<version>1.2.2-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<name>ResetButtonForTextField Root Project</name>

<prerequisites>
<maven>3</maven>
</prerequisites>

<modules>
<module>resetbuttonfortextfield</module>
<module>resetbuttonfortextfield-demo</module>
Expand Down
146 changes: 33 additions & 113 deletions resetbuttonfortextfield-demo/pom.xml
Original file line number Diff line number Diff line change
@@ -1,52 +1,41 @@
<?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/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.vaadin</groupId>
<artifactId>resetbuttonfortextfield-demo</artifactId>
<packaging>war</packaging>
<version>1.2.2-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<name>ResetButtonForTextField Demo UI</name>

<prerequisites>
<maven>3</maven>
</prerequisites>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vaadin.version>7.6.4</vaadin.version>
<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<vaadin.version>8.0.5</vaadin.version>
<vaadin.plugin.version>8.0.5</vaadin.plugin.version>
<jetty.plugin.version>9.3.9.v20160517</jetty.plugin.version>
</properties>

<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>vaadin-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

<dependencyManagement>
<dependencies>
<dependency>
Expand All @@ -58,6 +47,7 @@
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.vaadin</groupId>
Expand All @@ -67,6 +57,7 @@
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
Expand All @@ -75,124 +66,53 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
<configuration>
<filesets>
<fileset>
<directory>${basedir}/src/main/webapp/VAADIN/widgetsets</directory>
</fileset>
<fileset>
<directory>${basedir}/src/main/webapp/VAADIN/gwt-unitCache</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<version>3.0.0</version>
<configuration>
<packagingExcludes>
**/VAADIN/gwt-unitCache/**,
**/VAADIN/widgetsets/WEB-INF/**,
**/WEB-INF/lib/servlet-api-*.jar,
**/WEB-INF/lib/vaadin-client-*.jar,
**/WEB-INF/lib/jetty-*.jar,
**/WEB-INF/lib/ant-*.jar,
**/WEB-INF/classes/gwt-unitCache/**,
**/WEB-INF/classes/themes/**,
**/WEB-INF/classes/widgetsets/**
</packagingExcludes>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>

<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.plugin.version}</version>
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets</webappDirectory>
<hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets</hostedWebapp>
<noServer>true</noServer>
<persistentunitcachedir>${basedir}/target/tmp/gwt-unitCache</persistentunitcachedir>
<compileReport>true</compileReport>
<strict>true</strict>
<runTarget>http://localhost:8080/</runTarget>
</configuration>
<executions>
<!-- You are free to mark this as permanently ignored in Eclipse -->
<execution>
<configuration>
<!-- if you don't specify any modules, the plugin will find them -->
</configuration>
<goals>
<goal>resources</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- The Jetty plugin allows us to easily test the development build by -->
<!-- running jetty:run on the command line. -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.16.v20140903</version>
<version>${jetty.plugin.version}</version>
<configuration>
<stopKey>STOP</stopKey>
<stopPort>9999</stopPort>
<webApp>
<contextPath>/</contextPath>
</webApp>
<scanIntervalSeconds>2</scanIntervalSeconds>
</configuration>
</plugin>

</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<versionRange>
[${vaadin.plugin.version},)
</versionRange>
<goals>
<goal>resources</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<goal>update-theme</goal>
<goal>compile-theme</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>

</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Title;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.data.Property;
import com.vaadin.event.FieldEvents;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Button;
Expand All @@ -33,20 +31,14 @@ protected void init(VaadinRequest request) {
setContent(layout);

final TextField tf = new TextField("Type something, please");
tf.setInputPrompt("Some text here");
tf.setPlaceholder("Some text here");

final ResetButtonForTextField resetButton = ResetButtonForTextField
.extend(tf);

layout.addComponent(tf);
tf.setImmediate(true);
tf.setWidth("300px");

final Label textChangeEventListenerLabel = new Label();
textChangeEventListenerLabel.setHeight("20px");
textChangeEventListenerLabel.setCaption("I show text changes!");
layout.addComponent(textChangeEventListenerLabel);

final Label valueChangeListenerLabel = new Label();
valueChangeListenerLabel.setCaption("I show value changes!");
layout.addComponent(valueChangeListenerLabel);
Expand All @@ -58,20 +50,7 @@ protected void init(VaadinRequest request) {
layout.addComponent(resetButtonClickListenerLabel);
resetButtonClickListenerLabel.setHeight("20px");

tf.addValueChangeListener(new Property.ValueChangeListener() {
@Override
public void valueChange(Property.ValueChangeEvent event) {
valueChangeListenerLabel.setValue(event.getProperty()
.getValue().toString());
}
});

tf.addTextChangeListener(new FieldEvents.TextChangeListener() {
@Override
public void textChange(FieldEvents.TextChangeEvent event) {
textChangeEventListenerLabel.setValue(event.getText());
}
});
tf.addValueChangeListener(event -> valueChangeListenerLabel.setValue(event.getValue()));

resetButton
.addResetButtonClickedListener(new ResetButtonClickListener() {
Expand All @@ -87,38 +66,16 @@ public void resetButtonClicked() {
});

Button b1 = new Button("Clear the value of the textfield",
new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
tf.setValue("");
}
});
event -> tf.setValue(""));
Button b2 = new Button(
"Set the value of the textfield to current date",
new Button.ClickListener() {
event -> tf.setValue(new Date().toString()));
Button b3 = new Button("Toggle Enabled",
event -> tf.setEnabled(!tf.isEnabled()));
Button b4 = new Button("Toggle ReadOnly",
event -> tf.setReadOnly(!tf.isReadOnly()));

@Override
public void buttonClick(Button.ClickEvent event) {
tf.setValue(new Date().toString());
}
});
Button b3 = new Button("Toggle Enabled", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
tf.setEnabled(!tf.isEnabled());
}
});
Button b4 = new Button("Toggle ReadOnly", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
tf.setReadOnly(!tf.isReadOnly());
}
});

layout.addComponent(b1);
layout.addComponent(b2);
layout.addComponent(b3);
layout.addComponent(b4);
layout.addComponents(b1, b2, b3,b4);
}

}
Loading