コード例 #1
0
ファイル: SearchPopup.java プロジェクト: HackLinux/openkm
 /** langRefresh */
 public void langRefresh() {
   setText(GeneralComunicator.i18nExtension("dropbox.search"));
   cancelButton.setHTML(GeneralComunicator.i18n("button.cancel"));
   importButton.setHTML(GeneralComunicator.i18nExtension("button.import"));
   typeList.clear();
   typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.all"), "");
   typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.document"), CATEGORY_DOCUMENT);
   typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.folder"), CATEGORY_FOLDER);
 }
コード例 #2
0
ファイル: SearchPopup.java プロジェクト: HackLinux/openkm
  /** SearchPopup */
  public SearchPopup() {
    super(false, true);

    setText(GeneralComunicator.i18nExtension("dropbox.search"));
    vPanel = new VerticalPanel();
    vPanel.setWidth("100%");

    table = new ColoredFlexTable();
    table.setWidth("100%");
    table.setCellPadding(2);
    table.setCellSpacing(0);
    table.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (selectedRow >= 0) {
              table.setStyleRow(selectedRow, false);
            }
            selectedRow = table.getCellForEvent(event).getRowIndex();
            table.setStyleRow(selectedRow, true);
            importButton.setEnabled(true);
          }
        });
    table.addDoubleClickHandler(
        new DoubleClickHandler() {
          @Override
          public void onDoubleClick(DoubleClickEvent event) {
            if (selectedRow >= 0) {
              if (selectedRow >= 0) {
                table.setStyleRow(selectedRow, false);
              }
              executeImport();
              table.setStyleRow(selectedRow, true);
              hide();
            }
          }
        });

    scrollPanel = new ScrollPanel(table);
    scrollPanel.setPixelSize(690, 250);
    scrollPanel.setStyleName("okm-Popup-text");

    hSearchPanel = new HorizontalPanel();
    name = new TextBox();
    name.addKeyUpHandler(
        new KeyUpHandler() {
          @Override
          public void onKeyUp(KeyUpEvent event) {
            executeSearch();
          }
        });
    name.setWidth("540px");
    name.setStyleName("okm-Input");

    typeList = new ListBox();
    typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.all"), "");
    typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.document"), CATEGORY_DOCUMENT);
    typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.folder"), CATEGORY_FOLDER);
    typeList.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            executeSearch();
          }
        });
    typeList.setStyleName("okm-Input");

    hSearchPanel.add(UtilComunicator.hSpace("5"));
    hSearchPanel.add(name);
    hSearchPanel.add(UtilComunicator.hSpace("5"));
    hSearchPanel.add(typeList);

    // Buttons panel
    cancelButton =
        new Button(
            GeneralComunicator.i18n("button.cancel"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                hide();
              }
            });
    cancelButton.setStyleName("okm-NoButton");
    importButton =
        new Button(
            GeneralComunicator.i18nExtension("button.import"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                executeImport();
                hide();
              }
            });
    importButton.setStyleName("okm-YesButton");

    hButtonPanel = new HorizontalPanel();
    hButtonPanel.add(cancelButton);
    hButtonPanel.add(new HTML(" "));
    hButtonPanel.add(importButton);

    vPanel.add(UtilComunicator.vSpace("5"));
    vPanel.add(hSearchPanel);
    vPanel.add(UtilComunicator.vSpace("5"));
    vPanel.add(scrollPanel);
    vPanel.add(UtilComunicator.vSpace("5"));
    vPanel.add(hButtonPanel);
    vPanel.add(UtilComunicator.vSpace("5"));

    vPanel.setCellHorizontalAlignment(hSearchPanel, HasAlignment.ALIGN_LEFT);
    vPanel.setCellHorizontalAlignment(scrollPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hButtonPanel, HasAlignment.ALIGN_CENTER);

    setWidget(vPanel);
  }