List of usage examples for com.google.gwt.user.client.ui HTMLPanel add
public void add(Widget widget, String id)
From source file:eu.riscoss.client.RiscossWebApp.java
License:Apache License
public void generateShortcuts() { shortcuts.setStyleName("float-right"); shortcuts.setHeight("100%"); Boolean b1 = false;/*w w w. j a v a2 s.c om*/ Boolean b2 = false; Boolean b3 = false; //Entity-layer shortcut SimplePanel s1 = new SimplePanel(); s1.setStyleName("shortcut-1"); s1.setWidth("200px"); s1.setHeight("100px"); VerticalPanel v = new VerticalPanel(); if (access.contains("Entities")) { b1 = true; Anchor entities = new Anchor("entities to be analysed updated"); entities.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadPanel("entities.jsp"); } }); HTMLPanel l1 = new HTMLPanel( "Before you can run risk analysis, you need to have the <span id='entities'></span>."); l1.add(entities, "entities"); v.add(l1); } if (access.contains("Layers")) { b1 = true; Anchor layers = new Anchor("defining a hierarchy of layers"); layers.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadPanel("layers.jsp"); } }); HTMLPanel l2 = new HTMLPanel("Entities can be organized hierarchically <span id='layers'></span>."); l2.add(layers, "layers"); v.add(l2); } s1.add(v); //Riskconf-model shortcut SimplePanel s2 = new SimplePanel(); s2.setWidth("200px"); s2.setHeight("100px"); s2.setStyleName("shortcut-2"); VerticalPanel vv = new VerticalPanel(); if (access.contains("Risk Configurations")) { b2 = true; Anchor riskconfs = new Anchor("defining risks configurations"); riskconfs.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadPanel("riskconfs.jsp"); } }); HTMLPanel l3 = new HTMLPanel("The risk analysis needs to be configured <span id='riskconfs'></span>."); l3.add(riskconfs, "riskconfs"); vv.add(l3); } if (access.contains("Models")) { b2 = true; Anchor models = new Anchor("uploaded models"); models.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadPanel("models.jsp"); } }); HTMLPanel l4 = new HTMLPanel("The risk configurations use the <span id='models'></span>."); l4.add(models, "models"); vv.add(l4); } s2.setWidget(vv); //analysis-browse shortcut SimplePanel s3 = new SimplePanel(); s3.setWidth("200px"); s3.setHeight("100px"); s3.setStyleName("shortcut-3"); VerticalPanel vvv = new VerticalPanel(); if (access.contains("Multi-layer Analysis")) { b3 = true; Anchor riskanalysis = new Anchor("manage your risk analysis sessions"); riskanalysis.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadPanel("riskanalysis.jsp"); } }); HTMLPanel l5 = new HTMLPanel("You are ready to <span id='riskanalysis'></span>"); l5.add(riskanalysis, "riskanalysis"); vvv.add(l5); } if (access.contains("Risk Analysis Sessions")) { b3 = true; Anchor ras = new Anchor("generate some comparisons"); ras.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadPanel("ras.jsp"); } }); HTMLPanel l6 = new HTMLPanel("You can also <span id='ras'></span>."); l6.add(ras, "ras"); vvv.add(l6); } s3.setWidget(vvv); if (b1) shortcuts.add(s1); if (b2) shortcuts.add(s2); if (b3) shortcuts.add(s3); }
From source file:MY_PACKAGE.client.Index.java
License:Apache License
@Override public void onModuleLoad() { /*/* ww w . ja va2s . 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:org.baracusproject.client.Index.java
License:Apache License
@Override public void onModuleLoad() { /*//from w ww . ja va 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 face!"); /* The main footer shows our message at the bottom of the page. */ MainFooter footer = new MainFooter(); footer.setFooterString( "face 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(STRINGS.MainPanel_html()) { @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:org.bonitasoft.forms.client.view.common.DOMUtils.java
License:Open Source License
/** * Replace the content of the body by the template body * * @param pageHTMLPanel/*from w w w. j a va 2 s . c o m*/ * @param processHTMLPanel * @param elementId */ protected void addPageContent(final HTMLPanel pageHTMLPanel, final HTMLPanel processHTMLPanel, final String elementId) { if (processHTMLPanel != null) { processHTMLPanel.add(pageHTMLPanel, elementId); addScriptElementToDOM(pageHTMLPanel.getElement(), processHTMLPanel.getElement()); } else { final RootPanel container = RootPanel.get(STATIC_CONTENT_ELEMENT_ID); container.clear(); container.add(pageHTMLPanel); addScriptElementToDOM(pageHTMLPanel.getElement(), container.getElement()); } }
From source file:org.bonitasoft.forms.client.view.common.DOMUtils.java
License:Open Source License
/** * insert a content inside an element/* w ww . j ava 2 s . com*/ * * @param htmlPanel * @param pageLabelElementId * @param pageLabel * @param allowHTML */ public void insertInElement(final HTMLPanel htmlPanel, final String elementId, final String content, final boolean preventHTML) { if (htmlPanel != null) { final HTML htmlContent = new HTML(); if (preventHTML) { htmlContent.setText(content); } else { htmlContent.setHTML(content); } htmlPanel.add(htmlContent, elementId); } else { final Element element = DOM.getElementById(elementId); if (element != null) { if (preventHTML) { element.setInnerText(content); } else { element.setInnerHTML(content); } } } }
From source file:org.bonitasoft.forms.client.view.controller.ConfirmationPageHandler.java
License:Open Source License
/** * {@inheritDoc}/*from w w w.j a va2 s. c om*/ */ @Override public void onSuccess(final ReducedHtmlTemplate result) { String confirmMessage = result.getDynamicMessage(); if (confirmMessage == null) { confirmMessage = defaultConfirmationMessage; } if (getCurrentPageHTMLPanel() != null && applicationHTMLPanel != null) { applicationHTMLPanel.remove(getCurrentPageHTMLPanel()); } final HTMLPanel pageHTMLPanel = new HTMLPanel(result.getBodyContent()); final String onloadAttributeValue = formsTemplateUtils.insertPageTemplate(result.getHeadNodes(), pageHTMLPanel, result.getBodyAttributes(), applicationHTMLPanel, elementId); formsTemplateUtils.insertInElement(applicationHTMLPanel, CONFIRM_MESSAGE_ELEMENT_ID, confirmMessage); final TodoListTaskWidget taskListWidget = new TodoListTaskWidget(applicationHTMLPanel, elementId, getCurrentPageHTMLPanel(), formId, urlContext); pageHTMLPanel.add(taskListWidget, CONFIRM_TODOLIST_ELEMENT_ID); formsTemplateUtils.hideLoading(); if (onloadAttributeValue != null) { formsTemplateUtils.javascriptEval(onloadAttributeValue); } }
From source file:org.bonitasoft.forms.client.view.controller.FormPagesViewController.java
License:Open Source License
/** * Insert the widget in the page//from w w w . j av a 2 s .co m * * @param pageHTMLPanel * the HTMLPanel * @param formWidgetData * the widget definition * @param widget * the widget to insert * @param containerStyle * the style to apply to the container */ protected void insertWidget(final HTMLPanel pageHTMLPanel, final ReducedFormWidget formWidgetData, final Widget widget, final String containerStyle) { if (formWidgetData.isDisplayCondition()) { final Element widgetParentElement = pageHTMLPanel.getElementById(formWidgetData.getId()); final String widgetStyle; if (formWidgetData.getStyle() != null && formWidgetData.getStyle().length() > 0) { widgetStyle = containerStyle + " " + formWidgetData.getStyle(); } else { widgetStyle = containerStyle; } if (widgetParentElement != null) { pageHTMLPanel.add(widget, widgetParentElement); widgetParentElement.addClassName(widgetStyle); } else { Window.alert( "An element with id " + formWidgetData.getId() + " is missing from the page template."); } } }
From source file:org.gems.ajax.client.edit.DiagramElementEditPart.java
License:Open Source License
public DiagramElementEditPart(ModelHelper modelHelper, EditPartFactory fact, Object model) { super(modelHelper, fact, model); HTMLPanel hp = new HTMLPanel( "<table><tbody><tr><td>Properties:</td></tr><tr><td id=\"attrs\"></td></tr><tr><td></td></tr></tbody></table>"); hp.add(propertiesPanel_, "attrs"); detailFigure_ = new DetailFigure(hp); }
From source file:org.jboss.as.console.client.shared.homepage.ContentBox.java
License:Open Source License
public ContentBox(final String id, final String title, final SafeHtml body, final String linkTitle, final String linkTarget) { dp = new DisclosurePanel(); dp.setHeader(new HTML(TEMPLATES.header(IdHelper.asId(id + "_", getClass(), "_" + "header"), title))); dp.addOpenHandler(this); dp.addCloseHandler(this); dp.setOpen(true);/*from ww w. j a v a 2 s. com*/ String linkId = IdHelper.asId(id + "_", getClass(), "_" + "link"); HTMLPanel panel = new HTMLPanel(TEMPLATES.body(body, linkId)); panel.addStyleName("homepage-content-box-body"); InlineHyperlink hyperlink = new InlineHyperlink(linkTitle, linkTarget); hyperlink.addStyleName("homepage-link"); panel.add(hyperlink, linkId); dp.add(panel); initWidget(dp); setStyleName("homepage-content-box"); }
From source file:org.jboss.as.console.client.shared.homepage.ContentBox.java
License:Open Source License
public ContentBox(final String id, final String title, final SafeHtml body, Widget widget) { dp = new DisclosurePanel(); dp.setHeader(new HTML(TEMPLATES.header(IdHelper.asId(id + "_", getClass(), "_" + "header"), title))); dp.addOpenHandler(this); dp.addCloseHandler(this); dp.setOpen(true);/*from w w w.j a va 2s .co m*/ String linkId = HTMLPanel.createUniqueId(); HTMLPanel panel = new HTMLPanel(TEMPLATES.body(body, linkId)); panel.addStyleName("homepage-content-box-body"); panel.add(widget, linkId); dp.add(panel); initWidget(dp); setStyleName("homepage-content-box"); }