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

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

Introduction

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

Prototype

public final native void push(String value) ;

Source Link

Document

Pushes the given value onto the end of the array.

Usage

From source file:org.obiba.opal.web.gwt.app.client.administration.configuration.edit.GeneralConfModalView.java

License:Open Source License

@Override
public JsArrayString getLanguages() {
    JsArrayString languages = JsArrayString.createArray().cast();
    for (String locale : locales.getSelectedLocales()) {
        languages.push(locale);
    }/*from  w w w .j  a  v a  2  s  .c  o m*/
    return languages;
}

From source file:org.obiba.opal.web.gwt.app.client.administration.taxonomies.edit.TaxonomyEditModalPresenter.java

public void initView(final TaxonomyDto taxonomyDto) {
    originalTaxonomy = taxonomyDto;/*from ww  w  .  ja v a  2  s. c o  m*/
    mode = taxonomyDto.hasName() ? EDIT_MODE.EDIT : EDIT_MODE.CREATE;

    ResourceRequestBuilderFactory.<GeneralConf>newBuilder()
            .forResource(UriBuilders.SYSTEM_CONF_GENERAL.create().build())
            .withCallback(new ResourceCallback<GeneralConf>() {
                @Override
                public void onResource(Response response, GeneralConf resource) {
                    JsArrayString locales = JsArrayString.createArray().cast();
                    for (int i = 0; i < resource.getLanguagesArray().length(); i++) {
                        locales.push(resource.getLanguages(i));
                    }
                    getView().setMode(mode);
                    getView().setTaxonomy(taxonomyDto, locales);
                }
            }).get().send();
}

From source file:org.obiba.opal.web.gwt.app.client.administration.taxonomies.term.edit.TermEditModalPresenter.java

License:Open Source License

public void initView(final TaxonomyDto taxonomyDto, final VocabularyDto vocabularyDto, final TermDto termDto) {
    originalTaxonomy = taxonomyDto;//from   w  ww .ja  v a 2s. co m
    originalVocabulary = vocabularyDto;
    originalTerm = termDto;
    mode = termDto.hasName() ? EDIT_MODE.EDIT : EDIT_MODE.CREATE;

    ResourceRequestBuilderFactory.<GeneralConf>newBuilder()
            .forResource(UriBuilders.SYSTEM_CONF_GENERAL.create().build())
            .withCallback(new ResourceCallback<GeneralConf>() {
                @Override
                public void onResource(Response response, GeneralConf resource) {
                    JsArrayString locales = JsArrayString.createArray().cast();
                    for (int i = 0; i < resource.getLanguagesArray().length(); i++) {
                        locales.push(resource.getLanguages(i));
                    }
                    getView().setMode(mode);
                    getView().setTerm(termDto, locales);
                }
            }).get().send();
}

From source file:org.obiba.opal.web.gwt.app.client.administration.taxonomies.vocabulary.edit.VocabularyEditModalPresenter.java

License:Open Source License

public void initView(final TaxonomyDto taxonomyDto, final VocabularyDto vocabularyDto) {
    originalTaxonomy = taxonomyDto;/*from w  ww.j  ava2  s.  c o m*/
    originalVocabulary = vocabularyDto;
    mode = vocabularyDto.hasName() ? EDIT_MODE.EDIT : EDIT_MODE.CREATE;

    ResourceRequestBuilderFactory.<GeneralConf>newBuilder()
            .forResource(UriBuilders.SYSTEM_CONF_GENERAL.create().build())
            .withCallback(new ResourceCallback<GeneralConf>() {
                @Override
                public void onResource(Response response, GeneralConf resource) {
                    JsArrayString locales = JsArrayString.createArray().cast();
                    for (int i = 0; i < resource.getLanguagesArray().length(); i++) {
                        locales.push(resource.getLanguages(i));
                    }
                    getView().setMode(mode);
                    getView().setVocabulary(vocabularyDto, locales);
                }
            }).get().send();
}

From source file:org.obiba.opal.web.gwt.app.client.js.JsArrays.java

License:Open Source License

public static JsArrayString fromIterable(Iterable<String> iterable) {
    JsArrayString array = (JsArrayString) JsArrayString.createArray();
    if (iterable != null) {
        for (String s : iterable) {
            array.push(s);
        }/*w  ww  .j  a  va 2s  .co  m*/
    }
    return array;
}

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

License:Open Source License

private CopyCommandOptionsDto createCopyCommandOptions(String destination, String newName) {
    CopyCommandOptionsDto dto = CopyCommandOptionsDto.create();

    JsArrayString selectedTables = JavaScriptObject.createArray().cast();

    for (TableDto exportTable : copyTables) {
        selectedTables.push(exportTable.getDatasourceName() + "." + exportTable.getName());
    }//from   w ww.  j av  a 2 s  .  co  m

    dto.setTablesArray(selectedTables);
    dto.setDestination(destination);
    dto.setDestinationTableName(newName);
    dto.setNonIncremental(!getView().isIncremental());
    dto.setCopyNullValues(getView().isCopyNullValues());
    dto.setNoVariables(!getView().isWithVariables());
    if (!Strings.isNullOrEmpty(valuesQuery) && getView().applyQuery()) {
        dto.setQuery(valuesQuery);
    }

    return dto;
}

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

License:Open Source License

private ExportCommandOptionsDto createExportCommandOptions(String fileFormat, String outFile,
        String idMapping) {//  w w w . j  av  a 2  s .com
    ExportCommandOptionsDto dto = ExportCommandOptionsDto.create();

    JsArrayString selectedTables = JavaScriptObject.createArray().cast();

    for (TableDto exportTable : exportTables) {
        selectedTables.push(exportTable.getDatasourceName() + "." + exportTable.getName());
    }

    dto.setTablesArray(selectedTables);
    dto.setFormat(fileFormat);
    dto.setOut(outFile);
    dto.setNonIncremental(true);
    dto.setNoVariables(false);
    if (idMapping != null) {
        IdentifiersMappingConfigDto idConfig = IdentifiersMappingConfigDto.create();
        idConfig.setName(idMapping);
        idConfig.setAllowIdentifierGeneration(false);
        idConfig.setIgnoreUnknownIdentifier(false);
        dto.setIdConfig(idConfig);
    }
    if (!Strings.isNullOrEmpty(valuesQuery) && getView().applyQuery()) {
        dto.setQuery(valuesQuery);
    }

    return dto;
}

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

License:Open Source License

private ImportCommandOptionsDto createImportCommandOptionsDto(@Nullable String selectedFile) {
    ImportCommandOptionsDto dto = ImportCommandOptionsDto.create();
    dto.setDestination(importConfig.getDestinationDatasourceName());
    if (importConfig.isArchiveMove()) {
        dto.setArchive(importConfig.getArchiveDirectory());
        JsArrayString selectedFiles = JavaScriptObject.createArray().cast();
        selectedFiles.push(selectedFile);
        dto.setFilesArray(selectedFiles);
    }/*w w  w  . j  ava  2  s  .  c om*/
    if (importConfig.isIdentifierSharedWithUnit()) {
        IdentifiersMappingConfigDto idConfig = IdentifiersMappingConfigDto.create();
        idConfig.setName(importConfig.getIdentifiersMapping());
        idConfig.setAllowIdentifierGeneration(importConfig.isAllowIdentifierGeneration());
        idConfig.setIgnoreUnknownIdentifier(importConfig.isIgnoreUnknownIdentifier());
        dto.setIdConfig(idConfig);
    }
    JsArrayString selectedTables = JavaScriptObject.createArray().cast();
    for (String tableName : comparedDatasourcesReportPresenter.getSelectedTables()) {
        selectedTables.push(importConfig.getTransientDatasourceName() + "." + tableName);
    }
    dto.setTablesArray(selectedTables);
    return dto;
}

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   ww  w. j av  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 {//from w  w w. ja v a 2  s.  c om
        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())));
    }
}