use of org.rstudio.core.client.widget.FixedTextArea in project rstudio by rstudio.
the class ProjectPackratPreferencesPane method initialize.
@Override
protected void initialize(RProjectOptions options) {
Styles styles = RES.styles();
Label label = new Label("Packrat is a dependency management tool that makes your " + "R code more isolated, portable, and reproducible by " + "giving your project its own privately managed package " + "library.");
spaced(label);
add(label);
PackratContext context = options.getPackratContext();
RProjectPackratOptions packratOptions = options.getPackratOptions();
chkUsePackrat_ = new CheckBox("Use packrat with this project");
chkUsePackrat_.setValue(context.isPackified());
chkUsePackrat_.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
if (event.getValue())
verifyPrerequisites();
else
manageUI(false);
}
});
spaced(chkUsePackrat_);
add(chkUsePackrat_);
chkAutoSnapshot_ = new CheckBox("Automatically snapshot local changes");
chkAutoSnapshot_.setValue(packratOptions.getAutoSnapshot());
lessSpaced(chkAutoSnapshot_);
add(chkAutoSnapshot_);
String vcsName = session_.getSessionInfo().getVcsName();
chkVcsIgnoreLib_ = new CheckBox(vcsName + " ignore packrat library");
chkVcsIgnoreLib_.setValue(packratOptions.getVcsIgnoreLib());
lessSpaced(chkVcsIgnoreLib_);
add(chkVcsIgnoreLib_);
chkVcsIgnoreSrc_ = new CheckBox(vcsName + " ignore packrat sources");
chkVcsIgnoreSrc_.setValue(packratOptions.getVcsIgnoreSrc());
lessSpaced(chkVcsIgnoreSrc_);
add(chkVcsIgnoreSrc_);
chkUseCache_ = new CheckBox("Use global cache for installed packages");
chkUseCache_.setValue(packratOptions.getUseCache());
spaced(chkUseCache_);
add(chkUseCache_);
panelExternalPackages_ = new VerticalPanel();
panelExternalPackages_.add(new LabelWithHelp("External packages (comma separated):", "packrat_external_packages", false));
taExternalPackages_ = new FixedTextArea(3);
taExternalPackages_.addStyleName(styles.externalPackages());
taExternalPackages_.setText(StringUtil.join(Arrays.asList(JsUtil.toStringArray(packratOptions.getExternalPackages())), ", "));
taExternalPackages_.getElement().getStyle().setMarginBottom(8, Unit.PX);
panelExternalPackages_.add(taExternalPackages_);
add(panelExternalPackages_);
widgetLocalRepos_ = new LocalRepositoriesWidget();
String[] localRepos = JsUtil.toStringArray(packratOptions.getLocalRepos());
for (int i = 0; i < localRepos.length; ++i) {
widgetLocalRepos_.addItem(localRepos[i]);
}
add(widgetLocalRepos_);
manageUI(context.isPackified());
HelpLink helpLink = new HelpLink("Learn more about Packrat", "packrat", false);
helpLink.getElement().getStyle().setMarginTop(15, Unit.PX);
nudgeRight(helpLink);
add(helpLink);
}
use of org.rstudio.core.client.widget.FixedTextArea in project rstudio by rstudio.
the class RPubsUploadDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
Styles styles = RESOURCES.styles();
SimplePanel mainPanel = new SimplePanel();
mainPanel.addStyleName(styles.mainWidget());
VerticalPanel verticalPanel = new VerticalPanel();
HorizontalPanel headerPanel = new HorizontalPanel();
headerPanel.addStyleName(styles.headerPanel());
headerPanel.add(new Image(new ImageResource2x(RESOURCES.publishLarge2x())));
Label headerLabel = new Label("Publish to RPubs");
headerLabel.addStyleName(styles.headerLabel());
headerPanel.add(headerLabel);
headerPanel.setCellVerticalAlignment(headerLabel, HasVerticalAlignment.ALIGN_MIDDLE);
verticalPanel.add(headerPanel);
String msg;
if (!isPublished_ && uploadId_.isEmpty()) {
msg = "RPubs is a free service from RStudio for sharing " + "documents on the web. Click Publish to get " + "started.";
} else {
msg = "This document has already been published on RPubs. You can " + "choose to either update the existing RPubs document, or " + "create a new one.";
}
Label descLabel = new Label(msg);
descLabel.addStyleName(styles.descLabel());
verticalPanel.add(descLabel);
// if we have a generator then show title and comment UI
if (htmlGenerator_ != null) {
Label titleLabel = new Label("Title (optional):");
titleLabel.addStyleName(styles.fieldLabel());
verticalPanel.add(titleLabel);
titleTextBox_ = new TextBox();
titleTextBox_.addStyleName(styles.titleTextBox());
titleTextBox_.getElement().setAttribute("spellcheck", "false");
verticalPanel.add(titleTextBox_);
Label commentLabel = new Label("Comment (optional):");
commentLabel.addStyleName(styles.fieldLabel());
verticalPanel.add(commentLabel);
commentTextArea_ = new FixedTextArea(6);
commentTextArea_.addStyleName(styles.commentTextArea());
verticalPanel.add(commentTextArea_);
// not using either for now
titleLabel.setVisible(false);
titleTextBox_.setVisible(false);
commentLabel.setVisible(false);
commentTextArea_.setVisible(false);
previewButton_ = new ThemedButton("Preview");
previewButton_.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
htmlGenerator_.generateStaticHtml(titleTextBox_.getText().trim(), commentTextArea_.getText().trim(), new CommandWithArg<String>() {
@Override
public void execute(String rpubsFile) {
globalDisplay_.showHtmlFile(rpubsFile);
}
});
}
});
addLeftButton(previewButton_);
}
HTML warningLabel = new HTML("<strong>IMPORTANT: All documents published to RPubs are " + "publicly visible.</strong> You should " + "only publish documents that you wish to share publicly.");
warningLabel.addStyleName(styles.warningLabel());
verticalPanel.add(warningLabel);
ThemedButton cancelButton = createCancelButton(new Operation() {
@Override
public void execute() {
// if an upload is in progress then terminate it
if (uploader_.isUploadInProgress()) {
uploader_.terminateUpload();
}
}
});
continueButton_ = new ThemedButton("Publish", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
performUpload(false);
}
});
updateButton_ = new ThemedButton("Update Existing", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
performUpload(true);
}
});
createButton_ = new ThemedButton("Create New", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
performUpload(false);
}
});
if (!isPublished_ && uploadId_.isEmpty()) {
addOkButton(continueButton_);
addCancelButton(cancelButton);
} else {
addOkButton(updateButton_);
addButton(createButton_);
addCancelButton(cancelButton);
}
mainPanel.setWidget(verticalPanel);
return mainPanel;
}
Aggregations