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

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

Introduction

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

Prototype

public final native int length() ;

Source Link

Document

Gets the length of the array.

Usage

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  w  w  . j  a v  a  2  s  .  c  o 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. j  a v a2 s.  c om*/
                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  av a  2  s. co  m*/
    }
    return list;
}

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

License:Open Source License

@Override
public void onDeleteTables(List<TableDto> tableDtos) {
    if (tableDtos.isEmpty()) {
        fireEvent(NotificationEvent.newBuilder().error("DeleteTableSelectAtLeastOne").build());
    } else {//from   w  ww .j  a  v a  2s.com
        JsArrayString tableNames = JsArrays.create().cast();
        for (TableDto table : tableDtos) {
            tableNames.push(table.getName());
        }

        deleteConfirmation = new RemoveRunnable(tableNames);

        fireEvent(ConfirmationRequiredEvent.createWithMessages(deleteConfirmation,
                translationMessages.removeTables(),
                translationMessages.confirmRemoveTables(tableNames.length())));
    }
}

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

License:Open Source License

@Override
public void onDeleteVariables(List<VariableDto> variableDtos) {
    if (variableDtos.isEmpty()) {
        fireEvent(NotificationEvent.newBuilder().error("DeleteVariableSelectAtLeastOne").build());
    } else {//  w w  w.j  a v  a 2s.c o m
        JsArrayString variableNames = JsArrays.create().cast();
        for (VariableDto variable : variableDtos) {
            variableNames.push(variable.getName());
        }

        deleteVariablesConfirmation = new RemoveVariablesRunnable(variableNames);

        fireEvent(ConfirmationRequiredEvent.createWithMessages(deleteVariablesConfirmation,
                translationMessages.removeVariables(),
                translationMessages.confirmRemoveVariables(variableNames.length())));
    }
}

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);
    }//from   w w w.j  a  v  a2s  .c  o  m
    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   w  w w .ja  va  2 s .c  om

    // 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));
    }/*from   w  w  w .  ja  v a  2 s  .  c o m*/

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

From source file:org.obiba.opal.web.gwt.app.client.project.view.ProjectView.java

License:Open Source License

private void setTags(ProjectDto project) {
    tagsPanel.clear();/* w  w w  . ja  v  a 2  s. c  om*/
    JsArrayString tagsArray = JsArrays.toSafeArray(project.getTagsArray());
    tagsPanel.setVisible(tagsArray.length() > 0);
    if (tagsArray.length() > 0) {
        for (String tag : JsArrays.toIterable(tagsArray)) {
            Label tagLabel = new Label(tag);
            tagLabel.addStyleName("small-indent");
            tagsPanel.add(tagLabel);
        }
    }
}

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(" ");
    }//from  w  ww.ja  va2 s.co m
    return emailList.toString();
}