Example usage for com.google.gwt.http.client URL encode

List of usage examples for com.google.gwt.http.client URL encode

Introduction

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

Prototype

public static String encode(String decodedURL) 

Source Link

Document

Returns a string where all characters that are not valid for a complete URL have been escaped.

Usage

From source file:de.lilawelt.zmachine.client.machine.Memory.java

License:Open Source License

public void initialize(ZUserInterface ui, String storyFile) {
    Log.debug("Trying to load story from " + storyFile);

    final PopupPanel p = new PopupPanel();
    p.add(new HTML("Please wait, loading game..."));
    p.center();//from   w  w w. j  a va  2  s . c  o  m
    p.show();

    zui = ui;
    RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(storyFile));

    try {
        builder.sendRequest(null, new RequestCallback() {
            public void onError(Request request, Throwable exception) {
                // Couldn't connect to server (could be timeout, SOP violation, etc.)
                Log.debug("Server connect failed");
                zui.fatal("Could not connect to server: " + exception.getMessage());
            }

            public void onResponseReceived(Request request, Response response) {
                if (200 == response.getStatusCode()) {
                    String story = response.getText();
                    Log.debug("Text length: " + story.length());

                    //String[] tokens = story.split(" ");

                    dataLength = story.length();
                    Log.debug("Initial length: " + dataLength);
                    data = new byte[dataLength];
                    int count = 0;
                    for (int i = 0; i < dataLength - 3; i++) {
                        char e1 = story.charAt(i++);
                        //if ( i < 100 )
                        //Log.debug("Charvalue at pos "+i+": "+e1);
                        if (e1 == '\n' || e1 == '\r') {
                            e1 = story.charAt(i++);
                            if (e1 == '\n' || e1 == '\r') {
                                e1 = story.charAt(i++);
                            }
                        }
                        e1 = (char) tab.indexOf(e1);
                        char e2 = story.charAt(i++);
                        if (e2 == '\n') {
                            e2 = story.charAt(i++);
                        }
                        e2 = (char) tab.indexOf(e2);
                        char e3 = story.charAt(i++);
                        if (e3 == '\n') {
                            e3 = story.charAt(i++);
                        }
                        e3 = (char) tab.indexOf(e3);
                        char e4 = story.charAt(i);
                        if (e4 == '\n') {
                            e4 = story.charAt(++i);
                        }
                        e4 = (char) tab.indexOf(e4);

                        //Log.debug("Values: "+e1+" "+e2+" "+e3+" "+e4);

                        byte c1 = (byte) ((e1 << 2) + (e2 >> 4));
                        byte c2 = (byte) (((e2 & 15) << 4) + (e3 >> 2));
                        byte c3 = (byte) (((e3 & 3) << 6) + e4);

                        //c1 =  (byte) ( e2 >> 4);

                        data[count++] = c1;
                        if (e3 != 64)
                            data[count++] += c2;
                        if (e4 != 64)
                            data[count++] += c3;

                    }
                    /* data = new byte[dataLength];
                    int count = 0;
                    for ( int i = 0; i < dataLength; i++ ) {
                       char c = story.charAt(i);
                       if ( (int) c == 127 ) {
                          i++;
                          if ( (int) story.charAt(i) == 127 ) {
                             i++;
                             data[count] = 127;
                             data[count] += 127;
                          } else {
                             data[count] = 127;
                          }
                          data[count] += story.charAt(i);
                       }  else {
                          data[count] = (byte) c;
                       }
                       //Log.debug("Text item: "+(int)c);
                       count++;
                    }  */

                    dataLength = count;
                    Log.debug("Loaded " + count + " bytes of story.");
                    /* Log.debug("byte0: "+fetchByte(0));
                    Log.debug("byte1: "+fetchByte(1));
                    for ( int i = 0; i < dataLength; i++ ) {
                    if ( i != fetchByte(i))
                       Log.debug("Data "+i+": "+fetchByte(i));
                    } */
                    p.hide();
                    Machine.get().start();
                } else {
                    Log.debug("Server returned error on load: " + response.getText());
                    zui.fatal("Server returned error on load: " + response.getText());
                }
            }

        });
    } catch (RequestException e) {
        // Couldn't connect to server   
        zui.fatal("I/O error loading storyfile.");
    }

    Log.debug("Initialized memory");

}

From source file:de.lilawelt.zmachine.client.UrlSelector.java

License:Open Source License

UrlSelector() {
    main = new VerticalPanel();

    main.add(new Label("Please insert the story url you want to play"));

    storylist = new TextBox();
    storylist.setWidth("400px");

    Button ok = new Button("ok");
    ok.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            String getlocation = (GWT.getModuleBaseURL() + "/Proxy?url=" + URL.encode(storylist.getText()));
            Log.debug("Getting from: " + getlocation);
            Machine.get().loadStory(getlocation, ""); // not good, all savegames in one place.
        }//from   w ww .  ja  va 2 s.  c o m

    });

    main.add(storylist);
    main.add(ok);

    initWidget(main);

}

From source file:de.uni_koeln.spinfo.maalr.webapp.ui.editor.client.entry.AdvancedEditor.java

License:Apache License

public static PopupPanel openEditor(final LexEntry entry, final LemmaVersion lv,
        final AsyncCallback<LexEntry> afterClose, final EditorConstants constants,
        final EditorMessages messages) {

    final PopupPanel popup = new PopupPanel(false, false);
    final AsyncCallback<LexEntry> callback = new AsyncCallback<LexEntry>() {

        @Override//from www . j a va2s  . c o  m
        public void onFailure(Throwable caught) {
            afterClose.onFailure(caught);
        }

        @Override
        public void onSuccess(LexEntry result) {
            popup.hide();
            afterClose.onSuccess(result);
        }
    };
    popup.setStyleName("editor-modal");
    popup.setGlassEnabled(true);
    popup.setGlassStyleName("editor-modal-glass");
    final VerticalPanel content = new VerticalPanel();
    popup.add(content);
    popup.setPopupPosition(50, 50);
    popup.setPixelSize(Window.getClientWidth() - 100, Window.getClientHeight() - 100);
    final LemmaEditorWidget editorWidget = new LemmaEditorWidget(AsyncLemmaDescriptionLoader.getDescription(),
            UseCase.FIELDS_FOR_ADVANCED_EDITOR, true, 2, true, null);
    editorWidget.setData(lv);
    content.add(editorWidget);
    final boolean withComment = true;
    final boolean withEmail = true;
    Fieldset overlayPanel = new Fieldset();
    overlayPanel.getElement().getStyle().setMarginLeft(10, Unit.PX);
    overlayPanel.getElement().getStyle().setMarginRight(10, Unit.PX);
    overlayPanel.setStyleName("form-horizontal");
    content.add(overlayPanel);
    final ControlGroup left = new ControlGroup();
    final ControlGroup right = new ControlGroup();
    overlayPanel.add(left);
    overlayPanel.add(right);

    LocalizedStrings.afterLoad(new AsyncCallback<TranslationMap>() {

        @Override
        public void onFailure(Throwable caught) {
        }

        @Override
        public void onSuccess(final TranslationMap localizedStrings) {

            service.getOverlayTypes(true, new AsyncCallback<ArrayList<String>>() {

                @Override
                public void onFailure(Throwable caught) {
                }

                @Override
                public void onSuccess(ArrayList<String> result) {
                    if (result.size() == 0) {
                        return;
                    }
                    FlowPanel group = new FlowPanel();
                    langAOverlay = new ListBox(false);
                    langAOverlay.addItem(constants.none(), (String) null);
                    for (final String type : result) {
                        langAOverlay.addItem(type, type);
                    }
                    group.add(langAOverlay);
                    final Button edit = new Button(constants.edit());
                    langAOverlay.addChangeHandler(new ChangeHandler() {

                        @Override
                        public void onChange(ChangeEvent event) {
                            edit.setEnabled(langAOverlay.getSelectedIndex() != 0);
                        }
                    });

                    edit.getElement().getStyle().setMarginLeft(10, Unit.PX);
                    edit.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            showOverlayEditor(lv, langAOverlay.getValue(), localizedStrings, constants,
                                    messages);
                        }
                    });
                    group.add(edit);
                    //                        left.add(new ControlLabel(messages.controlLabelOverlay(AsyncLemmaDescriptionLoader.getDescription().getLanguageName(true))));
                    left.add(new ControlLabel(messages.controlLabelOverlay()));
                    Controls controls = new Controls();
                    controls.add(group);
                    left.add(controls);
                    edit.setEnabled(false);
                    String overlay = lv.getEntryValue(LemmaVersion.OVERLAY_LANG1);
                    for (int i = 0; i < result.size(); i++) {
                        if (result.get(i).equals(overlay)) {
                            langAOverlay.setItemSelected(i + 1, true);
                            edit.setEnabled(true);
                            break;
                        }
                    }
                }
            });
            service.getOverlayTypes(false, new AsyncCallback<ArrayList<String>>() {

                @Override
                public void onFailure(Throwable caught) {
                }

                @Override
                public void onSuccess(ArrayList<String> result) {
                    if (result.size() == 0) {
                        return;
                    }
                    FlowPanel group = new FlowPanel();
                    langBOverlay = new ListBox(false);
                    langBOverlay.addItem(constants.none(), (String) null);
                    for (final String type : result) {
                        langBOverlay.addItem(type, type);
                    }
                    group.add(langBOverlay);
                    final Button edit = new Button(constants.edit());
                    langBOverlay.addChangeHandler(new ChangeHandler() {

                        @Override
                        public void onChange(ChangeEvent event) {
                            edit.setEnabled(langBOverlay.getSelectedIndex() != 0);
                        }
                    });
                    edit.getElement().getStyle().setMarginLeft(10, Unit.PX);
                    edit.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            showOverlayEditor(lv, langBOverlay.getValue(), localizedStrings, constants,
                                    messages);
                        }
                    });
                    group.add(edit);
                    //                        right.add(new ControlLabel(messages.controlLabelOverlay(AsyncLemmaDescriptionLoader.getDescription().getLanguageName(false))));
                    right.add(new ControlLabel(messages.controlLabelOverlay()));
                    Controls controls = new Controls();
                    controls.add(group);
                    right.add(controls);
                    edit.setEnabled(false);
                    String overlay = lv.getEntryValue(LemmaVersion.OVERLAY_LANG2);
                    for (int i = 0; i < result.size(); i++) {
                        if (result.get(i).equals(overlay)) {
                            langBOverlay.setItemSelected(i + 1, true);
                            edit.setEnabled(true);
                            break;
                        }
                    }
                }
            });

            Fieldset set = null;
            if (withComment) {
                set = new Fieldset();
                ControlGroup commentGroup = new ControlGroup();
                commentGroup.add(new ControlLabel(localizedStrings.get("dialog.comment.header")));
                comment = new TextArea();
                comment.getElement().getStyle().setWidth(100, Unit.PCT);
                comment.getElement().getStyle().setProperty("resize", "none");
                comment.setVisibleLines(8);
                commentGroup.add(comment);
                set.add(commentGroup);
                comment.setText(lv.getEntryValue(LemmaVersion.COMMENT));
            }
            if (withEmail) {
                set = set == null ? new Fieldset() : set;
                ControlGroup group = new ControlGroup();
                group.add(new ControlLabel(localizedStrings.get("dialog.email.header")));
                HorizontalPanel hp = new HorizontalPanel();
                group.add(hp);
                email = new TextBox();
                email.getElement().getStyle().setWidth(350, Unit.PX);
                email.setText(lv.getEntryValue(LemmaVersion.EMAIL));
                hp.add(email);

                Button sendButton = new Button(constants.reply());
                sendButton.getElement().getStyle().setMarginLeft(10, Unit.PX);
                sendButton.addClickHandler(new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent event) {
                        AsyncLemmaDescriptionLoader
                                .afterLemmaDescriptionLoaded(new AsyncCallback<LemmaDescription>() {

                                    @Override
                                    public void onFailure(Throwable caught) {
                                        // TODO Auto-generated method stub
                                    }

                                    @Override
                                    public void onSuccess(LemmaDescription ld) {
                                        String firstLanguageId = ld.getLanguage(true).getId();
                                        String secondLanguageId = ld.getLanguage(false).getId();
                                        String first = localizedStrings.get(firstLanguageId);
                                        String second = localizedStrings.get(secondLanguageId);
                                        String lemma1st = ld.toUnescapedString(lv, UseCase.RESULT_LIST, true);
                                        String lemma2nd = ld.toUnescapedString(lv, UseCase.RESULT_LIST, false);
                                        String german = first + "%20%3D%20" + lemma1st;
                                        String romansh = second + "%20%3D%20" + lemma2nd;
                                        String remartg = localizedStrings.get("mail.comment") + "%0A"
                                                + URL.encode(comment.getText());

                                        String subject = "?subject="
                                                + URL.encode(localizedStrings.get("mail.subject"));
                                        String body = "&body=" + german + "%0A" + romansh + "%0A%0A" + remartg;
                                        String cc = "";
                                        if (localizedStrings.get("mail.cc") != null) {
                                            cc = "&cc=" + localizedStrings.get("mail.cc");
                                        }
                                        Window.Location
                                                .assign("mailto:" + email.getText() + subject + cc + body);
                                    }
                                });

                    }
                });
                hp.add(sendButton);
                set.add(group);

            }
            if (set != null) {
                set.getElement().getStyle().setPaddingLeft(15, Unit.PC);
                set.getElement().getStyle().setPaddingRight(15, Unit.PC);
                HTML html = new HTML(new SafeHtmlBuilder().appendHtmlConstant("<hr/>").toSafeHtml());
                html.getElement().getStyle().setMarginLeft(20, Unit.PX);
                html.getElement().getStyle().setMarginRight(20, Unit.PX);
                content.add(html);
                content.add(set);
            }
        }
    });

    Button cancel = new Button(constants.cancel());
    cancel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            popup.hide();
        }
    });
    Button reset = new Button(constants.reset());
    reset.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            editorWidget.setData(lv);
        }
    });
    Button ok = new Button(constants.ok());
    ok.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (entry == null) {
                LemmaVersion fromEditor = new LemmaVersion();
                fromEditor.getEntryValues().putAll(lv.getEntryValues());
                fromEditor.getMaalrValues().putAll(lv.getMaalrValues());
                transferSpecialValues(lv, fromEditor);
                editorWidget.updateFromEditor(fromEditor);
                if (editorWidget.isValid(true, true)) {
                    LexEntry entry = new LexEntry(fromEditor);
                    service.insert(entry, callback);
                }
            } else {
                LemmaVersion fromEditor = new LemmaVersion();
                fromEditor.getEntryValues().putAll(lv.getEntryValues());
                fromEditor.getMaalrValues().putAll(lv.getMaalrValues());
                transferSpecialValues(lv, fromEditor);
                editorWidget.updateFromEditor(fromEditor);
                if (editorWidget.isValid(true, true)) {
                    service.acceptAfterUpdate(entry, lv, fromEditor, callback);
                }
            }
            editorWidget.updateFromEditor(lv);
        }

        private void transferSpecialValues(final LemmaVersion lv, LemmaVersion fromEditor) {

            if (langAOverlay != null) {
                int index = langAOverlay.getSelectedIndex();
                String value = index <= 0 ? null : langAOverlay.getValue(index);
                fromEditor.setValue(LemmaVersion.OVERLAY_LANG1, value);
                lv.setValue(LemmaVersion.OVERLAY_LANG1, value);
            }
            if (langBOverlay != null) {
                int index = langBOverlay.getSelectedIndex();
                String value = index <= 0 ? null : langBOverlay.getValue(index);
                fromEditor.setValue(LemmaVersion.OVERLAY_LANG2, value);
                lv.setValue(LemmaVersion.OVERLAY_LANG2, value);
            }
            if (email != null) {
                fromEditor.setValue(LemmaVersion.EMAIL, email.getText());
                lv.setValue(LemmaVersion.EMAIL, email.getText());
            }
            if (comment != null) {
                fromEditor.setValue(LemmaVersion.COMMENT, comment.getText());
                lv.setValue(LemmaVersion.COMMENT, comment.getText());
            }
        }
    });
    ok.setType(ButtonType.PRIMARY);
    content.add(new ModalFooter(cancel, reset, ok));
    popup.show();
    final HandlerRegistration handler = Window.addResizeHandler(new ResizeHandler() {

        @Override
        public void onResize(ResizeEvent event) {
            popup.setSize(Window.getClientWidth() - 100 + "px", Window.getClientHeight() - 100 + "px");
        }
    });
    popup.addCloseHandler(new CloseHandler<PopupPanel>() {

        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            handler.removeHandler();
        }
    });
    return popup;
}

From source file:edu.caltech.ipac.firefly.util.WebUtil.java

/**
 * Returns a string where all characters that are not valid for a complete URL have been escaped.
 * Also, it will do URL rewriting for session tracking if necessary.
 * Fires SESSION_MISMATCH if the session ID on the client is different from the one on the server.
 *
 * @param url    this could be a full or partial url.  Delimiter characters will be preserved.
 * @param paramType  if the the parameters are for the server use QUESTION_MARK if the client use POUND
 * @param params parameters to be appended to the url.  These parameters may contain
 *               delimiter characters.  Unlike url, delimiter characters will be encoded as well.
 * @return encoded url/*from   www.  j  av  a  2 s . c o  m*/
 */
public static String encodeUrl(String url, ParamType paramType, Param... params) {

    String paramChar = paramType == ParamType.QUESTION_MARK ? "?" : "#";
    String[] parts = url.split("\\" + paramChar, 2);
    String baseUrl = parts[0];
    String queryStr = URL.encode(parts.length == 2 ? parts[1] : "");

    if (params != null && params.length > 0) {
        for (int i = 0; i < params.length; i++) {
            Param param = params[i];
            if (param != null && !StringUtils.isEmpty(param.getName())) {
                String key = URL.encodePathSegment(param.getName().trim());
                String val = param.getValue() == null ? "" : URL.encodePathSegment(param.getValue().trim());
                queryStr += val.length() == 0 ? key
                        : key + ServerRequest.KW_VAL_SEP + val + (i < params.length ? "&" : "");
            }
        }
    }
    return URL.encode(baseUrl) + (queryStr.length() == 0 ? "" : paramChar + queryStr);
}

From source file:edu.cudenver.bios.glimmpse.client.ChartRequestBuilder.java

License:Open Source License

private void appendPipeDelimitedList(StringBuffer buffer, String qParam, ArrayList<String> labels) {
    if (labels.size() > 0) {
        boolean first = true;
        for (String label : labels) {
            if (first) {
                buffer.append(qParam);/*  w  w w  . j  a  va  2 s  .co  m*/
                first = false;
            } else {
                buffer.append("|");
            }
            buffer.append(URL.encode(label));
        }
    }
}

From source file:edu.stanford.bmir.protege.web.client.ui.projectmanager.ProjectRevisionBundleConverter.java

License:Open Source License

public void convert() {
    String encodedProjectName = URL.encode(projectid.getId());
    String requestData = "";
    String baseURL = GWT.getHostPageBaseURL();
    String convertURL = baseURL + "convert?ontology=" + encodedProjectName + "&revision="
            + revisionnumber.getValue();

    RequestBuilder request = new RequestBuilder(RequestBuilder.GET, convertURL);
    try {/*from  w ww.  j  a v a2 s . co m*/
        request.sendRequest(requestData.toString(), new RequestCallback() //requestData vuoti poich i parametri di interesse sono gi specificati nell'URL
        {
            public void onError(Request request, Throwable e) {
                Window.alert(e.getMessage());
            }

            public void onResponseReceived(Request request, Response response) {
                if (200 == response.getStatusCode()) //controllo che la response sia stata ricevuta in maniera corretta (stato 200)
                {
                    String convertedProject = new String(response.getText());
                    returnTObundle(convertedProject); //funzione javascript che invia la stringa ottenuta a TRILL on SWISH
                } else {
                    Window.alert("Received HTTP status code other than 200 : " + response.getStatusText());
                }
            }
        });
    } catch (RequestException e) {
        // Couldn't connect to server
        Window.alert(e.getMessage());
    }
    //}
}

From source file:edu.stanford.bmir.protege.web.client.ui.projectmanager.ProjectRevisionConverter.java

License:Open Source License

public void convert() {
    String encodedProjectName = URL.encode(projectid.getId());
    String requestData = "";
    String baseURL = GWT.getHostPageBaseURL();
    String convertURL = baseURL + "convert?ontology=" + encodedProjectName + "&revision="
            + revisionnumber.getValue();
    boolean opened = openedPage();
    //controllo se la pagina  stata aperta da un'altra pagina, in modo da avere un riferimento a cui inviare l'ontologia in RDF/XML
    if (opened == true) { //invio la richiesta alla servlet per ottenere l'ontologia convertita!!!
        RequestBuilder request = new RequestBuilder(RequestBuilder.GET, convertURL);
        try {//w  w w.j a va  2 s  . c  o m
            request.sendRequest(requestData.toString(), new RequestCallback() //requestData vuoti poich i parametri di interesse sono gi specificati nell'URL
            {
                public void onError(Request request, Throwable e) {
                    Window.alert(e.getMessage());
                }

                public void onResponseReceived(Request request, Response response) {
                    if (200 == response.getStatusCode()) //controllo che la response sia stata ricevuta in maniera corretta (stato 200)
                    {
                        String convertedProject = new String(response.getText());
                        returnTOtrill(convertedProject); //funzione javascript che invia la stringa ottenuta a TRILL on SWISH
                    } else {
                        Window.alert("Received HTTP status code other than 200 : " + response.getStatusText());
                    }
                }
            });
        } catch (RequestException e) {
            // Couldn't connect to server
            Window.alert(e.getMessage());
        }
    }
}

From source file:edu.ucdenver.bios.glimmpseweb.client.connector.ChartSvcConnector.java

License:Open Source License

/**
 * Build the query string for a Chart svc scatter plot
 * @param resultList//ww w  .j a v a 2  s  .  c  o m
 * @param curveDescription
 * @return
 */
public String buildQueryString(List<PowerResult> resultList, PowerCurveDescription curveDescription) {
    StringBuffer queryStr = new StringBuffer();

    // add axis labels
    switch (curveDescription.getHorizontalAxisLabelEnum()) {
    case TOTAL_SAMPLE_SIZE:
        queryStr.append("chxl=" + URL.encode(GlimmpseWeb.constants.curveOptionsSampleSizeLabel()));
        break;
    case REGRESSION_COEEFICIENT_SCALE_FACTOR:
        queryStr.append("chxl=" + URL.encode(GlimmpseWeb.constants.curveOptionsBetaScaleLabel()));
        break;
    case VARIABILITY_SCALE_FACTOR:
        queryStr.append("chxl=" + URL.encode(GlimmpseWeb.constants.curveOptionsSigmaScaleLabel()));
        break;
    }
    queryStr.append(SERIES_DELIM + GlimmpseWeb.constants.curveOptionsPowerLabel());

    // add the chart title (optional)
    if (curveDescription.getTitle() != null) {
        queryStr.append("&chtt=" + curveDescription.getTitle());
    }

    // add the width/height parameters
    queryStr.append(buildSizeQueryString(curveDescription.getWidth(), curveDescription.getHeight()));

    // add data series
    List<PowerCurveDataSeries> dataSeriesList = curveDescription.getDataSeriesList();
    boolean firstSeries = true;
    int lineStyleIndex = 0;
    if (dataSeriesList != null) {
        StringBuffer seriesLabels = new StringBuffer();
        seriesLabels.append("&chdl=");
        /* Begin : Changes for line style */
        StringBuffer lineStyles = new StringBuffer();
        lineStyles.append("&ls=");
        /* End : Changes for line style */
        queryStr.append("&chd=t:");
        for (PowerCurveDataSeries dataSeries : dataSeriesList) {
            if (!firstSeries) {
                seriesLabels.append(SERIES_DELIM);
            }
            seriesLabels.append(dataSeries.getLabel());
            StringBuffer lowerCI = new StringBuffer();
            StringBuffer upperCI = new StringBuffer();
            StringBuffer main = new StringBuffer();
            StringBuffer xValues = new StringBuffer();

            boolean hasMatch = false;
            for (PowerResult result : resultList) {
                if (isMatch(result, dataSeries, curveDescription.getHorizontalAxisLabelEnum())) {
                    if (hasMatch) {
                        main.append(",");
                        xValues.append(",");
                    }
                    main.append(result.getActualPower());
                    switch (curveDescription.getHorizontalAxisLabelEnum()) {
                    case TOTAL_SAMPLE_SIZE:
                        xValues.append(result.getTotalSampleSize());
                        break;
                    case REGRESSION_COEEFICIENT_SCALE_FACTOR:
                        xValues.append(result.getBetaScale().getValue());
                        break;
                    case VARIABILITY_SCALE_FACTOR:
                        xValues.append(result.getSigmaScale().getValue());
                        break;
                    }

                    if (dataSeries.isConfidenceLimits() && result.getConfidenceInterval() != null) {
                        if (hasMatch) {
                            lowerCI.append(",");
                            upperCI.append(",");
                        }
                        lowerCI.append(result.getConfidenceInterval().getLowerLimit());
                        upperCI.append(result.getConfidenceInterval().getUpperLimit());
                    }
                    hasMatch = true;
                }

            }
            if (hasMatch) {
                if (!firstSeries) {
                    queryStr.append(SERIES_DELIM);
                    seriesLabels.append(SERIES_DELIM);
                    /* Begin : Changes for line style */
                    lineStyles.append(SERIES_DELIM);
                    /* End : Changes for line style */
                }
                /* Begin : Changes for line style */
                lineStyles.append(BUILT_IN_LINE_STYLES[lineStyleIndex]);
                lineStyleIndex++;
                if (lineStyleIndex >= BUILT_IN_LINE_STYLES.length) {
                    lineStyleIndex = 0;
                }
                /* End : Changes for line style */
                queryStr.append(xValues.toString() + SERIES_DELIM + main.toString());
                if (lowerCI.length() > 0) {
                    queryStr.append(SERIES_DELIM + xValues.toString() + SERIES_DELIM + lowerCI.toString());
                    /* Begin : Changes for line style */
                    lineStyles.append(SERIES_DELIM + CI_LINE_STYLE);
                    /* End : Changes for line style */
                }
                if (upperCI.length() > 0) {
                    queryStr.append(SERIES_DELIM + xValues.toString() + SERIES_DELIM + upperCI.toString());
                    /* Begin : Changes for line style */
                    lineStyles.append(SERIES_DELIM + CI_LINE_STYLE);
                    /* End : Changes for line style */
                }
            }
            firstSeries = false;
        }
        /* Begin : Changes for line style */
        // append the line styles 
        queryStr.append(lineStyles);
        /* End : Changes for line style */
        // append the series labels 
        queryStr.append(seriesLabels);
    }
    GWT.log(queryStr.toString());
    return queryStr.toString();
}

From source file:edu.ucla.loni.client.ServerLibraryManager.java

License:Open Source License

/**
 * Makes the HTTP request to download// w w  w.j  a va 2 s.  c  o  m
 */
private void downloadFiles(Pipefile[] selected) {
    int length = selected.length;

    String url = "serverlibrarymanager/download?n=" + length;
    for (int i = 0; i < length; i++) {
        String filename = selected[i].absolutePath;
        url += "&filename_" + i + "=" + URL.encode(filename);
    }

    Window.open(url, "downloadWindow", "");
}

From source file:edu.ucsb.eucalyptus.admin.client.EucalyptusWebInterface.java

License:Open Source License

public void displayDownloadsTab(final VerticalPanel parent) {
    History.newItem("extras");
    VerticalPanel vpanel = new VerticalPanel();
    vpanel.setSpacing(15);//from ww w  .  j a  v a  2  s .co m
    //vpanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    vpanel.add(new DownloadsTable(sessionId,
            "http://www.eucalyptussoftware.com/downloads/eucalyptus-images/list.php?version="
                    + URL.encode(version),
            "http://open.eucalyptus.com/wiki/EucalyptusUserImageCreatorGuide_v1.6",
            "Eucalyptus-certified Images", 50));
    vpanel.add(new DownloadsTable(sessionId,
            "http://www.eucalyptussoftware.com/downloads/eucalyptus-tools/list.php?version="
                    + URL.encode(version),
            "http://open.eucalyptus.com/wiki/ToolsEcosystem", "Eucalyptus-compatible Tools", 50));

    parent.clear();
    parent.add(vpanel);
}