Example usage for com.google.gwt.user.client.ui HTMLPanel HTMLPanel

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

Introduction

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

Prototype

private HTMLPanel(Element elem) 

Source Link

Document

Construct a new HTMLPanel with the specified element.

Usage

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

License:Open Source License

protected Widget getShortcutContent() {
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    List<ShortcutInfo> shortcuts = ShortcutManager.INSTANCE.getActiveShortcutInfo();
    String[][] groupNames = { new String[] { "Tabs/Panes", "Files", "Console" },
            new String[] { "Source Navigation", "Execute" }, new String[] { "Source Editor", "Debug" },
            new String[] { "Source Control", "Build", "Other" } };
    int pctWidth = 100 / groupNames.length;
    sb.appendHtmlConstant("<table width='100%'><tr>");
    for (String[] colGroupNames : groupNames) {
        sb.appendHtmlConstant("<td width='" + pctWidth + "%'>");
        for (String colGroupName : colGroupNames) {
            sb.appendHtmlConstant("<h2>");
            sb.appendEscaped(colGroupName);
            sb.appendHtmlConstant("</h2><table>");
            for (int i = 0; i < shortcuts.size(); i++) {
                ShortcutInfo info = shortcuts.get(i);
                if (info.getDescription() == null || info.getShortcuts().size() == 0
                        || !info.getGroupName().equals(colGroupName)) {
                    continue;
                }//  www .jav a  2s  . c  o  m
                sb.appendHtmlConstant("<tr><td><strong>");
                sb.appendHtmlConstant(StringUtil.joinStrings(info.getShortcuts(), ", "));
                sb.appendHtmlConstant("</strong></td><td>");
                sb.appendEscaped(info.getDescription());
                sb.appendHtmlConstant("</td></tr>");
            }
            sb.appendHtmlConstant("</table>");
        }
        sb.appendHtmlConstant("</td>");
    }
    sb.appendHtmlConstant("</td></tr></table>");
    HTMLPanel panel = new HTMLPanel(sb.toSafeHtml());
    return panel;
}

From source file:org.rstudio.studio.client.rmarkdown.ui.RmdBooleanOption.java

License:Open Source License

public RmdBooleanOption(RmdTemplateFormatOption option, String initialValue) {
    super(option);
    HTMLPanel panel = new HTMLPanel("");
    checkBox_ = new CheckBox(option.getUiName());
    defaultValue_ = Boolean.parseBoolean(option.getDefaultValue());
    checkBox_.setValue(Boolean.parseBoolean(initialValue));
    panel.add(checkBox_);//from   w ww.j av  a 2  s .  c  o  m
    initWidget(panel);
}

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());/*from  www  . j av  a 2s . c o m*/
    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.RmdDiscoveredTemplateItem.java

License:Open Source License

public RmdDiscoveredTemplateItem(RmdDiscoveredTemplate template) {
    template_ = template;//from  w  ww  .j  av a 2 s. c  o m
    panel_ = new HTMLPanel("");
    Label pkg = new Label("{" + template.getPackage() + "}");
    pkg.getElement().getStyle().setFloat(Style.Float.RIGHT);
    pkg.getElement().getStyle().setColor("#909090");
    panel_.add(pkg);
    Label name = new Label(template.getName());
    name.setTitle(template.getDescription());
    panel_.add(name);
    panel_.getElement().getStyle().setPaddingLeft(3, Unit.PX);
    panel_.getElement().getStyle().setPaddingRight(3, Unit.PX);

    initWidget(panel_);
}

From source file:org.rstudio.studio.client.rmarkdown.ui.RmdFileOption.java

License:Open Source License

public RmdFileOption(RmdTemplateFormatOption option, String initialValue) {
    super(option, initialValue);
    defaultValue_ = option.getDefaultValue();

    HTMLPanel panel = new HTMLPanel("");
    panel.add(getOptionLabelWidget());/*from  w w w .ja  v  a2s .co  m*/

    fileChooser_ = new FileChooserTextBox("", null);
    if (!initialValue.equals("null"))
        fileChooser_.setText(initialValue);
    fileChooser_.getElement().getStyle().setMarginLeft(20, Unit.PX);
    fileChooser_.getElement().getStyle().setMarginTop(3, Unit.PX);
    panel.add(fileChooser_);

    updateNull();

    initWidget(panel);
}

From source file:org.rstudio.studio.client.rmarkdown.ui.RmdFloatOption.java

License:Open Source License

public RmdFloatOption(RmdTemplateFormatOption option, String initialValue) {
    super(option, initialValue);
    HTMLPanel panel = new HTMLPanel("");
    defaultValue_ = Float.parseFloat(option.getDefaultValue());
    panel.add(getOptionLabelWidget());/*from   w  w  w .ja  v  a 2s  .  c om*/
    txtValue_ = new NumericTextBox();
    if (initialValue.equals("null"))
        txtValue_.setValue(option.getDefaultValue());
    else
        txtValue_.setValue(initialValue);
    txtValue_.setWidth("40px");
    txtValue_.getElement().getStyle().setMarginLeft(5, Unit.PX);
    panel.add(txtValue_);

    updateNull();

    initWidget(panel);
}

From source file:org.rstudio.studio.client.rmarkdown.ui.RmdStringOption.java

License:Open Source License

public RmdStringOption(RmdTemplateFormatOption option, String initialValue) {
    super(option, initialValue);
    defaultValue_ = option.getDefaultValue();

    HTMLPanel panel = new HTMLPanel("");
    panel.add(getOptionLabelWidget());//from   ww  w  . j a va2 s . c om
    txtValue_ = new TextBox();
    if (!initialValue.equals("null"))
        txtValue_.setValue(initialValue);
    txtValue_.getElement().getStyle().setDisplay(Display.BLOCK);
    txtValue_.getElement().getStyle().setMarginLeft(20, Unit.PX);
    txtValue_.getElement().getStyle().setMarginTop(3, Unit.PX);
    txtValue_.setWidth("75%");
    panel.add(txtValue_);

    updateNull();
    initWidget(panel);
}

From source file:org.rstudio.studio.client.workbench.views.connections.ui.NewConnectionPreInstallOdbcHost.java

License:Open Source License

public void initializeInfo(NewConnectionInfo info) {
    dirChooser_.setText(info.getOdbcInstallPath());
    license_.setText(info.getOdbcLicense());
    driverLabel_.setText("The " + info.getName() + " driver is currently not installed. ");

    if (!StringUtil.isNullOrEmpty(info.getOdbcWarning())) {
        SafeHtml safeMsg = DialogHtmlSanitizer.sanitizeHtml(info.getOdbcWarning());
        HTMLPanel formattedPanel = new HTMLPanel(safeMsg);
        warningLabel_.add(formattedPanel);
    } else {/*from  w  w  w .  j  a  v a  2s.  c om*/
        warningPanel_.setVisible(false);
    }
}

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

License:Open Source License

private Widget buildEmptyGridMessage() {
    HTMLPanel messagePanel = new HTMLPanel("");
    messagePanel.setStyleName(style.emptyEnvironmentPanel());
    environmentEmptyMessage_ = new Label(EMPTY_ENVIRONMENT_MESSAGE);
    environmentEmptyMessage_.setStyleName(style.emptyEnvironmentMessage());
    messagePanel.add(environmentEmptyMessage_);
    return messagePanel;
}

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

License:Open Source License

public ChunkOrdinalWidget() {
    final HTMLPanel content = new HTMLPanel("");
    content.setVisible(false);
    initWidget(content);
}