2
0
Fork 0

basic slit in multi module project

This commit is contained in:
willem.cazander 2010-09-19 22:02:05 +02:00
parent 029ad96a10
commit f79378dacb
239 changed files with 46 additions and 25213 deletions

View file

@ -1,11 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View file

@ -1,3 +1,12 @@
syntax: regexp
^target$
syntax: glob
# HG .orig files
*.orig
# A hidden file created by the Mac OS X Finder.
.DS_Store
# Ignore target dirs.
target/*
*/target/*

View file

@ -5,51 +5,6 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.wst.validation.validationbuilder.launch</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
@ -58,11 +13,5 @@
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>
<nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>

290
pom.xml
View file

@ -3,9 +3,9 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.idcanet.vasc</groupId>
<artifactId>vasc-main</artifactId>
<artifactId>vasc-base</artifactId>
<version>0.3-SNAPSHOT</version>
<packaging>jar</packaging>
<packaging>pom</packaging>
<name>vasc</name>
<description>Simple crud'ing for all.</description>
<url>http://www.x4o.org/vasc</url>
@ -65,284 +65,29 @@
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
<dependencies>
<!-- X4O dependcy -->
<dependency>
<groupId>com.idcanet.x4o</groupId>
<artifactId>x4o-main</artifactId>
<version>0.8-SNAPSHOT</version>
</dependency>
<!-- Serv5 depency -->
<dependency>
<groupId>com.idcanet.serv5</groupId>
<artifactId>serv5-main</artifactId>
<version>0.6-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<!-- Xtes depency -->
<dependency>
<groupId>com.idcanet.xtes</groupId>
<artifactId>xtes-main</artifactId>
<version>0.6-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<!-- FFF depency -->
<dependency>
<groupId>com.idcanet.fff</groupId>
<artifactId>fff-main</artifactId>
<version>0.8-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<!-- Ldap depency -->
<dependency>
<groupId>com.novell.ldap</groupId>
<artifactId>jldap</artifactId>
<version>4.3</version>
<scope>compile</scope>
</dependency>
<!-- Swing date editor depency -->
<dependency>
<groupId>com.michaelbaranov</groupId>
<artifactId>microba</artifactId>
<version>0.4.4.1</version>
<scope>compile</scope>
<optional/>
</dependency>
<!-- SWT depency TODO: linux only, wait for 3.4 !!
<dependency>
<groupId>org.eclipse.swt.gtk.linux</groupId>
<artifactId>x86</artifactId>
<version>3.3.0-v3346</version>
<scope>compile</scope>
<optional/>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>jface</artifactId>
<version>3.3.0-I20070606-0010</version>
<scope>compile</scope>
<optional/>
</dependency>
-->
<!-- EE5 + JSF + etc -->
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>javaee-api</artifactId>
<version>5.0-1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>1.2_04</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>1.2_04</version>
<scope>provided</scope>
</dependency>
<!-- tomahak jsf frontend -->
<dependency>
<groupId>org.apache.myfaces.tomahawk</groupId>
<artifactId>tomahawk12</artifactId>
<version>1.1.8</version>
<scope>compile</scope>
</dependency>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<juel.version>2.1.0</juel.version>
<testng.version>5.8</testng.version>
<x4o-core.version>0.8-SNAPSHOT</x4o-core.version>
<jldap.version>4.3</jldap.version>
<xtes-xpql.version>0.6-SNAPSHOT</xtes-xpql.version>
</properties>
<dependencies>
<!-- Unit tests cases -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.8</version>
<version>${testng.version}</version>
<classifier>jdk15</classifier>
<scope>test</scope>
</dependency>
<!-- OVERRIDES -->
<!-- X4O depency for EL -->
<dependency>
<groupId>de.odysseus.juel</groupId>
<artifactId>juel</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>jface</artifactId>
<version>3.2.1-M20060908-1000</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
<!--
<profiles>
<profile>
<id>unix</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<properties>
<swt.os-specific-dep>swt-linux-gtk</swt.os-specific-dep>
<swt.version>3.2.2</swt.version>
</properties>
</profile>
<profile>
<id>windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<swt.os-specific-dep>swt-win32</swt.os-specific-dep>
<swt.version>3.2.2</swt.version>
</properties>
</profile>
<profile>
<id>mac</id>
<activation>
<os>
<family>macosx</family>
</os>
</activation>
<properties>
<swt.os-specific-dep>swt-macosx</swt.os-specific-dep>
<swt.version>3.2.2</swt.version>
</properties>
</profile>
</profiles>
-->
<!-- Eclipse OS-specific dependencies -->
<profiles>
<profile>
<id>linux-x86</id>
<activation>
<os>
<arch>i386</arch>
<family>unix</family>
<name>linux</name>
</os>
</activation>
<dependencies>
<dependency>
<groupId>org.eclipse.swt.gtk.linux</groupId>
<artifactId>x86</artifactId>
<version>[3.2.0,4.0.0)</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>linux-x86_64</id>
<activation>
<os>
<arch>amd64</arch>
<family>unix</family>
<name>linux</name>
</os>
</activation>
<dependencies>
<dependency>
<groupId>org.eclipse.swt.gtk.linux</groupId>
<artifactId>x86_64</artifactId>
<version>[3.2.0,4.0.0)</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>solaris-sparc</id>
<activation>
<os>
<arch>sparc</arch>
<family>unix</family>
<name>SunOS</name>
</os>
</activation>
<dependencies>
<dependency>
<groupId>org.eclipse.swt.gtk.solaris</groupId>
<artifactId>sparc</artifactId>
<version>[3.2.0,4.0.0)</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>macosx</id>
<activation>
<os>
<family>unix</family>
<name>mac os x</name>
</os>
</activation>
<dependencies>
<dependency>
<groupId>org.eclipse.swt.carbon</groupId>
<artifactId>macosx</artifactId>
<version>[3.2.0,4.0.0)</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>win32</id>
<activation>
<os>
<arch>x86</arch>
<family>windows</family>
</os>
</activation>
<dependencies>
<dependency>
<groupId>org.eclipse.swt.win32.win32</groupId>
<artifactId>x86</artifactId>
<version>[3.2.0,4.0.0)</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>win64</id>
<activation>
<os>
<arch>amd64</arch>
<family>windows</family>
</os>
</activation>
<dependencies>
<dependency>
<groupId>org.eclipse.swt.win32.win32</groupId>
<artifactId>x86_64</artifactId>
<version>[3.2.0,4.0.0)</version>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<plugins>
@ -540,6 +285,15 @@
</plugins>
</reporting>
<modules>
<module>vasc-backend-jpa</module>
<module>vasc-backend-ldap</module>
<module>vasc-frontend-swing</module>
<module>vasc-frontend-swt</module>
<module>vasc-frontend-web-jsf</module>
<module>vasc-core</module>
<module>vasc-ejb3</module>
</modules>
<!-- END -->
</project>

View file

@ -1,96 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.jpa;
import org.hibernate.Session;
import com.idcanet.vasc.core.AbstractVascBackend;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
abstract public class AbstractHibernateVascBackend extends AbstractVascBackend {
/**
* Provides a hibernate session which is closed !! when transaction is compleeted.
* @return
*/
abstract Session getHibernateSession();
public void persist(Object object) throws VascException {
Session s = getHibernateSession();
try {
s.getTransaction().begin();
s.persist(object);
s.getTransaction().commit();
} finally {
if (s!=null && s.isOpen()) {
if (s.getTransaction().isActive()) {
s.getTransaction().rollback();
}
//s.close();
}
}
}
public Object merge(Object object) throws VascException {
Session s = getHibernateSession();
try {
s.getTransaction().begin();
Object result = s.merge(object);
s.getTransaction().commit();
return result;
} finally {
if (s!=null && s.isOpen()) {
if (s.getTransaction().isActive()) {
s.getTransaction().rollback();
}
//s.close();
}
}
}
public void delete(Object object) throws VascException {
Session s = getHibernateSession();
try {
s.getTransaction().begin();
Object newObject = s.merge(object);
s.delete(newObject);
s.getTransaction().commit();
} finally {
if (s!=null && s.isOpen()) {
if (s.getTransaction().isActive()) {
s.getTransaction().rollback();
}
//s.close();
}
}
}
}

View file

@ -1,99 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.jpa;
import java.lang.reflect.Method;
import javax.persistence.EntityManager;
import com.idcanet.vasc.core.AbstractVascBackend;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend {
protected boolean emTransaction = true;
abstract EntityManager getEntityManager();
public void persist(Object object) throws VascException {
EntityManager s = getEntityManager();
try {
if (emTransaction) {
s.getTransaction().begin();
}
s.persist(object);
if (emTransaction) {
s.getTransaction().commit();
}
} finally {
if (s!=null) {
//s.close();
}
}
}
public Object merge(Object object) throws VascException {
EntityManager s = getEntityManager();
try {
if (emTransaction) {
s.getTransaction().begin();
}
Object result = s.merge(object);
if (emTransaction) {
s.getTransaction().commit();
}
return result;
} finally {
if (s!=null) {
//s.close();
}
}
}
public void delete(Object object) throws VascException {
EntityManager s = getEntityManager();
try {
if (emTransaction) {
s.getTransaction().begin();
}
Object newObject = s.merge(object);
s.remove(newObject);
if (emTransaction) {
s.getTransaction().commit();
}
} finally {
if (s!=null) {
//s.close();
}
}
}
}

View file

@ -1,42 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.jpa;
import javax.persistence.EntityManager;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2009
*/
public interface EntityManagerProvider {
public EntityManager getEntityManager();
public boolean hasEntityManagerTransaction();
}

View file

@ -1,39 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.jpa;
import org.hibernate.Session;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2009
*/
public interface HibernateSessionProvider {
public Session getHibernateSession();
}

View file

@ -1,433 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.jpa;
import java.util.List;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.Session;
import com.idcanet.vasc.backends.BeanVascEntryFieldValue;
import com.idcanet.vasc.backends.BeanVascEntryRecordCreator;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
import com.idcanet.xtes.xpql.query.QueryParameterValue;
/**
* Manages persistance with xpql queries
*
* @author Willem Cazander
* @version 1.0 Mar 17, 2009
*/
public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend {
private HibernateSessionProvider hibernateSessionProvider = null;
private com.idcanet.xtes.xpql.query.Query query = null;
private com.idcanet.xtes.xpql.query.Query queryTotal = null;
private com.idcanet.xtes.xpql.query.Query queryMoveUp = null;
private com.idcanet.xtes.xpql.query.Query queryMoveUpDown = null;
private com.idcanet.xtes.xpql.query.Query queryMoveDown = null;
private com.idcanet.xtes.xpql.query.Query queryMoveDownUp = null;
private Class<?> resultClass = null;
public XpqlHibernateVascBackend() {
}
/**
* @see com.idcanet.vasc.backends.jpa.AbstractPersistenceVascBackend#getEntityManager()
*/
@Override
Session getHibernateSession() {
return hibernateSessionProvider.getHibernateSession();
}
@SuppressWarnings("unchecked")
public List<Object> execute(VascBackendState state) throws VascException {
// Copy parameters
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
query.setQueryParameter(key, value);
if (queryTotal!=null) {
queryTotal.setQueryParameter(key, value);
}
}
Session s = getHibernateSession();
try {
s.getTransaction().begin();
Query q = s.createQuery(query.toPreparedSQL(query));
List<QueryParameterValue> values = query.getOrderQueryParameterValues();
int i = 0;
for (QueryParameterValue value:values) {
Object valueObject = value.getValue();
if (valueObject!=null) {
q.setParameter(i,valueObject);
} else {
q.setParameter(i,valueObject,Hibernate.INTEGER);
}
i++;
}
if (isPageable()) {
q.setFirstResult(state.getPageIndex());
q.setMaxResults(state.getPageSize());
}
List<Object> data = q.list();
s.getTransaction().commit();
return data;
} finally {
if (s!=null) {
//em.close();
}
}
}
/**
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryFieldValue(com.idcanet.vasc.core.VascEntryField)
*/
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
BeanVascEntryFieldValue result = new BeanVascEntryFieldValue();
return result;
}
/**
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryRecordCreator(com.idcanet.vasc.core.VascEntry)
*/
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
return new BeanVascEntryRecordCreator(resultClass);
}
/**
* @return the query
*/
public com.idcanet.xtes.xpql.query.Query getQuery() {
return query;
}
/**
* @param query the query to set
*/
public void setQuery(com.idcanet.xtes.xpql.query.Query query) {
this.query = query;
}
/**
* @return the queryTotal
*/
public com.idcanet.xtes.xpql.query.Query getQueryTotal() {
return queryTotal;
}
/**
* @param queryTotal the queryTotal to set
*/
public void setQueryTotal(com.idcanet.xtes.xpql.query.Query queryTotal) {
this.queryTotal = queryTotal;
}
/**
* @return the resultClass
*/
public Class<?> getResultClass() {
return resultClass;
}
/**
* @param resultClass the resultClass to set
*/
public void setResultClass(Class<?> resultClass) {
this.resultClass = resultClass;
}
/**
* @return the hibernateSessionProvider
*/
public HibernateSessionProvider getHibernateSessionProvider() {
return hibernateSessionProvider;
}
/**
* @param hibernateSessionProvider the hibernateSessionProvider to set
*/
public void setHibernateSessionProvider(HibernateSessionProvider hibernateSessionProvider) {
this.hibernateSessionProvider = hibernateSessionProvider;
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackend#isPageable()
*/
@Override
public boolean isPageable() {
if (queryTotal==null) {
return false;
}
return true;
}
/**
* @see com.idcanet.vasc.core.VascBackend#fetchTotalExecuteSize(VascBackendState state)
*/
public long fetchTotalExecuteSize(VascBackendState state) {
Session s = getHibernateSession();
try {
s.getTransaction().begin();
Query q = s.createQuery(queryTotal.toPreparedSQL(queryTotal));
List<QueryParameterValue> values = queryTotal.getOrderQueryParameterValues();
int i = 0;
for (QueryParameterValue value:values) {
Object valueObject = value.getValue();
if (valueObject!=null) {
q.setParameter(i,valueObject);
} else {
q.setParameter(i,valueObject,Hibernate.INTEGER);
}
i++;
}
Long resultTotal = (Long)q.uniqueResult();
s.getTransaction().commit();
return resultTotal;
} finally {
if (s!=null) {
//em.close();
}
}
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackend#doRecordMoveDownById(java.lang.Object)
*/
@Override
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
long result = 0l;
if (queryMoveDown!=null) {
Session s = getHibernateSession();
try {
s.getTransaction().begin();
// Copy parameters
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
queryMoveDown.setQueryParameter(key, value);
}
// set id
queryMoveDown.setQueryParameter("id", primaryId);
// execute update
Query q = s.createQuery(queryMoveDown.toPreparedSQL(queryMoveDown));
List<QueryParameterValue> values = queryMoveDown.getOrderQueryParameterValues();
int i = 0;
for (QueryParameterValue value:values) {
Object valueObject = value.getValue();
if (valueObject!=null) {
q.setParameter(i,valueObject);
} else {
q.setParameter(i,valueObject,Hibernate.INTEGER);
}
i++;
}
result+=q.executeUpdate();
// Copy parameters
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
queryMoveDownUp.setQueryParameter(key, value);
}
// set id
queryMoveDownUp.setQueryParameter("id", primaryId);
// execute update
q = s.createQuery(queryMoveDownUp.toPreparedSQL(queryMoveDownUp));
values = queryMoveDownUp.getOrderQueryParameterValues();
i = 0;
for (QueryParameterValue value:values) {
Object valueObject = value.getValue();
if (valueObject!=null) {
q.setParameter(i,valueObject);
} else {
q.setParameter(i,valueObject,Hibernate.INTEGER);
}
i++;
}
result+=q.executeUpdate();
s.getTransaction().commit();
} finally {
if (s!=null) {
//em.close();
}
}
}
return result;
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackend#doRecordMoveUpById(java.lang.Object)
*/
@Override
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
long result = 0l;
if (queryMoveUp!=null) {
Session s = getHibernateSession();
try {
s.getTransaction().begin();
// Copy parameters
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
queryMoveUp.setQueryParameter(key, value);
}
// set id
queryMoveUp.setQueryParameter("id", primaryId);
// execute update
Query q = s.createQuery(queryMoveUp.toPreparedSQL(queryMoveUp));
List<QueryParameterValue> values = queryMoveUp.getOrderQueryParameterValues();
int i = 0;
for (QueryParameterValue value:values) {
Object valueObject = value.getValue();
if (valueObject!=null) {
q.setParameter(i,valueObject);
} else {
q.setParameter(i,valueObject,Hibernate.INTEGER);
}
i++;
}
result+=q.executeUpdate();
// Copy parameters
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
queryMoveUpDown.setQueryParameter(key, value);
}
// set id
queryMoveUpDown.setQueryParameter("id", primaryId);
// execute update
q = s.createQuery(queryMoveUpDown.toPreparedSQL(queryMoveUpDown));
values = queryMoveUpDown.getOrderQueryParameterValues();
i = 0;
for (QueryParameterValue value:values) {
Object valueObject = value.getValue();
if (valueObject!=null) {
q.setParameter(i,valueObject);
} else {
q.setParameter(i,valueObject,Hibernate.INTEGER);
}
i++;
}
result+=q.executeUpdate();
s.getTransaction().commit();
} finally {
if (s!=null) {
//em.close();
}
}
}
return result;
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackend#isRecordMoveable()
*/
@Override
public boolean isRecordMoveable() {
return queryMoveUp!=null & queryMoveDown!=null;
}
/**
* @return the queryMoveUp
*/
public com.idcanet.xtes.xpql.query.Query getQueryMoveUp() {
return queryMoveUp;
}
/**
* @param queryMoveUp the queryMoveUp to set
*/
public void setQueryMoveUp(com.idcanet.xtes.xpql.query.Query queryMoveUp) {
this.queryMoveUp = queryMoveUp;
}
/**
* @return the queryMoveDown
*/
public com.idcanet.xtes.xpql.query.Query getQueryMoveDown() {
return queryMoveDown;
}
/**
* @param queryMoveDown the queryMoveDown to set
*/
public void setQueryMoveDown(com.idcanet.xtes.xpql.query.Query queryMoveDown) {
this.queryMoveDown = queryMoveDown;
}
/**
* @return the queryMoveUpDown
*/
public com.idcanet.xtes.xpql.query.Query getQueryMoveUpDown() {
return queryMoveUpDown;
}
/**
* @param queryMoveUpDown the queryMoveUpDown to set
*/
public void setQueryMoveUpDown(com.idcanet.xtes.xpql.query.Query queryMoveUpDown) {
this.queryMoveUpDown = queryMoveUpDown;
}
/**
* @return the queryMoveDownUp
*/
public com.idcanet.xtes.xpql.query.Query getQueryMoveDownUp() {
return queryMoveDownUp;
}
/**
* @param queryMoveDownUp the queryMoveDownUp to set
*/
public void setQueryMoveDownUp(com.idcanet.xtes.xpql.query.Query queryMoveDownUp) {
this.queryMoveDownUp = queryMoveDownUp;
}
}

View file

@ -1,437 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.jpa;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import com.idcanet.vasc.backends.BeanVascEntryFieldValue;
import com.idcanet.vasc.backends.BeanVascEntryRecordCreator;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
import com.idcanet.xtes.xpql.query.QueryParameterValue;
/**
* Manages persistance with xpql queries
*
* @author Willem Cazander
* @version 1.0 Mar 17, 2009
*/
public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend {
private EntityManagerProvider entityManagerProvider = null;
private com.idcanet.xtes.xpql.query.Query query = null;
private com.idcanet.xtes.xpql.query.Query queryTotal = null;
private com.idcanet.xtes.xpql.query.Query queryMoveUp = null;
private com.idcanet.xtes.xpql.query.Query queryMoveUpDown = null;
private com.idcanet.xtes.xpql.query.Query queryMoveDown = null;
private com.idcanet.xtes.xpql.query.Query queryMoveDownUp = null;
private Class<?> resultClass = null;
public XpqlPersistanceVascBackend() {
}
/**
* @see com.idcanet.vasc.backends.jpa.AbstractPersistenceVascBackend#getEntityManager()
*/
@Override
EntityManager getEntityManager() {
emTransaction=entityManagerProvider.hasEntityManagerTransaction();
return entityManagerProvider.getEntityManager();
}
@SuppressWarnings("unchecked")
public List<Object> execute(VascBackendState state) throws VascException {
// Copy parameters
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
//System.out.println("Set para pame: "+key+" value: "+value);
query.setQueryParameter(key, value);
if (queryTotal!=null) {
queryTotal.setQueryParameter(key, value);
}
}
EntityManager em = getEntityManager();
try {
Query q = em.createQuery(query.toPreparedSQL(query));
List<QueryParameterValue> values = query.getOrderQueryParameterValues();
int i = 1;
for (QueryParameterValue value:values) {
Object valueObject = value.getValue();
q.setParameter(i,valueObject);
//System.out.println("Set para index: "+i+" value: "+valueObject+" valueClass: "+valueObject.getClass()+" valueType: "+value.getValueType());
i++;
}
if (isPageable()) {
q.setFirstResult(state.getPageIndex());
q.setMaxResults(state.getPageSize());
}
if (emTransaction) {
em.getTransaction().begin();
}
List<Object> data = q.getResultList();
if (emTransaction) {
em.getTransaction().commit();
}
return data;
} finally {
if (em!=null) {
//em.close();
}
}
}
/**
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryFieldValue(com.idcanet.vasc.core.VascEntryField)
*/
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
VascEntryFieldValue result = new BeanVascEntryFieldValue();
return result;
}
/**
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryRecordCreator(com.idcanet.vasc.core.VascEntry)
*/
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
VascEntryRecordCreator result = new BeanVascEntryRecordCreator(resultClass);
return result;
}
/**
* @return the query
*/
public com.idcanet.xtes.xpql.query.Query getQuery() {
return query;
}
/**
* @param query the query to set
*/
public void setQuery(com.idcanet.xtes.xpql.query.Query query) {
this.query = query;
}
/**
* @return the queryTotal
*/
public com.idcanet.xtes.xpql.query.Query getQueryTotal() {
return queryTotal;
}
/**
* @param queryTotal the queryTotal to set
*/
public void setQueryTotal(com.idcanet.xtes.xpql.query.Query queryTotal) {
this.queryTotal = queryTotal;
}
/**
* @return the resultClass
*/
public Class<?> getResultClass() {
return resultClass;
}
/**
* @param resultClass the resultClass to set
*/
public void setResultClass(Class<?> resultClass) {
this.resultClass = resultClass;
}
/**
* @return the entityManagerProvider
*/
public EntityManagerProvider getEntityManagerProvider() {
return entityManagerProvider;
}
/**
* @param entityManagerProvider the entityManagerProvider to set
*/
public void setEntityManagerProvider(EntityManagerProvider entityManagerProvider) {
this.entityManagerProvider = entityManagerProvider;
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackend#isPageable()
*/
@Override
public boolean isPageable() {
if (queryTotal==null) {
return false;
}
return true;
}
/**
* @see com.idcanet.vasc.core.VascBackend#fetchTotalExecuteSize(VascBackendState state)
*/
public long fetchTotalExecuteSize(VascBackendState state) {
EntityManager em = getEntityManager();
try {
Query q = em.createQuery(queryTotal.toPreparedSQL(queryTotal));
List<QueryParameterValue> values = queryTotal.getOrderQueryParameterValues();
int i = 1;
for (QueryParameterValue value:values) {
q.setParameter(i,value.getValue());
i++;
}
if (emTransaction) {
em.getTransaction().begin();
}
Long resultTotal = (Long)q.getSingleResult();
if (emTransaction) {
em.getTransaction().commit();
}
return resultTotal;
} finally {
if (em!=null) {
//em.close();
}
}
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackend#doRecordMoveDownById(VascBackendState state,java.lang.Object)
*/
@Override
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
long result = 0l;
if (queryMoveDown!=null) {
EntityManager em = getEntityManager();
try {
if (emTransaction) {
em.getTransaction().begin();
}
// Copy parameters
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
queryMoveDown.setQueryParameter(key, value);
}
// set id
queryMoveDown.setQueryParameter("id", primaryId);
// execute update
Query q = em.createQuery(queryMoveDown.toPreparedSQL(queryMoveDown));
List<QueryParameterValue> values = queryMoveDown.getOrderQueryParameterValues();
int i = 1;
for (QueryParameterValue value:values) {
q.setParameter(i,value.getValue());
i++;
}
result+=q.executeUpdate();
// Copy parameters
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
queryMoveDownUp.setQueryParameter(key, value);
}
// set id
queryMoveDownUp.setQueryParameter("id", primaryId);
// execute update
q = em.createQuery(queryMoveDownUp.toPreparedSQL(queryMoveDownUp));
values = queryMoveDownUp.getOrderQueryParameterValues();
i = 1;
for (QueryParameterValue value:values) {
q.setParameter(i,value.getValue());
i++;
}
result+=q.executeUpdate();
if (emTransaction) {
em.getTransaction().commit();
}
} finally {
if (em!=null) {
//em.close();
}
}
}
return result;
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackend#doRecordMoveUpById(VascBackendState state,java.lang.Object)
*/
@Override
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
long result = 0l;
if (queryMoveUp!=null) {
EntityManager em = getEntityManager();
try {
if (emTransaction) {
em.getTransaction().begin();
}
// Copy parameters
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
queryMoveUp.setQueryParameter(key, value);
}
// set id
queryMoveUp.setQueryParameter("id", primaryId);
// execute update
Query q = em.createQuery(queryMoveUp.toPreparedSQL(queryMoveUp));
List<QueryParameterValue> values = queryMoveUp.getOrderQueryParameterValues();
int i = 1;
for (QueryParameterValue value:values) {
q.setParameter(i,value.getValue());
i++;
}
result+=q.executeUpdate();
// Copy parameters
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
queryMoveUpDown.setQueryParameter(key, value);
}
// set id
queryMoveUpDown.setQueryParameter("id", primaryId);
// execute update
q = em.createQuery(queryMoveUpDown.toPreparedSQL(queryMoveUpDown));
values = queryMoveUpDown.getOrderQueryParameterValues();
i = 1;
for (QueryParameterValue value:values) {
q.setParameter(i,value.getValue());
i++;
}
result+=q.executeUpdate();
if (emTransaction) {
em.getTransaction().commit();
}
} finally {
if (em!=null) {
//em.close();
}
}
}
return result;
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackend#isRecordMoveable()
*/
@Override
public boolean isRecordMoveable() {
return queryMoveUp!=null & queryMoveDown!=null;
}
/**
* @return the queryMoveUp
*/
public com.idcanet.xtes.xpql.query.Query getQueryMoveUp() {
return queryMoveUp;
}
/**
* @param queryMoveUp the queryMoveUp to set
*/
public void setQueryMoveUp(com.idcanet.xtes.xpql.query.Query queryMoveUp) {
this.queryMoveUp = queryMoveUp;
}
/**
* @return the queryMoveDown
*/
public com.idcanet.xtes.xpql.query.Query getQueryMoveDown() {
return queryMoveDown;
}
/**
* @param queryMoveDown the queryMoveDown to set
*/
public void setQueryMoveDown(com.idcanet.xtes.xpql.query.Query queryMoveDown) {
this.queryMoveDown = queryMoveDown;
}
/**
* @return the queryMoveUpDown
*/
public com.idcanet.xtes.xpql.query.Query getQueryMoveUpDown() {
return queryMoveUpDown;
}
/**
* @param queryMoveUpDown the queryMoveUpDown to set
*/
public void setQueryMoveUpDown(com.idcanet.xtes.xpql.query.Query queryMoveUpDown) {
this.queryMoveUpDown = queryMoveUpDown;
}
/**
* @return the queryMoveDownUp
*/
public com.idcanet.xtes.xpql.query.Query getQueryMoveDownUp() {
return queryMoveDownUp;
}
/**
* @param queryMoveDownUp the queryMoveDownUp to set
*/
public void setQueryMoveDownUp(com.idcanet.xtes.xpql.query.Query queryMoveDownUp) {
this.queryMoveDownUp = queryMoveDownUp;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSearchable()
*/
public boolean isSearchable() {
if (query.getQueryParameterValue("text_search")==null) {
return false;
}
//return true;
return false;
}
}

View file

@ -1,39 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.ldap;
import com.novell.ldap.LDAPConnection;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public interface LdapConnectionProvider {
public LDAPConnection getLdapConnection();
}

View file

@ -1,331 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.ldap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.backends.MapVascEntryFieldValue;
import com.idcanet.vasc.backends.MapVascEntryRecordCreator;
import com.idcanet.vasc.core.AbstractVascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
import com.novell.ldap.LDAPAttribute;
import com.novell.ldap.LDAPAttributeSet;
import com.novell.ldap.LDAPConnection;
import com.novell.ldap.LDAPEntry;
import com.novell.ldap.LDAPModification;
import com.novell.ldap.LDAPSearchConstraints;
import com.novell.ldap.LDAPSearchResults;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public class LdapVascBackend extends AbstractVascBackend {
private LdapConnectionProvider ldapConnectionProvider = null;
private String baseDN = null;
private String keyAttribute = null;
private String ldapFilter = null;
/**
* @return the ldapConnectionProvider
*/
public LdapConnectionProvider getLdapConnectionProvider() {
return ldapConnectionProvider;
}
/**
* @param ldapConnectionProvider the ldapConnectionProvider to set
*/
public void setLdapConnectionProvider(LdapConnectionProvider ldapConnectionProvider) {
this.ldapConnectionProvider = ldapConnectionProvider;
}
/**
* @see com.idcanet.vasc.core.VascBackend#execute()
*/
public List<Object> execute(VascBackendState state) throws VascException {
LdapConnectionProvider prov = getLdapConnectionProvider();
LDAPConnection connection = prov.getLdapConnection();
List<Object> result = new ArrayList<Object>(50);
try {
LDAPSearchConstraints cons = new LDAPSearchConstraints();
cons.setBatchSize( 0 );
cons.setTimeLimit( 10000 ) ;
cons.setReferralFollowing(true);
connection.setConstraints(cons);
int searchScope = LDAPConnection.SCOPE_ONE;
String searchBase = baseDN;
//System.out.println("Reading object :" + searchBase + " with filter: " + ldapFilter);
LDAPSearchResults searchResults = connection.search(
searchBase, // object to read
searchScope, // scope - read single object
ldapFilter, // search filter
null, // return all attributes
false); // return attrs and values
while (searchResults.hasMore()) {
LDAPEntry entry = searchResults.next();
Map<String,Object> map = new HashMap<String,Object>(10);
LDAPAttributeSet attributeSet = entry.getAttributeSet();
Iterator<LDAPAttribute> i = attributeSet.iterator();
while (i.hasNext()) {
LDAPAttribute attr = i.next();
//System.out.println("ATTR: "+attr.getName()+" value: "+attr.getStringValue());
String[] s = attr.getStringValueArray();
if (s.length==1) {
map.put(attr.getName(), attr.getStringValue());
} else {
List<String> multiValue = new ArrayList<String>(s.length);
for (String ss:s) {
multiValue.add(ss);
}
map.put(attr.getName(), multiValue );
}
}
result.add(map);
}
} catch (Exception e) {
throw new VascException(e);
} finally {
if (connection!=null) {
connection.clone();
}
}
return result;
}
/**
* @see com.idcanet.vasc.core.VascBackend#merge(java.lang.Object)
*/
public Object merge(Object object) throws VascException {
LdapConnectionProvider prov = getLdapConnectionProvider();
LDAPConnection connection = prov.getLdapConnection();
try {
Map<String,Object> map = (Map)object;
String keyValue = (String)map.get(keyAttribute);
LDAPSearchConstraints cons = new LDAPSearchConstraints();
cons.setBatchSize( 0 );
cons.setTimeLimit( 10000 ) ;
cons.setReferralFollowing(true);
connection.setConstraints(cons);
int searchScope = LDAPConnection.SCOPE_ONE;
String searchBase = baseDN;
String filter = "(&("+keyAttribute+"="+keyValue+"))";
System.out.println("ldap filter: "+filter);
LDAPSearchResults searchResults = connection.search(
searchBase, // object to read
searchScope, // scope - read single object
filter, // search filter
null, // return all attributes
false); // return attrs and values
if (searchResults.hasMore()==false) {
// no result to mod
return object;
}
LDAPEntry entry = searchResults.next();
List<LDAPModification> mods = new ArrayList<LDAPModification>(20);
for (String key:map.keySet()) {
Object value = map.get(key);
LDAPAttribute attr = entry.getAttribute(key);
String[] s = attr.getStringValueArray();
if (s.length==1) {
String v = (String)value;
if (attr.getStringValue().equals(v)==false) {
LDAPModification mod = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute(key,v));
mods.add(mod);
}
map.put(attr.getName(), attr.getStringValue());
} else {
List<String> multiValue = new ArrayList<String>(s.length);
for (String ss:s) {
multiValue.add(ss);
}
List<String> v = null;
if (value instanceof String) {
v = new ArrayList<String>(1);
v.add((String)value);
} else {
v = (List<String>)value;
}
if (v.equals(multiValue)==false) {
LDAPAttribute a = new LDAPAttribute(key);
for (String vv:v) {
a.addValue(vv);
}
LDAPModification mod = new LDAPModification(LDAPModification.REPLACE,a);
mods.add(mod);
}
}
}
LDAPModification[] m = new LDAPModification[mods.size()];
mods.toArray(m);
connection.modify(entry.getDN(), m);
return object;
} catch (Exception e) {
throw new VascException(e);
} finally {
if (connection!=null) {
connection.clone();
}
}
}
/**
* @see com.idcanet.vasc.core.VascBackend#persist(java.lang.Object)
*/
public void persist(Object object) throws VascException {
LdapConnectionProvider prov = getLdapConnectionProvider();
LDAPConnection connection = prov.getLdapConnection();
try {
LDAPEntry entry = new LDAPEntry();
// entry.getAttributeSet().
connection.add(entry);
} catch (Exception e) {
throw new VascException(e);
} finally {
if (connection!=null) {
connection.clone();
}
}
}
/**
* @see com.idcanet.vasc.core.VascBackend#delete(java.lang.Object)
*/
public void delete(Object object) throws VascException {
LdapConnectionProvider prov = getLdapConnectionProvider();
LDAPConnection connection = prov.getLdapConnection();
try {
Map<String,Object> map = (Map)object;
String keyValue = (String)map.get(keyAttribute);
int searchScope = LDAPConnection.SCOPE_ONE;
String searchBase = baseDN;
String filter = "(&("+ldapFilter+")("+keyAttribute+"="+keyValue+"))";
LDAPSearchResults searchResults = connection.search(
searchBase, // object to read
searchScope, // scope - read single object
filter, // search filter
null, // return all attributes
false); // return attrs and values
if (searchResults.hasMore()==false) {
// no result to mod
return;
}
LDAPEntry entry = searchResults.next();
connection.delete(entry.getDN());
} catch (Exception e) {
throw new VascException(e);
} finally {
if (connection!=null) {
connection.clone();
}
}
}
/**
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryRecordCreator(com.idcanet.vasc.core.VascEntry)
*/
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
return new MapVascEntryRecordCreator();
}
/**
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryFieldValue(com.idcanet.vasc.core.VascEntryField)
*/
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
return new MapVascEntryFieldValue();
}
/**
* @return the baseDN
*/
public String getBaseDN() {
return baseDN;
}
/**
* @param baseDN the baseDN to set
*/
public void setBaseDN(String baseDN) {
this.baseDN = baseDN;
}
/**
* @return the keyAttribute
*/
public String getKeyAttribute() {
return keyAttribute;
}
/**
* @param keyAttribute the keyAttribute to set
*/
public void setKeyAttribute(String keyAttribute) {
this.keyAttribute = keyAttribute;
}
/**
* @return the ldapFilter
*/
public String getLdapFilter() {
return ldapFilter;
}
/**
* @param ldapFilter the ldapFilter to set
*/
public void setLdapFilter(String ldapFilter) {
this.ldapFilter = ldapFilter;
}
}

View file

@ -1,138 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.ldap;
import com.novell.ldap.LDAPConnection;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
private String ldapHost = "localhost";
private int ldapPort = LDAPConnection.DEFAULT_PORT;
private int ldapVersion = LDAPConnection.LDAP_V3;
private String bindUser = null;
private String bindPass = null;
/**
* @see com.idcanet.vasc.backends.ldap.LdapConnectionProvider#getLdapConnection()
*/
public LDAPConnection getLdapConnection() {
try {
// if ssl;
//Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
//System.setProperty("javax.net.ssl.trustStore", "/tmp/somewhere/ldap.root.crt");
//LDAPSocketFactory ssf = new LDAPJSSESecureSocketFactory();
// Set the socket factory as the default for all future connections
//LDAPConnection.setSocketFactory(ssf);
LDAPConnection lc = new LDAPConnection();
lc.connect( ldapHost, ldapPort );
if (bindUser!=null && bindPass!=null) {
lc.bind( ldapVersion, bindUser, bindPass.getBytes("UTF8") );
}
return lc;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* @return the ldapHost
*/
public String getLdapHost() {
return ldapHost;
}
/**
* @param ldapHost the ldapHost to set
*/
public void setLdapHost(String ldapHost) {
this.ldapHost = ldapHost;
}
/**
* @return the ldapPort
*/
public int getLdapPort() {
return ldapPort;
}
/**
* @param ldapPort the ldapPort to set
*/
public void setLdapPort(int ldapPort) {
this.ldapPort = ldapPort;
}
/**
* @return the ldapVersion
*/
public int getLdapVersion() {
return ldapVersion;
}
/**
* @param ldapVersion the ldapVersion to set
*/
public void setLdapVersion(int ldapVersion) {
this.ldapVersion = ldapVersion;
}
/**
* @return the bindUser
*/
public String getBindUser() {
return bindUser;
}
/**
* @param bindUser the bindUser to set
*/
public void setBindUser(String bindUser) {
this.bindUser = bindUser;
}
/**
* @return the bindPass
*/
public String getBindPass() {
return bindPass;
}
/**
* @param bindPass the bindPass to set
*/
public void setBindPass(String bindPass) {
this.bindPass = bindPass;
}
}

View file

@ -1,77 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.meta;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.AbstractVascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
import dk.eobjects.metamodel.query.Query;
/**
*
* @author Willem Cazander
* @version 1.0 Dec 19, 2008
*/
public class MetaModelVascBackend extends AbstractVascBackend {
private Query listQuery = null;
// interface
public void delete(Object object) throws VascException {
}
public List<Object> execute(VascBackendState state) throws VascException {
return null;
}
public Object merge(Object object) throws VascException {
return null;
}
public void persist(Object object) throws VascException {
}
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
return null;
}
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
return null;
}
}

View file

@ -1,134 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.Map;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 2, 2007
*/
abstract public class AbstractVascBackend implements VascBackend {
private String id = null;
/**
* @see com.idcanet.vasc.core.VascBackend#getId()
*/
public String getId() {
return id;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setId(java.lang.String)
*/
public void setId(String id) {
if (id==null) {
throw new IllegalArgumentException("id may not be null");
}
this.id=id;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isPageable()
*/
public boolean isPageable() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#fetchTotalExecuteSize(VascBackendState state)
*/
public long fetchTotalExecuteSize(VascBackendState state) {
return 0;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSearchable()
*/
public boolean isSearchable() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSortable()
*/
public boolean isSortable() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isRecordMoveable()
*/
public boolean isRecordMoveable() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#doRecordMoveDownById(java.lang.Object)
*/
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
return 0l;
}
/**
* @see com.idcanet.vasc.core.VascBackend#doRecordMoveUpById(java.lang.Object)
*/
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
return 0l;
}
/**
* @see com.idcanet.vasc.core.VascBackend#executePageSummary()
*/
public Map<String, Object> executePageSummary() {
return null;
}
/**
* @see com.idcanet.vasc.core.VascBackend#executeTotalSummary()
*/
public Map<String, Object> executeTotalSummary() {
return null;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isPageSummary()
*/
public boolean isPageSummary() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isTotalSummary()
*/
public boolean isTotalSummary() {
return false;
}
}

View file

@ -1,184 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 1, 2009
*/
abstract public class AbstractVascBackendProxy implements VascBackend {
protected VascBackend backend = null;
public AbstractVascBackendProxy(VascBackend backend) {
if (backend==null) {
throw new NullPointerException("backend object mey not be null.");
}
this.backend=backend;
}
/**
* @see com.idcanet.vasc.core.VascBackend#fetchTotalExecuteSize(VascBackendState state)
*/
public long fetchTotalExecuteSize(VascBackendState state) {
return backend.fetchTotalExecuteSize(state);
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSortable()
*/
public boolean isSortable() {
return backend.isSortable();
}
/**
* @throws Exception
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
public List<Object> execute(VascBackendState state) throws VascException {
return backend.execute(state);
}
/**
* @see com.idcanet.vasc.core.VascBackend#delete(java.lang.Object)
*/
public void delete(Object object) throws VascException {
backend.delete(object);
}
/**
* @see com.idcanet.vasc.core.VascBackend#isPageable()
*/
public boolean isPageable() {
return backend.isPageable();
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSearchable()
*/
public boolean isSearchable() {
return backend.isSearchable();
}
/**
* @see com.idcanet.vasc.core.VascBackend#merge(java.lang.Object)
*/
public Object merge(Object object) throws VascException {
return backend.merge(object);
}
/**
* @see com.idcanet.vasc.core.VascBackend#persist(java.lang.Object)
*/
public void persist(Object object) throws VascException {
backend.persist(object);
}
/**
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryFieldValue(com.idcanet.vasc.core.VascEntryField)
*/
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
return backend.provideVascEntryFieldValue(field);
}
/**
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryRecordCreator(com.idcanet.vasc.core.VascEntry)
*/
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
return backend.provideVascEntryRecordCreator(vascEntry);
}
/**
* @see com.idcanet.vasc.core.VascBackend#getId()
*/
public String getId() {
return backend.getId();
}
/**
* @see com.idcanet.vasc.core.VascBackend#setId(java.lang.String)
*/
public void setId(String id) {
backend.setId(id);
}
/**
* @see com.idcanet.vasc.core.VascBackend#doRecordMoveDownById(VascBackendState state,java.lang.Object)
*/
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
return backend.doRecordMoveDownById(state,primaryId);
}
/**
* @see com.idcanet.vasc.core.VascBackend#doRecordMoveUpById(VascBackendState state,java.lang.Object)
*/
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
return backend.doRecordMoveUpById(state,primaryId);
}
/**
* @see com.idcanet.vasc.core.VascBackend#isRecordMoveable()
*/
public boolean isRecordMoveable() {
return backend.isRecordMoveable();
}
/**
* @see com.idcanet.vasc.core.VascBackend#executePageSummary()
*/
public Map<String, Object> executePageSummary() {
return backend.executePageSummary();
}
/**
* @see com.idcanet.vasc.core.VascBackend#executeTotalSummary()
*/
public Map<String, Object> executeTotalSummary() {
return backend.executeTotalSummary();
}
/**
* @see com.idcanet.vasc.core.VascBackend#isPageSummary()
*/
public boolean isPageSummary() {
return backend.isPageSummary();
}
/**
* @see com.idcanet.vasc.core.VascBackend#isTotalSummary()
*/
public boolean isTotalSummary() {
return backend.isTotalSummary();
}
}

View file

@ -1,149 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
*
* @author Willem Cazander
* @version 1.0 May 26, 2009
*/
abstract public class AbstractVascBackendState implements VascBackendState {
private static final long serialVersionUID = 1L;
protected Map<String,Object> parameters = null;
private int pageIndex = 0;
private int pageSize = 0;
private int pageSizeMax = 0;
private String sortField = null;
private String searchString = null;
private boolean ascending = true;
//private long pagesTotalRecords = 0;
public AbstractVascBackendState() {
parameters = new HashMap<String,Object>(10);
}
public void setDataParameter(String key,Object data) {
parameters.put(key,data);
}
public Object getDataParameter(String key) {
return parameters.get(key);
}
public Set<String> getDataParameterKeys() {
return parameters.keySet();
}
/**
* @see com.idcanet.vasc.core.VascBackend#getPageIndex()
*/
public int getPageIndex() {
return pageIndex;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setPageIndex(int)
*/
public void setPageIndex(int pageIndex) {
this.pageIndex=pageIndex;
}
/**
* @see com.idcanet.vasc.core.VascBackend#getPageSize()
*/
public int getPageSize() {
return pageSize;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setPageSize(int)
*/
public void setPageSize(int pageSize) {
this.pageSize=pageSize;
}
/**
* @see com.idcanet.vasc.core.VascBackend#getSearchString()
*/
public String getSearchString() {
return searchString;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setSearchString(java.lang.String)
*/
public void setSearchString(String searchString) {
this.searchString=searchString;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSortAscending()
*/
public boolean isSortAscending() {
return ascending;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setSortAscending(boolean)
*/
public void setSortAscending(boolean ascending) {
this.ascending=ascending;
}
/**
* @see com.idcanet.vasc.core.VascBackend#getSortField()
*/
public String getSortField() {
return sortField;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setSortField(java.lang.String)
*/
public void setSortField(String sortField) {
this.sortField=sortField;
}
/**
* @return the pageSizeMax
*/
public int getPageSizeMax() {
return pageSizeMax;
}
/**
* @param pageSizeMax the pageSizeMax to set
*/
public void setPageSizeMax(int pageSizeMax) {
this.pageSizeMax = pageSizeMax;
}
}

View file

@ -1,217 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
import com.idcanet.vasc.validators.VascValidator;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 2, 2007
*/
abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
private static final long serialVersionUID = 1L;
protected String id = null;
protected Class<?> autoDetectClass = null;
protected List<VascValidator> vascValidators = null;
protected Map<String,String> properties = null;
protected Object dataObject = null;
protected String uiComponentId = null;
protected String inputMask = null;
public AbstractVascEntryFieldType() {
vascValidators = new ArrayList<VascValidator>(4);
properties = new HashMap<String,String>();
}
/**
* @see java.lang.Object#clone()
*/
@Override
abstract public VascEntryFieldType clone() throws CloneNotSupportedException;
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getId()
*/
public String getId() {
return id;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#setId(java.lang.String)
*/
public void setId(String id) {
this.id=id;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getProperty(java.lang.String)
*/
public String getProperty(String name) {
return properties.get(name);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#setProperty(java.lang.String, java.lang.String)
*/
public void setProperty(String name, String value) {
properties.put(name, value);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getPropertyNames()
*/
public List<String> getPropertyNames() {
return new ArrayList<String>(properties.keySet());
}
/**
* @return the dataObject
*/
public Object getDataObject() {
return dataObject;
}
/**
* @param dataObject the dataObject to set
*/
public void setDataObject(Object dataObject) {
this.dataObject = dataObject;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getVascValidators()
*/
public List<VascValidator> getVascValidators() {
return vascValidators;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#addVascValidator(com.idcanet.vasc.validators.VascValidator)
*/
public void addVascValidator(VascValidator vascValidator) {
vascValidators.add(vascValidator);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#removeVascValidator(com.idcanet.vasc.validators.VascValidator)
*/
public void removeVascValidator(VascValidator vascValidator) {
vascValidators.remove(vascValidator);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getAutoDetectClass()
*/
public Class<?> getAutoDetectClass() {
return autoDetectClass;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#setAutoDetectClass(java.lang.Class)
*/
public void setAutoDetectClass(Class<?> autoDetectClass) {
this.autoDetectClass=autoDetectClass;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getInputMask()
*/
public String getInputMask() {
return inputMask;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#setInputMask(java.lang.String)
*/
public void setInputMask(String inputMask) {
this.inputMask=inputMask;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getUIComponentId()
*/
public String getUIComponentId() {
return uiComponentId;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#setUIComponentId(java.lang.String)
*/
public void setUIComponentId(String uiComponentId) {
this.uiComponentId=uiComponentId;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getUIComponentCount()
*/
public int getUIComponentCount(VascEntryField entryField) throws VascException {
return 1;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#provideEditorUIComponent(int)
*/
public VascUIComponent provideEditorUIComponent(int index,VascEntryField entryField) throws VascException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = entryField.getClass().getClassLoader(); // fallback
}
String compId = getUIComponentId();
if (compId==null) {
compId = VascUIComponent.VASC_TEXT;
}
return entryField.getVascEntry().getVascFrontendData().getVascUIComponent(compId);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#provideLabelUIComponent(int)
*/
public VascUIComponent provideLabelUIComponent(int index,VascEntryField entryField) throws VascException {
return entryField.getVascEntry().getVascFrontendData().getVascUIComponent(VascUIComponent.VASC_LABEL);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#provideEditorVascValueModel()
*/
public VascValueModel provideEditorVascValueModel(int index,VascEntryField entryField) throws VascException {
if (index>0) {
throw new IllegalArgumentException("You have to override provideEditorVascValueModel if multi editor support is needed");
}
VascValueModel model = new VascValueModel();
return model;
}
}

View file

@ -1,142 +0,0 @@
/**
*
*/
package com.idcanet.vasc.core;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Holds all default state values
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
abstract public class AbstractVascEntryState implements VascEntryState {
private static final long serialVersionUID = 1L;
private List<Object> entryDataList = null;
private Object entryDataObject = null;
private Long totalBackendRecords = null;
private VascBackendState vascBackendState = null;
private VascEntryState state = null;
private Map<Integer,Boolean> multiActionSelection = null;
private boolean isEditCreate = false;
private VascBackend vascBackend = null;
private VascEntry vascEntry = null;
public AbstractVascEntryState() {
entryDataList = new ArrayList<Object>(0);
multiActionSelection = new HashMap<Integer,Boolean>(200);
}
/**
* @return the entryDataList
*/
public List<Object> getEntryDataList() {
return entryDataList;
}
/**
* @param entryDataList the entryDataList to set
*/
public void setEntryDataList(List<Object> entryDataList) {
this.entryDataList = entryDataList;
}
/**
* @return the entryDataObject
*/
public Object getEntryDataObject() {
return entryDataObject;
}
/**
* @param entryDataObject the entryDataObject to set
*/
public void setEntryDataObject(Object entryDataObject) {
this.entryDataObject = entryDataObject;
}
/**
* @return the vascBackendState
*/
public VascBackendState getVascBackendState() {
return vascBackendState;
}
/**
* @param vascBackendState the vascBackendState to set
*/
public void setVascBackendState(VascBackendState vascBackendState) {
this.vascBackendState = vascBackendState;
}
/**
* @return the totalBackendRecords
*/
public Long getTotalBackendRecords() {
return totalBackendRecords;
}
/**
* @param totalBackendRecords the totalBackendRecords to set
*/
public void setTotalBackendRecords(Long totalBackendRecords) {
this.totalBackendRecords = totalBackendRecords;
}
public void setParent(VascEntryState state) {
this.state=state;
}
public VascEntryState getParent() {
return state;
}
public void setMultiActionSelection(Map<Integer,Boolean> multiActionSelection) {
this.multiActionSelection=multiActionSelection;
}
public Map<Integer,Boolean> getMultiActionSelection() {
return multiActionSelection;
}
/**
* @return the vascBackend
*/
public VascBackend getVascBackend() {
return vascBackend;
}
/**
* @param vascBackend the vascBackend to set
*/
public void setVascBackend(VascBackend vascBackend) {
this.vascBackend = vascBackend;
}
/**
* @return the isEditCreate
*/
public boolean isEditCreate() {
return isEditCreate;
}
/**
* @param isEditCreate the isEditCreate to set
*/
public void setEditCreate(boolean isEditCreate) {
this.isEditCreate = isEditCreate;
}
public void setVascEntry(VascEntry vascEntry) {
this.vascEntry=vascEntry;
}
public VascEntry getVascEntry() {
return vascEntry;
}
}

View file

@ -1,82 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 2, 2007
*/
abstract public class AbstractVascFrontend implements VascFrontend {
private String id = null;
protected VascEntry entry = null;
protected String i18n(String key,Object...params) {
return entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(key,params);
}
protected Object i18nImage(String key) {
return entry.getVascFrontendData().getVascEntryResourceImageResolver().getImageValue(entry,key);
}
public VascEntry getVascEntry() {
return entry;
}
abstract protected void addUiComponents();
/**
* @see com.idcanet.vasc.core.VascFrontend#initEntry(com.idcanet.vasc.core.VascEntry)
*/
public void initEntry(VascEntry entry) throws Exception {
if (entry.getVascFrontendData().getVascFrontend()==null) {
entry.getVascFrontendData().setVascFrontend(this);
} else {
if (entry.getVascFrontendData().getVascFrontend()!=this) {
throw new IllegalArgumentException("VascEntry has already a differtent VascFrontend attected");
}
}
this.entry=entry;
addUiComponents();
}
/**
* @see com.idcanet.vasc.core.VascFrontend#getId()
*/
public String getId() {
return id;
}
/**
* @see com.idcanet.vasc.core.VascFrontend#setId(java.lang.String)
*/
public void setId(String id) {
this.id=id;
}
}

View file

@ -1,114 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascBackend {
public String getId();
public void setId(String id);
public List<Object> execute(VascBackendState state) throws VascException;
public void persist(Object object) throws VascException;
public Object merge(Object object) throws VascException;
public void delete(Object object) throws VascException;
/**
* Creates a new Field acces obj the the given field entry.
* note: Do not use inline class here because it needs to be seriabable and the backend is not seriabbzle.
* @param field
* @return
*/
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field);
/**
* Creates a new RecordCreater obj the the given entry.
* note: Do not use inline class here because it needs to be seriabable and the backend is not seriabbzle.
* @param vascEntry
* @return
*/
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry);
/**
* Defines if the backend supports sorting
* @return
*/
public boolean isSortable();
/**
* Defines if the backend supports pageing
* @return
*/
public boolean isPageable();
/**
* Returns the total amount of records.
* @return
*/
public long fetchTotalExecuteSize(VascBackendState state);
/**
* Defines if the backend supports pageing
* @return
*/
public boolean isSearchable();
/**
* Defines if the backend supports moveing an record up or down.
* @return
*/
public boolean isRecordMoveable();
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException;
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException;
public boolean isPageSummary();
public Map<String,Object> executePageSummary();
public boolean isTotalSummary();
public Map<String,Object> executeTotalSummary();
/*
public boolean hasSettings();
public Map<String,String> getSettings();
public void putSetting(String key,String value);
*/
}

View file

@ -1,38 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public interface VascBackendController {
public VascBackend getVascBackendById(String id);
}

View file

@ -1,38 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 17, 2008
*/
public interface VascBackendControllerLocal extends VascBackendController {
public void addVascBackend(VascBackend backend);
}

View file

@ -1,54 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
* Can filter the data
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2009
*/
public interface VascBackendFilter {
/**
* Inits the filter
*/
public void initFilter(VascEntry entry);
/**
* Only filters 1 object.
*/
public Object filterObject(Object object);
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascBackendFilter clone() throws CloneNotSupportedException;
}

View file

@ -1,48 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
/**
* Small class to wrap page number and the selected page number.
* note: this can be removed when JSF has the combined EL.
*
* @author Willem Cazander
* @version 1.0 Apr 25, 2006
*/
public class VascBackendPageNumber implements Serializable {
private static final long serialVersionUID = 1L;
private Integer pageNumber = null;
private Boolean selected = false;
public VascBackendPageNumber(Integer pageNumber) { this.pageNumber=pageNumber; }
public Integer getPageNumber() { return pageNumber; }
public Boolean getSelected() { return selected; }
public Boolean getNotSelected() { return !selected; }
public void setSelected(Boolean selected) { this.selected=selected; }
}

View file

@ -1,60 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.Set;
/**
* Holds all the data the backend needs to know to execute its work.
*
* @author Willem Cazander
* @version 1.0 May 26, 2009
*/
public interface VascBackendState extends Serializable {
public void setDataParameter(String key,Object data);
public Object getDataParameter(String key);
public Set<String> getDataParameterKeys();
public String getSortField();
public void setSortField(String name);
public boolean isSortAscending();
public void setSortAscending(boolean ascending);
public void setPageSize(int size);
public int getPageSize();
public void setPageSizeMax(int size);
public int getPageSizeMax();
public void setPageIndex(int index);
public int getPageIndex();
public void setSearchString(String searchString);
public String getSearchString();
}

View file

@ -1,67 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
* Resolvs all the resolvers.
* These resolved often point to an external locations.
*
* @author Willem Cazander
* @version 1.0 Sep 11, 2008
*/
public interface VascController {
/**
* @return Returns the VascBackendController
*/
public VascBackendController getVascBackendController();
/**
*
* @return Returns the VascEntryController
*/
public VascEntryController getVascEntryController();
/**
*
* @return Returns the VascEntryFieldController
*/
public VascEntryFieldTypeController getVascEntryFieldTypeController();
/**
*
* @return Returns the VascEventChannelController
*/
public VascEventChannelController getVascEventChannelController();
/**
*
* @return Returns the VascUserRoleController
*/
public VascUserRoleController getVascUserRoleController();
}

View file

@ -1,420 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
import com.idcanet.vasc.core.actions.ColumnVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
import com.idcanet.vasc.core.entry.VascEntryFieldEventChannel;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
/**
* The main vasc entry
*
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntry extends Cloneable,Serializable {
/**
* @return the id
*/
public String getId();
/**
* @param id the id to set
*/
public void setId(String id);
/**
* @return the name
*/
public String getName();
/**
* @param name the name to set
*/
public void setName(String name);
/**
* @return the helpId
*/
public String getHelpId();
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId);
/**
* @return the image
*/
public String getImage();
/**
* @param image the image to set
*/
public void setImage(String image);
/**
* @return the listDescription
*/
public String getListDescription();
/**
* @param listDescription the listDescription to set
*/
public void setListDescription(String listDescription);
/**
* @return the listImage
*/
public String getListImage();
/**
* @param listImage the listImage to set
*/
public void setListImage(String listImage);
/**
* @return the editDescription
*/
public String getEditDescription();
/**
* @param editDescription the editDescription to set
*/
public void setEditDescription(String editDescription);
/**
* @return the editImage
*/
public String getEditImage();
/**
* @param editImage the editImage to set
*/
public void setEditImage(String editImage);
/**
* @return the deleteDescription
*/
public String getDeleteDescription();
/**
* @param deleteDescription the deleteDescription to set
*/
public void setDeleteDescription(String deleteDescription);
/**
* @return the deleteImage
*/
public String getDeleteImage();
/**
* @param deleteImage the deleteImage to set
*/
public void setDeleteImage(String deleteImage);
/**
* @return the createDescription
*/
public String getCreateDescription();
/**
* @param createDescription the createDescription to set
*/
public void setCreateDescription(String createDescription);
/**
* @return the createImage
*/
public String getCreateImage();
/**
* @param createImage the createImage to set
*/
public void setCreateImage(String createImage);
/**
* @return the primaryKeyField
*/
public String getPrimaryKeyFieldId();
/**
* @param primaryKeyField the primaryKeyField to set
*/
public void setPrimaryKeyFieldId(String primaryKeyField);
/**
* @return the displayNameField
*/
public String getDisplayNameFieldId();
/**
* @param displayNameField the displayNameField to set
*/
public void setDisplayNameFieldId(String displayNameField);
/**
* @return the vascAdminList
*/
public boolean isVascAdminList();
/**
* @param vascAdminList the vascAdminList to set
*/
public void setVascAdminList(boolean vascAdminList);
/**
* @return the vascAdminEdit
*/
public boolean isVascAdminEdit();
/**
* @param vascAdminEdit the vascAdminEdit to set
*/
public void setVascAdminEdit(boolean vascAdminEdit);
/**
* @return the vascAdminCreate
*/
public boolean isVascAdminCreate();
/**
* @param vascAdminCreate the vascAdminCreate to set
*/
public void setVascAdminCreate(boolean vascAdminCreate);
/**
* @return the vascAdminDelete
*/
public boolean isVascAdminDelete();
/**
* @param vascAdminDelete the vascAdminDelete to set
*/
public void setVascAdminDelete(boolean vascAdminDelete);
/**
* @return the vascFields
*/
public List<VascEntryField> getVascEntryFields();
/**
* @param vascField the vascField to add
*/
public void addVascEntryField(VascEntryField vascField);
/**
* @param vascField the vascField to remove
*/
public void removeVascEntryField(VascEntryField vascField);
/**
* @return the vascField
*/
public VascEntryField getVascEntryFieldById(String id);
/**
* @return the rowActions
*/
public List<RowVascAction> getRowActions();
/**
* @return the RowVascAction
*/
public RowVascAction getRowActionById(String actionId);
/**
* @param rowAction the rowAction to add
*/
public void addRowAction(RowVascAction rowAction);
/**
* @param rowAction the rowAction to remove
*/
public void removeRowAction(RowVascAction rowAction);
/**
* @return the columnActions
*/
public List<ColumnVascAction> getColumnActions();
/**
* @return the ColumnVascAction
*/
public ColumnVascAction getColumnActionById(String actionId);
/**
* @param columnAction the columnAction to add
*/
public void addColumnAction(ColumnVascAction columnAction);
/**
* @param columnAction the columnAction to remove
*/
public void removeColumnAction(ColumnVascAction columnAction);
/**
* @return the globalActions
*/
public List<GlobalVascAction> getGlobalActions();
/**
* @return the GlobalVascAction
*/
public GlobalVascAction getGlobalActionById(String actionId);
/**
* @param globalAction the globalAction to add
*/
public void addGlobalAction(GlobalVascAction globalAction);
/**
* @param globalAction the globalAction to remove
*/
public void removeGlobalAction(GlobalVascAction globalAction);
/**
* @return the vascEntryFieldSets
*/
public List<VascEntryFieldSet> getVascEntryFieldSets();
/**
* @return the VascEntryFieldSet
*/
public VascEntryFieldSet getVascEntryFieldSetById(String actionId);
/**
* @param vascEntryFieldSet the vascEntryFieldSet to add
*/
public void addVascEntryFieldSet(VascEntryFieldSet vascEntryFieldSet);
/**
* @param vascEntryFieldSet the vascEntryFieldSet to remove
*/
public void removeVascEntryFieldSet(VascEntryFieldSet vascEntryFieldSet);
/**
* @return the vascLinkEntries
*/
public List<VascLinkEntry> getVascLinkEntries();
/**
* @return the VascLinkEntry
*/
public VascLinkEntry getVascLinkEntryById(String actionId);
/**
* @param vascLinkEntry the vascLinkEntry to add
*/
public void addVascLinkEntry(VascLinkEntry vascLinkEntry);
/**
* @param vascLinkEntry the vascLinkEntry to remover
*/
public void removeVascLinkEntry(VascLinkEntry vascLinkEntry);
public Object getEntryParameter(String key);
public void setEntryParameter(String key,Object value);
public List<String> getEntryParameterKeys();
public VascFrontendData getVascFrontendData();
public void setVascFrontendData(VascFrontendData vascFrontendData);
public String getBackendId();
public void setBackendId(String backendId);
/**
* @return the vascDisplayOnly
*/
public boolean isVascDisplayOnly();
/**
* @param vascDisplayOnly the vascDisplayOnly to set
*/
public void setVascDisplayOnly(boolean vascDisplayOnly);
/**
* @return the vascEntryFieldEventChannel
*/
public VascEntryFieldEventChannel getVascEntryFieldEventChannel();
/**
* @param vascEntryFieldEventChannel the vascEntryFieldEventChannel to set
*/
public void setVascEntryFieldEventChannel(VascEntryFieldEventChannel vascEntryFieldEventChannel);
/**
* Added an VascEntryBackendEventListener
* @param listener The class of the event listener.
*/
public void addVascEntryBackendEventListener(Class<VascEntryBackendEventListener> listener);
/**
* Returns the list of VascEntryBackendEventListener
* @return
*/
public List<Class<VascEntryBackendEventListener>> getVascEntryBackendEventListeners();
/**
* Added an VascEntryFrontendEventListener
* @param listener The class of the event listener.
*/
public void addVascEntryFrontendEventListener(Class<VascEntryFrontendEventListener> listener);
/**
* Returns the list of VascEntryFrontendEventListener
* @return
*/
public List<Class<VascEntryFrontendEventListener>> getVascEntryFrontendEventListeners();
public void addListOption(VascEntryField listOption);
public List<VascEntryField> getListOptions();
public void addVascBackendFilter(VascBackendFilter filter);
public List<VascBackendFilter> getVascBackendFilters();
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascEntry clone() throws CloneNotSupportedException;
}

View file

@ -1,44 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public interface VascEntryController {
public VascEntry getVascEntryById(String id);
public List<String> getVascEntryIds();
public List<String> getVascEntryAdminIds();
}

View file

@ -1,40 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
* The local interface which is not used in controllers.
* But is needed to be able to add entry in a safe way.
*
* @author Willem Cazander
* @version 1.0 Nov 16, 2008
*/
public interface VascEntryControllerLocal extends VascEntryController {
public void addVascEntry(VascEntry entry,VascController vascController) throws VascException;
}

View file

@ -1,387 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.validators.VascValidator;
/**
* Defines an VascEntryField
*
*
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryField extends Cloneable,Serializable {
/**
* @return the VascEntry
*/
public VascEntry getVascEntry();
/**
* @param entry the VascEntry to set
*/
public void setVascEntry(VascEntry entry);
/**
* @return the id
*/
public String getId();
/**
* @param id the id to set
*/
public void setId(String id);
/**
* @return the vascEntryFieldType
*/
public VascEntryFieldType getVascEntryFieldType();
/**
* @param vascEntryFieldType the vascEntryFieldType to set
*/
public void setVascEntryFieldType(VascEntryFieldType vascEntryFieldType);
/**
* @return the backendName
*/
public String getBackendName();
/**
* @param backendName the backendName to set
*/
public void setBackendName(String backendName);
/**
* @return the vascEntryFieldValue
*/
public VascEntryFieldValue getVascEntryFieldValue();
/**
* @param vascEntryFieldValue the vascEntryFieldValue to set
*/
public void setVascEntryFieldValue(VascEntryFieldValue vascEntryFieldValue);
/**
* @return the vascValidators
*/
public List<VascValidator> getVascValidators();
/**
* @param vascValidator the vascValidator to add
*/
public void addVascValidator(VascValidator vascValidator);
/**
* @param vascValidator the vascValidator to remove
*/
public void removeVascValidator(VascValidator vascValidator);
/**
* @return the name
*/
public String getName();
/**
* @param name the name to set
*/
public void setName(String name);
/**
* @return the description
*/
public String getDescription();
/**
* @param description the description to set
*/
public void setDescription(String description);
/**
* @return the helpId
*/
public String getHelpId();
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId);
/**
* @return the image
*/
public String getImage();
/**
* @param image the image to set
*/
public void setImage(String image);
/**
* @return the defaultValue
*/
public Object getDefaultValue();
/**
* @param defaultValue the defaultValue to set
*/
public void setDefaultValue(Object defaultValue);
/**
* @return the sizeList
*/
public Integer getSizeList();
/**
* @param sizeList the sizeList to set
*/
public void setSizeList(Integer sizeList);
/**
* @return the sizeEdit
*/
public Integer getSizeEdit();
/**
* @param sizeEdit the sizeEdit to set
*/
public void setSizeEdit(Integer sizeEdit);
/**
* @return the styleList
*/
public String getStyleList();
/**
* @param styleList the styleList to set
*/
public void setStyleList(String styleList);
/**
* @return the styleEdit
*/
public String getStyleEdit();
/**
* @param styleEdit the styleEdit to set
*/
public void setStyleEdit(String styleEdit);
/**
* @return the choices
*/
public String getChoices();
/**
* @param choices the choices to set
*/
public void setChoices(String choices);
/**
* @return the view
*/
public Boolean getView();
/**
* @param view the view to set
*/
public void setView(Boolean view);
/**
* @return the optional
*/
public Boolean getOptional();
/**
* @param optional the optional to set
*/
public void setOptional(Boolean optional);
/**
* @return the create
*/
public Boolean getCreate();
/**
* @param create the create to set
*/
public void setCreate(Boolean create);
/**
* @return the edit
*/
public Boolean getEdit();
/**
* @param edit the edit to set
*/
public void setEdit(Boolean edit);
/**
* @return the editReadOnly
*/
public Boolean getEditReadOnly();
/**
* @param editReadOnly the editReadOnly to set
*/
public void setEditReadOnly(Boolean editReadOnly);
/**
* @return the list
*/
public Boolean getList();
/**
* @param list the list to set
*/
public void setList(Boolean list);
/**
* @return the rolesCreate
*/
public String getRolesCreate();
/**
* @param rolesCreate the rolesCreate to set
*/
public void setRolesCreate(String rolesCreate);
/**
* @return the rolesEdit
*/
public String getRolesEdit();
/**
* @param rolesEdit the rolesEdit to set
*/
public void setRolesEdit(String rolesEdit);
/**
* @return the rolesEditReadOnly
*/
public String getRolesEditReadOnly();
/**
* @param rolesEditReadOnly the rolesEditReadOnly to set
*/
public void setRolesEditReadOnly(String rolesEditReadOnly);
/**
* @return the rolesList
*/
public String getRolesList();
/**
* @param rolesList the rolesList to set
*/
public void setRolesList(String rolesList);
/**
* @return the choicesAsRadio
*/
public Boolean getChoicesAsRadio();
/**
* @param choicesAsRadio the choicesAsRadio to set
*/
public void setChoicesAsRadio(Boolean choicesAsRadio);
/**
* @return the editBlank
*/
public Boolean getEditBlank();
/**
* @param editBlank the editBlank to set
*/
public void setEditBlank(Boolean editBlank);
/**
* @return the displayName
*/
public String getDisplayName();
/**
* @param displayName the displayName to set
*/
public void setDisplayName(String displayName);
/**
* @return the orderIndex
*/
public Integer getOrderIndex();
/**
* @param orderIndex the orderIndex to set
*/
public void setOrderIndex(Integer orderIndex);
/**
* @return the sortable
*/
public Boolean getSortable();
/**
* @param sortable the sortable to set
*/
public void setSortable(Boolean sortable);
/**
* @return the sumable
*/
public Boolean getSumable();
/**
* @param sumable the sumable to set
*/
public void setSumable(Boolean sumable);
/**
* @return the graphable
*/
public Boolean getGraphable();
/**
* @param graphable the graphable to set
*/
public void setGraphable(Boolean graphable);
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascEntryField clone() throws CloneNotSupportedException;
}

View file

@ -1,154 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
/**
* Orgenisess Fields
*
*
*
* @author Willem Cazander
* @version 1.0 Sep 56, 2008
*/
public interface VascEntryFieldSet extends Cloneable {
/**
* @return the id
*/
public String getId();
/**
* @param id the id to set
*/
public void setId(String id);
/**
* @return the name
*/
public String getName();
/**
* @param name the name to set
*/
public void setName(String name);
/**
* @return the description
*/
public String getDescription();
/**
* @param description the description to set
*/
public void setDescription(String description);
/**
* @return the helpId
*/
public String getHelpId();
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId);
/**
* @return the image
*/
public String getImage();
/**
* @param image the image to set
*/
public void setImage(String image);
/**
* @return the styleList
*/
public String getStyleList();
/**
* @param styleList the styleList to set
*/
public void setStyleList(String styleList);
/**
* @return the styleEdit
*/
public String getStyleEdit();
/**
* @param styleEdit the styleEdit to set
*/
public void setStyleEdit(String styleEdit);
/**
* @return the collapsed
*/
public boolean isCollapsed();
/**
* @param collapsed the collapsed to set
*/
public void setCollapsed(boolean collapsed);
/**
* @return the optional
*/
public boolean isOptional();
/**
* @param optional the optional to set
*/
public void setOptional(boolean optional);
/**
* @return the vascEntryFieldIds
*/
public List<String> getVascEntryFieldIds();
/**
* Add and VascEntryFieldId
* @param vascEntryFieldIds the vascEntryFieldIds to add
*/
public void addVascEntryFieldId(String vascEntryFieldId);
/**
* Removes and VascEntryFieldId
* @param vascEntryFieldIds the vascEntryFieldIds to remove
*/
public void removeVascEntryFieldId(String vascEntryFieldId);
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascEntryFieldSet clone() throws CloneNotSupportedException;
}

View file

@ -1,78 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
import com.idcanet.vasc.validators.VascValidator;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryFieldType extends Serializable {
public String getId();
public void setId(String id);
public String getUIComponentId();
public void setUIComponentId(String uiComponentId);
public String getInputMask();
public void setInputMask(String inputMask);
public Class<?> getAutoDetectClass();
public void setAutoDetectClass(Class<?> classObject);
public void addVascValidator(VascValidator vascValidator);
public void removeVascValidator(VascValidator vascValidator);
public List<VascValidator> getVascValidators();
public void setProperty(String name,String value);
public String getProperty(String name);
public List<String> getPropertyNames();
public void setDataObject(Object data);
public Object getDataObject();
public int getUIComponentCount(VascEntryField entryField) throws VascException;
public VascUIComponent provideLabelUIComponent(int index,VascEntryField entryField) throws VascException;
public VascUIComponent provideEditorUIComponent(int index,VascEntryField entryField) throws VascException;
public VascValueModel provideEditorVascValueModel(int index,VascEntryField entryField) throws VascException;
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascEntryFieldType clone() throws CloneNotSupportedException;
}

View file

@ -1,42 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public interface VascEntryFieldTypeController {
public VascEntryFieldType getVascEntryFieldTypeById(String id);
public List<String> getVascEntryFieldTypeIds();
}

View file

@ -1,38 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Dec 19, 2008
*/
public interface VascEntryFieldTypeControllerLocal extends VascEntryFieldTypeController {
public void addVascEntryFieldType(VascEntryFieldType vascEntryFieldType);
}

View file

@ -1,38 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 9, 2008
*/
public interface VascEntryFinalizer {
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException;
}

View file

@ -1,117 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* Holds all the data for state.
* So we can jump forward or back to a state.
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
public interface VascEntryState extends Serializable {
/**
* @return the entryDataList
*/
public List<Object> getEntryDataList();
/**
* @param entryDataList the entryDataList to set
*/
public void setEntryDataList(List<Object> entryDataList);
/**
* @return the entryDataObject
*/
public Object getEntryDataObject();
/**
* @param entryDataObject the entryDataObject to set
*/
public void setEntryDataObject(Object entryDataObject);
/**
* @return the vascBackendState
*/
public VascBackendState getVascBackendState();
/**
* @param vascBackendState the vascBackendState to set
*/
public void setVascBackendState(VascBackendState vascBackendState);
/**
* @return the totalBackendRecords
*/
public Long getTotalBackendRecords();
/**
* @param totalBackendRecords the totalBackendRecords to set
*/
public void setTotalBackendRecords(Long totalBackendRecords);
/**
* @param state The previous state we come from.
*/
public void setParent(VascEntryState state);
/**
* @return The previous state we come from.
*/
public VascEntryState getParent();
public void setMultiActionSelection(Map<Integer,Boolean> multiActionSelection);
public Map<Integer,Boolean> getMultiActionSelection();
public void setVascEntry(VascEntry vascEntry);
public VascEntry getVascEntry();
/**
* @return the vascBackend
*/
public VascBackend getVascBackend();
/**
* @param vascBackend the vascBackend to set
*/
public void setVascBackend(VascBackend vascBackend);
/**
* @return the isEditCreate
*/
public boolean isEditCreate();
/**
* @param isEditCreate the isEditCreate to set
*/
public void setEditCreate(boolean isEditCreate);
}

View file

@ -1,38 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2008
*/
public interface VascEventChannelController {
public void publishEntryEvent(String entryId);
}

View file

@ -1,38 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Dec 19, 2008
*/
public interface VascEventChannelControllerLocal extends VascEventChannelController {
}

View file

@ -1,50 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 18, 2008
*/
@SuppressWarnings("serial")
public class VascException extends Exception {
public VascException() {
}
public VascException(String message) {
super(message);
}
public VascException(Exception e) {
super(e);
}
}

View file

@ -1,52 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import com.idcanet.vasc.core.entry.VascEntryExporter;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascFrontend {
public void setId(String name);
public String getId();
public void initEntry(VascEntry entry) throws Exception;
public void renderView() throws Exception;
public void renderEdit() throws Exception;
public void renderDelete() throws Exception;
public void renderExport(VascEntryExporter exporter) throws Exception;
}

View file

@ -1,109 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
import com.idcanet.vasc.core.entry.VascEntryResourceImageResolver;
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
import com.idcanet.vasc.core.ui.VascUIComponent;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascFrontendData {
/**
* @return the vascFrontend
*/
public VascFrontend getVascFrontend();
/**
* @param vascFrontend the vascFrontend to set
*/
public void setVascFrontend(VascFrontend vascFrontend);
/**
* @return the VascFrontendHelper
*/
public VascFrontendHelper getVascFrontendHelper();
/**
* @param vascFrontendHelper The VascFrontendHelper to set.
*/
public void setVascFrontendHelper(VascFrontendHelper vascFrontendHelper);
/**
* @return the vascEntryResourceResolver
*/
public VascEntryResourceResolver getVascEntryResourceResolver();
/**
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
*/
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver);
public void putVascUIComponent(String rendererId,String uiComponentClass);
public VascUIComponent getVascUIComponent(String rendererId) throws VascException;
public String getVascUIComponentClass(String rendererId);
public void setVascController(VascController vascController);
public VascController getVascController();
public void addFieldVascUIComponents(VascEntryField field,VascUIComponent uiComponent,Object editor);
public VascUIComponent getFieldVascUIComponent(VascEntryField field);
public Object getFieldRealRenderer(VascEntryField field);
public void clearFieldRenderObjects();
/**
* @return the vascEntryResourceImageResolver
*/
public VascEntryResourceImageResolver getVascEntryResourceImageResolver();
/**
* @param vascEntryResourceImageResolver the vascEntryResourceImageResolver to set
*/
public void setVascEntryResourceImageResolver(VascEntryResourceImageResolver vascEntryResourceImageResolver);
public void addVascValidatorService(VascEntryFieldValidatorService validatorService);
public List<VascEntryFieldValidatorService> getVascValidatorServices();
public VascEntryState getVascEntryState();
public void setVascEntryState(VascEntryState state);
public void initFrontendListeners(VascEntry entry) throws InstantiationException, IllegalAccessException;
public void addVascEntryFrontendEventListener(VascEntryFrontendEventListener listener);
public List<VascEntryFrontendEventListener> getVascEntryFrontendEventListener(VascEntryFrontendEventListener.VascFrontendEventType type);
}

View file

@ -1,40 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.EventListener;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public interface VascFrontendExceptionHandler extends EventListener {
public void handleException(Exception e,VascFrontend vascFrontend,VascEntry entry);
}

View file

@ -1,90 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2007
*/
public interface VascFrontendHelper {
public boolean renderView(VascEntryField field);
public boolean renderList(VascEntryField field);
public boolean renderEdit(VascEntryField field);
public boolean renderEditReadOnly(VascEntryField field);
public boolean renderCreate(VascEntryField field);
public boolean renderGlobalVascAction(GlobalVascAction action);
public boolean renderRowVascAction(RowVascAction action);
public Integer getTotalColumnsWidth(VascEntry entry);
public List<VascLinkEntry> getVascLinkEntryByType(VascEntry entry,VascLinkEntryType type);
/**
* Returns the total amount of pages
* @return
*/
public List<VascBackendPageNumber> getVascBackendPageNumbers(VascEntry entry);
public void refreshData(VascEntry entry);
public Object createObject(VascEntry entry);
public void deleteObject(VascEntry entry);
public Object mergeObject(VascEntry entry);
public List<String> validateObjectField(VascEntryField field);
public boolean validateAndSetErrorText(VascEntry entry);
public void headerOptionsCreatedFillData(VascEntry entry);
public void editReadOnlyUIComponents(VascEntry entry);
public void handleException(VascEntry entry,Exception exception);
public void fireVascEvent(VascEntry entry,VascFrontendEventType type,Object data);
public void sortAction(VascEntry entry,VascEntryField field);
public void searchAction(VascEntry entry,String searchString);
public void pageAction(VascEntry entry,Integer page);
public void moveAction(VascEntry entry,Object object,boolean moveUp);
public List<RowVascAction> getMultiRowActions(VascEntry entry);
}

View file

@ -1,90 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 7, 2008
*/
public interface VascLinkEntry extends Cloneable,Serializable {
public String getId();
public void setId(String id);
public String getVascEntryId();
public void setVascEntryId(String vascEntryId);
public String getEntryParameterFieldId(String parameterName);
public void addEntryParameterFieldId(String parameterName,String valueFieldId);
public List<String> getEntryParameterFieldIdKeys();
public String getEntryCreateFieldValue(String valueFieldId);
public void addEntryCreateFieldValue(String valueFieldId,String selectedFieldId);
public List<String> getEntryCreateFieldValueKeys();
/**
* @return the vascLinkEntryType
*/
public VascLinkEntryType getVascLinkEntryType();
/**
* @param vascLinkEntryType the vascLinkEntryType to set
*/
public void setVascLinkEntryType(VascLinkEntryType vascLinkEntryType);
/**
* @return the doActionId
*/
public String getDoActionId();
/**
* @param doActionId the doActionId to set
*/
public void setDoActionId(String doActionId);
/**
* @return the name
*/
public String getName();
/**
* @param name the name to set
*/
public void setName(String name);
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascLinkEntry clone() throws CloneNotSupportedException;
}

View file

@ -1,44 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
/**
* The type of a VascLinkEntry
*
* @author Willem Cazander
* @version 1.0 Mrt 16, 2010
*/
public enum VascLinkEntryType implements Serializable {
EDIT_INLINE,
EDIT_TAB,
LIST;
public static VascLinkEntryType DEFAULT_TYPE = VascLinkEntryType.EDIT_TAB;
}

View file

@ -1,46 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public interface VascUserRoleController {
public Long getUserId();
public String getUserName();
public List<String> getUserRoles();
public boolean hasRole(String roles);
}

View file

@ -1,135 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 30, 2007
*/
abstract public class AbstractVascAction implements VascAction {
private static final long serialVersionUID = 1L;
private String id = null;
private String name = null;
private String description = null;
private String image = null;
private String helpId = null;
public AbstractVascAction() {
setId(getActionId());
}
abstract protected String getActionId();
public VascAction clone() throws CloneNotSupportedException {
VascAction action;
try {
action = this.getClass().newInstance();
} catch (Exception e) {
throw new CloneNotSupportedException("Could not create action from myClass: "+e.getMessage());
}
action.setId(id);
action.setName(name);
action.setDescription(description);
action.setImage(image);
action.setHelpId(helpId);
return action;
}
/**
* @see com.idcanet.vasc.core.actions.VascAction#getId()
*/
public String getId() {
return id;
}
/**
* @see com.idcanet.vasc.core.actions.VascAction#setId(java.lang.String)
*/
public void setId(String id) {
this.id=id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description description toolTip to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the helpId
*/
public String getHelpId() {
return helpId;
}
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId) {
this.helpId = helpId;
}
/**
* @return the image
*/
public String getImage() {
return image;
}
/**
* @param image the image to set
*/
public void setImage(String image) {
this.image = image;
}
}

View file

@ -1,40 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface ColumnVascAction extends VascAction {
public void doColumnAction(VascEntry table,VascEntryField column) throws Exception;
}

View file

@ -1,39 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface GlobalVascAction extends VascAction {
public void doGlobalAction(VascEntry vascEntry) throws Exception;
}

View file

@ -1,41 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface RowVascAction extends VascAction {
public boolean isMultiRowAction();
public void doRowAction(VascEntry vascEntry,Object rowObject) throws Exception;
}

View file

@ -1,64 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
import java.io.Serializable;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascAction extends Cloneable,Serializable {
public String getId();
public void setId(String id);
public String getName();
public void setName(String name);
public String getDescription();
public void setDescription(String description);
public String getImage();
public void setImage(String image);
public String getHelpId();
public void setHelpId(String helpId);
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascAction clone() throws CloneNotSupportedException;
}

View file

@ -1,62 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Jul 05, 2010
*/
public interface VascEntryBackendEventListener extends Serializable {
public enum VascBackendEventType {
EXECUTE,
PERSIST,
MERGE,
DELETE,
PROVIDE_FIELD_VALUE,
PROVIDE_RECORD_CREATOR,
TOTAL_EXECUTE_SIZE,
MOVE_DOWN,
MOVE_UP
}
public VascBackendEventType getEventType();
/**
* Is executed when the type of event is fired.
* @param entry
* @param type
* @param data
*/
public void vascEvent(VascEntry entry,Object data);
}

View file

@ -1,49 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.OutputStream;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 May 19, 2007
*/
public interface VascEntryExporter extends Serializable {
public void doExport(OutputStream out,VascEntry vascEntry) throws VascException;
public String getMineType();
public String getType();
}

View file

@ -1,43 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 04, 2008
*/
public interface VascEntryFieldEventChannel extends Serializable {
public void setChannel(String channel);
public String getChannel();
}

View file

@ -1,44 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.util.List;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
* Executes validation on a field.
*
* @author Willem Cazander
* @version 1.0 May 13, 2009
*/
public interface VascEntryFieldValidatorService {
public List<String> validateObjectField(VascEntryField field, Object selectedRecord,Object objectValue) throws VascException;
}

View file

@ -1,46 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryFieldValue extends Serializable {
public Object getValue(VascEntryField field,Object record) throws VascException;
public String getDisplayValue(VascEntryField field,Object record) throws VascException;
public void setValue(VascEntryField field,Object record,Object value) throws VascException;
}

View file

@ -1,68 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 02, 2007
*/
public interface VascEntryFrontendEventListener extends Serializable {
public enum VascFrontendEventType {
EXCEPTION,
DATA_CREATE,
DATA_READ,
DATA_SELECT,
DATA_PRE_UPDATE,
DATA_POST_UPDATE,
DATA_DELETE,
DATA_LIST_UPDATE,
DATA_SORT,
DATA_PAGE,
DATA_SEARCH,
OPTION_UPDATE,
}
public VascFrontendEventType[] getEventTypes();
/**
* Is executed when the type of event is fired.
* @param entry
* @param type
* @param data
*/
public void vascEvent(VascEntry entry,Object data);
}

View file

@ -1,44 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryRecordCreator extends Serializable {
public Object newRecord(VascEntry entry) throws Exception;
public Class<?> getObjectClass();
}

View file

@ -1,41 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 May 13, 2009
*/
public interface VascEntryResourceImageResolver {
public Object getImageValue(VascEntry entry,String key);
}

View file

@ -1,39 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryResourceResolver {
public String getTextValue(String key,Object...params);
}

View file

@ -1,81 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public class VascColumnValueModelListener implements VascValueModelListener {
private VascEntryField vascEntryField = null;
private Object bean = null;
public VascColumnValueModelListener() {
}
public VascColumnValueModelListener(VascEntryField vascEntryField,Object bean) {
setVascEntryField(vascEntryField);
setBean(bean);
}
public void valueUpdate(VascValueModel model) throws VascException {
vascEntryField.getVascEntryFieldValue().setValue(vascEntryField, bean, model.getValue());
}
/**
* @return the vascEntryField
*/
public VascEntryField getVascEntryField() {
return vascEntryField;
}
/**
* @param vascEntryField the vascEntryField to set
*/
public void setVascEntryField(VascEntryField vascEntryField) {
this.vascEntryField = vascEntryField;
}
/**
* @return the bean
*/
public Object getBean() {
return bean;
}
/**
* @param bean the bean to set
*/
public void setBean(Object bean) {
this.bean = bean;
}
}

View file

@ -1,67 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 May 21, 2009
*/
public class VascOptionValueModelListener implements VascValueModelListener {
private VascEntryField vascEntryField = null;
public VascOptionValueModelListener() {
}
public VascOptionValueModelListener(VascEntryField vascEntryField) {
setVascEntryField(vascEntryField);
}
public void valueUpdate(VascValueModel model) throws VascException {
String key = vascEntryField.getBackendName();
Object value = model.getValue();
vascEntryField.getVascEntry().setEntryParameter(key, value);
}
/**
* @return the vascEntryField
*/
public VascEntryField getVascEntryField() {
return vascEntryField;
}
/**
* @param vascEntryField the vascEntryField to set
*/
public void setVascEntryField(VascEntryField vascEntryField) {
this.vascEntryField = vascEntryField;
}
}

View file

@ -1,109 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public class VascSelectItem {
private String label = null;
private Object value = null;
private String keyValue = null;
private boolean disabled = false;
public VascSelectItem() {
}
public VascSelectItem(String label,Object value) {
setLabel(label);
setValue(value);
}
public VascSelectItem(String label,Object value,String keyValue) {
setLabel(label);
setValue(value);
setKeyValue(keyValue);
}
/**
* @return the label
*/
public String getLabel() {
return label;
}
/**
* @param label the label to set
*/
public void setLabel(String label) {
this.label = label;
}
/**
* @return the value
*/
public Object getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(Object value) {
this.value = value;
}
/**
* @return the keyValue
*/
public String getKeyValue() {
return keyValue;
}
/**
* @param keyValue the keyValue to set
*/
public void setKeyValue(String keyValue) {
this.keyValue = keyValue;
}
/**
* @return the disabled
*/
public boolean isDisabled() {
return disabled;
}
/**
* @param disabled the disabled to set
*/
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}
}

View file

@ -1,69 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import java.io.Serializable;
import java.util.List;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public interface VascSelectItemModel extends Serializable {
/**
* Creates an SelectItem list.
* @param entry
* @return
* @throws VascException
*/
public List<VascSelectItem> getVascSelectItems(VascEntry entry) throws VascException;
/**
* @return the nullLabel
*/
public String getNullLabel();
/**
* @param nullLabel the nullLabel to set
*/
public void setNullLabel(String nullLabel);
/**
* @return the nullKeyValue
*/
public String getNullKeyValue();
/**
* @param nullKeyValue the nullKeyValue to set
*/
public void setNullKeyValue(String nullKeyValue);
}

View file

@ -1,37 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public interface VascUIActionComponent extends VascUIComponent {
}

View file

@ -1,37 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public interface VascUIActionComponentListener {
}

View file

@ -1,64 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public interface VascUIComponent {
// required ui components
static public final String VASC_LABEL = "VascLabel";
static public final String VASC_TEXT = "VascText";
static public final String VASC_LIST = "VascList";
static public final String VASC_BUTTON = "VascButton";
// optional ui Components
static public final String VASC_TEXTAREA = "VascTextArea";
static public final String VASC_BOOLEAN = "VascBoolean";
static public final String VASC_DATE = "VascDate";
static public final String VASC_COLOR = "VascColor";
static public final String[] requiredUIComponents = {VASC_LABEL,VASC_TEXT,VASC_LIST,VASC_BUTTON};
public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws VascException;
public void setErrorText(String text);
public String getErrorText();
public void setDisabled(boolean disabled);
public boolean isDisabled();
public void setRendered(boolean rendered);
public boolean isRendered();
}

View file

@ -1,81 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public class VascValueModel {
private Object value = null;
private List<VascValueModelListener> listeners = null;
private VascValueModel parentModel = null;
public VascValueModel() {
listeners = new ArrayList<VascValueModelListener>(2);
}
public VascValueModel(VascValueModel parentModel) {
this();
this.parentModel=parentModel;
}
public Object getValue() throws VascException {
if (parentModel!=null) {
return parentModel.getValue();
}
return value;
}
public void setValue(Object value) throws VascException {
if (parentModel!=null) {
parentModel.setValue(value);
} else {
this.value = value;
}
fireListeners();
}
public void addListener(VascValueModelListener l) {
listeners.add(l);
}
public void removeListener(VascValueModelListener l) {
listeners.remove(l);
}
private void fireListeners() throws VascException {
for (VascValueModelListener l:listeners) {
l.valueUpdate(this);
}
}
}

View file

@ -1,43 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import java.util.EventListener;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public interface VascValueModelListener extends EventListener {
public void valueUpdate(VascValueModel model) throws VascException;
}

View file

@ -1,299 +0,0 @@
package com.idcanet.vasc.ejb3;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.el.ValueExpression;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.hibernate.Session;
import com.idcanet.vasc.backends.jpa.EntityManagerProvider;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.impl.DefaultVascBackedEntryFinalizer;
import com.idcanet.vasc.impl.DefaultVascEntryController;
import com.idcanet.vasc.impl.DefaultVascFactory;
import com.idcanet.vasc.impl.actions.AddRowAction;
import com.idcanet.vasc.impl.actions.CSVExportGlobalAction;
import com.idcanet.vasc.impl.actions.DeleteRowAction;
import com.idcanet.vasc.impl.actions.EditRowAction;
import com.idcanet.vasc.impl.actions.XMLExportGlobalAction;
import com.idcanet.vasc.impl.entry.DefaultVascEntryResourceResolver;
import com.idcanet.vasc.impl.x4o.VascParser;
import com.idcanet.x4o.core.AbstractX4OPhaseHandler;
import com.idcanet.x4o.core.X4OPhase;
import com.idcanet.x4o.core.X4OPhaseException;
import com.idcanet.x4o.core.X4OPhaseHandler;
import com.idcanet.x4o.element.Element;
import com.idcanet.x4o.element.ElementContext;
import com.idcanet.xtes.xpql.query.Query;
/**
*
* @author Willem Cazander
* @version 1.0 13 Aug 2007
*/
@Stateless(name="ejb/vascSericeManager")
public class VascServiceManager implements VascServiceManagerRemote {
private Logger logger = Logger.getLogger(VascServiceManager.class.getName());
//@PersistenceContext
//protected EntityManager entityManager;
// @EJB
/// public XtesManagerLocal xtesManager;
private VascController sharedVascController = null;
public Map<String,String> getResourceBundle(String locale) {
Map<String,String> result = new HashMap<String,String>(100);
ResourceBundle b = ResourceBundle.getBundle("com/idcanet/logstats/resources/i18n/LogstatsBundleEJB");
for (String key:b.keySet()) {
String value = b.getString(key);
result.put(key,value);
}
return result;
}
public List<String> getVascEntryIds() {
VascController v = getVascController();
return v.getVascEntryController().getVascEntryIds();
}
public VascEntry getVascEntry(String entryId) {
VascController v = getVascController();
VascEntry ve = v.getVascEntryController().getVascEntryById(entryId);
try {
VascEntry result = ve.clone();
//logger.info("Returning cloned ve.");
/*
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
objOutstream.writeObject(ve);
objOutstream.close();
int objectSize = dataArray.size();
*/
//logger.info("Writing obj to data: "+objectSize);
return result;
} catch (CloneNotSupportedException e) {
throw new RuntimeException("VascEntry should alway be clonable",e);
} catch (Exception e) {
throw new RuntimeException("VascEntry error:",e);
}
}
public Object invokeBackendMethod(String backendId,String method,Object[] args) {
VascController v = getVascController();
VascBackend vb = v.getVascBackendController().getVascBackendById(backendId);
Method vbm = null;
for (Method m:vb.getClass().getMethods()) {
if (m.getName().equals(method)) {
vbm = m;
break;
}
}
if (vbm==null) {
throw new IllegalArgumentException("Could not find: "+method);
}
try {
Object result = vbm.invoke(vb, args);
return result;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public VascController getVascController() {
if (sharedVascController==null) {
sharedVascController = getParsedVascController();
}
return sharedVascController;
}
class XpqlController implements Map<String,Query> {
public void clear() {
}
public boolean containsKey(Object key) {
return true;
}
public boolean containsValue(Object value) {
return true;
}
public Set<Map.Entry<String, Query>> entrySet() {
return null;
}
public Query get(Object key) {
return null;
//return xtesManager.getQuery((String)key);
}
public boolean isEmpty() {
return false;
}
public Set<String> keySet() {
return null;
}
public Query put(String key, Query value) {
return null;
}
@SuppressWarnings("unchecked")
public void putAll(Map m) {
}
public Query remove(Object key) {
return null;
}
public int size() {
return 0;
}
public Collection<Query> values() {
return null;
}
}
class DatafeedsEntityManagerProvider implements EntityManagerProvider {
/**
* @see com.idcanet.vasc.backends.jpa.EntityManagerProvider#getEntityManager()
*/
public EntityManager getEntityManager() {
return null;
//return entityManager;
}
public boolean hasEntityManagerTransaction() {
return false;
}
};
class HackVascParser extends VascParser {
public HackVascParser(VascController c) throws Exception {
super(c);
}
@Override
protected X4OPhaseHandler getConfigOptionalPhase() {
final X4OPhaseHandler resultSuper = super.getConfigOptionalPhase();
X4OPhaseHandler result = new AbstractX4OPhaseHandler() {
protected void setX4OPhase() {
phase = X4OPhase.configOptionalPhase;
}
@Override
public boolean isElementPhase() {
return false;
}
public void runElementPhase(Element element) throws X4OPhaseException {
}
public void runPhase(ElementContext elementContext) throws X4OPhaseException {
resultSuper.runPhase(elementContext); // this is needed !!
ValueExpression e1 = getElementContext().getExpressionFactory().createValueExpression(getElementContext().getELContext(),"${entityManagerProvider}", EntityManagerProvider.class);
e1.setValue(getElementContext().getELContext(), new DatafeedsEntityManagerProvider());
ValueExpression e2 = getElementContext().getExpressionFactory().createValueExpression(getElementContext().getELContext(),"${xpqlController}", XpqlController.class);
e2.setValue(getElementContext().getELContext(), new XpqlController());
}
};
return result;
}
}
private VascController getParsedVascController() {
try {
// get local jvm plugging controller
VascController c = DefaultVascFactory.getDefaultVascController(22l, "test", "login");
// TODO made reuse working.
new HackVascParser(c).parseResource("com/idcanet/logstats/resources/vasc/logstats.xml");
//new HackVascParser(c).parseResource("com/idcanet/logstats/resources/vasc/flowuser.xml");
// fill stuff in all global entry'ies
for (String id:c.getVascEntryController().getVascEntryIds()) {
VascEntry entry = ((DefaultVascEntryController)c.getVascEntryController()).getRealVascEntryById(id);
if (entry.isVascDisplayOnly()==false) {
if (entry.isVascAdminCreate()) {
entry.addRowAction(new AddRowAction());
}
if (entry.isVascAdminEdit()) {
entry.addRowAction(new EditRowAction());
}
if (entry.isVascAdminDelete()) {
entry.addRowAction(new DeleteRowAction());
}
}
entry.addGlobalAction(new XMLExportGlobalAction());
entry.addGlobalAction(new CSVExportGlobalAction());
//entry.addGlobalAction(new RefreshDataGlobalAction());
Locale locale = null;
// auto fix generic edit/del/create descriptiong if i18n key does not excits.
locale = Locale.getDefault();
DefaultVascEntryResourceResolver t = new DefaultVascEntryResourceResolver();
// TODO: new DefaultVascEntryResourceResolver("com/mbuyu/m4n/resources/datafeeds/i18n/DatafeedsBundle",locale);
if (t.getTextValue(entry.getEditDescription()).equals(entry.getEditDescription())) {
entry.setEditDescription("generic.editDescription");
}
if (t.getTextValue(entry.getDeleteDescription()).equals(entry.getDeleteDescription())) {
entry.setDeleteDescription("generic.deleteDescription");
}
if (t.getTextValue(entry.getCreateDescription()).equals(entry.getCreateDescription())) {
entry.setCreateDescription("generic.createDescription");
}
// add global listener to make sure we have all LAZY properties of a bean before we goto edit mode.
//entry.addVascEntryEventListener(VascEventType.DATA_SELECT, new RefreshObjectForLazyPropertiesListener());
// hackje om deze manuale actions van i18n keys te voorzien;
// this is temp untill x4o templaing
DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
f.finalizeVascEntry(entry, c);
}
logger.info("VASC COMPLEET LETS RETURN.");
// finally set the controller for storage in this (session) bean.
return c;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

View file

@ -1,27 +0,0 @@
package com.idcanet.vasc.ejb3;
import java.util.List;
import java.util.Map;
import javax.ejb.Remote;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 13 Aug 2007
*/
@Remote
public interface VascServiceManagerRemote {
public Map<String,String> getResourceBundle(String locale);
public List<String> getVascEntryIds();
public VascEntry getVascEntry(String entryId);
public Object invokeBackendMethod(String backendId,String method,Object[] args);
}

View file

@ -1,842 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swing;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.Spring;
import javax.swing.SpringLayout;
import javax.swing.UIManager;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import com.idcanet.vasc.core.AbstractVascFrontend;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
import com.idcanet.vasc.core.entry.VascEntryExporter;
import com.idcanet.vasc.core.ui.VascColumnValueModelListener;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
import com.idcanet.vasc.frontends.swing.ui.SwingBoolean;
import com.idcanet.vasc.frontends.swing.ui.SwingButton;
import com.idcanet.vasc.frontends.swing.ui.SwingColorChooser;
import com.idcanet.vasc.frontends.swing.ui.SwingLabel;
import com.idcanet.vasc.frontends.swing.ui.SwingList;
import com.idcanet.vasc.frontends.swing.ui.SwingText;
import com.idcanet.vasc.frontends.swing.ui.SwingTextArea;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class SwingVascFrontend extends AbstractVascFrontend {
private Logger logger = null;
private JComponent parent = null;
public SwingVascFrontend(JComponent parent) {
logger = Logger.getLogger(SwingVascFrontend.class.getName());
this.parent=parent;
}
/**
* Add swing implmented ui components
*/
protected void addUiComponents() {
VascFrontendData vfd = getVascEntry().getVascFrontendData();
// required UI components
vfd.putVascUIComponent(VascUIComponent.VASC_LABEL,SwingLabel.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_TEXT, SwingText.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_LIST, SwingList.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_BUTTON, SwingButton.class.getName());
// optional UI components
vfd.putVascUIComponent(VascUIComponent.VASC_BOOLEAN , SwingBoolean.class.getName());
//vfd.putVascUIComponent(VascUIComponent.VASC_DATE , SwingDate.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_TEXTAREA, SwingTextArea.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_COLOR, SwingColorChooser.class.getName());
}
public ImageIcon getImageIcon(String imageResource) {
/// TODO hack beter
String key = entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(imageResource);
//logger.fine("KEY======================="+key);
if (key.startsWith("vasc.entry")) {
return null;
}
if (key.indexOf("META-INF")>0 | key.indexOf("resource")>0) {
return null;
//return SwingImageHelper.getImageIcon(key);
} else {
return null;
}
}
/**
* @see com.idcanet.vasc.core.VascViewRenderer#renderEdit(com.idcanet.vasc.core.VascEntry, java.lang.Object)
*/
public void renderEdit() throws Exception {
logger.fine("Rending Edit View");
Object rowBean = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
String beanValue = rowBean.toString();
if (entry.getDisplayNameFieldId()!=null) {
VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId());
Object vv = v.getVascEntryFieldValue().getValue(v, rowBean);
if (vv==null) {
beanValue="";
} else {
beanValue=""+vv;
}
if (beanValue.length()>30) {
beanValue=beanValue.substring(0, 30);
}
}
SwingEditDialog dialog = new SwingEditDialog(parent,entry,rowBean,i18n("vasc.dialog.edit.title"),i18n("vasc.dialog.edit.message",beanValue));
Object result = dialog.openDialog();
logger.finest("OPEN closed : "+result);
if(result==null) {
return;
}
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(result);
entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry);
}
public void renderDelete() throws Exception {
Object rowBean = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
String beanValue = rowBean.toString();
VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId());
beanValue = ""+v.getVascEntryFieldValue().getValue(v, rowBean);
if (beanValue.length()>30) {
beanValue=beanValue.substring(0, 30);
}
int response = JOptionPane.showOptionDialog(
parent // Center in window.
, i18n("vasc.dialog.delete.message",beanValue) // Message
, i18n("vasc.dialog.delete.title") // Title in titlebar
, JOptionPane.YES_NO_OPTION // Option type
, JOptionPane.PLAIN_MESSAGE // messageType
, null // Icon (none)
, null // Button text as above.
, null // Default button's label
);
if (response==JOptionPane.YES_OPTION) {
entry.getVascFrontendData().getVascFrontendHelper().deleteObject(entry);
}
}
class SwingEditDialog extends JDialog {
private static final long serialVersionUID = 10L;
private String headerText = null;
private Object result = null;
private Object bean = null;
public SwingEditDialog(JComponent parent,VascEntry entry,Object bean,String title,String headerText) throws Exception {
super();
this.headerText = headerText;
this.bean = bean;
setTitle(i18n(title));
setModal(true);
JPanel pane = new JPanel();
pane.setLayout(new BorderLayout());
JPanel header = new JPanel();
createHeader(header);
pane.add(header,BorderLayout.NORTH);
JPanel body = new JPanel();
createBody(body);
pane.add(body,BorderLayout.CENTER);
JPanel footer = new JPanel();
createFooter(footer);
pane.add(footer,BorderLayout.SOUTH);
add(pane);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
//Ensure the text field always gets the first focus.
//addComponentListener(new ComponentAdapter() {
// public void componentShown(ComponentEvent ce) {
// textField.requestFocusInWindow();
// }
/// });
pack();
setLocationRelativeTo(parent);
}
public Object openDialog() {
setVisible(true);
return result;
}
public void createHeader(JPanel header) {
JLabel l = new JLabel();
l.setText(i18n(headerText));
l.setFont(new Font(null,Font.BOLD, 14));
//l.setToolTipText(i18n(headerText));
header.add(l);
}
public void createBody(JPanel body) throws Exception {
body.setLayout(new SpringLayout());
int column = 0;
for (VascEntryField c:entry.getVascEntryFields()) {
if (c.getEdit()==false) {
continue;
}
//if (c.isEditReadOnly()==true) {
for (int i=0;i<c.getVascEntryFieldType().getUIComponentCount(c);i++) {
VascUIComponent label = c.getVascEntryFieldType().provideLabelUIComponent(i,c);
VascValueModel model = new VascValueModel();
model.setValue(i18n(c.getName()));
label.createComponent(entry,c,model,body);
VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c);
model = new VascValueModel(c.getVascEntryFieldType().provideEditorVascValueModel(i,c));
model.setValue(c.getVascEntryFieldValue().getValue(c, bean));
model.addListener(new VascColumnValueModelListener(c,bean));
Object g = editor.createComponent(entry,c,model,body);
column++;
if (i==0) {
entry.getVascFrontendData().addFieldVascUIComponents(c, editor,g);
}
}
}
//JComponent, rows, cols, initX, initY ,xPad, yPad
SpringUtilities.makeCompactGrid(body, column,2, 6,6, 6,6);
}
public void createFooter(JPanel footer) {
JButton saveButton = new JButton();
saveButton.setIcon(getImageIcon("vasc.dialog.save.image"));
saveButton.setText(i18n("vasc.dialog.save.name"));
saveButton.setToolTipText(i18n("vasc.dialog.save.tooltip"));
saveButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
//if(entry.getVascFrontendData().getVascFrontendHelper().validateObject(entry, bean)) {
// return;
//}
result = bean;
setVisible(false);
}
});
footer.add(saveButton);
JButton cancelButton = new JButton();
cancelButton.setIcon(getImageIcon("vasc.dialog.cancel.image"));
cancelButton.setText(i18n("vasc.dialog.cancel.name"));
cancelButton.setToolTipText(i18n("vasc.dialog.cancel.tooltip"));
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
result = null;
setVisible(false);
}
});
footer.add(cancelButton);
}
}
/**
* @see com.idcanet.vasc.core.VascViewRenderer#renderExport(com.idcanet.vasc.core.VascEntry, com.idcanet.vasc.core.VascDataExporter)
*/
public void renderExport(VascEntryExporter exporter) throws Exception {
String fileName = null;
JFileChooser c = new JFileChooser();
int rVal = c.showSaveDialog(null);
if (rVal == JFileChooser.APPROVE_OPTION) {
fileName = c.getSelectedFile().getAbsolutePath();
// filename.setText(c.getSelectedFile().getName());
//dir.setText(c.getCurrentDirectory().toString());
}
if (rVal == JFileChooser.CANCEL_OPTION) {
return;
}
logger.fine("FileName: "+fileName);
if (fileName == null) {
return;
}
OutputStream out = new FileOutputStream(fileName);
try {
exporter.doExport(out, entry);
} catch (Exception e) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
} finally {
if (out!=null) {
out.close();
}
}
}
/**
* @see com.idcanet.vasc.core.VascViewRenderer#renderView(com.idcanet.vasc.core.VascEntry)
*/
public void renderView() throws Exception {
JPanel topPanel = new JPanel();
topPanel.setLayout(new BorderLayout());
//topPanel.setBackground(Color.PINK);
JPanel n = new JPanel();
topPanel.add(n,BorderLayout.NORTH);
renderHeader(n);
JPanel c = new JPanel();
c.setLayout(new BorderLayout());
topPanel.add(c,BorderLayout.CENTER);
renderBody(c);
JPanel f = new JPanel();
//f.setBackground(Color.BLUE);
topPanel.add(f,BorderLayout.SOUTH);
renderFooter(f);
//parent.setBackground(Color.CYAN);
parent.setLayout(new BorderLayout());
parent.add(topPanel);
}
private void renderHeader(JComponent parent2) {
JPanel header = new JPanel();
header.setLayout(new BorderLayout());
header.setBackground(Color.WHITE);
header.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
if(entry.getListImage()!=null) {
JLabel l = new JLabel();
// TODO: hack images working
//l.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(entry.getHeaderImage())).getScaledInstance(32, 32, Image.SCALE_SMOOTH)));
if (entry.getListDescription()!=null) {
l.setToolTipText(i18n(entry.getListDescription()));
}
header.add(l,BorderLayout.WEST);
}
if(entry.getName()!=null) {
JLabel l = new JLabel(i18n(entry.getName()));
l.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
l.setFont(new Font(null,Font.BOLD, 18));
if (entry.getListDescription()!=null) {
l.setToolTipText(i18n(entry.getListDescription()));
}
header.add(l,BorderLayout.CENTER);
}
JPanel top = new JPanel();
//top.setBackground(Color.BLUE);
for (GlobalVascAction action:entry.getGlobalActions()) {
JButton but = new JButton();
but.setText(i18n(action.getName()));
but.setToolTipText(i18n(action.getDescription()));
but.addActionListener(new GlobalActionListener(action));
but.setIcon(getImageIcon(action.getImage()));
top.add(but);
}
// create options
JPanel optionPanel = new JPanel();
//top.setBackground(Color.GREEN);
//for(VascUserOption option:entry.getUserOptions()) {
// option.createUserOptionRenderer(entry);
//}
//top.add(header,BorderLayout.NORTH);
parent2.setLayout(new BorderLayout());
parent2.add(header,BorderLayout.NORTH);
parent2.add(optionPanel,BorderLayout.CENTER);
parent2.add(top,BorderLayout.EAST);
}
private void renderBody(JComponent parent2) {
VascColumnModel model = new VascColumnModel();
//TODO: entry.getVascEntryController().addEventListener(model);
JTable table = new JTable();
// this regs the listeners for the sorting
//tableSorter.setTableHeader(table.getTableHeader());
//tableSorter.setTableModel(model);
table.setModel(model);
table.getTableHeader().setReorderingAllowed(false);
// remove auto columns :(
int cols = table.getColumnModel().getColumnCount();
for (int i=0;i<cols;i++) {
TableColumn c = table.getColumnModel().getColumn(0); // idd, just remove index 0 every time
table.removeColumn(c);
}
table.revalidate();
TableCellRenderer renderer = new JComponentTableHeaderCellRenderer();
int counter=0;
for(VascEntryField c:entry.getVascEntryFields()) {
if (c.getList()==false) {
continue;
}
TableColumn t = new TableColumn();
if (c.getSizeList()!=null) {
t.setPreferredWidth(c.getSizeList());
} else {
t.setPreferredWidth(200);
}
t.setHeaderValue(c);
t.setHeaderRenderer(renderer);
t.setModelIndex(counter);
table.addColumn(t);
counter++;
}
table.getSelectionModel().addListSelectionListener(new EntrySectionListener(table));
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
table.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if (e.getClickCount() == 2) {
Object o = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
if (o==null) {
return;
}
try {
// todo: fix
entry.getVascFrontendData().getVascFrontend().renderEdit();
} catch (Exception ee) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, ee);
}
}
}
});
JScrollPane scrollPane = new JScrollPane(table);
parent2.add(scrollPane);
}
class EntrySectionListener implements ListSelectionListener {
JTable table;
EntrySectionListener(JTable table) {
this.table = table;
}
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
int rowIndex = table.getSelectedRow();
if (rowIndex!=-1) {
// temp; gets index by sorter
//rowIndex = tableSorter.modelIndex(rowIndex);
Object data = entry.getVascFrontendData().getVascEntryState().getEntryDataList().get(rowIndex);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(data);
} else {
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
}
}
}
class JComponentTableHeaderCellRenderer extends DefaultTableCellRenderer {
private static final long serialVersionUID = 10L;
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,boolean hasFocus, int row, int column) {
VascEntryField c = (VascEntryField)value;
setText(i18n(c.getName()));
setToolTipText(i18n(c.getDescription()));
if(c.getImage()!=null) {
setIcon(getImageIcon(c.getImage()));
} else {
setIcon(null);
}
if (entry != null) {
JTableHeader header = table.getTableHeader();
if (header != null) {
setForeground(header.getForeground());
setBackground(header.getBackground());
setFont(header.getFont());
}
}
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
return this;
}
}
private void renderFooter(JComponent parent2) {
logger.finest("Creating footer");
JPanel panel = new JPanel();
for(RowVascAction action:entry.getRowActions()) {
JButton but = new JButton();
but.setText(i18n(action.getName()));
but.setToolTipText(i18n(action.getDescription()));
but.setIcon(getImageIcon(action.getImage()));
but.addActionListener(new RowActionListener(action));
panel.add(but);
}
parent2.setLayout(new BorderLayout());
parent2.add(panel,BorderLayout.WEST);
}
class RowActionListener implements ActionListener {
private RowVascAction action = null;
public RowActionListener(RowVascAction action) {
this.action=action;
}
public void actionPerformed(ActionEvent event) {
logger.fine("Row Action");
try {
action.doRowAction(entry, entry.getVascFrontendData().getVascEntryState().getEntryDataObject());
} catch (Exception e) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,e);
}
}
}
class GlobalActionListener implements ActionListener {
private GlobalVascAction action = null;
public GlobalActionListener(GlobalVascAction action) {
this.action=action;
}
public void actionPerformed(ActionEvent event) {
logger.fine("Global Action");
try {
action.doGlobalAction(entry);
} catch (Exception e) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,e);
}
}
}
class VascColumnModel extends AbstractTableModel implements VascEntryFrontendEventListener {
private static final long serialVersionUID = 10L;
public void vascEvent(VascEntry entry,Object o) {
fireTableDataChanged();
}
/**
* @see javax.swing.entry.entryModel#getColumnCount()
*/
public int getColumnCount() {
int result = 0;
for(VascEntryField c:entry.getVascEntryFields()) {
if (c.getList()==false) {
continue;
}
result++;
}
return result;
}
/**
* @see javax.swing.entry.entryModel#getRowCount()
*/
public int getRowCount() {
if (entry.getVascFrontendData().getVascEntryState().getEntryDataList()==null) {
return 0;
}
return entry.getVascFrontendData().getVascEntryState().getEntryDataList().size();
}
/**
* @see javax.swing.entry.entryModel#getValueAt(int, int)
*/
public Object getValueAt(int rowIndex, int columnIndex) {
Object bean = entry.getVascFrontendData().getVascEntryState().getEntryDataList().get(rowIndex);
logger.finer("Rending column; "+columnIndex+" bean: "+bean);
// TODO: this is slowing....
List<VascEntryField> list = new ArrayList<VascEntryField>();
for(VascEntryField c:entry.getVascEntryFields()) {
if (c.getList()==false) {
continue;
}
list.add(c);
}
VascEntryField vtc = list.get(columnIndex);
try {
//if (vtc.getVascColumnRenderer()!=null) {
// return vtc.getVascColumnRenderer().rendererColumn(vtc,bean);
//} else {
return ""+vtc.getVascEntryFieldValue().getValue(vtc,bean);
// }
} catch (Exception e) {
return "Error";
}
}
public VascFrontendEventType[] getEventTypes() {
VascFrontendEventType[] result = {VascFrontendEventType.DATA_LIST_UPDATE};
return result;
}
}
}
/**
* A 1.4 file that provides utility methods for creating form- or grid-style
* layouts with SpringLayout. These utilities are used by several programs, such
* as SpringBox and SpringCompactGrid.
*/
class SpringUtilities {
/**
* Aligns the first <code>rows</code>*<code>cols</code> components of
* <code>parent</code> in a grid. Each component is as big as the maximum
* preferred width and height of the components. The parent is made just big
* enough to fit them all.
*
* @param rows
* number of rows
* @param cols
* number of columns
* @param initialX
* x location to start the grid at
* @param initialY
* y location to start the grid at
* @param xPad
* x padding between cells
* @param yPad
* y padding between cells
*/
public static void makeGrid(Container parent, int rows, int cols,
int initialX, int initialY, int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
} catch (ClassCastException exc) {
System.err
.println("The first argument to makeGrid must use SpringLayout.");
return;
}
Spring xPadSpring = Spring.constant(xPad);
Spring yPadSpring = Spring.constant(yPad);
Spring initialXSpring = Spring.constant(initialX);
Spring initialYSpring = Spring.constant(initialY);
int max = rows * cols;
//Calculate Springs that are the max of the width/height so that all
//cells have the same size.
Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0))
.getWidth();
Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0))
.getWidth();
for (int i = 1; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(parent
.getComponent(i));
maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth());
maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight());
}
//Apply the new width/height Spring. This forces all the
//components to have the same size.
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(parent
.getComponent(i));
cons.setWidth(maxWidthSpring);
cons.setHeight(maxHeightSpring);
}
//Then adjust the x/y constraints of all the cells so that they
//are aligned in a grid.
SpringLayout.Constraints lastCons = null;
SpringLayout.Constraints lastRowCons = null;
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(parent
.getComponent(i));
if (i % cols == 0) { //start of new row
lastRowCons = lastCons;
cons.setX(initialXSpring);
} else { //x position depends on previous component
cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST),
xPadSpring));
}
if (i / cols == 0) { //first row
cons.setY(initialYSpring);
} else { //y position depends on previous row
cons.setY(Spring.sum(lastRowCons
.getConstraint(SpringLayout.SOUTH), yPadSpring));
}
lastCons = cons;
}
//Set the parent's size.
SpringLayout.Constraints pCons = layout.getConstraints(parent);
pCons.setConstraint(SpringLayout.SOUTH, Spring.sum(Spring
.constant(yPad), lastCons.getConstraint(SpringLayout.SOUTH)));
pCons.setConstraint(SpringLayout.EAST, Spring.sum(
Spring.constant(xPad), lastCons
.getConstraint(SpringLayout.EAST)));
}
/* Used by makeCompactGrid. */
private static SpringLayout.Constraints getConstraintsForCell(int row,
int col, Container parent, int cols) {
SpringLayout layout = (SpringLayout) parent.getLayout();
Component c = parent.getComponent(row * cols + col);
return layout.getConstraints(c);
}
/**
* Aligns the first <code>rows</code>*<code>cols</code> components of
* <code>parent</code> in a grid. Each component in a column is as wide as
* the maximum preferred width of the components in that column; height is
* similarly determined for each row. The parent is made just big enough to
* fit them all.
*
* @param rows
* number of rows
* @param cols
* number of columns
* @param initialX
* x location to start the grid at
* @param initialY
* y location to start the grid at
* @param xPad
* x padding between cells
* @param yPad
* y padding between cells
*/
public static void makeCompactGrid(Container parent, int rows, int cols,
int initialX, int initialY, int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
} catch (ClassCastException exc) {
System.err
.println("The first argument to makeCompactGrid must use SpringLayout.");
return;
}
//Align all cells in each column and make them the same width.
Spring x = Spring.constant(initialX);
for (int c = 0; c < cols; c++) {
Spring width = Spring.constant(0);
for (int r = 0; r < rows; r++) {
width = Spring.max(width, getConstraintsForCell(r, c, parent,
cols).getWidth());
}
for (int r = 0; r < rows; r++) {
SpringLayout.Constraints constraints = getConstraintsForCell(r,
c, parent, cols);
constraints.setX(x);
constraints.setWidth(width);
}
x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad)));
}
//Align all cells in each row and make them the same height.
Spring y = Spring.constant(initialY);
for (int r = 0; r < rows; r++) {
Spring height = Spring.constant(0);
for (int c = 0; c < cols; c++) {
height = Spring.max(height, getConstraintsForCell(r, c, parent,
cols).getHeight());
}
for (int c = 0; c < cols; c++) {
SpringLayout.Constraints constraints = getConstraintsForCell(r,
c, parent, cols);
constraints.setY(y);
constraints.setHeight(height);
}
y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad)));
}
//Set the parent's size.
SpringLayout.Constraints pCons = layout.getConstraints(parent);
pCons.setConstraint(SpringLayout.SOUTH, y);
pCons.setConstraint(SpringLayout.EAST, x);
}
}

View file

@ -1,136 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swing.ui;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
*
* @author Willem Cazander
* @version 1.0 Sep 21, 2007
*/
public class SwingBoolean implements VascUIComponent {
private JCheckBox checkBox = null;
private Color orgBackgroundColor = null;
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
checkBox = new JCheckBox();
orgBackgroundColor = checkBox.getBackground();
checkBox.setSelected(new Boolean(model.getValue().toString()));
((JComponent)gui).add(checkBox);
checkBox.addActionListener(new SelectActionListener(model,table));
return checkBox;
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (checkBox==null) {
return null;
}
return checkBox.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String text) {
if (checkBox==null) {
return;
}
checkBox.setToolTipText(text);
if (text==null) {
checkBox.setBackground(orgBackgroundColor);
} else {
checkBox.setBackground(Color.RED);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !checkBox.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
checkBox.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return checkBox.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
checkBox.setVisible(rendered);
}
}
class SelectActionListener implements ActionListener {
private VascValueModel model;
private VascEntry entry = null;
public SelectActionListener(VascValueModel model,VascEntry entry) {
this.model=model;
this.entry=entry;
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
boolean value = ((JCheckBox)e.getSource()).isSelected();
try {
model.setValue(value);
} catch (Exception ee) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee);
}
}
}

View file

@ -1,111 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swing.ui;
import java.awt.Color;
import javax.swing.JButton;
import javax.swing.JComponent;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
*
* @author Willem Cazander
* @version 1.0 Nov 18, 2008
*/
public class SwingButton implements VascUIComponent {
private JButton vascButton = null;
private Color orgBackgroundColor = null;
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
vascButton = new JButton("Color");
orgBackgroundColor = vascButton.getBackground();
((JComponent)gui).add(vascButton);
//vascButton.addActionListener(new SelectActionListener3(model,true,table));
return vascButton;
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (vascButton==null) {
return null;
}
return vascButton.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String text) {
if (vascButton==null) {
return;
}
vascButton.setToolTipText(text);
if (text==null) {
vascButton.setBackground(orgBackgroundColor);
} else {
vascButton.setBackground(Color.RED);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !vascButton.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
vascButton.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return vascButton.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
vascButton.setVisible(rendered);
}
}

View file

@ -1,168 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swing.ui;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JComponent;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
*
* @author Willem Cazander
* @version 1.0 Nov 25, 2007
*/
public class SwingColorChooser implements VascUIComponent {
private JButton colorButton = null;
private Color orgBackgroundColor = null;
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
JButton colorButton = new JButton("Color");
orgBackgroundColor = colorButton.getBackground();
((JComponent)gui).add(colorButton);
colorButton.addActionListener(new SelectActionListener3(model,true,table));
return colorButton;
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (colorButton==null) {
return null;
}
return colorButton.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String text) {
if (colorButton==null) {
return;
}
colorButton.setToolTipText(text);
if (text==null) {
colorButton.setBackground(orgBackgroundColor);
} else {
colorButton.setBackground(Color.RED);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !colorButton.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
colorButton.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return colorButton.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
colorButton.setVisible(rendered);
}
}
class SelectActionListener3 implements ActionListener {
private VascValueModel model;
private boolean hexEncoding = false;
private VascEntry entry = null;
public SelectActionListener3(VascValueModel model,boolean hexEncoding,VascEntry entry) {
this.model=model;
this.hexEncoding=hexEncoding;
this.entry=entry;
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
if (hexEncoding==false) {
Color cur=null;
try {
cur = (Color)model.getValue();
} catch (VascException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (cur==null) {
cur = Color.YELLOW;
}
Color newColor = JColorChooser.showDialog(null,"Choose a color...",cur);
try {
model.setValue(newColor);
} catch (Exception ee) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee);
}
} else {
String cur=null;
try {
cur = (String)model.getValue();
} catch (VascException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Color c = Color.YELLOW;
try {
if (cur!=null) {
c = Color.decode(cur);
}
Color newColor = JColorChooser.showDialog(null,"Choose a color...",c);
String newColorString = "#"+Integer.toHexString( newColor.getRGB() & 0x00ffffff );
model.setValue(newColorString);
} catch (Exception ee) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee);
}
}
}
}

View file

@ -1,142 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swing.ui;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyVetoException;
import java.util.Date;
import javax.swing.JComponent;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
import com.michaelbaranov.microba.calendar.DatePicker;
/**
*
*
* @author Willem Cazander
* @version 1.0 Sep 21, 2007
*/
public class SwingDate implements VascUIComponent {
private DatePicker datePicker = null;
private Color orgBackgroundColor = null;
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
datePicker = new DatePicker();
orgBackgroundColor = datePicker.getBackground();
try {
datePicker.setDate((Date)model.getValue());
} catch (PropertyVetoException e) {
throw new VascException(new VascException(e));
}
((JComponent)gui).add(datePicker);
datePicker.addActionListener(new SelectActionListener2(model,table));
return datePicker;
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (datePicker==null) {
return null;
}
return datePicker.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String text) {
if (datePicker==null) {
return;
}
datePicker.setToolTipText(text);
if (text==null) {
datePicker.setBackground(orgBackgroundColor);
} else {
datePicker.setBackground(Color.RED);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !datePicker.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
datePicker.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return datePicker.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
datePicker.setVisible(rendered);
}
}
class SelectActionListener2 implements ActionListener {
private VascValueModel model;
private VascEntry entry = null;
public SelectActionListener2(VascValueModel model,VascEntry entry) {
this.model=model;
this.entry=entry;
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
Date value = ((DatePicker)e.getSource()).getDate();
try {
model.setValue(value);
} catch (Exception ee) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee);
}
}
}

View file

@ -1,112 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swing.ui;
import java.awt.Color;
import javax.swing.JComponent;
import javax.swing.JLabel;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 21, 2008
*/
public class SwingLabel implements VascUIComponent {
private JLabel label = null;
private Color orgBackgroundColor = null;
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
label = new JLabel();
label.setHorizontalAlignment(JLabel.TRAILING);
orgBackgroundColor = label.getBackground();
label.setText(""+model.getValue());
((JComponent)gui).add(label);
return label;
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (label==null) {
return null;
}
return label.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String text) {
if (label==null) {
return;
}
label.setToolTipText(text);
if (text==null) {
label.setBackground(orgBackgroundColor);
} else {
label.setBackground(Color.RED);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !label.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
label.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return label.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
label.setVisible(rendered);
}
}

View file

@ -1,170 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swing.ui;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascSelectItem;
import com.idcanet.vasc.core.ui.VascSelectItemModel;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public class SwingList implements VascUIComponent {
private JComboBox comboBox = null;
private Color orgBackgroundColor = null;
public Object createComponent(final VascEntry entry,VascEntryField entryField,final VascValueModel model,Object gui) throws VascException {
VascSelectItemModel items = (VascSelectItemModel)entryField.getVascEntryFieldType().getDataObject();
if (items==null) {
comboBox = new JComboBox();
} else {
comboBox = new JComboBox(items.getVascSelectItems(entry).toArray());
}
orgBackgroundColor = comboBox.getBackground();
((JComponent)gui).add(comboBox);
comboBox.setRenderer(new MyCellRenderer());
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
VascSelectItem i = (VascSelectItem)((JComboBox)e.getSource()).getSelectedItem();
try {
model.setValue(i.getValue());
} catch (Exception ee) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee);
}
}
});
// set default !!
if (model.getValue()!=null) {
for (int i=0;i<comboBox.getModel().getSize();i++) {
Object o = comboBox.getModel().getElementAt(i);
VascSelectItem i2 = (VascSelectItem)o;
if ( model.getValue().equals(i2.getValue()) ) {
comboBox.setSelectedItem(i2);
return comboBox;
}
}
}
if (comboBox.getModel().getSize()>0) {
// else select the top one.
comboBox.setSelectedIndex(0);
}
return comboBox;
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (comboBox==null) {
return null;
}
return comboBox.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String text) {
if (comboBox==null) {
return;
}
comboBox.setToolTipText(text);
if (text==null) {
comboBox.setBackground(orgBackgroundColor);
} else {
comboBox.setBackground(Color.RED);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !comboBox.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
comboBox.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return comboBox.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
comboBox.setVisible(rendered);
}
}
class MyCellRenderer extends JLabel implements ListCellRenderer {
private static final long serialVersionUID = 10L;
public MyCellRenderer() {
setOpaque(true);
}
public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus) {
VascSelectItem i = (VascSelectItem)value;
if (i!=null) {
setText(i.getLabel());
} else {
setText("Error");
}
return this;
}
}

View file

@ -1,159 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swing.ui;
import java.awt.Color;
import javax.swing.JComponent;
import javax.swing.JTextField;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public class SwingText implements VascUIComponent {
private JTextField textField = null;
private Color orgBackgroundColor = null;
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
textField = new JTextField();
orgBackgroundColor = textField.getBackground();
textField.setText(""+model.getValue());
((JComponent)gui).add(textField);
textField.getDocument().addDocumentListener(new TextListener(model,table,this));
return textField;
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (textField==null) {
return null;
}
return textField.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String text) {
if (textField==null) {
return;
}
textField.setToolTipText(text);
if (text==null) {
textField.setBackground(orgBackgroundColor);
} else {
textField.setBackground(Color.RED);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !textField.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
textField.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return textField.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
textField.setVisible(rendered);
}
}
class TextListener implements DocumentListener {
private VascValueModel model = null;
//private VascTable table = null;
private SwingText textField = null;
public TextListener(VascValueModel model,VascEntry table,SwingText textField) {
this.model=model;
//this.table=table;
this.textField=textField;
}
/**
* @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
*/
public void changedUpdate(DocumentEvent e) {
update(e);
}
/**
* @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
*/
public void insertUpdate(DocumentEvent e) {
update(e);
}
/**
* @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
*/
public void removeUpdate(DocumentEvent e) {
update(e);
}
public void update(DocumentEvent event) {
try {
String value = event.getDocument().getText(0, event.getDocument().getLength());
model.setValue(value);
textField.setErrorText(null);
} catch (Exception ee) {
textField.setErrorText(ee.getLocalizedMessage());
//table.getVascTableController().handleException(ee, table);
}
}
}

View file

@ -1,166 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swing.ui;
import java.awt.Color;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JTextArea;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 21, 2008
*/
public class SwingTextArea implements VascUIComponent {
private JTextArea textArea = null;
private Color orgBackgroundColor = null;
public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
textArea = new JTextArea();
textArea.setBorder(BorderFactory.createEtchedBorder());
textArea.setRows(8);
//entryField.getVascEntryFieldType().getProperty(name)
//textArea.setRows(rows);
//textArea.setColumns(columns);
orgBackgroundColor = textArea.getBackground();
textArea.setText(""+model.getValue());
((JComponent)gui).add(textArea);
textArea.getDocument().addDocumentListener(new TextAreaListener(model,entry,this));
return textArea;
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (textArea==null) {
return null;
}
return textArea.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String text) {
if (textArea==null) {
return;
}
textArea.setToolTipText(text);
if (text==null) {
textArea.setBackground(orgBackgroundColor);
} else {
textArea.setBackground(Color.RED);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !textArea.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
textArea.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return textArea.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
textArea.setVisible(rendered);
}
}
class TextAreaListener implements DocumentListener {
private VascValueModel model = null;
private SwingTextArea textArea = null;
public TextAreaListener(VascValueModel model,VascEntry entry,SwingTextArea textArea) {
this.model=model;
this.textArea=textArea;
}
/**
* @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
*/
public void changedUpdate(DocumentEvent e) {
update(e);
}
/**
* @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
*/
public void insertUpdate(DocumentEvent e) {
update(e);
}
/**
* @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
*/
public void removeUpdate(DocumentEvent e) {
update(e);
}
public void update(DocumentEvent event) {
try {
String value = event.getDocument().getText(0, event.getDocument().getLength());
model.setValue(value);
textArea.setErrorText(null);
} catch (Exception ee) {
textArea.setErrorText(ee.getLocalizedMessage());
//table.getVascTableController().handleException(ee, table);
}
}
}

View file

@ -1,230 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swt;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascColumnValueModelListener;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
* @author Willem Cazander
* @version 1.0 May 13, 2009
*/
public class SwtVascEditDialog extends Dialog {
private VascEntry entry = null;
private Shell shell = null;
public SwtVascEditDialog (VascEntry entry) {
super (Display.getCurrent().getActiveShell(), 0);
this.entry=entry;
}
protected String i18n(String key,Object...params) {
return entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(key,params);
}
protected Object i18nImage(String key) {
if (entry.getVascFrontendData().getVascEntryResourceImageResolver()==null) {
return null;
}
return entry.getVascFrontendData().getVascEntryResourceImageResolver().getImageValue(entry,key);
}
public void open() throws VascException {
shell = new Shell(getParent(), SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
shell.setText(i18n(entry.getName()));
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
shell.setLayout(layout);
Composite header = new Composite(shell, SWT.NONE);
GridLayout headerLayout = new GridLayout();
headerLayout.numColumns = 6;
header.setLayout(headerLayout);
header.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite body = new Composite(shell, SWT.NONE);
GridLayout bodyLayout = new GridLayout();
bodyLayout.numColumns = 1;
body.setLayout(bodyLayout);
body.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite footer = new Composite(shell, SWT.NONE);
GridLayout footerLayout = new GridLayout();
footerLayout.numColumns = 6;
footer.setLayout(footerLayout);
footer.setLayoutData(new GridData(SWT.NONE));
createHeader(header);
createBody(body);
createFooter(footer);
shell.pack();
shell.open();
Display display = shell.getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
public void createHeader(Composite header) {
String displayFieldId = entry.getDisplayNameFieldId();
VascEntryField dis = entry.getVascEntryFieldById(displayFieldId);
if (dis==null) {
throw new RuntimeException("Could not find: "+displayFieldId+" from: "+entry.getId());
}
String name = null;
try {
Object bean = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
name = dis.getVascEntryFieldValue().getDisplayValue(dis, bean);
} catch (VascException e) {
throw new RuntimeException("Could not display value from "+entry.getId(),e);
}
Color c = new Color(header.getDisplay(),255,255,255);
header.setBackground(c);
Label img = new Label(header, SWT.NONE);
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
img.setImage((Image)i18nImage(entry.getCreateImage()));
} else {
img.setImage((Image)i18nImage(entry.getEditImage()));
}
img.setBackground(c);
Font headerFont = new Font(header.getDisplay(), "verdana", 14, SWT.NONE);
Label l = new Label(header, SWT.CENTER);
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
l.setText(i18n(entry.getCreateDescription(),name));
} else {
l.setText(i18n(entry.getEditDescription(),name));
}
l.setFont(headerFont);
l.setBackground(c);
}
public void createBody(Composite body) throws VascException {
body.setLayout(new GridLayout(2, true));
body.setLayoutData(new GridData(GridData.FILL_BOTH));
Object bean = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
entry.getVascFrontendData().clearFieldRenderObjects(); // only needed for swt use
for (VascEntryField c:entry.getVascEntryFields()) {
if (entry.getVascFrontendData().getVascFrontendHelper().renderEdit(c)==false) {
continue;
}
for (int i=0;i<c.getVascEntryFieldType().getUIComponentCount(c);i++) {
VascUIComponent label = c.getVascEntryFieldType().provideLabelUIComponent(i,c);
VascValueModel model = new VascValueModel();
model.setValue(i18n(c.getName()));
Control realLabel = (Control)label.createComponent(entry,c,model,body);
realLabel.setToolTipText(i18n(c.getDescription()));
VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c);
model = new VascValueModel(c.getVascEntryFieldType().provideEditorVascValueModel(i,c));
model.setValue(c.getVascEntryFieldValue().getValue(c, bean));
model.addListener(new VascColumnValueModelListener(c,bean));
Control edit = (Control )editor.createComponent(entry,c,model,body);
if (edit.getLayoutData()==null) { // is for textarea which has custum layout data
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
gridData.verticalAlignment = GridData.FILL;
edit.setLayoutData(gridData);
}
if (i==0) {
entry.getVascFrontendData().addFieldVascUIComponents(c, editor,edit);
}
}
}
entry.getVascFrontendData().getVascFrontendHelper().editReadOnlyUIComponents(entry);
}
public void createFooter(Composite body) {
Button saveButton = new Button(body, SWT.NONE);
saveButton.setImage((Image)i18nImage("vasc.action.saveAction.image"));
saveButton.setText(i18n("vasc.action.saveAction.name"));
saveButton.setToolTipText(i18n("vasc.action.saveAction.description"));
saveButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
try {
boolean error = entry.getVascFrontendData().getVascFrontendHelper().validateAndSetErrorText(entry);
if (error) {
return;
}
entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry);
shell.dispose();
} catch (Exception ee) {
ee.printStackTrace();
}
}
});
Button cancelButton = new Button(body, SWT.NONE);
cancelButton.setImage((Image)i18nImage("vasc.action.cancelAction.image"));
cancelButton.setText(i18n("vasc.action.cancelAction.name"));
cancelButton.setToolTipText(i18n("vasc.action.cancelAction.description"));
cancelButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
shell.dispose();
}
});
}
}

View file

@ -1,660 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swt;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import com.idcanet.vasc.core.AbstractVascFrontend;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
import com.idcanet.vasc.core.entry.VascEntryExporter;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
import com.idcanet.vasc.core.ui.VascOptionValueModelListener;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
import com.idcanet.vasc.core.ui.VascValueModelListener;
import com.idcanet.vasc.frontends.swt.ui.SwtBoolean;
import com.idcanet.vasc.frontends.swt.ui.SwtButton;
import com.idcanet.vasc.frontends.swt.ui.SwtLabel;
import com.idcanet.vasc.frontends.swt.ui.SwtList;
import com.idcanet.vasc.frontends.swt.ui.SwtText;
import com.idcanet.vasc.frontends.swt.ui.SwtTextArea;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class SwtVascFrontend extends AbstractVascFrontend {
private Logger logger = null;
private Composite parent = null;
private boolean renderGlobalActions = true;
public SwtVascFrontend(Composite parent) {
logger = Logger.getLogger(SwtVascFrontend.class.getName());
this.parent=parent;
}
/**
* Add swt implmented ui components
*/
protected void addUiComponents() {
VascFrontendData vfd = getVascEntry().getVascFrontendData();
// required UI components
vfd.putVascUIComponent(VascUIComponent.VASC_LABEL,SwtLabel.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_TEXT, SwtText.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_BUTTON, SwtButton.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_LIST, SwtList.class.getName());
// optional UI components
vfd.putVascUIComponent(VascUIComponent.VASC_BOOLEAN , SwtBoolean.class.getName());
//vfd.putVascUIComponent(VascUIComponent.VASC_DATE , SwtDate.class.getName());
vfd.putVascUIComponent(VascUIComponent.VASC_TEXTAREA, SwtTextArea.class.getName());
//vfd.putVascUIComponent(VascUIComponent.VASC_COLOR, SwtColorChooser.class.getName());
}
/**
* @return the renderGlobalActions
*/
public boolean isRenderGlobalActions() {
return renderGlobalActions;
}
/**
* @param renderGlobalActions the renderGlobalActions to set
*/
public void setRenderGlobalActions(boolean renderGlobalActions) {
this.renderGlobalActions = renderGlobalActions;
}
@Override
protected Object i18nImage(String key) {
if (entry.getVascFrontendData().getVascEntryResourceImageResolver()==null) {
return null;
}
return entry.getVascFrontendData().getVascEntryResourceImageResolver().getImageValue(entry,key);
}
private static final String[] FILTER_NAMES = {
"All Files (*.*)",
"Comma Separated Values Files (*.csv)",
"Microsoft Excel Spreadsheet Files (*.xls)",
};
/** These filter extensions are used to filter which files are displayed. */
private static final String[] FILTER_EXTS = { "*.*","*.csv","*.xls" };
public void renderExport(VascEntryExporter exporter) throws Exception {
FileDialog dlg = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE);
dlg.setFilterNames(FILTER_NAMES);
dlg.setFilterExtensions(FILTER_EXTS);
dlg.setFileName(entry.getName()+".csv");
String fileName = dlg.open();
logger.fine("FileName: "+fileName);
if (fileName == null) {
return;
}
OutputStream out = new FileOutputStream(fileName);
try {
exporter.doExport(out, entry);
} catch (Exception e) {
//MessageDialog.openError(Display.getCurrent().getActiveShell(),crudTable.i18n("crud.event.export.error.title"),crudTable.i18n("crud.event.export.error.message"));
logger.log(Level.WARNING,"Error: "+e.getMessage(),e);
} finally {
if (out!=null) {
out.close();
}
}
}
public void renderEdit() throws Exception {
logger.fine("Rending Edit View");
SwtVascEditDialog dialog = new SwtVascEditDialog(entry);
dialog.open();
}
public void renderDelete() throws Exception {
boolean del = askDelete( Display.getCurrent().getActiveShell() );
if (del==false) {
return;
}
// yes
entry.getVascFrontendData().getVascFrontendHelper().deleteObject(entry);
}
private boolean askDelete(Shell shell) {
logger.finest("Asking for delete");
MessageBox askDelete = new MessageBox(shell,SWT.ICON_QUESTION|SWT.YES|SWT.NO);
askDelete.setText(i18n("crud.event.delete.confim.title"));
askDelete.setMessage(i18n("crud.event.delete.confim.question"));
int state = askDelete.open();
if (state == SWT.YES) {
return true;
}
return false;
}
public void renderView() throws Exception {
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
parent.setLayout(layout);
Composite header = new Composite(parent, SWT.NONE);
GridLayout headerLayout = new GridLayout();
headerLayout.numColumns = 6;
header.setLayout(headerLayout);
header.setLayoutData(new GridData(SWT.NONE));
Composite body = new Composite(parent, SWT.NONE);
GridLayout bodyLayout = new GridLayout();
bodyLayout.numColumns = 1;
body.setLayout(bodyLayout);
body.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite footer = new Composite(parent, SWT.NONE);
GridLayout footerLayout = new GridLayout();
footerLayout.numColumns = 6;
footer.setLayout(footerLayout);
footer.setLayoutData(new GridData(SWT.NONE));
createHeader(header);
createBody(body);
createFooter(footer);
}
public void createHeader(Composite header) {
logger.finest("Creating header");
Color c = header.getDisplay().getSystemColor(SWT.COLOR_WHITE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.marginTop = 0;
header.setLayout(layout);
header.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
header.setBackground(c);
if (isRenderGlobalActions()) {
Composite headerBar = new Composite(header, SWT.NONE);
//GridLayout headerLayout = new GridLayout();
//headerLayout.numColumns = 1;
headerBar.setLayout(new FillLayout());
//headerBar.setLayoutData(new GridData(GridData.FILL_BOTH));
ToolBar toolBar = new ToolBar(headerBar, SWT.NONE);
for (GlobalVascAction action:entry.getGlobalActions()) {
if (entry.getVascFrontendData().getVascFrontendHelper().renderGlobalVascAction(action)==false) {
continue;
}
ToolItem item = new ToolItem(toolBar, SWT.PUSH);
item.setText(i18n(action.getName()));
item.setToolTipText(i18n(action.getDescription()));
item.setImage((Image)i18nImage(action.getImage()));
item.addSelectionListener(new GlobalActionListener(action));
}
}
Composite headerName = new Composite(header, SWT.NONE);
GridLayout bodyLayout = new GridLayout();
bodyLayout.numColumns = 2;
headerName.setLayout(bodyLayout);
headerName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
headerName.setBackground(c);
Label l = new Label(headerName, SWT.CENTER);
l.setImage((Image)i18nImage(entry.getListImage()));
l.setBackground(c);
Font headerFont = new Font(header.getDisplay(), "verdana", 16, SWT.BOLD);
l = new Label(headerName, SWT.CENTER);
l.setFont(headerFont);
l.setText(i18n(entry.getName()));
l.setBackground(c);
Composite headerText = new Composite(header, SWT.NONE);
bodyLayout = new GridLayout();
bodyLayout.numColumns = 1;
headerText.setLayout(bodyLayout);
headerText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
headerText.setBackground(c);
l = new Label(headerText, SWT.CENTER);
l.setText(i18n(entry.getListDescription()));
l.setBackground(c);
Composite headerSplit = new Composite(header, SWT.NONE);
GridLayout headerSplitLayout = new GridLayout();
headerSplitLayout.numColumns = 2;
headerSplit.setLayout(headerSplitLayout);
headerSplit.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite headerOptions = new Composite(headerSplit, SWT.NONE);
GridLayout headerOptionsLayout = new GridLayout();
headerOptionsLayout.numColumns = 2;
headerOptions.setLayout(headerOptionsLayout);
headerOptions.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
try {
for (VascEntryField option:entry.getListOptions()) {
for (int i=0;i<option.getVascEntryFieldType().getUIComponentCount(option);i++) {
com.idcanet.vasc.core.ui.VascUIComponent label = option.getVascEntryFieldType().provideLabelUIComponent(i,option);
VascValueModel model = new VascValueModel();
model.setValue(i18n(option.getName()));
label.createComponent(entry,option,model,headerOptions);
com.idcanet.vasc.core.ui.VascUIComponent editor = option.getVascEntryFieldType().provideEditorUIComponent(i,option);
model = new VascValueModel(option.getVascEntryFieldType().provideEditorVascValueModel(i,option));
model.addListener(new VascOptionValueModelListener(option));
model.setValue(null);
model.addListener(new VascValueModelListener() {
public void valueUpdate(VascValueModel model) throws VascException {
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);// mm
}
});
Object edit = editor.createComponent(entry,option,model,headerOptions);
// i==0 is for multi field editor support... which is stell very in progress
if (i==0) {
entry.getVascFrontendData().addFieldVascUIComponents(option, editor,edit);
}
}
}
Composite headerRightOptions = new Composite(headerSplit, SWT.NONE | SWT.RIGHT | SWT.TOP );
GridLayout headerRightOptionsLayout = new GridLayout();
headerRightOptionsLayout.numColumns = 2;
headerRightOptions.setLayout(headerRightOptionsLayout);
headerRightOptions.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label searchLabel = new Label(headerRightOptions, SWT.CENTER);
searchLabel.setText("Zoeken:");
final Text text = new Text(headerRightOptions, SWT.NONE | SWT.BORDER );
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String value = text.getText();
try {
entry.getVascFrontendData().getVascFrontendHelper().searchAction(entry, value);
} catch (Exception ee) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee);
}
}
});
entry.getVascFrontendData().getVascFrontendHelper().headerOptionsCreatedFillData(entry);
} catch (Exception e) {
e.printStackTrace();
}
}
class GlobalActionListener extends SelectionAdapter {
private GlobalVascAction action = null;
public GlobalActionListener(GlobalVascAction action) {
this.action=action;
}
/**
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(SelectionEvent event) {
logger.fine("Global Action");
try {
action.doGlobalAction(entry);
} catch (Exception e) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,e);
}
}
}
public void createBody(Composite body) {
logger.finer("Creating body");
// Create the table viewer to display the players
// SWT.CHECK
final TableViewer tableViewer = new TableViewer(body, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
final Table table2 = tableViewer.getTable();
table2.setLayoutData(new GridData(GridData.FILL_BOTH));
table2.setHeaderVisible(true);
table2.setLinesVisible(true);
body.addControlListener(new ResizeTableControlListener(body,table2));
table2.addSelectionListener(new SelectionListener() {
/**
* @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
*/
public void widgetDefaultSelected(SelectionEvent e) {
}
/**
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
public void widgetSelected(SelectionEvent e) {
Object data = e.item.getData();
logger.fine("Slecting data: "+data);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(data);
}
});
// Set the content and label providers
tableViewer.setContentProvider(new ListConverterContentProvider());
tableViewer.setLabelProvider(new DefaultLabelProvider(entry));
//TODO: add renderer support
//Add sort indicator and sort data when column selected
Listener sortListener = new Listener() {
public void handleEvent(Event e) {
// determine new sort column and direction
TableColumn sortColumn = table2.getSortColumn();
TableColumn currentColumn = (TableColumn) e.widget;
int dir = table2.getSortDirection();
if (sortColumn == currentColumn) {
dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
} else {
table2.setSortColumn(currentColumn);
dir = SWT.UP;
}
table2.setSortDirection(dir);
VascEntryField field = (VascEntryField)currentColumn.getData();
entry.getVascFrontendData().getVascFrontendHelper().sortAction(entry, field);
}
};
entry.getVascFrontendData().addVascEntryFrontendEventListener(new VascEntryFrontendEventListener() {
public VascFrontendEventType[] getEventTypes() {
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE};
return result;
}
public void vascEvent(VascEntry entry,Object data) {
tableViewer.refresh();
table2.deselectAll();
}
});
for (VascEntryField c:entry.getVascEntryFields()) {
if (entry.getVascFrontendData().getVascFrontendHelper().renderList(c)==false) {
continue;
}
TableColumn tc = new TableColumn(table2, SWT.LEFT);
tc.setText(i18n(c.getName()));
tc.setData(c);
tc.setToolTipText(i18n(c.getDescription()));
tc.setImage((Image)i18nImage(c.getImage()));
tc.addListener(SWT.Selection, sortListener);
tc.setMoveable(true);
tc.setResizable(true);
}
int totalWidth = entry.getVascFrontendData().getVascFrontendHelper().getTotalColumnsWidth(entry);
logger.finer("Total size: "+totalWidth);
TableColumn[] columns = table2.getColumns();
for (int i = 0; i < columns.length; i++) {
VascEntryField c = (VascEntryField)columns[i].getData();
Integer cWidth = c.getSizeList();
if (cWidth!=null) {
//int w = (int)((double)totalSize/(double)totalSize)*cWidth;
columns[i].setWidth(cWidth);
//logger.finest("Setting column width: "+w+" total: "+totalSize+" c: "+cWidth+" of column: "+i);
} else {
columns[i].pack();
}
}
logger.fine("Table with columns created: "+table2.getColumnCount());
tableViewer.setInput(entry);
tableViewer.refresh();
}
class ResizeTableControlListener implements ControlListener {
Composite comp = null;
Table table = null;
public ResizeTableControlListener(Composite comp,Table table) {
this.comp=comp;
this.table=table;
}
public void controlResized(ControlEvent e) {
Rectangle area = comp.getClientArea();
Point preferredSize = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int width = area.width - 2*table.getBorderWidth();
if (preferredSize.y > area.height + table.getHeaderHeight()) {
// Subtract the scrollbar width from the total column width
// if a vertical scrollbar will be required
Point vBarSize = table.getVerticalBar().getSize();
width -= vBarSize.x;
}
Point oldSize = table.getSize();
if (oldSize.x > area.width) {
// table is getting smaller so make the columns
// smaller first and then resize the table to
// match the client area width
table.setSize(area.width, area.height);
} else {
// table is getting bigger so make the table
// bigger first and then make the columns wider
// to match the client area width
table.setSize(area.width, area.height);
//column1.setWidth(width/3);
//column2.setWidth(width - column1.getWidth());
}
}
public void controlMoved(ControlEvent e) {
}
}
public void createFooter(Composite footer) {
logger.finest("Creating footer");
for( RowVascAction action:entry.getRowActions()) {
if (entry.getVascFrontendData().getVascFrontendHelper().renderRowVascAction(action)==false) {
continue;
}
Button actionButton = new Button(footer, SWT.NONE);
actionButton.setText(i18n(action.getName()));
actionButton.setToolTipText(i18n(action.getDescription()));
actionButton.setImage((Image)i18nImage(action.getImage()));
actionButton.addSelectionListener(new ActionListener(action));
}
}
class ActionListener extends SelectionAdapter {
private RowVascAction action = null;
public ActionListener(RowVascAction action) {
this.action=action;
}
/**
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(SelectionEvent event) {
logger.fine("Row Action");
try {
action.doRowAction(entry, entry.getVascFrontendData().getVascEntryState().getEntryDataObject());
} catch (Exception e) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,e);
}
}
}
class DefaultLabelProvider implements ITableLabelProvider {
private VascEntry entry = null;
public DefaultLabelProvider(VascEntry entry) {
this.entry=entry;
}
/**
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
*/
public Image getColumnImage(Object arg0, int arg1) {
return null;
}
/**
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
*/
public String getColumnText(Object bean, int columnNumber) {
int col=0;
VascEntryField vtc = null;
for (VascEntryField c:entry.getVascEntryFields()) {
if (entry.getVascFrontendData().getVascFrontendHelper().renderList(c)==false) {
continue;
}
if (col==columnNumber) {
vtc = c;
break;
}
col++;
}
if (vtc==null) {
// should not happen
vtc = entry.getVascEntryFields().get(columnNumber);
}
//if (vtc.getVascColumnRenderer()==null) {
try {
return vtc.getVascEntryFieldValue().getDisplayValue(vtc,bean);
} catch (Exception e) {
logger.log(Level.WARNING,"Error in get value: '"+vtc.getVascEntryFieldValue()+"' error: "+e.getMessage(),e);
return "Err";
}
//}
// see custem column renderer, so this code will never be called
//return "CUSTEM_RENDER";
}
/**
* @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
*/
public void addListener(ILabelProviderListener arg0) {
}
/**
* @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
*/
public void dispose() {
}
/**
* @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
*/
public boolean isLabelProperty(Object arg0, String arg1) {
return false;
}
/**
* @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
*/
public void removeListener(ILabelProviderListener arg0) {
}
}
class ListConverterContentProvider implements IStructuredContentProvider {
/**
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
public Object[] getElements(Object obj) {
return ((VascEntry)obj).getVascFrontendData().getVascEntryState().getEntryDataList().toArray();
}
/**
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
public void dispose() {
}
/**
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
}
}
}

View file

@ -1,132 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swt.ui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
*
* @author Willem Cazander
* @version 1.0 Jan 13, 2009
*/
public class SwtBoolean implements VascUIComponent {
private Button button = null;
private Color orgBackgroundColor = null;
private Color errorColor = null;
public Object createComponent(final VascEntry entry,VascEntryField entryField,final VascValueModel model,Object gui) throws VascException {
button = new Button((Composite)gui, SWT.CHECK);
orgBackgroundColor = button.getBackground();
errorColor = new Color(((Composite)gui).getDisplay(),255,0,0);
//button.setImage(getImageDescriptor("vasc.dialog.save.image").createImage());
button.setText("");
Object value = model.getValue();
if (value!=null) {
button.setSelection(new Boolean(model.getValue()+""));
}
//button.setToolTipText(i18n("vasc.dialog.save.tooltip"));
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Boolean value = button.getSelection();
try {
System.out.println("setting value: "+value);
model.setValue(value);
} catch (Exception ee) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee);
}
}
});
return button;
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (button==null) {
return null;
}
return button.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String text) {
if (button==null) {
return;
}
button.setToolTipText(text);
if (text==null) {
button.setBackground(orgBackgroundColor);
} else {
button.setBackground(errorColor);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !button.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
button.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return button.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
button.setVisible(rendered);
}
}

View file

@ -1,121 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swt.ui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
*
* @author Willem Cazander
* @version 1.0 Jan 13, 2009
*/
public class SwtButton implements VascUIComponent {
private Button button = null;
private Color orgBackgroundColor = null;
private Color errorColor = null;
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
button = new Button((Composite)gui, SWT.NONE);
orgBackgroundColor = button.getBackground();
errorColor = new Color(((Composite)gui).getDisplay(),255,0,0);
//button.setImage(getImageDescriptor("vasc.dialog.save.image").createImage());
button.setText(model.getValue()+"");
//button.setToolTipText(i18n("vasc.dialog.save.tooltip"));
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
return button;
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (button==null) {
return null;
}
return button.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String text) {
if (button==null) {
return;
}
button.setToolTipText(text);
if (text==null) {
button.setBackground(orgBackgroundColor);
} else {
button.setBackground(errorColor);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !button.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
button.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return button.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
button.setVisible(rendered);
}
}

View file

@ -1,112 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swt.ui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
*
* @author Willem Cazander
* @version 1.0 Jan 13, 2009
*/
public class SwtLabel implements VascUIComponent {
private Label label = null;
private Color orgBackgroundColor = null;
private Color errorColor = null;
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
label = new Label((Composite)gui, SWT.NONE);
orgBackgroundColor = label.getBackground();
errorColor = new Color(((Composite)gui).getDisplay(),255,0,0);
label.setText(model.getValue()+"");
return label;
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (label==null) {
return null;
}
return label.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String text) {
if (label==null) {
return;
}
label.setToolTipText(text);
if (text==null) {
label.setBackground(orgBackgroundColor);
} else {
label.setBackground(errorColor);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !label.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
label.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return label.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
label.setVisible(rendered);
}
}

View file

@ -1,179 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swt.ui;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascSelectItem;
import com.idcanet.vasc.core.ui.VascSelectItemModel;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
*
* @author Willem Cazander
* @version 1.0 May 10, 2009
*/
public class SwtList implements VascUIComponent {
private Combo combo = null;
private Color orgBackgroundColor = null;
private Color errorColor = null;
private List<VascSelectItem> data = null;
public Object createComponent(final VascEntry entry,VascEntryField entryField,final VascValueModel model,Object gui) throws VascException {
combo = new Combo((Composite)gui,SWT.SINGLE | SWT.BORDER);
combo.setVisibleItemCount(8);
VascSelectItemModel items = (VascSelectItemModel)entryField.getVascEntryFieldType().getDataObject();
if (items!=null) {
data = items.getVascSelectItems(entry);
}
fillCombo();
orgBackgroundColor = combo.getBackground();
errorColor = new Color(((Composite)gui).getDisplay(),255,0,0);
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
VascSelectItem item = findItem(combo.getText());
if (item!=null) {
try {
model.setValue(item.getValue());
} catch (Exception ee) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee);
}
}
}
});
// sets default selected
for (VascSelectItem i:data) {
Object iValue = i.getValue();
Object mValue = model.getValue();
if (iValue==null && mValue==null) {
combo.setText(i.getLabel());
break;
}
if (iValue==null) {
continue;
}
if (iValue.equals(mValue)) {
combo.setText(i.getLabel());
break;
}
}
if (combo.getText()==null) {
combo.setText(data.get(0).getLabel()); // select top one.
}
return combo;
}
private void fillCombo() {
if (data==null | combo==null) {
return;
}
for (VascSelectItem i:data) {
if (i.isDisabled()) {
continue;
}
combo.add(i.getLabel());
}
}
private VascSelectItem findItem(String text) {
for (VascSelectItem i:data) {
if (i.getLabel().equals(text)) {
return i;
}
}
return null;
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (combo==null) {
return null;
}
return combo.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String text) {
if (combo==null) {
return;
}
combo.setToolTipText(text);
if (text==null) {
combo.setBackground(orgBackgroundColor);
} else {
combo.setBackground(errorColor);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !combo.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
combo.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return combo.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
combo.setVisible(rendered);
}
}

View file

@ -1,138 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swt.ui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
* Renders the swt text field.
*
* @author Willem Cazander
* @version 1.0 Jan 13, 2009
*/
public class SwtText implements VascUIComponent {
private Text text = null;
private Color orgBackgroundColor = null;
private Color errorColor = null;
public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
text = new Text((Composite)gui, SWT.NONE | SWT.BORDER);
orgBackgroundColor = text.getBackground();
errorColor = new Color(((Composite)gui).getDisplay(),255,0,0);
Object value = model.getValue();
if (value!=null) {
text.setText(value.toString());
}
text.addModifyListener(new TextListener(model,entry));
return text;
}
class TextListener implements ModifyListener {
private VascValueModel model = null;
private VascEntry entry = null;
public TextListener(VascValueModel model,VascEntry entry) {
this.model=model;
this.entry=entry;
}
public void modifyText(ModifyEvent e) {
Object value = text.getText();
try {
model.setValue(value);
} catch (Exception ee) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee);
}
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (text==null) {
return null;
}
return text.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String textString) {
if (text==null) {
return;
}
text.setToolTipText(textString);
if (textString==null) {
text.setBackground(orgBackgroundColor);
} else {
text.setBackground(errorColor);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !text.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
text.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return text.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
text.setVisible(rendered);
}
}

View file

@ -1,162 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.swt.ui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
*
* @author Willem Cazander
* @version 1.0 Jan 13, 2009
*/
public class SwtTextArea implements VascUIComponent {
private Text text = null;
private Color orgBackgroundColor = null;
private Color errorColor = null;
public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws VascException {
text = new Text((Composite)gui, SWT.MULTI | SWT.BORDER);
orgBackgroundColor = text.getBackground();
errorColor = new Color(((Composite)gui).getDisplay(),255,0,0);
int cols = 25;
int rows = 3;
String colsString = entryField.getVascEntryFieldType().getProperty("editor.columns");
if (colsString!=null && "".equals(colsString)==false) {
cols = new Integer(colsString);
}
String rowsString = entryField.getVascEntryFieldType().getProperty("editor.rows");
if (rowsString!=null && "".equals(rowsString)==false) {
rows = new Integer(rowsString);
}
GC gc = new GC(text);
FontMetrics fm = gc.getFontMetrics ();
gc.dispose ();
int width = cols * fm.getAverageCharWidth();
int height = rows * fm.getHeight();
GridData data = new GridData();
data.widthHint = width;
data.heightHint = height;
text.setLayoutData(data);
Object value = model.getValue();
if (value!=null) {
text.setText(value.toString());
}
text.addModifyListener(new TextListener(model,entry));
return text;
}
class TextListener implements ModifyListener {
private VascValueModel model = null;
private VascEntry entry = null;
public TextListener(VascValueModel model,VascEntry entry) {
this.model=model;
this.entry=entry;
}
public void modifyText(ModifyEvent e) {
Object value = text.getText();
try {
model.setValue(value);
} catch (Exception ee) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee);
}
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
*/
public String getErrorText() {
if (text==null) {
return null;
}
return text.getToolTipText();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
*/
public void setErrorText(String textString) {
if (text==null) {
return;
}
text.setToolTipText(textString);
if (textString==null) {
text.setBackground(orgBackgroundColor);
} else {
text.setBackground(errorColor);
}
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled()
*/
public boolean isDisabled() {
return !text.isEnabled();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean)
*/
public void setDisabled(boolean disabled) {
text.setEnabled(!disabled);
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered()
*/
public boolean isRendered() {
return text.isVisible();
}
/**
* @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean)
*/
public void setRendered(boolean rendered) {
text.setVisible(rendered);
}
}

View file

@ -1,69 +0,0 @@
/**
*
*/
package com.idcanet.vasc.frontends.web.jsf;
import java.util.ArrayList;
import java.util.List;
import javax.el.ValueExpression;
import javax.faces.context.FacesContext;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
/**
* @author willemc
*
*/
public class JSFVascEntryEventListener implements VascEntryFrontendEventListener {
private static final long serialVersionUID = 1765054259934158076L;
private String entrySupportVar = null;
public JSFVascEntryEventListener(String entrySupportVar) {
this.entrySupportVar=entrySupportVar;
}
/**
* @see com.idcanet.vasc.core.entry.VascEntryFrontendEventListener#getEventTypes()
*/
public VascFrontendEventType[] getEventTypes() {
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE};
return result;
}
public void vascEvent(VascEntry entry,Object dataNotUsed) {
try {
for (VascEntryField field:entry.getVascEntryFields()) {
if (field.getVascEntryFieldValue()==null) {
// TODO: fix this for better remote support
VascEntryField fieldClone = field.clone();
fieldClone.getVascValidators().clear();
VascEntryFieldValue v = entry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(fieldClone);
field.setVascEntryFieldValue(v);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
List<Object> data = entry.getVascFrontendData().getVascEntryState().getEntryDataList();
List<Object> result = new ArrayList<Object>(data.size());
int index = 0;
for (Object o:data) {
VascDataBackendBean b = new VascDataBackendBean(entry,o,index);
result.add(b);
index++;
}
ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".tableDataModel.wrappedData}", Object.class);
ve2.setValue(FacesContext.getCurrentInstance().getELContext(), result);
ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".tablePagesDataModel.wrappedData}", Object.class);
ve3.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getVascFrontendData().getVascFrontendHelper().getVascBackendPageNumbers(entry));
}
}

View file

@ -1,136 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.web.jsf;
import java.io.Serializable;
import java.util.logging.Logger;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import com.idcanet.vasc.core.AbstractVascFrontend;
import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.core.entry.VascEntryExporter;
import com.idcanet.vasc.frontends.web.jsf.ui.JSFBoolean;
import com.idcanet.vasc.frontends.web.jsf.ui.JSFLabel;
import com.idcanet.vasc.frontends.web.jsf.ui.JSFList;
import com.idcanet.vasc.frontends.web.jsf.ui.JSFText;
import com.idcanet.vasc.frontends.web.jsf.ui.JSFTextArea;
/**
* Given the jsf vasc renderer its own class
*
*
* @author Willem Cazander
* @version 1.0 Nov 12, 2009
*/
public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Serializable {
private static final long serialVersionUID = 1L;
private Logger logger = null;
public JSFVascFrontendRenderer() {
logger = Logger.getLogger(JSFVascFrontendRenderer.class.getName());
}
// Frontend Stuff
protected void addUiComponents() {
VascFrontendData vfd = getVascEntry().getVascFrontendData();
// required UI components
vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_LABEL,JSFLabel.class.getName());
vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_TEXT, JSFText.class.getName());
vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_LIST, JSFList.class.getName());
//vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_BUTTON, JSFButton.class.getName());
// optional UI components
vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_BOOLEAN , JSFBoolean.class.getName());
//vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_DATE , JSFDate.class.getName());
vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_TEXTAREA , JSFTextArea.class.getName());
//vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_COLOR , JSFColorChooser.class.getName());
}
/**
* @see com.idcanet.vasc.core.VascFrontend#renderDelete(java.lang.Object)
*/
public void renderDelete() throws Exception {
logger.finer("renderDelete");
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId());
comp.setRenderFacetState("deleteView");
}
/**
* @see com.idcanet.vasc.core.VascFrontend#renderEdit(java.lang.Object)
*/
public void renderEdit() throws Exception {
logger.finer("renderEdit");
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId());
comp.setRenderFacetState("editView");
entry.getVascFrontendData().getVascFrontendHelper().editReadOnlyUIComponents(entry);
VascDataBackendBean selBean = null;
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
int index = entry.getVascFrontendData().getVascEntryState().getEntryDataList().size()+1;
selBean = new VascDataBackendBean(entry,entry.getVascFrontendData().getVascEntryState().getEntryDataObject(),index);
} else {
selBean = comp.getSupportBean().getSelectedTableRecord();
}
selBean.setRealValue(true);
comp.getSupportBean().setSelected(selBean);
}
/**
* @see com.idcanet.vasc.core.VascFrontend#renderExport(com.idcanet.vasc.core.entry.VascEntryExporter)
*/
public void renderExport(VascEntryExporter exporter) throws Exception {
logger.finer("renderExport");
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId());
comp.setRenderFacetState("exportView");
comp.getSupportBean().setSelectedExporter(exporter);
}
/**
* @see com.idcanet.vasc.core.VascFrontend#renderView()
*/
public void renderView() throws Exception {
logger.finer("renderView");
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId());
comp.setRenderFacetState("listView");
//if (comp.getSupportBean().getSelected()!=null) {
// comp.getSupportBean().getSelected().setRealValue(false);
// comp.getSupportBean().setSelected(null);
//}
}
}

View file

@ -1,423 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.web.jsf;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Logger;
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryState;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.core.VascLinkEntry;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
import com.idcanet.vasc.frontends.web.jsf.ui.JSFListModel;
import com.idcanet.vasc.impl.DefaultVascFactory;
/**
* Renders an JSF vasc entry views.
*
* This is a bit hacky because I'm not a JSF guro.
*
* @author Willem Cazander
* @version 1.0 Nov 16, 2008
*/
public class JSFVascUIComponent extends UIComponentBase {
public static final String FAMILY = "vasc.jsf.component.family";
public static final String VASC_CONTROLLER_KEY = "vascController";
public static final String VASC_FRONTEND_DATA_KEY = "vascFrontendData";
public static final String ENTRY_NAME_KEY = "entryName";
public static final String ENTRY_SUPPORT_VAR_KEY = "entrySupportVar";
public static final String TABLE_RECORD_VAR_KEY = "tableRecordVar";
public static final String INJECT_EDIT_FIELDS_ID = "injectEditFieldsId";
public static final String INJECT_TABLE_OPTIONS_ID = "injectTableOptionsId";
public static final String INJECT_TABLE_COLUMNS_ID = "injectTableColumnsId";
public static final String DISABLE_LINK_COLUMNS = "disableLinkColumns";
private JSFVascFrontendRenderer renderer = null;
private JSFVascEntrySupportBean supportBean = null;
private String renderFacetState = null;
private VascLinkEntry link = null;
private VascEntryState linkState = null;
private VascEntryState state = null;
private Object stateEditId = null;
private Logger logger = null;
private Boolean initClear = null;
public JSFVascUIComponent() {
logger = Logger.getLogger(JSFVascUIComponent.class.getName());
}
public String getFamily() {
return FAMILY;
}
@Override
public Object saveState(FacesContext facesContext) {
logger.fine("Save State");
Object values[] = new Object[7];
values[0] = super.saveState(facesContext);
values[1] = this.getAttributes().get(VASC_CONTROLLER_KEY);
values[2] = this.getAttributes().get(VASC_FRONTEND_DATA_KEY);
values[3] = this.getAttributes().get(ENTRY_NAME_KEY);
values[4] = renderer;
values[5] = supportBean;
values[6] = renderFacetState;
return values;
}
@Override
public void restoreState(FacesContext facesContext, Object state) {
logger.fine("Resotre State");
Object values[] = (Object[])state;
super.restoreState(facesContext, values[0]);
this.getAttributes().put(VASC_CONTROLLER_KEY, values[1]);
this.getAttributes().put(VASC_FRONTEND_DATA_KEY, values[2]);
this.getAttributes().put(ENTRY_NAME_KEY, values[3]);
renderer = (JSFVascFrontendRenderer) values[4];
supportBean = (JSFVascEntrySupportBean) values[5];
renderFacetState = (String) values[6];
// TODO: check if we can move this some day...
String entrySupportVar = (String)getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY);
ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+"}", Object.class);
ve2.setValue(FacesContext.getCurrentInstance().getELContext(), getSupportBean());
}
static public JSFVascUIComponent findVascParent(UIComponent comp) {
if (comp==null) {
return null;
}
if (comp instanceof JSFVascUIComponent) {
return (JSFVascUIComponent)comp;
}
return findVascParent(comp.getParent());
}
static public JSFVascUIComponent findVascChild(UIComponent comp,String entryId) {
if (comp==null) {
return null;
}
if (comp instanceof JSFVascUIComponent) {
JSFVascUIComponent ui = (JSFVascUIComponent)comp;
if (entryId==null) {
return ui;
}
if (entryId.equals(ui.getVascEntry().getId())) {
return ui;
}
return null; // this is a other entry on this view
}
for (UIComponent c:comp.getChildren()) {
Object res = findVascChild(c,entryId);
if (res!=null) {
return (JSFVascUIComponent)res; // found
}
}
return null;
}
/**
* Finds component with the given id
*/
static public UIComponent findComponentById(UIComponent c, String id) {
if (id.equals(c.getId())) {
return c;
}
Iterator<UIComponent> kids = c.getFacetsAndChildren();
while (kids.hasNext()) {
UIComponent found = findComponentById(kids.next(), id);
if (found != null) {
return found;
}
}
return null;
}
public VascEntry getVascEntry() {
return renderer.getVascEntry();
}
protected void initGoto(VascLinkEntry link) {
logger.fine("init goto "+link);
this.link=link;
}
protected void initGoto(VascLinkEntry link,VascEntryState state) {
logger.fine("init goto link: "+link);
this.link=link;
this.linkState=state;
}
protected void initGoto(VascEntryState state) {
logger.fine("init goto "+state);
this.state=state;
}
protected void initGoto(VascEntryState state,Object stateEditId) {
logger.fine("init goto "+state);
this.state=state;
this.stateEditId=stateEditId;
}
public Boolean getInitClear() {
return initClear;
}
@Override
public void encodeBegin(FacesContext context) throws IOException {
logger.fine("Comp encodeBegin link: "+link);
// no need to add multiple
if (renderer==null) {
logger.finer("Adding phase listener: JSFVascValidatePhaseListener");
context.getViewRoot().addPhaseListener(new JSFVascValidatePhaseListener());
}
boolean init = false;
if (renderer==null | link!=null | state!=null) {
renderFacetState = "listView";
VascEntry entry = createClonedVascEntry();
renderer = new JSFVascFrontendRenderer();
try {
renderer.initEntry(entry);
} catch (Exception e) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
}
supportBean = new JSFVascEntrySupportBean(entry);
// copy search string for preadded search string from application layer
supportBean.setSearchString(entry.getVascFrontendData().getVascEntryState().getVascBackendState().getSearchString());
init = true;
}
if (stateEditId!=null) {
Object rowObject = stateEditId;
// setup for renderEdit() of frontend
List<Object> list = new ArrayList<Object>(1);
list.add(new VascDataBackendBean(supportBean.getVascEntry(),rowObject,0));
supportBean.getTableDataModel().setWrappedData(list);
supportBean.getTableDataModel().setRowIndex(0);
// edit action copyed
try {
VascEntry entry = supportBean.getVascEntry();
entry.getVascFrontendData().getVascEntryState().setEditCreate(false);
entry.getVascFrontendData().getVascFrontendHelper().fireVascEvent(entry, VascFrontendEventType.DATA_SELECT, rowObject);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(rowObject);
entry.getVascFrontendData().getVascFrontend().renderEdit();
} catch (Exception e) {
e.printStackTrace();
}
}
// refresh all drop down lists..
for (String key:supportBean.getEditSelectItemModels().keySet()) {
Object o = supportBean.getEditSelectItemModels().get(key);
if (o instanceof JSFListModel) {
JSFListModel t = (JSFListModel)o;
t.requestRefresh();
}
}
// set the support bean
String entrySupportVar = (String)getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY);
ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+"}", Object.class);
ve2.setValue(FacesContext.getCurrentInstance().getELContext(), getSupportBean());
// set init for component renderer
if (init) {
initClear = false;
if (link!=null | state!=null) {
initClear = true;
}
}
super.encodeBegin(context);
}
public UIComponent getCurrentView() {
UIComponent result = getFacet(renderFacetState);
if (result==null) {
throw new IllegalArgumentException("Could not get facet: "+renderFacetState);
}
return result;
}
public JSFVascEntrySupportBean getSupportBean() {
return supportBean;
}
public void setRenderFacetState(String renderFacetState) {
this.renderFacetState=renderFacetState;
}
public String getRenderFacetState() {
return renderFacetState;
}
public VascEntry createClonedVascEntry() {
String entryName = null;
VascController vascController = null;
VascFrontendData frontendData = null;
if (getAttributes().get(VASC_CONTROLLER_KEY) instanceof String) {
// fix for JSP tag handler
logger.finer("Getting expression: "+getAttributes().get(VASC_CONTROLLER_KEY));
ValueExpression ve1 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), (String)getAttributes().get(VASC_CONTROLLER_KEY), Object.class);
ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), (String)getAttributes().get(VASC_FRONTEND_DATA_KEY), Object.class);
ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), (String)getAttributes().get(ENTRY_NAME_KEY), String.class);
vascController = (VascController)ve1.getValue( FacesContext.getCurrentInstance().getELContext());
frontendData = (VascFrontendData)ve2.getValue( FacesContext.getCurrentInstance().getELContext());
entryName = (String)ve3.getValue( FacesContext.getCurrentInstance().getELContext());
} else {
vascController = (VascController)getAttributes().get(VASC_CONTROLLER_KEY);
frontendData = (VascFrontendData)getAttributes().get(VASC_FRONTEND_DATA_KEY);
entryName = (String)getAttributes().get(ENTRY_NAME_KEY);
}
if (link!=null) {
entryName = link.getVascEntryId();
}
if (state!=null) {
entryName = state.getVascEntry().getId();
}
VascEntry entry = vascController.getVascEntryController().getVascEntryById(entryName);
if (entry==null) {
throw new NullPointerException("Could not locate '"+entryName+"' from : "+vascController);
}
frontendData.setVascController(vascController);
entry.setVascFrontendData(frontendData);
try {
frontendData.initFrontendListeners(entry);
} catch (InstantiationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalAccessException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
VascBackend backend = DefaultVascFactory.getProxyVascBackend(entry);
frontendData.getVascEntryState().setVascBackend(backend);
frontendData.getVascEntryState().setVascEntry(entry);
if (state!=null) {
// copy prevois parent
frontendData.getVascEntryState().setParent(state.getParent());
}
if (link!=null) {
// save state
if (linkState==null) {
frontendData.getVascEntryState().setParent(getVascEntry().getVascFrontendData().getVascEntryState());
} else {
frontendData.getVascEntryState().setParent(linkState);
}
// Set parameters
try {
Object selected = getSupportBean().getSelected().getRecord();
for (String parameterName:link.getEntryParameterFieldIdKeys()) {
String fieldId = link.getEntryParameterFieldId(parameterName);
VascEntryField v = getVascEntry().getVascEntryFieldById(fieldId);
if (v==null) {
logger.warning("Could nog get VascEntryField for fieldID: "+fieldId);
continue;
}
if (v.getVascEntryFieldValue()==null) {
logger.warning("Could not get VascEntryFieldValue for fieldID: "+fieldId);
continue;
}
Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected);
// set data parameter on new vasc entry
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue);
logger.fine("Setting link parameter: "+parameterName+" with: "+selectedValue);
}
for (String fieldId:link.getEntryCreateFieldValueKeys()) {
String selectedfieldId = link.getEntryParameterFieldId(fieldId);
Object selectedValue = selected;
if (selectedfieldId!=null) {
VascEntryField v = getVascEntry().getVascEntryFieldById(selectedfieldId);
selectedValue = v.getVascEntryFieldValue().getValue(v, selected);
}
// create listener for new objects
entry.getVascFrontendData().addVascEntryFrontendEventListener(new CreateEntryFieldValuesListener2(fieldId,selectedValue));
}
} catch (Exception e) {
e.printStackTrace();
}
}
String entrySupportVar = (String)getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY);
entry.getVascFrontendData().addVascEntryFrontendEventListener(new JSFVascEntryEventListener(entrySupportVar));
return entry;
}
class CreateEntryFieldValuesListener2 implements VascEntryFrontendEventListener {
private static final long serialVersionUID = 1L;
private String fieldId = null;
private Object value = null;
public CreateEntryFieldValuesListener2(String fieldId,Object value) {
if (fieldId==null) {
throw new NullPointerException("fieldId may not be null");
}
this.fieldId=fieldId;
this.value=value;
}
public VascFrontendEventType[] getEventTypes() {
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.DATA_CREATE};
return result;
}
public void vascEvent(VascEntry entry,Object data) {
VascEntryField field = entry.getVascEntryFieldById(fieldId);
try {
field.getVascEntryFieldValue().setValue(field, data, value);
} catch (VascException e) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
}
}
}
}

View file

@ -1,531 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.web.jsf;
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.util.List;
import java.util.logging.Logger;
import javax.el.ELContext;
import javax.el.MethodExpression;
import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.application.Application;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.component.UIOutput;
import javax.faces.component.UIViewRoot;
import javax.faces.component.html.HtmlCommandLink;
import javax.faces.component.html.HtmlMessage;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.component.html.HtmlSelectBooleanCheckbox;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import javax.faces.event.MethodExpressionActionListener;
import javax.faces.event.ValueChangeEvent;
import javax.faces.event.ValueChangeListener;
import javax.faces.render.Renderer;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascLinkEntry;
import com.idcanet.vasc.core.VascLinkEntryType;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.ui.VascOptionValueModelListener;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
import com.idcanet.vasc.impl.actions.AddRowAction;
/**
* Renders an JSF vasc entry views.
*
* This is a bit hacky because I'm not a JSF guro.
*
* @author Willem Cazander
* @version 1.0 Nov 16, 2008
*/
public class JSFVascUIComponentRenderer extends Renderer {
private Logger logger = null;
public JSFVascUIComponentRenderer() {
logger = Logger.getLogger(JSFVascUIComponentRenderer.class.getName());
}
@Override
public void encodeBegin(FacesContext facesContext,UIComponent component) throws IOException {
super.encodeBegin(facesContext, component);
ResponseWriter writer = facesContext.getResponseWriter();
JSFVascUIComponent comp = (JSFVascUIComponent)component;
logger.fine("renderen encodeBegin for: "+comp.getRenderFacetState());
writer.startElement("div", component);
//String styleClass = (String)attributes.get(Shuffler.STYLECLASS_ATTRIBUTE_KEY);
//writer.writeAttribute("class", styleClass, null);
// check if injection is needed
if (comp.getInitClear()!=null) {
injectAll(facesContext,comp,comp.getInitClear());
// hack for edit back action to set field disabled
VascEntry entry = comp.getVascEntry();
entry.getVascFrontendData().getVascFrontendHelper().editReadOnlyUIComponents(entry);
}
// render the current facet of the vasc component
UIComponent view = comp.getCurrentView();
view.encodeAll(facesContext);
}
@Override
public void encodeEnd(FacesContext facesContext,UIComponent component) throws IOException {
ResponseWriter writer = facesContext.getResponseWriter();
writer.endElement("div");
}
// ========== All private
private void injectAll(FacesContext context,JSFVascUIComponent comp,boolean clean) {
String injectEditFieldsId = (String)comp.getAttributes().get(JSFVascUIComponent.INJECT_EDIT_FIELDS_ID);
String injectTableOptionsId = (String)comp.getAttributes().get(JSFVascUIComponent.INJECT_TABLE_OPTIONS_ID);
String injectTableColumnsId = (String)comp.getAttributes().get(JSFVascUIComponent.INJECT_TABLE_COLUMNS_ID);
UIComponent injectEditFieldsComponent = JSFVascUIComponent.findComponentById(comp.getFacet("editView"),injectEditFieldsId);
UIComponent injectTableOptionsComponent = JSFVascUIComponent.findComponentById(comp.getFacet("listView"),injectTableOptionsId);
UIComponent injectTableColumnsComponent = JSFVascUIComponent.findComponentById(comp.getFacet("listView"),injectTableColumnsId);
if (injectEditFieldsComponent==null) {
throw new NullPointerException("Could not find injectEditFieldsId: "+injectEditFieldsId);
}
if (injectTableOptionsComponent==null) {
throw new NullPointerException("Could not find injectTableOptionsId: "+injectTableOptionsId);
}
if (injectTableColumnsComponent==null) {
throw new NullPointerException("Could not find injectTableColumnsId: "+injectTableColumnsId);
}
if (clean) {
logger.finer("Cleaning of all dynamic JSF components.");
injectEditFieldsComponent.getChildren().clear();
injectTableOptionsComponent.getChildren().clear();
injectTableColumnsComponent.getChildren().clear();
}
logger.finer("Injection of all dynamic JSF components.");
try {
addEditFields(context, injectEditFieldsComponent);
addTableOptions(context, injectTableOptionsComponent);
addColumns(context,comp,injectTableColumnsComponent );
} catch (Exception e) {
throw new RuntimeException("Error while injecting; "+e.getMessage(),e);
}
}
private String i18n(VascEntry entry,String key,Object...params) {
return entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(key,params);
}
private void addEditFields(FacesContext fc,UIComponent grid) throws FacesException, VascException {
Application application = fc.getApplication();
UIViewRoot viewRoot = fc.getViewRoot();
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(grid);
VascEntry entry = comp.getVascEntry();
String entrySupportVar = (String)comp.getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY);
int column = 0;
for (VascEntryField c:entry.getVascEntryFields()) {
if (entry.getVascFrontendData().getVascFrontendHelper().renderEdit(c)==false) {
continue;
}
//System.out.println("Multi edit size: "+c.getVascEntryFieldType().getUIComponentCount(c)+" of: "+c.getVascEntryFieldType());
for (int i=0;i<c.getVascEntryFieldType().getUIComponentCount(c);i++) {
VascUIComponent label = c.getVascEntryFieldType().provideLabelUIComponent(i,c);
VascValueModel model = new VascValueModel();
model.setValue(i18n(entry,c.getName()));
label.createComponent(entry,c,model,grid);
VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c);
model = new VascValueModel(c.getVascEntryFieldType().provideEditorVascValueModel(i,c));
//model.setValue(c.getVascEntryFieldValue().getValue(c, bean));
//model.addListener(new VascColumnValueModelListener(c,bean));
UIInput jsfEdit = (UIInput)editor.createComponent(entry,c,model,grid);
jsfEdit.addValidator(new VascJSFInputValidator2(c.getId()));
int index = VascDataBackendBean.getIndexId(c);
ValueExpression ve7 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".selected.field"+index+"}", Object.class);
jsfEdit.setValueExpression("value", ve7);
ValueExpression ve8 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".selected != null}", Boolean.class);
jsfEdit.setValueExpression("rendered", ve8);
HtmlMessage message = (HtmlMessage)application.createComponent(HtmlMessage.COMPONENT_TYPE);
message.setId(viewRoot.createUniqueId());
message.setFor(jsfEdit.getId());
message.setErrorClass("style_textBlue");
message.setFatalClass("style_textRed");
message.setInfoClass("style_textBlack");
message.setWarnClass("style_textGreen");
grid.getChildren().add(message);
column++;
// i==0 is for multi field editor support... which is still very in progress
if (i==0) {
entry.getVascFrontendData().addFieldVascUIComponents(c, editor,jsfEdit);
}
}
}
}
class VascJSFInputValidator2 implements Validator,Serializable {
private static final long serialVersionUID = -5715250529474737642L;
private Logger logger = null;
private String fieldId = null;
public VascJSFInputValidator2(String fieldId) {
this.fieldId=fieldId;
logger = Logger.getLogger(VascJSFInputValidator2.class.getName());
}
public void validate(FacesContext context, UIComponent component,Object object) throws ValidatorException {
// always oke, we are runned by phase listener
}
public void validatePhase(FacesContext context, UIComponent component,Object object) throws ValidatorException {
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(component);
VascEntry entry = comp.getVascEntry();
StringBuffer buf;
try {
VascEntryField field = entry.getVascEntryFieldById(fieldId);
int index = VascDataBackendBean.getIndexId(field);
String entrySupportVar = (String)comp.getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY);
logger.fine("sup-sel: "+comp.getSupportBean().getSelected()+" index: "+index);
// note we have to set the value to the vasc backend before we can run validation
ValueExpression ve7 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".selected.field"+index+"}", Object.class);
ve7.setValue(FacesContext.getCurrentInstance().getELContext(), object);
List<String> errors = entry.getVascFrontendData().getVascFrontendHelper().validateObjectField(field);
logger.fine("Validate: "+component+" errors: "+errors.size()+" value: "+object);
if (errors.isEmpty()) {
return; // no errors
}
buf = new StringBuffer(200);
for (String err:errors) {
buf.append(err);
buf.append('\n');
}
} catch (Exception e) {
e.printStackTrace();
return;
}
FacesMessage message = new FacesMessage(buf.toString());
message.setSeverity(FacesMessage.SEVERITY_ERROR);
throw new ValidatorException(message);
}
}
private void addTableOptions(FacesContext fc,UIComponent grid) throws FacesException, VascException {
//Application application = fc.getApplication();
//UIViewRoot viewRoot = fc.getViewRoot();
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(grid);
VascEntry entry = comp.getVascEntry();
for (VascEntryField option:entry.getListOptions()) {
for (int i=0;i<option.getVascEntryFieldType().getUIComponentCount(option);i++) {
VascUIComponent label = option.getVascEntryFieldType().provideLabelUIComponent(i,option);
VascValueModel model = new VascValueModel();
model.setValue(i18n(entry,option.getName()));
label.createComponent(entry,option,model,grid);
VascUIComponent editor = option.getVascEntryFieldType().provideEditorUIComponent(i,option);
model = new VascValueModel(option.getVascEntryFieldType().provideEditorVascValueModel(i,option));
model.addListener(new VascOptionValueModelListener(option));
model.setValue(option.getDefaultValue());
UIInput jsfEdit = (UIInput)editor.createComponent(entry,option,model,grid);
jsfEdit.addValueChangeListener(new ModelChangeListener(model));
Class<?> clazz = option.getVascEntryFieldType().getAutoDetectClass();
if (clazz!=null && model.getValue()!=null) {
if (clazz.equals(model.getValue().getClass())==false) {
// lets try setting correct default.
try {
Constructor<?> c = clazz.getConstructor(String.class);
Object value = c.newInstance(model.getValue());
jsfEdit.setValue(value);
} catch (Exception e) {
throw new VascException(e);
}
} else {
jsfEdit.setValue(model.getValue()); // set default value
}
}
// i==0 is for multi field editor support... which is stell very in progress aka not working
if (i==0) {
entry.getVascFrontendData().addFieldVascUIComponents(option, editor,jsfEdit);
}
}
}
entry.getVascFrontendData().getVascFrontendHelper().headerOptionsCreatedFillData(entry);
}
public class ModelChangeListener implements ValueChangeListener,Serializable {
private static final long serialVersionUID = 1L;
VascValueModel model;
public ModelChangeListener(VascValueModel model) {
this.model=model;
}
public void processValueChange(ValueChangeEvent event) throws AbortProcessingException {
try {
model.setValue(event.getNewValue());
} catch (VascException e) {
throw new AbortProcessingException(e);
}
}
}
private void addColumns(FacesContext fc,JSFVascUIComponent comp,UIComponent table) {
Application application = fc.getApplication();
UIViewRoot viewRoot = fc.getViewRoot();
VascEntry entry = comp.getVascEntry();
String entrySupportVar = (String)comp.getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY);
String tableRecordVar = (String)comp.getAttributes().get(JSFVascUIComponent.TABLE_RECORD_VAR_KEY);
if (!entry.getVascFrontendData().getVascFrontendHelper().getMultiRowActions(entry).isEmpty()) {
UIColumn colUp = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE);
colUp.setId(viewRoot.createUniqueId());
/*
// Select box head in table
HtmlCommandLink selectAll = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
selectAll.setId(viewRoot.createUniqueId());
selectAll.setType("selectAll");
MethodExpression actionExpression = getMethodExpression("#{"+entrySupportVar+".selectAllAction}");
MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(actionExpression);
selectAll.addActionListener(meActionListener);
HtmlOutputText orderUp = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
orderUp.setId(viewRoot.createUniqueId());
orderUp.setEscape(false);
orderUp.setValue("selectAll");
selectAll.getChildren().add(orderUp);
colUp.setHeader(selectAll);
*/
HtmlSelectBooleanCheckbox select = (HtmlSelectBooleanCheckbox)application.createComponent(HtmlSelectBooleanCheckbox.COMPONENT_TYPE);
select.setId(viewRoot.createUniqueId());
select.setStyleClass("js_table_select_all");
ValueExpression ve1 = application.getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(),"#{"+entrySupportVar+".vascEntry.vascFrontendData.vascEntryState.multiActionSelection["+tableRecordVar+".recordId]}",Object.class);
select.setValueExpression("value", ve1);
colUp.getChildren().add(select);
table.getChildren().add(colUp);
}
for (VascEntryField c:entry.getVascEntryFields()) {
if (entry.getVascFrontendData().getVascFrontendHelper().renderList(c)==false) {
continue;
}
UIColumn col = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE);
col.setId(viewRoot.createUniqueId());
HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
link.setId(viewRoot.createUniqueId());
link.setType(c.getId());
MethodExpression actionExpression = getMethodExpression("#{"+entrySupportVar+".sortAction}");
MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(actionExpression);
link.addActionListener(meActionListener);
HtmlOutputText out2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
out2.setId(viewRoot.createUniqueId());
out2.setEscape(false);
out2.setValue(i18n(entry,c.getName())+"&nbsp;");
HtmlOutputText orderUp = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
orderUp.setId(viewRoot.createUniqueId());
orderUp.setEscape(false);
orderUp.setValue("&#x2191;"); //
ValueExpression ren2 = application.getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".sortOrder==true and "+entrySupportVar+".sortField=='"+c.getId()+"'}", Boolean.class);
orderUp.setValueExpression("rendered", ren2);
HtmlOutputText orderDown = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
orderDown.setId(viewRoot.createUniqueId());
orderDown.setEscape(false);
orderDown.setValue("&#x2193;"); //
ValueExpression ren3 = application.getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".sortOrder==false and "+entrySupportVar+".sortField=='"+c.getId()+"'}", Boolean.class);
orderDown.setValueExpression("rendered", ren3);
link.getChildren().add(out2);
link.getChildren().add(orderUp);
link.getChildren().add(orderDown);
col.setHeader(link);
HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
out.setId(viewRoot.createUniqueId());
int index = VascDataBackendBean.getIndexId(c);
ValueExpression ve1 = application.getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(),"#{"+tableRecordVar+".field"+index+"}",Object.class);
out.setValueExpression("value", ve1);
col.getChildren().add(out);
table.getChildren().add(col);
}
if (entry.getVascFrontendData().getVascEntryState().getVascBackend().isRecordMoveable()) {
UIColumn colUp = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE);
colUp.setId(viewRoot.createUniqueId());
HtmlCommandLink linkUp = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
linkUp.setId(viewRoot.createUniqueId());
linkUp.setType("up");
MethodExpression actionExpression = getMethodExpression("#{"+entrySupportVar+".moveAction}");
MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(actionExpression);
linkUp.addActionListener(meActionListener);
HtmlOutputText orderUp = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
orderUp.setId(viewRoot.createUniqueId());
orderUp.setEscape(false);
orderUp.setValue("&#x2191;&nbsp;up"); //
linkUp.getChildren().add(orderUp);
colUp.getChildren().add(linkUp);
table.getChildren().add(colUp);
HtmlCommandLink linkDown = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
linkDown.setId(viewRoot.createUniqueId());
linkDown.setType("down");
MethodExpression actionExpression2 = getMethodExpression("#{"+entrySupportVar+".moveAction}");
MethodExpressionActionListener meActionListener2 = new MethodExpressionActionListener(actionExpression2);
linkDown.addActionListener(meActionListener2);
UIColumn colDown = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE);
colDown.setId(viewRoot.createUniqueId());
HtmlOutputText orderDown = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
orderDown.setId(viewRoot.createUniqueId());
orderDown.setEscape(false);
orderDown.setValue("&#x2193;&nbsp;down"); //
linkDown.getChildren().add(orderDown);
colDown.getChildren().add(linkDown);
table.getChildren().add(colDown);
}
for (VascLinkEntry vascLink:entry.getVascFrontendData().getVascFrontendHelper().getVascLinkEntryByType(entry, VascLinkEntryType.LIST)) {
UIColumn col = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE);
col.setId(viewRoot.createUniqueId());
UIOutput colHeader = (UIOutput)application.createComponent(UIOutput.COMPONENT_TYPE);
colHeader.setId(viewRoot.createUniqueId());
colHeader.setValue("link");
col.setHeader(colHeader);
HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
link.setId(viewRoot.createUniqueId());
link.setType(vascLink.getId());
MethodExpression actionExpression = getMethodExpression("#{"+entrySupportVar+".linkAction}");
MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(actionExpression);
link.addActionListener(meActionListener);
HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
out.setId(viewRoot.createUniqueId());
out.setValue(i18n(entry,vascLink.getName()));
link.getChildren().add(out);
col.getChildren().add(link);
table.getChildren().add(col);
}
for (RowVascAction action:entry.getRowActions()) {
if (entry.getVascFrontendData().getVascFrontendHelper().renderRowVascAction(action)==false) {
continue;
}
if (AddRowAction.ACTION_ID.equals(action.getId())) {
continue;
}
UIColumn col = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE);
col.setId(viewRoot.createUniqueId());
UIOutput colHeader = (UIOutput)application.createComponent(UIOutput.COMPONENT_TYPE);
colHeader.setId(viewRoot.createUniqueId());
colHeader.setValue(i18n(entry,action.getName()));
col.setHeader(colHeader);
HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
link.setId(viewRoot.createUniqueId());
link.setType(action.getId());
MethodExpression actionExpression = getMethodExpression("#{"+entrySupportVar+".rowAction}");
MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(actionExpression);
link.addActionListener(meActionListener);
HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
out.setId(viewRoot.createUniqueId());
out.setValue(i18n(entry,action.getName()));
link.getChildren().add(out);
col.getChildren().add(link);
table.getChildren().add(col);
}
}
private MethodExpression getMethodExpression(String name) {
Class<?>[] argtypes = new Class[1];
argtypes[0] = ActionEvent.class;
FacesContext facesCtx = FacesContext.getCurrentInstance();
ELContext elContext = facesCtx.getELContext();
return facesCtx.getApplication().getExpressionFactory().createMethodExpression(elContext, name, null, argtypes);
}
};

View file

@ -1,232 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.web.jsf;
import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.webapp.UIComponentELTag;
/**
*
*
* @author Willem Cazander
* @version 1.0 Nov 16, 2008
*/
public class JSFVascUIComponentTag extends UIComponentELTag {
public static final String COMPONENT_TYPE = "vasc.jsf.component";
public static final String RENDERER_TYPE = "vasc.jsf.component.renderer";
private ValueExpression vascController = null;
private ValueExpression vascFrontendData = null;
private ValueExpression entryName = null;
private ValueExpression entrySupportVar = null;
private ValueExpression tableRecordVar = null;
private ValueExpression injectEditFieldsId = null;
private ValueExpression injectTableOptionsId = null;
private ValueExpression injectTableColumnsId = null;
private ValueExpression disableLinkColumns = null;
@Override
public String getComponentType() {
return COMPONENT_TYPE;
}
@Override
public String getRendererType() {
return RENDERER_TYPE;
}
/**
* @see javax.faces.webapp.UIComponentELTag#setProperties(javax.faces.component.UIComponent)
*/
@Override
protected void setProperties(UIComponent component) {
super.setProperties(component);
processProperty(component, vascController, JSFVascUIComponent.VASC_CONTROLLER_KEY);
processProperty(component, vascFrontendData, JSFVascUIComponent.VASC_FRONTEND_DATA_KEY);
processProperty(component, entryName, JSFVascUIComponent.ENTRY_NAME_KEY);
processProperty(component, entrySupportVar, JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY);
processProperty(component, tableRecordVar, JSFVascUIComponent.TABLE_RECORD_VAR_KEY);
processProperty(component, injectEditFieldsId, JSFVascUIComponent.INJECT_EDIT_FIELDS_ID);
processProperty(component, injectTableOptionsId,JSFVascUIComponent.INJECT_TABLE_OPTIONS_ID);
processProperty(component, injectTableColumnsId,JSFVascUIComponent.INJECT_TABLE_COLUMNS_ID);
processProperty(component, disableLinkColumns ,JSFVascUIComponent.DISABLE_LINK_COLUMNS);
}
public void release() {
super.release();
vascController = null;
vascFrontendData = null;
entryName = null;
entrySupportVar = null;
tableRecordVar = null;
injectEditFieldsId = null;
injectTableOptionsId = null;
injectTableColumnsId = null;
disableLinkColumns = null;
}
protected final void processProperty(final UIComponent component, final ValueExpression property,final String propertyName) {
if (property != null) {
if(property.isLiteralText()) {
component.getAttributes().put(propertyName, property.getExpressionString());
} else {
component.setValueExpression(propertyName, property);
}
}
}
// ============= BEAN FIELDS
/**
* @return the vascController
*/
public ValueExpression getVascController() {
return vascController;
}
/**
* @param vascController the vascController to set
*/
public void setVascController(ValueExpression vascController) {
this.vascController = vascController;
}
/**
* @return the entryName
*/
public ValueExpression getEntryName() {
return entryName;
}
/**
* @param entryName the entryName to set
*/
public void setEntryName(ValueExpression entryName) {
this.entryName = entryName;
}
/**
* @return the vascFrontendData
*/
public ValueExpression getVascFrontendData() {
return vascFrontendData;
}
/**
* @param vascFrontendData the vascFrontendData to set
*/
public void setVascFrontendData(ValueExpression vascFrontendData) {
this.vascFrontendData = vascFrontendData;
}
/**
* @return the entrySupportVar
*/
public ValueExpression getEntrySupportVar() {
return entrySupportVar;
}
/**
* @param entrySupportVar the entrySupportVar to set
*/
public void setEntrySupportVar(ValueExpression entrySupportVar) {
this.entrySupportVar = entrySupportVar;
}
/**
* @return the injectEditFieldsId
*/
public ValueExpression getInjectEditFieldsId() {
return injectEditFieldsId;
}
/**
* @param injectEditFieldsId the injectEditFieldsId to set
*/
public void setInjectEditFieldsId(ValueExpression injectEditFieldsId) {
this.injectEditFieldsId = injectEditFieldsId;
}
/**
* @return the injectTableOptionsId
*/
public ValueExpression getInjectTableOptionsId() {
return injectTableOptionsId;
}
/**
* @param injectTableOptionsId the injectTableOptionsId to set
*/
public void setInjectTableOptionsId(ValueExpression injectTableOptionsId) {
this.injectTableOptionsId = injectTableOptionsId;
}
/**
* @return the injectTableColumnsId
*/
public ValueExpression getInjectTableColumnsId() {
return injectTableColumnsId;
}
/**
* @param injectTableColumnsId the injectTableColumnsId to set
*/
public void setInjectTableColumnsId(ValueExpression injectTableColumnsId) {
this.injectTableColumnsId = injectTableColumnsId;
}
/**
* @return the tableRecordVar
*/
public ValueExpression getTableRecordVar() {
return tableRecordVar;
}
/**
* @param tableRecordVar the tableRecordVar to set
*/
public void setTableRecordVar(ValueExpression tableRecordVar) {
this.tableRecordVar = tableRecordVar;
}
/**
* @return the disableLinkColumns
*/
public ValueExpression getDisableLinkColumns() {
return disableLinkColumns;
}
/**
* @param disableLinkColumns the disableLinkColumns to set
*/
public void setDisableLinkColumns(ValueExpression disableLinkColumns) {
this.disableLinkColumns = disableLinkColumns;
}
}

View file

@ -1,105 +0,0 @@
/**
*
*/
package com.idcanet.vasc.frontends.web.jsf;
import java.util.Iterator;
import java.util.Map;
import java.util.logging.Logger;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.frontends.web.jsf.JSFVascUIComponentRenderer.VascJSFInputValidator2;
/**
* JSFVascValidatePhaseListener runs the vasc field edit fields.
*
* @author Willem Cazander
* @version 1.0 Nov 15, 2009
*/
public class JSFVascValidatePhaseListener implements PhaseListener {
private static final long serialVersionUID = 1L;
private Logger logger = null;
public JSFVascValidatePhaseListener() {
logger = Logger.getLogger(JSFVascValidatePhaseListener.class.getName());
}
private static final String SAVE_ACTION_ID_HACK = "VASC_SAVE";
public void afterPhase(PhaseEvent event) {
FacesContext context = event.getFacesContext();
// we really only want validation this early when saveing.
// this is currently a bit hacky impl;
Map<String,String> requestMap = context.getExternalContext().getRequestParameterMap();
for (String key:requestMap.keySet()) {
if (key.contains(SAVE_ACTION_ID_HACK)) {
validateUIInput(context.getViewRoot(),context);
return;
}
}
}
public void beforePhase(PhaseEvent event) {
}
public PhaseId getPhaseId() {
return PhaseId.PROCESS_VALIDATIONS;
}
private void validateUIInput(UIComponent component,FacesContext context) {
if (component instanceof UIInput) {
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(component);
logger.finer("Validate UIInput: "+component+" comp: "+comp);
if (comp==null) {
return; // non-vasc ui-input
}
if (comp.getSupportBean().getSelected()==null) {
return; // no editing
}
VascEntry entry = comp.getVascEntry();
if (entry.getVascFrontendData().getVascEntryState().getEntryDataObject()==null) {
return; // we are not in edit mode.
}
UIInput in = (UIInput)component;
for (Validator v:in.getValidators()) {
if (v instanceof VascJSFInputValidator2) {
VascJSFInputValidator2 validator = (VascJSFInputValidator2)v;
try {
in.setValid(true);
validator.validatePhase(context, in, in.getValue());
} catch (ValidatorException ve) {
in.setValid(false);
// note: ve has the message already but this is the UIInput way
FacesMessage message;
String validatorMessageString = in.getValidatorMessage();
if (null != validatorMessageString) {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR,validatorMessageString,validatorMessageString);
message.setSeverity(FacesMessage.SEVERITY_ERROR);
} else {
message = ve.getFacesMessage();
}
if (message != null) {
context.addMessage(in.getClientId(context), message);
}
}
}
}
}
Iterator<UIComponent> kids = component.getFacetsAndChildren();
while (kids.hasNext()) {
UIComponent child = kids.next();
validateUIInput(child,context);
}
}
}

View file

@ -1,519 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.web.jsf;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
/**
*
*
* @author Willem Cazander
* @version 1.0 May 03, 2009
*/
public class VascDataBackendBean implements Serializable {
private static final long serialVersionUID = 3881688974089760074L;
private VascEntry entry = null;
private Object record = null;
private boolean realValue = false;
private int recordId = 0;
public VascDataBackendBean(VascEntry entry,Object record,int recordId) {
this.entry=entry;
this.record=record;
this.recordId=recordId;
}
public boolean isRealValue() {
return realValue;
}
public void setRealValue(boolean realValue) {
this.realValue=realValue;
}
static public VascEntryField getFieldIdByIndex(VascEntry entry,int index) {
if (index>entry.getVascEntryFields().size()) {
throw new IllegalArgumentException("Index is bigger then total field size: "+index);
}
return entry.getVascEntryFields().get(index);
}
static public int getIndexId(VascEntryField field) {
int i =0;
for (VascEntryField f:field.getVascEntry().getVascEntryFields()) {
if (f.getId().equals(field.getId())) {
return i;
}
i++;
}
throw new IllegalArgumentException("Could not find field.");
}
private Object getValue(int index) {
try {
VascEntryField field = getFieldIdByIndex(entry,index);
VascEntryFieldValue value = field.getVascEntryFieldValue();
if (isRealValue()) {
return value.getValue(field, record);
}
return value.getDisplayValue(field, record);
} catch (VascException e) {
return "Error: "+e.getMessage();
}
}
private void setValue(int index,Object valueObject) {
try {
VascEntryField field = getFieldIdByIndex(entry,index);
VascEntryFieldValue value = field.getVascEntryFieldValue();
value.setValue(field, record,valueObject);
} catch (VascException e) {
throw new RuntimeException("Could not set value on record.",e);
}
}
public Object getRecord() {
return record;
}
public int getRecordId() {
return recordId;
}
// GET/SET bean methods for using in EL
public Object getField0() {
return getValue(0);
}
public void setField0(Object o) {
setValue(0,o);
}
public Object getField1() {
return getValue(1);
}
public void setField1(Object o) {
setValue(1,o);
}
public Object getField2() {
return getValue(2);
}
public void setField2(Object o) {
setValue(2,o);
}
public Object getField3() {
return getValue(3);
}
public void setField3(Object o) {
setValue(3,o);
}
public Object getField4() {
return getValue(4);
}
public void setField4(Object o) {
setValue(4,o);
}
public Object getField5() {
return getValue(5);
}
public void setField5(Object o) {
setValue(5,o);
}
public Object getField6() {
return getValue(6);
}
public void setField6(Object o) {
setValue(6,o);
}
public Object getField7() {
return getValue(7);
}
public void setField7(Object o) {
setValue(7,o);
}
public Object getField8() {
return getValue(8);
}
public void setField8(Object o) {
setValue(8,o);
}
public Object getField9() {
return getValue(9);
}
public void setField9(Object o) {
setValue(9,o);
}
public Object getField10() {
return getValue(10);
}
public void setField10(Object o) {
setValue(10,o);
}
public Object getField11() {
return getValue(11);
}
public void setField11(Object o) {
setValue(11,o);
}
public Object getField12() {
return getValue(12);
}
public void setField12(Object o) {
setValue(12,o);
}
public Object getField13() {
return getValue(13);
}
public void setField13(Object o) {
setValue(13,o);
}
public Object getField14() {
return getValue(14);
}
public void setField14(Object o) {
setValue(14,o);
}
public Object getField15() {
return getValue(15);
}
public void setField15(Object o) {
setValue(15,o);
}
public Object getField16() {
return getValue(16);
}
public void setField16(Object o) {
setValue(16,o);
}
public Object getField17() {
return getValue(17);
}
public void setField17(Object o) {
setValue(17,o);
}
public Object getField18() {
return getValue(18);
}
public void setField18(Object o) {
setValue(18,o);
}
public Object getField19() {
return getValue(19);
}
public void setField19(Object o) {
setValue(19,o);
}
public Object getField20() {
return getValue(20);
}
public void setField20(Object o) {
setValue(20,o);
}
public Object getField21() {
return getValue(21);
}
public void setField21(Object o) {
setValue(21,o);
}
public Object getField22() {
return getValue(22);
}
public void setField22(Object o) {
setValue(22,o);
}
public Object getField23() {
return getValue(23);
}
public void setField23(Object o) {
setValue(23,o);
}
public Object getField24() {
return getValue(24);
}
public void setField24(Object o) {
setValue(24,o);
}
public Object getField25() {
return getValue(25);
}
public void setField25(Object o) {
setValue(25,o);
}
public Object getField26() {
return getValue(26);
}
public void setField26(Object o) {
setValue(26,o);
}
public Object getField27() {
return getValue(27);
}
public void setField27(Object o) {
setValue(27,o);
}
public Object getField28() {
return getValue(28);
}
public void setField28(Object o) {
setValue(28,o);
}
public Object getField29() {
return getValue(29);
}
public void setField29(Object o) {
setValue(29,o);
}
public Object getField30() {
return getValue(30);
}
public void setField30(Object o) {
setValue(30,o);
}
public Object getField31() {
return getValue(31);
}
public void setField31(Object o) {
setValue(31,o);
}
public Object getField32() {
return getValue(32);
}
public void setField32(Object o) {
setValue(32,o);
}
public Object getField33() {
return getValue(33);
}
public void setField33(Object o) {
setValue(33,o);
}
public Object getField34() {
return getValue(34);
}
public void setField34(Object o) {
setValue(34,o);
}
public Object getField35() {
return getValue(35);
}
public void setField35(Object o) {
setValue(35,o);
}
public Object getField36() {
return getValue(36);
}
public void setField36(Object o) {
setValue(36,o);
}
public Object getField37() {
return getValue(37);
}
public void setField37(Object o) {
setValue(37,o);
}
public Object getField38() {
return getValue(38);
}
public void setField38(Object o) {
setValue(38,o);
}
public Object getField39() {
return getValue(39);
}
public void setField39(Object o) {
setValue(39,o);
}
public Object getField40() {
return getValue(40);
}
public void setField40(Object o) {
setValue(40,o);
}
public Object getField41() {
return getValue(41);
}
public void setField41(Object o) {
setValue(41,o);
}
public Object getField42() {
return getValue(42);
}
public void setField42(Object o) {
setValue(42,o);
}
public Object getField43() {
return getValue(43);
}
public void setField43(Object o) {
setValue(43,o);
}
public Object getField44() {
return getValue(44);
}
public void setField44(Object o) {
setValue(44,o);
}
public Object getField45() {
return getValue(45);
}
public void setField45(Object o) {
setValue(45,o);
}
public Object getField46() {
return getValue(46);
}
public void setField46(Object o) {
setValue(46,o);
}
public Object getField47() {
return getValue(47);
}
public void setField47(Object o) {
setValue(47,o);
}
public Object getField48() {
return getValue(48);
}
public void setField48(Object o) {
setValue(48,o);
}
public Object getField49() {
return getValue(49);
}
public void setField49(Object o) {
setValue(49,o);
}
}

View file

@ -1,167 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.web.jsf;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.FactoryFinder;
import javax.faces.application.ViewExpiredException;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.context.FacesContextFactory;
import javax.faces.lifecycle.Lifecycle;
import javax.faces.lifecycle.LifecycleFactory;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Parses the Request info path info 3 vasc attributes an dispatches the request to the templateFile.
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2009
*/
public class VascRequestFacesFilter implements Filter {
private static final long serialVersionUID = 10l;
private Logger logger = null;
private String templateFile = null;
private ServletContext servletContext = null;
/**
* @see javax.servlet.Filter#destroy()
*/
public void destroy() {
servletContext = null;
templateFile = null;
logger = null;
}
/**
* @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
*/
public void init(FilterConfig config) throws ServletException {
logger = Logger.getLogger(VascRequestFacesFilter.class.getName());
templateFile=config.getInitParameter("templateFile");
if (templateFile==null) {
throw new ServletException("No templateFile init-param found.");
}
servletContext=config.getServletContext();
}
/**
* @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
*/
public void doFilter(ServletRequest servletRequest,ServletResponse servletResponse,FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest)servletRequest;
HttpServletResponse response = (HttpServletResponse)servletResponse;
// request info
String path = request.getRequestURI();
String v = "/vasc/";
if (path.contains(v)) {
path = path.substring(path.indexOf(v)+v.length());
}
// stuff to fill
String entityName = null;
String actionName = null;
String actionRecordId = null;
// parse request info
//path = path.substring(1); // rm /
int index = path.indexOf("/"); // check next /
String actionString = null;
if (index>0) {
actionString = path.substring(index+1);
entityName = path.substring(0,index);
} else {
entityName = path;
}
if (actionString!=null) {
index = actionString.indexOf("/");
String recordString = null;
if (index>0) {
recordString = actionString.substring(index+1);
actionName = actionString.substring(0,index);
} else {
actionName = actionString;
}
if (recordString!=null) {
actionRecordId = recordString;
}
}
//log
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,"entityName="+entityName+" actionName="+actionName+" actionRecordId="+actionRecordId);
}
// add to response
request.setAttribute("requestScopeVascEntityName", entityName);
request.setAttribute("requestScopeVascActionName", actionName);
request.setAttribute("requestScopeVascRecordId" , actionRecordId);
request.setAttribute("requestScopeVascPath" , request.getRequestURI());
// Acquire the FacesContext instance for this request
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext == null) {
FacesContextFactory facesContextFactory = (FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
LifecycleFactory lifecycleFactory = (LifecycleFactory)FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
facesContext = facesContextFactory.getFacesContext(servletContext, request, response, lifecycle);
ProtectedFacesContext.setFacesContextAsCurrentInstance(facesContext);
UIViewRoot viewRoot = facesContext.getApplication().getViewHandler().createView(facesContext,entityName+actionName);
facesContext.setViewRoot(viewRoot);
}
try {
request.getRequestDispatcher(templateFile).forward(request, response);
} catch (ViewExpiredException e) {
// lets try again
response.sendRedirect(request.getRequestURL().toString());
}
// done
}
private abstract static class ProtectedFacesContext extends FacesContext {
protected static void setFacesContextAsCurrentInstance(FacesContext facesContext) {
FacesContext.setCurrentInstance(facesContext);
}
}
}

View file

@ -1,123 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.frontends.web.jsf;
import java.io.IOException;
import java.util.Locale;
import javax.faces.FacesException;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
/**
* Fixes the action url
*
* @author Willem Cazander
* @version 1.0 May 05, 2009
*/
public class VascViewHandler extends ViewHandler {
private ViewHandler parentViewHandler = null;
public VascViewHandler(ViewHandler viewHandler) {
super();
this.parentViewHandler = viewHandler;
}
/**
* @see javax.faces.application.ViewHandler#getActionURL(javax.faces.context.FacesContext, java.lang.String)
*/
@Override
public String getActionURL(FacesContext context, String name) {
HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
if (request.getAttribute("requestScopeVascPath")==null) {
return parentViewHandler.getActionURL(context, name);
}
String path = (String)request.getAttribute("requestScopeVascPath");
return path;
}
/**
* @see javax.faces.application.ViewHandler#calculateLocale(javax.faces.context.FacesContext)
*/
@Override
public Locale calculateLocale(FacesContext context) {
return parentViewHandler.calculateLocale(context);
}
/**
* @see javax.faces.application.ViewHandler#calculateRenderKitId(javax.faces.context.FacesContext)
*/
@Override
public String calculateRenderKitId(FacesContext context) {
return parentViewHandler.calculateRenderKitId(context);
}
/**
* @see javax.faces.application.ViewHandler#createView(javax.faces.context.FacesContext, java.lang.String)
*/
@Override
public UIViewRoot createView(FacesContext context, String name) {
return parentViewHandler.createView(context, name);
}
/**
* @see javax.faces.application.ViewHandler#getResourceURL(javax.faces.context.FacesContext, java.lang.String)
*/
@Override
public String getResourceURL(FacesContext context, String resource) {
return parentViewHandler.getResourceURL(context, resource);
}
/**
* @see javax.faces.application.ViewHandler#renderView(javax.faces.context.FacesContext, javax.faces.component.UIViewRoot)
*/
@Override
public void renderView(FacesContext context, UIViewRoot viewRoot) throws IOException, FacesException {
parentViewHandler.renderView(context, viewRoot);
}
/**
* @see javax.faces.application.ViewHandler#restoreView(javax.faces.context.FacesContext, java.lang.String)
*/
@Override
public UIViewRoot restoreView(FacesContext context, String name) {
return parentViewHandler.restoreView(context, name);
}
/**
* @see javax.faces.application.ViewHandler#writeState(javax.faces.context.FacesContext)
*/
@Override
public void writeState(FacesContext context) throws IOException {
parentViewHandler.writeState(context);
}
}

Some files were not shown because too many files have changed in this diff Show more