[svn r342] WIP2
This commit is contained in:
parent
a60c7487e9
commit
62f7881380
282
doc/README.txt
282
doc/README.txt
|
@ -10,9 +10,289 @@ Down load http://www.ehecht.com/eclipse_ve/ve.html (lin_mac version)
|
|||
|
||||
Unzip and move the plug ins and features into the plug in and features directory of eclipse.
|
||||
|
||||
|
||||
Swing will run by default.
|
||||
|
||||
-- XyReasscan ?
|
||||
|
||||
zie tables statline.cbs.nl voor bs asielverzoeken nl
|
||||
|
||||
|
||||
---- Object tree:
|
||||
|
||||
3 layers
|
||||
|
||||
- Data Backend
|
||||
- JPA or Hibernate
|
||||
- Meta Query
|
||||
- LDAP
|
||||
# List via geparametered xql query
|
||||
# Save
|
||||
# Merge
|
||||
# Delete
|
||||
# Create ?
|
||||
FilteringDataSource
|
||||
PagingDataSource
|
||||
FilteringPagingDataSource
|
||||
Ordering
|
||||
Parameter
|
||||
|
||||
- Data Source Controller
|
||||
- Data Access Controller
|
||||
# User ACL on data items/columns
|
||||
# Create new entry hooks
|
||||
|
||||
- Table Controller
|
||||
- User Settings
|
||||
|
||||
|
||||
- Data Frontends
|
||||
- Extjs
|
||||
- Swing
|
||||
- WS
|
||||
- SWT via SwingWT
|
||||
- JSF (met utr plugin)
|
||||
|
||||
|
||||
|
||||
- default view field
|
||||
- Admin fields and order
|
||||
- Admin field groups -> 'collapse
|
||||
- List filters auto by type
|
||||
- search fields
|
||||
|
||||
verbose_name_plural
|
||||
The plural name for the object:
|
||||
verbose_name_plural = "stories"
|
||||
If this isn’t given, Django will use verbose_name + "s"
|
||||
|
||||
|
||||
- plural
|
||||
- ordering
|
||||
- order_with_respect_to
|
||||
|
||||
# admin
|
||||
- date_hierarchy
|
||||
- fields = (
|
||||
(None, {
|
||||
'fields': ('url', 'title', 'content', 'sites')
|
||||
}),
|
||||
('Advanced options', {
|
||||
'classes': 'collapse',
|
||||
'fields' : ('enable_comments', 'registration_required', 'template_name')
|
||||
'description' : 'sdf'
|
||||
}),
|
||||
)
|
||||
- JS
|
||||
- list_display_links
|
||||
- list_filter = BooleanField, DateField, DateTimeField or ForeignKey.
|
||||
- list_per_page
|
||||
- ordering def
|
||||
- save_as
|
||||
- search_fields
|
||||
|
||||
@Entity
|
||||
@VascAdmin(list=true,edit=true,create=true,delete=false)
|
||||
public class BlogPost {
|
||||
|
||||
@VascPrimaryKey
|
||||
@VascName(key="generic.id.name")
|
||||
@VascDescription(key="generic.id.name")
|
||||
@VascHelpId(key="generic.id.help")
|
||||
@VascImage(key="generid.id.image");
|
||||
Integer id;
|
||||
|
||||
@Column(columnName="title")
|
||||
@VascDisplayName
|
||||
@VascUserRoles(list="(floormanager&sitemanager)|admin" editViewOnly="floormanager" edit="sitemanager|admin")
|
||||
String title;
|
||||
|
||||
@VascEditorType(type="slugField")
|
||||
String slug;
|
||||
|
||||
@VascChoices()
|
||||
@VascDefaultValue(key="")
|
||||
String tags;
|
||||
|
||||
@VascRegex(regex="<(.*)>" key="generic.regex.html.tagsNotAllowed")
|
||||
String content;
|
||||
|
||||
@VascEditorType(type="floatField" hints="max_digits=3,decimal_places=2")
|
||||
@VascFieldOptions
|
||||
@VascColumnWidth(width=130)
|
||||
Float price;
|
||||
|
||||
@VascModelReference
|
||||
@VascDefaultValue
|
||||
@VascObjectNotNull
|
||||
BlogStatus blogStatus;
|
||||
|
||||
@VascEditorType(type="dateField" hints="auto_now=true,auto_now_add=true")
|
||||
@VascDefaultValue(key="new_date")
|
||||
@VascUserRoles(list="admin")
|
||||
Date createdDate
|
||||
|
||||
@VascEventChannel(channel="BlogPost.modifiedDate" create=true)
|
||||
Date modifiedDate
|
||||
|
||||
@VascDateFuture
|
||||
Date publicedDate
|
||||
}
|
||||
|
||||
|
||||
|
||||
$it['ldap']['user']="uid=admin-sudo,ou=services,dc=m4n,dc=nl";
|
||||
$it['ldap']['pass']="adminSudo";
|
||||
$it['ldap']['baseDN']="ou=sudoers,dc=m4n,dc=nl";
|
||||
$it['ldap']['key']="cn";
|
||||
|
||||
$it['columns'][0]['name']="Edit";
|
||||
$it['columns'][0]['columnType']="edit";
|
||||
$it['columns'][1]['name']="Delete";
|
||||
$it['columns'][1]['columnType']="delete";
|
||||
$it['columns'][2]['name']="User";
|
||||
$it['columns'][2]['attr']="cn";
|
||||
$it['columns'][3]['name']="Description";
|
||||
$it['columns'][3]['attr']="description";
|
||||
$it['columns'][4]['name']="sudoCommand";
|
||||
$it['columns'][4]['attr']="sudocommand";
|
||||
$it['columns'][4]['columnType']="list";
|
||||
$it['columns'][5]['name']="sudoHost";
|
||||
$it['columns'][5]['attr']="sudohost";
|
||||
$it['columns'][5]['columnType']="list";
|
||||
$it['columns'][6]['name']="sudoUser";
|
||||
$it['columns'][6]['attr']="sudouser";
|
||||
$it['columns'][6]['columnType']="list";
|
||||
|
||||
$it['list']['filter']="(&(objectClass=sudoRole))";
|
||||
$it['list']['columns']="0,2,6,4,5,1";
|
||||
$it['delete']['filter']="cn=%s";
|
||||
|
||||
$it['edit']['filter']="(cn=%s)";
|
||||
$it['edit']['create_dn_key']="cn=%s";
|
||||
$it['edit']['columns_edit']="2,3,4,5,6";
|
||||
$it['edit']['columns_edit_readonly']="2";
|
||||
$it['edit']['columns_create']="2,3,4,5,6";
|
||||
$it['edit']['map']['objectclass'][]="sudoRole";
|
||||
$it['edit']['map']['objectclass'][]="top";
|
||||
$it['edit']['map']['cn']="\$key";
|
||||
$it['edit']['map']['description']="\$formData['description']";
|
||||
|
||||
<servlet>
|
||||
<name>vasc</name>
|
||||
<class></class>
|
||||
<property>admin=true</property>
|
||||
<property>backend=extjs</property>
|
||||
<property>path=/js/extjs/*</property>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<name>vasc</name>
|
||||
<mapping>/vasc/*</mapping>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
DefaultVascController r = new D..();
|
||||
|
||||
r.set
|
||||
|
||||
|
||||
EmployeeDataSource dataSource = new EmployeeDataSource();
|
||||
dataSource.setJdbcTemplate(new JdbcTemplate(employeeDataSource()));
|
||||
FilteringPaginator filteringPaginator = new FilteringPaginator(dataSource, EmployeeReportObject.class);
|
||||
JsfCrudAdapter adapter = new JsfCrudAdapter(filteringPaginator, (CrudController)empCrud().getController()){
|
||||
public Serializable getEntity() {
|
||||
Object object = ((Row)getModel().getRowData()).getObject();
|
||||
EmployeeReportObject employeeReportObject = (EmployeeReportObject) object;
|
||||
Employee employee = new Employee();
|
||||
employee.setId(employeeReportObject.getId());
|
||||
return employee;
|
||||
}
|
||||
};
|
||||
|
||||
return adapter;
|
||||
|
||||
|
||||
|
||||
EVt;
|
||||
|
||||
<a4j:form id="blogForm" enctype="multipart/form-data">
|
||||
<vasc:form crud="${crud}" parentForm="blogForm"
|
||||
propertyNames="firstName,lastName,department,description,file,age,numberOfPromotions,active,status,dob">
|
||||
|
||||
<vasc:compositePanel entity="${crud.entity.address}" name="address"
|
||||
propertyNames="line_1,line2,zipCode" />
|
||||
|
||||
<vasc:detailListing
|
||||
detailController="${directReportDetailController}"
|
||||
propertyNames="firstName,lastName,description,age,numberOfPromotions" />
|
||||
|
||||
<vasc:detailListing detailController="${taskDetailController}"
|
||||
propertyNames="name,startDate,endDate,complete" />
|
||||
|
||||
<vasc:detailListing detailController="${contactDetailController}"
|
||||
propertyNames="name,phone" />
|
||||
|
||||
<vasc:selectMany jsfSelectManyController="${employeeToRoleController}"
|
||||
propertyNames="name"
|
||||
parentForm="employeeForm"/>
|
||||
|
||||
</vasc:form>
|
||||
</a4j:form>
|
||||
|
||||
Table def:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings({ "unchecked", "serial" })
|
||||
@Bean(scope = DefaultScopes.SESSION)
|
||||
public JsfCrudAdapter empRecordCrud() {
|
||||
EmployeeDataSource dataSource = new EmployeeDataSource();
|
||||
dataSource.setJdbcTemplate(new JdbcTemplate(employeeDataSource()));
|
||||
FilteringPaginator filteringPaginator = new FilteringPaginator(dataSource, EmployeeReportObject.class);
|
||||
JsfCrudAdapter adapter = new JsfCrudAdapter(filteringPaginator, (CrudController)empCrud().getController()){
|
||||
public Serializable getEntity() {
|
||||
Object object = ((Row)getModel().getRowData()).getObject();
|
||||
EmployeeReportObject employeeReportObject = (EmployeeReportObject) object;
|
||||
Employee employee = new Employee();
|
||||
employee.setId(employeeReportObject.getId());
|
||||
return employee;
|
||||
}
|
||||
};
|
||||
|
||||
return adapter;
|
||||
}
|
||||
|
||||
<a4j:form id="employeeListingForm">
|
||||
<a4j:outputPanel ajaxRendered="true">
|
||||
<h:panelGroup rendered="${empRecordCrud.controller.showForm}">
|
||||
<crank:form
|
||||
crud="${empRecordCrud.controller}"
|
||||
parentForm="employeeListingForm"
|
||||
propertyNames="firstName,lastName,numberOfPromotions,age,department" ajax="${true}" />
|
||||
</h:panelGroup>
|
||||
</a4j:outputPanel>
|
||||
|
||||
<crank:listing
|
||||
jsfCrudAdapter="${empRecordCrud}"
|
||||
propertyNames="firstName,lastName"
|
||||
parentForm="employeeListingForm"
|
||||
/>
|
||||
</a4j:form>
|
||||
|
||||
|
||||
|
||||
<h:form id="expListForm" rendered="#{controllerBean.showListing}">
|
||||
<crank:listing paginator="${paginators['Employee']}"
|
||||
jsfCrudAdapter="${cruds['Employee']}"
|
||||
propertyNames="firstName,lastName,active,dob,age,phone,email,department.name,description"
|
||||
pageTitle="Employees"
|
||||
parentForm="expListForm"
|
||||
reRender="${reRender}"
|
||||
crud="${cruds['Employee'].controller}"/>
|
||||
</h:form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Binary file not shown.
18
src/META-INF/fieldtype-lang.eld
Normal file
18
src/META-INF/fieldtype-lang.eld
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?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:elementClass>
|
||||
|
||||
</eld>
|
8
src/META-INF/fieldtype-namespaces.xml
Normal file
8
src/META-INF/fieldtype-namespaces.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
|
||||
<properties>
|
||||
<comment>
|
||||
Vasc namespace for the fieldtype language
|
||||
</comment>
|
||||
<entry key="eld.http://vasc.idcanet.com/eld/fieldtype-lang.eld">META-INF/fieldtype-lang.eld</entry>
|
||||
</properties>
|
|
@ -1,15 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<fieldtype
|
||||
xmlns:vf="http://vasc.idcanet.com/eld/fieldtype-lang.eld"
|
||||
xmlns:x4o="http://x4o.idcanet.com/eld/x4o-lang.eld"
|
||||
>
|
||||
|
||||
<!-- Verplichte impl field types -->
|
||||
<vasc:fieldType name="TextField">
|
||||
<vasc:fieldHint key="minlength" default="0"/>
|
||||
<vasc:fieldHint key="maxlength" default="80"/>
|
||||
<vasc:fieldClass className="java.lang.String"/>
|
||||
</vasc:fieldType>
|
||||
<vasc:fieldType name="ListField">
|
||||
<vasc:fieldHint key="radio_edit" default="false"/>
|
||||
</vasc:fieldType>
|
||||
<vf:fieldType id="TextField">
|
||||
<x4o:property key="minlength" value="0"/>
|
||||
<x4o:property key="maxlength" value="80"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="ListField">
|
||||
<x4o:property key="radio_edit" value="false"/>
|
||||
</vf:fieldType>
|
||||
|
||||
<!--
|
||||
<vasc:fieldType name="TextAreaField">
|
||||
|
@ -17,9 +19,9 @@
|
|||
<vasc:fieldHint key="rows" default="80"/>
|
||||
<vasc:fieldClass className="java.lang.StringBuffer"/>
|
||||
</vasc:fieldType>
|
||||
-->
|
||||
|
||||
-->
|
||||
<!-- Native types -->
|
||||
<!--
|
||||
<vasc:fieldType name="BooleanField">
|
||||
<vasc:fieldClass className="java.lang.Boolean"/>
|
||||
</vasc:fieldType>
|
||||
|
@ -47,9 +49,11 @@
|
|||
<vasc:fieldClass className="java.lang.Double"/>
|
||||
<vasc:fieldConverter className="com.idcanet.x4o.converts.DoubleConverter"/>
|
||||
</vasc:fieldType>
|
||||
-->
|
||||
|
||||
<!-- Date types -->
|
||||
<vasc:fieldType name="DateField">
|
||||
<!--
|
||||
<vasc:fieldType name="DateField" extends="TextField">
|
||||
<vasc:fieldHint key="format"/>
|
||||
<vasc:fieldConverter className="com.idcanet.x4o.converts.DateConverter"/>
|
||||
</vasc:fieldType>
|
||||
|
@ -62,9 +66,10 @@
|
|||
<vasc:fieldHint key="format" default="HH:mm"/>
|
||||
<vasc:fieldConverter className="com.idcanet.x4o.converts.DateConverter"/>
|
||||
</vasc:fieldType>
|
||||
|
||||
-->
|
||||
|
||||
<!-- Internet fields -->
|
||||
<!--
|
||||
<vasc:fieldType name="EmailField">
|
||||
<vasc:fieldHint key="validate" default="true"/>
|
||||
<vasc:fieldHint key="timeout" default="200"/>
|
||||
|
@ -88,8 +93,10 @@
|
|||
<vasc:fieldType name="SlugField">
|
||||
<vasc:fieldHint key="populate_from"/>
|
||||
</vasc:fieldType>
|
||||
-->
|
||||
|
||||
<!-- XML fields -->
|
||||
<!--
|
||||
<vasc:fieldType name="XMLField">
|
||||
<vasc:fieldHint key="validate" default="true"/>
|
||||
<vasc:fieldHint key="schema_url"/>
|
||||
|
@ -98,8 +105,9 @@
|
|||
<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=","/>
|
||||
|
@ -115,8 +123,9 @@
|
|||
<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"/>
|
||||
|
@ -139,5 +148,5 @@
|
|||
<vasc:fieldClass className="java.awt.Image"/>
|
||||
<vasc:fieldClass className="javax.swing.Image"/>
|
||||
</vasc:fieldType>
|
||||
|
||||
</root>
|
||||
-->
|
||||
</fieldtype>
|
|
@ -115,6 +115,7 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
/**
|
||||
* @see com.idcanet.vasc.core.entry.VascEntryFieldValue#getValue(com.idcanet.vasc.core.VascEntryField, java.lang.Object)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object getValue(VascEntryField field, Object record) throws ElementParameterException,ElementParameterNotFoundException {
|
||||
Map<String,Object> map = (Map<String,Object>)record;
|
||||
return map.get(field.getBackendName());
|
||||
|
@ -123,6 +124,7 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
/**
|
||||
* @see com.idcanet.vasc.core.entry.VascEntryFieldValue#setValue(com.idcanet.vasc.core.VascEntryField, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setValue(VascEntryField field, Object record,Object value) throws ElementParameterException,ElementParameterNotFoundException {
|
||||
Map<String,Object> map = (Map<String,Object>)record;
|
||||
map.put(field.getBackendName(), value);
|
||||
|
|
|
@ -26,11 +26,7 @@
|
|||
|
||||
package com.idcanet.vasc.backends.ldap;
|
||||
|
||||
import java.security.Security;
|
||||
|
||||
import com.novell.ldap.LDAPConnection;
|
||||
import com.novell.ldap.LDAPJSSESecureSocketFactory;
|
||||
import com.novell.ldap.LDAPSocketFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -45,7 +41,6 @@ public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
|
|||
private int ldapVersion = LDAPConnection.LDAP_V3;
|
||||
private String bindUser = null;
|
||||
private String bindPass = null;
|
||||
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.backends.ldap.LdapConnectionProvider#getLdapConnection()
|
||||
|
@ -71,7 +66,6 @@ public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the ldapHost
|
||||
*/
|
||||
|
|
168
src/com/idcanet/vasc/core/AbstractVascEntryFieldType.java
Normal file
168
src/com/idcanet/vasc/core/AbstractVascEntryFieldType.java
Normal file
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.validators.VascValidator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 2, 2007
|
||||
*/
|
||||
abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
|
||||
|
||||
private String id = null;
|
||||
private Class<?> autoFieldClass = null;
|
||||
private ObjectConverter objectConverter = null;
|
||||
private VascUIComponent vascUIComponent = null;
|
||||
private List<VascValidator> vascValidators = null;
|
||||
private Map<String,String> properties = null;
|
||||
private String parentEntryFieldTypeName = null;
|
||||
|
||||
public AbstractVascEntryFieldType() {
|
||||
vascValidators = new ArrayList<VascValidator>(4);
|
||||
properties = new HashMap<String,String>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#addVascValidator(com.idcanet.vasc.validators.VascValidator)
|
||||
*/
|
||||
public void addVascValidator(VascValidator vascValidator) {
|
||||
vascValidators.add(vascValidator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getAutoFieldClass()
|
||||
*/
|
||||
public Class<?> getAutoFieldClass() {
|
||||
return autoFieldClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getId()
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getObjectConverter()
|
||||
*/
|
||||
public ObjectConverter getObjectConverter() {
|
||||
return objectConverter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getParentEntryFieldTypeName()
|
||||
*/
|
||||
public String getParentEntryFieldTypeName() {
|
||||
return parentEntryFieldTypeName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getProperty(java.lang.String)
|
||||
*/
|
||||
public String getProperty(String name) {
|
||||
return properties.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getPropertyNames()
|
||||
*/
|
||||
public List<String> getPropertyNames() {
|
||||
return new ArrayList<String>(properties.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getVascUIComponent()
|
||||
*/
|
||||
public VascUIComponent getVascUIComponent() {
|
||||
return vascUIComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getVascValidators()
|
||||
*/
|
||||
public List<VascValidator> getVascValidators() {
|
||||
return vascValidators;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#removeVascValidator(com.idcanet.vasc.validators.VascValidator)
|
||||
*/
|
||||
public void removeVascValidator(VascValidator vascValidator) {
|
||||
vascValidators.remove(vascValidator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setAutoFieldClass(java.lang.Class)
|
||||
*/
|
||||
public void setAutoFieldClass(Class<?> autoFieldClass) {
|
||||
this.autoFieldClass=autoFieldClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setId(java.lang.String)
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id=id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setObjectConverter(com.idcanet.vasc.core.VascEntryFieldType.ObjectConverter)
|
||||
*/
|
||||
public void setObjectConverter(ObjectConverter objectConverter) {
|
||||
this.objectConverter=objectConverter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setParentEntryFieldTypeName(java.lang.String)
|
||||
*/
|
||||
public void setParentEntryFieldTypeName(String parentEntryFieldTypeName) {
|
||||
this.parentEntryFieldTypeName=parentEntryFieldTypeName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setProperty(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void setProperty(String name, String value) {
|
||||
properties.put(name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent)
|
||||
*/
|
||||
public void setVascUIComponent(VascUIComponent vascUIComponent) {
|
||||
this.vascUIComponent=vascUIComponent;
|
||||
}
|
||||
}
|
54
src/com/idcanet/vasc/core/VascController.java
Normal file
54
src/com/idcanet/vasc/core/VascController.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.core;
|
||||
|
||||
|
||||
/**
|
||||
* Resolvs all the resolvers.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 11, 2008
|
||||
*/
|
||||
public interface VascController {
|
||||
|
||||
/**
|
||||
* @return Returns the VascBackendControllerResolver
|
||||
*/
|
||||
public VascBackendControllerResolver getVascBackendControllerResolver();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns the VascEntryControllerResolver
|
||||
*/
|
||||
public VascEntryControllerResolver getVascEntryControllerResolver();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Returns the VascEntryFieldControllerResolver
|
||||
*/
|
||||
public VascEntryFieldTypeControllerResolver getVascEntryFieldTypeControllerResolver();
|
||||
}
|
|
@ -31,7 +31,6 @@ import java.util.List;
|
|||
import com.idcanet.vasc.core.actions.ColumnVascAction;
|
||||
import com.idcanet.vasc.core.actions.GlobalVascAction;
|
||||
import com.idcanet.vasc.core.actions.RowVascAction;
|
||||
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -45,7 +44,7 @@ import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public interface VascEntry {
|
||||
public interface VascEntry extends Cloneable {
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
|
@ -130,22 +129,22 @@ public interface VascEntry {
|
|||
/**
|
||||
* @return the primaryKeyField
|
||||
*/
|
||||
public String getPrimaryKeyField();
|
||||
public String getPrimaryKeyFieldId();
|
||||
|
||||
/**
|
||||
* @param primaryKeyField the primaryKeyField to set
|
||||
*/
|
||||
public void setPrimaryKeyField(String primaryKeyField);
|
||||
public void setPrimaryKeyFieldId(String primaryKeyField);
|
||||
|
||||
/**
|
||||
* @return the displayNameField
|
||||
*/
|
||||
public String getDisplayNameField();
|
||||
public String getDisplayNameFieldId();
|
||||
|
||||
/**
|
||||
* @param displayNameField the displayNameField to set
|
||||
*/
|
||||
public void setDisplayNameField(String displayNameField);
|
||||
public void setDisplayNameFieldId(String displayNameField);
|
||||
|
||||
/**
|
||||
* @return the vascAdmimList
|
||||
|
@ -203,85 +202,10 @@ public interface VascEntry {
|
|||
public void removeVascEntryField(VascEntryField vascField);
|
||||
|
||||
/**
|
||||
* @return the entryDataList
|
||||
* @return the vascField
|
||||
*/
|
||||
public List<Object> getEntryDataList();
|
||||
|
||||
/**
|
||||
* @param entryDataList the entryDataList to set
|
||||
*/
|
||||
public void setEntryDataList(List<Object> entryDataList);
|
||||
|
||||
/**
|
||||
* @return the entryDataObject
|
||||
*/
|
||||
public Object getEntryDataObject();
|
||||
|
||||
/**
|
||||
* @param entryDataObject the entryDataObject to set
|
||||
*/
|
||||
public void setEntryDataObject(Object entryDataObject);
|
||||
|
||||
/**
|
||||
* @return the vascBackend
|
||||
*/
|
||||
public VascBackend getVascBackend();
|
||||
|
||||
/**
|
||||
* @param vascBackend the vascBackend to set
|
||||
*/
|
||||
public void setVascBackend(VascBackend vascBackend);
|
||||
|
||||
/**
|
||||
* @return the vascFrontend
|
||||
*/
|
||||
public VascFrontend getVascFrontend();
|
||||
|
||||
/**
|
||||
* @param vascFrontend the vascFrontend to set
|
||||
*/
|
||||
public void setVascFrontend(VascFrontend vascFrontend);
|
||||
|
||||
/**
|
||||
* @return the vascBackendController
|
||||
*/
|
||||
public VascBackendController getVascBackendController();
|
||||
|
||||
/**
|
||||
* @param vascBackendController the vascBackendController to set
|
||||
*/
|
||||
public void setVascBackendController(VascBackendController vascBackendController);
|
||||
|
||||
/**
|
||||
* @return the vascEntryController
|
||||
*/
|
||||
public VascEntryController getVascEntryController();
|
||||
|
||||
/**
|
||||
* @param vascEntryController the vascEntryController to set
|
||||
*/
|
||||
public void setVascEntryController(VascEntryController vascEntryController);
|
||||
|
||||
/**
|
||||
* @return the vascFrontendController
|
||||
*/
|
||||
public VascFrontendController getVascFrontendController();
|
||||
|
||||
/**
|
||||
* @param vascFrontendController the vascFrontendController to set
|
||||
*/
|
||||
public void setVascFrontendController(VascFrontendController vascFrontendController);
|
||||
|
||||
/**
|
||||
* @return the vascEntryResourceResolver
|
||||
*/
|
||||
public VascEntryResourceResolver getVascEntryResourceResolver();
|
||||
|
||||
/**
|
||||
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
|
||||
*/
|
||||
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver);
|
||||
|
||||
public VascEntryField getVascEntryFieldById(String id);
|
||||
|
||||
/**
|
||||
* @return the rowActions
|
||||
*/
|
||||
|
@ -360,4 +284,7 @@ public interface VascEntry {
|
|||
public Object getEntryParameter(String key);
|
||||
public void setEntryParameter(String key,Object value);
|
||||
public List<String> getEntryParameterKeys();
|
||||
|
||||
public VascFrontendData getVascFrontendData();
|
||||
public void setVascFrontendData(VascFrontendData vascFrontendData);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
package com.idcanet.vasc.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -35,4 +37,6 @@ package com.idcanet.vasc.core;
|
|||
public interface VascEntryController {
|
||||
|
||||
public VascEntry getVascEntry(String name);
|
||||
|
||||
public List<String> getVascEntryNames();
|
||||
}
|
|
@ -39,8 +39,8 @@ import com.idcanet.vasc.validators.VascValidator;
|
|||
*/
|
||||
public interface VascEntryFieldType {
|
||||
|
||||
public String getName();
|
||||
public void setName(String name);
|
||||
public String getId();
|
||||
public void setId(String id);
|
||||
|
||||
public Class<?> getAutoFieldClass();
|
||||
public void setAutoFieldClass(Class<?> classObject);
|
||||
|
|
42
src/com/idcanet/vasc/core/VascEntryFieldTypeController.java
Normal file
42
src/com/idcanet/vasc/core/VascEntryFieldTypeController.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 4, 2008
|
||||
*/
|
||||
public interface VascEntryFieldTypeController {
|
||||
|
||||
public VascEntryFieldType getVascEntryFieldType(String name);
|
||||
|
||||
public List<String> getVascEntryFieldTypeNames();
|
||||
}
|
|
@ -32,7 +32,7 @@ package com.idcanet.vasc.core;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 4, 2008
|
||||
*/
|
||||
public interface VascFrontendControllerResolver {
|
||||
public interface VascEntryFieldTypeControllerResolver {
|
||||
|
||||
public VascFrontendController getVascFrontendController();
|
||||
public VascEntryFieldTypeController getVascEntryFieldTypeController();
|
||||
}
|
|
@ -30,11 +30,9 @@ package com.idcanet.vasc.core;
|
|||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 4, 2008
|
||||
* @version 1.0 Sep 9, 2008
|
||||
*/
|
||||
public interface VascFrontendController {
|
||||
public interface VascEntryFinalizer {
|
||||
|
||||
public VascFrontend getVascFrontend(String name);
|
||||
|
||||
public VascFrontendHelper getVascFrontendHelper();
|
||||
public void finalizeVascEntry(VascEntry table) throws Exception;
|
||||
}
|
100
src/com/idcanet/vasc/core/VascFrontendData.java
Normal file
100
src/com/idcanet/vasc/core/VascFrontendData.java
Normal file
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @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
|
||||
*/
|
||||
public List<Object> getEntryDataList();
|
||||
|
||||
/**
|
||||
* @param entryDataList the entryDataList to set
|
||||
*/
|
||||
public void setEntryDataList(List<Object> entryDataList);
|
||||
|
||||
/**
|
||||
* @return the entryDataObject
|
||||
*/
|
||||
public Object getEntryDataObject();
|
||||
|
||||
/**
|
||||
* @param entryDataObject the entryDataObject to set
|
||||
*/
|
||||
public void setEntryDataObject(Object entryDataObject);
|
||||
|
||||
/**
|
||||
* @return the vascFrontend
|
||||
*/
|
||||
public VascFrontend getVascFrontend();
|
||||
|
||||
/**
|
||||
* @param vascFrontend the vascFrontend to set
|
||||
*/
|
||||
public void setVascFrontend(VascFrontend vascFrontend);
|
||||
|
||||
/**
|
||||
* @return the VascFrontendHelper
|
||||
*/
|
||||
public VascFrontendHelper getVascFrontendHelper();
|
||||
|
||||
/**
|
||||
* @param vascFrontendHelper The VascFrontendHelper to set.
|
||||
*/
|
||||
public void setVascFrontendHelper(VascFrontendHelper vascFrontendHelper);
|
||||
|
||||
/**
|
||||
* @return the vascEntryResourceResolver
|
||||
*/
|
||||
public VascEntryResourceResolver getVascEntryResourceResolver();
|
||||
|
||||
/**
|
||||
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
|
||||
*/
|
||||
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver);
|
||||
}
|
|
@ -36,10 +36,6 @@ import com.idcanet.vasc.core.entry.VascEntryEventListener;
|
|||
*/
|
||||
public interface VascFrontendHelper {
|
||||
|
||||
public void finalizeVascEntry(VascEntry table) throws Exception;
|
||||
|
||||
public void finalizeVascEntryFields(VascEntry table) throws Exception;
|
||||
|
||||
public Integer getTotalColumnsWidth(VascEntry table);
|
||||
|
||||
public void refreshData(VascEntry table) throws Exception;
|
||||
|
|
|
@ -106,16 +106,14 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
|
||||
|
||||
public void initEntry(VascEntry entry) throws Exception {
|
||||
if (entry.getVascFrontend()==null) {
|
||||
entry.setVascFrontend(this);
|
||||
if (entry.getVascFrontendData().getVascFrontend()==null) {
|
||||
entry.getVascFrontendData().setVascFrontend(this);
|
||||
} else {
|
||||
if (entry.getVascFrontend()!=this) {
|
||||
if (entry.getVascFrontendData().getVascFrontend()!=this) {
|
||||
throw new IllegalArgumentException("VascEntry has already a differtent VascViewRenderer attected");
|
||||
}
|
||||
}
|
||||
entry.getVascFrontendController().getVascFrontendHelper().finalizeVascEntry(entry);
|
||||
entry.getVascFrontendController().getVascFrontendHelper().finalizeVascEntryFields(entry);
|
||||
entry.getVascFrontendController().getVascFrontendHelper().refreshData(entry);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
|
||||
/*
|
||||
entry.putUIComponent(VascTextField.class, SwingTextField.class);
|
||||
entry.putUIComponent(VascList.class, SwingList.class);
|
||||
|
@ -129,7 +127,7 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
|
||||
public ImageIcon getImageIcon(String imageResource) {
|
||||
/// TODO hack beter
|
||||
String key = entry.getVascEntryResourceResolver().getTextValue(imageResource);
|
||||
String key = entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(imageResource);
|
||||
//logger.fine("KEY======================="+key);
|
||||
|
||||
if (key.indexOf("META-INF")>0 | key.indexOf("resource")>0) {
|
||||
|
@ -149,10 +147,13 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
|
||||
|
||||
|
||||
rowBean = entry.getVascFrontendController().getVascFrontendHelper().initEditObject(entry, rowBean);
|
||||
rowBean = entry.getVascFrontendData().getVascFrontendHelper().initEditObject(entry, rowBean);
|
||||
String beanValue = rowBean.toString();
|
||||
if (entry.getDisplayNameField()!=null) {
|
||||
Object vv = entry.getUIIdentifierVascEntryColomn().getVascColumnValue().getValue(entry.getUIIdentifierVascEntryColomn(), rowBean);
|
||||
if (entry.getDisplayNameFieldId()!=null) {
|
||||
|
||||
VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId());
|
||||
|
||||
Object vv = v.getVascEntryFieldValue().getValue(v, rowBean);
|
||||
if (vv==null) {
|
||||
beanValue="";
|
||||
} else {
|
||||
|
@ -162,27 +163,28 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
beanValue=beanValue.substring(0, 30);
|
||||
}
|
||||
}
|
||||
SwingEditDialog dialog = new SwingEditDialog(parent,entry,rowBean,entry.getVascEntryResourceResolver().getTextValue("vasc.dialog.edit.title"),entry.getVascTextValue().getTextValue("vasc.dialog.edit.message",beanValue));
|
||||
SwingEditDialog dialog = new SwingEditDialog(parent,entry,rowBean,entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue("vasc.dialog.edit.title"),entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue("vasc.dialog.edit.message",beanValue));
|
||||
Object result = dialog.openDialog();
|
||||
logger.finest("OPEN closed : "+result);
|
||||
if(result==null) {
|
||||
return;
|
||||
}
|
||||
entry.getVascFrontendController().getVascFrontendHelper().mergeObject(entry, result);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry, result);
|
||||
}
|
||||
|
||||
public void renderDelete(Object rowBean) throws Exception {
|
||||
String beanValue = rowBean.toString();
|
||||
if (entry.getUIIdentifierVascEntryColomn()!=null) {
|
||||
beanValue = ""+entry.getUIIdentifierVascEntryColomn().getVascColumnValue().getValue(entry.getUIIdentifierVascEntryColomn(), rowBean);
|
||||
if (entry.getDisplayNameFieldId()!=null) {
|
||||
VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId());
|
||||
beanValue = ""+v.getVascEntryFieldValue().getValue(v, rowBean);
|
||||
if (beanValue.length()>30) {
|
||||
beanValue=beanValue.substring(0, 30);
|
||||
}
|
||||
}
|
||||
int response = JOptionPane.showOptionDialog(
|
||||
parent // Center in window.
|
||||
, entry.getVascEntryResourceResolver().getTextValue("vasc.dialog.delete.message",beanValue) // Message
|
||||
, entry.getVascEntryResourceResolver().getTextValue("vasc.dialog.delete.title") // Title in titlebar
|
||||
, entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue("vasc.dialog.delete.message",beanValue) // Message
|
||||
, entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue("vasc.dialog.delete.title") // Title in titlebar
|
||||
, JOptionPane.YES_NO_OPTION // Option type
|
||||
, JOptionPane.PLAIN_MESSAGE // messageType
|
||||
, null // Icon (none)
|
||||
|
@ -190,10 +192,10 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
, null // Default button's label
|
||||
);
|
||||
if (response==JOptionPane.YES_OPTION) {
|
||||
entry.getVascBackend().delete(rowBean);
|
||||
entry.getEntryDataList().remove(rowBean);
|
||||
entry.setEntryDataObject(null);
|
||||
entry.getVascFrontendController().getVascFrontendHelper().fireVascEvent(VascEventListener.VascEventType.DATA_UPDATE, rowBean);
|
||||
entry.getVascFrontendData().getVascBackend().delete(rowBean);
|
||||
entry.getVascFrontendData().getEntryDataList().remove(rowBean);
|
||||
entry.getVascFrontendData().setEntryDataObject(null);
|
||||
//entry.getVascFrontendController().getVascFrontendHelper().fireVascEvent(VascEventListener.VascEventType.DATA_UPDATE, rowBean);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,7 +212,7 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
this.headerText = headerText;
|
||||
this.bean = bean;
|
||||
|
||||
setTitle(entry.getVascEntryResourceResolver().getTextValue(title));
|
||||
setTitle(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(title));
|
||||
setModal(true);
|
||||
|
||||
JPanel pane = new JPanel();
|
||||
|
@ -250,7 +252,7 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
|
||||
public void createHeader(JPanel header) {
|
||||
JLabel l = new JLabel();
|
||||
l.setText(entry.getVascEntryResourceResolver().getTextValue(headerText));
|
||||
l.setText(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(headerText));
|
||||
l.setFont(new Font(null,Font.BOLD, 14));
|
||||
//l.setToolTipText(entry.getVascTextValue().getTextValue(headerText));
|
||||
header.add(l);
|
||||
|
@ -260,7 +262,7 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
body.setLayout(new SpringLayout());
|
||||
int column = 0;
|
||||
for(VascEntryField c:entry.getVascEntryFields()) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().initEditObjectColumn(c, bean);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().initEditObjectColumn(c, bean);
|
||||
if (c.isEdit()==false) {
|
||||
continue;
|
||||
}
|
||||
|
@ -269,16 +271,16 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
JLabel l = new JLabel();
|
||||
l.setHorizontalAlignment(JLabel.TRAILING);
|
||||
|
||||
l.setText(entry.getVascEntryResourceResolver().getTextValue(c.getName()));
|
||||
l.setText(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(c.getName()));
|
||||
if(c.getDescription()!=null) {
|
||||
l.setToolTipText(entry.getVascEntryResourceResolver().getTextValue(c.getDescription()));
|
||||
l.setToolTipText(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(c.getDescription()));
|
||||
}
|
||||
body.add(l);
|
||||
|
||||
if (c.isEditReadOnly()==true) {
|
||||
JLabel valueLabel = new JLabel();
|
||||
valueLabel.setText(""+c.getVascEntryFieldValue().getValue(c, bean));
|
||||
c.setColumnEditor(valueLabel);
|
||||
//c.setColumnEditor(valueLabel);
|
||||
body.add(valueLabel);
|
||||
continue;
|
||||
}
|
||||
|
@ -286,7 +288,7 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
if(c.getVascEntryFieldType().getVascUIComponent()==null) {
|
||||
JLabel valueLabel = new JLabel();
|
||||
valueLabel.setText(""+c.getVascEntryFieldValue().getValue(c, bean));
|
||||
c.setColumnEditor(valueLabel);
|
||||
//c.setColumnEditor(valueLabel);
|
||||
body.add(valueLabel);
|
||||
} else {
|
||||
VascUIComponent comp = c.getVascEntryFieldType().getVascUIComponent();
|
||||
|
@ -294,7 +296,7 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
model.setValue(c.getVascEntryFieldValue().getValue(c, bean));
|
||||
model.addListener(new VascColumnValueModelListener(c,bean));
|
||||
comp.createComponent(entry, model, body);
|
||||
c.setColumnEditor(comp);
|
||||
//c.setColumnEditor(comp);
|
||||
}
|
||||
}
|
||||
//JComponent, rows, cols, initX, initY ,xPad, yPad
|
||||
|
@ -305,11 +307,11 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
|
||||
JButton saveButton = new JButton();
|
||||
saveButton.setIcon(getImageIcon("vasc.dialog.save.image"));
|
||||
saveButton.setText(entry.getVascEntryResourceResolver().getTextValue("vasc.dialog.save.name"));
|
||||
saveButton.setToolTipText(entry.getVascEntryResourceResolver().getTextValue("vasc.dialog.save.tooltip"));
|
||||
saveButton.setText(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue("vasc.dialog.save.name"));
|
||||
saveButton.setToolTipText(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue("vasc.dialog.save.tooltip"));
|
||||
saveButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if(entry.getVascFrontendController().getVascFrontendHelper().setUIComponentsBeanErrors(entry, bean)) {
|
||||
if(entry.getVascFrontendData().getVascFrontendHelper().setUIComponentsBeanErrors(entry, bean)) {
|
||||
return;
|
||||
}
|
||||
result = bean;
|
||||
|
@ -320,8 +322,8 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
|
||||
JButton cancelButton = new JButton();
|
||||
cancelButton.setIcon(getImageIcon("vasc.dialog.cancel.image"));
|
||||
cancelButton.setText(entry.getVascEntryResourceResolver().getTextValue("vasc.dialog.cancel.name"));
|
||||
cancelButton.setToolTipText(entry.getVascEntryResourceResolver().getTextValue("vasc.dialog.cancel.tooltip"));
|
||||
cancelButton.setText(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue("vasc.dialog.cancel.name"));
|
||||
cancelButton.setToolTipText(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue("vasc.dialog.cancel.tooltip"));
|
||||
cancelButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
result = null;
|
||||
|
@ -361,7 +363,7 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
try {
|
||||
exporter.doExport(out, entry);
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(e, entry);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(e, entry);
|
||||
} finally {
|
||||
if (out!=null) {
|
||||
out.close();
|
||||
|
@ -410,17 +412,17 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
// TODO: hack images working
|
||||
l.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(entry.getHeaderImage())).getScaledInstance(32, 32, Image.SCALE_SMOOTH)));
|
||||
if (entry.getHeaderDescription()!=null) {
|
||||
l.setToolTipText(entry.getVascEntryResourceResolver().getTextValue(entry.getHeaderDescription()));
|
||||
l.setToolTipText(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(entry.getHeaderDescription()));
|
||||
}
|
||||
header.add(l,BorderLayout.WEST);
|
||||
}
|
||||
|
||||
if(entry.getHeaderName()!=null) {
|
||||
JLabel l = new JLabel(entry.getVascEntryResourceResolver().getTextValue(entry.getHeaderName()));
|
||||
JLabel l = new JLabel(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(entry.getHeaderName()));
|
||||
l.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
l.setFont(new Font(null,Font.BOLD, 18));
|
||||
if (entry.getHeaderDescription()!=null) {
|
||||
l.setToolTipText(entry.getVascEntryResourceResolver().getTextValue(entry.getHeaderDescription()));
|
||||
l.setToolTipText(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(entry.getHeaderDescription()));
|
||||
}
|
||||
header.add(l,BorderLayout.CENTER);
|
||||
}
|
||||
|
@ -429,8 +431,8 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
//top.setBackground(Color.BLUE);
|
||||
for (GlobalVascAction action:entry.getGlobalActions()) {
|
||||
JButton but = new JButton();
|
||||
but.setText(entry.getVascEntryResourceResolver().getTextValue(action.getName()));
|
||||
but.setToolTipText(entry.getVascEntryResourceResolver().getTextValue(action.getToolTip()));
|
||||
but.setText(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(action.getName()));
|
||||
but.setToolTipText(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(action.getToolTip()));
|
||||
but.addActionListener(new GlobalActionListener(action));
|
||||
but.setIcon(getImageIcon(action.getImage()));
|
||||
top.add(but);
|
||||
|
@ -481,7 +483,11 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
continue;
|
||||
}
|
||||
TableColumn t = new TableColumn();
|
||||
t.setPreferredWidth(c.getSizeList());
|
||||
if (c.getSizeList()!=null) {
|
||||
t.setPreferredWidth(c.getSizeList());
|
||||
} else {
|
||||
t.setPreferredWidth(200);
|
||||
}
|
||||
t.setHeaderValue(c);
|
||||
t.setHeaderRenderer(renderer);
|
||||
t.setModelIndex(counter);
|
||||
|
@ -493,15 +499,15 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
table.addMouseListener(new MouseAdapter() {
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (e.getClickCount() == 2) {
|
||||
Object o = entry.getEntryDataObject();
|
||||
Object o = entry.getVascFrontendData().getEntryDataObject();
|
||||
if (o==null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// TODO: fix this
|
||||
entry.getVascFrontend().renderEdit(o);
|
||||
entry.getVascFrontendData().getVascFrontend().renderEdit(o);
|
||||
} catch (Exception ee) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(ee, entry);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(ee, entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -524,10 +530,10 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
if (rowIndex!=-1) {
|
||||
// temp; gets index by sorter
|
||||
rowIndex = tableSorter.modelIndex(rowIndex);
|
||||
Object data = entry.getEntryDataList().get(rowIndex);
|
||||
entry.setEntryDataObject(data);
|
||||
Object data = entry.getVascFrontendData().getEntryDataList().get(rowIndex);
|
||||
entry.getVascFrontendData().setEntryDataObject(data);
|
||||
} else {
|
||||
entry.setEntryDataObject(null);
|
||||
entry.getVascFrontendData().setEntryDataObject(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -535,8 +541,8 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
private static final long serialVersionUID = 10L;
|
||||
public Component getentryCellRendererComponent(JTable table, Object value, boolean isSelected,boolean hasFocus, int row, int column) {
|
||||
VascEntryField c = (VascEntryField)value;
|
||||
setText(c.getVascEntry().getVascEntryResourceResolver().getTextValue(c.getName()));
|
||||
setToolTipText(c.getVascEntry().getVascEntryResourceResolver().getTextValue(c.getDescription()));
|
||||
setText(c.getVascEntry().getVascFrontendData().getVascEntryResourceResolver().getTextValue(c.getName()));
|
||||
setToolTipText(c.getVascEntry().getVascFrontendData().getVascEntryResourceResolver().getTextValue(c.getDescription()));
|
||||
|
||||
if(c.getImage()!=null) {
|
||||
setIcon(getImageIcon(c.getImage()));
|
||||
|
@ -563,8 +569,8 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
JPanel panel = new JPanel();
|
||||
for(RowVascAction action:entry.getRowActions()) {
|
||||
JButton but = new JButton();
|
||||
but.setText(entry.getVascEntryResourceResolver().getTextValue(action.getName()));
|
||||
but.setToolTipText(entry.getVascEntryResourceResolver().getTextValue(action.getToolTip()));
|
||||
but.setText(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(action.getName()));
|
||||
but.setToolTipText(entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(action.getToolTip()));
|
||||
but.setIcon(getImageIcon(action.getImage()));
|
||||
but.addActionListener(new RowActionListener(action));
|
||||
panel.add(but);
|
||||
|
@ -585,9 +591,9 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
public void actionPerformed(ActionEvent event) {
|
||||
logger.fine("Row Action");
|
||||
try {
|
||||
action.doRowAction(entry, entry.getEntryDataObject());
|
||||
action.doRowAction(entry, entry.getVascFrontendData().getEntryDataObject());
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(e, entry);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(e, entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -605,12 +611,12 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
try {
|
||||
action.doGlobalAction(entry);
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(e, entry);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(e, entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class VascColumnModel extends AbstractTableModel implements VascEventListener {
|
||||
class VascColumnModel extends AbstractTableModel { //implements VascEventListener {
|
||||
private static final long serialVersionUID = 10L;
|
||||
|
||||
public void vascEvent(VascEventType e,Object o) {
|
||||
|
@ -637,17 +643,17 @@ public class SwingVascFrontend implements VascFrontend {
|
|||
* @see javax.swing.entry.entryModel#getRowCount()
|
||||
*/
|
||||
public int getRowCount() {
|
||||
if (entry.getEntryDataList()==null) {
|
||||
if (entry.getVascFrontendData().getEntryDataList()==null) {
|
||||
return 0;
|
||||
}
|
||||
return entry.getEntryDataList().size();
|
||||
return entry.getVascFrontendData().getEntryDataList().size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.swing.entry.entryModel#getValueAt(int, int)
|
||||
*/
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
Object bean = entry.getEntryDataList().get(rowIndex);
|
||||
Object bean = entry.getVascFrontendData().getEntryDataList().get(rowIndex);
|
||||
logger.finer("Rending column; "+columnIndex+" bean: "+bean);
|
||||
|
||||
// TODO: this is slowing....
|
||||
|
|
|
@ -65,6 +65,7 @@ import org.eclipse.swt.widgets.ToolItem;
|
|||
|
||||
import com.idcanet.fff.SwingImageHelper;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascFrontend;
|
||||
import com.idcanet.vasc.core.actions.GlobalVascAction;
|
||||
import com.idcanet.vasc.core.actions.RowVascAction;
|
||||
|
||||
|
|
87
src/com/idcanet/vasc/impl/DefaultVascController.java
Normal file
87
src/com/idcanet/vasc/impl/DefaultVascController.java
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.impl;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackendControllerResolver;
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntryControllerResolver;
|
||||
import com.idcanet.vasc.core.VascEntryFieldTypeControllerResolver;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 11, 2008
|
||||
*/
|
||||
public class DefaultVascController implements VascController {
|
||||
|
||||
private VascBackendControllerResolver vascBackendControllerResolver = null;
|
||||
private VascEntryControllerResolver vascEntryControllerResolver = null;
|
||||
private VascEntryFieldTypeControllerResolver vascEntryFieldTypeControllerResolver = null;
|
||||
|
||||
/**
|
||||
* @return the vascBackendControllerResolver
|
||||
*/
|
||||
public VascBackendControllerResolver getVascBackendControllerResolver() {
|
||||
return vascBackendControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascBackendControllerResolver the vascBackendControllerResolver to set
|
||||
*/
|
||||
public void setVascBackendControllerResolver(VascBackendControllerResolver vascBackendControllerResolver) {
|
||||
this.vascBackendControllerResolver = vascBackendControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryControllerResolver
|
||||
*/
|
||||
public VascEntryControllerResolver getVascEntryControllerResolver() {
|
||||
return vascEntryControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryControllerResolver the vascEntryControllerResolver to set
|
||||
*/
|
||||
public void setVascEntryControllerResolver(VascEntryControllerResolver vascEntryControllerResolver) {
|
||||
this.vascEntryControllerResolver = vascEntryControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryFieldControllerResolver
|
||||
*/
|
||||
public VascEntryFieldTypeControllerResolver getVascEntryFieldTypeControllerResolver() {
|
||||
return vascEntryFieldTypeControllerResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryFieldControllerResolver the vascEntryFieldControllerResolver to set
|
||||
*/
|
||||
public void setVascEntryFieldTypeControllerResolver(VascEntryFieldTypeControllerResolver vascEntryFieldTypeControllerResolver) {
|
||||
this.vascEntryFieldTypeControllerResolver = vascEntryFieldTypeControllerResolver;
|
||||
}
|
||||
}
|
|
@ -31,22 +31,17 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackend;
|
||||
import com.idcanet.vasc.core.VascBackendController;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryController;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascEntryFieldSet;
|
||||
import com.idcanet.vasc.core.VascFrontend;
|
||||
import com.idcanet.vasc.core.VascFrontendController;
|
||||
import com.idcanet.vasc.core.VascFrontendData;
|
||||
import com.idcanet.vasc.core.VascLinkEntry;
|
||||
import com.idcanet.vasc.core.actions.ColumnVascAction;
|
||||
import com.idcanet.vasc.core.actions.GlobalVascAction;
|
||||
import com.idcanet.vasc.core.actions.RowVascAction;
|
||||
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
|
||||
|
||||
|
||||
/**
|
||||
* VascEntry
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
|
@ -64,8 +59,8 @@ public class DefaultVascEntry implements VascEntry {
|
|||
private String headerImage = null;
|
||||
private String headerDescription = null;
|
||||
|
||||
private String primaryKeyField = null;
|
||||
private String displayNameField = null;
|
||||
private String primaryKeyFieldId = null;
|
||||
private String displayNameFieldId = null;
|
||||
|
||||
private boolean vascAdmimList = true;
|
||||
private boolean vascAdmimEdit = true;
|
||||
|
@ -73,15 +68,6 @@ public class DefaultVascEntry implements VascEntry {
|
|||
private boolean vascAdmimDelete = true;
|
||||
|
||||
private List<VascEntryField> vascFields = null;
|
||||
private List<Object> entryDataList = null;
|
||||
private Object entryDataObject = null;
|
||||
private VascBackend vascBackend = null;
|
||||
private VascFrontend vascFrontend = null;
|
||||
|
||||
private VascBackendController vascBackendController = null;
|
||||
private VascEntryController vascEntryController = null;
|
||||
private VascFrontendController vascFrontendController = null;
|
||||
private VascEntryResourceResolver vascEntryResourceResolver = null;
|
||||
|
||||
private List<RowVascAction> rowActions = null;
|
||||
private List<ColumnVascAction> columnActions = null;
|
||||
|
@ -91,10 +77,13 @@ public class DefaultVascEntry implements VascEntry {
|
|||
private List<VascLinkEntry> vascLinkEntries = null;
|
||||
private Map<String,Object> entryParameters = null;
|
||||
|
||||
private VascFrontendData vascFrontendData = null;
|
||||
|
||||
/**
|
||||
* Te constructor
|
||||
*/
|
||||
public DefaultVascEntry() {
|
||||
vascFields = new ArrayList<VascEntryField>(10);
|
||||
entryDataList = new ArrayList<Object>(0);
|
||||
vascFields = new ArrayList<VascEntryField>(10);
|
||||
|
||||
rowActions = new ArrayList<RowVascAction>(10);
|
||||
columnActions = new ArrayList<ColumnVascAction>(10);
|
||||
|
@ -105,7 +94,17 @@ public class DefaultVascEntry implements VascEntry {
|
|||
entryParameters = new HashMap<String,Object>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#clone()
|
||||
*/
|
||||
@Override
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
|
@ -219,31 +218,31 @@ public class DefaultVascEntry implements VascEntry {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the primaryKeyField
|
||||
* @return the primaryKeyFieldId
|
||||
*/
|
||||
public String getPrimaryKeyField() {
|
||||
return primaryKeyField;
|
||||
public String getPrimaryKeyFieldId() {
|
||||
return primaryKeyFieldId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param primaryKeyField the primaryKeyField to set
|
||||
* @param primaryKeyFieldId the primaryKeyFieldId to set
|
||||
*/
|
||||
public void setPrimaryKeyField(String primaryKeyField) {
|
||||
this.primaryKeyField = primaryKeyField;
|
||||
public void setPrimaryKeyFieldId(String primaryKeyFieldId) {
|
||||
this.primaryKeyFieldId = primaryKeyFieldId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the displayNameField
|
||||
* @return the displayNameFieldId
|
||||
*/
|
||||
public String getDisplayNameField() {
|
||||
return displayNameField;
|
||||
public String getDisplayNameFieldId() {
|
||||
return displayNameFieldId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param displayNameField the displayNameField to set
|
||||
* @param displayNameFieldId the displayNameFieldId to set
|
||||
*/
|
||||
public void setDisplayNameField(String displayNameField) {
|
||||
this.displayNameField = displayNameField;
|
||||
public void setDisplayNameFieldId(String displayNameFieldId) {
|
||||
this.displayNameFieldId = displayNameFieldId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -324,117 +323,17 @@ public class DefaultVascEntry implements VascEntry {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the entryDataList
|
||||
* @see com.idcanet.vasc.core.VascEntry#getVascEntryFieldById(java.lang.String)
|
||||
*/
|
||||
public List<Object> getEntryDataList() {
|
||||
return entryDataList;
|
||||
public VascEntryField getVascEntryFieldById(String id) {
|
||||
for (VascEntryField v:vascFields) {
|
||||
if (v.getId().equals(id)) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Id not found as field");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entryDataList the entryDataList to set
|
||||
*/
|
||||
public void setEntryDataList(List<Object> entryDataList) {
|
||||
this.entryDataList = entryDataList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the entryDataObject
|
||||
*/
|
||||
public Object getEntryDataObject() {
|
||||
return entryDataObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entryDataObject the entryDataObject to set
|
||||
*/
|
||||
public void setEntryDataObject(Object entryDataObject) {
|
||||
this.entryDataObject = entryDataObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascBackend
|
||||
*/
|
||||
public VascBackend getVascBackend() {
|
||||
return vascBackend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascBackend the vascBackend to set
|
||||
*/
|
||||
public void setVascBackend(VascBackend vascBackend) {
|
||||
this.vascBackend = vascBackend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascFrontend
|
||||
*/
|
||||
public VascFrontend getVascFrontend() {
|
||||
return vascFrontend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascFrontend the vascFrontend to set
|
||||
*/
|
||||
public void setVascFrontend(VascFrontend vascFrontend) {
|
||||
this.vascFrontend = vascFrontend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascBackendController
|
||||
*/
|
||||
public VascBackendController getVascBackendController() {
|
||||
return vascBackendController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascBackendController the vascBackendController to set
|
||||
*/
|
||||
public void setVascBackendController(VascBackendController vascBackendController) {
|
||||
this.vascBackendController = vascBackendController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryController
|
||||
*/
|
||||
public VascEntryController getVascEntryController() {
|
||||
return vascEntryController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryController the vascEntryController to set
|
||||
*/
|
||||
public void setVascEntryController(VascEntryController vascEntryController) {
|
||||
this.vascEntryController = vascEntryController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascFrontendController
|
||||
*/
|
||||
public VascFrontendController getVascFrontendController() {
|
||||
return vascFrontendController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascFrontendController the vascFrontendController to set
|
||||
*/
|
||||
public void setVascFrontendController(VascFrontendController vascFrontendController) {
|
||||
this.vascFrontendController = vascFrontendController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryResourceResolver
|
||||
*/
|
||||
public VascEntryResourceResolver getVascEntryResourceResolver() {
|
||||
return vascEntryResourceResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
|
||||
*/
|
||||
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver) {
|
||||
this.vascEntryResourceResolver = vascEntryResourceResolver;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the rowActions
|
||||
*/
|
||||
|
@ -540,7 +439,6 @@ public class DefaultVascEntry implements VascEntry {
|
|||
vascLinkEntries.remove(vascLinkEntry);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntry#getEntryParameter(java.lang.String)
|
||||
*/
|
||||
|
@ -548,7 +446,6 @@ public class DefaultVascEntry implements VascEntry {
|
|||
return entryParameters.get(key);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntry#getEntryParameterKeys()
|
||||
*/
|
||||
|
@ -556,13 +453,24 @@ public class DefaultVascEntry implements VascEntry {
|
|||
return new ArrayList<String>(entryParameters.keySet());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntry#setEntryParameter(java.lang.String, java.lang.Object)
|
||||
*/
|
||||
public void setEntryParameter(String key, Object value) {
|
||||
entryParameters.put(key, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the vascFrontendData
|
||||
*/
|
||||
public VascFrontendData getVascFrontendData() {
|
||||
return vascFrontendData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascFrontendData the vascFrontendData to set
|
||||
*/
|
||||
public void setVascFrontendData(VascFrontendData vascFrontendData) {
|
||||
this.vascFrontendData = vascFrontendData;
|
||||
}
|
||||
}
|
156
src/com/idcanet/vasc/impl/DefaultVascFrontendData.java
Normal file
156
src/com/idcanet/vasc/impl/DefaultVascFrontendData.java
Normal file
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackend;
|
||||
import com.idcanet.vasc.core.VascEntryFinalizer;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class DefaultVascFrontendData implements VascFrontendData {
|
||||
|
||||
private VascBackend vascBackend = null;
|
||||
private List<Object> entryDataList = null;
|
||||
private Object entryDataObject = null;
|
||||
private VascFrontend vascFrontend = null;
|
||||
private VascEntryFinalizer vascEntryFinalizer = null;
|
||||
private VascFrontendHelper vascFrontendHelper = null;
|
||||
private VascEntryResourceResolver vascEntryResourceResolver = null;
|
||||
|
||||
public DefaultVascFrontendData() {
|
||||
entryDataList = new ArrayList<Object>(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public List<Object> getEntryDataList() {
|
||||
return entryDataList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entryDataList the entryDataList to set
|
||||
*/
|
||||
public void setEntryDataList(List<Object> entryDataList) {
|
||||
this.entryDataList = entryDataList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the entryDataObject
|
||||
*/
|
||||
public Object getEntryDataObject() {
|
||||
return entryDataObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entryDataObject the entryDataObject to set
|
||||
*/
|
||||
public void setEntryDataObject(Object entryDataObject) {
|
||||
this.entryDataObject = entryDataObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascFrontend
|
||||
*/
|
||||
public VascFrontend getVascFrontend() {
|
||||
return vascFrontend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascFrontend the vascFrontend to set
|
||||
*/
|
||||
public void setVascFrontend(VascFrontend vascFrontend) {
|
||||
this.vascFrontend = vascFrontend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackendData#getVascEntryFinalizer()
|
||||
*/
|
||||
public VascEntryFinalizer getVascEntryFinalizer() {
|
||||
return vascEntryFinalizer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackendData#setVascEntryFinalizer(com.idcanet.vasc.core.VascEntryFinalizer)
|
||||
*/
|
||||
public void setVascEntryFinalizer(VascEntryFinalizer vascEntryFinalizer) {
|
||||
this.vascEntryFinalizer=vascEntryFinalizer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascFrontendHelper
|
||||
*/
|
||||
public VascFrontendHelper getVascFrontendHelper() {
|
||||
return vascFrontendHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascFrontendHelper the vascFrontendHelper to set
|
||||
*/
|
||||
public void setVascFrontendHelper(VascFrontendHelper vascFrontendHelper) {
|
||||
this.vascFrontendHelper = vascFrontendHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascEntryResourceResolver
|
||||
*/
|
||||
public VascEntryResourceResolver getVascEntryResourceResolver() {
|
||||
return vascEntryResourceResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
|
||||
*/
|
||||
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver) {
|
||||
this.vascEntryResourceResolver = vascEntryResourceResolver;
|
||||
}
|
||||
}
|
|
@ -36,37 +36,204 @@ import org.hibernate.validator.ClassValidator;
|
|||
import org.hibernate.validator.InvalidValue;
|
||||
|
||||
import com.idcanet.vasc.annotations.VascAnnotationParser;
|
||||
import com.idcanet.vasc.core.VascEventListener;
|
||||
import com.idcanet.vasc.core.VascExceptionListener;
|
||||
import com.idcanet.vasc.core.VascTable;
|
||||
import com.idcanet.vasc.core.VascTableController;
|
||||
import com.idcanet.vasc.core.column.VascAnnotationTableColumn;
|
||||
import com.idcanet.vasc.core.column.VascTableColumn;
|
||||
import com.idcanet.vasc.core.ui.VascDate;
|
||||
import com.idcanet.vasc.core.ui.VascTextField;
|
||||
import com.idcanet.vasc.core.ui.VascToggle;
|
||||
import com.idcanet.vasc.impl.column.BeanPropertyVascColumnValue;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascFrontendHelper;
|
||||
import com.idcanet.vasc.core.entry.VascEntryEventListener;
|
||||
import com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 28, 2007
|
||||
*/
|
||||
public class DefaultVascTableController implements VascTableController {
|
||||
public class DefaultVascFrontendHelper implements VascFrontendHelper {
|
||||
|
||||
private Logger logger = null;
|
||||
private List<VascEventListener> eventListeners = null;
|
||||
private List<VascExceptionListener> exceptionListeners = null;
|
||||
//private List<VascEventListener> eventListeners = null;
|
||||
//private List<VascExceptionListener> exceptionListeners = null;
|
||||
|
||||
public DefaultVascTableController() {
|
||||
logger = Logger.getLogger(DefaultVascTableController.class.getName());
|
||||
eventListeners = new ArrayList<VascEventListener>(2);
|
||||
exceptionListeners = new ArrayList<VascExceptionListener>(2);
|
||||
public DefaultVascFrontendHelper() {
|
||||
logger = Logger.getLogger(DefaultVascFrontendHelper.class.getName());
|
||||
//eventListeners = new ArrayList<VascEventListener>(2);
|
||||
//exceptionListeners = new ArrayList<VascExceptionListener>(2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascTableController#finalizeVascColumns(com.idcanet.vasc.core.VascTable)
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#addEventListener(com.idcanet.vasc.core.entry.VascEntryEventListener)
|
||||
*/
|
||||
public void addEventListener(VascEntryEventListener e) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#addExceptionListener(com.idcanet.vasc.core.entry.VascEntryEventListener)
|
||||
*/
|
||||
public void addExceptionListener(VascEntryEventListener listener) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#fireVascEvent(com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType, java.lang.Object)
|
||||
*/
|
||||
public void fireVascEvent(VascEventType type, Object data) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#getTotalColumnsWidth(com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
public Integer getTotalColumnsWidth(VascEntry entry) {
|
||||
int result = 0;
|
||||
for(VascEntryField c:entry.getVascEntryFields()) {
|
||||
if(c.getSizeList()==null) {
|
||||
Logger.getLogger(VascEntry.class.getName()).finer("Column no size: "+c.getName());
|
||||
} else {
|
||||
result+=c.getSizeList();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#handleException(java.lang.Exception, com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
public void handleException(Exception e, VascEntry table) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
/*
|
||||
if (exceptionListeners.isEmpty()) {
|
||||
Logger.getLogger(DefaultVascTableController.class.getName()).log(Level.WARNING,e.getMessage(),e);
|
||||
return;
|
||||
}
|
||||
for(VascExceptionListener ee:exceptionListeners) {
|
||||
try {
|
||||
ee.handleException(e, table);
|
||||
} catch (Exception eee) {
|
||||
Logger.getLogger(DefaultVascTableController.class.getName()).log(Level.WARNING,"Error in ExceptionListener: "+eee.getMessage(),eee);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#initEditObject(com.idcanet.vasc.core.VascEntry, java.lang.Object)
|
||||
*/
|
||||
public Object initEditObject(VascEntry entry, Object object) throws Exception {
|
||||
if (object!=null) {
|
||||
return object;
|
||||
}
|
||||
object = entry.getVascFrontendData().getVascBackend().provideVascEntryRecordCreator(entry).newRecord(entry);
|
||||
//fireVascEvent(VascEventListener.VascEventType.BEAN_INIT, object);
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#initEditObjectColumn(com.idcanet.vasc.core.VascEntryField, java.lang.Object)
|
||||
*/
|
||||
public void initEditObjectColumn(VascEntryField field, Object bean) throws Exception {
|
||||
Object value = field.getVascEntryFieldValue().getValue(field, bean);
|
||||
if(value==null & field.getDefaultValue()!=null) {
|
||||
try {
|
||||
logger.finer("Setting default value for: "+field.getName()+" def: "+field.getDefaultValue());
|
||||
field.getVascEntryFieldValue().setValue(field, bean, field.getDefaultValue());
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.WARNING,"Error in setting default value: '"+field.getDefaultValue()+"' error: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#mergeObject(com.idcanet.vasc.core.VascEntry, java.lang.Object)
|
||||
*/
|
||||
public Object mergeObject(VascEntry entry, Object object) {
|
||||
Object result = null;
|
||||
try {
|
||||
object = entry.getVascFrontendData().getVascBackend().merge(object);
|
||||
//fireVascEvent(VascEventListener.VascEventType.BEAN_MERGE,object);
|
||||
// todo: make faster
|
||||
// add to table at position old old object
|
||||
// then remove old object
|
||||
// send refresh
|
||||
|
||||
refreshData(entry);
|
||||
} catch (Exception e) {
|
||||
handleException(e, entry);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#refreshData(com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
public void refreshData(VascEntry entry) throws Exception {
|
||||
entry.getVascFrontendData().setEntryDataObject(null);
|
||||
entry.getVascFrontendData().setEntryDataList(entry.getVascFrontendData().getVascBackend().execute());
|
||||
//fireVascEvent(VascEventListener.VascEventType.DATA_UPDATE, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#removeEventListener(com.idcanet.vasc.core.entry.VascEntryEventListener)
|
||||
*/
|
||||
public void removeEventListener(VascEntryEventListener e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#removeExceptionListener(com.idcanet.vasc.core.entry.VascEntryEventListener)
|
||||
*/
|
||||
public void removeExceptionListener(VascEntryEventListener listener) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendHelper#setUIComponentsBeanErrors(com.idcanet.vasc.core.VascEntry, java.lang.Object)
|
||||
*/
|
||||
public boolean setUIComponentsBeanErrors(VascEntry entry, Object bean) {
|
||||
boolean error = false;
|
||||
if(bean==null) {
|
||||
logger.finest("No bean to check.");
|
||||
return true; // nothing to check
|
||||
}
|
||||
|
||||
ClassValidator val = new ClassValidator(bean.getClass());
|
||||
InvalidValue[] ival = val.getInvalidValues(bean);
|
||||
logger.fine("Got invaliled value: "+ival.length);
|
||||
|
||||
for(VascEntryField col:entry.getVascEntryFields()) {
|
||||
/*
|
||||
if(col.getVascUIComponent()==null) {
|
||||
continue; // we only DISPLAY user input errors !!
|
||||
}
|
||||
if (col instanceof VascAnnotationTableColumn) {
|
||||
VascAnnotationTableColumn column = (VascAnnotationTableColumn)col;
|
||||
|
||||
InvalidValue iv = findInvalidValueByProperty(ival,column.getBeanProperty());
|
||||
if(iv==null) {
|
||||
column.getVascUIComponent().setErrorText(null);
|
||||
continue; // no error on this property
|
||||
}
|
||||
error = true;
|
||||
column.getVascUIComponent().setErrorText(iv.getMessage());
|
||||
}
|
||||
*/
|
||||
}
|
||||
logger.finest("Checked for errors: "+error);
|
||||
return error;
|
||||
}
|
||||
private InvalidValue findInvalidValueByProperty(InvalidValue[] ival,String property) {
|
||||
for(InvalidValue iv:ival) {
|
||||
if(iv.getPropertyName().equals(property)) {
|
||||
return iv;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
public void finalizeVascColumns(VascTable table) throws Exception {
|
||||
VascAnnotationParser vap = new VascAnnotationParser();
|
||||
|
||||
|
@ -116,76 +283,7 @@ public class DefaultVascTableController implements VascTableController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascTableController#finalizeVascTable(com.idcanet.vasc.core.VascTable)
|
||||
*/
|
||||
public void finalizeVascTable(VascTable table) throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascTableController#getTotalColumnsWidth(com.idcanet.vasc.core.VascTable)
|
||||
*/
|
||||
public Integer getTotalColumnsWidth(VascTable table) {
|
||||
int result = 0;
|
||||
for(VascTableColumn c:table.getTableColumns()) {
|
||||
if(c.getWidth()==null) {
|
||||
Logger.getLogger(VascTable.class.getName()).finer("Column no size: "+c.getName());
|
||||
} else {
|
||||
result+=c.getWidth();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascTableController#initEditObject(com.idcanet.vasc.core.VascTable, java.lang.Object)
|
||||
*/
|
||||
public Object initEditObject(VascTable table, Object object) throws Exception {
|
||||
if (object!=null) {
|
||||
return object;
|
||||
}
|
||||
object = table.getVascRecordCreator().newRecord(table);
|
||||
fireVascEvent(VascEventListener.VascEventType.BEAN_INIT, object);
|
||||
return object;
|
||||
}
|
||||
|
||||
public void initEditObjectColumn(VascTableColumn c,Object bean) throws Exception {
|
||||
Object value = c.getVascColumnValue().getValue(c, bean);
|
||||
if(value==null & c.getDefaultValue()!=null) {
|
||||
try {
|
||||
logger.finer("Setting default value for: "+c.getName()+" def: "+c.getDefaultValue());
|
||||
c.getVascColumnValue().setValue(c, bean, c.getDefaultValue());
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.WARNING,"Error in setting default value: '"+c.getDefaultValue()+"' error: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascTableController#refreshData()
|
||||
*/
|
||||
public void refreshData(VascTable table) throws Exception {
|
||||
table.setSelectedObject(null);
|
||||
table.setTableData(table.getVascDataSource().execute());
|
||||
fireVascEvent(VascEventListener.VascEventType.DATA_UPDATE, null);
|
||||
}
|
||||
|
||||
public void handleException(Exception e,VascTable table) {
|
||||
if (exceptionListeners.isEmpty()) {
|
||||
Logger.getLogger(DefaultVascTableController.class.getName()).log(Level.WARNING,e.getMessage(),e);
|
||||
return;
|
||||
}
|
||||
for(VascExceptionListener ee:exceptionListeners) {
|
||||
try {
|
||||
ee.handleException(e, table);
|
||||
} catch (Exception eee) {
|
||||
Logger.getLogger(DefaultVascTableController.class.getName()).log(Level.WARNING,"Error in ExceptionListener: "+eee.getMessage(),eee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addEventListener(VascEventListener e) {
|
||||
eventListeners.add(e);
|
||||
}
|
||||
|
@ -199,46 +297,7 @@ public class DefaultVascTableController implements VascTableController {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean setUIComponentsBeanErrors(VascTable table,Object bean) {
|
||||
boolean error = false;
|
||||
if(bean==null) {
|
||||
logger.finest("No bean to check.");
|
||||
return true; // nothing to check
|
||||
}
|
||||
|
||||
ClassValidator val = new ClassValidator(bean.getClass());
|
||||
InvalidValue[] ival = val.getInvalidValues(bean);
|
||||
logger.fine("Got invaliled value: "+ival.length);
|
||||
|
||||
for(VascTableColumn col:table.getTableColumns()) {
|
||||
if(col.getVascUIComponent()==null) {
|
||||
continue; // we only DISPLAY user input errors !!
|
||||
}
|
||||
if (col instanceof VascAnnotationTableColumn) {
|
||||
VascAnnotationTableColumn column = (VascAnnotationTableColumn)col;
|
||||
|
||||
InvalidValue iv = findInvalidValueByProperty(ival,column.getBeanProperty());
|
||||
if(iv==null) {
|
||||
column.getVascUIComponent().setErrorText(null);
|
||||
continue; // no error on this property
|
||||
}
|
||||
error = true;
|
||||
column.getVascUIComponent().setErrorText(iv.getMessage());
|
||||
}
|
||||
}
|
||||
logger.finest("Checked for errors: "+error);
|
||||
return error;
|
||||
}
|
||||
private InvalidValue findInvalidValueByProperty(InvalidValue[] ival,String property) {
|
||||
for(InvalidValue iv:ival) {
|
||||
if(iv.getPropertyName().equals(property)) {
|
||||
return iv;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addExceptionListener(VascExceptionListener listener) {
|
||||
exceptionListeners.add(listener);
|
||||
}
|
||||
|
@ -246,21 +305,5 @@ public class DefaultVascTableController implements VascTableController {
|
|||
public void removeExceptionListener(VascExceptionListener listener) {
|
||||
exceptionListeners.remove(listener);
|
||||
}
|
||||
|
||||
public Object mergeObject(VascTable table,Object object) {
|
||||
Object result = null;
|
||||
try {
|
||||
object = table.getVascDataSource().merge(object);
|
||||
fireVascEvent(VascEventListener.VascEventType.BEAN_MERGE,object);
|
||||
// todo: make faster
|
||||
// add to table at position old old object
|
||||
// then remove old object
|
||||
// send refresh
|
||||
|
||||
table.getVascTableController().refreshData(table);
|
||||
} catch (Exception e) {
|
||||
handleException(e, table);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -44,6 +44,6 @@ public class AddRowAction extends AbstractVascAction implements RowVascAction {
|
|||
}
|
||||
|
||||
public void doRowAction(VascEntry enty,Object rowObject) throws Exception {
|
||||
enty.getVascFrontend().renderEdit(null);
|
||||
enty.getVascFrontendData().getVascFrontend().renderEdit(null);
|
||||
}
|
||||
}
|
|
@ -49,7 +49,7 @@ public class CSVExportGlobalAction extends AbstractVascAction implements GlobalV
|
|||
}
|
||||
|
||||
public void doGlobalAction(VascEntry entry) throws Exception {
|
||||
entry.getVascFrontend().renderExport(this);
|
||||
entry.getVascFrontendData().getVascFrontend().renderExport(this);
|
||||
}
|
||||
|
||||
public void doExport(OutputStream out,VascEntry entry) throws Exception {
|
||||
|
@ -59,7 +59,7 @@ public class CSVExportGlobalAction extends AbstractVascAction implements GlobalV
|
|||
p.write(c.getName()+"\t");
|
||||
}
|
||||
p.write("\n");
|
||||
for (Object o:entry.getEntryDataList()) {
|
||||
for (Object o:entry.getVascFrontendData().getEntryDataList()) {
|
||||
for (VascEntryField c:entry.getVascEntryFields()) {
|
||||
p.write(c.getVascEntryFieldValue().getValue(c, o)+"\t");
|
||||
}
|
||||
|
|
|
@ -47,6 +47,6 @@ public class DeleteRowAction extends AbstractVascAction implements RowVascAction
|
|||
if (rowObject==null) {
|
||||
return;
|
||||
}
|
||||
entry.getVascFrontend().renderDelete(rowObject);
|
||||
entry.getVascFrontendData().getVascFrontend().renderDelete(rowObject);
|
||||
}
|
||||
}
|
|
@ -48,6 +48,6 @@ public class EditRowAction extends AbstractVascAction implements RowVascAction {
|
|||
if (rowObject==null) {
|
||||
return;
|
||||
}
|
||||
entry.getVascFrontend().renderEdit(rowObject);
|
||||
entry.getVascFrontendData().getVascFrontend().renderEdit(rowObject);
|
||||
}
|
||||
}
|
|
@ -45,6 +45,6 @@ public class RefreshDataGlobalAction extends AbstractVascAction implements Globa
|
|||
|
||||
|
||||
public void doGlobalAction(VascEntry entry) throws Exception {
|
||||
entry.get.refreshData(table); // this wil also fire the event
|
||||
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry); // this wil also fire the event
|
||||
}
|
||||
}
|
|
@ -49,14 +49,14 @@ public class XMLExportGlobalAction extends AbstractVascAction implements GlobalV
|
|||
}
|
||||
|
||||
public void doGlobalAction(VascEntry entry) throws Exception {
|
||||
entry.getVascFrontend().renderExport(this);
|
||||
entry.getVascFrontendData().getVascFrontend().renderExport(this);
|
||||
}
|
||||
|
||||
public void doExport(OutputStream out,VascEntry entry) throws Exception {
|
||||
PrintWriter p = new PrintWriter(out);
|
||||
p.write("<xml version=\"1.0\"/>\n");
|
||||
p.write("<data>\n");
|
||||
for (Object o:entry.getEntryDataList()) {
|
||||
for (Object o:entry.getVascFrontendData().getEntryDataList()) {
|
||||
for (VascEntryField c:entry.getVascEntryFields()) {
|
||||
p.write("<column name=\""+c.getName()+"\">");
|
||||
p.write(""+c.getVascEntryFieldValue().getValue(c, o));
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.impl.type;
|
||||
|
||||
|
||||
import com.idcanet.vasc.core.AbstractVascEntryFieldType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 8, 2008
|
||||
*/
|
||||
public class DefaultVascEntryFieldType extends AbstractVascEntryFieldType {
|
||||
|
||||
}
|
72
src/com/idcanet/vasc/impl/type/FieldTypeParser.java
Normal file
72
src/com/idcanet/vasc/impl/type/FieldTypeParser.java
Normal file
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* 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.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntryFieldType;
|
||||
import com.idcanet.x4o.core.X4OParser;
|
||||
import com.idcanet.x4o.element.Element;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 11, 2008
|
||||
*/
|
||||
public class FieldTypeParser extends X4OParser {
|
||||
|
||||
static public final String FIELD_TYPE_LANGUAGE = "fieldtype";
|
||||
|
||||
/**
|
||||
*
|
||||
* @param language
|
||||
* @throws Exception
|
||||
*/
|
||||
public FieldTypeParser() throws Exception {
|
||||
super(FIELD_TYPE_LANGUAGE);
|
||||
}
|
||||
|
||||
public void parseVascFieldTypes() throws IOException, SecurityException, NullPointerException, ParserConfigurationException, SAXException {
|
||||
parseResource("META-INF/fieldtypes.xml");
|
||||
}
|
||||
|
||||
public List<VascEntryFieldType> getTypes() {
|
||||
List<VascEntryFieldType> result = new ArrayList<VascEntryFieldType>(4);
|
||||
for (Element e:getElementContext().getRootElements()) {
|
||||
VascEntryFieldType a = (VascEntryFieldType)e.getElementObject();
|
||||
result.add(a);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -53,4 +53,17 @@ public @interface VascStringLength {
|
|||
* @return
|
||||
*/
|
||||
int max() default 0;
|
||||
|
||||
static BB bb = new BB() {
|
||||
public VascValidator getValidator(VascStringLength ano) {
|
||||
VascStringLengthValidator v = new VascStringLengthValidator();
|
||||
v.setMinLenght(ano.min());
|
||||
v.setMaxLenght(ano.max());
|
||||
return v;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
interface BB {
|
||||
public VascValidator getValidator(VascStringLength ano);
|
||||
}
|
|
@ -33,11 +33,50 @@ package com.idcanet.vasc.validators;
|
|||
* @version 1.0 Sep 5, 2008
|
||||
*/
|
||||
public class VascStringLengthValidator implements VascValidator {
|
||||
|
||||
|
||||
private Integer minLenght = null;
|
||||
private Integer maxLenght = null;
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
|
||||
*/
|
||||
public boolean isObjectValid(Object object) throws VascValidatorException {
|
||||
return false;
|
||||
String result = (String)object;
|
||||
|
||||
if (getMinLenght()!=null && result.length()<getMinLenght()) {
|
||||
return false;
|
||||
}
|
||||
if (getMaxLenght()!=null && result.length()>getMaxLenght()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the minLenght
|
||||
*/
|
||||
public Integer getMinLenght() {
|
||||
return minLenght;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param minLenght the minLenght to set
|
||||
*/
|
||||
public void setMinLenght(Integer minLenght) {
|
||||
this.minLenght = minLenght;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maxLenght
|
||||
*/
|
||||
public Integer getMaxLenght() {
|
||||
return maxLenght;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param maxLenght the maxLenght to set
|
||||
*/
|
||||
public void setMaxLenght(Integer maxLenght) {
|
||||
this.maxLenght = maxLenght;
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ handlers = java.util.logging.ConsoleHandler
|
|||
java.util.logging.ConsoleHandler.level = ALL
|
||||
|
||||
# Set the default logging level for the root logger
|
||||
.level = ALL
|
||||
.level = FINE
|
||||
|
||||
com.idcanet.x4o = ALL
|
||||
|
||||
|
|
64
tests/com/idcanet/vasc/FieldTypesTest.java
Normal file
64
tests/com/idcanet/vasc/FieldTypesTest.java
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright 2004-2006 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntryFieldType;
|
||||
import com.idcanet.vasc.impl.type.FieldTypeParser;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* Tests a simple x4o xml language.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class FieldTypesTest extends TestCase {
|
||||
|
||||
public void setUp() throws Exception {
|
||||
// enable all logs
|
||||
InputStream loggingProperties = this.getClass().getResourceAsStream("/META-INF/logging.properties");
|
||||
LogManager.getLogManager().readConfiguration( loggingProperties );
|
||||
loggingProperties.close();
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
public void testParse() throws Exception {
|
||||
FieldTypeParser p = new FieldTypeParser();
|
||||
p.parseVascFieldTypes();
|
||||
|
||||
System.out.println("Got types;");
|
||||
for (VascEntryFieldType t:p.getTypes()) {
|
||||
System.out.println("t= "+t.getId());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,6 +33,7 @@ import javax.swing.JFrame;
|
|||
import javax.swing.JPanel;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.frontends.swing.SwingVascFrontend;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
@ -53,16 +54,7 @@ public class SwingTest extends TestCase {
|
|||
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
- default view field
|
||||
- Admin fields and order
|
||||
- Admin field groups -> 'collapse
|
||||
- List filters auto by type
|
||||
- search fields
|
||||
|
||||
*/
|
||||
|
||||
public void testAll() throws Exception {
|
||||
JFrame.setDefaultLookAndFeelDecorated(false);
|
||||
|
||||
|
@ -73,15 +65,15 @@ public class SwingTest extends TestCase {
|
|||
frame.setLocationRelativeTo(null);
|
||||
|
||||
// get table
|
||||
VascTable table = TestTable.getVascTable();
|
||||
VascEntry entry = TestTable.getVascTable();
|
||||
|
||||
// define redering
|
||||
JPanel panel = new JPanel();
|
||||
SwingVascViewRenderer render = new SwingVascViewRenderer(panel);
|
||||
SwingVascFrontend render = new SwingVascFrontend(panel);
|
||||
frame.add(panel);
|
||||
|
||||
// render
|
||||
render.initTable(table);
|
||||
render.initEntry(entry);
|
||||
|
||||
//table.getTableColumns().get(0).set
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.idcanet.vasc.core.entry.VascEntryFieldValue;
|
|||
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
|
||||
import com.idcanet.vasc.core.ui.VascSelectItem;
|
||||
import com.idcanet.vasc.core.ui.VascSelectItemModel;
|
||||
import com.idcanet.vasc.impl.entry.BeanVascEntryRecordCreator;
|
||||
import com.idcanet.vasc.models.TestModel;
|
||||
|
||||
/**
|
||||
|
@ -103,6 +104,6 @@ public class TestModelVascDataSource extends AbstractVascBackend implements Vasc
|
|||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
return null;
|
||||
return new BeanVascEntryRecordCreator(TestModel.class);
|
||||
}
|
||||
}
|
|
@ -28,12 +28,13 @@ package com.idcanet.vasc;
|
|||
|
||||
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.DefaultVascController;
|
||||
import com.idcanet.vasc.impl.DefaultVascEntry;
|
||||
import com.idcanet.vasc.impl.DefaultVascEntryField;
|
||||
import com.idcanet.vasc.impl.DefaultVascTableController;
|
||||
import com.idcanet.vasc.impl.actions.AddRowAction;
|
||||
import com.idcanet.vasc.impl.actions.CSVExportGlobalAction;
|
||||
import com.idcanet.vasc.impl.actions.DeleteRowAction;
|
||||
|
@ -52,6 +53,17 @@ import com.idcanet.vasc.models.TestModel;
|
|||
*/
|
||||
public class TestTable {
|
||||
|
||||
static VascController getDefaultVascController() {
|
||||
DefaultVascController c = new DefaultVascController();
|
||||
|
||||
|
||||
//entry.setVascEntryResourceResolver(new VascI18nTextValue());
|
||||
|
||||
return c;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static public VascEntry getVascTable() throws Exception {
|
||||
|
||||
// define query
|
||||
|
@ -63,6 +75,8 @@ public class TestTable {
|
|||
*/
|
||||
|
||||
|
||||
VascController c = getDefaultVascController();
|
||||
|
||||
TestModelVascDataSource data = new TestModelVascDataSource();
|
||||
|
||||
// config table
|
||||
|
@ -72,24 +86,16 @@ public class TestTable {
|
|||
entry.setHeaderDescription("Met een hele coole tooltip");
|
||||
entry.setHeaderImage("/resources/images/gabelfresser.gif");
|
||||
entry.setHelpId("someKey");
|
||||
//entry.setVascTableController(new DefaultVascTableController());
|
||||
entry.setVascBackend(data);
|
||||
|
||||
//table.setVascTextValue(new DefaultVascTextValue());
|
||||
entry.setVascEntryResourceResolver(new VascI18nTextValue());
|
||||
|
||||
// entry.setVascEntryRecordCreator(new BeanVascEntryRecordCreator(TestModel.class));
|
||||
|
||||
entry.addRowAction(new AddRowAction());
|
||||
entry.addRowAction(new EditRowAction());
|
||||
entry.addRowAction(new DeleteRowAction());
|
||||
|
||||
entry.addGlobalAction(new XMLExportGlobalAction());
|
||||
entry.addGlobalAction(new CSVExportGlobalAction());
|
||||
//table.addGlobalActions(new HTMLExportGlobalAction());
|
||||
entry.addGlobalAction(new RefreshDataGlobalAction());
|
||||
|
||||
//table.addUserOptions(userOption);
|
||||
|
||||
//table.addColumnActions(new GraphColumnAction());
|
||||
|
||||
VascEntryField field = new DefaultVascEntryField();
|
||||
|
@ -98,7 +104,12 @@ public class TestTable {
|
|||
field.setDefaultValue("DEFFFFFF");
|
||||
field.setHelpId("helpColumnKey");
|
||||
field.setImage("/META-INF/images/silk/png/tick.png");
|
||||
field.setVascEntryFieldType(vascEntryFieldType)
|
||||
try {
|
||||
field.setVascEntryFieldType(c.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldType("TextField"));
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
field.setVascEntryFieldValue(new BeanPropertyVascEntryFieldValue("name"));
|
||||
entry.addVascEntryField(field);
|
||||
|
||||
|
|
|
@ -39,10 +39,10 @@ import com.idcanet.vasc.annotations.VascHelpId;
|
|||
import com.idcanet.vasc.annotations.VascImage;
|
||||
import com.idcanet.vasc.annotations.VascModelReference;
|
||||
import com.idcanet.vasc.annotations.VascName;
|
||||
import com.idcanet.vasc.annotations.VascToolTip;
|
||||
import com.idcanet.vasc.validator.VascDateFuture;
|
||||
import com.idcanet.vasc.validator.VascObjectNotNull;
|
||||
import com.idcanet.vasc.validator.VascStringLength;
|
||||
import com.idcanet.vasc.annotations.VascDescription;
|
||||
import com.idcanet.vasc.validators.VascDateFuture;
|
||||
import com.idcanet.vasc.validators.VascObjectNotNull;
|
||||
import com.idcanet.vasc.validators.VascStringLength;
|
||||
|
||||
/**
|
||||
* TestModel
|
||||
|
@ -51,7 +51,7 @@ import com.idcanet.vasc.validator.VascStringLength;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 28, 2007
|
||||
*/
|
||||
@VascToolTip(key="En een tooltip op het model")
|
||||
@VascDescription(key="En een tooltip op het model")
|
||||
public class TestModel {
|
||||
|
||||
private String name = null;
|
||||
|
@ -82,7 +82,7 @@ public class TestModel {
|
|||
* @return the description
|
||||
*/
|
||||
@VascName(key="omscheiving")
|
||||
@VascToolTip(key="De omscheiving")
|
||||
@VascDescription(key="De omscheiving")
|
||||
@VascHelpId(helpId="help.id")
|
||||
@VascDefaultValue(defaultValue="xxxxx")
|
||||
@VascColumnWidth(width=200)
|
||||
|
|
|
@ -80,15 +80,28 @@ Master
|
|||
|
||||
</v:viewController>
|
||||
|
||||
<vasc:fieldType name="EmailField2">
|
||||
<vasc:fieldHint key="validate" default="true"/>
|
||||
<vasc:fieldHint key="timeout" default="200"/>
|
||||
</vasc:fieldType>
|
||||
|
||||
<vasc:fieldType name="listField">
|
||||
<vasc:fieldHint key="validate" default="true"/>
|
||||
<vasc:fieldHint key="timeout" default="200"/>
|
||||
</vasc:fieldType>
|
||||
|
||||
<v:viewController name="sudoers" primaryKey="user">
|
||||
<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" fieldEditor="listField"/>
|
||||
<v:field name="sudoHost" fieldEditor="listField"/>
|
||||
<v:field name="sudoUser" fieldEditor="listField"/>
|
||||
<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"/>
|
||||
|
|
Loading…
Reference in a new issue