List of usage examples for com.vaadin.ui Panel setContent
@Override public void setContent(Component content)
From source file:org.jumpmind.metl.ui.mapping.EditMappingPanel.java
License:Open Source License
protected void buildUI() { if (!readOnly) { ButtonBar buttonBar = new ButtonBar(); addComponent(buttonBar);/* w w w .j a v a 2s.c o m*/ Button autoMapButton = buttonBar.addButton("Auto Map", FontAwesome.FLASH); removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O); removeButton.setEnabled(false); autoMapButton.addClickListener(new AutoMapListener()); removeButton.addClickListener(new RemoveListener()); } HorizontalLayout titleHeader = new HorizontalLayout(); titleHeader.setSpacing(true); titleHeader.setMargin(new MarginInfo(false, true, false, true)); titleHeader.setWidth(100f, Unit.PERCENTAGE); titleHeader.addComponent(new Label( "<b>Input Model:</b> " + (component.getInputModel() != null ? component.getInputModel().getName() : "?"), ContentMode.HTML)); titleHeader.addComponent(new Label( "<b>Output Model:</b> " + (component.getOutputModel() != null ? component.getOutputModel().getName() : "?"), ContentMode.HTML)); addComponent(titleHeader); HorizontalLayout filterHeader = new HorizontalLayout(); filterHeader.setSpacing(true); filterHeader.setMargin(new MarginInfo(true, true, true, true)); filterHeader.setWidth(100f, Unit.PERCENTAGE); HorizontalLayout srcFilterHeader = new HorizontalLayout(); srcFilterHeader.setSpacing(true); srcFilterHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); filterHeader.addComponent(srcFilterHeader); HorizontalLayout dstFilterHeader = new HorizontalLayout(); dstFilterHeader.setSpacing(true); dstFilterHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); filterHeader.addComponent(dstFilterHeader); addComponent(filterHeader); srcTextFilter = new TextField(); srcTextFilter.setInputPrompt("Filter"); srcTextFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); srcTextFilter.setIcon(FontAwesome.SEARCH); srcTextFilter.setImmediate(true); srcTextFilter.setTextChangeEventMode(TextChangeEventMode.LAZY); srcTextFilter.setTextChangeTimeout(200); srcTextFilter.addTextChangeListener(new FilterInputTextListener()); srcFilterHeader.addComponent(srcTextFilter); srcMapFilter = new CheckBox("Mapped Only"); srcMapFilter.addValueChangeListener(new FilterSrcMapListener()); srcFilterHeader.addComponent(srcMapFilter); dstTextFilter = new TextField(); dstTextFilter.setInputPrompt("Filter"); dstTextFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); dstTextFilter.setIcon(FontAwesome.SEARCH); dstTextFilter.setImmediate(true); dstTextFilter.setTextChangeEventMode(TextChangeEventMode.LAZY); dstTextFilter.setTextChangeTimeout(200); dstTextFilter.addTextChangeListener(new FilterOutputTextListener()); dstFilterHeader.addComponent(dstTextFilter); dstMapFilter = new CheckBox("Mapped Only"); dstMapFilter.addValueChangeListener(new FilterDstMapListener()); dstFilterHeader.addComponent(dstMapFilter); Panel panel = new Panel(); VerticalLayout vlay = new VerticalLayout(); vlay.setSizeFull(); diagram = new MappingDiagram(context, component, readOnly); diagram.setSizeFull(); vlay.addComponent(diagram); panel.setContent(vlay); panel.setSizeFull(); addComponent(panel); setExpandRatio(panel, 1.0f); diagram.addListener(new EventListener()); }
From source file:org.jumpmind.metl.ui.views.deploy.FlowSelectWindow.java
License:Open Source License
@SuppressWarnings({ "serial" }) public FlowSelectWindow(ApplicationContext context, String caption, String introText, boolean includeTestFlows) { super(caption); this.context = context; tree.setMultiSelect(true);// w w w.j a v a 2s. c o m tree.addContainerProperty("name", String.class, ""); tree.setItemCaptionPropertyId("name"); tree.setItemCaptionMode(ItemCaptionMode.PROPERTY); tree.addExpandListener(new ExpandListener() { public void nodeExpand(ExpandEvent event) { Object itemId = event.getItemId(); if (itemId instanceof ProjectVersion) { addFlowsToVersion((ProjectVersion) itemId, includeTestFlows); } } }); addProjects(); setWidth(600.0f, Unit.PIXELS); setHeight(600.0f, Unit.PIXELS); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.setSizeFull(); layout.addComponent(new Label(introText)); Panel scrollable = new Panel(); scrollable.addStyleName(ValoTheme.PANEL_BORDERLESS); scrollable.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR); scrollable.setSizeFull(); scrollable.setContent(tree); layout.addComponent(scrollable); layout.setExpandRatio(scrollable, 1.0f); addComponent(layout, 1); Button cancelButton = new Button("Cancel"); Button selectButton = new Button("Select"); addComponent(buildButtonFooter(cancelButton, selectButton)); cancelButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { close(); } }); selectButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { Collection<FlowName> flowCollection = getFlowCollection(includeTestFlows); listener.selected(flowCollection); close(); } }); }
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);// ww w .j a va 2s . co 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.jumpmind.vaadin.ui.sqlexplorer.SqlExplorer.java
License:Open Source License
public SqlExplorer(String configDir, IDbProvider databaseProvider, ISettingsProvider settingsProvider, String user, float leftSplitSize, IDbMenuItem... additionalMenuItems) { this.databaseProvider = databaseProvider; this.settingsProvider = settingsProvider; this.savedSplitPosition = leftSplitSize; this.additionalMenuItems = additionalMenuItems; setSizeFull();//from ww w .j a v a 2s .c o m addStyleName("sqlexplorer"); VerticalLayout leftLayout = new VerticalLayout(); leftLayout.setSizeFull(); leftLayout.addStyleName(ValoTheme.MENU_ROOT); leftLayout.addComponent(buildLeftMenu()); Panel scrollable = new Panel(); scrollable.setSizeFull(); dbTree = buildDbTree(); scrollable.setContent(dbTree); leftLayout.addComponent(scrollable); leftLayout.setExpandRatio(scrollable, 1); VerticalLayout rightLayout = new VerticalLayout(); rightLayout.setSizeFull(); VerticalLayout rightMenuWrapper = new VerticalLayout(); rightMenuWrapper.setWidth(100, Unit.PERCENTAGE); rightMenuWrapper.addStyleName(ValoTheme.MENU_ROOT); contentMenuBar = new MenuBar(); contentMenuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); contentMenuBar.setWidth(100, Unit.PERCENTAGE); addShowButton(contentMenuBar); rightMenuWrapper.addComponent(contentMenuBar); rightLayout.addComponent(rightMenuWrapper); contentTabs = new SqlExplorerTabPanel(); contentTabs.addSelectedTabChangeListener(new SelectedTabChangeListener() { private static final long serialVersionUID = 1L; @Override public void selectedTabChange(SelectedTabChangeEvent event) { selectContentTab((IContentTab) contentTabs.getSelectedTab()); } }); rightLayout.addComponent(contentTabs); rightLayout.setExpandRatio(contentTabs, 1); addComponents(leftLayout, rightLayout); setSplitPosition(savedSplitPosition, Unit.PIXELS); }
From source file:org.jumpmind.vaadin.ui.sqlexplorer.SqlRunner.java
License:Open Source License
protected Component wrapTextInComponent(String text, String style) { Panel panel = new Panel(); VerticalLayout content = new VerticalLayout(); content.setMargin(true);/* www.j a v a 2s.c om*/ panel.setContent(content); Label label = new Label("<pre>" + text.toString() + "</pre>", ContentMode.HTML); if (StringUtils.isNotBlank(style)) { label.setStyleName(style); } content.addComponent(label); return panel; }
From source file:org.lucidj.accounts.AccountsView.java
License:Apache License
private Panel local_accounts() { Panel p = new Panel("Local accounts"); VerticalLayout content = new VerticalLayout(); p.setContent(content); content.setSpacing(true);/*from w ww . ja v a 2s. com*/ content.setMargin(true); content.addComponent(new Label("You can test the loading indicator by pressing the buttons.")); content.addComponent(new Button("Hello world!")); return (p); }
From source file:org.lucidj.explorer.ExplorerView.java
License:Apache License
private Panel new_shortcuts_panel(String title) { Panel new_panel = new Panel(title); new_panel.setWidth(100, Unit.PERCENTAGE); new_panel.setContent(new Label("Empty.")); return (new_panel); }
From source file:org.lucidj.explorer.ExplorerView.java
License:Apache License
private void build_explorer_view() { setMargin(true);/* w w w .ja v a 2 s .co m*/ setSpacing(true); List<Map<String, Object>> components = new ArrayList<>(); if (System.getProperty("user.conf") != null) { components.add(new_component("My Home", System.getProperty("user.home"), "places/user-home")); } components.add(new_component("My Files", userdir.toString(), "places/folder")); components.add(new_component("LucidJ Home", System.getProperty("system.home"), "places/folder-script")); components.add(new_component("Applications", System.getProperty("system.home") + "/system/apps", "apps/preferences-desktop-icons")); // components.add (new_component ("Your Unbelievable Projects", "org.Buga", "places/folder-development")); // components.add (new_component ("Strange Project", "org.Buga", "some awkward thing")); Panel bookmarks = new Panel("Bookmarks"); bookmarks.setWidth(100, Unit.PERCENTAGE); ObjectRenderer component_renderer = rendererFactory.newRenderer(components); bookmarks.setContent(component_renderer); bookmarks.setWidth(100, Unit.PERCENTAGE); addComponent(bookmarks); component_renderer.addListener(new Listener() { @Override public void componentEvent(Event event) { log.info("[EVENT] ====> {}", event); if (event instanceof LayoutEvents.LayoutClickEvent) { LayoutEvents.LayoutClickEvent layoutClickEvent = (LayoutEvents.LayoutClickEvent) event; if (layoutClickEvent.isDoubleClick()) { log.info("**--DOUBLE-CLICK--** component => {}", layoutClickEvent.getClickedComponent()); fireEvent(layoutClickEvent); } } else if (event instanceof Button.ClickEvent) { Button.ClickEvent clickEvent = (Button.ClickEvent) event; log.info("**--CLICK--** CLICK! component = {}", clickEvent.getButton()); AbstractComponent c = clickEvent.getButton(); if (c.getData() instanceof Map) { Map<String, Object> data = (Map<String, Object>) c.getData(); log.info("Component Data = {}", data); if (data.containsKey("directory")) { log.info("---> BROWSE DIR: {}", data.get("directory")); view_directory(data); } } } } }); HorizontalLayout browse_and_shortcuts = new HorizontalLayout(); browse_and_shortcuts.setWidth(100, Unit.PERCENTAGE); browse_and_shortcuts.setSpacing(true); browse_files = new Panel("Your files"); browse_files.setWidth(100, Unit.PERCENTAGE); // Show the first directory view_directory(components.get(0)); browse_and_shortcuts.addComponent(browse_files); VerticalLayout shortcuts = new VerticalLayout(); shortcuts.setSpacing(true); Panel today_last_opened = new_shortcuts_panel("Today"); shortcuts.addComponent(today_last_opened); Panel this_week_last_opened = new_shortcuts_panel("Yesterday"); shortcuts.addComponent(this_week_last_opened); Panel full_history = new_shortcuts_panel("History"); shortcuts.addComponent(full_history); browse_and_shortcuts.addComponent(shortcuts); addComponent(browse_and_shortcuts); }
From source file:org.lucidj.newview.NewView.java
License:Apache License
private Component form_type_panel() { HorizontalLayout group = new HorizontalLayout(); group.setWidth(100, Unit.PERCENTAGE); group.setCaption("Artifact type"); Map<String, Object> component = new HashMap<>(); component.put("iconTitle", "LucidJ Application"); component.put("iconUrl", "apps/system-run"); List<Map<String, Object>> components = new ArrayList<>(); components.add(component);//from w w w . j ava 2 s.c o m ObjectRenderer component_renderer = rendererFactory.newRenderer(components); component_renderer.setWidth(100, Unit.PERCENTAGE); Panel field_panel = new Panel(); field_panel.setWidth(100, Unit.PERCENTAGE); field_panel.setContent(component_renderer); group.addComponent(field_panel); return (group); }
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); content_panel.addStyleName("ui-panel-contents"); content_panel.addStyleName(ValoTheme.PANEL_BORDERLESS); container.addComponent(content_panel); caption_button.addClickListener(new Button.ClickListener() { @Override/*from w w w . ja v a 2 s .c om*/ 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); } } }); }