List of usage examples for com.vaadin.ui CssLayout setSizeFull
@Override public void setSizeFull()
From source file:com.mycollab.module.file.view.components.AbstractResourceMovingWindow.java
License:Open Source License
private void constructBody() { MVerticalLayout contentLayout = new MVerticalLayout(); new Restrain(contentLayout).setMaxHeight("600px"); this.setContent(contentLayout); folderTree = new Tree(); folderTree.setMultiSelect(false);//w ww . j av a 2 s. co m folderTree.setSelectable(true); folderTree.setImmediate(true); folderTree.setSizeFull(); folderTree.addExpandListener(new Tree.ExpandListener() { private static final long serialVersionUID = 1L; @Override public void nodeExpand(final ExpandEvent event) { final Folder expandFolder = (Folder) event.getItemId(); // load externalResource if currentExpandFolder is rootFolder if (baseFolder.getPath().equals(expandFolder.getPath())) { List<ExternalDrive> externalDrives = externalDriveService .getExternalDrivesOfUser(AppContext.getUsername()); for (ExternalDrive externalDrive : externalDrives) { ExternalFolder externalMapFolder = new ExternalFolder("/"); externalMapFolder.setStorageName(externalDrive.getStoragename()); externalMapFolder.setExternalDrive(externalDrive); externalMapFolder.setName(externalDrive.getFoldername()); Calendar cal = GregorianCalendar.getInstance(); cal.setTime(externalDrive.getCreatedtime()); externalMapFolder.setCreated(cal); expandFolder.addChild(externalMapFolder); folderTree.addItem(externalMapFolder); folderTree.setItemIcon(externalMapFolder, FontAwesome.DROPBOX); folderTree.setItemCaption(externalMapFolder, externalMapFolder.getName()); folderTree.setParent(externalMapFolder, expandFolder); } } if (expandFolder instanceof ExternalFolder) { List<ExternalFolder> subFolders = externalResourceService.getSubFolders( ((ExternalFolder) expandFolder).getExternalDrive(), expandFolder.getPath()); for (final Folder subFolder : subFolders) { expandFolder.addChild(subFolder); folderTree.addItem(subFolder); folderTree.setItemIcon(subFolder, FontAwesome.DROPBOX); folderTree.setItemCaption(subFolder, subFolder.getName()); folderTree.setParent(subFolder, expandFolder); } } else { final List<Folder> subFolders = resourceService.getSubFolders(expandFolder.getPath()); folderTree.setItemIcon(expandFolder, FontAwesome.FOLDER_OPEN); if (subFolders != null) { for (final Folder subFolder : subFolders) { String subFolderName = subFolder.getName(); if (!subFolderName.startsWith(".")) { expandFolder.addChild(subFolder); folderTree.addItem(subFolder); folderTree.setItemIcon(subFolder, FontAwesome.FOLDER); folderTree.setItemCaption(subFolder, subFolderName); folderTree.setParent(subFolder, expandFolder); } } } } } }); folderTree.addCollapseListener(new Tree.CollapseListener() { private static final long serialVersionUID = 1L; @Override public void nodeCollapse(final CollapseEvent event) { final Folder collapseFolder = (Folder) event.getItemId(); if (collapseFolder instanceof ExternalFolder) { folderTree.setItemIcon(collapseFolder, FontAwesome.DROPBOX); } else { folderTree.setItemIcon(collapseFolder, FontAwesome.FOLDER); } for (Folder folder : collapseFolder.getChilds()) { recursiveRemoveSubItem(folder); } } private void recursiveRemoveSubItem(Folder collapseFolder) { List<Folder> childFolders = collapseFolder.getChilds(); if (childFolders.size() > 0) { for (Folder subFolder : childFolders) { recursiveRemoveSubItem(subFolder); } folderTree.removeItem(collapseFolder); } else { folderTree.removeItem(collapseFolder); } } }); folderTree.addItemClickListener(new ItemClickEvent.ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final ItemClickEvent event) { baseFolder = (Folder) event.getItemId(); } }); CssLayout treeWrapper = new CssLayout(folderTree); treeWrapper.setSizeFull(); contentLayout.addComponent(treeWrapper); displayFiles(); MHorizontalLayout controlGroupBtnLayout = new MHorizontalLayout(); Button moveBtn = new Button("Move", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (!CollectionUtils.isEmpty(movedResources)) { boolean checkingFail = false; for (Resource res : movedResources) { try { resourceMover.moveResource(res, baseFolder, AppContext.getUsername(), AppContext.getAccountId()); } catch (Exception e) { checkingFail = true; LOG.error("Error", e); } } close(); displayAfterMoveSuccess(baseFolder, checkingFail); } } }); moveBtn.setIcon(FontAwesome.ARROWS); moveBtn.addStyleName(UIConstants.BUTTON_ACTION); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { close(); } }); cancelBtn.addStyleName(UIConstants.BUTTON_OPTION); controlGroupBtnLayout.with(cancelBtn, moveBtn); contentLayout.with(controlGroupBtnLayout).withAlign(controlGroupBtnLayout, Alignment.MIDDLE_RIGHT); }
From source file:com.mycollab.vaadin.web.ui.AttachmentDisplayComponent.java
License:Open Source License
private void addAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }/*from ww w. j a va 2s . c o m*/ final AbsoluteLayout attachmentLayout = new AbsoluteLayout(); attachmentLayout.setWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); attachmentLayout.setHeight(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_HEIGHT); attachmentLayout.setStyleName("attachment-block"); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setSizeFull(); thumbnailWrap.setStyleName("thumbnail-wrap"); Link thumbnail = new Link(); if (StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setIcon(FileAssetsUtil.getFileIconResource(attachment.getName())); } else { thumbnail.setIcon(VaadinResourceFactory.getResource(attachment.getThumbnail())); } if (MimeTypesUtil.isImageType(docName)) { thumbnail.setResource(VaadinResourceFactory.getResource(attachment.getPath())); new Fancybox(thumbnail).setPadding(0).setVersion("2.1.5").setEnabled(true).setDebug(true); } Div contentTooltip = new Div().appendChild(new Span().appendText(docName).setStyle("font-weight:bold")); Ul ul = new Ul().appendChild(new Li().appendText(UserUIContext.getMessage(FileI18nEnum.OPT_SIZE_VALUE, FileUtils.getVolumeDisplay(attachment.getSize())))).setStyle("line-height:1.5em"); ul.appendChild(new Li().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_LAST_MODIFIED, UserUIContext.formatPrettyTime(attachment.getLastModified().getTime())))); contentTooltip.appendChild(ul); thumbnail.setDescription(contentTooltip.write()); thumbnail.setWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap, "top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 0;"); MCssLayout attachmentNameWrap = new MCssLayout() .withWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH).withStyleName("attachment-name-wrap"); Label attachmentName = new ELabel(docName).withStyleName(UIConstants.TEXT_ELLIPSIS); attachmentNameWrap.addComponent(attachmentName); attachmentLayout.addComponent(attachmentNameWrap, "bottom: 0px; left: 0px; right: 0px; z-index: 1;"); MButton trashBtn = new MButton("", clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { ResourceService attachmentService = AppContextUtil.getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), UserUIContext.getUsername(), true, MyCollabUI.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()).removeComponent(attachmentLayout); } }); }).withIcon(FontAwesome.TRASH_O).withStyleName("attachment-control"); attachmentLayout.addComponent(trashBtn, "top: 9px; left: 9px; z-index: 1;"); MButton downloadBtn = new MButton().withIcon(FontAwesome.DOWNLOAD).withStyleName("attachment-control"); FileDownloader fileDownloader = new FileDownloader( VaadinResourceFactory.getInstance().getStreamResource(attachment.getPath())); fileDownloader.extend(downloadBtn); attachmentLayout.addComponent(downloadBtn, "right: 9px; top: 9px; z-index: 1;"); this.addComponent(attachmentLayout); }
From source file:com.peergreen.webconsole.core.exception.ExceptionView.java
License:Open Source License
public ExceptionView(Exception ex) { setSizeFull();//w w w . j a va 2 s .com addStyleName("dashboard-view"); HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setSpacing(true); top.addStyleName("toolbar"); addComponent(top); final Label title = new Label("Oops ! A problem occurred when drawing this view"); title.setSizeUndefined(); title.addStyleName("h1"); top.addComponent(title); top.setComponentAlignment(title, Alignment.MIDDLE_LEFT); top.setExpandRatio(title, 1); HorizontalLayout row = new HorizontalLayout(); row.setSizeFull(); row.setMargin(new MarginInfo(true, true, false, true)); row.setSpacing(true); addComponent(row); setExpandRatio(row, 1.5f); Table t = new Table(); t.setCaption("Stack trace"); t.addContainerProperty("<p style=\"display:none\">Stack</p>", String.class, null); t.setWidth("100%"); t.setImmediate(true); t.addStyleName("plain"); t.addStyleName("borderless"); t.setSortEnabled(false); t.setImmediate(true); t.setSizeFull(); int i = 1; t.addItem(new Object[] { ex.toString() }, i++); for (StackTraceElement element : ex.getStackTrace()) { t.addItem(new Object[] { element.toString() }, i++); } CssLayout panel = new CssLayout(); panel.addStyleName("layout-panel"); panel.setSizeFull(); panel.addComponent(t); row.addComponent(panel); }
From source file:com.siemens.ct.osgi.vaadin.pm.main.MainApplication.java
License:Open Source License
@Override public void init() { logger.info("Dynamic Vaadin OSGi demo init..."); setTheme(Reindeer.THEME_NAME);//from w ww .j a v a 2 s . co m // setTheme(Runo.THEME_NAME); // setTheme("demo"); main = new Window("Dynamic Vaadin OSGi Demo"); mainLayout = (VerticalLayout) main.getContent(); mainLayout.setMargin(false); mainLayout.setStyleName("blue"); setMainWindow(main); mainLayout.setSizeFull(); mainLayout.addComponent(getMenu()); HorizontalLayout header = new HorizontalLayout(); header.addComponent(getHeader()); header.addComponent(getToolbar()); mainLayout.addComponent(header); CssLayout margin = new CssLayout(); margin.setMargin(false, true, true, true); margin.setSizeFull(); tabSheet = new TabSheet(); tabSheet.setSizeFull(); margin.addComponent(tabSheet); mainLayout.addComponent(margin); mainLayout.setExpandRatio(margin, 1); for (IViewContribution viewContribution : viewContributions) { tabSheet.addTab(viewContribution.getView(this), viewContribution.getName(), new ThemeResource(viewContribution.getIcon())); } for (IActionContribution actionContribution : actionContributions) { addActionContribution(actionContribution); } // Create the indicator // this is used for a simple poll mechanism // so that manual server-side starting/stopping of bundles has a direct // effect on the client UI ProgressIndicator indicator = new ProgressIndicator(); // Set polling frequency to 1 seconds. indicator.setPollingInterval(1000); // Add it to Application's main window main.addComponent(indicator); // Hide the component does not work... indicator.setWidth("1px"); indicator.setHeight("1px"); indicator.setVisible(true); initialized = true; }
From source file:de.fatalix.bookery.App.java
License:Open Source License
@Override protected void init(VaadinRequest request) { Navigator navigator = new Navigator(this, appLayout.getMainContent()); navigator.addProvider(viewProvider); CssLayout contentWrapper = new CssLayout(); contentWrapper.addStyleName("crud-view"); contentWrapper.setSizeFull(); contentWrapper.addComponents(appLayout, bookMenuLayout, bookDetailLayout); setContent(contentWrapper);// w w w . j a va2 s. c om getNavigator().addViewChangeListener(new ViewChangeListener() { @Override public boolean beforeViewChange(ViewChangeListener.ViewChangeEvent event) { if (!isLoggedIn()) { appLayout.getAppHeader().setVisible(false); if (!event.getViewName().equals(LoginView.id)) { getNavigator().navigateTo(LoginView.id); return false; } return true; } else { appLayout.getAppHeader().setVisible(isLoggedIn()); appLayout.getAppHeader().setLoginName(SecurityUtils.getSubject().getPrincipal().toString()); if (event.getViewName().equals("")) { getNavigator().navigateTo(HomeView.id); return false; } return true; } } @Override public void afterViewChange(ViewChangeListener.ViewChangeEvent event) { } }); if (!isLoggedIn()) { appLayout.getAppHeader().setVisible(false); getNavigator().navigateTo(LoginView.id); } else { appLayout.getAppHeader().setVisible(isLoggedIn()); appLayout.getAppHeader().setLoginName(SecurityUtils.getSubject().getPrincipal().toString()); if (getNavigator().getState().isEmpty()) { getNavigator().navigateTo(HomeView.id); } } }
From source file:de.kaiserpfalzEdv.vaadin.PiraccUI.java
License:Apache License
protected void showMainView() { HorizontalLayout screen = new HorizontalLayout(); CssLayout viewContainer = new CssLayout(); viewContainer.addStyleName("valo-content"); viewContainer.setSizeFull(); screen.setStyleName("main-screen"); screen.addComponent(menu);/* w w w. j a va 2s .co m*/ screen.addComponent(viewContainer); screen.setExpandRatio(viewContainer, 1); screen.setSizeFull(); Navigator navigator = new Navigator(this, viewContainer); navigator.addProvider(viewProvider); addStyleName(ValoTheme.UI_WITH_MENU); setContent(screen); if (isNotBlank(getNavigator().getState())) { getNavigator().navigateTo(getNavigator().getState()); } menu.generate(); }
From source file:de.metas.ui.web.vaadin.window.editor.ComposedValueEditor.java
License:Open Source License
public ComposedValueEditor(final ViewPropertyDescriptor descriptor) { super(descriptor); addStyleName(STYLE);/*from w w w .j a v a 2 s .co m*/ addStyleName(FieldEditor.STYLE_Field); valueField = new TextField(); valueField.setEnabled(false); valueField.addStyleName(STYLE_ValueField); description = new Label(); description.addStyleName(STYLE_Description); description.setContentMode(ContentMode.HTML); final CssLayout content = new CssLayout(valueField, description); content.setSizeFull(); setCompositionRoot(content); }
From source file:de.symeda.sormas.ui.MainScreen.java
License:Open Source License
public MainScreen(SormasUI ui) { CssLayout viewContainer = new CssLayout(); viewContainer.setSizeFull(); viewContainer.addStyleName("sormas-content"); final Navigator navigator = new Navigator(ui, viewContainer); navigator.setErrorProvider(new ViewProvider() { @Override/*from w ww. j a v a 2s. c o m*/ public String getViewName(String viewAndParameters) { return viewAndParameters; } @Override public View getView(String viewName) { try { // Add new views to this clause to make sure that the right error page is shown if (viewName.equals(SurveillanceDashboardView.VIEW_NAME) || viewName.equals(ContactsDashboardView.VIEW_NAME) || viewName.equals(TasksView.VIEW_NAME) || viewName.equals(CasesView.VIEW_NAME) || viewName.equals(ContactsView.VIEW_NAME) || viewName.equals(EventsView.VIEW_NAME) || viewName.equals(SamplesView.VIEW_NAME) || viewName.equals(ReportsView.VIEW_NAME) || viewName.equals(StatisticsView.VIEW_NAME) || viewName.equals(UsersView.VIEW_NAME) || viewName.equals(OutbreaksView.VIEW_NAME) || viewName.equals(RegionsView.VIEW_NAME) || viewName.equals(DistrictsView.VIEW_NAME) || viewName.equals(CommunitiesView.VIEW_NAME) || viewName.equals(HealthFacilitiesView.VIEW_NAME) || viewName.equals(LaboratoriesView.VIEW_NAME) || viewName.equals(PointsOfEntryView.VIEW_NAME) || viewName.equals(UserRightsView.VIEW_NAME)) { return AccessDeniedView.class.newInstance(); } else { return ErrorView.class.newInstance(); } } catch (Exception e) { throw new RuntimeException(e); } } }); menu = new Menu(navigator); if (UserProvider.getCurrent().hasUserRight(UserRight.DASHBOARD_VIEW)) { ControllerProvider.getDashboardController().registerViews(navigator); } if (UserProvider.getCurrent().hasUserRight(UserRight.DASHBOARD_SURVEILLANCE_ACCESS)) { menu.addView(SurveillanceDashboardView.class, AbstractDashboardView.ROOT_VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuDashboard), VaadinIcons.DASHBOARD); } else if (UserProvider.getCurrent().hasUserRight(UserRight.DASHBOARD_CONTACT_ACCESS)) { menu.addView(ContactsDashboardView.class, AbstractDashboardView.ROOT_VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuDashboard), VaadinIcons.DASHBOARD); } if (UserProvider.getCurrent().hasUserRight(UserRight.TASK_VIEW)) { menu.addView(TasksView.class, TasksView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuTasks), VaadinIcons.TASKS); } if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_VIEW)) { ControllerProvider.getCaseController().registerViews(navigator); menu.addView(CasesView.class, CasesView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuCases), VaadinIcons.EDIT); } if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_VIEW)) { ControllerProvider.getContactController().registerViews(navigator); menu.addView(ContactsView.class, ContactsView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuContacts), VaadinIcons.HAND); } if (UserProvider.getCurrent().hasUserRight(UserRight.EVENT_VIEW)) { ControllerProvider.getEventController().registerViews(navigator); menu.addView(EventsView.class, EventsView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuEvents), VaadinIcons.PHONE); } if (UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_VIEW)) { ControllerProvider.getSampleController().registerViews(navigator); menu.addView(SamplesView.class, SamplesView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuSamples), VaadinIcons.DATABASE); } if (UserProvider.getCurrent().hasUserRight(UserRight.WEEKLYREPORT_VIEW)) { menu.addView(ReportsView.class, ReportsView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuReports), VaadinIcons.FILE_TEXT); } if (UserProvider.getCurrent().hasUserRight(UserRight.STATISTICS_ACCESS)) { ControllerProvider.getStatisticsController().registerViews(navigator); menu.addView(StatisticsView.class, AbstractStatisticsView.ROOT_VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuStatistics), VaadinIcons.BAR_CHART); } if (UserProvider.getCurrent().hasUserRight(UserRight.USER_VIEW)) { menu.addView(UsersView.class, UsersView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuUsers), VaadinIcons.USERS); } if (UserProvider.getCurrent().hasUserRight(UserRight.CONFIGURATION_ACCESS)) { AbstractConfigurationView.registerViews(navigator); menu.addView(OutbreaksView.class, AbstractConfigurationView.ROOT_VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuConfiguration), VaadinIcons.COGS); } menu.addView(AboutView.class, AboutView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuAbout), VaadinIcons.INFO_CIRCLE); navigator.addViewChangeListener(viewChangeListener); ui.setNavigator(navigator); addComponent(menu); addComponent(viewContainer); setExpandRatio(viewContainer, 1); setSpacing(false); setMargin(false); setSizeFull(); }
From source file:fi.jasoft.dragdroplayouts.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { VerticalLayout content = new VerticalLayout(); content.setSizeFull();/*w w w . j a v a 2 s . c o m*/ setContent(content); Label header = new Label("DragDropLayouts for Vaadin 8"); header.setStyleName(ValoTheme.LABEL_H1); content.addComponent(header); HorizontalLayout hl = new HorizontalLayout(); hl.setSizeFull(); content.addComponent(hl); content.setExpandRatio(hl, 1); VerticalSplitPanel split = new VerticalSplitPanel(); hl.addComponent(split); hl.setExpandRatio(split, 1); CssLayout placeHolder = new CssLayout(new Label("No view selected.")); placeHolder.setSizeFull(); split.setFirstComponent(placeHolder); Panel codePanel = new Panel(codeLabel); codePanel.setSizeFull(); split.setSecondComponent(codePanel); navigator = new Navigator(this, placeHolder); navigator.addViewChangeListener(new ViewChangeListener() { @Override public boolean beforeViewChange(ViewChangeEvent event) { DemoView view = (DemoView) event.getNewView(); selection.getSelectionModel().select(view); codeLabel.setValue(getFormattedSourceCode(view.getSource())); return true; } @Override public void afterViewChange(ViewChangeEvent event) { // TODO Auto-generated method stub } }); try { addView(new DragdropAbsoluteLayoutDemo(navigator)); addView(new DragdropVerticalLayoutDemo(navigator)); addView(new DragdropHorizontalLayoutDemo(navigator)); addView(new DragdropGridLayoutDemo(navigator)); addView(new DragdropCssLayoutDemo(navigator)); addView(new DragdropFormLayoutDemo(navigator)); addView(new DragdropPanelDemo(navigator)); addView(new DragdropLayoutDraggingDemo(navigator)); addView(new DragdropHorizontalSplitPanelDemo(navigator)); addView(new DragdropVerticalSplitPanelDemo(navigator)); addView(new DragdropTabsheetDemo(navigator)); addView(new DragdropAccordionDemo(navigator)); addView(new DragdropDragFilterDemo(navigator)); addView(new DragdropCaptionModeDemo(navigator)); addView(new DragdropV7VerticalLayoutDemo(navigator)); addView(new DragdropV7HorizontalLayoutDemo(navigator)); // addView(new DragdropIframeDragging(navigator)); } catch (Exception e) { e.printStackTrace(); return; } hl.addComponent(selection = createViewSelection(), 0); String fragment = Page.getCurrent().getUriFragment(); if (fragment == null || fragment.equals("")) { navigator.navigateTo(DragdropAbsoluteLayoutDemo.NAME); } }
From source file:fi.jasoft.dragdroplayouts.demo.views.DragdropHorizontalSplitPanelDemo.java
License:Apache License
@Override public Component getLayout() { // start-source CssLayout root = new CssLayout(); root.setSizeFull(); Label lbl = new Label("To the left are some buttons, and to the right is a horizontal split panel. " + "Try dragging the buttons on to the splitpanel. If a component already exists in the SplitPanel it is replaced with the dragged one."); root.addComponent(lbl);/*from ww w .java 2 s . c o m*/ // Wrapping components in a horizontal layout HorizontalLayout inner = new HorizontalLayout(); inner.setMargin(true); inner.setSizeFull(); inner.setSpacing(true); root.addComponent(inner); // Add some buttons to a vertical layout with dragging enabled final DDVerticalLayout btns = new DDVerticalLayout(); btns.setDragMode(LayoutDragMode.CLONE); btns.setSizeUndefined(); btns.setSpacing(true); String caption = "Button "; btns.addComponent(new Button(caption + buttonCount++)); btns.addComponent(new Button(caption + buttonCount++)); btns.addComponent(new Button(caption + buttonCount++)); btns.addComponent(new Button(caption + buttonCount++)); btns.addComponent(new Button(caption + buttonCount++)); inner.addComponent(btns); // Create a drag & drop horizontal split panel final DDHorizontalSplitPanel panel = new DDHorizontalSplitPanel(); panel.setSizeFull(); inner.addComponent(panel); inner.setExpandRatio(panel, 1); // Enable dragging panel.setDragMode(LayoutDragMode.CLONE); // Enable dropping panel.setDropHandler(new DefaultHorizontalSplitPanelDropHandler()); // end-source return root; }