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); }
/** 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); }