2
0
Fork 0

[svn r390] jsf and state updates

This commit is contained in:
willemc 2009-12-31 13:51:53 +01:00
parent c1a8402ae8
commit 7ee4809086
64 changed files with 1475 additions and 1086 deletions

View file

@ -83,6 +83,7 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend
// Copy parameters
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
//System.out.println("Set para pame: "+key+" value: "+value);
query.setQueryParameter(key, value);
if (queryTotal!=null) {
queryTotal.setQueryParameter(key, value);
@ -97,6 +98,7 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend
for (QueryParameterValue value:values) {
Object valueObject = value.getValue();
q.setParameter(i,valueObject);
//System.out.println("Set para index: "+i+" value: "+valueObject+" valueClass: "+valueObject.getClass()+" valueType: "+value.getValueType());
i++;
}
if (isPageable() & state.getPageSize()>0) {

View file

@ -42,6 +42,7 @@ import com.idcanet.vasc.validators.VascValidator;
*/
abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
private static final long serialVersionUID = 1L;
protected String id = null;
protected Class<?> autoDetectClass = null;
protected List<VascValidator> vascValidators = null;

View file

@ -0,0 +1,142 @@
/**
*
*/
package com.idcanet.vasc.core;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Holds all default state values
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
abstract public class AbstractVascEntryState implements VascEntryState {
private static final long serialVersionUID = 1L;
private List<Object> entryDataList = null;
private Object entryDataObject = null;
private Long totalBackendRecords = null;
private VascBackendState vascBackendState = null;
private VascEntryState state = null;
private Map<Integer,Boolean> multiActionSelection = null;
private boolean isEditCreate = false;
private VascBackend vascBackend = null;
private VascEntry vascEntry = null;
public AbstractVascEntryState() {
entryDataList = new ArrayList<Object>(0);
multiActionSelection = new HashMap<Integer,Boolean>(200);
}
/**
* @return the entryDataList
*/
public List<Object> getEntryDataList() {
return entryDataList;
}
/**
* @param entryDataList the entryDataList to set
*/
public void setEntryDataList(List<Object> entryDataList) {
this.entryDataList = entryDataList;
}
/**
* @return the entryDataObject
*/
public Object getEntryDataObject() {
return entryDataObject;
}
/**
* @param entryDataObject the entryDataObject to set
*/
public void setEntryDataObject(Object entryDataObject) {
this.entryDataObject = entryDataObject;
}
/**
* @return the vascBackendState
*/
public VascBackendState getVascBackendState() {
return vascBackendState;
}
/**
* @param vascBackendState the vascBackendState to set
*/
public void setVascBackendState(VascBackendState vascBackendState) {
this.vascBackendState = vascBackendState;
}
/**
* @return the totalBackendRecords
*/
public Long getTotalBackendRecords() {
return totalBackendRecords;
}
/**
* @param totalBackendRecords the totalBackendRecords to set
*/
public void setTotalBackendRecords(Long totalBackendRecords) {
this.totalBackendRecords = totalBackendRecords;
}
public void setParent(VascEntryState state) {
this.state=state;
}
public VascEntryState getParent() {
return state;
}
public void setMultiActionSelection(Map<Integer,Boolean> multiActionSelection) {
this.multiActionSelection=multiActionSelection;
}
public Map<Integer,Boolean> getMultiActionSelection() {
return multiActionSelection;
}
/**
* @return the vascBackend
*/
public VascBackend getVascBackend() {
return vascBackend;
}
/**
* @param vascBackend the vascBackend to set
*/
public void setVascBackend(VascBackend vascBackend) {
this.vascBackend = vascBackend;
}
/**
* @return the isEditCreate
*/
public boolean isEditCreate() {
return isEditCreate;
}
/**
* @param isEditCreate the isEditCreate to set
*/
public void setEditCreate(boolean isEditCreate) {
this.isEditCreate = isEditCreate;
}
public void setVascEntry(VascEntry vascEntry) {
this.vascEntry=vascEntry;
}
public VascEntry getVascEntry() {
return vascEntry;
}
}

View file

@ -37,31 +37,31 @@ package com.idcanet.vasc.core;
public interface VascController {
/**
* @return Returns the VascBackendControllerResolver
* @return Returns the VascBackendController
*/
public VascBackendControllerResolver getVascBackendControllerResolver();
public VascBackendController getVascBackendController();
/**
*
* @return Returns the VascEntryControllerResolver
* @return Returns the VascEntryController
*/
public VascEntryControllerResolver getVascEntryControllerResolver();
public VascEntryController getVascEntryController();
/**
*
* @return Returns the VascEntryFieldControllerResolver
* @return Returns the VascEntryFieldController
*/
public VascEntryFieldTypeControllerResolver getVascEntryFieldTypeControllerResolver();
public VascEntryFieldTypeController getVascEntryFieldTypeController();
/**
*
* @return Returns the VascEventChannelControllerResolver
* @return Returns the VascEventChannelController
*/
public VascEventChannelControllerResolver getVascEventChannelControllerResolver();
public VascEventChannelController getVascEventChannelController();
/**
*
* @return Returns the VascUserRoleControllerResolver
* @return Returns the VascUserRoleController
*/
public VascUserRoleControllerResolver getVascUserRoleControllerResolver();
public VascUserRoleController getVascUserRoleController();
}

View file

@ -1,38 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public interface VascEntryControllerResolver {
public VascEntryController getVascEntryController();
}

View file

@ -1,38 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public interface VascEntryFieldTypeControllerResolver {
public VascEntryFieldTypeController getVascEntryFieldTypeController();
}

View file

@ -0,0 +1,117 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* Holds all the data for state.
* So we can jump forward or back to a state.
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
public interface VascEntryState extends Serializable {
/**
* @return the entryDataList
*/
public List<Object> getEntryDataList();
/**
* @param entryDataList the entryDataList to set
*/
public void setEntryDataList(List<Object> entryDataList);
/**
* @return the entryDataObject
*/
public Object getEntryDataObject();
/**
* @param entryDataObject the entryDataObject to set
*/
public void setEntryDataObject(Object entryDataObject);
/**
* @return the vascBackendState
*/
public VascBackendState getVascBackendState();
/**
* @param vascBackendState the vascBackendState to set
*/
public void setVascBackendState(VascBackendState vascBackendState);
/**
* @return the totalBackendRecords
*/
public Long getTotalBackendRecords();
/**
* @param totalBackendRecords the totalBackendRecords to set
*/
public void setTotalBackendRecords(Long totalBackendRecords);
/**
* @param state The previous state we come from.
*/
public void setParent(VascEntryState state);
/**
* @return The previous state we come from.
*/
public VascEntryState getParent();
public void setMultiActionSelection(Map<Integer,Boolean> multiActionSelection);
public Map<Integer,Boolean> getMultiActionSelection();
public void setVascEntry(VascEntry vascEntry);
public VascEntry getVascEntry();
/**
* @return the vascBackend
*/
public VascBackend getVascBackend();
/**
* @param vascBackend the vascBackend to set
*/
public void setVascBackend(VascBackend vascBackend);
/**
* @return the isEditCreate
*/
public boolean isEditCreate();
/**
* @param isEditCreate the isEditCreate to set
*/
public void setEditCreate(boolean isEditCreate);
}

View file

@ -1,38 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2008
*/
public interface VascEventChannelControllerResolver {
public VascEventChannelController getVascEventChannelController();
}

View file

@ -41,27 +41,7 @@ import com.idcanet.vasc.core.ui.VascUIComponent;
* @version 1.0 Mar 21, 2007
*/
public interface VascFrontendData {
/**
* @return the entryDataList
*/
public List<Object> getEntryDataList();
/**
* @param entryDataList the entryDataList to set
*/
public void setEntryDataList(List<Object> entryDataList);
/**
* @return the entryDataObject
*/
public Object getEntryDataObject();
/**
* @param entryDataObject the entryDataObject to set
*/
public void setEntryDataObject(Object entryDataObject);
/**
* @return the vascFrontend
*/
@ -106,17 +86,7 @@ public interface VascFrontendData {
public VascUIComponent getFieldVascUIComponent(VascEntryField field);
public Object getFieldRealRenderer(VascEntryField field);
public void clearFieldRenderObjects();
/**
* @return the vascBackend
*/
public VascBackend getVascBackend();
/**
* @param vascBackend the vascBackend to set
*/
public void setVascBackend(VascBackend vascBackend);
/**
* @return the exceptionListener
*/
@ -140,33 +110,6 @@ public interface VascFrontendData {
public void addVascValidatorService(VascEntryFieldValidatorService validatorService);
public List<VascEntryFieldValidatorService> getVascValidatorServices();
/**
* @return the isEditCreate
*/
public boolean isEditCreate();
/**
* @param isEditCreate the isEditCreate to set
*/
public void setEditCreate(boolean isEditCreate);
/**
* @return the vascBackendState
*/
public VascBackendState getVascBackendState();
/**
* @param vascBackendState the vascBackendState to set
*/
public void setVascBackendState(VascBackendState vascBackendState);
/**
* @return the totalBackendRecords
*/
public Long getTotalBackendRecords();
/**
* @param totalBackendRecords the totalBackendRecords to set
*/
public void setTotalBackendRecords(Long totalBackendRecords);
public VascEntryState getVascEntryState();
public void setVascEntryState(VascEntryState state);
}

View file

@ -83,4 +83,6 @@ public interface VascFrontendHelper {
public void pageAction(VascEntry entry,Integer page);
public void moveAction(VascEntry entry,Object object,boolean moveUp);
public List<RowVascAction> getMultiRowActions(VascEntry entry);
}

View file

@ -1,38 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public interface VascUserRoleControllerResolver {
public VascUserRoleController getVascUserRoleController();
}

View file

@ -35,6 +35,7 @@ package com.idcanet.vasc.core.actions;
*/
abstract public class AbstractVascAction implements VascAction {
private static final long serialVersionUID = 1L;
private String id = null;
private String name = null;
private String description = null;

View file

@ -142,7 +142,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
public void renderEdit() throws Exception {
logger.fine("Rending Edit View");
Object rowBean = entry.getVascFrontendData().getEntryDataObject();
Object rowBean = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
String beanValue = rowBean.toString();
if (entry.getDisplayNameFieldId()!=null) {
VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId());
@ -163,12 +163,12 @@ public class SwingVascFrontend extends AbstractVascFrontend {
if(result==null) {
return;
}
entry.getVascFrontendData().setEntryDataObject(result);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(result);
entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry);
}
public void renderDelete() throws Exception {
Object rowBean = entry.getVascFrontendData().getEntryDataObject();
Object rowBean = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
String beanValue = rowBean.toString();
VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId());
@ -476,7 +476,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
table.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if (e.getClickCount() == 2) {
Object o = entry.getVascFrontendData().getEntryDataObject();
Object o = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
if (o==null) {
return;
}
@ -505,10 +505,10 @@ public class SwingVascFrontend extends AbstractVascFrontend {
if (rowIndex!=-1) {
// temp; gets index by sorter
//rowIndex = tableSorter.modelIndex(rowIndex);
Object data = entry.getVascFrontendData().getEntryDataList().get(rowIndex);
entry.getVascFrontendData().setEntryDataObject(data);
Object data = entry.getVascFrontendData().getVascEntryState().getEntryDataList().get(rowIndex);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(data);
} else {
entry.getVascFrontendData().setEntryDataObject(null);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
}
}
}
@ -567,7 +567,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
public void actionPerformed(ActionEvent event) {
logger.fine("Row Action");
try {
action.doRowAction(entry, entry.getVascFrontendData().getEntryDataObject());
action.doRowAction(entry, entry.getVascFrontendData().getVascEntryState().getEntryDataObject());
} catch (Exception e) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,e);
}
@ -621,17 +621,17 @@ public class SwingVascFrontend extends AbstractVascFrontend {
* @see javax.swing.entry.entryModel#getRowCount()
*/
public int getRowCount() {
if (entry.getVascFrontendData().getEntryDataList()==null) {
if (entry.getVascFrontendData().getVascEntryState().getEntryDataList()==null) {
return 0;
}
return entry.getVascFrontendData().getEntryDataList().size();
return entry.getVascFrontendData().getVascEntryState().getEntryDataList().size();
}
/**
* @see javax.swing.entry.entryModel#getValueAt(int, int)
*/
public Object getValueAt(int rowIndex, int columnIndex) {
Object bean = entry.getVascFrontendData().getEntryDataList().get(rowIndex);
Object bean = entry.getVascFrontendData().getVascEntryState().getEntryDataList().get(rowIndex);
logger.finer("Rending column; "+columnIndex+" bean: "+bean);
// TODO: this is slowing....

View file

@ -35,18 +35,20 @@ public class JSFVascEntryEventListener implements VascEntryEventListener {
VascEntryField fieldClone = field.clone();
fieldClone.getVascValidators().clear();
VascEntryFieldValue v = entry.getVascFrontendData().getVascBackend().provideVascEntryFieldValue(fieldClone);
VascEntryFieldValue v = entry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(fieldClone);
field.setVascEntryFieldValue(v);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
List<Object> data = entry.getVascFrontendData().getEntryDataList();
List<Object> data = entry.getVascFrontendData().getVascEntryState().getEntryDataList();
List<Object> result = new ArrayList<Object>(data.size());
int index = 0;
for (Object o:data) {
VascDataBackendBean b = new VascDataBackendBean(entry,o);
VascDataBackendBean b = new VascDataBackendBean(entry,o,index);
result.add(b);
index++;
}
ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".tableDataModel.wrappedData}", Object.class);

View file

@ -41,6 +41,9 @@ import javax.faces.component.html.HtmlCommandButton;
import javax.faces.component.html.HtmlCommandLink;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
@ -48,13 +51,16 @@ import javax.faces.model.SelectItem;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendPageNumber;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryState;
import com.idcanet.vasc.core.VascLinkEntry;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryExporter;
import com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType;
/**
*
@ -81,6 +87,7 @@ public class JSFVascEntrySupportBean implements Serializable {
private VascEntryExporter selectedExporter = null;
private String selectedExporterAction = "null";
private String selectedDirectPage = "null";
private String selectedMultiRowAction = "null";
private Map<String,Object> editSelectItemModels = null;
public JSFVascEntrySupportBean(VascEntry entry) {
@ -96,10 +103,11 @@ public class JSFVascEntrySupportBean implements Serializable {
editSelectItemModels = new HashMap<String,Object>(6);
// cache some values
backendPageable = entry.getVascFrontendData().getVascBackend().isPageable();
backendMoveable = entry.getVascFrontendData().getVascBackend().isRecordMoveable();
backendSearchable = entry.getVascFrontendData().getVascBackend().isSearchable();
backendSortable = entry.getVascFrontendData().getVascBackend().isSortable();
VascBackend backend = entry.getVascFrontendData().getVascEntryState().getVascBackend();;
backendPageable = backend.isPageable();
backendMoveable = backend.isRecordMoveable();
backendSearchable = backend.isSearchable();
backendSortable = backend.isSortable();
i18nMap = new JSFVascSupportI18nMapController(entry);
@ -134,6 +142,9 @@ public class JSFVascEntrySupportBean implements Serializable {
public int getTotalFieldColumnCount() {
int t = 0;
if (getHasMultiRowActions()) {
t++; // auto add of select boxes
}
for (VascEntryField c:entry.getVascEntryFields()) {
if (entry.getVascFrontendData().getVascFrontendHelper().renderList(c)==false) {
continue;
@ -145,43 +156,42 @@ public class JSFVascEntrySupportBean implements Serializable {
public int getTotalActionColumnCount() {
int t = 0;
if (entry.getVascFrontendData().getVascBackend().isRecordMoveable()) {
if (entry.getVascFrontendData().getVascEntryState().getVascBackend().isRecordMoveable()) {
t++;
t++;
}
for (RowVascAction action:entry.getRowActions()) {
t++;
}
t+=entry.getRowActions().size();
return t;
}
public int getTotalLinkColumnCount() {
int t = 0;
for (VascLinkEntry vascLink:entry.getVascLinkEntries()) {
t++;
JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(FacesContext.getCurrentInstance().getViewRoot(),entry.getId());
String disableLinkColumns = (String)comp.getAttributes().get(JSFVascUIComponent.DISABLE_LINK_COLUMNS);
if (disableLinkColumns!=null && disableLinkColumns.equals("true")) {
return 0; // not added too table.
}
return t;
return entry.getVascLinkEntries().size();
}
public long getPageTotalRecordCount() {
long result = entry.getVascFrontendData().getTotalBackendRecords();
long result = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
return result;
}
public long getPageStartCount() {
int index = entry.getVascFrontendData().getVascBackendState().getPageIndex();
int pageSize = entry.getVascFrontendData().getVascBackendState().getPageSize();
int index = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
int pageSize = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
long result = index*pageSize;
return result;
}
public long getPageStopCount() {
int index = entry.getVascFrontendData().getVascBackendState().getPageIndex();
int pageSize = entry.getVascFrontendData().getVascBackendState().getPageSize();
int index = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
int pageSize = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
long result = (index*pageSize)+pageSize;
// limit for small result sets.
if (result>entry.getVascFrontendData().getTotalBackendRecords()) {
result = entry.getVascFrontendData().getTotalBackendRecords();
if (result>entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords()) {
result = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
}
return result;
}
@ -189,8 +199,8 @@ public class JSFVascEntrySupportBean implements Serializable {
public List<SelectItem> getGlobalExportItems() {
List<SelectItem> result = new ArrayList<SelectItem>(5);
SelectItem s = new SelectItem();
s.setLabel("...");
s.setDescription("Selecteer Export");
s.setLabel(i18nMap.get("generic.vasc.jsf.table.export.select"));
s.setDescription(i18nMap.get("generic.vasc.jsf.table.export.select.alt"));
s.setValue("null");
result.add(s);
@ -203,25 +213,26 @@ public class JSFVascEntrySupportBean implements Serializable {
result.add(s);
}
}
return result;
}
public List<SelectItem> getDirectPageItems() {
List<SelectItem> result = new ArrayList<SelectItem>(5);
SelectItem s = new SelectItem();
s.setLabel("...");
s.setDescription("Selecteer Page");
s.setLabel(i18nMap.get("generic.vasc.jsf.table.page.select"));
s.setDescription(i18nMap.get("generic.vasc.jsf.table.page.select.alt"));
s.setValue("null");
result.add(s);
int pageSize = getVascEntry().getVascFrontendData().getVascBackendState().getPageSize();
int pageSize = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
for (int i=0;i<getTablePagesDataModel().getRowCount();i++) {
getTablePagesDataModel().setRowIndex(i);
VascBackendPageNumber page = (VascBackendPageNumber)getTablePagesDataModel().getRowData();
s = new SelectItem();
s.setLabel("Page: "+page.getPageNumber()+" "+(i*pageSize)+"-"+((i*pageSize)+pageSize));
s.setDescription("Ga naar pagina: "+page.getPageNumber());
String name = i18nMap.get("generic.vasc.jsf.table.page.name");
String description = i18nMap.get("generic.vasc.jsf.table.page.description");
s.setLabel(name+page.getPageNumber()+" "+(i*pageSize)+"-"+((i*pageSize)+pageSize));
s.setDescription(description+page.getPageNumber());
s.setValue(page.getPageNumber());
result.add(s);
}
@ -241,12 +252,12 @@ public class JSFVascEntrySupportBean implements Serializable {
if (getHasExtendedPageMode()==false) {
return false;
}
int page = getVascEntry().getVascFrontendData().getVascBackendState().getPageIndex();
int page = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
if (page<5) {
return false;
}
int pages = getTablePagesDataModel().getRowCount();
if (page>pages-5) {
if (page>pages-6) {
return false;
}
return true;
@ -261,7 +272,7 @@ public class JSFVascEntrySupportBean implements Serializable {
getTablePagesDataModel().setRowIndex(2);
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
int page = getVascEntry().getVascFrontendData().getVascBackendState().getPageIndex();
int page = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
if (page==2 | page==3 | page==4) {
getTablePagesDataModel().setRowIndex(3);
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
@ -280,18 +291,18 @@ public class JSFVascEntrySupportBean implements Serializable {
public List<VascBackendPageNumber> getTablePagesExtendedEnd() {
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(6);
int pages = getTablePagesDataModel().getRowCount();
int page = getVascEntry().getVascFrontendData().getVascBackendState().getPageIndex();
int page = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
int off = pages-page;
if (off==4) {
if (off==5) {
getTablePagesDataModel().setRowIndex(pages-6);
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
}
if (off==3 | off==4) {
if (off==4 | off==5) {
getTablePagesDataModel().setRowIndex(pages-5);
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
}
if (off==2 | off==3 | off==4) {
if (off==3 | off==4 | off==5) {
getTablePagesDataModel().setRowIndex(pages-4);
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
}
@ -302,15 +313,12 @@ public class JSFVascEntrySupportBean implements Serializable {
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
getTablePagesDataModel().setRowIndex(pages-1);
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
return result;
}
public List<VascBackendPageNumber> getTablePagesExtendedCenter() {
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(3);
int page = getVascEntry().getVascFrontendData().getVascBackendState().getPageIndex();
int page = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
getTablePagesDataModel().setRowIndex(page-1);
result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData());
getTablePagesDataModel().setRowIndex(page);
@ -330,6 +338,97 @@ public class JSFVascEntrySupportBean implements Serializable {
throw new IllegalArgumentException("Component is of link of button type: "+comp);
}
public boolean getHasMultiRowActions() {
int size = getVascEntry().getVascFrontendData().getVascFrontendHelper().getMultiRowActions(getVascEntry()).size();
if (size==0) {
return false;
}
return true;
}
public List<SelectItem> getMultiRowActionItems() {
List<SelectItem> result = new ArrayList<SelectItem>(5);
SelectItem s = new SelectItem();
s.setLabel(i18nMap.get("generic.vasc.jsf.multiAction.name"));
s.setDescription(i18nMap.get("generic.vasc.jsf.multiAction.description"));
s.setValue("null");
result.add(s);
for (RowVascAction a:getVascEntry().getVascFrontendData().getVascFrontendHelper().getMultiRowActions(getVascEntry())) {
s = new SelectItem();
s.setLabel(i18nMap.get(a.getName()));
s.setDescription(i18nMap.get(a.getDescription()));
s.setValue(a.getId());
result.add(s);
}
return result;
}
public void processMultiRowActionChange(ValueChangeEvent event) {
// first do normal global selection of action aka: globalAction(event); copyed:
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
VascEntry entry = comp.getVascEntry();
String actionIdString = (String)event.getNewValue();
logger.finer("multri row id "+actionIdString);
// TODO: FIX this change listener is called before save action in row EDIT...
if (actionIdString==null) {
return;
}
// Default selection for fancy gui
if ("null".equals(actionIdString)) {
return;
}
logger.info("MultiRowAction: "+actionIdString);
FacesContext.getCurrentInstance().getViewRoot().addPhaseListener(new MultiRowAction(entry,actionIdString));
}
class MultiRowAction implements PhaseListener,Serializable {
private static final long serialVersionUID = 1L;
VascEntry vascEntry;
String actionId;
public MultiRowAction(VascEntry vascEntry,String actionId) {
this.vascEntry=vascEntry;
this.actionId=actionId;
}
public void beforePhase(PhaseEvent PhaseEvent) {
}
public void afterPhase(PhaseEvent PhaseEvent) {
if (vascEntry==null) {
return;
}
RowVascAction action = vascEntry.getRowActionById(actionId);
VascEntryState state = vascEntry.getVascFrontendData().getVascEntryState();
try {
for (Integer rowId:state.getMultiActionSelection().keySet()) {
Boolean value = state.getMultiActionSelection().get(rowId);
logger.fine("multiRow selected: "+rowId+" value: "+value);
if (value!=null && value==true) {
Object row = state.getEntryDataList().get(rowId);
logger.finer("row: "+row);
action.doRowAction(vascEntry, row);
}
}
setSelectedMultiRowAction("null"); // reset to selected ... value
state.getMultiActionSelection().clear(); // after down deselect all options
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
vascEntry=null;
}
}
public PhaseId getPhaseId(){
return PhaseId.UPDATE_MODEL_VALUES;
}
}
// All Actions
public void searchAction(ActionEvent event) {
@ -353,7 +452,7 @@ public class JSFVascEntrySupportBean implements Serializable {
entry.getVascFrontendData().getVascFrontendHelper().sortAction(entry, field);
sortOrder = entry.getVascFrontendData().getVascBackendState().isSortAscending();
sortOrder = entry.getVascFrontendData().getVascEntryState().getVascBackendState().isSortAscending();
sortField = field.getId();
try {
@ -363,6 +462,44 @@ public class JSFVascEntrySupportBean implements Serializable {
}
}
public boolean getRenderBackAction() {
return getVascEntry().getVascFrontendData().getVascEntryState().getParent()!=null;
}
public void backAction(ActionEvent event) {
logger.fine("backAction");
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
VascEntry entry = getVascEntry();
comp.initGoto(entry.getVascFrontendData().getVascEntryState().getParent());
try {
entry.getVascFrontendData().getVascFrontend().renderView();
} catch (Exception e) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
}
}
public void backEditAction(ActionEvent event) {
logger.fine("backEditAction");
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
VascEntry entry = getVascEntry();
comp.initGoto(entry.getVascFrontendData().getVascEntryState().getParent());
// select record to edit
Object rowObject = entry.getVascFrontendData().getVascEntryState().getParent().getEntryDataObject();
int index = entry.getVascFrontendData().getVascEntryState().getParent().getEntryDataList().indexOf(rowObject);
tableDataModel.setRowIndex(index);
try {
entry.getVascFrontendData().getVascEntryState().setEditCreate(false);
entry.getVascFrontendData().getVascFrontendHelper().fireVascEvent(entry, VascEventType.DATA_SELECT, rowObject);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(rowObject);
entry.getVascFrontendData().getVascFrontend().renderEdit();
} catch (Exception e) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
}
}
public void pageAction(ActionEvent event) {
logger.fine("pageAction");
Integer pageIndex = new Integer(getComponentType(event.getComponent()));
@ -382,7 +519,7 @@ public class JSFVascEntrySupportBean implements Serializable {
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
VascEntry entry = comp.getVascEntry();
int pageIndex = entry.getVascFrontendData().getVascBackendState().getPageIndex();
int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
pageIndex++;
selectedDirectPage=pageIndex+"";
entry.getVascFrontendData().getVascFrontendHelper().pageAction(entry, pageIndex);
@ -398,7 +535,7 @@ public class JSFVascEntrySupportBean implements Serializable {
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
VascEntry entry = comp.getVascEntry();
int pageIndex = entry.getVascFrontendData().getVascBackendState().getPageIndex();
int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
pageIndex--;
selectedDirectPage=pageIndex+"";
entry.getVascFrontendData().getVascFrontendHelper().pageAction(entry, pageIndex);
@ -411,12 +548,12 @@ public class JSFVascEntrySupportBean implements Serializable {
public boolean getHasPageNextAction() {
VascEntry entry = getVascEntry();
int pageIndex = entry.getVascFrontendData().getVascBackendState().getPageIndex();
int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
pageIndex++;
// copyed from helper
Long total = entry.getVascFrontendData().getTotalBackendRecords();
logger.finer("Checking has next action for next pageIndex"+pageIndex+" of total: "+total+" and pageSize: "+entry.getVascFrontendData().getVascBackendState().getPageSize());
if (total!=null && pageIndex>(total/entry.getVascFrontendData().getVascBackendState().getPageSize())) {
Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
logger.finer("Checking has next action for next pageIndex"+pageIndex+" of total: "+total+" and pageSize: "+entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize());
if (total!=null && pageIndex>(total/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize())) {
return false;
}
return true;
@ -424,7 +561,7 @@ public class JSFVascEntrySupportBean implements Serializable {
public boolean getHasPagePreviousAction() {
VascEntry entry = getVascEntry();
int pageIndex = entry.getVascFrontendData().getVascBackendState().getPageIndex();
int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
if (pageIndex==0) {
return false;
}
@ -500,6 +637,24 @@ public class JSFVascEntrySupportBean implements Serializable {
this.selected=selected; // renderView clears selected !
}
public void moveAction(ActionEvent event) {
logger.fine("moveAction");
String moveAction = getComponentType(event.getComponent());
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
Object selected = comp.getSupportBean().getSelectedTableRecord().getRecord();
if ("up".equals(moveAction)) {
entry.getVascFrontendData().getVascFrontendHelper().moveAction(entry,selected,true);
}
if ("down".equals(moveAction)) {
entry.getVascFrontendData().getVascFrontendHelper().moveAction(entry,selected,false);
}
try {
entry.getVascFrontendData().getVascFrontend().renderView();
} catch (Exception e) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
}
}
public void linkEditAction(ActionEvent event) {
logger.fine("linkEditAction");
String linkId = getComponentType(event.getComponent());
@ -517,11 +672,30 @@ public class JSFVascEntrySupportBean implements Serializable {
this.selected=selected; // renderView clears selected !
}
public void linkListAction(ActionEvent event) {
logger.fine("linkListAction");
String linkId = getComponentType(event.getComponent());
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
VascLinkEntry link = comp.getVascEntry().getVascFrontendData().getVascEntryState().getParent().getVascEntry().getVascLinkEntryById(linkId);
comp.initGoto(link,comp.getVascEntry().getVascFrontendData().getVascEntryState().getParent());
Object o = comp.getVascEntry().getVascFrontendData().getVascEntryState().getParent().getEntryDataObject();
int index = comp.getVascEntry().getVascFrontendData().getVascEntryState().getParent().getEntryDataList().indexOf(o);
VascDataBackendBean selected = new VascDataBackendBean(entry,o,index);
this.selected=selected;
try {
entry.getVascFrontendData().getVascFrontend().renderView();
} catch (Exception e) {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
}
this.selected=selected;
}
public void cancelAction(ActionEvent event) {
logger.fine("cancelAction");
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
VascEntry entry = comp.getVascEntry();
entry.getVascFrontendData().setEntryDataObject(null);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
try {
entry.getVascFrontendData().getVascFrontend().renderView();
} catch (Exception e) {
@ -548,7 +722,7 @@ public class JSFVascEntrySupportBean implements Serializable {
}
*/
entry.getVascFrontendData().setEntryDataObject(selected.getRecord());
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(selected.getRecord());
entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry);
try {
@ -791,6 +965,20 @@ public class JSFVascEntrySupportBean implements Serializable {
public Map<String, Object> getEditSelectItemModels() {
return editSelectItemModels;
}
/**
* @return the selectedMultiRowAction
*/
public String getSelectedMultiRowAction() {
return selectedMultiRowAction;
}
/**
* @param selectedMultiRowAction the selectedMultiRowAction to set
*/
public void setSelectedMultiRowAction(String selectedMultiRowAction) {
this.selectedMultiRowAction = selectedMultiRowAction;
}
}

View file

@ -99,8 +99,9 @@ public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Ser
//String entrySupportVar = (String)comp.getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY);
VascDataBackendBean selBean = null;
if (entry.getVascFrontendData().isEditCreate()) {
selBean = new VascDataBackendBean(entry,entry.getVascFrontendData().getEntryDataObject());
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
int index = entry.getVascFrontendData().getVascEntryState().getEntryDataList().size()+1;
selBean = new VascDataBackendBean(entry,entry.getVascFrontendData().getVascEntryState().getEntryDataObject(),index);
} else {
selBean = comp.getSupportBean().getSelectedTableRecord();
}

View file

@ -27,56 +27,25 @@
package com.idcanet.vasc.frontends.web.jsf;
import java.io.IOException;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Logger;
import javax.el.ELContext;
import javax.el.MethodExpression;
import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.application.Application;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.component.UIInput;
import javax.faces.component.UIOutput;
import javax.faces.component.UIViewRoot;
import javax.faces.component.html.HtmlCommandLink;
import javax.faces.component.html.HtmlMessage;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.MethodExpressionActionListener;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
import com.idcanet.vasc.core.AbstractVascFrontend;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendFilter;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryState;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.core.VascLinkEntry;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryEventListener;
import com.idcanet.vasc.core.entry.VascEntryExporter;
import com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType;
import com.idcanet.vasc.core.ui.VascOptionValueModelListener;
import com.idcanet.vasc.core.ui.VascValueModel;
import com.idcanet.vasc.frontends.web.jsf.ui.JSFBoolean;
import com.idcanet.vasc.frontends.web.jsf.ui.JSFLabel;
import com.idcanet.vasc.frontends.web.jsf.ui.JSFList;
import com.idcanet.vasc.frontends.web.jsf.ui.JSFText;
import com.idcanet.vasc.frontends.web.jsf.ui.JSFTextArea;
import com.idcanet.vasc.impl.VascBackendProxyFilter;
import com.idcanet.vasc.impl.VascBackendProxyPaged;
import com.idcanet.vasc.impl.VascBackendProxySearch;
import com.idcanet.vasc.impl.VascBackendProxySort;
import com.idcanet.vasc.impl.DefaultVascFactory;
/**
* Renders an JSF vasc entry views.
@ -97,11 +66,14 @@ public class JSFVascUIComponent extends UIComponentBase {
public static final String INJECT_EDIT_FIELDS_ID = "injectEditFieldsId";
public static final String INJECT_TABLE_OPTIONS_ID = "injectTableOptionsId";
public static final String INJECT_TABLE_COLUMNS_ID = "injectTableColumnsId";
public static final String DISABLE_LINK_COLUMNS = "disableLinkColumns";
private JSFVascFrontendRenderer renderer = null;
private JSFVascEntrySupportBean supportBean = null;
private String renderFacetState = null;
private VascLinkEntry link = null;
private VascEntryState linkState = null;
private VascEntryState state = null;
private Logger logger = null;
private Boolean initClear = null;
@ -162,6 +134,9 @@ public class JSFVascUIComponent extends UIComponentBase {
}
if (comp instanceof JSFVascUIComponent) {
JSFVascUIComponent ui = (JSFVascUIComponent)comp;
if (entryId==null) {
return ui;
}
if (entryId.equals(ui.getVascEntry().getId())) {
return ui;
}
@ -201,6 +176,16 @@ public class JSFVascUIComponent extends UIComponentBase {
logger.fine("init goto "+link);
this.link=link;
}
protected void initGoto(VascLinkEntry link,VascEntryState state) {
logger.fine("init goto link: "+link);
this.link=link;
this.linkState=state;
}
protected void initGoto(VascEntryState state) {
logger.fine("init goto "+state);
this.state=state;
}
public Boolean getInitClear() {
return initClear;
@ -210,8 +195,8 @@ public class JSFVascUIComponent extends UIComponentBase {
public void encodeBegin(FacesContext context) throws IOException {
logger.fine("Comp encodeBegin link: "+link);
boolean init = false;
if (renderer==null | link!=null) {
renderFacetState = "listView";
if (renderer==null | link!=null | state!=null) {
renderFacetState = "listView";
VascEntry entry = createClonedVascEntry();
renderer = new JSFVascFrontendRenderer();
try {
@ -220,11 +205,14 @@ public class JSFVascUIComponent extends UIComponentBase {
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
}
supportBean = new JSFVascEntrySupportBean(entry);
// copy search string for preadded search string from application layer
supportBean.setSearchString(entry.getVascFrontendData().getVascEntryState().getVascBackendState().getSearchString());
init = true;
// no need to add multiple
if (link!=null) {
logger.finer("Adding phase listener: JSFVascValidatePhaseListener");
if (renderer==null) {
logger.info("Adding phase listener: JSFVascValidatePhaseListener");
context.getViewRoot().addPhaseListener(new JSFVascValidatePhaseListener());
}
@ -238,7 +226,7 @@ public class JSFVascUIComponent extends UIComponentBase {
// set init for component renderer
if (init) {
initClear = false;
if (link!=null) {
if (link!=null | state!=null) {
initClear = true;
}
}
@ -290,55 +278,49 @@ public class JSFVascUIComponent extends UIComponentBase {
entryName = link.getVascEntryId();
}
VascEntry entry = vascController.getVascEntryControllerResolver().getVascEntryController().getVascEntryById(entryName);
VascEntry entry = vascController.getVascEntryController().getVascEntryById(entryName);
if (entry==null) {
throw new NullPointerException("Could not locate '"+entryName+"' from : "+vascController);
}
frontendData.setVascController(vascController);
entry.setVascFrontendData(frontendData);
VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId());
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);
}
frontendData.setVascBackend(backend);
VascBackend backend = DefaultVascFactory.getProxyVascBackend(entry);
frontendData.getVascEntryState().setVascBackend(backend);
frontendData.getVascEntryState().setVascEntry(entry);
if (link!=null) {
try {
Object selected = getSupportBean().getSelected().getRecord();
for (String parameterName:link.getEntryParameterFieldIdKeys()) {
String fieldId = link.getEntryParameterFieldId(parameterName);
VascEntryField v = getVascEntry().getVascEntryFieldById(fieldId);
Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected);
// set data parameter on new vasc entry
entry.getVascFrontendData().getVascBackendState().setDataParameter(parameterName, selectedValue);
logger.fine("Setting link parameter: "+parameterName+" with: "+selectedValue);
// save state
if (linkState==null) {
frontendData.getVascEntryState().setParent(getVascEntry().getVascFrontendData().getVascEntryState());
} else {
frontendData.getVascEntryState().setParent(linkState);
}
for (String fieldId:link.getEntryCreateFieldValueKeys()) {
String selectedfieldId = link.getEntryParameterFieldId(fieldId);
Object selectedValue = selected;
if (selectedfieldId!=null) {
VascEntryField v = getVascEntry().getVascEntryFieldById(selectedfieldId);
selectedValue = v.getVascEntryFieldValue().getValue(v, selected);
// Set parameters
try {
Object selected = getSupportBean().getSelected().getRecord();
for (String parameterName:link.getEntryParameterFieldIdKeys()) {
String fieldId = link.getEntryParameterFieldId(parameterName);
VascEntryField v = getVascEntry().getVascEntryFieldById(fieldId);
Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected);
// set data parameter on new vasc entry
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue);
logger.fine("Setting link parameter: "+parameterName+" with: "+selectedValue);
}
// create listener for new objects
entry.addVascEntryEventListener(VascEventType.DATA_CREATE, new CreateEntryFieldValuesListener2(fieldId,selectedValue));
}
for (String fieldId:link.getEntryCreateFieldValueKeys()) {
String selectedfieldId = link.getEntryParameterFieldId(fieldId);
Object selectedValue = selected;
if (selectedfieldId!=null) {
VascEntryField v = getVascEntry().getVascEntryFieldById(selectedfieldId);
selectedValue = v.getVascEntryFieldValue().getValue(v, selected);
}
// create listener for new objects
entry.addVascEntryEventListener(VascEventType.DATA_CREATE, new CreateEntryFieldValuesListener2(fieldId,selectedValue));
}
} catch (Exception e) {
e.printStackTrace();
}

View file

@ -43,13 +43,16 @@ import javax.faces.component.UIInput;
import javax.faces.component.UIOutput;
import javax.faces.component.UIViewRoot;
import javax.faces.component.html.HtmlCommandLink;
import javax.faces.component.html.HtmlDataTable;
import javax.faces.component.html.HtmlMessage;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.component.html.HtmlSelectBooleanCheckbox;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import javax.faces.event.MethodExpressionActionListener;
import javax.faces.event.ValueChangeEvent;
import javax.faces.event.ValueChangeListener;
import javax.faces.render.Renderer;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
@ -218,6 +221,7 @@ public class JSFVascUIComponentRenderer extends Renderer {
}
public void validate(FacesContext context, UIComponent component,Object object) throws ValidatorException {
// always oke, we are runned by phase listener
System.out.println("Validate normal.");
}
public void validatePhase(FacesContext context, UIComponent component,Object object) throws ValidatorException {
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(component);
@ -231,7 +235,7 @@ public class JSFVascUIComponentRenderer extends Renderer {
ve7.setValue(FacesContext.getCurrentInstance().getELContext(), object);
List<String> errors = entry.getVascFrontendData().getVascFrontendHelper().validateObjectField(field);
//System.out.println("Validate: "+component+" errors: "+errors.size()+" value: "+object);
System.out.println("Validate: "+component+" errors: "+errors.size()+" value: "+object);
if (errors.isEmpty()) {
return; // no errors
}
@ -267,13 +271,11 @@ public class JSFVascUIComponentRenderer extends Renderer {
com.idcanet.vasc.core.ui.VascUIComponent editor = option.getVascEntryFieldType().provideEditorUIComponent(i,option);
model = new VascValueModel(option.getVascEntryFieldType().provideEditorVascValueModel(i,option));
model.addListener(new VascOptionValueModelListener(option));
model.setValue(null);
model.setValue(option.getDefaultValue());
UIInput jsfEdit = (UIInput)editor.createComponent(entry,option,model,grid);
jsfEdit.addValueChangeListener(new ModelChangeListener(model));
//ValueExpression ve7 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+getSelectedRecordName()+"."+option.getBackendName()+"}", Object.class);
//jsfEdit.setValueExpression("value", ve7);
// i==0 is for multi field editor support... which is stell very in progress
// i==0 is for multi field editor support... which is stell very in progress aka not working
if (i==0) {
entry.getVascFrontendData().addFieldVascUIComponents(option, editor,jsfEdit);
}
@ -281,6 +283,20 @@ public class JSFVascUIComponentRenderer extends Renderer {
}
entry.getVascFrontendData().getVascFrontendHelper().headerOptionsCreatedFillData(entry);
}
public class ModelChangeListener implements ValueChangeListener,Serializable {
private static final long serialVersionUID = 1L;
VascValueModel model;
public ModelChangeListener(VascValueModel model) {
this.model=model;
}
public void processValueChange(ValueChangeEvent event) throws AbortProcessingException {
try {
model.setValue(event.getNewValue());
} catch (VascException e) {
throw new AbortProcessingException(e);
}
}
}
private void addColumns(FacesContext fc,JSFVascUIComponent comp,UIComponent table) {
@ -291,6 +307,38 @@ public class JSFVascUIComponentRenderer extends Renderer {
String entrySupportVar = (String)comp.getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY);
String tableRecordVar = (String)comp.getAttributes().get(JSFVascUIComponent.TABLE_RECORD_VAR_KEY);
if (!entry.getVascFrontendData().getVascFrontendHelper().getMultiRowActions(entry).isEmpty()) {
UIColumn colUp = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE);
colUp.setId(viewRoot.createUniqueId());
/*
// Select box head in table
HtmlCommandLink selectAll = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
selectAll.setId(viewRoot.createUniqueId());
selectAll.setType("selectAll");
MethodExpression actionExpression = getMethodExpression("#{"+entrySupportVar+".selectAllAction}");
MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(actionExpression);
selectAll.addActionListener(meActionListener);
HtmlOutputText orderUp = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
orderUp.setId(viewRoot.createUniqueId());
orderUp.setEscape(false);
orderUp.setValue("selectAll");
selectAll.getChildren().add(orderUp);
colUp.setHeader(selectAll);
*/
HtmlSelectBooleanCheckbox select = (HtmlSelectBooleanCheckbox)application.createComponent(HtmlSelectBooleanCheckbox.COMPONENT_TYPE);
select.setId(viewRoot.createUniqueId());
ValueExpression ve1 = application.getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(),"#{"+entrySupportVar+".vascEntry.vascFrontendData.vascEntryState.multiActionSelection["+tableRecordVar+".recordId]}",Object.class);
select.setValueExpression("value", ve1);
colUp.getChildren().add(select);
table.getChildren().add(colUp);
}
for (VascEntryField c:entry.getVascEntryFields()) {
if (entry.getVascFrontendData().getVascFrontendHelper().renderList(c)==false) {
continue;
@ -340,14 +388,16 @@ public class JSFVascUIComponentRenderer extends Renderer {
table.getChildren().add(col);
}
if (entry.getVascFrontendData().getVascBackend().isRecordMoveable()) {
if (entry.getVascFrontendData().getVascEntryState().getVascBackend().isRecordMoveable()) {
UIColumn colUp = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE);
colUp.setId(viewRoot.createUniqueId());
HtmlCommandLink linkUp = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
linkUp.setId(viewRoot.createUniqueId());
linkUp.setType("up");
//linkUp.addActionListener(new MoveActionListener());
MethodExpression actionExpression = getMethodExpression("#{"+entrySupportVar+".moveAction}");
MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(actionExpression);
linkUp.addActionListener(meActionListener);
HtmlOutputText orderUp = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
orderUp.setId(viewRoot.createUniqueId());
@ -361,7 +411,9 @@ public class JSFVascUIComponentRenderer extends Renderer {
HtmlCommandLink linkDown = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
linkDown.setId(viewRoot.createUniqueId());
linkDown.setType("down");
//linkDown.addActionListener(new MoveActionListener());
MethodExpression actionExpression2 = getMethodExpression("#{"+entrySupportVar+".moveAction}");
MethodExpressionActionListener meActionListener2 = new MethodExpressionActionListener(actionExpression2);
linkDown.addActionListener(meActionListener2);
UIColumn colDown = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE);
colDown.setId(viewRoot.createUniqueId());
@ -374,8 +426,14 @@ public class JSFVascUIComponentRenderer extends Renderer {
colDown.getChildren().add(linkDown);
table.getChildren().add(colDown);
}
String disableLinkColumns = (String)comp.getAttributes().get(JSFVascUIComponent.DISABLE_LINK_COLUMNS);
for (VascLinkEntry vascLink:entry.getVascLinkEntries()) {
if (disableLinkColumns!=null && disableLinkColumns.equals("true")) {
continue; // do not all columns
}
UIColumn col = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE);
col.setId(viewRoot.createUniqueId());
@ -393,7 +451,7 @@ public class JSFVascUIComponentRenderer extends Renderer {
link.addActionListener(meActionListener);
// rm this , bacause of unneeded copy, should add name to link
VascEntry ve = entry.getVascFrontendData().getVascController().getVascEntryControllerResolver().getVascEntryController().getVascEntryById(vascLink.getVascEntryId());
VascEntry ve = entry.getVascFrontendData().getVascController().getVascEntryController().getVascEntryById(vascLink.getVascEntryId());
HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
out.setId(viewRoot.createUniqueId());
@ -424,8 +482,6 @@ public class JSFVascUIComponentRenderer extends Renderer {
HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
link.setId(viewRoot.createUniqueId());
link.setType(action.getId());
//link.setImmediate(true);
MethodExpression actionExpression = getMethodExpression("#{"+entrySupportVar+".rowAction}");
MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(actionExpression);
link.addActionListener(meActionListener);

View file

@ -50,10 +50,7 @@ public class JSFVascUIComponentTag extends UIComponentELTag {
private ValueExpression injectEditFieldsId = null;
private ValueExpression injectTableOptionsId = null;
private ValueExpression injectTableColumnsId = null;
// noty used
private ValueExpression bundleName = null;
private ValueExpression locale = null;
private ValueExpression disableLinkColumns = null;
@Override
public String getComponentType() {
@ -79,6 +76,7 @@ public class JSFVascUIComponentTag extends UIComponentELTag {
processProperty(component, injectEditFieldsId, JSFVascUIComponent.INJECT_EDIT_FIELDS_ID);
processProperty(component, injectTableOptionsId,JSFVascUIComponent.INJECT_TABLE_OPTIONS_ID);
processProperty(component, injectTableColumnsId,JSFVascUIComponent.INJECT_TABLE_COLUMNS_ID);
processProperty(component, disableLinkColumns ,JSFVascUIComponent.DISABLE_LINK_COLUMNS);
}
public void release() {
@ -91,6 +89,7 @@ public class JSFVascUIComponentTag extends UIComponentELTag {
injectEditFieldsId = null;
injectTableOptionsId = null;
injectTableColumnsId = null;
disableLinkColumns = null;
}
protected final void processProperty(final UIComponent component, final ValueExpression property,final String propertyName) {
@ -133,34 +132,6 @@ public class JSFVascUIComponentTag extends UIComponentELTag {
this.entryName = entryName;
}
/**
* @return the bundleName
*/
public ValueExpression getBundleName() {
return bundleName;
}
/**
* @param bundleName the bundleName to set
*/
public void setBundleName(ValueExpression bundleName) {
this.bundleName = bundleName;
}
/**
* @return the locale
*/
public ValueExpression getLocale() {
return locale;
}
/**
* @param locale the locale to set
*/
public void setLocale(ValueExpression locale) {
this.locale = locale;
}
/**
* @return the vascFrontendData
*/
@ -244,4 +215,18 @@ public class JSFVascUIComponentTag extends UIComponentELTag {
public void setTableRecordVar(ValueExpression tableRecordVar) {
this.tableRecordVar = tableRecordVar;
}
/**
* @return the disableLinkColumns
*/
public ValueExpression getDisableLinkColumns() {
return disableLinkColumns;
}
/**
* @param disableLinkColumns the disableLinkColumns to set
*/
public void setDisableLinkColumns(ValueExpression disableLinkColumns) {
this.disableLinkColumns = disableLinkColumns;
}
}

View file

@ -33,13 +33,14 @@ public class JSFVascValidatePhaseListener implements PhaseListener {
return PhaseId.PROCESS_VALIDATIONS;
}
private void validateUIInput(UIComponent component,FacesContext context) {
System.out.println("Validate vasc: "+component);
if (component instanceof UIInput) {
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(component);
if (comp==null) {
return; // non-vasc ui-input
}
VascEntry entry = comp.getVascEntry();
if (entry.getVascFrontendData().getEntryDataObject()==null) {
if (entry.getVascFrontendData().getVascEntryState().getEntryDataObject()==null) {
return; // we are not in edit mode.
}
UIInput in = (UIInput)component;

View file

@ -201,7 +201,7 @@ public class OldVascUIComponent extends UIComponentBase {
vascEntityName = entryNameRealId;
}
VascEntry entry = vascControllerObj.getVascEntryControllerResolver().getVascEntryController().getVascEntryById(vascEntityName);
VascEntry entry = vascControllerObj.getVascEntryController().getVascEntryById(vascEntityName);
if (entry==null) {
throw new NullPointerException("Could not locate '"+vascEntityName+"' from : "+vascControllerObj+" ("+entryName.getExpressionString()+")");
}
@ -212,7 +212,7 @@ public class OldVascUIComponent extends UIComponentBase {
frontendData.setVascController(vascControllerObj);
entry.setVascFrontendData(frontendData);
VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId());
VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendController().getVascBackendById(entry.getBackendId());
for (VascBackendFilter filter:entry.getVascBackendFilters()) {
filter.initFilter(entry);
@ -227,30 +227,33 @@ public class OldVascUIComponent extends UIComponentBase {
if (backend.isPageable()==false) {
backend = new VascBackendProxyPaged(backend,entry);
}
frontendData.setVascBackend(backend);
frontendData.getVascEntryState().setVascBackend(backend);
entry.addVascEntryEventListener(VascEntryEventListener.VascEventType.DATA_LIST_UPDATE, new VascEntryEventListener() {
private static final long serialVersionUID = 1L;
public void vascEvent(VascEntry entry, VascEventType type,Object dataNotUsed) {
List<Object> data = entry.getVascFrontendData().getEntryDataList();
List<Object> data = entry.getVascFrontendData().getVascEntryState().getEntryDataList();
for (VascEntryField field:entry.getVascEntryFields()) {
if (field.getVascEntryFieldValue()==null) {
VascEntryFieldValue v = entry.getVascFrontendData().getVascBackend().provideVascEntryFieldValue(field);
VascEntryFieldValue v = entry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(field);
field.setVascEntryFieldValue(v);
}
}
List<Object> result = new ArrayList<Object>(data.size());
int index = 0;
for (Object o:data) {
VascDataBackendBean b = new VascDataBackendBean(entry,o);
VascDataBackendBean b = new VascDataBackendBean(entry,o,index);
result.add(b);
index++;
}
tableDataModel.setWrappedData(result);
pagesDataModel.setWrappedData(entry.getVascFrontendData().getVascFrontendHelper().getVascBackendPageNumbers(entry));
// ui value
ValueExpression ren3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['totalPageResults']}", Integer.class);
ren3.setValue(FacesContext.getCurrentInstance().getELContext(), getVascEntry().getVascFrontendData().getEntryDataList().size());
ren3.setValue(FacesContext.getCurrentInstance().getELContext(), getVascEntry().getVascFrontendData().getVascEntryState().getEntryDataList().size());
ValueExpression ren4 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['totalResults']}", Integer.class);
ren4.setValue(FacesContext.getCurrentInstance().getELContext(), getVascEntry().getVascFrontendData().getTotalBackendRecords());
ren4.setValue(FacesContext.getCurrentInstance().getELContext(), getVascEntry().getVascFrontendData().getVascEntryState().getTotalBackendRecords());
}
@Override
public VascEntryEventListener clone() throws CloneNotSupportedException {
@ -436,7 +439,7 @@ public class OldVascUIComponent extends UIComponentBase {
Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected);
// set data parameter on new vasc entry
entry.getVascFrontendData().getVascBackendState().setDataParameter(parameterName, selectedValue);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue);
}
for (String fieldId:link.getEntryCreateFieldValueKeys()) {
@ -475,6 +478,7 @@ public class OldVascUIComponent extends UIComponentBase {
}
class CreateEntryFieldValuesListener implements VascEntryEventListener {
private static final long serialVersionUID = 1L;
private String fieldId = null;
private Object value = null;
public CreateEntryFieldValuesListener(String fieldId,Object value) {
@ -579,7 +583,7 @@ public class OldVascUIComponent extends UIComponentBase {
return; // non-vasc ui-input
}
VascEntry entry = comp.getVascEntry();
if (entry.getVascFrontendData().getEntryDataObject()==null) {
if (entry.getVascFrontendData().getVascEntryState().getEntryDataObject()==null) {
return; // we are not in edit mode.
}
UIInput in = (UIInput)component;
@ -1013,7 +1017,7 @@ public class OldVascUIComponent extends UIComponentBase {
public void processAction(ActionEvent event) {
OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent());
VascEntry entry = comp.getVascEntry();
entry.getVascFrontendData().setEntryDataObject(null);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.selected}", Object.class);
VascDataBackendBean editObject = (VascDataBackendBean) ve2.getValue(FacesContext.getCurrentInstance().getELContext());
if (editObject!=null) {
@ -1049,7 +1053,7 @@ public class OldVascUIComponent extends UIComponentBase {
ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.selected}", Object.class);
VascDataBackendBean editObject = (VascDataBackendBean) ve2.getValue(FacesContext.getCurrentInstance().getELContext());
entry.getVascFrontendData().setEntryDataObject(editObject.getRecord());
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(editObject.getRecord());
entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry);
try {
@ -1086,7 +1090,7 @@ public class OldVascUIComponent extends UIComponentBase {
ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortOrder']}", Boolean.class);
ValueExpression ren3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortField']}", String.class);
ren2.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getVascFrontendData().getVascBackendState().isSortAscending());
ren2.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getVascFrontendData().getVascEntryState().getVascBackendState().isSortAscending());
ren3.setValue(FacesContext.getCurrentInstance().getELContext(), field.getId());
try {
@ -1303,7 +1307,7 @@ public class OldVascUIComponent extends UIComponentBase {
gotoGroup.setId(viewRoot.createUniqueId());
gridHeader.getChildren().add(gotoGroup);
VascBackend backend = entry.getVascFrontendData().getVascBackend();
VascBackend backend = entry.getVascFrontendData().getVascEntryState().getVascBackend();
// create pageing
if (backend.isPageable()) {
@ -1469,7 +1473,7 @@ public class OldVascUIComponent extends UIComponentBase {
table.getChildren().add(col);
}
if (entry.getVascFrontendData().getVascBackend().isRecordMoveable()) {
if (entry.getVascFrontendData().getVascEntryState().getVascBackend().isRecordMoveable()) {
UIColumn colUp = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE);
colUp.setId(viewRoot.createUniqueId());
@ -1519,7 +1523,7 @@ public class OldVascUIComponent extends UIComponentBase {
link.addActionListener(new VascLinkActionListener(vascLink.getId()));
// rm this , bacause of unneeded copy, should add name to link
VascEntry ve = entry.getVascFrontendData().getVascController().getVascEntryControllerResolver().getVascEntryController().getVascEntryById(vascLink.getVascEntryId());
VascEntry ve = entry.getVascFrontendData().getVascController().getVascEntryController().getVascEntryById(vascLink.getVascEntryId());
HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
out.setId(viewRoot.createUniqueId());
@ -1626,8 +1630,9 @@ class JSFFrontendRenderer extends AbstractVascFrontend implements Serializable {
entry.getVascFrontendData().getVascFrontendHelper().editReadOnlyUIComponents(entry);
VascDataBackendBean selBean = null;
if (entry.getVascFrontendData().isEditCreate()) {
selBean = new VascDataBackendBean(entry,entry.getVascFrontendData().getEntryDataObject());
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
int index = entry.getVascFrontendData().getVascEntryState().getEntryDataList().size()+1;
selBean = new VascDataBackendBean(entry,entry.getVascFrontendData().getVascEntryState().getEntryDataObject(),index);
} else {
selBean = comp.getSelectedTableBean();
}

View file

@ -46,10 +46,12 @@ public class VascDataBackendBean implements Serializable {
private VascEntry entry = null;
private Object record = null;
private boolean realValue = false;
private int recordId = 0;
public VascDataBackendBean(VascEntry entry,Object record) {
public VascDataBackendBean(VascEntry entry,Object record,int recordId) {
this.entry=entry;
this.record=record;
this.recordId=recordId;
}
public boolean isRealValue() {
@ -104,6 +106,10 @@ public class VascDataBackendBean implements Serializable {
return record;
}
public int getRecordId() {
return recordId;
}
// GET/SET bean methods for using in EL

View file

@ -28,7 +28,6 @@ package com.idcanet.vasc.frontends.web.jsf.ui;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.el.ValueExpression;
@ -73,10 +72,25 @@ public class JSFList extends AbstractJSFBaseComponent {
String id = component.getId();
ValueExpression itemsTestVE = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".editSelectItemModels['jsfListItems_"+id+"']}", TestModel.class);
//ValueExpression itemsDisVE = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['jsfListItemDis_"+id+"']}", Boolean.class);
//itemsDisVE.setValue(FacesContext.getCurrentInstance().getELContext(), false);
TestModel t = new TestModel();
List<VascSelectItem> items;
List<SelectItem> value = new ArrayList<SelectItem>(50);
VascSelectItemModel itemModel = (VascSelectItemModel)entryField.getVascEntryFieldType().getDataObject();
try {
items = itemModel.getVascSelectItems(entryField.getVascEntry());
} catch (VascException e) {
throw new VascException(e);
}
for (VascSelectItem v:items) {
SelectItem si = new SelectItem();
si.setLabel(v.getLabel());
si.setValue(v.getValue());
si.setDisabled(v.isDisabled());
value.add(si);
}
TestModel t = new TestModel(items);
t.addAll(value);
t.entryField=entryField;
itemsTestVE.setValue(FacesContext.getCurrentInstance().getELContext(), t);
@ -114,48 +128,8 @@ class TestModel extends ArrayList<SelectItem> implements Serializable {
public VascEntryField entryField;
private List<VascSelectItem> items;
@Override
public int size() {
if (super.isEmpty()) {
getItems();
}
return super.size();
}
@Override
public Iterator<SelectItem> iterator() {
if (super.isEmpty()) {
getItems();
}
return super.iterator();
}
@Override
public boolean isEmpty() {
if (super.isEmpty()) {
getItems();
}
return super.isEmpty();
}
public List<SelectItem> getItems() {
List<SelectItem> value = new ArrayList<SelectItem>(50);
VascSelectItemModel itemModel = (VascSelectItemModel)entryField.getVascEntryFieldType().getDataObject();
try {
items = itemModel.getVascSelectItems(entryField.getVascEntry());
} catch (VascException e) {
e.printStackTrace();
return value;
}
for (VascSelectItem v:items) {
SelectItem si = new SelectItem();
si.setLabel(v.getLabel());
si.setValue(v.getValue());
si.setDisabled(v.isDisabled());
this.add(si);
}
return value;
public TestModel(List<VascSelectItem> items) {
this.items=items;
}
public List<VascSelectItem> getVascItems() {

View file

@ -78,7 +78,7 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
}
// Check if backendId is valid
VascBackend back = vascController.getVascBackendControllerResolver().getVascBackendController().getVascBackendById( entry.getBackendId() );
VascBackend back = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
if (back==null) {
throw new IllegalArgumentException("The VascEntry backendId is not found in backends: '"+entry.getBackendId()+"' in entryId: "+id);
}
@ -233,15 +233,15 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
}
if (vef.getVascEntryFieldValue()==null) {
VascBackend back2 = vascController.getVascBackendControllerResolver().getVascBackendController().getVascBackendById( entry.getBackendId() );
VascBackend back2 = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
vef.setVascEntryFieldValue(back2.provideVascEntryFieldValue(vef));
}
if (vef.getVascEntryFieldType()==null) {
Object defValue = vef.getDefaultValue();
if (defValue != null) {
for (String typeId: vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
VascEntryFieldType type = vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById(typeId);
for (String typeId: vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
VascEntryFieldType type = vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById(typeId);
if (type.getAutoDetectClass()!=null) {
if (type.getAutoDetectClass().isAssignableFrom(defValue.getClass())) {
@ -252,7 +252,7 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
}
}
if (vef.getVascEntryFieldType()==null) {
vef.setVascEntryFieldType(vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField"));
vef.setVascEntryFieldType(vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField"));
}
//vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
}
@ -260,13 +260,15 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
//for (VascValidator vv:vef.getVascValidators()) {
//}
}
Collections.sort(entry.getVascEntryFields(),new Comparator() {
public int compare(Object o1, Object o2) {
VascEntryField v1 = (VascEntryField)o1;
VascEntryField v2 = (VascEntryField)o2;
class OrderIndexComparator implements Comparator<VascEntryField> {
public int compare(VascEntryField v1, VascEntryField v2) {
return v1.getOrderIndex().compareTo(v2.getOrderIndex());
}
});
}
Collections.sort(entry.getVascEntryFields(),new OrderIndexComparator());
// place primary key in front
int index = 0;

View file

@ -1,51 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.VascBackendController;
import com.idcanet.vasc.core.VascBackendControllerResolver;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 18, 2008
*/
public class DefaultVascBackendControllerResolver implements VascBackendControllerResolver {
private VascBackendController vascBackendController = null;
/**
* @see com.idcanet.vasc.core.VascBackendControllerResolver#getVascBackendController()
*/
public VascBackendController getVascBackendController() {
return vascBackendController;
}
public void setVascBackendController(VascBackendController vascBackendController) {
this.vascBackendController=vascBackendController;
}
}

View file

@ -26,12 +26,12 @@
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.VascBackendControllerResolver;
import com.idcanet.vasc.core.VascBackendController;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntryControllerResolver;
import com.idcanet.vasc.core.VascEntryFieldTypeControllerResolver;
import com.idcanet.vasc.core.VascEventChannelControllerResolver;
import com.idcanet.vasc.core.VascUserRoleControllerResolver;
import com.idcanet.vasc.core.VascEntryController;
import com.idcanet.vasc.core.VascEntryFieldTypeController;
import com.idcanet.vasc.core.VascEventChannelController;
import com.idcanet.vasc.core.VascUserRoleController;
/**
*
@ -41,79 +41,79 @@ import com.idcanet.vasc.core.VascUserRoleControllerResolver;
*/
public class DefaultVascController implements VascController {
private VascBackendControllerResolver vascBackendControllerResolver = null;
private VascEntryControllerResolver vascEntryControllerResolver = null;
private VascEntryFieldTypeControllerResolver vascEntryFieldTypeControllerResolver = null;
private VascEventChannelControllerResolver vascEventChannelControllerResolver = null;
private VascUserRoleControllerResolver vascUserRoleControllerResolver = null;
private VascBackendController vascBackendController = null;
private VascEntryController vascEntryController = null;
private VascEntryFieldTypeController vascEntryFieldTypeController = null;
private VascEventChannelController vascEventChannelController = null;
private VascUserRoleController vascUserRoleController = null;
/**
* @return the vascEventChannelControllerResolver
* @return the vascEventChannelController
*/
public VascEventChannelControllerResolver getVascEventChannelControllerResolver() {
return vascEventChannelControllerResolver;
public VascEventChannelController getVascEventChannelController() {
return vascEventChannelController;
}
/**
* @param vascEventChannelControllerResolver the vascEventChannelControllerResolver to set
* @param vascEventChannelController the vascEventChannelController to set
*/
public void setVascEventChannelControllerResolver(VascEventChannelControllerResolver vascEventChannelControllerResolver) {
this.vascEventChannelControllerResolver = vascEventChannelControllerResolver;
public void setVascEventChannelController(VascEventChannelController vascEventChannelController) {
this.vascEventChannelController = vascEventChannelController;
}
/**
* @return the vascBackendControllerResolver
* @return the vascBackendController
*/
public VascBackendControllerResolver getVascBackendControllerResolver() {
return vascBackendControllerResolver;
public VascBackendController getVascBackendController() {
return vascBackendController;
}
/**
* @param vascBackendControllerResolver the vascBackendControllerResolver to set
* @param vascBackendController the vascBackendController to set
*/
public void setVascBackendControllerResolver(VascBackendControllerResolver vascBackendControllerResolver) {
this.vascBackendControllerResolver = vascBackendControllerResolver;
public void setVascBackendController(VascBackendController vascBackendController) {
this.vascBackendController = vascBackendController;
}
/**
* @return the vascEntryControllerResolver
* @return the vascEntryController
*/
public VascEntryControllerResolver getVascEntryControllerResolver() {
return vascEntryControllerResolver;
public VascEntryController getVascEntryController() {
return vascEntryController;
}
/**
* @param vascEntryControllerResolver the vascEntryControllerResolver to set
* @param vascEntryController the vascEntryController to set
*/
public void setVascEntryControllerResolver(VascEntryControllerResolver vascEntryControllerResolver) {
this.vascEntryControllerResolver = vascEntryControllerResolver;
public void setVascEntryController(VascEntryController vascEntryController) {
this.vascEntryController = vascEntryController;
}
/**
* @return the vascEntryFieldControllerResolver
* @return the vascEntryFieldController
*/
public VascEntryFieldTypeControllerResolver getVascEntryFieldTypeControllerResolver() {
return vascEntryFieldTypeControllerResolver;
public VascEntryFieldTypeController getVascEntryFieldTypeController() {
return vascEntryFieldTypeController;
}
/**
* @param vascEntryFieldControllerResolver the vascEntryFieldControllerResolver to set
* @param vascEntryFieldController the vascEntryFieldController to set
*/
public void setVascEntryFieldTypeControllerResolver(VascEntryFieldTypeControllerResolver vascEntryFieldTypeControllerResolver) {
this.vascEntryFieldTypeControllerResolver = vascEntryFieldTypeControllerResolver;
public void setVascEntryFieldTypeController(VascEntryFieldTypeController vascEntryFieldTypeController) {
this.vascEntryFieldTypeController = vascEntryFieldTypeController;
}
/**
* @return the vascUserRoleControllerResolver
* @return the vascUserRoleController
*/
public VascUserRoleControllerResolver getVascUserRoleControllerResolver() {
return vascUserRoleControllerResolver;
public VascUserRoleController getVascUserRoleController() {
return vascUserRoleController;
}
/**
* @param vascUserRoleControllerResolver the vascUserRoleControllerResolver to set
* @param vascUserRoleController the vascUserRoleController to set
*/
public void setVascUserRoleControllerResolver(VascUserRoleControllerResolver vascUserRoleControllerResolver) {
this.vascUserRoleControllerResolver = vascUserRoleControllerResolver;
public void setVascUserRoleController(VascUserRoleController vascUserRoleController) {
this.vascUserRoleController = vascUserRoleController;
}
}

View file

@ -52,6 +52,7 @@ import com.idcanet.vasc.core.entry.VascEntryFieldEventChannel;
*/
public class DefaultVascEntry implements VascEntry {
private static final long serialVersionUID = 1L;
private String id = null;
private String name = null;
private String helpId = null;

View file

@ -1,52 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.VascEntryController;
import com.idcanet.vasc.core.VascEntryControllerResolver;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 18, 2008
*/
public class DefaultVascEntryControllerResolver implements VascEntryControllerResolver {
private VascEntryController vascEntryController = null;
/**
* @see com.idcanet.vasc.core.VascEntryControllerResolver#getVascEntryController()
*/
public VascEntryController getVascEntryController() {
return vascEntryController;
}
public void setVascEntryController(VascEntryController vascEntryController) {
this.vascEntryController=vascEntryController;
}
}

View file

@ -42,7 +42,9 @@ import com.idcanet.vasc.validators.VascValidator;
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascEntryField implements VascEntryField {
private static final long serialVersionUID = 1L;
private VascEntry vascEntry = null;
private String id = null;

View file

@ -0,0 +1,16 @@
/**
*
*/
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.AbstractVascEntryState;
/**
* Holds all state values
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
public class DefaultVascEntryState extends AbstractVascEntryState {
private static final long serialVersionUID = 1L;
}

View file

@ -1,55 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.VascEventChannelController;
import com.idcanet.vasc.core.VascEventChannelControllerResolver;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public class DefaultVascEventChannelControllerResolver implements VascEventChannelControllerResolver {
private VascEventChannelController vascEventChannelController = null;
/**
* @return the vascEventChannelController
*/
public VascEventChannelController getVascEventChannelController() {
return vascEventChannelController;
}
/**
* @param vascEventChannelController the vascEventChannelController to set
*/
public void setVascEventChannelController(
VascEventChannelController vascEventChannelController) {
this.vascEventChannelController = vascEventChannelController;
}
}

View file

@ -0,0 +1,123 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.Locale;
import java.util.ResourceBundle;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendFilter;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.core.entry.VascEntryEventListener;
import com.idcanet.vasc.impl.entry.DefaultVascEntryResourceResolver;
import com.idcanet.vasc.impl.entry.VascValidatorsValidatorService;
import com.idcanet.vasc.impl.type.DefaultVascEntryFieldTypeController;
/**
* Default Vasc Factory for creating some base object plumming for vasc useage.
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
public class DefaultVascFactory {
static public VascController getDefaultVascController(Long userId,String userName,String...roles) throws VascException {
// config full controller for local jvm use
DefaultVascController c = new DefaultVascController();
DefaultVascBackendController vascBackendController = new DefaultVascBackendController();
c.setVascBackendController(vascBackendController);
DefaultVascEntryController vascEntryController = new DefaultVascEntryController();
c.setVascEntryController(vascEntryController);
DefaultVascEntryFieldTypeController vascEntryFieldTypeController = new DefaultVascEntryFieldTypeController();
c.setVascEntryFieldTypeController(vascEntryFieldTypeController);
DefaultVascUserRoleController vascUserRoleController = new DefaultVascUserRoleController(userId,userName,roles);
c.setVascUserRoleController(vascUserRoleController);
return c;
}
static public VascFrontendData getDefaultVascFrontendData(String resourceBundle,Locale locale) {
ResourceBundle bundle = ResourceBundle.getBundle(resourceBundle, locale);
return getDefaultVascFrontendData(bundle);
}
static public VascFrontendData getDefaultVascFrontendData(ResourceBundle resourceBundle) {
DefaultVascFrontendData vascFrontendData = new DefaultVascFrontendData(); // controller is set by vasc
vascFrontendData.setVascEntryResourceResolver(new DefaultVascEntryResourceResolver(resourceBundle));
vascFrontendData.setVascFrontendHelper(new DefaultVascFrontendHelper());
//vascFrontendData.setVascEntryResourceImageResolver(new ImageResources());
vascFrontendData.setVascEntryState(new DefaultVascEntryState());
vascFrontendData.getVascEntryState().setVascBackendState(new DefaultVascBackendState());
vascFrontendData.getVascEntryState().getVascBackendState().setPageSize(100); // default page size is zero aka disabled
vascFrontendData.setExceptionListener(new VascEntryEventListener() {
private static final long serialVersionUID = 1L;
public void vascEvent(VascEntry entry, VascEventType type,Object data) {
throw new RuntimeException(((Exception)data)); // throw to top.
}
public VascEntryEventListener clone() throws CloneNotSupportedException {
return this;
}
});
vascFrontendData.addVascValidatorService(new VascValidatorsValidatorService()); // normal vasc validators
return vascFrontendData;
}
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);
// 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 backend;
}
}

View file

@ -31,11 +31,10 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryFinalizer;
import com.idcanet.vasc.core.VascEntryState;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascFrontend;
import com.idcanet.vasc.core.VascFrontendData;
@ -46,7 +45,6 @@ import com.idcanet.vasc.core.entry.VascEntryResourceImageResolver;
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
import com.idcanet.vasc.core.ui.VascUIComponent;
/**
*
* @author Willem Cazander
@ -54,11 +52,7 @@ import com.idcanet.vasc.core.ui.VascUIComponent;
*/
public class DefaultVascFrontendData implements VascFrontendData {
private List<Object> entryDataList = null;
private Object entryDataObject = null;
private VascFrontend vascFrontend = null;
private VascBackend vascBackend = null;
private VascBackendState vascBackendState = null;
private VascEntryFinalizer vascEntryFinalizer = null;
private VascFrontendHelper vascFrontendHelper = null;
private VascEntryResourceResolver vascEntryResourceResolver = null;
@ -66,50 +60,20 @@ public class DefaultVascFrontendData implements VascFrontendData {
private Map<String,String> uiComponents = null;
private VascController vascController = null;
private VascEntryEventListener exceptionListener = null;
private boolean isEditCreate = false;
private Long totalBackendRecords = null;
private VascEntryState state = null;
private Map<VascEntryField,VascUIComponent> fieldComps = null;
private Map<VascEntryField,Object> fieldEditors = null;
private List<VascEntryFieldValidatorService> validatorServices = null;
public DefaultVascFrontendData() {
entryDataList = new ArrayList<Object>(0);
uiComponents = new HashMap<String,String>(8);
fieldComps = new HashMap<VascEntryField,VascUIComponent>(8);
fieldEditors = new HashMap<VascEntryField,Object>(8);
validatorServices = new ArrayList<VascEntryFieldValidatorService>(4);
}
/**
* @return the entryDataList
*/
public List<Object> getEntryDataList() {
return entryDataList;
}
/**
* @param entryDataList the entryDataList to set
*/
public void setEntryDataList(List<Object> entryDataList) {
this.entryDataList = entryDataList;
}
/**
* @return the entryDataObject
*/
public Object getEntryDataObject() {
return entryDataObject;
}
/**
* @param entryDataObject the entryDataObject to set
*/
public void setEntryDataObject(Object entryDataObject) {
this.entryDataObject = entryDataObject;
}
/**
* @return the vascFrontend
*/
@ -244,20 +208,6 @@ public class DefaultVascFrontendData implements VascFrontendData {
return fieldComps.get(field);
}
/**
* @return the vascBackend
*/
public VascBackend getVascBackend() {
return vascBackend;
}
/**
* @param vascBackend the vascBackend to set
*/
public void setVascBackend(VascBackend vascBackend) {
this.vascBackend = vascBackend;
}
/**
* @return the exceptionListener
*/
@ -299,46 +249,12 @@ public class DefaultVascFrontendData implements VascFrontendData {
public List<VascEntryFieldValidatorService> getVascValidatorServices() {
return validatorServices;
}
/**
* @return the isEditCreate
*/
public boolean isEditCreate() {
return isEditCreate;
public VascEntryState getVascEntryState() {
return state;
}
/**
* @param isEditCreate the isEditCreate to set
*/
public void setEditCreate(boolean isEditCreate) {
this.isEditCreate = isEditCreate;
}
/**
* @return the vascBackendState
*/
public VascBackendState getVascBackendState() {
return vascBackendState;
}
/**
* @param vascBackendState the vascBackendState to set
*/
public void setVascBackendState(VascBackendState vascBackendState) {
this.vascBackendState = vascBackendState;
}
/**
* @return the totalBackendRecords
*/
public Long getTotalBackendRecords() {
return totalBackendRecords;
}
/**
* @param totalBackendRecords the totalBackendRecords to set
*/
public void setTotalBackendRecords(Long totalBackendRecords) {
this.totalBackendRecords = totalBackendRecords;
public void setVascEntryState(VascEntryState state) {
this.state=state;
}
}

View file

@ -72,7 +72,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
if (renderView(field)==false) {
return false;
}
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleControllerResolver().getVascUserRoleController();
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
if (field.getRolesCreate()!=null && u.hasRole(field.getRolesCreate())) {
return true;
}
@ -89,12 +89,12 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
if (renderView(field)==false) {
return false;
}
if (field.getVascEntry().getVascFrontendData().isEditCreate()) {
if (field.getVascEntry().getVascFrontendData().getVascEntryState().isEditCreate()) {
if (renderCreate(field)==false) {
return false;
}
}
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleControllerResolver().getVascUserRoleController();
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
if (field.getRolesEdit()!=null && u.hasRole(field.getRolesEdit())) {
return true;
}
@ -111,7 +111,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
if (renderView(field)==false) {
return false;
}
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleControllerResolver().getVascUserRoleController();
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
if (field.getRolesEditReadOnly()!=null && u.hasRole(field.getRolesEditReadOnly())) {
return true;
}
@ -128,7 +128,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
if (renderView(field)==false) {
return false;
}
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleControllerResolver().getVascUserRoleController();
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
if (field.getRolesList()!=null && u.hasRole(field.getRolesList())) {
return true;
}
@ -183,11 +183,11 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
*/
public List<VascBackendPageNumber> getVascBackendPageNumbers(VascEntry entry) {
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(30);
VascBackendState state = entry.getVascFrontendData().getVascBackendState();
VascBackendState state = entry.getVascFrontendData().getVascEntryState().getVascBackendState();
if (state.getPageSize()==0) {
return result; // paging disabled
}
Long total = entry.getVascFrontendData().getTotalBackendRecords();
Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
if (total==null) {
return result; // no pages
}
@ -209,12 +209,9 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
VascEntryEventListener listener = entry.getVascFrontendData().getExceptionListener();
if (listener==null) {
logger.log(Level.WARNING,exception.getMessage(),exception);
throw new RuntimeException("Exception happend: "+exception.getMessage(),exception);
}
try {
listener.vascEvent(entry,VascEventType.EXCEPTION , exception);
} catch (Exception eee) {
logger.log(Level.WARNING,"Error in ExceptionListener: "+eee.getMessage(),eee);
}
listener.vascEvent(entry,VascEventType.EXCEPTION , exception);
}
/**
@ -222,7 +219,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
*/
public Object createObject(VascEntry entry) {
try {
Object object = entry.getVascFrontendData().getVascBackend().provideVascEntryRecordCreator(entry.clone()).newRecord(entry);
Object object = entry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryRecordCreator(entry.clone()).newRecord(entry);
for (VascEntryField field:entry.getVascEntryFields()) {
Object value = field.getVascEntryFieldValue().getValue(field, object);
if (value==null & field.getDefaultValue()!=null) {
@ -247,8 +244,8 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
}
protected int removeObjectFromDataList(VascEntry entry,Object object) {
int indexOld = entry.getVascFrontendData().getEntryDataList().indexOf(object);
if (entry.getVascFrontendData().getEntryDataList().remove(object)) {
int indexOld = entry.getVascFrontendData().getVascEntryState().getEntryDataList().indexOf(object);
if (entry.getVascFrontendData().getVascEntryState().getEntryDataList().remove(object)) {
return indexOld; // java worked well for use
}
@ -261,7 +258,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
// is only null when creating objects
if (idObject!=null) {
int index = 0;
for (Object o:entry.getVascFrontendData().getEntryDataList()) {
for (Object o:entry.getVascFrontendData().getVascEntryState().getEntryDataList()) {
field = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
Object id = field.getVascEntryFieldValue().getValue(field, o);
if (idObject.equals(id)) {
@ -269,8 +266,8 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
}
index++;
}
if (index<entry.getVascFrontendData().getEntryDataList().size()) {
entry.getVascFrontendData().getEntryDataList().remove(index);
if (index<entry.getVascFrontendData().getVascEntryState().getEntryDataList().size()) {
entry.getVascFrontendData().getVascEntryState().getEntryDataList().remove(index);
return index;
}
}
@ -284,14 +281,14 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
* @see com.idcanet.vasc.core.VascFrontendHelper#mergeObject(com.idcanet.vasc.core.VascEntry)
*/
public Object mergeObject(VascEntry entry) {
Object object = entry.getVascFrontendData().getEntryDataObject();
Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
Object result = null;
try {
fireVascEvent(entry,VascEventType.DATA_PRE_UPDATE,object);
int index = removeObjectFromDataList(entry,object);
result = entry.getVascFrontendData().getVascBackend().merge(object);
entry.getVascFrontendData().getEntryDataList().add(index, result);
entry.getVascFrontendData().setEntryDataObject(null);
result = entry.getVascFrontendData().getVascEntryState().getVascBackend().merge(object);
entry.getVascFrontendData().getVascEntryState().getEntryDataList().add(index, result);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
fireVascEvent(entry,VascEventType.DATA_POST_UPDATE,result);
fireVascEvent(entry,VascEventType.DATA_LIST_UPDATE,result);
} catch (Exception e) {
@ -306,14 +303,14 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
* @param object
*/
public void deleteObject(VascEntry entry) {
Object object = entry.getVascFrontendData().getEntryDataObject();
Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
try {
entry.getVascFrontendData().getVascBackend().delete(object);
entry.getVascFrontendData().getVascEntryState().getVascBackend().delete(object);
} catch (Exception e) {
handleException(entry,e);
}
removeObjectFromDataList(entry,object);
entry.getVascFrontendData().setEntryDataObject(null);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
fireVascEvent(entry,VascEventType.DATA_DELETE, object);
fireVascEvent(entry,VascEventType.DATA_LIST_UPDATE, object);
}
@ -322,17 +319,17 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
* @see com.idcanet.vasc.core.VascFrontendHelper#refreshData(com.idcanet.vasc.core.VascEntry)
*/
public void refreshData(VascEntry entry) {
entry.getVascFrontendData().setEntryDataObject(null);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
try {
for (String key:entry.getEntryParameterKeys()) {
Object value = entry.getEntryParameter(key);
entry.getVascFrontendData().getVascBackendState().setDataParameter(key, value);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setDataParameter(key, value);
}
entry.getVascFrontendData().setEntryDataList(entry.getVascFrontendData().getVascBackend().execute(entry.getVascFrontendData().getVascBackendState()));
entry.getVascFrontendData().getVascEntryState().setEntryDataList(entry.getVascFrontendData().getVascEntryState().getVascBackend().execute(entry.getVascFrontendData().getVascEntryState().getVascBackendState()));
// also update total every time
Long total = entry.getVascFrontendData().getVascBackend().fetchTotalExecuteSize(entry.getVascFrontendData().getVascBackendState());
entry.getVascFrontendData().setTotalBackendRecords(total);
Long total = entry.getVascFrontendData().getVascEntryState().getVascBackend().fetchTotalExecuteSize(entry.getVascFrontendData().getVascEntryState().getVascBackendState());
entry.getVascFrontendData().getVascEntryState().setTotalBackendRecords(total);
} catch (Exception e) {
handleException(entry, e);
}
@ -352,12 +349,12 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
throw new NullPointerException("Can't validate null field.");
}
VascEntry entry = field.getVascEntry();
if (entry.getVascFrontendData().getEntryDataObject()==null) {
if (entry.getVascFrontendData().getVascEntryState().getEntryDataObject()==null) {
throw new NullPointerException("Can't validate null entry object.");
}
List<String> error = new ArrayList<String>(3);
try {
Object objectSelected = entry.getVascFrontendData().getEntryDataObject();
Object objectSelected = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
Object objectValue = field.getVascEntryFieldValue().getValue(field, objectSelected);
for (VascEntryFieldValidatorService s:entry.getVascFrontendData().getVascValidatorServices()) {
error.addAll(s.validateObjectField(field, objectSelected, objectValue));
@ -407,7 +404,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
// TODO: move back to rendered when jsf fixes
if (entry.getVascFrontendData().getVascFrontendHelper().renderCreate(f) == false &
entry.getVascFrontendData().isEditCreate()) {
entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
//entry.getVascFrontendData().getFieldVascUIComponent(f).setRendered(false);
entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(true);
} else {
@ -417,10 +414,10 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
// only when editing set edit readonlys
if (entry.getVascFrontendData().getVascFrontendHelper().renderEditReadOnly(f) &
entry.getVascFrontendData().isEditCreate()==false) {
entry.getVascFrontendData().getVascEntryState().isEditCreate()==false) {
entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(true);
} else {
if (entry.getVascFrontendData().isEditCreate()==false) { // todo: remove when jsf fixes
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()==false) { // todo: remove when jsf fixes
entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(false);
}
}
@ -428,22 +425,22 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
}
public void sortAction(VascEntry entry,VascEntryField field) {
String curSort = entry.getVascFrontendData().getVascBackendState().getSortField();
String curSort = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getSortField();
if (field.getBackendName().equals(curSort)) {
entry.getVascFrontendData().getVascBackendState().setSortAscending(!entry.getVascFrontendData().getVascBackendState().isSortAscending());
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortAscending(!entry.getVascFrontendData().getVascEntryState().getVascBackendState().isSortAscending());
}
String sortID = field.getBackendName();
entry.getVascFrontendData().getVascBackendState().setSortField(sortID);
entry.getVascFrontendData().getVascBackendState().setPageIndex(0);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortField(sortID);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(0);
fireVascEvent(entry,VascEntryEventListener.VascEventType.DATA_SORT, field);
refreshData(entry);
}
public void searchAction(VascEntry entry,String searchString) {
entry.getVascFrontendData().getVascBackendState().setSearchString(searchString);
entry.getVascFrontendData().getVascBackendState().setSortField(null);
entry.getVascFrontendData().getVascBackendState().setPageIndex(0);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSearchString(searchString);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortField(null);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(0);
fireVascEvent(entry,VascEntryEventListener.VascEventType.DATA_SEARCH, searchString);
refreshData(entry);
@ -453,12 +450,12 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
if (pageIndex<1) {
pageIndex = 0;
}
Long total = entry.getVascFrontendData().getTotalBackendRecords(); // note: total is only null when pageAction is done before first refresh, which should never happen anyway.
if (total!=null && pageIndex>(total/entry.getVascFrontendData().getVascBackendState().getPageSize())) {
pageIndex = new Long(total/entry.getVascFrontendData().getVascBackendState().getPageSize()).intValue();
Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords(); // note: total is only null when pageAction is done before first refresh, which should never happen anyway.
if (total!=null && pageIndex>(total/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize())) {
pageIndex = new Long(total/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize()).intValue();
}
entry.getVascFrontendData().getVascBackendState().setPageIndex(pageIndex);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(pageIndex);
fireVascEvent(entry,VascEntryEventListener.VascEventType.DATA_PAGE, pageIndex);
// lets load data;
@ -466,14 +463,14 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
}
public void moveAction(VascEntry entry,Object record,boolean moveUp) {
if (entry.getVascFrontendData().getVascBackend().isRecordMoveable()) {
if (entry.getVascFrontendData().getVascEntryState().getVascBackend().isRecordMoveable()) {
try {
VascEntryField p = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
Object primaryId = p.getVascEntryFieldValue().getValue(p, record);
if (moveUp) {
entry.getVascFrontendData().getVascBackend().doRecordMoveUpById(entry.getVascFrontendData().getVascBackendState(),primaryId);
entry.getVascFrontendData().getVascEntryState().getVascBackend().doRecordMoveUpById(entry.getVascFrontendData().getVascEntryState().getVascBackendState(),primaryId);
} else {
entry.getVascFrontendData().getVascBackend().doRecordMoveDownById(entry.getVascFrontendData().getVascBackendState(),primaryId);
entry.getVascFrontendData().getVascEntryState().getVascBackend().doRecordMoveDownById(entry.getVascFrontendData().getVascEntryState().getVascBackendState(),primaryId);
}
} catch (Exception e) {
handleException(entry, e);
@ -483,4 +480,14 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
refreshData(entry);
}
}
public List<RowVascAction> getMultiRowActions(VascEntry entry) {
List<RowVascAction> result = new ArrayList<RowVascAction>(5);
for (RowVascAction a:entry.getRowActions()) {
if (a.isMultiRowAction()) {
result.add(a);
}
}
return result;
}
}

View file

@ -42,6 +42,7 @@ import com.idcanet.vasc.core.VascLinkEntry;
*/
public class DefaultVascLinkEntry implements VascLinkEntry {
private static final long serialVersionUID = 1L;
private String id = null;
private String vascEntryId = null;
private Map<String,String> entryParameterFieldIds = new HashMap<String,String>(3);

View file

@ -60,7 +60,7 @@ public class DefaultVascSelectItemModel implements VascSelectItemModel {
*/
public List<VascSelectItem> getVascSelectItems(VascEntry entry) throws VascException {
List<VascSelectItem> result = new ArrayList<VascSelectItem>(100);
VascEntry ve = entry.getVascFrontendData().getVascController().getVascEntryControllerResolver().getVascEntryController().getVascEntryById(entryId);
VascEntry ve = entry.getVascFrontendData().getVascController().getVascEntryController().getVascEntryById(entryId);
if (keyFieldId==null) {
keyFieldId = ve.getPrimaryKeyFieldId();
@ -78,7 +78,9 @@ public class DefaultVascSelectItemModel implements VascSelectItemModel {
throw new VascException("Could not find: "+displayFieldId+" from: "+ve.getId());
}
VascBackend back = entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(ve.getBackendId());
// set frontend data for new clone, we need te get better lifecycle management for stats/entry/etc
ve.setVascFrontendData(entry.getVascFrontendData());
VascBackend back = DefaultVascFactory.getProxyVascBackend(ve);
try {
if (nullLabel!=null) {
if (nullKeyValue==null) {
@ -102,7 +104,7 @@ public class DefaultVascSelectItemModel implements VascSelectItemModel {
VascEntryField fieldClone = key.clone();
fieldClone.getVascValidators().clear();
VascEntryFieldValue v = entry.getVascFrontendData().getVascBackend().provideVascEntryFieldValue(fieldClone);
VascEntryFieldValue v = entry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(fieldClone);
key.setVascEntryFieldValue(v);
}
if (dis.getVascEntryFieldValue()==null) {
@ -110,7 +112,7 @@ public class DefaultVascSelectItemModel implements VascSelectItemModel {
VascEntryField fieldClone = dis.clone();
fieldClone.getVascValidators().clear();
VascEntryFieldValue v = entry.getVascFrontendData().getVascBackend().provideVascEntryFieldValue(fieldClone);
VascEntryFieldValue v = entry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(fieldClone);
dis.setVascEntryFieldValue(v);
}

View file

@ -1,54 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.VascUserRoleController;
import com.idcanet.vasc.core.VascUserRoleControllerResolver;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public class DefaultVascUserRoleControllerResolver implements VascUserRoleControllerResolver {
private VascUserRoleController vascUserRoleController = null;
/**
* @return the vascUserRoleController
*/
public VascUserRoleController getVascUserRoleController() {
return vascUserRoleController;
}
/**
* @param vascUserRoleController the vascUserRoleController to set
*/
public void setVascUserRoleController(VascUserRoleController vascUserRoleController) {
this.vascUserRoleController = vascUserRoleController;
}
}

View file

@ -0,0 +1,103 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.AbstractVascBackendProxy;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
* Does simple caching for the data.
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2009
*/
public class VascBackendProxyCache extends AbstractVascBackendProxy {
private Long records = null;
private List<Object> data = null;
private String dataSearchString = null;
private Map<String,Object> dataState = null;
public VascBackendProxyCache(VascBackend backend,VascEntry entry) {
super(backend);
dataState = new HashMap<String,Object>(10);
}
private boolean isStateChanged(VascBackendState state) {
boolean changed = false;
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
Object valueLast = dataState.get(key);
dataState.put(key, value);
if (value==null & valueLast==null) {
continue;
}
if (value==null & valueLast!=null) {
changed = true;
break;
}
if (value.equals(valueLast)==false) {
changed = true;
break;
}
}
if (state.getSearchString()!=null && state.getSearchString().equals(dataSearchString)==false) {
changed = true;
}
dataSearchString = state.getSearchString();
return changed;
}
/**
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
@Override
public List<Object> execute(VascBackendState state) throws VascException {
boolean changed = isStateChanged(state);
if (data==null | changed) {
data = backend.execute(state);
}
return data;
}
@Override
public long fetchTotalExecuteSize(VascBackendState state) {
boolean changed = isStateChanged(state);
if (records==null | changed) {
records = backend.fetchTotalExecuteSize(state);
}
return records;
}
}

View file

@ -27,9 +27,7 @@
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.AbstractVascBackendProxy;
import com.idcanet.vasc.core.VascBackend;
@ -47,13 +45,9 @@ import com.idcanet.vasc.core.VascException;
public class VascBackendProxyPaged extends AbstractVascBackendProxy {
private long records = 0;
private List<Object> data = null;
private String dataSearchString = null;
private Map<String,Object> dataState = null;
public VascBackendProxyPaged(VascBackend backend,VascEntry entry) {
super(backend);
dataState = new HashMap<String,Object>(10);
}
/**
@ -69,34 +63,7 @@ public class VascBackendProxyPaged extends AbstractVascBackendProxy {
*/
@Override
public List<Object> execute(VascBackendState state) throws VascException {
boolean changed = false;
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
Object valueLast = dataState.get(key);
dataState.put(key, value);
if (value==null & valueLast==null) {
continue;
}
if (value==null & valueLast!=null) {
changed = true;
break;
}
if (value.equals(valueLast)==false) {
changed = true;
break;
}
}
if (state.getSearchString()!=null && state.getSearchString().equals(dataSearchString)==false) {
changed = true;
}
dataSearchString = state.getSearchString();
if (data==null | changed) {
data = backend.execute(state);
}
List<Object> allData = data;
List<Object> allData = backend.execute(state);
int pageSize = state.getPageSize();
if (pageSize==0) {
records = allData.size();

View file

@ -100,7 +100,7 @@ public class VascBackendProxySearch extends AbstractVascBackendProxy {
}
Object res;
try {
res = method.invoke(o,null);
res = method.invoke(o,new Object[]{});
} catch (Exception e) {
throw new VascException(e);
}

View file

@ -0,0 +1,163 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.idcanet.vasc.core.AbstractVascBackendProxy;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
* Does simple caching for the data.
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2009
*/
public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
protected Logger logger = null;
protected Level logLevel = Level.INFO;
public VascBackendProxyTimerLogger(VascBackend backend,VascEntry entry) {
super(backend);
logger = Logger.getLogger(VascBackendProxyTimerLogger.class.getName());
}
/**
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
@Override
public List<Object> execute(VascBackendState state) throws VascException {
long t1 = System.currentTimeMillis();
try {
return backend.execute(state);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-execute backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
@Override
public long fetchTotalExecuteSize(VascBackendState state) {
long t1 = System.currentTimeMillis();
try {
return backend.fetchTotalExecuteSize(state);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-fetchTotalExecuteSize backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#doRecordMoveDownById(com.idcanet.vasc.core.VascBackendState, java.lang.Object)
*/
@Override
public long doRecordMoveDownById(VascBackendState state, Object primaryId) throws VascException {
long t1 = System.currentTimeMillis();
try {
return backend.doRecordMoveDownById(state, primaryId);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-doRecordMoveDownById backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#doRecordMoveUpById(com.idcanet.vasc.core.VascBackendState, java.lang.Object)
*/
@Override
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
long t1 = System.currentTimeMillis();
try {
return backend.doRecordMoveUpById(state, primaryId);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-doRecordMoveUpById backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#delete(java.lang.Object)
*/
@Override
public void delete(Object object) throws VascException {
long t1 = System.currentTimeMillis();
try {
backend.delete(object);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-delete backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#merge(java.lang.Object)
*/
@Override
public Object merge(Object object) throws VascException {
long t1 = System.currentTimeMillis();
try {
return backend.merge(object);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-merge backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#persist(java.lang.Object)
*/
@Override
public void persist(Object object) throws VascException {
long t1 = System.currentTimeMillis();
try {
backend.persist(object);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-persist backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
/**
* @return the logLevel
*/
public Level getLogLevel() {
return logLevel;
}
/**
* @param logLevel the logLevel to set
*/
public void setLogLevel(Level logLevel) {
this.logLevel = logLevel;
}
}

View file

@ -37,6 +37,7 @@ import com.idcanet.vasc.core.actions.RowVascAction;
*/
public class AddRowAction extends AbstractVascAction implements RowVascAction {
private static final long serialVersionUID = 1L;
static public final String ACTION_ID = "addRowAction";
protected String getActionId() {
@ -45,9 +46,9 @@ public class AddRowAction extends AbstractVascAction implements RowVascAction {
public void doRowAction(VascEntry entry,Object rowObject) throws Exception {
entry.getVascFrontendData().setEditCreate(true);
entry.getVascFrontendData().getVascEntryState().setEditCreate(true);
Object object = entry.getVascFrontendData().getVascFrontendHelper().createObject(entry);
entry.getVascFrontendData().setEntryDataObject(object);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(object);
entry.getVascFrontendData().getVascFrontend().renderEdit();
}

View file

@ -62,13 +62,13 @@ public class CSVExportGlobalAction extends AbstractVascAction implements GlobalV
}
p.write("\n");
int oldIndex = entry.getVascFrontendData().getVascBackendState().getPageIndex();
Long total = entry.getVascFrontendData().getTotalBackendRecords();
int pages = total.intValue()/entry.getVascFrontendData().getVascBackendState().getPageSize();
int oldIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
int pages = total.intValue()/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
for (int page=0;page<pages;page++) {
entry.getVascFrontendData().getVascBackendState().setPageIndex(page);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(page);
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
for (Object o:entry.getVascFrontendData().getEntryDataList()) {
for (Object o:entry.getVascFrontendData().getVascEntryState().getEntryDataList()) {
for (VascEntryField c:entry.getVascEntryFields()) {
p.write(c.getVascEntryFieldValue().getDisplayValue(c, o)+"\t");
}
@ -80,7 +80,7 @@ public class CSVExportGlobalAction extends AbstractVascAction implements GlobalV
p.flush();
// restore old page size
entry.getVascFrontendData().getVascBackendState().setPageIndex(oldIndex);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(oldIndex);
}

View file

@ -36,7 +36,8 @@ import com.idcanet.vasc.core.actions.RowVascAction;
* @version 1.0 Mar 30, 2007
*/
public class DeleteRowAction extends AbstractVascAction implements RowVascAction {
private static final long serialVersionUID = 1L;
static public final String ACTION_ID = "deleteRowAction";
protected String getActionId() {
@ -47,7 +48,7 @@ public class DeleteRowAction extends AbstractVascAction implements RowVascAction
if (rowObject==null) {
return; // nothing selected
}
entry.getVascFrontendData().setEntryDataObject(rowObject);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(rowObject);
entry.getVascFrontendData().getVascFrontend().renderDelete();
}

View file

@ -38,6 +38,7 @@ import com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType;
*/
public class EditRowAction extends AbstractVascAction implements RowVascAction {
private static final long serialVersionUID = 1L;
static public final String ACTION_ID = "editRowAction";
protected String getActionId() {
@ -49,9 +50,9 @@ public class EditRowAction extends AbstractVascAction implements RowVascAction {
if (rowObject==null) {
return; // nothing selected
}
entry.getVascFrontendData().setEditCreate(false);
entry.getVascFrontendData().getVascEntryState().setEditCreate(false);
entry.getVascFrontendData().getVascFrontendHelper().fireVascEvent(entry, VascEventType.DATA_SELECT, rowObject);
entry.getVascFrontendData().setEntryDataObject(rowObject);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(rowObject);
entry.getVascFrontendData().getVascFrontend().renderEdit();
}

View file

@ -37,6 +37,7 @@ import com.idcanet.vasc.core.actions.GlobalVascAction;
*/
public class RefreshDataGlobalAction extends AbstractVascAction implements GlobalVascAction {
private static final long serialVersionUID = 1L;
static public final String ACTION_ID = "refreshDataAction";
protected String getActionId() {

View file

@ -59,13 +59,13 @@ public class XMLExportGlobalAction extends AbstractVascAction implements GlobalV
p.write("<?xml version=\"1.0\"?>\n");
p.write("<data>\n");
int oldIndex = entry.getVascFrontendData().getVascBackendState().getPageIndex();
Long total = entry.getVascFrontendData().getTotalBackendRecords();
int pages = total.intValue()/entry.getVascFrontendData().getVascBackendState().getPageSize();
int oldIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
int pages = total.intValue()/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
for (int page=0;page<pages;page++) {
entry.getVascFrontendData().getVascBackendState().setPageIndex(page);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(page);
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
for (Object o:entry.getVascFrontendData().getEntryDataList()) {
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[");
@ -80,7 +80,7 @@ public class XMLExportGlobalAction extends AbstractVascAction implements GlobalV
p.flush();
// restore old page size
entry.getVascFrontendData().getVascBackendState().setPageIndex(oldIndex);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(oldIndex);
}
public String getMineType() {

View file

@ -38,6 +38,7 @@ import com.idcanet.x4o.impl.DefaultElementObjectPropertyValue;
*/
public class BeanPropertyVascEntryFieldValue implements VascEntryFieldValue {
private static final long serialVersionUID = 1L;
private String property = null;
private DefaultElementObjectPropertyValue helper = null;

View file

@ -36,6 +36,7 @@ import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
*/
public class BeanVascEntryRecordCreator implements VascEntryRecordCreator {
private static final long serialVersionUID = 1L;
private Class<?> objectClass = null;
public BeanVascEntryRecordCreator() {

View file

@ -110,12 +110,10 @@ public class HibernateValidatorService implements VascEntryFieldValidatorService
//cannot use an exclude list because the parameter name could match a method name
annotationParameters.put( method.getName(), method.invoke( annotation ) );
}
}
catch (IllegalAccessException e) {
} catch (IllegalAccessException e) {
//really should not happen, but we degrade nicely
//log.warning( "Unable to access {}", StringHelper.qualify( clazz.toString(), method.getName() ) );
}
catch (InvocationTargetException e) {
} catch (InvocationTargetException e) {
//really should not happen, but we degrade nicely
//log.warn( "Unable to access {}", StringHelper.qualify( clazz.toString(), method.getName() ) );
}
@ -127,15 +125,15 @@ public class HibernateValidatorService implements VascEntryFieldValidatorService
//do not resolve the property eagerly to allow validator.apply to work wo interpolator
}
public String interpolate(String message, Validator validator, MessageInterpolator defaultInterpolator) {
@SuppressWarnings("unchecked")
public String interpolate(String message, Validator validator, MessageInterpolator defaultInterpolator) {
if ( annotationMessage!=null && annotationMessage.equals( message ) ) {
//short cut
if (interpolateMessage == null) {
interpolateMessage = replace( annotationMessage );
}
return interpolateMessage;
}
else {
} else {
//TODO keep them in a weak hash map, but this might not even be useful
return replace( message );
}
@ -157,25 +155,20 @@ public class HibernateValidatorService implements VascEntryFieldValidatorService
}
if ( !el && "{".equals( token ) ) {
escaped = true;
}
else if ( escaped && "}".equals( token ) ) {
} else if ( escaped && "}".equals( token ) ) {
escaped = false;
}
else if ( !escaped ) {
} else if ( !escaped ) {
if ( "{".equals( token ) ) el = false;
buf.append( token );
}
else {
} else {
Object variable = annotationParameters.get( token );
if ( variable != null ) {
buf.append( variable );
}
else {
String string = null;
string = vascEntry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(token);
if ( string != null ) buf.append( replace( string ) );
} else {
String string = vascEntry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(token);
if ( string != null ) {
buf.append(replace(string));
}
}
}
}

View file

@ -39,6 +39,7 @@ import com.idcanet.vasc.core.VascEntryFieldType;
*/
public class DefaultVascEntryFieldType extends AbstractVascEntryFieldType {
private static final long serialVersionUID = 1L;
@Override
public VascEntryFieldType clone() throws CloneNotSupportedException {
DefaultVascEntryFieldType clone = new DefaultVascEntryFieldType();

View file

@ -1,56 +0,0 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.type;
import com.idcanet.vasc.core.VascEntryFieldTypeController;
import com.idcanet.vasc.core.VascEntryFieldTypeControllerResolver;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 14, 2008
*/
public class DefaultVascEntryFieldTypeControllerResolver implements VascEntryFieldTypeControllerResolver {
VascEntryFieldTypeController vascEntryFieldTypeController = null;
/**
* @see com.idcanet.vasc.core.VascEntryFieldTypeControllerResolver#getVascEntryFieldTypeController()
*/
public VascEntryFieldTypeController getVascEntryFieldTypeController() {
return vascEntryFieldTypeController;
}
/**
* @param vascEntryFieldTypeController the vascEntryFieldTypeController to set
*/
public void setVascEntryFieldTypeController(VascEntryFieldTypeController vascEntryFieldTypeController) {
this.vascEntryFieldTypeController = vascEntryFieldTypeController;
}
}

View file

@ -41,11 +41,12 @@ import com.idcanet.vasc.core.ui.VascValueModel;
*/
public class MultiTextVascEntryFieldType extends DefaultVascEntryFieldType {
private static final long serialVersionUID = 1L;
private Object getIndexValue(VascEntryField entryField,int index) throws VascException {
Object record = entryField.getVascEntry().getVascFrontendData().getEntryDataObject();
Object record = entryField.getVascEntry().getVascFrontendData().getVascEntryState().getEntryDataObject();
Object value = entryField.getVascEntryFieldValue().getValue(entryField, record);
if (value instanceof List) {
if (value instanceof List<?>) {
return ((List<?>)value).get(index);
}
if (value instanceof String[]) {
@ -60,12 +61,13 @@ public class MultiTextVascEntryFieldType extends DefaultVascEntryFieldType {
throw new VascException("Unknown object type");
}
@SuppressWarnings("unchecked")
private void setIndexValue(VascEntryField entryField,int index,Object newValue) throws VascException {
Object record = entryField.getVascEntry().getVascFrontendData().getEntryDataObject();
Object record = entryField.getVascEntry().getVascFrontendData().getVascEntryState().getEntryDataObject();
Object value = entryField.getVascEntryFieldValue().getValue(entryField, record);
if (value instanceof List) {
((List<Object>)value).set(index, newValue);
if (value instanceof List<?>) {
((List<Object>)value).set(index, newValue); // TODO: fix @SuppressWarnings here
return;
}
if (value instanceof String[]) {
@ -94,10 +96,10 @@ public class MultiTextVascEntryFieldType extends DefaultVascEntryFieldType {
public int getUIComponentCount(VascEntryField entryField) throws VascException {
Object record = entryField.getVascEntry().getVascFrontendData().getEntryDataObject();
Object record = entryField.getVascEntry().getVascFrontendData().getVascEntryState().getEntryDataObject();
Object value = entryField.getVascEntryFieldValue().getValue(entryField, record);
if (value instanceof List) {
if (value instanceof List<?>) {
return ((List<?>)value).size()+1;
}
if (value instanceof String[]) {

View file

@ -282,14 +282,14 @@ public class AnnotationParserElement extends AbstractElement {
VascController vascController = VascParser.getVascController(this.getElementContext());
VascChoices vc = parser.getVascChoices (modelClass, field.getId());
if (vc!=null) {
VascEntryFieldType type = vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById("ListField");
VascEntryFieldType type = vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById("ListField");
type.setDataObject(new VascChoicesSelectItemModel(vc));
field.setVascEntryFieldType(type);
}
if (field.getVascEntryFieldType()==null) {
String fieldType = parser.getVascFieldType (modelClass, field.getId());
if (fieldType!=null) {
VascEntryFieldType type = vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById(fieldType);
VascEntryFieldType type = vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById(fieldType);
field.setVascEntryFieldType(type);
// copy properties
@ -342,8 +342,8 @@ public class AnnotationParserElement extends AbstractElement {
if (methodCall!=null) {
Class<?> retType = methodCall.getReturnType();
for (String typeId: vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
VascEntryFieldType type = vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById(typeId);
for (String typeId: vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
VascEntryFieldType type = vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById(typeId);
//String auto = "";
//if (type.getAutoDetectClass()!=null) {

View file

@ -63,14 +63,14 @@ public class SetParameterElement extends AbstractElement {
}
if ("id".equals(value)) {
if ("int".equals(type)) {
Long userId = cont.getVascUserRoleControllerResolver().getVascUserRoleController().getUserId();
Long userId = cont.getVascUserRoleController().getUserId();
entry.setEntryParameter(name, userId.intValue());
} else {
Long userId = cont.getVascUserRoleControllerResolver().getVascUserRoleController().getUserId();
Long userId = cont.getVascUserRoleController().getUserId();
entry.setEntryParameter(name, userId);
}
} else {
String userName = cont.getVascUserRoleControllerResolver().getVascUserRoleController().getUserName();
String userName = cont.getVascUserRoleController().getUserName();
entry.setEntryParameter(name, userName);
}
return;

View file

@ -52,7 +52,7 @@ public class VascBackendElementConfigurator extends AbstractElementConfigurator
VascBackend backend = (VascBackend)element.getElementObject();
VascController vascController = VascParser.getVascController(element.getElementContext());
VascBackendController backendController = vascController.getVascBackendControllerResolver().getVascBackendController();
VascBackendController backendController = vascController.getVascBackendController();
if (backendController instanceof VascBackendControllerLocal) {
try {

View file

@ -52,7 +52,7 @@ public class VascEntryElementConfigurator extends AbstractElementConfigurator {
VascEntry entry = (VascEntry)element.getElementObject();
VascController vascController = VascParser.getVascController(element.getElementContext());
VascEntryController entryController = vascController.getVascEntryControllerResolver().getVascEntryController();
VascEntryController entryController = vascController.getVascEntryController();
if (entryController instanceof VascEntryControllerLocal) {
try {

View file

@ -54,7 +54,7 @@ public class VascEntryFieldTypeAttributeConverter extends AbstractElementAttribu
String fieldID = parameterValue.toString();
VascController controller = VascParser.getVascController(element.getElementContext());
Object result = controller.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById(fieldID);
Object result = controller.getVascEntryFieldTypeController().getVascEntryFieldTypeById(fieldID);
return result;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
@ -24,15 +24,28 @@
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
package com.idcanet.vasc.validators;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* An annotation to validate an url field of a bean.
* Also works on String types
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
* @version 1.0 Dec 15, 2009
*/
public interface VascBackendControllerResolver {
public VascBackendController getVascBackendController();
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface VascObjectUrl {
/**
* The regex to match on the url to forbid some urls.
* @return
*/
String forbidRegex();
}

View file

@ -0,0 +1,117 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.validators;
import java.lang.annotation.Annotation;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Validates the url annotations
*
* @author Willem Cazander
* @version 1.0 Sep 5, 2008
*/
public class VascObjectUrlValidator implements VascValidator {
private Pattern pattern = null;
/**
* Sets the regulare expression on which this object filters an String.<br>
* <br>
* When set to <code>Null</code> matching is disabled.<br>
*
* @param regex The regulare expression to match to.
*/
public void setForbidRegEx(String regex) {
pattern = Pattern.compile(regex);
}
/**
* Returns the current regulare expression.
* @return The regulare expression.
*/
public String getForbidRegEx() {
if(pattern==null) {
return null;
}
return pattern.pattern();
}
/**
* @see com.idcanet.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/
public boolean isObjectValid(Object object) throws VascValidatorException {
if (object==null) {
return true;
}
URL url = null;
if (object instanceof URL) {
url = (URL)object;
}
if (object instanceof String) {
try {
url = new URL((String)object);
} catch (MalformedURLException e) {
throw new VascValidatorException("Url not valid: "+(String)object,e);
}
}
if (url==null) {
throw new VascValidatorException("Object could not be translated into url: "+object);
}
if (pattern==null) {
return true;
}
String urlString = url.toExternalForm();
// test if regex matches
Matcher m = pattern.matcher(urlString);
return !m.find(); // if found then url it NOT valid
}
/**
* @see com.idcanet.vasc.validators.VascValidator#getAnnotationType()
*/
public Class<?> getAnnotationType() {
return VascObjectNull.class;
}
/**
* @see com.idcanet.vasc.validators.VascValidator#initAnnotation(java.lang.annotation.Annotation)
*/
public void initAnnotation(Annotation annotation) {
VascObjectUrl a = VascObjectUrl.class.cast(annotation);
setForbidRegEx(a.forbidRegex());
}
public VascValidator clone() throws CloneNotSupportedException {
VascObjectUrlValidator result = new VascObjectUrlValidator();
result.pattern=pattern;
return result;
}
}

View file

@ -50,6 +50,7 @@ public class VascValidatorClassParser {
validators.add(new VascLongSizeValidator());
validators.add(new VascObjectNotNullValidator());
validators.add(new VascObjectNullValidator());
validators.add(new VascObjectUrlValidator());
validators.add(new VascStringEmailValidator());
validators.add(new VascStringLengthValidator());
validators.add(new VascStringRegexValidator());

View file

@ -87,15 +87,11 @@
</deferred-value>
</attribute>
<attribute>
<name>bundleName</name>
<name>disableLinkColumns</name>
<required>false</required>
<deferred-value/>
</attribute>
<attribute>
<name>locale</name>
<required>false</required>
<deferred-value/>
<deferred-value>
<type>java.lang.String</type>
</deferred-value>
</attribute>
</tag>
</taglib>

View file

@ -84,12 +84,12 @@ public class SwingTest extends TestCase {
JMenuBar menubar = new JMenuBar();
JMenu vascMenu = new JMenu("Vasc Entries");
for (final String id:entry.getVascFrontendData().getVascController().getVascEntryControllerResolver().getVascEntryController().getVascEntryIds()) {
for (final String id:entry.getVascFrontendData().getVascController().getVascEntryController().getVascEntryIds()) {
JMenuItem item = new JMenuItem(id);
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
VascEntry ee = entry.getVascFrontendData().getVascController().getVascEntryControllerResolver().getVascEntryController().getVascEntryById(id);
VascEntry ee = entry.getVascFrontendData().getVascController().getVascEntryController().getVascEntryById(id);
TestTable.fill(ee,entry.getVascFrontendData().getVascController());
viewEntry(ee);
} catch (Exception e1) {

View file

@ -31,20 +31,15 @@ import java.io.FileOutputStream;
import java.lang.reflect.Method;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendControllerLocal;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.impl.DefaultVascBackedEntryFinalizer;
import com.idcanet.vasc.impl.DefaultVascBackendController;
import com.idcanet.vasc.impl.DefaultVascBackendControllerResolver;
import com.idcanet.vasc.impl.DefaultVascEntryController;
import com.idcanet.vasc.impl.DefaultVascEntryControllerResolver;
import com.idcanet.vasc.impl.DefaultVascController;
import com.idcanet.vasc.impl.DefaultVascFactory;
import com.idcanet.vasc.impl.DefaultVascFrontendData;
import com.idcanet.vasc.impl.DefaultVascFrontendHelper;
import com.idcanet.vasc.impl.DefaultVascUserRoleController;
import com.idcanet.vasc.impl.DefaultVascUserRoleControllerResolver;
import com.idcanet.vasc.impl.VascBackendProxyPaged;
import com.idcanet.vasc.impl.VascBackendProxySearch;
import com.idcanet.vasc.impl.VascBackendProxySort;
@ -54,8 +49,6 @@ import com.idcanet.vasc.impl.actions.DeleteRowAction;
import com.idcanet.vasc.impl.actions.EditRowAction;
import com.idcanet.vasc.impl.actions.RefreshDataGlobalAction;
import com.idcanet.vasc.impl.actions.XMLExportGlobalAction;
import com.idcanet.vasc.impl.type.DefaultVascEntryFieldTypeController;
import com.idcanet.vasc.impl.type.DefaultVascEntryFieldTypeControllerResolver;
import com.idcanet.vasc.impl.x4o.VascParser;
@ -67,38 +60,14 @@ import com.idcanet.vasc.impl.x4o.VascParser;
public class TestTable {
static VascController getDefaultVascController() throws Exception {
VascController c = DefaultVascFactory.getDefaultVascController(2288L,"idca.nl","user","admin");
// for test
TestModelVascDataSource backend = new TestModelVascDataSource();
backend.setId("testBackend1");
// config full controller for local jvm use
DefaultVascController c = new DefaultVascController();
DefaultVascBackendControllerResolver vascBackendControllerResolver = new DefaultVascBackendControllerResolver();
DefaultVascBackendController vascBackendController = new DefaultVascBackendController();
vascBackendController.addVascBackend(backend);
vascBackendControllerResolver.setVascBackendController(vascBackendController);
c.setVascBackendControllerResolver(vascBackendControllerResolver);
DefaultVascEntryControllerResolver vascEntryControllerResolver = new DefaultVascEntryControllerResolver();
DefaultVascEntryController vascEntryController = new DefaultVascEntryController();
vascEntryControllerResolver.setVascEntryController(vascEntryController);
c.setVascEntryControllerResolver(vascEntryControllerResolver);
DefaultVascEntryFieldTypeControllerResolver vascEntryFieldTypeControllerResolver = new DefaultVascEntryFieldTypeControllerResolver();
DefaultVascEntryFieldTypeController vascEntryFieldTypeController = new DefaultVascEntryFieldTypeController();
vascEntryFieldTypeControllerResolver.setVascEntryFieldTypeController(vascEntryFieldTypeController);
c.setVascEntryFieldTypeControllerResolver(vascEntryFieldTypeControllerResolver);
DefaultVascUserRoleControllerResolver vascUserRoleControllerResolver = new DefaultVascUserRoleControllerResolver();
DefaultVascUserRoleController vascUserRoleController = new DefaultVascUserRoleController(2288L,"idca.nl","user","admin");
vascUserRoleControllerResolver.setVascUserRoleController(vascUserRoleController);
c.setVascUserRoleControllerResolver(vascUserRoleControllerResolver);
((VascBackendControllerLocal)c.getVascBackendController()).addVascBackend(backend);
return c;
}
static public void fill(VascEntry entry,VascController c) {
@ -122,7 +91,7 @@ public class TestTable {
entry.setVascFrontendData(vascFrontendData);
}
VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId());
VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendController().getVascBackendById(entry.getBackendId());
if (backend.isSearchable()==false) {
backend = new VascBackendProxySearch(backend,entry);
}
@ -132,7 +101,7 @@ public class TestTable {
if (backend.isSortable()==false) {
backend = new VascBackendProxySort(backend,entry);
}
vascFrontendData.setVascBackend(backend);
vascFrontendData.getVascEntryState().setVascBackend(backend);
entry.addRowAction(new AddRowAction());
@ -162,7 +131,7 @@ public class TestTable {
parser.setDebugOutputStream(new FileOutputStream(f));
parser.parseResource("vasc/tables.xml");
VascEntry entry = parser.getVascController().getVascEntryControllerResolver().getVascEntryController().getVascEntryById("test1");
VascEntry entry = parser.getVascController().getVascEntryController().getVascEntryById("test1");
fill(entry,c);
return entry;