List of usage examples for com.google.gwt.user.client.ui HTMLPanel HTMLPanel
@SuppressIsSafeHtmlCastCheck
public HTMLPanel(String tag, @IsSafeHtml String html)
From source file:com.github.gwtbootstrap.client.ui.base.AlertBase.java
License:Apache License
/** * Initializes an Alert with an optional close icon. * * @param html inner HTML// ww w .j a v a 2s.com * @param hasClose whether the Alert should have a close icon. */ public AlertBase(String html, boolean hasClose) { super("div", ""); super.add(closeReplacement); super.add(headingContainer); container = new HTMLPanel("span", html); super.add(container); super.setStyleName(Constants.ALERT); setClose(hasClose); }
From source file:com.github.gwtbootstrap.client.ui.base.AlertBase.java
License:Apache License
/** * Sets the text of an optional heading. The implementation depends on the * subclass./* ww w. j a v a 2 s . c o m*/ * * @param text the new heading */ public void setHeading(String text) { headingContainer.clear(); headingContainer.add(new HTMLPanel("span", text)); }
From source file:com.github.gwtbootstrap.client.ui.base.AlertBase.java
License:Apache License
public void setHTML(String html) { container.clear(); container.add(new HTMLPanel("span", html)); }
From source file:com.ksyzt.gwt.client.ui.richeditor.RichTextToolbar.java
License:Open Source License
/** * Inits the popup panel.//from w ww .j a v a 2s .c om */ private void initPopupPanel() { m_ap_shadow = new HTMLPanel("div", ""); m_ap_content = new HTMLPanel("div", ""); m_ap_line = new HTMLPanel("div", ""); Style style = m_ap_content.getElement().getStyle(); style.setProperty("border", "solid 1px skyblue"); style.setBackgroundColor("white"); style.setPadding(5, Unit.PX); style.setPosition(Position.ABSOLUTE); style.setZIndex(1000000); style = m_ap_shadow.getElement().getStyle(); style.setBackgroundColor("#f0f0f0"); style.setPosition(Position.ABSOLUTE); style.setZIndex(999999); m_ap_line.setHeight("1px"); style = m_ap_line.getElement().getStyle(); style.setBackgroundColor("white"); style.setPosition(Position.ABSOLUTE); style.setZIndex(1000001); RootPanel.get().add(m_ap_shadow); RootPanel.get().add(m_ap_content); RootPanel.get().add(m_ap_line); m_ap_content.setVisible(false); m_ap_shadow.setVisible(false); m_ap_line.setVisible(false); }
From source file:com.ponysdk.core.terminal.ui.PTFrame.java
License:Apache License
@Override protected HTMLPanel createUIObject() { final HTMLPanel iframe = new HTMLPanel("iframe", ""); final String frameID = ClientToServerModel.FRAME_ID.toStringValue() + "=" + objectID; final String contextID = ClientToServerModel.UI_CONTEXT_ID.toStringValue() + "=" + PonySDK.get().getContextId(); url += url.contains("?") ? "&" : "?"; url += contextID + "&" + frameID; if (PonySDK.get().isTabindexOnlyFormField()) url += "&" + ClientToServerModel.OPTION_TABINDEX_ACTIVATED.toStringValue() + "=" + PonySDK.get().isTabindexOnlyFormField(); iframe.getElement().setAttribute("src", url); return iframe; }
From source file:com.sciencegadgets.client.equationbrowser.HomeBrowser.java
License:Open Source License
public HomeBrowser() { // Set up browsers this.getElement().setId(CSS.HOME_BROWSER); // Anchor title = new Anchor("ScienceGadgets", "/project/index.html"); HTMLPanel title = new HTMLPanel("h1", "ScienceGadgets"); title.addStyleName(CSS.MAIN_TITLE); // this.add(title); // HTMLPanel headline = new HTMLPanel( // "h2", // "A set of <a href=\"https://github.com/gralyan/ScienceGadgets\">Open Source</a>" // + " educational tools dedicated to helping redesign the next generation of learning strategies"); Label headline = new Label("sdgh"); headline.addStyleName(CSS.MAIN_HEADLINE); this.add(headline); // this.add(videoPanel); // activitySelectionPanel.getElement().setId(CSS.ACTIVITY_SELECTION_PANEL); // this.add(activitySelectionPanel); // activityDetailsPanel.getElement().setId(CSS.ACTIVITY_DETAILS_PANEL); // this.add(activityDetailsPanel); // ArrayList<ActivityButton> activityButtons = new ArrayList<HomeBrowser.ActivityButton>(); //// w ww. j a va 2 s . co m // // Add buttons // // ActivityButton defaultButton = new ActivityButton("Introduction", // videoPanel); // activityButtons.add(defaultButton); // // activityButtons.add(new ActivityButton("Make Equation", // makeEquationBrowser)); // // activityButtons // .add(new ActivityButton("Random Equation", generatePanel)); // // activityButtons.add(new ActivityButton("Conversion", conversionSpec)); // // // activitySelectionPanel.addAll(activityButtons); // // // Add initial detail // defaultButton.onSelect(); }
From source file:com.tasktop.c2c.server.tasks.client.widgets.wiki.WikiHTMLPanel.java
License:Open Source License
public void setWikiHTML(String wikiHtml) { // First, clear out previous contents. super.clear(); // Add all of our HTML to our element so that it gets converted to DOM format. HTML html = new HTML(wikiHtml); super.add(html); // Then, find all of our anchors and see if they are task links NodeList<Element> anchors = this.getElement().getElementsByTagName("a"); for (int i = 0; i < anchors.getLength(); i++) { Element curElem = anchors.getItem(i); // Grab out our href String href = curElem.getAttribute("href"); if (isTaskAnchor(href)) { String internalUrl = href.substring(href.indexOf("#")); // We need to do some fancy footwork here in order to inject a TaskAnchor into the body of this page - // hold on tight, it's going to get a bit bumpy. // First, grab the text inside the anchor - we'll use this and the href to construct our TaskAnchor. String label = curElem.getInnerText(); // Next, replace our existing anchor with a <span>-based HTMLPanel - we do this to ensure we are // preserving our location within the DOM tree (i.e. inserting our TaskAnchor at the right point in the // Document) HTMLPanel panel = new HTMLPanel("span", "") { @Override//from w w w .j a va 2 s. c o m public void add(Widget widget) { // Very ugly hack - need to call onAttach(), but it's a protected method. Sooo, we insert that // call in the add() method, which we'll call one time further inside this method, to ensure // that the widget is attached (otherwise it won't bind, and we won't get the normal Widget // behaviour, which is required for our TaskAnchor hovers to work). // If you are reading this comment and you know of a better way to handle this, you are // honour-bound to implement it and remove this hack. onAttach(); super.add(widget); } }; curElem.getParentElement().replaceChild(panel.getElement(), curElem); // Next, wrap that span in an HTML widget - this is done so that we can then inject our TaskAnchor as a // widget. panel.add(createTaskAnchor(label, internalUrl)); } } }
From source file:net.scran24.frontpage.client.FrontPage.java
License:Apache License
private void replaceHeader() { // A hack to support old generated login HTML files RootPanel headerPanel = RootPanel.get("login-header"); headerPanel.getElement().removeAllChildren(); headerPanel.add(new HTMLPanel("h1", commonMessages.loginForm_welcome())); }
From source file:net.scran24.staff.client.StaffPage.java
private void initStage1(final FlowPanel div) { div.add(new HTMLPanel("h2", "1. Set the start and end dates")); HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); hpanel.setSpacing(10);/*from ww w .j a v a 2s . c o m*/ final DatePicker dateFrom = new DatePicker(); final DatePicker dateTo = new DatePicker(); hpanel.add(new Label("Start date:")); hpanel.add(dateFrom); hpanel.add(new Label("End date:")); hpanel.add(dateTo); final Button cont = WidgetFactory.createButton("Continue", new ClickHandler() { @Override public void onClick(ClickEvent event) { final long twelveHours = 12 * 60 * 60 * 1000; long timeFrom = dateFrom.getValue().getTime() - twelveHours; long timeTo = dateTo.getValue().getTime() + twelveHours; initStage2(timeFrom, timeTo, div); } }); cont.setEnabled(false); cont.getElement().addClassName("scran24-admin-button"); dateFrom.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { if (event.getValue() != null && dateTo.getValue() != null) { cont.setEnabled(true); } } }); dateTo.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { if (event.getValue() != null && dateFrom.getValue() != null) { cont.setEnabled(true); } } }); div.add(hpanel); div.add(cont); }
From source file:net.scran24.staff.client.StaffPage.java
private void initStage2(final long startDate, final long endDate, FlowPanel div) { div.clear();/* w w w. jav a 2 s. c o m*/ div.add(new HTMLPanel("h2", "2. Upload the respondent accounts")); final FlowPanel messageDiv = new FlowPanel(); final Button start = WidgetFactory.createButton("Activate survey", new ClickHandler() { @Override public void onClick(ClickEvent event) { surveyControl.getParameters(new AsyncCallback<SurveyParameters>() { @Override public void onFailure(Throwable caught) { messageDiv.clear(); messageDiv.getElement().getStyle().setColor("#d00"); messageDiv.add(new HTMLPanel( SafeHtmlUtils.fromString("Survey could not be started: " + caught.getMessage()))); } @Override public void onSuccess(SurveyParameters result) { surveyControl.setParameters( result.withDates(startDate, endDate).withState(SurveyState.ACTIVE), new AsyncCallback<Void>() { @Override public void onSuccess(Void result) { Location.reload(); } @Override public void onFailure(Throwable caught) { messageDiv.clear(); messageDiv.getElement().getStyle().setColor("#d00"); messageDiv.add(new HTMLPanel(SafeHtmlUtils.fromString( "Survey could not be started: " + caught.getMessage()))); } }); } }); } }); start.getElement().addClassName("intake24-admin-button"); start.setEnabled(false); List<String> permissions = Arrays.asList(new String[] { "processSurvey:" + surveyId }); final UserInfoUpload userUpload = new UserInfoUpload(surveyId, "respondent", permissions, new Callback1<Option<String>>() { @Override public void call(Option<String> res) { res.accept(new Option.SideEffectVisitor<String>() { @Override public void visitSome(String error) { messageDiv.clear(); messageDiv.getElement().getStyle().setColor("#d00"); messageDiv.add(new HTMLPanel(SafeHtmlUtils.fromString(error))); start.setEnabled(false); } @Override public void visitNone() { messageDiv.clear(); messageDiv.getElement().getStyle().setColor("#0d0"); messageDiv.add(new HTMLPanel( SafeHtmlUtils.fromString("Respondent accounts uploaded successfully"))); start.setEnabled(true); } }); } }); div.add(userUpload); div.add(messageDiv); div.add(start); }