Example usage for com.google.gwt.http.client RequestBuilder sendRequest

List of usage examples for com.google.gwt.http.client RequestBuilder sendRequest

Introduction

In this page you can find the example usage for com.google.gwt.http.client RequestBuilder sendRequest.

Prototype

public Request sendRequest(String requestData, RequestCallback callback) throws RequestException 

Source Link

Document

Sends an HTTP request based on the current builder configuration with the specified data and callback.

Usage

From source file:org.freemedsoftware.gwt.client.widget.PatientTagsWidget.java

License:Open Source License

/**
 * Update database to set new tag.//from w ww . j a va 2  s  .  c o  m
 * 
 * @param tag
 */
public void addTag(final String tag) {
    if (Util.getProgramMode() == ProgramMode.STUBBED) {
        wEntry.clear();
        addTagToDisplay(tag);
    } else if (Util.getProgramMode() == ProgramMode.JSONRPC) {
        String[] params = { JsonUtil.jsonify(patientId), tag };
        RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
                URL.encode(Util.getJsonRequest("org.freemedsoftware.module.PatientTag.CreateTag", params)));
        try {
            builder.sendRequest(null, new RequestCallback() {
                public void onError(Request request, Throwable ex) {
                    Util.showInfoMsg("PatientTags", _("Failed to add tags."));
                }

                public void onResponseReceived(Request request, Response response) {
                    if (200 == response.getStatusCode()) {
                        Boolean r = (Boolean) JsonUtil.shoehornJson(JSONParser.parseStrict(response.getText()),
                                "Boolean");
                        if (r != null) {
                            wEntry.clear();
                            addTagToDisplay(tag);
                            Util.showInfoMsg("PatientTags", _("Tag added."));
                        }
                    } else {
                        Util.showErrorMsg("PatientTags", _("Failed to add tags."));
                    }
                }
            });
        } catch (RequestException e) {
            Util.showErrorMsg("PatientTags", _("Failed to add tags."));
        }
    } else {
        getProxy().CreateTag(patientId, tag, new AsyncCallback<Boolean>() {
            public void onSuccess(Boolean o) {
                wEntry.clear();
                addTagToDisplay(tag);
                Util.showInfoMsg("PatientTags", _("Tag added."));
            }

            public void onFailure(Throwable t) {
                GWT.log("Exception", t);
                Util.showErrorMsg("PatientTags", _("Failed to add tags."));
            }
        });
    }
}

From source file:org.freemedsoftware.gwt.client.widget.PatientTagsWidget.java

License:Open Source License

/**
 * Actual addition of tag to display.//from  w w  w.  j av  a  2s. c  o  m
 * 
 * @param tag
 */
protected void addTagToDisplay(String tag) {
    JsonUtil.debug("addTagToDisplay(" + tag + ")");
    HorizontalPanel p = new HorizontalPanel();
    p.setTitle(tag);
    final String oldTagName = tag.trim();
    final HTML r = new HTML("<sup>X</sup>");
    final Anchor tagLabel = new Anchor(tag);
    tagLabel.setStylePrimaryName("freemed-PatientTag");
    JsonUtil.debug("addclicklistener");
    tagLabel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent evt) {
            final Widget w = (Widget) evt.getSource();
            final PopupPanel p = new PopupPanel(true);
            final FlexTable fT = new FlexTable();
            fT.setWidget(0, 0, new HTML("<b>" + oldTagName + "</b>"));
            fT.setWidget(1, 0, new Label(_("Rename Tag")));
            final TextBox newTagName = new TextBox();
            fT.setWidget(2, 0, newTagName);
            final CustomButton changeTagButton = new CustomButton(_("Change"), AppConstants.ICON_MODIFY);
            fT.setWidget(2, 1, changeTagButton);
            changeTagButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent bEvt) {
                    if (newTagName.getText().trim().length() > 0) {
                        if (Util.getProgramMode() == ProgramMode.STUBBED) {
                            // Stubbed mode
                            p.hide();
                            p.removeFromParent();
                            ((HorizontalPanel) w.getParent()).removeFromParent();
                            addTagToDisplay(newTagName.getText().trim());
                        } else if (Util.getProgramMode() == ProgramMode.JSONRPC) {
                            String[] params = { oldTagName, newTagName.getText().trim() };
                            RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
                                    URL.encode(Util.getJsonRequest(
                                            "org.freemedsoftware.module.PatientTag.ChangeTag", params)));
                            try {
                                builder.sendRequest(null, new RequestCallback() {
                                    public void onError(Request request, Throwable ex) {
                                    }

                                    public void onResponseReceived(Request request, Response response) {
                                        if (200 == response.getStatusCode()) {
                                            Boolean r = (Boolean) JsonUtil.shoehornJson(
                                                    JSONParser.parseStrict(response.getText()), "Boolean");
                                            if (r != null) {
                                                p.hide();
                                                p.removeFromParent();
                                                ((HorizontalPanel) w.getParent()).removeFromParent();
                                                addTagToDisplay(newTagName.getText().trim());
                                            }
                                        } else {
                                        }
                                    }
                                });
                            } catch (RequestException e) {
                            }
                        } else {
                            getProxy().ChangeTag(oldTagName, newTagName.getText().trim(),
                                    new AsyncCallback<Boolean>() {
                                        public void onSuccess(Boolean o) {
                                            p.hide();
                                            p.removeFromParent();
                                            ((HorizontalPanel) w.getParent()).removeFromParent();
                                            addTagToDisplay(newTagName.getText().trim());
                                        }

                                        public void onFailure(Throwable t) {
                                            GWT.log("Exception", t);
                                        }
                                    });
                        }
                    }
                }
            });
            final CustomButton searchButton = new CustomButton(_("Search"), AppConstants.ICON_SEARCH);
            fT.setWidget(2, 2, searchButton);
            searchButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent evt) {
                    PatientTagSearchScreen searchScreen = new PatientTagSearchScreen();
                    searchScreen.setTagValue(oldTagName);
                    Util.spawnTab(_("Tag Search"), searchScreen);
                    p.hide();
                }
            });
            p.add(fT);
            p.setPopupPosition(tagLabel.getAbsoluteLeft() + 5, tagLabel.getAbsoluteTop() - 10);
            p.setStyleName("freemed-PatientTagPopup");
            p.show();
        }
    });
    p.add(tagLabel);
    p.add(r);
    p.setStyleName("freemed-PatientTag");
    r.addStyleName("freemed-PatientTagRemove");
    r.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent evt) {
            if (Window.confirm("Are you sure you want to remove this tag?")) {
                HorizontalPanel container = (HorizontalPanel) ((Widget) evt.getSource()).getParent();
                removeTag(container.getTitle(), container);
            }
        }
    });
    flowPanel.add(p);
}

From source file:org.freemedsoftware.gwt.client.widget.PatientTagsWidget.java

License:Open Source License

/**
 * Update database to remove tag.//from ww  w  .j a v a2s  .c  o m
 * 
 * @param tag
 */
public void removeTag(String tag, final HorizontalPanel hp) {
    if (Util.getProgramMode() == ProgramMode.STUBBED) {
        hp.removeFromParent();
    } else if (Util.getProgramMode() == ProgramMode.JSONRPC) {
        String[] params = { JsonUtil.jsonify(patientId), tag };
        RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
                URL.encode(Util.getJsonRequest("org.freemedsoftware.module.PatientTag.ExpireTag", params)));
        try {
            builder.sendRequest(null, new RequestCallback() {
                public void onError(Request request, Throwable ex) {
                    Util.showErrorMsg("PatientTags", _("Failed to remove tag."));
                }

                public void onResponseReceived(Request request, Response response) {
                    if (200 == response.getStatusCode()) {
                        Boolean r = (Boolean) JsonUtil.shoehornJson(JSONParser.parseStrict(response.getText()),
                                "Boolean");
                        if (r != null) {
                            hp.removeFromParent();
                            Util.showInfoMsg("PatientTags", _("Tag removed."));
                        }
                    } else {
                        Util.showErrorMsg("PatientTags", _("Failed to remove tag."));
                    }
                }
            });
        } catch (RequestException e) {
            Util.showErrorMsg("PatientTags", _("Failed to remove tag."));
        }
    } else {
        getProxy().ExpireTag(patientId, tag, new AsyncCallback<Boolean>() {
            public void onSuccess(Boolean o) {
                hp.removeFromParent();
                Util.showErrorMsg("PatientTags", _("Tag removed."));
            }

            public void onFailure(Throwable t) {
                GWT.log("Exception", t);
                Util.showErrorMsg("PatientTags", _("Failed to remove tag."));
            }
        });
    }
}

From source file:org.freemedsoftware.gwt.client.widget.PatientTagsWidget.java

License:Open Source License

/**
 * Populate the widget via RPC./*w  w  w .j av a2 s.  c om*/
 */
protected void populate() {
    if (Util.getProgramMode() == ProgramMode.STUBBED) {
        addTagToDisplay("testTag1");
        addTagToDisplay("Diabetes");
        addTagToDisplay("LatePayment");
    } else if (Util.getProgramMode() == ProgramMode.JSONRPC) {
        String[] params = { JsonUtil.jsonify(patientId) };
        RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL
                .encode(Util.getJsonRequest("org.freemedsoftware.module.PatientTag.TagsForPatient", params)));
        try {
            builder.sendRequest(null, new RequestCallback() {
                public void onError(Request request, Throwable ex) {
                }

                public void onResponseReceived(Request request, Response response) {
                    if (200 == response.getStatusCode()) {
                        JsonUtil.debug(response.getText());
                        String[] r = (String[]) JsonUtil
                                .shoehornJson(JSONParser.parseStrict(response.getText()), "String[]");
                        if (r != null) {
                            for (int iter = 0; iter < r.length; iter++) {
                                addTagToDisplay(r[iter]);
                            }
                        }
                    } else {
                    }
                }
            });
        } catch (RequestException e) {
        }
    } else {
        getProxy().TagsForPatient(patientId, new AsyncCallback<String[]>() {
            public void onSuccess(String[] tags) {
                for (int iter = 0; iter < tags.length; iter++) {
                    addTagToDisplay(tags[iter]);
                }
            }

            public void onFailure(Throwable t) {
                GWT.log("Exception", t);
            }
        });
    }
}

From source file:org.freemedsoftware.gwt.client.widget.PatientTagWidget.java

License:Open Source License

protected void loadSuggestions(String req, final Request r, final Callback cb) {
    if (Util.getProgramMode() == ProgramMode.STUBBED) {
        // Handle in a stubbed sort of way
        List<SuggestOracle.Suggestion> items = new ArrayList<SuggestOracle.Suggestion>();
        map.clear();/*from  w w  w.  j  a  va2 s .c  o m*/
        addKeyValuePair(items, new String("Diabetes"), new String("Diabetes"));
        addKeyValuePair(items, new String("Neuropathy"), new String("Neuropathy"));
        cb.onSuggestionsReady(r, new SuggestOracle.Response(items));
    } else if (Util.getProgramMode() == ProgramMode.JSONRPC) {
        String[] params = { req };
        RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
                URL.encode(Util.getJsonRequest("org.freemedsoftware.module.PatientTag.ListTags", params)));
        try {
            builder.sendRequest(null, new RequestCallback() {
                public void onError(com.google.gwt.http.client.Request request, Throwable ex) {
                }

                @SuppressWarnings("unchecked")
                public void onResponseReceived(com.google.gwt.http.client.Request request,
                        com.google.gwt.http.client.Response response) {
                    if (Util.checkValidSessionResponse(response.getText())) {
                        if (200 == response.getStatusCode()) {
                            HashMap<String, String> result = (HashMap<String, String>) JsonUtil.shoehornJson(
                                    JSONParser.parseStrict(response.getText()), "HashMap<String,String>");
                            if (result != null) {
                                List<SuggestOracle.Suggestion> items = new ArrayList<SuggestOracle.Suggestion>();
                                map.clear();
                                Iterator<String> iter = result.values().iterator();
                                while (iter.hasNext()) {
                                    String x = iter.next();
                                    addKeyValuePair(items, x, x);
                                }
                                cb.onSuggestionsReady(r, new SuggestOracle.Response(items));
                            }
                        } else {
                            GWT.log("Result " + response.getStatusText(), null);
                        }
                    }
                }
            });
        } catch (RequestException e) {
            GWT.log("Exception thrown: ", e);
        }
    } else {
        PatientTagAsync service = null;
        try {
            service = ((PatientTagAsync) Util.getProxy("org.freemedsoftware.gwt.client.Module.PatientTag"));
        } catch (Exception e) {
        }

        service.ListTags(req, new AsyncCallback<HashMap<String, String>>() {
            @Override
            public void onSuccess(HashMap<String, String> result) {
                List<SuggestOracle.Suggestion> items = new ArrayList<SuggestOracle.Suggestion>();
                map.clear();
                Iterator<String> iter = result.values().iterator();
                while (iter.hasNext()) {
                    String x = iter.next();
                    addKeyValuePair(items, x, x);
                }
                cb.onSuggestionsReady(r, new SuggestOracle.Response(items));
            }

            public void onFailure(Throwable t) {
                GWT.log("Exception thrown: ", t);
                Util.showErrorMsg("PatientTagWidget", "Exception: " + t.toString());
            }

        });
    }
}

From source file:org.freemedsoftware.gwt.client.widget.PatientWidget.java

License:Open Source License

protected void loadSuggestions(String req, final Request r, final Callback cb) {
    if (req.length() < CurrentState.getMinCharCountForSmartSearch())
        return;//  w  w w  . j a v a2s.c o  m
    if (Util.getProgramMode() == ProgramMode.STUBBED) {
        // Handle in a stubbed sort of way
        List<SuggestOracle.Suggestion> items = new ArrayList<SuggestOracle.Suggestion>();
        map.clear();
        addKeyValuePair(items, new String("Hackenbush, Hugo Z"), new String("1"));
        addKeyValuePair(items, new String("Firefly, Rufus T"), new String("2"));
        cb.onSuggestionsReady(r, new SuggestOracle.Response(items));
    } else if (Util.getProgramMode() == ProgramMode.JSONRPC) {
        String[] params = { req, new Integer(20).toString() };
        RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
                URL.encode(Util.getJsonRequest("org.freemedsoftware.api.PatientInterface.Picklist", params)));
        try {
            builder.sendRequest(null, new RequestCallback() {
                public void onError(com.google.gwt.http.client.Request request, Throwable ex) {
                    Window.alert(ex.toString());
                }

                @SuppressWarnings("unchecked")
                public void onResponseReceived(com.google.gwt.http.client.Request request,
                        com.google.gwt.http.client.Response response) {
                    if (200 == response.getStatusCode()) {
                        if (Util.checkValidSessionResponse(response.getText())) {
                            HashMap<Integer, String> result = (HashMap<Integer, String>) JsonUtil.shoehornJson(
                                    JSONParser.parseStrict(response.getText()), "HashMap<Integer,String>");
                            if (result != null) {
                                Set<Integer> keys = result.keySet();
                                Iterator<Integer> iter = keys.iterator();

                                List<SuggestOracle.Suggestion> items = new ArrayList<SuggestOracle.Suggestion>();
                                map.clear();
                                while (iter.hasNext()) {
                                    Integer keyInt = (Integer) iter.next();
                                    String key = keyInt.toString();
                                    String val = (String) result.get(keyInt);
                                    addKeyValuePair(items, val, key);
                                }
                                cb.onSuggestionsReady(r, new SuggestOracle.Response(items));
                            }
                        }
                    } else {
                        Window.alert(response.toString());
                    }
                }
            });
        } catch (RequestException e) {
            Window.alert(e.toString());
        }
    } else {
        PatientInterfaceAsync service = null;
        try {
            service = ((PatientInterfaceAsync) Util
                    .getProxy("org.freemedsoftware.gwt.client.Api.PatientInterface"));
        } catch (Exception e) {
        }

        service.Picklist(req, new Integer(20), new AsyncCallback<HashMap<Integer, String>>() {
            public void onSuccess(HashMap<Integer, String> result) {
                Set<Integer> keys = result.keySet();
                Iterator<Integer> iter = keys.iterator();

                List<SuggestOracle.Suggestion> items = new ArrayList<SuggestOracle.Suggestion>();
                map.clear();
                while (iter.hasNext()) {
                    Integer keyInt = (Integer) iter.next();
                    String key = keyInt.toString();
                    // Log.debug("keyInt = " + keyInt.toString());
                    String val = (String) result.get(keyInt);
                    addKeyValuePair(items, val, key);
                }
                cb.onSuggestionsReady(r, new SuggestOracle.Response(items));
            }

            public void onFailure(Throwable t) {
                Window.alert(t.getMessage());
            }

        });
    }
}

From source file:org.freemedsoftware.gwt.client.widget.PatientWidget.java

License:Open Source License

@Override
public void getTextForValue(Integer val) {
    if (val > 0) {
        if (Util.getProgramMode() == ProgramMode.STUBBED) {
            searchBox.setText("Hackenbush, Hugo Z (STUB)");
        } else if (Util.getProgramMode() == ProgramMode.JSONRPC) {
            textBox.setEnabled(false);//from   ww  w .  jav a 2s .  co m
            String[] params = { val.toString() };
            RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
                    URL.encode(Util.getJsonRequest("org.freemedsoftware.api.PatientInterface.ToText", params)));
            try {
                builder.sendRequest(null, new RequestCallback() {
                    public void onError(com.google.gwt.http.client.Request request, Throwable ex) {
                        textBox.setEnabled(true);
                        Window.alert(ex.toString());
                    }

                    public void onResponseReceived(com.google.gwt.http.client.Request request,
                            com.google.gwt.http.client.Response response) {
                        textBox.setEnabled(true);
                        if (Util.checkValidSessionResponse(response.getText())) {
                            if (200 == response.getStatusCode()) {
                                String result = (String) JsonUtil
                                        .shoehornJson(JSONParser.parseStrict(response.getText()), "String");
                                if (result != null) {
                                    searchBox.setText(result);
                                    if (callback != null) {
                                        callback.jsonifiedData("done");
                                    }
                                }
                            } else {
                                Window.alert(response.toString());
                            }
                        }
                    }
                });
            } catch (RequestException e) {
                textBox.setEnabled(true);
                Window.alert(e.toString());
            }
        } else {
            PatientInterfaceAsync service = null;
            try {
                service = ((PatientInterfaceAsync) Util
                        .getProxy("org.freemedsoftware.gwt.client.Api.PatientInterface"));
            } catch (Exception e) {
            }
            textBox.setEnabled(false);
            service.ToText(val, true, new AsyncCallback<String>() {
                public void onSuccess(String r) {
                    textBox.setEnabled(true);
                    searchBox.setText(r);
                }

                public void onFailure(Throwable t) {
                    textBox.setEnabled(true);
                    GWT.log("Exception", t);
                }
            });
        }
    }
}

From source file:org.freemedsoftware.gwt.client.widget.PharmacyWidget.java

License:Open Source License

protected void loadSuggestions(String req, final Request r, final Callback cb) {
    if (Util.getProgramMode() == ProgramMode.STUBBED) {
        // Handle in a stubbed sort of way
        List<SuggestOracle.Suggestion> items = new ArrayList<SuggestOracle.Suggestion>();
        map.clear();/*  w ww .  j  a v a 2  s  .  c  o  m*/
        addKeyValuePair(items, new String("Cranston GOP (Cranston, RI)"), new String("1"));
        cb.onSuggestionsReady(r, new SuggestOracle.Response(items));
    } else if (Util.getProgramMode() == ProgramMode.JSONRPC) {
        String[] params = { req, new Integer(20).toString() };
        RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
                URL.encode(Util.getJsonRequest("org.freemedsoftware.module.Pharmacy.Picklist", params)));
        try {
            builder.sendRequest(null, new RequestCallback() {
                public void onError(com.google.gwt.http.client.Request request, Throwable ex) {
                    Window.alert(ex.toString());
                }

                @SuppressWarnings("unchecked")
                public void onResponseReceived(com.google.gwt.http.client.Request request,
                        com.google.gwt.http.client.Response response) {
                    if (200 == response.getStatusCode()) {
                        if (Util.checkValidSessionResponse(response.getText())) {
                            HashMap<Integer, String> result = (HashMap<Integer, String>) JsonUtil.shoehornJson(
                                    JSONParser.parseStrict(response.getText()), "HashMap<Integer,String>");
                            if (result != null) {
                                Set<Integer> keys = result.keySet();
                                Iterator<Integer> iter = keys.iterator();

                                List<SuggestOracle.Suggestion> items = new ArrayList<SuggestOracle.Suggestion>();
                                map.clear();
                                while (iter.hasNext()) {
                                    Integer keyInt = (Integer) iter.next();
                                    String key = keyInt.toString();
                                    String val = (String) result.get(keyInt);
                                    addKeyValuePair(items, val, key);
                                }
                                cb.onSuggestionsReady(r, new SuggestOracle.Response(items));
                            }
                        }
                    } else {
                        Window.alert(response.toString());
                    }
                }
            });
        } catch (RequestException e) {
            Window.alert(e.toString());
        }
    } else {

        // TODO GWT CODE GOES HERE

    }
}

From source file:org.freemedsoftware.gwt.client.widget.PharmacyWidget.java

License:Open Source License

@Override
public void getTextForValue(Integer val) {
    if (val > 0) {
        if (Util.getProgramMode() == ProgramMode.STUBBED) {
            searchBox.setText("Cranston GOP (Cranston, RI)(STUB)");
        } else if (Util.getProgramMode() == ProgramMode.JSONRPC) {
            textBox.setEnabled(false);/*from   w  w  w . j  ava  2s  .c om*/
            String[] params = { val.toString() };
            RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
                    URL.encode(Util.getJsonRequest("org.freemedsoftware.module.Pharmacy.To_Text", params)));
            try {
                builder.sendRequest(null, new RequestCallback() {
                    public void onError(com.google.gwt.http.client.Request request, Throwable ex) {
                        textBox.setEnabled(true);
                        Window.alert(ex.toString());
                    }

                    public void onResponseReceived(com.google.gwt.http.client.Request request,
                            com.google.gwt.http.client.Response response) {
                        textBox.setEnabled(true);
                        if (Util.checkValidSessionResponse(response.getText())) {
                            if (200 == response.getStatusCode()) {
                                String result = (String) JsonUtil
                                        .shoehornJson(JSONParser.parseStrict(response.getText()), "String");
                                if (result != null) {
                                    searchBox.setText(result);
                                }
                            } else {
                                Window.alert(response.toString());
                            }
                        }
                    }
                });
            } catch (RequestException e) {
                textBox.setEnabled(true);
                Window.alert(e.toString());
            }
        } else {
            // TODO GWT STUFF
        }
    }
}

From source file:org.freemedsoftware.gwt.client.widget.PostCheckWidget.java

License:Open Source License

public void loadSelectedProcedureInfo() {
    if (Util.getProgramMode() == ProgramMode.STUBBED) {

    } else if (Util.getProgramMode() == ProgramMode.JSONRPC) {
        String[] params = { procs.toString() };
        RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
                URL.encode(Util.getJsonRequest("org.freemedsoftware.api.ClaimLog.getProceduresInfo", params)));
        try {//from  w  w  w  . j  av a2s .com
            builder.sendRequest(null, new RequestCallback() {
                public void onError(Request request, Throwable ex) {
                    Window.alert(ex.toString());
                }

                @SuppressWarnings("unchecked")
                public void onResponseReceived(Request request, Response response) {

                    if (Util.checkValidSessionResponse(response.getText())) {
                        if (200 == response.getStatusCode()) {
                            try {
                                HashMap<String, String>[] result = (HashMap<String, String>[]) JsonUtil
                                        .shoehornJson(JSONParser.parseStrict(response.getText()),
                                                "HashMap<String,String>[]");
                                if (result != null) {
                                    if (result.length > 0) {
                                        proceduresInfoTable.loadData(result);
                                    }
                                }
                            } catch (Exception e) {

                            }
                        } else {
                        }
                    }
                }
            });
        } catch (RequestException e) {
            Window.alert(e.toString());
        }

    } else {
    }
}