Cesar4
(Cesar Balzer)
November 1, 2010, 6:17pm
1
I am making a form and would like to know
because when I call this form the order of fields
this different from what I had set in creating the
form, thus becoming the order of the same cofuso
Marko1
(Marko Grönroos)
November 3, 2010, 2:48pm
2
Use [tt]
setVisibleItemProperties()
[/tt] to set not just which fields are visible, but also their order.
Cesar4
(Cesar Balzer)
November 3, 2010, 4:53pm
3
Right, but the detail I’m calling a class
as in this example:
then I lost where I need to put this
Marko1
(Marko Grönroos)
November 3, 2010, 5:20pm
4
After your code there.
Just like in
this example
.
Cesar4
(Cesar Balzer)
November 3, 2010, 6:27pm
5
Sorry I think I expressed it badly, I am also using hibernate, so I call the class of fields here:
private VerticalLayout pFisica(){
VerticalLayout la = new VerticalLayout();
la.setMargin(true);
pf = new PFisica();
fPessoa = new Form();
fPessoa.setItemDataSource(new BeanItem(pf));
cadastrar = new Button(“Cadastrar”,(ClickListener) this);
la.addComponent(fPessoa);
la.addComponent(cadastrar);
return la;
}
and here is being generated and where the entire form:
package br.com.nmsoftware.data;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.MappedSuperclass;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Entity;
import javax.persistence.Transient;
@MappedSuperclass
public class Pessoa implements Serializable{
@Id
@GeneratedValue (strategy=GenerationType.AUTO)
@Column (name=“cd_pessoa”)
private int iCd_pessoa;
@Column (name=“nm_pessoa”)
private String sNm_pessoa;
@Column (name=“email”)
private String sEmail;
@Transient
private Boolean bFl_status;
@Column (name=“fl_status”)
private String status;
@Column (name=“cd_tipo”)
private int iCd_tipo;
public Pessoa(){
bFl_status = true;
}
public int getiCd_pessoa() {
return iCd_pessoa;
}
public void setiCd_pessoa(int iCd_pessoa) {
this.iCd_pessoa = iCd_pessoa;
}
public String getsNm_pessoa() {
return sNm_pessoa;
}
public void setsNm_pessoa(String sNm_pessoa) {
this.sNm_pessoa = sNm_pessoa;
}
public String getsEmail() {
return sEmail;
}
public void setsEmail(String sEmail) {
this.sEmail = sEmail;
}
public Boolean getbFl_status() {
return bFl_status;
}
public void setbFl_status(Boolean bFl_status) {
if(bFl_status){
status=“T”;
}else{
status=“F”;
}
this.bFl_status = bFl_status;
}
public int getiCd_tipo() {
return iCd_tipo;
}
public void setiCd_tipo(int iCd_tipo) {
this.iCd_tipo = iCd_tipo;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
}
I apologize for the error in language perhaps, I live in Brazil and I’m still practicing the very English, but nevertheless I am grateful for your help my dear friend
Artur
(Artur Signell)
November 4, 2010, 9:39am
6
In a BeanItem the field names (actually the getters) are the property ids so use something like
fPessoa.setItemDataSource(new BeanItem<PFisica>(pf));
fPessoa.setVisibleItemProperties(new Object[] {"iCd_pessoa","sNm_pessoa", ...});
to control the order in which the fields appear.
You have not provided the PFisica class you use in the Form but I assumed it is a sub class of Pessoa.
Cesar4
(Cesar Balzer)
November 4, 2010, 3:38pm
7
Now it is all right, now I gotta see distribute these fields in a vertical layout and
horizontal in order to leave the beautiful interface for the user, I am very grateful for the help.
Hugs