Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded to Vaadin 7.1.9 and TouchKit 4.0 alpha #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion crm-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.vaadin.demo</groupId>
<artifactId>crm</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
</parent>
<artifactId>crm-backend</artifactId>
<dependencies>
Expand Down
142 changes: 132 additions & 10 deletions crm-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,165 @@
<parent>
<artifactId>crm</artifactId>
<groupId>org.vaadin.demo</groupId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
</parent>
<artifactId>crm-ui</artifactId>
<packaging>war</packaging>

<dependencies>
<dependency>
<artifactId>crm-backend</artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
<groupId>com.vaadin.addon</groupId>
<artifactId>vaadin-touchkit-agpl</artifactId>
<version>4.0.0.alpha2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<!-- Needed for possible offline mode -->
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<artifactId>crm-widgetset</artifactId>
<artifactId>crm-backend</artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin.addon</groupId>
<artifactId>jpacontainer-addon-agpl-3.0</artifactId>
<version>2.1.0</version>
<artifactId>jpacontainer</artifactId>
<version>3.1.1</version>
<type>jar</type>
<exclusions>
<exclusion>
<artifactId>vaadin-server</artifactId>
<groupId>com.vaadin</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.3</version>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin.addon</groupId>
<artifactId>vaadin-charts</artifactId>
<version>1.1.4</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>

<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<configuration>
<webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets
</webappDirectory>
<hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets
</hostedWebapp>
<extraJvmArgs>-Xmx1g -Xss4024k</extraJvmArgs>
<noServer>true</noServer>
<!-- Remove draftCompile when project is ready -->
<draftCompile>false</draftCompile>
<compileReport>false</compileReport>
<style>OBF</style>
<persistentunitcachedir>${project.build.directory}</persistentunitcachedir>
<deploy>${project.build.directory}/gwt-deploy</deploy>
<runTarget>http://localhost:8080/</runTarget>
</configuration>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- As we are doing "inplace" GWT compilatio, ensure the widgetset -->
<!-- directory is cleaned properly -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/VAADIN/widgetsets</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.8.v20121106</version>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<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>
[7.0-SNAPSHOT,)
</versionRange>
<goals>
<goal>
update-widgetset
</goal>
<goal>resources</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

<organization>
Expand Down
86 changes: 23 additions & 63 deletions crm-ui/src/main/java/org/vaadin/demo/crm/ui/AccountListView.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,88 +7,48 @@
import com.vaadin.addon.jpacontainer.JPAContainer;
import com.vaadin.addon.jpacontainer.JPAContainerFactory;
import com.vaadin.addon.touchkit.ui.NavigationView;
import com.vaadin.addon.touchkit.ui.Popover;
import com.vaadin.data.util.filter.SimpleStringFilter;
import com.vaadin.event.ItemClickEvent;
import com.vaadin.event.ItemClickEvent.ItemClickListener;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Component;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
import com.vaadin.ui.Button.ClickEvent;

public class AccountListView extends NavigationView {

JPAContainer<Account> accounts = JPAContainerFactory.make(Account.class,
Backend.PERSISTENCE_UNIT);

Button findButton = new Button("Find", new ClickListener() {
public void buttonClick(ClickEvent event) {
accounts.removeAllContainerFilters();
new FindDialog();
}
});


JPAContainer<Account> accounts = JPAContainerFactory.make(Account.class, Backend.PERSISTENCE_UNIT);

public AccountListView() {
getNavigationBar().setCaption("Accounts");
getNavigationBar().setLeftComponent(findButton);
setContent(new AccountList());
setContent(new AccountList());
}

protected void onBecomingVisible() {
((CrmApp) getApplication()).hideDetailsView();
super.onBecomingVisible();
}

// List of accounts filling the view
class AccountList extends Table implements ItemClickListener {

public AccountList() {
setSizeFull();
setImmediate(true);
setContainerDataSource(accounts);
setVisibleColumns(new Object[] { "name", "sales" });
addListener((ItemClickListener) this);
setVisibleColumns(new Object[]{"name","sales"});
addItemClickListener(this);

getNavigationBar().setRightComponent(new Button("Filter", new Button.ClickListener() {

@Override
public void buttonClick(ClickEvent event) {
getNavigationManager().navigateTo(new FilterView(accounts));

}
}));
}

@Override
public void itemClick(ItemClickEvent event) {
if (getNavigationManager().getCurrentComponent() != AccountListView.this)
return;

EntityItem<Account> account = accounts.getItem(event.getItemId());
AccountView accountView = new AccountView(account);
getNavigationManager().navigateTo(accountView);

((CrmApp) getApplication()).showDetailsView(account, accountView);
Component accountView = new AccountView(account);
getNavigationManager().navigateTo(accountView);
}

}

// Dialog shown when Find button is clicked
class FindDialog extends Popover implements ClickListener {
TextField nameFilter = new TextField();
Button searchButton = new Button("Search");
HorizontalLayout layout = new HorizontalLayout();

public FindDialog() {
showRelativeTo(findButton);

setContent(layout);
layout.setMargin(true);
layout.setSpacing(true);
layout.addComponent(nameFilter);
layout.setComponentAlignment(nameFilter, Alignment.MIDDLE_CENTER);
layout.addComponent(searchButton);

nameFilter.setInputPrompt("Customer name");
searchButton.addListener(this);
}

public void buttonClick(ClickEvent event) {
accounts.addContainerFilter(new SimpleStringFilter("name",
(String) nameFilter.getValue(), true, false));
AccountListView.this.getWindow().removeWindow(this);
}
}
}
Loading