Clean demo directory layout
This commit is contained in:
parent
b3923bd2fb
commit
7c044adb1f
61 changed files with 2334 additions and 252 deletions
|
|
@ -53,6 +53,18 @@ abstract public class AbstractVascBackend implements VascBackend {
|
|||
this.id=id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#startBackend()
|
||||
*/
|
||||
public void startBackend() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#stopBackend()
|
||||
*/
|
||||
public void stopBackend() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#isReadOnly()
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -41,7 +41,10 @@ public interface VascBackend {
|
|||
|
||||
public String getId();
|
||||
public void setId(String id);
|
||||
|
||||
|
||||
public void startBackend();
|
||||
public void stopBackend();
|
||||
|
||||
public List<Object> execute(VascBackendState state) throws VascException;
|
||||
|
||||
public boolean isReadOnly();
|
||||
|
|
|
|||
|
|
@ -31,4 +31,8 @@ package net.forwardfire.vasc.backend;
|
|||
public interface VascBackendControllerLocal extends VascBackendController {
|
||||
|
||||
public void addVascBackend(VascBackend backend);
|
||||
|
||||
public void removeVascBackendById(String backendId);
|
||||
|
||||
public void clearAndStopBackends();
|
||||
}
|
||||
|
|
@ -68,6 +68,20 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#startBackend()
|
||||
*/
|
||||
public void startBackend() {
|
||||
backend.startBackend();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#stopBackend()
|
||||
*/
|
||||
public void stopBackend() {
|
||||
backend.stopBackend();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#isReadOnly()
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
private int pageSizeMax = 0;
|
||||
private String sortField = null;
|
||||
private boolean sortDir = true;
|
||||
private boolean requestFlush = false;
|
||||
|
||||
public VascBackendProxyCache() {
|
||||
dataState = new HashMap<String,Object>(10);
|
||||
|
|
@ -105,9 +106,26 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
changed = true;
|
||||
}
|
||||
searchString = state.getSearchString();
|
||||
|
||||
if (requestFlush) {
|
||||
requestFlush = false;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#stopBackend()
|
||||
*/
|
||||
@Override
|
||||
public void stopBackend() {
|
||||
super.stopBackend();
|
||||
data.clear();
|
||||
dataState.clear();
|
||||
requestFlush = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state)
|
||||
*/
|
||||
|
|
@ -128,4 +146,31 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#delete(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void delete(Object object) throws VascException {
|
||||
requestFlush = true;
|
||||
super.delete(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object merge(Object object) throws VascException {
|
||||
requestFlush = true;
|
||||
return super.merge(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void persist(Object object) throws VascException {
|
||||
requestFlush = true;
|
||||
super.persist(object);
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,8 @@ public interface VascFrontendActions {
|
|||
|
||||
public void deleteObject();
|
||||
|
||||
public void persistObject();
|
||||
|
||||
public Object mergeObject();
|
||||
|
||||
public void sortAction(VascEntryField field);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* DefaultVascBackendController stores the vasc backends.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 18, 2008
|
||||
|
|
@ -54,18 +54,8 @@ public class DefaultVascBackendController implements VascBackendControllerLocal
|
|||
}
|
||||
|
||||
/**
|
||||
* Local
|
||||
* @see net.forwardfire.vasc.backend.VascBackendController#getVascBackendIds()
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
public List<String> getVascBackendIds() {
|
||||
List<String> result = new ArrayList<String>(50);
|
||||
for (String id:backends.keySet()) {
|
||||
|
|
@ -74,5 +64,39 @@ public class DefaultVascBackendController implements VascBackendControllerLocal
|
|||
Collections.sort(result); // lets do abc for consistance behauvior.
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackendControllerLocal#addVascBackend(net.forwardfire.vasc.backend.VascBackend)
|
||||
*/
|
||||
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.");
|
||||
}
|
||||
backend.startBackend();
|
||||
backends.put(backend.getId(), backend);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackendControllerLocal#removeVascBackendById(java.lang.String)
|
||||
*/
|
||||
public void removeVascBackendById(String backendId) {
|
||||
VascBackend backend = getVascBackendById(backendId);
|
||||
if (backend==null) {
|
||||
throw new NullPointerException("Could not find backend to remove with id: "+backendId);
|
||||
}
|
||||
backend.stopBackend();
|
||||
backends.remove(backendId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackendControllerLocal#clearAndStopBackends()
|
||||
*/
|
||||
public void clearAndStopBackends() {
|
||||
for (String backendId:getVascBackendIds()) {
|
||||
removeVascBackendById(backendId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -120,17 +120,32 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendHelper#mergeObject(net.forwardfire.vasc.core.VascEntry)
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendActions#persistObject()
|
||||
*/
|
||||
public void persistObject() {
|
||||
saveObject(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontendActions#mergeObject()
|
||||
*/
|
||||
public Object mergeObject() {
|
||||
return saveObject(false);
|
||||
}
|
||||
|
||||
protected Object saveObject(boolean persist) {
|
||||
Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
|
||||
Object result = null;
|
||||
try {
|
||||
entry.getVascFrontendData().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_UPDATE,object);
|
||||
int index = removeObjectFromDataList(object);
|
||||
|
||||
// merge object on backend
|
||||
result = entry.getVascFrontendData().getVascEntryState().getVascBackend().merge(object);
|
||||
// save object on backend
|
||||
if (persist) {
|
||||
entry.getVascFrontendData().getVascEntryState().getVascBackend().persist(object);
|
||||
} else {
|
||||
result = entry.getVascFrontendData().getVascEntryState().getVascBackend().merge(object);
|
||||
}
|
||||
|
||||
// put object thrue the filters
|
||||
for (VascBackendFilter filter:entry.getVascBackendFilters()) {
|
||||
|
|
@ -148,7 +163,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
}
|
||||
|
||||
/**
|
||||
* Deletes the selected row object from the list and fires event.
|
||||
* Deletes the selected row object from the back-end and list and fires events.
|
||||
* @param entry
|
||||
* @param object
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,19 +4,22 @@
|
|||
<eld:elementClass tag="root" objectClassName="java.lang.Object">
|
||||
<eld:elementDescription>Fake root tag</eld:elementDescription>
|
||||
</eld:elementClass>
|
||||
|
||||
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntry" childClass="net.forwardfire.vasc.core.VascEntryFieldSet" method="addVascEntryFieldSet"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntry" childClass="net.forwardfire.vasc.core.VascLinkEntry" method="addVascLinkEntry"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntry" childClass="net.forwardfire.vasc.backend.VascBackendFilter" method="addVascBackendFilter"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntry" childClass="net.forwardfire.vasc.core.actions.GlobalVascAction" method="addGlobalAction"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntry" childClass="net.forwardfire.vasc.core.actions.RowVascAction" method="addRowAction"/>
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntry" childClass="net.forwardfire.vasc.core.actions.ColumnVascAction" method="addColumnAction"/>
|
||||
|
||||
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntryField" childClass="net.forwardfire.vasc.validators.VascValidator" method="addVascValidator"/>
|
||||
|
||||
<eld:elementRefectionBindingHandler parentClass="net.forwardfire.vasc.core.VascEntryField" childClass="net.forwardfire.vasc.validators.VascValidator" method="addVascValidator"/>
|
||||
<eld:elementBindingHandler bean.class="net.forwardfire.vasc.impl.x4o.SelectItemModelBindingHandler"/>
|
||||
<eld:elementBindingHandler bean.class="net.forwardfire.vasc.impl.x4o.VascEntryFieldBindingHandler"/>
|
||||
|
||||
<eld:elementInterface interfaceClass="net.forwardfire.vasc.backend.VascBackend">
|
||||
<eld:elementConfigurator bean.class="net.forwardfire.vasc.impl.x4o.VascBackendElementConfigurator" configAction="true"/>
|
||||
</eld:elementInterface>
|
||||
|
||||
|
||||
<!-- Object for building an entry -->
|
||||
<eld:elementClass tag="entry" objectClassName="net.forwardfire.vasc.impl.DefaultVascEntry" >
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue