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:io.apiman.manager.ui.client.local.pages.consumer.PolicyChain.java

License:Apache License

/**
 * Creates a single policy row.//from ww  w.j a  v  a2 s . co  m
 * @param bean
 */
private Widget createPolicyRow(PolicyBean bean) {
    FlowPanel container = new FlowPanel();
    container.getElement().setClassName("container-fluid"); //$NON-NLS-1$
    container.getElement().addClassName("apiman-summaryrow"); //$NON-NLS-1$

    FlowPanel row = new FlowPanel();
    container.add(row);
    row.getElement().setClassName("row"); //$NON-NLS-1$

    createIconColumn(bean, row);
    createSummaryColumn(bean, row);

    container.add(new HTMLPanel("<hr/>")); //$NON-NLS-1$

    return container;
}

From source file:io.apiman.manager.ui.client.local.pages.org.OrgMemberList.java

License:Apache License

/**
 * Creates a single member row.//  w  w  w  . jav  a2s  .c  o m
 * @param bean
 */
private Widget createRow(MemberBean bean) {
    FlowPanel container = new FlowPanel();
    container.getElement().setClassName("container-fluid"); //$NON-NLS-1$
    container.getElement().addClassName("apiman-summaryrow"); //$NON-NLS-1$

    FlowPanel row = new FlowPanel();
    container.add(row);
    row.getElement().setClassName("row"); //$NON-NLS-1$

    createTitle(bean, row);
    createJoinedOn(bean, row);

    FlowPanel row2 = new FlowPanel();
    container.add(row2);
    row2.getElement().setClassName("row"); //$NON-NLS-1$
    createDescription(bean, row2);

    container.add(new HTMLPanel("<hr/>")); //$NON-NLS-1$

    return container;
}

From source file:io.apiman.manager.ui.client.local.pages.org.OrgPlanList.java

License:Apache License

/**
 * Creates a single plan row.//from w w  w  .j a  v  a2 s .  c o  m
 * @param bean
 */
private Widget createRow(PlanSummaryBean bean) {
    FlowPanel container = new FlowPanel();
    container.getElement().setClassName("container-fluid"); //$NON-NLS-1$
    container.getElement().addClassName("apiman-summaryrow"); //$NON-NLS-1$

    FlowPanel row1 = new FlowPanel();
    container.add(row1);
    row1.getElement().setClassName("row"); //$NON-NLS-1$

    createTitle(bean, row1);

    FlowPanel row2 = new FlowPanel();
    container.add(row2);
    row2.getElement().setClassName("row"); //$NON-NLS-1$
    createDescription(bean, row2);

    container.add(new HTMLPanel("<hr/>")); //$NON-NLS-1$

    return container;
}

From source file:io.apiman.manager.ui.client.local.pages.user.UserOrganizationList.java

License:Apache License

/**
 * Creates a single organization row.//from w w  w .j  a  v a  2 s  . co  m
 * @param bean
 */
private Widget createOrgRow(OrganizationSummaryBean bean) {
    FlowPanel container = new FlowPanel();
    container.getElement().setClassName("container-fluid"); //$NON-NLS-1$
    container.getElement().addClassName("apiman-summaryrow"); //$NON-NLS-1$

    FlowPanel row1 = new FlowPanel();
    container.add(row1);
    row1.getElement().setClassName("row"); //$NON-NLS-1$
    SpanPanel title = new SpanPanel();
    row1.add(title);
    title.getElement().setClassName("title"); //$NON-NLS-1$
    Anchor a = toOrgFactory.get(MultimapUtil.singleItemMap("org", bean.getId())); //$NON-NLS-1$
    title.add(a);
    a.setText(bean.getName());

    FlowPanel row2 = new FlowPanel();
    container.add(row2);
    row2.getElement().setClassName("row"); //$NON-NLS-1$
    InlineLabel description = new InlineLabel(bean.getDescription());
    row2.add(description);
    description.getElement().setClassName("description"); //$NON-NLS-1$

    container.add(new HTMLPanel("<hr/>")); //$NON-NLS-1$

    return container;
}

From source file:it.unibo.cs.v2.client.PrebuiltWizard.java

License:Open Source License

public PrebuiltWizard() {
    super("<h2>Import an existing machine</h2>");
    add(new HTML(
            "<p>Following is a list of machines exported by the other users. The list is ordered by the users' name.</p>"));

    getPrebuiltMachinesProxy.getPrebuiltMachines(new AsyncCallback<HashMap<String, LinkedList<MachineInfo>>>() {

        @Override//from  w ww. ja  va  2  s  .  c  o  m
        public void onSuccess(HashMap<String, LinkedList<MachineInfo>> result) {
            if (result == null) {
                System.err.println("No machines found.");
                return;
            }

            for (String user : result.keySet()) {
                DisclosurePanel userPanel = new DisclosurePanel(
                        user + " exported a total of " + result.get(user).size() + " machines");
                userPanel.setAnimationEnabled(true);
                HTMLPanel userHTMLPanel = new HTMLPanel("");
                userPanel.add(userHTMLPanel);

                for (final MachineInfo m : result.get(user)) {
                    DisclosurePanel machinePanel = new DisclosurePanel(m.getName());
                    Button importButton = new Button("Import this machine");
                    machinePanel.setAnimationEnabled(true);
                    HTMLPanel machineHTMLPanel = new HTMLPanel("");
                    machinePanel.add(machineHTMLPanel);

                    // Fetch the informations about the machine
                    userHTMLPanel.add(machinePanel);
                    machineHTMLPanel.add(new HTML("<b>Short description</b>"));
                    machineHTMLPanel.add(new HTML("&nbsp;" + m.getDescription() + "<br /><br />"));

                    machineHTMLPanel.add(new HTML("<b>Long description</b><br/>"));
                    machineHTMLPanel.add(
                            new HTML("&nbsp;" + m.getLongDescription().replace("<", "&lt;").replace(">", "&gt;")
                                    .replace("\n", "<br />&nbsp;").replace("\\n", "<br />&nbsp;")));

                    machineHTMLPanel.add(new HTML("<b>Storage</b><br />"));
                    machineHTMLPanel.add(new HTML("&nbsp;" + m.getHda() + " (" + m.getHdaSize() + ")<br />"));
                    if (m.isHdbEnabled())
                        machineHTMLPanel
                                .add(new HTML("&nbsp;" + m.getHdb() + " (" + m.getHdbSize() + ")<br />"));
                    machineHTMLPanel.add(new HTML("<br />"));

                    machineHTMLPanel.add(new HTML("<b>Networking</b><br />"));
                    if (m.isVirtuacluster())
                        machineHTMLPanel.add(new HTML("&nbsp;Virtuacluster support is <b>enabled</b>"));
                    else
                        machineHTMLPanel.add(new HTML("&nbsp;Virtuacluster support is <b>disabled</b>"));

                    machineHTMLPanel.add(new HTML("<br />"));
                    machineHTMLPanel.add(importButton);

                    importButton.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            importMachineProxy.importMachine(m, new AsyncCallback<Boolean>() {

                                @Override
                                public void onFailure(Throwable caught) {
                                    clear();
                                    add(new HTML(
                                            "<span style=\"color: red\">" + caught.getMessage() + "</span>"));
                                }

                                @Override
                                public void onSuccess(Boolean result) {
                                    clear();
                                    add(new HTML(
                                            "<span style=\"color: green\">Machine imported successfully. Please note that the process may take a while to complete. "
                                                    + "You'll receive a notification upon completition"));
                                }
                            });
                        }
                    });
                }

                add(userPanel);
                add(new HTML("<br />"));
            }

        }

        @Override
        public void onFailure(Throwable caught) {

        }
    });
}

From source file:mr.davidsanderson.uml.client.impl.MessagePanelImpl.java

License:Apache License

/**
 * @param graphEventBus//w  w  w  . ja  v a2  s  .  c  o  m
 */
@Inject
public MessagePanelImpl(final GraphEventBus graphEventBus) {
    this.graphEventBus = graphEventBus;
    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    buttonPanel.setSpacing(10);
    Button okBtn = new Button(new HTML("Ok").toString(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {

            Log.debug("MessagePanel.okBtn.onClick : fire event close editor");
            graphEventBus.fireEvent(new GraphEvent(origin, GraphEventType.MSG_CLOSE));
            Log.debug("MessagePanel.okBtn.onClick : fire content changed");
        }
    });
    Button clearBtn = new Button(new HTML("Clear").toString(), new ClickHandler() {
        public void onClick(ClickEvent arg0) {
            Log.debug("MessagePanel.Clear.onClick : clears");
            clear();
        }
    });
    Button helpBtn = new Button(new HTML("Help").toString(), new ClickHandler() {
        public void onClick(ClickEvent arg0) {

            Log.debug("MessagePanel.Help.onClick : show help");
            addMessage(helpTxtStart + helpTextMid + helpTextEnd);
        }
    });
    buttonPanel.add(okBtn);
    buttonPanel.add(clearBtn);
    buttonPanel.add(helpBtn);

    htmlPanel = new HTMLPanel(messagePanelHtml);
    htmlPanel.setSize("100%", "100%");

    this.add(htmlPanel, DockPanel.CENTER);
    this.add(buttonPanel, DockPanel.SOUTH);
    this.setCellHorizontalAlignment(buttonPanel, DockPanel.ALIGN_CENTER);
    this.setCellVerticalAlignment(buttonPanel, DockPanel.ALIGN_BOTTOM);
    this.setCellHeight(htmlPanel, "99%");
    this.setCellHorizontalAlignment(htmlPanel, DockPanel.ALIGN_LEFT);
    this.setCellVerticalAlignment(htmlPanel, DockPanel.ALIGN_MIDDLE);

    addMessage(messageDivStart + "Welcome begin modelling by clicking ok." + messageDivEnd);
}

From source file:MY_PACKAGE.client.Index.java

License:Apache License

@Override
public void onModuleLoad() {
    /*//  w  w  w  . j  ava  2 s.  c  o  m
     This is where we load our module and create our dynamic controls.  The MainHeader
     displays our title bar at the top of our page.
     */
    MainHeader header = new MainHeader();
    header.setHeaderTitle("Hello Spiffy MY_PROJECT!");

    /*
     The main footer shows our message at the bottom of the page.
     */
    MainFooter footer = new MainFooter();
    footer.setFooterString(
            "MY_PROJECT was built with the <a href=\"http://www.spiffyui.org\">Spiffy UI Framework</a>");

    /*
     This HTMLPanel holds most of our content.
     MainPanel_html was built in the HTMLProps task from MainPanel.html, which allows you to use large passages of html
     without having to string escape them.
     */
    HTMLPanel panel = new HTMLPanel(HTMLResources.INSTANCE.getMainPanelHTML().getText()) {
        @Override
        public void onLoad() {
            super.onLoad();
            /*
             Let's set focus into the text field when the page first loads
             */
            m_text.setFocus(true);
        }
    };

    RootPanel.get("mainContent").add(panel);

    /*
     These dynamic controls add interactivity to our page.
     */
    panel.add(m_longMessage, "longMsg");
    panel.add(m_text, "nameField");
    final Button button = new Button("Submit");
    panel.add(button, "submitButton");

    button.addClickHandler(this);
    m_text.addKeyPressHandler(this);

}

From source file:net.easysmarthouse.ui.webui.client.view.CamerasView.java

@Override
public Widget createWidget() {
    Widget widget = super.createWidget();
    grid.resize(2, 1);/* w w w. j av  a  2s  .c  o m*/

    camPanel = new HTMLPanel(camerasBundle.webcamFragment().getText());

    return widget;
}

From source file:net.europa13.taikai.web.client.ui.MainPanel.java

License:Open Source License

/**
 * Constructor.//from  w ww.  j  a v  a2 s.  com
 */
private MainPanel() {

    super("<div id=\"top\"></div>\n<div id=\"middle\"></div>\n<div id=\"bottom\">\n");

    setWidth("100%");

    HorizontalPanel topPanel = new HorizontalPanel();
    //        topPanel.setWidth("100%");
    topPanel.add(new HTML("<h1>TaikaiWeb</h1>"));
    //        topPanel.setBorderWidth(1);
    add(topPanel, "top");

    HorizontalPanel middlePanel = new HorizontalPanel();

    sidePanel = new SidePanel(this);
    sidePanel.setWidth("100%");
    sidePanel.setHeight("100%");
    //        sidePanel.setBorderWidth(1);
    middlePanel.add(sidePanel);

    toolbarPanel = new FlowPanel();
    toolbarPanel.setStyleName("taikaiweb-Toolbar");
    toolbarPanel.add(new Label("Tools:"));

    contentContainerPanel = new HTMLPanel("<div id=\"toolbar\"></div><div id=\"content\"></div>");
    contentContainerPanel.setWidth("100%");
    contentContainerPanel.setHeight("100%");
    contentContainerPanel.add(toolbarPanel, "toolbar");

    DecoratorPanel decorator = new DecoratorPanel();
    decorator.add(contentContainerPanel);
    decorator.setWidth("100%");
    decorator.setHeight("100%");
    //        decorator.set
    //        middlePanel.add(contentContainerPanel);
    middlePanel.add(decorator);

    //        middlePanel.setCellHeight(sidePanel, "100%");
    middlePanel.setCellWidth(sidePanel, "20%");
    middlePanel.setCellHeight(sidePanel, "100%");
    middlePanel.setCellWidth(contentContainerPanel, "80%");
    middlePanel.setCellWidth(contentContainerPanel, "100%");
    middlePanel.setWidth("100%");

    add(middlePanel, "middle");

}

From source file:net.scran24.admin.client.NewSurvey.java

License:Apache License

public NewSurvey() {
    contents = new FlowPanel();

    final Grid surveyParametersGrid = new Grid(7, 2);
    surveyParametersGrid.setCellPadding(5);

    contents.add(surveyParametersGrid);//from ww w  .  j  av  a  2s.  c o m

    final Label idLabel = new Label("Survey identifier: ");
    final TextBox idTextBox = new TextBox();

    surveyParametersGrid.setWidget(0, 0, idLabel);
    surveyParametersGrid.setWidget(0, 1, idTextBox);

    final Label schemeBoxLabel = new Label("Survey scheme: ");
    final ListBox schemeBox = new ListBox();
    schemeBox.setMultipleSelect(false);

    final Label localeLabel = new Label("Locale: ");
    final ListBox localeBox = new ListBox();
    localeBox.setMultipleSelect(false);

    localeBox.addItem("English (UK)", "en_GB");
    localeBox.addItem("English (New Zealand)", "en_NZ");
    localeBox.addItem("Portuguese (Portugal)", "pt_PT");
    localeBox.addItem("Danish (Denmark)", "da_DK");
    localeBox.addItem("Arabic (UAE)", "ar_AE");

    for (SurveySchemeReference s : SurveySchemes.allSchemes)
        schemeBox.addItem(s.description(), s.id());

    schemeBox.setSelectedIndex(0);

    surveyParametersGrid.setWidget(1, 0, schemeBoxLabel);
    surveyParametersGrid.setWidget(1, 1, schemeBox);

    surveyParametersGrid.setWidget(2, 0, localeLabel);
    surveyParametersGrid.setWidget(2, 1, localeBox);

    final Label genUserLabel = new Label("Allow auto login: ");
    final CheckBox genCheckBox = new CheckBox();

    surveyParametersGrid.setWidget(3, 0, genUserLabel);
    surveyParametersGrid.setWidget(3, 1, genCheckBox);

    final Label forwardToSurveyMonkey = new Label("SurveyMonkey support:");
    final CheckBox smCheckBox = new CheckBox();

    surveyParametersGrid.setWidget(4, 0, forwardToSurveyMonkey);
    surveyParametersGrid.setWidget(4, 1, smCheckBox);

    final Label surveyMonkeyUrl = new Label("SurveyMonkey link:");
    final TextBox smUrlTextBox = new TextBox();

    surveyParametersGrid.setWidget(5, 0, surveyMonkeyUrl);
    surveyParametersGrid.setWidget(5, 1, smUrlTextBox);

    smUrlTextBox.setEnabled(false);

    final Label supportEmailLabel = new Label("Support e-mail:");
    final TextBox supportEmailTextBox = new TextBox();

    surveyParametersGrid.setWidget(6, 0, supportEmailLabel);
    surveyParametersGrid.setWidget(6, 1, supportEmailTextBox);

    smCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
            smUrlTextBox.setEnabled(valueChangeEvent.getValue());
        }
    });

    final FlowPanel errorDiv = new FlowPanel();
    errorDiv.getElement().addClassName("scran24-admin-survey-id-error-message");

    contents.add(errorDiv);

    final Button createButton = WidgetFactory.createButton("Create survey");

    createButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            createButton.setEnabled(false);
            final String id = idTextBox.getText();
            errorDiv.clear();

            String smUrlText = smUrlTextBox.getText();

            Option<String> smUrl;

            if (smCheckBox.getValue())
                smUrl = smUrlText.isEmpty() ? Option.<String>none() : Option.some(smUrlText);
            else
                smUrl = Option.<String>none();

            if (smCheckBox.getValue() && smUrlText.isEmpty()) {
                errorDiv.add(new Label("Please paste the SurveyMonkey link!"));
                createButton.setEnabled(true);
                return;
            } else if (smCheckBox.getValue()
                    && !smUrlText.contains("intake24_username=[intake24_username_value]")) {
                errorDiv.add(new Label("Invalid SurveyMonkey link: intake24_username variable missing!"));
                createButton.setEnabled(true);
                return;
            }

            service.createSurvey(id, schemeBox.getValue(schemeBox.getSelectedIndex()),
                    localeBox.getValue(localeBox.getSelectedIndex()), genCheckBox.getValue(), smUrl,
                    supportEmailTextBox.getValue(), new AsyncCallback<Option<String>>() {
                        @Override
                        public void onSuccess(Option<String> result) {
                            result.accept(new Option.SideEffectVisitor<String>() {
                                @Override
                                public void visitSome(String error) {
                                    errorDiv.add(new Label(error));
                                    createButton.setEnabled(true);
                                }

                                @Override
                                public void visitNone() {
                                    contents.clear();
                                    contents.add(new HTMLPanel(SafeHtmlUtils.fromSafeConstant(
                                            "<h2>Survey created!</h2><p>Please go to <strong>Survey management</strong> and upload the staff accounts for the new survey.</p>")));
                                }
                            });
                        }

                        @Override
                        public void onFailure(Throwable caught) {
                            createButton.setEnabled(true);
                            errorDiv.add(
                                    new Label("Server error (" + SafeHtmlUtils.htmlEscape(caught.getMessage())
                                            + "), please check server logs"));
                        }
                    });
        }
    });
    createButton.getElement().addClassName("scran24-admin-button");

    VerticalPanel buttonsPanel = new VerticalPanel();
    buttonsPanel.add(createButton);

    contents.add(buttonsPanel);

    initWidget(contents);
}