protected void onFirstShowPage() {
super.onFirstShowPage();
final PVerticalPanel panel = new PVerticalPanel();
final PTextBox textBox = new PTextBox();
final PTextBox textBoxReadOnly = new PTextBox();
textBoxReadOnly.setText("read only");
textBoxReadOnly.setEnabled(false);
final PTextBox passwordTextBox = new PPasswordTextBox();
final PTextBox passwordTextBoxReadOnly = new PPasswordTextBox();
passwordTextBoxReadOnly.setText("xxxxxxxxxxxx");
passwordTextBoxReadOnly.setEnabled(false);
final PTextArea textArea = new PTextArea();
panel.add(new PLabel("Normal text box:"));
panel.add(textBox);
panel.add(textBoxReadOnly);
final PTextBox placeHolder = new PTextBox();
panel.add(new PLabel("Place holder : "));
panel.add(placeHolder);
final PButton button = new PButton("Set");
button.addClickHandler(new PClickHandler() {
@Override
public void onClick(final PClickEvent event) {
textBox.setPlaceholder(placeHolder.getText());
textBoxReadOnly.setPlaceholder(placeHolder.getText());
}
});
panel.add(button);
final PTextBox masked = new PTextBox();
final PTextBox maskedTextBox = new PTextBox();
final PTextBox replacement = new PTextBox();
final PCheckBox showMask = new PCheckBox("Show mask");
final PButton applyMaskButton = new PButton("Apply mask");
applyMaskButton.addClickHandler(new PClickHandler() {
@Override
public void onClick(final PClickEvent event) {
if (masked.getText().isEmpty()) return;
String replaceChar = " ";
if (!replacement.getText().isEmpty()) replaceChar = replacement.getText().substring(0, 1);
maskedTextBox.applyMask(masked.getText(), showMask.getValue(), replaceChar);
}
});
masked.setPlaceholder("({{000}}) {{000}}.{{0000}}");
replacement.setWidth("10px");
final PHorizontalPanel maskPanel = new PHorizontalPanel();
maskPanel.setVerticalAlignment(PVerticalAlignment.ALIGN_MIDDLE);
maskPanel.add(masked);
maskPanel.add(maskedTextBox);
maskPanel.add(replacement);
maskPanel.add(showMask);
maskPanel.add(applyMaskButton);
panel.add(new PLabel("Password text box:"));
panel.add(passwordTextBox);
panel.add(passwordTextBoxReadOnly);
panel.add(new PLabel("Text area:"));
panel.add(textArea);
panel.add(maskPanel);
panel.add(new PLabel("AddOn test (javascript reverse)"));
final PTextBox boxToReverse = new PTextBox();
new ReverseTextInput(boxToReverse);
final PTerminalScheduledCommand deffered = new PTerminalScheduledCommand() {
@Override
protected void run() {