List of usage examples for com.vaadin.ui Panel addStyleName
@Override public void addStyleName(String style)
From source file:org.jumpmind.metl.ui.views.design.TableColumnSelectWindow.java
License:Open Source License
public TableColumnSelectWindow(ApplicationContext context, Model model) { super("Import from Database into Model"); this.context = context; this.model = model; setWidth(600.0f, Unit.PIXELS);//from w ww.jav a2s . c o m setHeight(600.0f, Unit.PIXELS); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.setSizeFull(); layout.addComponent(new Label("Select tables and columns to import into the model.")); Panel scrollable = new Panel(); scrollable.addStyleName(ValoTheme.PANEL_BORDERLESS); scrollable.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR); scrollable.setSizeFull(); provider = new DbProvider(context); dbTree = new DbTree(provider, new DefaultSettingsProvider(context.getConfigDir())); scrollable.setContent(dbTree); layout.addComponent(scrollable); layout.setExpandRatio(scrollable, 1.0f); addComponent(layout, 1); Button refreshButton = new Button("Refresh"); Button cancelButton = new Button("Cancel"); Button selectButton = new Button("Import"); addComponent(buildButtonFooter(refreshButton, cancelButton, selectButton)); cancelButton.addClickListener(event -> close()); selectButton.addClickListener(event -> select()); refreshButton.addClickListener(event -> refresh()); }
From source file:org.lucidj.ui.gauss.GaussUI.java
License:Apache License
private void add_smart_tab(VerticalLayout container, String caption, Component contents) { String style_expanded = "ui-panel-caption-expanded"; // Every panel is a glorified button disguised as accordion tab... final Button caption_button = new Button(caption); caption_button.setWidth(100, Unit.PERCENTAGE); container.addComponent(caption_button); caption_button.addStyleName("ui-panel-caption"); caption_button.addStyleName(style_expanded); // ... with a panel for the contents and selective hide/show final Panel content_panel = new Panel(); content_panel.setWidth(100, Unit.PERCENTAGE); content_panel.setContent(contents);//from ww w . j a v a 2s. c o m content_panel.addStyleName("ui-panel-contents"); content_panel.addStyleName(ValoTheme.PANEL_BORDERLESS); container.addComponent(content_panel); caption_button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { if (content_panel.isVisible()) { content_panel.setVisible(false); caption_button.removeStyleName(style_expanded); } else { content_panel.setVisible(true); caption_button.addStyleName(style_expanded); } } }); }
From source file:org.milleni.dunning.ui.customer.form.CustomProcessInstanceDetailPanel.java
License:Apache License
protected void addProcessImage() { ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService) .getDeployedProcessDefinition(processDefinition.getId()); // Only show when graphical notation is defined if (processDefinitionEntity != null) { boolean didDrawImage = false; if (ExplorerApp.get().isUseJavascriptDiagram()) { try { final InputStream definitionStream = repositoryService.getResourceAsStream( processDefinition.getDeploymentId(), processDefinition.getResourceName()); XMLInputFactory xif = XMLInputFactory.newInstance(); XMLStreamReader xtr = xif.createXMLStreamReader(definitionStream); BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr); if (bpmnModel.getFlowLocationMap().size() > 0) { int maxX = 0; int maxY = 0; for (String key : bpmnModel.getLocationMap().keySet()) { GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(key); double elementX = graphicInfo.getX() + graphicInfo.getWidth(); if (maxX < elementX) { maxX = (int) elementX; }/*from w w w . ja v a 2 s. c om*/ double elementY = graphicInfo.getY() + graphicInfo.getHeight(); if (maxY < elementY) { maxY = (int) elementY; } } Panel imagePanel = new Panel(); // using panel for scrollbars imagePanel.addStyleName(Reindeer.PANEL_LIGHT); imagePanel.setWidth(100, UNITS_PERCENTAGE); imagePanel.setHeight(100, UNITS_PERCENTAGE); URL explorerURL = ExplorerApp.get().getURL(); URL url = new URL(explorerURL.getProtocol(), explorerURL.getHost(), explorerURL.getPort(), explorerURL.getPath().replace("/ui", "") + "diagram-viewer/index.html?processDefinitionId=" + processDefinition.getId() + "&processInstanceId=" + processInstance.getId()); Embedded browserPanel = new Embedded("", new ExternalResource(url)); browserPanel.setType(Embedded.TYPE_BROWSER); browserPanel.setWidth(maxX + 350 + "px"); browserPanel.setHeight(maxY + 220 + "px"); HorizontalLayout panelLayoutT = new HorizontalLayout(); panelLayoutT.setSizeUndefined(); imagePanel.setContent(panelLayoutT); imagePanel.addComponent(browserPanel); panelLayout.addComponent(imagePanel); didDrawImage = true; } } catch (Exception e) { LOGGER.error("Error loading process diagram component", e); } } if (didDrawImage == false && processDefinitionEntity.isGraphicalNotationDefined()) { StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder() .buildStreamResource(processInstance, repositoryService, runtimeService); if (diagram != null) { Label header = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM)); header.addStyleName(ExplorerLayout.STYLE_H3); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); header.addStyleName(ExplorerLayout.STYLE_NO_LINE); panelLayout.addComponent(header); Embedded embedded = new Embedded(null, diagram); embedded.setType(Embedded.TYPE_IMAGE); embedded.setSizeUndefined(); Panel imagePanel = new Panel(); // using panel for scrollbars imagePanel.setScrollable(true); imagePanel.addStyleName(Reindeer.PANEL_LIGHT); imagePanel.setWidth(100, UNITS_PERCENTAGE); imagePanel.setHeight(100, UNITS_PERCENTAGE); HorizontalLayout panelLayoutT = new HorizontalLayout(); panelLayoutT.setSizeUndefined(); imagePanel.setContent(panelLayoutT); imagePanel.addComponent(embedded); panelLayout.addComponent(imagePanel); } } } }
From source file:org.opencms.ui.components.CmsBasicDialog.java
License:Open Source License
/** * Creates a resource list panel.<p> * * @param caption the caption to use/*from w ww . ja v a 2 s .com*/ * @param resources the resources * * @return the panel */ protected Panel createResourceListPanel(String caption, List<CmsResource> resources) { Panel result = new Panel(caption); result.addStyleName("v-scrollable"); result.setSizeFull(); VerticalLayout resourcePanel = new VerticalLayout(); result.setContent(resourcePanel); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_MARGIN); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_SPACING); resourcePanel.setSpacing(true); resourcePanel.setMargin(true); for (CmsResource resource : resources) { resourcePanel.addComponent(new CmsResourceInfo(resource)); } return result; }
From source file:org.opencms.ui.dialogs.history.CmsHistoryDialog.java
License:Open Source License
/** * Opens the 'compare' view for the two selected versions of the resource.<p> * * @throws CmsException if something goes wrong *//*from w w w . ja va2 s . c om*/ public void tryCompare() throws CmsException { CmsObject cms = A_CmsUI.getCmsObject(); CheckBox check1 = m_group1.getSelected(); CheckBox check2 = m_group2.getSelected(); if (!canCompare(check1, check2)) { Notification.show( CmsVaadinUtils.getMessageText(Messages.GUI_HISTORY_DIALOG_SELECT_TWO_DIFFERENT_VERSIONS_0)); } else { CmsHistoryResourceBean bean1 = (CmsHistoryResourceBean) (check1.getData()); CmsHistoryResourceBean bean2 = (CmsHistoryResourceBean) (check2.getData()); VerticalLayout diffContainer = new VerticalLayout(); diffContainer.setSpacing(true); for (I_CmsDiffProvider diff : m_diffs) { Optional<Component> optionalDiff = diff.diff(cms, bean1, bean2); if (optionalDiff.isPresent()) { diffContainer.addComponent(optionalDiff.get()); } } Panel panel = new Panel(); panel.setSizeFull(); diffContainer.setWidth("100%"); diffContainer.setMargin(true); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); panel.setContent(diffContainer); openChildDialog(CmsHistoryDialog.this, panel, CmsVaadinUtils.getMessageText(Messages.GUI_HISTORY_DIALOG_COMPARE_0)); } }
From source file:org.opencms.ui.dialogs.history.diff.CmsShowVersionButtons.java
License:Open Source License
/** * @see org.opencms.ui.dialogs.history.diff.I_CmsDiffProvider#diff(org.opencms.file.CmsObject, org.opencms.gwt.shared.CmsHistoryResourceBean, org.opencms.gwt.shared.CmsHistoryResourceBean) *//* www .ja v a 2 s . c o m*/ public Optional<Component> diff(CmsObject cms, CmsHistoryResourceBean v1, CmsHistoryResourceBean v2) { Panel panel = new Panel(""); panel.addStyleName(ValoTheme.PANEL_BORDERLESS); HorizontalLayout hl = new HorizontalLayout(); panel.setContent(hl); hl.addComponent(createButton(cms, v1)); hl.addComponent(createButton(cms, v2)); VerticalLayout outerContainer = new VerticalLayout(); outerContainer.addComponent(hl); outerContainer.setComponentAlignment(hl, Alignment.MIDDLE_RIGHT); outerContainer.setMargin(true); hl.setSpacing(true); return Optional.fromNullable((Component) outerContainer); }
From source file:org.opencms.ui.editors.messagebundle.CmsMessageBundleEditor.java
License:Open Source License
/** * Creates the main component of the editor with all sub-components. * @return the completely filled main component of the editor. * @throws IOException thrown if setting the table's content data source fails. * @throws CmsException thrown if setting the table's content data source fails. *///from w w w . java2 s . c om private Component createMainComponent() throws IOException, CmsException { VerticalLayout mainComponent = new VerticalLayout(); mainComponent.setSizeFull(); mainComponent.addStyleName("o-message-bundle-editor"); m_table = createTable(); Panel navigator = new Panel(); navigator.setSizeFull(); navigator.setContent(m_table); navigator.addActionHandler(new CmsMessageBundleEditorTypes.TableKeyboardHandler(m_table)); navigator.addStyleName("v-panel-borderless"); mainComponent.addComponent(m_options.getOptionsComponent()); mainComponent.addComponent(navigator); mainComponent.setExpandRatio(navigator, 1f); m_options.updateShownOptions(m_model.hasMasterMode(), m_model.canAddKeys()); return mainComponent; }
From source file:org.opennms.features.topology.app.internal.TopologyWidgetTestApplication.java
License:Open Source License
@SuppressWarnings("serial") @Override// w w w . j av a 2s .c om public void init() { setTheme("topo_default"); m_rootLayout = new AbsoluteLayout(); m_rootLayout.setSizeFull(); m_window = new Window("OpenNMS Topology"); m_window.setContent(m_rootLayout); setMainWindow(m_window); m_uriFragUtil = new UriFragmentUtility(); m_window.addComponent(m_uriFragUtil); m_uriFragUtil.addListener(this); m_layout = new AbsoluteLayout(); m_layout.setSizeFull(); m_rootLayout.addComponent(m_layout); if (m_showHeader) { HEADER_HEIGHT = 100; Panel header = new Panel("header"); header.setCaption(null); header.setSizeUndefined(); header.addStyleName("onmsheader"); m_rootLayout.addComponent(header, "top: 0px; left: 0px; right:0px;"); try { CustomLayout customLayout = new CustomLayout(getHeaderLayout()); header.setContent(customLayout); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { HEADER_HEIGHT = 0; } Refresher refresher = new Refresher(); refresher.setRefreshInterval(5000); getMainWindow().addComponent(refresher); m_graphContainer.setLayoutAlgorithm(new FRLayoutAlgorithm()); final Property scale = m_graphContainer.getScaleProperty(); m_topologyComponent = new TopologyComponent(m_graphContainer, m_iconRepositoryManager, m_selectionManager, this); m_topologyComponent.setSizeFull(); m_topologyComponent.addMenuItemStateListener(this); m_topologyComponent.addVertexUpdateListener(this); final Slider slider = new Slider(0, 1); slider.setPropertyDataSource(scale); slider.setResolution(1); slider.setHeight("300px"); slider.setOrientation(Slider.ORIENTATION_VERTICAL); slider.setImmediate(true); final Button zoomInBtn = new Button(); zoomInBtn.setIcon(new ThemeResource("images/plus.png")); zoomInBtn.setDescription("Expand Semantic Zoom Level"); zoomInBtn.setStyleName("semantic-zoom-button"); zoomInBtn.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { int szl = (Integer) m_graphContainer.getSemanticZoomLevel(); szl++; m_graphContainer.setSemanticZoomLevel(szl); setSemanticZoomLevel(szl); saveHistory(); } }); Button zoomOutBtn = new Button(); zoomOutBtn.setIcon(new ThemeResource("images/minus.png")); zoomOutBtn.setDescription("Collapse Semantic Zoom Level"); zoomOutBtn.setStyleName("semantic-zoom-button"); zoomOutBtn.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { int szl = (Integer) m_graphContainer.getSemanticZoomLevel(); if (szl > 0) { szl--; m_graphContainer.setSemanticZoomLevel(szl); setSemanticZoomLevel(szl); saveHistory(); } } }); final Button panBtn = new Button(); panBtn.setIcon(new ThemeResource("images/cursor_drag_arrow.png")); panBtn.setDescription("Pan Tool"); panBtn.setStyleName("toolbar-button down"); final Button selectBtn = new Button(); selectBtn.setIcon(new ThemeResource("images/selection.png")); selectBtn.setDescription("Selection Tool"); selectBtn.setStyleName("toolbar-button"); selectBtn.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { selectBtn.setStyleName("toolbar-button down"); panBtn.setStyleName("toolbar-button"); m_topologyComponent.setActiveTool("select"); } }); panBtn.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { panBtn.setStyleName("toolbar-button down"); selectBtn.setStyleName("toolbar-button"); m_topologyComponent.setActiveTool("pan"); } }); VerticalLayout toolbar = new VerticalLayout(); toolbar.setWidth("31px"); toolbar.addComponent(panBtn); toolbar.addComponent(selectBtn); HorizontalLayout semanticLayout = new HorizontalLayout(); semanticLayout.addComponent(zoomInBtn); semanticLayout.addComponent(m_zoomLevelLabel); semanticLayout.addComponent(zoomOutBtn); semanticLayout.setComponentAlignment(m_zoomLevelLabel, Alignment.MIDDLE_CENTER); AbsoluteLayout mapLayout = new AbsoluteLayout(); mapLayout.addComponent(m_topologyComponent, "top:0px; left: 0px; right: 0px; bottom: 0px;"); mapLayout.addComponent(slider, "top: 5px; left: 20px; z-index:1000;"); mapLayout.addComponent(toolbar, "top: 324px; left: 12px;"); mapLayout.addComponent(semanticLayout, "top: 380px; left: 2px;"); mapLayout.setSizeFull(); m_treeMapSplitPanel = new HorizontalSplitPanel(); m_treeMapSplitPanel.setFirstComponent(createWestLayout()); m_treeMapSplitPanel.setSecondComponent(mapLayout); m_treeMapSplitPanel.setSplitPosition(222, Sizeable.UNITS_PIXELS); m_treeMapSplitPanel.setSizeFull(); m_commandManager.addCommandUpdateListener(this); menuBarUpdated(m_commandManager); if (m_widgetManager.widgetCount() != 0) { updateWidgetView(m_widgetManager); } else { m_layout.addComponent(m_treeMapSplitPanel, getBelowMenuPosition()); } if (m_treeWidgetManager.widgetCount() != 0) { updateAccordionView(m_treeWidgetManager); } }
From source file:org.opennms.features.vaadin.dashboard.ui.dashboard.DashboardBody.java
License:Open Source License
private Panel createPanel(Component content, String caption) { Panel panel = new Panel(); panel.setSizeFull();/* w w w . ja va 2 s. c o m*/ panel.setCaption(caption); panel.setContent(content); panel.addStyleName("novscroll"); return panel; }
From source file:org.s23m.cell.editor.semanticdomain.ui.components.ContainmentTreePanel.java
License:Mozilla Public License
private Panel createSearchPanel() { final Panel searchPanel = new Panel(); final HorizontalLayout searchLayout = new HorizontalLayout(); searchLayout.setWidth(TAB_SHEET_HEIGHT_RATIO); searchLayout.setSpacing(true);/*from w ww . j av a 2s .c om*/ searchPanel.addStyleName(Runo.PANEL_LIGHT); searchPanel.getLayout().setMargin(true); searchPanel.setLayout(searchLayout); searchText = new TextField(); searchText.setWidth(TAB_SHEET_HEIGHT_RATIO); final Button searchBtn = new Button(); searchBtn.setDescription("Search"); searchBtn.setClickShortcut(KeyCode.ENTER); searchBtn.setIcon(EditorIcon.SEARCH.getIconImage()); searchBtn.setWidth(null); searchBtn.addListener(Button.ClickEvent.class, this, INSTANCE_SEARCH_CMD); searchPanel.addComponent(searchText); searchPanel.addComponent(searchBtn); searchLayout.setExpandRatio(searchText, SEARCH_TEXT_EXPANSION_RATIO); return searchPanel; }