Example usage for com.google.gwt.core.client JsArrayString get

List of usage examples for com.google.gwt.core.client JsArrayString get

Introduction

In this page you can find the example usage for com.google.gwt.core.client JsArrayString get.

Prototype

public final native String get(int index) ;

Source Link

Document

Gets the value at a given index.

Usage

From source file:org.obiba.opal.web.gwt.app.client.magma.derive.presenter.DeriveConclusionPresenter.java

License:Open Source License

private boolean hasTableInFrom(ViewDto resource) {
    if (resource.getFromArray() == null)
        return false;
    JsArrayString froms = resource.getFromArray();
    for (int i = 0; i < froms.length(); i++) {
        String from = froms.get(i);
        if (from.equals(getOriginalTable().getDatasourceName() + "." + getOriginalTable().getName())) {
            return true;
        }/*from   w ww. j  ava2s. c om*/
    }
    return false;
}

From source file:org.obiba.opal.web.gwt.app.client.magma.derive.presenter.DeriveFromVariablePresenter.java

License:Open Source License

private void loadTables() {
    // fetch the current view to retrieve the fromTables
    UriBuilder ub = UriBuilder.create().segment("datasource", getDestinationTable().getDatasourceName(), "view",
            getDestinationTable().getName());
    ResourceRequestBuilderFactory.<ViewDto>newBuilder().forResource(ub.build()).get()
            .withCallback(new ResourceCallback<ViewDto>() {

                @Override//from w  ww  . ja v  a 2 s  . co  m
                public void onResource(Response response, final ViewDto viewDto) {

                    ResourceRequestBuilderFactory.<JsArray<TableDto>>newBuilder()
                            .forResource("/datasources/tables").get()
                            .withCallback(new ResourceCallback<JsArray<TableDto>>() {
                                @Override
                                public void onResource(Response response, JsArray<TableDto> resource) {
                                    // When deriving from, we should only add the tables that are part of the ViewDto.getFromTables().

                                    JsArray<TableDto> tables = JsArrays.create();
                                    JsArrayString fromTables = viewDto.getFromArray();

                                    for (int i = 0; i < fromTables.length(); i++) {
                                        for (int j = 0; j < resource.length(); j++) {
                                            // add the table if its in the fromtables
                                            if (fromTables.get(i).equals(resource.get(j).getDatasourceName()
                                                    + "." + resource.get(j).getName())) {
                                                tables.push(resource.get(j));
                                                break;
                                            }
                                        }
                                    }
                                    getView().addTableSelections(JsArrays.toSafeArray(tables));
                                    if (table != null) {
                                        getView().selectTable(table);
                                    }
                                    onTableSelection();
                                    loadVariables();
                                }
                            }).send();

                }
            }).send();

}

From source file:org.obiba.opal.web.gwt.app.client.magma.importdata.presenter.CsvFormatStepPresenter.java

License:Open Source License

public void getAvailableCharsets() {
    ResourceRequestBuilderFactory.<JsArrayString>newBuilder().forResource("/files/charsets/available").get()
            .withCallback(new ResourceCallback<JsArrayString>() {
                @Override//from   www  .ja v  a  2s .  c  o m
                public void onResource(Response response, JsArrayString datasources) {
                    for (int i = 0; i < datasources.length(); i++) {
                        availableCharsets.add(datasources.get(i));
                    }
                }
            }).send();
}

From source file:org.obiba.opal.web.gwt.app.client.magma.importdata.view.CsvFormatStepView.java

License:Open Source License

private List<String> toList(JsArrayString jsArrayString) {
    List<String> list = new ArrayList<String>();
    for (int i = 0; i < jsArrayString.length(); i++) {
        list.add(jsArrayString.get(i));
    }//from w w  w  . j  a  va 2s  .  com
    return list;
}

From source file:org.obiba.opal.web.gwt.app.client.magma.view.TableView.java

License:Open Source License

@Override
public void setFromTables(JsArrayString tableNames) {
    if (propertiesTable.getRowCount() > 2) {
        propertiesTable.removeProperty(2);
    }/* w  w  w. j  ava 2  s.  c  om*/
    if (tableNames != null) {
        FlowPanel fromTableLinks = new FlowPanel();
        for (int i = 0; i < tableNames.length(); i++) {
            String tableFullName = tableNames.get(i);
            Anchor a = new Anchor();
            a.setText(tableFullName);
            MagmaPath.Parser parser = MagmaPath.Parser.parse(tableFullName);
            a.setHref("#" + placeManager.buildHistoryToken(
                    ProjectPlacesHelper.getTablePlace(parser.getDatasource(), parser.getTable())));
            fromTableLinks.add(a);

            if (i < tableNames.length() - 1) {
                fromTableLinks.add(new InlineLabel(", "));
            }
        }
        propertiesTable.addProperty(new Label(translations.tableReferencesLabel()), fromTableLinks);
    }
}

From source file:org.obiba.opal.web.gwt.app.client.magma.view.ValueSequencePopupView.java

License:Open Source License

private void populateVariables(List<VariableDto> variables, JsArrayString variableNames) {
    // remove previously added variable columns
    while (valuesTable.getColumnCount() > 1) {
        valuesTable.removeColumn(valuesTable.getColumnCount() - 1);
    }//from  ww w . j a v a  2s .  c  o  m

    // add the variables columns
    for (int i = 0; i < variableNames.length(); i++) {
        final String varName = variableNames.get(i);

        // find the variable object and create+add the column
        VariableDto var = findVariable(variables, varName);
        if (var != null) {
            valuesTable.addColumn(createValueOccurrenceColumn(var, i), new Header<String>(new TextCell()) {

                @Override
                public String getValue() {
                    return varName;
                }

            });
        }
    }
}

From source file:org.obiba.opal.web.gwt.app.client.magma.view.VcsCommitHistoryModalView.java

License:Open Source License

@Override
public void setDiff(JsArrayString diffEntries) {
    if (diffEntries != null && diffEntries.length() > 0) {
        diffTable.setDiff(diffEntries.get(0));
    }/*w w  w . j a v  a 2  s. co  m*/

    diffTable.setVisible(diffEntries != null && diffEntries.length() > 0);
}

From source file:org.obiba.opal.web.gwt.app.client.report.view.ReportTemplateDetailsView.java

License:Open Source License

private String getEmailList(JsArrayString emails) {
    StringBuilder emailList = new StringBuilder();
    for (int i = 0; i < emails.length(); i++) {
        emailList.append(emails.get(i)).append(" ");
    }//w ww  . j a  v a  2  s .  c  o  m
    return emailList.toString();
}

From source file:org.opencms.ade.galleries.client.preview.CmsPreviewUtil.java

License:Open Source License

/**
 * Returns the available image format names for gallery widget mode.<p>
 * // w ww .j av a 2s . c  o m
 * @return the available image format names
 */
public static String[] getFormatNames() {

    JsArrayString formatNames = nativeGetFormatNames();
    if ((formatNames == null) || (formatNames.length() == 0)) {
        return null;
    }
    String[] result = new String[formatNames.length()];
    for (int i = 0; i < formatNames.length(); i++) {
        result[i] = formatNames.get(i);
    }
    return result;
}

From source file:org.opencms.ade.galleries.client.preview.CmsPreviewUtil.java

License:Open Source License

/**
 * Returns the available image formats for gallery widget mode.<p>
 * //w ww .j ava2  s.c o m
 * @return the available image formats
 */
public static String[] getFormats() {

    JsArrayString tempArr = nativeGetFormats();
    if ((tempArr == null) || (tempArr.length() == 0)) {
        return null;
    }
    String[] result = new String[tempArr.length()];
    for (int i = 0; i < tempArr.length(); i++) {
        result[i] = tempArr.get(i);
    }
    return result;
}