Line 28... |
Line 28... |
28 |
import com.extjs.gxt.ui.client.Registry;
|
28 |
import com.extjs.gxt.ui.client.Registry;
|
29 |
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
29 |
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
30 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
30 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
31 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
31 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
32 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
32 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
- |
|
33 |
import com.extjs.gxt.ui.client.event.EditorEvent;
|
- |
|
34 |
import com.extjs.gxt.ui.client.event.GridEvent;
|
33 |
import com.extjs.gxt.ui.client.event.Listener;
|
35 |
import com.extjs.gxt.ui.client.event.Listener;
|
34 |
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
|
36 |
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
|
35 |
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
|
37 |
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
|
36 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
38 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
37 |
import com.extjs.gxt.ui.client.event.ToolBarEvent;
|
39 |
import com.extjs.gxt.ui.client.event.ToolBarEvent;
|
Line 79... |
Line 81... |
79 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
81 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
80 |
import com.google.gwt.core.client.GWT;
|
82 |
import com.google.gwt.core.client.GWT;
|
81 |
import com.google.gwt.i18n.client.DateTimeFormat;
|
83 |
import com.google.gwt.i18n.client.DateTimeFormat;
|
82 |
import com.google.gwt.i18n.client.NumberFormat;
|
84 |
import com.google.gwt.i18n.client.NumberFormat;
|
83 |
import com.google.gwt.user.client.Event;
|
85 |
import com.google.gwt.user.client.Event;
|
- |
|
86 |
import com.google.gwt.user.client.Random;
|
84 |
import com.google.gwt.user.client.Window;
|
87 |
import com.google.gwt.user.client.Window;
|
85 |
import com.google.gwt.user.client.ui.HTML;
|
88 |
import com.google.gwt.user.client.ui.HTML;
|
86 |
import com.google.gwt.user.client.ui.Widget;
|
89 |
import com.google.gwt.user.client.ui.Widget;
|
Line 87... |
Line 90... |
87 |
|
90 |
|
Line 202... |
Line 205... |
202 |
private RadioGroup sansMotifAccesMarkRGrpChp;
|
205 |
private RadioGroup sansMotifAccesMarkRGrpChp;
|
203 |
private RadioGroup avecMotifAccesMarkRGrpChp;
|
206 |
private RadioGroup avecMotifAccesMarkRGrpChp;
|
204 |
private TextField<String> publicationChp;
|
207 |
private TextField<String> publicationChp;
|
205 |
private ContentPanel materielConservationCp;
|
208 |
private ContentPanel materielConservationCp;
|
Line 206... |
Line -... |
206 |
|
- |
|
207 |
|
- |
|
208 |
|
209 |
|
209 |
public FormStructureVue() {
|
210 |
public FormStructureVue() {
|
210 |
//+-----------------------------------------------------------------------------------------------------------+
|
211 |
//+-----------------------------------------------------------------------------------------------------------+
|
211 |
// Initialisation de variables
|
212 |
// Initialisation de variables
|
212 |
i18nC = GWT.create(Constantes.class);
|
213 |
i18nC = GWT.create(Constantes.class);
|
Line 859... |
Line 860... |
859 |
// NBRE PERSONNE
|
860 |
// NBRE PERSONNE
|
860 |
nbreTotalPersonneStructureChp.setValue(identification.getNbrePersonne());
|
861 |
nbreTotalPersonneStructureChp.setValue(identification.getNbrePersonne());
|
861 |
}
|
862 |
}
|
Line 862... |
Line 863... |
862 |
|
863 |
|
863 |
if (personnel != null) {
|
- |
|
864 |
|
864 |
if (personnel != null) {
|
865 |
ArrayList<StructureAPersonne> personnes = new ArrayList<StructureAPersonne>();
|
865 |
ArrayList<StructureAPersonne> personnes = new ArrayList<StructureAPersonne>();
|
866 |
for (Iterator<String> it = personnel.keySet().iterator(); it.hasNext();) {
|
866 |
for (Iterator<String> it = personnel.keySet().iterator(); it.hasNext();) {
|
867 |
String index = it.next();
|
867 |
String index = it.next();
|
868 |
if (magazinLiFonction != null && ((String) personnel.get(index).getFonction()).matches("^[0-9]+$")) {
|
868 |
if (magazinLiFonction != null && ((String) personnel.get(index).getFonction()).matches("^[0-9]+$")) {
|
869 |
GWT.log(personnel.get(index).getFonction(), null);
|
869 |
GWT.log(personnel.get(index).getFonction(), null);
|
870 |
personnel.get(index).set("fonction", magazinLiFonction.findModel("id_valeur", personnel.get(index).getFonction()).getNom());
|
870 |
personnel.get(index).set("fonction", magazinLiFonction.findModel("id_valeur", personnel.get(index).getFonction()).getNom());
|
871 |
} else {
|
871 |
} else {
|
872 |
personnel.get(index).set("fonction", personnel.get(index).getFonction());
|
872 |
personnel.get(index).set("fonction", personnel.get(index).getFonction().replaceFirst("AUTRE##", ""));
|
873 |
}
|
873 |
}
|
874 |
personnes.add(personnel.get(index));
|
874 |
personnes.add(personnel.get(index));
|
875 |
}
|
875 |
}
|
876 |
personnelGrilleMagazin.removeAll();
|
876 |
personnelGrilleMagazin.removeAll();
|
877 |
personnelGrilleMagazin.add(personnes);
|
- |
|
878 |
|
- |
|
879 |
grillePersonnel.getColumnModel().getColumn(1).getEditor().fireEvent(Events.StateSave);
|
- |
|
880 |
/*
|
- |
|
881 |
int nbreLigne = personnelGrilleMagazin.getCount();
|
- |
|
882 |
for (int i = 0; i < nbreLigne; i++) {
|
- |
|
883 |
|
- |
|
884 |
}
|
- |
|
885 |
*/
|
877 |
personnelGrilleMagazin.add(personnes);
|
- |
|
878 |
personnelOnglet.layout();
|
- |
|
879 |
// Nous vidons la variable personnel une fois qu'elle a remplie la grille
|
886 |
personnelOnglet.layout();
|
880 |
personnel = null;
|
887 |
}
|
881 |
}
|
Line 888... |
Line 882... |
888 |
}
|
882 |
}
|
889 |
|
883 |
|
Line 933... |
Line 927... |
933 |
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
927 |
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
Line 934... |
Line 928... |
934 |
|
928 |
|
935 |
CheckBoxSelectionModel<StructureAPersonne> sm = new CheckBoxSelectionModel<StructureAPersonne>();
|
929 |
CheckBoxSelectionModel<StructureAPersonne> sm = new CheckBoxSelectionModel<StructureAPersonne>();
|
Line 936... |
Line 930... |
936 |
configs.add(sm.getColumn());
|
930 |
configs.add(sm.getColumn());
|
937 |
|
931 |
|
938 |
ColumnConfig column = new ColumnConfig("fonction", "Fonction", 100);
|
932 |
ColumnConfig column = new ColumnConfig("fonction", "Fonction", 150);
|
939 |
modele.obtenirListeValeurs(((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("fonction"));
|
933 |
modele.obtenirListeValeurs(((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("fonction"));
|
Line 940... |
Line 934... |
940 |
magazinLiFonction = new ListStore<Valeur>();
|
934 |
magazinLiFonction = new ListStore<Valeur>();
|
941 |
magazinLiFonction.add(new ArrayList<Valeur>());
|
935 |
magazinLiFonction.add(new ArrayList<Valeur>());
|
942 |
|
936 |
|
943 |
comboLiFonction = new ComboBox<Valeur>();
|
937 |
comboLiFonction = new ComboBox<Valeur>();
|
944 |
comboLiFonction.setTriggerAction(TriggerAction.ALL);
|
- |
|
945 |
comboLiFonction.setEditable(true);
|
938 |
comboLiFonction.setTriggerAction(TriggerAction.ALL);
|
946 |
comboLiFonction.setDisplayField("nom");
|
- |
|
947 |
//comboLiStatut.setEmptyText("Sélectionez une fonction...");
|
- |
|
948 |
comboLiFonction.setStore(magazinLiFonction);
|
- |
|
949 |
/*
|
- |
|
950 |
comboLiFonction.addListener(Events.Blur, new Listener<BaseEvent>() {
|
- |
|
951 |
|
- |
|
952 |
@Override
|
- |
|
953 |
public void handleEvent(BaseEvent be) {
|
- |
|
954 |
//grillePersonnel..comboLiFonction.getRawValue();
|
- |
|
955 |
|
- |
|
Line 956... |
Line 939... |
956 |
}
|
939 |
comboLiFonction.setEditable(true);
|
957 |
|
940 |
comboLiFonction.setDisplayField("nom");
|
958 |
});*/
|
941 |
comboLiFonction.setStore(magazinLiFonction);
|
959 |
|
942 |
|
960 |
CellEditor fonctionEditor = new CellEditor(comboLiFonction) {
|
943 |
CellEditor fonctionEditor = new CellEditor(comboLiFonction) {
|
961 |
@Override
|
944 |
@Override
|
962 |
public Object preProcessValue(Object valeur) {
|
945 |
public Object preProcessValue(Object valeur) {
|
963 |
if (valeur == null) {
|
946 |
if (valeur == null) {
|
964 |
GWT.log("pre null :", null);
|
947 |
//GWT.log("pre null :"+this.getValue()+"-"+this.row, null);
|
965 |
return null;
|
948 |
return null;
|
966 |
}
|
949 |
}
|
967 |
GWT.log("pre : "+valeur.toString(), null);
|
950 |
//GWT.log("pre : "+valeur.toString(), null);
|
968 |
Object retour = null;
|
951 |
Object retour = null;
|
969 |
if (((String) valeur).matches("^[0-9]+$")) {
|
952 |
if (((String) valeur).matches("^[0-9]+$")) {
|
970 |
Valeur valeurRecherche = comboLiFonction.getStore().findModel("id_valeur", (String) valeur);
|
953 |
Valeur valeurRecherche = comboLiFonction.getStore().findModel("id_valeur", (String) valeur);
|
971 |
if (valeurRecherche != null) {
|
954 |
if (valeurRecherche != null) {
|
972 |
retour = valeurRecherche;
|
955 |
retour = valeurRecherche;
|
973 |
GWT.log("pre - retour valeur par chiffre : \n"+retour.toString(), null);
|
956 |
//GWT.log("pre - retour valeur par chiffre : \n"+retour.toString(), null);
|
974 |
} else {
|
957 |
} else {
|
975 |
this.getField().setRawValue((String) valeur);
|
958 |
this.getField().setRawValue((String) valeur);
|
976 |
retour = null;
|
959 |
retour = null;
|
977 |
}
|
960 |
}
|
978 |
} else if (valeur instanceof String) {
|
961 |
} else if (valeur instanceof String) {
|
979 |
this.getField().setRawValue((String) valeur);
|
962 |
this.getField().setRawValue((String) valeur);
|
980 |
retour = null;
|
963 |
retour = new Valeur("", (String) valeur, "", "");
|
Line 981... |
Line 964... |
981 |
} else {
|
964 |
} else {
|
982 |
retour = comboLiFonction.getStore().findModel("nom", (String) valeur);
|
965 |
retour = comboLiFonction.getStore().findModel("nom", (String) valeur);
|
Line 983... |
Line 966... |
983 |
GWT.log("pre - retour valeur par chaine : \n"+retour.toString(), null);
|
966 |
//GWT.log("pre - retour valeur par chaine : \n"+retour.toString(), null);
|
984 |
}
|
967 |
}
|
985 |
|
968 |
|
986 |
return retour;
|
969 |
return retour;
|
987 |
}
|
970 |
}
|
988 |
|
971 |
|
989 |
@Override
|
972 |
@Override
|
990 |
public Object postProcessValue(Object valeur) {
|
973 |
public Object postProcessValue(Object valeur) {
|
991 |
if (valeur == null) {
|
974 |
if (valeur == null) {
|
992 |
// Si la combobox n'a pas été utilisé, nous renvoyons la valeur brute saisie par l'utilisateur
|
975 |
// Si la combobox n'a pas été utilisé, nous renvoyons la valeur brute saisie par l'utilisateur
|
993 |
GWT.log("post raw : \n"+this.getField().getRawValue(), null);
|
976 |
//GWT.log("post raw : \n"+this.getField().getRawValue(), null);
|
994 |
String retour = this.getField().getRawValue();
|
977 |
String retour = this.getField().getRawValue();
|
995 |
if (retour.matches("^[0-9]+$")) {
|
978 |
if (retour.matches("^[0-9]+$")) {
|
996 |
GWT.log("ici", null);
|
979 |
//GWT.log("ici", null);
|
997 |
Valeur valeurRecherche = comboLiFonction.getStore().findModel("id_valeur", (String) retour);
|
980 |
Valeur valeurRecherche = comboLiFonction.getStore().findModel("id_valeur", (String) retour);
|
998 |
if (valeurRecherche != null) {
|
981 |
if (valeurRecherche != null) {
|
999 |
retour = valeurRecherche.getNom();
|
982 |
retour = valeurRecherche.getNom();
|
1000 |
}
|
983 |
}
|
1001 |
}
|
984 |
}
|
1002 |
return retour;
|
985 |
return retour;
|
1003 |
} else {
|
986 |
} else {
|
1004 |
GWT.log("post : \n"+valeur.toString(), null);
|
987 |
//GWT.log("post : \n"+valeur.toString(), null);
|
1005 |
String nom = "";
|
988 |
String nom = "";
|
1006 |
if (valeur instanceof Valeur) {
|
989 |
if (valeur instanceof Valeur) {
|
1007 |
nom = (((Valeur) valeur).getNom());
|
990 |
nom = (((Valeur) valeur).getNom());
|
Line 1044... |
Line 1027... |
1044 |
column = new ColumnConfig("fax", "Fax", 100);
|
1027 |
column = new ColumnConfig("fax", "Fax", 100);
|
1045 |
TextField<String> faxChp = new TextField<String>();
|
1028 |
TextField<String> faxChp = new TextField<String>();
|
1046 |
column.setEditor(new CellEditor(faxChp));
|
1029 |
column.setEditor(new CellEditor(faxChp));
|
1047 |
configs.add(column);
|
1030 |
configs.add(column);
|
Line 1048... |
Line 1031... |
1048 |
|
1031 |
|
1049 |
column = new ColumnConfig("courriel", "Courriel", 100);
|
1032 |
column = new ColumnConfig("courriel", "Courriel principal", 200);
|
1050 |
TextField<String> emailChp = new TextField<String>();
|
1033 |
TextField<String> emailChp = new TextField<String>();
|
1051 |
column.setEditor(new CellEditor(emailChp));
|
1034 |
column.setEditor(new CellEditor(emailChp));
|
Line 1052... |
Line 1035... |
1052 |
configs.add(column);
|
1035 |
configs.add(column);
|
Line 1056... |
Line 1039... |
1056 |
magazinLiStatut.add(new ArrayList<Valeur>());
|
1039 |
magazinLiStatut.add(new ArrayList<Valeur>());
|
Line 1057... |
Line 1040... |
1057 |
|
1040 |
|
1058 |
comboLiStatut = new ComboBox<Valeur>();
|
1041 |
comboLiStatut = new ComboBox<Valeur>();
|
1059 |
comboLiStatut.setTriggerAction(TriggerAction.ALL);
|
1042 |
comboLiStatut.setTriggerAction(TriggerAction.ALL);
|
- |
|
1043 |
comboLiStatut.setEditable(false);
|
1060 |
comboLiStatut.setEditable(false);
|
1044 |
comboLiStatut.disableTextSelection(true);
|
1061 |
comboLiStatut.setDisplayField("nom");
|
- |
|
1062 |
comboLiStatut.setEmptyText("Sélectionez un statut...");
|
1045 |
comboLiStatut.setDisplayField("nom");
|
Line 1063... |
Line 1046... |
1063 |
comboLiStatut.setStore(magazinLiStatut);
|
1046 |
comboLiStatut.setStore(magazinLiStatut);
|
1064 |
|
1047 |
|
1065 |
CellEditor statutEditor = new CellEditor(comboLiStatut) {
|
1048 |
CellEditor statutEditor = new CellEditor(comboLiStatut) {
|
Line 1104... |
Line 1087... |
1104 |
|
1087 |
|
1105 |
cp.setHeading("Personnes travaillant sur les collections");
|
1088 |
cp.setHeading("Personnes travaillant sur les collections");
|
1106 |
cp.setIconStyle("icone-table");
|
1089 |
cp.setIconStyle("icone-table");
|
1107 |
cp.setScrollMode(Scroll.AUTO);
|
1090 |
cp.setScrollMode(Scroll.AUTO);
|
1108 |
cp.setLayout(new FitLayout());
|
1091 |
cp.setLayout(new FitLayout());
|
1109 |
cp.setSize(1100, 200);
|
1092 |
cp.setSize(1250, 200);
|
Line 1110... |
Line 1093... |
1110 |
cp.setFrame(true);
|
1093 |
cp.setFrame(true);
|
Line 1111... |
Line 1094... |
1111 |
|
1094 |
|
1112 |
ToolBar toolBar = new ToolBar();
|
1095 |
ToolBar toolBar = new ToolBar();
|
1113 |
|
1096 |
|
1114 |
TextToolItem ajouterPersonnelBtn = new TextToolItem("Ajouter", "icone-vcard-ajouter");
|
1097 |
TextToolItem ajouterPersonnelBtn = new TextToolItem("Ajouter", "icone-vcard-ajouter");
|
1115 |
ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {
|
1098 |
ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {
|
1116 |
@Override
|
1099 |
@Override
|
- |
|
1100 |
public void componentSelected(ToolBarEvent ce) {
|
- |
|
1101 |
StructureAPersonne personne = new StructureAPersonne();
|
1117 |
public void componentSelected(ToolBarEvent ce) {
|
1102 |
grillePersonnel.stopEditing();
|
1118 |
StructureAPersonne personne = new StructureAPersonne();
|
1103 |
int numNouveau = grillePersonnel.getData("nouveau");
|
1119 |
grillePersonnel.stopEditing();
|
1104 |
grillePersonnel.setData("nouveau", ++numNouveau);
|
1120 |
personnelGrilleMagazin.insert(personne, 0);
|
1105 |
personnelGrilleMagazin.insert(personne, 0);
|
1121 |
grillePersonnel.startEditing(0, 0);
|
1106 |
grillePersonnel.startEditing(0, 0);
|
Line 1146... |
Line 1131... |
1146 |
cp.setTopComponent(toolBar);
|
1131 |
cp.setTopComponent(toolBar);
|
Line 1147... |
Line 1132... |
1147 |
|
1132 |
|
Line 1148... |
Line 1133... |
1148 |
ColumnModel cm = new ColumnModel(configs);
|
1133 |
ColumnModel cm = new ColumnModel(configs);
|
- |
|
1134 |
|
1149 |
|
1135 |
grillePersonnel = new EditorGrid<StructureAPersonne>(personnelGrilleMagazin, cm);
|
1150 |
grillePersonnel = new EditorGrid<StructureAPersonne>(personnelGrilleMagazin, cm);
|
1136 |
grillePersonnel.setData("nouveau", 0);
|
1151 |
grillePersonnel.setBorders(true);
|
1137 |
grillePersonnel.setBorders(true);
|
1152 |
grillePersonnel.setSelectionModel(sm);
|
1138 |
grillePersonnel.setSelectionModel(sm);
|
1153 |
grillePersonnel.addPlugin(sm);
|
1139 |
grillePersonnel.addPlugin(sm);
|
1154 |
grillePersonnel.addPlugin(checkColumn);
|
1140 |
grillePersonnel.addPlugin(checkColumn);
|
1155 |
grillePersonnel.setAutoExpandColumn("specialite");
|
1141 |
grillePersonnel.setAutoExpandColumn("specialite");
|
- |
|
1142 |
grillePersonnel.setStripeRows(true);
|
- |
|
1143 |
grillePersonnel.setTrackMouseOver(true);
|
- |
|
1144 |
grillePersonnel.addListener(Events.ValidateEdit, new Listener<GridEvent>() {
|
- |
|
1145 |
|
- |
|
1146 |
public void handleEvent(GridEvent ge) {
|
- |
|
1147 |
|
- |
|
1148 |
GWT.log(ge.property+" : "+ge.value, null);
|
- |
|
1149 |
List<StructureAPersonne> personnes = personnelGrilleMagazin.getModels();
|
- |
|
1150 |
StructureAPersonneListe personnelModifie = new StructureAPersonneListe();
|
- |
|
1151 |
for (int i = 0; i < personnes.size(); i++) {
|
- |
|
1152 |
personnelModifie.put(""+i, personnes.get(i));
|
- |
|
1153 |
}
|
- |
|
1154 |
personnel = personnelModifie;
|
- |
|
1155 |
}
|
1156 |
grillePersonnel.setStripeRows(true);
|
1156 |
|
Line 1157... |
Line 1157... |
1157 |
grillePersonnel.setTrackMouseOver(true);
|
1157 |
});
|
1158 |
cp.add(grillePersonnel);
|
1158 |
cp.add(grillePersonnel);
|