how I can use spring CCP to intéragir with two window?
I am using spring RCP in my application. I already could test it for a simple example by using only one table of the data base. but as soon as I passed at a base more complicated: a base which contains three table to connect between them, I met full with problems.
for better explaining my situation, I will take a esxemple: I have a table customer in relation with the table counts: relation one to many. by using the interface spring RCP : you can visualize on the interface a list of the customer with his atributs in a table and when you clicks on a line of the table, another window opens which indicates all information concerning this customer. the problem is how can I post the lists of the accounts of each customer in one 2nd window???? the code is too dificult. I will try to put the classes necessary. thank you for your assistance.
it is an example of class Fournisseur like customer.
Code:
package west.pharmacie.dto.base;
import java.io.Serializable;/*** This is an object that contains data related to the fournisseur table.* Do not modify this class because it will be overwritten if the configuration file* related to this class is modified.** @hibernate.class* table=quot;fournisseurquot;*/
public abstract class BaseFournisseur implements Serializable {
public static String REF = quot;Fournisseurquot;;
public static String PROP_ADRESSE = quot;Adressequot;;
public static String PROP_TEL = quot;Telquot;;
public static String PROP_VILLE = quot;Villequot;;
public static String PROP_RAISON_SOCIALE = quot;RaisonSocialequot;;
public static String PROP_ID = quot;Idquot;;// constructors
public BaseFournisseur () {
initialize();
}
/*** Constructor for primary key*/
public BaseFournisseur (java.lang.Integer id) {
this.setId(id);
initialize();
}
protected void initialize () {}
private int hashCode = Integer.MIN_VALUE;
// primary key
private java.lang.Integer id;
// fields
private java.lang.String raisonSociale;
private java.lang.String adresse;
private java.lang.String ville;
private java.lang.String tel;
// collections
private java.util.Setlt;west.pharmacie.dto.Lotstockgt; lotstocks;
/*** Return the unique identifier of this class * @hibernate.id * generator-class=quot;incrementquot; * column=quot;CodeFournisseurquot; */
public java.lang.Integer getId () {
return id;
}
/*** Set the unique identifier of this class* @param id the new ID*/
public void setId (java.lang.Integer id) {
this.id = id;
this.hashCode = Integer.MIN_VALUE;
}
/*** Return the value associated with the column: RaisonSociale*/
public java.lang.String getRaisonSociale () {
return raisonSociale;
}
/*** Set the value related to the column: RaisonSociale* @param raisonSociale the RaisonSociale value*/
public void setRaisonSociale (java.lang.String raisonSociale) {
this.raisonSociale = raisonSociale;
}
/*** Return the value associated with the column: Adresse*/
public java.lang.String getAdresse () {
return adresse;
}
/*** Set the value related to the column: Adresse* @param adresse the Adresse value*/
public void setAdresse (java.lang.String adresse) {
this.adresse = adresse;
}
/*** Return the value associated with the column: Ville*/
public java.lang.String getVille () {
return ville;
}
/*** Set the value related to the column: Ville* @param ville the Ville value*/
public void setVille (java.lang.String ville) {
this.ville = ville;
}
/*** Return the value associated with the column: TEL*/
public java.lang.String getTel () {
return tel;
}
/*** Set the value related to the column: TEL* @param tel the TEL value*/
public void setTel (java.lang.String tel) {
this.tel = tel;
}
/*** Return the value associated with the column: Lotstocks*/
public java.util.Setlt;west.pharmacie.dto.Lotstockgt; getLotstocks () {
return lotstocks;
}
/*** Set the value related to the column: Lotstocks* @param lotstocks the Lotstocks value*/
public void setLotstocks (java.util.Setlt;west.pharmacie.dto.Lotstockgt; lotstocks) {
this.lotstocks = lotstocks;
}
public void addToLotstocks (west.pharmacie.dto.Lotstock lotstock) {
if (null == getLotstocks()) setLotstocks(new java.util.TreeSetlt;west.pharmacie.dto.Lotstockgt;());
getLotstocks().add(lotstock);
}
public boolean equals (Object obj) {
if (null == obj) return false;
if (!(obj instanceof west.pharmacie.dto.Fournisseur)) return false;
else {
west.pharmacie.dto.Fournisseur fournisseur = (west.pharmacie.dto.Fournisseur) obj;
if (null == this.getId() || null == fournisseur.getId()) return false;
else return (this.getId().equals(fournisseur.getId()));
}
}
public int hashCode () {
if (Integer.MIN_VALUE == this.hashCode) {
if (null == this.getId()) return super.hashCode();
else {
String hashStr = this.getClass().getName() + quot;:quot; + this.getId().hashCode();
this.hashCode = hashStr.hashCode();
}
}
return this.hashCode;
}public String toString () {
return super.toString();
}}
the other class necessary related to spring RCP are as follows:Code:package org..richclient.samples.simple.ui;
import javax.swing.JComponent;import org..binding.form.FormModel;
import org..richclient.form.AbstractForm;
import org..richclient.form.binding.swing.SwingBindingFactory;
import org..richclient.form.builder.TableFormBuilder;
public class FournisseurForm extends AbstractForm {
public static final String FORM_NAME = quot;fournisseurquot;;
//private JComponent nomFournisseurField;
/** * @param pageFormModel */ public FournisseurForm( FormModel formModel ) { super(formModel, FORM_NAME); }
/* * (non-Javadoc) * * @see org..richclient.form.AbstractForm#createFormControl() */ protected JComponent createFormControl() { final SwingBindingFactory bf = (SwingBindingFactory) getBindingFactory(); TableFormBuilder formBuilder = new TableFormBuilder(bf); formBuilder.setLabelAttributes(quot;colGrId=label colSpec=right:prefquot;);
formBuilder.addSeparator(quot;new fournisseurquot;); formBuilder.row(); //nomFournisseurField = formBuilder.add(quot;nomquot;)[1]; formBuilder.add(quot;raisonSocialequot;); formBuilder.row(); formBuilder.add(quot;adressequot;); formBuilder.row(); formBuilder.add(quot;villequot;); formBuilder.row(); formBuilder.add(quot;telquot;); formBuilder.row(); return formBuilder.getForm(); }
/** * Try to place the focus in the firstNameField whenever the initial focus is being * set. * * @return */ /*public boolean requestFocusInWindow() { return nomFournisseurField.requestFocusInWindow(); }*/
} |