use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.
the class WebApplicationHeader method initCommandsPanel.
private void initCommandsPanel(final SessionInfo sessionInfo) {
// add username
if (sessionInfo.getShowIdentity()) {
ToolbarLabel usernameLabel = new ToolbarLabel();
usernameLabel.getElement().getStyle().setMarginRight(2, Unit.PX);
if (!BrowseCap.isFirefox())
usernameLabel.getElement().getStyle().setMarginTop(2, Unit.PX);
String userIdentity = sessionInfo.getUserIdentity();
usernameLabel.setTitle(userIdentity);
userIdentity = userIdentity.split("@")[0];
usernameLabel.setText(userIdentity);
headerBarCommandsPanel_.add(usernameLabel);
ToolbarButton signOutButton = new ToolbarButton(new ImageResource2x(RESOURCES.signOut2x()), new ClickHandler() {
public void onClick(ClickEvent event) {
eventBus_.fireEvent(new LogoutRequestedEvent());
}
});
signOutButton.setTitle("Sign out");
headerBarCommandsPanel_.add(signOutButton);
headerBarCommandsPanel_.add(signOutSeparator_ = createCommandSeparator());
}
overlay_.addCommands(this);
headerBarCommandsPanel_.add(commands_.quitSession().createToolbarButton());
}
use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.
the class CompilePanel method connectToolbar.
public void connectToolbar(Toolbar toolbar) {
Commands commands = RStudioGinjector.INSTANCE.getCommands();
ImageResource stopImage = commands.interruptR().getImageResource();
stopButton_ = new ToolbarButton(stopImage, null);
stopButton_.setVisible(false);
toolbar.addRightWidget(stopButton_);
showOutputButton_ = new LeftRightToggleButton("Output", "Issues", false);
showOutputButton_.setVisible(false);
showOutputButton_.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
showOutputButton_.setVisible(false);
showErrorsButton_.setVisible(true);
panel_.setWidget(outputDisplay_.asWidget());
outputDisplay_.scrollToBottom();
}
});
toolbar.addRightWidget(showOutputButton_);
showErrorsButton_ = new LeftRightToggleButton("Output", "Issues", true);
showErrorsButton_.setVisible(false);
showErrorsButton_.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
showOutputButton_.setVisible(true);
showErrorsButton_.setVisible(false);
panel_.setWidget(errorList_);
}
});
toolbar.addRightWidget(showErrorsButton_);
}
use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.
the class SavePlotAsPdfDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
ExportPlotResources.Styles styles = ExportPlotResources.INSTANCE.styles();
Grid grid = new Grid(7, 2);
grid.setStylePrimaryName(styles.savePdfMainWidget());
// paper size
grid.setWidget(0, 0, new Label("PDF Size:"));
// paper size label
paperSizeEditor_ = new PaperSizeEditor();
grid.setWidget(0, 1, paperSizeEditor_);
// orientation
grid.setWidget(1, 0, new Label("Orientation:"));
HorizontalPanel orientationPanel = new HorizontalPanel();
orientationPanel.setSpacing(kComponentSpacing);
VerticalPanel orientationGroupPanel = new VerticalPanel();
final String kOrientationGroup = new String("Orientation");
portraitRadioButton_ = new RadioButton(kOrientationGroup, "Portrait");
orientationGroupPanel.add(portraitRadioButton_);
landscapeRadioButton_ = new RadioButton(kOrientationGroup, "Landscape");
orientationGroupPanel.add(landscapeRadioButton_);
orientationPanel.add(orientationGroupPanel);
grid.setWidget(1, 1, orientationPanel);
boolean haveCairoPdf = sessionInfo_.isCairoPdfAvailable();
if (haveCairoPdf)
grid.setWidget(2, 0, new Label("Options:"));
HorizontalPanel cairoPdfPanel = new HorizontalPanel();
String label = "Use cairo_pdf device";
if (BrowseCap.isMacintoshDesktop())
label = label + " (requires X11)";
chkCairoPdf_ = new CheckBox(label);
chkCairoPdf_.getElement().getStyle().setMarginLeft(kComponentSpacing, Unit.PX);
cairoPdfPanel.add(chkCairoPdf_);
chkCairoPdf_.setValue(haveCairoPdf && options_.getCairoPdf());
if (haveCairoPdf)
grid.setWidget(2, 1, cairoPdfPanel);
grid.setWidget(3, 0, new HTML(" "));
ThemedButton directoryButton = new ThemedButton("Directory...");
directoryButton.setStylePrimaryName(styles.directoryButton());
directoryButton.getElement().getStyle().setMarginLeft(-2, Unit.PX);
grid.setWidget(4, 0, directoryButton);
directoryButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
fileDialogs_.chooseFolder("Choose Directory", fileSystemContext_, FileSystemItem.createDir(directoryLabel_.getTitle().trim()), new ProgressOperationWithInput<FileSystemItem>() {
public void execute(FileSystemItem input, ProgressIndicator indicator) {
if (input == null)
return;
indicator.onCompleted();
// update default
ExportPlotUtils.setDefaultSaveDirectory(input);
// set display
setDirectory(input);
}
});
}
});
directoryLabel_ = new Label();
setDirectory(defaultDirectory_);
directoryLabel_.setStylePrimaryName(styles.savePdfDirectoryLabel());
grid.setWidget(4, 1, directoryLabel_);
Label fileNameLabel = new Label("File name:");
fileNameLabel.setStylePrimaryName(styles.savePdfFileNameLabel());
grid.setWidget(5, 0, fileNameLabel);
fileNameTextBox_ = new TextBox();
fileNameTextBox_.setText(defaultPlotName_);
fileNameTextBox_.setStylePrimaryName(styles.savePdfFileNameTextBox());
grid.setWidget(5, 1, fileNameTextBox_);
// view after size
viewAfterSaveCheckBox_ = new CheckBox("View plot after saving");
viewAfterSaveCheckBox_.setStylePrimaryName(styles.savePdfViewAfterCheckbox());
viewAfterSaveCheckBox_.setValue(options_.getViewAfterSave());
grid.setWidget(6, 1, viewAfterSaveCheckBox_);
// set default value
if (options_.getPortrait())
portraitRadioButton_.setValue(true);
else
landscapeRadioButton_.setValue(true);
// return the widget
return grid;
}
use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.
the class ShowContentDialog method addButtons.
protected void addButtons() {
ThemedButton closeButton = new ThemedButton("Close", new ClickHandler() {
public void onClick(ClickEvent event) {
closeDialog();
}
});
addOkButton(closeButton);
}
use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.
the class MessageDialog method addButton.
public ThemedButton addButton(String label, final Operation operation, boolean isDefault, boolean isCancel) {
ThemedButton button = new ThemedButton(label, new ClickHandler() {
public void onClick(ClickEvent event) {
if (operation != null)
operation.execute();
closeDialog();
}
});
addButton(button, isDefault, isCancel);
return button;
}
Aggregations