@Override
  protected void onFirstShowPage() {
    super.onFirstShowPage();

    final PVerticalPanel layout = new PVerticalPanel();

    final FormView formView = new DefaultFormView();
    final FormConfiguration formConfiguration = new FormConfiguration();
    formConfiguration.setName("Form");
    final FormActivity formActivity = new FormActivity(formConfiguration, formView);

    final FormField field1 = new FormField("field1");
    formActivity.addFormField(field1);
    field1.addValidator(new NotEmptyFieldValidator());
    field1.addValidator(new DoubleFieldValidator());

    final FormFieldRenderer field2Renderer = new TextBoxFormFieldRenderer("field2");
    final FormField field2 = new FormField(field2Renderer);
    formActivity.addFormField(field2);

    final ListBoxFormFieldRenderer field3Renderer = new ListBoxFormFieldRenderer("field3");
    field3Renderer.addItem("Choice 1", 1);
    field3Renderer.addItem("Choice 2", 2);
    field3Renderer.addItem("Choice 3", 3);
    field3Renderer.addItem("Choice 4", 4);
    final FormField field3 = new FormField(field3Renderer);
    formActivity.addFormField(field3);

    final FormFieldRenderer field4Renderer = new DateBoxFormFieldRenderer("field4");
    final FormField field4 = new FormField(field4Renderer);
    formActivity.addFormField(field4);

    final FormFieldRenderer field5Renderer = new TextAreaFormFieldRenderer("field5");
    final FormField field5 = new FormField(field5Renderer);
    formActivity.addFormField(field5);

    final PSimplePanel formLayout = new PSimplePanel();
    layout.add(formLayout);
    formActivity.start(formLayout);

    final PButton validateButton = new PButton("Validate");
    validateButton.addClickHandler(
        new PClickHandler() {

          @Override
          public void onClick(final PClickEvent clickEvent) {
            final boolean isValid = formActivity.isValid();
            PNotificationManager.showTrayNotification(
                "The form is valid? " + (isValid ? "YES" : "NO"));
          }
        });
    layout.add(validateButton);

    examplePanel.setWidget(layout);
  }
  @Override
  protected void onFirstShowPage() {
    super.onFirstShowPage();

    final PTextBox name = new PTextBox();
    name.setPlaceholder("Cookie name");
    final PTextBox value = new PTextBox();
    name.setPlaceholder("Cookie value");
    final PButton add = new PButton("Add");
    add.addClickHandler(
        new PClickHandler() {

          @Override
          public void onClick(final PClickEvent event) {
            UIContext.get().getCookies().setCookie(name.getValue(), value.getValue());
          }
        });

    final PTextBox name2 = new PTextBox();
    name2.setPlaceholder("Cookie name");
    final PButton remove = new PButton("Remove");
    remove.addClickHandler(
        new PClickHandler() {

          @Override
          public void onClick(final PClickEvent event) {
            UIContext.get().getCookies().removeCookie(name2.getValue());
          }
        });

    final PHorizontalPanel addPanel = new PHorizontalPanel();
    addPanel.add(name);
    addPanel.add(value);
    addPanel.add(add);

    final PHorizontalPanel removePanel = new PHorizontalPanel();
    removePanel.add(name2);
    removePanel.add(remove);

    final PVerticalPanel panel = new PVerticalPanel();
    panel.setSpacing(10);

    panel.add(new PLabel("Add a cookie:"));
    panel.add(addPanel);
    panel.add(new PLabel("Remove a cookie:"));
    panel.add(removePanel);

    examplePanel.setWidget(panel);
  }
  @Override
  protected void onFirstShowPage() {
    super.onFirstShowPage();

    final PDockLayoutPanel dockLayoutPanel = new PDockLayoutPanel(PUnit.PX);
    dockLayoutPanel.setSizeFull();

    final PTabPanel tabPanel = new PTabPanel();
    tabPanel.setSizeFull();

    tabPanel.addBeforeSelectionHandler(
        new PBeforeSelectionHandler<Integer>() {

          @Override
          public void onBeforeSelection(final PBeforeSelectionEvent<Integer> event) {
            PNotificationManager.showTrayNotification(
                "onBeforeSelection, tab index : " + event.getSelectedItem());
          }
        });
    tabPanel.addSelectionHandler(
        new PSelectionHandler<Integer>() {

          @Override
          public void onSelection(final PSelectionEvent<Integer> event) {
            PNotificationManager.showTrayNotification(
                "onSelection, tab index : " + event.getSelectedItem());
          }
        });

    final PButton button = new PButton("Add Tab");
    button.setStyleProperty("margin", "10px");
    button.addClickHandler(
        new PClickHandler() {

          @Override
          public void onClick(final PClickEvent clickEvent) {
            addTabContent(tabPanel);
          }
        });

    final PButton addCustomTabButton = new PButton("Add Tab (custom tab)");
    addCustomTabButton.setStyleProperty("margin", "10px");
    addCustomTabButton.addClickHandler(
        new PClickHandler() {

          @Override
          public void onClick(final PClickEvent clickEvent) {
            addCustomTabContent(tabPanel);
          }
        });

    final PTextBox indexTextBox = new PTextBox();
    final PButton selectButton = new PButton("Select Tab");
    selectButton.setStyleProperty("margin", "10px");
    selectButton.addClickHandler(
        new PClickHandler() {

          @Override
          public void onClick(final PClickEvent clickEvent) {
            final String text = indexTextBox.getText();
            tabPanel.selectTab(Integer.valueOf(text));
          }
        });

    final PHorizontalPanel horizontalPanel = new PHorizontalPanel();
    horizontalPanel.setVerticalAlignment(PVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.add(button);
    horizontalPanel.add(addCustomTabButton);
    horizontalPanel.add(indexTextBox);
    horizontalPanel.add(selectButton);

    final PHorizontalPanel tabPanelContainer = new PHorizontalPanel();
    tabPanelContainer.add(tabPanel);

    dockLayoutPanel.addNorth(horizontalPanel, 50);
    dockLayoutPanel.add(tabPanelContainer);

    addTabContent(tabPanel);

    examplePanel.setWidget(dockLayoutPanel);
  }