List of usage examples for com.google.gwt.user.client.ui FlexTable FlexTable
public FlexTable()
From source file:com.openkm.frontend.client.widget.properties.Mail.java
License:Open Source License
/** * Mail/*from w ww . j a v a2s. co m*/ */ public Mail() { mail = new GWTMail(); categoryManager = new CategoryManager(CategoryManager.ORIGIN_MAIL); keywordManager = new KeywordManager(ThesaurusSelectPopup.MAIL_PROPERTIES); table = new FlexTable(); tableProperties = new FlexTable(); scrollPanel = new ScrollPanel(table); tableProperties.setHTML(0, 0, "<b>" + Main.i18n("mail.uuid") + "</b>"); tableProperties.setHTML(0, 1, ""); tableProperties.setHTML(1, 0, "<b>" + Main.i18n("mail.name") + "</b>"); tableProperties.setHTML(1, 1, ""); tableProperties.setHTML(2, 0, "<b>" + Main.i18n("mail.folder") + "</b>"); tableProperties.setHTML(3, 1, ""); tableProperties.setHTML(3, 0, "<b>" + Main.i18n("mail.size") + "</b>"); tableProperties.setHTML(4, 1, ""); tableProperties.setHTML(4, 0, "<b>" + Main.i18n("mail.created") + "</b>"); tableProperties.setHTML(5, 1, ""); tableProperties.setHTML(6, 0, "<b>" + Main.i18n("mail.mimetype") + "</b>"); tableProperties.setHTML(6, 1, ""); tableProperties.setHTML(7, 0, "<b>" + Main.i18n("mail.keywords") + "</b>"); tableProperties.setHTML(7, 1, ""); tableProperties.setHTML(8, 0, "<b>" + Main.i18n("mail.url") + "</b>"); tableProperties.setWidget(8, 1, new HTML("")); tableProperties.setHTML(9, 0, "<b>" + Main.i18n("mail.webdav") + "</b>"); tableProperties.setWidget(9, 1, new HTML("")); // Sets wordWrap for al rows for (int i = 0; i < 10; i++) { setRowWordWarp(i, 0, true, tableProperties); } tableProperties.getCellFormatter().setVerticalAlignment(7, 0, HasAlignment.ALIGN_TOP); tableProperties.setStyleName("okm-DisableSelect"); // Sets the tagcloud keywordManager.getKeywordCloud().setWidth("350"); VerticalPanel vPanel = new VerticalPanel(); vPanel.add(keywordManager.getKeywordCloudText()); vPanel.add(keywordManager.getKeywordCloud()); HTML space = new HTML(""); vPanel.add(space); vPanel.setCellHeight(space, "10"); vPanel.add(categoryManager.getPanelCategories()); vPanel.add(categoryManager.getSubscribedCategoriesTable()); table.setWidget(0, 0, tableProperties); table.setHTML(0, 1, ""); table.setWidget(0, 2, vPanel); table.getFlexCellFormatter().setWidth(0, 1, "25"); table.getFlexCellFormatter().setVerticalAlignment(0, 1, HasAlignment.ALIGN_TOP); table.getFlexCellFormatter().setVerticalAlignment(0, 2, HasAlignment.ALIGN_TOP); initWidget(scrollPanel); }
From source file:com.openkm.frontend.client.widget.properties.MailViewer.java
License:Open Source License
/** * MailViewer//from w ww . ja va 2s .c o m */ public MailViewer() { table = new FlexTable(); dataTable = new FlexTable(); attachmentsTable = new ExtendedFlexTable(); contentPanel = new HorizontalPanel(); menuPopup = new MenuPopup(); attachmentsList = new HashMap<Integer, GWTDocument>(); table.setCellPadding(0); table.setCellSpacing(0); dataTable.setCellPadding(3); dataTable.setCellSpacing(2); dataTable.setHTML(0, 0, "<b>" + Main.i18n("mail.from") + "</b>"); dataTable.setHTML(0, 1, ""); dataTable.setHTML(0, 2, ""); dataTable.setHTML(1, 0, "<b>" + Main.i18n("mail.reply") + "</b>"); dataTable.setHTML(1, 1, ""); dataTable.setHTML(2, 0, "<b>" + Main.i18n("mail.to") + "</b>"); dataTable.setHTML(3, 1, ""); dataTable.setHTML(3, 0, "<b>" + Main.i18n("mail.subject") + "</b>"); dataTable.getCellFormatter().setWidth(0, 2, "100%"); dataTable.getCellFormatter().setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP); dataTable.getCellFormatter().setVerticalAlignment(1, 0, HasAlignment.ALIGN_TOP); dataTable.getCellFormatter().setVerticalAlignment(2, 0, HasAlignment.ALIGN_TOP); dataTable.getCellFormatter().setVerticalAlignment(3, 0, HasAlignment.ALIGN_TOP); dataTable.getCellFormatter().setVerticalAlignment(1, 1, HasAlignment.ALIGN_TOP); dataTable.getCellFormatter().setVerticalAlignment(2, 1, HasAlignment.ALIGN_TOP); // Sets wordWrap for al rows for (int i = 0; i < 4; i++) { setRowWordWarp(i, 2, false, dataTable); } mailPreview = new MailPreview(); contentPanel.add(mailPreview); contentPanel.setWidth("100%"); attachmentText = new HTML("<b>" + Main.i18n("mail.attachment") + "</b> "); attachmentsTable.setCellPadding(3); attachmentsTable.setCellSpacing(2); VerticalPanel vRightPanel = new VerticalPanel(); vRightPanel.add(attachmentText); vRightPanel.add(attachmentsTable); table.setWidget(0, 0, dataTable); table.setWidget(0, 1, vRightPanel); table.setWidget(1, 0, contentPanel); table.getCellFormatter().setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP); table.getCellFormatter().setVerticalAlignment(0, 1, HasAlignment.ALIGN_TOP); table.getCellFormatter().setHorizontalAlignment(0, 1, HasAlignment.ALIGN_RIGHT); table.getFlexCellFormatter().setHeight(1, 0, "10px"); table.getFlexCellFormatter().setColSpan(1, 0, 2); table.getRowFormatter().setStyleName(1, "okm-Mail-White"); table.setWidth("100%"); dataTable.setStyleName("okm-DisableSelect"); table.setStyleName("okm-Mail"); menuPopup.setStyleName("okm-Mail-MenuPopup"); attachmentsTable.setStyleName("okm-NoWrap"); initWidget(table); }
From source file:com.openkm.frontend.client.widget.searchin.ControlSearchIn.java
License:Open Source License
public ControlSearchIn() { controlPanel = new VerticalPanel(); table = new FlexTable(); textResults = new HTML(Main.i18n("search.results")); previous = new Image(OKMBundleResources.INSTANCE.previous()); next = new Image(OKMBundleResources.INSTANCE.next()); export = new Image(OKMBundleResources.INSTANCE.exportCSV()); export.setTitle(Main.i18n("search.export.to.csv")); export.addClickHandler(new ClickHandler() { @Override/* w w w.j a v a 2s.com*/ public void onClick(ClickEvent event) { boolean compact = false; String params = "action=" + ((gwtParams != null) ? "find" : "findSimpleQuery"); params += "&lang=" + Main.get().getLang(); if (Main.get().mainPanel.search.searchBrowser.searchIn.searchControl.advancedView.getValue() && Main.get().mainPanel.search.searchBrowser.searchIn.searchControl.compactResultsView .getValue()) { compact = true; } if (gwtParams != null) { params += "&json=" + JSONUtil.toJson(gwtParams).toString(); params += "&compact=" + String.valueOf(compact); } else { JSONObject json = new JSONObject(); json.put("statement", new JSONString(statement)); params += "&json=" + json.toString(); params += "&compact=" + String.valueOf(compact); } Util.downloadCSVFile(params); } }); export.setStyleName("okm-Hyperlink"); previous.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (previousEnabled) { offset -= limit; if (gwtParams != null) { Main.get().mainPanel.search.searchBrowser.searchResult.findPaginated(gwtParams, offset, limit); } else { Main.get().mainPanel.search.searchBrowser.searchResult.findSimpleQueryPaginated(statement, offset, limit); } } } }); previous.setStyleName("okm-Hyperlink"); next.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (nextEnabled) { offset += limit; if (gwtParams != null) { Main.get().mainPanel.search.searchBrowser.searchResult.findPaginated(gwtParams, offset, limit); } else { Main.get().mainPanel.search.searchBrowser.searchResult.findSimpleQueryPaginated(statement, offset, limit); } } } }); next.setStyleName("okm-Hyperlink"); table.setWidget(0, 0, textResults); table.setHTML(0, 1, " "); table.setWidget(0, 2, previous); table.setHTML(0, 3, ""); table.setWidget(0, 4, next); table.setWidget(0, 5, export); controlPanel.add(table); controlPanel.setVisible(false); // Initially not shows only when search has been executed controlPanel.setStyleName("okm-DisableSelect"); initWidget(controlPanel); }
From source file:com.openkm.frontend.client.widget.searchin.GroupPopup.java
License:Open Source License
/** * About popup//from w w w . j a v a 2 s .c o m */ public GroupPopup() { // Establishes auto-close when click outside super(false, true); vPanel = new VerticalPanel(); hPanel = new HorizontalPanel(); groupLabel = new Label(Main.i18n("group.group")); propertyLabel = new Label(Main.i18n("group.property.group")); table = new FlexTable(); closeButton = new Button(Main.i18n("button.close"), new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); addButton = new Button(Main.i18n("button.add"), new ClickHandler() { @Override public void onClick(ClickEvent event) { if (propertyListBox.getSelectedIndex() > 0) { String grpName = groupListBox.getValue(groupListBox.getSelectedIndex()); String grpLabel = groupListBox.getItemText(groupListBox.getSelectedIndex()); String propertyName = propertyListBox.getValue(propertyListBox.getSelectedIndex()); for (Iterator<GWTFormElement> it = formElementList.iterator(); it.hasNext();) { GWTFormElement formElement = it.next(); if (formElement.getName().endsWith(propertyName)) { GWTPropertyParams param = new GWTPropertyParams(); param.setGrpName(grpName); param.setGrpLabel(grpLabel); param.setFormElement(formElement); switch (origin) { case UIDockPanelConstants.SEARCH: Main.get().mainPanel.search.searchBrowser.searchIn.searchMetadata .addProperty(param); break; case UIDockPanelConstants.DESKTOP: Main.get().updatePropertyGroupPopup.addProperty(param); break; } } } } enableAddGroupButton(); // Enables or disables add group button ( if exist some property still to be added ) hide(); } }); groupListBox = new ListBox(); groupListBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { if (groupListBox.getSelectedIndex() > 0) { propertyListBox.clear(); getMetaData(); } else { propertyListBox.clear(); propertyListBox.setVisible(false); propertyLabel.setVisible(false); addButton.setEnabled(false); } } }); groupListBox.setStyleName("okm-Select"); propertyListBox = new ListBox(); propertyListBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { if (propertyListBox.getSelectedIndex() > 0) { addButton.setEnabled(true); } else { addButton.setEnabled(false); } } }); propertyListBox.setStyleName("okm-Select"); propertyListBox.setVisible(false); propertyLabel.setVisible(false); vPanel.setWidth("300px"); vPanel.setHeight("100px"); closeButton.setStyleName("okm-NoButton"); addButton.setStyleName("okm-AddButton"); addButton.setEnabled(false); hPanel.add(closeButton); hPanel.add(new HTML(" ")); hPanel.add(addButton); hPanel.setCellHorizontalAlignment(closeButton, VerticalPanel.ALIGN_CENTER); hPanel.setCellHorizontalAlignment(addButton, VerticalPanel.ALIGN_CENTER); table.setWidget(0, 0, groupLabel); table.setWidget(0, 1, groupListBox); table.setWidget(1, 0, propertyLabel); table.setWidget(1, 1, propertyListBox); vPanel.add(new HTML("<br>")); vPanel.add(table); vPanel.add(new HTML("<br>")); vPanel.add(hPanel); vPanel.add(new HTML("<br>")); vPanel.setCellHorizontalAlignment(table, VerticalPanel.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(hPanel, VerticalPanel.ALIGN_CENTER); super.hide(); setWidget(vPanel); }
From source file:com.openkm.frontend.client.widget.searchin.SearchAdvanced.java
License:Open Source License
/** * SearchAdvanced// ww w. j a v a2 s . c o m */ public SearchAdvanced() { table = new FlexTable(); scrollPanel = new ScrollPanel(table); // Sets the folder explorer folderSelectPopup = new FolderSelectPopup(); pathExplorerPanel = new HorizontalPanel(); path = new TextBox(); path.setReadOnly(true); pathExplorer = new Image(OKMBundleResources.INSTANCE.folderExplorer()); pathExplorerPanel.add(path); pathExplorerPanel.add(new HTML(" ")); pathExplorerPanel.add(pathExplorer); pathExplorer.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { folderSelectPopup.show(false); } }); pathExplorerPanel.setCellVerticalAlignment(pathExplorer, HasAlignment.ALIGN_MIDDLE); // Sets the category explorer categoryExplorerPanel = new HorizontalPanel(); categoryPath = new TextBox(); categoryUuid = ""; categoryPath.setReadOnly(true); categoryExplorer = new Image(OKMBundleResources.INSTANCE.folderExplorer()); categoryExplorerPanel.add(categoryPath); categoryExplorerPanel.add(new HTML(" ")); categoryExplorerPanel.add(categoryExplorer); categoryExplorer.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { folderSelectPopup.show(true); } }); categoryExplorerPanel.setCellVerticalAlignment(categoryExplorer, HasAlignment.ALIGN_MIDDLE); // Sets type document tableMail = new FlexTable(); typePanel = new HorizontalPanel(); typeDocument = new CheckBox(Main.i18n("search.type.document")); typeDocument.setValue(true); typeFolder = new CheckBox(Main.i18n("search.type.folder")); typeFolder.setValue(false); typeMail = new CheckBox(Main.i18n("search.type.mail")); typeMail.setValue(false); typeMail.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (typeMail.getValue()) { mailText.setVisible(true); tableMail.setVisible(true); } else { mailText.setVisible(false); tableMail.setVisible(false); } } }); typePanel.add(typeDocument); typePanel.add(new HTML(" ")); typePanel.add(typeFolder); typePanel.add(new HTML(" ")); typePanel.add(typeMail); typePanel.add(new HTML(" ")); // Sets mime types values mimeTypes = new ListBox(); mimeTypes.addItem(" ", ""); mimeTypes.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { Main.get().mainPanel.search.searchBrowser.searchIn.searchControl.evaluateSearchButtonVisible(); } }); mailText = new HTML(Main.i18n("search.type.mail")); mailText.setVisible(false); table.setHTML(1, 0, Main.i18n("search.folder")); table.setWidget(1, 1, pathExplorerPanel); table.setHTML(2, 0, Main.i18n("search.category")); table.setWidget(2, 1, categoryExplorerPanel); table.setHTML(3, 0, Main.i18n("search.type")); table.setWidget(3, 1, typePanel); table.setHTML(4, 0, Main.i18n("search.mimetype")); table.setWidget(4, 1, mimeTypes); table.setWidget(5, 0, mailText); table.setWidget(5, 1, tableMail); table.getCellFormatter().setVerticalAlignment(5, 0, HasAlignment.ALIGN_TOP); // Adding mail search params from = new TextBox(); to = new TextBox(); subject = new TextBox(); tableMail.setHTML(0, 0, Main.i18n("mail.from")); tableMail.setWidget(0, 1, from); tableMail.setHTML(1, 0, Main.i18n("mail.to")); tableMail.setWidget(1, 1, to); tableMail.setHTML(2, 0, Main.i18n("mail.subject")); tableMail.setWidget(2, 1, subject); setRowWordWarp(tableMail, 0, 2, false); setRowWordWarp(tableMail, 1, 2, false); setRowWordWarp(tableMail, 2, 2, false); setRowWordWarp(tableMail, 3, 2, false); tableMail.setVisible(false); path.setStyleName("okm-Input"); categoryPath.setStyleName("okm-Input"); folderSelectPopup.setStyleName("okm-Popup"); folderSelectPopup.addStyleName("okm-DisableSelect"); from.setStyleName("okm-Input"); to.setStyleName("okm-Input"); subject.setStyleName("okm-Input"); mimeTypes.setStyleName("okm-Select"); initWidget(scrollPanel); }
From source file:com.openkm.frontend.client.widget.searchin.SearchControl.java
License:Open Source License
/** * SearchControl// w w w .ja v a2 s .c o m */ public SearchControl() { table = new FlexTable(); table.setCellPadding(2); table.setCellSpacing(2); scrollPanel = new ScrollPanel(table); advancedView = new CheckBox(Main.i18n("search.view.advanced")); advancedView.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (advancedView.getValue()) { clean(); switchSearchMode(SEARCH_MODE_ADVANCED); } else { clean(); switchSearchMode(SEARCH_MODE_SIMPLE); } } }); compactResultsView = new CheckBox(Main.i18n("search.view.compact.results")); compactResultsView.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (compactResultsView.getValue()) { switchResultsViewMode(RESULTS_VIEW_COMPACT); table.getCellFormatter().setVisible(2, 0, false); // hide view property groups } else { switchResultsViewMode(RESULTS_VIEW_NORMAL); table.getCellFormatter().setVisible(2, 0, true); // show view property groups } } }); showPropertyGroups = new CheckBox(Main.i18n("search.view.propety.groups")); showPropertyGroups.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (searchButton.isEnabled()) { executeSearch(); } } }); saveUserNews = new CheckBox(Main.i18n("search.save.as.news")); searchSavedName = new TextBox(); searchSavedName.setWidth("200"); controlSearch = new ControlSearchIn(); resultPage = new ListBox(); resultPage.addItem("10", "10"); resultPage.addItem("20", "20"); resultPage.addItem("30", "30"); resultPage.addItem("50", "50"); resultPage.addItem("100", "100"); keyUpHandler = new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { evaluateSearchButtonVisible(); if (KeyCodes.KEY_ENTER == event.getNativeKeyCode() && searchButton.isEnabled()) { executeSearch(); } } }; searchButton = new Button(Main.i18n("button.search"), new ClickHandler() { @Override public void onClick(ClickEvent event) { executeSearch(); } }); cleanButton = new Button(Main.i18n("button.clean"), new ClickHandler() { @Override public void onClick(ClickEvent event) { clean(); } }); saveSearchButton = new Button(Main.i18n("button.save.search"), new ClickHandler() { @Override public void onClick(ClickEvent event) { long domain = 0; SearchNormal searchNormal = Main.get().mainPanel.search.searchBrowser.searchIn.searchNormal; SearchAdvanced searchAdvanced = Main.get().mainPanel.search.searchBrowser.searchIn.searchAdvanced; String operator = GWTQueryParams.OPERATOR_AND; params = new GWTQueryParams(); if (!searchAdvanced.path.getText().equals("")) { params.setPath(searchAdvanced.path.getText()); } else { params.setPath(searchNormal.context.getValue(searchNormal.context.getSelectedIndex())); } if (!searchAdvanced.categoryUuid.equals("")) { params.setCategoryUuid(searchAdvanced.categoryUuid); params.setCategoryPath(searchAdvanced.categoryPath.getText().substring(16)); // removes /okm:category } params.setContent(searchNormal.content.getText()); params.setName(searchNormal.name.getText()); params.setKeywords(searchNormal.keywords.getText()); params.setProperties(Main.get().mainPanel.search.searchBrowser.searchIn.getProperties()); params.setAuthor(searchNormal.userListBox.getValue(searchNormal.userListBox.getSelectedIndex())); params.setLastModifiedFrom(searchNormal.modifyDateFrom); params.setLastModifiedTo(searchNormal.modifyDateTo); params.setDashboard(saveUserNews.getValue()); params.setMailFrom(searchAdvanced.from.getText()); params.setMailTo(searchAdvanced.to.getText()); params.setMailSubject(searchAdvanced.subject.getText()); if (searchAdvanced.typeDocument.getValue()) { domain += GWTQueryParams.DOCUMENT; } if (searchAdvanced.typeFolder.getValue()) { domain += GWTQueryParams.FOLDER; } if (searchAdvanced.typeMail.getValue()) { domain += GWTQueryParams.MAIL; } params.setDomain(domain); if (searchTypeAnd.getValue()) { operator = GWTQueryParams.OPERATOR_AND; } else { operator = GWTQueryParams.OPERATOR_OR; } params.setOperator(operator); // Removes dates if dashboard is checked if (saveUserNews.getValue()) { params.setLastModifiedFrom(null); params.setLastModifiedTo(null); } params.setMimeType(searchAdvanced.mimeTypes.getValue(searchAdvanced.mimeTypes.getSelectedIndex())); if (!searchSavedName.getText().equals("")) { saveSearchButton.setEnabled(false); params.setQueryName(searchSavedName.getText()); isUserNews = params.isDashboard(); saveSearch(params, "sql"); } } }); searchSavedName.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { evalueSaveSearchButtonVisible(); } }); searchButton.setEnabled(false); saveSearchButton.setEnabled(false); // Type of search searchTypePanel = new HorizontalPanel(); searchTypePanel.setVisible(true); // On OpenKM 4.0 has hidden AND / OR option list searchTypeAnd = new CheckBox("AND"); searchTypeOr = new CheckBox("OR"); searchTypeAnd.setValue(true); searchTypeOr.setValue(false); searchTypeAnd.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { searchTypeOr.setValue(!searchTypeAnd.getValue()); // Always set changed between and and or type } }); searchTypeOr.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { searchTypeAnd.setValue(!searchTypeOr.getValue()); // Always set changed between and and or type } }); HTML space1 = new HTML(""); searchTypePanel.add(searchTypeAnd); searchTypePanel.add(space1); searchTypePanel.add(searchTypeOr); searchTypePanel.setCellWidth(space1, "10"); table.setWidget(0, 0, advancedView); table.setWidget(1, 0, compactResultsView); table.setWidget(2, 0, showPropertyGroups); table.setWidget(3, 0, saveUserNews); table.setWidget(4, 0, saveSearchButton); table.setWidget(4, 1, searchSavedName); resultsPageText = new HTML(Main.i18n("search.page.results")); table.setWidget(5, 0, resultsPageText); table.setWidget(5, 1, resultPage); searchTypeText = new HTML(Main.i18n("search.type")); table.setHTML(6, 0, Main.i18n("search.type")); table.setWidget(6, 1, searchTypePanel); table.setWidget(6, 0, cleanButton); table.setWidget(6, 1, searchButton); table.setWidget(7, 0, controlSearch); table.getCellFormatter().setHorizontalAlignment(4, 0, HasAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(5, 0, HasAlignment.ALIGN_RIGHT); table.getCellFormatter().setHorizontalAlignment(6, 0, HasAlignment.ALIGN_RIGHT); table.getFlexCellFormatter().setColSpan(0, 0, 2); table.getFlexCellFormatter().setColSpan(1, 0, 2); table.getFlexCellFormatter().setColSpan(2, 0, 2); table.getFlexCellFormatter().setColSpan(3, 0, 2); table.getFlexCellFormatter().setColSpan(7, 0, 2); // By default is enabled search mode simple table.getCellFormatter().setVisible(3, 0, false); table.getCellFormatter().setVisible(4, 0, false); table.getCellFormatter().setVisible(4, 1, false); searchButton.setStyleName("okm-SearchButton"); saveSearchButton.setStyleName("okm-SaveButton"); saveSearchButton.addStyleName("okm-NoWrap"); cleanButton.setStyleName("okm-CleanButton"); searchSavedName.setStyleName("okm-Input"); resultPage.setStyleName("okm-Input"); initWidget(scrollPanel); }
From source file:com.openkm.frontend.client.widget.searchin.SearchMetadata.java
License:Open Source License
/** * SearchMetadata/*w w w. j a va 2s. c o m*/ */ public SearchMetadata(HasPropertyHandler propertyHandler) { formManager = new FormManager(propertyHandler); table = new FlexTable(); scrollPanel = new ScrollPanel(table); // Table padding and spacing properties formManager.getTable().setCellPadding(2); formManager.getTable().setCellSpacing(2); groupPopup = new GroupPopup(); groupPopup.setWidth("300px"); groupPopup.setHeight("125px"); groupPopup.setStyleName("okm-Popup"); groupPopup.addStyleName("okm-DisableSelect"); addGroup = new Button(Main.i18n("search.add.property.group"), new ClickHandler() { @Override public void onClick(ClickEvent event) { groupPopup.show(UIDockPanelConstants.SEARCH); } }); table.setWidget(0, 0, addGroup); table.setWidget(1, 0, formManager.getTable()); addGroup.setStyleName("okm-AddButton"); addGroup.addStyleName("okm-NoWrap"); initWidget(scrollPanel); }
From source file:com.openkm.frontend.client.widget.searchresult.SearchFullResult.java
License:Open Source License
/** * drawCategoriesKeywords/* w w w .j av a 2 s.co m*/ */ private int addCategoriesKeywords(Set<GWTFolder> categories, Set<String> keywords, FlexTable table) { int rows = table.getRowCount(); // Categories and tagcloud if (categories.size() > 0 || keywords.size() > 0) { HorizontalPanel hPanel = new HorizontalPanel(); hPanel.setStyleName("okm-NoWrap"); if (categories.size() > 0) { FlexTable tableSubscribedCategories = new FlexTable(); tableSubscribedCategories.setStyleName("okm-DisableSelect"); // Sets the document categories for (Iterator<GWTFolder> it = categories.iterator(); it.hasNext();) { drawCategory(tableSubscribedCategories, it.next()); } hPanel.add(new HTML("<b>" + Main.i18n("document.categories") + "</b>")); hPanel.add(Util.hSpace("5")); hPanel.add(tableSubscribedCategories); hPanel.add(Util.hSpace("33")); } if (keywords.size() > 0) { // Tag cloud TagCloud keywordsCloud = new TagCloud(); keywordsCloud.setWidth("350"); WidgetUtil.drawTagCloud(keywordsCloud, keywords); hPanel.add(new HTML("<b>" + Main.i18n("document.keywords.cloud") + "</b>")); hPanel.add(Util.hSpace("5")); hPanel.add(keywordsCloud); } table.setWidget(rows++, 0, hPanel); } return rows; }
From source file:com.openkm.frontend.client.widget.TemplatePopup.java
License:Open Source License
public TemplatePopup() { // Establishes auto-close when click outside super(false, true); setText(Main.i18n("template.new.document.title")); // Name/*from w w w. j a va 2s . c om*/ hNamePanel = new HorizontalPanel(); nameText = new HTML(Main.i18n("template.new.document.name")); name = new TextBox(); name.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (name.getText().length() > 0) { if (KeyCodes.KEY_ENTER == event.getNativeKeyCode()) { create.setEnabled(false); create(); } else { create.setEnabled(true); } } else { create.setEnabled(false); } } }); name.setWidth("250"); name.setStyleName("okm-Input"); hNamePanel.add(Util.hSpace("5")); hNamePanel.add(nameText); hNamePanel.add(Util.hSpace("5")); hNamePanel.add(name); hNamePanel.setCellVerticalAlignment(nameText, HasAlignment.ALIGN_MIDDLE); hNamePanel.setCellVerticalAlignment(name, HasAlignment.ALIGN_MIDDLE); // Buttons cancel = new Button(Main.i18n("button.cancel")); cancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); cancel.setStyleName("okm-NoButton"); create = new Button(Main.i18n("button.create")); create.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { create.setEnabled(false); create(); } }); create.setStyleName("okm-AddButton"); hButtonPanel = new HorizontalPanel(); hButtonPanel.add(cancel); hButtonPanel.add(Util.hSpace("5")); hButtonPanel.add(create); // copy attributes HorizontalPanel hAttributesPanel = new HorizontalPanel(); hAttributesPanel.setWidth("100%"); copyCategories = new CheckBox(); copyKeywords = new CheckBox(); copyNotes = new CheckBox(); copyPropertyGroup = new CheckBox(); table = new FlexTable(); table.setWidth("100%"); table.setStyleName("okm-NoWrap"); // row 1 table.setHTML(0, 0, Main.i18n("template.categories")); table.setWidget(0, 1, copyCategories); table.setHTML(0, 2, " "); table.setHTML(0, 3, Main.i18n("template.notes")); table.setWidget(0, 4, copyNotes); table.setHTML(0, 5, " "); table.getFlexCellFormatter().setWidth(0, 5, "100%"); // row 2 table.setHTML(1, 0, Main.i18n("template.keywords")); table.setWidget(1, 1, copyKeywords); table.setHTML(1, 2, " "); table.setHTML(1, 3, Main.i18n("template.wiki")); // row 3 table.setHTML(2, 0, Main.i18n("template.propertygroup")); table.setWidget(2, 1, copyPropertyGroup); table.setHTML(2, 2, " "); // row 4 HorizontalPanel selectPanel = new HorizontalPanel(); selectAll = new Anchor(Main.i18n("button.all")); selectAll.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { copyCategories.setValue(true); copyKeywords.setValue(true); copyNotes.setValue(true); copyPropertyGroup.setValue(true); } }); selectAll.addStyleName("okm-Hyperlink"); selectNone = new Anchor(Main.i18n("button.none")); selectNone.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { copyCategories.setValue(false); copyKeywords.setValue(false); copyNotes.setValue(false); copyPropertyGroup.setValue(false); } }); selectNone.addStyleName("okm-Hyperlink"); selectPanel.add(selectAll); selectPanel.add(Util.hSpace("5")); selectPanel.add(selectNone); selectPanel.add(Util.hSpace("5")); table.setWidget(3, 0, selectPanel); table.getFlexCellFormatter().setColSpan(3, 0, 6); table.getFlexCellFormatter().setHorizontalAlignment(3, 0, HasAlignment.ALIGN_RIGHT); groupBoxPanel = new GroupBoxPanel(); groupBoxPanel.setCaption(Main.i18n("template.copy")); groupBoxPanel.add(table); hAttributesPanel.add(Util.hSpace("5")); hAttributesPanel.add(groupBoxPanel); hAttributesPanel.add(Util.hSpace("5")); vPanel = new VerticalPanel(); vPanel.setWidth("100%"); vPanel.add(Util.vSpace("5")); vPanel.add(hNamePanel); vPanel.add(Util.vSpace("5")); vPanel.add(hAttributesPanel); vPanel.add(Util.vSpace("5")); vPanel.add(hButtonPanel); vPanel.add(Util.vSpace("5")); vPanel.setCellHorizontalAlignment(hNamePanel, HasAlignment.ALIGN_LEFT); vPanel.setCellHorizontalAlignment(groupBoxPanel, HasAlignment.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(hButtonPanel, HasAlignment.ALIGN_CENTER); setWidget(vPanel); }
From source file:com.openkm.frontend.client.widget.UserPopup.java
License:Open Source License
/** * User popup//from w w w . j a v a 2 s . c o m */ public UserPopup() { // Establishes auto-close when click outside super(false, true); vPanel = new VerticalPanel(); userFlexTable = new FlexTable(); mailFlexTable = new FlexTable(); userGroupBoxPanel = new GroupBoxPanel(); userGroupBoxPanel.setCaption(Main.i18n("user.preferences.user.data")); userGroupBoxPanel.add(userFlexTable); mailGroupBoxPanel = new GroupBoxPanel(); mailGroupBoxPanel.setCaption(Main.i18n("user.preferences.mail.data")); mailGroupBoxPanel.add(mailFlexTable); userId = new HTML(Main.i18n("user.preferences.user")); userName = new HTML(Main.i18n("user.preferences.name")); userPassword = new HTML(Main.i18n("user.preferences.password")); userMail = new HTML(Main.i18n("user.preferences.mail")); userRoles = new HTML(Main.i18n("user.preferences.roles")); mailProtocol = new HTML(Main.i18n("user.preferences.mail.protocol")); mailHost = new HTML(Main.i18n("user.preferences.mail.host")); mailUser = new HTML(Main.i18n("user.preferences.mail.user")); mailPassword = new HTML(Main.i18n("user.preferences.mail.user.password")); mailFolder = new HTML(Main.i18n("user.preferences.mail.folder")); userPasswordText = new PasswordTextBox(); userPasswordTextVerify = new PasswordTextBox(); userNameText = new HTML(""); userMailText = new TextBox(); rolesPanel = new HTML(); mailUserPasswordText = new PasswordTextBox(); passwordError = new HTML(Main.i18n("user.preferences.password.error")); passwordValidationError = new HTML(""); mailPasswordError = new HTML(Main.i18n("user.preferences.mail.password.error.void")); mailError = new HTML(Main.i18n("user.preferences.mail.error")); mailTestError = new HTML(Main.i18n("user.preferences.mail.test.error")); mailTestOK = new HTML(Main.i18n("user.preferences.mail.test.ok")); passwordError.setVisible(false); passwordValidationError.setVisible(false); mailPasswordError.setVisible(false); mailError.setVisible(false); mailTestError.setVisible(false); mailTestOK.setVisible(false); mailHostText = new TextBox(); mailUserText = new TextBox(); mailFolderText = new TextBox(); mailProtocolList = new ListBox(); mailProtocolList.addItem("POP3", "pop3"); mailProtocolList.addItem("POP3S", "pop3s"); mailProtocolList.addItem("IMAP", "imap"); mailProtocolList.addItem("IMAPS", "imaps"); acceptButton = new Button(Main.i18n("button.accept"), new ClickHandler() { @Override public void onClick(ClickEvent event) { passwordError.setVisible(false); passwordValidationError.setVisible(false); mailPasswordError.setVisible(false); mailError.setVisible(false); mailTestError.setVisible(false); mailTestOK.setVisible(false); // Password always must be equals if (!userPasswordText.getText().equals(userPasswordTextVerify.getText())) { passwordError.setVisible(true); // Case creation } else if (Main.get().workspaceUserProperties.getWorkspace().getMailID() < 0 && mailUserPasswordText.getText().equals("") && (mailFolderText.getText().length() > 0 || mailUserText.getText().length() > 0 || mailHostText.getText().length() > 0)) { mailPasswordError.setVisible(true); // Case update } else if ((mailUserPasswordText.getText().length() > 0 || mailFolderText.getText().length() > 0 || mailUserText.getText().length() > 0 || mailHostText.getText().length() > 0) && !(mailFolderText.getText().length() > 0 && mailUserText.getText().length() > 0 && mailHostText.getText().length() > 0)) { mailError.setVisible(true); } else { final GWTWorkspace workspace = new GWTWorkspace(); String proto = mailProtocolList.getValue(mailProtocolList.getSelectedIndex()); workspace.setUser(Main.get().workspaceUserProperties.getUser()); workspace.setEmail(userMailText.getText()); workspace.setMailFolder(mailFolderText.getText()); workspace.setMailProtocol(proto); workspace.setMailHost(mailHostText.getText()); workspace.setMailUser(mailUserText.getText()); workspace.setMailPassword(mailUserPasswordText.getText()); workspace.setPassword(userPasswordText.getText()); workspace.setMailID(Main.get().workspaceUserProperties.getWorkspace().getMailID()); // First must validate password workspaceService.isValidPassword(userPasswordText.getText(), new AsyncCallback<String>() { @Override public void onSuccess(String result) { if (result.equals("")) { workspaceService.updateUserWorkspace(workspace, callbackUpdateUserWorkspace); } else { passwordValidationError.setHTML(result); passwordValidationError.setVisible(true); } } @Override public void onFailure(Throwable caught) { Main.get().showError("callbackIsValidPassword", caught); } }); } } }); cancelButton = new Button(Main.i18n("button.cancel"), new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); testButton = new Button(Main.i18n("button.test"), new ClickHandler() { @Override public void onClick(ClickEvent event) { mailTestError.setVisible(false); mailTestOK.setVisible(false); testButton.setEnabled(false); String proto = mailProtocolList.getValue(mailProtocolList.getSelectedIndex()); generalService.testMailConnection(proto, mailHostText.getText(), mailUserText.getText(), mailUserPasswordText.getText(), mailFolderText.getText(), new AsyncCallback<GWTTestMail>() { @Override public void onSuccess(GWTTestMail result) { if (!result.isError()) { mailTestError.setVisible(false); mailTestOK.setVisible(true); } else { mailTestError.setHTML(Main.i18n("user.preferences.mail.test.error") + "<br>" + result.getErrorMsg()); mailTestError.setVisible(true); mailTestOK.setVisible(false); } testButton.setEnabled(true); } @Override public void onFailure(Throwable caught) { mailTestError.setVisible(false); mailTestOK.setVisible(false); testButton.setEnabled(true); Main.get().showError("testMailConnection", caught); } }); } }); deleteButton = new Button(Main.i18n("button.delete"), new ClickHandler() { @Override public void onClick(ClickEvent event) { long Id = Main.get().workspaceUserProperties.getWorkspace().getMailID(); if (Id >= 0) { workspaceService.deleteMailAccount(Id, callbackDeleteMailAccount); } } }); hPanel = new HorizontalPanel(); hPanel.add(cancelButton); hPanel.add(new HTML(" ")); hPanel.add(acceptButton); userFlexTable.setCellPadding(0); userFlexTable.setCellSpacing(2); userFlexTable.setWidth("455"); userFlexTable.setWidget(0, 0, userId); userFlexTable.setWidget(1, 0, userName); userFlexTable.setWidget(2, 0, userPassword); userFlexTable.setWidget(3, 0, userMail); userFlexTable.setWidget(4, 0, userRoles); userFlexTable.setWidget(1, 1, userNameText); userFlexTable.setWidget(2, 1, userPasswordText); userFlexTable.setWidget(2, 2, userPasswordTextVerify); userFlexTable.setWidget(3, 1, userMailText); userFlexTable.setWidget(4, 1, rolesPanel); userFlexTable.getFlexCellFormatter().setVerticalAlignment(4, 0, HasAlignment.ALIGN_TOP); userFlexTable.getFlexCellFormatter().setColSpan(3, 1, 2); userFlexTable.getFlexCellFormatter().setColSpan(4, 1, 2); mailFlexTable.setCellPadding(0); mailFlexTable.setCellSpacing(2); mailFlexTable.setWidth("455"); mailFlexTable.setWidget(1, 0, mailProtocol); mailFlexTable.setWidget(2, 0, mailHost); mailFlexTable.setWidget(3, 0, mailUser); mailFlexTable.setWidget(4, 0, mailPassword); mailFlexTable.setWidget(5, 0, mailFolder); mailFlexTable.setWidget(1, 1, mailProtocolList); mailFlexTable.setWidget(2, 1, mailHostText); mailFlexTable.setWidget(3, 1, mailUserText); mailFlexTable.setWidget(4, 1, mailUserPasswordText); mailFlexTable.setWidget(5, 1, mailFolderText); HorizontalPanel hMailButtonPanel = new HorizontalPanel(); hMailButtonPanel.add(deleteButton); hMailButtonPanel.add(new HTML(" ")); hMailButtonPanel.add(testButton); mailFlexTable.setWidget(6, 0, hMailButtonPanel); mailFlexTable.getFlexCellFormatter().setColSpan(1, 1, 2); mailFlexTable.getFlexCellFormatter().setColSpan(6, 0, 3); mailFlexTable.getFlexCellFormatter().setAlignment(6, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); userMailText.setWidth("200"); mailHostText.setWidth("200"); mailUserText.setWidth("150"); mailUserPasswordText.setWidth("150"); mailFolderText.setWidth("150"); rolesPanel.setWidth("350"); userGroupBoxPanel.setWidth("460"); mailGroupBoxPanel.setWidth("460"); vPanel.setWidth("470"); vPanel.setHeight("195"); vPanel.add(new HTML("<br>")); vPanel.add(userGroupBoxPanel); vPanel.add(new HTML("<br>")); vPanel.add(mailGroupBoxPanel); vPanel.add(passwordError); vPanel.add(passwordValidationError); vPanel.add(mailPasswordError); vPanel.add(mailError); vPanel.add(mailTestError); vPanel.add(mailTestOK); vPanel.add(new HTML("<br>")); vPanel.add(hPanel); vPanel.add(new HTML("<br>")); vPanel.setCellHorizontalAlignment(userGroupBoxPanel, HasAlignment.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(mailGroupBoxPanel, HasAlignment.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(passwordError, HasAlignment.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(passwordValidationError, HasAlignment.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(mailPasswordError, HasAlignment.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(mailError, HasAlignment.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(mailTestError, HasAlignment.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(mailTestOK, HasAlignment.ALIGN_CENTER); userId.addStyleName("okm-NoWrap"); userName.addStyleName("okm-NoWrap"); userPassword.addStyleName("okm-NoWrap"); userMail.addStyleName("okm-NoWrap"); mailHost.addStyleName("okm-NoWrap"); mailUser.addStyleName("okm-NoWrap"); mailPassword.addStyleName("okm-NoWrap"); mailFolder.addStyleName("okm-NoWrap"); userPasswordText.setStyleName("okm-Input"); userPasswordTextVerify.setStyleName("okm-Input"); userMailText.setStyleName("okm-Input"); mailProtocolList.setStyleName("okm-Input"); mailHostText.setStyleName("okm-Input"); mailUserText.setStyleName("okm-Input"); mailUserPasswordText.setStyleName("okm-Input"); mailFolderText.setStyleName("okm-Input"); passwordError.setStyleName("okm-Input-Error"); passwordValidationError.setStyleName("okm-Input-Error"); mailPasswordError.setStyleName("okm-Input-Error"); mailError.setStyleName("okm-Input-Error"); mailTestError.setStyleName("okm-Input-Error"); mailTestOK.setStyleName("okm-Input-Ok"); acceptButton.setStyleName("okm-YesButton"); cancelButton.setStyleName("okm-NoButton"); deleteButton.setStyleName("okm-DeleteButton"); testButton.setStyleName("okm-YesButton"); super.hide(); setWidget(vPanel); }