2
0
Fork 0

[svn r340] WIP commit

This commit is contained in:
willemc 2008-09-08 02:07:46 +02:00
parent a40c22f13a
commit 435a26f4d6
108 changed files with 8325 additions and 680 deletions

View file

@ -16,5 +16,8 @@
<classpathentry kind="lib" path="lib/idcanet-fff-bin.jar"/>
<classpathentry kind="lib" path="lib/hibernate-annotations.jar"/>
<classpathentry kind="lib" path="lib/microba-0.4.2-bin.jar"/>
<classpathentry kind="lib" path="lib/hibernate-entitymanager.jar"/>
<classpathentry kind="lib" path="lib/ejb3-persistence.jar"/>
<classpathentry kind="lib" path="lib/ldap.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<!-- Verplichte impl field types -->
<vasc:fieldType name="TextField">
<vasc:fieldHint key="minlength" default="0"/>
<vasc:fieldHint key="maxlength" default="80"/>
<vasc:fieldClass className="java.lang.String"/>
</vasc:fieldType>
<vasc:fieldType name="ListField">
<vasc:fieldHint key="radio_edit" default="false"/>
</vasc:fieldType>
<!--
<vasc:fieldType name="TextAreaField">
<vasc:fieldHint key="columns" default="80"/>
<vasc:fieldHint key="rows" default="80"/>
<vasc:fieldClass className="java.lang.StringBuffer"/>
</vasc:fieldType>
-->
<!-- Native types -->
<vasc:fieldType name="BooleanField">
<vasc:fieldClass className="java.lang.Boolean"/>
</vasc:fieldType>
<vasc:fieldType name="IntegerField">
<vasc:fieldHint key="min_value" default="0"/>
<vasc:fieldHint key="max_value" default="2000"/>
<vasc:fieldClass className="java.lang.Integer"/>
<vasc:fieldConverter className="com.idcanet.x4o.converts.IntegerConverter"/>
</vasc:fieldType>
<vasc:fieldType name="LongField">
<vasc:fieldHint key="min_value" default="0"/>
<vasc:fieldHint key="max_value" default="2000"/>
<vasc:fieldClass className="java.lang.Long"/>
<vasc:fieldConverter className="com.idcanet.x4o.converts.LongConverter"/>
</vasc:fieldType>
<vasc:fieldType name="FloatField">
<vasc:fieldHint key="max_digits" default="5"/>
<vasc:fieldHint key="decimals" default="2"/>
<vasc:fieldClass className="java.lang.Float"/>
<vasc:fieldConverter className="com.idcanet.x4o.converts.FloatConverter"/>
</vasc:fieldType>
<vasc:fieldType name="DoubleField">
<vasc:fieldHint key="max_digits" default="5"/>
<vasc:fieldHint key="decimals" default="2"/>
<vasc:fieldClass className="java.lang.Double"/>
<vasc:fieldConverter className="com.idcanet.x4o.converts.DoubleConverter"/>
</vasc:fieldType>
<!-- Date types -->
<vasc:fieldType name="DateField">
<vasc:fieldHint key="format"/>
<vasc:fieldConverter className="com.idcanet.x4o.converts.DateConverter"/>
</vasc:fieldType>
<vasc:fieldType name="DateTimeField">
<vasc:fieldHint key="format"/>
<vasc:fieldClass className="java.util.Date"/>
<vasc:fieldConverter className="com.idcanet.x4o.converts.DateConverter"/>
</vasc:fieldType>
<vasc:fieldType name="TimeField">
<vasc:fieldHint key="format" default="HH:mm"/>
<vasc:fieldConverter className="com.idcanet.x4o.converts.DateConverter"/>
</vasc:fieldType>
<!-- Internet fields -->
<vasc:fieldType name="EmailField">
<vasc:fieldHint key="validate" default="true"/>
<vasc:fieldHint key="timeout" default="200"/>
</vasc:fieldType>
<vasc:fieldType name="IPField">
<vasc:fieldHint key="validate" default="true"/>
<vasc:fieldHint key="timeout" default="200"/>
</vasc:fieldType>
<vasc:fieldType name="DNSField">
<vasc:fieldHint key="validate" default="true"/>
<vasc:fieldHint key="timeout" default="200"/>
</vasc:fieldType>
<vasc:fieldType name="URLField">
<vasc:fieldHint key="timeout" default="200"/>
<vasc:fieldHint key="redirects" default="true"/>
<vasc:fieldHint key="validate" default="true"/>
<vasc:fieldHint key="status_code" default="200"/>
<vasc:fieldClass className="java.net.URL"/>
<vasc:fieldConverter className="com.idcanet.x4o.converts.URLConverter"/>
</vasc:fieldType>
<vasc:fieldType name="SlugField">
<vasc:fieldHint key="populate_from"/>
</vasc:fieldType>
<!-- XML fields -->
<vasc:fieldType name="XMLField">
<vasc:fieldHint key="validate" default="true"/>
<vasc:fieldHint key="schema_url"/>
</vasc:fieldType>
<vasc:fieldType name="XSLTField">
<vasc:fieldHint key="validate" default="true"/>
<vasc:fieldHint key="schema_url"/>
</vasc:fieldType>
<!-- Combined fields -->
<vasc:fieldType name="SeparatedTypeField">
<vasc:fieldHint key="field_type" default="IntegerField"/>
<vasc:fieldHint key="seperator" default=","/>
<vasc:fieldHint key="min_items" default="0"/>
<vasc:fieldHint key="max_items" default="10"/>
</vasc:fieldType>
<vasc:fieldType name="MultipleTypeField">
<vasc:fieldHint key="field_type" default="TextField"/>
<vasc:fieldHint key="min_items" default="0"/>
<vasc:fieldHint key="max_items" default="10"/>
</vasc:fieldType>
<vasc:fieldType name="ColorField">
<vasc:fieldConverter className="com.idcanet.x4o.converts.ColorConverter"/>
</vasc:fieldType>
<!-- File fields -->
<vasc:fieldType name="FileField">
<vasc:fieldHint key="base_path" default="/tmp"/>
<vasc:fieldHint key="base_path_templateing" default="true"/>
<vasc:fieldHint key="max_size" default="1000000"/>
<vasc:fieldHint key="mine_types" default="ALL"/>
<vasc:fieldHint key="file_match"/>
<vasc:fieldClass className="java.io.File"/>
<vasc:fieldConverter className="com.idcanet.x4o.converts.FileConverter"/>
</vasc:fieldType>
<vasc:fieldType name="FilePathField">
<vasc:fieldHint key="base_path" default="/tmp"/>
<vasc:fieldHint key="recursive" default="true"/>
<vasc:fieldHint key="path_match"/>
</vasc:fieldType>
<vasc:fieldType name="ImageField" superType="FileField">
<vasc:fieldHint key="max_height" default="6000"/>
<vasc:fieldHint key="max_width" default="7000"/>
<vasc:fieldHint key="thumpnail_auto" default="false"/>
<vasc:fieldHint key="thumpnail_path" default="/tmp/nails/"/>
<vasc:fieldClass className="java.awt.Image"/>
<vasc:fieldClass className="javax.swing.Image"/>
</vasc:fieldType>
</root>

View 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;
}

View file

@ -62,12 +62,12 @@ public class VascAnnotationParser {
* @param property The property for the ToolTip
* @return The i18n key for an ToolTip
*/
public String getVascToolTipKey(Class<?> beanClass,String property) {
return (String)getValue(beanClass,VascToolTip.class,property);
public String getVascDescriptionKey(Class<?> beanClass,String property) {
return (String)getValue(beanClass,VascDescription.class,property);
}
public String getVascToolTipKey(Class<?> beanClass) {
return (String)getValue(beanClass,VascToolTip.class,null);
public String getVascDescriptionKey(Class<?> beanClass) {
return (String)getValue(beanClass,VascDescription.class,null);
}
/**
@ -211,8 +211,8 @@ public class VascAnnotationParser {
}
return l.key();
}
if (a.equals(VascToolTip.class)) {
VascToolTip t = (VascToolTip)b;
if (a.equals(VascDescription.class)) {
VascDescription t = (VascDescription)b;
if("".equals(t.key()) | "null".equals(t.key())) {
return null;
}

View 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;
}

View file

@ -39,7 +39,7 @@ import java.lang.annotation.Target;
* @version 1.0 Apr 28, 2007
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
@Target(ElementType.METHOD)
public @interface VascColumnWidth {
int width() default 150;

View file

@ -39,13 +39,15 @@ import java.lang.annotation.Target;
* @version 1.0 Mar 28, 2007
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
@Target(ElementType.METHOD)
public @interface VascDefaultValue {
String key() default "null";
String defaultValue() default "null";
/**
* The defaultValue of the method
*/
Class<?> defaultValueClass() default Object.class;
String defaultValue() default "null";
//Class<?> defaultValueClass() default Object.class;
}

View file

@ -40,7 +40,7 @@ import java.lang.annotation.Target;
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface VascToolTip {
public @interface VascDescription {
/**
* The key of the ToolTip default to "null"

View file

@ -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";
}

View file

@ -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";
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -42,5 +42,7 @@ import java.lang.annotation.Target;
@Target(ElementType.METHOD)
public @interface VascModelReference {
boolean editAsRadio() default true;
Class<?> type() default Object.class;
}

View file

@ -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 {
}

View file

@ -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";
}

View 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.backends.jdbc;
import java.sql.Connection;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 5, 2008
*/
public interface JdbcConnectionProvider {
public Connection getJdbcConnection();
}

View file

@ -24,38 +24,61 @@
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
package com.idcanet.vasc.backends.jdbc;
import com.idcanet.vasc.core.VascTable;
import java.util.List;
import com.idcanet.vasc.core.AbstractVascBackend;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 25, 2007
* @version 1.0 Sep 5, 2008
*/
public class VascColorChooser extends VascUIComponentImplLoader {
public class JdbcVascBackend extends AbstractVascBackend {
private JdbcConnectionProvider jdbcConnectionProvider = null;
// TODO: remove this hack with converters
boolean hexSwingEncoding = false;
public Object createComponent(VascTable table,VascValueModel model,Object gui) throws Exception {
return loadAndCreateComponent(this, table, model, gui);
/**
* @return the JdbcConnectionProvider
*/
public JdbcConnectionProvider getJdbcConnectionProvider() {
return jdbcConnectionProvider;
}
/**
* @return the hexSwingEncoding
* @param JdbcConnectionProvider the JdbcConnectionProvider to set
*/
public boolean getHexSwingEncoding() {
return hexSwingEncoding;
public void setJdbcConnectionProvider(JdbcConnectionProvider jdbcConnectionProvider) {
this.jdbcConnectionProvider = jdbcConnectionProvider;
}
/**
* @see com.idcanet.vasc.core.VascBackend#execute()
*/
public List<Object> execute() throws Exception {
return null;
}
/**
* @param hexSwingEncoding the hexSwingEncoding to set
* @see com.idcanet.vasc.core.VascBackend#merge(java.lang.Object)
*/
public void setHexSwingEncoding(boolean hexSwingEncoding) {
this.hexSwingEncoding = hexSwingEncoding;
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 {
}
}

View file

@ -0,0 +1,116 @@
/*
* 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.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 {
}
}

View file

@ -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();
}
}
}
}

View file

@ -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();
}
}
}
}

View file

@ -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;
}
}

View file

@ -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();
}

View file

@ -0,0 +1,133 @@
/*
* 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.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.x4o.element.ElementParameterException;
import com.idcanet.x4o.element.ElementParameterNotFoundException;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public class LdapVascBackend extends AbstractVascBackend {
private LdapConnectionProvider ldapConnectionProvider = 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 {
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#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)
*/
public Object getValue(VascEntryField field, Object record) throws ElementParameterException,ElementParameterNotFoundException {
Map<String,Object> map = (Map<String,Object>)record;
return map.get(field.getBackendName());
}
/**
* @see com.idcanet.vasc.core.entry.VascEntryFieldValue#setValue(com.idcanet.vasc.core.VascEntryField, java.lang.Object, java.lang.Object)
*/
public void setValue(VascEntryField field, Object record,Object value) throws ElementParameterException,ElementParameterNotFoundException {
Map<String,Object> map = (Map<String,Object>)record;
map.put(field.getBackendName(), value);
}
};
return result;
}
}

View file

@ -0,0 +1,153 @@
/*
* 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.security.Security;
import com.novell.ldap.LDAPConnection;
import com.novell.ldap.LDAPJSSESecureSocketFactory;
import com.novell.ldap.LDAPSocketFactory;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
private String ldapHost = "localhost";
private int ldapPort = LDAPConnection.DEFAULT_PORT;
private int ldapVersion = LDAPConnection.LDAP_V3;
private String bindUser = null;
private String bindPass = null;
/**
* @see com.idcanet.vasc.backends.ldap.LdapConnectionProvider#getLdapConnection()
*/
public LDAPConnection getLdapConnection() {
try {
// if ssl;
//Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
//System.setProperty("javax.net.ssl.trustStore", "/tmp/somewhere/ldap.root.crt");
//LDAPSocketFactory ssf = new LDAPJSSESecureSocketFactory();
// Set the socket factory as the default for all future connections
//LDAPConnection.setSocketFactory(ssf);
LDAPConnection lc = new LDAPConnection();
lc.connect( ldapHost, ldapPort );
if (bindUser!=null && bindPass!=null) {
lc.bind( ldapVersion, bindUser, bindPass.getBytes("UTF8") );
}
return lc;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* @return the ldapHost
*/
public String getLdapHost() {
return ldapHost;
}
/**
* @param ldapHost the ldapHost to set
*/
public void setLdapHost(String ldapHost) {
this.ldapHost = ldapHost;
}
/**
* @return the ldapPort
*/
public int getLdapPort() {
return ldapPort;
}
/**
* @param ldapPort the ldapPort to set
*/
public void setLdapPort(int ldapPort) {
this.ldapPort = ldapPort;
}
/**
* @return the ldapVersion
*/
public int getLdapVersion() {
return ldapVersion;
}
/**
* @param ldapVersion the ldapVersion to set
*/
public void setLdapVersion(int ldapVersion) {
this.ldapVersion = ldapVersion;
}
/**
* @return the bindUser
*/
public String getBindUser() {
return bindUser;
}
/**
* @param bindUser the bindUser to set
*/
public void setBindUser(String bindUser) {
this.bindUser = bindUser;
}
/**
* @return the bindPass
*/
public String getBindPass() {
return bindPass;
}
/**
* @param bindPass the bindPass to set
*/
public void setBindPass(String bindPass) {
this.bindPass = bindPass;
}
}

View file

@ -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 name = 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#getName()
*/
public String getName() {
return name;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setName(java.lang.String)
*/
public void setName(String name) {
if (name==null) {
throw new IllegalArgumentException("name may not be null");
}
this.name=name;
}
/**
* @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;
}
}

View file

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

View 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 getName();
public void setName(String name);
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);
*/
}

View file

@ -30,10 +30,9 @@ package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
* @version 1.0 Sep 4, 2008
*/
public interface VascUserOption {
public Object createUserOptionRenderer(VascTable table);
public interface VascBackendController {
public VascBackend getVascBackend(String name);
}

View 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 4, 2008
*/
public interface VascBackendControllerResolver {
public VascBackendController getVascBackendController();
}

View file

@ -0,0 +1,363 @@
/*
* 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;
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
/**
*
* 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 {
/**
* @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 getPrimaryKeyField();
/**
* @param primaryKeyField the primaryKeyField to set
*/
public void setPrimaryKeyField(String primaryKeyField);
/**
* @return the displayNameField
*/
public String getDisplayNameField();
/**
* @param displayNameField the displayNameField to set
*/
public void setDisplayNameField(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 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 vascBackend
*/
public VascBackend getVascBackend();
/**
* @param vascBackend the vascBackend to set
*/
public void setVascBackend(VascBackend vascBackend);
/**
* @return the vascFrontend
*/
public VascFrontend getVascFrontend();
/**
* @param vascFrontend the vascFrontend to set
*/
public void setVascFrontend(VascFrontend vascFrontend);
/**
* @return the vascBackendController
*/
public VascBackendController getVascBackendController();
/**
* @param vascBackendController the vascBackendController to set
*/
public void setVascBackendController(VascBackendController vascBackendController);
/**
* @return the vascEntryController
*/
public VascEntryController getVascEntryController();
/**
* @param vascEntryController the vascEntryController to set
*/
public void setVascEntryController(VascEntryController vascEntryController);
/**
* @return the vascFrontendController
*/
public VascFrontendController getVascFrontendController();
/**
* @param vascFrontendController the vascFrontendController to set
*/
public void setVascFrontendController(VascFrontendController vascFrontendController);
/**
* @return the vascEntryResourceResolver
*/
public VascEntryResourceResolver getVascEntryResourceResolver();
/**
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
*/
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver);
/**
* @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();
}

View file

@ -30,11 +30,9 @@ package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
* @version 1.0 Sep 4, 2008
*/
public interface VascRecordCreator {
public interface VascEntryController {
public Object newRecord(VascTable table) throws Exception;
public Class<?> getObjectClass();
public VascEntry getVascEntry(String name);
}

View 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 4, 2008
*/
public interface VascEntryControllerResolver {
public VascEntryController getVascEntryController();
}

View file

@ -0,0 +1,313 @@
/*
* 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 {
public VascEntry getVascEntry();
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);
}

View 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);
}

View file

@ -0,0 +1,68 @@
/*
* 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.validators.VascValidator;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryFieldType {
public String getName();
public void setName(String name);
public Class<?> getAutoFieldClass();
public void setAutoFieldClass(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 String getParentEntryFieldTypeName();
public void setParentEntryFieldTypeName(String name);
public ObjectConverter getObjectConverter();
public void setObjectConverter(ObjectConverter converter);
public VascUIComponent getVascUIComponent();
public void setVascUIComponent(VascUIComponent vascUIComponent);
interface ObjectConverter {
}
}

View file

@ -26,15 +26,21 @@
package com.idcanet.vasc.core;
import com.idcanet.vasc.core.entry.VascEntryExporter;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascViewRenderer {
public interface VascFrontend {
public void initTable(VascTable table) throws Exception;
public void setName(String name);
public String getName();
public void initEntry(VascEntry table) throws Exception;
public void renderView() throws Exception;
@ -42,5 +48,5 @@ public interface VascViewRenderer {
public void renderDelete(Object rowBean) throws Exception;
public void renderExport(VascDataExporter exporter) throws Exception;
public void renderExport(VascEntryExporter exporter) throws Exception;
}

View 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 4, 2008
*/
public interface VascFrontendController {
public VascFrontend getVascFrontend(String name);
public VascFrontendHelper getVascFrontendHelper();
}

View 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 4, 2008
*/
public interface VascFrontendControllerResolver {
public VascFrontendController getVascFrontendController();
}

View file

@ -34,7 +34,7 @@ import java.util.EventListener;
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public interface VascExceptionListener extends EventListener {
public interface VascFrontendExceptionHandler extends EventListener {
public void handleException(Exception e,VascTable table);
public void handleException(Exception e,VascFrontend vascFrontend,VascEntry entry);
}

View file

@ -26,40 +26,41 @@
package com.idcanet.vasc.core;
import com.idcanet.vasc.core.column.VascTableColumn;
import com.idcanet.vasc.core.entry.VascEntryEventListener;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2007
*/
public interface VascTableController {
public interface VascFrontendHelper {
public void finalizeVascTable(VascTable table) throws Exception;
public void finalizeVascEntry(VascEntry table) throws Exception;
public void finalizeVascColumns(VascTable table) throws Exception;
public void finalizeVascEntryFields(VascEntry table) throws Exception;
public Integer getTotalColumnsWidth(VascTable table);
public Integer getTotalColumnsWidth(VascEntry table);
public void refreshData(VascTable table) throws Exception;
public void refreshData(VascEntry table) throws Exception;
public Object initEditObject(VascTable table,Object object) throws Exception;
public Object initEditObject(VascEntry table,Object object) throws Exception;
public void initEditObjectColumn(VascTableColumn column,Object object) throws Exception;
public void initEditObjectColumn(VascEntryField field,Object object) throws Exception;
public void handleException(Exception e,VascTable table);
public void handleException(Exception e,VascEntry table);
public void addEventListener(VascEventListener e);
public void addEventListener(VascEntryEventListener e);
public void removeEventListener(VascEventListener e);
public void removeEventListener(VascEntryEventListener e);
public void fireVascEvent(VascEventListener.VascEventType type,Object data);
public void fireVascEvent(VascEntryEventListener.VascEventType type,Object data);
public boolean setUIComponentsBeanErrors(VascTable table,Object bean);
public boolean setUIComponentsBeanErrors(VascEntry table,Object bean);
public void addExceptionListener(VascExceptionListener listener);
public void addExceptionListener(VascEntryEventListener listener);
public void removeExceptionListener(VascExceptionListener listener);
public void removeExceptionListener(VascEntryEventListener listener);
public Object mergeObject(VascTable table,Object object);
public Object mergeObject(VascEntry table,Object object);
}

View file

@ -26,15 +26,15 @@
package com.idcanet.vasc.core;
import java.io.OutputStream;
/**
*
* @author Willem Cazander
* @version 1.0 May 19, 2007
* @version 1.0 Sep 7, 2008
*/
public interface VascDataExporter {
public interface VascLinkEntry {
public String getVascEntryName();
public void setVascEntryName(String vascEntryName);
public void doExport(OutputStream out,VascTable table) throws Exception;
}

View file

@ -1,344 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.actions.ColumnVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.column.VascTableColumn;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class VascTable {
private String name = null;
private String headerName = null;
private String headerImage = null;
private String headerToolTip = null;
private List<VascTableColumn> tableColumns = null;
private List<RowVascAction> rowActions = null;
private List<ColumnVascAction> columnActions = null;
private List<GlobalVascAction> globalActions = null;
private VascDataSource vascDataSource = null;
private List<Object> tableData = null;
private Object selectedObject = null;
private VascRecordCreator vascRecordCreator = null;
private VascViewRenderer vascViewRenderer = null;
private VascTextValue vascTextValue = null;
private List<VascUserOption> userOptions = null;
private String helpId = null;
private VascTableController vascTableController = null;
private Map<Class<?>,Class<?>> uiComponents = null;
private VascTableColumn UIIdentifierVascTableColomn = null;
public VascTable() {
tableColumns = new ArrayList<VascTableColumn>(6);
rowActions = new ArrayList<RowVascAction>(6);
columnActions = new ArrayList<ColumnVascAction>(6);
globalActions = new ArrayList<GlobalVascAction>(6);
tableData = new ArrayList<Object>(6);
userOptions = new ArrayList<VascUserOption>(6);
uiComponents = new HashMap<Class<?>,Class<?>>(6);
}
/**
* @return the columnActions
*/
public List<ColumnVascAction> getColumnActions() {
return columnActions;
}
/**
* @param columnActions the columnActions to set
*/
public void addColumnActions(ColumnVascAction columnAction) {
columnActions.add(columnAction);
}
/**
* @return the globalActions
*/
public List<GlobalVascAction> getGlobalActions() {
return globalActions;
}
/**
* @param globalActions the globalActions to set
*/
public void addGlobalActions(GlobalVascAction globalAction) {
globalActions.add(globalAction);
}
/**
* @return the headerName
*/
public String getHeaderName() {
return headerName;
}
/**
* @param headerName the headerName to set
*/
public void setHeaderName(String headerName) {
this.headerName = headerName;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the rowActions
*/
public List<RowVascAction> getRowActions() {
return rowActions;
}
/**
* @param rowActions the rowActions to set
*/
public void addRowActions(RowVascAction rowAction) {
rowActions.add(rowAction);
}
/**
* @return the selectedObject
*/
public Object getSelectedObject() {
return selectedObject;
}
/**
* @param selectedObject the selectedObject to set
*/
public void setSelectedObject(Object selectedObject) {
this.selectedObject = selectedObject;
}
/**
* @return the tableColumns
*/
public List<VascTableColumn> getTableColumns() {
return tableColumns;
}
/**
* @param tableColumns the tableColumns to set
*/
public void addTableColumns(VascTableColumn tableColumn) {
if (tableColumn.getVascTable()!=null) {
if (tableColumn.getVascTable().equals(this) == false) {
throw new IllegalStateException("VascTableColumn already bound to an other VascTable instance.");
}
}
tableColumn.setVascTable(this);
tableColumns.add(tableColumn);
}
/**
* @return the tableData
*/
public List<Object> getTableData() {
return tableData;
}
/**
* @param tableData the tableData to set
*/
public void setTableData(List<Object> tableData) {
this.tableData = tableData;
}
/**
* @return the userOptions
*/
public List<VascUserOption> getUserOptions() {
return userOptions;
}
/**
* @param userOptions the userOptions to set
*/
public void addUserOptions(VascUserOption userOption) {
userOptions.add(userOption);
}
/**
* @return the vascDataSource
*/
public VascDataSource getVascDataSource() {
return vascDataSource;
}
/**
* @param vascDataSource the vascDataSource to set
*/
public void setVascDataSource(VascDataSource vascDataSource) {
this.vascDataSource = vascDataSource;
}
/**
* @return the vascRecordCreator
*/
public VascRecordCreator getVascRecordCreator() {
return vascRecordCreator;
}
/**
* @param vascRecordCreator the vascRecordCreator to set
*/
public void setVascRecordCreator(VascRecordCreator vascRecordCreator) {
this.vascRecordCreator = vascRecordCreator;
}
/**
* @return the vascTextValue
*/
public VascTextValue getVascTextValue() {
return vascTextValue;
}
/**
* @param vascTextValue the vascTextValue to set
*/
public void setVascTextValue(VascTextValue vascTextValue) {
this.vascTextValue = vascTextValue;
}
/**
* @return the vascViewRenderer
*/
public VascViewRenderer getVascViewRenderer() {
return vascViewRenderer;
}
/**
* @param vascViewRenderer the vascViewRenderer to set
*/
public void setVascViewRenderer(VascViewRenderer vascViewRenderer) {
this.vascViewRenderer = vascViewRenderer;
}
/**
* @return the helpId
*/
public String getHelpId() {
return helpId;
}
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId) {
this.helpId = helpId;
}
/**
* @return the vascTableController
*/
public VascTableController getVascTableController() {
return vascTableController;
}
/**
* @param vascTableController the vascTableController to set
*/
public void setVascTableController(VascTableController vascTableController) {
this.vascTableController = vascTableController;
}
/**
* @return the headerImage
*/
public String getHeaderImage() {
return headerImage;
}
/**
* @param headerImage the headerImage to set
*/
public void setHeaderImage(String headerImage) {
this.headerImage = headerImage;
}
/**
* @return the headerToolTip
*/
public String getHeaderToolTip() {
return headerToolTip;
}
/**
* @param headerToolTip the headerToolTip to set
*/
public void setHeaderToolTip(String headerToolTip) {
this.headerToolTip = headerToolTip;
}
public Class<?> getUIComponent(Class<?> classType) {
return uiComponents.get(classType);
}
public void putUIComponent(Class<?> classType,Class<?> comp) {
uiComponents.put(classType, comp);
}
/**
* @return the uiIdentifierVascTableColomn
*/
public VascTableColumn getUIIdentifierVascTableColomn() {
return UIIdentifierVascTableColomn;
}
/**
* @param uiIdentifierVascTableColomn the uiIdentifierVascTableColomn to set
*/
public void setUIIdentifierVascTableColomn(VascTableColumn UIIdentifierVascTableColomn) {
this.UIIdentifierVascTableColomn = UIIdentifierVascTableColomn;
}
}

View file

@ -26,8 +26,8 @@
package com.idcanet.vasc.core.actions;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.column.VascTableColumn;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
/**
*
@ -36,5 +36,5 @@ import com.idcanet.vasc.core.column.VascTableColumn;
*/
public interface ColumnVascAction extends VascAction {
public void doColumnAction(VascTable table,VascTableColumn column) throws Exception;
public void doColumnAction(VascEntry table,VascEntryField column) throws Exception;
}

View file

@ -26,7 +26,7 @@
package com.idcanet.vasc.core.actions;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascEntry;
/**
*
@ -35,5 +35,5 @@ import com.idcanet.vasc.core.VascTable;
*/
public interface GlobalVascAction extends VascAction {
public void doGlobalAction(VascTable table) throws Exception;
public void doGlobalAction(VascEntry vascEntry) throws Exception;
}

View file

@ -26,7 +26,7 @@
package com.idcanet.vasc.core.actions;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascEntry;
/**
*
@ -35,5 +35,5 @@ import com.idcanet.vasc.core.VascTable;
*/
public interface RowVascAction extends VascAction {
public void doRowAction(VascTable table,Object rowObject) throws Exception;
public void doRowAction(VascEntry vascEntry,Object rowObject) throws Exception;
}

View file

@ -34,13 +34,18 @@ package com.idcanet.vasc.core.actions;
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);
//public Object createActionObject(VascTable table);
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);
}

View file

@ -24,7 +24,7 @@
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
package com.idcanet.vasc.core.entry;
/**
@ -32,7 +32,7 @@ package com.idcanet.vasc.core;
* @author Willem Cazander
* @version 1.0 Aug 02, 2007
*/
public interface VascEventListener {
public interface VascEntryEventListener {
public enum VascEventType { DATA_UPDATE,OPTION_UPDATE,CLOSE_WINDOW,BEAN_MERGE,BEAN_INIT }

View file

@ -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();
}

View file

@ -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();
}

View file

@ -24,27 +24,20 @@
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
package com.idcanet.vasc.core.entry;
import java.util.List;
import java.util.Set;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.x4o.element.ElementParameterException;
import com.idcanet.x4o.element.ElementParameterNotFoundException;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascDataSource {
public interface VascEntryFieldValue {
public void setDataParameter(String key,Object data);
public Object getDataParameter(String key);
public Set<String> getDataParameterKeys();
public Object getValue(VascEntryField field,Object record) throws ElementParameterException,ElementParameterNotFoundException;
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 void setValue(VascEntryField field,Object record,Object value) throws ElementParameterException,ElementParameterNotFoundException;
}

View file

@ -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();
}

View file

@ -24,7 +24,7 @@
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
package com.idcanet.vasc.core.entry;
/**
@ -32,7 +32,7 @@ package com.idcanet.vasc.core;
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascTextValue {
public interface VascEntryResourceResolver {
public String getTextValue(String key,Object...params);

View file

@ -26,7 +26,7 @@
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascEntry;
/**
*
@ -37,7 +37,7 @@ abstract public class AbstractVascUIComponent implements VascUIComponent {
private VascUIComponent wrapper = null;
abstract public Object createComponent(VascTable table,VascValueModel model,Object gui) throws Exception;
abstract public Object createComponent(VascEntry entry,VascValueModel model,Object gui) throws Exception;
/**
* @return the wrapper

View file

@ -26,7 +26,7 @@
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.column.VascTableColumn;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.x4o.element.ElementParameterException;
import com.idcanet.x4o.element.ElementParameterNotFoundException;
@ -38,18 +38,19 @@ import com.idcanet.x4o.element.ElementParameterNotFoundException;
*/
public class VascColumnValueModelListener implements VascValueModelListener {
private VascTableColumn vascTableColumn = null;
private VascEntryField vascTableColumn = null;
private Object bean = null;
public VascColumnValueModelListener() {
}
public VascColumnValueModelListener(VascTableColumn vascTableColumn,Object bean) {
public VascColumnValueModelListener(VascEntryField vascTableColumn,Object bean) {
setVascTableColumn(vascTableColumn);
setBean(bean);
}
public void valueUpdate(VascValueModel model) throws ElementParameterException,ElementParameterNotFoundException {
vascTableColumn.getVascColumnValue().setValue(vascTableColumn, bean, model.getValue());
//vascTableColumn.getVascColumnValue().setValue(VascEntryField, bean, model.getValue());
//TODO
}
@ -57,7 +58,7 @@ public class VascColumnValueModelListener implements VascValueModelListener {
/**
* @return the vascTableColumn
*/
public VascTableColumn getVascTableColumn() {
public VascEntryField getVascTableColumn() {
return vascTableColumn;
}
@ -66,7 +67,7 @@ public class VascColumnValueModelListener implements VascValueModelListener {
/**
* @param vascTableColumn the vascTableColumn to set
*/
public void setVascTableColumn(VascTableColumn vascTableColumn) {
public void setVascTableColumn(VascEntryField vascTableColumn) {
this.vascTableColumn = vascTableColumn;
}
/**

View file

@ -26,7 +26,7 @@
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascEntry;
/**
@ -38,8 +38,8 @@ public class VascList extends VascUIComponentImplLoader {
private VascSelectItemModel vascSelectItemModel = null;
public Object createComponent(VascTable table,VascValueModel model,Object gui) throws Exception {
return loadAndCreateComponent(this, table, model, gui);
public Object createComponent(VascEntry entry,VascValueModel model,Object gui) throws Exception {
return loadAndCreateComponent(this, entry, model, gui);
}
/**

View file

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

View file

@ -26,7 +26,7 @@
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascEntry;
/**
*
@ -38,7 +38,7 @@ public interface VascUIComponent {
public void setWrapper(VascUIComponent wrapper);
public VascUIComponent getWrapper();
public Object createComponent(VascTable table,VascValueModel model,Object gui) throws Exception;
public Object createComponent(VascEntry entry,VascValueModel model,Object gui) throws Exception;
public void setErrorText(String text);
public String getErrorText();

View file

@ -26,7 +26,7 @@
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascEntry;
/**
*
@ -37,10 +37,12 @@ abstract public class VascUIComponentImplLoader extends AbstractVascUIComponent
private VascUIComponent realComponent = null;
public Object loadAndCreateComponent(VascUIComponent wrapper,VascTable table,VascValueModel model,Object gui) throws Exception {
realComponent = (VascUIComponent)table.getUIComponent(wrapper.getClass()).newInstance();
realComponent.setWrapper(wrapper);
return realComponent.createComponent(table, model, gui);
public Object loadAndCreateComponent(VascUIComponent wrapper,VascEntry entry,VascValueModel model,Object gui) throws Exception {
//realComponent = (VascUIComponent)entry.getUIComponent(wrapper.getClass()).newInstance();
//realComponent.setWrapper(wrapper);
//return realComponent.createComponent(entry, model, gui);
//TODO
return null;
}

View file

@ -29,7 +29,7 @@ package com.idcanet.vasc.core.ui;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.x4o.element.ElementParameterException;
import com.idcanet.x4o.element.ElementParameterNotFoundException;
@ -45,7 +45,7 @@ public class VascValueModel {
private List<VascValueModelListener> listeners = null;
//private VascTable table = null;
public VascValueModel(VascTable table) {
public VascValueModel(VascEntry entry) {
listeners = new ArrayList<VascValueModelListener>(2);
//this.table=table;
}

View file

@ -0,0 +1,857 @@
/*
* 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.Image;
import java.awt.Toolkit;
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.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascFrontend;
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.VascList;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class SwingVascFrontend implements VascFrontend {
private String name = null;
private Logger logger = null;
private JComponent parent = null;
private VascEntry entry = null;
public SwingVascFrontend(JComponent parent) {
logger = Logger.getLogger(SwingVascFrontend.class.getName());
this.parent=parent;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void initEntry(VascEntry entry) throws Exception {
if (entry.getVascFrontend()==null) {
entry.setVascFrontend(this);
} else {
if (entry.getVascFrontend()!=this) {
throw new IllegalArgumentException("VascEntry has already a differtent VascViewRenderer attected");
}
}
entry.getVascFrontendController().getVascFrontendHelper().finalizeVascEntry(entry);
entry.getVascFrontendController().getVascFrontendHelper().finalizeVascEntryFields(entry);
entry.getVascFrontendController().getVascFrontendHelper().refreshData(entry);
/*
entry.putUIComponent(VascTextField.class, SwingTextField.class);
entry.putUIComponent(VascList.class, SwingList.class);
entry.putUIComponent(VascToggle.class, SwingToggle.class);
entry.putUIComponent(VascDate.class, SwingDate.class);
entry.putUIComponent(VascColorChooser.class, SwingColorChooser.class);
*/
this.entry=entry;
}
public ImageIcon getImageIcon(String imageResource) {
/// TODO hack beter
String key = entry.getVascEntryResourceResolver().getTextValue(imageResource);
//logger.fine("KEY======================="+key);
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.getVascFrontendController().getVascFrontendHelper().initEditObject(entry, rowBean);
String beanValue = rowBean.toString();
if (entry.getDisplayNameField()!=null) {
Object vv = entry.getUIIdentifierVascEntryColomn().getVascColumnValue().getValue(entry.getUIIdentifierVascEntryColomn(), rowBean);
if (vv==null) {
beanValue="";
} else {
beanValue=""+vv;
}
if (beanValue.length()>30) {
beanValue=beanValue.substring(0, 30);
}
}
SwingEditDialog dialog = new SwingEditDialog(parent,entry,rowBean,entry.getVascEntryResourceResolver().getTextValue("vasc.dialog.edit.title"),entry.getVascTextValue().getTextValue("vasc.dialog.edit.message",beanValue));
Object result = dialog.openDialog();
logger.finest("OPEN closed : "+result);
if(result==null) {
return;
}
entry.getVascFrontendController().getVascFrontendHelper().mergeObject(entry, result);
}
public void renderDelete(Object rowBean) throws Exception {
String beanValue = rowBean.toString();
if (entry.getUIIdentifierVascEntryColomn()!=null) {
beanValue = ""+entry.getUIIdentifierVascEntryColomn().getVascColumnValue().getValue(entry.getUIIdentifierVascEntryColomn(), rowBean);
if (beanValue.length()>30) {
beanValue=beanValue.substring(0, 30);
}
}
int response = JOptionPane.showOptionDialog(
parent // Center in window.
, entry.getVascEntryResourceResolver().getTextValue("vasc.dialog.delete.message",beanValue) // Message
, entry.getVascEntryResourceResolver().getTextValue("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.getVascBackend().delete(rowBean);
entry.getEntryDataList().remove(rowBean);
entry.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(entry.getVascEntryResourceResolver().getTextValue(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(entry.getVascEntryResourceResolver().getTextValue(headerText));
l.setFont(new Font(null,Font.BOLD, 14));
//l.setToolTipText(entry.getVascTextValue().getTextValue(headerText));
header.add(l);
}
public void createBody(JPanel body) throws Exception {
body.setLayout(new SpringLayout());
int column = 0;
for(VascEntryField c:entry.getVascEntryFields()) {
entry.getVascFrontendController().getVascFrontendHelper().initEditObjectColumn(c, bean);
if (c.isEdit()==false) {
continue;
}
column++;
JLabel l = new JLabel();
l.setHorizontalAlignment(JLabel.TRAILING);
l.setText(entry.getVascEntryResourceResolver().getTextValue(c.getName()));
if(c.getDescription()!=null) {
l.setToolTipText(entry.getVascEntryResourceResolver().getTextValue(c.getDescription()));
}
body.add(l);
if (c.isEditReadOnly()==true) {
JLabel valueLabel = new JLabel();
valueLabel.setText(""+c.getVascEntryFieldValue().getValue(c, bean));
c.setColumnEditor(valueLabel);
body.add(valueLabel);
continue;
}
if(c.getVascEntryFieldType().getVascUIComponent()==null) {
JLabel valueLabel = new JLabel();
valueLabel.setText(""+c.getVascEntryFieldValue().getValue(c, bean));
c.setColumnEditor(valueLabel);
body.add(valueLabel);
} else {
VascUIComponent comp = c.getVascEntryFieldType().getVascUIComponent();
VascValueModel model = new VascValueModel(entry);
model.setValue(c.getVascEntryFieldValue().getValue(c, bean));
model.addListener(new VascColumnValueModelListener(c,bean));
comp.createComponent(entry, model, body);
c.setColumnEditor(comp);
}
}
//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(entry.getVascEntryResourceResolver().getTextValue("vasc.dialog.save.name"));
saveButton.setToolTipText(entry.getVascEntryResourceResolver().getTextValue("vasc.dialog.save.tooltip"));
saveButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
if(entry.getVascFrontendController().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(entry.getVascEntryResourceResolver().getTextValue("vasc.dialog.cancel.name"));
cancelButton.setToolTipText(entry.getVascEntryResourceResolver().getTextValue("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();
// Demonstrate "Save" dialog:
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.getVascFrontendController().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(entry.getVascEntryResourceResolver().getTextValue(entry.getHeaderDescription()));
}
header.add(l,BorderLayout.WEST);
}
if(entry.getHeaderName()!=null) {
JLabel l = new JLabel(entry.getVascEntryResourceResolver().getTextValue(entry.getHeaderName()));
l.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
l.setFont(new Font(null,Font.BOLD, 18));
if (entry.getHeaderDescription()!=null) {
l.setToolTipText(entry.getVascEntryResourceResolver().getTextValue(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(entry.getVascEntryResourceResolver().getTextValue(action.getName()));
but.setToolTipText(entry.getVascEntryResourceResolver().getTextValue(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 JComponententryCellRenderer();
int counter=0;
for(VascEntryField c:entry.getVascEntryFields()) {
if (c.isList()==false) {
continue;
}
TableColumn t = new TableColumn();
t.setPreferredWidth(c.getSizeList());
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.getEntryDataObject();
if (o==null) {
return;
}
try {
// TODO: fix this
entry.getVascFrontend().renderEdit(o);
} catch (Exception ee) {
entry.getVascFrontendController().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.getEntryDataList().get(rowIndex);
entry.setEntryDataObject(data);
} else {
entry.setEntryDataObject(null);
}
}
}
class JComponententryCellRenderer extends DefaultTableCellRenderer {
private static final long serialVersionUID = 10L;
public Component getentryCellRendererComponent(JTable table, Object value, boolean isSelected,boolean hasFocus, int row, int column) {
VascEntryField c = (VascEntryField)value;
setText(c.getVascEntry().getVascEntryResourceResolver().getTextValue(c.getName()));
setToolTipText(c.getVascEntry().getVascEntryResourceResolver().getTextValue(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("entryHeader.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(entry.getVascEntryResourceResolver().getTextValue(action.getName()));
but.setToolTipText(entry.getVascEntryResourceResolver().getTextValue(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.getEntryDataObject());
} catch (Exception e) {
entry.getVascFrontendController().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.getVascFrontendController().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.getEntryDataList()==null) {
return 0;
}
return entry.getEntryDataList().size();
}
/**
* @see javax.swing.entry.entryModel#getValueAt(int, int)
*/
public Object getValueAt(int rowIndex, int columnIndex) {
Object bean = entry.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);
}
}

View 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;
}
}
}

View file

@ -0,0 +1,131 @@
/*
* 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.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.VascTable;
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
import com.idcanet.vasc.core.ui.VascColorChooser;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
*
* @author Willem Cazander
* @version 1.0 Nov 25, 2007
*/
public class SwingColorChooser extends AbstractVascUIComponent {
private JButton colorButton = null;
private Color orgBackgroundColor = null;
public Object createComponent(VascTable table,VascValueModel model,Object gui) throws Exception {
VascColorChooser org = (VascColorChooser)getWrapper();
JButton colorButton = new JButton("Color");
orgBackgroundColor = colorButton.getBackground();
((JComponent)gui).add(colorButton);
colorButton.addActionListener(new SelectActionListener3(model,org.getHexSwingEncoding(),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 VascTable table = null;
public SelectActionListener3(VascValueModel model,boolean hexEncoding,VascTable 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 = (Color)model.getValue();
if (cur==null) {
cur = Color.YELLOW;
}
Color newColor = JColorChooser.showDialog(null,"Choose a color...",cur);
try {
model.setValue(newColor);
} catch (Exception ee) {
table.getVascTableController().handleException(ee, table);
}
} else {
String cur = (String)model.getValue();
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.getVascTableController().handleException(ee, table);
}
}
}
}

View file

@ -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.impl.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.VascTable;
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
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 extends AbstractVascUIComponent {
private DatePicker datePicker = null;
private Color orgBackgroundColor = null;
public Object createComponent(VascTable table,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 VascTable table = null;
public SelectActionListener2(VascValueModel model,VascTable 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.getVascTableController().handleException(ee, table);
}
}
}

View file

@ -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.impl.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.VascTable;
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
import com.idcanet.vasc.core.ui.VascList;
import com.idcanet.vasc.core.ui.VascSelectItem;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public class SwingList extends AbstractVascUIComponent {
private JComboBox comboBox = null;
private Color orgBackgroundColor = null;
public Object createComponent(final VascTable table,final VascValueModel model,Object gui) throws Exception {
VascList l = (VascList)getWrapper();
if (l.getVascSelectItemModel()==null) {
comboBox = new JComboBox();
} else {
comboBox = new JComboBox(l.getVascSelectItemModel().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.getVascTableController().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;
}
}

View file

@ -0,0 +1,129 @@
/*
* 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.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.VascTable;
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public class SwingTextField extends AbstractVascUIComponent {
private JTextField textField = null;
private Color orgBackgroundColor = null;
public Object createComponent(VascTable table,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 SwingTextField textField = null;
public TextListener(VascValueModel model,VascTable table,SwingTextField textField) {
this.model=model;
//this.table=table;
this.textField=textField;
}
/**
* @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
*/
public void changedUpdate(DocumentEvent e) {
update(e);
}
/**
* @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
*/
public void insertUpdate(DocumentEvent e) {
update(e);
}
/**
* @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
*/
public void removeUpdate(DocumentEvent e) {
update(e);
}
public void update(DocumentEvent event) {
try {
String value = event.getDocument().getText(0, event.getDocument().getLength());
model.setValue(value);
textField.setErrorText(null);
} catch (Exception ee) {
textField.setErrorText(ee.getLocalizedMessage());
//table.getVascTableController().handleException(ee, table);
}
}
}

View file

@ -0,0 +1,106 @@
/*
* 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.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.VascTable;
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
*
*
* @author Willem Cazander
* @version 1.0 Sep 21, 2007
*/
public class SwingToggle extends AbstractVascUIComponent {
private JCheckBox checkBox = null;
private Color orgBackgroundColor = null;
public Object createComponent(VascTable table,VascValueModel model,Object gui) throws Exception {
checkBox = new JCheckBox();
orgBackgroundColor = checkBox.getBackground();
checkBox.setSelected((Boolean)model.getValue());
((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 VascTable table = null;
public SelectActionListener(VascValueModel model,VascTable 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.getVascTableController().handleException(ee, table);
}
}
}

View file

@ -0,0 +1,714 @@
/*
* 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.Control;
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.VascEntry;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class SwtVascFrontend implements VascFrontend {
private Logger logger = null;
private Composite parent = null;
private VascEntry table = null;
public SwtVascFrontend(Composite parent) {
logger = Logger.getLogger(SwtVascFrontend.class.getName());
this.parent=parent;
}
public void initTable(VascEntry table) throws Exception {
if (table.VascEntry()==null) {
table.setVascViewRenderer(this);
} else {
if (table.getVascViewRenderer()!=this) {
throw new IllegalArgumentException("VascTable has already a differtent VascViewRenderer attected");
}
}
table.getVascTableController().finalizeVascColumns(table);
table.getVascTableController().finalizeVascTable(table);
table.getVascTableController().refreshData(table);
this.table=table;
}
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(VascDataExporter exporter) throws Exception {
FileDialog dlg = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE);
dlg.setFilterNames(FILTER_NAMES);
dlg.setFilterExtensions(FILTER_EXTS);
dlg.setFileName(table.getHeaderName()+".csv");
String fileName = dlg.open();
logger.fine("FileName: "+fileName);
if (fileName == null) {
return;
}
OutputStream out = new FileOutputStream(fileName);
try {
exporter.doExport(out, table);
} 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");
table.getVascTableController().initEditObject(table, object);
SwtVascEditDialog dialog = new SwtVascEditDialog(Display.getCurrent().getActiveShell(),table,object,"Vasc Edit","Edit");
Object result = dialog.open();
if(result==null) {
return;
}
try {
result = table.getVascDataSource().merge(object);
//table.getVascTableController().fireModelUpdateListeners(result);
} finally {
//TODO: or merge into table == faster
table.getVascTableController().refreshData(table);
}
}
public ImageDescriptor getImageDescriptor(String path) {
try {
path = table.getVascTextValue().getTextValue(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,VascTable table,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(VascTableColumn c:table.getTableColumns()) {
Label l = new Label(body, SWT.WRAP);
l.setText(c.getName());
if(c.getToolTip()!=null) {
l.setToolTipText(c.getToolTip());
}
try {
table.getVascTableController().initEditObjectColumn(c, bean);
//if(c.getVascColumnEditor()==null) {
Label valueLabel = new Label(body, SWT.WRAP);
valueLabel.setText(""+c.getVascColumnValue().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.getVascColumnValue()+"' 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(table.getVascTextValue().getTextValue("vasc.dialog.save.name"));
saveButton.setToolTipText(table.getVascTextValue().getTextValue("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(table.getVascTextValue().getTextValue("vasc.dialog.cancel.name"));
cancelButton.setToolTipText(table.getVascTextValue().getTextValue("vasc.dialog.cancel.tooltip"));
cancelButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
result = null;
shell.dispose();
}
});
}
}
public Object defaultColumnEditor(VascTableColumn 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.getVascColumnValue().getValue(column, bean));
return text;
}
class TextListener extends SelectionAdapter {
private VascTableColumn column = null;
private Object bean = null;
public TextListener(VascTableColumn 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.getVascColumnValue().setValue(column, bean, value);
} catch (Exception ee) {
ee.printStackTrace();
}
}
}
public Object defaultColumnRenderer(VascTableColumn column,Object gui) throws Exception {
return null;
}
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:table.getGlobalActions()) {
ToolItem item = new ToolItem(toolBar, SWT.PUSH);
item.setText(table.getVascTextValue().getTextValue(action.getName()));
item.setToolTipText(table.getVascTextValue().getTextValue(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(table.getHeaderName()!=null) {
Font headerFont = new Font(header.getDisplay(), "verdana", 16, SWT.BOLD);
Label l = new Label(headerName, SWT.CENTER);
l.setImage(getImageDescriptor(table.getHeaderImage()).createImage());
l.setFont(headerFont);
l.setText(table.getVascTextValue().getTextValue(table.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(table);
} catch (Exception e) {
table.getVascTableController().handleException(e, table);
}
}
}
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);
table.setSelectedObject(data);
}
});
// Set the content and label providers
tableViewer.setContentProvider(new ListConverterContentProvider());
tableViewer.setLabelProvider(new DefaultLabelProvider(table));
//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(VascTableColumn c:table.getTableColumns()) {
TableColumn tc = new TableColumn(table2, SWT.LEFT);
tc.setText(c.getName());
tc.setToolTipText(c.getToolTip());
if (c.getImage()!=null) {
tc.setImage(getImageDescriptor(c.getImage()).createImage());
}
tc.addListener(SWT.Selection, sortListener);
tc.setMoveable(false);
tc.setResizable(true);
}
int totalWidth = table.getVascTableController().getTotalColumnsWidth(table);
logger.finer("Total size: "+totalWidth);
TableColumn[] columns = table2.getColumns();
for (int i = 0; i < columns.length; i++) {
Integer cWidth = table.getTableColumns().get(i).getWidth();
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(table);
}
public void createFooter(Composite footer) {
logger.finest("Creating footer");
for(RowVascAction action:table.getRowActions()) {
Button actionButton = new Button(footer, SWT.NONE);
actionButton.setText(table.getVascTextValue().getTextValue(action.getName()));
actionButton.setToolTipText(table.getVascTextValue().getTextValue(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(table, table.getSelectedObject());
} catch (Exception e) {
table.getVascTableController().handleException(e, table);
}
}
}
/**
* Is called when all createPartControl is done with creating Parts
*/
public void partCreated() {
}
class DefaultLabelProvider implements ITableLabelProvider {
private VascTable table = null;
public DefaultLabelProvider(VascTable table) {
this.table=table;
}
/**
* @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) {
VascTableColumn vtc = table.getTableColumns().get(columnNumber);
if (vtc.getVascColumnRenderer()==null) {
try {
return ""+vtc.getVascColumnValue().getValue(vtc,bean);
} catch (Exception e) {
logger.log(Level.WARNING,"Error in get value: '"+vtc.getVascColumnValue()+"' 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 ((VascTable)obj).getTableData().toArray();
}
/**
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
public void dispose() {
}
/**
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
}
}
}

View file

@ -0,0 +1,568 @@
/*
* 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.VascBackend;
import com.idcanet.vasc.core.VascBackendController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryController;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryFieldSet;
import com.idcanet.vasc.core.VascFrontend;
import com.idcanet.vasc.core.VascFrontendController;
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;
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
/**
*
* @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 primaryKeyField = null;
private String displayNameField = null;
private boolean vascAdmimList = true;
private boolean vascAdmimEdit = true;
private boolean vascAdmimCreate = true;
private boolean vascAdmimDelete = true;
private List<VascEntryField> vascFields = null;
private List<Object> entryDataList = null;
private Object entryDataObject = null;
private VascBackend vascBackend = null;
private VascFrontend vascFrontend = null;
private VascBackendController vascBackendController = null;
private VascEntryController vascEntryController = null;
private VascFrontendController vascFrontendController = null;
private VascEntryResourceResolver vascEntryResourceResolver = 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;
public DefaultVascEntry() {
vascFields = new ArrayList<VascEntryField>(10);
entryDataList = new ArrayList<Object>(0);
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>();
}
/**
* @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 primaryKeyField
*/
public String getPrimaryKeyField() {
return primaryKeyField;
}
/**
* @param primaryKeyField the primaryKeyField to set
*/
public void setPrimaryKeyField(String primaryKeyField) {
this.primaryKeyField = primaryKeyField;
}
/**
* @return the displayNameField
*/
public String getDisplayNameField() {
return displayNameField;
}
/**
* @param displayNameField the displayNameField to set
*/
public void setDisplayNameField(String displayNameField) {
this.displayNameField = displayNameField;
}
/**
* @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);
}
/**
* @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 vascBackend
*/
public VascBackend getVascBackend() {
return vascBackend;
}
/**
* @param vascBackend the vascBackend to set
*/
public void setVascBackend(VascBackend vascBackend) {
this.vascBackend = vascBackend;
}
/**
* @return the vascFrontend
*/
public VascFrontend getVascFrontend() {
return vascFrontend;
}
/**
* @param vascFrontend the vascFrontend to set
*/
public void setVascFrontend(VascFrontend vascFrontend) {
this.vascFrontend = vascFrontend;
}
/**
* @return the vascBackendController
*/
public VascBackendController getVascBackendController() {
return vascBackendController;
}
/**
* @param vascBackendController the vascBackendController to set
*/
public void setVascBackendController(VascBackendController vascBackendController) {
this.vascBackendController = vascBackendController;
}
/**
* @return the vascEntryController
*/
public VascEntryController getVascEntryController() {
return vascEntryController;
}
/**
* @param vascEntryController the vascEntryController to set
*/
public void setVascEntryController(VascEntryController vascEntryController) {
this.vascEntryController = vascEntryController;
}
/**
* @return the vascFrontendController
*/
public VascFrontendController getVascFrontendController() {
return vascFrontendController;
}
/**
* @param vascFrontendController the vascFrontendController to set
*/
public void setVascFrontendController(VascFrontendController vascFrontendController) {
this.vascFrontendController = vascFrontendController;
}
/**
* @return the vascEntryResourceResolver
*/
public VascEntryResourceResolver getVascEntryResourceResolver() {
return vascEntryResourceResolver;
}
/**
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
*/
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver) {
this.vascEntryResourceResolver = vascEntryResourceResolver;
}
/**
* @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);
}
}

View file

@ -0,0 +1,475 @@
/*
* 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 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;
}
}

View file

@ -0,0 +1,201 @@
/*
* 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.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;
/**
* @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);
}
}

View file

@ -26,7 +26,7 @@
package com.idcanet.vasc.impl.actions;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.actions.AbstractVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
@ -43,7 +43,7 @@ public class AddRowAction extends AbstractVascAction implements RowVascAction {
setImage("vasc.action.add.image");
}
public void doRowAction(VascTable table,Object rowObject) throws Exception {
table.getVascViewRenderer().renderEdit(null);
public void doRowAction(VascEntry enty,Object rowObject) throws Exception {
enty.getVascFrontend().renderEdit(null);
}
}

View file

@ -29,18 +29,18 @@ package com.idcanet.vasc.impl.actions;
import java.io.OutputStream;
import java.io.PrintWriter;
import com.idcanet.vasc.core.VascDataExporter;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.entry.VascEntryExporter;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.actions.AbstractVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.column.VascTableColumn;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 30, 2007
*/
public class CSVExportGlobalAction extends AbstractVascAction implements GlobalVascAction,VascDataExporter {
public class CSVExportGlobalAction extends AbstractVascAction implements GlobalVascAction,VascEntryExporter {
public CSVExportGlobalAction() {
setName("vasc.action.csv.name");
@ -48,20 +48,20 @@ public class CSVExportGlobalAction extends AbstractVascAction implements GlobalV
setImage("vasc.action.csv.image");
}
public void doGlobalAction(VascTable table) throws Exception {
table.getVascViewRenderer().renderExport(this);
public void doGlobalAction(VascEntry entry) throws Exception {
entry.getVascFrontend().renderExport(this);
}
public void doExport(OutputStream out,VascTable table) throws Exception {
public void doExport(OutputStream out,VascEntry entry) throws Exception {
PrintWriter p = new PrintWriter(out);
p.write("# csv\n");
for (VascTableColumn c:table.getTableColumns()) {
for (VascEntryField c:entry.getVascEntryFields()) {
p.write(c.getName()+"\t");
}
p.write("\n");
for (Object o:table.getTableData()) {
for (VascTableColumn c:table.getTableColumns()) {
p.write(c.getVascColumnValue().getValue(c, o)+"\t");
for (Object o:entry.getEntryDataList()) {
for (VascEntryField c:entry.getVascEntryFields()) {
p.write(c.getVascEntryFieldValue().getValue(c, o)+"\t");
}
p.write("\n");
p.flush();
@ -69,4 +69,12 @@ public class CSVExportGlobalAction extends AbstractVascAction implements GlobalV
p.write("# end\n");
p.flush();
}
public String getMineType() {
return "csv";
}
public String getType() {
return "csv";
}
}

View file

@ -26,7 +26,7 @@
package com.idcanet.vasc.impl.actions;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.actions.AbstractVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
@ -43,10 +43,10 @@ public class DeleteRowAction extends AbstractVascAction implements RowVascAction
setImage("vasc.action.del.image");
}
public void doRowAction(VascTable table,Object rowObject) throws Exception {
public void doRowAction(VascEntry entry,Object rowObject) throws Exception {
if (rowObject==null) {
return;
}
table.getVascViewRenderer().renderDelete(rowObject);
entry.getVascFrontend().renderDelete(rowObject);
}
}

View file

@ -26,7 +26,7 @@
package com.idcanet.vasc.impl.actions;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.actions.AbstractVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
@ -44,10 +44,10 @@ public class EditRowAction extends AbstractVascAction implements RowVascAction {
}
public void doRowAction(VascTable table,Object rowObject) throws Exception {
public void doRowAction(VascEntry entry,Object rowObject) throws Exception {
if (rowObject==null) {
return;
}
table.getVascViewRenderer().renderEdit(rowObject);
entry.getVascFrontend().renderEdit(rowObject);
}
}

View file

@ -26,7 +26,7 @@
package com.idcanet.vasc.impl.actions;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.actions.AbstractVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
@ -44,7 +44,7 @@ public class RefreshDataGlobalAction extends AbstractVascAction implements Globa
}
public void doGlobalAction(VascTable table) throws Exception {
table.getVascTableController().refreshData(table); // this wil also fire the event
public void doGlobalAction(VascEntry entry) throws Exception {
entry.get.refreshData(table); // this wil also fire the event
}
}

View file

@ -29,18 +29,18 @@ package com.idcanet.vasc.impl.actions;
import java.io.OutputStream;
import java.io.PrintWriter;
import com.idcanet.vasc.core.VascDataExporter;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.actions.AbstractVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.column.VascTableColumn;
import com.idcanet.vasc.core.entry.VascEntryExporter;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 30, 2007
*/
public class XMLExportGlobalAction extends AbstractVascAction implements GlobalVascAction,VascDataExporter {
public class XMLExportGlobalAction extends AbstractVascAction implements GlobalVascAction,VascEntryExporter {
public XMLExportGlobalAction() {
setName("vasc.action.xml.name");
@ -48,18 +48,18 @@ public class XMLExportGlobalAction extends AbstractVascAction implements GlobalV
setImage("vasc.action.xml.image");
}
public void doGlobalAction(VascTable table) throws Exception {
table.getVascViewRenderer().renderExport(this);
public void doGlobalAction(VascEntry entry) throws Exception {
entry.getVascFrontend().renderExport(this);
}
public void doExport(OutputStream out,VascTable table) throws Exception {
public void doExport(OutputStream out,VascEntry entry) throws Exception {
PrintWriter p = new PrintWriter(out);
p.write("<xml version=\"1.0\"/>\n");
p.write("<data>\n");
for (Object o:table.getTableData()) {
for (VascTableColumn c:table.getTableColumns()) {
for (Object o:entry.getEntryDataList()) {
for (VascEntryField c:entry.getVascEntryFields()) {
p.write("<column name=\""+c.getName()+"\">");
p.write(""+c.getVascColumnValue().getValue(c, o));
p.write(""+c.getVascEntryFieldValue().getValue(c, o));
p.write("</column>\n");
}
p.flush();
@ -67,4 +67,12 @@ public class XMLExportGlobalAction extends AbstractVascAction implements GlobalV
p.write("</data>\n");
p.flush();
}
public String getMineType() {
return "text/xml";
}
public String getType() {
return "xml";
}
}

View file

@ -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.impl.entry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.x4o.element.ElementParameterException;
import com.idcanet.x4o.element.ElementParameterNotFoundException;
import com.idcanet.x4o.impl.DefaultElementParameterHelper;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class BeanPropertyVascEntryFieldValue implements VascEntryFieldValue {
private String property = null;
private DefaultElementParameterHelper helper = null;
public BeanPropertyVascEntryFieldValue() {
helper = new DefaultElementParameterHelper();
}
public BeanPropertyVascEntryFieldValue(String property) {
this();
setProperty(property);
}
/**
* @see com.idcanet.vasc.core.column.VascColumnValue#getValue(com.idcanet.vasc.core.column.VascTableColumn, java.lang.Object)
*/
public Object getValue(VascEntryField column,Object record) throws ElementParameterException,ElementParameterNotFoundException {
if(getProperty()==null) {
return null;
}
if(getProperty().equals("")) {
return "";
}
return helper.getParameter(record, getProperty());
}
/**
* @see com.idcanet.vasc.core.column.VascColumnValue#setValue(com.idcanet.vasc.core.column.VascTableColumn, java.lang.Object, java.lang.Object)
*/
public void setValue(VascEntryField column, Object record,Object value) throws ElementParameterException,ElementParameterNotFoundException {
if(getProperty()==null) {
return;
}
if(getProperty().equals("")) {
return;
}
helper.setParameter(record, getProperty(),value);
}
/**
* @return the property
*/
public String getProperty() {
return property;
}
/**
* @param property the property to set
*/
public void setProperty(String property) {
this.property = property;
}
}

View file

@ -24,28 +24,28 @@
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
package com.idcanet.vasc.impl.entry;
import com.idcanet.vasc.core.VascRecordCreator;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class BeanVascRecordCreator implements VascRecordCreator {
public class BeanVascEntryRecordCreator implements VascEntryRecordCreator {
private Class<?> objectClass = null;
public BeanVascRecordCreator() {
public BeanVascEntryRecordCreator() {
}
public BeanVascRecordCreator(Class<?> objectClass) {
public BeanVascEntryRecordCreator(Class<?> objectClass) {
setObjectClass(objectClass);
}
public Object newRecord(VascTable table) throws Exception {
public Object newRecord(VascEntry entry) throws Exception {
return objectClass.newInstance();
}

View file

@ -24,16 +24,16 @@
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
package com.idcanet.vasc.impl.entry;
import com.idcanet.vasc.core.VascTextValue;
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascTextValue implements VascTextValue {
public class DefaultVascEntryResourceResolver implements VascEntryResourceResolver {
public String getKeyMapping(String key) {
return key;

View file

@ -0,0 +1,45 @@
/*
* 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.validators;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An annotation to validate an field of a bean.
*
* @author Willem Cazander
* @version 1.0 Mar 14, 2008
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface VascDateFuture {
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
* 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:
@ -24,19 +24,20 @@
* 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.VascTable;
package com.idcanet.vasc.validators;
/**
* Validates
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
* @version 1.0 Sep 5, 2008
*/
public class VascDate extends VascUIComponentImplLoader {
public Object createComponent(VascTable table,VascValueModel model,Object gui) throws Exception {
return loadAndCreateComponent(this, table, model, gui);
public class VascDateFutureValidator implements VascValidator {
/**
* @see com.idcanet.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/
public boolean isObjectValid(Object object) throws VascValidatorException {
return false;
}
}

View file

@ -0,0 +1,46 @@
/*
* 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.validators;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An annotation to validate an field of a bean.
*
* @author Willem Cazander
* @version 1.0 Mar 14, 2008
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface VascDatePast {
}

View file

@ -0,0 +1,43 @@
/*
* 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.validators;
/**
* Validates
*
* @author Willem Cazander
* @version 1.0 Sep 5, 2008
*/
public class VascDatePastValidator implements VascValidator {
/**
* @see com.idcanet.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/
public boolean isObjectValid(Object object) throws VascValidatorException {
return false;
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.validators;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An annotation to validate an field of a bean.
*
* @author Willem Cazander
* @version 1.0 Mar 14, 2008
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface VascIntSize {
/**
* The minimal size
* @return
*/
int min() default 0;
/**
* The maximum size
* @return
*/
int max() default 0;
}

View file

@ -0,0 +1,43 @@
/*
* 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.validators;
/**
* Validates
*
* @author Willem Cazander
* @version 1.0 Sep 5, 2008
*/
public class VascIntSizeValidator implements VascValidator {
/**
* @see com.idcanet.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/
public boolean isObjectValid(Object object) throws VascValidatorException {
return false;
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.validators;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An annotation to validate an field of a bean.
*
* @author Willem Cazander
* @version 1.0 Mar 14, 2008
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface VascLongSize {
/**
* The minimal size
* @return
*/
long min() default 0;
/**
* The maximum size
* @return
*/
long max() default 0;
}

View file

@ -0,0 +1,43 @@
/*
* 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.validators;
/**
* Validates
*
* @author Willem Cazander
* @version 1.0 Sep 5, 2008
*/
public class VascLongSizeValidator implements VascValidator {
/**
* @see com.idcanet.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/
public boolean isObjectValid(Object object) throws VascValidatorException {
return false;
}
}

View file

@ -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.validators;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An annotation to validate an field of a bean.
*
* @author Willem Cazander
* @version 1.0 Mar 14, 2008
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface VascObjectNotNull {
}

View file

@ -0,0 +1,43 @@
/*
* 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.validators;
/**
* Validates
*
* @author Willem Cazander
* @version 1.0 Sep 5, 2008
*/
public class VascObjectNotNullValidator implements VascValidator {
/**
* @see com.idcanet.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/
public boolean isObjectValid(Object object) throws VascValidatorException {
return false;
}
}

View file

@ -0,0 +1,46 @@
/*
* 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.validators;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An annotation to validate an field of a bean.
*
* @author Willem Cazander
* @version 1.0 Mar 14, 2008
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface VascObjectNull {
}

View file

@ -0,0 +1,43 @@
/*
* 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.validators;
/**
* Validates
*
* @author Willem Cazander
* @version 1.0 Sep 5, 2008
*/
public class VascObjectNullValidator implements VascValidator {
/**
* @see com.idcanet.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/
public boolean isObjectValid(Object object) throws VascValidatorException {
return false;
}
}

View file

@ -0,0 +1,46 @@
/*
* 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.validators;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An annotation to validate an field of a bean.
*
* @author Willem Cazander
* @version 1.0 Mar 14, 2008
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface VascStringEmail {
}

View file

@ -0,0 +1,43 @@
/*
* 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.validators;
/**
* Validates
*
* @author Willem Cazander
* @version 1.0 Sep 5, 2008
*/
public class VascStringEmailValidator implements VascValidator {
/**
* @see com.idcanet.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/
public boolean isObjectValid(Object object) throws VascValidatorException {
return false;
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.validators;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An annotation to validate an field of a bean.
*
* @author Willem Cazander
* @version 1.0 Mar 14, 2008
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface VascStringLength {
/**
* The minimal length
* @return
*/
int min() default 0;
/**
* The maximum length
* @return
*/
int max() default 0;
}

View file

@ -0,0 +1,43 @@
/*
* 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.validators;
/**
* Validates
*
* @author Willem Cazander
* @version 1.0 Sep 5, 2008
*/
public class VascStringLengthValidator implements VascValidator {
/**
* @see com.idcanet.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/
public boolean isObjectValid(Object object) throws VascValidatorException {
return false;
}
}

View file

@ -0,0 +1,50 @@
/*
* 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.validators;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An annotation to validate an field of a bean.
*
* @author Willem Cazander
* @version 1.0 Mar 14, 2008
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface VascStringRegex {
/**
* The regex to match on the String field
* @return
*/
String regex();
}

View file

@ -0,0 +1,43 @@
/*
* 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.validators;
/**
* Validates
*
* @author Willem Cazander
* @version 1.0 Sep 5, 2008
*/
public class VascStringRegexValidator implements VascValidator {
/**
* @see com.idcanet.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/
public boolean isObjectValid(Object object) throws VascValidatorException {
return false;
}
}

View file

@ -0,0 +1,46 @@
/*
* 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.validators;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An annotation to validate an field of a bean.
*
* @author Willem Cazander
* @version 1.0 Sep 5, 2008
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface VascStringZipCode {
}

View file

@ -0,0 +1,43 @@
/*
* 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.validators;
/**
* Validates
*
* @author Willem Cazander
* @version 1.0 Sep 5, 2008
*/
public class VascStringZipCodeValidator implements VascValidator {
/**
* @see com.idcanet.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/
public boolean isObjectValid(Object object) throws VascValidatorException {
return false;
}
}

View file

@ -0,0 +1,39 @@
/*
* 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.validators;
/**
* The VascValidator interface
*
* @author Willem Cazander
* @version 1.0 Sep 5, 2008
*/
public interface VascValidator {
public boolean isObjectValid(Object object) throws VascValidatorException;
}

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