List of usage examples for com.google.gwt.core.client JsArrayString get
public final native String get(int index) ;
From source file:org.rstudio.studio.client.projects.model.ProjectTemplateWidget.java
License:Open Source License
private String[] readSelectBoxFields(ProjectTemplateWidgetDescription description) { JsArrayString jsFields = description.getFields(); int n = jsFields.length(); String[] fields = new String[n]; for (int i = 0; i < n; i++) fields[i] = jsFields.get(i); return fields; }
From source file:org.rstudio.studio.client.projects.ui.prefs.buildtools.BuildToolsWebsitePanel.java
License:Open Source License
@Override void load(RProjectOptions options) { RProjectConfig config = options.getConfig(); pathSelector_.setText(config.getWebsitePath()); RProjectBuildOptions buildOptions = options.getBuildOptions(); chkPreviewAfterBuilding_.setValue(buildOptions.getPreviewWebsite()); chkLivePreviewSite_.setValue(buildOptions.getLivePreviewWebsite()); RProjectBuildContext buildContext = options.getBuildContext(); if (buildContext.isBookdownSite()) { // change caption chkPreviewAfterBuilding_.setText("Preview book after building"); // get all available output formats JsArrayString formatsJson = buildContext.getWebsiteOutputFormats(); ArrayList<String> formatNames = new ArrayList<String>(); ArrayList<String> formats = new ArrayList<String>(); // always include "All Formats" formatNames.add("(All Formats)"); formats.add("all"); for (int i = 0; i < formatsJson.length(); i++) { formatNames.add(formatsJson.get(i)); formats.add(formatsJson.get(i)); }//from ww w . j av a2 s .c om websiteOutputFormat_.setChoices(formatNames.toArray(new String[] {}), formats.toArray(new String[] {})); websiteOutputFormat_.setValue(buildOptions.getWebsiteOutputFormat()); websiteOutputFormat_.setVisible(true); } }
From source file:org.rstudio.studio.client.projects.ui.prefs.ProjectSourceControlPreferencesPane.java
License:Open Source License
@Override protected void initialize(RProjectOptions options) { // save the context vcsContext_ = options.getVcsContext(); // populate the vcs selections list String[] vcsSelections = new String[] { NONE }; JsArrayString applicableVcs = vcsContext_.getApplicableVcs(); if (applicableVcs.length() > 0) { vcsSelections = new String[applicableVcs.length() + 1]; vcsSelections[0] = NONE;//from ww w .j av a2 s.co m for (int i = 0; i < applicableVcs.length(); i++) vcsSelections[i + 1] = applicableVcs.get(i); } vcsSelect_.setChoices(vcsSelections); // set override or default RProjectVcsOptions vcsOptions = options.getVcsOptions(); if (vcsOptions.getActiveVcsOverride().length() > 0) setVcsSelection(vcsOptions.getActiveVcsOverride()); else setVcsSelection(vcsContext_.getDetectedVcs()); }
From source file:org.rstudio.studio.client.rmarkdown.ui.RmdChoiceOption.java
License:Open Source License
public RmdChoiceOption(RmdTemplateFormatOption option, String initialValue) { super(option, initialValue); defaultValue_ = option.getDefaultValue(); HTMLPanel panel = new HTMLPanel(""); panel.add(getOptionLabelWidget());/* w w w . j av a2s . c om*/ choices_ = new ListBox(); JsArrayString choiceList = option.getChoiceList(); int selectedIdx = 0; for (int i = 0; i < choiceList.length(); i++) { choices_.addItem(choiceList.get(i)); if (choiceList.get(i).equals(initialValue)) { selectedIdx = i; } } choices_.setSelectedIndex(selectedIdx); panel.add(choices_); updateNull(); initWidget(panel); }
From source file:org.rstudio.studio.client.rmarkdown.ui.RmdTemplateOptionsWidget.java
License:Open Source License
private void addFormatOptions(RmdTemplateFormat format) { if (format.getNotes().length() > 0 && allowFormatChange_) { labelFormatNotes_.setText(format.getNotes()); labelFormatNotes_.setVisible(true); } else {//w w w. ja v a 2 s.c om labelFormatNotes_.setVisible(false); } optionWidgets_ = new ArrayList<RmdFormatOption>(); JsArrayString options = format.getOptions(); for (int i = 0; i < options.length(); i++) { RmdFormatOption optionWidget; RmdTemplateFormatOption option = findOption(format.getName(), options.get(i)); if (option == null) continue; String initialValue = option.getDefaultValue(); // check to see whether a value for this format and option were // specified in the front matter String frontMatterValue = getFrontMatterDefault(format.getName(), option.getName()); if (frontMatterValue != null) initialValue = frontMatterValue; optionWidget = createWidgetForOption(option, initialValue); if (optionWidget == null) continue; optionWidget.asWidget().addStyleName(style.optionWidget()); FlowPanel panel = null; String category = option.getCategory(); if (tabs_.containsKey(category)) { panel = tabs_.get(category); } else { ScrollPanel scrollPanel = new ScrollPanel(); panel = new FlowPanel(); scrollPanel.add(panel); optionsTabs_.add(scrollPanel, new Label(category)); tabs_.put(category, panel); } panel.add(optionWidget); optionWidgets_.add(optionWidget); } // we need to center the tabs and overlay them on the top edge of the // content; to do this, it is necessary to nuke a couple of the inline // styles used by the default GWT tab panel. Element tabOuter = (Element) optionsTabs_.getElement().getChild(1); tabOuter.getStyle().setOverflow(Overflow.VISIBLE); Element tabInner = (Element) tabOuter.getFirstChild(); tabInner.getStyle().clearWidth(); }
From source file:org.rstudio.studio.client.rmarkdown.ui.RmdTemplateOptionsWidget.java
License:Open Source License
private void applyFrontMatter(RmdFrontMatter frontMatter) { frontMatter_ = frontMatter;/*from w ww . java 2 s.co m*/ frontMatterCache_ = new HashMap<String, String>(); ensureOptionsCache(); JsArrayString formats = frontMatter.getFormatList(); for (int i = 0; i < formats.length(); i++) { String format = formats.get(i); RmdFrontMatterOutputOptions options = frontMatter.getOutputOption(format); JsArrayString optionList = options.getOptionList(); for (int j = 0; j < optionList.length(); j++) { String option = optionList.get(j); String value = options.getOptionValue(option); frontMatterCache_.put(format + ":" + option, value); if (optionCache_.containsKey(option)) { // If the option is specifically labeled as transferable // between formats, add a generic key to be applied to other // formats RmdTemplateFormatOption formatOption = optionCache_.get(option); if (formatOption.isTransferable()) { frontMatterCache_.put(option, value); } } } } }
From source file:org.rstudio.studio.client.rsconnect.ui.RSConnectAccountManager.java
License:Open Source License
public void setAccountList(JsArrayString accounts) { accountList.clear();//from ww w . j av a2 s . com for (int i = 0; i < accounts.length(); i++) { accountList.addItem(accounts.get(i)); } }
From source file:org.rstudio.studio.client.rsconnect.ui.RSConnectDeploy.java
License:Open Source License
public void setFileList(JsArrayString files, String[] unchecked) { if (forDocument_) { fileChecks_ = new ArrayList<CheckBox>(); }/*from w w w . java 2s.c o m*/ for (int i = 0; i < files.length(); i++) { boolean checked = true; if (unchecked != null) { for (int j = 0; j < unchecked.length; j++) { if (unchecked[j].equals(files.get(i))) { checked = false; break; } } } addFile(files.get(i), checked); } }
From source file:org.rstudio.studio.client.server.remote.RemoteServer.java
License:Open Source License
private void setArrayString(JSONArray params, int index, JsArrayString what) { JSONArray array = new JSONArray(); for (int i = 0; i < what.length(); i++) array.set(i, new JSONString(what.get(i))); params.set(index, array);// w w w.j a v a2 s . c o m }
From source file:org.rstudio.studio.client.shiny.ui.ShinyAppsDeploy.java
License:Open Source License
public void setAccountList(JsArrayString accounts) { accountList.clear();//from w ww.j a va 2 s .co m for (int i = 0; i < accounts.length(); i++) accountList.addItem(accounts.get(i)); }