List of usage examples for com.vaadin.ui TabSheet setSizeFull
@Override public void setSizeFull()
From source file:org.opennms.features.vaadin.nodemaps.internal.NodeMapsApplication.java
License:Open Source License
/** * Gets a {@link TabSheet} view for all widgets in this manager. * // w w w . jav a 2s. com * @return TabSheet */ private Component getTabSheet() { // Use an absolute layout for the bottom panel AbsoluteLayout bottomLayout = new AbsoluteLayout(); bottomLayout.setSizeFull(); final TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull(); for (final SelectionAwareTable view : new SelectionAwareTable[] { m_alarmTable, m_nodeTable }) { // Icon can be null tabSheet.addTab(view, (view == m_alarmTable ? "Alarms" : "Nodes"), null); // If the component supports the HasExtraComponents interface, then add the extra // components to the tab bar try { final Component[] extras = ((HasExtraComponents) view).getExtraComponents(); if (extras != null && extras.length > 0) { // For any extra controls, add a horizontal layout that will float // on top of the right side of the tab panel final HorizontalLayout extraControls = new HorizontalLayout(); extraControls.setHeight(32, Unit.PIXELS); extraControls.setSpacing(true); // Add the extra controls to the layout for (final Component component : extras) { extraControls.addComponent(component); extraControls.setComponentAlignment(component, Alignment.MIDDLE_RIGHT); } // Add a TabSheet.SelectedTabChangeListener to show or hide the extra controls tabSheet.addSelectedTabChangeListener(new SelectedTabChangeListener() { @Override public void selectedTabChange(final SelectedTabChangeEvent event) { final TabSheet source = (TabSheet) event.getSource(); if (source == tabSheet) { // Bizarrely enough, getSelectedTab() returns the contained // Component, not the Tab itself. // // If the first tab was selected... if (source.getSelectedTab() == view) { extraControls.setVisible(true); } else { extraControls.setVisible(false); } } } }); // Place the extra controls on the absolute layout bottomLayout.addComponent(extraControls, "top:0px;right:5px;z-index:100"); } } catch (ClassCastException e) { } view.setSizeFull(); } // Add the tabsheet to the layout bottomLayout.addComponent(tabSheet, "top: 0; left: 0; bottom: 0; right: 0;"); return bottomLayout; }
From source file:org.ow2.sirocco.cloudmanager.MachineDetailView.java
License:Open Source License
public MachineDetailView(final MachineView machineView) { this.machineView = machineView; this.setSizeFull(); this.setSpacing(true); this.setMargin(true); this.addStyleName("detailmargins"); this.setVisible(false); this.title = new Label(); this.title.setStyleName("detailTitle"); this.addComponent(this.title); TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull(); VerticalLayout attributeTab = new VerticalLayout(); attributeTab.setSizeFull();/* w ww . j a va 2s. c o m*/ this.attributeTable = new Table(); attributeTab.addComponent(this.attributeTable); this.attributeTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); this.attributeTable.setSizeFull(); this.attributeTable.setPageLength(0); this.attributeTable.setSelectable(false); this.attributeTable.addContainerProperty("attribute", String.class, null); this.attributeTable.addContainerProperty("value", String.class, null); this.attributeTable.addContainerProperty("edit", Button.class, null); this.attributeTable.setColumnWidth("edit", 400); tabSheet.addTab(attributeTab, "Attributes"); this.metadataView = new MetadataView(this); tabSheet.addTab(this.metadataView, "Metadata"); this.addComponent(tabSheet); this.setExpandRatio(tabSheet, 1.0f); }
From source file:org.ow2.sirocco.cloudmanager.MachineImageDetailView.java
License:Open Source License
public MachineImageDetailView(final MachineImageView machineImageView) { this.machineImageView = machineImageView; this.setSizeFull(); this.setSpacing(true); this.setMargin(true); this.addStyleName("detailmargins"); this.setVisible(false); this.title = new Label(); this.title.setStyleName("detailTitle"); this.addComponent(this.title); TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull(); VerticalLayout attributeTab = new VerticalLayout(); attributeTab.setSizeFull();/*from ww w .j a v a 2 s . c o m*/ this.attributeTable = new Table(); attributeTab.addComponent(this.attributeTable); this.attributeTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); this.attributeTable.setSizeFull(); this.attributeTable.setPageLength(0); this.attributeTable.setSelectable(false); this.attributeTable.addContainerProperty("attribute", String.class, null); this.attributeTable.addContainerProperty("value", String.class, null); this.attributeTable.addContainerProperty("edit", Button.class, null); this.attributeTable.setColumnWidth("edit", 400); tabSheet.addTab(attributeTab, "Attributes"); this.metadataView = new MetadataView(this); tabSheet.addTab(this.metadataView, "Metadata"); this.addComponent(tabSheet); this.setExpandRatio(tabSheet, 1.0f); }
From source file:org.ow2.sirocco.cloudmanager.ProviderAccountDetailView.java
License:Open Source License
public ProviderAccountDetailView(final CloudProviderView providerView) { this.providerView = providerView; this.setSizeFull(); this.setSpacing(true); this.setMargin(true); this.addStyleName("detailmargins"); this.setVisible(false); this.title = new Label(); this.title.setStyleName("detailTitle"); this.addComponent(this.title); TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull(); VerticalLayout attributeTab = new VerticalLayout(); attributeTab.setSizeFull();// w ww . ja va2s.c om this.attributeTable = new Table(); attributeTab.addComponent(this.attributeTable); this.attributeTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); this.attributeTable.setSizeFull(); this.attributeTable.setPageLength(0); this.attributeTable.setSelectable(false); this.attributeTable.addContainerProperty("attribute", String.class, null); this.attributeTable.addContainerProperty("value", String.class, null); this.attributeTable.addContainerProperty("edit", Button.class, null); this.attributeTable.setColumnWidth("edit", 400); tabSheet.addTab(attributeTab, "Attributes"); this.metadataView = new MetadataView(this); tabSheet.addTab(this.metadataView, "Metadata"); this.addComponent(tabSheet); this.setExpandRatio(tabSheet, 1.0f); }
From source file:org.ow2.sirocco.cloudmanager.SecurityGroupDetailView.java
License:Open Source License
public SecurityGroupDetailView(final SecurityGroupView securityGroupView) { this.securityGroupView = securityGroupView; this.setSizeFull(); this.setSpacing(true); this.setMargin(true); this.addStyleName("detailmargins"); this.setVisible(false); this.title = new Label(); this.title.setStyleName("detailTitle"); this.addComponent(this.title); TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull(); VerticalLayout attributeTab = new VerticalLayout(); attributeTab.setSizeFull();/*w w w. j av a 2 s . c o m*/ this.attributeTable = new Table(); attributeTab.addComponent(this.attributeTable); this.attributeTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); this.attributeTable.setSizeFull(); this.attributeTable.setPageLength(0); this.attributeTable.setSelectable(false); this.attributeTable.addContainerProperty("attribute", String.class, null); this.attributeTable.addContainerProperty("value", String.class, null); this.attributeTable.addContainerProperty("edit", Button.class, null); this.attributeTable.setColumnWidth("edit", 400); tabSheet.addTab(attributeTab, "Attributes"); this.ruleView = new SecurityGroupRuleView(); tabSheet.addTab(this.ruleView, "Rules"); this.addComponent(tabSheet); this.setExpandRatio(tabSheet, 1.0f); }
From source file:org.sensorhub.ui.GenericConfigForm.java
License:Mozilla Public License
protected Component buildTabs(final String propId, final ContainerProperty prop, final FieldGroup fieldGroup) { GridLayout layout = new GridLayout(); layout.setWidth(100.0f, Unit.PERCENTAGE); // title bar//from w w w .ja v a 2 s. c om HorizontalLayout titleBar = new HorizontalLayout(); titleBar.setMargin(new MarginInfo(true, false, false, false)); titleBar.setSpacing(true); String label = prop.getLabel(); if (label == null) label = DisplayUtils.getPrettyName((String) propId); Label sectionLabel = new Label(label); sectionLabel.setDescription(prop.getDescription()); sectionLabel.addStyleName(STYLE_H3); sectionLabel.addStyleName(STYLE_COLORED); titleBar.addComponent(sectionLabel); layout.addComponent(titleBar); // create one tab per item in container final MyBeanItemContainer<Object> container = prop.getValue(); final TabSheet tabs = new TabSheet(); tabs.setSizeFull(); int i = 1; for (Object itemId : container.getItemIds()) { MyBeanItem<Object> childBeanItem = (MyBeanItem<Object>) container.getItem(itemId); IModuleConfigForm subform = AdminUI.getInstance().generateForm(childBeanItem.getBean().getClass()); subform.build(null, childBeanItem); ((MarginHandler) subform).setMargin(new MarginInfo(true, false, true, false)); allForms.add(subform); Tab tab = tabs.addTab(subform, "Item #" + (i++)); tab.setClosable(true); // store item id so we can map a tab with the corresponding bean item ((AbstractComponent) subform).setData(itemId); } // draw icon on last tab to add new items tabs.addTab(new VerticalLayout(), "", UIConstants.ADD_ICON); // catch close event to delete item tabs.setCloseHandler(new CloseHandler() { private static final long serialVersionUID = 1L; @Override public void onTabClose(TabSheet tabsheet, Component tabContent) { final Tab tab = tabs.getTab(tabContent); final ConfirmDialog popup = new ConfirmDialog( "Are you sure you want to delete " + tab.getCaption() + "?</br>All settings will be lost."); popup.addCloseListener(new CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(CloseEvent e) { if (popup.isConfirmed()) { // retrieve id of item shown on tab AbstractComponent tabContent = (AbstractComponent) tab.getComponent(); Object itemId = tabContent.getData(); // remove from UI int deletedTabPos = tabs.getTabPosition(tab); tabs.removeTab(tab); tabs.setSelectedTab(deletedTabPos - 1); // remove from container container.removeItem(itemId); } } }); popup.setModal(true); AdminUI.getInstance().addWindow(popup); } }); // catch select event on '+' tab to add new item tabs.addSelectedTabChangeListener(new SelectedTabChangeListener() { private static final long serialVersionUID = 1L; public void selectedTabChange(SelectedTabChangeEvent event) { Component selectedTab = event.getTabSheet().getSelectedTab(); final Tab tab = tabs.getTab(selectedTab); final int selectedTabPos = tabs.getTabPosition(tab); // case of + tab to add new item if (tab.getCaption().equals("")) { tabs.setSelectedTab(selectedTabPos - 1); try { // show popup to select among available module types String title = "Please select the desired option"; Map<String, Class<?>> typeList = GenericConfigForm.this.getPossibleTypes(propId); ObjectTypeSelectionPopup popup = new ObjectTypeSelectionPopup(title, typeList, new ObjectTypeSelectionCallback() { public void typeSelected(Class<?> objectType) { try { // add new item to container MyBeanItem<Object> childBeanItem = container.addBean( objectType.newInstance(), ((String) propId) + PROP_SEP); // generate form for new item IModuleConfigForm subform = AdminUI.getInstance() .generateForm(childBeanItem.getBean().getClass()); subform.build(null, childBeanItem); ((MarginHandler) subform) .setMargin(new MarginInfo(true, false, true, false)); allForms.add(subform); // add new tab and select it Tab newTab = tabs.addTab(subform, "Item #" + (selectedTabPos + 1), null, selectedTabPos); newTab.setClosable(true); tabs.setSelectedTab(newTab); } catch (Exception e) { Notification.show("Error", e.getMessage(), Notification.Type.ERROR_MESSAGE); } } }); popup.setModal(true); AdminUI.getInstance().addWindow(popup); } catch (Exception e) { e.printStackTrace(); } } } }); // also register commit handler fieldGroup.addCommitHandler(new CommitHandler() { private static final long serialVersionUID = 1L; @Override public void preCommit(CommitEvent commitEvent) throws CommitException { } @Override public void postCommit(CommitEvent commitEvent) throws CommitException { // make sure new items are transfered to model prop.setValue(prop.getValue()); } }); layout.addComponent(tabs); return layout; }
From source file:org.tltv.gantt.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { ganttListener = null;//from ww w . j av a 2 s .c o m createGantt(); MenuBar menu = controlsMenuBar(); Panel controls = createControls(); TabSheet tabsheet = new TabSheet(); tabsheet.setSizeFull(); Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment(UI.getCurrent().getPage().getUriFragment(), gantt); if (wrapper instanceof GanttListener) { ganttListener = (GanttListener) wrapper; } final VerticalLayout layout = new VerticalLayout(); layout.setStyleName("demoContentLayout"); layout.setSizeFull(); layout.addComponent(menu); layout.addComponent(controls); layout.addComponent(wrapper); layout.setExpandRatio(wrapper, 1); setContent(layout); }
From source file:org.vaadin.addon.borderlayout.BorderlayoutUI.java
@Override protected void init(VaadinRequest request) { TabSheet tabs = new TabSheet(); tabs.setSizeFull(); setContent(tabs);/* w w w .ja v a2 s. co m*/ tabs.addTab(getSimpleExamle(), "Basic functionality"); tabs.addTab(getAnotherExample(), "Sequential add"); }
From source file:org.vaadin.addon.twitter.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { Responsive.makeResponsive(this); CssLayout info = new CssLayout(); info.setStyleName("tw-docs"); info.addComponent(markdown.get(0));//from w w w . ja va 2s. c o m TabSheet tabSheet = new TabSheet(); tabSheet.setStyleName("tw-demo-tab"); tabSheet.addStyleName(ValoTheme.TABSHEET_CENTERED_TABS); tabSheet.setSizeFull(); tabSheet.addTab(new TimelineDemo()).setCaption("Timeline"); tabSheet.addTab(new TweetDemo()).setCaption("Single Tweet"); tabSheet.addTab(new ButtonDemo(TweetButton.Type.Follow)).setCaption("Follow Button"); tabSheet.addTab(new ButtonDemo(TweetButton.Type.Share)).setCaption("Share Button"); tabSheet.addTab(new ButtonDemo(TweetButton.Type.Hashtag)).setCaption("Hashtag Button"); tabSheet.addTab(new ButtonDemo(TweetButton.Type.Mention)).setCaption("Mention Button"); tabSheet.addSelectedTabChangeListener(event -> { Component old = info.getComponent(0); Component newComp = markdown.get(tabSheet.getTabPosition(tabSheet.getTab(tabSheet.getSelectedTab()))); info.replaceComponent(old, newComp); }); final MHorizontalLayout layout = new MHorizontalLayout(info, tabSheet).withExpand(info, 4) .withExpand(tabSheet, 6).withFullWidth().withFullHeight().withMargin(false).withSpacing(true); setContent(new MPanel(layout).withFullWidth().withFullHeight().withStyleName(ValoTheme.PANEL_WELL, "root-container")); }
From source file:org.vaadin.alump.fancylayouts.demo.FancyLayoutsUI.java
License:Apache License
private ComponentContainer buildLayout() { CssLayout topLayout = new CssLayout(); topLayout.setSizeFull();// w w w.j a v a 2 s . co m TabSheet tabs = new TabSheet(); topLayout.addComponent(tabs); tabs.setSizeFull(); tabs.addTab(buildWelcome(), "Welcome"); tabs.addTab(new ImageDemo(), "FancyImage"); tabs.addTab(new PanelDemo(), "FancyPanel"); tabs.addTab(new CssLayoutDemo(), "FancyLayout"); NotificationsDemo notDemo = new NotificationsDemo(); tabs.addTab(notDemo, "FancyNotifications"); // Add notification to top most UI elements you have. Then just give it // as reference to child components. notifications = new FancyNotifications(); topLayout.addComponent(notifications); notDemo.init(notifications); return topLayout; }