use of com.github.bordertech.wcomponents.WLabel in project wcomponents by BorderTech.
the class WDataListServletExample method addField.
/**
* Adds a field to the example's layout.
*
* @param input the input field to add.
* @param labelText the label text for the field.
* @param labelHint the optional label hint for the field.
*/
private void addField(final WComponent input, final String labelText, final String labelHint) {
WLabel label = new WLabel(labelText, input);
if (labelHint != null) {
label.setHint(labelHint);
}
layout.addField(label, input);
}
use of com.github.bordertech.wcomponents.WLabel in project wcomponents by BorderTech.
the class WRadioButtonSelectExample method addSingleColumnSelectExample.
/**
* adds a WRadioButtonSelect with LAYOUT_COLUMN in 1 column simply by not setting the number of columns. This is
* superfluous as you should use LAYOUT_STACKED (the default) instead.
*/
private void addSingleColumnSelectExample() {
add(new WHeading(HeadingLevel.H3, "WRadioButtonSelect laid out in a single column"));
add(new ExplanatoryText("When layout is COLUMN, setting the layoutColumnCount property to one, or forgetting to set it at all (default is " + "one) is a little bit pointless."));
final WRadioButtonSelect select = new WRadioButtonSelect("australian_state");
select.setButtonLayout(WRadioButtonSelect.LAYOUT_COLUMNS);
add(new WLabel("One column", select));
add(select);
}
use of com.github.bordertech.wcomponents.WLabel in project wcomponents by BorderTech.
the class WRadioButtonSelectExample method addColumnSelectExample.
/**
* adds a WRadioButtonSelect with LAYOUT_COLUMN in 3 columns.
*/
private void addColumnSelectExample() {
add(new WHeading(HeadingLevel.H3, "WRadioButtonSelect laid out in three columns"));
add(new ExplanatoryText("Setting the layout to COLUMN will make the radio buttons be rendered in 'n' columns. The number of columns is" + " determined by the layoutColumnCount property."));
final WRadioButtonSelect select = new WRadioButtonSelect("australian_state");
select.setButtonLayout(WRadioButtonSelect.LAYOUT_COLUMNS);
select.setButtonColumns(3);
add(new WLabel("Three column selection", select));
add(select);
add(new WHeading(HeadingLevel.H3, "Options equal to columns"));
String[] options = new String[] { "Dog", "Cat", "Bird" };
final WRadioButtonSelect select2 = new WRadioButtonSelect(options);
select2.setButtonColumns(3);
final WTextField text = new WTextField();
text.setReadOnly(true);
text.setText(NO_SELECTION);
WButton update = new WButton("Select Animals");
update.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
String output = select2.getSelected() == null ? NO_SELECTION : "The selected animal is: " + select2.getSelected();
text.setText(output);
}
});
select2.setDefaultSubmitButton(update);
add(new WLabel("Three columns and three options", select2));
add(select2);
add(update);
add(text);
add(new WAjaxControl(update, text));
}
use of com.github.bordertech.wcomponents.WLabel in project wcomponents by BorderTech.
the class WRadioButtonSelectExample method makeFramelessExample.
/**
* Make a simple editable example without a frame.
*/
private void makeFramelessExample() {
add(new WHeading(HeadingLevel.H3, "WRadioButtonSelect without its frame"));
add(new ExplanatoryText("When a WRadioButtonSelect is frameless it loses some of its coherence, especially when its WLabel is hidden or " + "replaced by a toolTip. Using a frameless WRadioButtonSelect is useful within an existing WFieldLayout as it can provide a more " + "consistent user interface but only if it has a relatively small number of options."));
final WRadioButtonSelect select = new SelectWithSelection("australian_state");
select.setFrameless(true);
add(new WLabel("Frameless with default selection", select));
add(select);
}
use of com.github.bordertech.wcomponents.WLabel in project wcomponents by BorderTech.
the class WRadioButtonSelectExample method addFlatSelectExample.
/*
* WRadioButtonSelect layout options
* These examples show the various ways to lay out the options in a WRadioButtonSelect
* NOTE: the default (if no buttonLayout is set) is LAYOUT_STACKED
*/
/**
* adds a WRadioButtonSelect with LAYOUT_FLAT.
*/
private void addFlatSelectExample() {
add(new WHeading(HeadingLevel.H3, "WRadioButtonSelect with flat layout"));
add(new ExplanatoryText("Setting the layout to FLAT will make the radio buttons be rendered in a horizontal line. They will wrap when they" + " reach the edge of the parent container."));
final WRadioButtonSelect select = new WRadioButtonSelect("australian_state");
select.setButtonLayout(WRadioButtonSelect.LAYOUT_FLAT);
add(new WLabel("Flat selection", select));
add(select);
}
Aggregations