Dyna Form
I agree with you that for create purpose we can use master detail to do that. But what about edit and detail? From usability perspective do we use that wizard like thing for edit view also? It does not look good for me. But I am glad to hear your point.
I have understood you use the same tabs for create / edit. I proposed to use button as tabs for create / edit.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
No from usability perspective users will prefer tabs rather than buttons and consistency of screens.
Hello Oleg,
I have checked out the PF-E project and successfully managed to build all the projects (0.5.0-SNAPSHOT). Now I land up into few problems.
1> I try to run the PE-E showcase on Tomcat 7 and there are problems with layout and I get few alert popups and finally nothing is displayed.
2> Now for another project I try to include the 0.5.0-SNAPSHOT dependency into my pom.xml as I am very keen on dyna form. Nothing is displayed instead I get the following error as shown in stack trace below
Please note I do not use PF or PF-E layouts in my page. I have a simple HTML layout with UI includes
Here is my form bean. Please not I use Spring framework JSF variable resolver and extened VIEW Scope implementation
And finally the xhtml page is below
I think a snapshot release with examples and showcase enhancements with documentation will be of great help for early adaptors like me.
I have checked out the PF-E project and successfully managed to build all the projects (0.5.0-SNAPSHOT). Now I land up into few problems.
1> I try to run the PE-E showcase on Tomcat 7 and there are problems with layout and I get few alert popups and finally nothing is displayed.
2> Now for another project I try to include the 0.5.0-SNAPSHOT dependency into my pom.xml as I am very keen on dyna form. Nothing is displayed instead I get the following error as shown in stack trace below
Code: Select all
May 21, 2012 9:50:42 AM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
SEVERE: Error Rendering View[/contactcreateform.xhtml]
java.lang.NullPointerException
at org.primefaces.extensions.component.dynaform.DynaFormRenderer.getTotalColspan(DynaFormRenderer.java:218)
at org.primefaces.extensions.component.dynaform.DynaFormRenderer.encodeMarkup(DynaFormRenderer.java:86)
at org.primefaces.extensions.component.dynaform.DynaFormRenderer.encodeEnd(DynaFormRenderer.java:65)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:61)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:45)
at org.primefaces.component.layout.LayoutUnitRenderer.encodeEnd(LayoutUnitRenderer.java:51)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
Here is my form bean. Please not I use Spring framework JSF variable resolver and extened VIEW Scope implementation
Code: Select all
import javax.annotation.PostConstruct;
import javax.inject.Named;
import org.primefaces.extensions.model.dynaform.DynaFormModel;
import org.primefaces.extensions.model.dynaform.DynaFormRow;
import org.springframework.context.annotation.Scope;
/**
* @author Dhrubo
*
*/
@Named
@Scope("view")
public class ConctactCreateForm {
private DynaFormModel model = new DynaFormModel();
/**
* @return the model
*/
public DynaFormModel getModel() {
System.out.println("######## getModel = " + model);
return model;
}
/**
* @param model the model to set
*/
public void setModel(DynaFormModel model) {
this.model = model;
}
@PostConstruct
public void init() {
System.out.println("########### INIT @@@@@@@@@@@@@@");
DynaFormRow row = model.createRegularRow();
row.addControl("hi", "input", 1, 1, true);
}
}
Code: Select all
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions"
template="/fplayout.xhtml">
<ui:define name="title">
Create Contact
</ui:define>
<ui:define name="mainform">
<pe:dynaForm value="${contactCreateForm.model}" var="formElement"
varStatus="curStatus">
<pe:dynaFormCell type="label">
<h:outputLabel value="${formElement.value}" for="curStatus.forValue" />
</pe:dynaFormCell>
<pe:dynaFormCell type="input">
<p:inputText value="#{formElement.value}"
required="#{formElement.required}" />
</pe:dynaFormCell>
<pe:dynaFormCell type="date">
<p:calendar value="#{formElement.value}" />
</pe:dynaFormCell>
<pe:dynaFormCell type="select">
<p:selectOneMenu value="#{formElement.value}" >
</p:selectOneMenu>
</pe:dynaFormCell>
</pe:dynaForm>
</ui:define>
</ui:composition>
Please ignore most of my earlier post. It was really silly. A typo - ConctactCreateForm should be ContactCreateForm. One extra c create all problems.
Now I took a step forward. The next error that I am getting is
value="#{formElement.value}": Property 'value' not found on type java.lang.String
So now the question is whats the type of formElement?
Now I took a step forward. The next error that I am getting is
value="#{formElement.value}": Property 'value' not found on type java.lang.String
So now the question is whats the type of formElement?
Hi,
The type is DynaFormModel. Please don't use the component yet. I have not tested it, only fresh implemented. There is not even a showcase with samples. We will announce if it's ready to use.
The type is DynaFormModel. Please don't use the component yet. I have not tested it, only fresh implemented. There is not even a showcase with samples. We will announce if it's ready to use.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
Ok now I created a class like this
Then I modified my form bean init method as shown below
And I was able to see a text box with "Hello" as value in it.
Now my question is how do I attach a value expression with the dyna form?
Is dynaform a table with rows and columns and each cell has a control viz input text etc? In other words it does not generate any <form ....></form> markup
Code: Select all
/**
* @author Dhrubo
*
*/
public class FormElement {
private Object value;
private boolean required;
/**
* @return the value
*/
public Object getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(Object value) {
this.value = value;
}
/**
* @return the required
*/
public boolean isRequired() {
return required;
}
/**
* @param required the required to set
*/
public void setRequired(boolean required) {
this.required = required;
}
}
Code: Select all
@PostConstruct
public void init() {
LOGGER.info("########### INIT @@@@@@@@@@@@@@");
DynaFormRow row = model.createRegularRow();
Contact c = new Contact();
FormElement element = new FormElement();
element.setRequired(true);
element.setValue("Hello");
row.addControl(element, "input", 1, 1, true);
}
Now my question is how do I attach a value expression with the dyna form?
Is dynaform a table with rows and columns and each cell has a control viz input text etc? In other words it does not generate any <form ....></form> markup
Sorry I cannot wait till your announcement. I am too eager to use it
BTW I use DynaFormModel and use the factory to create DynaFormRow and attach controls to the row.
BTW I use DynaFormModel and use the factory to create DynaFormRow and attach controls to the row.
You're the first person who uses DynaForm. I implemented this but not used / not tested it until now. It's normal that this component can have some issue. Please wait a little bit Thanks.
Yes, dynaform is a table with rows and columns and each cell has a control - edit control or label. Think about p:panelGrid which is built dynamically.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
Thanks. I have put a pause to my usage, until your next announcement. Now I am curious when can tentatively I can expect the announcement?Oleg wrote:
You're the first person who uses DynaForm. I implemented this but not used / not tested it until now. It's normal that this component can have some issue. Please wait a little bit Thanks.
Yes, dynaform is a table with rows and columns and each cell has a control - edit control or label. Think about p:panelGrid which is built dynamically.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 3 guests