List of usage examples for com.vaadin.ui Label setContentMode
public void setContentMode(ContentMode contentMode)
From source file:org.opennms.features.vaadin.dashboard.dashlets.KscDashlet.java
License:Open Source License
@Override public DashletComponent getWallboardComponent() { if (m_wallboardComponent == null) { m_wallboardComponent = new AbstractDashletComponent() { private GridLayout m_gridLayout = new GridLayout(); {//from w ww .j a v a 2 s . com m_gridLayout.setCaption(getName()); m_gridLayout.setSizeFull(); m_gridLayout.setColumns(1); m_gridLayout.setRows(1); } @Override public void refresh() { m_gridLayout.removeAllComponents(); /** * initializing the parameters */ int columns = 0; int rows = 0; String kscReportName = getDashletSpec().getParameters().get("kscReport"); if (kscReportName == null || "".equals(kscReportName)) { return; } KSC_PerformanceReportFactory kscPerformanceReportFactory = KSC_PerformanceReportFactory .getInstance(); Map<Integer, String> reportsMap = kscPerformanceReportFactory.getReportList(); int kscReportId = -1; for (Map.Entry<Integer, String> entry : reportsMap.entrySet()) { if (kscReportName.equals(entry.getValue())) { kscReportId = entry.getKey(); break; } } if (kscReportId == -1) { return; } Report kscReport = kscPerformanceReportFactory.getReportByIndex(kscReportId); columns = kscReport.getGraphs_per_line(); if (columns == 0) { columns = 1; } rows = kscReport.getGraphCount() / columns; if (rows == 0) { rows = 1; } if (kscReport.getGraphCount() % columns > 0) { rows++; } /** * setting new columns/rows */ m_gridLayout.setColumns(columns); m_gridLayout.setRows(rows); int i = 0; /** * adding the components */ Page.getCurrent().getStyles().add( ".box { margin: 5px; background-color: #444; border: 1px solid #999; border-top: 0; overflow: auto; }"); Page.getCurrent().getStyles().add( ".text { color:#ffffff; line-height: 11px; font-size: 9px; font-family: 'Lucida Grande', Verdana, sans-serif; font-weight: bold; }"); Page.getCurrent().getStyles().add(".margin { margin:5px; }"); for (int y = 0; y < m_gridLayout.getRows(); y++) { for (int x = 0; x < m_gridLayout.getColumns(); x++) { if (i < kscReport.getGraphCount()) { Graph graph = kscReport.getGraph(i); Map<String, String> data = getDataForResourceId(graph.getNodeId(), graph.getResourceId()); Calendar beginTime = Calendar.getInstance(); Calendar endTime = Calendar.getInstance(); KSC_PerformanceReportFactory.getBeginEndTime(graph.getTimespan(), beginTime, endTime); GraphContainer graphContainer = getGraphContainer(graph, beginTime.getTime(), endTime.getTime()); VerticalLayout verticalLayout = new VerticalLayout(); HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.addStyleName("box"); horizontalLayout.setWidth("100%"); horizontalLayout.setHeight("42px"); VerticalLayout leftLayout = new VerticalLayout(); leftLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT); leftLayout.addStyleName("margin"); Label labelTitle; if (graph.getTitle() == null || "".equals(graph.getTitle())) { labelTitle = new Label(" "); labelTitle.setContentMode(ContentMode.HTML); } else { labelTitle = new Label(graph.getTitle()); } labelTitle.addStyleName("text"); Label labelFrom = new Label("From: " + beginTime.getTime().toString()); labelFrom.addStyleName("text"); Label labelTo = new Label("To: " + endTime.getTime().toString()); labelTo.addStyleName("text"); Label labelNodeLabel = new Label(data.get("nodeLabel")); labelNodeLabel.addStyleName("text"); Label labelResourceLabel = new Label( data.get("resourceTypeLabel") + ": " + data.get("resourceLabel")); labelResourceLabel.addStyleName("text"); leftLayout.addComponent(labelTitle); leftLayout.addComponent(labelFrom); leftLayout.addComponent(labelTo); VerticalLayout rightLayout = new VerticalLayout(); rightLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT); rightLayout.addStyleName("margin"); rightLayout.addComponent(labelNodeLabel); rightLayout.addComponent(labelResourceLabel); horizontalLayout.addComponent(leftLayout); horizontalLayout.addComponent(rightLayout); horizontalLayout.setExpandRatio(leftLayout, 1.0f); horizontalLayout.setExpandRatio(rightLayout, 1.0f); verticalLayout.addComponent(horizontalLayout); verticalLayout.addComponent(graphContainer); verticalLayout.setWidth(DEFAULT_GRAPH_WIDTH_PX, Unit.PIXELS); m_gridLayout.addComponent(verticalLayout, x, y); verticalLayout.setComponentAlignment(horizontalLayout, Alignment.MIDDLE_CENTER); verticalLayout.setComponentAlignment(graphContainer, Alignment.MIDDLE_CENTER); m_gridLayout.setComponentAlignment(verticalLayout, Alignment.MIDDLE_CENTER); } i++; } } } @Override public Component getComponent() { return m_gridLayout; } }; } return m_wallboardComponent; }
From source file:org.opennms.features.vaadin.dashboard.dashlets.KscDashlet.java
License:Open Source License
@Override public DashletComponent getDashboardComponent() { if (m_dashboardComponent == null) { m_dashboardComponent = new AbstractDashletComponent() { private VerticalLayout m_verticalLayout = new VerticalLayout(); {/* w w w .jav a2s .c o m*/ m_verticalLayout.setCaption(getName()); m_verticalLayout.setSizeFull(); } @Override public void refresh() { m_verticalLayout.removeAllComponents(); String kscReportName = getDashletSpec().getParameters().get("kscReport"); if (kscReportName == null || "".equals(kscReportName)) { return; } KSC_PerformanceReportFactory kscPerformanceReportFactory = KSC_PerformanceReportFactory .getInstance(); Map<Integer, String> reportsMap = kscPerformanceReportFactory.getReportList(); int kscReportId = -1; for (Map.Entry<Integer, String> entry : reportsMap.entrySet()) { if (kscReportName.equals(entry.getValue())) { kscReportId = entry.getKey(); break; } } if (kscReportId == -1) { return; } Report kscReport = kscPerformanceReportFactory.getReportByIndex(kscReportId); Page.getCurrent().getStyles().add( ".box { margin: 5px; background-color: #444; border: 1px solid #999; border-top: 0; overflow: auto; }"); Page.getCurrent().getStyles().add( ".text { color:#ffffff; line-height: 11px; font-size: 9px; font-family: 'Lucida Grande', Verdana, sans-serif; font-weight: bold; }"); Page.getCurrent().getStyles().add(".margin { margin:5px; }"); Accordion accordion = new Accordion(); accordion.setSizeFull(); m_verticalLayout.addComponent(accordion); for (Graph graph : kscReport.getGraph()) { Map<String, String> data = getDataForResourceId(graph.getNodeId(), graph.getResourceId()); Calendar beginTime = Calendar.getInstance(); Calendar endTime = Calendar.getInstance(); KSC_PerformanceReportFactory.getBeginEndTime(graph.getTimespan(), beginTime, endTime); GraphContainer graphContainer = getGraphContainer(graph, beginTime.getTime(), endTime.getTime()); VerticalLayout verticalLayout = new VerticalLayout(); HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.addStyleName("box"); horizontalLayout.setWidth("100%"); horizontalLayout.setHeight("42px"); VerticalLayout leftLayout = new VerticalLayout(); leftLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT); leftLayout.addStyleName("margin"); Label labelTitle; if (graph.getTitle() == null || "".equals(graph.getTitle())) { labelTitle = new Label(" "); labelTitle.setContentMode(ContentMode.HTML); } else { labelTitle = new Label(graph.getTitle()); } labelTitle.addStyleName("text"); Label labelFrom = new Label("From: " + beginTime.getTime().toString()); labelFrom.addStyleName("text"); Label labelTo = new Label("To: " + endTime.getTime().toString()); labelTo.addStyleName("text"); Label labelNodeLabel = new Label(data.get("nodeLabel")); labelNodeLabel.addStyleName("text"); Label labelResourceLabel = new Label( data.get("resourceTypeLabel") + ": " + data.get("resourceLabel")); labelResourceLabel.addStyleName("text"); leftLayout.addComponent(labelTitle); leftLayout.addComponent(labelFrom); leftLayout.addComponent(labelTo); VerticalLayout rightLayout = new VerticalLayout(); rightLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT); rightLayout.addStyleName("margin"); rightLayout.addComponent(labelNodeLabel); rightLayout.addComponent(labelResourceLabel); horizontalLayout.addComponent(leftLayout); horizontalLayout.addComponent(rightLayout); horizontalLayout.setExpandRatio(leftLayout, 1.0f); horizontalLayout.setExpandRatio(rightLayout, 1.0f); verticalLayout.addComponent(horizontalLayout); verticalLayout.addComponent(graphContainer); verticalLayout.setWidth(DEFAULT_GRAPH_WIDTH_PX, Unit.PIXELS); accordion.addTab(verticalLayout, data.get("nodeLabel") + "/" + data.get("resourceTypeLabel") + ": " + data.get("resourceLabel")); verticalLayout.setComponentAlignment(horizontalLayout, Alignment.MIDDLE_CENTER); verticalLayout.setComponentAlignment(graphContainer, Alignment.MIDDLE_CENTER); verticalLayout.setMargin(true); } } @Override public Component getComponent() { return m_verticalLayout; } }; } return m_dashboardComponent; }
From source file:org.opennms.features.vaadin.dashboard.ui.HeaderLayout.java
License:Open Source License
/** * Default constructor./*ww w. j av a 2 s .c om*/ */ public HeaderLayout() { /** * Setting up the layout */ addStyleName("header"); setMargin(new MarginInfo(false, true, false, false)); setSpacing(true); setWidth("100%"); setHeight(64, Unit.PIXELS); /** * Adding the logo */ Label link = new Label(); link.setContentMode(ContentMode.HTML); link.setValue("<a href=\"/opennms/index.jsp\" id=\"onmslogo\"></a>"); addComponent(link); setExpandRatio(link, 1.0f); /** * Adding the selection box */ m_nativeSelect = new NativeSelect(); m_nativeSelect.setDescription("Select Ops Board configuration"); m_nativeSelect.setContainerDataSource(WallboardProvider.getInstance().getBeanContainer()); m_nativeSelect.setItemCaptionPropertyId("title"); m_nativeSelect.setNullSelectionAllowed(false); m_nativeSelect.setImmediate(true); m_nativeSelect.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { m_wallboardButton.setEnabled(true); m_dashboardButton.setEnabled(true); } }); m_dashboardButton = new Button("Ops Panel", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().getNavigator().addViewChangeListener(HeaderLayout.this); UI.getCurrent().getNavigator().navigateTo( "dashboard/" + m_nativeSelect.getContainerProperty(m_nativeSelect.getValue(), "title")); } }); m_dashboardButton.setDescription("Ops Panel view"); /** * Adding the wallboard button */ m_pauseButton = new Button("Pause", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (m_wallboardView instanceof WallboardView) { if (((WallboardView) m_wallboardView).isPaused()) { ((WallboardView) m_wallboardView).resume(); } else { ((WallboardView) m_wallboardView).pause(); } } else { if (m_wallboardView instanceof DashboardView) { ((DashboardView) m_wallboardView).updateAll(); } } updatePauseButton(); } }); /** * Adding the wallboard button */ m_wallboardButton = new Button("Ops Board", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().getNavigator().addViewChangeListener(HeaderLayout.this); UI.getCurrent().getNavigator().navigateTo( "wallboard/" + m_nativeSelect.getContainerProperty(m_nativeSelect.getValue(), "title")); } }); m_wallboardButton.setDescription("Ops Board view"); m_pauseButton.setEnabled(false); m_wallboardButton.setEnabled(false); m_dashboardButton.setEnabled(false); addComponents(m_nativeSelect, m_dashboardButton, m_wallboardButton, m_pauseButton); setComponentAlignment(m_nativeSelect, Alignment.MIDDLE_CENTER); setComponentAlignment(m_dashboardButton, Alignment.MIDDLE_CENTER); setComponentAlignment(m_wallboardButton, Alignment.MIDDLE_CENTER); setComponentAlignment(m_pauseButton, Alignment.MIDDLE_CENTER); }
From source file:org.opennms.features.vaadin.mibcompiler.MibCompilerPanel.java
License:Open Source License
/** * Instantiates a new MIB tree panel./* ww w . j ava 2 s .c o m*/ * * @param dataCollectionDao the OpenNMS Data Collection Configuration DAO * @param eventsDao the OpenNMS Events Configuration DAO * @param eventsProxy the OpenNMS Events Proxy * @param mibParser the MIB parser * @param logger the logger */ public MibCompilerPanel(final DataCollectionConfigDao dataCollectionDao, final EventConfDao eventsDao, final EventProxy eventsProxy, final MibParser mibParser, final Logger logger) { super("MIB Compiler"); if (dataCollectionDao == null) throw new RuntimeException("dataCollectionDao cannot be null."); if (eventsProxy == null) throw new RuntimeException("eventProxy cannot be null."); if (eventsDao == null) throw new RuntimeException("eventsDao cannot be null."); this.eventsDao = eventsDao; this.eventsProxy = eventsProxy; this.dataCollectionDao = dataCollectionDao; logger.info("Reading MIBs from " + MIBS_ROOT_DIR); // Make sure MIB directories exist if (!MIBS_COMPILED_DIR.exists()) { if (!MIBS_COMPILED_DIR.mkdirs()) { throw new RuntimeException( "Unable to create directory for compiled MIBs (" + MIBS_COMPILED_DIR + ")"); } } if (!MIBS_PENDING_DIR.exists()) { if (!MIBS_PENDING_DIR.mkdirs()) { throw new RuntimeException( "Unable to create directory for pending MIBs (" + MIBS_PENDING_DIR + ")"); } } // Parser Configuration this.mibParser = mibParser; mibParser.setMibDirectory(MIBS_COMPILED_DIR); // Initialize Toolbar MibUploadButton upload = new MibUploadButton(MIBS_PENDING_DIR, MIBS_COMPILED_DIR, logger) { @Override public void uploadHandler(String filename) { addTreeItem(filename, PENDING); } }; VerticalLayout layout = new VerticalLayout(); layout.addComponent(upload); // Initialize MIB Tree mibsTree = new Tree("MIB Tree"); initMibTree(logger); final Label label = new Label( "<p>Use the right-click context menu over the MIB tree files, to display the compiler operations.</p>"); label.setContentMode(ContentMode.HTML); layout.addComponent(label); layout.addComponent(mibsTree); // Panel Setup setSizeFull(); addStyleName("light"); layout.setComponentAlignment(upload, Alignment.TOP_RIGHT); layout.setExpandRatio(mibsTree, 1); setContent(layout); }
From source file:org.opennms.features.vaadin.pmatrix.ui.PmatrixApplication.java
License:Open Source License
@Override protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); layout.setWidth("-1px"); layout.setHeight("-1px"); layout.setDefaultComponentAlignment(Alignment.TOP_LEFT); layout.setMargin(true);// w ww .ja va 2 s . c om setContent(layout); //used to test that detach events are happening addDetachListener(new DetachListener() { @Override public void detach(DetachEvent event) { LOG.debug("Pmatrix UI instance detached:" + this); } }); Component uiComponent = uiComponentFactory.getUiComponent(request); if (uiComponent == null) { StringBuilder sb = new StringBuilder( "Error: Cannot create the UI because the URL request parameters are not recognised<BR>\n" + "you need to provide atleast '?" + UiComponentFactory.COMPONENT_REQUEST_PARAMETER + "=" + UiComponentFactory.DEFAULT_COMPONENT_REQUEST_VALUE + "'<BR>\n" + "Parameters passed in URL:<BR>\n"); for (Entry<String, String[]> entry : request.getParameterMap().entrySet()) { sb.append("parameter:'" + entry.getKey() + "' value:'"); for (String s : entry.getValue()) { sb.append("{" + s + "}"); } sb.append("'<BR>\n"); } Label label = new Label(); label.setWidth("600px"); label.setContentMode(ContentMode.HTML); label.setValue(sb.toString()); layout.addComponent(label); } else { layout.addComponent(uiComponent); // refresh interval to apply to the UI int pollInterval = uiComponentFactory.getRefreshRate(); setPollInterval(pollInterval); // display poll interval in seconds DecimalFormat dformat = new DecimalFormat("##.##"); Label label = new Label(); label.setCaption("(refresh rate:" + dformat.format(pollInterval / 1000) + " seconds)"); layout.addComponent(label); } }
From source file:org.processbase.ui.bpm.admin.ProcessDefinitionWindow.java
License:Open Source License
public void initUI() { try {/*w w w . j a v a 2 s .c o m*/ String caption = processDefinition.getLabel() != null ? processDefinition.getLabel() : processDefinition.getName(); setCaption(caption + " (v." + processDefinition.getVersion() + ")"); VerticalLayout layout = (VerticalLayout) this.getContent(); layout.setMargin(true); layout.setSpacing(true); layout.setStyleName(Reindeer.LAYOUT_WHITE); v1.setMargin(true, false, false, false); v1.setSizeFull(); if (processDefinition.getLabel() != null) { Label pdLabel = new Label("<b>" + processDefinition.getLabel() + "</b>"); pdLabel.setContentMode(Label.CONTENT_XHTML); v1.addComponent(pdLabel); } if (processDefinition.getDescription() != null) { Label pdDescription = new Label(processDefinition.getDescription()); pdDescription.setContentMode(Label.CONTENT_XHTML); v1.addComponent(pdDescription); v1.setExpandRatio(pdDescription, 1); } tabSheet.addTab(v1, ProcessbaseApplication.getCurrent().getPbMessages().getString("tabDescription"), null); activitiesTable.setSizeFull(); v2.setMargin(false, false, false, false); v2.addComponent(activitiesTable); v2.setSizeFull(); tabSheet.addTab(v2, ProcessbaseApplication.getCurrent().getPbMessages().getString("tabCustomUI"), null); // prepare membership prepareTableMembership(); addBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnAdd"), this); addBtn.setStyleName(Runo.BUTTON_SMALL); v3.setMargin(false, false, false, false); v3.setSpacing(true); v3.addComponent(addBtn); v3.setComponentAlignment(addBtn, Alignment.MIDDLE_RIGHT); v3.addComponent(tableMembership); v3.setSizeFull(); tabSheet.addTab(v3, ProcessbaseApplication.getCurrent().getPbMessages().getString("processAccess"), null); refreshTableMembership(); tabSheet.setStyleName(Reindeer.TABSHEET_MINIMAL); tabSheet.setSizeFull(); tabSheet.addListener((TabSheet.SelectedTabChangeListener) this); layout.addComponent(tabSheet); layout.setExpandRatio(tabSheet, 1); closeBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnClose"), this); applyBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnSaveCustomUI"), this); saveAccessBtn = new Button( ProcessbaseApplication.getCurrent().getPbMessages().getString("btnSaveProcessAccess"), this); deleteAllBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnDeleteAll"), this); deleteInstancesBtn = new Button( ProcessbaseApplication.getCurrent().getPbMessages().getString("btnDeleteInstances"), this); downloadBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnDownload"), this); enableBtn = new CheckBox(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnEnable"), this); archiveBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnArchive"), this); deleteAllBtn.setDescription( ProcessbaseApplication.getCurrent().getPbMessages().getString("deleteProcessDefinition")); buttons.addButton(deleteAllBtn); buttons.setComponentAlignment(deleteAllBtn, Alignment.MIDDLE_RIGHT); deleteInstancesBtn.setDescription( ProcessbaseApplication.getCurrent().getPbMessages().getString("deleteProcessInstances")); buttons.addButton(deleteInstancesBtn); buttons.setComponentAlignment(deleteInstancesBtn, Alignment.MIDDLE_RIGHT); Label expand = new Label(""); buttons.addComponent(expand); buttons.setExpandRatio(expand, 1); enableBtn.setValue(processDefinition.getState().equals(ProcessState.ENABLED)); buttons.addButton(enableBtn); buttons.setComponentAlignment(enableBtn, Alignment.MIDDLE_RIGHT); buttons.addButton(archiveBtn); buttons.setComponentAlignment(archiveBtn, Alignment.MIDDLE_RIGHT); applyBtn.setVisible(false); buttons.addButton(applyBtn); buttons.setComponentAlignment(applyBtn, Alignment.MIDDLE_RIGHT); buttons.addButton(saveAccessBtn); saveAccessBtn.setVisible(false); buttons.setComponentAlignment(saveAccessBtn, Alignment.MIDDLE_RIGHT); buttons.addButton(closeBtn); buttons.setComponentAlignment(closeBtn, Alignment.MIDDLE_RIGHT); buttons.setMargin(false); buttons.setHeight("30px"); buttons.setWidth("100%"); layout.addComponent(buttons); layout.setWidth("800px"); layout.setHeight("400px"); setResizable(false); setModal(true); // activitiesTable.addContainerProperty("activityUUID", String.class, null, "UUID", null, null); // activitiesTable.setColumnWidth("activityUUID", 0); activitiesTable.addContainerProperty("activityLabel", String.class, null, ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionActivityName"), null, null); activitiesTable.addContainerProperty("url", String.class, null, ProcessbaseApplication.getCurrent().getPbMessages().getString("tabCaptionTaskURL"), null, null); activitiesTable.setColumnWidth("url", 300); activitiesTable.setTableFieldFactory(new PbTableFieldFactory()); activitiesTable.setEditable(true); activitiesTable.setImmediate(true); refreshTable(); } catch (Exception ex) { ex.printStackTrace(); showError(ex.getMessage()); } }
From source file:org.processbase.ui.bpm.generator.GeneratedWindow.java
License:Open Source License
private Label getLabel(Widget widget, Object value) { Label component = new Label(value.toString()); component.setContentMode(Label.CONTENT_XHTML); return component; }
From source file:org.robot.gtf.gui.GTFApplication.java
License:Apache License
private void buildAboutWindow() { // Create the window... aboutWindow = new Window("About"); aboutWindow.setModal(true);//from w w w. j a v a2s. c om aboutWindow.setResizable(false); aboutWindow.setWidth(350, Window.UNITS_PIXELS); aboutWindow.setHeight(180, Window.UNITS_PIXELS); // Configure the window layout; by default a VerticalLayout VerticalLayout layout = (VerticalLayout) aboutWindow.getContent(); layout.setMargin(true); layout.setSpacing(true); // Add some content; a label and a close-button Label message = new Label(TextResources.getAboutText()); message.setContentMode(Label.CONTENT_XHTML); aboutWindow.addComponent(message); Button close = new Button("Close", new Button.ClickListener() { public void buttonClick(ClickEvent event) { (aboutWindow.getParent()).removeWindow(aboutWindow); } }); // The components added to the window are actually added to the window's // layout; you can use either. Alignments are set using the layout layout.addComponent(close); layout.setComponentAlignment(close, Alignment.TOP_RIGHT); }
From source file:org.s23m.cell.editor.semanticdomain.ui.components.layout.ImpactAnalysisFormLayout.java
License:Mozilla Public License
private void init() { setMargin(true);/*ww w. j a va 2s.c o m*/ resultsPanel = new Panel(); resultsPanel.addStyleName(Runo.PANEL_LIGHT); resultsPanel.setWidth(RESULTS_PANEL_WIDTH); resultsPanel.setHeight(RESULTS_PANEL_HEIGHT); addComponent(resultsPanel); parent.getMainApplication().getMainWindow().showNotification("Processing results..."); final List<Set> dependentInstances = doImapactAnalysis( analysedSet.identity().uniqueRepresentationReference().toString()); this.pageIndex = 0; final Label lblTitle = new Label(); lblTitle.setValue( analysedSet.identity().name() + "<br/> can impact : " + dependentInstances.size() + " instaces(s)"); lblTitle.setContentMode(Label.CONTENT_XHTML); lblTitle.setStyleName("title-label"); resultsPanel.addComponent(lblTitle); if (dependentInstances.size() > 0) { final int startIndex = pageIndex * PAGE_SIZE; final int endIndex = startIndex + PAGE_SIZE; final Panel resultsContentPanel = new Panel(); resultsContentPanel.setWidth(RESULTS_CONTENT_PANEL_WIDTH); resultsContentPanel.setHeight(RESULTS_CONTENT_PANEL_HEIGHT); resultsPanel.addComponent(resultsContentPanel); buildResultsPage(dependentInstances, resultsContentPanel, startIndex, endIndex); } }
From source file:org.s23m.cell.editor.semanticdomain.ui.components.MultitabPanel.java
License:Mozilla Public License
public void displaySearchResults() { application.getMainWindow().showNotification("Processing results..."); this.pageIndex = 0; final RepositoryClient client = RepositoryClientImpl.getInstance(); final String inputText = application.getContainmentTreePanel().getSearchText(); final ArtefactContainer container = ObjectFactoryHolder.getInstance().createArtefactContainer(); container.setContentType(SerializationType.SEARCH_ARGUMENTS.toString()); final Content searchContent = ObjectFactoryHolder.getInstance().createArtefactContainerContent(); searchContent.setContent(inputText); container.getContent().add(searchContent); final ArtefactContainer resultsContainer = client.get(container); searchResults = new ArrayList<SearchResultType>(); for (final SearchResult sr : resultsContainer.getSearchResult()) { searchResults.add(sr);// w w w. ja v a 2s . c o m } searchResultPanel.removeAllComponents(); final Panel resultsPanel = new Panel(); final Label lblTitle = new Label(); lblTitle.setValue(inputText + "<br/>Returned: " + searchResults.size() + " result(s)"); lblTitle.setContentMode(Label.CONTENT_XHTML); lblTitle.setStyleName("title-label"); searchResultPanel.addComponent(lblTitle); if (searchResults.size() > 0) { //display 10 per page and put a navigation toolbar at the bottom searchResultPanel.addComponent(resultsPanel); final int startIndex = pageIndex * PAGE_SIZE; final int endIndex = startIndex + PAGE_SIZE; buildResultsPage(resultsPanel, startIndex, endIndex); } }