2
0
Fork 0

Added pdf export support, export servlet support, renamed frontends

without s and made vasc config object.
This commit is contained in:
Willem Cazander 2012-05-12 17:26:21 +02:00
parent efcbdbd519
commit b3923bd2fb
160 changed files with 5001 additions and 2552 deletions

View file

@ -1,5 +1,16 @@
== TODO ==
- demo user
- demo user_groups
- user log
- demo vasc_settings
- demo vasc_audit_log
- demo menu
- demo wiki
- encodeing select model
- lcoale select model
- x4o template
- swing readonly field editor
- order by list and edit.

View file

@ -101,7 +101,7 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend {
}
i++;
}
if (isPageable()) {
if (isPageable() && state.getPageSize()>0) {
q.setFirstResult(state.getPageIndex());
q.setMaxResults(state.getPageSize());
}

View file

@ -101,7 +101,7 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend
//System.out.println("Set para index: "+i+" value: "+valueObject+" valueClass: "+valueObject.getClass()+" valueType: "+value.getValueType());
i++;
}
if (isPageable()) {
if (isPageable() && state.getPageSize()>0) {
q.setFirstResult(state.getPageIndex());
q.setMaxResults(state.getPageSize());
}

View file

@ -158,7 +158,7 @@ public class MetaModelVascBackend extends AbstractVascBackend {
Schema schema = dataContext.getDefaultSchema();
Table t = schema.getTableByName(table);
Query q = createFilterQuery(state,t,false);
if (isPageable()) {
if (isPageable() && state.getPageSize()>0) {
q.setFirstRow(state.getPageIndex());
q.setMaxRows(state.getPageSize());
}

View file

@ -93,7 +93,7 @@ public class MongodbVascBackend extends AbstractVascBackend {
DBCollection coll = getDBCollection();
DBObject query = createFilterQuery(state);
DBCursor cur = coll.find(query);
if (isPageable()) {
if (isPageable() && state.getPageSize()>0) {
cur.limit(state.getPageSize());
cur.skip(state.getPageIndex());
}

View file

@ -21,6 +21,11 @@
<artifactId>vasc-xpql</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc.lib</groupId>
<artifactId>vasc-lib-jr4o</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>

View file

@ -22,7 +22,6 @@
package net.forwardfire.vasc.backend.data;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
@ -30,6 +29,7 @@ import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
import org.x4o.xml.impl.DefaultElementObjectPropertyValue;
/**
* BeanVascEntryFieldValue provides get/set support for bean based backends.
*
* @author Willem Cazander
* @version 1.0 Dec 05, 2009

View file

@ -25,11 +25,11 @@ package net.forwardfire.vasc.backend.data;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
/**
* @author willemc
*
* BeanVascEntryRecordCreator creates a new backend record based on class object.
*
* @author Willem Cazander
* @version 1.0 Dec 05, 2009
*/
public class BeanVascEntryRecordCreator implements VascEntryRecordCreator {

View file

@ -28,11 +28,11 @@ import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
/**
* @author willemc
*
* MapVascEntryFieldValue provides get/set support on Map record object.
*
* @author Willem Cazander
* @version 1.0 Dec 05, 2009
*/
public class MapVascEntryFieldValue implements VascEntryFieldValue {

View file

@ -28,11 +28,11 @@ import java.util.Map;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
/**
* @author willemc
*
* MapVascEntryRecordCreator creates a new HashMap for Map based record backends.
*
* @author Willem Cazander
* @version 1.0 Dec 05, 2009
*/
public class MapVascEntryRecordCreator implements VascEntryRecordCreator {

View file

@ -35,22 +35,39 @@ import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
/**
* AbstractVascBackendProxy to implement missing features of the backend.
* VascBackendProxy to implement missing features of the backend.
*
* @author Willem Cazander
* @version 1.0 Apr 1, 2009
*/
abstract public class AbstractVascBackendProxy implements VascBackend {
abstract public class AbstractVascBackendProxy implements VascBackendProxy {
protected VascBackend backend = null;
protected VascEntry entry = null;
public AbstractVascBackendProxy(VascBackend backend) {
abstract public VascBackendProxy clone() throws CloneNotSupportedException;
/**
* @see net.forwardfire.vasc.backend.proxy.VascBackendProxy#initProxy(net.forwardfire.vasc.backend.VascBackend, net.forwardfire.vasc.core.VascEntry)
*/
public void initProxy(VascBackend backend, VascEntry entry) {
if (backend==null) {
throw new NullPointerException("backend object mey not be null.");
throw new NullPointerException("backend object may not be null.");
}
if (entry==null) {
throw new NullPointerException("entry object may not be null.");
}
this.backend=backend;
this.entry=entry;
}
/**
* @see net.forwardfire.vasc.backend.proxy.VascBackendProxy#isProxyNeeded()
*/
public boolean isProxyNeeded() {
return true;
}
/**
* @see net.forwardfire.vasc.backend.VascBackend#isReadOnly()
*/

View file

@ -0,0 +1,41 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.backend.proxy;
import net.forwardfire.vasc.backend.VascBackend;
import net.forwardfire.vasc.core.VascEntry;
/**
* VascBackendProxy interface to make proxies configable.
*
* @author Willem Cazander
* @version 1.0 May 9, 2012
*/
public interface VascBackendProxy extends VascBackend,Cloneable {
public void initProxy(VascBackend backend,VascEntry entry);
public boolean isProxyNeeded();
public VascBackendProxy clone() throws CloneNotSupportedException;
}

View file

@ -26,9 +26,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.forwardfire.vasc.backend.VascBackend;
import net.forwardfire.vasc.backend.VascBackendState;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascException;
/**
@ -41,14 +39,27 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
private Long records = null;
private List<Object> data = null;
private String dataSearchString = null;
private String searchString = null;
private Map<String,Object> dataState = null;
private int pageIndex = 0;
private int pageSize = 0;
private int pageSizeMax = 0;
private String sortField = null;
private boolean sortDir = true;
public VascBackendProxyCache(VascBackend backend,VascEntry entry) {
super(backend);
public VascBackendProxyCache() {
dataState = new HashMap<String,Object>(10);
}
/**
* @see java.lang.Object#clone()
*/
@Override
public VascBackendProxy clone() throws CloneNotSupportedException {
VascBackendProxyCache result = new VascBackendProxyCache();
return result;
}
private boolean isStateChanged(VascBackendState state) {
boolean changed = false;
for (String key:state.getDataParameterKeys()) {
@ -68,10 +79,32 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
}
}
if (state.getSearchString()!=null && state.getSearchString().equals(dataSearchString)==false) {
if (state.getSortField()!=null && state.getSortField().equals(sortField)==false) {
changed = true;
}
dataSearchString = state.getSearchString();
sortField = state.getSortField();
if (state.isSortAscending()==sortDir) {
changed = true;
}
sortDir = state.isSortAscending();
if (state.getPageSizeMax()==pageSizeMax) {
changed = true;
}
pageSizeMax = state.getPageSizeMax();
if (state.getPageSize()==pageSize) {
changed = true;
}
pageSize = state.getPageSize();
if (state.getPageIndex()==pageIndex) {
changed = true;
}
pageIndex = state.getPageIndex();
if (state.getSearchString()!=null && state.getSearchString().equals(searchString)==false) {
changed = true;
}
searchString = state.getSearchString();
return changed;
}

View file

@ -32,9 +32,6 @@ import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.entry.VascEntryBackendEventListener;
import net.forwardfire.vasc.core.entry.VascEntryBackendEventListener.VascBackendEventType;
/**
* Holds !! and fires the backend event listeners.
*
@ -44,10 +41,18 @@ import net.forwardfire.vasc.core.entry.VascEntryBackendEventListener.VascBackend
public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
private List<VascEntryBackendEventListener> listeners = null;
private VascEntry entry = null;
public VascBackendProxyEventExecutor(VascBackend backend,VascEntry entry) {
super(backend);
/**
* @see java.lang.Object#clone()
*/
@Override
public VascBackendProxy clone() throws CloneNotSupportedException {
VascBackendProxyEventExecutor result = new VascBackendProxyEventExecutor();
return result;
}
public void initProxy(VascBackend backend,VascEntry entry) {
super.initProxy(backend, entry);
this.entry=entry;
this.listeners=new ArrayList<VascEntryBackendEventListener>(10);
ClassLoader cl = Thread.currentThread().getContextClassLoader();
@ -64,13 +69,19 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
listeners.add(listener);
}
}
public VascBackendProxyEventExecutor(VascBackend backend,VascEntry entry,List<VascEntryBackendEventListener> listeners) {
super(backend);
this.entry=entry;
this.listeners=listeners;
}
public void addVascEntryBackendEventListener(VascEntryBackendEventListener listener) {
listeners.add(listener);
}
public void removeVascEntryBackendEventListener(VascEntryBackendEventListener listener) {
listeners.remove(listener);
}
public List<VascEntryBackendEventListener> getVascEntryBackendEventListeners() {
return listeners;
}
private void fireVascEvent(VascBackendEventType type, Object data) {
for (int i=0;i<listeners.size();i++) {
VascEntryBackendEventListener l = listeners.get(i);

View file

@ -42,11 +42,37 @@ import net.forwardfire.vasc.core.VascException;
public class VascBackendProxyFilter extends AbstractVascBackendProxy {
private long records = 0;
private VascBackendFilter filter = null;
private List<VascBackendFilter> filters = null;
public VascBackendProxyFilter(VascBackend backend,VascEntry entry,VascBackendFilter filter) {
super(backend);
this.filter=filter;
/**
* @see java.lang.Object#clone()
*/
@Override
public VascBackendProxy clone() throws CloneNotSupportedException {
VascBackendProxyFilter result = new VascBackendProxyFilter();
return result;
}
/**
* @see net.forwardfire.vasc.backend.proxy.VascBackendProxy#initProxy(net.forwardfire.vasc.backend.VascBackend, net.forwardfire.vasc.core.VascEntry)
*/
public void initProxy(VascBackend backend, VascEntry entry) {
super.initProxy(backend,entry);
filters = entry.getVascBackendFilters();
for (VascBackendFilter filter:filters) {
filter.initFilter(entry);
}
}
/**
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#isProxyNeeded()
*/
@Override
public boolean isProxyNeeded() {
if (entry.getVascBackendFilters().isEmpty()) {
return false;
}
return true;
}
/**
@ -55,14 +81,19 @@ public class VascBackendProxyFilter extends AbstractVascBackendProxy {
@Override
public List<Object> execute(VascBackendState state) throws VascException {
List<Object> result = backend.execute(state);
if (filter==null) {
if (filters==null) {
return result;
}
if (filters.isEmpty()) {
return result;
}
List<Object> search = new ArrayList<Object>(result.size()/2);
for (Object o:result) {
Object r = filter.filterObject(o);
if (r!=null) {
search.add(r);
for (VascBackendFilter filter:filters) {
Object r = filter.filterObject(o);
if (r!=null) {
search.add(r);
}
}
}
records = search.size();

View file

@ -25,13 +25,9 @@ package net.forwardfire.vasc.backend.proxy;
import java.util.ArrayList;
import java.util.List;
import net.forwardfire.vasc.backend.VascBackend;
import net.forwardfire.vasc.backend.VascBackendState;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascException;
/**
* Simulates a real pages backend.
*
@ -42,10 +38,26 @@ public class VascBackendProxyPaged extends AbstractVascBackendProxy {
private long records = 0;
public VascBackendProxyPaged(VascBackend backend,VascEntry entry) {
super(backend);
/**
* @see java.lang.Object#clone()
*/
@Override
public VascBackendProxy clone() throws CloneNotSupportedException {
VascBackendProxyPaged result = new VascBackendProxyPaged();
return result;
}
/**
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#isProxyNeeded()
*/
@Override
public boolean isProxyNeeded() {
if (backend.isPageable()) {
return false;
}
return true;
}
/**
* @see net.forwardfire.vasc.backend.VascBackend#isPageable()
*/

View file

@ -25,9 +25,7 @@ package net.forwardfire.vasc.backend.proxy;
import java.util.ArrayList;
import java.util.List;
import net.forwardfire.vasc.backend.VascBackend;
import net.forwardfire.vasc.backend.VascBackendState;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
@ -41,13 +39,27 @@ import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
public class VascBackendProxySearch extends AbstractVascBackendProxy {
private long records = 0;
private VascEntry entry = null;
public VascBackendProxySearch(VascBackend backend,VascEntry entry) {
super(backend);
this.entry=entry;
/**
* @see java.lang.Object#clone()
*/
@Override
public VascBackendProxy clone() throws CloneNotSupportedException {
VascBackendProxySearch result = new VascBackendProxySearch();
return result;
}
/**
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#isProxyNeeded()
*/
@Override
public boolean isProxyNeeded() {
if (backend.isSearchable()) {
return false;
}
return true;
}
/**
* @see net.forwardfire.vasc.backend.VascBackend#isSearchable()
*/

View file

@ -26,9 +26,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import net.forwardfire.vasc.backend.VascBackend;
import net.forwardfire.vasc.backend.VascBackendState;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
@ -40,15 +38,26 @@ import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
* @version 1.0 Oct 27, 2007
*/
public class VascBackendProxySort extends AbstractVascBackendProxy {
private VascEntry entry = null;
public VascBackendProxySort(VascBackend backend,VascEntry entry) {
super(backend);
this.entry=entry;
/**
* @see java.lang.Object#clone()
*/
@Override
public VascBackendProxy clone() throws CloneNotSupportedException {
VascBackendProxySort result = new VascBackendProxySort();
return result;
}
// sort stuff
/**
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#isProxyNeeded()
*/
@Override
public boolean isProxyNeeded() {
if (backend.isSortable()) {
return false;
}
return true;
}
/**
* @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state)

View file

@ -26,14 +26,11 @@ import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.forwardfire.vasc.backend.VascBackend;
import net.forwardfire.vasc.backend.VascBackendState;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascException;
/**
* Does simple caching for the data.
* Does simple timer logging for the backend actions.
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2009
@ -43,11 +40,20 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
protected Logger logger = null;
protected Level logLevel = Level.INFO;
public VascBackendProxyTimerLogger(VascBackend backend,VascEntry entry) {
super(backend);
public VascBackendProxyTimerLogger() {
logger = Logger.getLogger(VascBackendProxyTimerLogger.class.getName());
}
/**
* @see java.lang.Object#clone()
*/
@Override
public VascBackendProxy clone() throws CloneNotSupportedException {
VascBackendProxyTimerLogger result = new VascBackendProxyTimerLogger();
result.logLevel=logLevel;
return result;
}
/**
* @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state)
*/

View file

@ -34,6 +34,11 @@ import net.forwardfire.vasc.backend.VascBackendController;
*/
public interface VascController {
/**
* @return Returns the VascConfigController
*/
public VascEntryConfigController getVascEntryConfigController();
/**
* @return Returns the VascBackendController
*/

View file

@ -0,0 +1,37 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.core;
/**
* Interface to get an VascController from somewhere.
*
* @author Willem Cazander
* @version 1.0 May 9, 2012
*/
public interface VascControllerProvider {
/**
* @return Returns the VascController
*/
public VascController getVascController();
}

View file

@ -304,6 +304,26 @@ public interface VascEntry extends Cloneable,Serializable {
*/
public void removeGlobalAction(GlobalVascAction globalAction);
/**
* @return the exportActions
*/
public List<GlobalVascAction> getExportActions();
/**
* @return the GlobalVascAction exportAction
*/
public GlobalVascAction getExportActionById(String actionId);
/**
* @param exportAction the exportAction to add
*/
public void addExportAction(GlobalVascAction exportAction);
/**
* @param exportAction the exportAction to remove
*/
public void removeExportAction(GlobalVascAction exportAction);
/**
* @return the vascEntryFieldSets
*/

View file

@ -0,0 +1,93 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.core;
import java.util.List;
import java.util.Locale;
import net.forwardfire.vasc.backend.VascBackend;
import net.forwardfire.vasc.backend.proxy.VascBackendProxy;
import net.forwardfire.vasc.core.entry.VascEntryExporter;
import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService;
/**
* Interface to make default fill/etc config plugable.
*
* @author Willem Cazander
* @version 1.0 May 9, 2012
*/
public interface VascEntryConfigController {
public VascEntry configVascEntry(VascController vascController,String entryId) throws VascException;
public void configVascEntry(VascController vascController,VascEntry vascEntry) throws VascException;
public void addVascEntryConfigFinalizer(VascEntryConfigFinalizer vascEntryConfigFinalizer);
public void removeVascEntryConfigFinalizer(VascEntryConfigFinalizer vascEntryConfigFinalizer);
public List<VascEntryConfigFinalizer> getVascEntryConfigFinalizers();
public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry) throws VascException;
public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry,VascBackend realBackend) throws VascException;
public void addVascBackendProxy(VascBackendProxy proxy);
public void removeVascBackendProxy(VascBackendProxy proxy);
public List<VascBackendProxy> getVascBackendProxies();
public VascEntryExporter getVascEntryExporterById(String exporterId);
public void addVascEntryExporter(VascEntryExporter exporter);
public void removeVascEntryExporter(VascEntryExporter exporter);
public List<VascEntryExporter> getVascEntryExporters();
public void configVascFrontendData(VascController vascController,VascEntry entry,Locale locale) throws VascException;
public String getResourceBundle();
public void setResourceBundle(String resourceBundle);
public int getDefaultPageSizeMax();
public void setDefaultPageSizeMax(int max);
public int getDefaultPageSize();
public void setDefaultPageSize(int size);
public void addVascEntryFieldValidatorService(VascEntryFieldValidatorService validator);
public void removeVascEntryFieldValidatorService(VascEntryFieldValidatorService validator);
public List<VascEntryFieldValidatorService> getVascEntryFieldValidatorServices();
}

View file

@ -22,13 +22,13 @@
package net.forwardfire.vasc.core;
/**
* Finalizes the VascEntry so it is ready to use.
*
* @author Willem Cazander
* @version 1.0 Sep 9, 2008
*/
public interface VascEntryFinalizer {
public interface VascEntryConfigFinalizer {
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException;
public void configVascEntry(VascController vascController,VascEntry entry) throws VascException;
}

View file

@ -35,6 +35,4 @@ public interface VascEntryController {
public VascEntry getVascEntryById(String id);
public List<String> getVascEntryIds();
public List<String> getVascEntryAdminIds();
}

View file

@ -32,7 +32,9 @@ package net.forwardfire.vasc.core;
*/
public interface VascEntryControllerLocal extends VascEntryController {
public void addVascEntry(VascEntry entry,VascController vascController) throws VascException;
public void addVascEntry(VascEntry entry);
public VascEntry getMasterVascEntryById(String id);
public void removeVascEntry(String entryId);
public VascEntry getMasterVascEntryById(String entryId);
}

View file

@ -27,17 +27,13 @@ import java.util.List;
/**
* VascLinkEntry
*
* @author Willem Cazander
* @version 1.0 Sep 7, 2008
*/
public interface VascLinkEntry extends Cloneable,Serializable {
public String getId();
public void setId(String id);
public String getVascEntryId();
public void setVascEntryId(String vascEntryId);
public String getEntryParameterFieldId(String parameterName);
public void addEntryParameterFieldId(String parameterName,String valueFieldId);
@ -47,6 +43,26 @@ public interface VascLinkEntry extends Cloneable,Serializable {
public void addEntryCreateFieldValue(String valueFieldId,String selectedFieldId);
public List<String> getEntryCreateFieldValueKeys();
/**
* @return the id
*/
public String getId();
/**
* @param id the id to set
*/
public void setId(String id);
/**
* @return the vascEntryId
*/
public String getVascEntryId();
/**
* @param vascEntryId the vascEntryId to set
*/
public void setVascEntryId(String vascEntryId);
/**
* @return the vascLinkEntryType
*/
@ -77,6 +93,16 @@ public interface VascLinkEntry extends Cloneable,Serializable {
*/
public void setName(String name);
/**
* @return the helpId
*/
public String getHelpId();
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId);
/**
* Force impl to have public clone methode
* @return

View file

@ -37,10 +37,12 @@ import net.forwardfire.vasc.core.VascException;
*/
public interface VascEntryExporter extends Serializable {
public String getId();
public void doExport(OutputStream out,VascEntry vascEntry) throws VascException;
public String getMineType();
public String getType();
public String getFileType();
}

View file

@ -37,5 +37,14 @@ import net.forwardfire.vasc.core.VascException;
*/
public interface VascEntryFieldValidatorService {
/**
* Validated a field and returns zero or more error messsages.
*
* @param field
* @param selectedRecord
* @param objectValue
* @return
* @throws VascException
*/
public List<String> validateObjectField(VascEntryField field, Object selectedRecord,Object objectValue) throws VascException;
}

View file

@ -23,6 +23,7 @@
package net.forwardfire.vasc.impl;
import net.forwardfire.vasc.backend.VascBackendController;
import net.forwardfire.vasc.core.VascEntryConfigController;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntryController;
import net.forwardfire.vasc.core.VascEntryFieldTypeController;
@ -37,12 +38,27 @@ import net.forwardfire.vasc.core.VascUserRoleController;
*/
public class DefaultVascController implements VascController {
private VascEntryConfigController vascEntryConfigController = null;
private VascBackendController vascBackendController = null;
private VascEntryController vascEntryController = null;
private VascEntryFieldTypeController vascEntryFieldTypeController = null;
private VascEventChannelController vascEventChannelController = null;
private VascUserRoleController vascUserRoleController = null;
/**
* @return the vascEntryConfigController
*/
public VascEntryConfigController getVascEntryConfigController() {
return vascEntryConfigController;
}
/**
* @param vascEntryConfigController the vascEntryConfigController to set
*/
public void setVascEntryConfigController(VascEntryConfigController vascEntryConfigController) {
this.vascEntryConfigController = vascEntryConfigController;
}
/**
* @return the vascEventChannelController
*/

View file

@ -78,6 +78,7 @@ public class DefaultVascEntry implements VascEntry {
private List<RowVascAction> rowActions = null;
private List<ColumnVascAction> columnActions = null;
private List<GlobalVascAction> globalActions = null;
private List<GlobalVascAction> exportActions = null;
private List<VascEntryFieldSet> vascEntryFieldSets = null;
private List<VascLinkEntry> vascLinkEntries = null;
@ -99,8 +100,9 @@ public class DefaultVascEntry implements VascEntry {
vascFields = new ArrayList<VascEntryField>(20);
rowActions = new ArrayList<RowVascAction>(10);
columnActions = new ArrayList<ColumnVascAction>(10);
globalActions = new ArrayList<GlobalVascAction>(10);
columnActions = new ArrayList<ColumnVascAction>(5);
globalActions = new ArrayList<GlobalVascAction>(5);
exportActions = new ArrayList<GlobalVascAction>(10);
vascEntryFieldSets = new ArrayList<VascEntryFieldSet>(10);
vascLinkEntries = new ArrayList<VascLinkEntry>(10);
@ -160,6 +162,9 @@ public class DefaultVascEntry implements VascEntry {
for (VascAction a:globalActions) {
result.globalActions.add((GlobalVascAction)a.clone());
}
for (VascAction a:exportActions) {
result.exportActions.add((GlobalVascAction)a.clone());
}
for (VascEntryFieldSet s:vascEntryFieldSets) {
result.vascEntryFieldSets.add(s.clone());
}
@ -572,6 +577,39 @@ public class DefaultVascEntry implements VascEntry {
globalActions.remove(globalAction);
}
/**
* @return the exportActions
*/
public List<GlobalVascAction> getExportActions() {
return exportActions;
}
/**
* @return the GlobalVascAction exportAction
*/
public GlobalVascAction getExportActionById(String actionId) {
for (GlobalVascAction a:exportActions) {
if (a.getId().equals(actionId)) {
return a;
}
}
return null;
}
/**
* @param exportAction the exportAction to add
*/
public void addExportAction(GlobalVascAction exportAction) {
exportActions.add(exportAction);
}
/**
* @param exportAction the exportAction to remove
*/
public void removeExportAction(GlobalVascAction exportAction) {
exportActions.remove(exportAction);
}
/**
* @return the vascEntryFieldSets
*/

View file

@ -0,0 +1,289 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import net.forwardfire.vasc.backend.VascBackend;
import net.forwardfire.vasc.backend.proxy.VascBackendProxy;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryConfigController;
import net.forwardfire.vasc.core.VascEntryConfigFinalizer;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.entry.VascEntryExporter;
import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService;
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
import net.forwardfire.vasc.impl.entry.DefaultVascEntryResourceResolver;
/**
* DefaultVascEntryConfigController runs all VascEntryConfigFinalizers on VascEntry.
*
* @author Willem Cazander
* @version 1.0 May 9, 2012
*/
public class DefaultVascEntryConfigController implements VascEntryConfigController {
private List<VascEntryConfigFinalizer> configFinalizers = null;
private List<VascBackendProxy> backendProxies = null;
private Map<String,VascEntryExporter> dataExporters = null;
private List<VascEntryFieldValidatorService> fieldValidators = null;
private int defaultPageSize = 100;
private int defaultPageSizeMax = 1000;
private String resourceBundle = null;
public DefaultVascEntryConfigController() {
configFinalizers = new ArrayList<VascEntryConfigFinalizer>(10);
backendProxies = new ArrayList<VascBackendProxy>(10);
dataExporters = new HashMap<String,VascEntryExporter>(10);
fieldValidators = new ArrayList<VascEntryFieldValidatorService>(5);
}
public VascEntry configVascEntry(VascController vascController,String entryId) throws VascException {
VascEntry vascEntry = vascController.getVascEntryController().getVascEntryById(entryId);
configVascEntry(vascController,vascEntry);
return vascEntry;
}
public void configVascEntry(VascController vascController,VascEntry vascEntry) throws VascException {
for (VascEntryConfigFinalizer finalizer:configFinalizers) {
finalizer.configVascEntry(vascController,vascEntry);
}
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#configVascBackendProxied(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry)
*/
public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry) throws VascException {
VascBackend realBackend = vascController.getVascBackendController().getVascBackendById(vascEntry.getBackendId());
return configVascBackendProxied(vascController,vascEntry,realBackend);
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#configVascBackendProxied(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry, net.forwardfire.vasc.backend.VascBackend)
*/
public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry, VascBackend realBackend) throws VascException {
VascBackend backend = realBackend;
for (VascBackendProxy proxy:backendProxies) {
VascBackendProxy proxyClone;
try {
proxyClone = proxy.clone();
} catch (CloneNotSupportedException e) {
throw new VascException(e);
}
proxyClone.initProxy(backend, vascEntry);
if (proxyClone.isProxyNeeded()==false) {
continue;
}
backend = proxyClone;
}
return backend;
}
/**
* @throws VascException
* @see net.forwardfire.vasc.core.VascEntryConfigController#configVascFrontendData(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry, java.util.Locale)
*/
public void configVascFrontendData(VascController vascController,VascEntry entry, Locale locale) throws VascException {
DefaultVascFrontendData vascFrontendData = new DefaultVascFrontendData();
DefaultVascEntryState state = new DefaultVascEntryState();
DefaultVascBackendState backendState = new DefaultVascBackendState();
backendState.setPageSize(vascController.getVascEntryConfigController().getDefaultPageSize());
backendState.setPageSizeMax(vascController.getVascEntryConfigController().getDefaultPageSizeMax());
state.setVascBackendState(backendState);
vascFrontendData.setVascEntryState(state);
// init resource resultsers
vascFrontendData.setVascEntryResourceResolver(new DefaultVascEntryResourceResolver(ResourceBundle.getBundle(vascController.getVascEntryConfigController().getResourceBundle(), locale)));
vascFrontendData.setVascFrontendHelper(new DefaultVascFrontendHelper());
//vascFrontendData.setVascEntryResourceImageResolver(new ImageResources());
for(VascEntryFieldValidatorService validator:vascController.getVascEntryConfigController().getVascEntryFieldValidatorServices()) {
vascFrontendData.addVascValidatorService(validator);
}
vascFrontendData.setVascController(vascController);
entry.setVascFrontendData(vascFrontendData);
VascBackend backend = vascController.getVascEntryConfigController().configVascBackendProxied(vascController, entry);
vascFrontendData.getVascEntryState().setVascBackend(backend);
vascFrontendData.getVascEntryState().setVascEntry(entry);
for (VascEntryField field:entry.getVascEntryFields()) {
if (field.getVascEntryFieldValue()==null) {
VascEntryFieldValue v = backend.provideVascEntryFieldValue(field);
field.setVascEntryFieldValue(v);
}
}
vascFrontendData.setVascFrontendPager(new DefaultVascFrontendPager(entry));
vascFrontendData.setVascFrontendActions(new DefaultVascFrontendActions(entry));
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#addVascEntryConfigFinalizer(net.forwardfire.vasc.core.VascEntryConfigFinalizer)
*/
public void addVascEntryConfigFinalizer(VascEntryConfigFinalizer vascEntryConfigFinalizer) {
configFinalizers.add(vascEntryConfigFinalizer);
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#removeVascEntryConfigFinalizer(net.forwardfire.vasc.core.VascEntryConfigFinalizer)
*/
public void removeVascEntryConfigFinalizer(VascEntryConfigFinalizer vascEntryConfigFinalizer) {
configFinalizers.remove(vascEntryConfigFinalizer);
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#getVascEntryConfigFinalizers()
*/
public List<VascEntryConfigFinalizer> getVascEntryConfigFinalizers() {
return configFinalizers;
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#addVascBackendProxy(net.forwardfire.vasc.backend.proxy.VascBackendProxy)
*/
public void addVascBackendProxy(VascBackendProxy proxy) {
backendProxies.add(proxy);
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#removeVascBackendProxy(net.forwardfire.vasc.backend.proxy.VascBackendProxy)
*/
public void removeVascBackendProxy(VascBackendProxy proxy) {
backendProxies.remove(proxy);
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#getVascBackendProxies()
*/
public List<VascBackendProxy> getVascBackendProxies() {
return backendProxies;
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#getVascEntryExporterById(java.lang.String)
*/
public VascEntryExporter getVascEntryExporterById(String exporterId) {
return dataExporters.get(exporterId);
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#addVascEntryExporter(net.forwardfire.vasc.core.entry.VascEntryExporter)
*/
public void addVascEntryExporter(VascEntryExporter exporter) {
dataExporters.put(exporter.getId(),exporter);
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#removeVascEntryExporter(net.forwardfire.vasc.core.entry.VascEntryExporter)
*/
public void removeVascEntryExporter(VascEntryExporter exporter) {
dataExporters.remove(exporter.getId());
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#getVascEntryExporters()
*/
public List<VascEntryExporter> getVascEntryExporters() {
return new ArrayList<VascEntryExporter>(dataExporters.values());
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#getResourceBundle()
*/
public String getResourceBundle() {
return resourceBundle;
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#setResourceBundle(java.lang.String)
*/
public void setResourceBundle(String resourceBundle) {
this.resourceBundle=resourceBundle;
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#getDefaultPageSizeMax()
*/
public int getDefaultPageSizeMax() {
return defaultPageSizeMax;
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#setDefaultPageSizeMax(int)
*/
public void setDefaultPageSizeMax(int defaultPageSizeMax) {
this.defaultPageSizeMax=defaultPageSizeMax;
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#getDefaultPageSize()
*/
public int getDefaultPageSize() {
return defaultPageSize;
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#setDefaultPageSize(int)
*/
public void setDefaultPageSize(int defaultPageSize) {
this.defaultPageSize=defaultPageSize;
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#addVascEntryFieldValidatorService(net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService)
*/
public void addVascEntryFieldValidatorService(VascEntryFieldValidatorService validator) {
fieldValidators.add(validator);
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#removeVascEntryFieldValidatorService(net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService)
*/
public void removeVascEntryFieldValidatorService(VascEntryFieldValidatorService validator) {
fieldValidators.remove(validator);
}
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#getVascEntryFieldValidatorServices()
*/
public List<VascEntryFieldValidatorService> getVascEntryFieldValidatorServices() {
return fieldValidators;
}
}

View file

@ -28,14 +28,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryControllerLocal;
import net.forwardfire.vasc.core.VascException;
/**
*
* DefaultVascEntryController holds the VascEntries which we can work with.
*
* @author Willem Cazander
* @version 1.0 Sep 18, 2008
@ -47,13 +44,27 @@ public class DefaultVascEntryController implements VascEntryControllerLocal {
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);
/**
* @see net.forwardfire.vasc.core.VascEntryControllerLocal#addVascEntry(net.forwardfire.vasc.core.VascEntry)
*/
public void addVascEntry(VascEntry entry) {
if (entry==null) {
throw new NullPointerException("Can't add null VascEntry.");
}
if (entry.getId()==null) {
throw new NullPointerException("Can't add VascEntry with null Id.");
}
entries.put(entry.getId(), entry);
}
/**
* @see net.forwardfire.vasc.core.VascEntryControllerLocal#removeVascEntry(java.lang.String)
*/
public void removeVascEntry(String entryId) {
entries.remove(entryId);
}
/**
* @see net.forwardfire.vasc.core.VascEntryController#getVascEntryById(java.lang.String)
*/
@ -69,9 +80,11 @@ public class DefaultVascEntryController implements VascEntryControllerLocal {
}
}
public VascEntry getMasterVascEntryById(String id) {
VascEntry entry = entries.get(id);
/**
* @see net.forwardfire.vasc.core.VascEntryControllerLocal#getMasterVascEntryById(java.lang.String)
*/
public VascEntry getMasterVascEntryById(String entryId) {
VascEntry entry = entries.get(entryId);
return entry;
}
@ -83,18 +96,4 @@ public class DefaultVascEntryController implements VascEntryControllerLocal {
Collections.sort(result); // lets do abc for consistance behauvior.
return result;
}
/**
* 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.isVascAdminList())) {
adminIds.add(e.getId());
}
}
Collections.sort(adminIds); // lets do abc for consistance behauvior.
return adminIds;
}
}

View file

@ -26,7 +26,6 @@ import java.util.Locale;
import java.util.ResourceBundle;
import net.forwardfire.vasc.backend.VascBackend;
import net.forwardfire.vasc.backend.VascBackendFilter;
import net.forwardfire.vasc.backend.proxy.VascBackendProxyCache;
import net.forwardfire.vasc.backend.proxy.VascBackendProxyEventExecutor;
import net.forwardfire.vasc.backend.proxy.VascBackendProxyFilter;
@ -41,14 +40,17 @@ import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
import net.forwardfire.vasc.frontend.VascFrontendData;
import net.forwardfire.vasc.impl.actions.AddRowAction;
import net.forwardfire.vasc.impl.actions.CSVExportGlobalAction;
import net.forwardfire.vasc.impl.actions.DeleteRowAction;
import net.forwardfire.vasc.impl.actions.EditRowAction;
import net.forwardfire.vasc.impl.actions.RefreshDataGlobalAction;
import net.forwardfire.vasc.impl.actions.XMLExportGlobalAction;
import net.forwardfire.vasc.impl.entry.DefaultVascEntryResourceResolver;
import net.forwardfire.vasc.impl.entry.VascValidatorsValidatorService;
import net.forwardfire.vasc.impl.entry.config.VascActionsFinalizer;
import net.forwardfire.vasc.impl.entry.config.VascDefaultsFinalizer;
import net.forwardfire.vasc.impl.entry.config.VascHelpIdFinalizer;
import net.forwardfire.vasc.impl.entry.config.VascI18nFinalizer;
import net.forwardfire.vasc.impl.entry.config.VascIdAutoFinalizer;
import net.forwardfire.vasc.impl.entry.config.VascIdCheckFinalizer;
import net.forwardfire.vasc.impl.entry.export.VascEntryExporterCsv;
import net.forwardfire.vasc.impl.entry.export.VascEntryExporterXml;
import net.forwardfire.vasc.impl.entry.export.VascEntryExporterXmlTree;
import net.forwardfire.vasc.impl.type.DefaultVascEntryFieldTypeController;
/**
@ -62,8 +64,35 @@ public class DefaultVascFactory {
static public VascController getDefaultVascController(Long userId,String userName,String...roles) throws VascException {
// config full controller for local jvm use
DefaultVascEntryConfigController vascConfig = new DefaultVascEntryConfigController();
// Add all backend proxy in ORDER
vascConfig.addVascBackendProxy(new VascBackendProxyTimerLogger());
vascConfig.addVascBackendProxy(new VascBackendProxyEventExecutor());
vascConfig.addVascBackendProxy(new VascBackendProxyCache());
vascConfig.addVascBackendProxy(new VascBackendProxyFilter());
vascConfig.addVascBackendProxy(new VascBackendProxySearch());
vascConfig.addVascBackendProxy(new VascBackendProxySort());
vascConfig.addVascBackendProxy(new VascBackendProxyPaged());
// Add all finalizers in ORDER
vascConfig.addVascEntryConfigFinalizer(new VascActionsFinalizer());
vascConfig.addVascEntryConfigFinalizer(new VascIdAutoFinalizer());
vascConfig.addVascEntryConfigFinalizer(new VascIdCheckFinalizer());
vascConfig.addVascEntryConfigFinalizer(new VascI18nFinalizer());
vascConfig.addVascEntryConfigFinalizer(new VascHelpIdFinalizer());
vascConfig.addVascEntryConfigFinalizer(new VascDefaultsFinalizer());
// Add all exporters in reverse ORDER
vascConfig.addVascEntryExporter(new VascEntryExporterXmlTree());
vascConfig.addVascEntryExporter(new VascEntryExporterXml());
vascConfig.addVascEntryExporter(new VascEntryExporterCsv());
// Add per default the internal vasc validator
vascConfig.addVascEntryFieldValidatorService(new VascValidatorsValidatorService());
DefaultVascController c = new DefaultVascController();
c.setVascEntryConfigController(vascConfig);
DefaultVascBackendController vascBackendController = new DefaultVascBackendController();
c.setVascBackendController(vascBackendController);
@ -90,7 +119,7 @@ public class DefaultVascFactory {
DefaultVascFrontendData vascFrontendData = new DefaultVascFrontendData(); //
vascFrontendData.setVascEntryState(new DefaultVascEntryState());
vascFrontendData.getVascEntryState().setVascBackendState(new DefaultVascBackendState());
vascFrontendData.getVascEntryState().getVascBackendState().setPageSize(100); // default page size is zero aka disabled
vascFrontendData.getVascEntryState().getVascBackendState().setPageSize(100);
vascFrontendData.getVascEntryState().getVascBackendState().setPageSizeMax(1000); // max 1k records on screen.
// init resource resultsers
@ -102,65 +131,17 @@ public class DefaultVascFactory {
return vascFrontendData;
}
/**
* Gets a backend of the backend controller and addes all the proxy classes.
* @param entry
* @return
*/
static public VascBackend getProxyVascBackend(VascEntry entry) {
// Get the 'real' backend
VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendController().getVascBackendById(entry.getBackendId());
// logs all actions log logger
backend = new VascBackendProxyTimerLogger(backend,entry);
// Fire event listeners before caching.
backend = new VascBackendProxyEventExecutor(backend,entry);
// only cached one result, checks for paramater differnce
backend = new VascBackendProxyCache(backend,entry);
for (VascBackendFilter filter:entry.getVascBackendFilters()) {
filter.initFilter(entry);
backend = new VascBackendProxyFilter(backend,entry,filter);
}
if (backend.isSearchable()==false) {
backend = new VascBackendProxySearch(backend,entry);
}
if (backend.isSortable()==false) {
backend = new VascBackendProxySort(backend,entry);
}
if (backend.isPageable()==false) {
backend = new VascBackendProxyPaged(backend,entry);
}
// return the configed backend.
return backend;
}
static public void fillVascControllerLocalEntries(VascEntryControllerLocal c,VascController con) throws VascException {
static public void fillVascControllerLocalEntries(VascEntryControllerLocal c,VascController vascController) throws VascException {
for (String id:c.getVascEntryIds()) {
VascEntry entry = c.getMasterVascEntryById(id);
// hackje for calling multiple times on same entries.
if (entry.getGlobalActionById(XMLExportGlobalAction.ACTION_ID)==null) {
if (entry.isVascDisplayOnly()==false) {
if (entry.isVascAdminCreate()) {
entry.addRowAction(new AddRowAction());
}
if (entry.isVascAdminEdit()) {
entry.addRowAction(new EditRowAction());
}
if (entry.isVascAdminDelete()) {
entry.addRowAction(new DeleteRowAction());
}
}
entry.addGlobalAction(new XMLExportGlobalAction());
entry.addGlobalAction(new CSVExportGlobalAction());
entry.addGlobalAction(new RefreshDataGlobalAction());
}
vascController.getVascEntryConfigController().configVascEntry(vascController, entry);
}
}
/* MOVED to VascEntryConfigController
/*
DefaultVascEntryResourceResolver t = new DefaultVascEntryResourceResolver(resourceBundle);
@ -196,7 +177,7 @@ public class DefaultVascFactory {
entry.getVa
}
*/
// hackje om deze manuale actions van i18n keys te voorzien;
// this is temp untill x4o templaing
@ -209,11 +190,12 @@ public class DefaultVascFactory {
// ((VascBackendControllerLocal)c.getVascBackendController()).addVascBackend(vb);
}
}
*/
static public void fillVascEntryFrontend(VascEntry entry,VascController vascController,VascFrontendData frontendData) {
static public void fillVascEntryFrontend(VascEntry entry,VascController vascController,VascFrontendData frontendData) throws VascException {
frontendData.setVascController(vascController);
entry.setVascFrontendData(frontendData);
VascBackend backend = DefaultVascFactory.getProxyVascBackend(entry);
VascBackend backend = vascController.getVascEntryConfigController().configVascBackendProxied(vascController, entry);
frontendData.getVascEntryState().setVascBackend(backend);
frontendData.getVascEntryState().setVascEntry(entry);

View file

@ -30,7 +30,7 @@ import java.util.Map;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascEntryFinalizer;
import net.forwardfire.vasc.core.VascEntryConfigFinalizer;
import net.forwardfire.vasc.core.VascEntryState;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.actions.ColumnVascAction;
@ -62,7 +62,7 @@ public class DefaultVascFrontendData implements VascFrontendData {
private VascFrontend vascFrontend = null;
private VascFrontendActions vascFrontendActions = null;
private VascFrontendPager vascFrontendPager = null;
private VascEntryFinalizer vascEntryFinalizer = null;
private VascEntryConfigFinalizer vascEntryFinalizer = null;
private VascFrontendHelper vascFrontendHelper = null;
private VascEntryResourceResolver vascEntryResourceResolver = null;
private VascEntryResourceImageResolver vascEntryResourceImageResolver = null;
@ -129,14 +129,14 @@ public class DefaultVascFrontendData implements VascFrontendData {
/**
* @see net.forwardfire.vasc.core.VascBackendData#getVascEntryFinalizer()
*/
public VascEntryFinalizer getVascEntryFinalizer() {
public VascEntryConfigFinalizer getVascEntryFinalizer() {
return vascEntryFinalizer;
}
/**
* @see net.forwardfire.vasc.core.VascBackendData#setVascEntryFinalizer(net.forwardfire.vasc.core.VascEntryFinalizer)
* @see net.forwardfire.vasc.core.VascBackendData#setVascEntryFinalizer(net.forwardfire.vasc.core.VascEntryConfigFinalizer)
*/
public void setVascEntryFinalizer(VascEntryFinalizer vascEntryFinalizer) {
public void setVascEntryFinalizer(VascEntryConfigFinalizer vascEntryFinalizer) {
this.vascEntryFinalizer=vascEntryFinalizer;
}

View file

@ -48,6 +48,7 @@ public class DefaultVascLinkEntry implements VascLinkEntry {
private VascLinkEntryType vascLinkEntryType = null;
private String doActionId = null;
private String name = null;
private String helpId = null;
/**
* @return the id
@ -140,6 +141,20 @@ public class DefaultVascLinkEntry implements VascLinkEntry {
this.name = name;
}
/**
* @return the helpId
*/
public String getHelpId() {
return helpId;
}
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId) {
this.helpId = helpId;
}
/**
* @see java.lang.Object#clone()
*/
@ -153,6 +168,7 @@ public class DefaultVascLinkEntry implements VascLinkEntry {
result.entryCreateFieldValues=entryCreateFieldValues;
result.id=id;
result.name=name;
result.helpId=helpId;
return result;
}
}

View file

@ -0,0 +1,72 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.impl.actions;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.actions.AbstractVascAction;
import net.forwardfire.vasc.core.actions.GlobalVascAction;
import net.forwardfire.vasc.core.actions.VascAction;
import net.forwardfire.vasc.core.entry.VascEntryExporter;
/**
* ExportDataGlobalAction is action per exporter.
*
* @author Willem Cazander
* @version 1.0 May 10, 2012
*/
public class ExportDataGlobalAction extends AbstractVascAction implements GlobalVascAction {
private static final long serialVersionUID = 1L;
private String exporterId = null;
static public final String ACTION_POSTFIX = "ExportAction";
public ExportDataGlobalAction(String exporterId) {
this.exporterId=exporterId;
setId(exporterId+ACTION_POSTFIX);
}
protected String getActionId() {
return exporterId;
}
public void doGlobalAction(VascEntry entry) throws Exception {
VascEntryExporter exporter = entry.getVascFrontendData().getVascController().getVascEntryConfigController().getVascEntryExporterById(exporterId);
entry.getVascFrontendData().getVascFrontend().renderExport(exporter);
}
/**
* @see net.forwardfire.vasc.core.actions.AbstractVascAction#clone()
*/
@Override
public VascAction clone() throws CloneNotSupportedException {
VascAction action = new ExportDataGlobalAction(exporterId);
action.setId(getId());
action.setName(getName());
action.setDescription(getDescription());
action.setImage(getImage());
action.setHelpId(getHelpId());
return action;
}
}

View file

@ -0,0 +1,71 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.impl.entry.config;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryConfigFinalizer;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.entry.VascEntryExporter;
import net.forwardfire.vasc.impl.actions.AddRowAction;
import net.forwardfire.vasc.impl.actions.DeleteRowAction;
import net.forwardfire.vasc.impl.actions.EditRowAction;
import net.forwardfire.vasc.impl.actions.ExportDataGlobalAction;
import net.forwardfire.vasc.impl.actions.RefreshDataGlobalAction;
/**
* VascActionsFinalizer Adds all the default actions.
*
* @author Willem Cazander
* @version 1.0 May 9, 2012
*/
public class VascActionsFinalizer implements VascEntryConfigFinalizer {
/**
* @see net.forwardfire.vasc.core.VascEntryConfigFinalizer#configVascEntry(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry)
*/
public void configVascEntry(VascController vascController, VascEntry entry) throws VascException {
if (entry.getExportActions().isEmpty()==false) {
return; // hackje for calling multiple times on same entries.
}
if (entry.isVascDisplayOnly()==false) { // TODO: redo to flags
if (entry.isVascAdminCreate()) {
entry.addRowAction(new AddRowAction());
}
if (entry.isVascAdminEdit()) {
entry.addRowAction(new EditRowAction());
}
if (entry.isVascAdminDelete()) {
entry.addRowAction(new DeleteRowAction());
}
}
entry.addGlobalAction(new RefreshDataGlobalAction());
// Add all exporter actions
for (VascEntryExporter export:vascController.getVascEntryConfigController().getVascEntryExporters()) {
entry.addExportAction(new ExportDataGlobalAction(export.getId()));
}
}}

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.impl;
package net.forwardfire.vasc.impl.entry.config;
import java.util.Collections;
import java.util.Comparator;
@ -32,49 +32,29 @@ import net.forwardfire.vasc.backend.VascBackend;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascEntryFieldSet;
import net.forwardfire.vasc.core.VascEntryFinalizer;
import net.forwardfire.vasc.core.VascEntryConfigFinalizer;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.VascLinkEntry;
import net.forwardfire.vasc.core.VascLinkEntryType;
import net.forwardfire.vasc.core.actions.VascAction;
/**
* Checks for minimal needed stuff
* and fills up the rest.
*
* VascDefaultsFinalizer does set some default in objects of entry.
*
* @author Willem Cazander
* @version 1.0 Sep 14, 2008
* @version 1.0 May 9, 2012
*/
public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
public class VascDefaultsFinalizer implements VascEntryConfigFinalizer {
/**
* @see net.forwardfire.vasc.core.VascEntryFinalizer#finalizeVascEntry(net.forwardfire.vasc.core.VascEntry)
* @see net.forwardfire.vasc.core.VascEntryConfigFinalizer#configVascEntry(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry)
*/
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException {
public void configVascEntry(VascController vascController, VascEntry entry) throws VascException {
// First Check if we all have ids
String id = entry.getId();
if (id==null) {
throw new IllegalArgumentException("The VascEntry need an id.");
}
if (entry.getBackendId()==null) {
throw new IllegalArgumentException("The VascEntry need an backendId in entryId: "+id);
}
if (entry.getVascEntryFields().size()==0) {
throw new IllegalArgumentException("We need at least one VascEntryField in entryId: "+id);
}
for (VascEntryField vef:entry.getVascEntryFields()) {
if (vef.getId()==null) {
throw new IllegalArgumentException("All VascEntryField need an id in entryId: "+id);
}
}
for (VascEntryField vef:entry.getListOptions()) {
if (vef.getId()==null) {
throw new IllegalArgumentException("All listOption VascEntryField to have an id in entryId: "+id);
}
}
// Check if backendId is valid
VascBackend back = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
@ -82,89 +62,13 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
throw new IllegalArgumentException("The VascEntry backend is not found in backends: '"+entry.getBackendId()+"' in entryId: "+id);
}
// Fill up all not field i18n keys
// entry fields
if (entry.getName()==null) {
entry.setName("vasc.entry."+id+".name");
}
if (entry.getImage()==null) {
entry.setImage("vasc.entry."+id+".image");
}
if (entry.getHelpId()==null) {
entry.setHelpId("vasc.entry."+id+".helpId");
}
if (entry.getListDescription()==null) {
entry.setListDescription("vasc.entry."+id+".listDescription");
}
if (entry.getListImage()==null) {
entry.setListImage("vasc.entry."+id+".listImage");
}
if (entry.getEditDescription()==null) {
entry.setEditDescription("vasc.entry."+id+".editDescription");
}
if (entry.getEditImage()==null) {
entry.setEditImage("vasc.entry."+id+".editImage");
}
if (entry.getDeleteDescription()==null) {
entry.setDeleteDescription("vasc.entry."+id+".deleteDescription");
}
if (entry.getDeleteImage()==null) {
entry.setDeleteImage("vasc.entry."+id+".deleteImage");
}
if (entry.getCreateDescription()==null) {
entry.setCreateDescription("vasc.entry."+id+".createDescription");
}
if (entry.getCreateImage()==null) {
entry.setCreateImage("vasc.entry."+id+".createImage");
}
// boolean view helper
if (entry.isVascDisplayOnly()) {
entry.setVascAdminCreate(false);
entry.setVascAdminDelete(false);
entry.setVascAdminEdit(false);
}
// optional field sets
for (VascEntryFieldSet s:entry.getVascEntryFieldSets()) {
// check id
String sid = s.getId();
if (sid==null) {
throw new IllegalArgumentException("All VascEntryFieldSet need an id in entryId: "+id);
}
// check if refenced ids are avalible
for (String fid:s.getVascEntryFieldIds()) {
if (entry.getVascEntryFieldById(fid)==null) {
throw new IllegalArgumentException("VascEntryFieldSet "+sid+" has non excisting field id: "+fid+" in entryId: "+id);
}
}
// fill up properties
if (s.getName()==null) {
s.setName("vasc.entry."+id+"."+sid+".name");
}
if (s.getDescription()==null) {
s.setDescription("vasc.entry."+id+"."+sid+".description");
}
if (s.getImage()==null) {
s.setImage("vasc.entry."+id+"."+sid+".image");
}
if (s.getHelpId()==null) {
s.setHelpId("vasc.entry."+id+"."+sid+".helpId");
}
if (s.getStyleEdit()==null) {
s.setStyleEdit("vasc.entry."+id+"."+sid+".styleEdit");
}
if (s.getStyleList()==null) {
s.setStyleList("vasc.entry."+id+"."+sid+".styleEdit");
}
}
// Set defaults field Id for key ad display
if (entry.getPrimaryKeyFieldId()==null) {
entry.setPrimaryKeyFieldId(entry.getVascEntryFields().get(0).getId());
@ -174,7 +78,6 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
entry.setDisplayNameFieldId(entry.getVascEntryFields().get(0).getId());
}
// Check fields
int orderIndex = 0;
for (VascEntryField vef:entry.getVascEntryFields()) {
@ -188,32 +91,11 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
vef.setVascEntry(entry);
}
//System.out.println("Field: "+vef.getId()+" order: "+vef.getOrderIndex()+" else: "+orderIndex);
if (vef.getOrderIndex()==null) {
vef.setOrderIndex(orderIndex);
}
orderIndex = orderIndex+100;
// fill up properties
if (vef.getName()==null) {
vef.setName("vasc.entry."+id+"."+vid+".name");
}
if (vef.getDescription()==null) {
vef.setDescription("vasc.entry."+id+"."+vid+".description");
}
if (vef.getImage()==null) {
vef.setImage("vasc.entry."+id+"."+vid+".image");
}
if (vef.getHelpId()==null) {
vef.setHelpId("vasc.entry."+id+"."+vid+".helpId");
}
if (vef.getStyleEdit()==null) {
vef.setStyleEdit("vasc.entry."+id+"."+vid+".styleEdit");
}
if (vef.getStyleList()==null) {
vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
}
//if (vef.getDefaultValue()==null) {
// vef.setDefaultValue("vasc.entry."+id+"."+vid+".defaultValue");
//}
@ -249,7 +131,6 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
if (vef.getVascEntryFieldType()==null) {
vef.setVascEntryFieldType(vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField"));
}
//vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
}
@ -269,7 +150,6 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
//}
}
class OrderIndexComparator implements Comparator<VascEntryField> {
public int compare(VascEntryField v1, VascEntryField v2) {
return v1.getOrderIndex().compareTo(v2.getOrderIndex());
@ -277,7 +157,6 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
}
Collections.sort(entry.getVascEntryFields(),new OrderIndexComparator());
// place primary key in front
int index = 0;
for (VascEntryField vef:entry.getVascEntryFields()) {
@ -295,22 +174,12 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
// Check if link entries excists
for (VascLinkEntry vle:entry.getVascLinkEntries()) {
// check id
String vid = vle.getId();
if (vid==null) {
throw new IllegalArgumentException("All VascLinkEntry need an id in entryId: "+id);
}
if (vle.getVascEntryId()==null) {
throw new IllegalArgumentException("All VascLinkEntry need an vascEntryId: "+id);
}
if (vle.getVascLinkEntryType()==null) {
vle.setVascLinkEntryType(VascLinkEntryType.DEFAULT_TYPE);
}
if (vle.getName()==null) {
vle.setName("vasc.entry."+vle.getVascEntryId()+".name");
}
}
for (VascEntryField vef:entry.getListOptions()) {
@ -326,27 +195,7 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
vef.setOrderIndex(orderIndex);
}
orderIndex = orderIndex+100;
// fill up properties
if (vef.getName()==null) {
vef.setName("vasc.entry."+id+"."+vid+".name");
}
if (vef.getDescription()==null) {
vef.setDescription("vasc.entry."+id+"."+vid+".description");
}
if (vef.getImage()==null) {
vef.setImage("vasc.entry."+id+"."+vid+".image");
}
if (vef.getHelpId()==null) {
vef.setHelpId("vasc.entry."+id+"."+vid+".helpId");
}
if (vef.getStyleEdit()==null) {
vef.setStyleEdit("vasc.entry."+id+"."+vid+".styleEdit");
}
if (vef.getStyleList()==null) {
vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
}
//if (vef.getDefaultValue()==null) {
// vef.setDefaultValue("vasc.entry."+id+"."+vid+".defaultValue");
//}
@ -382,71 +231,7 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
}
vef.setDefaultValue(value);
}
}
}
for (VascAction action:entry.getGlobalActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
if (action.getName()==null) {
action.setName("vasc.action."+aid+".name");
}
if (action.getDescription()==null) {
action.setDescription("vasc.action."+aid+".description");
}
if (action.getImage()==null) {
action.setImage("vasc.action."+aid+".image");
}
if (action.getHelpId()==null) {
action.setHelpId("vasc.action."+aid+".helpId");
}
}
for (VascAction action:entry.getRowActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
if (action.getName()==null) {
action.setName("vasc.action."+aid+".name");
}
if (action.getDescription()==null) {
action.setDescription("vasc.action."+aid+".description");
}
if (action.getImage()==null) {
action.setImage("vasc.action."+aid+".image");
}
if (action.getHelpId()==null) {
action.setHelpId("vasc.action."+aid+".helpId");
}
}
for (VascAction action:entry.getColumnActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
if (action.getName()==null) {
action.setName("vasc.action."+aid+".name");
}
if (action.getDescription()==null) {
action.setDescription("vasc.action."+aid+".description");
}
if (action.getImage()==null) {
action.setImage("vasc.action."+aid+".image");
}
if (action.getHelpId()==null) {
action.setHelpId("vasc.action."+aid+".helpId");
}
}
return entry;
}
}
}
}

View file

@ -0,0 +1,137 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.impl.entry.config;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascEntryFieldSet;
import net.forwardfire.vasc.core.VascEntryConfigFinalizer;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.VascLinkEntry;
import net.forwardfire.vasc.core.actions.VascAction;
/**
* VascHelpIdFinalizer copies the (optional)capitalized Id's into helpId field.
*
* @author Willem Cazander
* @version 1.0 May 9, 2012
*/
public class VascHelpIdFinalizer implements VascEntryConfigFinalizer {
private boolean upperCase = true;
private char seperatorChar = '_';
/**
* @see net.forwardfire.vasc.core.VascEntryConfigFinalizer#configVascEntry(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry)
*/
public void configVascEntry(VascController vascController, VascEntry entry) throws VascException {
String id = entry.getId();
if (entry.getHelpId()==null) {
entry.setHelpId(format(entry.getId()));
}
for (VascEntryFieldSet s:entry.getVascEntryFieldSets()) {
if (s.getHelpId()==null) {
s.setHelpId(format(id,s.getId()));
}
}
for (VascEntryField vef:entry.getVascEntryFields()) {
if (vef.getHelpId()==null) {
vef.setHelpId(format(id,vef.getId()));
}
}
for (VascLinkEntry vle:entry.getVascLinkEntries()) {
if (vle.getHelpId()==null) {
vle.setHelpId(format(id,vle.getId()));
}
}
for (VascEntryField vef:entry.getListOptions()) {
if (vef.getHelpId()==null) {
vef.setHelpId(format(id,vef.getId()));
}
}
for (VascAction action:entry.getGlobalActions()) {
if (action.getHelpId()==null) {
action.setHelpId(format(id,action.getId()));
}
}
for (VascAction action:entry.getExportActions()) {
if (action.getHelpId()==null) {
action.setHelpId(format(id,action.getId()));
}
}
for (VascAction action:entry.getRowActions()) {
if (action.getHelpId()==null) {
action.setHelpId(format(id,action.getId()));
}
}
for (VascAction action:entry.getColumnActions()) {
if (action.getHelpId()==null) {
action.setHelpId(format(id,action.getId()));
}
}
}
private String format(String ... ids) {
StringBuilder idBuff = new StringBuilder();
for (int i=0;i<ids.length;i++) {
idBuff.append(ids[i]);
if (i<ids.length-1) {
idBuff.append(getSeperatorChar());
}
}
if (isUpperCase()) {
return idBuff.toString().toUpperCase();
}
return idBuff.toString();
}
/**
* @return the upperCase
*/
public boolean isUpperCase() {
return upperCase;
}
/**
* @param upperCase the upperCase to set
*/
public void setUpperCase(boolean upperCase) {
this.upperCase = upperCase;
}
/**
* @return the seperatorChar
*/
public char getSeperatorChar() {
return seperatorChar;
}
/**
* @param seperatorChar the seperatorChar to set
*/
public void setSeperatorChar(char seperatorChar) {
this.seperatorChar = seperatorChar;
}
}

View file

@ -0,0 +1,190 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.impl.entry.config;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascEntryFieldSet;
import net.forwardfire.vasc.core.VascEntryConfigFinalizer;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.VascLinkEntry;
import net.forwardfire.vasc.core.actions.VascAction;
/**
* VascI18NFinalizer fills all missing i18n fields.
*
* @author Willem Cazander
* @version 1.0 May 9, 2012
*/
public class VascI18nFinalizer implements VascEntryConfigFinalizer {
/**
* @see net.forwardfire.vasc.core.VascEntryConfigFinalizer#configVascEntry(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry)
*/
public void configVascEntry(VascController vascController, VascEntry entry) throws VascException {
// Fill up all not field i18n keys
String id = entry.getId();
// entry fields
if (entry.getName()==null) {
entry.setName("vasc.entry."+id+".name");
}
if (entry.getImage()==null) {
entry.setImage("vasc.entry."+id+".image");
}
if (entry.getListDescription()==null) {
entry.setListDescription("vasc.entry."+id+".listDescription");
}
if (entry.getListImage()==null) {
entry.setListImage("vasc.entry."+id+".listImage");
}
if (entry.getEditDescription()==null) {
entry.setEditDescription("vasc.entry."+id+".editDescription");
}
if (entry.getEditImage()==null) {
entry.setEditImage("vasc.entry."+id+".editImage");
}
if (entry.getDeleteDescription()==null) {
entry.setDeleteDescription("vasc.entry."+id+".deleteDescription");
}
if (entry.getDeleteImage()==null) {
entry.setDeleteImage("vasc.entry."+id+".deleteImage");
}
if (entry.getCreateDescription()==null) {
entry.setCreateDescription("vasc.entry."+id+".createDescription");
}
if (entry.getCreateImage()==null) {
entry.setCreateImage("vasc.entry."+id+".createImage");
}
// Field sets
for (VascEntryFieldSet s:entry.getVascEntryFieldSets()) {
String sid = s.getId();
if (s.getName()==null) {
s.setName("vasc.entry."+id+"."+sid+".name");
}
if (s.getDescription()==null) {
s.setDescription("vasc.entry."+id+"."+sid+".description");
}
if (s.getImage()==null) {
s.setImage("vasc.entry."+id+"."+sid+".image");
}
}
// Check fields
for (VascEntryField vef:entry.getVascEntryFields()) {
String vid = vef.getId();
if (vef.getName()==null) {
vef.setName("vasc.entry."+id+"."+vid+".name");
}
if (vef.getDescription()==null) {
vef.setDescription("vasc.entry."+id+"."+vid+".description");
}
if (vef.getImage()==null) {
vef.setImage("vasc.entry."+id+"."+vid+".image");
}
}
for (VascLinkEntry vle:entry.getVascLinkEntries()) {
if (vle.getName()==null) {
vle.setName("vasc.entry."+vle.getVascEntryId()+".name");
}
}
for (VascEntryField vef:entry.getListOptions()) {
String vid = vef.getId();
if (vef.getName()==null) {
vef.setName("vasc.entry."+id+"."+vid+".name");
}
if (vef.getDescription()==null) {
vef.setDescription("vasc.entry."+id+"."+vid+".description");
}
if (vef.getImage()==null) {
vef.setImage("vasc.entry."+id+"."+vid+".image");
}
}
for (VascAction action:entry.getGlobalActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
if (action.getName()==null) {
action.setName("vasc.action."+aid+".name");
}
if (action.getDescription()==null) {
action.setDescription("vasc.action."+aid+".description");
}
if (action.getImage()==null) {
action.setImage("vasc.action."+aid+".image");
}
}
for (VascAction action:entry.getExportActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
if (action.getName()==null) {
action.setName("vasc.action."+aid+".name");
}
if (action.getDescription()==null) {
action.setDescription("vasc.action."+aid+".description");
}
if (action.getImage()==null) {
action.setImage("vasc.action."+aid+".image");
}
}
for (VascAction action:entry.getRowActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
if (action.getName()==null) {
action.setName("vasc.action."+aid+".name");
}
if (action.getDescription()==null) {
action.setDescription("vasc.action."+aid+".description");
}
if (action.getImage()==null) {
action.setImage("vasc.action."+aid+".image");
}
}
for (VascAction action:entry.getColumnActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
if (action.getName()==null) {
action.setName("vasc.action."+aid+".name");
}
if (action.getDescription()==null) {
action.setDescription("vasc.action."+aid+".description");
}
if (action.getImage()==null) {
action.setImage("vasc.action."+aid+".image");
}
}
}
}

View file

@ -0,0 +1,126 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.impl.entry.config;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascEntryFieldSet;
import net.forwardfire.vasc.core.VascEntryConfigFinalizer;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.VascLinkEntry;
import net.forwardfire.vasc.core.actions.VascAction;
/**
* VascAutoIdFinalizer fills the missing id automaticly.
*
* @author Willem Cazander
* @version 1.0 May 9, 2012
*/
public class VascIdAutoFinalizer implements VascEntryConfigFinalizer {
private char seperatorChar = '_';
/**
* @see net.forwardfire.vasc.core.VascEntryConfigFinalizer#configVascEntry(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry)
*/
public void configVascEntry(VascController vascController, VascEntry entry) throws VascException {
// count all auto objects as one index
int index = 0;
String id = entry.getId();
if (id==null) {
throw new IllegalArgumentException("The VascEntry need an id.");
}
for (VascEntryField vef:entry.getListOptions()) {
if (vef.getId()==null) {
vef.setId(format(id,"list",""+index++));
}
}
for (VascEntryFieldSet s:entry.getVascEntryFieldSets()) {
String sid = s.getId();
if (sid==null) {
s.setId(format(id,"fieldset",""+index++));
}
}
for (VascLinkEntry vle:entry.getVascLinkEntries()) {
String vid = vle.getId();
if (vid==null) {
if (vle.getVascEntryId()==null) {
vle.setId(format(id,"link",""+index++));
} else {
vle.setId(format(id,"link",vle.getVascEntryId()));
}
}
}
for (VascAction action:entry.getGlobalActions()) {
String aid = action.getId();
if (aid==null) {
action.setId(format(id,"action",""+index++));
}
}
for (VascAction action:entry.getExportActions()) {
String aid = action.getId();
if (aid==null) {
action.setId(format(id,"action",""+index++));
}
}
for (VascAction action:entry.getRowActions()) {
String aid = action.getId();
if (aid==null) {
action.setId(format(id,"action",""+index++));
}
}
for (VascAction action:entry.getColumnActions()) {
String aid = action.getId();
if (aid==null) {
action.setId(format(id,"action",""+index++));
}
}
}
private String format(String ... ids) {
StringBuilder idBuff = new StringBuilder();
for (int i=0;i<ids.length;i++) {
idBuff.append(ids[i]);
if (i<ids.length-1) {
idBuff.append(getSeperatorChar());
}
}
return idBuff.toString();
}
/**
* @return the seperatorChar
*/
public char getSeperatorChar() {
return seperatorChar;
}
/**
* @param seperatorChar the seperatorChar to set
*/
public void setSeperatorChar(char seperatorChar) {
this.seperatorChar = seperatorChar;
}
}

View file

@ -0,0 +1,124 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.impl.entry.config;
import net.forwardfire.vasc.backend.VascBackend;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascEntryFieldSet;
import net.forwardfire.vasc.core.VascEntryConfigFinalizer;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.VascLinkEntry;
import net.forwardfire.vasc.core.actions.VascAction;
/**
* VascIdCheckFinalizer Checks the all objects have an ID.
*
* @author Willem Cazander
* @version 1.0 May 9, 2012
*/
public class VascIdCheckFinalizer implements VascEntryConfigFinalizer {
/**
* @see net.forwardfire.vasc.core.VascEntryConfigFinalizer#configVascEntry(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry)
*/
public void configVascEntry(VascController vascController, VascEntry entry) throws VascException {
// First Check if we all have ids
String id = entry.getId();
if (id==null) {
throw new IllegalArgumentException("The VascEntry need an id.");
}
if (entry.getBackendId()==null) {
throw new IllegalArgumentException("The VascEntry need an backendId in entryId: "+id);
}
for (VascEntryField vef:entry.getVascEntryFields()) {
if (vef.getId()==null) {
throw new IllegalArgumentException("All VascEntryField need an id in entryId: "+id);
}
}
for (VascEntryField vef:entry.getListOptions()) {
if (vef.getId()==null) {
throw new IllegalArgumentException("All listOption VascEntryField to have an id in entryId: "+id);
}
}
// Check if backendId is valid
VascBackend back = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
if (back==null) {
throw new IllegalArgumentException("The VascEntry backend is not found in backends: '"+entry.getBackendId()+"' in entryId: "+id);
}
// optional field sets
for (VascEntryFieldSet s:entry.getVascEntryFieldSets()) {
String sid = s.getId();
if (sid==null) {
throw new IllegalArgumentException("All VascEntryFieldSet need an id in entryId: "+id);
}
// check if refenced ids are avalible
for (String fid:s.getVascEntryFieldIds()) {
if (entry.getVascEntryFieldById(fid)==null) {
throw new IllegalArgumentException("VascEntryFieldSet "+sid+" has non excisting field id: "+fid+" in entryId: "+id);
}
}
}
// Check if link entries excists
for (VascLinkEntry vle:entry.getVascLinkEntries()) {
String vid = vle.getId();
if (vid==null) {
throw new IllegalArgumentException("All VascLinkEntry need an id in entryId: "+id);
}
if (vle.getVascEntryId()==null) {
throw new IllegalArgumentException("All VascLinkEntry need an vascEntryId: "+id);
}
}
for (VascAction action:entry.getGlobalActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
}
for (VascAction action:entry.getExportActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
}
for (VascAction action:entry.getRowActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
}
for (VascAction action:entry.getColumnActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
}
}
}

View file

@ -0,0 +1,169 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.impl.entry.export;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.lib.jr4o.data.AbstractJRDynamicDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField;
import net.sf.jasperreports.engine.design.JRDesignField;
import net.sf.jasperreports.engine.design.JasperDesign;
/**
* JRDynamicDataSourceVascEntry converts the Vasc backend data to JasperReports data.
*
* @author Willem Cazander
* @version 1.0 May 11, 2012
*/
public class JRDynamicDataSourceVascEntry extends AbstractJRDynamicDataSource {
private VascEntry vascEntry = null;
private long total = -1;
private int index = -1;
private static final String PREFIX_COLUMN = "COLUMN_";
private static final String PREFIX_HEADER = "HEADER_";
private static final String INFIX_CLASS = "CLASS_";
private List<List<String>> data = null;
public JRDynamicDataSourceVascEntry(VascEntry vascEntry) {
if (vascEntry==null) {
throw new NullPointerException("vascEntry can't be null.");
}
this.vascEntry = vascEntry;
total = vascEntry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
// hackje until calc index to page and row.
try {
data = new ArrayList<List<String>>(1000);
int pages = (int)total/vascEntry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
for (int page=0;page<=pages;page++) {
vascEntry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(page);
vascEntry.getVascFrontendData().getVascFrontendActions().refreshData();
for (Object o:vascEntry.getVascFrontendData().getVascEntryState().getEntryDataList()) {
List<String> row = new ArrayList<String>(30);
for (VascEntryField c:vascEntry.getVascEntryFields()) {
row.add(c.getVascEntryFieldValue().getDisplayValue(c, o));
}
data.add(row);
}
}
} catch (VascException ve) {
throw new RuntimeException(ve);
}
}
/**
* @see net.sf.jasperreports.engine.JRDataSource#getFieldValue(net.sf.jasperreports.engine.JRField)
*/
public Object getFieldValue(JRField jrField) throws JRException {
String fieldName = jrField.getName();
if (fieldName.startsWith(PREFIX_COLUMN)) {
return data.get(index).get(Integer.parseInt(fieldName.substring(7)));
}
if (fieldName.startsWith(PREFIX_HEADER)) {
List<VascEntryField> fields = vascEntry.getVascEntryFields();
VascEntryField field = fields.get(Integer.parseInt(fieldName.substring(7)));
return vascEntry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(field.getName());
}
throw new JRException("Unknown column name : " + fieldName);
}
/**
* @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#addDynamicColumnClassFields(net.sf.jasperreports.engine.design.JasperDesign)
*/
public void addDynamicColumnClassFields(JasperDesign jd) throws JRException {
JRDesignField field;
for (int i=0;i<getDynamicColumnCount();i++) {
field = new JRDesignField();
field.setName(PREFIX_COLUMN+i);
field.setValueClass(String.class); // todo
jd.addField(field);
field = new JRDesignField();
field.setName(PREFIX_HEADER+i);
field.setValueClass(String.class);
jd.addField(field);
}
}
/**
* @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#addDynamicELBean()
*/
public Map<String, Object> addDynamicELBean() {
Map<String,Object> result = new HashMap<String,Object>(10);
for (int i=0;i<getDynamicColumnCount();i++) {
result.put(PREFIX_COLUMN+INFIX_CLASS+i,String.class); // todo
result.put(PREFIX_HEADER+INFIX_CLASS+i,String.class);
}
return result;
}
/**
* @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#getDynamicColumnX(int)
*/
public int getDynamicColumnX(int col) {
int result = 0;
for (int i=0;i<col;i++) {
result += 80;
}
return result;
}
/**
* @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#getDynamicColumnWidth(int)
*/
public int getDynamicColumnWidth(int col) {
return 80; // todo
}
/**
* @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#getDynamicColumnCount()
*/
public int getDynamicColumnCount() {
return vascEntry.getVascEntryFields().size();
}
/**
* @see net.sf.jasperreports.engine.JRDataSource#next()
*/
public boolean next() throws JRException {
index++;
return (index < total);
}
/**
* @see net.sf.jasperreports.engine.JRRewindableDataSource#moveFirst()
*/
public void moveFirst() throws JRException {
index = -1;
}
}

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.impl.actions;
package net.forwardfire.vasc.impl.entry.export;
import java.io.OutputStream;
import java.io.PrintWriter;
@ -28,31 +28,30 @@ import java.io.PrintWriter;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.actions.AbstractVascAction;
import net.forwardfire.vasc.core.actions.GlobalVascAction;
import net.forwardfire.vasc.core.entry.VascEntryExporter;
/**
* VascEntryExporterCsv writes data to csv output format.
*
* @author Willem Cazander
* @version 1.0 Mar 30, 2007
*/
public class CSVExportGlobalAction extends AbstractVascAction implements GlobalVascAction,VascEntryExporter {
public class VascEntryExporterCsv implements VascEntryExporter {
private static final long serialVersionUID = 2770924442917617161L;
static public final String EXPORT_TYPE = "csv";
/**
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getId()
*/
public String getId() {
return EXPORT_TYPE;
}
private static final long serialVersionUID = -3951608685719832654L;
static public final String ACTION_ID = "csvExportAction";
protected String getActionId() {
return ACTION_ID;
}
public void doGlobalAction(VascEntry entry) throws Exception {
entry.getVascFrontendData().getVascFrontend().renderExport(this);
}
public void doExport(OutputStream out,VascEntry entry) throws VascException {
/**
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#doExport(java.io.OutputStream, net.forwardfire.vasc.core.VascEntry)
*/
public void doExport(OutputStream out, VascEntry entry) throws VascException {
PrintWriter p = new PrintWriter(out);
p.write("# csv\n");
for (VascEntryField c:entry.getVascEntryFields()) {
@ -82,11 +81,17 @@ public class CSVExportGlobalAction extends AbstractVascAction implements GlobalV
}
/**
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getMineType()
*/
public String getMineType() {
return "text/csv";
}
public String getType() {
return "csv";
/**
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getFileType()
*/
public String getFileType() {
return EXPORT_TYPE;
}
}

View file

@ -0,0 +1,128 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.impl.entry.export;
import java.io.File;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.entry.VascEntryExporter;
import net.forwardfire.vasc.lib.jr4o.JR4ODesignManager;
import net.forwardfire.vasc.lib.jr4o.JR4ODesignManager.JRExportType;
/**
* VascEntryExporterPdf creates an pdf view of the data.
*
* @author Willem Cazander
* @version 1.0 May 11, 2012
*/
public class VascEntryExporterJR4O implements VascEntryExporter {
private static final long serialVersionUID = -3951608685719832654L;
static public final String EXPORT_TYPE = "pdf";
private JRExportType reportType = null;
private String reportResource = null;
private String reportName = null;
private File reportFile = null;
private String id = null;
private VascEntryExporterJR4O(String id,JRExportType reportType,String reportName) {
if (reportName == null) {
throw new NullPointerException("Can't export null reportName.");
}
if (reportType == null) {
throw new NullPointerException("Can't export null reportType.");
}
this.id = id;
this.reportType = reportType;
this.reportName = reportName;
}
public VascEntryExporterJR4O(String id,JRExportType reportType,String reportName,String reportResource) {
this(id,reportType,reportName);
this.reportResource=reportResource;
}
public VascEntryExporterJR4O(String id,JRExportType reportType,String reportName,File reportFile) {
this(id,reportType,reportName);
this.reportFile=reportFile;
}
/**
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getId()
*/
public String getId() {
return id;
}
public void setId(String id) {
this.id=id;
}
/**
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#doExport(java.io.OutputStream, net.forwardfire.vasc.core.VascEntry)
*/
public void doExport(OutputStream out, VascEntry entry) throws VascException {
Map<String,Object> parameters = new HashMap<String,Object>(5);
parameters.put("title", entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(entry.getName()));
parameters.put("description", entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(entry.getListDescription()));
parameters.put("titleSubject", entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(entry.getId()));
int oldIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
String bundle = entry.getVascFrontendData().getVascController().getVascEntryConfigController().getResourceBundle();
JRDynamicDataSourceVascEntry dataSource = new JRDynamicDataSourceVascEntry(entry);
JR4ODesignManager jr4o = new JR4ODesignManager(dataSource,bundle,parameters);
try {
if (reportResource!=null) {
jr4o.parseResource(reportResource);
} else if (reportFile!=null) {
jr4o.parseFile(reportFile);
} else {
throw new NullPointerException("No report input data defined,reportResource and reportFile are null.");
}
jr4o.saveReportStream(reportName, reportType, out);
} catch (Exception e) {
throw new VascException(e);
} finally {
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(oldIndex); // restore page index
}
}
/**
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getMineType()
*/
public String getMineType() {
return "text/pdf";
}
/**
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getFileType()
*/
public String getFileType() {
return EXPORT_TYPE;
}
}

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.impl.actions;
package net.forwardfire.vasc.impl.entry.export;
import java.io.OutputStream;
import java.io.PrintWriter;
@ -28,31 +28,31 @@ import java.io.PrintWriter;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.actions.AbstractVascAction;
import net.forwardfire.vasc.core.actions.GlobalVascAction;
import net.forwardfire.vasc.core.entry.VascEntryExporter;
/**
* VascEntryExporterXml writes entry data to xml format.
*
* @author Willem Cazander
* @version 1.0 Mar 30, 2007
*/
public class XMLExportGlobalAction extends AbstractVascAction implements GlobalVascAction,VascEntryExporter {
public class VascEntryExporterXml implements VascEntryExporter {
private static final long serialVersionUID = 3719424578585760828L;
static public final String ACTION_ID = "xmlExportAction";
static public final String EXPORT_TYPE = "xml";
private boolean xmlTree = false;
protected String getActionId() {
return ACTION_ID;
/**
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getId()
*/
public String getId() {
return EXPORT_TYPE;
}
public void doGlobalAction(VascEntry entry) throws Exception {
entry.getVascFrontendData().getVascFrontend().renderExport(this);
}
public void doExport(OutputStream out,VascEntry entry) throws VascException {
/**
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#doExport(java.io.OutputStream, net.forwardfire.vasc.core.VascEntry)
*/
public void doExport(OutputStream out, VascEntry entry) throws VascException {
PrintWriter p = new PrintWriter(out);
p.write("<?xml version=\"1.0\"?>\n");
p.write("<data>\n");
@ -66,9 +66,15 @@ public class XMLExportGlobalAction extends AbstractVascAction implements GlobalV
for (Object o:entry.getVascFrontendData().getVascEntryState().getEntryDataList()) {
p.write("\t<row>\n");
for (VascEntryField c:entry.getVascEntryFields()) {
p.write("\t\t<column name=\""+c.getId()+"\"><![CDATA[");
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c, o));
p.write("]]></column>\n");
if (xmlTree) {
p.write("\t\t<"+c.getId()+"><![CDATA[");
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c, o));
p.write("]]></"+c.getId()+">\n");
} else {
p.write("\t\t<column name=\""+c.getId()+"\"><![CDATA[");
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c, o));
p.write("]]></column>\n");
}
}
p.write("\t</row>\n");
p.flush();
@ -81,11 +87,31 @@ public class XMLExportGlobalAction extends AbstractVascAction implements GlobalV
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(oldIndex);
}
/**
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getMineType()
*/
public String getMineType() {
return "text/xml";
}
public String getType() {
return "xml";
/**
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getFileType()
*/
public String getFileType() {
return EXPORT_TYPE;
}
/**
* @return the xmlTree
*/
public boolean isXmlTree() {
return xmlTree;
}
/**
* @param xmlTree the xmlTree to set
*/
public void setXmlTree(boolean xmlTree) {
this.xmlTree = xmlTree;
}
}

View file

@ -0,0 +1,50 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.impl.entry.export;
/**
* VascEntryExporterXmlTree exports the data as xml tree.
*
* @author Willem Cazander
* @version 1.0 May 9, 2012
*/
public class VascEntryExporterXmlTree extends VascEntryExporterXml {
private static final long serialVersionUID = 179434457857022828L;
static public final String EXPORT_TYPE = "xmltree";
/**
* Creates an VascEntryExporterXmlTree
*/
public VascEntryExporterXmlTree() {
setXmlTree(true);
}
/**
* @see net.forwardfire.vasc.impl.entry.export.VascEntryExporterXml#getId()
*/
@Override
public String getId() {
return EXPORT_TYPE;
}
}

View file

@ -36,17 +36,13 @@ import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
import net.forwardfire.vasc.core.ui.VascSelectItem;
import net.forwardfire.vasc.core.ui.VascSelectItemModel;
import net.forwardfire.vasc.impl.DefaultVascBackendState;
import net.forwardfire.vasc.impl.DefaultVascFactory;
/**
* The DefaultVascSelectItemModel
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
* The DefaultVascSelectItemModel
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
public class VascSelectItemModelEntry implements VascSelectItemModel {
private static final long serialVersionUID = 1L;
@ -84,7 +80,7 @@ public class VascSelectItemModelEntry implements VascSelectItemModel {
// set frontend data for new clone, we need te get better lifecycle management for stats/entry/etc
entry.setVascFrontendData(currentEntry.getVascFrontendData());
VascBackend back = DefaultVascFactory.getProxyVascBackend(entry);
VascBackend back = currentEntry.getVascFrontendData().getVascController().getVascEntryConfigController().configVascBackendProxied(currentEntry.getVascFrontendData().getVascController(), entry);
try {
if (nullLabel!=null) {
if (nullKeyValue==null) {
@ -97,6 +93,7 @@ public class VascSelectItemModelEntry implements VascSelectItemModel {
// set def para
VascBackendState state = new DefaultVascBackendState();
for (String key2:entry.getEntryParameterKeys()) {
Object value = entry.getEntryParameter(key2);
//System.out.println("Copy paras name: "+key2+" value: "+value+" class: "+value.getClass().getName());

View file

@ -22,18 +22,15 @@
package net.forwardfire.vasc.impl.x4o;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryController;
import net.forwardfire.vasc.core.VascEntryControllerLocal;
import net.forwardfire.vasc.core.VascException;
import org.x4o.xml.element.AbstractElementConfigurator;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementConfiguratorException;
/**
* Converts the type to the type object
*
@ -46,18 +43,12 @@ public class VascEntryElementConfigurator extends AbstractElementConfigurator {
* @see org.x4o.xml.element.AbstractElementConfigurator#doConfigEndTag(org.x4o.xml.element.Element)
*/
public void doConfigElement(Element element) throws ElementConfiguratorException {
VascEntry entry = (VascEntry)element.getElementObject();
VascController vascController = VascParser.getVascController(element.getElementContext());
VascEntryController entryController = vascController.getVascEntryController();
if (entryController instanceof VascEntryControllerLocal) {
try {
((VascEntryControllerLocal)entryController).addVascEntry(entry, vascController);
} catch (VascException e) {
throw new ElementConfiguratorException(this,"Couln't add entry: "+e.getMessage(),e);
}
((VascEntryControllerLocal)entryController).addVascEntry(entry);
} else {
throw new ElementConfiguratorException(this,"Can not add entry '"+entry.getId()+"' to VascEntryController because we have no access to VascEntryControllerLocal interface.");
}

View file

@ -15,5 +15,6 @@
<module>vasc-demo-tech-editor</module>
<module>vasc-demo-tech-web</module>
<module>vasc-demo-tech-ui</module>
<module>vasc-demo-tech-core</module>
</modules>
</project>

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vasc-demo-tech-core</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,19 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>vasc-demo-tech</artifactId>
<groupId>net.forwardfire.vasc.demo</groupId>
<version>0.3.5-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>vasc-demo-tech-core</artifactId>
<name>vasc-demo-tech-core</name>
<description>vasc-demo-tech-core</description>
<dependencies>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View file

@ -20,26 +20,23 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.impl;
package net.forwardfire.vasc.demo.tech.core;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryFinalizer;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.VascControllerProvider;
/**
* DemoVascControllerProvider gets the static local jvm vasc controller for this tech demo.
*
* @author Willem Cazander
* @version 1.0 Sep 14, 2008
* @version 1.0 May 12, 2012
*/
public class DefaultVascFrontendEntryFinalizer implements VascEntryFinalizer {
public class DemoVascControllerProvider implements VascControllerProvider {
/**
* @see net.forwardfire.vasc.core.VascEntryFinalizer#finalizeVascEntry(net.forwardfire.vasc.core.VascEntry)
* @see net.forwardfire.vasc.core.VascControllerProvider#getVascController()
*/
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException {
return entry;
public VascController getVascController() {
return DemoVascManager.getVascControllerStatic();
}
}
}

View file

@ -0,0 +1,128 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.demo.tech.core;
import java.io.File;
import java.io.FileOutputStream;
import java.util.logging.Logger;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntryConfigController;
import net.forwardfire.vasc.core.VascEntryControllerLocal;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.impl.DefaultVascFactory;
import net.forwardfire.vasc.impl.entry.export.VascEntryExporterJR4O;
import net.forwardfire.vasc.impl.x4o.VascParser;
import net.forwardfire.vasc.lib.jr4o.JR4ODesignManager.JRExportType;
/**
* DemoVascManager manages the dynamic vasc controller for tech demo.
*
* @author Willem Cazander
* @version 1.0 May 12, 2012
*/
public class DemoVascManager {
private Logger logger = null;
static private VascController vascController = null;
public DemoVascManager() {
logger = Logger.getLogger(DemoVascManager.class.getName());
}
public void start() {
logger.finer("Starting vascmanager");
if (vascController!=null) {
throw new RuntimeException("VascManager is already started.");
}
try {
vascController = DefaultVascFactory.getDefaultVascController(2288L,"forwardfire.net","user","admin");
VascEntryConfigController vecc = vascController.getVascEntryConfigController();
// Config all report export engines for demo.
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrPdfLandscape",JRExportType.PDF,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrPdfPortrait",JRExportType.PDF,"generic-portrait","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrRtf",JRExportType.RTF,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrXls",JRExportType.XLS,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrXml",JRExportType.XML,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrCsv",JRExportType.CSV,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
// Config root bundle to load all resources.
vecc.setResourceBundle("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle");
// Config some defaults
vecc.setDefaultPageSize(200);
vecc.setDefaultPageSizeMax(1500);
initEditor();
} catch (VascException e) {
throw new RuntimeException(e);
}
}
public void stop() {
vascController = null;
logger.info("Stop manager, cleared all.");
}
private void initEditor() {
try {
VascParser parser = new VascParser(vascController);
parser.addGlobalELBean("vascController", vascController);
parser.parseResource("net/forwardfire/vasc/editor/vasc-edit.xml");
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
} catch (Exception e) {
e.printStackTrace();
}
}
public void openFile(File file) {
logger.info("Vasc open file: "+file.getAbsoluteFile());
try {
VascParser parser = new VascParser(vascController);
File f = File.createTempFile("test-vasc", ".xml");
parser.setDebugOutputStream(new FileOutputStream(f));
parser.parseFile(file);
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
} catch (Exception e) {
e.printStackTrace();
}
}
public VascController getVascController() {
return vascController;
}
/**
* Needed for the provider interface
* @return
*/
static protected VascController getVascControllerStatic() {
return vascController;
}
}

View file

@ -21,6 +21,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-editor</artifactId>
@ -30,7 +35,15 @@
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-web</artifactId>
<version>${project.version}</version>
<!-- <type>war</type> -->
<type>war</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-web</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
@ -47,6 +60,16 @@
<artifactId>vasc-frontend-web-jsf</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-frontend-web-export</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-frontend-cxf-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-backend-ldap</artifactId>

View file

@ -42,13 +42,14 @@ import org.jdesktop.application.FrameView;
import org.jdesktop.application.SingleFrameApplication;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.demo.tech.core.DemoVascManager;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanelMenuBar;
public class TechUI extends SingleFrameApplication {
private Logger logger = null;
private VascManager vascManager = null;
private DemoVascManager vascManager = null;
private TomcatManager tomcatManager = null;
static public void main(String[] args) {
@ -129,7 +130,7 @@ public class TechUI extends SingleFrameApplication {
long startTime = System.currentTimeMillis();
setupLogging();
logger.info("Starting Vasc-Demo-Tech-UI.");
vascManager = new VascManager();
vascManager = new DemoVascManager();
vascManager.start();
autoLoadVasc();
@ -180,7 +181,7 @@ public class TechUI extends SingleFrameApplication {
return getInstance(TechUI.class);
}
public VascManager getVascManager() {
public DemoVascManager getVascManager() {
return vascManager;
}

View file

@ -1,8 +1,5 @@
package net.forwardfire.vasc.demo.tech.ui;
import java.io.File;
import java.io.FileOutputStream;
import java.lang.reflect.Method;
import java.util.logging.Logger;
import org.eobjects.metamodel.DataContext;
@ -17,118 +14,28 @@ import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryControllerLocal;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.core.VascLinkEntry;
import net.forwardfire.vasc.core.VascLinkEntryType;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
import net.forwardfire.vasc.impl.DefaultVascEntry;
import net.forwardfire.vasc.impl.DefaultVascEntryField;
import net.forwardfire.vasc.impl.DefaultVascFactory;
import net.forwardfire.vasc.impl.DefaultVascLinkEntry;
import net.forwardfire.vasc.impl.ui.VascSelectItemModelEntry;
import net.forwardfire.vasc.impl.x4o.VascParser;
public class VascManager {
public class VascAutoSchemaMetaModel {
private Logger logger = null;
private VascController vascController = null;
public VascManager() {
logger = Logger.getLogger(VascManager.class.getName());
public VascAutoSchemaMetaModel(VascController vascController) {
logger = Logger.getLogger(VascAutoSchemaMetaModel.class.getName());
this.vascController=vascController;
}
public void start() {
logger.finer("Starting vascmanager");
try {
vascController = DefaultVascFactory.getDefaultVascController(2288L,"forwardfire.net","user","admin");
initEditor();
} catch (VascException e) {
throw new RuntimeException(e);
}
}
public void stop() {
vascController = null;
logger.info("Stop manager, cleared all.");
}
private void initEditor() {
try {
VascParser parser = new VascParser(vascController);
parser.addGlobalELBean("vascController", vascController);
parser.parseResource("net/forwardfire/vasc/editor/vasc-edit.xml");
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
} catch (Exception e) {
e.printStackTrace();
}
}
public void openFile(File file) {
logger.info("Vasc open file: "+file.getAbsoluteFile());
try {
VascParser parser = new VascParser(vascController);
File f = File.createTempFile("test-vasc", ".xml");
parser.setDebugOutputStream(new FileOutputStream(f));
parser.parseFile(file);
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
} catch (Exception e) {
e.printStackTrace();
}
}
public VascController getVascController() {
private VascController getVascController() {
return vascController;
}
public void printEntries() {
try {
for (String key:getVascController().getVascEntryController().getVascEntryIds()) {
VascEntry ve = getVascController().getVascEntryController().getVascEntryById(key);
printEntry(ve);
}
} catch (Exception e) {
e.printStackTrace();
}
}
private void printEntry(VascEntry e) throws Exception {
System.out.println("");
System.out.println("=== Printing entry ===");
System.out.println("");
for (Method m:e.getClass().getMethods()) {
if (m.getName().startsWith("get")==false) { //a bit dirty
continue;
}
if (m.getParameterTypes().length>0) {
continue;
}
System.out.println("prop: "+m.getName()+" -> "+m.invoke(e));
}
System.out.println("");
System.out.println("=== Fields ===");
for (VascEntryField vef:e.getVascEntryFields()) {
System.out.println("=== Field: "+vef.getId());
for (Method m:vef.getClass().getMethods()) {
if (m.getName().startsWith("get")==false) { //a bit dirty
continue;
}
if (m.getParameterTypes().length>0) {
continue;
}
System.out.println("prop: "+m.getName()+" -> "+m.invoke(vef));
}
}
}
public void createMetaEntry(MetaModelDataContextProvider ds,String id,String tableName) {
logger.info("Creating entry id: "+id+" of table: "+tableName);
@ -175,12 +82,10 @@ public class VascManager {
try {
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backend);
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(ve, getVascController());
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(ve);
// mm TODO rm this fill which adds the global actions ... and show updated tree in editor
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) getVascController().getVascEntryController(), getVascController());
//rebuildTree();
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
} catch (Exception ee) {
ee.printStackTrace();
}
@ -222,7 +127,7 @@ public class VascManager {
try {
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backendLink);
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink, getVascController());
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink);
VascLinkEntry vle = new DefaultVascLinkEntry();
vle.setId(id+"Link");
@ -272,7 +177,7 @@ public class VascManager {
vef.getVascEntryFieldType().setDataObject(itemModel);
((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backendLink);
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink, getVascController());
((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink);
} catch (Exception e) {
e.printStackTrace();
}

View file

@ -18,6 +18,8 @@ import javax.swing.JPanel;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv;
import net.forwardfire.vasc.demo.tech.ui.TechUI;
import net.forwardfire.vasc.demo.tech.ui.VascAutoSchemaMetaModel;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
public class JDialogMetaCsv extends JDialog implements ActionListener {
@ -62,7 +64,9 @@ public class JDialogMetaCsv extends JDialog implements ActionListener {
File file = fc.getSelectedFile();
MetaModelDataContextCsv ds = new MetaModelDataContextCsv();
ds.setFile(file.getAbsolutePath());
TechUI.getInstance().getVascManager().createMetaEntry(ds,file.getName(),null);
VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController());
schema.createMetaEntry(ds,file.getName(),null);
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
}
}
});

View file

@ -19,6 +19,8 @@ import javax.swing.SpringLayout;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc;
import net.forwardfire.vasc.demo.tech.ui.TechUI;
import net.forwardfire.vasc.demo.tech.ui.VascAutoSchemaMetaModel;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
import net.forwardfire.vasc.demo.tech.ui.components.SpringLayoutGrid;
import org.eobjects.metamodel.DataContext;
@ -89,9 +91,11 @@ public class JDialogMetaJdbc extends JDialog implements ActionListener {
ds.setPassword(passwordField.getText());
DataContext metaDs = ds.getDataContext();
String dbName = url.substring(url.lastIndexOf('/')+1,url.length());
VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController());
for (String table:metaDs.getDefaultSchema().getTableNames()) {
TechUI.getInstance().getVascManager().createMetaEntry(ds,dbName+"_"+table,table);
schema.createMetaEntry(ds,dbName+"_"+table,table);
}
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
}
});
result.add(fileButton);

View file

@ -18,6 +18,8 @@ import javax.swing.SpringLayout;
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb;
import net.forwardfire.vasc.demo.tech.ui.TechUI;
import net.forwardfire.vasc.demo.tech.ui.VascAutoSchemaMetaModel;
import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel;
import net.forwardfire.vasc.demo.tech.ui.components.SpringLayoutGrid;
import org.eobjects.metamodel.DataContext;
@ -78,9 +80,11 @@ public class JDialogMetaMongodb extends JDialog implements ActionListener {
ds.setPort(new Integer(hostPortField.getText()));
ds.setDatabase(databaseField.getText());
DataContext metaDs = ds.getDataContext();
VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController());
for (String table:metaDs.getDefaultSchema().getTableNames()) {
TechUI.getInstance().getVascManager().createMetaEntry(ds,ds.getDatabase()+"_"+table,table);
schema.createMetaEntry(ds,ds.getDatabase()+"_"+table,table);
}
((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree();
}
});
result.add(fileButton);

View file

@ -53,10 +53,10 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.demo.tech.core.DemoVascManager;
import net.forwardfire.vasc.demo.tech.ui.TechUI;
import net.forwardfire.vasc.demo.tech.ui.VascManager;
import net.forwardfire.vasc.frontends.swing.SwingPanelIntegration;
import net.forwardfire.vasc.frontends.swing.SwingPanelTabbed;
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
import net.forwardfire.vasc.impl.DefaultVascFactory;
import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle_en;
import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
@ -64,7 +64,7 @@ import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
public class JMainPanel extends JPanel {
private static final long serialVersionUID = 5834715323973411147L;
private VascManager vascManager = null;
private DemoVascManager vascManager = null;
private SwingPanelIntegration spi = null;
private JTabbedPane tabPane = null;
private JTree vascTree = null;

View file

@ -76,10 +76,6 @@ vasc.validator.VascStringZipCodeValidator=Value must be a valid post code.
# Vasc actions labels
vasc.action.addRowAction.description = add a new record
vasc.action.addRowAction.name = Add
vasc.action.csvExportAction.description = CSV
vasc.action.csvExportAction.name = CSV
vasc.action.xmlExportAction.description = XML
vasc.action.xmlExportAction.name = XML
vasc.action.deleteRowAction.description = delete
vasc.action.deleteRowAction.name = delete
vasc.action.downloadAction.description = Select this record.
@ -87,6 +83,26 @@ vasc.action.downloadAction.name = Select
vasc.action.editRowAction.description = edit
vasc.action.editRowAction.name = Edit
vasc.action.csvExportAction.description = CSV
vasc.action.csvExportAction.name = CSV
vasc.action.xmlExportAction.description = XML
vasc.action.xmlExportAction.name = XML
vasc.action.xmltreeExportAction.description = XMLTree
vasc.action.xmltreeExportAction.name = XMLTree
vasc.action.jrPdfLandscapeExportAction.description = jrPdfLandscape
vasc.action.jrPdfLandscapeExportAction.name = PDF-Landscape
vasc.action.jrPdfPortraitExportAction.description = jrPdfPortrait
vasc.action.jrPdfPortraitExportAction.name = PDF-Portrait
vasc.action.jrRtfExportAction.description = RTF
vasc.action.jrRtfExportAction.name = RTF
vasc.action.jrXlsExportAction.description = XLS
vasc.action.jrXlsExportAction.name = XLS
vasc.action.jrXmlExportAction.description = JR-XML
vasc.action.jrXmlExportAction.name = JR-XML
vasc.action.jrCsvExportAction.description = JR-CSV
vasc.action.jrCsvExportAction.name = JR-CSV
# Temp jsf
generic.vasc.jsf.listOption.header = Searchoptions
generic.vasc.jsf.listOption.search = Searh\:
@ -116,3 +132,6 @@ generic.vasc.jsf.action.cancel = Cancel
generic.vasc.jsf.action.back = Back
generic.vasc.jsf.parentSelected = Selected:
vasc.dialog.edit.message = Edit
vasc.dialog.save.name = Save
vasc.dialog.cancel.name = Cancel

View file

@ -18,6 +18,12 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc.demo</groupId>
<artifactId>vasc-demo-tech-core</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<!-- Web tech deps -->
<dependency>

View file

@ -31,12 +31,12 @@ import javax.faces.context.FacesContext;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
import net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider;
import net.forwardfire.vasc.frontend.VascFrontendData;
import net.forwardfire.vasc.frontends.web.jsf.AbstractJSFVascFacesControllerBase;
import net.forwardfire.vasc.frontend.web.jsf.AbstractJSFVascFacesControllerBase;
import net.forwardfire.vasc.impl.DefaultVascFactory;
/**
*
* @author Willem Cazander
@ -77,20 +77,8 @@ public class VascFacesController extends AbstractJSFVascFacesControllerBase {
@Override
public VascController getVascController() {
// TODO: rm this by making common tech vasc package ?
try {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = this.getClass().getClassLoader(); // fallback
}
Class<?> clazz = cl.loadClass("net.forwardfire.vasc.demo.tech.ui.TechUI");
Object instance = clazz.getMethod("getInstance").invoke(null);
Object vasc = clazz.getMethod("getVascController").invoke(instance);
return (VascController)vasc;
} catch (Exception e) {
throw new RuntimeException(e);
}
DemoVascControllerProvider provider = new DemoVascControllerProvider();
return provider.getVascController();
}
}

View file

@ -95,7 +95,7 @@
<filter>
<display-name>User Filter</display-name>
<filter-name>userFilter</filter-name>
<filter-class>net.forwardfire.logstats.web.filters.UserFilter</filter-class>
<filter-class>net.forwardfire.vasc.demo.tech.web.filters.UserFilter</filter-class>
</filter>
<filter-mapping>
@ -130,12 +130,7 @@
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<!--
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
-->
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
@ -184,7 +179,7 @@
<filter>
<display-name>VASC Filter</display-name>
<filter-name>vascFilter</filter-name>
<filter-class>net.forwardfire.vasc.frontends.web.jsf.VascRequestFacesFilter</filter-class>
<filter-class>net.forwardfire.vasc.frontend.web.jsf.VascRequestFacesFilter</filter-class>
<init-param>
<param-name>templateFile</param-name>
<param-value>/jsp/includes/vasc-template.jsf</param-value>
@ -201,4 +196,50 @@
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<servlet>
<servlet-name>vascExportServlet</servlet-name>
<servlet-class>net.forwardfire.vasc.frontend.web.export.VascExportServlet</servlet-class>
<init-param>
<param-name>vascControllerProvider</param-name>
<param-value>net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>vascExportServlet</servlet-name>
<url-pattern>/export</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>vascExportServletTree</servlet-name>
<servlet-class>net.forwardfire.vasc.frontend.web.export.VascExportServlet</servlet-class>
<init-param>
<param-name>vascControllerProvider</param-name>
<param-value>net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider</param-value>
</init-param>
<init-param>
<param-name>exportTree</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>vascExportServletTree</servlet-name>
<url-pattern>/export-tree/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>vascCXFServlet</servlet-name>
<servlet-class>net.forwardfire.vasc.frontend.cxf.server.web.VascCXFServlet</servlet-class>
<init-param>
<param-name>vascControllerProvider</param-name>
<param-value>net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>vascCXFServlet</servlet-name>
<url-pattern>/cxf/*</url-pattern>
</servlet-mapping>
</web-app>

View file

@ -14,5 +14,7 @@
<module>vasc-frontend-swing</module>
<module>vasc-frontend-swt</module>
<module>vasc-frontend-web-jsf</module>
<module>vasc-frontend-web-export</module>
<module>vasc-frontend-cxf</module>
</modules>
</project>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vasc-frontend-cxf</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,17 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>vasc-frontend</artifactId>
<groupId>net.forwardfire.vasc</groupId>
<version>0.3.5-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>vasc-frontend-cxf</artifactId>
<packaging>pom</packaging>
<name>vasc-frontend-cxf</name>
<description>vasc-frontend-cxf</description>
<modules>
<module>vasc-frontend-cxf-client</module>
<module>vasc-frontend-cxf-server</module>
</modules>
</project>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vasc-frontend-cxf-client</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,19 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>vasc-frontend-cxf</artifactId>
<groupId>net.forwardfire.vasc</groupId>
<version>0.3.5-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>vasc-frontend-cxf-client</artifactId>
<name>vasc-frontend-cxf-client</name>
<description>vasc-frontend-cxf-client</description>
<dependencies>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>jsr181-api</artifactId>
<version>1.0-MR1</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,10 @@
package net.forwardfire.vasc.frontend.cxf.client;
import javax.jws.WebService;
@WebService
public interface VascEntryService {
public String testHi(String response);
}

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vasc-frontend-cxf-server</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,51 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>vasc-frontend-cxf</artifactId>
<groupId>net.forwardfire.vasc</groupId>
<version>0.3.5-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>vasc-frontend-cxf-server</artifactId>
<name>vasc-frontend-cxf-server</name>
<description>vasc-frontend-cxf-server</description>
<dependencies>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.forwardfire.vasc</groupId>
<artifactId>vasc-frontend-cxf-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-databinding-jaxb</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,10 @@
package net.forwardfire.vasc.frontend.cxf.server;
import net.forwardfire.vasc.frontend.cxf.client.VascEntryService;
public class VascEntryServiceImpl implements VascEntryService {
public String testHi(String response) {
return "HOHO: "+response+" HAAHA..";
}
}

View file

@ -0,0 +1,89 @@
/*
* Copyright 2007-2012 forwardfire.net All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * 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 THE COPYRIGHT HOLDERS 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
* THE COPYRIGHT HOLDER 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.
*/
package net.forwardfire.vasc.frontend.cxf.server.web;
import java.util.logging.Logger;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import net.forwardfire.vasc.core.VascControllerProvider;
import net.forwardfire.vasc.frontend.cxf.server.VascEntryServiceImpl;
import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
/**
* VascCXFServlet exports the entries via webservices
*
* @author Willem Cazander
* @version 1.0 May 12, 2012
*/
public class VascCXFServlet extends CXFNonSpringServlet {
private Logger logger = Logger.getLogger(VascCXFServlet.class.getName());
private static final long serialVersionUID = 8125039180724973858L;
private VascControllerProvider vascControllerProvider = null;
private boolean exportTree = false;
/**
* @see org.apache.cxf.transport.servlet.CXFNonSpringServlet#init(javax.servlet.ServletConfig)
*/
@Override
public void init(ServletConfig sc) throws ServletException {
String className = getInitParameter("vascControllerProvider");
if (className==null) {
throw new ServletException("Can't start with null vascControllerProvider init parameter.");
}
String exportTreeStr = getInitParameter("exportTree");
if (exportTreeStr!=null && "true".equalsIgnoreCase(exportTreeStr)) {
exportTree = true;
}
try {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = className.getClass().getClassLoader();
}
Class<?> clazz = cl.loadClass(className);
vascControllerProvider = (VascControllerProvider)clazz.newInstance();
} catch (Exception e) {
throw new ServletException("Could not create VascControllerProvider: "+e.getMessage(),e);
}
super.init(sc); // runs loadBus
logger.info("CXF Servlet started. (exportTree: "+exportTree+")");
}
@Override
public void loadBus(ServletConfig servletConfig) {
super.loadBus(servletConfig);
Bus bus = getBus();
BusFactory.setDefaultBus(bus);
Endpoint.publish("/foobar", new VascEntryServiceImpl());
}
}

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing;
package net.forwardfire.vasc.frontend.swing;
import java.awt.Component;
import java.awt.event.ActionEvent;
@ -263,15 +263,8 @@ public class SwingActionPanel extends JPanel implements VascEntryFrontendEventLi
empty.setName("...");
gotoDownload.addItem(empty);
for (GlobalVascAction a:entry.getGlobalActions()) {
if (a.getId().contains("xport")) {
//s = new SelectItem();
//s.setLabel(i18nMap.get(a.getName()));
//s.setDescription(i18nMap.get(a.getDescription()));
//s.setValue(a.getId());
//result.add(s);
gotoDownload.addItem(a);
}
for (GlobalVascAction a:entry.getExportActions()) {
gotoDownload.addItem(a);
}

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing;
package net.forwardfire.vasc.frontend.swing;
import java.awt.Component;
import java.awt.event.ActionEvent;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing;
package net.forwardfire.vasc.frontend.swing;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing;
package net.forwardfire.vasc.frontend.swing;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing;
package net.forwardfire.vasc.frontend.swing;
import java.awt.BorderLayout;
import java.awt.FlowLayout;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing;
package net.forwardfire.vasc.frontend.swing;
import java.awt.BorderLayout;
import java.awt.Component;
@ -71,14 +71,14 @@ import net.forwardfire.vasc.core.ui.VascValueModel;
import net.forwardfire.vasc.frontend.AbstractVascFrontend;
import net.forwardfire.vasc.frontend.VascFrontendData;
import net.forwardfire.vasc.frontends.swing.ui.SwingBoolean;
import net.forwardfire.vasc.frontends.swing.ui.SwingButton;
import net.forwardfire.vasc.frontends.swing.ui.SwingColorChooser;
import net.forwardfire.vasc.frontends.swing.ui.SwingDate;
import net.forwardfire.vasc.frontends.swing.ui.SwingLabel;
import net.forwardfire.vasc.frontends.swing.ui.SwingList;
import net.forwardfire.vasc.frontends.swing.ui.SwingText;
import net.forwardfire.vasc.frontends.swing.ui.SwingTextArea;
import net.forwardfire.vasc.frontend.swing.ui.SwingBoolean;
import net.forwardfire.vasc.frontend.swing.ui.SwingButton;
import net.forwardfire.vasc.frontend.swing.ui.SwingColorChooser;
import net.forwardfire.vasc.frontend.swing.ui.SwingDate;
import net.forwardfire.vasc.frontend.swing.ui.SwingLabel;
import net.forwardfire.vasc.frontend.swing.ui.SwingList;
import net.forwardfire.vasc.frontend.swing.ui.SwingText;
import net.forwardfire.vasc.frontend.swing.ui.SwingTextArea;
/**
* SwingVascFrontend renders vasc entries in a swing panel.

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing;
package net.forwardfire.vasc.frontend.swing;
import java.util.ArrayList;
import java.util.List;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing.ui;
package net.forwardfire.vasc.frontend.swing.ui;
import java.awt.Color;
import java.awt.event.ActionEvent;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing.ui;
package net.forwardfire.vasc.frontend.swing.ui;
import java.awt.Color;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing.ui;
package net.forwardfire.vasc.frontend.swing.ui;
import java.awt.Color;
import java.awt.event.ActionEvent;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing.ui;
package net.forwardfire.vasc.frontend.swing.ui;
import java.awt.Color;
import java.awt.event.ActionEvent;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing.ui;
package net.forwardfire.vasc.frontend.swing.ui;
import java.awt.Color;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing.ui;
package net.forwardfire.vasc.frontend.swing.ui;
import java.awt.Color;
import java.awt.Component;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing.ui;
package net.forwardfire.vasc.frontend.swing.ui;
import java.awt.Color;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swing.ui;
package net.forwardfire.vasc.frontend.swing.ui;
import java.awt.Color;

View file

@ -25,8 +25,8 @@ package net.forwardfire.vasc;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryControllerLocal;
import net.forwardfire.vasc.frontends.swing.SwingPanelFrame;
import net.forwardfire.vasc.frontends.swing.SwingPanelIntegration;
import net.forwardfire.vasc.frontend.swing.SwingPanelFrame;
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
import net.forwardfire.vasc.impl.DefaultVascFactory;
import net.forwardfire.vasc.test.frontend.data.TestModelData;

View file

@ -35,8 +35,8 @@ import javax.swing.JTabbedPane;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryControllerLocal;
import net.forwardfire.vasc.frontends.swing.SwingPanelIntegration;
import net.forwardfire.vasc.frontends.swing.SwingPanelTabbed;
import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration;
import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed;
import net.forwardfire.vasc.impl.DefaultVascFactory;
import net.forwardfire.vasc.test.frontend.data.TestModelData;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swt;
package net.forwardfire.vasc.frontend.swt;
import java.util.List;
@ -102,10 +102,8 @@ public class SwtActionPanel implements VascEntryFrontendEventListener {
l.setText("Download: ");
downloadBox = new Combo(actionRow,SWT.SINGLE | SWT.BORDER);
downloadBox.add("...");
for (GlobalVascAction a:entry.getGlobalActions()) {
if (a.getId().contains("xport")) {
downloadBox.add(a.getName());
}
for (GlobalVascAction a:entry.getExportActions()) {
downloadBox.add(a.getName());
}
downloadBox.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swt;
package net.forwardfire.vasc.frontend.swt;
import java.util.List;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swt;
package net.forwardfire.vasc.frontend.swt;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swt;
package net.forwardfire.vasc.frontend.swt;
import java.io.FileOutputStream;
import java.io.OutputStream;
@ -40,12 +40,12 @@ import net.forwardfire.vasc.core.ui.VascValueModel;
import net.forwardfire.vasc.core.ui.VascValueModelListener;
import net.forwardfire.vasc.frontend.AbstractVascFrontend;
import net.forwardfire.vasc.frontend.VascFrontendData;
import net.forwardfire.vasc.frontends.swt.ui.SwtBoolean;
import net.forwardfire.vasc.frontends.swt.ui.SwtButton;
import net.forwardfire.vasc.frontends.swt.ui.SwtLabel;
import net.forwardfire.vasc.frontends.swt.ui.SwtList;
import net.forwardfire.vasc.frontends.swt.ui.SwtText;
import net.forwardfire.vasc.frontends.swt.ui.SwtTextArea;
import net.forwardfire.vasc.frontend.swt.ui.SwtBoolean;
import net.forwardfire.vasc.frontend.swt.ui.SwtButton;
import net.forwardfire.vasc.frontend.swt.ui.SwtLabel;
import net.forwardfire.vasc.frontend.swt.ui.SwtList;
import net.forwardfire.vasc.frontend.swt.ui.SwtText;
import net.forwardfire.vasc.frontend.swt.ui.SwtTextArea;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swt.ui;
package net.forwardfire.vasc.frontend.swt.ui;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;

View file

@ -20,7 +20,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.forwardfire.vasc.frontends.swt.ui;
package net.forwardfire.vasc.frontend.swt.ui;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;

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