/** * Sets the caption for the panel using an HTML fragment. Pass in empty string * to remove the caption completely, leaving just the unadorned panel. * * @param html HTML for the new caption; must not be <code>null</code> */ public void setCaptionHTML(@IsSafeHtml String html) { assert (html != null); impl.setCaption(FieldSetElement.as(getElement()), legend, html, true); }
/** * Creates an HTML FIELDSET element. * * @return the newly-created element */ public static com.google.gwt.user.client.Element createFieldSet() { return Document.get().createFieldSetElement().cast(); }
public void setCaption( FieldSetElement fieldset, Element legend, @IsSafeHtml String caption, boolean asHTML) { // TODO(bruce): rewrite to be inlinable assert (caption != null); if (asHTML) { legend.setInnerHTML(caption); } else { legend.setInnerText(caption); } if (!"".equals(caption)) { // This is formulated to become an append (if there's no widget), an // insertion at index 0 (if there is a widget but no legend already), or // a no-op (if the legend is already in place). fieldset.insertBefore(legend, fieldset.getFirstChild()); } else if (legend.getParentNode() != null) { // We remove the legend from the DOM because leaving it in with an empty // string renders as an ugly gap in the top border on some browsers. fieldset.removeChild(legend); } } }
/** * Assert that the given {@link Element} is compatible with this class and * automatically typecast it. */ public static FieldSetElement as(Element elem) { assert is(elem); return (FieldSetElement) elem; }
public void execute() { fieldset.getStyle().setProperty("visibility", ""); } });
/** * Constructs a CaptionPanel having the specified caption. * * @param caption the caption to display * @param asHTML if <code>true</code>, the <code>caption</code> param is * interpreted as HTML; otherwise, <code>caption</code> is * treated as text and automatically escaped */ public CaptionPanel(@IsSafeHtml String caption, boolean asHTML) { FieldSetElement fieldSet = Document.get().createFieldSetElement(); initWidget(new SimplePanel(fieldSet)); legend = Document.get().createLegendElement(); fieldSet.appendChild(legend); if (asHTML) { setCaptionHTML(caption); } else { setCaptionText(caption); } }
/** * Determine whether the given {@link Node} can be cast to this class. * A <code>null</code> node will cause this method to return * <code>false</code>. */ public static boolean is(Node node) { if (Element.is(node)) { return is((Element) node); } return false; }
/** * Constructs a CaptionPanel having the specified caption. * * @param caption the caption to display * @param asHTML if <code>true</code>, the <code>caption</code> param is * interpreted as HTML; otherwise, <code>caption</code> is * treated as text and automatically escaped */ public CaptionPanel(String caption, boolean asHTML) { FieldSetElement fieldSet = Document.get().createFieldSetElement(); initWidget(new SimplePanel(fieldSet)); legend = Document.get().createLegendElement(); fieldSet.appendChild(legend); if (asHTML) { setCaptionHTML(caption); } else { setCaptionText(caption); } }
public void setCaption(FieldSetElement fieldset, Element legend, String caption, boolean asHTML) { // TODO(bruce): rewrite to be inlinable assert (caption != null); if (asHTML) { legend.setInnerHTML(caption); } else { legend.setInnerText(caption); } if (!"".equals(caption)) { // This is formulated to become an append (if there's no widget), an // insertion at index 0 (if there is a widget but no legend already), or // a no-op (if the legend is already in place). fieldset.insertBefore(legend, fieldset.getFirstChild()); } else if (legend.getParentNode() != null) { // We remove the legend from the DOM because leaving it in with an empty // string renders as an ugly gap in the top border on some browsers. fieldset.removeChild(legend); } } }
/** * Determines whether the given {@link JavaScriptObject} can be cast to * this class. A <code>null</code> object will cause this method to * return <code>false</code>. */ public static boolean is(JavaScriptObject o) { if (Element.is(o)) { return is((Element) o); } return false; }
@Override public void setCaption( final FieldSetElement fieldset, Element legend, @IsSafeHtml String caption, boolean asHTML) { fieldset.getStyle().setProperty("visibility", "hidden"); super.setCaption(fieldset, legend, caption, asHTML); Scheduler.get().scheduleDeferred(new ScheduledCommand() { public void execute() { fieldset.getStyle().setProperty("visibility", ""); } }); } }
/** * Sets the caption for the panel using text that will be automatically * escaped. Pass in empty string to remove the caption completely, leaving * just the unadorned panel. * * @param text text for the new caption; must not be <code>null</code> */ @SuppressIsSafeHtmlCastCheck public void setCaptionText(String text) { assert (text != null); impl.setCaption(FieldSetElement.as(getElement()), legend, text, false); }
/** * Creates an HTML FIELDSET element. * * @return the newly-created element */ public static com.google.gwt.user.client.Element createFieldSet() { return Document.get().createFieldSetElement().cast(); }
/** * Constructs a CaptionPanel having the specified caption. * * @param caption the caption to display * @param asHTML if <code>true</code>, the <code>caption</code> param is * interpreted as HTML; otherwise, <code>caption</code> is * treated as text and automatically escaped */ public CaptionPanel(String caption, boolean asHTML) { FieldSetElement fieldSet = Document.get().createFieldSetElement(); initWidget(new SimplePanel(fieldSet)); legend = Document.get().createLegendElement(); fieldSet.appendChild(legend); if (asHTML) { setCaptionHTML(caption); } else { setCaptionText(caption); } }
public void setCaption(FieldSetElement fieldset, Element legend, String caption, boolean asHTML) { // TODO(bruce): rewrite to be inlinable assert (caption != null); if (asHTML) { legend.setInnerHTML(caption); } else { legend.setInnerText(caption); } if (!"".equals(caption)) { // This is formulated to become an append (if there's no widget), an // insertion at index 0 (if there is a widget but no legend already), or // a no-op (if the legend is already in place). fieldset.insertBefore(legend, fieldset.getFirstChild()); } else if (legend.getParentNode() != null) { // We remove the legend from the DOM because leaving it in with an empty // string renders as an ugly gap in the top border on some browsers. fieldset.removeChild(legend); } } }
/** * Assert that the given {@link Element} is compatible with this class and * automatically typecast it. */ public static FieldSetElement as(Element elem) { assert is(elem); return (FieldSetElement) elem; }
public void execute() { fieldset.getStyle().setProperty("visibility", ""); } });
/** * Sets the caption for the panel using text that will be automatically * escaped. Pass in empty string to remove the caption completely, leaving * just the unadorned panel. * * @param text text for the new caption; must not be <code>null</code> */ public void setCaptionText(String text) { assert (text != null); impl.setCaption(FieldSetElement.as(getElement()), legend, text, false); }
/** * Creates an HTML FIELDSET element. * * @return the newly-created element */ public static com.google.gwt.user.client.Element createFieldSet() { return Document.get().createFieldSetElement().cast(); }