Example usage for com.google.gwt.user.client.ui HorizontalPanel setVerticalAlignment

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setVerticalAlignment

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HorizontalPanel setVerticalAlignment.

Prototype

public void setVerticalAlignment(VerticalAlignmentConstant align) 

Source Link

Document

Sets the default vertical alignment to be used for widgets added to this panel.

Usage

From source file:org.rstudio.core.client.widget.TextBoxWithPrefix.java

License:Open Source License

public TextBoxWithPrefix() {
    HorizontalPanel panel = new HorizontalPanel();

    prefixLabel_ = new Label();
    panel.add(prefixLabel_);// www . jav  a2 s .c om
    textBox_ = new TextBox();
    panel.add(textBox_);

    // draw a border around the panel and remove it from the textbox
    textBox_.getElement().getStyle().setBorderWidth(0, Unit.PX);
    textBox_.getElement().getStyle().setOutlineWidth(0, Unit.PX);
    textBox_.setWidth("100%");
    textBox_.setHeight("100%");
    panel.getElement().getStyle().setBackgroundColor("#FFFFFF");
    panel.getElement().getStyle().setBorderColor("#999999");
    panel.getElement().getStyle().setBorderStyle(BorderStyle.SOLID);
    panel.getElement().getStyle().setBorderWidth(1, Unit.PX);
    panel.setCellWidth(prefixLabel_, "1");

    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    initWidget(panel);
}

From source file:org.rstudio.studio.client.workbench.exportplot.ExportPlotSizeEditor.java

License:Open Source License

private void configureHorizontalOptionsPanel(HorizontalPanel panel) {
    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
}

From source file:org.rstudio.studio.client.workbench.views.environment.ClearAllDialog.java

License:Open Source License

@Override
protected Widget createMainWidget() {
    progress_ = addProgressIndicator();/*w  w w  . ja  va 2  s  .c o  m*/

    VerticalPanel panel = new VerticalPanel();

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    // add image
    MessageDialogImages images = MessageDialogImages.INSTANCE;
    Image image = new Image(images.dialog_warning());
    horizontalPanel.add(image);

    // add message widget
    String objects;
    if (numObjects_ == 0)
        objects = "all objects";
    else if (numObjects_ == 1)
        objects = "1 object";
    else
        objects = numObjects_ + " objects";
    Label label = new MultiLineLabel("Are you sure you want to remove " + objects + " from the "
            + "environment? This operation cannot be undone.");
    label.setStylePrimaryName(ThemeResources.INSTANCE.themeStyles().dialogMessage());
    horizontalPanel.add(label);
    panel.add(horizontalPanel);

    // add include hidden option
    HorizontalPanel optionPanel = new HorizontalPanel();
    Style optionStyle = optionPanel.getElement().getStyle();
    optionStyle.setMarginLeft(image.getWidth(), Unit.PX);
    optionStyle.setMarginBottom(10, Unit.PX);

    chkIncludeHidden_ = new CheckBox("Include hidden objects");
    chkIncludeHidden_.setValue(prefs_.clearHidden().getValue());

    if (numObjects_ == 0) {
        chkIncludeHidden_.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
            @Override
            public void onValueChange(ValueChangeEvent<Boolean> event) {
                prefs_.clearHidden().setGlobalValue(event.getValue());
                prefs_.writeUIPrefs();
            }
        });
        optionPanel.add(chkIncludeHidden_);
    }
    panel.add(optionPanel);

    return panel;
}

From source file:org.rstudio.studio.client.workbench.views.plots.ui.manipulator.ManipulatorControlCheckBox.java

License:Open Source License

public ManipulatorControlCheckBox(String variable, boolean value, Manipulator.CheckBox checkBox,
        final ManipulatorChangedHandler changedHandler) {
    super(variable, checkBox, changedHandler);

    // get manipulator styles
    ManipulatorStyles styles = ManipulatorResources.INSTANCE.manipulatorStyles();

    // main control
    HorizontalPanel panel = new HorizontalPanel();
    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    // checkbox/*  w ww.j  a  va2s .c  o m*/
    checkBox_ = new CheckBox();
    checkBox_.setValue(value);
    checkBox_.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            ManipulatorControlCheckBox.this.onValueChanged(JSONBoolean.getInstance(checkBox_.getValue()));

        }
    });
    panel.add(checkBox_);

    // label
    Label label = new Label(getLabel());
    panel.add(label);

    initWidget(panel);
    addControlStyle(styles.checkBox());
}

From source file:org.rstudio.studio.client.workbench.views.plots.ui.manipulator.ManipulatorControlPicker.java

License:Open Source License

public ManipulatorControlPicker(String variable, String value, Manipulator.Picker picker,
        final ManipulatorChangedHandler changedHandler) {
    super(variable, picker, changedHandler);

    // get manipulator styles
    ManipulatorStyles styles = ManipulatorResources.INSTANCE.manipulatorStyles();

    // main control
    HorizontalPanel panel = new HorizontalPanel();
    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    // caption/*from ww  w .j  av  a 2s . c o m*/
    Label captionLabel = new Label();
    captionLabel.setStyleName(styles.captionLabel());
    captionLabel.setText(getLabel() + ":");
    panel.add(captionLabel);

    // picker
    listBox_ = new ListBox();
    listBox_.setVisibleItemCount(1);
    JsArrayString choices = picker.getChoices();
    int selectedIndex = 0;
    for (int i = 0; i < choices.length(); i++) {
        String choice = choices.get(i);
        listBox_.addItem(choice);
        if (choice.equals(value))
            selectedIndex = i;
    }
    listBox_.setSelectedIndex(selectedIndex);
    listBox_.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            ManipulatorControlPicker.this
                    .onValueChanged(new JSONString(listBox_.getItemText(listBox_.getSelectedIndex())));
        }
    });
    panel.add(listBox_);

    initWidget(panel);
    addControlStyle(styles.picker());
}

From source file:org.rstudio.studio.client.workbench.views.source.editors.text.ChunkOptionsPopupPanel.java

License:Open Source License

public ChunkOptionsPopupPanel(boolean includeChunkNameUI) {
    super(true);/* www.j a va 2 s  . c  om*/
    setVisible(false);

    chunkOptions_ = new HashMap<String, String>();
    originalChunkOptions_ = new HashMap<String, String>();

    panel_ = new VerticalPanel();
    add(panel_);

    header_ = new Label();
    header_.addStyleName(RES.styles().headerLabel());
    header_.setVisible(false);
    panel_.add(header_);

    tbChunkLabel_ = new TextBoxWithCue("Unnamed chunk");
    tbChunkLabel_.addStyleName(RES.styles().textBox());
    tbChunkLabel_.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            synchronize();
        }
    });

    panel_.addHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            int keyCode = event.getNativeKeyCode();
            if (keyCode == KeyCodes.KEY_ESCAPE || keyCode == KeyCodes.KEY_ENTER) {
                ChunkOptionsPopupPanel.this.hide();
                widget_.getEditor().focus();
                return;
            }
        }
    }, KeyUpEvent.getType());

    tbChunkLabel_.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            int keyCode = event.getNativeKeyCode();
            if (keyCode == KeyCodes.KEY_ESCAPE || keyCode == KeyCodes.KEY_ENTER) {
                ChunkOptionsPopupPanel.this.hide();
                widget_.getEditor().focus();
                return;
            }

            synchronize();

        }
    });

    int gridRows = includeChunkNameUI ? 2 : 1;
    Grid nameAndOutputGrid = new Grid(gridRows, 2);

    chunkLabel_ = new Label("Name:");
    chunkLabel_.addStyleName(RES.styles().chunkLabel());

    if (includeChunkNameUI)
        nameAndOutputGrid.setWidget(0, 0, chunkLabel_);

    tbChunkLabel_.addStyleName(RES.styles().chunkName());

    if (includeChunkNameUI)
        nameAndOutputGrid.setWidget(0, 1, tbChunkLabel_);

    outputComboBox_ = new ListBox();
    String[] options = new String[] { OUTPUT_USE_DOCUMENT_DEFAULT, OUTPUT_SHOW_OUTPUT_ONLY,
            OUTPUT_SHOW_CODE_AND_OUTPUT, OUTPUT_SHOW_NOTHING, OUTPUT_SKIP_THIS_CHUNK };

    for (String option : options)
        outputComboBox_.addItem(option);

    outputComboBox_.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            String value = outputComboBox_.getItemText(outputComboBox_.getSelectedIndex());
            if (value.equals(OUTPUT_USE_DOCUMENT_DEFAULT)) {
                unset("echo");
                unset("eval");
                unset("include");
            } else if (value.equals(OUTPUT_SHOW_CODE_AND_OUTPUT)) {
                set("echo", "TRUE");
                unset("eval");
                unset("include");
            } else if (value.equals(OUTPUT_SHOW_OUTPUT_ONLY)) {
                set("echo", "FALSE");
                unset("eval");
                unset("include");
            } else if (value.equals(OUTPUT_SHOW_NOTHING)) {
                unset("echo");
                unset("eval");
                set("include", "FALSE");
            } else if (value.equals(OUTPUT_SKIP_THIS_CHUNK)) {
                set("eval", "FALSE");
                set("include", "FALSE");
                unset("echo");
            }
            synchronize();
        }
    });

    int row = includeChunkNameUI ? 1 : 0;
    nameAndOutputGrid.setWidget(row, 0, new Label("Output:"));
    nameAndOutputGrid.setWidget(row, 1, outputComboBox_);

    panel_.add(nameAndOutputGrid);

    panel_.add(verticalSpacer(4));

    showWarningsInOutputCb_ = makeTriStateCheckBox("Show warnings", "warning");
    panel_.add(showWarningsInOutputCb_);

    panel_.add(verticalSpacer(6));

    showMessagesInOutputCb_ = makeTriStateCheckBox("Show messages", "message");
    panel_.add(showMessagesInOutputCb_);

    panel_.add(verticalSpacer(6));

    useCustomFigureCheckbox_ = new ThemedCheckBox("Use custom figure size");
    useCustomFigureCheckbox_.addStyleName(RES.styles().checkBox());
    useCustomFigureCheckbox_.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            boolean value = event.getValue();
            figureDimensionsPanel_.setVisible(value);

            if (!value) {
                figWidthBox_.setText("");
                figHeightBox_.setText("");
                unset("fig.width");
                unset("fig.height");
                synchronize();
            }
        }
    });
    panel_.add(useCustomFigureCheckbox_);

    figureDimensionsPanel_ = new Grid(2, 2);
    figureDimensionsPanel_.getElement().getStyle().setMarginTop(5, Unit.PX);

    figWidthBox_ = makeInputBox("fig.width");
    Label widthLabel = new Label("Width (inches):");
    widthLabel.getElement().getStyle().setMarginLeft(20, Unit.PX);
    figureDimensionsPanel_.setWidget(0, 0, widthLabel);
    figureDimensionsPanel_.setWidget(0, 1, figWidthBox_);

    figHeightBox_ = makeInputBox("fig.height");
    Label heightLabel = new Label("Height (inches):");
    heightLabel.getElement().getStyle().setMarginLeft(20, Unit.PX);
    figureDimensionsPanel_.setWidget(1, 0, heightLabel);
    figureDimensionsPanel_.setWidget(1, 1, figHeightBox_);

    panel_.add(figureDimensionsPanel_);

    panel_.add(verticalSpacer(8));

    HorizontalPanel footerPanel = new HorizontalPanel();
    footerPanel.getElement().getStyle().setWidth(100, Unit.PCT);

    FlowPanel linkPanel = new FlowPanel();
    HelpLink helpLink = new HelpLink("Chunk options", "chunk-options", false);
    linkPanel.add(helpLink);

    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.addStyleName(RES.styles().buttonPanel());
    buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);

    revertButton_ = new SmallButton("Revert");
    revertButton_.getElement().getStyle().setMarginRight(8, Unit.PX);
    revertButton_.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            revert();
            hideAndFocusEditor();
        }
    });
    buttonPanel.add(revertButton_);

    applyButton_ = new SmallButton("Apply");
    applyButton_.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            synchronize();
            hideAndFocusEditor();
        }
    });
    buttonPanel.add(applyButton_);

    footerPanel.setVerticalAlignment(VerticalPanel.ALIGN_BOTTOM);
    footerPanel.add(linkPanel);

    footerPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    footerPanel.add(buttonPanel);

    panel_.add(footerPanel);
}

From source file:org.rstudio.studio.client.workbench.views.source.editors.text.rmd.display.ChunkOptionsPopupPanel.java

License:Open Source License

public ChunkOptionsPopupPanel(boolean includeChunkNameUI) {
    super(true);/*www  .j av  a2s .  c  o m*/
    setVisible(false);

    RStudioGinjector.INSTANCE.injectMembers(this);

    chunkOptions_ = new HashMap<String, String>();
    originalChunkOptions_ = new HashMap<String, String>();

    panel_ = new VerticalPanel();
    add(panel_);

    header_ = new Label();
    header_.addStyleName(RES.styles().headerLabel());
    header_.setVisible(false);
    panel_.add(header_);

    tbChunkLabel_ = new TextBoxWithCue("Unnamed chunk");
    tbChunkLabel_.addStyleName(RES.styles().textBox());
    tbChunkLabel_.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            synchronize();
        }
    });

    panel_.addHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            int keyCode = event.getNativeKeyCode();
            if (keyCode == KeyCodes.KEY_ESCAPE || keyCode == KeyCodes.KEY_ENTER) {
                ChunkOptionsPopupPanel.this.hide();
                display_.focus();
                return;
            }
        }
    }, KeyUpEvent.getType());

    tbChunkLabel_.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            int keyCode = event.getNativeKeyCode();
            if (keyCode == KeyCodes.KEY_ESCAPE || keyCode == KeyCodes.KEY_ENTER) {
                ChunkOptionsPopupPanel.this.hide();
                display_.focus();
                return;
            }

            synchronize();

        }
    });

    int gridRows = includeChunkNameUI ? 2 : 1;
    Grid nameAndOutputGrid = new Grid(gridRows, 2);

    chunkLabel_ = new Label("Name:");
    chunkLabel_.addStyleName(RES.styles().chunkLabel());

    if (includeChunkNameUI)
        nameAndOutputGrid.setWidget(0, 0, chunkLabel_);

    tbChunkLabel_.addStyleName(RES.styles().chunkName());

    if (includeChunkNameUI)
        nameAndOutputGrid.setWidget(0, 1, tbChunkLabel_);

    outputComboBox_ = new ListBox();
    String[] options = new String[] { OUTPUT_USE_DOCUMENT_DEFAULT, OUTPUT_SHOW_OUTPUT_ONLY,
            OUTPUT_SHOW_CODE_AND_OUTPUT, OUTPUT_SHOW_NOTHING, OUTPUT_SKIP_THIS_CHUNK };

    for (String option : options)
        outputComboBox_.addItem(option);

    outputComboBox_.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            String value = outputComboBox_.getItemText(outputComboBox_.getSelectedIndex());
            if (value.equals(OUTPUT_USE_DOCUMENT_DEFAULT)) {
                unset("echo");
                unset("eval");
                unset("include");
            } else if (value.equals(OUTPUT_SHOW_CODE_AND_OUTPUT)) {
                set("echo", "TRUE");
                unset("eval");
                unset("include");
            } else if (value.equals(OUTPUT_SHOW_OUTPUT_ONLY)) {
                set("echo", "FALSE");
                unset("eval");
                unset("include");
            } else if (value.equals(OUTPUT_SHOW_NOTHING)) {
                unset("echo");
                unset("eval");
                set("include", "FALSE");
            } else if (value.equals(OUTPUT_SKIP_THIS_CHUNK)) {
                set("eval", "FALSE");
                set("include", "FALSE");
                unset("echo");
            }
            synchronize();
        }
    });

    int row = includeChunkNameUI ? 1 : 0;
    nameAndOutputGrid.setWidget(row, 0, new Label("Output:"));
    nameAndOutputGrid.setWidget(row, 1, outputComboBox_);

    panel_.add(nameAndOutputGrid);

    showWarningsInOutputCb_ = makeTriStateCheckBox("Show warnings", "warning");
    panel_.add(showWarningsInOutputCb_);

    showMessagesInOutputCb_ = makeTriStateCheckBox("Show messages", "message");

    panel_.add(showMessagesInOutputCb_);

    useCustomFigureCheckbox_ = new ThemedCheckBox("Use custom figure size");
    useCustomFigureCheckbox_.addStyleName(RES.styles().checkBox());
    useCustomFigureCheckbox_.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            boolean value = event.getValue();
            figureDimensionsPanel_.setVisible(value);

            if (!value) {
                figWidthBox_.setText("");
                figHeightBox_.setText("");
                unset("fig.width");
                unset("fig.height");
                synchronize();
            }
        }
    });
    panel_.add(useCustomFigureCheckbox_);

    figureDimensionsPanel_ = new Grid(2, 2);
    figureDimensionsPanel_.getElement().getStyle().setMarginTop(5, Unit.PX);

    figWidthBox_ = makeInputBox("fig.width", false);
    Label widthLabel = new Label("Width (inches):");
    widthLabel.getElement().getStyle().setMarginLeft(20, Unit.PX);
    figureDimensionsPanel_.setWidget(0, 0, widthLabel);
    figureDimensionsPanel_.setWidget(0, 1, figWidthBox_);

    figHeightBox_ = makeInputBox("fig.height", false);
    Label heightLabel = new Label("Height (inches):");
    heightLabel.getElement().getStyle().setMarginLeft(20, Unit.PX);
    figureDimensionsPanel_.setWidget(1, 0, heightLabel);
    figureDimensionsPanel_.setWidget(1, 1, figHeightBox_);

    panel_.add(figureDimensionsPanel_);

    enginePanel_ = new Grid(2, 3);
    enginePanel_.getElement().getStyle().setMarginTop(5, Unit.PX);

    enginePathBox_ = makeInputBox("engine.path", true);
    enginePathBox_.getElement().getStyle().setWidth(120, Unit.PX);
    Label enginePathLabel = new Label("Engine path:");
    SmallButton enginePathBrowseButton = new SmallButton("...");
    enginePathBrowseButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // infer the start navigation directory
            String path = enginePathBox_.getValue();
            FileSystemItem initialPath = path.isEmpty() ? FileSystemItem.createDir("~/")
                    : FileSystemItem.createDir(FilePathUtils.dirFromFile(path));

            fileDialogs_.openFile("Select Engine", rfsContext_, initialPath,
                    new ProgressOperationWithInput<FileSystemItem>() {
                        @Override
                        public void execute(FileSystemItem input, ProgressIndicator indicator) {
                            if (input == null) {
                                indicator.onCompleted();
                                return;
                            }

                            String path = StringUtil.notNull(input.getPath());
                            path = path.replaceAll("\\\\", "\\\\\\\\");
                            enginePathBox_.setValue(path);
                            set("engine.path", StringUtil.ensureQuoted(path));
                            synchronize();
                            indicator.onCompleted();
                        }
                    });
        }
    });
    enginePanel_.setWidget(0, 0, enginePathLabel);
    enginePanel_.setWidget(0, 1, enginePathBox_);
    enginePanel_.setWidget(0, 2, enginePathBrowseButton);

    engineOptsBox_ = makeInputBox("engine.opts", true);
    engineOptsBox_.getElement().getStyle().setWidth(120, Unit.PX);
    Label engineOptsLabel = new Label("Engine options:");
    enginePanel_.setWidget(1, 0, engineOptsLabel);
    enginePanel_.setWidget(1, 1, engineOptsBox_);

    panel_.add(enginePanel_);

    HorizontalPanel footerPanel = new HorizontalPanel();
    footerPanel.getElement().getStyle().setWidth(100, Unit.PCT);

    FlowPanel linkPanel = new FlowPanel();
    linkPanel.add(new VerticalSpacer("8px"));
    HelpLink helpLink = new HelpLink("Chunk options", "chunk-options", false);
    linkPanel.add(helpLink);

    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.addStyleName(RES.styles().buttonPanel());
    buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);

    revertButton_ = new SmallButton("Revert");
    revertButton_.getElement().getStyle().setMarginRight(8, Unit.PX);
    revertButton_.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            revert();
            hideAndFocusEditor();
        }
    });
    buttonPanel.add(revertButton_);

    applyButton_ = new SmallButton("Apply");
    applyButton_.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            synchronize();
            hideAndFocusEditor();
        }
    });
    buttonPanel.add(applyButton_);

    footerPanel.setVerticalAlignment(VerticalPanel.ALIGN_BOTTOM);
    footerPanel.add(linkPanel);

    footerPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    footerPanel.add(buttonPanel);

    panel_.add(footerPanel);
}

From source file:org.rstudio.studio.client.workbench.views.source.editors.text.status.StatusBarWidget.java

License:Open Source License

public StatusBarWidget() {
    Binder binder = GWT.create(Binder.class);
    HorizontalPanel hpanel = binder.createAndBindUi(this);
    hpanel.setVerticalAlignment(HorizontalPanel.ALIGN_TOP);

    hpanel.setCellWidth(hpanel.getWidget(2), "100%");

    initWidget(hpanel);//from  ww w .j ava  2 s  .co  m

    height_ = 16;
}

From source file:org.rstudio.studio.client.workbench.views.source.editors.text.ui.RMarkdownNoParamsDialog.java

License:Open Source License

@Override
protected Widget createMainWidget() {
    VerticalPanel panel = new VerticalPanel();

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    // add image/*w  ww.  j  a  v a  2 s.c  o  m*/
    MessageDialogImages images = MessageDialogImages.INSTANCE;
    Image image = new Image(new ImageResource2x(images.dialog_warning2x()));
    horizontalPanel.add(image);

    // add message widget
    VerticalPanel messagePanel = new VerticalPanel();
    Label label = new MultiLineLabel(
            "There are no parameters defined for the current " + "R Markdown document.");
    label.setStylePrimaryName(ThemeResources.INSTANCE.themeStyles().dialogMessage());
    messagePanel.add(label);
    HelpLink helpLink = new HelpLink("Using R Markdown Parameters", "parameterized_reports", false);
    Style style = helpLink.getElement().getStyle();
    style.setMarginTop(4, Unit.PX);
    style.setMarginBottom(12, Unit.PX);

    messagePanel.add(helpLink);

    horizontalPanel.add(messagePanel);
    panel.add(horizontalPanel);

    return panel;
}

From source file:org.rstudio.studio.client.workbench.views.workspace.ClearAllDialog.java

License:Open Source License

@Override
protected Widget createMainWidget() {
    progress_ = addProgressIndicator();/*from   w ww . j a  va2s  .  com*/

    VerticalPanel panel = new VerticalPanel();

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    // add image
    MessageDialogImages images = MessageDialogImages.INSTANCE;
    Image image = new Image(images.dialog_warning());
    horizontalPanel.add(image);

    // add message widget
    Label label = new MultiLineLabel("Are you sure you want to remove all objects from the workspace?");
    label.setStylePrimaryName(ThemeResources.INSTANCE.themeStyles().dialogMessage());
    horizontalPanel.add(label);
    panel.add(horizontalPanel);

    // add include hidden option
    HorizontalPanel optionPanel = new HorizontalPanel();
    Style optionStyle = optionPanel.getElement().getStyle();
    optionStyle.setMarginLeft(image.getWidth(), Unit.PX);
    optionStyle.setMarginBottom(10, Unit.PX);

    chkIncludeHidden_ = new CheckBox("Include hidden objects");
    chkIncludeHidden_.setValue(prefs_.clearHidden().getValue());
    chkIncludeHidden_.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            prefs_.clearHidden().setGlobalValue(event.getValue());
            prefs_.writeUIPrefs();
        }
    });
    optionPanel.add(chkIncludeHidden_);
    panel.add(optionPanel);

    return panel;
}