All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.bordertech.wcomponents.examples.theme.WEmailFieldExample Maven / Gradle / Ivy

There is a newer version: 1.5.36
Show newest version
package com.github.bordertech.wcomponents.examples.theme;

import com.github.bordertech.wcomponents.WContainer;
import com.github.bordertech.wcomponents.WEmailField;
import com.github.bordertech.wcomponents.WFieldLayout;
import com.github.bordertech.wcomponents.autocomplete.type.Email;

/**
 * Example using WEmailFiled.
 */
public class WEmailFieldExample extends WContainer {

	private WEmailField eField;

	/**
	 * Construct example.
	 */
	public WEmailFieldExample() {

		WFieldLayout layout = new WFieldLayout();
		layout.setLabelWidth(25);
		add(layout);

		layout.addField("Plain email address", new WEmailField());

		eField = new WEmailField();
		eField.setDisabled(true);
		layout.addField("Disabled email address field", eField);

		eField = new WEmailField();
		eField.setReadOnly(true);
		layout.addField("Read-only email address field", eField);

		eField = new WEmailField();
		eField.setText("[email protected]");
		layout.addField("email address field with data", eField);

		eField = new WEmailField();
		eField.setText("[email protected]");
		eField.setDisabled(true);
		layout.addField("Disabled email address field with data", eField);

		eField = new WEmailField();
		eField.setText("[email protected]");
		eField.setReadOnly(true);
		layout.addField("Read-only email address field with data", eField);



		// constraints
		eField = new WEmailField();
		eField.setMaxLength(254);
		eField.setPlaceholder("[email protected]");
		layout.addField("Max length 254", eField);

		// autocomplete
		for (Email email : Email.values()) {
			eField = new WEmailField();
			eField.setAutocomplete(email);
			layout.addField("auto-fill hint set to ".concat(email.getValue()), eField);
		}

		eField = new WEmailField();
		eField.setAutocompleteOff();
		layout.addField("Autocomplete off", eField);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy