Example #1
0
  private FormPanel createForm() {
    FormPanel panel = new FormPanel();
    panel.setFrame(true);
    // panel.setIconStyle("icon-filter");
    panel.setCollapsible(false);
    panel.setHeaderVisible(false);
    // panel.setHeading("Select views to import");
    panel.setSize(410, -1);
    panel.setButtonAlign(HorizontalAlignment.RIGHT);
    panel.setLayout(new FlowLayout());

    // main container:
    LayoutContainer main = new LayoutContainer();
    RowLayout rowLayout = new RowLayout();
    main.setLayout(rowLayout);

    main.add(createAccountChoice());
    main.add(createTreePanel());

    panel.add(main);

    // Checkboxes for public/editable:
    final LayoutContainer rights = new LayoutContainer();
    RowLayout rLayout = new RowLayout();
    rights.setLayout(rLayout);

    makePublicView = new CheckBox();
    makePublicView.setBoxLabel(constants.visibleForAllViewers());

    makeEditableView = new CheckBox();
    makeEditableView.setBoxLabel(constants.visibleAndEditableForAllEditors());

    if (showBoxes) {
      rights.add(makePublicView);
      rights.add(makeEditableView);
      makePublicView.setValue(false);
      makeEditableView.setValue(false);
    }
    panel.add(rights);

    LabelField label = new LabelField();
    label.setHeight("20px");
    panel.add(label);

    // finally the apply/cancel button:
    SelectionListener<ComponentEvent> listener =
        new SelectionListener<ComponentEvent>() {
          public void componentSelected(ComponentEvent ce) {
            if (ce.component instanceof Button) {
              Button pressedButton = (Button) ce.component;
              // we close dialog on button press:
              if (closeAction == CloseAction.CLOSE) close(pressedButton);
              else hide(pressedButton);
            }
          }
        };
    okButton = importViews ? new Button(constants.importAction()) : new Button(constants.create());
    okButton.setItemId(BUTTON_OK);
    cancelButton = new Button(constants.cancel());
    cancelButton.setItemId(BUTTON_CANCEL);
    okButton.addSelectionListener(listener);
    cancelButton.addSelectionListener(listener);
    panel.addButton(okButton);
    panel.addButton(cancelButton);

    return panel;
  }