[svn r364] WIP for move to maven2
This commit is contained in:
parent
8fc495c6b6
commit
818ed10649
173 changed files with 275 additions and 45 deletions
52
src/main/java/com/idcanet/vasc/annotations/VascAdmin.java
Normal file
52
src/main/java/com/idcanet/vasc/annotations/VascAdmin.java
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* Defines the admin interface settings
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 18, 2008
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface VascAdmin {
|
||||
|
||||
boolean list() default true;
|
||||
|
||||
boolean create() default true;
|
||||
|
||||
boolean update() default true;
|
||||
|
||||
boolean delete() default true;
|
||||
}
|
||||
|
|
@ -0,0 +1,271 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* Parses the Vasc annotations
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 27, 2006
|
||||
*/
|
||||
public class VascAnnotationParser {
|
||||
|
||||
/** Determens if no when no annotation is found null will return or default key */
|
||||
private Boolean noAnnotationNullReturn = null;
|
||||
|
||||
/**
|
||||
* Creates an VascAnnotationParser
|
||||
*/
|
||||
public VascAnnotationParser() {
|
||||
setNoAnnotationNullReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determens if no when no annotation is found null will return or default key
|
||||
* default is false
|
||||
* @param noAnnotationNullReturn
|
||||
*/
|
||||
public VascAnnotationParser(boolean noAnnotationNullReturn) {
|
||||
setNoAnnotationNullReturn(noAnnotationNullReturn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the key of the VascToolTip key for the property of the class
|
||||
* @param beanClass The class to search for the property
|
||||
* @param property The property for the ToolTip
|
||||
* @return The i18n key for an ToolTip
|
||||
*/
|
||||
public String getVascDescriptionKey(Class<?> beanClass,String property) {
|
||||
return (String)getValue(beanClass,VascDescription.class,property);
|
||||
}
|
||||
|
||||
public String getVascDescriptionKey(Class<?> beanClass) {
|
||||
return (String)getValue(beanClass,VascDescription.class,null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the key of the VascName key for the property of the class
|
||||
* @param beanClass The class to search for the property
|
||||
* @param property The property for the Labe
|
||||
* @return The i18n key for an Label
|
||||
*/
|
||||
public String getVascNameKey(Class<?> beanClass,String property) {
|
||||
return (String)getValue(beanClass,VascName.class,property);
|
||||
}
|
||||
|
||||
public String getVascNameKey(Class<?> beanClass) {
|
||||
return (String)getValue(beanClass,VascName.class,null);
|
||||
}
|
||||
|
||||
|
||||
public Object getVascColumnWidth(Class<?> beanClass,String property) {
|
||||
return getValue(beanClass,VascColumnWidth.class,property);
|
||||
}
|
||||
|
||||
public Object getVascColumnWidth(Class<?> beanClass) {
|
||||
return getValue(beanClass,VascColumnWidth.class,null);
|
||||
}
|
||||
|
||||
public String getVascHelpId(Class<?> beanClass,String property) {
|
||||
return (String)getValue(beanClass,VascHelpId.class,property);
|
||||
}
|
||||
|
||||
public String getVascHelpId(Class<?> beanClass) {
|
||||
return (String)getValue(beanClass,VascHelpId.class,null);
|
||||
}
|
||||
|
||||
public Object getVascDefaultValue(Class<?> beanClass,String property) {
|
||||
return getValue(beanClass,VascDefaultValue.class,property);
|
||||
}
|
||||
|
||||
public Object getVascDefaultValue(Class<?> beanClass) {
|
||||
return getValue(beanClass,VascDefaultValue.class,null);
|
||||
}
|
||||
|
||||
public String getVascImage(Class<?> beanClass,String property) {
|
||||
return (String)getValue(beanClass,VascImage.class,property);
|
||||
}
|
||||
|
||||
public String getVascImage(Class<?> beanClass) {
|
||||
return (String)getValue(beanClass,VascImage.class,null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* No oop code here...refactor at some point in time
|
||||
*
|
||||
*
|
||||
* @param beanClass
|
||||
* @param property
|
||||
* @param annotationType
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object getValue(Class<?> beanClass,Class annotationType,String property) {
|
||||
if(beanClass==null) { throw new NullPointerException("beanClass may not be null"); }
|
||||
if(annotationType==null){ throw new NullPointerException("annotationType may not be null"); }
|
||||
|
||||
Object result = null;
|
||||
if(property==null) {
|
||||
Annotation anno = beanClass.getAnnotation(annotationType);
|
||||
if (anno==null) {
|
||||
// no annotation == no default
|
||||
if (annotationType.equals(VascDefaultValue.class)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// no annotion avaible
|
||||
if (noAnnotationNullReturn) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
result = doAnnotation(anno);
|
||||
if(result!=null) {
|
||||
return result;
|
||||
}
|
||||
if (noAnnotationNullReturn) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return beanClass.getName()+"."+annotationType.getSimpleName();
|
||||
}
|
||||
|
||||
String propRest = null;
|
||||
int index = property.indexOf(".");
|
||||
if(index>0) {
|
||||
propRest = property.substring(index+1);
|
||||
property = property.substring(0,index);
|
||||
}
|
||||
|
||||
for(Method method:beanClass.getMethods()) {
|
||||
if(method.getName().equalsIgnoreCase("get"+property)==false) { //a bit durty
|
||||
continue;
|
||||
}
|
||||
//logger.finer("Found property: "+property);
|
||||
VascModelReference mt = method.getAnnotation(VascModelReference.class);
|
||||
if(mt!=null) {
|
||||
Class typeClass = mt.type();
|
||||
if(Object.class==mt.type()) {
|
||||
typeClass = method.getReturnType();
|
||||
//return returnType.getName()+"."+annotationType.toString();
|
||||
}
|
||||
|
||||
// recursif function:
|
||||
return getValue(typeClass,annotationType,propRest);
|
||||
}
|
||||
|
||||
Annotation anno = method.getAnnotation(annotationType);
|
||||
// no annotation == no default
|
||||
if (anno==null && annotationType.equals(VascDefaultValue.class)) {
|
||||
return null;
|
||||
}
|
||||
result = doAnnotation(anno);
|
||||
if(result!=null) {
|
||||
return result;
|
||||
}
|
||||
if (noAnnotationNullReturn) {
|
||||
return null;
|
||||
}
|
||||
break; // return default
|
||||
}
|
||||
return beanClass.getName()+"."+property+"."+annotationType.getSimpleName();
|
||||
}
|
||||
|
||||
private Object doAnnotation(Annotation b) {
|
||||
if (b==null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Class<?> a = b.annotationType();
|
||||
if (a.equals(VascName.class)) {
|
||||
VascName l = (VascName)b;
|
||||
if("".equals(l.key()) | "null".equals(l.key())) {
|
||||
return null;
|
||||
}
|
||||
return l.key();
|
||||
}
|
||||
if (a.equals(VascDescription.class)) {
|
||||
VascDescription t = (VascDescription)b;
|
||||
if("".equals(t.key()) | "null".equals(t.key())) {
|
||||
return null;
|
||||
}
|
||||
return t.key();
|
||||
}
|
||||
if (a.equals(VascHelpId.class)) {
|
||||
VascHelpId h = (VascHelpId)b;
|
||||
if("".equals(h.helpId()) | "null".equals(h.helpId())) {
|
||||
return null;
|
||||
}
|
||||
return h.helpId();
|
||||
}
|
||||
if (a.equals(VascDefaultValue.class)) {
|
||||
VascDefaultValue v = (VascDefaultValue)b;
|
||||
|
||||
if(v.defaultValue().equals(Object.class)==false) {
|
||||
try {
|
||||
//return v.defaultValue().newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new NullPointerException("Could not init defaultValueClass error: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
if ("null".equals(v.defaultValue())) {
|
||||
return "";
|
||||
}
|
||||
return v.defaultValue();
|
||||
}
|
||||
if (a.equals(VascColumnWidth.class)) {
|
||||
VascColumnWidth c = (VascColumnWidth)b;
|
||||
return c.width();
|
||||
}
|
||||
if (a.equals(VascImage.class)) {
|
||||
VascImage c = (VascImage)b;
|
||||
if("".equals(c.image()) | "null".equals(c.image())) {
|
||||
return null;
|
||||
}
|
||||
return c.image();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* default is false
|
||||
* @return Returns the noAnnotationNullReturn.
|
||||
*/
|
||||
public Boolean getNoAnnotationNullReturn() {
|
||||
return noAnnotationNullReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param noAnnotationNullReturn The noAnnotationNullReturn to set.
|
||||
*/
|
||||
public void setNoAnnotationNullReturn(Boolean noAnnotationNullReturn) {
|
||||
this.noAnnotationNullReturn = noAnnotationNullReturn;
|
||||
}
|
||||
}
|
||||
50
src/main/java/com/idcanet/vasc/annotations/VascChoices.java
Normal file
50
src/main/java/com/idcanet/vasc/annotations/VascChoices.java
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* Some choises options
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 19, 2008
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface VascChoices {
|
||||
|
||||
String[] choisesKeys();
|
||||
|
||||
String[] choisesNames();
|
||||
|
||||
boolean editAsRadio() default true;
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* The default column width
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 28, 2007
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface VascColumnWidth {
|
||||
|
||||
int width() default 150;
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the defaultValue
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 28, 2007
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface VascDefaultValue {
|
||||
|
||||
String key() default "null";
|
||||
|
||||
String defaultValue() default "null";
|
||||
|
||||
/**
|
||||
* The defaultValue of the method
|
||||
*/
|
||||
//Class<?> defaultValueClass() default Object.class;
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the I18nToolTip(non default) an a Class property
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 27, 2006
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD,ElementType.TYPE})
|
||||
public @interface VascDescription {
|
||||
|
||||
/**
|
||||
* The key of the ToolTip default to "null"
|
||||
* @see com.idcanet.i18n.I18nAnnotationParser#getI18nToolTipKey(Class, String)
|
||||
* @return The key of the ToolTip
|
||||
*/
|
||||
String key() default "null";
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* The field(s)/method used for displaying the display name in lists/etc.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 18, 2008
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface VascDisplayName {
|
||||
|
||||
/**
|
||||
* The field or fields which are the display name.
|
||||
* If used on method then field may be left out.
|
||||
*
|
||||
*/
|
||||
String fields() default "null";
|
||||
|
||||
String format() default "null";
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* Specefiecs the editor needed for a field
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 15, 2008
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface VascEditorType {
|
||||
|
||||
/**
|
||||
* The editor of the method/field
|
||||
*/
|
||||
String type() default "null";
|
||||
|
||||
/**
|
||||
* Hints for the choosen editor
|
||||
*/
|
||||
String hints() default "null";
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* Specefiecs the type of events we want to get from vasc.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 15, 2008
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface VascEventChannel {
|
||||
|
||||
/**
|
||||
* The channel to send to.
|
||||
*/
|
||||
String channel() default "null";
|
||||
|
||||
boolean create() default false;
|
||||
|
||||
boolean update() default false;
|
||||
|
||||
boolean delete() default false;
|
||||
|
||||
boolean listed() default false;
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* Some generic field options
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 15, 2008
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface VascFieldOptions {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
boolean blank() default false;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
String choises() default "null"; // + radio admin
|
||||
|
||||
boolean editable() default true;
|
||||
}
|
||||
49
src/main/java/com/idcanet/vasc/annotations/VascHelpId.java
Normal file
49
src/main/java/com/idcanet/vasc/annotations/VascHelpId.java
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the helpId
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 28, 2007
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD,ElementType.TYPE})
|
||||
public @interface VascHelpId {
|
||||
|
||||
/**
|
||||
* The defaultValue of the method
|
||||
*/
|
||||
String helpId() default "null";
|
||||
}
|
||||
51
src/main/java/com/idcanet/vasc/annotations/VascImage.java
Normal file
51
src/main/java/com/idcanet/vasc/annotations/VascImage.java
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the VascImage property
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 27, 2006
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD,ElementType.TYPE})
|
||||
public @interface VascImage {
|
||||
|
||||
/**
|
||||
* The resource or key of the Image, default to "null"
|
||||
* @see com.idcanet.i18n.I18nAnnotationParser#getI18nLabelKey(Class, String)
|
||||
* @return The key of the ToolTip
|
||||
*/
|
||||
String image() default "null";
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* When plased on a getter is will redirect the label and tooltip text to the type of the return type
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 27, 2006
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface VascModelReference {
|
||||
|
||||
boolean editAsRadio() default true;
|
||||
|
||||
Class<?> type() default Object.class;
|
||||
}
|
||||
51
src/main/java/com/idcanet/vasc/annotations/VascName.java
Normal file
51
src/main/java/com/idcanet/vasc/annotations/VascName.java
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the I18nLabel(non default) an a Class property
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 27, 2006
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD,ElementType.TYPE})
|
||||
public @interface VascName {
|
||||
|
||||
/**
|
||||
* The key of the Label default to "null"
|
||||
* @see com.idcanet.i18n.I18nAnnotationParser#getI18nLabelKey(Class, String)
|
||||
* @return The key of the ToolTip
|
||||
*/
|
||||
String key() default "null";
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* The field(s)/method used for letting vasc know what the PrimaryKey is so we can load it.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 18, 2008
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface VascPrimaryKey {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright 2004-2006 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.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
|
||||
/**
|
||||
* Specefiecs the roles to view/edit or edit-view only modes
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 18, 2008
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface VascUserRoles {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
String list() default "null";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
String edit() default "null";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
String editViewOnly() default "null";
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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.jdbc;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 5, 2008
|
||||
*/
|
||||
public interface JdbcConnectionProvider {
|
||||
|
||||
public Connection getJdbcConnection();
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* 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.jdbc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.idcanet.vasc.core.AbstractVascBackend;
|
||||
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.VascEntryRecordCreator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 5, 2008
|
||||
*/
|
||||
public class JdbcVascBackend extends AbstractVascBackend {
|
||||
|
||||
private JdbcConnectionProvider jdbcConnectionProvider = null;
|
||||
|
||||
/**
|
||||
* @return the JdbcConnectionProvider
|
||||
*/
|
||||
public JdbcConnectionProvider getJdbcConnectionProvider() {
|
||||
return jdbcConnectionProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param JdbcConnectionProvider the JdbcConnectionProvider to set
|
||||
*/
|
||||
public void setJdbcConnectionProvider(JdbcConnectionProvider jdbcConnectionProvider) {
|
||||
this.jdbcConnectionProvider = jdbcConnectionProvider;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#execute()
|
||||
*/
|
||||
public List<Object> execute() throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#merge(java.lang.Object)
|
||||
*/
|
||||
public Object merge(Object object) throws Exception {
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#persist(java.lang.Object)
|
||||
*/
|
||||
public void persist(Object object) throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#delete(java.lang.Object)
|
||||
*/
|
||||
public void delete(Object object) throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryFieldValue(com.idcanet.vasc.core.VascEntryField)
|
||||
*/
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryRecordCreator(com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* 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.jdbc;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.core.AbstractVascBackend;
|
||||
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.VascEntryRecordCreator;
|
||||
import com.idcanet.xtes.xpql.query.QueryParameterValue;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 5, 2008
|
||||
*/
|
||||
public class JdbcXpqlVascBackend extends AbstractVascBackend {
|
||||
|
||||
private JdbcConnectionProvider jdbcConnectionProvider = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query query = null;
|
||||
|
||||
/**
|
||||
* @return the JdbcConnectionProvider
|
||||
*/
|
||||
public JdbcConnectionProvider getJdbcConnectionProvider() {
|
||||
return jdbcConnectionProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param JdbcConnectionProvider the JdbcConnectionProvider to set
|
||||
*/
|
||||
public void setJdbcConnectionProvider(JdbcConnectionProvider jdbcConnectionProvider) {
|
||||
this.jdbcConnectionProvider = jdbcConnectionProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#execute()
|
||||
*/
|
||||
public List<Object> execute() throws Exception {
|
||||
Connection c = getJdbcConnectionProvider().getJdbcConnection();
|
||||
try {
|
||||
PreparedStatement q = c.prepareStatement(query.toPreparedSQL(query));
|
||||
|
||||
List<QueryParameterValue> values = query.getOrderQueryParameterValues();
|
||||
int i = 0;
|
||||
for (QueryParameterValue value:values) {
|
||||
q.setObject(i,value.getValue());
|
||||
i++;
|
||||
}
|
||||
q.execute();
|
||||
ResultSet rs = q.getResultSet();
|
||||
|
||||
List<Object> data = new ArrayList<Object>(100);
|
||||
do {
|
||||
Map<String,Object> obj = new HashMap<String,Object>(10);
|
||||
for (i=0;i<rs.getMetaData().getColumnCount();i++) {
|
||||
obj.put(rs.getMetaData().getCatalogName(i), rs.getObject(i));
|
||||
}
|
||||
data.add(obj);
|
||||
} while (rs.next());
|
||||
return data;
|
||||
} finally {
|
||||
if (c!=null) {
|
||||
c.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#merge(java.lang.Object)
|
||||
*/
|
||||
public Object merge(Object object) throws Exception {
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#persist(java.lang.Object)
|
||||
*/
|
||||
public void persist(Object object) throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#delete(java.lang.Object)
|
||||
*/
|
||||
public void delete(Object object) throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryFieldValue(com.idcanet.vasc.core.VascEntryField)
|
||||
*/
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryRecordCreator(com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @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 Exception {
|
||||
Session s = getHibernateSession();
|
||||
try {
|
||||
s.persist(object);
|
||||
} finally {
|
||||
if (s!=null) {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws Exception {
|
||||
Session s = getHibernateSession();
|
||||
try {
|
||||
return s.merge(object);
|
||||
} finally {
|
||||
if (s!=null) {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void delete(Object object) throws Exception {
|
||||
Session s = getHibernateSession();
|
||||
try {
|
||||
Object newObject = s.merge(object);
|
||||
s.delete(newObject);
|
||||
} finally {
|
||||
if (s!=null) {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import com.idcanet.vasc.core.AbstractVascBackend;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend {
|
||||
|
||||
/**
|
||||
* Provides a hibernate session which is closed !! when transaction is compleeted.
|
||||
* @return
|
||||
*/
|
||||
abstract EntityManager getEntityManager();
|
||||
|
||||
public void persist(Object object) throws Exception {
|
||||
EntityManager s = getEntityManager();
|
||||
try {
|
||||
s.persist(object);
|
||||
} finally {
|
||||
if (s!=null) {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws Exception {
|
||||
EntityManager s = getEntityManager();
|
||||
try {
|
||||
return s.merge(object);
|
||||
} finally {
|
||||
if (s!=null) {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void delete(Object object) throws Exception {
|
||||
EntityManager s = getEntityManager();
|
||||
try {
|
||||
Object newObject = s.merge(object);
|
||||
s.remove(newObject);
|
||||
} finally {
|
||||
if (s!=null) {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* 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.Query;
|
||||
import org.hibernate.Session;
|
||||
|
||||
import com.idcanet.serv5.services.hibernate3.Hibernate3Factory;
|
||||
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.VascEntryRecordCreator;
|
||||
import com.idcanet.xtes.xpql.query.QueryParameterValue;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class Serv5XpqlHibernateVascBackend extends AbstractHibernateVascBackend {
|
||||
|
||||
private String session = null;
|
||||
|
||||
private com.idcanet.xtes.xpql.query.Query query = null;
|
||||
|
||||
public Serv5XpqlHibernateVascBackend() {
|
||||
|
||||
}
|
||||
public Serv5XpqlHibernateVascBackend(String session,com.idcanet.xtes.xpql.query.Query query) {
|
||||
setSession(session);
|
||||
setQuery(query);
|
||||
}
|
||||
|
||||
Session getHibernateSession() {
|
||||
return Hibernate3Factory.getSession(getSession());
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Object> execute() throws Exception {
|
||||
Session s = getHibernateSession();
|
||||
try {
|
||||
Query q = s.createQuery(query.toPreparedSQL(query));
|
||||
List<QueryParameterValue> values = query.getOrderQueryParameterValues();
|
||||
int i = 0;
|
||||
for (QueryParameterValue value:values) {
|
||||
q.setParameter(i,value.getValue());
|
||||
i++;
|
||||
}
|
||||
List<Object> data = q.list();
|
||||
return data;
|
||||
} finally {
|
||||
if (s!=null) {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the session
|
||||
*/
|
||||
public String getSession() {
|
||||
return session;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param session the session to set
|
||||
*/
|
||||
public void setSession(String session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
return null;
|
||||
}
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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();
|
||||
}
|
||||
|
|
@ -0,0 +1,268 @@
|
|||
/*
|
||||
* 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.Enumeration;
|
||||
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.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.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() throws Exception {
|
||||
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 ) ;
|
||||
|
||||
int searchScope = LDAPConnection.SCOPE_ONE;
|
||||
String searchBase = baseDN;
|
||||
|
||||
System.out.println("\n\tReading 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
|
||||
|
||||
System.out.println("Got object :" + searchResults.getCount());
|
||||
while (searchResults.hasMore()) {
|
||||
LDAPEntry entry = searchResults.next();
|
||||
System.out.println("We found "+entry.getDN());
|
||||
Map<String,Object> map = new HashMap<String,Object>(10);
|
||||
|
||||
LDAPAttributeSet attributeSet = entry.getAttributeSet();
|
||||
Iterator i = attributeSet.iterator();
|
||||
while (i.hasNext()) {
|
||||
LDAPAttribute attr = (LDAPAttribute)i.next();
|
||||
System.out.println("ATTR: "+attr.getName()+" value: "+attr.getStringValue());
|
||||
|
||||
map.put(attr.getName(), attr.getStringValueArray());
|
||||
}
|
||||
result.add(map);
|
||||
}
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#merge(java.lang.Object)
|
||||
*/
|
||||
public Object merge(Object object) throws Exception {
|
||||
LdapConnectionProvider prov = getLdapConnectionProvider();
|
||||
LDAPConnection connection = prov.getLdapConnection();
|
||||
try {
|
||||
|
||||
return object;
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#persist(java.lang.Object)
|
||||
*/
|
||||
public void persist(Object object) throws Exception {
|
||||
LdapConnectionProvider prov = getLdapConnectionProvider();
|
||||
LDAPConnection connection = prov.getLdapConnection();
|
||||
try {
|
||||
LDAPEntry entry = new LDAPEntry();
|
||||
// entry.getAttributeSet().
|
||||
|
||||
connection.add(entry);
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#delete(java.lang.Object)
|
||||
*/
|
||||
public void delete(Object object) throws Exception {
|
||||
LdapConnectionProvider prov = getLdapConnectionProvider();
|
||||
LDAPConnection connection = prov.getLdapConnection();
|
||||
try {
|
||||
|
||||
} 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 VascEntryRecordCreator() {
|
||||
|
||||
public Class<?> getObjectClass() {
|
||||
return Map.class;
|
||||
}
|
||||
|
||||
public Object newRecord(VascEntry entry) throws Exception {
|
||||
return new HashMap<String,Object>(10);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryFieldValue(com.idcanet.vasc.core.VascEntryField)
|
||||
*/
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
VascEntryFieldValue result = new VascEntryFieldValue() {
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.entry.VascEntryFieldValue#getValue(com.idcanet.vasc.core.VascEntryField, java.lang.Object)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object getValue(VascEntryField field, Object record) throws VascException {
|
||||
Map<String,Object> map = (Map<String,Object>)record;
|
||||
String[] r = (String[])map.get(field.getBackendName());
|
||||
if (r==null) {
|
||||
return ""; // create new value, ldap does not return data for field that an user does not have, but other do,...
|
||||
}
|
||||
if (r.length==1) {
|
||||
return r[0];
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.entry.VascEntryFieldValue#setValue(com.idcanet.vasc.core.VascEntryField, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setValue(VascEntryField field, Object record,Object value) throws VascException {
|
||||
Map<String,Object> map = (Map<String,Object>)record;
|
||||
map.put(field.getBackendName(), value);
|
||||
}
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
192
src/main/java/com/idcanet/vasc/core/AbstractVascBackend.java
Normal file
192
src/main/java/com/idcanet/vasc/core/AbstractVascBackend.java
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
/*
|
||||
* 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 Aug 2, 2007
|
||||
*/
|
||||
abstract public class AbstractVascBackend implements VascBackend {
|
||||
|
||||
private String id = null;
|
||||
protected Map<String,Object> parameters = null;
|
||||
private int pageIndex = 0;
|
||||
private int pageSize = 100;
|
||||
private String sortField = null;
|
||||
private String searchString = null;
|
||||
private boolean ascending = true;
|
||||
|
||||
public AbstractVascBackend() {
|
||||
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#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#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#getPagesTotal()
|
||||
*/
|
||||
public int getPagesTotal() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#getPagesTotalRecords()
|
||||
*/
|
||||
public int getPagesTotalRecords() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#isSearchable()
|
||||
*/
|
||||
public boolean isSearchable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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#isSortable()
|
||||
*/
|
||||
public boolean isSortable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
/*
|
||||
* 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 String id = null;
|
||||
private Class<?> autoDetectClass = null;
|
||||
private List<VascValidator> vascValidators = null;
|
||||
private Map<String,String> properties = null;
|
||||
|
||||
private Object dataObject = null;
|
||||
private String uiComponentId = null;
|
||||
private String inputMask = null;
|
||||
|
||||
public AbstractVascEntryFieldType() {
|
||||
vascValidators = new ArrayList<VascValidator>(4);
|
||||
properties = new HashMap<String,String>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* 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 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;
|
||||
}
|
||||
}
|
||||
109
src/main/java/com/idcanet/vasc/core/VascBackend.java
Normal file
109
src/main/java/com/idcanet/vasc/core/VascBackend.java
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* 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.Set;
|
||||
|
||||
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 void setDataParameter(String key,Object data);
|
||||
public Object getDataParameter(String key);
|
||||
public Set<String> getDataParameterKeys();
|
||||
|
||||
public List<Object> execute() throws Exception;
|
||||
|
||||
public void persist(Object object) throws Exception;
|
||||
|
||||
public Object merge(Object object) throws Exception;
|
||||
|
||||
public void delete(Object object) throws Exception;
|
||||
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field);
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry);
|
||||
|
||||
/**
|
||||
* Defines if the backend supports sorting
|
||||
* @return
|
||||
*/
|
||||
public boolean isSortable();
|
||||
public String getSortField();
|
||||
public void setSortField(String name);
|
||||
public boolean isSortAscending();
|
||||
public void setSortAscending(boolean ascending);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines if the backend supports pageing
|
||||
* @return
|
||||
*/
|
||||
public boolean isPageable();
|
||||
|
||||
/**
|
||||
* Returns the total amount of pages
|
||||
* @return
|
||||
*/
|
||||
public int getPagesTotal();
|
||||
|
||||
public int getPagesTotalRecords();
|
||||
|
||||
|
||||
public void setPageSize(int size);
|
||||
public int getPageSize();
|
||||
|
||||
public void setPageIndex(int index);
|
||||
public int getPageIndex();
|
||||
|
||||
|
||||
/**
|
||||
* Defines if the backend supports pageing
|
||||
* @return
|
||||
*/
|
||||
public boolean isSearchable();
|
||||
public void setSearchString(String searchString);
|
||||
public String getSearchString();
|
||||
|
||||
/*
|
||||
public boolean hasSettings();
|
||||
public Map<String,String> getSettings();
|
||||
public void putSetting(String key,String value);
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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 VascBackendControllerResolver {
|
||||
|
||||
public VascBackendController getVascBackendController();
|
||||
}
|
||||
67
src/main/java/com/idcanet/vasc/core/VascController.java
Normal file
67
src/main/java/com/idcanet/vasc/core/VascController.java
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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 VascBackendControllerResolver
|
||||
*/
|
||||
public VascBackendControllerResolver getVascBackendControllerResolver();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns the VascEntryControllerResolver
|
||||
*/
|
||||
public VascEntryControllerResolver getVascEntryControllerResolver();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns the VascEntryFieldControllerResolver
|
||||
*/
|
||||
public VascEntryFieldTypeControllerResolver getVascEntryFieldTypeControllerResolver();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns the VascEventChannelControllerResolver
|
||||
*/
|
||||
public VascEventChannelControllerResolver getVascEventChannelControllerResolver();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns the VascUserRoleControllerResolver
|
||||
*/
|
||||
public VascUserRoleControllerResolver getVascUserRoleControllerResolver();
|
||||
}
|
||||
293
src/main/java/com/idcanet/vasc/core/VascEntry.java
Normal file
293
src/main/java/com/idcanet/vasc/core/VascEntry.java
Normal file
|
|
@ -0,0 +1,293 @@
|
|||
/*
|
||||
* 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.ColumnVascAction;
|
||||
import com.idcanet.vasc.core.actions.GlobalVascAction;
|
||||
import com.idcanet.vasc.core.actions.RowVascAction;
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO:
|
||||
* private List<VascUserOption> userOptions = null;
|
||||
* private List<VascListeners> listeners = null;
|
||||
* private Map<String,VascDetailView> vascLinks = null;
|
||||
* private Map<String,VascFunction> vascFunctions = null;
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public interface VascEntry 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 headerName
|
||||
*/
|
||||
public String getHeaderName();
|
||||
|
||||
/**
|
||||
* @param headerName the headerName to set
|
||||
*/
|
||||
public void setHeaderName(String headerName);
|
||||
|
||||
/**
|
||||
* @return the headerImage
|
||||
*/
|
||||
public String getHeaderImage();
|
||||
|
||||
/**
|
||||
* @param headerImage the headerImage to set
|
||||
*/
|
||||
public void setHeaderImage(String headerImage);
|
||||
|
||||
/**
|
||||
* @return the headerDescription
|
||||
*/
|
||||
public String getHeaderDescription();
|
||||
|
||||
/**
|
||||
* @param headerDescription the headerDescription to set
|
||||
*/
|
||||
public void setHeaderDescription(String headerDescription);
|
||||
|
||||
/**
|
||||
* @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 vascAdmimList
|
||||
*/
|
||||
public boolean isVascAdmimList();
|
||||
|
||||
/**
|
||||
* @param vascAdmimList the vascAdmimList to set
|
||||
*/
|
||||
public void setVascAdmimList(boolean vascAdmimList);
|
||||
|
||||
/**
|
||||
* @return the vascAdmimEdit
|
||||
*/
|
||||
public boolean isVascAdmimEdit();
|
||||
|
||||
/**
|
||||
* @param vascAdmimEdit the vascAdmimEdit to set
|
||||
*/
|
||||
public void setVascAdmimEdit(boolean vascAdmimEdit);
|
||||
|
||||
/**
|
||||
* @return the vascAdmimCreate
|
||||
*/
|
||||
public boolean isVascAdmimCreate();
|
||||
|
||||
/**
|
||||
* @param vascAdmimCreate the vascAdmimCreate to set
|
||||
*/
|
||||
public void setVascAdmimCreate(boolean vascAdmimCreate);
|
||||
|
||||
/**
|
||||
* @return the vascAdmimDelete
|
||||
*/
|
||||
public boolean isVascAdmimDelete();
|
||||
|
||||
/**
|
||||
* @param vascAdmimDelete the vascAdmimDelete to set
|
||||
*/
|
||||
public void setVascAdmimDelete(boolean vascAdmimDelete);
|
||||
|
||||
/**
|
||||
* @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();
|
||||
|
||||
/**
|
||||
* @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();
|
||||
|
||||
/**
|
||||
* @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();
|
||||
|
||||
/**
|
||||
* @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();
|
||||
|
||||
/**
|
||||
* @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();
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
44
src/main/java/com/idcanet/vasc/core/VascEntryController.java
Normal file
44
src/main/java/com/idcanet/vasc/core/VascEntryController.java
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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();
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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 VascEntryControllerResolver {
|
||||
|
||||
public VascEntryController getVascEntryController();
|
||||
}
|
||||
319
src/main/java/com/idcanet/vasc/core/VascEntryField.java
Normal file
319
src/main/java/com/idcanet/vasc/core/VascEntryField.java
Normal file
|
|
@ -0,0 +1,319 @@
|
|||
/*
|
||||
* 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.VascEntryFieldEventChannel;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
|
||||
import com.idcanet.vasc.validators.VascValidator;
|
||||
|
||||
/**
|
||||
* Defines an VascTableColumn
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public interface VascEntryField {
|
||||
|
||||
/**
|
||||
* @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 vascEntryFieldEventChannel
|
||||
*/
|
||||
public VascEntryFieldEventChannel getVascEntryFieldEventChannel();
|
||||
|
||||
/**
|
||||
* @param vascEntryFieldEventChannel the vascEntryFieldEventChannel to set
|
||||
*/
|
||||
public void setVascEntryFieldEventChannel(VascEntryFieldEventChannel vascEntryFieldEventChannel);
|
||||
|
||||
/**
|
||||
* @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 isView();
|
||||
|
||||
/**
|
||||
* @param view the view to set
|
||||
*/
|
||||
public void setView(boolean view);
|
||||
|
||||
/**
|
||||
* @return the optional
|
||||
*/
|
||||
public boolean isOptional();
|
||||
|
||||
/**
|
||||
* @param optional the optional to set
|
||||
*/
|
||||
public void setOptional(boolean optional);
|
||||
|
||||
/**
|
||||
* @return the create
|
||||
*/
|
||||
public boolean isCreate();
|
||||
|
||||
/**
|
||||
* @param create the create to set
|
||||
*/
|
||||
public void setCreate(boolean create);
|
||||
|
||||
/**
|
||||
* @return the edit
|
||||
*/
|
||||
public boolean isEdit();
|
||||
|
||||
/**
|
||||
* @param edit the edit to set
|
||||
*/
|
||||
public void setEdit(boolean edit);
|
||||
|
||||
/**
|
||||
* @return the editReadOnly
|
||||
*/
|
||||
public boolean isEditReadOnly();
|
||||
|
||||
/**
|
||||
* @param editReadOnly the editReadOnly to set
|
||||
*/
|
||||
public void setEditReadOnly(boolean editReadOnly);
|
||||
|
||||
/**
|
||||
* @return the list
|
||||
*/
|
||||
public boolean isList();
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
147
src/main/java/com/idcanet/vasc/core/VascEntryFieldSet.java
Normal file
147
src/main/java/com/idcanet/vasc/core/VascEntryFieldSet.java
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* 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 {
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
70
src/main/java/com/idcanet/vasc/core/VascEntryFieldType.java
Normal file
70
src/main/java/com/idcanet/vasc/core/VascEntryFieldType.java
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* 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.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 {
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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();
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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 VascEntryFieldTypeControllerResolver {
|
||||
|
||||
public VascEntryFieldTypeController getVascEntryFieldTypeController();
|
||||
}
|
||||
38
src/main/java/com/idcanet/vasc/core/VascEntryFinalizer.java
Normal file
38
src/main/java/com/idcanet/vasc/core/VascEntryFinalizer.java
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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 {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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 VascEventChannelControllerResolver {
|
||||
|
||||
public VascEventChannelController getVascEventChannelController();
|
||||
}
|
||||
50
src/main/java/com/idcanet/vasc/core/VascException.java
Normal file
50
src/main/java/com/idcanet/vasc/core/VascException.java
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
52
src/main/java/com/idcanet/vasc/core/VascFrontend.java
Normal file
52
src/main/java/com/idcanet/vasc/core/VascFrontend.java
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* 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(Object rowBean) throws Exception;
|
||||
|
||||
public void renderDelete(Object rowBean) throws Exception;
|
||||
|
||||
public void renderExport(VascEntryExporter exporter) throws Exception;
|
||||
}
|
||||
105
src/main/java/com/idcanet/vasc/core/VascFrontendData.java
Normal file
105
src/main/java/com/idcanet/vasc/core/VascFrontendData.java
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* 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.VascEntryResourceResolver;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public interface VascFrontendData {
|
||||
|
||||
/**
|
||||
* @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 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);
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
||||
62
src/main/java/com/idcanet/vasc/core/VascFrontendHelper.java
Normal file
62
src/main/java/com/idcanet/vasc/core/VascFrontendHelper.java
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* 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.VascEntryEventListener;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 28, 2007
|
||||
*/
|
||||
public interface VascFrontendHelper {
|
||||
|
||||
public Integer getTotalColumnsWidth(VascEntry table);
|
||||
|
||||
public void refreshData(VascEntry table) throws Exception;
|
||||
|
||||
public Object initEditObject(VascEntry table,Object object) throws Exception;
|
||||
|
||||
public void initEditObjectColumn(VascEntryField field,Object object) throws Exception;
|
||||
|
||||
public void handleException(Exception e,VascEntry table);
|
||||
|
||||
public void addEventListener(VascEntryEventListener e);
|
||||
|
||||
public void removeEventListener(VascEntryEventListener e);
|
||||
|
||||
public void fireVascEvent(VascEntryEventListener.VascEventType type,Object data);
|
||||
|
||||
public boolean setUIComponentsBeanErrors(VascEntry table,Object bean);
|
||||
|
||||
public void addExceptionListener(VascEntryEventListener listener);
|
||||
|
||||
public void removeExceptionListener(VascEntryEventListener listener);
|
||||
|
||||
public Object mergeObject(VascEntry table,Object object);
|
||||
}
|
||||
40
src/main/java/com/idcanet/vasc/core/VascLinkEntry.java
Normal file
40
src/main/java/com/idcanet/vasc/core/VascLinkEntry.java
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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 7, 2008
|
||||
*/
|
||||
public interface VascLinkEntry {
|
||||
|
||||
public String getVascEntryName();
|
||||
public void setVascEntryName(String vascEntryName);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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();
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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 19, 2008
|
||||
*/
|
||||
public interface VascUserRoleControllerResolver {
|
||||
|
||||
public VascUserRoleController getVascUserRoleController();
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
|
||||
/*
|
||||
* 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 String name = null;
|
||||
private String toolTip = null;
|
||||
private String image = null;
|
||||
private String helpId = null;
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* @return the toolTip
|
||||
*/
|
||||
public String getToolTip() {
|
||||
return toolTip;
|
||||
}
|
||||
/**
|
||||
* @param toolTip the toolTip to set
|
||||
*/
|
||||
public void setToolTip(String toolTip) {
|
||||
this.toolTip = toolTip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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 void doRowAction(VascEntry vascEntry,Object rowObject) throws Exception;
|
||||
}
|
||||
51
src/main/java/com/idcanet/vasc/core/actions/VascAction.java
Normal file
51
src/main/java/com/idcanet/vasc/core/actions/VascAction.java
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* 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 21, 2007
|
||||
*/
|
||||
public interface VascAction {
|
||||
|
||||
public String getName();
|
||||
|
||||
public void setName(String name);
|
||||
|
||||
public String getToolTip();
|
||||
|
||||
public void setToolTip(String toolTip);
|
||||
|
||||
public String getImage();
|
||||
|
||||
public void setImage(String image);
|
||||
|
||||
public String getHelpId();
|
||||
|
||||
public void setHelpId(String helpId);
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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 Aug 02, 2007
|
||||
*/
|
||||
public interface VascEntryEventListener {
|
||||
|
||||
public enum VascEventType { DATA_UPDATE,OPTION_UPDATE,CLOSE_WINDOW,BEAN_MERGE,BEAN_INIT }
|
||||
|
||||
public void vascEvent(VascEventType e,Object o);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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 com.idcanet.vasc.core.VascEntry;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 19, 2007
|
||||
*/
|
||||
public interface VascEntryExporter {
|
||||
|
||||
public void doExport(OutputStream out,VascEntry vascEntry) throws Exception;
|
||||
|
||||
public String getMineType();
|
||||
|
||||
public String getType();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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 Sep 04, 2008
|
||||
*/
|
||||
public interface VascEntryFieldEventChannel {
|
||||
|
||||
public void setChannel(String channel);
|
||||
public String getChannel();
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public interface VascEntryFieldValue {
|
||||
|
||||
public Object getValue(VascEntryField field,Object record) throws VascException;
|
||||
|
||||
public void setValue(VascEntryField field,Object record,Object value) throws VascException;
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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 Mar 21, 2007
|
||||
*/
|
||||
public interface VascEntryRecordCreator {
|
||||
|
||||
public Object newRecord(VascEntry entry) throws Exception;
|
||||
|
||||
public Class<?> getObjectClass();
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
75
src/main/java/com/idcanet/vasc/core/ui/VascSelectItem.java
Normal file
75
src/main/java/com/idcanet/vasc/core/ui/VascSelectItem.java
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
public VascSelectItem() {
|
||||
|
||||
}
|
||||
public VascSelectItem(String label,Object value) {
|
||||
setLabel(label);
|
||||
setValue(value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 12, 2007
|
||||
*/
|
||||
public interface VascSelectItemModel {
|
||||
|
||||
public List<VascSelectItem> getVascSelectItems();
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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 {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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 {
|
||||
|
||||
}
|
||||
57
src/main/java/com/idcanet/vasc/core/ui/VascUIComponent.java
Normal file
57
src/main/java/com/idcanet/vasc/core/ui/VascUIComponent.java
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @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 Exception;
|
||||
|
||||
public void setErrorText(String text);
|
||||
public String getErrorText();
|
||||
}
|
||||
81
src/main/java/com/idcanet/vasc/core/ui/VascValueModel.java
Normal file
81
src/main/java/com/idcanet/vasc/core/ui/VascValueModel.java
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
|
|
@ -0,0 +1,851 @@
|
|||
/*
|
||||
* 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.fff.SwingImageHelper;
|
||||
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.VascEntryExporter;
|
||||
import com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType;
|
||||
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.SwingDate;
|
||||
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 SwingImageHelper.getImageIcon(key);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascViewRenderer#renderEdit(com.idcanet.vasc.core.VascEntry, java.lang.Object)
|
||||
*/
|
||||
public void renderEdit(Object rowBean) throws Exception {
|
||||
logger.fine("Rending Edit View");
|
||||
|
||||
|
||||
|
||||
rowBean = entry.getVascFrontendData().getVascFrontendHelper().initEditObject(entry, rowBean);
|
||||
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().getVascFrontendHelper().mergeObject(entry, result);
|
||||
}
|
||||
|
||||
public void renderDelete(Object rowBean) throws Exception {
|
||||
String beanValue = rowBean.toString();
|
||||
if (entry.getDisplayNameFieldId()!=null) {
|
||||
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().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId()).delete(rowBean);
|
||||
entry.getVascFrontendData().getEntryDataList().remove(rowBean);
|
||||
entry.getVascFrontendData().setEntryDataObject(null);
|
||||
//entry.getVascFrontendController().getVascFrontendHelper().fireVascEvent(VascEventListener.VascEventType.DATA_UPDATE, rowBean);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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()) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().initEditObjectColumn(c, bean);
|
||||
if (c.isEdit()==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().setUIComponentsBeanErrors(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(e, entry);
|
||||
} 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.getHeaderImage()!=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.getHeaderDescription()!=null) {
|
||||
l.setToolTipText(i18n(entry.getHeaderDescription()));
|
||||
}
|
||||
header.add(l,BorderLayout.WEST);
|
||||
}
|
||||
|
||||
if(entry.getHeaderName()!=null) {
|
||||
JLabel l = new JLabel(i18n(entry.getHeaderName()));
|
||||
l.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
l.setFont(new Font(null,Font.BOLD, 18));
|
||||
if (entry.getHeaderDescription()!=null) {
|
||||
l.setToolTipText(i18n(entry.getHeaderDescription()));
|
||||
}
|
||||
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.getToolTip()));
|
||||
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();
|
||||
//TODO: remove this extra model for sorting, AND fixup a real sorting stuff
|
||||
TableSorter tableSorter = new TableSorter();
|
||||
// this regs the listeners for the sorting
|
||||
tableSorter.setTableHeader(table.getTableHeader());
|
||||
tableSorter.setTableModel(model);
|
||||
|
||||
|
||||
table.setModel(tableSorter);
|
||||
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.isList()==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,tableSorter));
|
||||
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
|
||||
table.addMouseListener(new MouseAdapter() {
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (e.getClickCount() == 2) {
|
||||
Object o = entry.getVascFrontendData().getEntryDataObject();
|
||||
if (o==null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// TODO: fix this
|
||||
entry.getVascFrontendData().getVascFrontend().renderEdit(o);
|
||||
} catch (Exception ee) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(ee, entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
JScrollPane scrollPane = new JScrollPane(table);
|
||||
parent2.add(scrollPane);
|
||||
}
|
||||
class entrySectionListener implements ListSelectionListener {
|
||||
JTable table;
|
||||
TableSorter tableSorter;
|
||||
entrySectionListener(JTable table,TableSorter tableSorter) {
|
||||
this.table = table;
|
||||
this.tableSorter=tableSorter;
|
||||
}
|
||||
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().getEntryDataList().get(rowIndex);
|
||||
entry.getVascFrontendData().setEntryDataObject(data);
|
||||
} else {
|
||||
entry.getVascFrontendData().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.getToolTip()));
|
||||
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().getEntryDataObject());
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(e, entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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(e, entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class VascColumnModel extends AbstractTableModel { //implements VascEventListener {
|
||||
private static final long serialVersionUID = 10L;
|
||||
|
||||
public void vascEvent(VascEventType e,Object o) {
|
||||
if (e==VascEventType.DATA_UPDATE) {
|
||||
fireTableDataChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.swing.entry.entryModel#getColumnCount()
|
||||
*/
|
||||
public int getColumnCount() {
|
||||
int result = 0;
|
||||
for(VascEntryField c:entry.getVascEntryFields()) {
|
||||
if (c.isList()==false) {
|
||||
continue;
|
||||
}
|
||||
result++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.swing.entry.entryModel#getRowCount()
|
||||
*/
|
||||
public int getRowCount() {
|
||||
if (entry.getVascFrontendData().getEntryDataList()==null) {
|
||||
return 0;
|
||||
}
|
||||
return entry.getVascFrontendData().getEntryDataList().size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.swing.entry.entryModel#getValueAt(int, int)
|
||||
*/
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
Object bean = entry.getVascFrontendData().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.isList()==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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
||||
492
src/main/java/com/idcanet/vasc/frontends/swing/TableSorter.java
Normal file
492
src/main/java/com/idcanet/vasc/frontends/swing/TableSorter.java
Normal file
|
|
@ -0,0 +1,492 @@
|
|||
/*
|
||||
*
|
||||
*
|
||||
* THIS FILE IS FROM:
|
||||
* http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#sorting
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.frontends.swing;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
import javax.swing.event.TableModelListener;
|
||||
import javax.swing.table.*;
|
||||
|
||||
/**
|
||||
* TableSorter is a decorator for TableModels; adding sorting
|
||||
* functionality to a supplied TableModel. TableSorter does
|
||||
* not store or copy the data in its TableModel; instead it maintains
|
||||
* a map from the row indexes of the view to the row indexes of the
|
||||
* model. As requests are made of the sorter (like getValueAt(row, col))
|
||||
* they are passed to the underlying model after the row numbers
|
||||
* have been translated via the internal mapping array. This way,
|
||||
* the TableSorter appears to hold another copy of the table
|
||||
* with the rows in a different order.
|
||||
* <p/>
|
||||
* TableSorter registers itself as a listener to the underlying model,
|
||||
* just as the JTable itself would. Events recieved from the model
|
||||
* are examined, sometimes manipulated (typically widened), and then
|
||||
* passed on to the TableSorter's listeners (typically the JTable).
|
||||
* If a change to the model has invalidated the order of TableSorter's
|
||||
* rows, a note of this is made and the sorter will resort the
|
||||
* rows the next time a value is requested.
|
||||
* <p/>
|
||||
* When the tableHeader property is set, either by using the
|
||||
* setTableHeader() method or the two argument constructor, the
|
||||
* table header may be used as a complete UI for TableSorter.
|
||||
* The default renderer of the tableHeader is decorated with a renderer
|
||||
* that indicates the sorting status of each column. In addition,
|
||||
* a mouse listener is installed with the following behavior:
|
||||
* <ul>
|
||||
* <li>
|
||||
* Mouse-click: Clears the sorting status of all other columns
|
||||
* and advances the sorting status of that column through three
|
||||
* values: {NOT_SORTED, ASCENDING, DESCENDING} (then back to
|
||||
* NOT_SORTED again).
|
||||
* <li>
|
||||
* SHIFT-mouse-click: Clears the sorting status of all other columns
|
||||
* and cycles the sorting status of the column through the same
|
||||
* three values, in the opposite order: {NOT_SORTED, DESCENDING, ASCENDING}.
|
||||
* <li>
|
||||
* CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except
|
||||
* that the changes to the column do not cancel the statuses of columns
|
||||
* that are already sorting - giving a way to initiate a compound
|
||||
* sort.
|
||||
* </ul>
|
||||
* <p/>
|
||||
* This is a long overdue rewrite of a class of the same name that
|
||||
* first appeared in the swing table demos in 1997.
|
||||
*
|
||||
* @author Philip Milne
|
||||
* @author Brendon McLean
|
||||
* @author Dan van Enckevort
|
||||
* @author Parwinder Sekhon
|
||||
* @version 2.0 02/27/04
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class TableSorter extends AbstractTableModel {
|
||||
|
||||
private static final long serialVersionUID = 10L;
|
||||
protected TableModel tableModel;
|
||||
|
||||
public static final int DESCENDING = -1;
|
||||
public static final int NOT_SORTED = 0;
|
||||
public static final int ASCENDING = 1;
|
||||
|
||||
private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED);
|
||||
|
||||
public static final Comparator COMPARABLE_COMAPRATOR = new Comparator() {
|
||||
public int compare(Object o1, Object o2) {
|
||||
return ((Comparable) o1).compareTo(o2);
|
||||
}
|
||||
};
|
||||
public static final Comparator LEXICAL_COMPARATOR = new Comparator() {
|
||||
public int compare(Object o1, Object o2) {
|
||||
return o1.toString().compareTo(o2.toString());
|
||||
}
|
||||
};
|
||||
|
||||
private Row[] viewToModel;
|
||||
private int[] modelToView;
|
||||
|
||||
private JTableHeader tableHeader;
|
||||
private MouseListener mouseListener;
|
||||
private TableModelListener tableModelListener;
|
||||
private Map columnComparators = new HashMap();
|
||||
private List sortingColumns = new ArrayList();
|
||||
|
||||
public TableSorter() {
|
||||
this.mouseListener = new MouseHandler();
|
||||
this.tableModelListener = new TableModelHandler();
|
||||
}
|
||||
|
||||
public TableSorter(TableModel tableModel) {
|
||||
this();
|
||||
setTableModel(tableModel);
|
||||
}
|
||||
|
||||
public TableSorter(TableModel tableModel, JTableHeader tableHeader) {
|
||||
this();
|
||||
setTableHeader(tableHeader);
|
||||
setTableModel(tableModel);
|
||||
}
|
||||
|
||||
private void clearSortingState() {
|
||||
viewToModel = null;
|
||||
modelToView = null;
|
||||
}
|
||||
|
||||
public TableModel getTableModel() {
|
||||
return tableModel;
|
||||
}
|
||||
|
||||
public void setTableModel(TableModel tableModel) {
|
||||
if (this.tableModel != null) {
|
||||
this.tableModel.removeTableModelListener(tableModelListener);
|
||||
}
|
||||
|
||||
this.tableModel = tableModel;
|
||||
if (this.tableModel != null) {
|
||||
this.tableModel.addTableModelListener(tableModelListener);
|
||||
}
|
||||
|
||||
clearSortingState();
|
||||
fireTableStructureChanged();
|
||||
}
|
||||
|
||||
public JTableHeader getTableHeader() {
|
||||
return tableHeader;
|
||||
}
|
||||
|
||||
public void setTableHeader(JTableHeader tableHeader) {
|
||||
if (this.tableHeader != null) {
|
||||
this.tableHeader.removeMouseListener(mouseListener);
|
||||
TableCellRenderer defaultRenderer = this.tableHeader.getDefaultRenderer();
|
||||
if (defaultRenderer instanceof SortableHeaderRenderer) {
|
||||
this.tableHeader.setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer);
|
||||
}
|
||||
}
|
||||
this.tableHeader = tableHeader;
|
||||
if (this.tableHeader != null) {
|
||||
this.tableHeader.addMouseListener(mouseListener);
|
||||
this.tableHeader.setDefaultRenderer(
|
||||
new SortableHeaderRenderer(this.tableHeader.getDefaultRenderer()));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSorting() {
|
||||
return sortingColumns.size() != 0;
|
||||
}
|
||||
|
||||
private Directive getDirective(int column) {
|
||||
for (int i = 0; i < sortingColumns.size(); i++) {
|
||||
Directive directive = (Directive)sortingColumns.get(i);
|
||||
if (directive.column == column) {
|
||||
return directive;
|
||||
}
|
||||
}
|
||||
return EMPTY_DIRECTIVE;
|
||||
}
|
||||
|
||||
public int getSortingStatus(int column) {
|
||||
return getDirective(column).direction;
|
||||
}
|
||||
|
||||
private void sortingStatusChanged() {
|
||||
clearSortingState();
|
||||
fireTableDataChanged();
|
||||
if (tableHeader != null) {
|
||||
tableHeader.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSortingStatus(int column, int status) {
|
||||
Directive directive = getDirective(column);
|
||||
if (directive != EMPTY_DIRECTIVE) {
|
||||
sortingColumns.remove(directive);
|
||||
}
|
||||
if (status != NOT_SORTED) {
|
||||
sortingColumns.add(new Directive(column, status));
|
||||
}
|
||||
sortingStatusChanged();
|
||||
}
|
||||
|
||||
protected Icon getHeaderRendererIcon(int column, int size) {
|
||||
Directive directive = getDirective(column);
|
||||
if (directive == EMPTY_DIRECTIVE) {
|
||||
return null;
|
||||
}
|
||||
return new Arrow(directive.direction == DESCENDING, size, sortingColumns.indexOf(directive));
|
||||
}
|
||||
|
||||
private void cancelSorting() {
|
||||
sortingColumns.clear();
|
||||
sortingStatusChanged();
|
||||
}
|
||||
|
||||
public void setColumnComparator(Class type, Comparator comparator) {
|
||||
if (comparator == null) {
|
||||
columnComparators.remove(type);
|
||||
} else {
|
||||
columnComparators.put(type, comparator);
|
||||
}
|
||||
}
|
||||
|
||||
protected Comparator getComparator(int column) {
|
||||
Class columnType = tableModel.getColumnClass(column);
|
||||
Comparator comparator = (Comparator) columnComparators.get(columnType);
|
||||
if (comparator != null) {
|
||||
return comparator;
|
||||
}
|
||||
if (Comparable.class.isAssignableFrom(columnType)) {
|
||||
return COMPARABLE_COMAPRATOR;
|
||||
}
|
||||
return LEXICAL_COMPARATOR;
|
||||
}
|
||||
|
||||
private Row[] getViewToModel() {
|
||||
if (viewToModel == null) {
|
||||
int tableModelRowCount = tableModel.getRowCount();
|
||||
viewToModel = new Row[tableModelRowCount];
|
||||
for (int row = 0; row < tableModelRowCount; row++) {
|
||||
viewToModel[row] = new Row(row);
|
||||
}
|
||||
|
||||
if (isSorting()) {
|
||||
Arrays.sort(viewToModel);
|
||||
}
|
||||
}
|
||||
return viewToModel;
|
||||
}
|
||||
|
||||
public int modelIndex(int viewIndex) {
|
||||
return getViewToModel()[viewIndex].modelIndex;
|
||||
}
|
||||
|
||||
private int[] getModelToView() {
|
||||
if (modelToView == null) {
|
||||
int n = getViewToModel().length;
|
||||
modelToView = new int[n];
|
||||
for (int i = 0; i < n; i++) {
|
||||
modelToView[modelIndex(i)] = i;
|
||||
}
|
||||
}
|
||||
return modelToView;
|
||||
}
|
||||
|
||||
// TableModel interface methods
|
||||
|
||||
public int getRowCount() {
|
||||
return (tableModel == null) ? 0 : tableModel.getRowCount();
|
||||
}
|
||||
|
||||
public int getColumnCount() {
|
||||
return (tableModel == null) ? 0 : tableModel.getColumnCount();
|
||||
}
|
||||
|
||||
public String getColumnName(int column) {
|
||||
return tableModel.getColumnName(column);
|
||||
}
|
||||
|
||||
public Class getColumnClass(int column) {
|
||||
return tableModel.getColumnClass(column);
|
||||
}
|
||||
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return tableModel.isCellEditable(modelIndex(row), column);
|
||||
}
|
||||
|
||||
public Object getValueAt(int row, int column) {
|
||||
return tableModel.getValueAt(modelIndex(row), column);
|
||||
}
|
||||
|
||||
public void setValueAt(Object aValue, int row, int column) {
|
||||
tableModel.setValueAt(aValue, modelIndex(row), column);
|
||||
}
|
||||
|
||||
// Helper classes
|
||||
|
||||
private class Row implements Comparable {
|
||||
private int modelIndex;
|
||||
|
||||
public Row(int index) {
|
||||
this.modelIndex = index;
|
||||
}
|
||||
|
||||
public int compareTo(Object o) {
|
||||
int row1 = modelIndex;
|
||||
int row2 = ((Row) o).modelIndex;
|
||||
|
||||
for (Iterator it = sortingColumns.iterator(); it.hasNext();) {
|
||||
Directive directive = (Directive) it.next();
|
||||
int column = directive.column;
|
||||
Object o1 = tableModel.getValueAt(row1, column);
|
||||
Object o2 = tableModel.getValueAt(row2, column);
|
||||
|
||||
int comparison = 0;
|
||||
// Define null less than everything, except null.
|
||||
if (o1 == null && o2 == null) {
|
||||
comparison = 0;
|
||||
} else if (o1 == null) {
|
||||
comparison = -1;
|
||||
} else if (o2 == null) {
|
||||
comparison = 1;
|
||||
} else {
|
||||
comparison = getComparator(column).compare(o1, o2);
|
||||
}
|
||||
if (comparison != 0) {
|
||||
return directive.direction == DESCENDING ? -comparison : comparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private class TableModelHandler implements TableModelListener {
|
||||
public void tableChanged(TableModelEvent e) {
|
||||
// If we're not sorting by anything, just pass the event along.
|
||||
if (!isSorting()) {
|
||||
clearSortingState();
|
||||
fireTableChanged(e);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the table structure has changed, cancel the sorting; the
|
||||
// sorting columns may have been either moved or deleted from
|
||||
// the model.
|
||||
if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
|
||||
cancelSorting();
|
||||
fireTableChanged(e);
|
||||
return;
|
||||
}
|
||||
|
||||
// We can map a cell event through to the view without widening
|
||||
// when the following conditions apply:
|
||||
//
|
||||
// a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and,
|
||||
// b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and,
|
||||
// c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and,
|
||||
// d) a reverse lookup will not trigger a sort (modelToView != null)
|
||||
//
|
||||
// Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS.
|
||||
//
|
||||
// The last check, for (modelToView != null) is to see if modelToView
|
||||
// is already allocated. If we don't do this check; sorting can become
|
||||
// a performance bottleneck for applications where cells
|
||||
// change rapidly in different parts of the table. If cells
|
||||
// change alternately in the sorting column and then outside of
|
||||
// it this class can end up re-sorting on alternate cell updates -
|
||||
// which can be a performance problem for large tables. The last
|
||||
// clause avoids this problem.
|
||||
int column = e.getColumn();
|
||||
if (e.getFirstRow() == e.getLastRow()
|
||||
&& column != TableModelEvent.ALL_COLUMNS
|
||||
&& getSortingStatus(column) == NOT_SORTED
|
||||
&& modelToView != null) {
|
||||
int viewIndex = getModelToView()[e.getFirstRow()];
|
||||
fireTableChanged(new TableModelEvent(TableSorter.this,
|
||||
viewIndex, viewIndex,
|
||||
column, e.getType()));
|
||||
return;
|
||||
}
|
||||
|
||||
// Something has happened to the data that may have invalidated the row order.
|
||||
clearSortingState();
|
||||
fireTableDataChanged();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private class MouseHandler extends MouseAdapter {
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
JTableHeader h = (JTableHeader) e.getSource();
|
||||
TableColumnModel columnModel = h.getColumnModel();
|
||||
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
|
||||
int column = columnModel.getColumn(viewColumn).getModelIndex();
|
||||
if (column != -1) {
|
||||
int status = getSortingStatus(column);
|
||||
if (!e.isControlDown()) {
|
||||
cancelSorting();
|
||||
}
|
||||
// Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
|
||||
// {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.
|
||||
status = status + (e.isShiftDown() ? -1 : 1);
|
||||
status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
|
||||
setSortingStatus(column, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class Arrow implements Icon {
|
||||
private boolean descending;
|
||||
private int size;
|
||||
private int priority;
|
||||
|
||||
public Arrow(boolean descending, int size, int priority) {
|
||||
this.descending = descending;
|
||||
this.size = size;
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
Color color = c == null ? Color.GRAY : c.getBackground();
|
||||
// In a compound sort, make each succesive triangle 20%
|
||||
// smaller than the previous one.
|
||||
int dx = (int)(size/2*Math.pow(0.8, priority));
|
||||
int dy = descending ? dx : -dx;
|
||||
// Align icon (roughly) with font baseline.
|
||||
y = y + 5*size/6 + (descending ? -dy : 0);
|
||||
int shift = descending ? 1 : -1;
|
||||
g.translate(x, y);
|
||||
|
||||
// Right diagonal.
|
||||
g.setColor(color.darker());
|
||||
g.drawLine(dx / 2, dy, 0, 0);
|
||||
g.drawLine(dx / 2, dy + shift, 0, shift);
|
||||
|
||||
// Left diagonal.
|
||||
g.setColor(color.brighter());
|
||||
g.drawLine(dx / 2, dy, dx, 0);
|
||||
g.drawLine(dx / 2, dy + shift, dx, shift);
|
||||
|
||||
// Horizontal line.
|
||||
if (descending) {
|
||||
g.setColor(color.darker().darker());
|
||||
} else {
|
||||
g.setColor(color.brighter().brighter());
|
||||
}
|
||||
g.drawLine(dx, 0, 0, 0);
|
||||
|
||||
g.setColor(color);
|
||||
g.translate(-x, -y);
|
||||
}
|
||||
|
||||
public int getIconWidth() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public int getIconHeight() {
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
private class SortableHeaderRenderer implements TableCellRenderer {
|
||||
private TableCellRenderer tableCellRenderer;
|
||||
|
||||
public SortableHeaderRenderer(TableCellRenderer tableCellRenderer) {
|
||||
this.tableCellRenderer = tableCellRenderer;
|
||||
}
|
||||
|
||||
public Component getTableCellRendererComponent(JTable table,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
boolean hasFocus,
|
||||
int row,
|
||||
int column) {
|
||||
Component c = tableCellRenderer.getTableCellRendererComponent(table,
|
||||
value, isSelected, hasFocus, row, column);
|
||||
if (c instanceof JLabel) {
|
||||
JLabel l = (JLabel) c;
|
||||
l.setHorizontalTextPosition(JLabel.LEFT);
|
||||
int modelColumn = table.convertColumnIndexToModel(column);
|
||||
l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize()));
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Directive {
|
||||
private int column;
|
||||
private int direction;
|
||||
|
||||
public Directive(int column, int direction) {
|
||||
this.column = column;
|
||||
this.direction = direction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* 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.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 Exception {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
class SelectActionListener implements ActionListener {
|
||||
|
||||
private VascValueModel model;
|
||||
private VascEntry table = null;
|
||||
public SelectActionListener(VascValueModel model,VascEntry table) {
|
||||
this.model=model;
|
||||
this.table=table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
table.getVascFrontendData().getVascFrontendHelper().handleException(ee, table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* 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.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 Exception {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
* 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 Exception {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
class SelectActionListener3 implements ActionListener {
|
||||
|
||||
private VascValueModel model;
|
||||
private boolean hexEncoding = false;
|
||||
private VascEntry table = null;
|
||||
public SelectActionListener3(VascValueModel model,boolean hexEncoding,VascEntry table) {
|
||||
this.model=model;
|
||||
this.hexEncoding=hexEncoding;
|
||||
this.table=table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
table.getVascFrontendData().getVascFrontendHelper().handleException(ee, table);
|
||||
}
|
||||
} 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) {
|
||||
table.getVascFrontendData().getVascFrontendHelper().handleException(ee, table);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
108
src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingDate.java
Normal file
108
src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingDate.java
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* 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.util.Date;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
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 Exception {
|
||||
datePicker = new DatePicker();
|
||||
orgBackgroundColor = datePicker.getBackground();
|
||||
datePicker.setDate((Date)model.getValue());
|
||||
((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);
|
||||
}
|
||||
}
|
||||
}
|
||||
class SelectActionListener2 implements ActionListener {
|
||||
|
||||
private VascValueModel model;
|
||||
private VascEntry table = null;
|
||||
public SelectActionListener2(VascValueModel model,VascEntry table) {
|
||||
this.model=model;
|
||||
this.table=table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
table.getVascFrontendData().getVascFrontendHelper().handleException(ee, table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* 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.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 Exception {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
141
src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingList.java
Normal file
141
src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingList.java
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* 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.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 table,VascEntryField entryField,final VascValueModel model,Object gui) throws Exception {
|
||||
VascSelectItemModel items = (VascSelectItemModel)entryField.getVascEntryFieldType().getDataObject();
|
||||
if (items==null) {
|
||||
comboBox = new JComboBox();
|
||||
} else {
|
||||
comboBox = new JComboBox(items.getVascSelectItems().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) {
|
||||
table.getVascFrontendData().getVascFrontendHelper().handleException(ee, table);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
130
src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingText.java
Normal file
130
src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingText.java
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* 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.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 Exception {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* 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.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.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 Exception {
|
||||
textArea = new JTextArea();
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,719 @@
|
|||
/*
|
||||
* 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.resource.ImageDescriptor;
|
||||
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.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.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.Dialog;
|
||||
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.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.fff.SwingImageHelper;
|
||||
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.VascEntryExporter;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingLabel;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingList;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingText;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class SwtVascFrontend extends AbstractVascFrontend {
|
||||
|
||||
private Logger logger = null;
|
||||
private Composite parent = null;
|
||||
|
||||
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,SwingLabel.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_TEXT, SwingText.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_LIST, SwingList.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());
|
||||
}
|
||||
|
||||
|
||||
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.getHeaderName()+".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(Object object) throws Exception {
|
||||
|
||||
logger.fine("Rending Edit View");
|
||||
entry.getVascFrontendData().getVascFrontendHelper().initEditObject(entry, object);
|
||||
|
||||
SwtVascEditDialog dialog = new SwtVascEditDialog(Display.getCurrent().getActiveShell(),object,"Vasc Edit","Edit");
|
||||
Object result = dialog.open();
|
||||
if(result==null) {
|
||||
return;
|
||||
}
|
||||
/*
|
||||
try {
|
||||
result = entry.getVascDataSource().merge(object);
|
||||
//table.getVascTableController().fireModelUpdateListeners(result);
|
||||
} finally {
|
||||
//TODO: or merge into table == faster
|
||||
entry.getVascTableController().refreshData(entry);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public ImageDescriptor getImageDescriptor(String path) {
|
||||
try {
|
||||
path = i18n(path);
|
||||
|
||||
|
||||
logger.fine("Loading image: "+path);
|
||||
ImageDescriptor result = ImageDescriptor.createFromFile(path.getClass(), path);
|
||||
result = ImageDescriptor.createFromFile(SwingImageHelper.class, path);
|
||||
if(result==null) {
|
||||
// try load fff
|
||||
//result = ImageDescriptor.createFromURL(SwingImageHelper.class.getClass().getResource(path));
|
||||
}
|
||||
if(result==null) {
|
||||
throw new NullPointerException("Can't load resource: "+path);
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
logger.warning("Could not load image from path: '"+path+"'");
|
||||
try {
|
||||
ImageDescriptor result = null; //ImageDescriptor.createFromURL(SwingImageHelper.class.getClass().getResource("/META-INF/images/silk/png/bomb.png"));
|
||||
if(result==null) {
|
||||
throw new NullPointerException("Can't load resource: "+path);
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e2) {
|
||||
return ImageDescriptor.getMissingImageDescriptor(); // default swt missing image fall back
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void renderDelete(Object rowBean) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
public class SwtVascEditDialog extends Dialog {
|
||||
|
||||
private Shell shell = null;
|
||||
//private String headerText = null;
|
||||
private String title = null;
|
||||
private Object result = null;
|
||||
private Object bean = null;
|
||||
|
||||
public SwtVascEditDialog (Shell parent,Object bean,String title,String headerText) {
|
||||
super (parent, 0);
|
||||
///this.headerText = headerText;
|
||||
this.title = title;
|
||||
this.bean = bean;
|
||||
}
|
||||
public Object open() {
|
||||
shell = new Shell(getParent(), SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
|
||||
shell.setText(title);
|
||||
|
||||
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);
|
||||
|
||||
// should be last
|
||||
partCreated();
|
||||
|
||||
shell.pack();
|
||||
shell.open();
|
||||
|
||||
Display display = shell.getDisplay();
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch()) {
|
||||
display.sleep();
|
||||
}
|
||||
}
|
||||
//image.dispose();
|
||||
//closeDialog();
|
||||
return result;
|
||||
}
|
||||
|
||||
public void createBody(Composite body) {
|
||||
body.setLayout(new GridLayout(2, true));
|
||||
body.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
for(VascEntryField c:entry.getVascEntryFields()) {
|
||||
Label l = new Label(body, SWT.WRAP);
|
||||
l.setText(i18n(c.getName()));
|
||||
|
||||
if(c.getDescription()!=null) {
|
||||
l.setToolTipText(i18n(c.getDescription()));
|
||||
}
|
||||
|
||||
try {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().initEditObjectColumn(c, bean);
|
||||
|
||||
//if(c.getVascColumnEditor()==null) {
|
||||
Label valueLabel = new Label(body, SWT.WRAP);
|
||||
valueLabel.setText(""+c.getVascEntryFieldValue().getValue(c, bean));
|
||||
//c.setColumnEditor(valueLabel);
|
||||
/*
|
||||
} else {
|
||||
c.setColumnEditor(c.getVascColumnEditor().createColumnEditor(c,bean,body));
|
||||
}
|
||||
*/
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.WARNING,"Error making column editor: '"+c.getVascEntryFieldValue()+"' error: "+e.getMessage(),e);
|
||||
}
|
||||
|
||||
/*
|
||||
if(c.getColumnEditor() instanceof Control) {
|
||||
Control editor = (Control)c.getColumnEditor();
|
||||
GridData gridData = new GridData();
|
||||
gridData.grabExcessHorizontalSpace = true;
|
||||
gridData.grabExcessVerticalSpace = true;
|
||||
gridData.horizontalAlignment = GridData.FILL;
|
||||
gridData.verticalAlignment = GridData.FILL;
|
||||
editor.setLayoutData(gridData);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// create some spaceing , should replace by seperator
|
||||
new Label(body, SWT.WRAP);
|
||||
new Label(body, SWT.WRAP);
|
||||
|
||||
Button saveButton = new Button(body, SWT.NONE);
|
||||
saveButton.setImage(getImageDescriptor("vasc.dialog.save.image").createImage());
|
||||
saveButton.setText(i18n("vasc.dialog.save.name"));
|
||||
saveButton.setToolTipText(i18n("vasc.dialog.save.tooltip"));
|
||||
saveButton.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
//if(hasRecordError()) {
|
||||
// return;
|
||||
//}
|
||||
//result = bean;
|
||||
shell.dispose();
|
||||
}
|
||||
});
|
||||
Button cancelButton = new Button(body, SWT.NONE);
|
||||
cancelButton.setImage(getImageDescriptor("vasc.dialog.cancel.image").createImage());
|
||||
cancelButton.setText(i18n("vasc.dialog.cancel.name"));
|
||||
cancelButton.setToolTipText(i18n("vasc.dialog.cancel.tooltip"));
|
||||
cancelButton.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
result = null;
|
||||
shell.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public Object defaultColumnEditor(VascEntryField column,Object bean,Object gui) throws Exception {
|
||||
|
||||
Composite body = (Composite)gui;
|
||||
Text text = new Text(body,SWT.SINGLE);
|
||||
text.addSelectionListener(new TextListener(column,bean));
|
||||
text.setText(""+column.getVascEntryFieldValue().getValue(column, bean));
|
||||
return text;
|
||||
}
|
||||
|
||||
class TextListener extends SelectionAdapter {
|
||||
|
||||
private VascEntryField column = null;
|
||||
private Object bean = null;
|
||||
|
||||
public TextListener(VascEntryField column,Object bean) {
|
||||
this.column=column;
|
||||
this.bean=bean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
|
||||
*/
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
// SHIT it works :)
|
||||
Object value = e.data;
|
||||
logger.finer("Setting value: "+value);
|
||||
try {
|
||||
column.getVascEntryFieldValue().setValue(column, bean, value);
|
||||
} catch (Exception ee) {
|
||||
ee.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
// should be last
|
||||
partCreated();
|
||||
}
|
||||
|
||||
|
||||
public void createHeader(Composite header) {
|
||||
logger.finest("Creating header");
|
||||
|
||||
GridLayout layout = new GridLayout();
|
||||
layout.marginHeight = 0;
|
||||
layout.marginWidth = 0;
|
||||
header.setLayout(layout);
|
||||
header.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
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));
|
||||
|
||||
Composite headerName = new Composite(header, SWT.NONE);
|
||||
GridLayout bodyLayout = new GridLayout();
|
||||
bodyLayout.numColumns = 1;
|
||||
headerName.setLayout(bodyLayout);
|
||||
headerName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
//headerName.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
Composite headerOptions = new Composite(header, SWT.NONE);
|
||||
GridLayout footerLayout = new GridLayout();
|
||||
footerLayout.numColumns = 1;
|
||||
headerOptions.setLayout(footerLayout);
|
||||
//headerOptions.setLayoutData(new GridData(SWT.NONE));
|
||||
headerOptions.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
ToolBar toolBar = new ToolBar(headerBar, SWT.NONE);
|
||||
for (GlobalVascAction action:entry.getGlobalActions()) {
|
||||
ToolItem item = new ToolItem(toolBar, SWT.PUSH);
|
||||
item.setText(i18n(action.getName()));
|
||||
item.setToolTipText(i18n(action.getToolTip()));
|
||||
if (action.getImage()!=null) {
|
||||
item.setImage(getImageDescriptor(action.getImage()).createImage());
|
||||
}
|
||||
item.addSelectionListener(new GlobalActionListener(action));
|
||||
}
|
||||
|
||||
|
||||
Color c = new Color(header.getDisplay(),255,255,255);
|
||||
headerName.setBackground(c);
|
||||
if(entry.getHeaderName()!=null) {
|
||||
Font headerFont = new Font(header.getDisplay(), "verdana", 16, SWT.BOLD);
|
||||
Label l = new Label(headerName, SWT.CENTER);
|
||||
l.setImage(getImageDescriptor(entry.getHeaderImage()).createImage());
|
||||
l.setFont(headerFont);
|
||||
l.setText(i18n(entry.getHeaderName()));
|
||||
l.setBackground(c);
|
||||
}
|
||||
|
||||
// create options
|
||||
//for(VascUserOption option:table.getUserOptions()) {
|
||||
|
||||
/*
|
||||
if(option.getLabelText()!=null) {
|
||||
Label l = new Label(header,SWT.WRAP);
|
||||
l.setText(crudTable.i18n(cpo.getLabelText()));
|
||||
l.setBackground(c);
|
||||
}
|
||||
|
||||
// create ValueHolder
|
||||
cpo.setValueHolder(new ValueHolder(null));
|
||||
// create control
|
||||
cpo.setTempObjectPropertyControl(cpo.getPropertyEditor().createPropertyEditor(header,cpo.getValueHolder()));
|
||||
|
||||
cpo.getValueHolder().addPropertyChangeListener(this);
|
||||
*/
|
||||
//}
|
||||
}
|
||||
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(e, entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void createBody(Composite body) {
|
||||
logger.finer("Creating body");
|
||||
|
||||
// Create the table viewer to display the players
|
||||
final TableViewer tableViewer = new TableViewer(body, SWT.SINGLE | 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);
|
||||
|
||||
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().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;
|
||||
}
|
||||
// sort the data based on column and direction
|
||||
//String prop = (String)currentColumn.getData("PROP");
|
||||
|
||||
//List l = new ArrayList(10);
|
||||
/*
|
||||
* //columns[i].setData("PROP",table.getTableColumns().get(i)....);
|
||||
*
|
||||
for(int i=0;i<crudTable.getSelectionInList().getSize();i++) {
|
||||
l.add(crudTable.getSelectionInList().getElementAt(i));
|
||||
}
|
||||
BeanPropertyComparator c = new BeanPropertyComparator();
|
||||
c.setAscending(dir!=SWT.DOWN);
|
||||
c.setProperty(prop);
|
||||
Collections.sort(l,c);
|
||||
crudTable.getSelectionInList().setList(l);
|
||||
*/
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
for(VascEntryField c:entry.getVascEntryFields()) {
|
||||
TableColumn tc = new TableColumn(table2, SWT.LEFT);
|
||||
tc.setText(c.getName());
|
||||
tc.setToolTipText(c.getDescription());
|
||||
if (c.getImage()!=null) {
|
||||
tc.setImage(getImageDescriptor(c.getImage()).createImage());
|
||||
}
|
||||
tc.addListener(SWT.Selection, sortListener);
|
||||
tc.setMoveable(false);
|
||||
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++) {
|
||||
Integer cWidth = entry.getVascEntryFields().get(i).getSizeEdit();
|
||||
if (cWidth==null) {
|
||||
break;
|
||||
}
|
||||
//int w = (int)((double)totalSize/(double)totalSize)*cWidth;
|
||||
columns[i].setWidth(cWidth);
|
||||
columns[i].pack();
|
||||
//logger.finest("Setting column width: "+w+" total: "+totalSize+" c: "+cWidth+" of column: "+i);
|
||||
}
|
||||
logger.fine("Table with columns created: "+table2.getColumnCount());
|
||||
|
||||
tableViewer.setInput(entry);
|
||||
}
|
||||
|
||||
|
||||
public void createFooter(Composite footer) {
|
||||
logger.finest("Creating footer");
|
||||
for(RowVascAction action:entry.getRowActions()) {
|
||||
Button actionButton = new Button(footer, SWT.NONE);
|
||||
actionButton.setText(i18n(action.getName()));
|
||||
actionButton.setToolTipText(i18n(action.getToolTip()));
|
||||
if (action.getImage()!=null) {
|
||||
actionButton.setImage(getImageDescriptor(action.getImage()).createImage());
|
||||
}
|
||||
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().getEntryDataObject());
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(e, entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is called when all createPartControl is done with creating Parts
|
||||
*/
|
||||
public void partCreated() {
|
||||
|
||||
}
|
||||
|
||||
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) {
|
||||
VascEntryField vtc = entry.getVascEntryFields().get(columnNumber);
|
||||
//if (vtc.getVascColumnRenderer()==null) {
|
||||
try {
|
||||
return ""+vtc.getVascEntryFieldValue().getValue(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().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) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* 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.Date;
|
||||
|
||||
import javax.el.ValueExpression;
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.component.UIComponentBase;
|
||||
import javax.faces.component.html.HtmlInputText;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 16, 2008
|
||||
*/
|
||||
public class VascUIComponent extends UIComponentBase {
|
||||
|
||||
public static final String COMPONENT_TYPE = "vasc-jsf";
|
||||
//public static final String RENDERER_TYPE = "com.idcanet.vasc.frontends.web.jsf.VascUIComponentRenderer";
|
||||
|
||||
private Object[] state = null;
|
||||
protected String bar;
|
||||
|
||||
public VascUIComponent() {
|
||||
//setRendererType(RENDERER_TYPE);
|
||||
}
|
||||
|
||||
public String getFamily () {
|
||||
return COMPONENT_TYPE;
|
||||
}
|
||||
|
||||
public String getBar() {
|
||||
if (null != this.bar) {
|
||||
return this.bar;
|
||||
}
|
||||
ValueExpression ve = getValueExpression("bar");
|
||||
return (ve != null) ? (String) ve.getValue(getFacesContext().getELContext()) : null;
|
||||
}
|
||||
|
||||
|
||||
public void encodeBegin(FacesContext context) throws IOException {
|
||||
ResponseWriter writer = context.getResponseWriter();
|
||||
|
||||
writer.append("<p>");
|
||||
writer.append(" Today is: " + new Date());
|
||||
writer.append("</p>");
|
||||
|
||||
|
||||
HtmlInputText inputText = new HtmlInputText();
|
||||
inputText.setParent(this);
|
||||
// inputText.setId(this.getId() + ":_text1");
|
||||
inputText.encodeBegin(context);
|
||||
inputText.encodeEnd(context);
|
||||
|
||||
if (inputText.getRendersChildren()) {
|
||||
for (UIComponent child:inputText.getChildren()) {
|
||||
child.encodeBegin(context);
|
||||
child.encodeEnd(context);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void restoreState(FacesContext context, Object state) {
|
||||
this.state = (Object[]) state;
|
||||
super.restoreState(context, this.state[0]);
|
||||
bar = (String) this.state[1];
|
||||
}
|
||||
|
||||
public Object saveState(FacesContext context) {
|
||||
if (state == null) {
|
||||
state = new Object[2];
|
||||
}
|
||||
state[0] = super.saveState(context);
|
||||
state[1] = bar;
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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.component.UIComponentBase;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
import javax.faces.render.Renderer;
|
||||
import javax.faces.webapp.UIComponentTag;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 16, 2008
|
||||
*/
|
||||
public class VascUIComponentTag extends UIComponentTag {
|
||||
|
||||
protected ValueExpression bar;
|
||||
|
||||
public String getComponentType() {
|
||||
return VascUIComponent.COMPONENT_TYPE;
|
||||
}
|
||||
|
||||
public String getRendererType() {
|
||||
return VascUIComponent.COMPONENT_TYPE;
|
||||
}
|
||||
|
||||
public ValueExpression getBar() {
|
||||
return bar;
|
||||
}
|
||||
|
||||
protected void setProperties(UIComponent component) {
|
||||
super.setProperties(component);
|
||||
VascUIComponent download = null;
|
||||
try {
|
||||
//foo = (VascUIComponent) component;
|
||||
} catch (ClassCastException cce) {
|
||||
throw new IllegalStateException("Component " + component.toString() +
|
||||
" not expected type. Expected: com.foo.Foo. Perhaps you're missing a tag?");
|
||||
}
|
||||
|
||||
if (bar != null) {
|
||||
//foo.setValueExpression("bar", bar);
|
||||
}
|
||||
}
|
||||
|
||||
public void release() {
|
||||
super.release();
|
||||
bar = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,236 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
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.VascEntryFieldSet;
|
||||
import com.idcanet.vasc.core.VascEntryFieldType;
|
||||
import com.idcanet.vasc.core.VascEntryFinalizer;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.VascLinkEntry;
|
||||
|
||||
/**
|
||||
* Checks for minimal needed stuff
|
||||
* and fills up the rest.
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 14, 2008
|
||||
*/
|
||||
public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFinalizer#finalizeVascEntry(com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException {
|
||||
|
||||
// First Check if we all have ids
|
||||
if (entry.getId()==null) {
|
||||
throw new IllegalArgumentException("The VascEntry need an id.");
|
||||
}
|
||||
if (entry.getBackendId()==null) {
|
||||
throw new IllegalArgumentException("The VascEntry need an backendId.");
|
||||
}
|
||||
if (entry.getVascEntryFields().size()==0) {
|
||||
throw new IllegalArgumentException("We need at least one VascEntryField.");
|
||||
}
|
||||
for (VascEntryField vef:entry.getVascEntryFields()) {
|
||||
if (vef.getId()==null) {
|
||||
throw new IllegalArgumentException("All VascEntryField need an id");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if backendId is valid
|
||||
VascBackend back = vascController.getVascBackendControllerResolver().getVascBackendController().getVascBackendById( entry.getBackendId() );
|
||||
if (back==null) {
|
||||
throw new IllegalArgumentException("The VascEntry backendId is not found in backends: '"+entry.getBackendId()+"'");
|
||||
}
|
||||
|
||||
|
||||
// Fill up all not field i18n keys
|
||||
String id = entry.getId();
|
||||
|
||||
// header
|
||||
if (entry.getHeaderName()==null) {
|
||||
entry.setHeaderName("vasc.entry."+id+".headerName");
|
||||
}
|
||||
if (entry.getHeaderDescription()==null) {
|
||||
entry.setHeaderDescription("vasc.entry."+id+".headerDescription");
|
||||
}
|
||||
if (entry.getHeaderImage()==null) {
|
||||
entry.setHeaderImage("vasc.entry."+id+".headerImage");
|
||||
}
|
||||
|
||||
// entry fields
|
||||
if (entry.getName()==null) {
|
||||
entry.setName("vasc.entry."+id+".name");
|
||||
}
|
||||
if (entry.getDescription()==null) {
|
||||
entry.setDescription("vasc.entry."+id+".description");
|
||||
}
|
||||
if (entry.getImage()==null) {
|
||||
entry.setImage("vasc.entry."+id+".image");
|
||||
}
|
||||
if (entry.getHelpId()==null) {
|
||||
entry.setHelpId("vasc.entry."+id+".helpId");
|
||||
}
|
||||
|
||||
// optional field sets
|
||||
for (VascEntryFieldSet s:entry.getVascEntryFieldSets()) {
|
||||
|
||||
// check id
|
||||
String sid = s.getId();
|
||||
if (sid==null) {
|
||||
throw new IllegalArgumentException("All VascEntryFieldSet need an id");
|
||||
}
|
||||
|
||||
// check if refenced ids are avalible
|
||||
for (String fid:s.getVascEntryFieldIds()) {
|
||||
if (entry.getVascEntryFieldById(fid)==null) {
|
||||
throw new IllegalArgumentException("VascEntryFieldSet "+sid+" has non excisting field id: "+fid);
|
||||
}
|
||||
}
|
||||
|
||||
// fill up properties
|
||||
if (s.getName()==null) {
|
||||
s.setName("vasc.entry."+id+"."+sid+".name");
|
||||
}
|
||||
if (s.getDescription()==null) {
|
||||
s.setDescription("vasc.entry."+id+"."+sid+".description");
|
||||
}
|
||||
if (s.getImage()==null) {
|
||||
s.setImage("vasc.entry."+id+"."+sid+".image");
|
||||
}
|
||||
if (s.getHelpId()==null) {
|
||||
s.setHelpId("vasc.entry."+id+"."+sid+".helpId");
|
||||
}
|
||||
if (s.getStyleEdit()==null) {
|
||||
s.setStyleEdit("vasc.entry."+id+"."+sid+".styleEdit");
|
||||
}
|
||||
if (s.getStyleList()==null) {
|
||||
s.setStyleList("vasc.entry."+id+"."+sid+".styleEdit");
|
||||
}
|
||||
}
|
||||
|
||||
// Set defaults field Id for key ad display
|
||||
if (entry.getPrimaryKeyFieldId()==null) {
|
||||
entry.setPrimaryKeyFieldId(entry.getVascEntryFields().get(0).getId());
|
||||
}
|
||||
|
||||
if (entry.getDisplayNameFieldId()==null) {
|
||||
entry.setDisplayNameFieldId(entry.getVascEntryFields().get(0).getId());
|
||||
}
|
||||
|
||||
|
||||
// Check fields
|
||||
for (VascEntryField vef:entry.getVascEntryFields()) {
|
||||
String vid = vef.getId();
|
||||
|
||||
// set manual stuff
|
||||
if (vef.getBackendName()==null) {
|
||||
vef.setBackendName(vid);
|
||||
}
|
||||
if (vef.getVascEntry()==null) {
|
||||
vef.setVascEntry(entry);
|
||||
}
|
||||
|
||||
// fill up properties
|
||||
if (vef.getName()==null) {
|
||||
vef.setName("vasc.entry."+id+"."+vid+".name");
|
||||
}
|
||||
if (vef.getDescription()==null) {
|
||||
vef.setDescription("vasc.entry."+id+"."+vid+".description");
|
||||
}
|
||||
if (vef.getImage()==null) {
|
||||
vef.setImage("vasc.entry."+id+"."+vid+".image");
|
||||
}
|
||||
if (vef.getHelpId()==null) {
|
||||
vef.setHelpId("vasc.entry."+id+"."+vid+".helpId");
|
||||
}
|
||||
if (vef.getStyleEdit()==null) {
|
||||
vef.setStyleEdit("vasc.entry."+id+"."+vid+".styleEdit");
|
||||
}
|
||||
if (vef.getStyleList()==null) {
|
||||
vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
|
||||
}
|
||||
|
||||
//if (vef.getDefaultValue()==null) {
|
||||
// vef.setDefaultValue("vasc.entry."+id+"."+vid+".defaultValue");
|
||||
//}
|
||||
|
||||
|
||||
if (vef.getVascEntryFieldEventChannel()==null) {
|
||||
//vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
|
||||
}
|
||||
if (vef.getVascEntryFieldValue()==null) {
|
||||
VascBackend back2 = vascController.getVascBackendControllerResolver().getVascBackendController().getVascBackendById( entry.getBackendId() );
|
||||
vef.setVascEntryFieldValue(back2.provideVascEntryFieldValue(vef));
|
||||
}
|
||||
|
||||
if (vef.getVascEntryFieldType()==null) {
|
||||
Object defValue = vef.getDefaultValue();
|
||||
if (defValue != null) {
|
||||
for (String typeId: vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
|
||||
VascEntryFieldType type = vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById(typeId);
|
||||
|
||||
if (type.getAutoDetectClass()!=null) {
|
||||
if (type.getAutoDetectClass().isAssignableFrom(defValue.getClass())) {
|
||||
vef.setVascEntryFieldType(type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vef.getVascEntryFieldType()==null) {
|
||||
vef.setVascEntryFieldType(vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField"));
|
||||
}
|
||||
//vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
|
||||
}
|
||||
|
||||
//for (VascValidator vv:vef.getVascValidators()) {
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
// Check if link entries excists
|
||||
for (VascLinkEntry vle:entry.getVascLinkEntries()) {
|
||||
vle.getVascEntryName();
|
||||
}
|
||||
|
||||
|
||||
// ..
|
||||
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackend;
|
||||
import com.idcanet.vasc.core.VascBackendControllerLocal;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 18, 2008
|
||||
*/
|
||||
public class DefaultVascBackendController implements VascBackendControllerLocal {
|
||||
|
||||
private Map<String,VascBackend> backends = null;
|
||||
|
||||
public DefaultVascBackendController() {
|
||||
backends = new HashMap<String,VascBackend>(7);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackendController#getVascBackendById(java.lang.String)
|
||||
*/
|
||||
public VascBackend getVascBackendById(String id) {
|
||||
return backends.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Local
|
||||
*/
|
||||
public void addVascBackend(VascBackend backend) {
|
||||
if (backend==null) {
|
||||
throw new NullPointerException("backend must not be null.");
|
||||
}
|
||||
if (backend.getId()==null) {
|
||||
throw new IllegalArgumentException("The backend must have an id.");
|
||||
}
|
||||
backends.put(backend.getId(), backend);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackendController;
|
||||
import com.idcanet.vasc.core.VascBackendControllerResolver;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 18, 2008
|
||||
*/
|
||||
public class DefaultVascBackendControllerResolver implements VascBackendControllerResolver {
|
||||
|
||||
private VascBackendController vascBackendController = null;
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackendControllerResolver#getVascBackendController()
|
||||
*/
|
||||
public VascBackendController getVascBackendController() {
|
||||
return vascBackendController;
|
||||
}
|
||||
|
||||
public void setVascBackendController(VascBackendController vascBackendController) {
|
||||
this.vascBackendController=vascBackendController;
|
||||
}
|
||||
}
|
||||
121
src/main/java/com/idcanet/vasc/impl/DefaultVascController.java
Normal file
121
src/main/java/com/idcanet/vasc/impl/DefaultVascController.java
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackendControllerResolver;
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntryControllerResolver;
|
||||
import com.idcanet.vasc.core.VascEntryFieldTypeControllerResolver;
|
||||
import com.idcanet.vasc.core.VascEventChannelControllerResolver;
|
||||
import com.idcanet.vasc.core.VascUserRoleControllerResolver;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 11, 2008
|
||||
*/
|
||||
public class DefaultVascController implements VascController {
|
||||
|
||||
private VascBackendControllerResolver vascBackendControllerResolver = null;
|
||||
private VascEntryControllerResolver vascEntryControllerResolver = null;
|
||||
private VascEntryFieldTypeControllerResolver vascEntryFieldTypeControllerResolver = null;
|
||||
private VascEventChannelControllerResolver vascEventChannelControllerResolver = null;
|
||||
private VascUserRoleControllerResolver vascUserRoleControllerResolver = null;
|
||||
|
||||
/**
|
||||
* @return the vascEventChannelControllerResolver
|
||||
*/
|
||||
public VascEventChannelControllerResolver getVascEventChannelControllerResolver() {
|
||||
return vascEventChannelControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEventChannelControllerResolver the vascEventChannelControllerResolver to set
|
||||
*/
|
||||
public void setVascEventChannelControllerResolver(
|
||||
VascEventChannelControllerResolver vascEventChannelControllerResolver) {
|
||||
this.vascEventChannelControllerResolver = vascEventChannelControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascBackendControllerResolver
|
||||
*/
|
||||
public VascBackendControllerResolver getVascBackendControllerResolver() {
|
||||
return vascBackendControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascBackendControllerResolver the vascBackendControllerResolver to set
|
||||
*/
|
||||
public void setVascBackendControllerResolver(VascBackendControllerResolver vascBackendControllerResolver) {
|
||||
this.vascBackendControllerResolver = vascBackendControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryControllerResolver
|
||||
*/
|
||||
public VascEntryControllerResolver getVascEntryControllerResolver() {
|
||||
return vascEntryControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryControllerResolver the vascEntryControllerResolver to set
|
||||
*/
|
||||
public void setVascEntryControllerResolver(VascEntryControllerResolver vascEntryControllerResolver) {
|
||||
this.vascEntryControllerResolver = vascEntryControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryFieldControllerResolver
|
||||
*/
|
||||
public VascEntryFieldTypeControllerResolver getVascEntryFieldTypeControllerResolver() {
|
||||
return vascEntryFieldTypeControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryFieldControllerResolver the vascEntryFieldControllerResolver to set
|
||||
*/
|
||||
public void setVascEntryFieldTypeControllerResolver(VascEntryFieldTypeControllerResolver vascEntryFieldTypeControllerResolver) {
|
||||
this.vascEntryFieldTypeControllerResolver = vascEntryFieldTypeControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascUserRoleControllerResolver
|
||||
*/
|
||||
public VascUserRoleControllerResolver getVascUserRoleControllerResolver() {
|
||||
return vascUserRoleControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascUserRoleControllerResolver the vascUserRoleControllerResolver to set
|
||||
*/
|
||||
public void setVascUserRoleControllerResolver(
|
||||
VascUserRoleControllerResolver vascUserRoleControllerResolver) {
|
||||
this.vascUserRoleControllerResolver = vascUserRoleControllerResolver;
|
||||
}
|
||||
}
|
||||
491
src/main/java/com/idcanet/vasc/impl/DefaultVascEntry.java
Normal file
491
src/main/java/com/idcanet/vasc/impl/DefaultVascEntry.java
Normal file
|
|
@ -0,0 +1,491 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascEntryFieldSet;
|
||||
import com.idcanet.vasc.core.VascFrontendData;
|
||||
import com.idcanet.vasc.core.VascLinkEntry;
|
||||
import com.idcanet.vasc.core.actions.ColumnVascAction;
|
||||
import com.idcanet.vasc.core.actions.GlobalVascAction;
|
||||
import com.idcanet.vasc.core.actions.RowVascAction;
|
||||
|
||||
/**
|
||||
* VascEntry
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class DefaultVascEntry implements VascEntry {
|
||||
|
||||
private String id = null;
|
||||
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private String helpId = null;
|
||||
private String image = null;
|
||||
|
||||
private String headerName = null;
|
||||
private String headerImage = null;
|
||||
private String headerDescription = null;
|
||||
|
||||
private String primaryKeyFieldId = null;
|
||||
private String displayNameFieldId = null;
|
||||
|
||||
private boolean vascAdmimList = true;
|
||||
private boolean vascAdmimEdit = true;
|
||||
private boolean vascAdmimCreate = true;
|
||||
private boolean vascAdmimDelete = true;
|
||||
|
||||
private List<VascEntryField> vascFields = null;
|
||||
|
||||
private List<RowVascAction> rowActions = null;
|
||||
private List<ColumnVascAction> columnActions = null;
|
||||
private List<GlobalVascAction> globalActions = null;
|
||||
|
||||
private List<VascEntryFieldSet> vascEntryFieldSets = null;
|
||||
private List<VascLinkEntry> vascLinkEntries = null;
|
||||
private Map<String,Object> entryParameters = null;
|
||||
|
||||
private String backendId = null;
|
||||
private VascFrontendData vascFrontendData = null;
|
||||
|
||||
/**
|
||||
* Te constructor
|
||||
*/
|
||||
public DefaultVascEntry() {
|
||||
vascFields = new ArrayList<VascEntryField>(10);
|
||||
|
||||
rowActions = new ArrayList<RowVascAction>(10);
|
||||
columnActions = new ArrayList<ColumnVascAction>(10);
|
||||
globalActions = new ArrayList<GlobalVascAction>(10);
|
||||
|
||||
vascEntryFieldSets = new ArrayList<VascEntryFieldSet>(10);
|
||||
vascLinkEntries = new ArrayList<VascLinkEntry>(10);
|
||||
entryParameters = new HashMap<String,Object>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#clone()
|
||||
*/
|
||||
@Override
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
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 the description 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the headerName
|
||||
*/
|
||||
public String getHeaderName() {
|
||||
return headerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param headerName the headerName to set
|
||||
*/
|
||||
public void setHeaderName(String headerName) {
|
||||
this.headerName = headerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the headerImage
|
||||
*/
|
||||
public String getHeaderImage() {
|
||||
return headerImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param headerImage the headerImage to set
|
||||
*/
|
||||
public void setHeaderImage(String headerImage) {
|
||||
this.headerImage = headerImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the headerDescription
|
||||
*/
|
||||
public String getHeaderDescription() {
|
||||
return headerDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param headerDescription the headerDescription to set
|
||||
*/
|
||||
public void setHeaderDescription(String headerDescription) {
|
||||
this.headerDescription = headerDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the primaryKeyFieldId
|
||||
*/
|
||||
public String getPrimaryKeyFieldId() {
|
||||
return primaryKeyFieldId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param primaryKeyFieldId the primaryKeyFieldId to set
|
||||
*/
|
||||
public void setPrimaryKeyFieldId(String primaryKeyFieldId) {
|
||||
this.primaryKeyFieldId = primaryKeyFieldId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the displayNameFieldId
|
||||
*/
|
||||
public String getDisplayNameFieldId() {
|
||||
return displayNameFieldId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param displayNameFieldId the displayNameFieldId to set
|
||||
*/
|
||||
public void setDisplayNameFieldId(String displayNameFieldId) {
|
||||
this.displayNameFieldId = displayNameFieldId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascAdmimList
|
||||
*/
|
||||
public boolean isVascAdmimList() {
|
||||
return vascAdmimList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascAdmimList the vascAdmimList to set
|
||||
*/
|
||||
public void setVascAdmimList(boolean vascAdmimList) {
|
||||
this.vascAdmimList = vascAdmimList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascAdmimEdit
|
||||
*/
|
||||
public boolean isVascAdmimEdit() {
|
||||
return vascAdmimEdit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascAdmimEdit the vascAdmimEdit to set
|
||||
*/
|
||||
public void setVascAdmimEdit(boolean vascAdmimEdit) {
|
||||
this.vascAdmimEdit = vascAdmimEdit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascAdmimCreate
|
||||
*/
|
||||
public boolean isVascAdmimCreate() {
|
||||
return vascAdmimCreate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascAdmimCreate the vascAdmimCreate to set
|
||||
*/
|
||||
public void setVascAdmimCreate(boolean vascAdmimCreate) {
|
||||
this.vascAdmimCreate = vascAdmimCreate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascAdmimDelete
|
||||
*/
|
||||
public boolean isVascAdmimDelete() {
|
||||
return vascAdmimDelete;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascAdmimDelete the vascAdmimDelete to set
|
||||
*/
|
||||
public void setVascAdmimDelete(boolean vascAdmimDelete) {
|
||||
this.vascAdmimDelete = vascAdmimDelete;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascFields
|
||||
*/
|
||||
public List<VascEntryField> getVascEntryFields() {
|
||||
return vascFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascField the vascFields to add
|
||||
*/
|
||||
public void addVascEntryField(VascEntryField vascField) {
|
||||
vascFields.add(vascField);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascField the vascFields to remove
|
||||
*/
|
||||
public void removeVascEntryField(VascEntryField vascField) {
|
||||
vascFields.remove(vascField);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntry#getVascEntryFieldById(java.lang.String)
|
||||
*/
|
||||
public VascEntryField getVascEntryFieldById(String id) {
|
||||
for (VascEntryField v:vascFields) {
|
||||
if (v.getId().equals(id)) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Id not found as field");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rowActions
|
||||
*/
|
||||
public List<RowVascAction> getRowActions() {
|
||||
return rowActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rowAction the rowAction to add
|
||||
*/
|
||||
public void addRowAction(RowVascAction rowAction) {
|
||||
rowActions.add(rowAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rowAction the rowAction to remove
|
||||
*/
|
||||
public void removeRowAction(RowVascAction rowAction) {
|
||||
rowActions.remove(rowAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the columnActions
|
||||
*/
|
||||
public List<ColumnVascAction> getColumnActions() {
|
||||
return columnActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param columnAction the columnActions to add
|
||||
*/
|
||||
public void addColumnAction(ColumnVascAction columnAction) {
|
||||
columnActions.add(columnAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param columnAction the columnActions to remove
|
||||
*/
|
||||
public void removeColumnAction(ColumnVascAction columnAction) {
|
||||
columnActions.remove(columnAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the globalActions
|
||||
*/
|
||||
public List<GlobalVascAction> getGlobalActions() {
|
||||
return globalActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param globalAction the globalAction to add
|
||||
*/
|
||||
public void addGlobalAction(GlobalVascAction globalAction) {
|
||||
globalActions.add(globalAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param globalAction the globalAction to remove
|
||||
*/
|
||||
public void removeGlobalAction(GlobalVascAction globalAction) {
|
||||
globalActions.remove(globalAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryFieldSets
|
||||
*/
|
||||
public List<VascEntryFieldSet> getVascEntryFieldSets() {
|
||||
return vascEntryFieldSets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryFieldSet the vascEntryFieldSet to add
|
||||
*/
|
||||
public void addVascEntryFieldSet(VascEntryFieldSet vascEntryFieldSet) {
|
||||
vascEntryFieldSets.add(vascEntryFieldSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryFieldSet the vascEntryFieldSet to add
|
||||
*/
|
||||
public void removeVascEntryFieldSet(VascEntryFieldSet vascEntryFieldSet) {
|
||||
vascEntryFieldSets.remove(vascEntryFieldSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascLinkEntries
|
||||
*/
|
||||
public List<VascLinkEntry> getVascLinkEntries() {
|
||||
return vascLinkEntries;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascLinkEntry the vascLinkEntry to set
|
||||
*/
|
||||
public void addVascLinkEntry(VascLinkEntry vascLinkEntry) {
|
||||
vascLinkEntries.add(vascLinkEntry);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascLinkEntry the vascLinkEntry to remove
|
||||
*/
|
||||
public void removeVascLinkEntry(VascLinkEntry vascLinkEntry) {
|
||||
vascLinkEntries.remove(vascLinkEntry);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntry#getEntryParameter(java.lang.String)
|
||||
*/
|
||||
public Object getEntryParameter(String key) {
|
||||
return entryParameters.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntry#getEntryParameterKeys()
|
||||
*/
|
||||
public List<String> getEntryParameterKeys() {
|
||||
return new ArrayList<String>(entryParameters.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntry#setEntryParameter(java.lang.String, java.lang.Object)
|
||||
*/
|
||||
public void setEntryParameter(String key, Object value) {
|
||||
entryParameters.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascFrontendData
|
||||
*/
|
||||
public VascFrontendData getVascFrontendData() {
|
||||
return vascFrontendData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascFrontendData the vascFrontendData to set
|
||||
*/
|
||||
public void setVascFrontendData(VascFrontendData vascFrontendData) {
|
||||
this.vascFrontendData = vascFrontendData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the backendId
|
||||
*/
|
||||
public String getBackendId() {
|
||||
return backendId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param backendId the backendId to set
|
||||
*/
|
||||
public void setBackendId(String backendId) {
|
||||
this.backendId = backendId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryControllerLocal;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 18, 2008
|
||||
*/
|
||||
public class DefaultVascEntryController implements VascEntryControllerLocal {
|
||||
|
||||
private Map<String,VascEntry> entries = null;
|
||||
|
||||
public DefaultVascEntryController() {
|
||||
entries = new HashMap<String,VascEntry>();
|
||||
}
|
||||
|
||||
public void addVascEntry(VascEntry entry,VascController vascController) throws VascException {
|
||||
DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
|
||||
entry = f.finalizeVascEntry(entry,vascController);
|
||||
entries.put(entry.getId(), entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryController#getVascEntryById(java.lang.String)
|
||||
*/
|
||||
public VascEntry getVascEntryById(String id) {
|
||||
return entries.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryController#getVascEntryIds()
|
||||
*/
|
||||
public List<String> getVascEntryIds() {
|
||||
return new ArrayList<String>(entries.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retuns only the adminList table entries
|
||||
*/
|
||||
public List<String> getVascEntryAdminIds() {
|
||||
List<String> adminIds = new ArrayList<String>(30);
|
||||
for (VascEntry e:entries.values()) {
|
||||
if (Boolean.TRUE.equals(e.isVascAdmimList())) {
|
||||
adminIds.add(e.getId());
|
||||
}
|
||||
}
|
||||
return adminIds;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntryController;
|
||||
import com.idcanet.vasc.core.VascEntryControllerResolver;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 18, 2008
|
||||
*/
|
||||
public class DefaultVascEntryControllerResolver implements VascEntryControllerResolver {
|
||||
|
||||
private VascEntryController vascEntryController = null;
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryControllerResolver#getVascEntryController()
|
||||
*/
|
||||
public VascEntryController getVascEntryController() {
|
||||
return vascEntryController;
|
||||
}
|
||||
|
||||
public void setVascEntryController(VascEntryController vascEntryController) {
|
||||
this.vascEntryController=vascEntryController;
|
||||
}
|
||||
|
||||
}
|
||||
480
src/main/java/com/idcanet/vasc/impl/DefaultVascEntryField.java
Normal file
480
src/main/java/com/idcanet/vasc/impl/DefaultVascEntryField.java
Normal file
|
|
@ -0,0 +1,480 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascEntryFieldType;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFieldEventChannel;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
|
||||
import com.idcanet.vasc.validators.VascValidator;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class DefaultVascEntryField implements VascEntryField {
|
||||
|
||||
private VascEntry vascEntry = null;
|
||||
|
||||
/** The vasc id for this field */
|
||||
private String id = null;
|
||||
|
||||
/** The vasc Field Type for this field entry. */
|
||||
private VascEntryFieldType vascEntryFieldType = null;
|
||||
|
||||
/** The backendName, default to the name. **/
|
||||
private String backendName = null;
|
||||
|
||||
private VascEntryFieldValue vascEntryFieldValue = null;
|
||||
|
||||
private VascEntryFieldEventChannel vascEntryFieldEventChannel = null;
|
||||
|
||||
private List<VascValidator> vascValidators = null;
|
||||
|
||||
/** Some VascField fields**/
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private String helpId = null;
|
||||
private String image = null;
|
||||
private Object defaultValue = null;
|
||||
private Integer sizeList = null;
|
||||
private Integer sizeEdit = null;
|
||||
private String styleList = null;
|
||||
private String styleEdit = null;
|
||||
|
||||
private String choices = null;
|
||||
|
||||
/** Defines if this columns is used in interface list,create,edit **/
|
||||
private boolean view = true;
|
||||
private boolean optional = false;
|
||||
|
||||
/** Defines per view state of this field **/
|
||||
private boolean create = true;
|
||||
private boolean edit = true;
|
||||
private boolean editReadOnly = false;
|
||||
private boolean list = true;
|
||||
|
||||
/** Defines the roles stuff if all up is true **/
|
||||
private String rolesCreate = null;
|
||||
private String rolesEdit = null;
|
||||
private String rolesEditReadOnly = null;
|
||||
private String rolesList = null;
|
||||
|
||||
public DefaultVascEntryField() {
|
||||
vascValidators = new ArrayList<VascValidator>(5);
|
||||
}
|
||||
|
||||
public DefaultVascEntryField(String id) {
|
||||
this();
|
||||
setId(id);
|
||||
}
|
||||
|
||||
public VascEntry getVascEntry() {
|
||||
return vascEntry;
|
||||
}
|
||||
|
||||
public void setVascEntry(VascEntry vascEntry) {
|
||||
this.vascEntry=vascEntry;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryFieldType
|
||||
*/
|
||||
public VascEntryFieldType getVascEntryFieldType() {
|
||||
return vascEntryFieldType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryFieldType the vascEntryFieldType to set
|
||||
*/
|
||||
public void setVascEntryFieldType(VascEntryFieldType vascEntryFieldType) {
|
||||
this.vascEntryFieldType = vascEntryFieldType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the backendName
|
||||
*/
|
||||
public String getBackendName() {
|
||||
return backendName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param backendName the backendName to set
|
||||
*/
|
||||
public void setBackendName(String backendName) {
|
||||
this.backendName = backendName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryFieldValue
|
||||
*/
|
||||
public VascEntryFieldValue getVascEntryFieldValue() {
|
||||
return vascEntryFieldValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryFieldValue the vascEntryFieldValue to set
|
||||
*/
|
||||
public void setVascEntryFieldValue(VascEntryFieldValue vascEntryFieldValue) {
|
||||
this.vascEntryFieldValue = vascEntryFieldValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryFieldEventChannel
|
||||
*/
|
||||
public VascEntryFieldEventChannel getVascEntryFieldEventChannel() {
|
||||
return vascEntryFieldEventChannel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryFieldEventChannel the vascEntryFieldEventChannel to set
|
||||
*/
|
||||
public void setVascEntryFieldEventChannel(VascEntryFieldEventChannel vascEntryFieldEventChannel) {
|
||||
this.vascEntryFieldEventChannel = vascEntryFieldEventChannel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascValidators
|
||||
*/
|
||||
public List<VascValidator> getVascValidators() {
|
||||
return vascValidators;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascValidators the vascValidators to add
|
||||
*/
|
||||
public void addVascValidator(VascValidator vascValidator) {
|
||||
this.vascValidators.add(vascValidator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascValidators the vascValidators to remove
|
||||
*/
|
||||
public void removeVascValidator(VascValidator vascValidator) {
|
||||
this.vascValidators.remove(vascValidator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 the description 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the defaultValue
|
||||
*/
|
||||
public Object getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param defaultValue the defaultValue to set
|
||||
*/
|
||||
public void setDefaultValue(Object defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sizeList
|
||||
*/
|
||||
public Integer getSizeList() {
|
||||
return sizeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sizeList the sizeList to set
|
||||
*/
|
||||
public void setSizeList(Integer sizeList) {
|
||||
this.sizeList = sizeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sizeEdit
|
||||
*/
|
||||
public Integer getSizeEdit() {
|
||||
return sizeEdit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sizeEdit the sizeEdit to set
|
||||
*/
|
||||
public void setSizeEdit(Integer sizeEdit) {
|
||||
this.sizeEdit = sizeEdit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the styleList
|
||||
*/
|
||||
public String getStyleList() {
|
||||
return styleList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param styleList the styleList to set
|
||||
*/
|
||||
public void setStyleList(String styleList) {
|
||||
this.styleList = styleList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the styleEdit
|
||||
*/
|
||||
public String getStyleEdit() {
|
||||
return styleEdit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param styleEdit the styleEdit to set
|
||||
*/
|
||||
public void setStyleEdit(String styleEdit) {
|
||||
this.styleEdit = styleEdit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the choices
|
||||
*/
|
||||
public String getChoices() {
|
||||
return choices;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param choices the choices to set
|
||||
*/
|
||||
public void setChoices(String choices) {
|
||||
this.choices = choices;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the view
|
||||
*/
|
||||
public boolean isView() {
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param view the view to set
|
||||
*/
|
||||
public void setView(boolean view) {
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the optional
|
||||
*/
|
||||
public boolean isOptional() {
|
||||
return optional;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param optional the optional to set
|
||||
*/
|
||||
public void setOptional(boolean optional) {
|
||||
this.optional = optional;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the create
|
||||
*/
|
||||
public boolean isCreate() {
|
||||
return create;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param create the create to set
|
||||
*/
|
||||
public void setCreate(boolean create) {
|
||||
this.create = create;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the edit
|
||||
*/
|
||||
public boolean isEdit() {
|
||||
return edit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param edit the edit to set
|
||||
*/
|
||||
public void setEdit(boolean edit) {
|
||||
this.edit = edit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the editReadOnly
|
||||
*/
|
||||
public boolean isEditReadOnly() {
|
||||
return editReadOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param editReadOnly the editReadOnly to set
|
||||
*/
|
||||
public void setEditReadOnly(boolean editReadOnly) {
|
||||
this.editReadOnly = editReadOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list
|
||||
*/
|
||||
public boolean isList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list the list to set
|
||||
*/
|
||||
public void setList(boolean list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolesCreate
|
||||
*/
|
||||
public String getRolesCreate() {
|
||||
return rolesCreate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rolesCreate the rolesCreate to set
|
||||
*/
|
||||
public void setRolesCreate(String rolesCreate) {
|
||||
this.rolesCreate = rolesCreate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolesEdit
|
||||
*/
|
||||
public String getRolesEdit() {
|
||||
return rolesEdit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rolesEdit the rolesEdit to set
|
||||
*/
|
||||
public void setRolesEdit(String rolesEdit) {
|
||||
this.rolesEdit = rolesEdit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolesEditReadOnly
|
||||
*/
|
||||
public String getRolesEditReadOnly() {
|
||||
return rolesEditReadOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rolesEditReadOnly the rolesEditReadOnly to set
|
||||
*/
|
||||
public void setRolesEditReadOnly(String rolesEditReadOnly) {
|
||||
this.rolesEditReadOnly = rolesEditReadOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rolesList
|
||||
*/
|
||||
public String getRolesList() {
|
||||
return rolesList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rolesList the rolesList to set
|
||||
*/
|
||||
public void setRolesList(String rolesList) {
|
||||
this.rolesList = rolesList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntryFieldSet;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class DefaultVascEntryFieldSet implements VascEntryFieldSet {
|
||||
|
||||
private String id = null;
|
||||
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private String helpId = null;
|
||||
private String image = null;
|
||||
|
||||
private String styleList = null;
|
||||
private String styleEdit = null;
|
||||
|
||||
private boolean collapsed = false;
|
||||
private boolean optional = false;
|
||||
|
||||
private List<String> vascEntryFieldIds = null;
|
||||
|
||||
public DefaultVascEntryFieldSet() {
|
||||
vascEntryFieldIds = new ArrayList<String>(10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
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 the description 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the styleList
|
||||
*/
|
||||
public String getStyleList() {
|
||||
return styleList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param styleList the styleList to set
|
||||
*/
|
||||
public void setStyleList(String styleList) {
|
||||
this.styleList = styleList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the styleEdit
|
||||
*/
|
||||
public String getStyleEdit() {
|
||||
return styleEdit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param styleEdit the styleEdit to set
|
||||
*/
|
||||
public void setStyleEdit(String styleEdit) {
|
||||
this.styleEdit = styleEdit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the collapsed
|
||||
*/
|
||||
public boolean isCollapsed() {
|
||||
return collapsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param collapsed the collapsed to set
|
||||
*/
|
||||
public void setCollapsed(boolean collapsed) {
|
||||
this.collapsed = collapsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the optional
|
||||
*/
|
||||
public boolean isOptional() {
|
||||
return optional;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param optional the optional to set
|
||||
*/
|
||||
public void setOptional(boolean optional) {
|
||||
this.optional = optional;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryFieldIds
|
||||
*/
|
||||
public List<String> getVascEntryFieldIds() {
|
||||
return vascEntryFieldIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryFieldIds the vascEntryFieldIds to set
|
||||
*/
|
||||
public void addVascEntryFieldId(String vascEntryFieldId) {
|
||||
vascEntryFieldIds.add(vascEntryFieldId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryFieldIds the vascEntryFieldIds to set
|
||||
*/
|
||||
public void removeVascEntryFieldId(String vascEntryFieldId) {
|
||||
vascEntryFieldIds.remove(vascEntryFieldId);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
import com.idcanet.vasc.core.VascEventChannelController;
|
||||
import com.idcanet.vasc.core.VascEventChannelControllerResolver;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 19, 2008
|
||||
*/
|
||||
public class DefaultVascEventChannelControllerResolver implements VascEventChannelControllerResolver {
|
||||
|
||||
private VascEventChannelController vascEventChannelController = null;
|
||||
|
||||
/**
|
||||
* @return the vascEventChannelController
|
||||
*/
|
||||
public VascEventChannelController getVascEventChannelController() {
|
||||
return vascEventChannelController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEventChannelController the vascEventChannelController to set
|
||||
*/
|
||||
public void setVascEventChannelController(
|
||||
VascEventChannelController vascEventChannelController) {
|
||||
this.vascEventChannelController = vascEventChannelController;
|
||||
}
|
||||
}
|
||||
222
src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendData.java
Normal file
222
src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendData.java
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascEntryFinalizer;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.VascFrontend;
|
||||
import com.idcanet.vasc.core.VascFrontendData;
|
||||
import com.idcanet.vasc.core.VascFrontendHelper;
|
||||
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class DefaultVascFrontendData implements VascFrontendData {
|
||||
|
||||
private List<Object> entryDataList = null;
|
||||
private Object entryDataObject = null;
|
||||
private VascFrontend vascFrontend = null;
|
||||
private VascEntryFinalizer vascEntryFinalizer = null;
|
||||
private VascFrontendHelper vascFrontendHelper = null;
|
||||
private VascEntryResourceResolver vascEntryResourceResolver = null;
|
||||
private Map<String,String> uiComponents = null;
|
||||
private VascController vascController = null;
|
||||
|
||||
private Map<VascEntryField,VascUIComponent> fieldComps = null;
|
||||
private Map<VascEntryField,Object> fieldEditors = null;
|
||||
|
||||
public DefaultVascFrontendData() {
|
||||
entryDataList = new ArrayList<Object>(0);
|
||||
uiComponents = new HashMap<String,String>(8);
|
||||
|
||||
fieldComps = new HashMap<VascEntryField,VascUIComponent>(8);
|
||||
fieldEditors = new HashMap<VascEntryField,Object>(8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 vascFrontend
|
||||
*/
|
||||
public VascFrontend getVascFrontend() {
|
||||
return vascFrontend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascFrontend the vascFrontend to set
|
||||
*/
|
||||
public void setVascFrontend(VascFrontend vascFrontend) {
|
||||
this.vascFrontend = vascFrontend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackendData#getVascEntryFinalizer()
|
||||
*/
|
||||
public VascEntryFinalizer getVascEntryFinalizer() {
|
||||
return vascEntryFinalizer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackendData#setVascEntryFinalizer(com.idcanet.vasc.core.VascEntryFinalizer)
|
||||
*/
|
||||
public void setVascEntryFinalizer(VascEntryFinalizer vascEntryFinalizer) {
|
||||
this.vascEntryFinalizer=vascEntryFinalizer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascFrontendHelper
|
||||
*/
|
||||
public VascFrontendHelper getVascFrontendHelper() {
|
||||
return vascFrontendHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascFrontendHelper the vascFrontendHelper to set
|
||||
*/
|
||||
public void setVascFrontendHelper(VascFrontendHelper vascFrontendHelper) {
|
||||
this.vascFrontendHelper = vascFrontendHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryResourceResolver
|
||||
*/
|
||||
public VascEntryResourceResolver getVascEntryResourceResolver() {
|
||||
return vascEntryResourceResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
|
||||
*/
|
||||
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver) {
|
||||
this.vascEntryResourceResolver = vascEntryResourceResolver;
|
||||
}
|
||||
|
||||
|
||||
public VascUIComponent getVascUIComponent(String rendererId) throws VascException {
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl == null) {
|
||||
cl = rendererId.getClass().getClassLoader(); // fallback
|
||||
}
|
||||
String componentClass = getVascUIComponentClass(rendererId);
|
||||
if (componentClass==null) {
|
||||
throw new VascException("No component Class found for frontend UIComponent: "+rendererId);
|
||||
}
|
||||
try {
|
||||
return (VascUIComponent)cl.loadClass(componentClass).newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendData#getVascUIComponent(java.lang.String)
|
||||
*/
|
||||
public String getVascUIComponentClass(String rendererId) {
|
||||
return uiComponents.get(rendererId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendData#putVascUIComponent(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void putVascUIComponent(String rendererId, String uiComponentClass) {
|
||||
uiComponents.put(rendererId, uiComponentClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascController
|
||||
*/
|
||||
public VascController getVascController() {
|
||||
return vascController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascController the vascController to set
|
||||
*/
|
||||
public void setVascController(VascController vascController) {
|
||||
this.vascController = vascController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendData#addFieldVascUIComponents(com.idcanet.vasc.core.VascEntryField, com.idcanet.vasc.core.ui.VascUIComponent, java.lang.Object)
|
||||
*/
|
||||
public void addFieldVascUIComponents(VascEntryField field,VascUIComponent uiComponent, Object editor) {
|
||||
fieldComps.put(field, uiComponent);
|
||||
fieldEditors.put(field, editor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendData#getFieldRealRenderer(com.idcanet.vasc.core.VascEntryField)
|
||||
*/
|
||||
public Object getFieldRealRenderer(VascEntryField field) {
|
||||
return fieldEditors.get(field);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendData#getFieldVascUIComponent(com.idcanet.vasc.core.VascEntryField)
|
||||
*/
|
||||
public VascUIComponent getFieldVascUIComponent(VascEntryField field) {
|
||||
return fieldComps.get(field);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryFinalizer;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 14, 2008
|
||||
*/
|
||||
public class DefaultVascFrontendEntryFinalizer implements VascEntryFinalizer {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFinalizer#finalizeVascEntry(com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException {
|
||||
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,332 @@
|
|||
/*
|
||||
* 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.impl;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascFrontendHelper;
|
||||
import com.idcanet.vasc.core.entry.VascEntryEventListener;
|
||||
import com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.validators.VascValidator;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 28, 2007
|
||||
*/
|
||||
public class DefaultVascFrontendHelper implements VascFrontendHelper {
|
||||
|
||||
private Logger logger = null;
|
||||
//private List<VascEventListener> eventListeners = null;
|
||||
//private List<VascExceptionListener> exceptionListeners = null;
|
||||
|
||||
public DefaultVascFrontendHelper() {
|
||||
logger = Logger.getLogger(DefaultVascFrontendHelper.class.getName());
|
||||
//eventListeners = new ArrayList<VascEventListener>(2);
|
||||
//exceptionListeners = new ArrayList<VascExceptionListener>(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#addEventListener(com.idcanet.vasc.core.entry.VascEntryEventListener)
|
||||
*/
|
||||
public void addEventListener(VascEntryEventListener e) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#addExceptionListener(com.idcanet.vasc.core.entry.VascEntryEventListener)
|
||||
*/
|
||||
public void addExceptionListener(VascEntryEventListener listener) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#fireVascEvent(com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType, java.lang.Object)
|
||||
*/
|
||||
public void fireVascEvent(VascEventType type, Object data) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#getTotalColumnsWidth(com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
public Integer getTotalColumnsWidth(VascEntry entry) {
|
||||
int result = 0;
|
||||
for(VascEntryField c:entry.getVascEntryFields()) {
|
||||
if(c.getSizeList()==null) {
|
||||
Logger.getLogger(VascEntry.class.getName()).finer("Column no size: "+c.getName());
|
||||
} else {
|
||||
result+=c.getSizeList();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#handleException(java.lang.Exception, com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
public void handleException(Exception e, VascEntry table) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
/*
|
||||
if (exceptionListeners.isEmpty()) {
|
||||
Logger.getLogger(DefaultVascTableController.class.getName()).log(Level.WARNING,e.getMessage(),e);
|
||||
return;
|
||||
}
|
||||
for(VascExceptionListener ee:exceptionListeners) {
|
||||
try {
|
||||
ee.handleException(e, table);
|
||||
} catch (Exception eee) {
|
||||
Logger.getLogger(DefaultVascTableController.class.getName()).log(Level.WARNING,"Error in ExceptionListener: "+eee.getMessage(),eee);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#initEditObject(com.idcanet.vasc.core.VascEntry, java.lang.Object)
|
||||
*/
|
||||
public Object initEditObject(VascEntry entry, Object object) throws Exception {
|
||||
if (object!=null) {
|
||||
return object;
|
||||
}
|
||||
object = entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId()).provideVascEntryRecordCreator(entry).newRecord(entry);
|
||||
//fireVascEvent(VascEventListener.VascEventType.BEAN_INIT, object);
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#initEditObjectColumn(com.idcanet.vasc.core.VascEntryField, java.lang.Object)
|
||||
*/
|
||||
public void initEditObjectColumn(VascEntryField field, Object bean) throws Exception {
|
||||
Object value = field.getVascEntryFieldValue().getValue(field, bean);
|
||||
if(value==null & field.getDefaultValue()!=null) {
|
||||
try {
|
||||
logger.finer("Setting default value for: "+field.getName()+" def: "+field.getDefaultValue());
|
||||
field.getVascEntryFieldValue().setValue(field, bean, field.getDefaultValue());
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.WARNING,"Error in setting default value: '"+field.getDefaultValue()+"' error: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#mergeObject(com.idcanet.vasc.core.VascEntry, java.lang.Object)
|
||||
*/
|
||||
public Object mergeObject(VascEntry entry, Object object) {
|
||||
Object result = null;
|
||||
try {
|
||||
object = entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId()).merge(object);
|
||||
//fireVascEvent(VascEventListener.VascEventType.BEAN_MERGE,object);
|
||||
// todo: make faster
|
||||
// add to table at position old old object
|
||||
// then remove old object
|
||||
// send refresh
|
||||
|
||||
refreshData(entry);
|
||||
} catch (Exception e) {
|
||||
handleException(e, entry);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#refreshData(com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
public void refreshData(VascEntry entry) throws Exception {
|
||||
entry.getVascFrontendData().setEntryDataObject(null);
|
||||
entry.getVascFrontendData().setEntryDataList(entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId()).execute());
|
||||
//fireVascEvent(VascEventListener.VascEventType.DATA_UPDATE, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#removeEventListener(com.idcanet.vasc.core.entry.VascEntryEventListener)
|
||||
*/
|
||||
public void removeEventListener(VascEntryEventListener e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#removeExceptionListener(com.idcanet.vasc.core.entry.VascEntryEventListener)
|
||||
*/
|
||||
public void removeExceptionListener(VascEntryEventListener listener) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#setUIComponentsBeanErrors(com.idcanet.vasc.core.VascEntry, java.lang.Object)
|
||||
*/
|
||||
public boolean setUIComponentsBeanErrors(VascEntry entry, Object bean) {
|
||||
boolean error = false;
|
||||
if(bean==null) {
|
||||
logger.finest("No bean to check.");
|
||||
return true; // nothing to check
|
||||
}
|
||||
|
||||
//ClassValidator val = new ClassValidator(bean.getClass());
|
||||
//InvalidValue[] ival = val.getInvalidValues(bean);
|
||||
//logger.fine("Got invaliled value: "+ival.length);
|
||||
|
||||
for(VascEntryField col:entry.getVascEntryFields()) {
|
||||
|
||||
try {
|
||||
Object object = col.getVascEntryFieldValue().getValue(col, bean);
|
||||
VascUIComponent comp = entry.getVascFrontendData().getFieldVascUIComponent(col);
|
||||
|
||||
for (VascValidator val:col.getVascEntryFieldType().getVascValidators()) {
|
||||
if (val.isObjectValid(object)==false) {
|
||||
comp.setErrorText("error");
|
||||
error = true;
|
||||
} else {
|
||||
comp.setErrorText(null);
|
||||
}
|
||||
}
|
||||
|
||||
for (VascValidator val:col.getVascValidators()) {
|
||||
if (val.isObjectValid(object)==false) {
|
||||
comp.setErrorText("error");
|
||||
error = true;
|
||||
} else {
|
||||
comp.setErrorText(null);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
/*
|
||||
if(col.getVascUIComponent()==null) {
|
||||
continue; // we only DISPLAY user input errors !!
|
||||
}
|
||||
if (col instanceof VascAnnotationTableColumn) {
|
||||
VascAnnotationTableColumn column = (VascAnnotationTableColumn)col;
|
||||
|
||||
InvalidValue iv = findInvalidValueByProperty(ival,column.getBeanProperty());
|
||||
if(iv==null) {
|
||||
column.getVascUIComponent().setErrorText(null);
|
||||
continue; // no error on this property
|
||||
}
|
||||
error = true;
|
||||
column.getVascUIComponent().setErrorText(iv.getMessage());
|
||||
}
|
||||
*/
|
||||
}
|
||||
logger.finest("Checked for errors: "+error);
|
||||
return error;
|
||||
}
|
||||
/*
|
||||
private InvalidValue findInvalidValueByProperty(InvalidValue[] ival,String property) {
|
||||
for(InvalidValue iv:ival) {
|
||||
if(iv.getPropertyName().equals(property)) {
|
||||
return iv;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
public void finalizeVascColumns(VascTable table) throws Exception {
|
||||
VascAnnotationParser vap = new VascAnnotationParser();
|
||||
|
||||
for(VascTableColumn c:table.getTableColumns()) {
|
||||
if (c instanceof VascAnnotationTableColumn) {
|
||||
VascAnnotationTableColumn column = (VascAnnotationTableColumn)c;
|
||||
|
||||
if (c.getName()==null) {
|
||||
c.setName(vap.getVascNameKey(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty()));
|
||||
}
|
||||
if (c.getToolTip()==null) {
|
||||
c.setToolTip(vap.getVascToolTipKey(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty()));
|
||||
}
|
||||
if (c.getDefaultValue()==null) {
|
||||
c.setDefaultValue(vap.getVascDefaultValue(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty()));
|
||||
}
|
||||
if (c.getWidth()==null) {
|
||||
Object obj = vap.getVascColumnWidth(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty());
|
||||
if (obj instanceof Integer) {
|
||||
c.setWidth((Integer)obj);
|
||||
}
|
||||
c.setWidth(100);
|
||||
// get KEY
|
||||
}
|
||||
if (c.getHelpId()==null) {
|
||||
c.setHelpId(vap.getVascHelpId(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty()));
|
||||
}
|
||||
if (c.getVascColumnValue()==null) {
|
||||
c.setVascColumnValue(new BeanPropertyVascColumnValue(column.getBeanProperty()));
|
||||
}
|
||||
if (c.getImage()==null) {
|
||||
c.setImage(vap.getVascImage(table.getVascRecordCreator().getObjectClass(),column.getBeanProperty()));
|
||||
}
|
||||
}
|
||||
if (c.getVascUIComponent()==null) {
|
||||
if (c.getDefaultValue() instanceof Boolean) {
|
||||
c.setVascUIComponent(new VascToggle());
|
||||
} else if (c.getDefaultValue() instanceof Date) {
|
||||
c.setVascUIComponent(new VascDate());
|
||||
} else {
|
||||
c.setVascUIComponent(new VascTextField());
|
||||
}
|
||||
}
|
||||
if (c.getVascColumnRenderer()==null) {
|
||||
//c.setVascColumnRenderer(new DefaultVascColumnRenderer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addEventListener(VascEventListener e) {
|
||||
eventListeners.add(e);
|
||||
}
|
||||
public void removeEventListener(VascEventListener e) {
|
||||
eventListeners.remove(e);
|
||||
}
|
||||
|
||||
public void fireVascEvent(VascEventListener.VascEventType type,Object data) {
|
||||
for(VascEventListener e:eventListeners) {
|
||||
e.vascEvent(type, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addExceptionListener(VascExceptionListener listener) {
|
||||
exceptionListeners.add(listener);
|
||||
}
|
||||
|
||||
public void removeExceptionListener(VascExceptionListener listener) {
|
||||
exceptionListeners.remove(listener);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright 2004-2008 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.impl;
|
||||
|
||||
import com.idcanet.vasc.core.VascLinkEntry;
|
||||
|
||||
|
||||
/**
|
||||
* The DefaultVascLinkEntry
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 27, 2007
|
||||
*/
|
||||
public class DefaultVascLinkEntry implements VascLinkEntry {
|
||||
|
||||
private String vascEntryName = null;
|
||||
|
||||
/**
|
||||
* @return the vascEntryName
|
||||
*/
|
||||
public String getVascEntryName() {
|
||||
return vascEntryName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryName the vascEntryName to set
|
||||
*/
|
||||
public void setVascEntryName(String vascEntryName) {
|
||||
this.vascEntryName = vascEntryName;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue