public class Widgets extends Object
| Constructor and Description |
|---|
Widgets() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getText(TextBoxBase box,
String defaultAsBlank)
Retrieve the text from the TextBox, unless it is the specified default, in which case
we return "".
|
static TextBox |
initTextBox(TextBox box,
String text,
int maxLength,
int visibleLength)
Configures a text box with all of the configuration that you're bound to want to do.
|
static <T extends Widget & HasClickHandlers> |
makeActionable(T target,
ClickHandler onClick,
Value<Boolean> enabled)
Makes the supplied widget "actionable" which means adding the "actionLabel" style to it and
binding the supplied click handler.
|
static Image |
makeActionImage(Image image,
String tip,
ClickHandler onClick)
Makes an image into one that responds to clicking.
|
static Label |
makeActionLabel(Label label,
ClickHandler onClick)
Makes the supplied label into an action label.
|
static AbsolutePanel |
newAbsolutePanel(String styleName)
Creates a AbsolutePanel with the supplied style
|
static Image |
newActionImage(String path,
ClickHandler onClick)
Creates an image that responds to clicking.
|
static Image |
newActionImage(String path,
String tip,
ClickHandler onClick)
Creates an image that responds to clicking.
|
static Label |
newActionLabel(String text,
ClickHandler onClick)
Creates a label that triggers an action using the supplied text and handler.
|
static Label |
newActionLabel(String text,
String style,
ClickHandler onClick)
Creates a label that triggers an action using the supplied text and handler.
|
static FlowPanel |
newFlowPanel(String styleName,
Widget... contents)
Creates a FlowPanel with the provided style and widgets.
|
static FlowPanel |
newFlowPanel(Widget... contents)
Creates a FlowPanel with the supplied widgets.
|
static HTML |
newHTML(String text,
String... styles)
Creates a new HTML element with the specified contents and style.
|
static Image |
newImage(AbstractImagePrototype image,
String... styles)
Creates an image with the supplied resource and style.
|
static Image |
newImage(ImageResource image,
String... styles)
Creates an image with the supplied resource and style.
|
static Image |
newImage(String path,
String... styles)
Creates an image with the supplied path and style.
|
static PushButton |
newImageButton(String style,
ClickHandler onClick)
Creates an image button that changes appearance when you click and hover over it.
|
static Image |
newInlineImage(String path)
Creates an image that will render inline with text (rather than forcing a break).
|
static InlineLabel |
newInlineLabel(String text,
String... styles)
Creates an inline label with optional styles.
|
static Label |
newLabel(String text,
String... styles)
Creates a label with the supplied text and style and optional additional styles.
|
static PushButton |
newPushButton(Image defaultImage,
Image overImage,
Image downImage,
ClickHandler onClick)
Creates a PushButton with default(up), mouseover and mousedown states.
|
static HorizontalPanel |
newRow(HasVerticalAlignment.VerticalAlignmentConstant valign,
String styleName,
Widget... contents)
Creates a row of widgets in a horizontal panel with a 5 pixel gap between them.
|
static HorizontalPanel |
newRow(String styleName,
Widget... contents)
Creates a row of widgets in a horizontal panel with a 5 pixel gap between them.
|
static HorizontalPanel |
newRow(Widget... contents)
Creates a row of widgets in a horizontal panel with a 5 pixel gap between them.
|
static ScrollPanel |
newScrollPanel(Widget contents,
int xpad,
int ypad)
Wraps the supplied contents in a scroll panel that will set the max-width to
Window.getClientWidth()-xpad and the max-height to Window.getClientHeight()-ypad.
|
static ScrollPanel |
newScrollPanelX(Widget contents,
int maxWidth)
Wraps the supplied contents in a scroll panel with the specified maximum width.
|
static ScrollPanel |
newScrollPanelY(Widget contents,
int maxHeight)
Wraps the supplied contents in a scroll panel with the specified maximum height.
|
static Widget |
newShim(int width,
int height)
Makes a widget that takes up horizontal and or vertical space.
|
static SimplePanel |
newSimplePanel(String styleName,
Widget widget)
Creates a SimplePanel with the supplied style and widget
|
static TextArea |
newTextArea(String text,
int width,
int height)
Creates a text area with all of the configuration that you're bound to want to do.
|
static LimitedTextArea |
newTextArea(String text,
int width,
int height,
int maxLength)
Creates a limited text area with all of the configuration that you're bound to want to do.
|
static TextBox |
newTextBox(String text,
int maxLength,
int visibleLength)
Creates a text box with all of the configuration that you're bound to want to do.
|
static <B extends TextBoxBase> |
setPlaceholderText(B box,
String placeholder)
Set the placeholder text to use on the specified form field.
|
static <T extends Widget> |
setStyleNames(T widget,
String... styles)
Configures the supplied styles on the supplied widget.
|
public static SimplePanel newSimplePanel(String styleName, Widget widget)
public static FlowPanel newFlowPanel(Widget... contents)
public static FlowPanel newFlowPanel(String styleName, Widget... contents)
public static AbsolutePanel newAbsolutePanel(String styleName)
public static ScrollPanel newScrollPanel(Widget contents, int xpad, int ypad)
public static ScrollPanel newScrollPanelX(Widget contents, int maxWidth)
public static ScrollPanel newScrollPanelY(Widget contents, int maxHeight)
public static HorizontalPanel newRow(Widget... contents)
public static HorizontalPanel newRow(String styleName, Widget... contents)
public static HorizontalPanel newRow(HasVerticalAlignment.VerticalAlignmentConstant valign, String styleName, Widget... contents)
public static Label newLabel(String text, String... styles)
public static InlineLabel newInlineLabel(String text, String... styles)
public static Label newActionLabel(String text, ClickHandler onClick)
public static Label newActionLabel(String text, String style, ClickHandler onClick)
public static Label makeActionLabel(Label label, ClickHandler onClick)
public static <T extends Widget & HasClickHandlers> T makeActionable(T target, ClickHandler onClick, Value<Boolean> enabled)
enabled - an optional value that governs the enabled state of the target. When the
value becomes false, the target's click handler and "actionLabel" style will be removed,
when it becomes true they will be reinstated.public static HTML newHTML(String text, String... styles)
public static Image newImage(ImageResource image, String... styles)
public static Image newImage(AbstractImagePrototype image, String... styles)
public static Image newImage(String path, String... styles)
public static Image newActionImage(String path, ClickHandler onClick)
public static Image newActionImage(String path, String tip, ClickHandler onClick)
public static Image makeActionImage(Image image, String tip, ClickHandler onClick)
public static Image newInlineImage(String path)
public static TextBox newTextBox(String text, int maxLength, int visibleLength)
public static <B extends TextBoxBase> B setPlaceholderText(B box, String placeholder)
public static String getText(TextBoxBase box, String defaultAsBlank)
public static TextBox initTextBox(TextBox box, String text, int maxLength, int visibleLength)
public static TextArea newTextArea(String text, int width, int height)
width - the width of the text area or -1 to use the default (or CSS styled) width.public static LimitedTextArea newTextArea(String text, int width, int height, int maxLength)
width - the width of the text area or -1 to use the default (or CSS styled) width.public static PushButton newPushButton(Image defaultImage, Image overImage, Image downImage, ClickHandler onClick)
public static PushButton newImageButton(String style, ClickHandler onClick)
public static Widget newShim(int width, int height)
Copyright © 2013. All Rights Reserved.