예제 #1
0
 private void declTexteFormu(Programme prog, StringBuffer buf, int indent, Argument arg) {
   if (arg.avecTexteRadio()) {
     String zone = "zone_" + arg.nom;
     zone = Divers.remplacer(zone, ".", "_");
     String group = "group_" + arg.nom;
     group = Divers.remplacer(group, ".", "_");
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, "ButtonGroup " + group + "; ");
     String p_group = "p_" + group;
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, "JPanel " + p_group + "; ");
     String[] liste = arg.getTexteRadio();
     int n = liste.length;
     for (int i = 0; i < n; i++) {
       Divers.indenter(buf, indent);
       String zone_bouton = "zone_" + liste[i] + "_" + arg.nom;
       zone_bouton = Divers.remplacer(zone_bouton, ".", "_");
       Divers.ecrire(buf, "JRadioButton " + zone_bouton + "; ");
     }
   } else if (arg.avecTexteListe()) {
     String zone = "zone_" + arg.nom;
     zone = Divers.remplacer(zone, ".", "_");
     String model = "model_" + arg.nom;
     model = Divers.remplacer(model, ".", "_");
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, "JList " + zone + "; ");
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, "DefaultListModel " + model + "; ");
   } else {
     String zone = "zone_" + arg.nom;
     zone = Divers.remplacer(zone, ".", "_");
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, "JTextField " + zone + "; ");
   }
 }
예제 #2
0
 private void constrTabFormu(
     Programme prog,
     StringBuffer buf,
     int indent,
     String msg,
     String p_pere,
     Argument arg,
     String indice) {
   this.constrLabelFormu(prog, buf, indent, msg, p_pere, arg);
   String p_zone = "p_" + arg.nom;
   p_zone = Divers.remplacer(p_zone, ".", "_");
   String zone = "zone_" + arg.nom;
   zone = Divers.remplacer(zone, ".", "_");
   Divers.indenter(buf, indent);
   Divers.ecrire(buf, p_zone + "=new JPanel(new GridLayout(1, " + prog.getMaxTab() + ")); ");
   Divers.ecrire(buf, p_pere + ".add(" + p_zone + "); ");
   if (arg.isTabBooleens()) {
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, zone + "=new Checkbox [" + prog.getMaxTab() + "]; ");
   } else if (arg.isTabTextes() && arg.avecTexteRadio()) {
     String group = "group_" + arg.nom;
     group = Divers.remplacer(group, ".", "_");
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, group + "=new ButtonGroup[" + prog.getMaxTab() + "]; ");
     String p_group = "p_" + group;
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, p_group + "=new JPanel[ " + prog.getMaxTab() + "]; ");
     String[] liste = arg.getTexteRadio();
     int n = liste.length;
     for (int i = 0; i < n; i++) {
       String zone_bouton = "zone_" + liste[i] + "_" + arg.nom;
       zone_bouton = Divers.remplacer(zone_bouton, ".", "_");
       Divers.indenter(buf, indent);
       Divers.ecrire(buf, zone_bouton + "=new JRadioButton[ " + prog.getMaxTab() + "]; ");
     }
   } else if (arg.isTabTextes() && arg.avecTexteListe()) {
     String model = "model_" + arg.nom;
     model = Divers.remplacer(model, ".", "_");
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, zone + "=new JList [" + prog.getMaxTab() + "]; ");
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, model + "=new DefaultListModel [" + prog.getMaxTab() + "]; ");
   } else {
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, zone + "=new JTextField [" + prog.getMaxTab() + "]; ");
   }
   // la boucle
   instr_pere.addVariable(new Variable(indice, "ENTIER"));
   Divers.ecrire(
       buf,
       "for(int " + indice + "=0; " + indice + "<" + prog.getMaxTab() + "; " + indice + "++) {",
       indent);
   String msg1 = null;
   Argument arg1 = new Argument(arg.nom + "[" + indice + "]", arg.getTypeOfTab(), arg.mode);
   constrFormu(prog, buf, indent + 1, msg1, p_zone, arg1);
   Divers.ecrire(buf, "}", indent);
 }
예제 #3
0
 private void constrTexteFormu(
     Programme prog, StringBuffer buf, int indent, String msg, String p_pere, Argument arg) {
   String zone = "zone_" + arg.nom;
   zone = Divers.remplacer(zone, ".", "_");
   if (arg.avecTexteRadio()) {
     String group = "group_" + arg.nom;
     group = Divers.remplacer(group, ".", "_");
     this.constrLabelFormu(prog, buf, indent, msg, p_pere, arg);
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, group + "=new ButtonGroup(); ");
     String p_group = "p_" + group;
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, p_group + "=new JPanel(); ");
     Divers.ecrire(buf, p_pere + ".add(" + p_group + "); ");
     String[] liste = arg.getTexteRadio();
     int n = liste.length;
     for (int i = 0; i < n; i++) {
       String zone_bouton = "zone_" + liste[i] + "_" + arg.nom;
       zone_bouton = Divers.remplacer(zone_bouton, ".", "_");
       Divers.indenter(buf, indent);
       Divers.ecrire(buf, zone_bouton + " = new JRadioButton(" + prog.quote(liste[i]) + "); ");
       Divers.indenter(buf, indent);
       Divers.ecrire(buf, group + ".add(" + zone_bouton + "); ");
       Divers.indenter(buf, indent);
       Divers.ecrire(buf, p_group + ".add(" + zone_bouton + "); ");
     }
   } else if (arg.avecTexteListe()) {
     String model = "model_" + arg.nom;
     model = Divers.remplacer(model, ".", "_");
     this.constrLabelFormu(prog, buf, indent, msg, p_pere, arg);
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, model + "=new DefaultListModel(); ");
     String[] liste = arg.getTexteListe();
     int n = liste.length;
     for (int i = 0; i < n; i++) {
       Divers.ecrire(buf, model + ".addElement(" + prog.quote(liste[i]) + ");", indent);
     }
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, zone + "=new JList(" + model + "); ");
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, zone + ".setVisibleRowCount(2); ");
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, p_pere + ".add(new JScrollPane(" + zone + ")); ");
   } else {
     this.constrLabelFormu(prog, buf, indent, msg, p_pere, arg);
     Divers.indenter(buf, indent);
     Divers.ecrire(buf, zone + "=new JTextField(); ");
     Divers.ecrire(buf, p_pere + ".add(" + zone + ");");
   }
 }
예제 #4
0
 private void lireTexteFormu(Programme prog, StringBuffer buf, int indent, Argument arg) {
   String zone = "zone_" + arg.nom;
   zone = Divers.remplacer(zone, ".", "_");
   Divers.indenter(buf, indent);
   Divers.ecrire(buf, arg.nom + " = ");
   if (arg.avecTexteRadio()) {
     Divers.ecrire(buf, "null; ");
     String[] liste = arg.getTexteRadio();
     int n = liste.length;
     for (int i = 0; i < n; i++) {
       String zone_bouton = "zone_" + liste[i] + "_" + arg.nom;
       zone_bouton = Divers.remplacer(zone_bouton, ".", "_");
       Divers.indenter(buf, indent);
       Divers.ecrire(buf, "if (" + zone_bouton + ".isSelected()) ");
       Divers.ecrire(buf, arg.nom + "=" + prog.quote(liste[i]) + "; ");
     }
   } else if (arg.avecTexteListe()) {
     Divers.ecrire(buf, "(String) " + zone + ".getSelectedValue(); ");
   } else {
     Divers.ecrire(buf, zone + ".getText(); ");
   }
 }