[svn r346] WIP, with working x4o and simple ldap backend for listing end editing entries
This commit is contained in:
parent
5d64bde0bd
commit
f401b61a6c
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="tests"/>
|
||||
<classpathentry kind="src" output="www/WEB-INF/classes" path="src"/>
|
||||
<classpathentry kind="src" output="www/WEB-INF/classes" path="tests"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="lib/idcanet-x4o-bin.jar"/>
|
||||
<classpathentry kind="lib" path="lib/juel-2.1.0-rc1.jar"/>
|
||||
|
@ -19,5 +19,6 @@
|
|||
<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"/>
|
||||
<classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/>
|
||||
<classpathentry kind="output" path="www/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
13
.mymetadata
Normal file
13
.mymetadata
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-module
|
||||
type="WEB"
|
||||
name="com.idcanet.vasc"
|
||||
id="myeclipse.1225411091277"
|
||||
context-root="/vasc"
|
||||
j2ee-spec="5.0"
|
||||
archive="com.idcanet.vasc.war">
|
||||
<attributes>
|
||||
<attribute name="webrootdir" value="www" />
|
||||
</attributes>
|
||||
</project-module>
|
||||
|
27
.project
27
.project
|
@ -5,13 +5,40 @@
|
|||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>
|
||||
<nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature>
|
||||
|
|
Binary file not shown.
|
@ -1,18 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<eld xmlns:eld="http://x4o.idcanet.com/eld/eld-lang.eld">
|
||||
|
||||
<!--
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.x4o.obj.TestObjectParent" childClass="com.idcanet.x4o.obj.TestObjectChild" method="addTestObjectChild"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="javax.swing.JComponent" childClass="javax.swing.JComponent" method="add"/>
|
||||
|
||||
<eld:elementClass tag="testObjectParent" objectClassName="com.idcanet.x4o.obj.TestObjectParent"/>
|
||||
<eld:elementClass tag="testObjectChild" objectClassName="com.idcanet.x4o.obj.TestObjectChild"/>
|
||||
-->
|
||||
|
||||
|
||||
<eld:elementClass tag="fieldType" objectClassName="com.idcanet.vasc.impl.type.DefaultVascEntryFieldType">
|
||||
<!--
|
||||
<eld:elementClassParameterConverter parameterName="bounds" bean.class="com.idcanet.x4o.x4o.BoundsConverter"/>
|
||||
-->
|
||||
<eld:elementClassParameterConverter parameterName="autoDetectClass" bean.class="com.idcanet.x4o.impl.lang.ClassConverter"/>
|
||||
</eld:elementClass>
|
||||
|
||||
<eld:elementClass tag="multiTextFieldType" objectClassName="com.idcanet.vasc.impl.type.MultiTextVascEntryFieldType">
|
||||
<eld:elementClassParameterConverter parameterName="autoDetectClass" bean.class="com.idcanet.x4o.impl.lang.ClassConverter"/>
|
||||
</eld:elementClass>
|
||||
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntryFieldType"
|
||||
childClass="com.idcanet.vasc.validators.VascValidator"
|
||||
method="addVascValidator"/>
|
||||
|
||||
<eld:elementClass tag="dateFutureValidator" objectClassName="com.idcanet.vasc.validators.VascDateFutureValidator"/>
|
||||
<eld:elementClass tag="datePastValidator" objectClassName="com.idcanet.vasc.validators.VascDatePastValidator"/>
|
||||
<eld:elementClass tag="intSizeValidator" objectClassName="com.idcanet.vasc.validators.VascIntSizeValidator"/>
|
||||
<eld:elementClass tag="longSizeValidator " objectClassName="com.idcanet.vasc.validators.VascLongSizeValidator"/>
|
||||
<eld:elementClass tag="objectNotNullValidator" objectClassName="com.idcanet.vasc.validators.VascObjectNotNullValidator"/>
|
||||
<eld:elementClass tag="objectNullValidator" objectClassName="com.idcanet.vasc.validators.VascObjectNullValidator"/>
|
||||
<eld:elementClass tag="stringEmailValidator" objectClassName="com.idcanet.vasc.validators.VascStringEmailValidator"/>
|
||||
<eld:elementClass tag="stringLengthValidator" objectClassName="com.idcanet.vasc.validators.VascStringLengthValidator"/>
|
||||
<eld:elementClass tag="stringRegexValidator" objectClassName="com.idcanet.vasc.validators.VascStringRegexValidator"/>
|
||||
<eld:elementClass tag="stringZipCodeValidator" objectClassName="com.idcanet.vasc.validators.VascStringZipCodeValidator"/>
|
||||
|
||||
</eld>
|
|
@ -7,144 +7,113 @@
|
|||
<!-- Verplichte impl field types -->
|
||||
<vf:fieldType id="LabelField" uiComponentId="VascLabel"/>
|
||||
<vf:fieldType id="TextField" uiComponentId="VascText" inputMask="">
|
||||
<x4o:property key="minlength" value="0"/>
|
||||
<x4o:property key="maxlength" value="80"/>
|
||||
<x4o:property key="editor.length" value="80"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="ListField" uiComponentId="VascList" inputMask="">
|
||||
<x4o:property key="radio_edit" value="false"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="TextAreaField" uiComponentId="VascTextArea">
|
||||
<x4o:property key="columns" value="80"/>
|
||||
<x4o:property key="rows" value="80"/>
|
||||
<x4o:property key="editor.columns" value="80"/>
|
||||
<x4o:property key="editor.rows" value="80"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="ColorField" uiComponentId="VascColor" autoDetectClass="java.awt.Color">
|
||||
<x4o:property key="editor.length" value="8"/>
|
||||
</vf: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>
|
||||
-->
|
||||
<vf:fieldType id="BooleanField" uiComponentId="VascBoolean" inputMask="true|false" autoDetectClass="java.lang.Boolean">
|
||||
<x4o:property key="editor.length" value="10"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="IntegerField" autoDetectClass="java.lang.Integer">
|
||||
<x4o:property key="editor.length" value="20"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="LongField" autoDetectClass="java.lang.Long">
|
||||
<x4o:property key="editor.length" value="20"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="FloatField" autoDetectClass="java.lang.Float">
|
||||
<x4o:property key="editor.length" value="20"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="DoubleField" autoDetectClass="java.lang.Double">
|
||||
<x4o:property key="editor.length" value="20"/>
|
||||
</vf:fieldType>
|
||||
|
||||
<!-- Date types -->
|
||||
<!--
|
||||
<vasc:fieldType name="DateField" extends="TextField">
|
||||
<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>
|
||||
-->
|
||||
<!-- Date types -->
|
||||
<vf:fieldType id="DateField" uiComponentId="VascDate" autoDetectClass="java.util.Date">
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="DateTimeField">
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="TimeField">
|
||||
</vf: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>
|
||||
-->
|
||||
<vf:fieldType id="EmailField" inputMask="">
|
||||
<vf:stringEmailValidator/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="IPField">
|
||||
<x4o:property key="validate" value="true"/>
|
||||
<x4o:property key="timeout" value="200"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="DNSField">
|
||||
<x4o:property key="validate" value="true"/>
|
||||
<x4o:property key="timeout" value="200"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="URLField" autoDetectClass="java.net.URL">
|
||||
<x4o:property key="timeout" value="200"/>
|
||||
<x4o:property key="redirects" value="true"/>
|
||||
<x4o:property key="validate" value="true"/>
|
||||
<x4o:property key="status_code" value="200"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="SlugField">
|
||||
<x4o:property key="populate_from" value="true"/>
|
||||
</vf: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>
|
||||
<vf:fieldType id="XMLField" uiComponentId="VascTextArea">
|
||||
<x4o:property key="validate" value="true"/>
|
||||
<x4o:property key="schema_url" value="true"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="XSLTField" uiComponentId="VascTextArea">
|
||||
<x4o:property key="validate" value="true"/>
|
||||
<x4o:property key="schema_url" value="true"/>
|
||||
</vf:fieldType>
|
||||
|
||||
<!-- Combined fields -->
|
||||
|
||||
<vf:fieldType id="SeparatedTextField" uiComponentId="VascText">
|
||||
<x4o:property key="seperator" value=","/>
|
||||
<x4o:property key="min_items" value="0"/>
|
||||
<x4o:property key="max_items" value="15"/>
|
||||
</vf:fieldType>
|
||||
|
||||
<vf:multiTextFieldType id="MultiTextField" uiComponentId="VascText">
|
||||
<x4o:property key="min_items" value="0"/>
|
||||
<x4o:property key="max_items" value="15"/>
|
||||
</vf:multiTextFieldType>
|
||||
|
||||
|
||||
<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>
|
||||
<vf:fieldType id="FileField">
|
||||
<vf:fieldHint key="base_path" default="/tmp"/>
|
||||
<vf:fieldHint key="base_path_templateing" default="true"/>
|
||||
<vf:fieldHint key="max_size" default="1000000"/>
|
||||
<vf:fieldHint key="mine_types" default="ALL"/>
|
||||
<vf:fieldHint key="file_match"/>
|
||||
<vf:fieldClass className="java.io.File"/>
|
||||
<vf:fieldConverter className="com.idcanet.x4o.converts.FileConverter"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="FilePathField">
|
||||
<vf:fieldHint key="base_path" default="/tmp"/>
|
||||
<vf:fieldHint key="recursive" default="true"/>
|
||||
<vf:fieldHint key="path_match"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="ImageField" superType="FileField">
|
||||
<vf:fieldHint key="max_height" default="6000"/>
|
||||
<vf:fieldHint key="max_width" default="7000"/>
|
||||
<vf:fieldHint key="thumpnail_auto" default="false"/>
|
||||
<vf:fieldHint key="thumpnail_path" default="/tmp/nails/"/>
|
||||
<vf:fieldClass className="java.awt.Image"/>
|
||||
<vf:fieldClass className="javax.swing.Image"/>
|
||||
</vf:fieldType>
|
||||
-->
|
||||
</fieldtype>
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntry" childClass="com.idcanet.vasc.core.VascEntryField" method="addVascEntryField"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntry" childClass="com.idcanet.vasc.core.VascEntrySet" method="addVascEntryFieldSet"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntry" childClass="com.idcanet.vasc.core.VascEntryFieldSet" method="addVascEntryFieldSet"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntry" childClass="com.idcanet.vasc.core.VascLinkEntry" method="addVascLinkEntry"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntry" childClass="com.idcanet.vasc.core.actions.GlobalVascAction" method="addGlobalAction"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntry" childClass="com.idcanet.vasc.core.actions.RowVascAction" method="addRowAction"/>
|
||||
|
@ -16,9 +16,23 @@
|
|||
-->
|
||||
|
||||
<!-- Object for building an entry -->
|
||||
<eld:elementClass tag="entry" objectClassName="com.idcanet.vasc.impl.DefaultVascEntry"/>
|
||||
<eld:elementClass tag="field" objectClassName="com.idcanet.vasc.impl.DefaultVascEntryField"/>
|
||||
<eld:elementClass tag="fieldSet" objectClassName="com.idcanet.vasc.impl.DefaultVascEntryFieldSet"/>
|
||||
<eld:elementClass tag="entry" objectClassName="com.idcanet.vasc.impl.DefaultVascEntry" >
|
||||
<eld:elementConfigurator bean.class="com.idcanet.vasc.impl.x4o.VascEntryElementConfigurator"/>
|
||||
</eld:elementClass>
|
||||
<eld:elementClass tag="field" objectClassName="com.idcanet.vasc.impl.DefaultVascEntryField">
|
||||
<eld:elementClassParameterConverter parameterName="vascEntryFieldType" bean.class="com.idcanet.vasc.impl.x4o.VascEntryFieldTypeParameterConverter"/>
|
||||
</eld:elementClass>
|
||||
<eld:elementClass tag="fieldSet" objectClassName="com.idcanet.vasc.impl.DefaultVascEntryFieldSet">
|
||||
<eld:elementClassParameterConverter parameterName="vascEntryFieldIds" bean.class="com.idcanet.vasc.impl.x4o.VascEntryFieldSetParameterConverter"/>
|
||||
</eld:elementClass>
|
||||
|
||||
<eld:elementClass tag="link" objectClassName="com.idcanet.vasc.impl.DefaultVascLinkEntry"/>
|
||||
|
||||
<eld:elementClass tag="ldapBackend" objectClassName="com.idcanet.vasc.backends.ldap.LdapVascBackend">
|
||||
<eld:elementConfigurator bean.class="com.idcanet.vasc.impl.x4o.VascBackendElementConfigurator"/>
|
||||
</eld:elementClass>
|
||||
|
||||
<eld:elementClass tag="simpleLdapConnectionProvider" objectClassName="com.idcanet.vasc.backends.ldap.SimpleLdapConnectionProvider"/>
|
||||
|
||||
<!-- Default vasc validators -->
|
||||
<eld:elementClass tag="dateFutureValidator" objectClassName="com.idcanet.vasc.validators.VascDateFutureValidator"/>
|
||||
|
|
|
@ -26,7 +26,10 @@
|
|||
|
||||
package com.idcanet.vasc.backends.ldap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -36,6 +39,12 @@ import com.idcanet.vasc.core.VascEntryField;
|
|||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
|
||||
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
|
||||
import com.novell.ldap.LDAPAttribute;
|
||||
import com.novell.ldap.LDAPAttributeSet;
|
||||
import com.novell.ldap.LDAPConnection;
|
||||
import com.novell.ldap.LDAPEntry;
|
||||
import com.novell.ldap.LDAPSearchConstraints;
|
||||
import com.novell.ldap.LDAPSearchResults;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -46,6 +55,10 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
|
||||
|
||||
private LdapConnectionProvider ldapConnectionProvider = null;
|
||||
private String baseDN = null;
|
||||
private String keyAttribute = null;
|
||||
private String ldapFilter = null;
|
||||
|
||||
|
||||
/**
|
||||
* @return the ldapConnectionProvider
|
||||
|
@ -68,26 +81,98 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
* @see com.idcanet.vasc.core.VascBackend#execute()
|
||||
*/
|
||||
public List<Object> execute() throws Exception {
|
||||
return null;
|
||||
LdapConnectionProvider prov = getLdapConnectionProvider();
|
||||
LDAPConnection connection = prov.getLdapConnection();
|
||||
List<Object> result = new ArrayList<Object>(50);
|
||||
try {
|
||||
|
||||
|
||||
LDAPSearchConstraints cons = new LDAPSearchConstraints();
|
||||
cons.setBatchSize( 0 );
|
||||
cons.setTimeLimit( 10000 ) ;
|
||||
|
||||
int searchScope = LDAPConnection.SCOPE_ONE;
|
||||
String searchBase = baseDN;
|
||||
|
||||
System.out.println("\n\tReading object :" + searchBase + " with filter: " + ldapFilter);
|
||||
LDAPSearchResults searchResults = connection.search(
|
||||
searchBase, // object to read
|
||||
searchScope, // scope - read single object
|
||||
ldapFilter, // search filter
|
||||
null, // return all attributes
|
||||
false); // return attrs and values
|
||||
|
||||
System.out.println("Got object :" + searchResults.getCount());
|
||||
while (searchResults.hasMore()) {
|
||||
LDAPEntry entry = searchResults.next();
|
||||
System.out.println("We found "+entry.getDN());
|
||||
Map<String,Object> map = new HashMap<String,Object>(10);
|
||||
|
||||
LDAPAttributeSet attributeSet = entry.getAttributeSet();
|
||||
Iterator i = attributeSet.iterator();
|
||||
while (i.hasNext()) {
|
||||
LDAPAttribute attr = (LDAPAttribute)i.next();
|
||||
//System.out.println("ATTR: "+attr.getName()+" ... ");
|
||||
|
||||
map.put(attr.getName(), attr.getStringValueArray());
|
||||
}
|
||||
result.add(map);
|
||||
}
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#merge(java.lang.Object)
|
||||
*/
|
||||
public Object merge(Object object) throws Exception {
|
||||
return object;
|
||||
LdapConnectionProvider prov = getLdapConnectionProvider();
|
||||
LDAPConnection connection = prov.getLdapConnection();
|
||||
try {
|
||||
|
||||
return object;
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#persist(java.lang.Object)
|
||||
*/
|
||||
public void persist(Object object) throws Exception {
|
||||
public void persist(Object object) throws Exception {
|
||||
LdapConnectionProvider prov = getLdapConnectionProvider();
|
||||
LDAPConnection connection = prov.getLdapConnection();
|
||||
try {
|
||||
LDAPEntry entry = new LDAPEntry();
|
||||
// entry.getAttributeSet().
|
||||
|
||||
connection.add(entry);
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#delete(java.lang.Object)
|
||||
*/
|
||||
public void delete(Object object) throws Exception {
|
||||
LdapConnectionProvider prov = getLdapConnectionProvider();
|
||||
LDAPConnection connection = prov.getLdapConnection();
|
||||
try {
|
||||
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,7 +202,11 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
@SuppressWarnings("unchecked")
|
||||
public Object getValue(VascEntryField field, Object record) throws VascException {
|
||||
Map<String,Object> map = (Map<String,Object>)record;
|
||||
return map.get(field.getBackendName());
|
||||
String[] r = (String[])map.get(field.getBackendName());
|
||||
if (r.length==1) {
|
||||
return r[0];
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,4 +220,46 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the baseDN
|
||||
*/
|
||||
public String getBaseDN() {
|
||||
return baseDN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param baseDN the baseDN to set
|
||||
*/
|
||||
public void setBaseDN(String baseDN) {
|
||||
this.baseDN = baseDN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the keyAttribute
|
||||
*/
|
||||
public String getKeyAttribute() {
|
||||
return keyAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param keyAttribute the keyAttribute to set
|
||||
*/
|
||||
public void setKeyAttribute(String keyAttribute) {
|
||||
this.keyAttribute = keyAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ldapFilter
|
||||
*/
|
||||
public String getLdapFilter() {
|
||||
return ldapFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ldapFilter the ldapFilter to set
|
||||
*/
|
||||
public void setLdapFilter(String ldapFilter) {
|
||||
this.ldapFilter = ldapFilter;
|
||||
}
|
||||
}
|
|
@ -35,7 +35,6 @@ import com.novell.ldap.LDAPConnection;
|
|||
*/
|
||||
public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
|
||||
|
||||
|
||||
private String ldapHost = "localhost";
|
||||
private int ldapPort = LDAPConnection.DEFAULT_PORT;
|
||||
private int ldapVersion = LDAPConnection.LDAP_V3;
|
||||
|
@ -73,7 +72,6 @@ public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
|
|||
return ldapHost;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ldapHost the ldapHost to set
|
||||
*/
|
||||
|
@ -81,7 +79,6 @@ public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
|
|||
this.ldapHost = ldapHost;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the ldapPort
|
||||
*/
|
||||
|
@ -89,7 +86,6 @@ public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
|
|||
return ldapPort;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ldapPort the ldapPort to set
|
||||
*/
|
||||
|
@ -97,7 +93,6 @@ public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
|
|||
this.ldapPort = ldapPort;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the ldapVersion
|
||||
*/
|
||||
|
@ -105,7 +100,6 @@ public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
|
|||
return ldapVersion;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ldapVersion the ldapVersion to set
|
||||
*/
|
||||
|
@ -113,7 +107,6 @@ public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
|
|||
this.ldapVersion = ldapVersion;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the bindUser
|
||||
*/
|
||||
|
@ -121,7 +114,6 @@ public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
|
|||
return bindUser;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param bindUser the bindUser to set
|
||||
*/
|
||||
|
@ -137,11 +129,10 @@ public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
|
|||
return bindPass;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param bindPass the bindPass to set
|
||||
*/
|
||||
public void setBindPass(String bindPass) {
|
||||
this.bindPass = bindPass;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,6 +32,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
import com.idcanet.vasc.validators.VascValidator;
|
||||
|
||||
/**
|
||||
|
@ -42,10 +43,11 @@ import com.idcanet.vasc.validators.VascValidator;
|
|||
abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
|
||||
|
||||
private String id = null;
|
||||
private List<Class<?>> autoDetectionClasses = null;
|
||||
private Class<?> autoDetectClass = null;
|
||||
private List<VascValidator> vascValidators = null;
|
||||
private Map<String,String> properties = null;
|
||||
|
||||
private Object dataObject = null;
|
||||
private String uiComponentId = null;
|
||||
private String inputMask = null;
|
||||
|
||||
|
@ -89,6 +91,20 @@ abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
|
|||
return new ArrayList<String>(properties.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dataObject
|
||||
*/
|
||||
public Object getDataObject() {
|
||||
return dataObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataObject the dataObject to set
|
||||
*/
|
||||
public void setDataObject(Object dataObject) {
|
||||
this.dataObject = dataObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getVascValidators()
|
||||
*/
|
||||
|
@ -111,17 +127,17 @@ abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#addAutoDetectionClass(java.lang.Class)
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getAutoDetectClass()
|
||||
*/
|
||||
public void addAutoDetectionClass(Class<?> classObject) {
|
||||
autoDetectionClasses.add(classObject);
|
||||
public Class<?> getAutoDetectClass() {
|
||||
return autoDetectClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getAutoDetectionClasses()
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setAutoDetectClass(java.lang.Class)
|
||||
*/
|
||||
public List<Class<?>> getAutoDetectionClasses() {
|
||||
return autoDetectionClasses;
|
||||
public void setAutoDetectClass(Class<?> autoDetectClass) {
|
||||
this.autoDetectClass=autoDetectClass;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,7 +171,7 @@ abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
|
|||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getUIComponentCount()
|
||||
*/
|
||||
public int getUIComponentCount() {
|
||||
public int getUIComponentCount(VascEntryField entryField) throws VascException {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -163,42 +179,32 @@ abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
|
|||
* @see com.idcanet.vasc.core.VascEntryFieldType#provideEditorUIComponent(int)
|
||||
*/
|
||||
public VascUIComponent provideEditorUIComponent(int index,VascEntryField entryField) throws VascException {
|
||||
if (index!=0) {
|
||||
return null;
|
||||
}
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl == null) {
|
||||
cl = entryField.getClass().getClassLoader(); // fallback
|
||||
}
|
||||
String compId = getUIComponentId();
|
||||
if (compId==null) {
|
||||
compId = VascUIComponent.VASC_TEXT; // ??? mmmm
|
||||
compId = VascUIComponent.VASC_TEXT;
|
||||
}
|
||||
String componentClass = entryField.getVascEntry().getVascFrontendData().getVascUIComponent(compId);
|
||||
try {
|
||||
return (VascUIComponent)cl.loadClass(componentClass).newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new VascException();
|
||||
}
|
||||
return entryField.getVascEntry().getVascFrontendData().getVascUIComponent(compId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#provideLabelUIComponent(int)
|
||||
*/
|
||||
public VascUIComponent provideLabelUIComponent(int index,VascEntryField entryField) throws VascException {
|
||||
if (index!=0) {
|
||||
return null;
|
||||
}
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl == null) {
|
||||
cl = entryField.getClass().getClassLoader(); // fallback
|
||||
}
|
||||
String componentClass = entryField.getVascEntry().getVascFrontendData().getVascUIComponent(VascUIComponent.VASC_LABEL);
|
||||
try {
|
||||
return (VascUIComponent)cl.loadClass(componentClass).newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new VascException();
|
||||
}
|
||||
return entryField.getVascEntry().getVascFrontendData().getVascUIComponent(VascUIComponent.VASC_LABEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#provideEditorVascValueModel()
|
||||
*/
|
||||
public VascValueModel provideEditorVascValueModel(int index,VascEntryField entryField) throws VascException {
|
||||
if (index>0) {
|
||||
throw new IllegalArgumentException("You have to override provideEditorVascValueModel if multi editor support is needed");
|
||||
}
|
||||
VascValueModel model = new VascValueModel();
|
||||
return model;
|
||||
}
|
||||
}
|
|
@ -24,28 +24,15 @@
|
|||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.core.ui;
|
||||
package com.idcanet.vasc.core;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 12, 2007
|
||||
* @version 1.0 Nov 17, 2008
|
||||
*/
|
||||
abstract public class AbstractVascUIComponent implements VascUIComponent {
|
||||
public interface VascBackendControllerLocal extends VascBackendController {
|
||||
|
||||
private VascUIComponent wrapper = null;
|
||||
|
||||
/**
|
||||
* @return the wrapper
|
||||
*/
|
||||
public VascUIComponent getWrapper() {
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param wrapper the wrapper to set
|
||||
*/
|
||||
public void setWrapper(VascUIComponent wrapper) {
|
||||
this.wrapper = wrapper;
|
||||
}
|
||||
public void addVascBackend(VascBackend backend);
|
||||
}
|
|
@ -51,4 +51,10 @@ public interface VascController {
|
|||
* @return Returns the VascEntryFieldControllerResolver
|
||||
*/
|
||||
public VascEntryFieldTypeControllerResolver getVascEntryFieldTypeControllerResolver();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns the VascEventChannelControllerResolver
|
||||
*/
|
||||
public VascEventChannelControllerResolver getVascEventChannelControllerResolver();
|
||||
}
|
40
src/com/idcanet/vasc/core/VascEntryControllerLocal.java
Normal file
40
src/com/idcanet/vasc/core/VascEntryControllerLocal.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.core;
|
||||
|
||||
|
||||
/**
|
||||
* The local interface which is not used in controllers.
|
||||
* But is needed to be able to add entry in a safe way.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 16, 2008
|
||||
*/
|
||||
public interface VascEntryControllerLocal extends VascEntryController {
|
||||
|
||||
public void addVascEntry(VascEntry entry,VascController vascController) throws VascException;
|
||||
}
|
|
@ -29,6 +29,7 @@ package com.idcanet.vasc.core;
|
|||
import java.util.List;
|
||||
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
import com.idcanet.vasc.validators.VascValidator;
|
||||
|
||||
|
||||
|
@ -48,8 +49,8 @@ public interface VascEntryFieldType {
|
|||
public String getInputMask();
|
||||
public void setInputMask(String inputMask);
|
||||
|
||||
public List<Class<?>> getAutoDetectionClasses();
|
||||
public void addAutoDetectionClass(Class<?> classObject);
|
||||
public Class<?> getAutoDetectClass();
|
||||
public void setAutoDetectClass(Class<?> classObject);
|
||||
|
||||
public void addVascValidator(VascValidator vascValidator);
|
||||
public void removeVascValidator(VascValidator vascValidator);
|
||||
|
@ -59,7 +60,11 @@ public interface VascEntryFieldType {
|
|||
public String getProperty(String name);
|
||||
public List<String> getPropertyNames();
|
||||
|
||||
public int getUIComponentCount();
|
||||
public void setDataObject(Object data);
|
||||
public Object getDataObject();
|
||||
|
||||
public int getUIComponentCount(VascEntryField entryField) throws VascException;
|
||||
public VascUIComponent provideLabelUIComponent(int index,VascEntryField entryField) throws VascException;
|
||||
public VascUIComponent provideEditorUIComponent(int index,VascEntryField entryField) throws VascException;
|
||||
}
|
||||
public VascValueModel provideEditorVascValueModel(int index,VascEntryField entryField) throws VascException;
|
||||
}
|
||||
|
|
|
@ -24,36 +24,15 @@
|
|||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.core.ui;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
package com.idcanet.vasc.core;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 12, 2007
|
||||
* @version 1.0 Oct 27, 2008
|
||||
*/
|
||||
public class VascList extends VascUIComponentImplLoader {
|
||||
public interface VascEventChannelController {
|
||||
|
||||
private VascSelectItemModel vascSelectItemModel = null;
|
||||
|
||||
public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws Exception {
|
||||
return loadAndCreateComponent(this, entry, model, gui);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascSelectItemModel
|
||||
*/
|
||||
public VascSelectItemModel getVascSelectItemModel() {
|
||||
return vascSelectItemModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascSelectItemModel the vascSelectItemModel to set
|
||||
*/
|
||||
public void setVascSelectItemModel(VascSelectItemModel vascSelectItemModel) {
|
||||
this.vascSelectItemModel = vascSelectItemModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.core;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 27, 2008
|
||||
*/
|
||||
public interface VascEventChannelControllerResolver {
|
||||
|
||||
public VascEventChannelController getVascEventChannelController();
|
||||
}
|
|
@ -40,6 +40,10 @@ public class VascException extends Exception {
|
|||
public VascException() {
|
||||
}
|
||||
|
||||
public VascException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public VascException(Exception e) {
|
||||
super(e);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ package com.idcanet.vasc.core;
|
|||
import java.util.List;
|
||||
|
||||
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -37,17 +38,7 @@ import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
|
|||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public interface VascFrontendData {
|
||||
|
||||
/**
|
||||
* @return the vascBackend
|
||||
*/
|
||||
public VascBackend getVascBackend();
|
||||
|
||||
/**
|
||||
* @param vascBackend the vascBackend to set
|
||||
*/
|
||||
public void setVascBackend(VascBackend vascBackend);
|
||||
|
||||
|
||||
/**
|
||||
* @return the entryDataList
|
||||
*/
|
||||
|
@ -101,5 +92,14 @@ public interface VascFrontendData {
|
|||
|
||||
public void putVascUIComponent(String rendererId,String uiComponentClass);
|
||||
|
||||
public String getVascUIComponent(String rendererId);
|
||||
public VascUIComponent getVascUIComponent(String rendererId) throws VascException;
|
||||
public String getVascUIComponentClass(String rendererId);
|
||||
|
||||
public void setVascController(VascController vascController);
|
||||
|
||||
public VascController getVascController();
|
||||
|
||||
public void addFieldVascUIComponents(VascEntryField field,VascUIComponent uiComponent,Object editor);
|
||||
public VascUIComponent getFieldVascUIComponent(VascEntryField field);
|
||||
public Object getFieldRealRenderer(VascEntryField field);
|
||||
}
|
|
@ -40,16 +40,15 @@ public interface VascUIComponent {
|
|||
static public final String VASC_LABEL = "VascLabel";
|
||||
static public final String VASC_TEXT = "VascText";
|
||||
static public final String VASC_LIST = "VascList";
|
||||
static public final String VASC_BUTTON = "VascButton";
|
||||
|
||||
// optional ui Components
|
||||
static public final String VASC_TEXTAREA = "VascTextArea";
|
||||
static public final String VASC_BOOLEAN = "VascBoolean";
|
||||
static public final String VASC_DATE = "VascDate";
|
||||
static public final String VASC_COLOR = "VascColor";
|
||||
|
||||
static public final String[] requiredUIComponents = {VASC_LABEL,VASC_TEXT,VASC_LIST};
|
||||
|
||||
public void setWrapper(VascUIComponent wrapper);
|
||||
public VascUIComponent getWrapper();
|
||||
static public final String[] requiredUIComponents = {VASC_LABEL,VASC_TEXT,VASC_LIST,VASC_BUTTON};
|
||||
|
||||
public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws Exception;
|
||||
|
||||
|
|
|
@ -41,17 +41,29 @@ public class VascValueModel {
|
|||
|
||||
private Object value = null;
|
||||
private List<VascValueModelListener> listeners = null;
|
||||
private VascValueModel parentModel = null;
|
||||
|
||||
public VascValueModel() {
|
||||
listeners = new ArrayList<VascValueModelListener>(2);
|
||||
}
|
||||
public VascValueModel(VascValueModel parentModel) {
|
||||
this();
|
||||
this.parentModel=parentModel;
|
||||
}
|
||||
|
||||
public Object getValue() throws VascException {
|
||||
if (parentModel!=null) {
|
||||
return parentModel.getValue();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Object value) throws VascException {
|
||||
this.value = value;
|
||||
if (parentModel!=null) {
|
||||
parentModel.setValue(value);
|
||||
} else {
|
||||
this.value = value;
|
||||
}
|
||||
fireListeners();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@ 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;
|
||||
|
@ -79,6 +77,8 @@ import com.idcanet.vasc.core.ui.VascColumnValueModelListener;
|
|||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingBoolean;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingButton;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingColorChooser;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingDate;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingLabel;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingList;
|
||||
|
@ -110,11 +110,13 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
vfd.putVascUIComponent(VascUIComponent.VASC_LABEL,SwingLabel.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_TEXT, SwingText.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_LIST, SwingList.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_BUTTON, SwingButton.class.getName());
|
||||
|
||||
// optional UI components
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_BOOLEAN , SwingBoolean.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_DATE , SwingDate.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_TEXTAREA, SwingTextArea.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_COLOR, SwingColorChooser.class.getName());
|
||||
}
|
||||
|
||||
public ImageIcon getImageIcon(String imageResource) {
|
||||
|
@ -188,7 +190,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
, null // Default button's label
|
||||
);
|
||||
if (response==JOptionPane.YES_OPTION) {
|
||||
entry.getVascFrontendData().getVascBackend().delete(rowBean);
|
||||
entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId()).delete(rowBean);
|
||||
entry.getVascFrontendData().getEntryDataList().remove(rowBean);
|
||||
entry.getVascFrontendData().setEntryDataObject(null);
|
||||
//entry.getVascFrontendController().getVascFrontendHelper().fireVascEvent(VascEventListener.VascEventType.DATA_UPDATE, rowBean);
|
||||
|
@ -262,9 +264,11 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
if (c.isEdit()==false) {
|
||||
continue;
|
||||
}
|
||||
column++;
|
||||
|
||||
for (int i=0;i<c.getVascEntryFieldType().getUIComponentCount();i++) {
|
||||
|
||||
//if (c.isEditReadOnly()==true) {
|
||||
|
||||
for (int i=0;i<c.getVascEntryFieldType().getUIComponentCount(c);i++) {
|
||||
|
||||
VascUIComponent label = c.getVascEntryFieldType().provideLabelUIComponent(i,c);
|
||||
VascValueModel model = new VascValueModel();
|
||||
|
@ -272,46 +276,16 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
label.createComponent(entry,c,model,body);
|
||||
|
||||
VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c);
|
||||
model = new VascValueModel();
|
||||
model = new VascValueModel(c.getVascEntryFieldType().provideEditorVascValueModel(i,c));
|
||||
model.setValue(c.getVascEntryFieldValue().getValue(c, bean));
|
||||
model.addListener(new VascColumnValueModelListener(c,bean));
|
||||
editor.createComponent(entry,c,model,body);
|
||||
Object g = editor.createComponent(entry,c,model,body);
|
||||
|
||||
column++;
|
||||
if (i==0) {
|
||||
entry.getVascFrontendData().addFieldVascUIComponents(c, editor,g);
|
||||
}
|
||||
}
|
||||
|
||||
/* OLD OLD OLD
|
||||
*
|
||||
*
|
||||
JLabel l = new JLabel();
|
||||
l.setHorizontalAlignment(JLabel.TRAILING);
|
||||
l.setText(i18n(c.getName()));
|
||||
if(c.getDescription()!=null) {
|
||||
l.setToolTipText(i18n(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);
|
||||
|
|
|
@ -35,7 +35,7 @@ import javax.swing.JComponent;
|
|||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ import com.idcanet.vasc.core.ui.VascValueModel;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 21, 2007
|
||||
*/
|
||||
public class SwingBoolean extends AbstractVascUIComponent {
|
||||
public class SwingBoolean implements VascUIComponent {
|
||||
|
||||
private JCheckBox checkBox = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
|
|
@ -24,45 +24,59 @@
|
|||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.core.ui;
|
||||
package com.idcanet.vasc.frontends.swing.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 12, 2007
|
||||
* @version 1.0 Nov 18, 2008
|
||||
*/
|
||||
abstract public class VascUIComponentImplLoader extends AbstractVascUIComponent {
|
||||
public class SwingButton implements VascUIComponent {
|
||||
|
||||
private VascUIComponent realComponent = null;
|
||||
private JButton vascButton = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
||||
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;
|
||||
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws Exception {
|
||||
vascButton = new JButton("Color");
|
||||
orgBackgroundColor = vascButton.getBackground();
|
||||
((JComponent)gui).add(vascButton);
|
||||
//vascButton.addActionListener(new SelectActionListener3(model,true,table));
|
||||
return vascButton;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
|
||||
*/
|
||||
public String getErrorText() {
|
||||
if (realComponent==null) {
|
||||
if (vascButton==null) {
|
||||
return null;
|
||||
}
|
||||
return realComponent.getErrorText();
|
||||
return vascButton.getToolTipText();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
|
||||
*/
|
||||
public void setErrorText(String text) {
|
||||
if (realComponent==null) {
|
||||
if (vascButton==null) {
|
||||
return;
|
||||
}
|
||||
realComponent.setErrorText(text);
|
||||
vascButton.setToolTipText(text);
|
||||
if (text==null) {
|
||||
vascButton.setBackground(orgBackgroundColor);
|
||||
} else {
|
||||
vascButton.setBackground(Color.RED);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,7 +37,7 @@ import javax.swing.JComponent;
|
|||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
|
||||
/**
|
||||
|
@ -46,7 +46,7 @@ import com.idcanet.vasc.core.ui.VascValueModel;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 25, 2007
|
||||
*/
|
||||
public class SwingColorChooser extends AbstractVascUIComponent {
|
||||
public class SwingColorChooser implements VascUIComponent {
|
||||
|
||||
private JButton colorButton = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
|
|
@ -35,7 +35,7 @@ import javax.swing.JComponent;
|
|||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
import com.michaelbaranov.microba.calendar.DatePicker;
|
||||
|
||||
|
@ -46,7 +46,7 @@ import com.michaelbaranov.microba.calendar.DatePicker;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 21, 2007
|
||||
*/
|
||||
public class SwingDate extends AbstractVascUIComponent {
|
||||
public class SwingDate implements VascUIComponent {
|
||||
|
||||
private DatePicker datePicker = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
|
|
@ -33,7 +33,7 @@ import javax.swing.JLabel;
|
|||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ import com.idcanet.vasc.core.ui.VascValueModel;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 21, 2008
|
||||
*/
|
||||
public class SwingLabel extends AbstractVascUIComponent {
|
||||
public class SwingLabel implements VascUIComponent {
|
||||
|
||||
private JLabel label = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
|
|
@ -39,9 +39,9 @@ import javax.swing.ListCellRenderer;
|
|||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
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.VascSelectItemModel;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
|
||||
|
||||
|
@ -50,17 +50,17 @@ import com.idcanet.vasc.core.ui.VascValueModel;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 12, 2007
|
||||
*/
|
||||
public class SwingList extends AbstractVascUIComponent {
|
||||
public class SwingList implements VascUIComponent {
|
||||
|
||||
private JComboBox comboBox = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
||||
public Object createComponent(final VascEntry table,VascEntryField entryField,final VascValueModel model,Object gui) throws Exception {
|
||||
VascList l = (VascList)getWrapper();
|
||||
if (l.getVascSelectItemModel()==null) {
|
||||
VascSelectItemModel items = (VascSelectItemModel)entryField.getVascEntryFieldType().getDataObject();
|
||||
if (items==null) {
|
||||
comboBox = new JComboBox();
|
||||
} else {
|
||||
comboBox = new JComboBox(l.getVascSelectItemModel().getVascSelectItems().toArray());
|
||||
comboBox = new JComboBox(items.getVascSelectItems().toArray());
|
||||
}
|
||||
orgBackgroundColor = comboBox.getBackground();
|
||||
((JComponent)gui).add(comboBox);
|
||||
|
|
|
@ -35,7 +35,7 @@ import javax.swing.event.DocumentListener;
|
|||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ import com.idcanet.vasc.core.ui.VascValueModel;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 12, 2007
|
||||
*/
|
||||
public class SwingText extends AbstractVascUIComponent {
|
||||
public class SwingText implements VascUIComponent {
|
||||
|
||||
private JTextField textField = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
|
|
@ -35,7 +35,7 @@ import javax.swing.event.DocumentListener;
|
|||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ import com.idcanet.vasc.core.ui.VascValueModel;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 21, 2008
|
||||
*/
|
||||
public class SwingTextArea extends AbstractVascUIComponent {
|
||||
public class SwingTextArea implements VascUIComponent {
|
||||
|
||||
private JTextArea textArea = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
|
|
@ -49,7 +49,6 @@ 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;
|
||||
|
@ -67,9 +66,14 @@ import com.idcanet.fff.SwingImageHelper;
|
|||
import com.idcanet.vasc.core.AbstractVascFrontend;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascFrontendData;
|
||||
import com.idcanet.vasc.core.actions.GlobalVascAction;
|
||||
import com.idcanet.vasc.core.actions.RowVascAction;
|
||||
import com.idcanet.vasc.core.entry.VascEntryExporter;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingLabel;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingList;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingText;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -86,6 +90,25 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
this.parent=parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add swt implmented ui components
|
||||
*/
|
||||
protected void addUiComponents() {
|
||||
VascFrontendData vfd = getVascEntry().getVascFrontendData();
|
||||
|
||||
// required UI components
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_LABEL,SwingLabel.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_TEXT, SwingText.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_LIST, SwingList.class.getName());
|
||||
|
||||
// optional UI components
|
||||
//vfd.putVascUIComponent(VascUIComponent.VASC_BOOLEAN , SwingBoolean.class.getName());
|
||||
//vfd.putVascUIComponent(VascUIComponent.VASC_DATE , SwingDate.class.getName());
|
||||
//vfd.putVascUIComponent(VascUIComponent.VASC_TEXTAREA, SwingTextArea.class.getName());
|
||||
//vfd.putVascUIComponent(VascUIComponent.VASC_COLOR, SwingColorChooser.class.getName());
|
||||
}
|
||||
|
||||
|
||||
private static final String[] FILTER_NAMES = {
|
||||
"All Files (*.*)",
|
||||
"Comma Separated Values Files (*.csv)",
|
||||
|
@ -240,10 +263,10 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
|
||||
for(VascEntryField c:entry.getVascEntryFields()) {
|
||||
Label l = new Label(body, SWT.WRAP);
|
||||
l.setText(c.getName());
|
||||
l.setText(i18n(c.getName()));
|
||||
|
||||
if(c.getDescription()!=null) {
|
||||
l.setToolTipText(c.getDescription());
|
||||
l.setToolTipText(i18n(c.getDescription()));
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
108
src/com/idcanet/vasc/frontends/web/jsf/VascUIComponent.java
Normal file
108
src/com/idcanet/vasc/frontends/web/jsf/VascUIComponent.java
Normal file
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.frontends.web.jsf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.el.ValueExpression;
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.component.UIComponentBase;
|
||||
import javax.faces.component.html.HtmlInputText;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 16, 2008
|
||||
*/
|
||||
public class VascUIComponent extends UIComponentBase {
|
||||
|
||||
public static final String COMPONENT_TYPE = "vasc-jsf";
|
||||
//public static final String RENDERER_TYPE = "com.idcanet.vasc.frontends.web.jsf.VascUIComponentRenderer";
|
||||
|
||||
private Object[] state = null;
|
||||
protected String bar;
|
||||
|
||||
public VascUIComponent() {
|
||||
//setRendererType(RENDERER_TYPE);
|
||||
}
|
||||
|
||||
public String getFamily () {
|
||||
return COMPONENT_TYPE;
|
||||
}
|
||||
|
||||
public String getBar() {
|
||||
if (null != this.bar) {
|
||||
return this.bar;
|
||||
}
|
||||
ValueExpression ve = getValueExpression("bar");
|
||||
return (ve != null) ? (String) ve.getValue(getFacesContext().getELContext()) : null;
|
||||
}
|
||||
|
||||
|
||||
public void encodeBegin(FacesContext context) throws IOException {
|
||||
ResponseWriter writer = context.getResponseWriter();
|
||||
|
||||
writer.append("<p>");
|
||||
writer.append(" Today is: " + new Date());
|
||||
writer.append("</p>");
|
||||
|
||||
|
||||
HtmlInputText inputText = new HtmlInputText();
|
||||
inputText.setParent(this);
|
||||
// inputText.setId(this.getId() + ":_text1");
|
||||
inputText.encodeBegin(context);
|
||||
inputText.encodeEnd(context);
|
||||
|
||||
if (inputText.getRendersChildren()) {
|
||||
for (UIComponent child:inputText.getChildren()) {
|
||||
child.encodeBegin(context);
|
||||
child.encodeEnd(context);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void restoreState(FacesContext context, Object state) {
|
||||
this.state = (Object[]) state;
|
||||
super.restoreState(context, this.state[0]);
|
||||
bar = (String) this.state[1];
|
||||
}
|
||||
|
||||
public Object saveState(FacesContext context) {
|
||||
if (state == null) {
|
||||
state = new Object[2];
|
||||
}
|
||||
state[0] = super.saveState(context);
|
||||
state[1] = bar;
|
||||
return state;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.frontends.web.jsf;
|
||||
|
||||
import javax.el.ValueExpression;
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.component.UIComponentBase;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
import javax.faces.render.Renderer;
|
||||
import javax.faces.webapp.UIComponentTag;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 16, 2008
|
||||
*/
|
||||
public class VascUIComponentTag extends UIComponentTag {
|
||||
|
||||
protected ValueExpression bar;
|
||||
|
||||
public String getComponentType() {
|
||||
return VascUIComponent.COMPONENT_TYPE;
|
||||
}
|
||||
|
||||
public String getRendererType() {
|
||||
return VascUIComponent.COMPONENT_TYPE;
|
||||
}
|
||||
|
||||
public ValueExpression getBar() {
|
||||
return bar;
|
||||
}
|
||||
|
||||
protected void setProperties(UIComponent component) {
|
||||
super.setProperties(component);
|
||||
VascUIComponent download = null;
|
||||
try {
|
||||
//foo = (VascUIComponent) component;
|
||||
} catch (ClassCastException cce) {
|
||||
throw new IllegalStateException("Component " + component.toString() +
|
||||
" not expected type. Expected: com.foo.Foo. Perhaps you're missing a tag?");
|
||||
}
|
||||
|
||||
if (bar != null) {
|
||||
//foo.setValueExpression("bar", bar);
|
||||
}
|
||||
}
|
||||
|
||||
public void release() {
|
||||
super.release();
|
||||
bar = null;
|
||||
}
|
||||
|
||||
}
|
|
@ -26,12 +26,12 @@
|
|||
|
||||
package com.idcanet.vasc.impl;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackend;
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascEntryFieldSet;
|
||||
import com.idcanet.vasc.core.VascEntryFieldType;
|
||||
import com.idcanet.vasc.core.VascEntryFinalizer;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.VascLinkEntry;
|
||||
|
@ -67,6 +67,13 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
|
|||
}
|
||||
}
|
||||
|
||||
// Check if backendId is valid
|
||||
VascBackend back = vascController.getVascBackendControllerResolver().getVascBackendController().getVascBackendById( entry.getBackendId() );
|
||||
if (back==null) {
|
||||
throw new IllegalArgumentException("The VascEntry backendId is not found in backends: '"+entry.getBackendId()+"'");
|
||||
}
|
||||
|
||||
|
||||
// Fill up all not field i18n keys
|
||||
String id = entry.getId();
|
||||
|
||||
|
@ -183,18 +190,26 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
|
|||
//vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
|
||||
}
|
||||
if (vef.getVascEntryFieldValue()==null) {
|
||||
vef.setVascEntryFieldValue( vascController.getVascBackendControllerResolver().getVascBackendController().getVascBackendById( entry.getBackendId() ).provideVascEntryFieldValue(vef) );
|
||||
VascBackend back2 = vascController.getVascBackendControllerResolver().getVascBackendController().getVascBackendById( entry.getBackendId() );
|
||||
vef.setVascEntryFieldValue(back2.provideVascEntryFieldValue(vef));
|
||||
}
|
||||
|
||||
if (vef.getVascEntryFieldType()==null) {
|
||||
|
||||
|
||||
vef.setVascEntryFieldType(vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField"));
|
||||
|
||||
if (vef.getDefaultValue() instanceof Boolean) {
|
||||
///vef.setVascEntryFieldType(vascEntryFieldType);
|
||||
} else if (vef.getDefaultValue() instanceof Date) {
|
||||
} else {
|
||||
if (vef.getVascEntryFieldType()==null) {
|
||||
Object defValue = vef.getDefaultValue();
|
||||
if (defValue != null) {
|
||||
for (String typeId: vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
|
||||
VascEntryFieldType type = vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById(typeId);
|
||||
|
||||
if (type.getAutoDetectClass()!=null) {
|
||||
if (type.getAutoDetectClass().isAssignableFrom(defValue.getClass())) {
|
||||
vef.setVascEntryFieldType(type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vef.getVascEntryFieldType()==null) {
|
||||
vef.setVascEntryFieldType(vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField"));
|
||||
}
|
||||
//vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackend;
|
||||
import com.idcanet.vasc.core.VascBackendController;
|
||||
import com.idcanet.vasc.core.VascBackendControllerLocal;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -38,7 +38,7 @@ import com.idcanet.vasc.core.VascBackendController;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 18, 2008
|
||||
*/
|
||||
public class DefaultVascBackendController implements VascBackendController {
|
||||
public class DefaultVascBackendController implements VascBackendControllerLocal {
|
||||
|
||||
private Map<String,VascBackend> backends = null;
|
||||
|
||||
|
@ -53,6 +53,9 @@ public class DefaultVascBackendController implements VascBackendController {
|
|||
return backends.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Local
|
||||
*/
|
||||
public void addVascBackend(VascBackend backend) {
|
||||
if (backend==null) {
|
||||
throw new NullPointerException("backend must not be null.");
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.idcanet.vasc.core.VascBackendControllerResolver;
|
|||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntryControllerResolver;
|
||||
import com.idcanet.vasc.core.VascEntryFieldTypeControllerResolver;
|
||||
import com.idcanet.vasc.core.VascEventChannelControllerResolver;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -42,7 +43,23 @@ public class DefaultVascController implements VascController {
|
|||
private VascBackendControllerResolver vascBackendControllerResolver = null;
|
||||
private VascEntryControllerResolver vascEntryControllerResolver = null;
|
||||
private VascEntryFieldTypeControllerResolver vascEntryFieldTypeControllerResolver = null;
|
||||
private VascEventChannelControllerResolver vascEventChannelControllerResolver = null;
|
||||
|
||||
/**
|
||||
* @return the vascEventChannelControllerResolver
|
||||
*/
|
||||
public VascEventChannelControllerResolver getVascEventChannelControllerResolver() {
|
||||
return vascEventChannelControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEventChannelControllerResolver the vascEventChannelControllerResolver to set
|
||||
*/
|
||||
public void setVascEventChannelControllerResolver(
|
||||
VascEventChannelControllerResolver vascEventChannelControllerResolver) {
|
||||
this.vascEventChannelControllerResolver = vascEventChannelControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascBackendControllerResolver
|
||||
*/
|
||||
|
|
|
@ -33,7 +33,7 @@ import java.util.Map;
|
|||
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryController;
|
||||
import com.idcanet.vasc.core.VascEntryControllerLocal;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ import com.idcanet.vasc.core.VascException;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 18, 2008
|
||||
*/
|
||||
public class DefaultVascEntryController implements VascEntryController {
|
||||
public class DefaultVascEntryController implements VascEntryControllerLocal {
|
||||
|
||||
private Map<String,VascEntry> entries = null;
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ public class DefaultVascEntryField implements VascEntryField {
|
|||
}
|
||||
|
||||
public DefaultVascEntryField(String id) {
|
||||
super();
|
||||
this();
|
||||
setId(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
package com.idcanet.vasc.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntryFieldSet;
|
||||
|
@ -52,6 +53,10 @@ public class DefaultVascEntryFieldSet implements VascEntryFieldSet {
|
|||
|
||||
private List<String> vascEntryFieldIds = null;
|
||||
|
||||
public DefaultVascEntryFieldSet() {
|
||||
vascEntryFieldIds = new ArrayList<String>(10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
|
|
|
@ -31,12 +31,15 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackend;
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascEntryFinalizer;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.VascFrontend;
|
||||
import com.idcanet.vasc.core.VascFrontendData;
|
||||
import com.idcanet.vasc.core.VascFrontendHelper;
|
||||
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -46,7 +49,6 @@ import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
|
|||
*/
|
||||
public class DefaultVascFrontendData implements VascFrontendData {
|
||||
|
||||
private VascBackend vascBackend = null;
|
||||
private List<Object> entryDataList = null;
|
||||
private Object entryDataObject = null;
|
||||
private VascFrontend vascFrontend = null;
|
||||
|
@ -54,26 +56,19 @@ public class DefaultVascFrontendData implements VascFrontendData {
|
|||
private VascFrontendHelper vascFrontendHelper = null;
|
||||
private VascEntryResourceResolver vascEntryResourceResolver = null;
|
||||
private Map<String,String> uiComponents = null;
|
||||
private VascController vascController = null;
|
||||
|
||||
private Map<VascEntryField,VascUIComponent> fieldComps = null;
|
||||
private Map<VascEntryField,Object> fieldEditors = null;
|
||||
|
||||
public DefaultVascFrontendData() {
|
||||
entryDataList = new ArrayList<Object>(0);
|
||||
uiComponents = new HashMap<String,String>(8);
|
||||
|
||||
fieldComps = new HashMap<VascEntryField,VascUIComponent>(8);
|
||||
fieldEditors = new HashMap<VascEntryField,Object>(8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascBackend
|
||||
*/
|
||||
public VascBackend getVascBackend() {
|
||||
return vascBackend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascBackend the vascBackend to set
|
||||
*/
|
||||
public void setVascBackend(VascBackend vascBackend) {
|
||||
this.vascBackend = vascBackend;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the entryDataList
|
||||
*/
|
||||
|
@ -158,10 +153,27 @@ public class DefaultVascFrontendData implements VascFrontendData {
|
|||
this.vascEntryResourceResolver = vascEntryResourceResolver;
|
||||
}
|
||||
|
||||
|
||||
public VascUIComponent getVascUIComponent(String rendererId) throws VascException {
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl == null) {
|
||||
cl = rendererId.getClass().getClassLoader(); // fallback
|
||||
}
|
||||
String componentClass = getVascUIComponentClass(rendererId);
|
||||
if (componentClass==null) {
|
||||
throw new VascException("No component Class found for frontend UIComponent: "+rendererId);
|
||||
}
|
||||
try {
|
||||
return (VascUIComponent)cl.loadClass(componentClass).newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendData#getVascUIComponent(java.lang.String)
|
||||
*/
|
||||
public String getVascUIComponent(String rendererId) {
|
||||
public String getVascUIComponentClass(String rendererId) {
|
||||
return uiComponents.get(rendererId);
|
||||
}
|
||||
|
||||
|
@ -171,4 +183,40 @@ public class DefaultVascFrontendData implements VascFrontendData {
|
|||
public void putVascUIComponent(String rendererId, String uiComponentClass) {
|
||||
uiComponents.put(rendererId, uiComponentClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascController
|
||||
*/
|
||||
public VascController getVascController() {
|
||||
return vascController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascController the vascController to set
|
||||
*/
|
||||
public void setVascController(VascController vascController) {
|
||||
this.vascController = vascController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendData#addFieldVascUIComponents(com.idcanet.vasc.core.VascEntryField, com.idcanet.vasc.core.ui.VascUIComponent, java.lang.Object)
|
||||
*/
|
||||
public void addFieldVascUIComponents(VascEntryField field,VascUIComponent uiComponent, Object editor) {
|
||||
fieldComps.put(field, uiComponent);
|
||||
fieldEditors.put(field, editor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendData#getFieldRealRenderer(com.idcanet.vasc.core.VascEntryField)
|
||||
*/
|
||||
public Object getFieldRealRenderer(VascEntryField field) {
|
||||
return fieldEditors.get(field);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendData#getFieldVascUIComponent(com.idcanet.vasc.core.VascEntryField)
|
||||
*/
|
||||
public VascUIComponent getFieldVascUIComponent(VascEntryField field) {
|
||||
return fieldComps.get(field);
|
||||
}
|
||||
}
|
|
@ -34,6 +34,8 @@ import com.idcanet.vasc.core.VascEntryField;
|
|||
import com.idcanet.vasc.core.VascFrontendHelper;
|
||||
import com.idcanet.vasc.core.entry.VascEntryEventListener;
|
||||
import com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.validators.VascValidator;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -117,7 +119,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
|
|||
if (object!=null) {
|
||||
return object;
|
||||
}
|
||||
object = entry.getVascFrontendData().getVascBackend().provideVascEntryRecordCreator(entry).newRecord(entry);
|
||||
object = entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId()).provideVascEntryRecordCreator(entry).newRecord(entry);
|
||||
//fireVascEvent(VascEventListener.VascEventType.BEAN_INIT, object);
|
||||
return object;
|
||||
}
|
||||
|
@ -143,7 +145,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
|
|||
public Object mergeObject(VascEntry entry, Object object) {
|
||||
Object result = null;
|
||||
try {
|
||||
object = entry.getVascFrontendData().getVascBackend().merge(object);
|
||||
object = entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId()).merge(object);
|
||||
//fireVascEvent(VascEventListener.VascEventType.BEAN_MERGE,object);
|
||||
// todo: make faster
|
||||
// add to table at position old old object
|
||||
|
@ -162,7 +164,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
|
|||
*/
|
||||
public void refreshData(VascEntry entry) throws Exception {
|
||||
entry.getVascFrontendData().setEntryDataObject(null);
|
||||
entry.getVascFrontendData().setEntryDataList(entry.getVascFrontendData().getVascBackend().execute());
|
||||
entry.getVascFrontendData().setEntryDataList(entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId()).execute());
|
||||
//fireVascEvent(VascEventListener.VascEventType.DATA_UPDATE, null);
|
||||
}
|
||||
|
||||
|
@ -197,6 +199,32 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
|
|||
//logger.fine("Got invaliled value: "+ival.length);
|
||||
|
||||
for(VascEntryField col:entry.getVascEntryFields()) {
|
||||
|
||||
try {
|
||||
Object object = col.getVascEntryFieldValue().getValue(col, bean);
|
||||
VascUIComponent comp = entry.getVascFrontendData().getFieldVascUIComponent(col);
|
||||
|
||||
for (VascValidator val:col.getVascEntryFieldType().getVascValidators()) {
|
||||
if (val.isObjectValid(object)==false) {
|
||||
comp.setErrorText("error");
|
||||
error = true;
|
||||
} else {
|
||||
comp.setErrorText(null);
|
||||
}
|
||||
}
|
||||
|
||||
for (VascValidator val:col.getVascValidators()) {
|
||||
if (val.isObjectValid(object)==false) {
|
||||
comp.setErrorText("error");
|
||||
error = true;
|
||||
} else {
|
||||
comp.setErrorText(null);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
/*
|
||||
if(col.getVascUIComponent()==null) {
|
||||
continue; // we only DISPLAY user input errors !!
|
||||
|
|
55
src/com/idcanet/vasc/impl/DefaultVascLinkEntry.java
Normal file
55
src/com/idcanet/vasc/impl/DefaultVascLinkEntry.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright 2004-2008 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.impl;
|
||||
|
||||
import com.idcanet.vasc.core.VascLinkEntry;
|
||||
|
||||
|
||||
/**
|
||||
* The DefaultVascLinkEntry
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 27, 2007
|
||||
*/
|
||||
public class DefaultVascLinkEntry implements VascLinkEntry {
|
||||
|
||||
private String vascEntryName = null;
|
||||
|
||||
/**
|
||||
* @return the vascEntryName
|
||||
*/
|
||||
public String getVascEntryName() {
|
||||
return vascEntryName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryName the vascEntryName to set
|
||||
*/
|
||||
public void setVascEntryName(String vascEntryName) {
|
||||
this.vascEntryName = vascEntryName;
|
||||
}
|
||||
}
|
131
src/com/idcanet/vasc/impl/type/MultiTextVascEntryFieldType.java
Normal file
131
src/com/idcanet/vasc/impl/type/MultiTextVascEntryFieldType.java
Normal 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.type;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
|
||||
|
||||
/**
|
||||
* Custem FieldType for multi text values.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 17, 2008
|
||||
*/
|
||||
public class MultiTextVascEntryFieldType extends DefaultVascEntryFieldType {
|
||||
|
||||
private Object getIndexValue(VascEntryField entryField,int index) throws VascException {
|
||||
Object record = entryField.getVascEntry().getVascFrontendData().getEntryDataObject();
|
||||
Object value = entryField.getVascEntryFieldValue().getValue(entryField, record);
|
||||
|
||||
if (value instanceof List) {
|
||||
return ((List)value).get(index);
|
||||
}
|
||||
if (value instanceof String[]) {
|
||||
if (index >= ((String[])value).length ) {
|
||||
return "";
|
||||
}
|
||||
return ((String[])value)[index];
|
||||
}
|
||||
if (value instanceof String) {
|
||||
return ((String)value);
|
||||
}
|
||||
throw new VascException("Unknown object type");
|
||||
}
|
||||
|
||||
private void setIndexValue(VascEntryField entryField,int index,Object newValue) throws VascException {
|
||||
Object record = entryField.getVascEntry().getVascFrontendData().getEntryDataObject();
|
||||
Object value = entryField.getVascEntryFieldValue().getValue(entryField, record);
|
||||
|
||||
if (value instanceof List) {
|
||||
((List)value).set(index, newValue);
|
||||
return;
|
||||
}
|
||||
if (value instanceof String[]) {
|
||||
|
||||
if (index+1 > ((String[])value).length ) {
|
||||
String[] n = new String[index+1];
|
||||
for (int i=0;i<((String[])value).length;i++) {
|
||||
n[i]= ((String[])value)[i];
|
||||
}
|
||||
value = n;
|
||||
}
|
||||
((String[])value)[index] = newValue.toString();
|
||||
return;
|
||||
}
|
||||
if (value instanceof String) {
|
||||
value = new String[] { (String)value };
|
||||
return;
|
||||
}
|
||||
throw new VascException("Unknown object type: "+value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.AbstractVascEntryFieldType#getUIComponentCount(com.idcanet.vasc.core.VascEntryField)
|
||||
*/
|
||||
@Override
|
||||
public int getUIComponentCount(VascEntryField entryField) throws VascException {
|
||||
|
||||
|
||||
Object record = entryField.getVascEntry().getVascFrontendData().getEntryDataObject();
|
||||
Object value = entryField.getVascEntryFieldValue().getValue(entryField, record);
|
||||
|
||||
if (value instanceof List) {
|
||||
return ((List)value).size()+1;
|
||||
}
|
||||
if (value instanceof String[]) {
|
||||
return ((String[])value).length+1;
|
||||
}
|
||||
if (value instanceof String) {
|
||||
return 1+1;
|
||||
}
|
||||
throw new VascException("Unknown object type: "+value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.AbstractVascEntryFieldType#provideEditorVascValueModel(int, com.idcanet.vasc.core.VascEntryField)
|
||||
*/
|
||||
@Override
|
||||
public VascValueModel provideEditorVascValueModel(final int index,final VascEntryField entryField) {
|
||||
VascValueModel model = new VascValueModel() {
|
||||
public Object getValue() throws VascException {
|
||||
Object value = getIndexValue(entryField,index);
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Object value) throws VascException {
|
||||
setIndexValue(entryField,index,value);
|
||||
super.setValue(value);
|
||||
}
|
||||
};
|
||||
|
||||
return model;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright 2004-2008 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.impl.x4o;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackend;
|
||||
import com.idcanet.vasc.core.VascBackendController;
|
||||
import com.idcanet.vasc.core.VascBackendControllerLocal;
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
|
||||
import com.idcanet.x4o.element.AbstractElementConfigurator;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
import com.idcanet.x4o.element.ElementConfiguratorException;
|
||||
|
||||
|
||||
/**
|
||||
* Adds the backend to the local controller
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 16, 2008
|
||||
*/
|
||||
public class VascBackendElementConfigurator extends AbstractElementConfigurator {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElementConfigurator#doConfigEndTag(com.idcanet.x4o.element.Element)
|
||||
*/
|
||||
@Override
|
||||
public void doConfigEndTag(Element element) throws ElementConfiguratorException {
|
||||
|
||||
VascBackend backend = (VascBackend)element.getElementObject();
|
||||
|
||||
VascController vascController = VascParser.getVascController(element.getElementContext());
|
||||
VascBackendController backendController = vascController.getVascBackendControllerResolver().getVascBackendController();
|
||||
|
||||
if (backendController instanceof VascBackendControllerLocal) {
|
||||
try {
|
||||
((VascBackendControllerLocal)backendController).addVascBackend(backend);
|
||||
} catch (Exception e) {
|
||||
throw new ElementConfiguratorException(this,"Couln't add backend: "+e.getMessage(),e);
|
||||
}
|
||||
} else {
|
||||
throw new ElementConfiguratorException(this,"Can not add backend '"+backend.getId()+"' to VascBackendController because we have no access to VascBackendControllerLocal interface.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright 2004-2008 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.impl.x4o;
|
||||
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryController;
|
||||
import com.idcanet.vasc.core.VascEntryControllerLocal;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.x4o.element.AbstractElementConfigurator;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
import com.idcanet.x4o.element.ElementConfiguratorException;
|
||||
|
||||
|
||||
/**
|
||||
* Converts the type to the type object
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 16, 2008
|
||||
*/
|
||||
public class VascEntryElementConfigurator extends AbstractElementConfigurator {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElementConfigurator#doConfigEndTag(com.idcanet.x4o.element.Element)
|
||||
*/
|
||||
@Override
|
||||
public void doConfigEndTag(Element element) throws ElementConfiguratorException {
|
||||
|
||||
VascEntry entry = (VascEntry)element.getElementObject();
|
||||
|
||||
VascController vascController = VascParser.getVascController(element.getElementContext());
|
||||
VascEntryController entryController = vascController.getVascEntryControllerResolver().getVascEntryController();
|
||||
|
||||
if (entryController instanceof VascEntryControllerLocal) {
|
||||
try {
|
||||
((VascEntryControllerLocal)entryController).addVascEntry(entry, vascController);
|
||||
} catch (VascException e) {
|
||||
throw new ElementConfiguratorException(this,"Couln't add entry: "+e.getMessage(),e);
|
||||
}
|
||||
} else {
|
||||
throw new ElementConfiguratorException(this,"Can not add entry '"+entry.getId()+"' to VascEntryController because we have no access to VascEntryControllerLocal interface.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright 2004-2008 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.impl.x4o;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntryFieldSet;
|
||||
import com.idcanet.x4o.element.AbstractElementParameterConverter;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
import com.idcanet.x4o.element.ElementParameterConverterException;
|
||||
|
||||
|
||||
/**
|
||||
* Converts the VascEntryFieldSet parameter
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 17, 2008
|
||||
*/
|
||||
public class VascEntryFieldSetParameterConverter extends AbstractElementParameterConverter {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElementParameterConverter#doConvertParameter(com.idcanet.x4o.element.Element, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object doConvertParameter(Element element, Object parameterValue) throws ElementParameterConverterException {
|
||||
|
||||
if (parameterValue==null) {
|
||||
throw new NullPointerException("can't convert null parameter");
|
||||
}
|
||||
if ("".equals(parameterValue)) {
|
||||
return null;
|
||||
}
|
||||
String[] ids = parameterValue.toString().split(",");
|
||||
|
||||
VascEntryFieldSet set = (VascEntryFieldSet)element.getElementObject();
|
||||
for (String id:ids) {
|
||||
set.addVascEntryFieldId(id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright 2004-2008 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.impl.x4o;
|
||||
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.x4o.element.AbstractElementParameterConverter;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
import com.idcanet.x4o.element.ElementParameterConverterException;
|
||||
|
||||
|
||||
/**
|
||||
* Converts the type to the type object
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 16, 2008
|
||||
*/
|
||||
public class VascEntryFieldTypeParameterConverter extends AbstractElementParameterConverter {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElementParameterConverter#doConvertParameter(com.idcanet.x4o.element.Element, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object doConvertParameter(Element element, Object parameterValue) throws ElementParameterConverterException {
|
||||
|
||||
if (parameterValue==null) {
|
||||
throw new NullPointerException("can't convert null parameter");
|
||||
}
|
||||
if ("".equals(parameterValue)) {
|
||||
parameterValue = "TextField"; // ??
|
||||
}
|
||||
String fieldID = parameterValue.toString();
|
||||
|
||||
VascController controller = VascParser.getVascController(element.getElementContext());
|
||||
Object result = controller.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById(fieldID);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
79
src/com/idcanet/vasc/impl/x4o/VascParser.java
Normal file
79
src/com/idcanet/vasc/impl/x4o/VascParser.java
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright 2004-2008 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.impl.x4o;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.el.ValueExpression;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.x4o.core.X4OParser;
|
||||
import com.idcanet.x4o.element.ElementContext;
|
||||
|
||||
/**
|
||||
* Parses the vasc xml streams
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 27, 2008
|
||||
*/
|
||||
public class VascParser extends X4OParser {
|
||||
|
||||
static public String VASC_LANGUAGE = "vasc";
|
||||
private VascController vascController = null;
|
||||
|
||||
/**
|
||||
* @see X4OParser#X4OParser(String)
|
||||
*/
|
||||
public VascParser(VascController vascController) throws Exception {
|
||||
super(VASC_LANGUAGE);
|
||||
if (vascController==null) {
|
||||
throw new NullPointerException("vascController may not be null");
|
||||
}
|
||||
this.vascController=vascController;
|
||||
}
|
||||
|
||||
public VascController getVascController() {
|
||||
return vascController;
|
||||
}
|
||||
|
||||
static public VascController getVascController(ElementContext context) {
|
||||
ValueExpression ee = context.getExpressionFactory().createValueExpression(context.getELContext(),"${vascController}", VascController.class);
|
||||
VascController con = (VascController)ee.getValue(context.getELContext());
|
||||
return con;
|
||||
}
|
||||
|
||||
protected void preStartParsing() throws ParserConfigurationException,SAXException,IOException {
|
||||
super.preStartParsing();
|
||||
|
||||
// Add the controller to EL
|
||||
ValueExpression ee = getElementContext().getExpressionFactory().createValueExpression(getElementContext().getELContext(),"${vascController}", VascController.class);
|
||||
ee.setValue(getElementContext().getELContext(), vascController);
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<eld xmlns:eld="http://x4o.idcanet.com/eld/eld-lang.eld">
|
||||
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.x4o.obj.TestObjectParent" childClass="com.idcanet.x4o.obj.TestObjectChild" method="addTestObjectChild"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="javax.swing.JComponent" childClass="javax.swing.JComponent" method="add"/>
|
||||
|
||||
<eld:elementClass tag="testObjectParent" objectClassName="com.idcanet.x4o.obj.TestObjectParent"/>
|
||||
<eld:elementClass tag="testObjectChild" objectClassName="com.idcanet.x4o.obj.TestObjectChild"/>
|
||||
<eld:elementClass tag="testBeanObjectChild" objectClassName="com.idcanet.x4o.obj.TestObjectChild" parentNamespace="http://iets.idcanet.com/eld/iets.eld" elementTag="superObject"/>
|
||||
<eld:elementClass tag="testBeanObjectChild" objectClassName="com.idcanet.x4o.obj.TestObjectChild">
|
||||
<eld:elementClassParentElementClass namespace="http://iets.idcanet.com/eld/iets.eld" elementTag="superObject"/>
|
||||
<eld:elementClassParentElementClass namespace="http://iets.idcanet.com/eld/iets.eld" elementTag="superObject2"/>
|
||||
</eld:elementClass>
|
||||
|
||||
<eld:elementClass tag="JFrame" objectClassName="javax.swing.JFrame">
|
||||
<eld:elementClassParameterConverter parameterName="bounds" bean.class="com.idcanet.x4o.x4o.BoundsConverter"/>
|
||||
</eld:elementClass>
|
||||
<eld:elementClass tag="JFrameContentPane" elementClassName="com.idcanet.x4o.x4o.ContentPaneElement"/>
|
||||
|
||||
<eld:elementClass tag="JLabel" objectClassName="javax.swing.JLabel"/>
|
||||
<eld:elementClass tag="JPanel" objectClassName="javax.swing.JPanel"/>
|
||||
<eld:elementClass tag="JTextField" objectClassName="javax.swing.JTextField"/>
|
||||
<eld:elementClass tag="JTextArea" objectClassName="javax.swing.JTextArea"/>
|
||||
|
||||
<eld:elementClass tag="JScrollPane" objectClassName="javax.swing.JScrollPane"/>
|
||||
|
||||
</eld>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
|
||||
<properties>
|
||||
<comment>
|
||||
Vasc namespace for x4o vasc state/table/column language
|
||||
</comment>
|
||||
<entry key="eld.http://vasc.idcanet.com/eld/vasc-lang.eld">META-INF/vasc-lang.eld</entry>
|
||||
</properties>
|
|
@ -26,10 +26,15 @@
|
|||
|
||||
package com.idcanet.vasc;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.InputStream;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
|
@ -57,16 +62,43 @@ public class SwingTest extends TestCase {
|
|||
|
||||
public void testAll() throws Exception {
|
||||
JFrame.setDefaultLookAndFeelDecorated(false);
|
||||
VascEntry entry = TestTable.getVascTable();
|
||||
JFrame frame = viewEntry(entry);
|
||||
|
||||
while (frame.isVisible()) {
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
public JFrame viewEntry(final VascEntry entry) throws Exception {
|
||||
// get GUI
|
||||
JFrame frame = new JFrame();
|
||||
frame.setTitle("Vasc Test - Swing");
|
||||
frame.setTitle("Vasc Test - Swing - "+entry.getName());
|
||||
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
// get table
|
||||
VascEntry entry = TestTable.getVascTable();
|
||||
|
||||
|
||||
JMenuBar menubar = new JMenuBar();
|
||||
JMenu vascMenu = new JMenu("Vasc Entries");
|
||||
|
||||
for (final String id:entry.getVascFrontendData().getVascController().getVascEntryControllerResolver().getVascEntryController().getVascEntryIds()) {
|
||||
JMenuItem item = new JMenuItem(id);
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
VascEntry ee = entry.getVascFrontendData().getVascController().getVascEntryControllerResolver().getVascEntryController().getVascEntryById(id);
|
||||
TestTable.fill(ee,entry.getVascFrontendData().getVascController());
|
||||
viewEntry(ee);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
vascMenu.add(item);
|
||||
}
|
||||
menubar.add(vascMenu);
|
||||
frame.setJMenuBar(menubar);
|
||||
|
||||
// define redering
|
||||
JPanel panel = new JPanel();
|
||||
SwingVascFrontend render = new SwingVascFrontend(panel);
|
||||
|
@ -74,18 +106,12 @@ public class SwingTest extends TestCase {
|
|||
|
||||
// render
|
||||
render.initEntry(entry);
|
||||
|
||||
//table.getTableColumns().get(0).set
|
||||
|
||||
//render.renderEdit(table.getTableData().get(0));
|
||||
render.renderView();
|
||||
|
||||
// view
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
|
||||
while (frame.isVisible()) {
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
}
|
|
@ -32,7 +32,6 @@ import java.util.Date;
|
|||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.VascList;
|
||||
import com.idcanet.vasc.impl.DefaultVascBackedEntryFinalizer;
|
||||
import com.idcanet.vasc.impl.DefaultVascBackendController;
|
||||
import com.idcanet.vasc.impl.DefaultVascBackendControllerResolver;
|
||||
|
@ -50,12 +49,9 @@ import com.idcanet.vasc.impl.actions.DeleteRowAction;
|
|||
import com.idcanet.vasc.impl.actions.EditRowAction;
|
||||
import com.idcanet.vasc.impl.actions.RefreshDataGlobalAction;
|
||||
import com.idcanet.vasc.impl.actions.XMLExportGlobalAction;
|
||||
import com.idcanet.vasc.impl.entry.BeanVascEntryRecordCreator;
|
||||
import com.idcanet.vasc.impl.entry.BeanPropertyVascEntryFieldValue;
|
||||
import com.idcanet.vasc.impl.entry.DefaultVascEntryResourceResolver;
|
||||
import com.idcanet.vasc.impl.type.DefaultVascEntryFieldTypeController;
|
||||
import com.idcanet.vasc.impl.type.DefaultVascEntryFieldTypeControllerResolver;
|
||||
import com.idcanet.vasc.models.TestModel;
|
||||
import com.idcanet.vasc.impl.x4o.VascParser;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -69,7 +65,7 @@ public class TestTable {
|
|||
|
||||
// for test
|
||||
TestModelVascDataSource backend = new TestModelVascDataSource();
|
||||
backend.setId("testBackend");
|
||||
backend.setId("testBackend1");
|
||||
|
||||
// config full controller for local jvm use
|
||||
DefaultVascController c = new DefaultVascController();
|
||||
|
@ -87,6 +83,7 @@ public class TestTable {
|
|||
|
||||
DefaultVascEntryFieldTypeControllerResolver vascEntryFieldTypeControllerResolver = new DefaultVascEntryFieldTypeControllerResolver();
|
||||
DefaultVascEntryFieldTypeController vascEntryFieldTypeController = new DefaultVascEntryFieldTypeController();
|
||||
//vascEntryFieldTypeController.
|
||||
vascEntryFieldTypeControllerResolver.setVascEntryFieldTypeController(vascEntryFieldTypeController);
|
||||
c.setVascEntryFieldTypeControllerResolver(vascEntryFieldTypeControllerResolver);
|
||||
|
||||
|
@ -94,19 +91,10 @@ public class TestTable {
|
|||
|
||||
}
|
||||
|
||||
|
||||
static public VascEntry getVascTable() throws Exception {
|
||||
|
||||
VascController c = getDefaultVascController();
|
||||
|
||||
// config table
|
||||
VascEntry entry = new DefaultVascEntry();
|
||||
entry.setId("test1");
|
||||
entry.setBackendId("testBackend");
|
||||
|
||||
static public void fill(VascEntry entry,VascController c) {
|
||||
DefaultVascFrontendData vascFrontendData = new DefaultVascFrontendData();
|
||||
vascFrontendData.setVascBackend(c.getVascBackendControllerResolver().getVascBackendController().getVascBackendById("testBackend"));
|
||||
|
||||
vascFrontendData.setVascController(c);
|
||||
|
||||
VascI18nTextValue vascEntryResourceResolver = new VascI18nTextValue();// new DefaultVascEntryResourceResolver();
|
||||
vascFrontendData.setVascEntryResourceResolver(vascEntryResourceResolver);
|
||||
|
||||
|
@ -114,7 +102,7 @@ public class TestTable {
|
|||
vascFrontendData.setVascFrontendHelper(vascFrontendHelper);
|
||||
|
||||
entry.setVascFrontendData(vascFrontendData);
|
||||
|
||||
|
||||
entry.addRowAction(new AddRowAction());
|
||||
entry.addRowAction(new EditRowAction());
|
||||
entry.addRowAction(new DeleteRowAction());
|
||||
|
@ -122,7 +110,28 @@ public class TestTable {
|
|||
entry.addGlobalAction(new XMLExportGlobalAction());
|
||||
entry.addGlobalAction(new CSVExportGlobalAction());
|
||||
entry.addGlobalAction(new RefreshDataGlobalAction());
|
||||
}
|
||||
|
||||
static public VascEntry getVascTable() throws Exception {
|
||||
|
||||
VascController c = getDefaultVascController();
|
||||
|
||||
VascParser parser = new VascParser(c);
|
||||
parser.parseResource("resources/vasc/tables.xml");
|
||||
|
||||
VascEntry entry = parser.getVascController().getVascEntryControllerResolver().getVascEntryController().getVascEntryById("test1");
|
||||
fill(entry,c);
|
||||
|
||||
|
||||
// config table
|
||||
|
||||
//VascEntry entry = new DefaultVascEntry();
|
||||
//entry.setId("test1");
|
||||
//entry.setBackendId("testBackend");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
//table.addUserOptions(userOption);
|
||||
//table.addColumnActions(new GraphColumnAction());
|
||||
|
||||
|
@ -131,6 +140,7 @@ public class TestTable {
|
|||
entry.addVascEntryField(field);
|
||||
|
||||
field = new DefaultVascEntryField("description");
|
||||
field.setVascEntryFieldType(c.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById("EmailField"));
|
||||
entry.addVascEntryField(field);
|
||||
|
||||
field = new DefaultVascEntryField("active");
|
||||
|
@ -142,19 +152,14 @@ public class TestTable {
|
|||
entry.addVascEntryField(field);
|
||||
|
||||
field = new DefaultVascEntryField("testModel");
|
||||
//field.setVascEntryFieldType(c.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField"));
|
||||
//field.getVascEntryFieldType()
|
||||
VascList list = new VascList();
|
||||
list.setVascSelectItemModel((TestModelVascDataSource)c.getVascBackendControllerResolver().getVascBackendController().getVascBackendById("testBackend"));
|
||||
//field.setVascUIComponent(list);
|
||||
field.setVascEntryFieldType(c.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById("ListField"));
|
||||
field.getVascEntryFieldType().setDataObject(c.getVascBackendControllerResolver().getVascBackendController().getVascBackendById("testBackend"));
|
||||
entry.addVascEntryField(field);
|
||||
|
||||
|
||||
field = new DefaultVascEntryField("hexColor");
|
||||
field.setVascEntryFieldType(c.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById("ColorField"));
|
||||
field.setDefaultValue("#FF3355");
|
||||
//VascColorChooser ui = new VascColorChooser();
|
||||
//ui.setHexSwingEncoding(true);
|
||||
//field.setVascUIComponent(ui);
|
||||
entry.addVascEntryField(field);
|
||||
|
||||
printEntry(entry);
|
||||
|
@ -165,6 +170,7 @@ public class TestTable {
|
|||
DefaultVascFrontendEntryFinalizer f2 = new DefaultVascFrontendEntryFinalizer();
|
||||
entry = f2.finalizeVascEntry(entry,c);
|
||||
//printEntry(entry);
|
||||
*/
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,55 @@
|
|||
<vasc xmlns:v="http://vasc.idcanet.com/eld/vasc-lang.eld"
|
||||
xmlns:x4o="http://x4o.idcanet.com/eld/x4o-lang.eld"
|
||||
>
|
||||
|
||||
<v:simpleLdapConnectionProvider
|
||||
el.id="ldapSudoers"
|
||||
ldapHost="ldap2.lan.mbuyu.nl"
|
||||
bindUser="uid=admin-sudo,ou=services,dc=m4n,dc=nl"
|
||||
bindPass="adminSudo"
|
||||
/>
|
||||
|
||||
<v:ldapBackend
|
||||
id="ldapBackendSudoers"
|
||||
ldapConnectionProvider="${ldapSudoers}"
|
||||
baseDN="ou=sudoers,dc=m4n,dc=nl"
|
||||
keyAttribute="cn"
|
||||
ldapFilter="(&(objectClass=sudoRole))"
|
||||
/>
|
||||
<v:entry id="sudoers" backendId="ldapBackendSudoers">
|
||||
<v:field id="user" backendName="cn" readOnly="true"/>
|
||||
<v:field id="description" rolesEdit="admin" rolesList="all"/>
|
||||
<v:field id="sudoCommand" vascEntryFieldType="MultiTextField"/>
|
||||
<v:field id="sudoHost" vascEntryFieldType="MultiTextField"/>
|
||||
<v:field id="sudoUser" vascEntryFieldType="MultiTextField"/>
|
||||
|
||||
<!--
|
||||
<v:ldapNextIdFunction name="nextUidNumber" ldapFilter="(&(objectClass=posixGroup))" ldapAttribute="gidnumber"/>
|
||||
|
||||
<v:listeners hook="post_create">
|
||||
<etc:loginToFtpServer/>
|
||||
</v:listeners>
|
||||
|
||||
<v:link fieldName="user" viewController="ldapUsers" parameterName="user_cn"/>
|
||||
<v:link fieldName="gidNumber" viewController="ldapGroups" parameterName="group_key,${baseDn}"/>
|
||||
|
||||
<v:detail fieldName="gidNumber" detailController="${ldapGroups}"/>
|
||||
-->
|
||||
</v:entry>
|
||||
|
||||
|
||||
<v:entry id="test1" backendId="testBackend1">
|
||||
<v:field id="name" defaultValue=""/>
|
||||
<v:field id="description" vascEntryFieldType="EmailField" defaultValue="email@address.nl"/>
|
||||
<v:field id="active" defaultValue="true"/>
|
||||
<v:field id="date" vascEntryFieldType="DateField" defaultValue="$myBean.newDate"/>
|
||||
<v:field id="hexColor" vascEntryFieldType="ColorField" defaultValue="#FF3355"/>
|
||||
<v:field id="testModel" vascEntryFieldType="ListField" dataObject="$myBean.testBackend1"
|
||||
vascEntryFieldType.dataObject="#{vascController.vascBackendControllerResolver.vascBackendController.vascBackendById('testBackend1')}"
|
||||
/>
|
||||
</v:entry>
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
- View
|
||||
|
@ -87,15 +136,16 @@ Master
|
|||
|
||||
-->
|
||||
|
||||
<v:entry id="test1" backendId="testBackend1">
|
||||
|
||||
<v:entry id="test2" backendId="testBackend1">
|
||||
<v:field id="name"/>
|
||||
<v:field id="description"/>
|
||||
<v:field id="active"/>
|
||||
<v:field id="model" vascEntryFieldType="ListField" selectItemId="testBackend1"/>
|
||||
<v:field id="testModel" vascEntryFieldType="ListField"/>
|
||||
</v:entry>
|
||||
|
||||
<v:entry
|
||||
id="test2"
|
||||
id="test3"
|
||||
name="iets"
|
||||
description="ietsdescrip"
|
||||
helpId="someHelpKey"
|
||||
|
@ -126,8 +176,8 @@ Master
|
|||
|
||||
defaultValue="true"
|
||||
|
||||
sizeList="styleClass"
|
||||
sizeEdit="styleClass"
|
||||
sizeList="100"
|
||||
sizeEdit="80"
|
||||
styleList="styleClass"
|
||||
styleEdit="styleClass"
|
||||
|
||||
|
@ -168,145 +218,5 @@ Master
|
|||
optional="false"
|
||||
/>
|
||||
</v:entry>
|
||||
|
||||
|
||||
<v:entry id="sudoers">
|
||||
<v:field name="user" backendName="cn" readOnly="true"/>
|
||||
<v:field name="description" backendName="description">
|
||||
<v:roles edit="admin" list="all"/>
|
||||
</v:field>
|
||||
<v:field name="sudoCommand" fieldType="listField"/>
|
||||
<v:field name="sudoHost" fieldType="listField"/>
|
||||
<v:field name="sudoUser" fieldType="listField">
|
||||
<v:fieldType>
|
||||
<vasc:fieldHint key="timeout" default="200"/>
|
||||
</v:fieldType>
|
||||
</v:field>
|
||||
|
||||
<v:field name="sambaSID" fieldEditor="textField" edit="false" list="false" view="false" create="false" defaultValue="S-1-5-21-1200182392-965607725-1867741125-514"/>
|
||||
<v:field name="sambaGroupType" v.defaultValue="2"/>
|
||||
|
||||
<v:field name="gidNumber" v.defaultValue="nextUidNumber();"/>
|
||||
<v:field name="objectclass" v.defaultValue="{posixGroup,sambaGroupMapping,top}"/>
|
||||
|
||||
<v:fieldSet name="extraOptions" optional="true">
|
||||
<v:field name="sudoHost" defaultValue="localhost"/>
|
||||
</v:fieldSet>
|
||||
|
||||
<v:ldapNextIdFunction name="nextUidNumber" ldapFilter="(&(objectClass=posixGroup))" ldapAttribute="gidnumber"/>
|
||||
|
||||
<v:listeners hook="post_create">
|
||||
<etc:loginToFtpServer/>
|
||||
</v:listeners>
|
||||
|
||||
<v:link fieldName="user" viewController="ldapUsers" parameterName="user_cn"/>
|
||||
<v:link fieldName="gidNumber" viewController="ldapGroups" parameterName="group_key,${baseDn}"/>
|
||||
|
||||
<v:detail fieldName="gidNumber" detailController="${ldapGroups}"/>
|
||||
|
||||
|
||||
<v:ldapBackend ldapConnection="${sudoers}">
|
||||
<x4o:property name="list_filter">(&(objectClass=sudoRole))</x4o:property>
|
||||
<x4o:property name="delete">${baseDn},cn=%s</x4o:property>
|
||||
<x4o:property name="new_classes">sudoRole,top</x4o:property>
|
||||
</v:ldapBackend>
|
||||
</v:entry>
|
||||
|
||||
<!--
|
||||
<jsf-vasc:viewManager controller="${sudoers}">
|
||||
|
||||
</jsf-vasc:viewManager>
|
||||
|
||||
|
||||
<table
|
||||
name = "myTable1"
|
||||
vascDataSource = "${dataSource}"
|
||||
vascRecordBeanCreatorClass="com.id.models.User"
|
||||
vascTextValue="${vascI18nController}"
|
||||
vascTableController = "${tableController}"
|
||||
UIIdentifierVascTableColomn = "${idColumn}"
|
||||
|
||||
>
|
||||
|
||||
<actions:addRowAction/>
|
||||
<actions:DeleteRowAction/>
|
||||
<actions:editRowAction/>
|
||||
|
||||
<action:csvExportAction/>
|
||||
<action:xmlExportAction/>
|
||||
<action:refreshDataAction/>
|
||||
|
||||
<option:comboBoxOption />
|
||||
|
||||
<colum el.id="idColumn"
|
||||
name="test"
|
||||
toolTip="test"
|
||||
defaultValue="true"
|
||||
width="30"
|
||||
helpId="test"
|
||||
image="ergens"
|
||||
editDisplay="true"
|
||||
editReadonly="false"
|
||||
listDisplay="true"
|
||||
>
|
||||
<bind:beanColumnValue />
|
||||
<ui:vascToggle />
|
||||
</colum>
|
||||
</table>
|
||||
|
||||
|
||||
<view>
|
||||
|
||||
</view>
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
<xslt>
|
||||
# Convert from xml -> csv and html or xitext
|
||||
</xslt>
|
||||
-->
|
||||
<!--
|
||||
<query name="limit">
|
||||
<sql>
|
||||
LIMIT <parameter name="limit"/>
|
||||
</sql>
|
||||
<parameterValue name="limit" value="10" defaultValue="200" type="parameter"/>
|
||||
</query>
|
||||
<query name="paging" type="hql">
|
||||
<sql>
|
||||
OFFSET <parameter name="offset"/>
|
||||
<include name="limit"/>
|
||||
</sql>
|
||||
<parameterValue name="offset" value="0" defaultValue="0" type="parameter"/>
|
||||
</query>
|
||||
<query name="baseSelect">
|
||||
<x4o:property name="executionTimeout" value="200"/>
|
||||
<x4o:property name="cacheTimeout" value="99"/>
|
||||
<x4o:property name="jdniConnection" value="somewhere"/>
|
||||
<sql>
|
||||
SELECT
|
||||
USERS.USERNAME AS USERNAME
|
||||
USERS.PASSWD AS PASSWORD
|
||||
FROM
|
||||
USERS
|
||||
</sql>
|
||||
<comment>Bla bla</comment>
|
||||
<comment>Also see this site http://www.google.com</comment>
|
||||
</query>
|
||||
|
||||
<query name="testUsers2" type="hql">
|
||||
<x4o:property name="persistanceSession" value="sessionName"/>
|
||||
<sql>
|
||||
<include name="baseSelect"/>
|
||||
<parameter name="extra_where"/>
|
||||
AND role is in <parameter name="roles"/>
|
||||
<include name="paging"/>
|
||||
</sql>
|
||||
<parameterValue name="extra_where" defaultValue="WHERE true=true" type="raw"/>
|
||||
<parameterValue name="roles" value="1,12,99,200" type="parameterList"/>
|
||||
<parameterValue name="limit" value="15"/>
|
||||
<parameterValue name="offset" value="25"/>
|
||||
</query>
|
||||
-->
|
||||
</vasc>
|
3
www/META-INF/MANIFEST.MF
Normal file
3
www/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,3 @@
|
|||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
15
www/META-INF/vasc-jsf.taglib.xml
Normal file
15
www/META-INF/vasc-jsf.taglib.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE facelet-taglib PUBLIC
|
||||
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
|
||||
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
|
||||
|
||||
<facelet-taglib>
|
||||
<namespace>http://foo.com/foo</namespace>
|
||||
<tag>
|
||||
<tag-name>foo</tag-name>
|
||||
<component>
|
||||
<component-type>com.foo.Foo</component-type>
|
||||
<renderer-type>com.foo.component.Foo</renderer-type>
|
||||
</component>
|
||||
</tag>
|
||||
</facelet-taglib>
|
31
www/WEB-INF/faces-config.xml
Normal file
31
www/WEB-INF/faces-config.xml
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0"?>
|
||||
<faces-config
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
|
||||
version="1.2">
|
||||
|
||||
<component>
|
||||
<description><![CDATA[Vasc component]]></description>
|
||||
<display-name>Vasc</display-name>
|
||||
<component-type>vasc-jsf</component-type>
|
||||
<component-class>com.idcanet.vasc.frontends.web.jsf.VascUIComponent</component-class>
|
||||
|
||||
</component>
|
||||
|
||||
<!--
|
||||
|
||||
<component-extension>
|
||||
<renderer-type>com.idcanet.vasc.frontends.web.jsf.VascUIComponentRenderer</renderer-type>
|
||||
</component-extension>
|
||||
<render-kit>
|
||||
<description>Renderkit implementation for the Vasc component</description>
|
||||
<renderer>
|
||||
<component-family>vasc-jsf</component-family>
|
||||
<renderer-type>com.idcanet.vasc.frontends.web.jsf.VascUIComponentRenderer</renderer-type>
|
||||
<renderer-class>com.idcanet.vasc.frontends.web.jsf.VascUIComponentRenderer</renderer-class>
|
||||
</renderer>
|
||||
</render-kit>
|
||||
-->
|
||||
|
||||
</faces-config>
|
27
www/WEB-INF/vasc-jsf.tld
Normal file
27
www/WEB-INF/vasc-jsf.tld
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
|
||||
version="2.1">
|
||||
<description><![CDATA[Vasc-JSF components]]></description>
|
||||
<tlib-version>1.0</tlib-version>
|
||||
<short-name>vasc</short-name>
|
||||
<uri>http://vasc.idcanet.com/jsf</uri>
|
||||
<tag>
|
||||
<description><![CDATA[The Vasc Renderer]]></description>
|
||||
<name>vasc</name>
|
||||
<tag-class>com.idcanet.vasc.frontends.web.jsf.VascUIComponentTag</tag-class>
|
||||
<body-content>JSP</body-content>
|
||||
<attribute>
|
||||
<description><![CDATA[The jsf id]]></description>
|
||||
<name>id</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<description><![CDATA[Some attribute of vasc]]></description>
|
||||
<name>bar</name>
|
||||
<required>false</required>
|
||||
<deferred-value><type>java.lang.Object</type></deferred-value>
|
||||
</attribute>
|
||||
</tag>
|
||||
</taglib>
|
81
www/WEB-INF/web.xml
Normal file
81
www/WEB-INF/web.xml
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app version="2.5"
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.jsp</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
<context-param>
|
||||
<param-name>facelets.SKIP_COMMENTS</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
|
||||
<context-param>
|
||||
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
|
||||
<param-value>server</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>com.sun.faces.validateXml</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>com.sun.faces.verifyObjects</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
|
||||
<param-value>.jsp</param-value>
|
||||
</context-param>
|
||||
|
||||
<!-- Facelets pages will use the .xhtml extension -->
|
||||
<context-param>
|
||||
<param-name>facelets.VIEW_MAPPINGS</param-name>
|
||||
<param-value>*.xhtml</param-value>
|
||||
</context-param>
|
||||
|
||||
<!-- Faces Servlet -->
|
||||
<servlet>
|
||||
<servlet-name>Faces Servlet</servlet-name>
|
||||
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<!-- Faces Servlet Mapping -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>Faces Servlet</servlet-name>
|
||||
<url-pattern>/faces/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>Faces Servlet</servlet-name>
|
||||
<url-pattern>*.jsf</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<!--
|
||||
<security-constraint>
|
||||
This security constraint illustrates how JSP pages
|
||||
with JSF components can be protected from
|
||||
being accessed without going through the Faces Servlet.
|
||||
The security constraint ensures that the Faces Servlet will
|
||||
be used or the pages will not be processed.
|
||||
|
||||
<display-name>Restrict access to JSP pages</display-name>
|
||||
<web-resource-collection>
|
||||
<web-resource-name>
|
||||
Restrict access to JSP pages
|
||||
</web-resource-name>
|
||||
<url-pattern>/greeting.jsp</url-pattern>
|
||||
<url-pattern>/response.jsp</url-pattern>
|
||||
</web-resource-collection>
|
||||
<auth-constraint>
|
||||
<description>
|
||||
With no roles defined, no access granted
|
||||
</description>
|
||||
</auth-constraint>
|
||||
</security-constraint>
|
||||
-->
|
||||
|
||||
</web-app>
|
12
www/index.jsp
Normal file
12
www/index.jsp
Normal file
|
@ -0,0 +1,12 @@
|
|||
<jsp:root version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:jsp="http://java.sun.com/JSP/Page"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:t="http://myfaces.apache.org/tomahawk"
|
||||
xmlns:s="http://myfaces.apache.org/sandbox"
|
||||
xmlns:i18n="http://i18n.idcanet.com/i18n"
|
||||
>
|
||||
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
|
||||
TEST INDEX.JSP
|
||||
</jsp:root>
|
24
www/vasc_test1.jsp
Normal file
24
www/vasc_test1.jsp
Normal file
|
@ -0,0 +1,24 @@
|
|||
<jsp:root version="2.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:jsp="http://java.sun.com/JSP/Page"
|
||||
xmlns:f="http://java.sun.com/jsf/core"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:t="http://myfaces.apache.org/tomahawk"
|
||||
xmlns:s="http://myfaces.apache.org/sandbox"
|
||||
xmlns:i18n="http://i18n.idcanet.com/i18n"
|
||||
xmlns:vasc="http://vasc.idcanet.com/jsf"
|
||||
>
|
||||
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
|
||||
<f:view>
|
||||
<html>
|
||||
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta></head>
|
||||
<body>
|
||||
<h:form>
|
||||
<p>TEST vasc1</p>
|
||||
<p>The HelloWorld UI Component:</p>
|
||||
<vasc:vasc />
|
||||
</h:form>
|
||||
</body>
|
||||
</html>
|
||||
</f:view>
|
||||
</jsp:root>
|
Loading…
Reference in a new issue