[svn r345] WIP for editor support
This commit is contained in:
parent
4643057b7f
commit
5d64bde0bd
|
@ -65,6 +65,24 @@ The plural name for the object:
|
|||
verbose_name_plural = "stories"
|
||||
If this isn’t given, Django will use verbose_name + "s"
|
||||
|
||||
List of Magic Field Names
|
||||
|
||||
* created_at
|
||||
* created_on
|
||||
* updated_at
|
||||
* updated_on
|
||||
* lock_version
|
||||
* type
|
||||
* id
|
||||
* #{table_name}_count
|
||||
* position
|
||||
* parent_id
|
||||
* lft
|
||||
* rgt
|
||||
* quote_value (is used for quoting)
|
||||
* template
|
||||
|
||||
|
||||
|
||||
- plural
|
||||
- ordering
|
||||
|
|
|
@ -5,21 +5,19 @@
|
|||
>
|
||||
|
||||
<!-- Verplichte impl field types -->
|
||||
<vf:fieldType id="TextField">
|
||||
<vf:fieldType id="LabelField" uiComponentId="VascLabel"/>
|
||||
<vf:fieldType id="TextField" uiComponentId="VascText" inputMask="">
|
||||
<x4o:property key="minlength" value="0"/>
|
||||
<x4o:property key="maxlength" value="80"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="ListField">
|
||||
<vf:fieldType id="ListField" uiComponentId="VascList" inputMask="">
|
||||
<x4o:property key="radio_edit" value="false"/>
|
||||
</vf:fieldType>
|
||||
<vf:fieldType id="TextAreaField" uiComponentId="VascTextArea">
|
||||
<x4o:property key="columns" value="80"/>
|
||||
<x4o:property key="rows" value="80"/>
|
||||
</vf:fieldType>
|
||||
|
||||
<!--
|
||||
<vasc:fieldType name="TextAreaField">
|
||||
<vasc:fieldHint key="columns" default="80"/>
|
||||
<vasc:fieldHint key="rows" default="80"/>
|
||||
<vasc:fieldClass className="java.lang.StringBuffer"/>
|
||||
</vasc:fieldType>
|
||||
-->
|
||||
<!-- Native types -->
|
||||
<!--
|
||||
<vasc:fieldType name="BooleanField">
|
||||
|
|
36
src/META-INF/vasc-lang.eld
Normal file
36
src/META-INF/vasc-lang.eld
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<eld xmlns:eld="http://x4o.idcanet.com/eld/eld-lang.eld">
|
||||
|
||||
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntry" childClass="com.idcanet.vasc.core.VascEntryField" method="addVascEntryField"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntry" childClass="com.idcanet.vasc.core.VascEntrySet" method="addVascEntryFieldSet"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntry" childClass="com.idcanet.vasc.core.VascLinkEntry" method="addVascLinkEntry"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntry" childClass="com.idcanet.vasc.core.actions.GlobalVascAction" method="addGlobalAction"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntry" childClass="com.idcanet.vasc.core.actions.RowVascAction" method="addRowAction"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntry" childClass="com.idcanet.vasc.core.actions.ColumnVascAction" method="addColumnAction"/>
|
||||
|
||||
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntryField" childClass="com.idcanet.vasc.validators.VascValidator" method="addVascValidator"/>
|
||||
<!-- etc..
|
||||
<eld:elementRefectionBindingHandler parentClass="com.idcanet.vasc.core.VascEntryField" childClass="com.idcanet.vasc.validators.VascValidator" method="setVascEntryFieldEventChannel"/>
|
||||
-->
|
||||
|
||||
<!-- Object for building an entry -->
|
||||
<eld:elementClass tag="entry" objectClassName="com.idcanet.vasc.impl.DefaultVascEntry"/>
|
||||
<eld:elementClass tag="field" objectClassName="com.idcanet.vasc.impl.DefaultVascEntryField"/>
|
||||
<eld:elementClass tag="fieldSet" objectClassName="com.idcanet.vasc.impl.DefaultVascEntryFieldSet"/>
|
||||
|
||||
<!-- Default vasc validators -->
|
||||
<eld:elementClass tag="dateFutureValidator" objectClassName="com.idcanet.vasc.validators.VascDateFutureValidator"/>
|
||||
<eld:elementClass tag="datePastValidator" objectClassName="com.idcanet.vasc.validators.VascDatePastValidator"/>
|
||||
<eld:elementClass tag="intSizeValidator" objectClassName="com.idcanet.vasc.validators.VascIntSizeValidator"/>
|
||||
<eld:elementClass tag="longSizeValidator" objectClassName="com.idcanet.vasc.validators.VascLongSizeValidator"/>
|
||||
<eld:elementClass tag="objectNotNullValidator" objectClassName="com.idcanet.vasc.validators.VascObjectNotNullValidator"/>
|
||||
<eld:elementClass tag="objectNullValidator" objectClassName="com.idcanet.vasc.validators.VascObjectNullValidator"/>
|
||||
<eld:elementClass tag="stringEmailValidator" objectClassName="com.idcanet.vasc.validators.VascStringEmailValidator"/>
|
||||
<eld:elementClass tag="stringLengthValidator" objectClassName="com.idcanet.vasc.validators.VascStringLengthValidator"/>
|
||||
<eld:elementClass tag="stringRegexValidator" objectClassName="com.idcanet.vasc.validators.VascStringRegexValidator"/>
|
||||
<eld:elementClass tag="stringZipCodeValidator" objectClassName="com.idcanet.vasc.validators.VascStringZipCodeValidator"/>
|
||||
|
||||
|
||||
</eld>
|
8
src/META-INF/vasc-namespaces.xml
Normal file
8
src/META-INF/vasc-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/vasc-lang.eld">META-INF/vasc-lang.eld</entry>
|
||||
</properties>
|
|
@ -33,10 +33,9 @@ import java.util.Map;
|
|||
import com.idcanet.vasc.core.AbstractVascBackend;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
|
||||
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
|
||||
import com.idcanet.x4o.element.ElementParameterException;
|
||||
import com.idcanet.x4o.element.ElementParameterNotFoundException;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -116,7 +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 {
|
||||
public Object getValue(VascEntryField field, Object record) throws VascException {
|
||||
Map<String,Object> map = (Map<String,Object>)record;
|
||||
return map.get(field.getBackendName());
|
||||
}
|
||||
|
@ -125,7 +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 {
|
||||
public void setValue(VascEntryField field, Object record,Object value) throws VascException {
|
||||
Map<String,Object> map = (Map<String,Object>)record;
|
||||
map.put(field.getBackendName(), value);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.Set;
|
|||
*/
|
||||
abstract public class AbstractVascBackend implements VascBackend {
|
||||
|
||||
private String name = null;
|
||||
private String id = null;
|
||||
protected Map<String,Object> parameters = null;
|
||||
private int pageIndex = 0;
|
||||
private int pageSize = 100;
|
||||
|
@ -62,20 +62,20 @@ abstract public class AbstractVascBackend implements VascBackend {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#getName()
|
||||
* @see com.idcanet.vasc.core.VascBackend#getId()
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#setName(java.lang.String)
|
||||
* @see com.idcanet.vasc.core.VascBackend#setId(java.lang.String)
|
||||
*/
|
||||
public void setName(String name) {
|
||||
if (name==null) {
|
||||
throw new IllegalArgumentException("name may not be null");
|
||||
public void setId(String id) {
|
||||
if (id==null) {
|
||||
throw new IllegalArgumentException("id may not be null");
|
||||
}
|
||||
this.name=name;
|
||||
this.id=id;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,53 +42,32 @@ import com.idcanet.vasc.validators.VascValidator;
|
|||
abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
|
||||
|
||||
private String id = null;
|
||||
private Class<?> autoFieldClass = null;
|
||||
private ObjectConverter objectConverter = null;
|
||||
private VascUIComponent vascUIComponent = null;
|
||||
private List<Class<?>> autoDetectionClasses = null;
|
||||
private List<VascValidator> vascValidators = null;
|
||||
private Map<String,String> properties = null;
|
||||
private String parentEntryFieldTypeName = null;
|
||||
|
||||
private String uiComponentId = null;
|
||||
private String inputMask = null;
|
||||
|
||||
public AbstractVascEntryFieldType() {
|
||||
vascValidators = new ArrayList<VascValidator>(4);
|
||||
properties = new HashMap<String,String>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#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()
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setId(java.lang.String)
|
||||
*/
|
||||
public ObjectConverter getObjectConverter() {
|
||||
return objectConverter;
|
||||
public void setId(String id) {
|
||||
this.id=id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getParentEntryFieldTypeName()
|
||||
*/
|
||||
public String getParentEntryFieldTypeName() {
|
||||
return parentEntryFieldTypeName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getProperty(java.lang.String)
|
||||
*/
|
||||
|
@ -96,6 +75,13 @@ abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
|
|||
return properties.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setProperty(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void setProperty(String name, String value) {
|
||||
properties.put(name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getPropertyNames()
|
||||
*/
|
||||
|
@ -103,13 +89,6 @@ abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
|
|||
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()
|
||||
*/
|
||||
|
@ -117,6 +96,13 @@ abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
|
|||
return vascValidators;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#addVascValidator(com.idcanet.vasc.validators.VascValidator)
|
||||
*/
|
||||
public void addVascValidator(VascValidator vascValidator) {
|
||||
vascValidators.add(vascValidator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#removeVascValidator(com.idcanet.vasc.validators.VascValidator)
|
||||
*/
|
||||
|
@ -125,44 +111,94 @@ abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setAutoFieldClass(java.lang.Class)
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#addAutoDetectionClass(java.lang.Class)
|
||||
*/
|
||||
public void setAutoFieldClass(Class<?> autoFieldClass) {
|
||||
this.autoFieldClass=autoFieldClass;
|
||||
public void addAutoDetectionClass(Class<?> classObject) {
|
||||
autoDetectionClasses.add(classObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setId(java.lang.String)
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getAutoDetectionClasses()
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id=id;
|
||||
public List<Class<?>> getAutoDetectionClasses() {
|
||||
return autoDetectionClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setObjectConverter(com.idcanet.vasc.core.VascEntryFieldType.ObjectConverter)
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getInputMask()
|
||||
*/
|
||||
public void setObjectConverter(ObjectConverter objectConverter) {
|
||||
this.objectConverter=objectConverter;
|
||||
public String getInputMask() {
|
||||
return inputMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setParentEntryFieldTypeName(java.lang.String)
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setInputMask(java.lang.String)
|
||||
*/
|
||||
public void setParentEntryFieldTypeName(String parentEntryFieldTypeName) {
|
||||
this.parentEntryFieldTypeName=parentEntryFieldTypeName;
|
||||
public void setInputMask(String inputMask) {
|
||||
this.inputMask=inputMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setProperty(java.lang.String, java.lang.String)
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getUIComponentId()
|
||||
*/
|
||||
public void setProperty(String name, String value) {
|
||||
properties.put(name, value);
|
||||
public String getUIComponentId() {
|
||||
return uiComponentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent)
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#setUIComponentId(java.lang.String)
|
||||
*/
|
||||
public void setVascUIComponent(VascUIComponent vascUIComponent) {
|
||||
this.vascUIComponent=vascUIComponent;
|
||||
public void setUIComponentId(String uiComponentId) {
|
||||
this.uiComponentId=uiComponentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#getUIComponentCount()
|
||||
*/
|
||||
public int getUIComponentCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#provideEditorUIComponent(int)
|
||||
*/
|
||||
public VascUIComponent provideEditorUIComponent(int index,VascEntryField entryField) throws VascException {
|
||||
if (index!=0) {
|
||||
return null;
|
||||
}
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl == null) {
|
||||
cl = entryField.getClass().getClassLoader(); // fallback
|
||||
}
|
||||
String compId = getUIComponentId();
|
||||
if (compId==null) {
|
||||
compId = VascUIComponent.VASC_TEXT; // ??? mmmm
|
||||
}
|
||||
String componentClass = entryField.getVascEntry().getVascFrontendData().getVascUIComponent(compId);
|
||||
try {
|
||||
return (VascUIComponent)cl.loadClass(componentClass).newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new VascException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldType#provideLabelUIComponent(int)
|
||||
*/
|
||||
public VascUIComponent provideLabelUIComponent(int index,VascEntryField entryField) throws VascException {
|
||||
if (index!=0) {
|
||||
return null;
|
||||
}
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl == null) {
|
||||
cl = entryField.getClass().getClassLoader(); // fallback
|
||||
}
|
||||
String componentClass = entryField.getVascEntry().getVascFrontendData().getVascUIComponent(VascUIComponent.VASC_LABEL);
|
||||
try {
|
||||
return (VascUIComponent)cl.loadClass(componentClass).newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new VascException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -33,7 +33,7 @@ package com.idcanet.vasc.core;
|
|||
*/
|
||||
abstract public class AbstractVascFrontend implements VascFrontend {
|
||||
|
||||
private String name = null;
|
||||
private String id = null;
|
||||
protected VascEntry entry = null;
|
||||
|
||||
protected String i18n(String key,Object...params) {
|
||||
|
@ -44,6 +44,8 @@ abstract public class AbstractVascFrontend implements VascFrontend {
|
|||
return entry;
|
||||
}
|
||||
|
||||
abstract protected void addUiComponents();
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontend#initEntry(com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
|
@ -56,19 +58,20 @@ abstract public class AbstractVascFrontend implements VascFrontend {
|
|||
}
|
||||
}
|
||||
this.entry=entry;
|
||||
addUiComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontend#getName()
|
||||
* @see com.idcanet.vasc.core.VascFrontend#getId()
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontend#setName(java.lang.String)
|
||||
* @see com.idcanet.vasc.core.VascFrontend#setId(java.lang.String)
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name=name;
|
||||
public void setId(String id) {
|
||||
this.id=id;
|
||||
}
|
||||
}
|
|
@ -39,8 +39,8 @@ import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
|
|||
*/
|
||||
public interface VascBackend {
|
||||
|
||||
public String getName();
|
||||
public void setName(String name);
|
||||
public String getId();
|
||||
public void setId(String id);
|
||||
|
||||
public void setDataParameter(String key,Object data);
|
||||
public Object getDataParameter(String key);
|
||||
|
|
|
@ -34,5 +34,5 @@ package com.idcanet.vasc.core;
|
|||
*/
|
||||
public interface VascBackendController {
|
||||
|
||||
public VascBackend getVascBackend(String name);
|
||||
public VascBackend getVascBackendById(String id);
|
||||
}
|
|
@ -287,4 +287,7 @@ public interface VascEntry extends Cloneable {
|
|||
|
||||
public VascFrontendData getVascFrontendData();
|
||||
public void setVascFrontendData(VascFrontendData vascFrontendData);
|
||||
|
||||
public String getBackendId();
|
||||
public void setBackendId(String backendId);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,9 @@ import java.util.List;
|
|||
*/
|
||||
public interface VascEntryController {
|
||||
|
||||
public VascEntry getVascEntry(String name);
|
||||
public VascEntry getVascEntryById(String id);
|
||||
|
||||
public List<String> getVascEntryNames();
|
||||
public List<String> getVascEntryIds();
|
||||
|
||||
public List<String> getVascEntryAdminIds();
|
||||
}
|
|
@ -42,8 +42,14 @@ import com.idcanet.vasc.validators.VascValidator;
|
|||
*/
|
||||
public interface VascEntryField {
|
||||
|
||||
/**
|
||||
* @return the VascEntry
|
||||
*/
|
||||
public VascEntry getVascEntry();
|
||||
|
||||
/**
|
||||
* @param entry the VascEntry to set
|
||||
*/
|
||||
public void setVascEntry(VascEntry entry);
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,8 +42,14 @@ public interface VascEntryFieldType {
|
|||
public String getId();
|
||||
public void setId(String id);
|
||||
|
||||
public Class<?> getAutoFieldClass();
|
||||
public void setAutoFieldClass(Class<?> classObject);
|
||||
public String getUIComponentId();
|
||||
public void setUIComponentId(String uiComponentId);
|
||||
|
||||
public String getInputMask();
|
||||
public void setInputMask(String inputMask);
|
||||
|
||||
public List<Class<?>> getAutoDetectionClasses();
|
||||
public void addAutoDetectionClass(Class<?> classObject);
|
||||
|
||||
public void addVascValidator(VascValidator vascValidator);
|
||||
public void removeVascValidator(VascValidator vascValidator);
|
||||
|
@ -52,17 +58,8 @@ public interface VascEntryFieldType {
|
|||
public void setProperty(String name,String value);
|
||||
public String getProperty(String name);
|
||||
public List<String> getPropertyNames();
|
||||
|
||||
public String getParentEntryFieldTypeName();
|
||||
public void setParentEntryFieldTypeName(String name);
|
||||
|
||||
public ObjectConverter getObjectConverter();
|
||||
public void setObjectConverter(ObjectConverter converter);
|
||||
|
||||
public VascUIComponent getVascUIComponent();
|
||||
public void setVascUIComponent(VascUIComponent vascUIComponent);
|
||||
|
||||
interface ObjectConverter {
|
||||
|
||||
}
|
||||
public int getUIComponentCount();
|
||||
public VascUIComponent provideLabelUIComponent(int index,VascEntryField entryField) throws VascException;
|
||||
public VascUIComponent provideEditorUIComponent(int index,VascEntryField entryField) throws VascException;
|
||||
}
|
|
@ -36,7 +36,7 @@ import java.util.List;
|
|||
*/
|
||||
public interface VascEntryFieldTypeController {
|
||||
|
||||
public VascEntryFieldType getVascEntryFieldType(String name);
|
||||
public VascEntryFieldType getVascEntryFieldTypeById(String id);
|
||||
|
||||
public List<String> getVascEntryFieldTypeNames();
|
||||
public List<String> getVascEntryFieldTypeIds();
|
||||
}
|
|
@ -34,5 +34,5 @@ package com.idcanet.vasc.core;
|
|||
*/
|
||||
public interface VascEntryFinalizer {
|
||||
|
||||
public VascEntry finalizeVascEntry(VascEntry entry) throws Exception;
|
||||
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException;
|
||||
}
|
46
src/com/idcanet/vasc/core/VascException.java
Normal file
46
src/com/idcanet/vasc/core/VascException.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.core;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 18, 2008
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class VascException extends Exception {
|
||||
|
||||
|
||||
public VascException() {
|
||||
}
|
||||
|
||||
public VascException(Exception e) {
|
||||
super(e);
|
||||
}
|
||||
}
|
|
@ -36,9 +36,9 @@ import com.idcanet.vasc.core.entry.VascEntryExporter;
|
|||
*/
|
||||
public interface VascFrontend {
|
||||
|
||||
public void setName(String name);
|
||||
public void setId(String name);
|
||||
|
||||
public String getName();
|
||||
public String getId();
|
||||
|
||||
public void initEntry(VascEntry entry) throws Exception;
|
||||
|
||||
|
|
|
@ -97,4 +97,9 @@ public interface VascFrontendData {
|
|||
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
|
||||
*/
|
||||
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver);
|
||||
|
||||
|
||||
public void putVascUIComponent(String rendererId,String uiComponentClass);
|
||||
|
||||
public String getVascUIComponent(String rendererId);
|
||||
}
|
|
@ -27,8 +27,7 @@
|
|||
package com.idcanet.vasc.core.entry;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.x4o.element.ElementParameterException;
|
||||
import com.idcanet.x4o.element.ElementParameterNotFoundException;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -37,7 +36,7 @@ import com.idcanet.x4o.element.ElementParameterNotFoundException;
|
|||
*/
|
||||
public interface VascEntryFieldValue {
|
||||
|
||||
public Object getValue(VascEntryField field,Object record) throws ElementParameterException,ElementParameterNotFoundException;
|
||||
public Object getValue(VascEntryField field,Object record) throws VascException;
|
||||
|
||||
public void setValue(VascEntryField field,Object record,Object value) throws ElementParameterException,ElementParameterNotFoundException;
|
||||
public void setValue(VascEntryField field,Object record,Object value) throws VascException;
|
||||
}
|
|
@ -26,8 +26,6 @@
|
|||
|
||||
package com.idcanet.vasc.core.ui;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
|
@ -36,9 +34,7 @@ import com.idcanet.vasc.core.VascEntry;
|
|||
abstract public class AbstractVascUIComponent implements VascUIComponent {
|
||||
|
||||
private VascUIComponent wrapper = null;
|
||||
|
||||
abstract public Object createComponent(VascEntry entry,VascValueModel model,Object gui) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* @return the wrapper
|
||||
*/
|
||||
|
|
|
@ -27,9 +27,7 @@
|
|||
package com.idcanet.vasc.core.ui;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.x4o.element.ElementParameterException;
|
||||
import com.idcanet.x4o.element.ElementParameterNotFoundException;
|
||||
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -38,50 +36,46 @@ import com.idcanet.x4o.element.ElementParameterNotFoundException;
|
|||
*/
|
||||
public class VascColumnValueModelListener implements VascValueModelListener {
|
||||
|
||||
private VascEntryField vascTableColumn = null;
|
||||
private VascEntryField vascEntryField = null;
|
||||
private Object bean = null;
|
||||
|
||||
public VascColumnValueModelListener() {
|
||||
}
|
||||
public VascColumnValueModelListener(VascEntryField vascTableColumn,Object bean) {
|
||||
setVascTableColumn(vascTableColumn);
|
||||
|
||||
public VascColumnValueModelListener(VascEntryField vascEntryField,Object bean) {
|
||||
setVascEntryField(vascEntryField);
|
||||
setBean(bean);
|
||||
}
|
||||
|
||||
public void valueUpdate(VascValueModel model) throws ElementParameterException,ElementParameterNotFoundException {
|
||||
//vascTableColumn.getVascColumnValue().setValue(VascEntryField, bean, model.getValue());
|
||||
//TODO
|
||||
public void valueUpdate(VascValueModel model) throws VascException {
|
||||
vascEntryField.getVascEntryFieldValue().setValue(vascEntryField, bean, model.getValue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the vascTableColumn
|
||||
* @return the vascEntryField
|
||||
*/
|
||||
public VascEntryField getVascTableColumn() {
|
||||
return vascTableColumn;
|
||||
public VascEntryField getVascEntryField() {
|
||||
return vascEntryField;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param vascTableColumn the vascTableColumn to set
|
||||
* @param vascEntryField the vascEntryField to set
|
||||
*/
|
||||
public void setVascTableColumn(VascEntryField vascTableColumn) {
|
||||
this.vascTableColumn = vascTableColumn;
|
||||
public void setVascEntryField(VascEntryField vascEntryField) {
|
||||
this.vascEntryField = vascEntryField;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the bean
|
||||
*/
|
||||
public Object getBean() {
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bean the bean to set
|
||||
*/
|
||||
public void setBean(Object bean) {
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -27,6 +27,7 @@
|
|||
package com.idcanet.vasc.core.ui;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -38,7 +39,7 @@ public class VascList extends VascUIComponentImplLoader {
|
|||
|
||||
private VascSelectItemModel vascSelectItemModel = null;
|
||||
|
||||
public Object createComponent(VascEntry entry,VascValueModel model,Object gui) throws Exception {
|
||||
public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws Exception {
|
||||
return loadAndCreateComponent(this, entry, model, gui);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
package com.idcanet.vasc.core.ui;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -35,10 +36,22 @@ import com.idcanet.vasc.core.VascEntry;
|
|||
*/
|
||||
public interface VascUIComponent {
|
||||
|
||||
// required ui components
|
||||
static public final String VASC_LABEL = "VascLabel";
|
||||
static public final String VASC_TEXT = "VascText";
|
||||
static public final String VASC_LIST = "VascList";
|
||||
|
||||
// optional ui Components
|
||||
static public final String VASC_TEXTAREA = "VascTextArea";
|
||||
static public final String VASC_BOOLEAN = "VascBoolean";
|
||||
static public final String VASC_DATE = "VascDate";
|
||||
|
||||
static public final String[] requiredUIComponents = {VASC_LABEL,VASC_TEXT,VASC_LIST};
|
||||
|
||||
public void setWrapper(VascUIComponent wrapper);
|
||||
public VascUIComponent getWrapper();
|
||||
|
||||
public Object createComponent(VascEntry entry,VascValueModel model,Object gui) throws Exception;
|
||||
public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws Exception;
|
||||
|
||||
public void setErrorText(String text);
|
||||
public String getErrorText();
|
||||
|
|
|
@ -29,9 +29,7 @@ package com.idcanet.vasc.core.ui;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.x4o.element.ElementParameterException;
|
||||
import com.idcanet.x4o.element.ElementParameterNotFoundException;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -43,18 +41,16 @@ public class VascValueModel {
|
|||
|
||||
private Object value = null;
|
||||
private List<VascValueModelListener> listeners = null;
|
||||
//private VascTable table = null;
|
||||
|
||||
public VascValueModel(VascEntry entry) {
|
||||
public VascValueModel() {
|
||||
listeners = new ArrayList<VascValueModelListener>(2);
|
||||
//this.table=table;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
public Object getValue() throws VascException {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Object value) throws ElementParameterException,ElementParameterNotFoundException {
|
||||
public void setValue(Object value) throws VascException {
|
||||
this.value = value;
|
||||
fireListeners();
|
||||
}
|
||||
|
@ -65,7 +61,7 @@ public class VascValueModel {
|
|||
public void removeListener(VascValueModelListener l) {
|
||||
listeners.remove(l);
|
||||
}
|
||||
private void fireListeners() throws ElementParameterException,ElementParameterNotFoundException {
|
||||
private void fireListeners() throws VascException {
|
||||
for (VascValueModelListener l:listeners) {
|
||||
l.valueUpdate(this);
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ package com.idcanet.vasc.core.ui;
|
|||
|
||||
import java.util.EventListener;
|
||||
|
||||
import com.idcanet.x4o.element.ElementParameterException;
|
||||
import com.idcanet.x4o.element.ElementParameterNotFoundException;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -39,5 +39,5 @@ import com.idcanet.x4o.element.ElementParameterNotFoundException;
|
|||
*/
|
||||
public interface VascValueModelListener extends EventListener {
|
||||
|
||||
public void valueUpdate(VascValueModel model) throws ElementParameterException,ElementParameterNotFoundException;
|
||||
public void valueUpdate(VascValueModel model) throws VascException;
|
||||
}
|
|
@ -70,6 +70,7 @@ import com.idcanet.fff.SwingImageHelper;
|
|||
import com.idcanet.vasc.core.AbstractVascFrontend;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascFrontendData;
|
||||
import com.idcanet.vasc.core.actions.GlobalVascAction;
|
||||
import com.idcanet.vasc.core.actions.RowVascAction;
|
||||
import com.idcanet.vasc.core.entry.VascEntryExporter;
|
||||
|
@ -77,6 +78,12 @@ import com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType;
|
|||
import com.idcanet.vasc.core.ui.VascColumnValueModelListener;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingBoolean;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingDate;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingLabel;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingList;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingText;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingTextArea;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -92,28 +99,23 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
logger = Logger.getLogger(SwingVascFrontend.class.getName());
|
||||
this.parent=parent;
|
||||
}
|
||||
|
||||
/*
|
||||
public void initEntry(VascEntry entry) throws Exception {
|
||||
if (entry.getVascFrontendData().getVascFrontend()==null) {
|
||||
entry.getVascFrontendData().setVascFrontend(this);
|
||||
} else {
|
||||
if (entry.getVascFrontendData().getVascFrontend()!=this) {
|
||||
throw new IllegalArgumentException("VascEntry has already a differtent VascViewRenderer attected");
|
||||
}
|
||||
}
|
||||
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
|
||||
/*
|
||||
entry.putUIComponent(VascTextField.class, SwingTextField.class);
|
||||
entry.putUIComponent(VascList.class, SwingList.class);
|
||||
entry.putUIComponent(VascToggle.class, SwingToggle.class);
|
||||
entry.putUIComponent(VascDate.class, SwingDate.class);
|
||||
entry.putUIComponent(VascColorChooser.class, SwingColorChooser.class);
|
||||
|
||||
this.entry=entry;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add swing implmented ui components
|
||||
*/
|
||||
protected void addUiComponents() {
|
||||
VascFrontendData vfd = getVascEntry().getVascFrontendData();
|
||||
|
||||
// required UI components
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_LABEL,SwingLabel.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_TEXT, SwingText.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_LIST, SwingList.class.getName());
|
||||
|
||||
// optional UI components
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_BOOLEAN , SwingBoolean.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_DATE , SwingDate.class.getName());
|
||||
vfd.putVascUIComponent(VascUIComponent.VASC_TEXTAREA, SwingTextArea.class.getName());
|
||||
}
|
||||
|
||||
public ImageIcon getImageIcon(String imageResource) {
|
||||
/// TODO hack beter
|
||||
|
@ -255,16 +257,32 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
public void createBody(JPanel body) throws Exception {
|
||||
body.setLayout(new SpringLayout());
|
||||
int column = 0;
|
||||
for(VascEntryField c:entry.getVascEntryFields()) {
|
||||
for (VascEntryField c:entry.getVascEntryFields()) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().initEditObjectColumn(c, bean);
|
||||
if (c.isEdit()==false) {
|
||||
continue;
|
||||
}
|
||||
column++;
|
||||
|
||||
for (int i=0;i<c.getVascEntryFieldType().getUIComponentCount();i++) {
|
||||
|
||||
VascUIComponent label = c.getVascEntryFieldType().provideLabelUIComponent(i,c);
|
||||
VascValueModel model = new VascValueModel();
|
||||
model.setValue(i18n(c.getName()));
|
||||
label.createComponent(entry,c,model,body);
|
||||
|
||||
VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c);
|
||||
model = new VascValueModel();
|
||||
model.setValue(c.getVascEntryFieldValue().getValue(c, bean));
|
||||
model.addListener(new VascColumnValueModelListener(c,bean));
|
||||
editor.createComponent(entry,c,model,body);
|
||||
}
|
||||
|
||||
/* OLD OLD OLD
|
||||
*
|
||||
*
|
||||
JLabel l = new JLabel();
|
||||
l.setHorizontalAlignment(JLabel.TRAILING);
|
||||
|
||||
l.setText(i18n(c.getName()));
|
||||
if(c.getDescription()!=null) {
|
||||
l.setToolTipText(i18n(c.getDescription()));
|
||||
|
@ -279,7 +297,8 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
continue;
|
||||
}
|
||||
|
||||
if(c.getVascEntryFieldType().getVascUIComponent()==null) {
|
||||
|
||||
if (c.getVascEntryFieldType().getVascUIComponent()==null) {
|
||||
JLabel valueLabel = new JLabel();
|
||||
valueLabel.setText(""+c.getVascEntryFieldValue().getValue(c, bean));
|
||||
//c.setColumnEditor(valueLabel);
|
||||
|
@ -292,6 +311,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
comp.createComponent(entry, model, body);
|
||||
//c.setColumnEditor(comp);
|
||||
}
|
||||
*/
|
||||
}
|
||||
//JComponent, rows, cols, initX, initY ,xPad, yPad
|
||||
SpringUtilities.makeCompactGrid(body, column,2, 6,6, 6,6);
|
||||
|
@ -469,7 +489,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
}
|
||||
table.revalidate();
|
||||
|
||||
TableCellRenderer renderer = new JComponententryCellRenderer();
|
||||
TableCellRenderer renderer = new JComponentTableHeaderCellRenderer();
|
||||
int counter=0;
|
||||
for(VascEntryField c:entry.getVascEntryFields()) {
|
||||
if (c.isList()==false) {
|
||||
|
@ -530,9 +550,10 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
}
|
||||
}
|
||||
}
|
||||
class JComponententryCellRenderer extends DefaultTableCellRenderer {
|
||||
class JComponentTableHeaderCellRenderer extends DefaultTableCellRenderer {
|
||||
private static final long serialVersionUID = 10L;
|
||||
public Component getentryCellRendererComponent(JTable table, Object value, boolean isSelected,boolean hasFocus, int row, int column) {
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,boolean hasFocus, int row, int column) {
|
||||
VascEntryField c = (VascEntryField)value;
|
||||
setText(i18n(c.getName()));
|
||||
setToolTipText(i18n(c.getDescription()));
|
||||
|
@ -551,7 +572,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
setFont(header.getFont());
|
||||
}
|
||||
}
|
||||
setBorder(UIManager.getBorder("entryHeader.cellBorder"));
|
||||
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import javax.swing.JCheckBox;
|
|||
import javax.swing.JComponent;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
|
||||
|
@ -49,7 +50,7 @@ public class SwingBoolean extends AbstractVascUIComponent {
|
|||
private JCheckBox checkBox = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
||||
public Object createComponent(VascEntry table,VascValueModel model,Object gui) throws Exception {
|
||||
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws Exception {
|
||||
checkBox = new JCheckBox();
|
||||
orgBackgroundColor = checkBox.getBackground();
|
||||
checkBox.setSelected((Boolean)model.getValue());
|
||||
|
|
|
@ -35,6 +35,8 @@ import javax.swing.JColorChooser;
|
|||
import javax.swing.JComponent;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
|
||||
|
@ -49,7 +51,7 @@ public class SwingColorChooser extends AbstractVascUIComponent {
|
|||
private JButton colorButton = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
||||
public Object createComponent(VascEntry table,VascValueModel model,Object gui) throws Exception {
|
||||
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws Exception {
|
||||
JButton colorButton = new JButton("Color");
|
||||
orgBackgroundColor = colorButton.getBackground();
|
||||
((JComponent)gui).add(colorButton);
|
||||
|
@ -98,7 +100,13 @@ class SelectActionListener3 implements ActionListener {
|
|||
*/
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (hexEncoding==false) {
|
||||
Color cur = (Color)model.getValue();
|
||||
Color cur=null;
|
||||
try {
|
||||
cur = (Color)model.getValue();
|
||||
} catch (VascException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
if (cur==null) {
|
||||
cur = Color.YELLOW;
|
||||
}
|
||||
|
@ -109,7 +117,13 @@ class SelectActionListener3 implements ActionListener {
|
|||
table.getVascFrontendData().getVascFrontendHelper().handleException(ee, table);
|
||||
}
|
||||
} else {
|
||||
String cur = (String)model.getValue();
|
||||
String cur=null;
|
||||
try {
|
||||
cur = (String)model.getValue();
|
||||
} catch (VascException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
Color c = Color.YELLOW;
|
||||
try {
|
||||
if (cur!=null) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import java.util.Date;
|
|||
import javax.swing.JComponent;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
import com.michaelbaranov.microba.calendar.DatePicker;
|
||||
|
@ -50,7 +51,7 @@ public class SwingDate extends AbstractVascUIComponent {
|
|||
private DatePicker datePicker = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
||||
public Object createComponent(VascEntry table,VascValueModel model,Object gui) throws Exception {
|
||||
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws Exception {
|
||||
datePicker = new DatePicker();
|
||||
orgBackgroundColor = datePicker.getBackground();
|
||||
datePicker.setDate((Date)model.getValue());
|
||||
|
|
83
src/com/idcanet/vasc/frontends/swing/ui/SwingLabel.java
Normal file
83
src/com/idcanet/vasc/frontends/swing/ui/SwingLabel.java
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.frontends.swing.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 21, 2008
|
||||
*/
|
||||
public class SwingLabel extends AbstractVascUIComponent {
|
||||
|
||||
private JLabel label = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
||||
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws Exception {
|
||||
label = new JLabel();
|
||||
label.setHorizontalAlignment(JLabel.TRAILING);
|
||||
orgBackgroundColor = label.getBackground();
|
||||
label.setText(""+model.getValue());
|
||||
((JComponent)gui).add(label);
|
||||
return label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
|
||||
*/
|
||||
public String getErrorText() {
|
||||
if (label==null) {
|
||||
return null;
|
||||
}
|
||||
return label.getToolTipText();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
|
||||
*/
|
||||
public void setErrorText(String text) {
|
||||
if (label==null) {
|
||||
return;
|
||||
}
|
||||
label.setToolTipText(text);
|
||||
if (text==null) {
|
||||
label.setBackground(orgBackgroundColor);
|
||||
} else {
|
||||
label.setBackground(Color.RED);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,6 +38,7 @@ import javax.swing.JList;
|
|||
import javax.swing.ListCellRenderer;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascList;
|
||||
import com.idcanet.vasc.core.ui.VascSelectItem;
|
||||
|
@ -54,7 +55,7 @@ public class SwingList extends AbstractVascUIComponent {
|
|||
private JComboBox comboBox = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
||||
public Object createComponent(final VascEntry table,final VascValueModel model,Object gui) throws Exception {
|
||||
public Object createComponent(final VascEntry table,VascEntryField entryField,final VascValueModel model,Object gui) throws Exception {
|
||||
VascList l = (VascList)getWrapper();
|
||||
if (l.getVascSelectItemModel()==null) {
|
||||
comboBox = new JComboBox();
|
||||
|
|
|
@ -34,6 +34,7 @@ import javax.swing.event.DocumentEvent;
|
|||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
|
||||
|
@ -43,12 +44,12 @@ import com.idcanet.vasc.core.ui.VascValueModel;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 12, 2007
|
||||
*/
|
||||
public class SwingTextField extends AbstractVascUIComponent {
|
||||
public class SwingText extends AbstractVascUIComponent {
|
||||
|
||||
private JTextField textField = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
||||
public Object createComponent(VascEntry table,VascValueModel model,Object gui) throws Exception {
|
||||
public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws Exception {
|
||||
textField = new JTextField();
|
||||
orgBackgroundColor = textField.getBackground();
|
||||
textField.setText(""+model.getValue());
|
||||
|
@ -87,9 +88,9 @@ class TextListener implements DocumentListener {
|
|||
|
||||
private VascValueModel model = null;
|
||||
//private VascTable table = null;
|
||||
private SwingTextField textField = null;
|
||||
private SwingText textField = null;
|
||||
|
||||
public TextListener(VascValueModel model,VascEntry table,SwingTextField textField) {
|
||||
public TextListener(VascValueModel model,VascEntry table,SwingText textField) {
|
||||
this.model=model;
|
||||
//this.table=table;
|
||||
this.textField=textField;
|
134
src/com/idcanet/vasc/frontends/swing/ui/SwingTextArea.java
Normal file
134
src/com/idcanet/vasc/frontends/swing/ui/SwingTextArea.java
Normal file
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.frontends.swing.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.AbstractVascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 21, 2008
|
||||
*/
|
||||
public class SwingTextArea extends AbstractVascUIComponent {
|
||||
|
||||
private JTextArea textArea = null;
|
||||
private Color orgBackgroundColor = null;
|
||||
|
||||
public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws Exception {
|
||||
textArea = new JTextArea();
|
||||
|
||||
//entryField.getVascEntryFieldType().getProperty(name)
|
||||
|
||||
//textArea.setRows(rows);
|
||||
//textArea.setColumns(columns);
|
||||
|
||||
orgBackgroundColor = textArea.getBackground();
|
||||
textArea.setText(""+model.getValue());
|
||||
((JComponent)gui).add(textArea);
|
||||
textArea.getDocument().addDocumentListener(new TextAreaListener(model,entry,this));
|
||||
return textArea;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText()
|
||||
*/
|
||||
public String getErrorText() {
|
||||
if (textArea==null) {
|
||||
return null;
|
||||
}
|
||||
return textArea.getToolTipText();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String)
|
||||
*/
|
||||
public void setErrorText(String text) {
|
||||
if (textArea==null) {
|
||||
return;
|
||||
}
|
||||
textArea.setToolTipText(text);
|
||||
if (text==null) {
|
||||
textArea.setBackground(orgBackgroundColor);
|
||||
} else {
|
||||
textArea.setBackground(Color.RED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TextAreaListener implements DocumentListener {
|
||||
|
||||
private VascValueModel model = null;
|
||||
private SwingTextArea textArea = null;
|
||||
|
||||
public TextAreaListener(VascValueModel model,VascEntry entry,SwingTextArea textArea) {
|
||||
this.model=model;
|
||||
this.textArea=textArea;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
|
||||
*/
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
update(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
|
||||
*/
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
update(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
|
||||
*/
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
update(e);
|
||||
}
|
||||
|
||||
public void update(DocumentEvent event) {
|
||||
try {
|
||||
String value = event.getDocument().getText(0, event.getDocument().getLength());
|
||||
model.setValue(value);
|
||||
textArea.setErrorText(null);
|
||||
} catch (Exception ee) {
|
||||
textArea.setErrorText(ee.getLocalizedMessage());
|
||||
//table.getVascTableController().handleException(ee, table);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,10 +28,12 @@ package com.idcanet.vasc.impl;
|
|||
|
||||
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.VascEntryFieldSet;
|
||||
import com.idcanet.vasc.core.VascEntryFinalizer;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.VascLinkEntry;
|
||||
|
||||
/**
|
||||
|
@ -47,12 +49,15 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
|
|||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFinalizer#finalizeVascEntry(com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
public VascEntry finalizeVascEntry(VascEntry entry) throws Exception {
|
||||
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException {
|
||||
|
||||
// First Check if we all have ids
|
||||
if (entry.getId()==null) {
|
||||
throw new IllegalArgumentException("The VascEntry need an id.");
|
||||
}
|
||||
if (entry.getBackendId()==null) {
|
||||
throw new IllegalArgumentException("The VascEntry need an backendId.");
|
||||
}
|
||||
if (entry.getVascEntryFields().size()==0) {
|
||||
throw new IllegalArgumentException("We need at least one VascEntryField.");
|
||||
}
|
||||
|
@ -108,7 +113,7 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
|
|||
|
||||
// fill up properties
|
||||
if (s.getName()==null) {
|
||||
s.setName("vasc.entry."+id+"."+sid+"name");
|
||||
s.setName("vasc.entry."+id+"."+sid+".name");
|
||||
}
|
||||
if (s.getDescription()==null) {
|
||||
s.setDescription("vasc.entry."+id+"."+sid+".description");
|
||||
|
@ -151,7 +156,7 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
|
|||
|
||||
// fill up properties
|
||||
if (vef.getName()==null) {
|
||||
vef.setName("vasc.entry."+id+"."+vid+"name");
|
||||
vef.setName("vasc.entry."+id+"."+vid+".name");
|
||||
}
|
||||
if (vef.getDescription()==null) {
|
||||
vef.setDescription("vasc.entry."+id+"."+vid+".description");
|
||||
|
@ -178,10 +183,14 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
|
|||
//vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
|
||||
}
|
||||
if (vef.getVascEntryFieldValue()==null) {
|
||||
//vef.setVascEntryFieldValue(entry.getVasc)
|
||||
vef.setVascEntryFieldValue( vascController.getVascBackendControllerResolver().getVascBackendController().getVascBackendById( entry.getBackendId() ).provideVascEntryFieldValue(vef) );
|
||||
}
|
||||
|
||||
if (vef.getVascEntryFieldType()==null) {
|
||||
|
||||
|
||||
vef.setVascEntryFieldType(vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField"));
|
||||
|
||||
if (vef.getDefaultValue() instanceof Boolean) {
|
||||
///vef.setVascEntryFieldType(vascEntryFieldType);
|
||||
} else if (vef.getDefaultValue() instanceof Date) {
|
||||
|
|
66
src/com/idcanet/vasc/impl/DefaultVascBackendController.java
Normal file
66
src/com/idcanet/vasc/impl/DefaultVascBackendController.java
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackend;
|
||||
import com.idcanet.vasc.core.VascBackendController;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 18, 2008
|
||||
*/
|
||||
public class DefaultVascBackendController implements VascBackendController {
|
||||
|
||||
private Map<String,VascBackend> backends = null;
|
||||
|
||||
public DefaultVascBackendController() {
|
||||
backends = new HashMap<String,VascBackend>(7);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackendController#getVascBackendById(java.lang.String)
|
||||
*/
|
||||
public VascBackend getVascBackendById(String id) {
|
||||
return backends.get(id);
|
||||
}
|
||||
|
||||
public void addVascBackend(VascBackend backend) {
|
||||
if (backend==null) {
|
||||
throw new NullPointerException("backend must not be null.");
|
||||
}
|
||||
if (backend.getId()==null) {
|
||||
throw new IllegalArgumentException("The backend must have an id.");
|
||||
}
|
||||
backends.put(backend.getId(), backend);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.impl;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackendController;
|
||||
import com.idcanet.vasc.core.VascBackendControllerResolver;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 18, 2008
|
||||
*/
|
||||
public class DefaultVascBackendControllerResolver implements VascBackendControllerResolver {
|
||||
|
||||
private VascBackendController vascBackendController = null;
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackendControllerResolver#getVascBackendController()
|
||||
*/
|
||||
public VascBackendController getVascBackendController() {
|
||||
return vascBackendController;
|
||||
}
|
||||
|
||||
public void setVascBackendController(VascBackendController vascBackendController) {
|
||||
this.vascBackendController=vascBackendController;
|
||||
}
|
||||
}
|
|
@ -77,6 +77,7 @@ public class DefaultVascEntry implements VascEntry {
|
|||
private List<VascLinkEntry> vascLinkEntries = null;
|
||||
private Map<String,Object> entryParameters = null;
|
||||
|
||||
private String backendId = null;
|
||||
private VascFrontendData vascFrontendData = null;
|
||||
|
||||
/**
|
||||
|
@ -473,4 +474,18 @@ public class DefaultVascEntry implements VascEntry {
|
|||
public void setVascFrontendData(VascFrontendData vascFrontendData) {
|
||||
this.vascFrontendData = vascFrontendData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the backendId
|
||||
*/
|
||||
public String getBackendId() {
|
||||
return backendId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param backendId the backendId to set
|
||||
*/
|
||||
public void setBackendId(String backendId) {
|
||||
this.backendId = backendId;
|
||||
}
|
||||
}
|
85
src/com/idcanet/vasc/impl/DefaultVascEntryController.java
Normal file
85
src/com/idcanet/vasc/impl/DefaultVascEntryController.java
Normal file
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryController;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 18, 2008
|
||||
*/
|
||||
public class DefaultVascEntryController implements VascEntryController {
|
||||
|
||||
private Map<String,VascEntry> entries = null;
|
||||
|
||||
public DefaultVascEntryController() {
|
||||
entries = new HashMap<String,VascEntry>();
|
||||
}
|
||||
|
||||
public void addVascEntry(VascEntry entry,VascController vascController) throws VascException {
|
||||
DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
|
||||
entry = f.finalizeVascEntry(entry,vascController);
|
||||
entries.put(entry.getId(), entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryController#getVascEntryById(java.lang.String)
|
||||
*/
|
||||
public VascEntry getVascEntryById(String id) {
|
||||
return entries.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryController#getVascEntryIds()
|
||||
*/
|
||||
public List<String> getVascEntryIds() {
|
||||
return new ArrayList<String>(entries.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retuns only the adminList table entries
|
||||
*/
|
||||
public List<String> getVascEntryAdminIds() {
|
||||
List<String> adminIds = new ArrayList<String>(30);
|
||||
for (VascEntry e:entries.values()) {
|
||||
if (Boolean.TRUE.equals(e.isVascAdmimList())) {
|
||||
adminIds.add(e.getId());
|
||||
}
|
||||
}
|
||||
return adminIds;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.impl;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntryController;
|
||||
import com.idcanet.vasc.core.VascEntryControllerResolver;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 18, 2008
|
||||
*/
|
||||
public class DefaultVascEntryControllerResolver implements VascEntryControllerResolver {
|
||||
|
||||
private VascEntryController vascEntryController = null;
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryControllerResolver#getVascEntryController()
|
||||
*/
|
||||
public VascEntryController getVascEntryController() {
|
||||
return vascEntryController;
|
||||
}
|
||||
|
||||
public void setVascEntryController(VascEntryController vascEntryController) {
|
||||
this.vascEntryController=vascEntryController;
|
||||
}
|
||||
|
||||
}
|
|
@ -27,7 +27,9 @@
|
|||
package com.idcanet.vasc.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackend;
|
||||
import com.idcanet.vasc.core.VascEntryFinalizer;
|
||||
|
@ -51,9 +53,11 @@ public class DefaultVascFrontendData implements VascFrontendData {
|
|||
private VascEntryFinalizer vascEntryFinalizer = null;
|
||||
private VascFrontendHelper vascFrontendHelper = null;
|
||||
private VascEntryResourceResolver vascEntryResourceResolver = null;
|
||||
private Map<String,String> uiComponents = null;
|
||||
|
||||
public DefaultVascFrontendData() {
|
||||
entryDataList = new ArrayList<Object>(0);
|
||||
uiComponents = new HashMap<String,String>(8);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,4 +157,18 @@ public class DefaultVascFrontendData implements VascFrontendData {
|
|||
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver) {
|
||||
this.vascEntryResourceResolver = vascEntryResourceResolver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendData#getVascUIComponent(java.lang.String)
|
||||
*/
|
||||
public String getVascUIComponent(String rendererId) {
|
||||
return uiComponents.get(rendererId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontendData#putVascUIComponent(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void putVascUIComponent(String rendererId, String uiComponentClass) {
|
||||
uiComponents.put(rendererId, uiComponentClass);
|
||||
}
|
||||
}
|
|
@ -26,8 +26,10 @@
|
|||
|
||||
package com.idcanet.vasc.impl;
|
||||
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryFinalizer;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -40,7 +42,7 @@ public class DefaultVascFrontendEntryFinalizer implements VascEntryFinalizer {
|
|||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFinalizer#finalizeVascEntry(com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
public VascEntry finalizeVascEntry(VascEntry entry) throws Exception {
|
||||
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException {
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
|
|
@ -27,9 +27,8 @@
|
|||
package com.idcanet.vasc.impl.entry;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
|
||||
import com.idcanet.x4o.element.ElementParameterException;
|
||||
import com.idcanet.x4o.element.ElementParameterNotFoundException;
|
||||
import com.idcanet.x4o.impl.DefaultElementParameterHelper;
|
||||
|
||||
/**
|
||||
|
@ -54,27 +53,35 @@ public class BeanPropertyVascEntryFieldValue implements VascEntryFieldValue {
|
|||
/**
|
||||
* @see com.idcanet.vasc.core.column.VascColumnValue#getValue(com.idcanet.vasc.core.column.VascTableColumn, java.lang.Object)
|
||||
*/
|
||||
public Object getValue(VascEntryField column,Object record) throws ElementParameterException,ElementParameterNotFoundException {
|
||||
public Object getValue(VascEntryField column,Object record) throws VascException {
|
||||
if(getProperty()==null) {
|
||||
return null;
|
||||
}
|
||||
if(getProperty().equals("")) {
|
||||
return "";
|
||||
}
|
||||
return helper.getParameter(record, getProperty());
|
||||
try {
|
||||
return helper.getParameter(record, getProperty());
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.column.VascColumnValue#setValue(com.idcanet.vasc.core.column.VascTableColumn, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public void setValue(VascEntryField column, Object record,Object value) throws ElementParameterException,ElementParameterNotFoundException {
|
||||
public void setValue(VascEntryField column, Object record,Object value) throws VascException {
|
||||
if(getProperty()==null) {
|
||||
return;
|
||||
}
|
||||
if(getProperty().equals("")) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
helper.setParameter(record, getProperty(),value);
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
helper.setParameter(record, getProperty(),value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,9 +48,9 @@ public class DefaultVascEntryFieldTypeController implements VascEntryFieldTypeCo
|
|||
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldTypeController#getVascEntryFieldType(java.lang.String)
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldTypeController#getVascEntryFieldTypeById(java.lang.String)
|
||||
*/
|
||||
public VascEntryFieldType getVascEntryFieldType(String name) {
|
||||
public VascEntryFieldType getVascEntryFieldTypeById(String name) {
|
||||
for(VascEntryFieldType v:parser.getTypes()) {
|
||||
if (v.getId().equals(name)) {
|
||||
return v;
|
||||
|
@ -60,9 +60,9 @@ public class DefaultVascEntryFieldTypeController implements VascEntryFieldTypeCo
|
|||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldTypeController#getVascEntryFieldTypeNames()
|
||||
* @see com.idcanet.vasc.core.VascEntryFieldTypeController#getVascEntryFieldTypeIds()
|
||||
*/
|
||||
public List<String> getVascEntryFieldTypeNames() {
|
||||
public List<String> getVascEntryFieldTypeIds() {
|
||||
List<String> result = new ArrayList<String>(5);
|
||||
for(VascEntryFieldType v:parser.getTypes()) {
|
||||
result.add(v.getId());
|
||||
|
|
|
@ -58,6 +58,8 @@ public class TestModelVascDataSource extends AbstractVascBackend implements Vasc
|
|||
t.setDescription("yoyo test");
|
||||
t.setName("this Name");
|
||||
t.setPrice(34.1f);
|
||||
t.setActive(true);
|
||||
t.setHexColor("#FF66EE");
|
||||
testModels.add(t);
|
||||
|
||||
t = new TestModel();
|
||||
|
@ -65,6 +67,8 @@ public class TestModelVascDataSource extends AbstractVascBackend implements Vasc
|
|||
t.setDescription("Model2 test");
|
||||
t.setName("BeanSourde");
|
||||
t.setPrice(19.2f);
|
||||
t.setActive(false);
|
||||
t.setTestModel((TestModel)testModels.get(0));
|
||||
testModels.add(t);
|
||||
}
|
||||
public TestModelVascDataSource(List<Object> testModels) {
|
||||
|
|
|
@ -34,6 +34,10 @@ import com.idcanet.vasc.core.VascEntry;
|
|||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.VascList;
|
||||
import com.idcanet.vasc.impl.DefaultVascBackedEntryFinalizer;
|
||||
import com.idcanet.vasc.impl.DefaultVascBackendController;
|
||||
import com.idcanet.vasc.impl.DefaultVascBackendControllerResolver;
|
||||
import com.idcanet.vasc.impl.DefaultVascEntryController;
|
||||
import com.idcanet.vasc.impl.DefaultVascEntryControllerResolver;
|
||||
import com.idcanet.vasc.impl.DefaultVascFrontendEntryFinalizer;
|
||||
import com.idcanet.vasc.impl.DefaultVascController;
|
||||
import com.idcanet.vasc.impl.DefaultVascEntry;
|
||||
|
@ -63,18 +67,23 @@ public class TestTable {
|
|||
|
||||
static VascController getDefaultVascController() throws Exception {
|
||||
|
||||
// for test
|
||||
TestModelVascDataSource backend = new TestModelVascDataSource();
|
||||
backend.setId("testBackend");
|
||||
|
||||
// config full controller for local jvm use
|
||||
DefaultVascController c = new DefaultVascController();
|
||||
|
||||
DefaultVascBackendControllerResolver vascBackendControllerResolver = new DefaultVascBackendControllerResolver();
|
||||
DefaultVascBackendController vascBackendController = new DefaultVascBackendController();
|
||||
vascBackendController.addVascBackend(backend);
|
||||
vascBackendControllerResolver.setVascBackendController(vascBackendController);
|
||||
c.setVascBackendControllerResolver(vascBackendControllerResolver);
|
||||
|
||||
//DefaultVascBackendControllerResolver vascBackendControllerResolver = new DefaultVascBackendControllerResolver();
|
||||
//c.setVascBackendControllerResolver(vascBackendControllerResolver);
|
||||
|
||||
|
||||
|
||||
//DefaultVascEntryControllerResolver vascEntryControllerResolver = new DefaultVascEntryControllerResolver();
|
||||
//c.setVascEntryControllerResolver(vascEntryControllerResolver);
|
||||
|
||||
|
||||
DefaultVascEntryControllerResolver vascEntryControllerResolver = new DefaultVascEntryControllerResolver();
|
||||
DefaultVascEntryController vascEntryController = new DefaultVascEntryController();
|
||||
vascEntryControllerResolver.setVascEntryController(vascEntryController);
|
||||
c.setVascEntryControllerResolver(vascEntryControllerResolver);
|
||||
|
||||
DefaultVascEntryFieldTypeControllerResolver vascEntryFieldTypeControllerResolver = new DefaultVascEntryFieldTypeControllerResolver();
|
||||
DefaultVascEntryFieldTypeController vascEntryFieldTypeController = new DefaultVascEntryFieldTypeController();
|
||||
|
@ -87,34 +96,24 @@ public class TestTable {
|
|||
|
||||
|
||||
static public VascEntry getVascTable() throws Exception {
|
||||
|
||||
// define query
|
||||
/*
|
||||
XTESParser parser = new XTESParser();
|
||||
parser.parseResource("/resources/xtes/tests.xml");
|
||||
TemplateStore store = XTESParser.getTemplateStore(parser.getElementContext());
|
||||
Query query = store.getQuery("testUsers2");
|
||||
*/
|
||||
|
||||
|
||||
VascController c = getDefaultVascController();
|
||||
|
||||
TestModelVascDataSource data = new TestModelVascDataSource();
|
||||
|
||||
|
||||
// config table
|
||||
VascEntry entry = new DefaultVascEntry();
|
||||
entry.setId("test1");
|
||||
entry.setBackendId("testBackend");
|
||||
|
||||
DefaultVascFrontendData vascFrontendData = new DefaultVascFrontendData();
|
||||
vascFrontendData.setVascBackend(data);
|
||||
vascFrontendData.setVascBackend(c.getVascBackendControllerResolver().getVascBackendController().getVascBackendById("testBackend"));
|
||||
|
||||
DefaultVascEntryResourceResolver vascEntryResourceResolver = new DefaultVascEntryResourceResolver();
|
||||
VascI18nTextValue vascEntryResourceResolver = new VascI18nTextValue();// new DefaultVascEntryResourceResolver();
|
||||
vascFrontendData.setVascEntryResourceResolver(vascEntryResourceResolver);
|
||||
|
||||
DefaultVascFrontendHelper vascFrontendHelper = new DefaultVascFrontendHelper();
|
||||
vascFrontendData.setVascFrontendHelper(vascFrontendHelper);
|
||||
|
||||
entry.setVascFrontendData(vascFrontendData);
|
||||
entry.setId("test1");
|
||||
|
||||
entry.addRowAction(new AddRowAction());
|
||||
entry.addRowAction(new EditRowAction());
|
||||
|
@ -129,21 +128,11 @@ public class TestTable {
|
|||
|
||||
VascEntryField field = new DefaultVascEntryField("name");
|
||||
field.setImage("/META-INF/images/silk/png/tick.png");
|
||||
try {
|
||||
field.setVascEntryFieldType(c.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldType("TextField"));
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
field.setVascEntryFieldValue(new BeanPropertyVascEntryFieldValue("name"));
|
||||
entry.addVascEntryField(field);
|
||||
|
||||
|
||||
field = new DefaultVascEntryField("description");
|
||||
field.setVascEntryFieldValue(new BeanPropertyVascEntryFieldValue("description"));
|
||||
entry.addVascEntryField(field);
|
||||
|
||||
|
||||
|
||||
field = new DefaultVascEntryField("active");
|
||||
field.setDefaultValue(true);
|
||||
entry.addVascEntryField(field);
|
||||
|
@ -153,8 +142,10 @@ public class TestTable {
|
|||
entry.addVascEntryField(field);
|
||||
|
||||
field = new DefaultVascEntryField("testModel");
|
||||
//field.setVascEntryFieldType(c.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField"));
|
||||
//field.getVascEntryFieldType()
|
||||
VascList list = new VascList();
|
||||
list.setVascSelectItemModel(data);
|
||||
list.setVascSelectItemModel((TestModelVascDataSource)c.getVascBackendControllerResolver().getVascBackendController().getVascBackendById("testBackend"));
|
||||
//field.setVascUIComponent(list);
|
||||
entry.addVascEntryField(field);
|
||||
|
||||
|
@ -168,11 +159,11 @@ public class TestTable {
|
|||
|
||||
printEntry(entry);
|
||||
DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
|
||||
entry = f.finalizeVascEntry(entry);
|
||||
entry = f.finalizeVascEntry(entry,c);
|
||||
printEntry(entry);
|
||||
|
||||
DefaultVascFrontendEntryFinalizer f2 = new DefaultVascFrontendEntryFinalizer();
|
||||
entry = f2.finalizeVascEntry(entry);
|
||||
entry = f2.finalizeVascEntry(entry,c);
|
||||
//printEntry(entry);
|
||||
|
||||
return entry;
|
||||
|
|
|
@ -2,7 +2,23 @@
|
|||
test = Dit is een test
|
||||
|
||||
|
||||
vasc.entry.test1.headerName = Test Entry 1
|
||||
vasc.entry.test1.headerDescription = De test omschrijving van deze entry
|
||||
vasc.entry.test1.headerImage = /META-INF/images/silk/png/tick.png
|
||||
|
||||
vasc.entry.test1.name.name = Naam
|
||||
vasc.entry.test1.name.description = De naam van het object
|
||||
vasc.entry.test1.description.name = Omschrijving
|
||||
vasc.entry.test1.description.description = De omschrijving van het object
|
||||
vasc.entry.test1.active.name = Aktief
|
||||
vasc.entry.test1.active.description = Is deze actief
|
||||
vasc.entry.test1.active.image = /META-INF/images/silk/png/tick.png
|
||||
vasc.entry.test1.date.name = Datum
|
||||
vasc.entry.test1.date.description = De datum om te testen
|
||||
vasc.entry.test1.testModel.name = Tests Models
|
||||
vasc.entry.test1.testModel.description = ddddd
|
||||
vasc.entry.test1.hexColor.name = Kleur
|
||||
vasc.entry.test1.hexColor.description = De kleur van omo power.
|
||||
|
||||
vasc.dialog.save.name = Opslaan
|
||||
vasc.dialog.save.tooltip = Het opslaan van de waardes.
|
||||
|
@ -12,8 +28,8 @@ vasc.dialog.cancel.name = Annuleren
|
|||
vasc.dialog.cancel.tooltip = Niet opslaan van de waardes.
|
||||
vasc.dialog.cancel.image = /META-INF/images/silk/png/cancel.png
|
||||
|
||||
|
||||
|
||||
vasc.dialog.delete.message = Wilt u deze {0} record verwijderen ?
|
||||
vasc.dialog.delete.title = Verwijderen
|
||||
|
||||
vasc.action.add.name = Toevoegen
|
||||
vasc.action.add.tooltip = Voegt een nieuw rij toe.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xtes xmlns="http://xtes.idcanet.com/eld/xtes-lang.eld"
|
||||
<vasc xmlns:v="http://vasc.idcanet.com/eld/vasc-lang.eld"
|
||||
xmlns:x4o="http://x4o.idcanet.com/eld/x4o-lang.eld"
|
||||
>
|
||||
<!--
|
||||
|
@ -15,7 +15,7 @@ Master
|
|||
- Details
|
||||
|
||||
-->
|
||||
|
||||
<!--
|
||||
<x4o:bean el.id="dataSource" bean.class="com.id.."/>
|
||||
<x4o:bean el.id="tableController" bean.class="com.id.."/>
|
||||
|
||||
|
@ -70,14 +70,9 @@ Master
|
|||
<v:viewController name="ldapUsers" primaryKey="user">
|
||||
<x4o:templateTag template="${posixUserSchema}"/>
|
||||
<x4o:templateTag template="${sambaUserSchema}">
|
||||
<!-- template overrideing -->
|
||||
<v:field name="sambaGroupType" v.defaultValue="3"/>
|
||||
</x4o:templateTag>
|
||||
|
||||
<!-- redifine overrideing -->
|
||||
<v:field name="sambaGroupType" v.defaultValue="4"/>
|
||||
|
||||
|
||||
</v:viewController>
|
||||
|
||||
<vasc:fieldType name="EmailField2">
|
||||
|
@ -90,7 +85,92 @@ Master
|
|||
<vasc:fieldHint key="timeout" default="200"/>
|
||||
</vasc:fieldType>
|
||||
|
||||
<v:viewController name="sudoers" primaryKey="user">
|
||||
-->
|
||||
|
||||
<v:entry id="test1" backendId="testBackend1">
|
||||
<v:field id="name"/>
|
||||
<v:field id="description"/>
|
||||
<v:field id="active"/>
|
||||
<v:field id="model" vascEntryFieldType="ListField" selectItemId="testBackend1"/>
|
||||
</v:entry>
|
||||
|
||||
<v:entry
|
||||
id="test2"
|
||||
name="iets"
|
||||
description="ietsdescrip"
|
||||
helpId="someHelpKey"
|
||||
image="imsdf"
|
||||
|
||||
headerName="sdf"
|
||||
headerDescription="sdfsdf"
|
||||
headerImage="sdfsdfsd"
|
||||
|
||||
primaryKeyFieldId="name"
|
||||
displayNameFieldId="name"
|
||||
|
||||
vascAdmimList="true"
|
||||
vascAdmimEdit="true"
|
||||
vascAdmimCreate="true"
|
||||
vascAdmimDelete="true"
|
||||
|
||||
backendId="testBackend1"
|
||||
>
|
||||
<v:field id="name"/>
|
||||
<v:field
|
||||
id="active"
|
||||
backendName="active"
|
||||
name="active"
|
||||
description="active"
|
||||
helpId="active"
|
||||
image="active"
|
||||
|
||||
defaultValue="true"
|
||||
|
||||
sizeList="styleClass"
|
||||
sizeEdit="styleClass"
|
||||
styleList="styleClass"
|
||||
styleEdit="styleClass"
|
||||
|
||||
choices=""
|
||||
|
||||
view="true"
|
||||
optional="false"
|
||||
|
||||
create="true"
|
||||
edit="true"
|
||||
editReadOnly="false"
|
||||
list="true"
|
||||
|
||||
rolesCreate="admin|manager"
|
||||
rolesEdit=""
|
||||
rolesEditReadOnly=""
|
||||
rolesList=""
|
||||
|
||||
vascEntryFieldType=""
|
||||
vascEntryFieldEventChannel=""
|
||||
>
|
||||
<v:intSizeValidator min="20"/>
|
||||
</v:field>
|
||||
|
||||
<v:fieldSet
|
||||
id="set1"
|
||||
vascEntryFieldIds="name,active"
|
||||
|
||||
name="set1"
|
||||
description="set1"
|
||||
helpId="set1"
|
||||
image="set1"
|
||||
|
||||
styleList="styleClass"
|
||||
styleEdit="styleClass"
|
||||
|
||||
collapsed="false"
|
||||
optional="false"
|
||||
/>
|
||||
</v:entry>
|
||||
|
||||
|
||||
<v:entry id="sudoers">
|
||||
<v:field name="user" backendName="cn" readOnly="true"/>
|
||||
<v:field name="description" backendName="description">
|
||||
<v:roles edit="admin" list="all"/>
|
||||
|
@ -123,21 +203,16 @@ Master
|
|||
<v:link fieldName="gidNumber" viewController="ldapGroups" parameterName="group_key,${baseDn}"/>
|
||||
|
||||
<v:detail fieldName="gidNumber" detailController="${ldapGroups}"/>
|
||||
|
||||
<!-- default are oke here
|
||||
<v:createView allField="true"/>
|
||||
<v:editView allField="true" inverse="true">
|
||||
<v:fieldName name="description"/>
|
||||
</v:editView>
|
||||
-->
|
||||
|
||||
|
||||
<v:ldapBackend ldapConnection="${sudoers}">
|
||||
<x4o:property name="list_filter">(&(objectClass=sudoRole))</x4o:property>
|
||||
<x4o:property name="delete">${baseDn},cn=%s</x4o:property>
|
||||
<x4o:property name="new_classes">sudoRole,top</x4o:property>
|
||||
</v:ldapBackend>
|
||||
</v:viewController>
|
||||
</v:entry>
|
||||
|
||||
<!--
|
||||
<jsf-vasc:viewManager controller="${sudoers}">
|
||||
|
||||
</jsf-vasc:viewManager>
|
||||
|
@ -183,7 +258,7 @@ Master
|
|||
<view>
|
||||
|
||||
</view>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
|
@ -191,7 +266,7 @@ Master
|
|||
# Convert from xml -> csv and html or xitext
|
||||
</xslt>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<query name="limit">
|
||||
<sql>
|
||||
LIMIT <parameter name="limit"/>
|
||||
|
@ -219,11 +294,10 @@ Master
|
|||
<comment>Bla bla</comment>
|
||||
<comment>Also see this site http://www.google.com</comment>
|
||||
</query>
|
||||
|
||||
|
||||
<query name="testUsers2" type="hql">
|
||||
<x4o:property name="persistanceSession" value="sessionName"/>
|
||||
<sql>
|
||||
<!-- SOME COMMENT -->
|
||||
<include name="baseSelect"/>
|
||||
<parameter name="extra_where"/>
|
||||
AND role is in <parameter name="roles"/>
|
||||
|
@ -234,4 +308,5 @@ Master
|
|||
<parameterValue name="limit" value="15"/>
|
||||
<parameterValue name="offset" value="25"/>
|
||||
</query>
|
||||
</xtes>
|
||||
-->
|
||||
</vasc>
|
Loading…
Reference in a new issue