List of usage examples for com.vaadin.ui TabSheet.Tab setIcon
@Override public void setIcon(Resource icon)
From source file:annis.gui.docbrowser.DocBrowserController.java
License:Apache License
public void openDocBrowser(String corpus) { // if not already init, do it now if (!initedDocBrowsers.containsKey(corpus)) { DocBrowserPanel docBrowser = DocBrowserPanel.initDocBrowserPanel(ui, corpus); initedDocBrowsers.put(corpus, docBrowser); }/*w ww . java 2 s . c o m*/ // init tab and put to front TabSheet.Tab tab = ui.getSearchView().getTabSheet().addTab(initedDocBrowsers.get(corpus), corpus); tab.setIcon(DOC_ICON); tab.setClosable(true); ui.getSearchView().getTabSheet().setSelectedTab(tab); }
From source file:annis.gui.QueryController.java
License:Apache License
/** * Executes a query./* ww w.ja v a 2s .com*/ * @param replaceOldTab * @param freshQuery If true the offset and the selected matches are reset before executing the query. */ public void executeSearch(boolean replaceOldTab, boolean freshQuery) { if (freshQuery) { getState().getOffset().setValue(0l); getState().getSelectedMatches().setValue(new TreeSet<Long>()); // get the value for the visible segmentation from the configured context Set<String> selectedCorpora = getState().getSelectedCorpora().getValue(); CorpusConfig config = new CorpusConfig(); if (selectedCorpora != null && !selectedCorpora.isEmpty()) { config = ui.getCorpusConfigWithCache(selectedCorpora.iterator().next()); } if (config.containsKey(SearchOptionsPanel.KEY_DEFAULT_BASE_TEXT_SEGMENTATION)) { String configVal = config.getConfig(SearchOptionsPanel.KEY_DEFAULT_BASE_TEXT_SEGMENTATION); if ("".equals(configVal) || "tok".equals(configVal)) { configVal = null; } getState().getVisibleBaseText().setValue(configVal); } else { getState().getVisibleBaseText().setValue(getState().getContextSegmentation().getValue()); } } // construct a query from the current properties DisplayedResultQuery displayedQuery = getSearchQuery(); searchView.getControlPanel().getQueryPanel().setStatus("Searching..."); cancelSearch(); // cleanup resources VaadinSession session = VaadinSession.getCurrent(); session.setAttribute(IFrameResourceMap.class, new IFrameResourceMap()); if (session.getAttribute(MediaController.class) != null) { session.getAttribute(MediaController.class).clearMediaPlayers(); } searchView.updateFragment(displayedQuery); if (displayedQuery.getCorpora() == null || displayedQuery.getCorpora().isEmpty()) { Notification.show("Please select a corpus", Notification.Type.WARNING_MESSAGE); return; } if ("".equals(displayedQuery.getQuery())) { Notification.show("Empty query", Notification.Type.WARNING_MESSAGE); return; } addHistoryEntry(displayedQuery); AsyncWebResource res = Helper.getAnnisAsyncWebResource(); // // begin execute match fetching // ResultViewPanel oldPanel = searchView.getLastSelectedResultView(); if (replaceOldTab) { // remove old panel from view searchView.closeTab(oldPanel); } ResultViewPanel newResultView = new ResultViewPanel(ui, ui, ui.getInstanceConfig(), displayedQuery); newResultView.getPaging() .addCallback(new SpecificPagingCallback(ui, searchView, newResultView, displayedQuery)); TabSheet.Tab newTab; List<ResultViewPanel> existingResultPanels = getResultPanels(); String caption = existingResultPanels.isEmpty() ? "Query Result" : "Query Result #" + (existingResultPanels.size() + 1); newTab = searchView.getMainTab().addTab(newResultView, caption); newTab.setClosable(true); newTab.setIcon(FontAwesome.SEARCH); searchView.getMainTab().setSelectedTab(newResultView); searchView.notifiyQueryStarted(); Background.run(new ResultFetchJob(displayedQuery, newResultView, ui)); // // end execute match fetching // // // begin execute count // // start count query searchView.getControlPanel().getQueryPanel().setCountIndicatorEnabled(true); AsyncWebResource countRes = res.path("query").path("search").path("count") .queryParam("q", Helper.encodeJersey(displayedQuery.getQuery())) .queryParam("corpora", Helper.encodeJersey(StringUtils.join(displayedQuery.getCorpora(), ","))); Future<MatchAndDocumentCount> futureCount = countRes.get(MatchAndDocumentCount.class); state.getExecutedTasks().put(QueryUIState.QueryType.COUNT, futureCount); Background.run(new CountCallback(newResultView, displayedQuery.getLimit(), ui)); // // end execute count // }
From source file:annis.gui.SearchView.java
License:Apache License
public SearchView(AnnisUI ui) { super(2, 2);/*w ww. jav a 2 s. com*/ this.ui = ui; this.selectedTabHistory = new LinkedHashSet<>(); // init a doc browser controller this.docBrowserController = new DocBrowserController(ui); // always get the resize events directly setImmediate(true); setSizeFull(); setMargin(false); setRowExpandRatio(1, 1.0f); setColumnExpandRatio(1, 1.0f); final HelpPanel help = new HelpPanel(ui); mainTab = new TabSheet(); mainTab.setSizeFull(); mainTab.setCloseHandler(SearchView.this); mainTab.addStyleName(ValoTheme.TABSHEET_FRAMED); mainTab.addSelectedTabChangeListener(SearchView.this); TabSheet.Tab helpTab = mainTab.addTab(help, "Help/Examples"); helpTab.setIcon(FontAwesome.QUESTION_CIRCLE); helpTab.setClosable(false); controlPanel = new ControlPanel(ui.getInstanceConfig(), help.getExamples(), ui); controlPanel.setWidth(CONTROL_PANEL_WIDTH, Layout.Unit.PIXELS); controlPanel.setHeight(100f, Layout.Unit.PERCENTAGE); ui.addAction(new ShortcutListener("Tutor^eial") { @Override public void handleAction(Object sender, Object target) { mainTab.setSelectedTab(help); } }); addComponent(controlPanel, 0, 1); addComponent(mainTab, 1, 1); }
From source file:com.haulmont.cuba.web.gui.WebWindow.java
License:Apache License
@Override public void setIcon(String icon) { this.icon = icon; if (component.isAttached()) { com.vaadin.ui.Window dialogWindow = asDialogWindow(); if (dialogWindow != null) { dialogWindow.setIcon(WebComponentsHelper.getIcon(icon)); }// ww w. ja va2 s . c o m TabSheet.Tab tabWindow = asTabWindow(); if (tabWindow != null) { tabWindow.setIcon(WebComponentsHelper.getIcon(icon)); } } }