private void updateStatus() { if (text != null) { StringBuilder sb = new StringBuilder(); String color = isEnabled() ? "black" : "#AAAAAA"; sb.append("<font color='").append(color).append("'>").append(text).append("</font>"); super.setHTML(sb.toString()); } }
// Charger la zone de modification par les differents elements du formulaire public void chargerFormulaire() { // Vider la zone de modification dans le cas où elle est occupée par un // autre formulaire if (bodyExist) { RootPanel.get("container_principal").clear(); Document.get().getBody().removeChild(bodyForm.getElement()); dualListBox.clear(); enregistrer = new Anchor(); } // Construire la zone de modification bodyForm = new BodyFormulaire(); Document.get().getBody().appendChild(bodyForm.getElement()); // Alimenter la liste des comptes CU et CA alimenterList(); // Ajouter Action au lien "Allocation du formulaire" Anchor link_allocation = Anchor.wrap(bodyForm.getLink_allocation()); link_allocation.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { // Afficher le popup contenant la dual liste qui contient la // liste des comptes CA et CU FormulaireController.CreateDialogBoxAllocation(dualListBox, false, null).show(); } }); // Ajouter le button supprimer Formulaire supprimer.setHTML( "<a class='bouton_enregistrer floatRight' style='margin-right:13%; cursor:pointer'>Supprimer</a>"); RootPanel.get("button_Enregistrer").add(supprimer); // RootPanel.get("form_formulaire_allocation").getElement().appendChild(dualListBox.getElement()); RootPanel.get("form_formulaire_creation").getElement().appendChild(form.getElement()); enregistrer.setHTML( "<a class='bouton_enregistrer floatRight' style='margin-right:15px; cursor:pointer'>Enregistrer</a>"); RootPanel.get("button_Enregistrer").add(enregistrer); RootPanel.get("contenu_principal_formulaire").add(new FormulaireBoard()); RootPanel.get("container_principal").insert(FormulaireController.createImageGrid(), 0); bodyExist = true; // Remplir le formulaire nom et commentaire RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, FORMULAIRE_URL + formulaire_id); builder.setHeader("Content-Type", "application/json"); try { builder.sendRequest( null, new RequestCallback() { public void onError(Request request, Throwable exception) {} @SuppressWarnings("deprecation") public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK) { JSONValue formAsJSONValue = JSONParser.parse(response.getText()); formAsJSONObject = formAsJSONValue.isObject(); ((InputElement) form.getForm_nom()) .setValue(formAsJSONObject.get("nom").isString().stringValue()); ((InputElement) form.getForm_comment()) .setValue(formAsJSONObject.get("commentaire").isString().stringValue()); ancienNom = form.getForm_nom().getValue(); // ((InputElement)form.getForm_nom()).setDisabled(true); } } }); } catch (RequestException e) { System.out.println("RequestException"); } // Remplir la zone de création par les elements et les parametres builder = new RequestBuilder( RequestBuilder.GET, ELEMENT_URL + "listerElement/formulaire/" + formulaire_id); builder.setHeader("Content-Type", "application/json"); try { builder.sendRequest( null, new RequestCallback() { public void onError(Request request, Throwable exception) {} @SuppressWarnings("deprecation") public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK) { String elementsAsJSONString = response.getText(); JSONValue elementsAsJSONValue = JSONParser.parse(elementsAsJSONString); JSONArray elementsAsJSONArray = elementsAsJSONValue.isArray(); for (int i = 0; i < elementsAsJSONArray.size(); i++) { JSONValue elementAsJSONValue = elementsAsJSONArray.get(i); JSONObject elementAsJSONObject = elementAsJSONValue.isObject(); elementsAsString += elementAsJSONObject.get("id").isNumber().toString() + "-"; getParamsByElement( Long.parseLong(elementAsJSONObject.get("id").isNumber().toString()), Integer.parseInt(elementAsJSONObject.get("position_y").isNumber().toString()), Integer.parseInt(elementAsJSONObject.get("position_x").isNumber().toString()), elementAsJSONObject.get("type").isString().stringValue()); } } } }); } catch (RequestException e) { System.out.println("RequestException"); } // Action de suppression d'un formulaire supprimer.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { // Supprimer le formulaire RequestBuilder builder = new RequestBuilder( RequestBuilder.PUT, FORMULAIRE_URL + "supprimer/" + formulaire_id); builder.setHeader("Content-Type", "application/json"); try { builder.sendRequest( null, new RequestCallback() { public void onError(Request request, Throwable exception) {} public void onResponseReceived(Request request, Response response) { Window.Location.reload(); } }); } catch (RequestException e) { System.out.println("RequestException"); } } }); // Action de l'enregistrement du formulaire dans la base de données enregistrer.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { FormulaireController.recupererElements(choices, options, elements, parametres); // Ajouter les elements regroupés dans la base de données ajouterFormulaire(elements); } }); final Anchor apercu = new Anchor(); // Création du lien de l'aperçu apercu.setHTML( "<a class='bouton_enregistrer floatRight' style='margin-right:15px; cursor:pointer'>Aperçu</a>"); RootPanel.get("button_Enregistrer").add(apercu); apercu.addClickHandler( new ClickHandler() { @SuppressWarnings("rawtypes") public void onClick(ClickEvent event) { choices = new ArrayList(); options = new ArrayList(); elements = new ArrayList(); parametres = new ArrayList(); FormulaireController.recupererElements(choices, options, elements, parametres); bodyapercu = new BodyApercu(); // Passer à l'interface de l'aperçu Document.get().getBody().removeChild(bodyForm.getElement()); Document.get().getBody().appendChild(bodyapercu.getElement()); // Création de la page de l'aperçu FormulaireController.pageApercu( bodyapercu, form.getForm_nom().getValue(), form.getForm_comment().getValue(), elements, parametres, choices, options); Anchor retourAnchor = Anchor.wrap(bodyapercu.getRetour()); retourAnchor.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { choices = new ArrayList(); options = new ArrayList(); elements = new ArrayList(); parametres = new ArrayList(); Document.get().getBody().removeChild(bodyapercu.getElement()); Document.get().getBody().appendChild(bodyForm.getElement()); } }); } }); }
public com.google.gwt.user.client.ui.Widget createAndBindUi( final org.restlet.example.book.restlet.ch09.client.TopPanel owner) { org.restlet.example.book.restlet.ch09.client.TopPanel_BinderImpl_GenBundle clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay = (org.restlet.example.book.restlet.ch09.client.TopPanel_BinderImpl_GenBundle) GWT.create( org.restlet.example.book.restlet.ch09.client.TopPanel_BinderImpl_GenBundle .class); com.google.gwt.resources.client.ImageResource logo = clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.logo(); com.google.gwt.resources.client.DataResource logoIe6Data = clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.logoIe6Data(); org.restlet.example.book.restlet.ch09.client.TopPanel_BinderImpl_GenCss_style style = clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style(); java.lang.String domId0 = com.google.gwt.dom.client.Document.get().createUniqueId(); com.google.gwt.user.client.ui.Anchor signOutLink = (com.google.gwt.user.client.ui.Anchor) GWT.create(com.google.gwt.user.client.ui.Anchor.class); java.lang.String domId1 = com.google.gwt.dom.client.Document.get().createUniqueId(); com.google.gwt.user.client.ui.Anchor aboutLink = (com.google.gwt.user.client.ui.Anchor) GWT.create(com.google.gwt.user.client.ui.Anchor.class); com.google.gwt.user.client.ui.HTMLPanel f_HTMLPanel1 = new com.google.gwt.user.client.ui.HTMLPanel( template .html3( "" + style.logo() + "", "" + style.statusDiv() + "", "" + style.linksDiv() + "", domId0, domId1) .asString()); signOutLink.setHTML(template.html1().asString()); signOutLink.setHref("javascript:;"); aboutLink.setHTML(template.html2().asString()); aboutLink.setHref("javascript:;"); UiBinderUtil.TempAttachment attachRecord0 = UiBinderUtil.attachToDom(f_HTMLPanel1.getElement()); com.google.gwt.user.client.Element domId0Element = com.google.gwt.dom.client.Document.get().getElementById(domId0).cast(); com.google.gwt.user.client.Element domId1Element = com.google.gwt.dom.client.Document.get().getElementById(domId1).cast(); attachRecord0.detach(); f_HTMLPanel1.addAndReplaceElement(signOutLink, domId0Element); f_HTMLPanel1.addAndReplaceElement(aboutLink, domId1Element); final com.google.gwt.event.dom.client.ClickHandler handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames1 = new com.google.gwt.event.dom.client.ClickHandler() { public void onClick(com.google.gwt.event.dom.client.ClickEvent event) { owner.onAboutClicked(event); } }; aboutLink.addClickHandler(handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames1); final com.google.gwt.event.dom.client.ClickHandler handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames2 = new com.google.gwt.event.dom.client.ClickHandler() { public void onClick(com.google.gwt.event.dom.client.ClickEvent event) { owner.onSignOutClicked(event); } }; signOutLink.addClickHandler(handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames2); owner.aboutLink = aboutLink; owner.signOutLink = signOutLink; clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style().ensureInjected(); return f_HTMLPanel1; }