Example usage for com.google.gwt.core.client JavaScriptObject createArray

List of usage examples for com.google.gwt.core.client JavaScriptObject createArray

Introduction

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

Prototype

public static native JavaScriptObject createArray() ;

Source Link

Document

Returns a new array.

Usage

From source file:org.rstudio.studio.client.workbench.views.vcs.common.VCSFileOpener.java

License:Open Source License

private JsArray<FileSystemItem> toJsArray(ArrayList<StatusAndPath> items) {
    JsArray<FileSystemItem> jsItems = JavaScriptObject.createArray().cast();
    for (StatusAndPath item : items) {
        if (item.isDirectory())
            jsItems.push(FileSystemItem.createDir(item.getRawPath()));
        else/* w  w w  .  j  ava2 s . com*/
            jsItems.push(FileSystemItem.createFile(item.getRawPath()));
    }
    return jsItems;
}

From source file:org.sigmah.offline.indexeddb.Database.java

License:Open Source License

/**
 * Open a new transaction in the given mode.
 * //www .  j  a v  a 2 s .  co m
 * @param mode Write mode.
 * @param stores Stores to access during the transaction.
 * @return A new transaction.
 * @throws IndexedDBException If an error occurs when opening the transaction.
 */
public Transaction<S> getTransaction(Transaction.Mode mode, Collection<S> stores) throws IndexedDBException {
    final JsArrayString array = (JsArrayString) JavaScriptObject.createArray();
    for (final S store : stores) {
        array.push(store.name());
    }
    try {
        return new Transaction<S>(nativeDatabase.getTransaction(array, mode.getArgument()), mode, stores);
    } catch (JavaScriptException e) {
        throw new IndexedDBException(e);
    }
}

From source file:org.sigmah.offline.js.BudgetElementJS.java

License:Open Source License

public void setBudgetSubFields(List<BudgetSubFieldDTO> budgetSubFields) {
    if (budgetSubFields != null) {
        final JsArray<BudgetSubFieldJS> array = (JsArray<BudgetSubFieldJS>) JavaScriptObject.createArray();

        for (final BudgetSubFieldDTO budgetSubFieldDTO : budgetSubFields) {
            array.push(BudgetSubFieldJS.toJavaScript(budgetSubFieldDTO));
        }/*from w  w  w.  j ava 2 s .c o m*/

        setBudgetSubFields(array);
    }
}

From source file:org.sigmah.offline.js.CategoryTypeJS.java

License:Open Source License

public void setCategoryElements(List<CategoryElementDTO> categoryElements) {
    if (categoryElements != null) {
        final JsArrayInteger array = (JsArrayInteger) JavaScriptObject.createArray();

        for (final CategoryElementDTO categoryElementDTO : categoryElements) {
            array.push(categoryElementDTO.getId());
        }// w w w .j  a va  2  s  .com

        setCategoryElements(array);
    }
}

From source file:org.sigmah.offline.js.ContactJS.java

License:Open Source License

@SuppressWarnings("unchecked")
public void setSecondaryOrgUnits(List<OrgUnitDTO> secondaryOrgUnitDTOs) {
    JsArray<OrgUnitJS> secondaryOrgUnits = (JsArray<OrgUnitJS>) JavaScriptObject.createArray();
    for (OrgUnitDTO orgUnitDTO : secondaryOrgUnitDTOs) {
        secondaryOrgUnits.push(OrgUnitJS.toJavaScript(orgUnitDTO));
    }/*from w w  w. j  ava2s .c o  m*/

    setSecondaryOrgUnits(secondaryOrgUnits);
}

From source file:org.sigmah.offline.js.ExpectedResultJS.java

License:Open Source License

public void setIndicators(List<IndicatorDTO> indicators) {
    if (indicators != null) {
        final JsArrayInteger array = (JsArrayInteger) JavaScriptObject.createArray();

        for (final IndicatorDTO indicator : indicators) {
            array.push(indicator.getId());
        }/*from   w  w  w. java2 s.  c  om*/

        setIndicators(array);
    }
}

From source file:org.sigmah.offline.js.ExpectedResultJS.java

License:Open Source License

public void setActivities(List<LogFrameActivityDTO> activities) {
    if (activities != null) {
        final JsArray<LogFrameActivityJS> array = (JsArray<LogFrameActivityJS>) JavaScriptObject.createArray();

        for (final LogFrameActivityDTO activity : activities) {
            array.push(LogFrameActivityJS.toJavaScript(activity));
        }//from   w w w. j  ava2 s . c  om

        setActivities(array);
    }
}

From source file:org.sigmah.offline.js.HistoryTokenListJS.java

License:Open Source License

public void setTokens(List<HistoryTokenDTO> tokens) {
    if (tokens != null) {
        final JsArray<HistoryTokenJS> array = (JsArray<HistoryTokenJS>) JavaScriptObject.createArray();

        for (final HistoryTokenDTO token : tokens) {
            array.push(HistoryTokenJS.toJavaScript(token));
        }/*  w  ww.j  a  va  2 s .c om*/

        setTokens(array);
    }
}

From source file:org.sigmah.offline.js.LayoutGroupJS.java

License:Open Source License

public void setConstraints(List<LayoutConstraintDTO> constraints) {
    if (constraints != null) {
        final JsArray<LayoutConstraintJS> array = (JsArray<LayoutConstraintJS>) JavaScriptObject.createArray();

        for (final LayoutConstraintDTO layoutConstraintDTO : constraints) {
            array.push(LayoutConstraintJS.toJavaScript(layoutConstraintDTO));
        }/*from w  ww .  j av a 2  s . c  o m*/

        setConstraints(array);
    }
}

From source file:org.sigmah.offline.js.LayoutJS.java

License:Open Source License

public void setGroups(List<LayoutGroupDTO> groups) {
    if (groups != null) {
        final JsArray<LayoutGroupJS> array = (JsArray<LayoutGroupJS>) JavaScriptObject.createArray();

        for (final LayoutGroupDTO layoutGroupDTO : groups) {
            array.push(LayoutGroupJS.toJavaScript(layoutGroupDTO));
        }/*  w  w w  .j  ava  2 s .  c o  m*/

        setGroups(array);
    }
}