wip made remote ejb working over http
This commit is contained in:
parent
d4e537a2bf
commit
2a0d992642
393 changed files with 8916 additions and 3872 deletions
|
|
@ -3,7 +3,7 @@
|
|||
<parent>
|
||||
<artifactId>vasc-frontend</artifactId>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<version>0.4.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>vasc-frontend-web-jsf</artifactId>
|
||||
<name>vasc-frontend-web-jsf</name>
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-ejb3</artifactId>
|
||||
<artifactId>vasc-core-ejb3-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
|
|
|||
|
|
@ -23,22 +23,23 @@
|
|||
package net.forwardfire.vasc.frontend.web.jsf;
|
||||
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendController;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendException;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.impl.entry.DefaultVascEntryResourceResolver;
|
||||
import net.forwardfire.vasc.impl.x4o.VascParser;
|
||||
|
||||
|
||||
|
|
@ -142,7 +143,7 @@ abstract public class AbstractJSFVascFacesControllerLocal extends AbstractJSFVas
|
|||
VascParser vp = new VascParser(c);
|
||||
for (String name:vascGlobalELBeans.keySet()) {
|
||||
Object value = vascGlobalELBeans.get(name);
|
||||
vp.addGlobalELBean(name, value);
|
||||
vp.addELBean(name, value);
|
||||
}
|
||||
vp.parseResource(res);
|
||||
}
|
||||
|
|
@ -150,8 +151,20 @@ abstract public class AbstractJSFVascFacesControllerLocal extends AbstractJSFVas
|
|||
|
||||
vascController = c;
|
||||
return vascController;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not create remote based vasc controller; "+e.getMessage(),e);
|
||||
} catch (VascException e) {
|
||||
throw new VascFrontendException(e);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new VascFrontendException(e);
|
||||
} catch (SecurityException e) {
|
||||
throw new VascFrontendException(e);
|
||||
} catch (NullPointerException e) {
|
||||
throw new VascFrontendException(e);
|
||||
} catch (ParserConfigurationException e) {
|
||||
throw new VascFrontendException(e);
|
||||
} catch (SAXException e) {
|
||||
throw new VascFrontendException(e);
|
||||
} catch (IOException e) {
|
||||
throw new VascFrontendException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
package net.forwardfire.vasc.frontend.web.jsf;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
|
@ -54,9 +55,11 @@ import net.forwardfire.vasc.core.VascEntryField;
|
|||
import net.forwardfire.vasc.core.VascEntryState;
|
||||
import net.forwardfire.vasc.core.VascEntryLink;
|
||||
import net.forwardfire.vasc.core.VascEntryLinkType;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendException;
|
||||
import net.forwardfire.vasc.impl.actions.AddRowAction;
|
||||
import net.forwardfire.vasc.impl.actions.DeleteRowAction;
|
||||
import net.forwardfire.vasc.impl.actions.EditRowAction;
|
||||
|
|
@ -319,9 +322,9 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
Object parentSelected = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
|
||||
logger.fine("parentCustomRowaction do on: "+action+" parentSelection: "+parentSelected);
|
||||
try {
|
||||
action.doRowAction(parent,parentSelected);
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
action.doRowAction(parent,parentSelected);
|
||||
} catch (VascException e) {
|
||||
throw new VascFrontendException(e);
|
||||
}
|
||||
logger.fine("parentCustomRowaction DONE");
|
||||
}
|
||||
|
|
@ -383,12 +386,12 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
this.actionId=actionId;
|
||||
}
|
||||
public void beforePhase(PhaseEvent PhaseEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
public void afterPhase(PhaseEvent PhaseEvent) {
|
||||
if (vascEntry==null) {
|
||||
return;
|
||||
}
|
||||
public void afterPhase(PhaseEvent PhaseEvent) {
|
||||
if (vascEntry==null) {
|
||||
return;
|
||||
}
|
||||
RowVascAction action = vascEntry.getRowActionById(actionId);
|
||||
VascEntryState state = vascEntry.getVascFrontendController().getVascEntryState();
|
||||
|
||||
|
|
@ -413,11 +416,11 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
} finally {
|
||||
vascEntry=null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public PhaseId getPhaseId(){
|
||||
return PhaseId.UPDATE_MODEL_VALUES;
|
||||
}
|
||||
public PhaseId getPhaseId(){
|
||||
return PhaseId.UPDATE_MODEL_VALUES;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -459,11 +462,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
logger.fine("backAction");
|
||||
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
|
||||
comp.initGoto(entry.getVascFrontendController().getVascEntryState().getParent());
|
||||
try {
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
}
|
||||
|
||||
public void backEditAction(ActionEvent event) {
|
||||
|
|
@ -495,11 +494,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
pageIndex++;
|
||||
selectedDirectPage=pageIndex+"";
|
||||
entry.getVascFrontendController().getVascFrontendActions().pageAction(pageIndex);
|
||||
try {
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
}
|
||||
|
||||
public void pagePreviousAction(ActionEvent event) {
|
||||
|
|
@ -511,11 +506,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
pageIndex--;
|
||||
selectedDirectPage=pageIndex+"";
|
||||
entry.getVascFrontendController().getVascFrontendActions().pageAction(pageIndex);
|
||||
try {
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
}
|
||||
|
||||
public boolean getHasPageNextAction() {
|
||||
|
|
@ -546,8 +537,8 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
} else {
|
||||
action.doRowAction(entry, selected.getRecord());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
} catch (VascException e) {
|
||||
throw new VascFrontendException(e);
|
||||
}
|
||||
logger.fine("RowAction DONE");
|
||||
}
|
||||
|
|
@ -560,8 +551,8 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
GlobalVascAction action = entry.getGlobalActionById(id);
|
||||
try {
|
||||
action.doGlobalAction(entry);
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
} catch (VascException e) {
|
||||
throw new VascFrontendException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -573,8 +564,8 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
RowVascAction action = entry.getRowActionById("addRowAction");
|
||||
try {
|
||||
action.doRowAction(entry, null);
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
} catch (VascException e) {
|
||||
throw new VascFrontendException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -588,11 +579,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
entry.getVascFrontendController().getVascEntryState().setEntryDataObject(selected.getRecord());
|
||||
VascEntryLink l = entry.getVascEntryLinkById(linkId);
|
||||
comp.initGoto(l);
|
||||
try {
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
this.selected=selected; // renderView clears selected !
|
||||
}
|
||||
|
||||
|
|
@ -618,11 +605,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
VascEntry entry = comp.getVascEntry();
|
||||
VascEntryLink l = entry.getVascEntryLinkById(linkId);
|
||||
comp.initGoto(l);
|
||||
try {
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
this.selected=selected; // renderView clears selected !
|
||||
}
|
||||
|
||||
|
|
@ -637,11 +620,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
int index = comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent().getEntryDataList().indexOf(o);
|
||||
VascDataBackendBean selected = new VascDataBackendBean(entry,o,index);
|
||||
this.selected=selected;
|
||||
try {
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
this.selected=selected;
|
||||
}
|
||||
|
||||
|
|
@ -653,11 +632,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
getSelected().setRealValue(false);
|
||||
}
|
||||
entry.getVascFrontendController().getVascEntryState().setEntryDataObject(null);
|
||||
try {
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
}
|
||||
|
||||
public void saveAction(ActionEvent event) {
|
||||
|
|
@ -681,17 +656,13 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
|
||||
entry.getVascFrontendController().getVascEntryState().setEntryDataObject(selected.getRecord());
|
||||
|
||||
if (entry.getVascFrontendController().getVascEntryState().isEditCreate()) {
|
||||
entry.getVascFrontendController().getVascFrontendActions().persistObject();
|
||||
} else {
|
||||
entry.getVascFrontendController().getVascFrontendActions().mergeObject();
|
||||
}
|
||||
|
||||
try {
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
if (entry.getVascFrontendController().getVascEntryState().isEditCreate()) {
|
||||
entry.getVascFrontendController().getVascFrontendActions().persistObject();
|
||||
} else {
|
||||
entry.getVascFrontendController().getVascFrontendActions().mergeObject();
|
||||
}
|
||||
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
}
|
||||
|
||||
public void deleteAction(ActionEvent event) {
|
||||
|
|
@ -719,11 +690,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
entry.getVascFrontendController().getVascFrontendActions().deleteObject();
|
||||
}
|
||||
|
||||
try {
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
}
|
||||
|
||||
public void processDirectDownloadChange(ValueChangeEvent event){
|
||||
|
|
@ -750,8 +717,8 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
GlobalVascAction action = entry.getExportActionById(id);
|
||||
try {
|
||||
action.doGlobalAction(entry);
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
} catch (VascException e1) {
|
||||
throw new VascFrontendException(e1);
|
||||
}
|
||||
|
||||
// restore normal view for next request.
|
||||
|
|
@ -775,9 +742,11 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
ServletOutputStream out = response.getOutputStream();
|
||||
|
||||
ex.doExport(out, entry);
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
out.close();
|
||||
} catch (VascException e) {
|
||||
throw new VascFrontendException(e);
|
||||
} catch (IOException e) {
|
||||
throw new VascFrontendException(e);
|
||||
} finally {
|
||||
fc.responseComplete();
|
||||
}
|
||||
|
|
@ -806,12 +775,8 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
logger.fine("directPageChangeAction id: "+id);
|
||||
//selectedDirectPage = "null";
|
||||
|
||||
try {
|
||||
entry.getVascFrontendController().getVascFrontendActions().pageAction(new Integer(id));
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
}
|
||||
entry.getVascFrontendController().getVascFrontendActions().pageAction(new Integer(id));
|
||||
entry.getVascFrontendController().getVascFrontend().renderView();
|
||||
}
|
||||
|
||||
// Pure get/setters
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import javax.faces.context.FacesContext;
|
|||
|
||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
||||
import net.forwardfire.vasc.frontend.AbstractVascFrontend;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendException;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendController;
|
||||
import net.forwardfire.vasc.frontend.web.jsf.ui.JSFBoolean;
|
||||
import net.forwardfire.vasc.frontend.web.jsf.ui.JSFLabel;
|
||||
|
|
@ -85,7 +86,7 @@ public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Ser
|
|||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#renderDelete(java.lang.Object)
|
||||
*/
|
||||
public void renderDelete() throws Exception {
|
||||
public void renderDelete() throws VascFrontendException {
|
||||
logger.finer("renderDelete");
|
||||
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
|
||||
JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId());
|
||||
|
|
@ -95,7 +96,7 @@ public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Ser
|
|||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#renderEdit(java.lang.Object)
|
||||
*/
|
||||
public void renderEdit() throws Exception {
|
||||
public void renderEdit() throws VascFrontendException {
|
||||
logger.finer("renderEdit");
|
||||
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
|
||||
JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId());
|
||||
|
|
@ -117,7 +118,7 @@ public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Ser
|
|||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#renderExport(net.forwardfire.vasc.core.entry.VascEntryExporter)
|
||||
*/
|
||||
public void renderExport(VascEntryExporter exporter) throws Exception {
|
||||
public void renderExport(VascEntryExporter exporter) throws VascFrontendException {
|
||||
logger.finer("renderExport");
|
||||
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
|
||||
JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId());
|
||||
|
|
@ -128,7 +129,7 @@ public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Ser
|
|||
/**
|
||||
* @see net.forwardfire.vasc.frontend.VascFrontend#renderView()
|
||||
*/
|
||||
public void renderView() throws Exception {
|
||||
public void renderView() throws VascFrontendException {
|
||||
logger.finer("renderView");
|
||||
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
|
||||
JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId());
|
||||
|
|
|
|||
|
|
@ -39,11 +39,12 @@ import net.forwardfire.vasc.core.VascEntry;
|
|||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryState;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.VascEntryLink;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendController;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendException;
|
||||
import net.forwardfire.vasc.frontend.web.jsf.ui.JSFListModel;
|
||||
|
||||
/**
|
||||
|
|
@ -357,7 +358,8 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected);
|
||||
|
||||
// set data parameter on new vasc entry
|
||||
entry.getVascFrontendController().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue);
|
||||
//was; entry.getVascFrontendController().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue);
|
||||
entry.setEntryParameter(parameterName, selectedValue);
|
||||
logger.fine("Setting link parameter: "+parameterName+" with: "+selectedValue);
|
||||
}
|
||||
|
||||
|
|
@ -404,7 +406,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
try {
|
||||
field.getVascEntryFieldValue().setValue(field, data, value);
|
||||
} catch (VascException e) {
|
||||
entry.getVascFrontendController().getVascFrontendHelper().handleException(entry, e);
|
||||
throw new VascFrontendException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,13 +64,13 @@ import javax.faces.validator.ValidatorException;
|
|||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryListOption;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.VascEntryLink;
|
||||
import net.forwardfire.vasc.core.VascEntryLinkType;
|
||||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||
import net.forwardfire.vasc.core.ui.VascOptionValueModelListener;
|
||||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||
import net.forwardfire.vasc.core.ui.VascValueModel;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.impl.actions.AddRowAction;
|
||||
|
||||
|
||||
|
|
@ -115,35 +115,33 @@ public class JSFVascUIComponentRenderer extends Renderer {
|
|||
view.encodeAll(facesContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeEnd(FacesContext facesContext,UIComponent component) throws IOException {
|
||||
ResponseWriter writer = facesContext.getResponseWriter();
|
||||
writer.endElement("div");
|
||||
}
|
||||
|
||||
|
||||
// ========== All private
|
||||
|
||||
|
||||
private void injectAll(FacesContext context,JSFVascUIComponent comp,boolean clean) {
|
||||
|
||||
String injectEditFieldsId = (String)comp.getAttributes().get(JSFVascUIComponent.INJECT_EDIT_FIELDS_ID);
|
||||
String injectTableOptionsId = (String)comp.getAttributes().get(JSFVascUIComponent.INJECT_TABLE_OPTIONS_ID);
|
||||
String injectTableColumnsId = (String)comp.getAttributes().get(JSFVascUIComponent.INJECT_TABLE_COLUMNS_ID);
|
||||
|
||||
UIComponent injectEditFieldsComponent = JSFVascUIComponent.findComponentById(comp.getFacet("editView"),injectEditFieldsId);
|
||||
UIComponent injectTableOptionsComponent = JSFVascUIComponent.findComponentById(comp.getFacet("listView"),injectTableOptionsId);
|
||||
UIComponent injectTableColumnsComponent = JSFVascUIComponent.findComponentById(comp.getFacet("listView"),injectTableColumnsId);
|
||||
if (injectEditFieldsComponent==null) {
|
||||
throw new NullPointerException("Could not find injectEditFieldsId: "+injectEditFieldsId);
|
||||
}
|
||||
if (injectTableOptionsComponent==null) {
|
||||
throw new NullPointerException("Could not find injectTableOptionsId: "+injectTableOptionsId);
|
||||
}
|
||||
if (injectTableColumnsComponent==null) {
|
||||
throw new NullPointerException("Could not find injectTableColumnsId: "+injectTableColumnsId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeEnd(FacesContext facesContext,UIComponent component) throws IOException {
|
||||
ResponseWriter writer = facesContext.getResponseWriter();
|
||||
writer.endElement("div");
|
||||
}
|
||||
|
||||
// ========== All private
|
||||
|
||||
private void injectAll(FacesContext context,JSFVascUIComponent comp,boolean clean) {
|
||||
|
||||
String injectEditFieldsId = (String)comp.getAttributes().get(JSFVascUIComponent.INJECT_EDIT_FIELDS_ID);
|
||||
String injectTableOptionsId = (String)comp.getAttributes().get(JSFVascUIComponent.INJECT_TABLE_OPTIONS_ID);
|
||||
String injectTableColumnsId = (String)comp.getAttributes().get(JSFVascUIComponent.INJECT_TABLE_COLUMNS_ID);
|
||||
|
||||
UIComponent injectEditFieldsComponent = JSFVascUIComponent.findComponentById(comp.getFacet("editView"),injectEditFieldsId);
|
||||
UIComponent injectTableOptionsComponent = JSFVascUIComponent.findComponentById(comp.getFacet("listView"),injectTableOptionsId);
|
||||
UIComponent injectTableColumnsComponent = JSFVascUIComponent.findComponentById(comp.getFacet("listView"),injectTableColumnsId);
|
||||
if (injectEditFieldsComponent==null) {
|
||||
throw new NullPointerException("Could not find injectEditFieldsId: "+injectEditFieldsId);
|
||||
}
|
||||
if (injectTableOptionsComponent==null) {
|
||||
throw new NullPointerException("Could not find injectTableOptionsId: "+injectTableOptionsId);
|
||||
}
|
||||
if (injectTableColumnsComponent==null) {
|
||||
throw new NullPointerException("Could not find injectTableColumnsId: "+injectTableColumnsId);
|
||||
}
|
||||
|
||||
if (clean) {
|
||||
logger.finer("Cleaning of all dynamic JSF components.");
|
||||
injectEditFieldsComponent.getChildren().clear();
|
||||
|
|
@ -158,8 +156,8 @@ public class JSFVascUIComponentRenderer extends Renderer {
|
|||
} catch (Exception e) {
|
||||
throw new RuntimeException("Error while injecting; "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String i18n(VascEntry entry,String key,Object...params) {
|
||||
return entry.getVascFrontendController().getVascEntryResourceResolver().getTextValue(key,params);
|
||||
}
|
||||
|
|
@ -175,55 +173,52 @@ public class JSFVascUIComponentRenderer extends Renderer {
|
|||
if (entry==null) {
|
||||
throw new NullPointerException("No parent vasc component found.");
|
||||
}
|
||||
|
||||
|
||||
String entrySupportVar = (String)comp.getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY);
|
||||
for (VascEntryField c:entry.getVascEntryFields()) {
|
||||
for (VascEntryField c:entry.getVascEntryFields()) {
|
||||
if (entry.getVascFrontendController().getVascFrontendDataSelector().isFieldEdit(c)==false) {
|
||||
continue;
|
||||
}
|
||||
for (int i=0;i<c.getVascEntryFieldType().getUIComponentCount(c);i++) {
|
||||
|
||||
VascUIComponent label = c.getVascEntryFieldType().provideLabelUIComponent(i,c);
|
||||
VascValueModel model = new VascValueModel();
|
||||
model.setValue(i18n(entry,c.getName()));
|
||||
label.createComponent(entry,c,model,grid);
|
||||
|
||||
VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c);
|
||||
model = new VascValueModel(c.getVascEntryFieldType().provideEditorVascValueModel(i,c));
|
||||
//model.setValue(c.getVascEntryFieldValue().getValue(c, bean));
|
||||
//model.addListener(new VascColumnValueModelListener(c,bean));
|
||||
UIInput jsfEdit = (UIInput)editor.createComponent(entry,c,model,grid);
|
||||
jsfEdit.addValidator(new VascJSFInputValidator2(c.getId()));
|
||||
|
||||
int index = VascDataBackendBean.getIndexId(c);
|
||||
|
||||
ValueExpression ve7 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".selected.field"+index+"}", Object.class);
|
||||
jsfEdit.setValueExpression("value", ve7);
|
||||
|
||||
|
||||
ValueExpression ve8 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".selected != null}", Boolean.class);
|
||||
jsfEdit.setValueExpression("rendered", ve8);
|
||||
|
||||
HtmlMessage message = (HtmlMessage)application.createComponent(HtmlMessage.COMPONENT_TYPE);
|
||||
message.setId(viewRoot.createUniqueId());
|
||||
message.setFor(jsfEdit.getId());
|
||||
|
||||
message.setErrorClass("style_textBlue");
|
||||
message.setFatalClass("style_textRed");
|
||||
message.setInfoClass("style_textBlack");
|
||||
message.setWarnClass("style_textGreen");
|
||||
|
||||
grid.getChildren().add(message);
|
||||
|
||||
//column++;
|
||||
// i==0 is for multi field editor support... which is still very in progress
|
||||
if (i==0) {
|
||||
entry.getVascFrontendController().addFieldVascUIComponents(c, editor,jsfEdit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i=0;i<c.getVascEntryFieldType().getUIComponentCount(c);i++) {
|
||||
|
||||
VascUIComponent label = c.getVascEntryFieldType().provideLabelUIComponent(i,c);
|
||||
VascValueModel model = new VascValueModel();
|
||||
model.setValue(i18n(entry,c.getName()));
|
||||
label.createComponent(entry,c,model,grid);
|
||||
|
||||
VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c);
|
||||
model = new VascValueModel(c.getVascEntryFieldType().provideEditorVascValueModel(i,c));
|
||||
//model.setValue(c.getVascEntryFieldValue().getValue(c, bean));
|
||||
//model.addListener(new VascColumnValueModelListener(c,bean));
|
||||
UIInput jsfEdit = (UIInput)editor.createComponent(entry,c,model,grid);
|
||||
jsfEdit.addValidator(new VascJSFInputValidator2(c.getId()));
|
||||
|
||||
int index = VascDataBackendBean.getIndexId(c);
|
||||
|
||||
ValueExpression ve7 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".selected.field"+index+"}", Object.class);
|
||||
jsfEdit.setValueExpression("value", ve7);
|
||||
|
||||
ValueExpression ve8 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".selected != null}", Boolean.class);
|
||||
jsfEdit.setValueExpression("rendered", ve8);
|
||||
|
||||
HtmlMessage message = (HtmlMessage)application.createComponent(HtmlMessage.COMPONENT_TYPE);
|
||||
message.setId(viewRoot.createUniqueId());
|
||||
message.setFor(jsfEdit.getId());
|
||||
|
||||
message.setErrorClass("style_textBlue");
|
||||
message.setFatalClass("style_textRed");
|
||||
message.setInfoClass("style_textBlack");
|
||||
message.setWarnClass("style_textGreen");
|
||||
|
||||
grid.getChildren().add(message);
|
||||
|
||||
//column++;
|
||||
// i==0 is for multi field editor support... which is still very in progress
|
||||
if (i==0) {
|
||||
entry.getVascFrontendController().addFieldVascUIComponents(c, editor,jsfEdit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class VascJSFInputValidator2 implements Validator,Serializable {
|
||||
|
|
@ -275,80 +270,74 @@ public class JSFVascUIComponentRenderer extends Renderer {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void addTableOptions(FacesContext fc,UIComponent grid,JSFVascUIComponent comp) throws FacesException, VascException {
|
||||
|
||||
//Application application = fc.getApplication();
|
||||
//UIViewRoot viewRoot = fc.getViewRoot();
|
||||
|
||||
//JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(grid);
|
||||
VascEntry entry = comp.getVascEntry();
|
||||
|
||||
for (VascEntryListOption option:entry.getVascEntryListOptions()) {
|
||||
for (int i=0;i<option.getVascEntryFieldType().getUIComponentCount(option);i++) {
|
||||
|
||||
VascUIComponent label = option.getVascEntryFieldType().provideLabelUIComponent(i,option);
|
||||
VascValueModel model = new VascValueModel();
|
||||
model.setValue(i18n(entry,option.getName()));
|
||||
label.createComponent(entry,option,model,grid);
|
||||
|
||||
VascUIComponent editor = option.getVascEntryFieldType().provideEditorUIComponent(i,option);
|
||||
for (VascEntryListOption option:entry.getVascEntryListOptions()) {
|
||||
for (int i=0;i<option.getVascEntryFieldType().getUIComponentCount(option);i++) {
|
||||
|
||||
VascUIComponent label = option.getVascEntryFieldType().provideLabelUIComponent(i,option);
|
||||
VascValueModel model = new VascValueModel();
|
||||
model.setValue(i18n(entry,option.getName()));
|
||||
label.createComponent(entry,option,model,grid);
|
||||
|
||||
VascUIComponent editor = option.getVascEntryFieldType().provideEditorUIComponent(i,option);
|
||||
model = new VascValueModel(option.getVascEntryFieldType().provideEditorVascValueModel(i,option));
|
||||
model.addListener(new VascOptionValueModelListener(option));
|
||||
model.setValue(option.getDefaultValue());
|
||||
UIInput jsfEdit = (UIInput)editor.createComponent(entry,option,model,grid);
|
||||
jsfEdit.addValueChangeListener(new ModelChangeListener(model));
|
||||
|
||||
if (comp.getInjectTableOptionOnChange()!=null && comp.getInjectTableOptionOnChange().isEmpty()==false) {
|
||||
if (jsfEdit instanceof HtmlSelectBooleanCheckbox) {
|
||||
((HtmlSelectBooleanCheckbox)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlSelectManyMenu) {
|
||||
((HtmlSelectManyMenu)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlInputText) {
|
||||
((HtmlInputText)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlInputTextarea) {
|
||||
((HtmlInputTextarea)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlSelectManyListbox) {
|
||||
((HtmlSelectManyListbox)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlSelectOneMenu) {
|
||||
((HtmlSelectOneMenu)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlSelectOneRadio) {
|
||||
((HtmlSelectOneRadio)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlSelectOneListbox) {
|
||||
((HtmlSelectOneListbox)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
}
|
||||
|
||||
Class<?> clazz = option.getVascEntryFieldType().getAutoDetectClass();
|
||||
if (clazz!=null && model.getValue()!=null) {
|
||||
if (clazz.equals(model.getValue().getClass())==false) {
|
||||
// lets try setting correct default.
|
||||
try {
|
||||
Constructor<?> c = clazz.getConstructor(String.class);
|
||||
Object value = c.newInstance(model.getValue());
|
||||
jsfEdit.setValue(value);
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
} else {
|
||||
jsfEdit.setValue(model.getValue()); // set default value
|
||||
}
|
||||
}
|
||||
// i==0 is for multi field editor support... which is stell very in progress aka not working
|
||||
if (i==0) {
|
||||
entry.getVascFrontendController().addFieldVascUIComponents(option, editor,jsfEdit);
|
||||
}
|
||||
}
|
||||
}
|
||||
entry.getVascFrontendController().getVascFrontendHelper().headerOptionsCreatedFillData(entry);
|
||||
model.addListener(new VascOptionValueModelListener(option));
|
||||
model.setValue(option.getDefaultValue());
|
||||
UIInput jsfEdit = (UIInput)editor.createComponent(entry,option,model,grid);
|
||||
jsfEdit.addValueChangeListener(new ModelChangeListener(model));
|
||||
|
||||
if (comp.getInjectTableOptionOnChange()!=null && comp.getInjectTableOptionOnChange().isEmpty()==false) {
|
||||
if (jsfEdit instanceof HtmlSelectBooleanCheckbox) {
|
||||
((HtmlSelectBooleanCheckbox)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlSelectManyMenu) {
|
||||
((HtmlSelectManyMenu)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlInputText) {
|
||||
((HtmlInputText)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlInputTextarea) {
|
||||
((HtmlInputTextarea)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlSelectManyListbox) {
|
||||
((HtmlSelectManyListbox)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlSelectOneMenu) {
|
||||
((HtmlSelectOneMenu)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlSelectOneRadio) {
|
||||
((HtmlSelectOneRadio)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
if (jsfEdit instanceof HtmlSelectOneListbox) {
|
||||
((HtmlSelectOneListbox)jsfEdit).setOnchange(comp.getInjectTableOptionOnChange());
|
||||
}
|
||||
}
|
||||
|
||||
Class<?> clazz = option.getVascEntryFieldType().getAutoDetectClass();
|
||||
if (clazz!=null && model.getValue()!=null) {
|
||||
if (clazz.equals(model.getValue().getClass())==false) {
|
||||
// lets try setting correct default.
|
||||
try {
|
||||
Constructor<?> c = clazz.getConstructor(String.class);
|
||||
Object value = c.newInstance(model.getValue());
|
||||
jsfEdit.setValue(value);
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
} else {
|
||||
jsfEdit.setValue(model.getValue()); // set default value
|
||||
}
|
||||
}
|
||||
// i==0 is for multi field editor support... which is stell very in progress aka not working
|
||||
if (i==0) {
|
||||
entry.getVascFrontendController().addFieldVascUIComponents(option, editor,jsfEdit);
|
||||
}
|
||||
}
|
||||
}
|
||||
entry.getVascFrontendController().getVascFrontendHelper().headerOptionsCreatedFillData(entry);
|
||||
}
|
||||
|
||||
public class ModelChangeListener implements ValueChangeListener,Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
VascValueModel model;
|
||||
|
|
@ -555,11 +544,11 @@ public class JSFVascUIComponentRenderer extends Renderer {
|
|||
}
|
||||
|
||||
private MethodExpression getMethodExpression(String name) {
|
||||
Class<?>[] argtypes = new Class[1];
|
||||
argtypes[0] = ActionEvent.class;
|
||||
FacesContext facesCtx = FacesContext.getCurrentInstance();
|
||||
ELContext elContext = facesCtx.getELContext();
|
||||
return facesCtx.getApplication().getExpressionFactory().createMethodExpression(elContext, name, null, argtypes);
|
||||
}
|
||||
|
||||
Class<?>[] argtypes = new Class[1];
|
||||
argtypes[0] = ActionEvent.class;
|
||||
FacesContext facesCtx = FacesContext.getCurrentInstance();
|
||||
ELContext elContext = facesCtx.getELContext();
|
||||
return facesCtx.getApplication().getExpressionFactory().createMethodExpression(elContext, name, null, argtypes);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -27,8 +27,8 @@ import java.io.Serializable;
|
|||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ import javax.faces.context.FacesContext;
|
|||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.ui.VascValueModel;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.frontend.web.jsf.JSFVascUIComponent;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,14 +30,11 @@ import javax.faces.context.FacesContext;
|
|||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.ui.VascValueModel;
|
||||
|
||||
|
||||
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
*
|
||||
* JSFLabel
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 25, 2009
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ import javax.faces.convert.ConverterException;
|
|||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.ui.VascSelectItem;
|
||||
import net.forwardfire.vasc.core.ui.VascValueModel;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.frontend.web.jsf.JSFVascUIComponent;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ import java.util.ListIterator;
|
|||
import javax.faces.model.SelectItem;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.ui.VascSelectItem;
|
||||
import net.forwardfire.vasc.core.ui.VascSelectItemModel;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ import javax.faces.convert.ConverterException;
|
|||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.ui.VascValueModel;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.frontend.web.jsf.JSFVascUIComponent;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ import javax.faces.context.FacesContext;
|
|||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.ui.VascValueModel;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.frontend.web.jsf.JSFVascUIComponent;
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue