--- /dev/null
+/*****************************************************************************
+ * Copyright Igor Barma, Eric Brun, Alexandre Desoubeaux, Christian Martel,
+ * (2 décembre 2008)
+ *
+ * Ce logiciel est un programme informatique servant à l'évaluation des
+ * compétences.
+ *
+ * Ce logiciel est régi par la licence CeCILL soumise au droit français et
+ * respectant les principes de diffusion des logiciels libres. Vous pouvez
+ * utiliser, modifier et/ou redistribuer ce programme sous les conditions
+ * de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
+ * sur le site "http://www.cecill.info".
+ *
+ * En contrepartie de l'accessibilité au code source et des droits de copie,
+ * de modification et de redistribution accordés par cette licence, il n'est
+ * offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
+ * seule une responsabilité restreinte pèse sur l'auteur du programme, le
+ * titulaire des droits patrimoniaux et les concédants successifs.
+ *
+ * A cet égard l'attention de l'utilisateur est attirée sur les risques
+ * associés au chargement, à l'utilisation, à la modification et/ou au
+ * développement et à la reproduction du logiciel par l'utilisateur étant
+ * donné sa spécificité de logiciel libre, qui peut le rendre complexe à
+ * manipuler et qui le réserve donc à des développeurs et des professionnels
+ * avertis possédant des connaissances informatiques approfondies. Les
+ * utilisateurs sont donc invités à charger et tester l'adéquation du
+ * logiciel à leurs besoins dans des conditions permettant d'assurer la
+ * sécurité de leurs systèmes et ou de leurs données et, plus généralement,
+ * à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
+ *
+ * Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
+ * pris connaissance de la licence CeCILL, et que vous en avez accepté les
+ * termes.
+ *******************************************************************************/
+package com.pentila.evalcomp.client.services.certification;
+
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.gwtext.client.util.Format;
+import com.pentila.evalcomp.client.ConnexionServer;
+import com.pentila.evalcomp.client.evalFolder.SmartExamenValidation;
+import com.pentila.evalcomp.client.i18n.Messages;
+import com.pentila.evalcomp.client.services.IServiceWidgetContainerPaging;
+import com.pentila.evalcomp.client.services.validation.SmartValidationUserGrid;
+import com.pentila.evalcomp.client.services.validation.ValidationGridGlobal;
+import com.pentila.evalcomp.client.utilities.Tools;
+import com.pentila.evalcomp.client.widget.SmartWindow;
+import com.pentila.evalcomp.domain.certification.UserCertInstance;
+import com.pentila.evalcomp.domain.plan.PlanRef;
+import com.pentila.evalcomp.domain.transit.TUserCompositeValidation;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.HeaderControls;
+import com.smartgwt.client.types.SelectionAppearance;
+import com.smartgwt.client.types.Side;
+import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.widgets.HeaderControl;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.events.DrawEvent;
+import com.smartgwt.client.widgets.events.DrawHandler;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.CellDoubleClickEvent;
+import com.smartgwt.client.widgets.grid.events.CellDoubleClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.events.ClickHandler;
+import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
+import com.smartgwt.client.widgets.tab.Tab;
+import com.smartgwt.client.widgets.tab.TabSet;
+import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
+import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
+
+/**
+ * The Class EvalGrid.
+ */
+public class SmartCertificationNumericGrid extends SmartValidationGrid {
+
+
+ /** The data index. */
+ List<String> dataIndex = Arrays.asList(new String[]{"need", "free", "nbeval", "nbValidateCompetence", "nbValidateDomain"});
+
+ /** The undo. */
+ Map<String, String> undo = new HashMap<String, String>();
+
+ /** The row. */
+ int row;
+
+ /** The smart validation user grid. */
+ SmartValidationUserGrid smartValidationUserGrid;
+
+ /**
+ * Instantiates a new smart certification numeric grid.
+ *
+ * @param provider the provider
+ * @param planRef the plan ref
+ * @param recordDef the record def
+ * @param columns the columns
+ * @param readOnly the read only
+ */
+ public SmartCertificationNumericGrid(IServiceWidgetContainerPaging provider,
+ PlanRef planRef, List<String> recordDef, ListGridField[] columns,
+ boolean readOnly) {
+ super(provider, planRef, recordDef, columns, readOnly);
+ initCert();
+ }
+
+
+ /**
+ * Inits the cert.
+ */
+ private void initCert() {
+
+ this.setShowAllRecords(true);
+
+ setHoverWidth(300);
+
+ ListGridField lgf = this.getField("fil");
+ lgf.setAlign(Alignment.CENTER);
+ lgf.setCellFormatter(new CellFormatter(){
+
+ public String format(Object value, ListGridRecord record,
+ int rowNum, int colNum) {
+
+ String v = value.toString();
+ v = record.getAttribute(getFieldName(colNum));
+ String res = "";
+ if (!v.equals("")){
+ res = "<img src=\"" + Tools.getBaseURL() +"images/" + "add_comment-16x16.png" + "\"/>";
+ }
+
+ return res;
+
+ }
+
+ });
+
+ lgf.setShowHover(true);
+
+ lgf.setHoverCustomizer(new HoverCustomizer(){
+
+ public String hoverHTML(Object value, ListGridRecord record,
+ int rowNum, int colNum) {
+
+ String v = value.toString();
+
+ String username = record.getAttributeAsString("lastname") + " " + record.getAttributeAsString("firstname");
+ v = record.getAttribute(getFieldName(colNum));
+
+ String res ="";
+
+ if (v.equals("")){
+ res = Format.format(Messages.getString("Double_cliquer_pour_initier_un_fil_de_discussion_au_sujet_de") , username);
+ }else{
+ res = Format.format(Messages.getString("Fil_de_discussion_a_propos_de_username_nb_messages"), username, v);
+ }
+ return res;
+
+ }
+
+ });
+
+ ListGridField usernameField = this.getField("lastname");
+
+ usernameField.setCellFormatter(new CellFormatter() {
+ public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
+
+ if (value == null) {
+ return null;
+ }
+ try {
+
+ String res = value.toString() + " " + record.getAttributeAsString("firstname");
+
+ String state = record.getAttribute("uciState");
+ String uciId = record.getAttribute("uciId");
+ String waitForReply = record.getAttribute("waitForReply");
+
+
+ if (state.equals("" + UserCertInstance.INITIAL) || (state.equals("") && !uciId.equals(""))){
+ res = "<b>" + res + "</b>";
+ }else if (!state.equals("" + UserCertInstance.INITIAL) && !state.equals("")){
+ res = "<span style=\"color:#AAAAAA\">" + res + "</span>";
+ }
+
+ if (waitForReply != null && waitForReply.equals("1")){
+ res = res + "<img src=\"" + Tools.getBaseURL() +"images/" + "wait-16x16.png" + "\"/>";
+ }
+
+ return res;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return value.toString();
+ }
+ }
+ });
+
+
+ usernameField.setShowHover(true);
+ usernameField.setHoverCustomizer(new HoverCustomizer(){
+
+ public String hoverHTML(Object value, ListGridRecord record,
+ int rowNum, int colNum) {
+ String res = "";
+
+ res = value.toString() + " : ";
+ if (record.getAttribute("uciId").equals("")){
+ res += Messages.getString("le_dossier_de_ce_candidat_n_a_pas_encore_ete_consulte");
+ }else{
+ res += Messages.getString("le_dossier_de_ce_candidat_a_deja_ete_consulte");
+ }
+
+ return res;
+ }
+
+ });
+
+
+
+ new HoverCustomizer(){
+
+ public String hoverHTML(Object value, ListGridRecord record,
+ int rowNum, int colNum) {
+
+ String v = value.toString();
+
+ String username = record.getAttributeAsString("lastname") + " " + record.getAttributeAsString("firstname");
+ String competenceName = getField(colNum).getTitle();
+ String res = "";
+
+ v = record.getAttribute(getFieldName(colNum));
+ if (v.equals("0") || v.equals("1")){
+ res = Format.format(Messages.getString("Double_cliquer_pour_creer_une_demande_de_modification_pour_username_sur_la_competence_competenceName"), username, competenceName);
+ }else{
+ res = Format.format(Messages.getString("Double_cliquer_pour_supprimer_la_demande_de_modification_pour_username_sur_la_competence_competenceName"), username, competenceName);
+ }
+
+ return res;
+
+ }
+
+ };
+
+ /*for (ListGridField lf : this.getFields()){
+ if (lf.getName().startsWith("c")){
+ lf.setShowHover(true);
+ lf.setHoverCustomizer(hc);
+ }
+ }*/
+
+ ListGridField status = this.getField("status");
+
+ status.setAlign(Alignment.CENTER);
+ status.setCellFormatter(new CellFormatter() {
+ public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
+ String v = value.toString();
+ v = record.getAttribute(getFieldName(colNum));
+ String res = "";
+ if (v.equals("0")){
+ res = "<img src=\"" + Tools.getBaseURL() +"images/" + "attestation-16x16.png" + "\"/>";
+ }else{
+ res = "<img src=\"" + Tools.getBaseURL() +"images/" + "certificate-16x16.png" + "\"/>";
+ }
+
+ return res;
+ }
+ });
+
+ HoverCustomizer hcs = new HoverCustomizer(){
+
+ public String hoverHTML(Object value, ListGridRecord record,
+ int rowNum, int colNum) {
+
+ String v = value.toString();
+
+ String res = "";
+
+ v = record.getAttribute(getFieldName(colNum));
+ if (v.equals("0")){
+ res = Messages.getString("Attestation");
+ }else{
+ res = Messages.getString("Certificat");
+ }
+
+ return res;
+
+
+ }
+
+ };
+
+ status.setHoverCustomizer(hcs);
+ }
+
+ /* (non-Javadoc)
+ * @see com.pentila.evalcomp.client.services.certification.SmartValidationGrid#initilizeClicks()
+ */
+ protected void initilizeClicks(){
+
+ this.addCellDoubleClickHandler(new CellDoubleClickHandler(){
+
+ public void onCellDoubleClick(CellDoubleClickEvent event) {
+
+ Record record = event.getRecord();
+
+ String uid = record.getAttributeAsString("uid");
+ String username = record.getAttributeAsString("lastname") + " "+ record.getAttributeAsString("firstname");
+ String uciId = record.getAttribute("uciId");
+
+ String fieldName = getFieldName(event.getColNum());
+
+ if (fieldName.equals("lastname")){
+
+ if (uciId.equals("")){
+ row = event.getRowNum();
+ createUserCertInstance(event.getRowNum(), uid, username);
+ }else{
+
+ showUserDetail(uid, username, readOnly);
+ }
+ }else {
+
+
+
+
+
+ /*if (attr.startsWith("c") && !readOnly){
+
+ String ownerUid = event.getRecord().getAttributeAsString("uid");
+ String issuerUid = UserTools.getUser().getUid();
+
+ Long idComp = getCompositeData().getHeadersIds().get(event.getColNum()-1);
+
+ String rr = "";
+
+ String value = event.getRecord().getAttribute(attr);
+
+ if (value.equals("0") || value.equals("1")){
+
+ String key = event.getRowNum() +"_"+ event.getColNum();
+
+ undo.put(key, value);
+
+ rr = "2";
+ askDemand(ownerUid, issuerUid, idComp);
+ }else if (value.equals("2")){
+ String key = event.getRowNum() +"_"+ event.getColNum();
+ if (undo.containsKey(key)){
+ rr = undo.get(key);
+ }
+
+ deleteDemand(ownerUid, issuerUid, idComp, rr.equals(""));
+
+ }
+
+ event.getRecord().setAttribute(attr, rr);
+
+ refreshRow(event.getRowNum());
+
+
+
+ }else */if (fieldName.equals("fil")){
+
+ String nbmsg = record.getAttribute("fil");
+
+ if (nbmsg.equals("")){
+ initFil(uciId, uid, username);
+ }else{
+ showFil(new Long(uciId), username);
+ }
+
+
+ row = event.getRowNum();
+
+ }
+
+
+ }
+ }
+
+
+
+ });
+ }
+
+
+
+ /**
+ * Inits the fil.
+ *
+ * @param uciId the uci id
+ * @param uid the uid
+ * @param username the username
+ */
+ protected void initFil(String uciId, String uid, String username) {
+
+
+ CertificationNumericGrid g = (CertificationNumericGrid) provider;
+ g.initFil(uid, username);
+
+
+
+ }
+
+ /**
+ * Ask demand.
+ *
+ * @param ownerUid the owner uid
+ * @param issuerUid the issuer uid
+ * @param idComp the id comp
+ */
+ public void askDemand(String ownerUid, String issuerUid, Long idComp, String motiv){
+ CertificationNumericGrid g = (CertificationNumericGrid) provider;
+ g.askDemand(ownerUid, issuerUid, idComp, motiv);
+ }
+
+ /**
+ * Delete demand.
+ *
+ * @param ownerUid the owner uid
+ * @param issuerUid the issuer uid
+ * @param idComp the id comp
+ * @param reload the reload
+ */
+ public void deleteDemand(String ownerUid, String issuerUid,
+ Long idComp, boolean reload) {
+ CertificationNumericGrid g = (CertificationNumericGrid) provider;
+ g.deleteDemand(ownerUid, issuerUid, idComp, reload);
+
+ }
+
+ /**
+ * Show fil.
+ *
+ * @param uciId the uci id
+ * @param username the username
+ */
+ public void showFil(Long uciId, String username) {
+
+ CertificationNumericGrid g = (CertificationNumericGrid) provider;
+ g.messageSended(uciId, username);
+ }
+
+ /* (non-Javadoc)
+ * @see com.pentila.evalcomp.client.services.certification.SmartValidationGrid#loadDataSource()
+ */
+ public void loadDataSource() {
+
+ undo.clear();
+
+ ListGridRecord[] ll = new ListGridRecord[objList.length];
+ int i = 0;
+ for (Object[] o : objList){
+
+ ListGridRecord smartgwtRecord = new ListGridRecord();
+ for (String fieldName : this.recordDef) {
+
+ String rr = (String) getFieldValue(i, fieldName);
+
+ if (dataIndex.contains(fieldName) ){
+
+
+ smartgwtRecord.setAttribute(fieldName, Integer.valueOf(rr));
+ }else{
+ smartgwtRecord.setAttribute(fieldName, rr);
+ }
+
+
+
+ if (fieldName.equals("uciState") && !rr.equals(""+UserCertInstance.INITIAL) && !rr.equals("")){
+
+ smartgwtRecord.setEnabled(false);
+
+ }
+
+ }
+ ll[i++] = smartgwtRecord;
+
+ }
+ this.getDataSource().setTestData(ll);
+ this.setData(ll);
+
+ }
+
+ /**
+ * Sets the attribute grid.
+ *
+ * @param attributeName the attribute name
+ * @param attributeValue the attribute value
+ * @param resetRow the reset row
+ */
+ public void setAttributeGrid(String attributeName, String attributeValue, boolean resetRow){
+ if (row != -1){
+ getRecord(row).setAttribute(attributeName, attributeValue);
+
+ if (resetRow){
+ refreshRow(row);
+ row = -1;
+ }
+
+ }
+ }
+
+ /**
+ * Creates the user cert instance.
+ *
+ * @param rowNum the row num
+ * @param uid the uid
+ * @param username the username
+ */
+ private void createUserCertInstance(int rowNum, String uid, String username) {
+ CertificationNumericGrid g = (CertificationNumericGrid) provider;
+ g.createUserCertInstance(rowNum, uid, username);
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.smartgwt.client.widgets.grid.ListGrid#getHeaderContextMenuItems(java.lang.Integer)
+ */
+ @Override
+ protected MenuItem[] getHeaderContextMenuItems(final Integer fieldNum) {
+ final MenuItem[] items = super.getHeaderContextMenuItems(fieldNum);
+
+ if (fieldNum == 1){
+
+ MenuItem customItem = new MenuItem(Messages.getString("Reactiver_les_elements"));
+ customItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ int i = 1;
+ for (ListGridRecord lgr : getRecords()){
+ lgr.setEnabled(true);
+ lgr.setAttribute("uciState", "" + UserCertInstance.INITIAL);
+ refreshRow(i);
+ i++;
+ }
+ }
+ });
+ MenuItem[] newItems = new MenuItem[items.length + 1];
+ for (int i = 0; i < items.length; i++) {
+ MenuItem item = items[i];
+ newItems[i] = item;
+ }
+ newItems[items.length] = customItem;
+ return newItems;
+ }else{
+ return items;
+ }
+ }
+
+ /* Show user detail.
+ *
+ * @param login
+ * the login
+ * @param username
+ * the username
+ */
+ /* (non-Javadoc)
+ * @see com.pentila.evalcomp.client.services.certification.SmartValidationGrid#showUserDetail(java.lang.String, java.lang.String, java.lang.Boolean)
+ */
+ public void showUserDetail2(final String login, final String username, final Boolean optionalReadOnly) {
+
+ final SmartWindow window = new SmartWindow();
+
+ window.setTitle(Format.format(Messages.getString("user_detail"),
+ new String[] { username }));
+ //window.setClosable(true);
+ //window.setMaximizable(true);
+ window.setWidth(800);
+ window.setHeight(600);
+ com.smartgwt.client.widgets.events.ClickHandler clickHandler = new com.smartgwt.client.widgets.events.ClickHandler() {
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
+
+ if (window.getMaximized() != null && window.getMaximized()){
+
+ window.restore();
+
+ }else{
+
+ window.maximize();
+ }
+
+ }
+ };
+ HeaderControl maximize = new HeaderControl(HeaderControl.MAXIMIZE, clickHandler);
+
+ window.setHeaderControls(HeaderControls.HEADER_LABEL , HeaderControls.MINIMIZE_BUTTON,HeaderControls.MAXIMIZE_BUTTON, maximize, HeaderControls.CLOSE_BUTTON);
+ //window.setLayout(new FitLayout());
+
+
+ final VLayout superContainer = new VLayout();
+ superContainer.setWidth100();
+ superContainer.setHeight100();
+ final HLayout hlayout = new HLayout();
+ hlayout.setHeight(20);
+ hlayout.setWidth100();
+ hlayout.setAlign(Alignment.RIGHT);
+ hlayout.setAlign(VerticalAlignment.CENTER);
+
+
+ window.addItem(superContainer);
+
+ final SmartCertificationNumericGrid me = this;
+
+
+ AsyncCallback callback = new AsyncCallback() {
+
+ public void onFailure(Throwable caught) {
+ // do some UI stuff to show failure
+ System.out.println("Probleme dans edit prop"); //$NON-NLS-1$
+ System.out.println(caught.getMessage());
+ Tools.hideLoadingRegion(getID());
+
+ }
+
+ public void onSuccess(Object result) {
+
+ TUserCompositeValidation T = (TUserCompositeValidation) result;
+
+ Boolean ro = readOnly;
+
+ if (optionalReadOnly != null){
+ ro = optionalReadOnly;
+ }
+
+ //readOnly = ro
+ //readOnlyValidation = ?
+
+ smartValidationUserGrid = new SmartValidationUserGrid(login, username, me, T, true, ro);
+ smartValidationUserGrid.setShowDetailED(true);
+
+ //g.setHeight(500);
+
+ smartValidationUserGrid.initializeInterface();
+
+ smartValidationUserGrid.setWidth100();
+ superContainer.addMember(smartValidationUserGrid);
+
+ smartValidationUserGrid.update(T);
+
+ Tools.hideLoadingRegion(getID());
+ }
+ };
+
+ Tools.showLoadingRegion(getID(), Messages
+ .getString("MAJ_resultats"), Messages
+ .getString("Chargement"));
+ ConnexionServer.validationService.getUserTable(planRef.getId(), sicId, login, null, null,
+ callback);
+
+
+ Boolean ro2 = readOnly;
+
+ if (optionalReadOnly != null){
+ ro2 = optionalReadOnly;
+ }
+
+ if (!ro2){
+
+ IButton validerButton = new IButton(Messages.getString("Valider"));
+
+ validerButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler(){
+
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
+ AsyncCallback callback = new AsyncCallback() {
+
+ public void onFailure(Throwable caught) {
+ // do some UI stuff to show failure
+ System.out.println("Probleme dans edit prop");
+ System.out.println(caught.getMessage());
+ window.hide();
+ }
+
+ public void onSuccess(Object result) {
+
+
+ provider.update();
+
+ window.hide();
+
+ }
+ };
+
+ ConnexionServer.validationService.changeCompetenceInstances(smartValidationUserGrid
+ .getCompetenceInstances(), callback);
+
+ }
+
+ });
+
+
+
+ hlayout.addMember(validerButton);
+ }
+ IButton cancelButton = new IButton(Messages.getString("Annuler"));
+
+ cancelButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler(){
+
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
+ window.hide();
+
+ }
+
+ });
+
+
+ hlayout.addMember(cancelButton);
+ window.setCanDragReposition(true);
+ window.setCanDragResize(true);
+ window.centerInPage();
+ window.show();
+
+
+ }
+
+ public void showUserDetail(final String login, final String username, final Boolean optionalReadOnly) {
+ final SmartWindow window = new SmartWindow();
+
+ window.setTitle(Format.format(Messages.getString("user_detail"),
+ new String[] { username }));
+ //window.setClosable(true);
+ //window.setMaximizable(true);
+ window.setWidth(800);
+ window.setHeight(600);
+ com.smartgwt.client.widgets.events.ClickHandler clickHandler = new com.smartgwt.client.widgets.events.ClickHandler() {
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
+
+ if (window.getMaximized() != null && window.getMaximized()){
+
+ window.restore();
+
+ }else{
+
+ window.maximize();
+ }
+
+ }
+ };
+ HeaderControl maximize = new HeaderControl(HeaderControl.MAXIMIZE, clickHandler);
+
+ window.setHeaderControls(HeaderControls.HEADER_LABEL , HeaderControls.MINIMIZE_BUTTON,HeaderControls.MAXIMIZE_BUTTON, maximize, HeaderControls.CLOSE_BUTTON);
+ //window.setLayout(new FitLayout());
+
+
+ final VLayout superContainer = new VLayout();
+ superContainer.setWidth100();
+ superContainer.setHeight100();
+ final HLayout hlayout = new HLayout();
+ hlayout.setHeight(20);
+ hlayout.setWidth100();
+ hlayout.setAlign(Alignment.RIGHT);
+ hlayout.setAlign(VerticalAlignment.CENTER);
+
+
+ //window.addItem(superContainer);
+ initializeValidation(login, username, window );
+
+
+ Boolean ro2 = readOnly;
+
+ if (optionalReadOnly != null){
+ ro2 = optionalReadOnly;
+ }
+
+ if (!ro2){
+
+ IButton validerButton = new IButton(Messages.getString("Valider"));
+
+ validerButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler(){
+
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
+ AsyncCallback callback = new AsyncCallback() {
+
+ public void onFailure(Throwable caught) {
+ // do some UI stuff to show failure
+ System.out.println("Probleme dans edit prop");
+ System.out.println(caught.getMessage());
+ window.hide();
+ }
+
+ public void onSuccess(Object result) {
+
+
+ provider.update();
+
+ window.hide();
+
+ }
+ };
+
+ ConnexionServer.validationService.changeCompetenceInstances(smartValidationUserGrid
+ .getCompetenceInstances(), callback);
+
+ }
+
+ });
+
+
+
+ hlayout.addMember(validerButton);
+ }
+ IButton cancelButton = new IButton(Messages.getString("Annuler"));
+
+ cancelButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler(){
+
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
+ window.hide();
+
+ }
+
+ });
+
+
+ hlayout.addMember(cancelButton);
+ window.setCanDragReposition(true);
+ window.setCanDragResize(true);
+ window.centerInPage();
+ window.show();
+
+ }
+
+
+ protected void initializeValidation(final String login, final String username, SmartWindow section) {
+
+
+ if (planRef.getMethodValidationInstances().size() > 1){
+ TabSet tabSet = new TabSet();
+
+ tabSet.setTabBarPosition(Side.LEFT);
+ /*final Tab tab1 = new Tab("<span class=\"echo-style\">" + Messages.getString("Global") + "</span>");
+
+
+
+ tabSet.addDrawHandler(new DrawHandler(){
+
+ public void onDraw(DrawEvent event) {
+ tab1.addTabSelectedHandler(new TabSelectedHandler(){
+
+ public void onTabSelected(TabSelectedEvent event) {
+
+ initializeValidationResultsGlobal( login, event.getTab());
+
+
+
+
+ }
+
+ });
+
+ initializeValidationResultsGlobal(login, tab1);
+
+ }
+
+ });*/
+
+
+
+
+ final Tab tab2 = new Tab("<span class=\"echo-style echo-style2\">" + Messages.getString("Pratique") + "</span>");
+
+ tabSet.addDrawHandler(new DrawHandler(){
+
+ public void onDraw(DrawEvent event) {
+ tab2.addTabSelectedHandler(new TabSelectedHandler(){
+
+ public void onTabSelected(TabSelectedEvent event) {
+
+ initializeValidationResults(login, username, event.getTab(), null) ;
+
+
+
+
+ }
+
+ });
+
+ initializeValidationResults(login, username, tab2, null) ;
+
+ }
+
+ });
+
+ /*tab2.addTabSelectedHandler(new TabSelectedHandler(){
+
+ public void onTabSelected(TabSelectedEvent event) {
+
+ initializeValidationResults(login, event.getTab(), null) ;
+
+ }
+
+ });*/
+
+ final Tab tab3 = new Tab("<span class=\"echo-style echo-style3\">" + Messages.getString("Theorique") + "</span>");
+ tab3.addTabSelectedHandler(new TabSelectedHandler(){
+
+ public void onTabSelected(TabSelectedEvent event) {
+
+ /*VLayout vl = new VLayout();
+
+ HLayout hLayout = new HLayout();
+
+ vl.addMember(hLayout);
+ hLayout.setAutoHeight();
+ hLayout.addMember(initializeDetailTheo(planRef));
+
+ final HLayout chartContainer = new HLayout();
+
+ hLayout.addMember(chartContainer);
+ hLayout.setShowResizeBar(true);*/
+
+ final SmartExamenValidation SEV = new SmartExamenValidation(login, planRef.getPlan().getId(), planRef.getReferentiel().getId());
+ SEV.setHeight100();
+ /*vl.addMember(SEV);
+ Function f = new Function(){
+
+ public void execute() {
+
+ chartContainer.addMember(Tools.getChart(SEV.getStatsDomain(), Messages.getString("Domain"), true, "400", "170"));
+
+ }
+
+ };
+
+ SEV.setCallBackFunction(f);
+ */
+
+ SEV.update();
+
+
+
+ tab3.setPane(SEV);
+
+ }
+
+ });
+ tabSet.setTabs(tab2, tab3);
+
+ section.addItem(tabSet);
+
+ }else if (planRef.getMethodValidationInstance() != null){
+
+ initializeValidationResults(login, username, null, section) ;
+
+ }else if (planRef.getMethodValidationInstanceTheorique() != null){
+ /*VLayout vl = new VLayout();
+
+ HLayout hLayout = new HLayout();
+
+ vl.addMember(hLayout);
+ hLayout.setAutoHeight();
+ hLayout.addMember(initializeDetailTheo(planRef));
+
+ final HLayout chartContainer = new HLayout();
+
+ hLayout.addMember(chartContainer);
+ hLayout.setShowResizeBar(true);*/
+
+ final SmartExamenValidation SEV = new SmartExamenValidation(login, planRef.getPlan().getId(), planRef.getReferentiel().getId());
+ SEV.setHeight100();
+ /*vl.addMember(SEV);
+ Function f = new Function(){
+
+ public void execute() {
+
+ chartContainer.addMember(Tools.getChart(SEV.getStatsDomain(), Messages.getString("Domain"), true, "400", "170"));
+
+ }
+
+ };
+
+ SEV.setCallBackFunction(f);
+ */
+ SEV.update();
+
+ section.addItem(SEV);
+ }
+
+
+
+
+
+
+
+
+ }
+
+
+ private void initializeValidationResults(final String login, final String username, final Tab tab, final SmartWindow section) {
+
+ final SmartCertificationNumericGrid me = this;
+
+ AsyncCallback callback = new AsyncCallback() {
+
+ public void onFailure(Throwable arg0) {
+
+ Tools.hideLoadingRegion(getID());
+ }
+
+ public void onSuccess(Object result) {
+ TUserCompositeValidation t = (TUserCompositeValidation) result;
+
+ /*VLayout vLayout = new VLayout();
+ vLayout.setShowEdges(true);
+
+ vLayout.setMembersMargin(5);
+ vLayout.setLayoutMargin(10);
+ vLayout.setWidth100();
+
+ DetailViewer detail = initializeDetail(t);
+
+
+ HLayout hLayout = new HLayout();
+
+ vLayout.addMember(hLayout);
+ hLayout.setAutoHeight();
+ hLayout.addMember(detail);
+ hLayout.setShowResizeBar(true);
+ */
+ final SmartValidationUserGrid v = new SmartValidationUserGrid(login, username, me, t, true, readOnly, false);
+
+ v.setShowDetailED(true);
+ v.setPositionFromParent(false);
+
+ v.setHeight100();
+
+ v.initializeInterface();
+ v.update(t);
+ /*
+ hLayout.addMember(Tools.getChart(v.getStatsDomain(), Messages.getString("Domain"), false, "200", "170"));
+ hLayout.addMember(Tools.getChart(v.getStats(), Messages.getString("Competences"), true, "330", "170"));
+
+
+ v.setWidth100();
+ v.setZIndex(1);
+
+
+ vLayout.addMember(v);
+ */
+
+ if (tab != null){
+ tab.setPane(v);
+ }else{
+ section.addItem(v);
+ }
+
+
+
+ Tools.hideLoading();
+
+ }
+
+ };
+ Tools.showLoadingRegion(getID(), Messages
+ .getString("MAJ_resultats"), Messages
+ .getString("Chargement"));
+ ConnexionServer.validationService.getUserTable(planRef.getId(), sicId, login, null, null,
+ callback);
+ }
+
+ protected void initializeValidationResultsGlobal(String login, Tab tab) {
+ Set<String> ss= new HashSet<String>();
+ ss.add(login);
+
+ final ValidationGridGlobal vgg = new ValidationGridGlobal(planRef, sicId, true, ss);
+ tab.setPane(vgg);
+ vgg.setHeight100();
+ /*Function f = new Function(){
+
+ public void execute() {
+
+ vgg.getChartContainer().addMember(Tools.getChart(vgg.getStatsDomain(), Messages.getString("Domain"), false, "200", "170"));
+ vgg.getChartContainer().addMember(Tools.getChart(vgg.getStats(), Messages.getString("Competences"), true, "400", "170"));
+ }
+
+ };
+
+ vgg.setCallBackFunction(f);
+ */
+ vgg.initializeInterface();
+
+ vgg.getPagerWidget().setVisible(false);
+ vgg.getGrid().getField("lastname").setHidden(true);
+ vgg.getGrid().setSelectionAppearance(SelectionAppearance.ROW_STYLE);
+
+
+ //vgg.update();
+
+ }
+
+}