cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/tdwg/voc/TaxonName.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/tdwg/voc/TaxonRelationshipTerm.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/tdwg/voc/Team.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/vaadin/CdmTaxonTableCollection.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/editor/CdmTypePropertyEditor.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/editor/DateTimeEditor.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/editor/DefinedTermBaseList.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/service/DataController.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/service/MetadataController.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/service/Utils.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/SpringContextHelper.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/VaadinConfigurer.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/VaadinUI.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/components/CellRendererTable.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/components/ClassificationSelectionForm.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/components/DemoTaxonTable.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/components/DetailWindow.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/components/DistributionSelectionForm.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/components/HorizontalToolbar.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/components/LoginForm.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/components/TaxonTableDTO.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/data/LazyLoadedContainer.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/data/LazyLoadedIndexedContainer.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/service/CdmVaadinServlet.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/service/VaadinAuthenticationService.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/uiset/disabled/DefaultView.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/uiset/redlist/views/BfnView.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/uiset/redlist/views/ClassificationSelectorView.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/uiset/redlist/views/DashBoardView.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/uiset/redlist/views/DistributionSelectorView.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/uiset/redlist/views/ErrorView.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/uiset/redlist/views/LoginView.java -text
-cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/widgetset/AppWidgetSet.gwt.xml -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/view/BaseView.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/view/CsvFileDownloadView.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/view/FileDownloadView.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/view/oaipmh/rdf/ListRecordsView.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/remote/dto/rdf/Rdf.java -text
cdmlib-remote/src/main/java/net/sf/json/CycleSetAcess.java -text
-cdmlib-remote/src/main/java/ru/xpoft/vaadin/CdmDiscoveryNavigator.java -text
cdmlib-remote/src/main/resources/eu/etaxonomy/cdm/remote-security.xml -text
cdmlib-remote/src/main/resources/eu/etaxonomy/cdm/remote.xml -text
cdmlib-remote/src/main/resources/eu/etaxonomy/cdm/remote/dto/dwc/mappings.xml -text
<?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" -->
- <parent>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-parent</artifactId>
- <version>3.4.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+<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" -->
+ <parent>
+ <groupId>eu.etaxonomy</groupId>
+ <artifactId>cdmlib-parent</artifactId>
+ <version>3.4.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>cdmlib-remote</artifactId>
- <properties>
- <!-- custom property to hold the patch version number shouldn't this be
- set in the parent pom? -->
- <project.patchversion>0</project.patchversion>
- </properties>
- <name>CDM Remote</name>
- <description>The EDIT CDM Remote package allows remote access to
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>cdmlib-remote</artifactId>
+ <properties>
+ <!-- custom property to hold the patch version number shouldn't this be
+ set in the parent pom? -->
+ <project.patchversion>0</project.patchversion>
+ </properties>
+ <name>CDM Remote</name>
+ <description>The EDIT CDM Remote package allows remote access to
the common data model via webservices in the wider sense</description>
- <!-- Revert this back to "war" before committing -->
- <packaging>jar</packaging>
- <scm>
- <connection>
+ <!-- Revert this back to "war" before committing -->
+ <packaging>jar</packaging>
+ <scm>
+ <connection>
scm:svn:http://dev.e-taxonomy.eu/svn/trunk/cdmlib/cdmlib-remote/
</connection>
- <developerConnection>
+ <developerConnection>
scm:svn:https://dev.e-taxonomy.eu/svn/trunk/cdmlib/cdmlib-remote/
</developerConnection>
- <url>
+ <url>
http://dev.e-taxonomy.eu/trac/browser/trunk/cdmlib/cdmlib-remote/
</url>
- </scm>
+ </scm>
- <dependencies>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-io</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context-support</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.web.servlet</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springmodules</groupId>
- <artifactId>spring-modules-cache</artifactId>
- <version>0.7</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-mock</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-core</artifactId>
- <version>${spring-security.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-expression</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-tx</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-config</artifactId>
- <version>${spring-security.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-web</artifactId>
- <version>${spring-security.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-database</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-dbmaintainer</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-dbunit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-easymock</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-mock</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-inject</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-orm</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.unitils</groupId>
- <artifactId>unitils-spring</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>eu.etaxonomy</groupId>
+ <artifactId>cdmlib-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>org.springframework.web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>org.springframework.web.servlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springmodules</groupId>
+ <artifactId>spring-modules-cache</artifactId>
+ <version>0.7</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-mock</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-core</artifactId>
+ <version>${spring-security.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-expression</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-config</artifactId>
+ <version>${spring-security.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-web</artifactId>
+ <version>${spring-security.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.unitils</groupId>
+ <artifactId>unitils-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.unitils</groupId>
+ <artifactId>unitils-database</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.unitils</groupId>
+ <artifactId>unitils-dbmaintainer</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.unitils</groupId>
+ <artifactId>unitils-dbunit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.unitils</groupId>
+ <artifactId>unitils-easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.unitils</groupId>
+ <artifactId>unitils-mock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.unitils</groupId>
+ <artifactId>unitils-inject</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.unitils</groupId>
+ <artifactId>unitils-orm</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.unitils</groupId>
+ <artifactId>unitils-spring</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
- <dependency>
- <groupId>com.ibm.lsid</groupId>
- <artifactId>lsid-server</artifactId>
- </dependency>
- <dependency>
- <groupId>com.ibm.lsid</groupId>
- <artifactId>lsid-client</artifactId>
- </dependency>
+ <dependency>
+ <groupId>com.ibm.lsid</groupId>
+ <artifactId>lsid-server</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.ibm.lsid</groupId>
+ <artifactId>lsid-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>org.springframework.test</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.dozer</groupId>
+ <artifactId>dozer</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-cglib-repack</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-ehcache</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.json-lib</groupId>
+ <artifactId>json-lib</artifactId>
+ <classifier>jdk15</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>org.springframework.oxm</artifactId>
+ </dependency>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-server</artifactId>
- </dependency>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-shared</artifactId>
- </dependency>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-client-compiled</artifactId>
- </dependency>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-client</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-themes</artifactId>
- </dependency>
- <dependency>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-client-compiler</artifactId>
- </dependency>
+ <!-- XmlView -->
+ <dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>xpp3</groupId>
+ <artifactId>xpp3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax</artifactId>
+ </dependency>
- <dependency>
- <groupId>ru.xpoft.vaadin</groupId>
- <artifactId>spring-vaadin-integration</artifactId>
- </dependency>
+ <!-- JsonView -->
+ <dependency>
+ <!-- for xml serialization (net.sf.json.xml.XMLSerializer) -->
+ <groupId>xom</groupId>
+ <artifactId>xom</artifactId>
+ </dependency>
- <dependency>
- <groupId>org.vaadin.addons</groupId>
- <artifactId>exporter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.vaadin.addons</groupId>
- <artifactId>wizards-for-vaadin</artifactId>
- </dependency>
+ <!-- Connection Pooling -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-c3p0</artifactId>
+ </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.test</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sf.dozer</groupId>
- <artifactId>dozer</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-cglib-repack</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-ehcache</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sf.json-lib</groupId>
- <artifactId>json-lib</artifactId>
- <classifier>jdk15</classifier>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.oxm</artifactId>
- </dependency>
+ <!-- SQL Debugging -->
+ <dependency>
+ <groupId>p6spy</groupId>
+ <artifactId>p6spy</artifactId>
+ </dependency>
+ </dependencies>
- <!-- XmlView -->
- <dependency>
- <groupId>com.thoughtworks.xstream</groupId>
- <artifactId>xstream</artifactId>
- </dependency>
- <dependency>
- <groupId>xpp3</groupId>
- <artifactId>xpp3</artifactId>
- </dependency>
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax</artifactId>
- </dependency>
-
- <!-- JsonView -->
- <dependency>
- <!-- for xml serialization (net.sf.json.xml.XMLSerializer) -->
- <groupId>xom</groupId>
- <artifactId>xom</artifactId>
- </dependency>
-
-
-
- <!-- Connection Pooling -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-c3p0</artifactId>
- </dependency>
-
- <!-- SQL Debugging -->
- <dependency>
- <groupId>p6spy</groupId>
- <artifactId>p6spy</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.1-beta-1</version>
- </plugin>
- <plugin>
- <groupId>com.vaadin</groupId>
- <artifactId>vaadin-maven-plugin</artifactId>
- <version>7.3.1</version>
- <configuration>
- <strict>true</strict>
- <force>true</force>
- <webappDirectory>../cdmlib-remote-webapp/src/main/webapp/VAADIN/widgetsets</webappDirectory>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>resources</goal>
- <goal>compile</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.5</version>
- <executions>
- <execution>
- <id>copy-resources</id>
- <phase>validate</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.outputDirectory}/eu/etaxonomy/cdm/doc/remote/apt</outputDirectory>
- <resources>
- <resource>
- <directory>../src/site/apt/remote</directory>
- <filtering>true</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.5</version>
+ <executions>
+ <execution>
+ <id>copy-resources</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.outputDirectory}/eu/etaxonomy/cdm/doc/remote/apt</outputDirectory>
+ <resources>
+ <resource>
+ <directory>../src/site/apt/remote</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
+++ /dev/null
-package eu.etaxonomy.cdm.remote.dto.vaadin;
-
-import java.util.Collection;
-import java.util.UUID;
-
-import org.apache.log4j.Logger;
-
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.description.Distribution;
-import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
-import eu.etaxonomy.cdm.model.name.Rank;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-
-/**
- * This class acts like a data transfer object. It is intended to ease the communication
- * between the jpa and vaadin's ui widget/objects. The dto is filled with the desired information
- * especially needed to display. The ui is able to change certain fields. In the end the services
- * persist the changed values.<p>
- *
- * So it reduces the service calls, at least in theory.
- *
- *
- * @author a.oppermann
- *
- */
-public class CdmTaxonTableCollection{
-
- Logger logger = Logger.getLogger(CdmTaxonTableCollection.class);
-
- private Taxon taxon;
-
- private Collection<DescriptionElementBase> listTaxonDescription;
-
-
- private String fullTitleCache;
-
- private Rank rank;
-
-
- public CdmTaxonTableCollection(Taxon taxon, Collection<DescriptionElementBase> listTaxonDescription){
- this.taxon = CdmBase.deproxy(taxon, Taxon.class);
- this.listTaxonDescription = listTaxonDescription;
- }
-
- public CdmTaxonTableCollection(Taxon taxon){
- this.taxon = CdmBase.deproxy(taxon, Taxon.class);
- }
-
- //----Getter - Setter - methods ----//
- /**
- *
- * @return
- */
- public String getFullTitleCache() {
- TaxonNameBase name = taxon.getName();
- name = CdmBase.deproxy(name, TaxonNameBase.class);
- if(name == null){
- return "-";
- }
- return name.getFullTitleCache();
- }
- /**
- *
- * @param fullTitleCache
- */
- public void setFullTitleCache(String fullTitleCache) {
- taxon.getName().setFullTitleCache(fullTitleCache, true);
- taxon.setTitleCache(fullTitleCache, true);
- }
- /**
- *
- * @return
- */
- public Taxon getTaxon() {
- return taxon;
- }
-
- public void setTaxon(Taxon taxon){
- this.taxon = taxon;
- }
-
-
-
- /**
- * Returns the taxonomic {@link Rank rank} of <i>this</i> taxon name.
- *
- * @see Rank
- */
- public String getRank(){
- rank = taxon.getName().getRank();
- if(rank == null){
- return "-";
- }
- return rank.toString();
- }
-
- public UUID getUUID(){
- return taxon.getUuid();
- }
-
- /**
- * @see #getRank()
- */
- public void setRank(Rank rank){
- taxon.getName().setRank(rank);
- }
- /**
- *
- * @return
- */
- public PresenceAbsenceTerm getDistributionStatus(String distribution){
- Distribution db = getDistribution(distribution);
- if(db != null){
- return db.getStatus();
- }
- return null;
- }
-
-// public ComboBox getDistributionComboBox(){
-// if(getDistributionStatus() != null && termList != null){
-// BeanItemContainer<PresenceAbsenceTermBase> container = new BeanItemContainer<PresenceAbsenceTermBase>(PresenceAbsenceTermBase.class);
-// container.addAll(termList);
-// final ComboBox box = new ComboBox();
-// box.setContainerDataSource(container);
-// box.setImmediate(true);
-//// setValueChangeListener(box);
-// if(getDistributionStatus() != null){
-// box.setValue(getDistributionStatus());
-// }
-// return box;
-// }else{
-// return null;
-// }
-// }
-
-
-
-// private void setValueChangeListener(final ComboBox box){
-// box.addValueChangeListener(new ValueChangeListener() {
-// private static final long serialVersionUID = 1L;
-// @Override
-// public void valueChange(ValueChangeEvent event) {
-// logger.info("Value Change: "+ box.getValue());
-// setDistributionStatus((PresenceAbsenceTermBase<?>)box.getValue());
-// }
-// });
-// }
-
- /**
- *
- * @param status
- */
- public void setDistributionStatus(String distribution, PresenceAbsenceTerm status){
- Distribution db = getDistribution(distribution);
- if(db != null){
- db.setStatus(status);
-// DescriptionServiceImpl desc = new DescriptionServiceImpl();
-// desc.saveDescriptionElement(db);
-// descriptionService.saveDescriptionElement(db);
- }
- }
- /**
- *
- * @return
- */
- public Distribution getDistribution(String distribution){
- if(listTaxonDescription != null){
- for(DescriptionElementBase deb : listTaxonDescription){
- if(deb instanceof Distribution){
- //FIXME HOW TO IMPLEMENT A FILTER ???
- Distribution db = (Distribution)deb;
- if(db.getArea().getTitleCache().equalsIgnoreCase(distribution)){
- return db;
- }
- }
- }
- }
- return null;
- }
-
-
- //----------- Detail View ------------------//
-
- /**
- *
- * @return
- */
- public String getTaxonNameCache(){
- return taxon.getName().getTitleCache();
- }
-
- public void setTaxonNameCache(String titlecache){
- taxon.getName().setTitleCache(titlecache, true);
- }
- /**
- *
- * @return
- */
- public String getNomenclaturalCode(){
- return taxon.getName().getNomenclaturalCode().getTitleCache();
- }
- /**
- *
- * @return
- */
- public String getSecundum(){
- return taxon.getSec().toString();
- }
-
-
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin;
-
-import javax.servlet.ServletContext;
-import org.springframework.context.ApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
-
-public class SpringContextHelper {
-
- private ApplicationContext context;
- public SpringContextHelper(ServletContext servletContext) {
- /*ServletContext servletContext =
- ((WebApplicationContext) application.getContext())
- .getHttpSession().getServletContext();*/
- context = WebApplicationContextUtils.
- getRequiredWebApplicationContext(servletContext);
- }
-
- public Object getBean(final String beanRef) {
- return context.getBean(beanRef);
- }
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer;
-
-@Configuration
-public class VaadinConfigurer extends AbstractWebApplicationConfigurer {
-
- @Bean
- public String vaadinUiSet(){
- return findProperty("cdm.remote.vaadinUISet", false);
- }
-
-
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin;
-
-import java.io.IOException;
-import java.util.logging.Level;
-
-import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import ru.xpoft.vaadin.CdmDiscoveryNavigator;
-
-import com.vaadin.annotations.PreserveOnRefresh;
-import com.vaadin.annotations.Theme;
-import com.vaadin.server.RequestHandler;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinResponse;
-import com.vaadin.server.VaadinSession;
-import com.vaadin.ui.UI;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.remote.vaadin.uiset.redlist.views.ErrorView;
-
-/**
- *
- * @author a.oppermann
- *
- * This class is the entry point for the Vaadin Application.
- * The UI Session,different Views and more get initialized here.
- * The navigator auto-discovers all the views by looking for
- * the @VaadinView Annotation at the beginning of each class.
- *
- */
-@Component
-@Scope("prototype")//maybe session?
-@Theme("mytheme")
-public class VaadinUI extends UI {
-
- private static final String UISET = "redlist.views";
-
- public VaadinUI(){
- super();
- }
-
- Logger logger = Logger.getLogger(VaadinUI.class);
- /**
- * Automatically generated serial version ID
- */
- private static final long serialVersionUID = 7106403278711066859L;
-
- @Autowired
- private VaadinConfigurer vaadinConfigurer;
-
- @Override
- public void init(VaadinRequest request) {
- VaadinSession.getCurrent().addRequestHandler(
- new RequestHandler() {
- @Override
- public boolean handleRequest(VaadinSession session,
- VaadinRequest request,
- VaadinResponse response)
- throws IOException {
-
- ConversationHolder conv = (ConversationHolder)VaadinSession.getCurrent().getAttribute("conversation");
- conv.bind();
- logger.info("UI Request Handler call - Bound Vaadin Session Conversation : " + VaadinSession.getCurrent().getAttribute("conversation"));
- return false; // No response was written
- }
- });
-
- setSizeFull();
- String packageNameScope = "eu.etaxonomy.cdm.remote.vaadin.uiset." + UISET;// vaadinConfigurer.vaadinUiSet();
-
-// DiscoveryNavigator navigator = new DiscoveryNavigator(this, this);
- CdmDiscoveryNavigator navigator = new CdmDiscoveryNavigator(this, this, packageNameScope);
- navigator.setErrorView(new ErrorView());
- }
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.components;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.annotation.PostConstruct;
-
-import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import com.vaadin.data.Item;
-import com.vaadin.data.util.BeanItemContainer;
-import com.vaadin.server.VaadinSession;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Table;
-
-import eu.etaxonomy.cdm.api.service.IClassificationService;
-import eu.etaxonomy.cdm.api.service.IDescriptionService;
-import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.api.service.ITermService;
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.DefinedTermBase;
-import eu.etaxonomy.cdm.model.common.TermVocabulary;
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.description.Distribution;
-import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.cdm.remote.dto.vaadin.CdmTaxonTableCollection;
-import eu.etaxonomy.cdm.remote.vaadin.data.LazyLoadedContainer;
-
-/**
- *
- * This class is a Vaadin Component. It starts a long running session at the moment.
- * This might change in the future, but for now it beautifully works for this prototype.<p>
- * This class takes advantage of the dto and fills a container with data from the DB. Lazyloading or
- * Paging needs to be used!!!!
- * <p>
- * Further clarification is needed about the exact process when marking this component as dirty.
- * What will happen to the bound session? Why are changed Object saved without calling services explicitly.
- *
- *
- * @author a.oppermann
- *
- */
-
-@Component
-@Scope("prototype")
-public class CellRendererTable extends Table{
-
- /**
- * automatic generated ID
- */
- @Autowired
- IVocabularyService vocabularyService;
- @Autowired
- ITaxonService taxonService;
- @Autowired
- IDescriptionService descriptionService;
- @Autowired
- ITermService termService;
- @Autowired
- IClassificationService clService;
- @Autowired
- ITaxonNodeService taxonNodeService;
- @Autowired
- IClassificationService classificationService;
-
- Logger logger = Logger.getLogger(CellRendererTable.class);
-
-
- private static final long serialVersionUID = 1L;
-
- @PostConstruct
- @SuppressWarnings("rawtypes")
- void PostConstruct(){
-
-// final BeanItemContainer<CdmTaxonTableCollection> redListContainer = new BeanItemContainer<CdmTaxonTableCollection>(CdmTaxonTableCollection.class);
- //TODO: Make use of paging
-// VaadinSession session = VaadinSession.getCurrent();
-// UUID uuid = UUID.fromString(session.getAttribute("classificationUUID").toString());
-// Classification classification = clService.load(uuid);
-// List<TaxonNode> listAllNodes = taxonNodeService.listAllNodesForClassification(classification, null, null);
-
-// Collection<Taxon> listTaxon = taxonService.list(Taxon.class, null, null, null, NODE_INIT_STRATEGY);
-// for(TaxonNode taxonNode:listAllNodes){
-//
-// Taxon taxon = taxonNode.getTaxon();
-// List<PresenceAbsenceTermBase> termList = termService.list(PresenceAbsenceTermBase.class, null, null, null, DESCRIPTION_INIT_STRATEGY);
-// List<DescriptionElementBase> listTaxonDescription = descriptionService.listDescriptionElementsForTaxon(taxon, null, null, null, null, DESCRIPTION_INIT_STRATEGY);
-// CdmTaxonTableCollection tableCollection = new CdmTaxonTableCollection(taxon, listTaxonDescription, termList);
-// redListContainer.addBean(tableCollection);
-// }
-
- /** Get Distribution selection **/
- VaadinSession session = VaadinSession.getCurrent();
- UUID termUUID = (UUID) session.getAttribute("selectedTerm");
- TermVocabulary<DefinedTermBase> term = vocabularyService.load(termUUID);
- term = CdmBase.deproxy(term, TermVocabulary.class);
- Set<DefinedTermBase> terms = term.getTerms();
-
- final LazyLoadedContainer container = new LazyLoadedContainer(CdmTaxonTableCollection.class, classificationService, taxonNodeService);
-
-// container.addContainerProperty("fullTitleCache", String.class, null);
-// container.addContainerProperty("rank", String.class, null);
-
- //String[] columns = ; //,"distributionStatus"
- ArrayList<String> columnList = new ArrayList<String>(Arrays.asList(new String[]{"fullTitleCache","rank"}));
- ArrayList<String> headerList = new ArrayList<String>(Arrays.asList(new String[]{"Taxon","Rang"}));
- for(final DefinedTermBase dt : terms){
- columnList.add(dt.getTitleCache());
- headerList.add(dt.getTitleCache());
-// container.addContainerProperty(dt.getTitleCache(), String.class, null);
-
- addContainerProperty(dt.getTitleCache(), String.class, null);
- try{
- addGeneratedColumn(dt.getTitleCache(), new ColumnGenerator() {
- public Object generateCell(Table source, Object itemId, Object columnId) {
- Label tf = new Label();
- ComboBox box = null;
- if(itemId instanceof TaxonNode){
- TaxonNode tn = CdmBase.deproxy((TaxonNode) itemId, TaxonNode.class);
- Taxon taxon = CdmBase.deproxy(tn.getTaxon(), Taxon.class);
- taxon =(Taxon) taxonService.load(taxon.getUuid());
- Set<Feature> setFeature = new HashSet<Feature>(Arrays.asList(Feature.DISTRIBUTION()));
- List<DescriptionElementBase> listTaxonDescription = descriptionService.listDescriptionElementsForTaxon(taxon, setFeature, null, null, null, DESCRIPTION_INIT_STRATEGY);
- for(DescriptionElementBase deb : listTaxonDescription){
- if(deb instanceof Distribution){
- Distribution db = (Distribution)deb;
- String titleCache = dt.getTitleCache();
- if(isEditable()){
- if(db.getArea().getTitleCache().equalsIgnoreCase(titleCache)){
- List<PresenceAbsenceTerm> listTerm = termService.list(PresenceAbsenceTerm.class, null, null, null, DESCRIPTION_INIT_STRATEGY);
- BeanItemContainer<PresenceAbsenceTerm> termContainer = new BeanItemContainer<PresenceAbsenceTerm>(PresenceAbsenceTerm.class);
- termContainer.addAll(listTerm);
- box = new ComboBox("Occurrence Status: ", termContainer);
- Item item = container.getItem(itemId);
- box.setValue(db.getStatus());
- }
- }else{
- if(db.getArea().getTitleCache().equalsIgnoreCase(titleCache)){
- tf.setValue(db.getStatus().toString());
-
- }
- }
- }
- }
- }
- if(isEditable()){
- return box;
- }else{
- return tf;
- }
- }
- });
- }catch(IllegalArgumentException e){
- e.printStackTrace();
- }
- }
-
-
-
- setContainerDataSource(container);
- setColumnReorderingAllowed(true);
- setSortEnabled(false);
-// setVisibleColumns(columns);
- Object[] visibleColumns = columnList.toArray();
- setVisibleColumns(visibleColumns);
- setColumnHeaders(headerList.toArray(new String[headerList.size()]));//new String[]{"Taxon", "Rang"});// ,"Deutschland"
- setColumnCollapsingAllowed(true);
- setSelectable(true);
- setSizeUndefined();
- setSizeFull();
- setPageLength(15);
- setFooterVisible(true);
- setColumnFooter("fullTitleCache", "Total amount of Taxa displayed: " + container.size());
-
-
-
- // setCacheRate(10);
- }
-
- private static final List<String> NODE_INIT_STRATEGY = Arrays.asList(new String[]{
- "descriptions",
- "descriptions.*",
- "description.state",
- "feature",
- "feature.*",
- "childNodes",
- "childNodes.taxon",
- "childNodes.taxon.name",
- "taxonNodes",
- "taxonNodes.*",
- "taxonNodes.taxon.*",
- "taxon.*",
- "taxon.descriptions",
- "taxon.sec",
- "taxon.name.*",
- "taxon.synonymRelations",
- "terms",
- "name.*",
- "name.rank.representations",
- "name.status.type.representations",
- "sources.$",
- "stateData.$"
- });
-
- protected static final List<String> DESCRIPTION_INIT_STRATEGY = Arrays.asList(new String []{
- "$",
- "elements.*",
- "elements.sources.citation.authorTeam.$",
- "elements.sources.nameUsedInSource.originalNameString",
- "elements.area.level",
- "elements.modifyingText",
- "elements.states.*",
- "elements.media",
- "elements.multilanguageText",
- "multilanguageText",
- "stateData.$"
- });
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.components;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import com.vaadin.data.Container;
-import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.event.ShortcutAction.KeyCode;
-import com.vaadin.server.Page;
-import com.vaadin.server.VaadinSession;
-import com.vaadin.shared.ui.label.ContentMode;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.FormLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Notification;
-
-import eu.etaxonomy.cdm.api.service.IClassificationService;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.remote.vaadin.uiset.redlist.views.DistributionSelectorView;
-
-/**
- *
- *
- * Yet another component, which creates a simple form layout. It makes use of the
- * AuthenticationController.
- *
- *
- * @author a.oppermann
- *
- */
-
-@Component
-@Scope("request")
-public class ClassificationSelectionForm extends FormLayout implements Serializable{
-
- /**
- * Automatically generated serial version ID
- */
- private static final long serialVersionUID = 1L;
-
- private ComboBox box;
- @Autowired
- private IClassificationService classificationService;
-
-
- @PostConstruct
- public void PostConstruct(){
- Label header = new Label("Classificaton Selection");
- header.setStyleName("h1");
- Label description = new Label("Please choose a classification and proceed with continue.",ContentMode.TEXT);
-
- List<Classification> listClassifications = classificationService.listClassifications(null, null, null, NODE_INIT_STRATEGY());
- box = new ComboBox();
- Container c = new IndexedContainer(listClassifications);
- box.setContainerDataSource(c);
- box.select(listClassifications.get(0));
-
-
- Button nextButton = new Button("Continue", new Button.ClickListener() {
-
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void buttonClick(ClickEvent event) {
- if(box.getValue() != null){
- VaadinSession session = VaadinSession.getCurrent();
- Classification classification = (Classification) box.getValue();
- session.setAttribute("classificationUUID", classification.getUuid());
- Page.getCurrent().setUriFragment("!"+ DistributionSelectorView.NAME);//BfnView.NAME //MyVaadinTest.NAME
- }else{
- Notification.show("Please Select a Classification, in order to proceed!",Notification.Type.ERROR_MESSAGE);
- }
- }
- });
- nextButton.setClickShortcut(KeyCode.ENTER, null);
- nextButton.setImmediate(true);
-
- header.setStyleName("h1");
-
- setSpacing(true);
- setMargin(true);
- setSizeUndefined();
-
- addComponent(header);
- addComponent(description);
- addComponent(box);
- addComponent(nextButton);
- }
-
- private List<String> NODE_INIT_STRATEGY(){
- return Arrays.asList(new String[]{
- "taxon.sec",
- "taxon.name",
- "classification"
- });}
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.components;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.annotation.PostConstruct;
-
-import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import com.vaadin.annotations.PreserveOnRefresh;
-import com.vaadin.data.util.BeanItemContainer;
-import com.vaadin.server.VaadinSession;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Notification;
-import com.vaadin.ui.Table;
-
-import eu.etaxonomy.cdm.api.service.IClassificationService;
-import eu.etaxonomy.cdm.api.service.IDescriptionService;
-import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.api.service.ITermService;
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.DefinedTermBase;
-import eu.etaxonomy.cdm.model.common.TermVocabulary;
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.description.Distribution;
-import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
-import eu.etaxonomy.cdm.model.location.NamedArea;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.cdm.remote.dto.vaadin.CdmTaxonTableCollection;
-import eu.etaxonomy.cdm.remote.vaadin.data.LazyLoadedContainer;
-
-/**
- *
- * This class is a Vaadin Component. It starts a long running session at the moment.
- * This might change in the future, but for now it beautifully works for this prototype.<p>
- * This class takes advantage of the dto and fills a container with data from the DB. Lazyloading or
- * Paging needs to be used!!!!
- * <p>
- * Further clarification is needed about the exact process when marking this component as dirty.
- * What will happen to the bound session? Why are changed Object saved without calling services explicitly.
- *
- *
- * @author a.oppermann
- *
- */
-
-@Component
-@Scope("request")
-@PreserveOnRefresh
-public class DemoTaxonTable extends Table{
-
- /**
- * automatic generated ID
- */
- @Autowired
- transient IVocabularyService vocabularyService;
- @Autowired
- transient ITaxonService taxonService;
- @Autowired
- transient IDescriptionService descriptionService;
- @Autowired
- transient ITermService termService;
- @Autowired
- transient IClassificationService clService;
- @Autowired
- transient ITaxonNodeService taxonNodeService;
- @Autowired
- transient IClassificationService classificationService;
-
- Logger logger = Logger.getLogger(DemoTaxonTable.class);
-
-
- private static final long serialVersionUID = 1L;
-
- @PostConstruct
- @SuppressWarnings("rawtypes")
- void PostConstruct(){
-
-// final BeanItemContainer<CdmTaxonTableCollection> redListContainer = new BeanItemContainer<CdmTaxonTableCollection>(CdmTaxonTableCollection.class);
- //TODO: Make use of paging
-// VaadinSession session = VaadinSession.getCurrent();
-// UUID uuid = UUID.fromString(session.getAttribute("classificationUUID").toString());
-// Classification classification = clService.load(uuid);
-// List<TaxonNode> listAllNodes = taxonNodeService.listAllNodesForClassification(classification, null, null);
-
-// Collection<Taxon> listTaxon = taxonService.list(Taxon.class, null, null, null, NODE_INIT_STRATEGY);
-// for(TaxonNode taxonNode:listAllNodes){
-//
-// Taxon taxon = taxonNode.getTaxon();
-// List<PresenceAbsenceTermBase> termList = termService.list(PresenceAbsenceTermBase.class, null, null, null, DESCRIPTION_INIT_STRATEGY);
-// List<DescriptionElementBase> listTaxonDescription = descriptionService.listDescriptionElementsForTaxon(taxon, null, null, null, null, DESCRIPTION_INIT_STRATEGY);
-// CdmTaxonTableCollection tableCollection = new CdmTaxonTableCollection(taxon, listTaxonDescription, termList);
-// redListContainer.addBean(tableCollection);
-// }
-
- VaadinSession session = VaadinSession.getCurrent();
- UUID termUUID = (UUID) session.getAttribute("selectedTerm");
- TermVocabulary<DefinedTermBase> term = vocabularyService.load(termUUID);
- term = CdmBase.deproxy(term, TermVocabulary.class);
- Set<DefinedTermBase> terms = term.getTerms();
-
- final LazyLoadedContainer container = new LazyLoadedContainer(CdmTaxonTableCollection.class, classificationService, taxonNodeService);
-
-// container.addContainerProperty("fullTitleCache", String.class, null);
-// container.addContainerProperty("rank", String.class, null);
-
- //String[] columns = ; //,"distributionStatus"
- ArrayList<String> columnList = new ArrayList<String>(Arrays.asList(new String[]{"fullTitleCache","rank"}));
- ArrayList<String> headerList = new ArrayList<String>(Arrays.asList(new String[]{"Taxon","Rang"}));
- for(final DefinedTermBase dt : terms){
- columnList.add(dt.getTitleCache());
- headerList.add(dt.getTitleCache());
-// container.addContainerProperty(dt.getTitleCache(), String.class, null);
-
- addContainerProperty(dt.getTitleCache(), String.class, null);
- try{
- addGeneratedColumn(dt.getTitleCache(), new ColumnGenerator() {
- public Object generateCell(Table source, Object itemId, Object columnId) {
- Label tf = new Label();
- ComboBox box = null;
- if(itemId instanceof TaxonNode){
- TaxonNode tn = CdmBase.deproxy((TaxonNode) itemId, TaxonNode.class);
- Taxon taxon = CdmBase.deproxy(tn.getTaxon(), Taxon.class);
- taxon =(Taxon) taxonService.load(taxon.getUuid());
- HashMap<DescriptionElementBase, Distribution> map = getDistribution(taxon);
-
- List<PresenceAbsenceTerm> listTerm = termService.list(PresenceAbsenceTerm.class, null, null, null, DESCRIPTION_INIT_STRATEGY);
- BeanItemContainer<PresenceAbsenceTerm> termContainer = new BeanItemContainer<PresenceAbsenceTerm>(PresenceAbsenceTerm.class);
- termContainer.addAll(listTerm);
- box = new ComboBox("Occurrence Status: ", termContainer);
- box.setImmediate(true);
-
- if(map != null){
- /** update field **/
- DescriptionElementBase deb = null;
- Distribution db = null;
- for(Map.Entry<DescriptionElementBase, Distribution> entry : map.entrySet()){
- deb = entry.getKey();
- db = entry.getValue();
- }
- if(isEditable()){
- box = updateDistributionField(deb, db, termContainer, box, taxon);
- }else{
- if(db.getStatus() != null){
- tf.setValue(db.getStatus().toString());
- }else{
- //FIXME: case for delete?
- Notification.show("Possible Error for " +taxon.getTitleCache() + " for Distribution: " + db.getArea().getTitleCache(), Notification.Type.TRAY_NOTIFICATION);
- tf.setValue("-");
- }
- }
- }else{
- /** create distribution if it does not exist and set the status **/
- if(isEditable()){
- box = createDistributionField(taxon, termContainer, box);
- }else{
- tf.setValue("-");
- }
- }
-
- }
-
- if(isEditable()){
- return box;
- }else{
- return tf;
- }
- }
-
- private ComboBox createDistributionField(
- final Taxon taxon,
- BeanItemContainer<PresenceAbsenceTerm> termContainer,ComboBox box) {
- final ComboBox box2 = box;
- box.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
- NamedArea area = (NamedArea) dt;
- Distribution db = Distribution.NewInstance(area, (PresenceAbsenceTerm) box2.getValue());
- Set<TaxonDescription> descriptions = taxon.getDescriptions();
- if (descriptions != null) {
- for (TaxonDescription desc : descriptions) {
- // add to first taxon description
- desc.addElement(db);
- descriptionService.saveOrUpdate(desc);
- break;
- }
- } else {// there are no TaxonDescription yet.
- TaxonDescription td = TaxonDescription.NewInstance(taxon);
- td.addElement(db);
- taxon.addDescription(td);
- taxonService.saveOrUpdate(taxon);
- }
- }
-
- });
-
-
- return box;
- }
-
- private HashMap<DescriptionElementBase, Distribution> getDistribution(Taxon taxon){
- Set<Feature> setFeature = new HashSet<Feature>(Arrays.asList(Feature.DISTRIBUTION()));
- List<DescriptionElementBase> listTaxonDescription = descriptionService.listDescriptionElementsForTaxon(taxon, setFeature, null, null, null, DESCRIPTION_INIT_STRATEGY);
- for(DescriptionElementBase deb : listTaxonDescription){
- if(deb instanceof Distribution){
- Distribution db = (Distribution)deb;
- String titleCache = dt.getTitleCache();
- if(db.getArea().getTitleCache().equalsIgnoreCase(titleCache)){
- HashMap<DescriptionElementBase, Distribution> map = new HashMap<DescriptionElementBase, Distribution>();
- map.put(deb, db);
- return map;
- }
- }
- }
- return null;
- }
-
- private ComboBox updateDistributionField(DescriptionElementBase deb, Distribution db, BeanItemContainer<PresenceAbsenceTerm> termContainer, ComboBox box, Taxon taxon) {
- final Distribution db2 = db;
- final DescriptionElementBase deb2 = deb;
- box.setValue(db.getStatus());
- final ComboBox box2 = box;
- final Taxon taxon2 = taxon;
- box.addValueChangeListener(new ValueChangeListener() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
- if(box2.getValue() == null){//delete descriptionElementBase
- descriptionService.deleteDescriptionElement(deb2);
- taxonService.saveOrUpdate(taxon2);
- Notification.show("Delete Status", Notification.Type.TRAY_NOTIFICATION);
- }else{
- db2.setStatus((PresenceAbsenceTerm)box2.getValue());
- descriptionService.saveDescriptionElement(deb2);
- Notification.show("DescriptionService wrote", Notification.Type.TRAY_NOTIFICATION);
- }
- }
- });
- return box;
- }
- });
- }catch(IllegalArgumentException e){
- e.printStackTrace();
- }
- }
-
- setContainerDataSource(container);
- setColumnReorderingAllowed(true);
- setSortEnabled(false);
-// setVisibleColumns(columns);
- Object[] visibleColumns = columnList.toArray();
- setVisibleColumns(visibleColumns);
- setColumnHeaders(headerList.toArray(new String[headerList.size()]));//new String[]{"Taxon", "Rang"});// ,"Deutschland"
- setColumnCollapsingAllowed(true);
- setSelectable(true);
- setSizeUndefined();
- setSizeFull();
- setPageLength(20);
- setFooterVisible(true);
- setColumnFooter("fullTitleCache", "Total amount of Taxa displayed: " + container.size());
-
- setCacheRate(10);
- }
-
- private static final List<String> NODE_INIT_STRATEGY = Arrays.asList(new String[]{
- "descriptions",
- "descriptions.*",
- "description.state",
- "feature",
- "feature.*",
- "childNodes",
- "childNodes.taxon",
- "childNodes.taxon.name",
- "taxonNodes",
- "taxonNodes.*",
- "taxonNodes.taxon.*",
- "taxon.*",
- "taxon.descriptions",
- "taxon.sec",
- "taxon.name.*",
- "taxon.synonymRelations",
- "terms",
- "name.*",
- "name.rank.representations",
- "name.status.type.representations",
- "sources.$",
- "stateData.$"
- });
-
- protected static final List<String> DESCRIPTION_INIT_STRATEGY = Arrays.asList(new String []{
- "$",
- "elements.*",
- "elements.sources.citation.authorship.$",
- "elements.sources.nameUsedInSource.originalNameString",
- "elements.area.level",
- "elements.modifyingText",
- "elements.states.*",
- "elements.media",
- "elements.multilanguageText",
- "multilanguageText",
- "stateData.$"
- });
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.components;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-
-import org.springframework.context.annotation.Scope;
-
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.Tree;
-import com.vaadin.ui.Window;
-
-import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.description.CategoricalData;
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.description.Distribution;
-import eu.etaxonomy.cdm.model.description.StateData;
-import eu.etaxonomy.cdm.model.description.TextData;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-
-
-@Scope("request")
-public class DetailWindow extends CustomComponent implements Serializable{
-
-
- private Collection<DescriptionElementBase> listDescriptions;
- private Taxon taxon;
-
- public DetailWindow(Taxon taxon, Collection<DescriptionElementBase> listDescriptions) {
- this.taxon = taxon;
- this.listDescriptions = listDescriptions;
-
- }
-
- public Window createWindow(){
- Window window = new Window();
- window.setHeight("600px");
- window.setWidth("400px");
- window.setCaption(taxon.getName().getTitleCache());
- window.setContent(constructDescriptionTree(taxon));
- return window;
- }
-
- private Tree constructDescriptionTree(Taxon taxon){
- Tree tree = new Tree();
- tree.setSizeUndefined();
- String parent = "Descriptive Data";
- tree.setValue(parent);
- initDescriptionTree(tree, listDescriptions, parent);
- return tree;
- }
-
- private void initDescriptionTree(Tree tree, Collection<DescriptionElementBase>listDescriptions, Object parent) {
- //TODO: sorting List
-// ArrayList<DescriptionElementBase> lDesc = new ArrayList<DescriptionElementBase>(listDescriptions);
-// sort(lDesc);
- for (DescriptionElementBase deb : listDescriptions){
- tree.addItem(deb.getFeature());
- tree.setItemCaption(deb.getFeature(), deb.getFeature().getTitleCache());
- tree.setParent(deb.getFeature(), parent);
- tree.setChildrenAllowed(deb.getFeature(), true);
-
- if(deb instanceof CategoricalData){
- CategoricalData cd = (CategoricalData) deb;
- if(cd.getStatesOnly().size() <= 1){
- for(StateData st : cd.getStateData()){
- tree.addItem(st);
- tree.setItemCaption(st, st.getState().getTitleCache());
- tree.setParent(st, deb.getFeature());
- tree.setChildrenAllowed(st, false);
- }
- }else{
- //TODO: implement recursion
- }
- }else if(deb instanceof TextData){
- TextData td = (TextData) deb;
- tree.addItem(td);
- tree.setItemCaption(td, td.getText(Language.GERMAN()));
- tree.setParent(td, deb.getFeature());
- tree.setChildrenAllowed(td, false);
- }else if(deb instanceof Distribution){
- Distribution db = (Distribution) deb;
-
- tree.addItem(db.toString());
- tree.setParent(db.toString(), deb.getFeature());
- tree.setChildrenAllowed(db.toString(), true);
-
- tree.addItem(db.getStatus().toString());
- tree.setParent(db.getStatus().toString(), db.toString());
- tree.setChildrenAllowed(db.getStatus().toString(), false);
- }
- tree.expandItemsRecursively(parent);
- }
-
- }
-
- private void sort(ArrayList<DescriptionElementBase> lDesc) {
- Collections.sort(lDesc, new Comparator<DescriptionElementBase>() {
- @Override
- public int compare(DescriptionElementBase o1,
- DescriptionElementBase o2) {
- if (o1.toString() == null && o2.toString() == null) {
- return 0;
- }
- if (o1.toString() == null) {
- return 1;
- }
- if (o2.toString() == null) {
- return -1;
- }
- return o2.toString().compareTo(o2.toString());
- }
- });
- }
-
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.components;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.SortedSet;
-
-import javax.annotation.PostConstruct;
-
-import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import com.vaadin.data.Container;
-import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.event.ShortcutAction.KeyCode;
-import com.vaadin.server.Page;
-import com.vaadin.server.VaadinSession;
-import com.vaadin.shared.ui.label.ContentMode;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.FormLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Notification;
-import com.vaadin.ui.OptionGroup;
-
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
-import eu.etaxonomy.cdm.model.common.DefinedTermBase;
-import eu.etaxonomy.cdm.model.common.TermType;
-import eu.etaxonomy.cdm.model.common.TermVocabulary;
-import eu.etaxonomy.cdm.remote.vaadin.service.VaadinAuthenticationService;
-import eu.etaxonomy.cdm.remote.vaadin.uiset.redlist.views.BfnView;
-
-/**
- *
- *
- * Yet another component, which creates a simple form layout. It makes use of the
- * AuthenticationController.
- *
- *
- * @author a.oppermann
- *
- */
-
-@Component
-@Scope("request")
-public class DistributionSelectionForm extends FormLayout{
-
- /**
- * Automatically generated serial version ID
- */
- private static final long serialVersionUID = 1L;
-
- private OptionGroup selector;
- @Autowired
- private IVocabularyService vocabularyService;
- @Autowired
- VaadinAuthenticationService authenticationService;
-
- private final Logger logger = Logger.getLogger(DistributionSelectionForm.class);
-
-
- @PostConstruct
- public void PostConstruct(){
- Label header = new Label("Distribution Selection");
- header.setStyleName("h1");
- Label description = new Label("Please choose a distributions and proceed with continue.",ContentMode.TEXT);
-
- List<TermVocabulary<DefinedTermBase>> listNamedArea = vocabularyService.findByTermType(TermType.NamedArea);
-
- selector = new OptionGroup();
- Container c = new IndexedContainer(listNamedArea);
- selector.setContainerDataSource(c);
- selector.setNullSelectionAllowed(true);
- selector.setMultiSelect(false);
- selector.setImmediate(true);
-// selector.setLeftColumnCaption("Available distributions");
-// selector.setRightColumnCaption("Selected distributions");
- selector.setWidth("100%");
-
-
-
-// selector.addValueChangeListener(new ValueChangeListener() {
-//
-// @Override
-// public void valueChange(ValueChangeEvent event) {
-// Notification.show(selector.getValue().toString(), Notification.Type.TRAY_NOTIFICATION);
-// if (selector.getValue() instanceof TermVocabulary) {
-// TermVocabulary<DefinedTermBase> term = (TermVocabulary<DefinedTermBase>) selector.getValue();
-// VaadinSession current = VaadinSession.getCurrent();
-// VaadinSession.getCurrent().setAttribute("selectedTerm", term.getUuid());
-//// term = vocabularyService.load(term.getUuid());
-//// term = CdmBase.deproxy(term, TermVocabulary.class);
-//// Set<DefinedTermBase> terms = term.getTerms();
-//// for(DefinedTermBase dt : terms){
-//// Notification.show(dt.toString(), Notification.Type.TRAY_NOTIFICATION);
-////
-//// }
-// }
-// }
-//
-// });
-
- Button nextButton = new Button("Continue", new Button.ClickListener() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void buttonClick(ClickEvent event) {
- try{
- if(selector.getValue() != null){
- if (selector.getValue() instanceof TermVocabulary) {
- TermVocabulary<DefinedTermBase> term = (TermVocabulary<DefinedTermBase>) selector.getValue();
- VaadinSession.getCurrent().setAttribute("selectedTerm", term.getUuid());
- }
- Notification.show(selector.getValue().toString(), Notification.Type.TRAY_NOTIFICATION);
- Page.getCurrent().setUriFragment("!"+ BfnView.NAME);//BfnView.NAME //MyVaadinTest.NAME
- }else{
- Notification.show("Please Select a Distribution, in order to proceed!",Notification.Type.ERROR_MESSAGE);
- }
- }catch(Exception e){
- Notification.show("Unexpected Error, \n\n Please log in again!", Notification.Type.WARNING_MESSAGE);
- logger.info(e);
- authenticationService.logout();
- }
- }
- });
- nextButton.setClickShortcut(KeyCode.ENTER, null);
- nextButton.setImmediate(true);
- nextButton.setClickShortcut(KeyCode.ENTER, null);
-
- header.setStyleName("h1");
-
- setSpacing(true);
- setMargin(true);
- setSizeUndefined();
-
- addComponent(header);
- addComponent(description);
- addComponent(selector);
- addComponent(nextButton);
- }
-
- public Object[] getChildren(Object parentElement) {
-
- if(parentElement instanceof TermVocabulary){
- return getTopLevelElements((TermVocabulary)parentElement);
- } else if (parentElement instanceof DefinedTermBase) {
- return ((DefinedTermBase) parentElement).getIncludes().toArray();
- }
- return null;
- }
-
- /**
- *
- * @param vocabulary
- * @return An array of DefinedTermBase objects that do not have parents
- *
- * TODO: Needs to be implemented in cdmlib
- */
- private Object[] getTopLevelElements(TermVocabulary vocabulary) {
-
- SortedSet<DefinedTermBase> terms = vocabulary.getTermsOrderedByLabels(null);
- Set<DefinedTermBase> topLevelTerms = new HashSet<DefinedTermBase>();
-
- for (DefinedTermBase term : terms){
- if (term.getPartOf() == null){
- topLevelTerms.add(term);
- }
- }
- return topLevelTerms.toArray();
- }
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.components;
-
-import java.io.Serializable;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.security.core.context.SecurityContext;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.stereotype.Component;
-
-import com.vaadin.server.ThemeResource;
-import com.vaadin.ui.Alignment;
-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.Image;
-import com.vaadin.ui.Label;
-
-import eu.etaxonomy.cdm.remote.vaadin.service.VaadinAuthenticationService;
-
-/**
- *
- * This component creates a simple toolbar. It also makes use of the AuthenticationController.
- *
- * @author a.oppermann
- *
- */
-
-@Component
-@Scope("request")
-public class HorizontalToolbar extends HorizontalLayout implements Serializable{
-
-
- /**
- * automatically generated ID
- */
- private static final long serialVersionUID = 5344340511582993289L;
-
- @Autowired
- private transient VaadinAuthenticationService authenticationController;
-
- private final Button editButton = new Button("Edit");
-
- private final Button saveButton = new Button("Save");
-
- private final Button detailButton = new Button("Detail");
-
- private final Button logoutButton= new Button("Logout");
-
-// private ExcelExporter exporter = new ExcelExporter();
-
-
- @PostConstruct
- public void PostConstruct() {
- if(authenticationController.isAuthenticated()){
- setMargin(true);
- setSpacing(true);
- setStyleName("toolbar");
- setWidth("100%");
- setHeight("75px");
-
- addComponent(editButton);
- addComponent(saveButton);
- addComponent(detailButton);
-// addComponent(exporter);
-
-// exporter.setCaption("Export");
-// exporter.setIcon(new ThemeResource("icons/32/document-xsl.png"));
-
- saveButton.setIcon(new ThemeResource("icons/32/document-save.png"));
- editButton.setIcon(new ThemeResource("icons/32/document-edit.png"));
- detailButton.setIcon(new ThemeResource("icons/32/document-txt.png"));
- logoutButton.setIcon(new ThemeResource("icons/32/cancel.png"));
-
- // SecurityContext context = (SecurityContext)VaadinService.getCurrentRequest().getWrappedSession().getAttribute("context");
- SecurityContext context = SecurityContextHolder.getContext();
- Label loginName = new Label(authenticationController.getUserName());
- loginName.setIcon(new ThemeResource("icons/32/user.png"));
-
- HorizontalLayout rightLayout = new HorizontalLayout();
- Image image = new Image(null, new ThemeResource("icons/32/vseparator1.png"));
- rightLayout.addComponent(logoutButton);
- rightLayout.addComponent(image);
- rightLayout.addComponent(loginName);
-
- addComponent(rightLayout);
- setComponentAlignment(rightLayout, Alignment.MIDDLE_RIGHT);
- setExpandRatio(rightLayout, 1);
-
- logoutButton.addClickListener(new ClickListener() {
-
- /**
- * automatically generated ID
- */
- private static final long serialVersionUID = 8380401487511285303L;
-
- public void buttonClick(ClickEvent event) {
-
- authenticationController.logout();
-
- }
- });
- }
- }
-
- public Button getEditButton() {
- return editButton;
- }
-
- public Button getSaveButton() {
- return saveButton;
- }
-
- public Button getDetailButton() {
- return detailButton;
- }
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.components;
-
-import java.io.Serializable;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.stereotype.Component;
-
-import com.vaadin.data.validator.StringLengthValidator;
-import com.vaadin.event.ShortcutAction.KeyCode;
-import com.vaadin.server.Page;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.FormLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Notification;
-import com.vaadin.ui.PasswordField;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.UI;
-
-import eu.etaxonomy.cdm.remote.vaadin.service.VaadinAuthenticationService;
-import eu.etaxonomy.cdm.remote.vaadin.uiset.redlist.views.ClassificationSelectorView;
-
-/**
- *
- *
- * Yet another component, which creates a simple login form layout. It makes use of the
- * AuthenticationController.
- *
- *
- * @author a.oppermann
- *
- */
-
-@Component
-@Scope("prototype")
-public class LoginForm extends FormLayout implements Serializable{
-
- /**
- * Automatically generated serial version ID
- */
- private static final long serialVersionUID = 8409330855620204572L;
-
- private static final String COMMON_FIELD_WIDTH = "12em";
-
- @Autowired
- private transient VaadinAuthenticationService authenticationController;
-
-
-
-
- private TextField userName;
- private PasswordField passwordField;
-
-
- @PostConstruct
- public void PostConstruct(){
- // userName
- userName = new TextField();
- userName.setRequired(true);
- userName.setRequiredError("Please enter a valid user name!");
- userName.setCaption("Username");
- userName.setImmediate(false);
- userName.addValidator(new StringLengthValidator("It must be 3-25 characters", 3, 25, false));
- userName.setWidth(COMMON_FIELD_WIDTH);
- userName.setNullRepresentation("");
- userName.focus();
-
- // passwordField
- passwordField = new PasswordField();
- passwordField.setRequired(true);
- passwordField.setRequiredError("Please enter a valid password!");
- passwordField.addValidator(new StringLengthValidator("It must be 3-25 characters", 3, 25, false));
- passwordField.setCaption("Password");
- passwordField.setImmediate(false);
- passwordField.setWidth(COMMON_FIELD_WIDTH);
-
- // sendButton
- Button sendButton = new Button("Send", new Button.ClickListener() {
-
- /**
- * Automatically generated serial version ID
- */
- private static final long serialVersionUID = -4423849632134093870L;
-
- @Override
- public void buttonClick(ClickEvent event) {
- try{
- boolean isAuthenticated = authenticationController.authenticate(userName.getValue(), passwordField.getValue());
- if(isAuthenticated){
- UI.getCurrent().getSession().setAttribute("isAuthenticated", isAuthenticated);
- Page.getCurrent().setUriFragment("!"+ ClassificationSelectorView.NAME);//DashBoardView BfnView.NAME
- }
- }catch(AuthenticationException e){
- Notification.show("Bad credentials",Notification.Type.ERROR_MESSAGE);
- }
- }
- });
- sendButton.setClickShortcut(KeyCode.ENTER, null);
- sendButton.setCaption("Send");
- sendButton.setImmediate(true);
-
- Label header = new Label("Vaaditor login...");
- Label label = new Label("Bitte melden Sie sich mit Ihrem Benutzernamen und Passwort an.");
-
- header.setStyleName("h1");
-
- setSpacing(true);
- setMargin(true);
- setSizeUndefined();
-
- addComponent(header);
- addComponent(label);
- addComponent(userName);
- addComponent(passwordField);
- addComponent(sendButton);
- }
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.components;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-import javax.sql.DataSource;
-
-import org.apache.log4j.Logger;
-import org.hibernate.SessionFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.orm.hibernate4.HibernateTransactionManager;
-
-import com.vaadin.data.util.BeanItemContainer;
-import com.vaadin.ui.Table;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.IDescriptionService;
-import eu.etaxonomy.cdm.api.service.INameService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.api.service.ITermService;
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.remote.dto.vaadin.CdmTaxonTableCollection;
-
-/**
- *
- * This class is a Vaadin Component. It starts a long running session at the moment.
- * This might change in the future, but for now it beautifully works for this prototype.<p>
- * This class takes advantage of the dto and fills a container with data from the DB. Lazyloading or
- * Paging needs to be used!!!!
- * <p>
- * Further clarification is needed about the exact process when marking this component as dirty.
- * What will happen to the bound session? Why are changed Object saved without calling services explicitly.
- *
- *
- * @author a.oppermann
- *
- */
-
-//@Component
-//@Scope("request")
-public class TaxonTableDTO extends Table{
-
- /**
- * automatic generated ID
- */
- @Autowired
- ITaxonService taxonService;
- @Autowired
- INameService nameService;
- @Autowired
- IDescriptionService descriptionService;
- @Autowired
- ITermService termService;
-
- @Autowired
- private HibernateTransactionManager transactionManager;
-
- @Autowired
- private DataSource dataSource;
-
- @Autowired
- private SessionFactory sessionFactory;
-
- private ConversationHolder conversationHolder;
-
-
- Logger logger = Logger.getLogger(TaxonTableDTO.class);
-
- private static final long serialVersionUID = -8449485694571526437L;
-
- @PostConstruct
- @SuppressWarnings("rawtypes")
- void PostConstruct(){
- setSizeFull();
-
-// conversationHolder = new ConversationHolder(dataSource, sessionFactory, transactionManager);
-// conversationHolder.bind();
- final BeanItemContainer<CdmTaxonTableCollection> redListContainer = new BeanItemContainer<CdmTaxonTableCollection>(CdmTaxonTableCollection.class);
- //TODO: Make use of paging
- Collection<Taxon> listTaxon = taxonService.list(Taxon.class, null, null, null, NODE_INIT_STRATEGY);
-
- for(Taxon taxonBase:listTaxon){
-
- Taxon taxon = taxonBase;
- List<PresenceAbsenceTerm> termList = termService.list(PresenceAbsenceTerm.class, null, null, null, DESCRIPTION_INIT_STRATEGY);
- List<DescriptionElementBase> listTaxonDescription = descriptionService.listDescriptionElementsForTaxon(taxon, null, null, null, null, DESCRIPTION_INIT_STRATEGY);
- CdmTaxonTableCollection tableCollection = new CdmTaxonTableCollection(taxon, listTaxonDescription);
- redListContainer.addBean(tableCollection);
- }
-
-
- setContainerDataSource(redListContainer);
- setColumnReorderingAllowed(true);
-
- String[] columns = new String[]{"fullTitleCache", "rank", "UUID", "distributionStatus"};
- setVisibleColumns(columns);
- setColumnHeaders(new String[]{"Taxon", "Rang" , "UUID", "Deutschland"});
- setImmediate(true);
- setColumnCollapsingAllowed(true);
- setSelectable(true);
- setSizeFull();
- setPageLength(10);
- }
-
- public ConversationHolder getConversationHolder() {
- return conversationHolder;
- }
-
-
- private static final List<String> NODE_INIT_STRATEGY = Arrays.asList(new String[]{
- "descriptions",
- "descriptions.*",
- "description.state",
- "feature",
- "feature.*",
- "childNodes",
- "childNodes.taxon",
- "childNodes.taxon.name",
- "taxonNodes",
- "taxonNodes.*",
- "taxonNodes.taxon.*",
- "taxon.*",
- "taxon.descriptions",
- "taxon.sec",
- "taxon.name.*",
- "taxon.synonymRelations",
- "terms",
- "name.*",
- "name.rank.representations",
- "name.status.type.representations",
- "sources.$",
- "stateData.$"
- });
-
- protected static final List<String> DESCRIPTION_INIT_STRATEGY = Arrays.asList(new String []{
- "$",
- "elements.*",
- "elements.sources.citation.authorship.$",
- "elements.sources.nameUsedInSource.originalNameString",
- "elements.area.level",
- "elements.modifyingText",
- "elements.states.*",
- "elements.media",
- "elements.multilanguageText",
- "multilanguageText",
- "stateData.$"
- });
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.data;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.UUID;
-
-import com.vaadin.data.util.BeanContainer;
-import com.vaadin.data.util.BeanItem;
-import com.vaadin.server.VaadinSession;
-
-import eu.etaxonomy.cdm.api.service.IClassificationService;
-import eu.etaxonomy.cdm.api.service.IDescriptionService;
-import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.cdm.remote.dto.vaadin.CdmTaxonTableCollection;
-
-public class LazyLoadedContainer extends BeanContainer implements Serializable{
-
- /** autogenerated **/
- private static final long serialVersionUID = 1L;
-
-
- transient ITaxonNodeService taxonNodeService;
- transient IClassificationService classificationService;
- transient IDescriptionService descriptionService;
-
- VaadinSession session;
- UUID uuid;
- Classification classification;
-
- public LazyLoadedContainer(Class type, IClassificationService classificationService, ITaxonNodeService taxonNodeService) throws IllegalArgumentException {
- super(type);
- this.classificationService = classificationService;
- this.taxonNodeService = taxonNodeService;
- }
-//
-// public LazyLoadedContainer(Class type, IClassificationService classificationService, ITaxonNodeService taxonNodeService, IDescriptionService descriptionService) throws IllegalArgumentException {
-// super(type);
-// this.classificationService = classificationService;
-// this.taxonNodeService = taxonNodeService;
-// this.descriptionService = descriptionService;
-//
-// }
-
- @Override
- public int size(){
- session = VaadinSession.getCurrent();
- uuid = UUID.fromString(session.getAttribute("classificationUUID").toString());
- classification = classificationService.load(uuid);
- int countAllNodesForClassification = taxonNodeService.countAllNodesForClassification(classification);
- return countAllNodesForClassification;
- }
-
- @Override
- public BeanItem getItem(Object itemId){
- TaxonNode taxonNode = ((TaxonNode) itemId);
- CdmBase.deproxy(taxonNode, TaxonNode.class);
- Taxon taxon = (Taxon)taxonNode.getTaxon();
- CdmBase.deproxy(taxon, Taxon.class);
- CdmTaxonTableCollection cttc = new CdmTaxonTableCollection(taxon);
- return new BeanItem(cttc);
- }
-
- @Override
- public List getItemIds(int startIndex, int numberOfIds){
- session = VaadinSession.getCurrent();
- uuid = UUID.fromString(session.getAttribute("classificationUUID").toString());
- classification = classificationService.load(uuid);
- int endIndex = startIndex + numberOfIds;
- System.out.println("startIndex: " + startIndex + ", endIndex: " +endIndex);
- List<TaxonNode> listAllNodesForClassification = taxonNodeService.listAllNodesForClassification(classification, startIndex, endIndex);
- return listAllNodesForClassification;
- }
-
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.data;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.UUID;
-
-import com.vaadin.data.util.BeanItem;
-import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.server.VaadinSession;
-
-import eu.etaxonomy.cdm.api.service.IClassificationService;
-import eu.etaxonomy.cdm.api.service.IDescriptionService;
-import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.cdm.remote.dto.vaadin.CdmTaxonTableCollection;
-
-public class LazyLoadedIndexedContainer extends IndexedContainer implements Serializable{
-
- /** autogenerated **/
- private static final long serialVersionUID = 1L;
-
-
- ITaxonNodeService taxonNodeService;
- IClassificationService classificationService;
- IDescriptionService descriptionService;
-
- VaadinSession session;
- UUID uuid;
- Classification classification;
-
- public LazyLoadedIndexedContainer(IClassificationService classificationService, ITaxonNodeService taxonNodeService) throws IllegalArgumentException {
- super();
- this.classificationService = classificationService;
- this.taxonNodeService = taxonNodeService;
- }
-//
-// public LazyLoadedContainer(Class type, IClassificationService classificationService, ITaxonNodeService taxonNodeService, IDescriptionService descriptionService) throws IllegalArgumentException {
-// super(type);
-// this.classificationService = classificationService;
-// this.taxonNodeService = taxonNodeService;
-// this.descriptionService = descriptionService;
-//
-// }
-
- @Override
- public int size(){
- session = VaadinSession.getCurrent();
- uuid = UUID.fromString(session.getAttribute("classificationUUID").toString());
- classification = classificationService.load(uuid);
- int countAllNodesForClassification = taxonNodeService.countAllNodesForClassification(classification);
- return countAllNodesForClassification;
- }
-
- @Override
- public BeanItem getItem(Object itemId){
- Taxon taxon = (Taxon)((TaxonNode) itemId).getTaxon();
- CdmTaxonTableCollection cttc = new CdmTaxonTableCollection(taxon);
- return new BeanItem(cttc);
- }
-
- @Override
- public List getItemIds(int startIndex, int numberOfIds){
- session = VaadinSession.getCurrent();
- uuid = UUID.fromString(session.getAttribute("classificationUUID").toString());
- classification = classificationService.load(uuid);
- int endIndex = startIndex + numberOfIds;
- System.out.println("startIndex: " + startIndex + ", endIndex: " +endIndex);
- List<TaxonNode> listAllNodesForClassification = taxonNodeService.listAllNodesForClassification(classification, startIndex, endIndex);
- return listAllNodesForClassification;
- }
-
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.service;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.sql.DataSource;
-
-import org.apache.log4j.Logger;
-import org.hibernate.SessionFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.orm.hibernate4.HibernateTransactionManager;
-import org.springframework.stereotype.Component;
-
-import ru.xpoft.vaadin.SpringVaadinServlet;
-
-import com.vaadin.server.ServiceException;
-import com.vaadin.server.SessionDestroyEvent;
-import com.vaadin.server.SessionDestroyListener;
-import com.vaadin.server.SessionInitEvent;
-import com.vaadin.server.SessionInitListener;
-import com.vaadin.server.VaadinServlet;
-import com.vaadin.server.VaadinSession;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.remote.vaadin.SpringContextHelper;
-
-
-public class CdmVaadinServlet extends SpringVaadinServlet implements SessionInitListener, SessionDestroyListener {
-
- private static final Logger logger = Logger.getLogger(CdmVaadinServlet.class);
-
- /**
- *
- */
- private static final long serialVersionUID = -2973231251266766766L;
-
- private ConversationHolder conversation;
- SpringContextHelper helper;
- @Override
- protected void servletInitialized() throws ServletException {
- super.servletInitialized();
- helper = new SpringContextHelper(VaadinServlet.getCurrent().getServletContext());
- getService().addSessionInitListener(this);
- getService().addSessionDestroyListener(this);
- }
-
- @Override
- public void sessionInit(SessionInitEvent event)
- throws ServiceException {
- conversation = (ConversationHolder) helper.getBean("conversationHolder");
- conversation.bind();
- VaadinSession.getCurrent().setAttribute("conversation", conversation);
- }
-
- @Override
- public void sessionDestroy(SessionDestroyEvent event) {
- conversation.close();
- }
-
- @Override
- protected void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ServletException, IOException {
- if(conversation != null) {
- logger.info("Servlet Service call - Binding Vaadin Session Conversation : " + conversation);
- conversation.bind();
- }
- super.service(request, response);
- }
-
-
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.service;
-
-import javax.sql.DataSource;
-
-import org.apache.log4j.Logger;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.orm.hibernate4.HibernateTransactionManager;
-import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.authentication.BadCredentialsException;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.context.SecurityContext;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.stereotype.Component;
-
-import com.vaadin.server.VaadinService;
-import com.vaadin.ui.Notification;
-import com.vaadin.ui.UI;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-
-/**
- *
- * This class handles the whole login procedure with the spring security layer.
- * There are still some issues to be solved concerning session handling, see ticket
- * {@link http://dev.e-taxonomy.eu/trac/ticket/3830}.<p>
- *
- *
- * @author a.oppermann
- *
- */
-
-@Component
-public class VaadinAuthenticationService {
-
- @Autowired
- private transient AuthenticationManager authenticationManager;
- @Autowired
- private transient ApplicationContext applicationContext;
-
- @Autowired
- private transient HibernateTransactionManager transactionManager;
-
- @Autowired
- private transient DataSource dataSource;
-
- @Autowired
- private transient SessionFactory sessionFactory;
-
- //private transient ConversationHolder conversationHolder;
-
- Logger logger = Logger.getLogger(VaadinAuthenticationService.class);
-
- private String userName;
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public boolean authenticate(String user, String password){
- UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(user, password);
- try{
- Authentication authentication = authenticationManager.authenticate(token);
-// conversationHolder = new ConversationHolder(dataSource, sessionFactory, transactionManager);
-// Session session = conversationHolder.getSession();
-// conversationHolder.startTransaction();
- SecurityContext context = SecurityContextHolder.getContext();
- context.setAuthentication(authentication);
-// SecurityContextHolder.setStrategyName( SecurityContextHolder.MODE_GLOBAL );
- setUserName(user);
-// VaadinService.getCurrentRequest().getWrappedSession().setAttribute("context", context);
- VaadinService.getCurrentRequest().getWrappedSession().setAttribute("isAuthenticated", true);
-// logger.info("VaadinSession: "+ VaadinSession.getCurrent().getSession().getAttribute("context"));
- return true;
-
- }catch(BadCredentialsException e){
- Notification.show("Bad credentials", Notification.Type.ERROR_MESSAGE);
- }
-
- return false;
- }
-
- public void logout(){
- Boolean isAuth = (Boolean) VaadinService.getCurrentRequest().getAttribute("isAuthenticated");
- if(isAuth != null){
- VaadinService.getCurrentRequest().getWrappedSession().setAttribute("isAuthenticated", false);
- }
- UI ui = UI.getCurrent();
- SecurityContextHolder.clearContext();
- ui.close();
- //conversationHolder.clear();
- //conversationHolder.close();
-// conversationHolder.getSessionHolder().getSession().close();
-// VaadinSession.getCurrent().close();
- VaadinService.getCurrentRequest().getWrappedSession().invalidate();
- ui.getSession().close();
- ui.getPage().setLocation("/edit/");
-// ui.close();
-// ui.detach();
-// Navigator navigator = ui.getNavigator();
-// navigator.navigateTo("");
- }
-
- public boolean isAuthenticated(){
- Boolean isAuth = (Boolean) VaadinService.getCurrentRequest().getWrappedSession().getAttribute("isAuthenticated");
- if(isAuth == null || isAuth == false){
- logout();
- return false;
- }
- return true;
- }
-// public ConversationHolder getConversationHolder(){
-// return conversationHolder;
-// }
-
-}
\ No newline at end of file
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.uiset.disabled;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import ru.xpoft.vaadin.VaadinView;
-
-import com.vaadin.navigator.View;
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
-import com.vaadin.server.Page;
-import com.vaadin.shared.ui.label.ContentMode;
-import com.vaadin.ui.Alignment;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.VerticalLayout;
-
-@Component
-@Scope("prototype")
-@VaadinView(DefaultView.NAME)
-public class DefaultView extends CustomComponent implements View{
-
- private static final long serialVersionUID = 1L;
- public static final String NAME ="";
-
- @PostConstruct
- void postConstruct(){
- VerticalLayout layout = new VerticalLayout();
- layout.setWidth("100%");
- layout.setHeight("100%");
- Page page = Page.getCurrent();
- HorizontalLayout hLayout = new HorizontalLayout();
- //TODO: Quick'n'dirty hack, better solutions are possible
- int hh = page.getBrowserWindowHeight()-300;
- setHeight(hh +"px");
-
- Panel panel = new Panel();
- panel.setSizeUndefined();
- VerticalLayout innerLayout = new VerticalLayout();
- innerLayout.setMargin(true);
- Label n = new Label("<h1>Vaadin Service is not available for this instance<h1><br><center><h3>We are sorry for the inconvenience!<h3></center>", ContentMode.HTML);
- innerLayout.addComponent(n);
- panel.setContent(innerLayout);
- panel.setStyleName("login");
-
- layout.addComponent(hLayout);
- layout.addComponent(panel);
-
- layout.setSizeFull();
- layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
-
-
- setCompositionRoot(layout);
- }
-
- @Override
- public void enter(ViewChangeEvent event) {
-
- }
-
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.uiset.redlist.views;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.annotation.PostConstruct;
-
-import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import ru.xpoft.vaadin.VaadinView;
-
-import com.vaadin.annotations.PreserveOnRefresh;
-import com.vaadin.annotations.Theme;
-import com.vaadin.data.Container;
-import com.vaadin.data.Property;
-import com.vaadin.data.util.BeanItem;
-import com.vaadin.event.ItemClickEvent;
-import com.vaadin.event.ItemClickEvent.ItemClickListener;
-import com.vaadin.event.ShortcutAction.KeyCode;
-import com.vaadin.event.ShortcutAction.ModifierKey;
-import com.vaadin.navigator.View;
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
-import com.vaadin.server.VaadinSession;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.DefaultFieldFactory;
-import com.vaadin.ui.Field;
-import com.vaadin.ui.Notification;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Window;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.IDescriptionService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.api.service.ITermService;
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.DefinedTermBase;
-import eu.etaxonomy.cdm.model.common.TermVocabulary;
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.remote.dto.vaadin.CdmTaxonTableCollection;
-import eu.etaxonomy.cdm.remote.vaadin.components.DemoTaxonTable;
-import eu.etaxonomy.cdm.remote.vaadin.components.DetailWindow;
-import eu.etaxonomy.cdm.remote.vaadin.components.HorizontalToolbar;
-import eu.etaxonomy.cdm.remote.vaadin.service.VaadinAuthenticationService;
-
-@Component
-@Scope("prototype")
-@Theme("mytheme")
-@VaadinView(BfnView.NAME)
-@PreserveOnRefresh
-public class BfnView extends CustomComponent implements View{
-
- private static final long serialVersionUID = 1L;
-
- public static final String NAME = "bfn";
-
- @Autowired
- private transient VaadinAuthenticationService authenticationController;
-
- @Autowired
- private transient HorizontalToolbar toolbar;
-
- @Autowired
- private transient DemoTaxonTable taxonTable;
-
- private VerticalLayout layout;
- @Autowired
- private transient ITermService termService;
- @Autowired
- private transient ITaxonService taxonService;
- @Autowired
- private transient IDescriptionService descriptionService;
- @Autowired
- private transient IVocabularyService vocabularyService;
-
- private Taxon currentTaxon;
-
- private final Logger logger = Logger.getLogger(BfnView.class);
-
- private Set<DefinedTermBase> selectedTerms;
-
- @PostConstruct
- public void PostConstruct(){
- if(authenticationController.isAuthenticated()){
- setSizeUndefined();
- setSizeFull();
- layout = new VerticalLayout();
- layout.addComponent(toolbar);
- layout.addComponent(taxonTable);
- layout.setSizeFull();
- taxonTable.setSizeFull();
-
- selectedTerms = initializeTerms();
-
- DefaultFieldFactory fieldFactory = createDefaulfielFactory();
- taxonTable.setTableFieldFactory(fieldFactory);
- layout.setExpandRatio(taxonTable, 1);
-
- createEditClickListener();
-
- setCompositionRoot(layout);
- }
- }
-
-
- private Set<DefinedTermBase> initializeTerms() {
- VaadinSession session = VaadinSession.getCurrent();
- UUID termUUID = (UUID) session.getAttribute("selectedTerm");
- TermVocabulary<DefinedTermBase> term = vocabularyService.load(termUUID);
- term = CdmBase.deproxy(term, TermVocabulary.class);
- return term.getTerms();
- }
-
-
- private DefaultFieldFactory createDefaulfielFactory() {
- DefaultFieldFactory fieldFactory = new DefaultFieldFactory() {
- private static final long serialVersionUID = 1L;
- @Override
- public Field createField(Container container, Object itemId,
- Object propertyId, com.vaadin.ui.Component uiContext) {
- Property containerProperty = container.getContainerProperty(itemId, propertyId);
- if("fullTitleCache".equals(propertyId)){
- return null;
- }
- if("rank".equals(propertyId)){
- return null;
- }
-// if("Berlin".equals(propertyId)){
-// List<PresenceAbsenceTermBase> listTerm = termService.list(PresenceAbsenceTermBase.class, null, null, null, DESCRIPTION_INIT_STRATEGY);
-// BeanItemContainer<PresenceAbsenceTermBase> termContainer = new BeanItemContainer<PresenceAbsenceTermBase>(PresenceAbsenceTermBase.class);
-// termContainer.addAll(listTerm);
-// final ComboBox box = new ComboBox("Occurrence Status: ", termContainer);
-// Item item = container.getItem(itemId);
-// box.setValue(item);
-// toolbar.getSaveButton().setCaption("Save Data *");
-// return box;
-// }
- return super.createField(container, itemId, propertyId, uiContext);
- }
- };
- return fieldFactory;
- }
-
-
- private void createEditClickListener(){
- Button detailButton = toolbar.getDetailButton();
- detailButton.setCaption("Detail View");
- detailButton.addClickListener(new ClickListener() {
-
- @Override
- public void buttonClick(ClickEvent event) {
- try{
- if(currentTaxon != null){
- List<DescriptionElementBase> listDescriptions = descriptionService.listDescriptionElementsForTaxon(currentTaxon, null, null, null, null, DESCRIPTION_INIT_STRATEGY);
- DetailWindow dw = new DetailWindow(currentTaxon, listDescriptions);
- Window window = dw.createWindow();
- getUI().addWindow(window);
- }else{
- Notification.show("Please select a Taxon.", Notification.Type.HUMANIZED_MESSAGE);
- }
- }catch(Exception e){
- Notification.show("Unexpected Error, \n\n Please log in again!", Notification.Type.WARNING_MESSAGE);
- logger.info(e);
- authenticationController.logout();
- }
- }
- });
-
-
- Button saveButton = toolbar.getSaveButton();
- saveButton.setClickShortcut(KeyCode.S, ModifierKey.CTRL);
- saveButton.setDescription("Shortcut: CTRL+S");
- saveButton.setCaption("Save Data");
- saveButton.addClickListener(new ClickListener() {
- private static final long serialVersionUID = 1L;
- @Override
- public void buttonClick(ClickEvent event) {
- ConversationHolder conversationHolder = (ConversationHolder) VaadinSession.getCurrent().getAttribute("conversation");
- try{
- conversationHolder.commit();
- }catch(Exception stateException){
- //TODO create Table without DTO
- Notification.show("Unexpected Error, \n\n Please log in again!", Notification.Type.WARNING_MESSAGE);
- logger.info(stateException);
- authenticationController.logout();
-// conversationHolder.startTransaction();
-// conversationHolder.commit();
- }
- Notification.show("Data saved", Notification.Type.HUMANIZED_MESSAGE);
- taxonTable.setEditable(false);
- toolbar.getSaveButton().setCaption("Save Data");
- }
- });
-
- Button editButton = toolbar.getEditButton();
- editButton.setClickShortcut(KeyCode.E, ModifierKey.CTRL);
- editButton.setDescription("Shortcut: CTRL+e");
- editButton.addClickListener(new ClickListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void buttonClick(ClickEvent event) {
- if(taxonTable.isEditable() == false){
- taxonTable.setEditable(true);
-// taxonTable.removeGeneratedColumn("Berlin");
-// taxonTable.refreshRowCache();
- }else{
- taxonTable.setEditable(false);
- taxonTable.refreshRowCache();
- }
- }
- });
-
- taxonTable.addItemClickListener(new ItemClickListener() {
-
- @Override
- public void itemClick(ItemClickEvent event) {
- Object taxonbean = ((BeanItem<?>)event.getItem()).getBean();
- if(taxonbean instanceof CdmTaxonTableCollection){
- CdmTaxonTableCollection red = (CdmTaxonTableCollection) taxonbean;
- currentTaxon = red.getTaxon();
- }
- }
- });
- }
-
- @Override
- public void enter(ViewChangeEvent event) {
-
- }
- protected static final List<String> DESCRIPTION_INIT_STRATEGY = Arrays.asList(new String []{
- "$",
- "elements.*",
- "elements.sources.citation.authorship.$",
- "elements.sources.nameUsedInSource.originalNameString",
- "elements.area.level",
- "elements.modifyingText",
- "elements.states.*",
- "elements.media",
- "elements.multilanguageText",
- "elements.inDescription",
- "descriptionElements",
- "descriptionElements.$",
- "descriptionElements.inDescription.$",
- "multilanguageText",
- "stateData.$"
- });
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.uiset.redlist.views;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import ru.xpoft.vaadin.VaadinView;
-
-import com.vaadin.annotations.Theme;
-import com.vaadin.navigator.View;
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
-import com.vaadin.server.Page;
-import com.vaadin.ui.Alignment;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.UI;
-import com.vaadin.ui.VerticalLayout;
-
-import eu.etaxonomy.cdm.remote.vaadin.components.ClassificationSelectionForm;
-import eu.etaxonomy.cdm.remote.vaadin.service.VaadinAuthenticationService;
-
-@Component
-@Scope("prototype")
-@Theme("mytheme")
-@VaadinView(ClassificationSelectorView.NAME)
-public class ClassificationSelectorView extends CustomComponent implements View {
-
- private static final long serialVersionUID = 1L;
- public static final String NAME = "ClassificationSelector";
- @Autowired
- private transient VaadinAuthenticationService authenticationService;
- @Autowired
- private transient ClassificationSelectionForm classificationSelectionForm;
-
- @PostConstruct
- public void PostConstruct(){
- if(authenticationService.isAuthenticated()){
- VerticalLayout layout = new VerticalLayout();
- layout.setWidth("100%");
- layout.setHeight("100%");
-
- HorizontalLayout hLayout = new HorizontalLayout();
- //FIXME: Quick'n'dirty hack
- int hh = Page.getCurrent().getBrowserWindowHeight()-300;
- setHeight(hh +"px");
-
-
- Panel panel = new Panel();
- panel.setSizeUndefined();
- panel.setContent(classificationSelectionForm);
- panel.setStyleName("login");
-
- layout.addComponent(hLayout);
- layout.addComponent(panel);
-
- layout.setSizeFull();
- layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
-
- setCompositionRoot(layout);
- }
- }
-
-
- @Override
- public void enter(ViewChangeEvent event) {
- // TODO Auto-generated method stub
- Boolean isAuthenticated = (Boolean)UI.getCurrent().getSession().getAttribute("isAuthenticated");
- if(isAuthenticated == null || !isAuthenticated){
- Page.getCurrent().setLocation("/edit/");
- }
- }
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.uiset.redlist.views;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.annotation.PostConstruct;
-
-import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.data.fieldgroup.BeanFieldGroup;
-import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
-import com.vaadin.data.util.BeanItem;
-import com.vaadin.data.util.BeanItemContainer;
-import com.vaadin.event.ItemClickEvent;
-import com.vaadin.event.ItemClickEvent.ItemClickListener;
-import com.vaadin.navigator.View;
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
-import com.vaadin.server.VaadinSession;
-import com.vaadin.ui.AbsoluteLayout;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.Field;
-import com.vaadin.ui.FormLayout;
-import com.vaadin.ui.HorizontalSplitPanel;
-import com.vaadin.ui.Notification;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.Tree;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.VerticalSplitPanel;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.themes.Runo;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.IDescriptionService;
-import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
-import eu.etaxonomy.cdm.api.service.INameService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.api.service.ITermService;
-import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.description.CategoricalData;
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.description.Distribution;
-import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
-import eu.etaxonomy.cdm.model.description.StateData;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
-import eu.etaxonomy.cdm.model.description.TextData;
-import eu.etaxonomy.cdm.model.location.NamedArea;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.remote.dto.vaadin.CdmTaxonTableCollection;
-import eu.etaxonomy.cdm.remote.vaadin.components.HorizontalToolbar;
-import eu.etaxonomy.cdm.remote.vaadin.components.TaxonTableDTO;
-import eu.etaxonomy.cdm.remote.vaadin.service.VaadinAuthenticationService;
-
-/**
- *
- *
- * Main View Class of this prototype. Components can be autowired or created within this class.
- * This View will be auto-detected by the VaadinServlet. This will be enabled by the @VaadinView
- * annotation. Further it is important to mark this View as a Component, so Spring is able to index
- * it for Apsect Orientation stuff like Autowiring.
- *
- *<p>
- *
- * The @Scope annotation is important for session handling but there are still some issues that need
- * clarification, for further information see
- * {@link https://github.com/xpoft/spring-vaadin/issues/issuecomment-15107560 }
- *
- * @author a.oppermann
- */
-
-//@Component
-//@Scope("prototype")
-//@Theme("mytheme")
-//@VaadinView(DashBoardView.NAME)
-public class DashBoardView extends CustomComponent implements View{
-
- /**
- * Automatically generated serial version ID
- */
- private static final long serialVersionUID = 6724641666558728722L;
-
- public static final String NAME = "dash";
- Logger logger = Logger.getLogger(DashBoardView.class);
- @Autowired
- private VaadinAuthenticationService authenticationService;
-
- @Autowired
- private HorizontalToolbar toolbar;
-
- @Autowired
- private TaxonTableDTO taxonTable;
-
- @Autowired
- private ITaxonService taxonService;
-
- @Autowired
- private ITermService termService;
-
- @Autowired
- private IFeatureTreeService featureTreeService;
-
- @Autowired
- private IDescriptionService descriptionService;
-
- @Autowired
- private INameService nameService;
-
- private Collection<DescriptionElementBase>listDescriptions;
-
- private Table detailTable;
-
- private Taxon currentTaxon;
-
- private BeanItemContainer<CdmTaxonTableCollection> taxonBaseContainer;
-
- private VerticalLayout layout;
-
- private VerticalLayout detailViewLayout;
-
- /*
- * Method will be called initially, but executed after dependency injection
- * further it constructs the whole UI based widgets.
- *
- */
- @PostConstruct
- public void PostConstruct(){
- if(authenticationService.isAuthenticated()){
- layout = new VerticalLayout();
- layout.setSizeFull();
- layout.setHeight("100%");
-
- final HorizontalSplitPanel horizontalSplit = new HorizontalSplitPanel();
- horizontalSplit.setStyleName(Runo.SPLITPANEL_SMALL);
- horizontalSplit.setHeight("100%");
-
- detailViewLayout = new VerticalLayout();
-
- final VerticalLayout descriptionViewLayout = new VerticalLayout();
-
- detailViewLayout.setSizeFull();
- detailViewLayout.setStyleName("taxonDetailView");
-
- horizontalSplit.setFirstComponent(detailViewLayout);
- horizontalSplit.setSecondComponent(descriptionViewLayout);
-
- descriptionViewLayout.setStyleName("descriptiveView");
- descriptionViewLayout.setSizeFull();
-
- VerticalSplitPanel vSplit = new VerticalSplitPanel();
- vSplit.setStyleName(Runo.SPLITPANEL_SMALL);
- vSplit.setSizeFull();
- vSplit.setFirstComponent(taxonTable);
- vSplit.setSecondComponent(horizontalSplit);
-
- AbsoluteLayout taxonLayout = new AbsoluteLayout();
- taxonLayout.setSizeFull();
- taxonLayout.setWidth("100%");
- int height = VaadinSession.getCurrent().getBrowser().getScreenHeight() - 175;
- taxonLayout.setHeight(height+"px");
-// taxonLayout.setSizeUndefined();
- taxonLayout.addComponent(vSplit);
-
- layout.addComponent(toolbar);
- layout.addComponent(taxonLayout);
-// layout.addComponent(horizontalSplit);
- layout.setExpandRatio(taxonLayout, 1);
-
-
- createTaxonTableListener(detailViewLayout, descriptionViewLayout);
- createEditClickListener();
- setCompositionRoot(layout);
- }
- }
-
- //---------------------------------------------------------------------------------------//
- //--------------------Begin of helper methods--------------------------------------------//
- //---------------------------------------------------------------------------------------//
-
- private void createTaxonTableListener(final VerticalLayout detailViewLayout, final VerticalLayout descriptionViewLayout) {
-
- taxonTable.addItemClickListener(new ItemClickListener() {
- private static final long serialVersionUID = 1L;
- @Override
- public void itemClick(ItemClickEvent event) {
- Object taxonbean = ((BeanItem<?>)event.getItem()).getBean();
- clickHandler(taxonbean, detailViewLayout, descriptionViewLayout);
- }
- });
-
-
- taxonTable.addValueChangeListener(new ValueChangeListener() {
- private static final long serialVersionUID = 1L;
- @Override
- public void valueChange(ValueChangeEvent event) {
- Object taxonbean = event.getProperty().getValue();
- clickHandler(taxonbean, detailViewLayout, descriptionViewLayout);
- }
- });
-
- }
-
- private void clickHandler(Object taxonbean, final VerticalLayout detailViewLayout, final VerticalLayout descriptionViewLayout){
- if(taxonbean instanceof CdmTaxonTableCollection){
- detailViewLayout.removeAllComponents();
- descriptionViewLayout.removeAllComponents();
- CdmTaxonTableCollection red = (CdmTaxonTableCollection) taxonbean;
- currentTaxon = red.getTaxon();
- detailViewLayout.addComponent(constructFormLayout(red));
- descriptionViewLayout.addComponent(constructDetailPanel(red));
- }
- }
-
- private TabSheet constructFormLayout(CdmTaxonTableCollection dto){
- TabSheet tabsheet = new TabSheet();
- VerticalLayout tab1 = new VerticalLayout();
- Taxon taxon = dto.getTaxon();
- listDescriptions = descriptionService.listDescriptionElementsForTaxon(taxon, null, null, null, null, DESCRIPTION_INIT_STRATEGY);
-
- tab1.addComponent(constructTaxonDetailForm(dto));
- tab1.setSizeFull();
- tabsheet.setStyleName(Runo.TABSHEET_SMALL);
- tabsheet.addTab(tab1, "Detail Data");
-
- return tabsheet;
- }
-
-
- private FormLayout constructForm(Taxon taxon, final Window window){
- CdmTaxonTableCollection redlistDTO = new CdmTaxonTableCollection(taxon, listDescriptions);
- final BeanFieldGroup<CdmTaxonTableCollection> binder = new BeanFieldGroup<CdmTaxonTableCollection>(CdmTaxonTableCollection.class);
- binder.setItemDataSource(redlistDTO);
- binder.setBuffered(true);
-
- final FormLayout form = new FormLayout();
- form.setMargin(true);
-
- final Field<?> fullTitleCacheField = binder.buildAndBind("Taxon Full Title Cache: ", "fullTitleCache");
- final Field<?> taxonNameCacheField = binder.buildAndBind("Taxon Name Cache: ", "taxonNameCache");
- fullTitleCacheField.setSizeFull();
- taxonNameCacheField.setSizeFull();
-
- form.addComponent(fullTitleCacheField);
- form.addComponent(taxonNameCacheField);
- form.addComponent(constructSaveButton(window, binder));
- form.setImmediate(true);
- form.setSizeFull();
- fullTitleCacheField.commit();
- taxonNameCacheField.commit();
-
- return form;
- }
-
- private FormLayout constructTaxonDetailForm(final CdmTaxonTableCollection red){
- final BeanFieldGroup<CdmTaxonTableCollection> binder = new BeanFieldGroup<CdmTaxonTableCollection>(CdmTaxonTableCollection.class);
- binder.setItemDataSource(red);
- binder.setBuffered(true);
-
- final ComboBox box = initComboBox(red);
-
- final FormLayout form = new FormLayout();
- form.setMargin(true);
-
- Field<?> nameCacheField = binder.buildAndBind("Taxon Name Cache: ", "taxonNameCache");
- Field<?> nomenCodeField = binder.buildAndBind("Nomenclatural Code: ", "nomenclaturalCode");
- Field<?> rankField = binder.buildAndBind("Rang: ", "rank");
- Field<?> secundumField = binder.buildAndBind("Secundum: ", "secundum");
-
- binder.bind(box, "distributionStatus");
-
- nameCacheField.setSizeFull();
- nameCacheField.setReadOnly(true);
- nameCacheField.commit();
- nomenCodeField.setSizeFull();
- rankField.setSizeFull();
- secundumField.setSizeFull();
-
- form.addComponents(nameCacheField, nomenCodeField, rankField, secundumField);
- form.addComponent(box);
- form.setImmediate(true);
- form.setSizeFull();
-
- return form;
- }
-
- @SuppressWarnings("rawtypes")
- private ComboBox initComboBox(final CdmTaxonTableCollection red) {
- List<PresenceAbsenceTerm> listTerm = termService.list(PresenceAbsenceTerm.class, null, null, null, DESCRIPTION_INIT_STRATEGY);
- BeanItemContainer<PresenceAbsenceTerm> container = new BeanItemContainer<PresenceAbsenceTerm>(PresenceAbsenceTerm.class);
- container.addAll(listTerm);
-
- final ComboBox box = new ComboBox("Occurrence Status: ", container);
- //FIXME: box.setValue(red.getDistributionStatus());
- box.setImmediate(true);
-
- box.addValueChangeListener(new ValueChangeListener() {
- private static final long serialVersionUID = 1L;
- @Override
- public void valueChange(ValueChangeEvent event) {
-// ConversationHolder conversationHolder = authenticationService.getConversationHolder();
- ConversationHolder conversationHolder = (ConversationHolder) VaadinSession.getCurrent().getAttribute("conversation");
-// conversationHolder.startTransaction();
- //FIXME: red.setDistributionStatus((PresenceAbsenceTermBase<?>) box.getValue());
- conversationHolder.commit();
- updateTables();
- }
- });
- return box;
- }
-
- private TabSheet constructDetailPanel(CdmTaxonTableCollection dto){
- Taxon taxon = dto.getTaxon();
- TabSheet tabsheet = new TabSheet();
-
- VerticalLayout tab1 = new VerticalLayout();
- VerticalLayout tab2 = new VerticalLayout();
- VerticalLayout tab3 = new VerticalLayout();
- VerticalLayout tab4 = new VerticalLayout();
-
- tab1.addComponent(constructDescriptionTree(taxon));
- tab2.addComponent(initComboBox(dto));
- tab4.addComponent(constructGenerateButton());
- tab4.addComponent(constructDeleteButton());
-
- tabsheet.addTab(tab1, "Description Data");
- tabsheet.addTab(tab2, "Taxon Data");
- tabsheet.addTab(tab3, "Checklist Data");
- tabsheet.addTab(tab4, "Example Data");
-
- tabsheet.setStyleName(Runo.TABSHEET_SMALL);
-
- return tabsheet;
- }
-
- private Tree constructDescriptionTree(Taxon taxon){
- Tree tree = new Tree();
- tree.setSizeUndefined();
- String parent = "Descriptive Data";
- tree.setValue(parent);
- initDescriptionTree(tree, listDescriptions, parent);
- return tree;
- }
-
- private void initDescriptionTree(Tree tree, Collection<DescriptionElementBase>listDescriptions, Object parent) {
- //TODO: sorting List
- for (DescriptionElementBase deb : listDescriptions){
- tree.addItem(deb.getFeature());
- tree.setItemCaption(deb.getFeature(), deb.getFeature().getTitleCache());
- tree.setParent(deb.getFeature(), parent);
- tree.setChildrenAllowed(deb.getFeature(), true);
-
- if(deb instanceof CategoricalData){
- CategoricalData cd = (CategoricalData) deb;
- if(cd.getStatesOnly().size() <= 1){
- for(StateData st : cd.getStateData()){
- tree.addItem(st);
- tree.setItemCaption(st, st.getState().getTitleCache());
- tree.setParent(st, deb.getFeature());
- tree.setChildrenAllowed(st, false);
- }
- }else{
- //TODO: implement recursion
- }
- }else if(deb instanceof TextData){
- TextData td = (TextData) deb;
- tree.addItem(td);
- tree.setItemCaption(td, td.getText(Language.GERMAN()));
- tree.setParent(td, deb.getFeature());
- tree.setChildrenAllowed(td, false);
- }else if(deb instanceof Distribution){
- Distribution db = (Distribution) deb;
-
- tree.addItem(db.toString());
- tree.setParent(db.toString(), deb.getFeature());
- tree.setChildrenAllowed(db.toString(), true);
-
- tree.addItem(db.getStatus().toString());
- tree.setParent(db.getStatus().toString(), db.toString());
- tree.setChildrenAllowed(db.getStatus().toString(), false);
- }
- tree.expandItemsRecursively(parent);
- }
-
- }
-
- private Button constructSaveButton(final Window window, final BeanFieldGroup<CdmTaxonTableCollection> binder) {
- Button okButton = new Button("Save");
- okButton.addClickListener(new ClickListener() {
- private static final long serialVersionUID = 1L;
- @Override
- public void buttonClick(ClickEvent event) {
- try {
- binder.commit();
- BeanItem<CdmTaxonTableCollection> beanItem = (BeanItem<CdmTaxonTableCollection>) binder.getItemDataSource();
- binder.commit();
- CdmTaxonTableCollection redlist = beanItem.getBean();
- logger.info("check das Taxon: "+ redlist.getTaxon());
-// Taxon tnb = redlist.getTaxon();
-// taxonService.saveOrUpdate(tnb);
- updateTables();
- window.close();
- } catch (CommitException e) {
- logger.info("Commit Exception: "+e);
- }
- }
- });
- return okButton;
- }
-
- private void updateTables() {
- taxonTable.markAsDirtyRecursive();
- detailViewLayout.markAsDirtyRecursive();
- //TODO: not a clean way to do a save, there is a more elegant way to do so!!!!
-// ConversationHolder conversationHolder = taxonTable.getConversationHolder();
-// conversationHolder.commit();
- }
-
- private void openDetailWindow(Taxon taxon){
- Window window = new Window("Edit Taxon Information");
- window.setWidth("400px");
- window.setModal(true);
- window.setContent(constructForm(taxon, window));
- getUI().addWindow(window);
- }
-
- private void createEditClickListener(){
- toolbar.getEditButton().addClickListener(new ClickListener() {
- private static final long serialVersionUID = 1L;
- @Override
- public void buttonClick(ClickEvent event) {
- if(currentTaxon != null){
- openDetailWindow(currentTaxon);
- }else{
- Notification.show("Please select a Taxon.", Notification.Type.HUMANIZED_MESSAGE);
- }
-
- }
- });
- }
-
-
- @Override
- public void enter(ViewChangeEvent event) {
- }
-
- //---------------------------------------------------------------------------------------------------//
- //------------------------------------Example Data Creation------------------------------------------//
- //---------------------------------------------------------------------------------------------------//
- private void createExampleData(){
- List<Taxon> listTaxa = taxonService.list(Taxon.class, null, null, null, NODE_INIT_STRATEGY);
- for(Taxon taxon : listTaxa){
- TaxonDescription td = getTaxonDescription(taxon, false, true);
- NamedArea na = NamedArea.NewInstance();//0a9727d2-8d1f-4a88-ad4c-d6ef4ebc112a
- na = (NamedArea) termService.load(UUID.fromString("cbe7ce69-2952-4309-85dd-0d7d4a4830a1"));
- PresenceAbsenceTerm absenceTermBase = (PresenceAbsenceTerm) termService.load(UUID.fromString("cef81d25-501c-48d8-bbea-542ec50de2c2"));
- Distribution db = Distribution.NewInstance(na, absenceTermBase);
- descriptionService.saveDescriptionElement(db);
- td.addElement(db);
- taxonService.saveOrUpdate(taxon);
- }
-
- }
-
- private void deleteExampleData(){
- List<Taxon> listTaxa = taxonService.list(Taxon.class, null, null, null, DESCRIPTION_INIT_STRATEGY);
- Iterator<Taxon> taxonIterator = listTaxa.iterator();
- while(taxonIterator.hasNext()){
- Taxon taxon = taxonIterator.next();
- TaxonDescription td = getTaxonDescription(taxon, false, false);
- Iterator<DescriptionElementBase> descriptionIterator = td.getElements().iterator();
- while(descriptionIterator.hasNext()){
- DescriptionElementBase descriptionElementBase = descriptionIterator.next();
- if(descriptionElementBase instanceof Distribution){
- logger.info("Will be deleted: " + descriptionIterator);
- td.removeElement(descriptionElementBase);
- taxonService.saveOrUpdate(taxon);
- break;
- }
- }
- }
- }
-
- private void refreshLayout(){
- //TODO: refresh of Taxon Table does not work properly
- layout.markAsDirtyRecursive();
- taxonTable.markAsDirtyRecursive();
- taxonTable.refreshRowCache();
- ConversationHolder conversationHolder = taxonTable.getConversationHolder();
- conversationHolder.commit();
- }
-
-
- private TaxonDescription getTaxonDescription(Taxon taxon, boolean isImageGallery, boolean createNewIfNotExists) {
- TaxonDescription result = null;
- Set<TaxonDescription> descriptions= taxon.getDescriptions();
- for (TaxonDescription description : descriptions){
- if (description.isImageGallery() == isImageGallery){
- result = description;
- break;
- }
- }
- if (result == null && createNewIfNotExists){
- result = TaxonDescription.NewInstance(taxon);
- result.setImageGallery(isImageGallery);
- }
- return result;
- }
-
- private Button constructDeleteButton() {
- Button deleteButton = new Button("Delete Data");
- deleteButton.addClickListener(new ClickListener() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void buttonClick(ClickEvent event) {
- deleteExampleData();
- refreshLayout();
- }
- });
- return deleteButton;
- }
-
-
- private Button constructGenerateButton() {
- Button generateButton = new Button("Generate Data");
- generateButton.addClickListener(new ClickListener() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void buttonClick(ClickEvent event) {
- createExampleData();
- updateTables();
- }
- });
-
- return generateButton;
- }
-
-
- //---------------------------------------------------------------------------------------------------//
- //------------------------------------Initialization Strategies--------------------------------------//
- //---------------------------------------------------------------------------------------------------//
-
-
- protected static final List<String> DESCRIPTION_INIT_STRATEGY = Arrays.asList(new String []{
- "$",
- "elements.*",
- "elements.sources.citation.authorship.$",
- "elements.sources.nameUsedInSource.originalNameString",
- "elements.area.level",
- "elements.modifyingText",
- "elements.states.*",
- "elements.media",
- "elements.multilanguageText",
- "elements.inDescription",
- "descriptionElements",
- "descriptionElements.$",
- "descriptionElements.inDescription.$",
- "multilanguageText",
- "stateData.$"
- });
-
- private static final List<String> NODE_INIT_STRATEGY = Arrays.asList(new String[]{
- "classification",
- "descriptions",
- "descriptions.*",
- "descriptionElements",
- "descriptionElements.$",
- "descriptionElements.inDescription.$",
- "description.state",
- "feature",
- "feature.*",
- "State",
- "state",
- "states",
- "stateData.*",
- "stateData.state",
- "categoricalData",
- "categoricalData.*",
- "categoricalData.states.state",
- "categoricalData.States.State",
- "categoricalData.states.*",
- "categoricalData.stateData.state",
- "childNodes",
- "childNodes.taxon",
- "childNodes.taxon.name",
- "taxonNodes",
- "taxonNodes.*",
- "taxonNodes.taxon.*",
- "taxon.*",
- "taxon.descriptions",
- "taxon.sec",
- "taxon.name.*",
- "taxon.synonymRelations",
- "terms",
- "$",
- "elements.$",
- "elements.states.*",
- "elements.inDescription",
- "elements.sources.citation.authorship",
- "elements.sources.nameUsedInSource.originalNameString",
- "elements.area.level",
- "elements.modifyingText",
- "elements.states.*",
- "elements.multilanguageText",
- "elements.media",
- "name.$",
- "name.rank.representations",
- "name.status.type.representations",
- "sources.$",
- "stateData.$"
- });
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.uiset.redlist.views;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import ru.xpoft.vaadin.VaadinView;
-
-import com.vaadin.annotations.Theme;
-import com.vaadin.navigator.View;
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
-import com.vaadin.server.Page;
-import com.vaadin.ui.Alignment;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.VerticalLayout;
-
-import eu.etaxonomy.cdm.remote.vaadin.components.DistributionSelectionForm;
-import eu.etaxonomy.cdm.remote.vaadin.service.VaadinAuthenticationService;
-
-@Component
-@Scope("prototype")
-@Theme("mytheme")
-@VaadinView(DistributionSelectorView.NAME)
-public class DistributionSelectorView extends CustomComponent implements View {
-
- private static final long serialVersionUID = 1L;
- public static final String NAME = "DistributionSelector";
- @Autowired
- private transient VaadinAuthenticationService authenticationService;
- @Autowired
- private transient DistributionSelectionForm distributionSelectionForm;
-
- @PostConstruct
- public void PostConstruct(){
- if(authenticationService.isAuthenticated()){
- VerticalLayout layout = new VerticalLayout();
- layout.setWidth("100%");
- layout.setHeight("100%");
- Page page = Page.getCurrent();
-
- HorizontalLayout hLayout = new HorizontalLayout();
- //FIXME: Quick'n'dirty hack
- int hh = Page.getCurrent().getBrowserWindowHeight()-300;
- setHeight(hh +"px");
-
-
- Panel panel = new Panel();
- panel.setSizeUndefined();
- panel.setContent(distributionSelectionForm);
- panel.setStyleName("login");
-
- layout.addComponent(hLayout);
- layout.addComponent(panel);
-
- layout.setSizeFull();
- layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
-
- setCompositionRoot(layout);
- }
- }
-
-
- @Override
- public void enter(ViewChangeEvent event) {
-
- }
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.uiset.redlist.views;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import ru.xpoft.vaadin.VaadinView;
-
-import com.vaadin.navigator.View;
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
-import com.vaadin.server.ExternalResource;
-import com.vaadin.server.Page;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Link;
-import com.vaadin.ui.VerticalLayout;
-
-/**
- *
- * This view is intended to be the default error view. It doesn't work yet as intended, but it will be only
- * a matter of time until the right wiring is found, so this view will serve its purpose in the near future.
- *
- * @author a.oppermann
- *
- */
-
-@Component
-@Scope("prototype")
-@VaadinView(ErrorView.NAME)
-public class ErrorView extends CustomComponent implements View{
-
- /**
- * automatically generated ID
- */
- private static final long serialVersionUID = -5247307478297680373L;
-
- public final static String NAME = "error";
-
-
- @PostConstruct
- public void PostConstruct(){// throws GeneralSecurityException
- Page.getCurrent().setLocation("/");
- setSizeFull();
- VerticalLayout layout = new VerticalLayout();
- layout.setSpacing(true);
- layout.setMargin(true);
-
-
- Label header = new Label("ERROR");
- header.setStyleName("h1");
-
- Label message = new Label("We are sorry for the inconvenience, but the site you were trying to reach is not registered in our System.");
- Link startpage = new Link("Go to the startpage", new ExternalResource("/"));
-
- layout.addComponent(header);
- layout.addComponent(message);
- layout.addComponent(startpage);
- setCompositionRoot(layout);
-
-
- }
-
-
- @Override
- public void enter(ViewChangeEvent event) {
- }
-
-
-}
+++ /dev/null
-package eu.etaxonomy.cdm.remote.vaadin.uiset.redlist.views;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import ru.xpoft.vaadin.VaadinView;
-
-import com.vaadin.annotations.Theme;
-import com.vaadin.navigator.View;
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
-import com.vaadin.server.Page;
-import com.vaadin.ui.Alignment;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.VerticalLayout;
-
-import eu.etaxonomy.cdm.remote.vaadin.components.LoginForm;
-
-/**
- *
- * This view displays the login screen and makes use of the LoginForm component.
- * It will be displayed as the first view, because it has an empty NAME string.
- *
- * @author a.oppermann
- *
- */
-
-@Component
-@Scope("prototype")
-@Theme("mytheme")
-@VaadinView(LoginView.NAME)
-public class LoginView extends CustomComponent implements View{
-
- /**
- * Automatically generated serial version ID
- */
- private static final long serialVersionUID = 4683904341319655627L;
-
- public static final String NAME = "";
-
- @Autowired
- private transient LoginForm loginForm;
-
-
- @PostConstruct
- public void PostConstruct(){
- VerticalLayout layout = new VerticalLayout();
- layout.setWidth("100%");
- layout.setHeight("100%");
- Page page = Page.getCurrent();
-
- HorizontalLayout hLayout = new HorizontalLayout();
- //TODO: Quick'n'dirty hack, better solutions are possible
- int hh = page.getBrowserWindowHeight()-300;
- setHeight(hh +"px");
-
-
- Panel panel = new Panel();
- panel.setSizeUndefined();
- panel.setContent(loginForm);
- panel.setStyleName("login");
-
- layout.addComponent(hLayout);
- layout.addComponent(panel);
-
- layout.setSizeFull();
- layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
-
- setCompositionRoot(layout);
- }
-
- @Override
- public void enter(ViewChangeEvent event) {
-
- }
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE module PUBLIC
- "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN"
- "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
-<module>
- <!--
- Uncomment the following to compile the widgetset for one browser only.
- This can reduce the GWT compilation time significantly when debugging.
- The line should be commented out before deployment to production
- environments.
-
- Multiple browsers can be specified for GWT 1.7 as a comma separated
- list. The supported user agents at the moment of writing were:
- ie6,ie8,gecko,gecko1_8,safari,opera
-
- The value gecko1_8 is used for Firefox 3 and later and safari is used for
- webkit based browsers including Google Chrome.
-
- see also https://vaadin.com/book/vaadin7/-/page/clientside.module.html
- -->
- <!--
- <set-property name="user.agent" value="gecko1_8"/>
- -->
- <inherits name="com.vaadin.DefaultWidgetSet" />
-</module>
\ No newline at end of file
+++ /dev/null
-package ru.xpoft.vaadin;
-
-import java.util.Calendar;
-
-import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.vaadin.navigator.NavigationStateManager;
-import com.vaadin.navigator.View;
-import com.vaadin.navigator.ViewDisplay;
-import com.vaadin.ui.ComponentContainer;
-import com.vaadin.ui.SingleComponentContainer;
-import com.vaadin.ui.UI;
-
-import eu.etaxonomy.cdm.remote.vaadin.VaadinConfigurer;
-import ru.xpoft.vaadin.DiscoveryNavigator;
-import ru.xpoft.vaadin.SpringApplicationContext;
-import ru.xpoft.vaadin.VaadinView;
-import ru.xpoft.vaadin.DiscoveryNavigator.ViewCache;
-
-public class CdmDiscoveryNavigator extends DiscoveryNavigator {
-
-
- String packageNameScope = null;
-
- @Autowired
- private VaadinConfigurer vaadinConfigurer;
-
- public CdmDiscoveryNavigator(UI ui, ComponentContainer container, String packageNameScope) {
- super(ui, container);
- this.packageNameScope = packageNameScope;
- initViews();
- }
-
-
- public CdmDiscoveryNavigator(UI ui, SingleComponentContainer container, String packageNameScope) {
- super(ui, container);
- this.packageNameScope = packageNameScope;
- initViews();
- }
-
- public CdmDiscoveryNavigator(UI ui, ViewDisplay display, String packageNameScope) {
- super(ui, display);
- this.packageNameScope = packageNameScope;
- }
-
- public CdmDiscoveryNavigator(UI ui, NavigationStateManager stateManager,
- ViewDisplay display, String packageNameScope) {
- super(ui, stateManager, display);
- this.packageNameScope = packageNameScope;
- }
-
- @Override
- protected void initViews()
- {
-
- if (packageNameScope == null){
- return;
- }
- if (views.isEmpty())
- {
-
-
- String[] beansName = SpringApplicationContext.getApplicationContext().getBeanDefinitionNames();
-
- // Also looking for parent's beans definition
- if (SpringApplicationContext.getApplicationContext().getParent() != null)
- {
- String[] parentBeansName = SpringApplicationContext.getApplicationContext().getParent().getBeanDefinitionNames();
- String[] newBeansName = new String[beansName.length + parentBeansName.length];
-
- System.arraycopy(beansName, 0, newBeansName, 0, beansName.length);
- System.arraycopy(parentBeansName, 0, newBeansName, beansName.length, parentBeansName.length);
-
- beansName = newBeansName;
- }
- for (String beanName : beansName)
- {
- Class beanClass = SpringApplicationContext.getApplicationContext().getType(beanName);
-
- if(beanClass != null)
- {
- if(beanClass.getPackage() != null && beanClass.getPackage().toString().contains(packageNameScope))
- {
- // Check for a valid bean class because "abstract" beans may not have a bean class defined.
- if(beanClass.isAnnotationPresent(VaadinView.class) && View.class.isAssignableFrom(beanClass))
- {
- VaadinView vaadinView = (VaadinView) beanClass.getAnnotation(VaadinView.class);
- String viewName = vaadinView.value();
- boolean viewCached = vaadinView.cached();
-
- ViewCache viewCache = new ViewCache(viewName, beanName, beanClass, viewCached);
- views.add(viewCache);
- }
- }
- }
- }
- }
-
- addCachedBeans();
- }
-
-
-}