split event listeners and made xml elements for event en actions on back/frontend
This commit is contained in:
parent
3d0d609462
commit
a51eeeb254
|
@ -41,6 +41,6 @@ import java.lang.annotation.Target;
|
|||
@Target(ElementType.TYPE)
|
||||
public @interface VascEventListener {
|
||||
|
||||
String[] backendEventListeners();
|
||||
String[] frontendEventListeners();
|
||||
String[] backendEventListeners() default {};
|
||||
String[] frontendEventListeners() default {};
|
||||
}
|
|
@ -34,6 +34,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.idcanet.vasc.backends.MapVascEntryFieldValue;
|
||||
import com.idcanet.vasc.backends.MapVascEntryRecordCreator;
|
||||
import com.idcanet.vasc.core.AbstractVascBackend;
|
||||
import com.idcanet.vasc.core.VascBackendState;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
|
@ -151,49 +153,13 @@ public class JdbcXpqlVascBackend extends AbstractVascBackend {
|
|||
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryFieldValue(com.idcanet.vasc.core.VascEntryField)
|
||||
*/
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
VascEntryFieldValue result = new VascEntryFieldValue() {
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.entry.VascEntryFieldValue#getValue(com.idcanet.vasc.core.VascEntryField, java.lang.Object)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object getValue(VascEntryField field, Object record) throws VascException {
|
||||
Map<String,Object> map = (Map<String,Object>)record;
|
||||
Object o = map.get(field.getBackendName());
|
||||
return o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.entry.VascEntryFieldValue#getDisplayValue(com.idcanet.vasc.core.VascEntryField, java.lang.Object)
|
||||
*/
|
||||
public String getDisplayValue(VascEntryField field, Object record) throws VascException {
|
||||
return ""+getValue(field,record); // not supported
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.entry.VascEntryFieldValue#setValue(com.idcanet.vasc.core.VascEntryField, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setValue(VascEntryField field, Object record,Object value) throws VascException {
|
||||
Map<String,Object> map = (Map<String,Object>)record;
|
||||
map.put(field.getBackendName(), value);
|
||||
}
|
||||
};
|
||||
return result;
|
||||
return new MapVascEntryFieldValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryRecordCreator(com.idcanet.vasc.core.VascEntry)
|
||||
*/
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
return new VascEntryRecordCreator() {
|
||||
|
||||
public Class<?> getObjectClass() {
|
||||
return Map.class;
|
||||
}
|
||||
|
||||
public Object newRecord(VascEntry entry) throws Exception {
|
||||
return new HashMap<String,Object>(10);
|
||||
}
|
||||
};
|
||||
return new MapVascEntryRecordCreator();
|
||||
}
|
||||
}
|
|
@ -26,6 +26,9 @@
|
|||
|
||||
package com.idcanet.vasc.core;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
|
@ -56,10 +59,11 @@ abstract public class AbstractVascFrontend implements VascFrontend {
|
|||
*/
|
||||
public void initEntry(VascEntry entry) throws Exception {
|
||||
if (entry.getVascFrontendData().getVascFrontend()==null) {
|
||||
Logger.getLogger(AbstractVascFrontend.class.getName()).fine("Bind frontend: "+this+" to: "+entry.getVascFrontendData()+" entry: "+entry.getId());
|
||||
entry.getVascFrontendData().setVascFrontend(this);
|
||||
} else {
|
||||
if (entry.getVascFrontendData().getVascFrontend()!=this) {
|
||||
throw new IllegalArgumentException("VascEntry has already a differtent VascFrontend attected");
|
||||
throw new IllegalArgumentException("VascEntry '"+entry.getId()+"' data: "+entry.getVascFrontendData()+" frontend: "+this+" has already a differtent VascFrontend attected");
|
||||
}
|
||||
}
|
||||
this.entry=entry;
|
||||
|
|
|
@ -393,13 +393,13 @@ public interface VascEntry extends Cloneable,Serializable {
|
|||
* Added an VascEntryFrontendEventListener
|
||||
* @param listener The class of the event listener.
|
||||
*/
|
||||
public void addVascEntryFrontendEventListener(String listener);
|
||||
public void addVascEntryFrontendEventListener(String listener,String frontendType);
|
||||
|
||||
/**
|
||||
* Returns the list of VascEntryFrontendEventListener
|
||||
* @return
|
||||
*/
|
||||
public List<String> getVascEntryFrontendEventListeners();
|
||||
public List<String> getVascEntryFrontendEventListenersByType(String frontendType);
|
||||
|
||||
|
||||
public void addListOption(VascEntryField listOption);
|
||||
|
@ -409,6 +409,9 @@ public interface VascEntry extends Cloneable,Serializable {
|
|||
public void addVascBackendFilter(VascBackendFilter filter);
|
||||
public List<VascBackendFilter> getVascBackendFilters();
|
||||
|
||||
public void addVascEntryFrontendAction(String actionClass,String frontendType);
|
||||
public List<String> getVascEntryFrontendActionsByType(String frontendType);
|
||||
|
||||
/**
|
||||
* Force impl to have public clone methode
|
||||
* @return
|
||||
|
|
|
@ -40,6 +40,8 @@ public interface VascFrontend {
|
|||
|
||||
public String getId();
|
||||
|
||||
public String getFrontendType();
|
||||
|
||||
public void initEntry(VascEntry entry) throws Exception;
|
||||
|
||||
public void renderView() throws Exception;
|
||||
|
|
|
@ -103,7 +103,7 @@ public interface VascFrontendData {
|
|||
public VascEntryState getVascEntryState();
|
||||
public void setVascEntryState(VascEntryState state);
|
||||
|
||||
public void initFrontendListeners(VascEntry entry) throws InstantiationException, IllegalAccessException;
|
||||
public void initFrontendListeners(VascEntry entry,String frontendType) throws InstantiationException, IllegalAccessException;
|
||||
public void addVascEntryFrontendEventListener(VascEntryFrontendEventListener listener);
|
||||
public List<VascEntryFrontendEventListener> getVascEntryFrontendEventListener(VascEntryFrontendEventListener.VascFrontendEventType type);
|
||||
}
|
|
@ -60,7 +60,7 @@ public interface VascEntryBackendEventListener extends Serializable {
|
|||
POST_MOVE_UP
|
||||
}
|
||||
|
||||
public VascBackendEventType[] getEventType();
|
||||
public VascBackendEventType[] getEventTypes();
|
||||
|
||||
/**
|
||||
* Is executed when the type of event is fired.
|
||||
|
|
|
@ -41,9 +41,7 @@ import com.idcanet.vasc.core.actions.ColumnVascAction;
|
|||
import com.idcanet.vasc.core.actions.GlobalVascAction;
|
||||
import com.idcanet.vasc.core.actions.RowVascAction;
|
||||
import com.idcanet.vasc.core.actions.VascAction;
|
||||
import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFieldEventChannel;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
|
||||
/**
|
||||
* VascEntry
|
||||
|
@ -87,11 +85,12 @@ public class DefaultVascEntry implements VascEntry {
|
|||
private List<VascLinkEntry> vascLinkEntries = null;
|
||||
private Map<String,Object> entryParameters = null;
|
||||
private VascEntryFieldEventChannel vascEntryFieldEventChannel = null;
|
||||
private List<String> eventEntryFrontendEventListeners = null;
|
||||
private Map<String,List<String>> eventEntryFrontendEventListeners = null;
|
||||
private List<String> eventEntryBackendEventListeners = null;
|
||||
private List<VascEntryField> listOptions = null;
|
||||
private List<VascBackendFilter> backendFilters = null;
|
||||
|
||||
private Map<String,List<String>> eventEntryFrontendActions = null;
|
||||
|
||||
private String backendId = null;
|
||||
private VascFrontendData vascFrontendData = null;
|
||||
|
||||
|
@ -109,7 +108,8 @@ public class DefaultVascEntry implements VascEntry {
|
|||
vascLinkEntries = new ArrayList<VascLinkEntry>(10);
|
||||
entryParameters = new HashMap<String,Object>(10);
|
||||
|
||||
eventEntryFrontendEventListeners = new ArrayList<String>(10);
|
||||
eventEntryFrontendActions = new HashMap<String,List<String>>(10);
|
||||
eventEntryFrontendEventListeners = new HashMap<String,List<String>>(10);
|
||||
eventEntryBackendEventListeners = new ArrayList<String>(10);
|
||||
listOptions = new ArrayList<VascEntryField>(5);
|
||||
backendFilters = new ArrayList<VascBackendFilter>(3);
|
||||
|
@ -143,8 +143,9 @@ public class DefaultVascEntry implements VascEntry {
|
|||
result.vascAdminDelete=vascAdminDelete;
|
||||
result.backendId=backendId;
|
||||
result.vascEntryFieldEventChannel=vascEntryFieldEventChannel;
|
||||
result.eventEntryFrontendEventListeners.addAll(eventEntryFrontendEventListeners);
|
||||
result.eventEntryFrontendEventListeners.putAll(eventEntryFrontendEventListeners);
|
||||
result.eventEntryBackendEventListeners.addAll(eventEntryBackendEventListeners);
|
||||
result.eventEntryFrontendActions.putAll(eventEntryFrontendActions);
|
||||
// skipping 'vascFrontendData' because it should always be null when cloning happens.
|
||||
|
||||
for (VascEntryField f:vascFields) {
|
||||
|
@ -172,10 +173,10 @@ public class DefaultVascEntry implements VascEntry {
|
|||
ff.setVascEntry(result);
|
||||
result.listOptions.add(ff);
|
||||
}
|
||||
for (VascBackendFilter f:backendFilters) {
|
||||
VascBackendFilter ff = f.clone();
|
||||
result.backendFilters.add(ff);
|
||||
}
|
||||
// for (VascBackendFilter f:backendFilters) {
|
||||
// VascBackendFilter ff = f.clone();
|
||||
// result.backendFilters.add(ff);
|
||||
// }
|
||||
|
||||
|
||||
// no cloning of the values here ?
|
||||
|
@ -736,18 +737,84 @@ public class DefaultVascEntry implements VascEntry {
|
|||
* Added an VascEntryFrontendEventListener
|
||||
* @param listener The class of the event listener.
|
||||
*/
|
||||
public void addVascEntryFrontendEventListener(String listener) {
|
||||
eventEntryFrontendEventListeners.add(listener);
|
||||
public void addVascEntryFrontendEventListener(String listener,String frontendType) {
|
||||
if (frontendType==null) {
|
||||
frontendType = "__ALL__";
|
||||
}
|
||||
if (frontendType.isEmpty() | "all".equalsIgnoreCase(frontendType)) {
|
||||
frontendType = "__ALL__";
|
||||
}
|
||||
List<String> typeList = eventEntryFrontendEventListeners.get(frontendType);
|
||||
if (typeList==null) {
|
||||
typeList = new ArrayList<String>(10);
|
||||
eventEntryFrontendEventListeners.put(frontendType,typeList);
|
||||
}
|
||||
typeList.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of VascEntryFrontendEventListener
|
||||
* @return
|
||||
*/
|
||||
public List<String> getVascEntryFrontendEventListeners() {
|
||||
return eventEntryFrontendEventListeners;
|
||||
public List<String> getVascEntryFrontendEventListenersByType(String frontendType) {
|
||||
if (frontendType==null) {
|
||||
frontendType = "__ALL__";
|
||||
}
|
||||
if (frontendType.isEmpty() | "all".equalsIgnoreCase(frontendType)) {
|
||||
frontendType = "__ALL__";
|
||||
}
|
||||
List<String> typeList = eventEntryFrontendEventListeners.get(frontendType);
|
||||
if (typeList==null) {
|
||||
typeList = new ArrayList<String>(0);
|
||||
}
|
||||
if (frontendType.equals("__ALL__")==false) {
|
||||
// also add all
|
||||
List<String> typeListAll = eventEntryFrontendEventListeners.get("__ALL__");
|
||||
if (typeListAll!=null) {
|
||||
typeList.addAll(typeListAll);
|
||||
}
|
||||
}
|
||||
return typeList;
|
||||
}
|
||||
|
||||
public void addVascEntryFrontendAction(String actionClass,String frontendType) {
|
||||
if (frontendType==null) {
|
||||
frontendType = "__ALL__";
|
||||
}
|
||||
if (frontendType.isEmpty() | "all".equalsIgnoreCase(frontendType)) {
|
||||
frontendType = "__ALL__";
|
||||
}
|
||||
List<String> typeList = eventEntryFrontendActions.get(frontendType);
|
||||
if (typeList==null) {
|
||||
typeList = new ArrayList<String>(10);
|
||||
eventEntryFrontendActions.put(frontendType,typeList);
|
||||
}
|
||||
typeList.add(actionClass);
|
||||
}
|
||||
|
||||
|
||||
public List<String> getVascEntryFrontendActionsByType(String frontendType) {
|
||||
if (frontendType==null) {
|
||||
frontendType = "__ALL__";
|
||||
}
|
||||
if (frontendType.isEmpty() | "all".equalsIgnoreCase(frontendType)) {
|
||||
frontendType = "__ALL__";
|
||||
}
|
||||
List<String> typeList = eventEntryFrontendActions.get(frontendType);
|
||||
if (typeList==null) {
|
||||
typeList = new ArrayList<String>(0);
|
||||
}
|
||||
if (frontendType.equals("__ALL__")==false) {
|
||||
// also add all
|
||||
List<String> typeListAll = eventEntryFrontendActions.get("__ALL__");
|
||||
if (typeListAll!=null) {
|
||||
typeList.addAll(typeListAll);
|
||||
}
|
||||
}
|
||||
return typeList;
|
||||
}
|
||||
|
||||
|
||||
public void addListOption(VascEntryField listOption) {
|
||||
if (listOption==null) {
|
||||
throw new NullPointerException("can not add null listOption.");
|
||||
|
|
|
@ -115,10 +115,7 @@ public class DefaultVascFactory {
|
|||
if (backend.isPageable()==false) {
|
||||
backend = new VascBackendProxyPaged(backend,entry);
|
||||
}
|
||||
|
||||
// execute backend event listeners
|
||||
backend = new VascBackendProxyEventExecutor(backend,entry);
|
||||
|
||||
|
||||
// return the configed backend.
|
||||
return backend;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,10 @@ import com.idcanet.vasc.core.VascException;
|
|||
import com.idcanet.vasc.core.VascFrontend;
|
||||
import com.idcanet.vasc.core.VascFrontendData;
|
||||
import com.idcanet.vasc.core.VascFrontendHelper;
|
||||
import com.idcanet.vasc.core.actions.ColumnVascAction;
|
||||
import com.idcanet.vasc.core.actions.GlobalVascAction;
|
||||
import com.idcanet.vasc.core.actions.RowVascAction;
|
||||
import com.idcanet.vasc.core.actions.VascAction;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import com.idcanet.vasc.core.entry.VascEntryResourceImageResolver;
|
||||
|
@ -247,12 +251,12 @@ public class DefaultVascFrontendData implements VascFrontendData {
|
|||
}
|
||||
|
||||
|
||||
public void initFrontendListeners(VascEntry entry) throws InstantiationException, IllegalAccessException {
|
||||
public void initFrontendListeners(VascEntry entry,String frontendType) throws InstantiationException, IllegalAccessException {
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl==null) {
|
||||
cl = entry.getClass().getClassLoader();
|
||||
}
|
||||
for (String clazz:entry.getVascEntryFrontendEventListeners()) {
|
||||
for (String clazz:entry.getVascEntryFrontendEventListenersByType(frontendType)) {
|
||||
VascEntryFrontendEventListener listener;
|
||||
try {
|
||||
listener = (VascEntryFrontendEventListener)cl.loadClass(clazz).newInstance();
|
||||
|
@ -261,6 +265,44 @@ public class DefaultVascFrontendData implements VascFrontendData {
|
|||
}
|
||||
addVascEntryFrontendEventListener(listener);
|
||||
}
|
||||
|
||||
for (String clazz:entry.getVascEntryFrontendActionsByType(frontendType)) {
|
||||
Object obj = null;
|
||||
try {
|
||||
obj = cl.loadClass(clazz).newInstance();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException("Could not load frontend action of: "+clazz);
|
||||
}
|
||||
if (obj instanceof VascAction) {
|
||||
VascAction action = (VascAction)obj;
|
||||
String aid = action.getId();
|
||||
if (aid==null) {
|
||||
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+entry.getId());
|
||||
}
|
||||
if (action.getName()==null) {
|
||||
action.setName("vasc.action."+aid+".name");
|
||||
}
|
||||
if (action.getDescription()==null) {
|
||||
action.setDescription("vasc.action."+aid+".description");
|
||||
}
|
||||
if (action.getImage()==null) {
|
||||
action.setImage("vasc.action."+aid+".image");
|
||||
}
|
||||
if (action.getHelpId()==null) {
|
||||
action.setHelpId("vasc.action."+aid+".helpId");
|
||||
}
|
||||
}
|
||||
|
||||
if (obj instanceof RowVascAction) {
|
||||
entry.addRowAction((RowVascAction)obj);
|
||||
}
|
||||
if (obj instanceof ColumnVascAction) {
|
||||
entry.addColumnAction((ColumnVascAction)obj);
|
||||
}
|
||||
if (obj instanceof GlobalVascAction) {
|
||||
entry.addGlobalAction((GlobalVascAction)obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addVascEntryFrontendEventListener(VascEntryFrontendEventListener listener) {
|
||||
|
|
|
@ -67,11 +67,29 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
listeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public VascBackendProxyEventExecutor(VascBackend backend,VascEntry entry,List<VascEntryBackendEventListener> listeners) {
|
||||
super(backend);
|
||||
this.entry=entry;
|
||||
this.listeners=listeners;
|
||||
}
|
||||
|
||||
private void fireVascEvent(VascBackendEventType type, Object data) {
|
||||
for (int i=0;i<listeners.size();i++) {
|
||||
VascEntryBackendEventListener l = listeners.get(i);
|
||||
l.vascEvent(entry, data);
|
||||
VascBackendEventType[] types = l.getEventTypes();
|
||||
if (types==null) {
|
||||
continue;
|
||||
}
|
||||
if (types.length==0) {
|
||||
continue;
|
||||
}
|
||||
for (int t=0;t<types.length;t++) {
|
||||
VascBackendEventType typeListener = types[t];
|
||||
if (typeListener==type) {
|
||||
l.vascEvent(entry, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
package com.idcanet.vasc.impl.entry;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackendState;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
|
||||
|
||||
public class SetParameterBackendListener implements VascEntryBackendEventListener {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String name = null;
|
||||
private String value = null;
|
||||
private String type = null;
|
||||
|
||||
private boolean isUserValue = false;
|
||||
private Long userId = null;
|
||||
private String userName = null;
|
||||
|
||||
public SetParameterBackendListener() {
|
||||
|
||||
}
|
||||
|
||||
public SetParameterBackendListener(Long userId,String userName) {
|
||||
this.userId=userId;
|
||||
this.userName=userName;
|
||||
isUserValue = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.entry.VascEntryBackendEventListener#getEventType()
|
||||
*/
|
||||
public VascBackendEventType[] getEventTypes() {
|
||||
return new VascBackendEventType[] {
|
||||
VascBackendEventType.PRE_DELETE,
|
||||
VascBackendEventType.PRE_EXECUTE,
|
||||
VascBackendEventType.PRE_MERGE,
|
||||
VascBackendEventType.PRE_MOVE_DOWN,
|
||||
VascBackendEventType.PRE_MOVE_UP,
|
||||
VascBackendEventType.PRE_PERSIST,
|
||||
VascBackendEventType.PRE_TOTAL_EXECUTE_SIZE
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.entry.VascEntryBackendEventListener#vascEvent(com.idcanet.vasc.core.VascEntry, java.lang.Object)
|
||||
*/
|
||||
public void vascEvent(VascEntry entry, Object data) {
|
||||
if (data instanceof VascBackendState) {
|
||||
VascBackendState state = (VascBackendState)data;
|
||||
if (isUserValue) {
|
||||
if (value==null) {
|
||||
value="id";
|
||||
}
|
||||
if ("id".equals(value)) {
|
||||
if ("int".equals(type)) {
|
||||
state.setDataParameter(name, userId.intValue());
|
||||
} else {
|
||||
state.setDataParameter(name, userId);
|
||||
}
|
||||
} else {
|
||||
state.setDataParameter(name, userName);
|
||||
}
|
||||
} else {
|
||||
state.setDataParameter(name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the value
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value the value to set
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type the type to set
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the userId
|
||||
*/
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userId the userId to set
|
||||
*/
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the userName
|
||||
*/
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userName the userName to set
|
||||
*/
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
}
|
|
@ -112,7 +112,7 @@ public class AnnotationParserElement extends AbstractElement {
|
|||
VascEventListener vc = parser.getVascEventListener(modelClass);
|
||||
if (vc!=null) {
|
||||
for (String listener:vc.frontendEventListeners()) {
|
||||
entry.addVascEntryFrontendEventListener(listener);
|
||||
entry.addVascEntryFrontendEventListener(listener,null);
|
||||
}
|
||||
for (String listener:vc.backendEventListeners()) {
|
||||
entry.addVascEntryBackendEventListener(listener);
|
||||
|
|
|
@ -58,21 +58,7 @@ public class SetParameterElement extends AbstractElement {
|
|||
logger.fine("Setting parameter name: "+name+" value: "+value+" type: "+type);
|
||||
|
||||
if ("setUserParameter".equals(getElementClass().getTag())) {
|
||||
if (value==null) {
|
||||
value="id";
|
||||
}
|
||||
if ("id".equals(value)) {
|
||||
if ("int".equals(type)) {
|
||||
Long userId = cont.getVascUserRoleController().getUserId();
|
||||
entry.setEntryParameter(name, userId.intValue());
|
||||
} else {
|
||||
Long userId = cont.getVascUserRoleController().getUserId();
|
||||
entry.setEntryParameter(name, userId);
|
||||
}
|
||||
} else {
|
||||
String userName = cont.getVascUserRoleController().getUserName();
|
||||
entry.setEntryParameter(name, userName);
|
||||
}
|
||||
entry.setEntryParameter(name, "userPara:"+type+":"+value);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -92,4 +78,6 @@ public class SetParameterElement extends AbstractElement {
|
|||
|
||||
throw new ElementException("Could not set dataParameter: "+name+" with type: "+type);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* 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.x4o;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.actions.ColumnVascAction;
|
||||
import com.idcanet.vasc.core.actions.GlobalVascAction;
|
||||
import com.idcanet.vasc.core.actions.RowVascAction;
|
||||
|
||||
import com.idcanet.x4o.core.X4OParser;
|
||||
import com.idcanet.x4o.element.AbstractElement;
|
||||
import com.idcanet.x4o.element.ElementException;
|
||||
|
||||
/**
|
||||
* Handed the eventListener xml tag.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 18, 2010
|
||||
*/
|
||||
public class VascEntryActionElement extends AbstractElement {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElement#doElementRun()
|
||||
*/
|
||||
@Override
|
||||
public void doElementRun() throws ElementException {
|
||||
String clazz = getAttributes().get("class");
|
||||
String type = getAttributes().get("type");
|
||||
String frontendType = getAttributes().get("frontendType");
|
||||
if (clazz==null) {
|
||||
throw new ElementException("No class attribute given.");
|
||||
}
|
||||
if (clazz.isEmpty()) {
|
||||
throw new ElementException("class attribute is empty.");
|
||||
}
|
||||
if (getParent().getElementObject() instanceof VascEntry==false) {
|
||||
throw new ElementException("Parent object is not vasc entry.");
|
||||
}
|
||||
VascEntry v = (VascEntry)getParent().getElementObject();
|
||||
if ("backend".equalsIgnoreCase(type)) {
|
||||
Object obj = null;
|
||||
try {
|
||||
Class<?> clazz2 = X4OParser.loadClass(clazz);
|
||||
obj = clazz2.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new ElementException("Could not load class: "+clazz);
|
||||
}
|
||||
if (obj instanceof RowVascAction) {
|
||||
v.addRowAction((RowVascAction)obj);
|
||||
}
|
||||
if (obj instanceof ColumnVascAction) {
|
||||
v.addColumnAction((ColumnVascAction)obj);
|
||||
}
|
||||
if (obj instanceof GlobalVascAction) {
|
||||
v.addGlobalAction((GlobalVascAction)obj);
|
||||
}
|
||||
} else if ("frontend".equalsIgnoreCase(type)) {
|
||||
v.addVascEntryFrontendAction(clazz, frontendType);
|
||||
} else {
|
||||
throw new ElementException("Unsupported type attribute: "+type);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* 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.x4o;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
|
||||
import com.idcanet.x4o.element.AbstractElement;
|
||||
import com.idcanet.x4o.element.ElementException;
|
||||
|
||||
/**
|
||||
* Handed the eventListener xml tag.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 18, 2010
|
||||
*/
|
||||
public class VascEventListenerElement extends AbstractElement {
|
||||
|
||||
/**
|
||||
* @see com.idcanet.x4o.element.AbstractElement#doElementRun()
|
||||
*/
|
||||
@Override
|
||||
public void doElementRun() throws ElementException {
|
||||
String clazz = getAttributes().get("class");
|
||||
String type = getAttributes().get("type");
|
||||
String frontendType = getAttributes().get("frontendType");
|
||||
if (clazz==null) {
|
||||
throw new ElementException("No class attribute given.");
|
||||
}
|
||||
if (clazz.isEmpty()) {
|
||||
throw new ElementException("class attribute is empty.");
|
||||
}
|
||||
if (getParent().getElementObject() instanceof VascEntry==false) {
|
||||
throw new ElementException("Parent object is not vasc entry.");
|
||||
}
|
||||
VascEntry v = (VascEntry)getParent().getElementObject();
|
||||
if ("backend".equalsIgnoreCase(type)) {
|
||||
v.addVascEntryBackendEventListener(clazz);
|
||||
} else if ("frontend".equalsIgnoreCase(type)) {
|
||||
v.addVascEntryFrontendEventListener(clazz, frontendType);
|
||||
} else {
|
||||
throw new ElementException("Unsupported type attribute: "+type);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,6 +22,8 @@
|
|||
<eld:elementClassAttributeConverter attributeName="vascEntryFieldType" bean.class="com.idcanet.vasc.impl.x4o.VascEntryFieldTypeAttributeConverter"/>
|
||||
</eld:elementClass>
|
||||
<eld:elementClass tag="vascEntryFieldType" elementClassName="com.idcanet.vasc.impl.x4o.VascEntryFieldTypeElement"/>
|
||||
<eld:elementClass tag="eventListener" elementClassName="com.idcanet.vasc.impl.x4o.VascEventListenerElement"/>
|
||||
<eld:elementClass tag="entryAction" elementClassName="com.idcanet.vasc.impl.x4o.VascEntryActionElement"/>
|
||||
|
||||
<eld:elementClass tag="vascSelectItemModel" objectClassName="com.idcanet.vasc.impl.DefaultVascSelectItemModel"/>
|
||||
<eld:elementClass tag="vascSelectItemEntryParameter" elementClassName="com.idcanet.vasc.impl.x4o.VascLinkEntryParameterElement"/>
|
||||
|
|
|
@ -49,11 +49,13 @@ import javax.persistence.EntityManager;
|
|||
|
||||
import com.idcanet.vasc.backends.jpa.EntityManagerProvider;
|
||||
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.impl.DefaultVascBackedEntryFinalizer;
|
||||
import com.idcanet.vasc.impl.DefaultVascEntryController;
|
||||
import com.idcanet.vasc.impl.DefaultVascFactory;
|
||||
import com.idcanet.vasc.impl.VascBackendProxyEventExecutor;
|
||||
import com.idcanet.vasc.impl.actions.AddRowAction;
|
||||
import com.idcanet.vasc.impl.actions.CSVExportGlobalAction;
|
||||
import com.idcanet.vasc.impl.actions.DeleteRowAction;
|
||||
|
@ -91,18 +93,16 @@ public class VascServiceManagerImpl implements VascServiceManager.IRemote,VascSe
|
|||
@PostConstruct
|
||||
public void loadAll() {
|
||||
logger.fine("VascServiceManager created now loading resources...");
|
||||
try {
|
||||
long s = System.currentTimeMillis();
|
||||
|
||||
try {
|
||||
Map<String,String> keys = loadKeys();
|
||||
for (String key:keys.keySet()) {
|
||||
String value = keys.get(key);
|
||||
if ("persistenceUnit".equals(key)) {
|
||||
logger.info("getting EntityManager: "+value);
|
||||
logger.fine("getting EntityManager: "+value);
|
||||
entityManager = (EntityManager)new InitialContext().lookup(value);
|
||||
}
|
||||
if ("xpqlController".equals(key)) {
|
||||
logger.info("getting XpqlQueryManagerLocal: "+value);
|
||||
logger.fine("getting XpqlQueryManagerLocal: "+value);
|
||||
xpqlController = (XpqlQueryManager)new InitialContext().lookup(value);
|
||||
}
|
||||
if ("i18nBundle".equals(key)) {
|
||||
|
@ -119,9 +119,10 @@ public class VascServiceManagerImpl implements VascServiceManager.IRemote,VascSe
|
|||
if (resourceBundle==null) {
|
||||
new NullPointerException("Have no resourceBundle");
|
||||
}
|
||||
long s = System.currentTimeMillis();
|
||||
|
||||
// get local jvm plugging controller
|
||||
VascController c = DefaultVascFactory.getDefaultVascController(22l, "test", "login");
|
||||
VascController c = DefaultVascFactory.getDefaultVascController(0l, "nobody", "NO_ROLE");
|
||||
|
||||
for (String key:keys.keySet()) {
|
||||
String value = keys.get(key);
|
||||
|
@ -357,8 +358,8 @@ public class VascServiceManagerImpl implements VascServiceManager.IRemote,VascSe
|
|||
try {
|
||||
// fill stuff in all global entry'ies
|
||||
for (String id:c.getVascEntryController().getVascEntryIds()) {
|
||||
VascEntry entry = ((DefaultVascEntryController)c.getVascEntryController()).getRealVascEntryById(id);
|
||||
if (entry.isVascDisplayOnly()==false) {
|
||||
VascEntry entry = ((DefaultVascEntryController)c.getVascEntryController()).getRealVascEntryById(id);
|
||||
if (entry.isVascDisplayOnly()==false) {
|
||||
if (entry.isVascAdminCreate()) {
|
||||
entry.addRowAction(new AddRowAction());
|
||||
}
|
||||
|
@ -391,9 +392,14 @@ public class VascServiceManagerImpl implements VascServiceManager.IRemote,VascSe
|
|||
// this is temp untill x4o templaing
|
||||
DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
|
||||
f.finalizeVascEntry(entry, c);
|
||||
|
||||
// execute backend event listeners
|
||||
VascBackend vb = c.getVascBackendController().getVascBackendById(entry.getBackendId());
|
||||
vb = new VascBackendProxyEventExecutor(vb,entry);
|
||||
((VascBackendControllerLocal)c.getVascBackendController()).addVascBackend(vb);
|
||||
}
|
||||
|
||||
logger.info("VASC COMPLEET LETS RETURN.");
|
||||
logger.finer("Done final config vascController: "+c);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -98,6 +98,13 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
this.parent=parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontend#getFrontendType()
|
||||
*/
|
||||
public String getFrontendType() {
|
||||
return "swing";
|
||||
}
|
||||
|
||||
/**
|
||||
* Add swing implmented ui components
|
||||
*/
|
||||
|
@ -686,15 +693,12 @@ class SpringUtilities {
|
|||
* @param yPad
|
||||
* y padding between cells
|
||||
*/
|
||||
public static void makeGrid(Container parent, int rows, int cols,
|
||||
int initialX, int initialY, int xPad, int yPad) {
|
||||
public static void makeGrid(Container parent, int rows, int cols,int initialX, int initialY, int xPad, int yPad) {
|
||||
SpringLayout layout;
|
||||
try {
|
||||
layout = (SpringLayout) parent.getLayout();
|
||||
} catch (ClassCastException exc) {
|
||||
System.err
|
||||
.println("The first argument to makeGrid must use SpringLayout.");
|
||||
return;
|
||||
throw new IllegalArgumentException("parent container has not StringLayout layoutmanager.");
|
||||
}
|
||||
|
||||
Spring xPadSpring = Spring.constant(xPad);
|
||||
|
@ -788,15 +792,12 @@ class SpringUtilities {
|
|||
* @param yPad
|
||||
* y padding between cells
|
||||
*/
|
||||
public static void makeCompactGrid(Container parent, int rows, int cols,
|
||||
int initialX, int initialY, int xPad, int yPad) {
|
||||
public static void makeCompactGrid(Container parent, int rows, int cols,int initialX, int initialY, int xPad, int yPad) {
|
||||
SpringLayout layout;
|
||||
try {
|
||||
layout = (SpringLayout) parent.getLayout();
|
||||
} catch (ClassCastException exc) {
|
||||
System.err
|
||||
.println("The first argument to makeCompactGrid must use SpringLayout.");
|
||||
return;
|
||||
throw new IllegalArgumentException("parent container has not StringLayout layoutmanager.");
|
||||
}
|
||||
|
||||
//Align all cells in each column and make them the same width.
|
||||
|
|
|
@ -104,6 +104,13 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
this.parent=parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontend#getFrontendType()
|
||||
*/
|
||||
public String getFrontendType() {
|
||||
return "swt";
|
||||
}
|
||||
|
||||
/**
|
||||
* Add swt implmented ui components
|
||||
*/
|
||||
|
|
|
@ -51,13 +51,17 @@ import com.idcanet.vasc.core.VascEntryControllerLocal;
|
|||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.VascFrontendData;
|
||||
import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
|
||||
import com.idcanet.vasc.ejb3.VascServiceManager;
|
||||
import com.idcanet.vasc.impl.DefaultVascBackedEntryFinalizer;
|
||||
import com.idcanet.vasc.impl.DefaultVascEntryState;
|
||||
import com.idcanet.vasc.impl.DefaultVascFactory;
|
||||
import com.idcanet.vasc.impl.VascBackendProxyEventExecutor;
|
||||
import com.idcanet.vasc.impl.entry.DefaultVascEntryResourceResolver;
|
||||
import com.idcanet.vasc.impl.entry.SetParameterBackendListener;
|
||||
|
||||
/**
|
||||
* Base faces session object for managing vasc entries.
|
||||
|
@ -175,6 +179,9 @@ abstract public class AbstractJSFVascFacesController {
|
|||
VascEntry entry = getVascController().getVascEntryController().getVascEntryById(entryId);
|
||||
entry.setVascFrontendData(getNewVascFrontendData());
|
||||
entry.getVascFrontendData().setVascController(getVascController());
|
||||
VascBackend backend = DefaultVascFactory.getProxyVascBackend(entry);
|
||||
entry.getVascFrontendData().getVascEntryState().setVascBackend(backend);
|
||||
entry.getVascFrontendData().getVascEntryState().setVascEntry(entry);
|
||||
|
||||
// copy para
|
||||
if (para!=null) {
|
||||
|
@ -187,8 +194,7 @@ abstract public class AbstractJSFVascFacesController {
|
|||
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
|
||||
return entry.getVascFrontendData().getVascEntryState().getEntryDataList();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ArrayList<Object>(0);
|
||||
throw new RuntimeException("Could not execute list: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,6 +392,31 @@ abstract public class AbstractJSFVascFacesController {
|
|||
VascEntry ve = vascManager.getVascEntry(id);
|
||||
String backendId = ve.getBackendId();
|
||||
VascBackend vb = new RemoteVascBackend(backendId,vascManager);
|
||||
|
||||
for (String key:ve.getEntryParameterKeys()) {
|
||||
Object value = ve.getEntryParameter(key);
|
||||
if (value instanceof String==false) {
|
||||
continue;
|
||||
}
|
||||
String paraValue = (String)value;
|
||||
if (paraValue.startsWith("userPara")==false) {
|
||||
continue;
|
||||
}
|
||||
String[] ps = paraValue.split(":");
|
||||
String type = ps[1];
|
||||
String paraTypeValue = ps[2];
|
||||
|
||||
SetParameterBackendListener listener = new SetParameterBackendListener(vui.userId,vui.username);
|
||||
listener.setName(key);
|
||||
listener.setType(type);
|
||||
// listener.setValue(paraTypeValue);
|
||||
|
||||
List<VascEntryBackendEventListener> listeners=new ArrayList<VascEntryBackendEventListener>(10);
|
||||
listeners.add(listener);
|
||||
vb = new VascBackendProxyEventExecutor(vb,ve,listeners);
|
||||
}
|
||||
|
||||
|
||||
localBackendController.addVascBackend(vb);
|
||||
|
||||
DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
|
||||
|
|
|
@ -153,7 +153,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
try {
|
||||
result = ve.getDisplayValue(v, row);
|
||||
} catch (VascException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Could not get parent name DisplayValue: "+e.getMessage(),e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
try {
|
||||
result = ve.getDisplayValue(v, row);
|
||||
} catch (VascException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Could not get selected name DisplayValue: "+e.getMessage(),e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -528,8 +528,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
}
|
||||
state.getMultiActionSelection().clear(); // after down deselect all options
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Could not do multirowaction",e);
|
||||
} finally {
|
||||
vascEntry=null;
|
||||
}
|
||||
|
@ -606,15 +605,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
|
||||
// select record to edit
|
||||
Object rowObject = entry.getVascFrontendData().getVascEntryState().getParent().getEntryDataObject();
|
||||
//String idField = entry.getVascFrontendData().getVascEntryState().getParent().getVascEntry().getPrimaryKeyFieldId();
|
||||
// VascEntryField field = entry.getVascFrontendData().getVascEntryState().getParent().getVascEntry().getVascEntryFieldById(idField);
|
||||
// try {
|
||||
// Object id = field.getVascEntryFieldValue().getValue(field, rowObject);
|
||||
comp.initGoto(entry.getVascFrontendData().getVascEntryState().getParent(),rowObject);
|
||||
// } catch (VascException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
// e1.printStackTrace();
|
||||
//}
|
||||
comp.initGoto(entry.getVascFrontendData().getVascEntryState().getParent(),rowObject);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -57,7 +57,15 @@ public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Ser
|
|||
logger = Logger.getLogger(JSFVascFrontendRenderer.class.getName());
|
||||
}
|
||||
|
||||
// Frontend Stuff
|
||||
// Frontend Stuff
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontend#getFrontendType()
|
||||
*/
|
||||
public String getFrontendType() {
|
||||
return "jsf";
|
||||
}
|
||||
|
||||
|
||||
protected void addUiComponents() {
|
||||
VascFrontendData vfd = getVascEntry().getVascFrontendData();
|
||||
|
|
|
@ -217,7 +217,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
try {
|
||||
renderer.initEntry(entry);
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
throw new RuntimeException("Could not initEntry: "+e.getMessage(),e);
|
||||
}
|
||||
supportBean = new JSFVascEntrySupportBean(entry);
|
||||
// copy search string for preadded search string from application layer
|
||||
|
@ -243,7 +243,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(rowObject);
|
||||
entry.getVascFrontendData().getVascFrontend().renderEdit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Could not renderEdit: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,10 +324,11 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
throw new NullPointerException("Could not locate '"+entryName+"' from : "+vascController);
|
||||
}
|
||||
|
||||
frontendData.setVascFrontend(null); // reset data obj. todo rm this.
|
||||
frontendData.setVascController(vascController);
|
||||
entry.setVascFrontendData(frontendData);
|
||||
try {
|
||||
frontendData.initFrontendListeners(entry);
|
||||
frontendData.initFrontendListeners(entry,"jsf");
|
||||
} catch (InstantiationException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
|
@ -385,7 +386,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
entry.getVascFrontendData().addVascEntryFrontendEventListener(new CreateEntryFieldValuesListener2(fieldId,selectedValue));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("error: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -166,8 +166,11 @@ public class JSFVascUIComponentRenderer extends Renderer {
|
|||
|
||||
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(grid);
|
||||
VascEntry entry = comp.getVascEntry();
|
||||
if (entry==null) {
|
||||
throw new NullPointerException("No parent vasc component found.");
|
||||
}
|
||||
|
||||
String entrySupportVar = (String)comp.getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY);
|
||||
|
||||
int column = 0;
|
||||
for (VascEntryField c:entry.getVascEntryFields()) {
|
||||
if (entry.getVascFrontendData().getVascFrontendHelper().renderEdit(c)==false) {
|
||||
|
|
|
@ -207,7 +207,7 @@ public class OldVascUIComponent extends UIComponentBase {
|
|||
ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), vascFrontendData.getExpressionString(), VascFrontendData.class);
|
||||
VascFrontendData frontendData = (VascFrontendData)ve2.getValue(FacesContext.getCurrentInstance().getELContext());
|
||||
try {
|
||||
frontendData.initFrontendListeners(entry);
|
||||
frontendData.initFrontendListeners(entry,"jsf");
|
||||
} catch (InstantiationException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
@ -1597,6 +1597,13 @@ class JSFFrontendRenderer extends AbstractVascFrontend implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.VascFrontend#getFrontendType()
|
||||
*/
|
||||
public String getFrontendType() {
|
||||
return "jsf";
|
||||
}
|
||||
|
||||
// Frontend Stuff
|
||||
|
||||
protected void addUiComponents() {
|
||||
|
|
Loading…
Reference in a new issue