Beispiel #1
0
  public WeaponsView() {
    DecoratorPanel contentTableDecorator = new DecoratorPanel();
    initWidget(contentTableDecorator);
    contentTableDecorator.setWidth("100%");
    contentTableDecorator.setWidth("15em");

    contentTable = new FlexTable();
    contentTable.setWidth("100%");
    contentTable.getCellFormatter().addStyleName(0, 0, "contacts-ListContainer");
    contentTable.getCellFormatter().setWidth(0, 0, "100%");
    contentTable.getFlexCellFormatter().setVerticalAlignment(0, 0, DockPanel.ALIGN_TOP);

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setBorderWidth(0);
    hPanel.setSpacing(0);
    hPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
    addButton = new Button("增加");
    hPanel.add(addButton);
    deleteButton = new Button("删除");
    hPanel.add(deleteButton);
    contentTable.getCellFormatter().addStyleName(0, 0, "contacts-ListMenu");
    contentTable.setWidget(0, 0, hPanel);

    contactsTable = new FlexTable();
    contactsTable.setCellSpacing(0);
    contactsTable.setCellPadding(0);
    contactsTable.setWidth("100%");
    contactsTable.addStyleName("contacts-ListContents");
    contactsTable.getColumnFormatter().setWidth(0, "15px");
    contentTable.setWidget(1, 0, contactsTable);

    contentTableDecorator.add(contentTable);
  }
  private FlexTable getFooter() {

    ft = new FlexTable();
    ft.addStyleName("perunFooter");

    FlexTable.FlexCellFormatter ftf = ft.getFlexCellFormatter();

    if (!voContact.getHTML().isEmpty()) {
      // show only if any contact is present
      voContact.setHTML(
          "<strong>"
              + ApplicationMessages.INSTANCE.supportContact()
              + "</strong> "
              + voContact.getHTML());
    }

    ft.setWidget(0, 0, voContact);
    ft.setWidget(0, 1, new HTML(PerunWebConstants.INSTANCE.footerPerunCopyright()));

    ftf.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);
    ftf.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    ftf.getElement(0, 1).setAttribute("style", "text-wrap: avoid;");
    ftf.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    ftf.setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    return ft;
  }
Beispiel #3
0
 public void removeIcon() {
   center = new Text("Switch");
   switchTable.setWidget(1, 1, center);
   switchTable.addStyleName("screen-btn-cont");
   image.setUrl("");
   isOn = true;
 }
Beispiel #4
0
 @Override
 public void clear() {
   super.clear();
   table = new FlexTable();
   table.addStyleName("property-Table");
   table.setCellSpacing(0);
   addWidget(table);
 }
Beispiel #5
0
 private void addStylesToElementsInStockList() {
   stocksFlexTable.getRowFormatter().addStyleName(0, "watchListHeader");
   stocksFlexTable.addStyleName("watchList");
   stocksFlexTable.getCellFormatter().addStyleName(0, 1, "watchListNumericColumn");
   stocksFlexTable.getCellFormatter().addStyleName(0, 2, "watchListNumericColumn");
   stocksFlexTable.getCellFormatter().addStyleName(0, 3, "watchListRemoveColumn");
   stocksFlexTable.setCellPadding(6);
 }
Beispiel #6
0
  public CalendarWidget(
      int displayHeaders, boolean displayWeekNumber, Authentication authentication) {
    this.calendars = new ArrayList<Calendar>();
    this.displayHeaders = displayHeaders;
    this.displayWeekNumber = displayWeekNumber;
    this.authentication = authentication;

    // final SimplePanel container;

    final FlexTable grid = new FlexTable();
    grid.addStyleName("calendar");
    grid.addStyleName(displayMode.getStyleName());

    initWidget(grid);

    final Date now = new Date();
    today = new Date(now.getYear(), now.getMonth(), now.getDate());
    startDate = new Date(0, 0, 0);

    today();
  }
Beispiel #7
0
 /** Add a row to the flex table. */
 private void addRows() {
   int rowIndex = flexTable.getRowCount();
   for (int i = 0; i < addRecord.size(); i++) {
     Widget widget = addWidget(addRecord.get(rowIndex - 1));
     flexTable.setText(rowIndex, 0, addRecord.get(i).getFieldName());
     flexTable.setWidget(rowIndex, 1, widget);
     flexTable.setText(rowIndex, 2, getMandatory(addRecord.get(rowIndex - 1)));
     flexTable.setText(rowIndex, KEY_COLUMN, addRecord.get(i).getFieldKey());
     applyDataRowStyles();
     flexTable.setCellSpacing(0);
     flexTable.addStyleName("FlexTable");
     flexTable.setWidth("90%");
     rowIndex++;
   }
 }
Beispiel #8
0
  /**
   * Defines the display mode of the calendar and perform a redraw.
   *
   * @param displayMode Style of the calendar (day, week or month).
   * @see CalendarWidget.DisplayMode
   */
  public void setDisplayMode(DisplayMode displayMode) {
    final FlexTable grid = (FlexTable) getWidget();

    clear();

    // Resetting the CSS style
    grid.removeStyleName(this.displayMode.getStyleName());

    this.displayMode = displayMode;

    // Applying the CSS style associated with the new display mode
    grid.addStyleName(displayMode.getStyleName());

    refresh();
  }
Beispiel #9
0
  public TangoPanelTable(String str) {
    HorizontalPanel buttons = new HorizontalPanel();
    panel.add(buttons);
    panel.setCellHorizontalAlignment(buttons, VerticalPanel.ALIGN_CENTER);
    flexTable = new FlexTable();
    flexTable.setSize("100%", "100%");
    panel.add(flexTable);
    flexTable.addStyleName("WordPanelTable-table");
    flexTable.addStyleName("WordPanelTable-panel");

    /* セルがクリックされた時の振る舞い */
    flexTable.addTableListener(
        new TableListener() {
          public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
            System.out.println("row=" + row + ", col=" + cell);
          }
        });
  }
Beispiel #10
0
  private void loadStockWatcher() {
    // Set up sign out hyperlink.
    signOutLink.setHref(loginInfo.getLogoutUrl());

    // Create table for tasks.
    tasksFlexTable.setText(0, 0, "Tâche");
    tasksFlexTable.setText(0, 1, "DeadLine");
    tasksFlexTable.setText(0, 2, "Priorité");
    tasksFlexTable.setText(0, 3, "Remove");

    // Add styles to elements in the stock list table.
    tasksFlexTable.getRowFormatter().addStyleName(0, "watchListHeader");
    tasksFlexTable.addStyleName("watchList");
    tasksFlexTable.getCellFormatter().addStyleName(0, 1, "watchListNumericColumn");
    tasksFlexTable.getCellFormatter().addStyleName(0, 2, "watchListNumericColumn");
    tasksFlexTable.getCellFormatter().addStyleName(0, 3, "watchListRemoveColumn");

    loadStocks();

    // Assemble Add Task panel.
    addPanel.add(newTaskTextBox);
    addPanel.add(addTaskButton);
    addPanel.addStyleName("addPanel");

    // Assemble Main panel.
    errorMsgLabel.setStyleName("errorMessage");
    errorMsgLabel.setVisible(false);

    mainPanel.add(errorMsgLabel);
    mainPanel.add(signOutLink);
    mainPanel.add(tasksFlexTable);
    mainPanel.add(addPanel);
    mainPanel.add(lastUpdatedLabel);

    // Associate the Main panel with the HTML host page.
    RootPanel.get("tasksList").add(mainPanel);

    // Move cursor focus to the input box.
    newTaskTextBox.setFocus(true);

    // Setup timer to refresh list automatically.
    Timer refreshTimer =
        new Timer() {
          @Override
          public void run() {
            refreshWatchList();
          }
        };
    refreshTimer.scheduleRepeating(REFRESH_INTERVAL);

    // Listen for mouse events on the Add button.
    addTaskButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            addTask();
          }
        });

    // Listen for keyboard events in the input box.
    newTaskTextBox.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            if (event.getCharCode() == KeyCodes.KEY_ENTER) {
              addTask();
            }
          }
        });
  }
Beispiel #11
0
  /**
   * Prepares the widgets from the items as A FORM FOR SETTINGS
   *
   * @param items
   */
  public void prepareSettings(final ArrayList<ApplicationFormItem> items) {

    // refresh table events
    final JsonCallbackEvents refreshEvents =
        new JsonCallbackEvents() {
          public void onFinished(JavaScriptObject jso) {
            prepareSettings(items);
          }
        };

    FlexTable ft = new FlexTable();
    ft.addStyleName("borderTable");
    ft.setWidth("100%");
    ft.setCellPadding(8);
    FlexCellFormatter fcf = ft.getFlexCellFormatter();

    ft.setHTML(0, 0, "<strong>Short name</strong>");
    ft.setHTML(0, 1, "<strong>Type</strong>");
    ft.setHTML(0, 2, "<strong>Preview</strong>");
    ft.setHTML(0, 3, "<strong>Edit</strong>");

    fcf.setStyleName(0, 0, "GPBYFDEFD");
    fcf.setStyleName(0, 1, "GPBYFDEFD");
    fcf.setStyleName(0, 2, "GPBYFDEFD");
    fcf.setStyleName(0, 3, "GPBYFDEFD");

    String locale = "en";

    if (LocaleInfo.getCurrentLocale().getLocaleName().equals("default")
        || LocaleInfo.getCurrentLocale().getLocaleName().equals("en")) {
      locale = "en";
    } else {
      locale = "cs";
    }

    int i = 1;
    for (final ApplicationFormItem item : items) {

      final int index = i - 1;

      // not yet set locale on config page
      RegistrarFormItemGenerator gen = new RegistrarFormItemGenerator(item, locale);

      // 0 = label
      String label = "";
      if (gen.isLabelShown()) {
        label = item.getShortname();
      }
      if (item.isRequired() == true) {
        label += "*";
      }
      ft.setHTML(i, 0, label);

      // 1 = type
      ft.setHTML(i, 1, item.getType());

      // 2 = preview
      Widget w = gen.getWidget();
      ft.setWidget(i, 2, w);

      // 3 = EDIT
      FlexTable editTable = new FlexTable();
      editTable.setStyleName("noBorder");
      ft.setWidget(i, 3, editTable);

      // color for items with unsaved changes
      if (item.wasEdited() == true) {
        ft.getFlexCellFormatter().setStyleName(i, 0, "log-changed");
        ft.getFlexCellFormatter().setStyleName(i, 1, "log-changed");
        ft.getFlexCellFormatter().setStyleName(i, 2, "log-changed");
        ft.getFlexCellFormatter().setStyleName(i, 3, "log-changed");
      }

      // mark row for deletion
      if (item.isForDelete()) {

        ft.getFlexCellFormatter().setStyleName(i, 0, "log-error");
        ft.getFlexCellFormatter().setStyleName(i, 1, "log-error");
        ft.getFlexCellFormatter().setStyleName(i, 2, "log-error");
        ft.getFlexCellFormatter().setStyleName(i, 3, "log-error");

        // undelete button
        CustomButton undelete =
            new CustomButton(
                ButtonTranslation.INSTANCE.undeleteFormItemButton(),
                ButtonTranslation.INSTANCE.undeleteFormItem(),
                SmallIcons.INSTANCE.arrowLeftIcon(),
                new ClickHandler() {
                  public void onClick(ClickEvent event) {
                    items.get(index).setForDelete(false);
                    // refresh
                    prepareSettings(items);
                  }
                });

        FlexTable undelTable = new FlexTable();
        undelTable.setStyleName("noBorder");
        undelTable.setHTML(
            0, 0, "<strong><span style=\"color:red;\">MARKED FOR DELETION</span></strong>");
        undelTable.setWidget(0, 1, undelete);
        ft.setWidget(i, 3, undelTable);
      }

      // color for new items to be saved
      if (item.getId() == 0) {
        ft.getFlexCellFormatter().setStyleName(i, 0, "log-success");
        ft.getFlexCellFormatter().setStyleName(i, 1, "log-success");
        ft.getFlexCellFormatter().setStyleName(i, 2, "log-success");
        ft.getFlexCellFormatter().setStyleName(i, 3, "log-success");
      }

      // up
      PushButton upButton =
          new PushButton(
              new Image(SmallIcons.INSTANCE.arrowUpIcon()),
              new ClickHandler() {

                public void onClick(ClickEvent event) {

                  if (index - 1 < 0) return;

                  // move it
                  items.remove(index);
                  items.add(index - 1, item);
                  item.setOrdnum(item.getOrdnum() - 1);

                  item.setEdited(true);

                  // refresh
                  prepareSettings(items);
                }
              });
      editTable.setWidget(0, 0, upButton);
      upButton.setTitle(ButtonTranslation.INSTANCE.moveFormItemUp());

      // down
      PushButton downButton =
          new PushButton(
              new Image(SmallIcons.INSTANCE.arrowDownIcon()),
              new ClickHandler() {

                public void onClick(ClickEvent event) {

                  if (index + 1 >= items.size()) return;

                  // move it
                  items.remove(index);
                  items.add(index + 1, item);
                  item.setOrdnum(item.getOrdnum() + 1);

                  item.setEdited(true);

                  // refresh
                  prepareSettings(items);
                }
              });
      editTable.setWidget(0, 1, downButton);
      downButton.setTitle(ButtonTranslation.INSTANCE.moveFormItemDown());

      // edit
      CustomButton editButton =
          new CustomButton(
              ButtonTranslation.INSTANCE.editFormItemButton(),
              ButtonTranslation.INSTANCE.editFormItem(),
              SmallIcons.INSTANCE.applicationFormEditIcon());
      editButton.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              session
                  .getTabManager()
                  .addTabToCurrentTab(new EditFormItemTabItem(item, refreshEvents));
            }
          });
      editTable.setWidget(0, 2, editButton);

      // remove
      CustomButton removeButton =
          new CustomButton(
              ButtonTranslation.INSTANCE.deleteButton(),
              ButtonTranslation.INSTANCE.deleteFormItem(),
              SmallIcons.INSTANCE.deleteIcon());
      removeButton.addClickHandler(
          new ClickHandler() {

            public void onClick(ClickEvent event) {
              HTML text =
                  new HTML(
                      "<p>Deleting of form items is <strong>NOT RECOMMENDED!</strong><p>You will loose access to data users submitted in older applications within this form item!<p>Do you want to continue?");
              Confirm c =
                  new Confirm(
                      "Delete confirm",
                      text,
                      new ClickHandler() {
                        public void onClick(ClickEvent event) {
                          // mark for deletion when save changes
                          items.get(index).setForDelete(true);
                          // remove if newly created
                          if (items.get(index).getId() == 0) {
                            items.remove(index);
                          }
                          // refresh
                          prepareSettings(items);
                        }
                      },
                      true);
              c.setNonScrollable(true);
              c.show();
            }
          });
      editTable.setWidget(0, 3, removeButton);

      // format
      fcf.setHeight(i, 0, "28px");
      fcf.setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_MIDDLE);
      fcf.setVerticalAlignment(i, 1, HasVerticalAlignment.ALIGN_MIDDLE);
      fcf.setVerticalAlignment(i, 2, HasVerticalAlignment.ALIGN_MIDDLE);

      i++;
    }

    contents.setWidget(ft);
  }
  public Widget draw() {

    titleWidget.setText(def.getName());
    final TabItem tab = this;

    // create main panel for content
    final FlexTable mainPage = new FlexTable();
    mainPage.setWidth("100%");

    final ExtendedTextBox description = new ExtendedTextBox();
    description.setWidth("100%");
    description.getTextBox().setText(def.getDescription());
    final ExtendedTextBox.TextBoxValidator validator =
        new ExtendedTextBox.TextBoxValidator() {
          @Override
          public boolean validateTextBox() {
            if (description.getTextBox().getText().trim().isEmpty()) {
              description.setError("Description can't be empty.");
              return false;
            }
            description.setOk();
            return true;
          }
        };

    final ExtendedTextBox displayName = new ExtendedTextBox();
    displayName.setWidth("100%");
    displayName.getTextBox().setText(def.getDisplayName());
    final ExtendedTextBox.TextBoxValidator validatorName =
        new ExtendedTextBox.TextBoxValidator() {
          @Override
          public boolean validateTextBox() {
            if (displayName.getTextBox().getText().trim().isEmpty()) {
              displayName.setError("Display name can't be empty.");
              return false;
            }
            displayName.setOk();
            return true;
          }
        };

    description.setValidator(validator);
    displayName.setValidator(validatorName);

    FlexTable attributeDetailTable = new FlexTable();
    attributeDetailTable.setStyleName("inputFormFlexTable");

    final CustomButton updateButton =
        TabMenu.getPredefinedButton(ButtonType.SAVE, "Save attribute details");
    updateButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {

            final ArrayList<AttributeRights> list = new ArrayList<AttributeRights>();
            for (AttributeRights r : rights) {
              if (r.getRole().equalsIgnoreCase("SELF")) {
                list.add(getRightsFromWidgets(selfRead, selfWrite, r));
              } else if (r.getRole().equalsIgnoreCase("VOADMIN")) {
                list.add(getRightsFromWidgets(voRead, voWrite, r));
              } else if (r.getRole().equalsIgnoreCase("GROUPADMIN")) {
                list.add(getRightsFromWidgets(groupRead, groupWrite, r));
              } else if (r.getRole().equalsIgnoreCase("FACILITYADMIN")) {
                list.add(getRightsFromWidgets(facilityRead, facilityWrite, r));
              }
            }

            if ((!def.getDescription().equals(description.getTextBox().getText().trim())
                || !def.getDisplayName().equals(displayName.getTextBox().getText().trim()))) {

              if (!validator.validateTextBox() || !validatorName.validateTextBox()) return;

              def.setDescription(description.getTextBox().getText().trim());
              def.setDisplayName(displayName.getTextBox().getText().trim());

              UpdateAttribute request =
                  new UpdateAttribute(
                      JsonCallbackEvents.disableButtonEvents(
                          updateButton,
                          new JsonCallbackEvents() {
                            @Override
                            public void onFinished(JavaScriptObject jso) {

                              // after update - update rights
                              SetAttributeRights request =
                                  new SetAttributeRights(
                                      JsonCallbackEvents.disableButtonEvents(
                                          updateButton,
                                          new JsonCallbackEvents() {
                                            @Override
                                            public void onFinished(JavaScriptObject jso) {
                                              enableDisableWidgets(true);
                                            }

                                            @Override
                                            public void onLoadingStart() {
                                              enableDisableWidgets(false);
                                            }

                                            @Override
                                            public void onError(PerunError error) {
                                              enableDisableWidgets(true);
                                            }
                                          }));
                              request.setAttributeRights(list);
                            }
                          }));
              request.updateAttribute(def);
            } else {

              // after update - update rights
              SetAttributeRights request =
                  new SetAttributeRights(
                      JsonCallbackEvents.disableButtonEvents(
                          updateButton,
                          new JsonCallbackEvents() {
                            @Override
                            public void onFinished(JavaScriptObject jso) {
                              enableDisableWidgets(true);
                            }

                            @Override
                            public void onLoadingStart() {
                              enableDisableWidgets(false);
                            }

                            @Override
                            public void onError(PerunError error) {
                              enableDisableWidgets(true);
                            }
                          }));
              request.setAttributeRights(list);
            }
          }
        });

    attributeDetailTable.setHTML(0, 0, "Display name:");
    attributeDetailTable.setWidget(0, 1, displayName);
    attributeDetailTable.setHTML(1, 0, "Description:");
    attributeDetailTable.setWidget(1, 1, description);
    for (int i = 0; i < attributeDetailTable.getRowCount(); i++) {
      attributeDetailTable.getFlexCellFormatter().setStyleName(i, 0, "itemName");
    }

    final FlexTable rightsTable = new FlexTable();
    rightsTable.setStyleName("inputFormFlexTable");

    rightsTable.setHTML(0, 1, "<strong>SELF</strong>");
    rightsTable.setHTML(0, 2, "<strong>VO</strong>");
    rightsTable.setHTML(0, 3, "<strong>GROUP</strong>");
    rightsTable.setHTML(0, 4, "<strong>FACILITY</strong>");

    rightsTable.setHTML(1, 0, "<strong>READ</strong>");
    rightsTable.setHTML(2, 0, "<strong>WRITE</strong>");

    rightsTable.setWidget(1, 1, selfRead);
    rightsTable.setWidget(2, 1, selfWrite);
    rightsTable.setWidget(1, 2, voRead);
    rightsTable.setWidget(2, 2, voWrite);
    rightsTable.setWidget(1, 3, groupRead);
    rightsTable.setWidget(2, 3, groupWrite);
    rightsTable.setWidget(1, 4, facilityRead);
    rightsTable.setWidget(2, 4, facilityWrite);

    rightsTable.addStyleName("centeredTable");

    TabMenu menu = new TabMenu();
    menu.addWidget(updateButton);

    menu.addWidget(
        TabMenu.getPredefinedButton(
            ButtonType.CLOSE,
            "",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                session.getTabManager().closeTab(tab, false);
              }
            }));

    GetAttributeRights rightsCall =
        new GetAttributeRights(
            def.getId(),
            new JsonCallbackEvents() {
              @Override
              public void onFinished(JavaScriptObject jso) {
                rights = JsonUtils.jsoAsList(jso);
                for (AttributeRights r : rights) {
                  if (r.getRole().equalsIgnoreCase("SELF")) {
                    setRightsToWidgets(selfRead, selfWrite, r);
                  } else if (r.getRole().equalsIgnoreCase("VOADMIN")) {
                    setRightsToWidgets(voRead, voWrite, r);
                  } else if (r.getRole().equalsIgnoreCase("GROUPADMIN")) {
                    setRightsToWidgets(groupRead, groupWrite, r);
                  } else if (r.getRole().equalsIgnoreCase("FACILITYADMIN")) {
                    setRightsToWidgets(facilityRead, facilityWrite, r);
                  }
                }
                enableDisableWidgets(true);
                rightsTable.setVisible(true);
              }

              @Override
              public void onError(PerunError error) {
                enableDisableWidgets(true);
                rightsTable.setVisible(false);
              }

              @Override
              public void onLoadingStart() {
                enableDisableWidgets(false);
                rightsTable.setVisible(false);
              }
            });
    rightsCall.retrieveData();

    // create new instance for jsonCall
    final GetServicesByAttrDefinition services = new GetServicesByAttrDefinition(def.getId());
    services.setCheckable(false);

    CellTable<Service> attrDefTable =
        services.getTable(
            new FieldUpdater<Service, String>() {
              @Override
              public void update(int index, Service object, String value) {
                session.getTabManager().addTab(new ServiceDetailTabItem(object));
              }
            });
    attrDefTable.setStyleName("perun-table");
    ScrollPanel scrollTable = new ScrollPanel(attrDefTable);
    scrollTable.addStyleName("perun-tableScrollPanel");
    session.getUiElements().resizePerunTable(scrollTable, 350, this);

    // set content to page

    mainPage.setWidget(0, 0, menu);
    mainPage.getFlexCellFormatter().setColSpan(0, 0, 2);

    mainPage.setWidget(1, 0, attributeDetailTable);
    mainPage.setWidget(1, 1, rightsTable);
    mainPage.getFlexCellFormatter().setWidth(1, 0, "50%");
    mainPage.getFlexCellFormatter().setWidth(1, 1, "50%");

    HTML title = new HTML("<p>Required by service</p>");
    title.setStyleName("subsection-heading");
    mainPage.setWidget(2, 0, title);
    mainPage.getFlexCellFormatter().setColSpan(2, 0, 2);

    // put page into scroll panel
    mainPage.setWidget(3, 0, scrollTable);
    mainPage.getFlexCellFormatter().setColSpan(3, 0, 2);
    mainPage.getFlexCellFormatter().setHeight(3, 0, "100%");

    this.contentWidget.setWidget(mainPage);

    return getWidget();
  }
  public FindFolderSelectPopup() {
    // Establishes auto-close when click outside
    super(false, true);

    status = new Status();
    status.setStyleName("okm-StatusPopup");

    vPanel = new VerticalPanel();
    vPanel.setWidth("700");
    vPanel.setHeight("350");
    hPanel = new HorizontalPanel();

    scrollFolderPanel = new ScrollPanel();
    scrollFolderPanel.setStyleName("okm-Popup-text");

    cancelButton =
        new Button(
            Main.i18n("button.close"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                hide();
              }
            });

    actionButton =
        new Button(
            Main.i18n("search.result.menu.go.folder"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                CommonUI.openPath(folderTable.getText(selectedRow, 1), "");
                hide();
              }
            });

    keyword = new TextBox();
    keyword.setWidth("692");
    keyword.addKeyUpHandler(
        new KeyUpHandler() {
          @Override
          public void onKeyUp(KeyUpEvent event) {
            if (keyword.getText().length() >= 3) {
              GWTQueryParams gwtParams = new GWTQueryParams();
              int actualView = Main.get().mainPanel.desktop.navigator.stackPanel.getStackIndex();

              switch (actualView) {
                case UIDesktopConstants.NAVIGATOR_TAXONOMY:
                  gwtParams.setPath(Main.get().taxonomyRootFolder.getPath());
                  break;
                case UIDesktopConstants.NAVIGATOR_TEMPLATES:
                  gwtParams.setPath(Main.get().templatesRootFolder.getPath());
                  break;
                case UIDesktopConstants.NAVIGATOR_PERSONAL:
                  gwtParams.setPath(Main.get().personalRootFolder.getPath());
                  break;
                case UIDesktopConstants.NAVIGATOR_MAIL:
                  gwtParams.setPath(Main.get().mailRootFolder.getPath());
                  break;
                case UIDesktopConstants.NAVIGATOR_TRASH:
                  gwtParams.setPath(Main.get().trashRootFolder.getPath());
                  break;
              }

              gwtParams.setMimeType("");
              gwtParams.setKeywords("");
              gwtParams.setMimeType("");
              gwtParams.setName(keyword.getText() + "*"); // add wildcard at ends
              gwtParams.setAuthor("");
              gwtParams.setMailFrom("");
              gwtParams.setMailTo("");
              gwtParams.setMailSubject("");
              gwtParams.setOperator(GWTQueryParams.OPERATOR_AND);
              gwtParams.setLastModifiedFrom(null);
              gwtParams.setLastModifiedTo(null);
              gwtParams.setDomain(GWTQueryParams.FOLDER);
              gwtParams.setProperties(new HashMap<String, GWTPropertyParams>());
              find(gwtParams);
            } else {
              removeAllRows();
            }
          }
        });

    folderTable = new FlexTable();
    folderTable.setWidth("100%");
    folderTable.setCellPadding(2);
    folderTable.setCellSpacing(0);

    folderTable.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            markSelectedRow(folderTable.getCellForEvent(event).getRowIndex());
            evaluateEnableAction();
          }
        });

    folderTable.addDoubleClickHandler(
        new DoubleClickHandler() {
          @Override
          public void onDoubleClick(DoubleClickEvent event) {
            CommonUI.openPath(folderTable.getText(selectedRow, 1), "");
            hide();
          }
        });

    scrollFolderPanel.add(folderTable);
    scrollFolderPanel.setPixelSize(690, 300);

    vPanel.add(keyword);
    vPanel.add(scrollFolderPanel);
    vPanel.add(new HTML("<br>"));
    hPanel.add(cancelButton);
    HTML space = new HTML();
    space.setWidth("50");
    hPanel.add(space);
    hPanel.add(actionButton);
    vPanel.add(hPanel);
    vPanel.add(new HTML("<br>"));

    vPanel.setCellHorizontalAlignment(keyword, HasAlignment.ALIGN_CENTER);
    vPanel.setCellVerticalAlignment(keyword, HasAlignment.ALIGN_MIDDLE);
    vPanel.setCellHorizontalAlignment(scrollFolderPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHeight(keyword, "25");
    vPanel.setCellHeight(scrollFolderPanel, "300");

    cancelButton.setStyleName("okm-NoButton");
    actionButton.setStyleName("okm-YesButton");
    folderTable.setStyleName("okm-NoWrap");
    folderTable.addStyleName("okm-Table-Row");
    keyword.setStyleName("okm-Input");

    super.hide();
    setWidget(vPanel);
  }