List of usage examples for com.vaadin.ui CssLayout CssLayout
public CssLayout(Component... children)
From source file:com.esofthead.mycollab.module.project.view.assignments.gantt.AssignmentNameCellField.java
License:Open Source License
@Override protected Component initContent() { MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%"); layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); field.setBuffered(true);//from w w w. ja va 2s .c o m field.setWidth("100%"); Label icon = new Label(ProjectAssetsManager.getAsset(type).getHtml(), ContentMode.HTML); layout.with(new CssLayout(icon), field).expand(field); return layout; }
From source file:com.esofthead.mycollab.module.user.accountsettings.customize.view.GeneralSettingViewImpl.java
License:Open Source License
@Override public void displayView() { removeAllComponents();/*from www . j a v a 2s . c o m*/ billingAccount = AppContext.getBillingAccount(); FormContainer formContainer = new FormContainer(); this.addComponent(formContainer); MHorizontalLayout generalSettingHeader = new MHorizontalLayout(); Label headerLbl = new Label(AppContext.getMessage(AdminI18nEnum.OPT_GENERAL_SETTINGS)); Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { UI.getCurrent().addWindow(new AccountInfoChangeWindow()); } }); editBtn.setStyleName(UIConstants.BUTTON_LINK); generalSettingHeader.with(headerLbl, editBtn).alignAll(Alignment.MIDDLE_LEFT); GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(2, 5, "200px"); gridFormLayoutHelper.addComponent(new Label(billingAccount.getSitename()), AppContext.getMessage(AdminI18nEnum.FORM_SITE_NAME), 0, 0); gridFormLayoutHelper.addComponent( new Label(String.format("https://%s.mycollab.com", billingAccount.getSubdomain())), AppContext.getMessage(AdminI18nEnum.FORM_SITE_ADDRESS), 0, 1); gridFormLayoutHelper.addComponent( new Label(TimezoneVal.getDisplayName(billingAccount.getDefaulttimezone())), AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_TIMEZONE), 0, 2); Currency defaultCurrency = billingAccount.getCurrencyInstance(); gridFormLayoutHelper.addComponent(new ELabel(defaultCurrency.getDisplayName(AppContext.getUserLocale())), AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_CURRENCY), 0, 3); Date now = new GregorianCalendar().getTime(); String defaultFullDateFormat = billingAccount.getDateFormatInstance(); gridFormLayoutHelper.addComponent(new Label(String.format("%s (%s)", DateTimeUtils.formatDate(now, billingAccount.getDateFormatInstance()), defaultFullDateFormat)), AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_YYMMDD_FORMAT), AppContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 1, 0); String defaultShortDateFormat = billingAccount.getShortDateFormatInstance(); gridFormLayoutHelper.addComponent( new Label(String.format("%s (%s)", DateTimeUtils.formatDate(now, billingAccount.getShortDateFormatInstance()), defaultShortDateFormat)), AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_MMDD_FORMAT), AppContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 1, 1); String defaultLongDateFormat = billingAccount.getLongDateFormatInstance(); gridFormLayoutHelper.addComponent(new Label(String.format("%s (%s)", DateTimeUtils.formatDate(now, billingAccount.getLongDateFormatInstance()), defaultLongDateFormat)), AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_HUMAN_DATE_FORMAT), AppContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 1, 2); gridFormLayoutHelper.addComponent( new Label(LocalizationHelper.getLocaleInstance(billingAccount.getDefaultlanguagetag()) .getDisplayLanguage(AppContext.getUserLocale())), AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_LANGUAGE), 1, 3); gridFormLayoutHelper.addComponent( new Label(AppContext .getMessage(LocalizationHelper.localizeYesNo(billingAccount.getDisplayemailpublicly()))), AppContext.getMessage(AdminI18nEnum.FORM_SHOW_EMAIL_PUBLICLY), AppContext.getMessage(AdminI18nEnum.FORM_SHOW_EMAIL_PUBLICLY_HELP), 0, 4, 2, "100%"); formContainer.addSection(new CssLayout(generalSettingHeader), gridFormLayoutHelper.getLayout()); buildLogoPanel(); buildShortcutIconPanel(); }
From source file:com.mycollab.mobile.module.project.view.ticket.TicketRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(IBeanList<ProjectTicket> host, final ProjectTicket ticket, int rowIndex) { MVerticalLayout rowLayout = new MVerticalLayout().withMargin(false).withSpacing(false).withFullWidth(); if (ticket.isTask()) { rowLayout.addStyleName("task"); } else if (ticket.isBug()) { rowLayout.addStyleName("bug"); } else if (ticket.isRisk()) { rowLayout.addStyleName("risk"); }// w w w . ja va 2s .com A ticketLink = new A(); if (ticket.isBug() || ticket.isTask()) { ticketLink.setHref(ProjectLinkGenerator.generateProjectItemLink(ticket.getProjectShortName(), ticket.getProjectId(), ticket.getType(), ticket.getExtraTypeId() + "")); } else if (ticket.isRisk()) { ticketLink.setHref(ProjectLinkGenerator.generateProjectItemLink(ticket.getProjectShortName(), ticket.getProjectId(), ticket.getType(), ticket.getTypeId() + "")); } else { throw new IgnoreException("Not support type: " + ticket.getType()); } ticketLink.appendText(ticket.getName()); ELabel ticketLbl = ELabel.html(ticketLink.write()).withStyleName(UIConstants.TEXT_ELLIPSIS); if (ticket.isClosed()) { ticketLbl.addStyleName(MobileUIConstants.LINK_COMPLETED); } else if (ticket.isOverdue()) { ticketLbl.addStyleName(MobileUIConstants.LINK_OVERDUE); } CssLayout ticketLayout = new CssLayout(ticketLbl); String priorityValue = ProjectAssetsManager.getPriority(ticket.getPriority()).getHtml(); ELabel priorityLbl = ELabel.html(priorityValue).withWidthUndefined() .withStyleName("priority-" + ticket.getPriority().toLowerCase()); rowLayout.with(new MHorizontalLayout(ELabel.fontIcon(ProjectAssetsManager.getAsset(ticket.getType())), priorityLbl, ticketLayout).expand(ticketLayout).withFullWidth()); MVerticalLayout metaInfoLayout = new MVerticalLayout().withMargin(false); rowLayout.with(metaInfoLayout); ELabel lastUpdatedTimeLbl = new ELabel(UserUIContext.getMessage(DayI18nEnum.LAST_UPDATED_ON, UserUIContext.formatPrettyTime((ticket.getLastUpdatedTime())))) .withStyleName(UIConstants.META_INFO); metaInfoLayout.addComponent(lastUpdatedTimeLbl); A assigneeLink = new A(ProjectLinkGenerator .generateProjectMemberLink(CurrentProjectVariables.getProjectId(), ticket.getAssignUser())); assigneeLink.appendText(StringUtils.trim(ticket.getAssignUserFullName(), 30, true)); Div assigneeDiv = new Div().appendText(UserUIContext.getMessage(GenericI18Enum.FORM_ASSIGNEE)).appendChild( DivLessFormatter.EMPTY_SPACE(), new Img("", StorageFactory.getAvatarPath(ticket.getAssignUserAvatarId(), 16)) .setCSSClass(UIConstants.CIRCLE_BOX), DivLessFormatter.EMPTY_SPACE(), assigneeLink); ELabel assigneeLbl = ELabel.html(assigneeDiv.write()).withStyleName(UIConstants.META_INFO) .withWidthUndefined(); metaInfoLayout.addComponent(assigneeLbl); String status; if (ticket.isBug()) { status = UserUIContext.getMessage(BugStatus.class, ticket.getStatus()); } else { status = UserUIContext.getMessage(OptionI18nEnum.StatusI18nEnum.class, ticket.getStatus()); } MHorizontalLayout statusLbl = new MHorizontalLayout(ELabel .html(UserUIContext.getMessage(GenericI18Enum.FORM_STATUS)).withStyleName(UIConstants.META_INFO), new ELabel(status).withStyleName(UIConstants.BLOCK)); metaInfoLayout.addComponent(statusLbl); return rowLayout; }
From source file:com.mycollab.module.file.view.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);//from w w w . j a v a2s . c o m folderTree.setSelectable(true); folderTree.setImmediate(true); folderTree.setSizeFull(); folderTree.addExpandListener(expandEvent -> { final Folder expandFolder = (Folder) expandEvent.getItemId(); // load externalResource if currentExpandFolder is rootFolder if (baseFolder.getPath().equals(expandFolder.getPath())) { List<ExternalDrive> externalDrives = externalDriveService .getExternalDrivesOfUser(UserUIContext.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); } collapseFolder.getChilds().forEach(this::recursiveRemoveSubItem); } private void recursiveRemoveSubItem(Folder collapseFolder) { List<Folder> childFolders = collapseFolder.getChilds(); if (childFolders.size() > 0) { childFolders.forEach(this::recursiveRemoveSubItem); folderTree.removeItem(collapseFolder); } else { folderTree.removeItem(collapseFolder); } } }); folderTree.addItemClickListener(itemClickEvent -> baseFolder = (Folder) itemClickEvent.getItemId()); CssLayout treeWrapper = new CssLayout(folderTree); treeWrapper.setSizeFull(); contentLayout.addComponent(treeWrapper); displayFiles(); MButton moveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_MOVE), clickEvent -> { if (!CollectionUtils.isEmpty(movedResources)) { boolean checkingFail = false; for (Resource res : movedResources) { try { resourceMover.moveResource(res, baseFolder, UserUIContext.getUsername(), MyCollabUI.getAccountId()); } catch (Exception e) { checkingFail = true; LOG.error("Error", e); } } close(); displayAfterMoveSuccess(baseFolder, checkingFail); } }).withIcon(FontAwesome.ARROWS).withStyleName(WebThemes.BUTTON_ACTION); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); MHorizontalLayout controlGroupBtnLayout = new MHorizontalLayout(cancelBtn, moveBtn); contentLayout.with(controlGroupBtnLayout).withAlign(controlGroupBtnLayout, Alignment.MIDDLE_RIGHT); }
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 . ja v a 2 s . com*/ 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.module.user.accountsettings.customize.view.GeneralSettingViewImpl.java
License:Open Source License
@Override public void displayView() { removeAllComponents();/*from w w w . j a va 2s .com*/ billingAccount = MyCollabUI.getBillingAccount(); FormContainer formContainer = new FormContainer(); this.addComponent(formContainer); MHorizontalLayout generalSettingHeader = new MHorizontalLayout(); Label headerLbl = new Label(UserUIContext.getMessage(AdminI18nEnum.OPT_GENERAL_SETTINGS)); MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> UI.getCurrent().addWindow(new AccountInfoChangeWindow())) .withStyleName(WebThemes.BUTTON_LINK); generalSettingHeader.with(headerLbl, editBtn).alignAll(Alignment.MIDDLE_LEFT); GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(2, 5, "200px"); gridFormLayoutHelper.addComponent(new Label(billingAccount.getSitename()), UserUIContext.getMessage(AdminI18nEnum.FORM_SITE_NAME), 0, 0); gridFormLayoutHelper.addComponent( new Label(String.format("https://%s.mycollab.com", billingAccount.getSubdomain())), UserUIContext.getMessage(AdminI18nEnum.FORM_SITE_ADDRESS), 0, 1); gridFormLayoutHelper.addComponent( new Label(TimezoneVal.getDisplayName(UserUIContext.getUserLocale(), billingAccount.getDefaulttimezone())), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_TIMEZONE), 0, 2); Currency defaultCurrency = billingAccount.getCurrencyInstance(); gridFormLayoutHelper.addComponent(new ELabel(defaultCurrency.getDisplayName(UserUIContext.getUserLocale())), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_CURRENCY), 0, 3); Date now = new GregorianCalendar().getTime(); String defaultFullDateFormat = billingAccount.getDateFormatInstance(); gridFormLayoutHelper.addComponent( new Label(String.format("%s (%s)", DateTimeUtils.formatDate(now, billingAccount.getDateFormatInstance(), UserUIContext.getUserLocale()), defaultFullDateFormat)), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_YYMMDD_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 1, 0); String defaultShortDateFormat = billingAccount.getShortDateFormatInstance(); gridFormLayoutHelper.addComponent( new Label(String.format("%s (%s)", DateTimeUtils.formatDate(now, billingAccount.getShortDateFormatInstance(), UserUIContext.getUserLocale()), defaultShortDateFormat)), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_MMDD_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 1, 1); String defaultLongDateFormat = billingAccount.getLongDateFormatInstance(); gridFormLayoutHelper.addComponent( new Label(String.format("%s (%s)", DateTimeUtils.formatDate(now, billingAccount.getLongDateFormatInstance(), UserUIContext.getUserLocale()), defaultLongDateFormat)), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_HUMAN_DATE_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 1, 2); gridFormLayoutHelper.addComponent( new Label(LocalizationHelper.getLocaleInstance(billingAccount.getDefaultlanguagetag()) .getDisplayLanguage(UserUIContext.getUserLocale())), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_LANGUAGE), 1, 3); gridFormLayoutHelper.addComponent( new Label(UserUIContext .getMessage(LocalizationHelper.localizeYesNo(billingAccount.getDisplayemailpublicly()))), UserUIContext.getMessage(AdminI18nEnum.FORM_SHOW_EMAIL_PUBLICLY), UserUIContext.getMessage(AdminI18nEnum.FORM_SHOW_EMAIL_PUBLICLY_HELP), 0, 4, 2, "100%"); formContainer.addSection(new CssLayout(generalSettingHeader), gridFormLayoutHelper.getLayout()); buildLogoPanel(); buildShortcutIconPanel(); if (!SiteConfiguration.isDemandEdition()) { buildLanguageUpdatePanel(); } }
From source file:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java
private Component buildBadgeWrapper(final Component menuItemButton, final Component badgeLabel) { CssLayout dashboardWrapper = new CssLayout(menuItemButton); dashboardWrapper.addStyleName("badgewrapper"); dashboardWrapper.addStyleName(ValoTheme.MENU_ITEM); badgeLabel.addStyleName(ValoTheme.MENU_BADGE); badgeLabel.setWidthUndefined();//from w w w .j a v a2s . c o m badgeLabel.setVisible(false); dashboardWrapper.addComponent(badgeLabel); return dashboardWrapper; }
From source file:de.metas.procurement.webui.ui.view.InfoMessageView.java
License:Open Source License
public InfoMessageView() { super();//from w w w . j ava 2 s .c o m Application.autowire(this); addStyleName(STYLE); this.setCaption(i18n.getWithDefault("InfoMessageView.caption", "Info")); label = new Label(); label.addStyleName("text"); label.setContentMode(ContentMode.PREFORMATTED); setContent(new CssLayout(label)); }
From source file:fi.jasoft.dragdroplayouts.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { VerticalLayout content = new VerticalLayout(); content.setSizeFull();/*from 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:gov.va.ehtac.appsonfhir.ui.FHIRChart.java
public FHIRChart() { session = ((HealthElementsTouchKitUI) UI.getCurrent()).getSessionAttributes(); setCaption("TriCare Portal"); //final VerticalComponentGroup vert = new VerticalComponentGroup(); GridLayout layout = new GridLayout(3, 2); layout.setMargin(true);/* w ww .ja va2s . c o m*/ layout.setWidth("80%"); layout.setHeight("100%"); Panel problemListPanel = getProblemList(); Panel medicationPanel = getMedications(); Panel encountersPanel = getEncounters(); Panel allergiesPanel = getAllergies(); Panel testsPanel = getTests(); Panel carePanel = getCarePlan(); layout.addComponent(problemListPanel, 0, 0); layout.setComponentAlignment(problemListPanel, Alignment.TOP_LEFT); layout.addComponent(medicationPanel, 1, 0); layout.setComponentAlignment(medicationPanel, Alignment.TOP_LEFT); layout.addComponent(encountersPanel, 2, 0); layout.setComponentAlignment(encountersPanel, Alignment.TOP_LEFT); layout.addComponent(allergiesPanel, 0, 1); layout.setComponentAlignment(allergiesPanel, Alignment.TOP_LEFT); layout.addComponent(testsPanel, 1, 1); layout.setComponentAlignment(testsPanel, Alignment.TOP_LEFT); layout.addComponent(carePanel, 2, 1); layout.setComponentAlignment(carePanel, Alignment.TOP_LEFT); //vert.addComponent(layout); setContent(new CssLayout(layout)); }