List of usage examples for com.vaadin.ui Layout setSizeFull
public void setSizeFull();
From source file:annis.visualizers.component.RawTextVisualizer.java
License:Apache License
@Override public Panel createComponent(VisualizerInput visInput, VisualizationToggle visToggle) { // get config for alignment boolean vertical = Boolean.parseBoolean(visInput.getMappings().getProperty("vertical", "true")); // get the texts RawTextWrapper texts = visInput.getRawText(); // create the main panel Panel p = new Panel(); p.setSizeFull();// w w w . j ava2s.c om // some layout configuration p.addStyleName(ChameleonTheme.PANEL_BORDERLESS); p.addStyleName(PANEL_CLASS); // enable webfonts p.addStyleName(Helper.CORPUS_FONT_FORCE); Layout l; // if no text available inform user and exit if (texts == null) { Label text = new Label(NO_TEXT); text.addStyleName(LABEL_CLASS); text.setSizeFull(); p.setContent(text); return p; } if (texts.hasMultipleTexts()) { // set the aligmnent if (vertical) { l = new VerticalLayout(); } else { l = new GridLayout(texts.getTexts().size(), 1); } // limit the size to the parent panel. l.setSizeFull(); // add the texts to the layout for (int i = 0; i < texts.getTexts().size(); i++) { String s = texts.getTexts().get(i); Label lblText; // check if the text is empty if (s == null || hasOnlyWhiteSpace(s)) { lblText = new Label(NO_TEXT); } else { lblText = new Label(s, ContentMode.TEXT); } lblText.setCaption("text " + (i + 1)); lblText.addStyleName(LABEL_CLASS); lblText.setWidth(98, Sizeable.Unit.PERCENTAGE); l.addComponent(lblText); } // apply the panel p.setContent(l); return p; } Label lblText; if (texts.hasTexts() && !hasOnlyWhiteSpace(texts.getFirstText())) { lblText = new Label(texts.getFirstText(), ContentMode.TEXT); } else { lblText = new Label(NO_TEXT); } lblText.setSizeFull(); lblText.addStyleName(LABEL_CLASS); p.setContent(lblText); return p; }
From source file:com.haulmont.cuba.web.gui.components.WebAccordion.java
License:Apache License
@Override public Accordion.Tab addLazyTab(String name, Element descriptor, ComponentLoader loader) { WebVBoxLayout tabContent = new WebVBoxLayout(); Layout layout = (Layout) tabContent.getComponent(); layout.setSizeFull(); Tab tab = new Tab(name, tabContent); tabs.put(name, tab);//from ww w . j a v a 2s . c o m com.vaadin.ui.Component tabComponent = WebComponentsHelper.getComposition(tabContent); tabComponent.setSizeFull(); tabMapping.put(tabComponent, new ComponentDescriptor(name, tabContent)); com.vaadin.ui.Accordion.Tab tabControl = this.component.addTab(tabComponent); getLazyTabs().add(tabComponent); this.component.addSelectedTabChangeListener(new LazyTabChangeListener(tabContent, descriptor, loader)); context = loader.getContext(); if (!postInitTaskAdded) { context.addPostInitTask((context1, window) -> initComponentTabChangeListener()); postInitTaskAdded = true; } if (getDebugId() != null) { this.component.setTestId(tabControl, AppUI.getCurrent().getTestIdManager().getTestId(getDebugId() + "." + name)); } if (AppUI.getCurrent().isTestMode()) { this.component.setCubaId(tabControl, name); } tabContent.setFrame(context.getFrame()); return tab; }
From source file:com.haulmont.cuba.web.gui.components.WebTabSheet.java
License:Apache License
@Override public TabSheet.Tab addLazyTab(String name, Element descriptor, ComponentLoader loader) { ComponentsFactory cf = AppBeans.get(ComponentsFactory.NAME); BoxLayout tabContent = (BoxLayout) cf.createComponent(VBoxLayout.NAME); Layout layout = tabContent.unwrap(Layout.class); layout.setSizeFull(); Tab tab = new Tab(name, tabContent); tabs.put(name, tab);//from ww w . j ava 2s . c o m com.vaadin.ui.Component tabComponent = WebComponentsHelper.getComposition(tabContent); tabComponent.setSizeFull(); tabMapping.put(tabComponent, new ComponentDescriptor(name, tabContent)); com.vaadin.ui.TabSheet.Tab tabControl = this.component.addTab(tabComponent); getLazyTabs().add(tabComponent); this.component.addSelectedTabChangeListener(new LazyTabChangeListener(tabContent, descriptor, loader)); context = loader.getContext(); if (!postInitTaskAdded) { context.addPostInitTask((context1, window) -> initComponentTabChangeListener()); postInitTaskAdded = true; } if (getDebugId() != null) { this.component.setTestId(tabControl, AppUI.getCurrent().getTestIdManager().getTestId(getDebugId() + "." + name)); } if (AppUI.getCurrent().isTestMode()) { this.component.setCubaId(tabControl, name); } tabContent.setFrame(context.getFrame()); return tab; }
From source file:com.haulmont.cuba.web.WebWindowManager.java
License:Apache License
protected Layout createNewTabLayout(final Window window, final boolean multipleOpen, WindowBreadCrumbs breadCrumbs, Component... additionalComponents) { Layout layout = new CssLayout(); layout.setPrimaryStyleName("c-app-window-wrap"); layout.setSizeFull(); layout.addComponent(breadCrumbs);//from w w w . j a va 2s. c om if (additionalComponents != null) { for (final Component c : additionalComponents) { layout.addComponent(c); } } final Component component = WebComponentsHelper.getComposition(window); component.setSizeFull(); layout.addComponent(component); WebAppWorkArea workArea = getConfiguredWorkArea(createWorkAreaContext(window)); if (workArea.getMode() == Mode.TABBED) { layout.addStyleName("c-app-tabbed-window"); TabSheetBehaviour tabSheet = workArea.getTabbedWindowContainer().getTabSheetBehaviour(); String tabId; Integer hashCode = getWindowHashCode(window); ComponentContainer tab = null; if (hashCode != null) { tab = findTab(hashCode); } if (tab != null && !multipleOpen) { tabSheet.replaceComponent(tab, layout); tabSheet.removeComponent(tab); tabs.put(layout, breadCrumbs); tabId = tabSheet.getTab(layout); } else { tabs.put(layout, breadCrumbs); tabId = "tab_" + uuidSource.createUuid(); tabSheet.addTab(layout, tabId); if (ui.isTestMode()) { String id = "tab_" + window.getId(); tabSheet.setTabTestId(tabId, ui.getTestIdManager().getTestId(id)); tabSheet.setTabCubaId(tabId, id); } } String windowContentSwitchMode = window.getContentSwitchMode().name(); ContentSwitchMode contentSwitchMode = ContentSwitchMode.valueOf(windowContentSwitchMode); tabSheet.setContentSwitchMode(tabId, contentSwitchMode); String formattedCaption = formatTabCaption(window.getCaption(), window.getDescription()); tabSheet.setTabCaption(tabId, formattedCaption); String formattedDescription = formatTabDescription(window.getCaption(), window.getDescription()); if (!Objects.equals(formattedCaption, formattedDescription)) { tabSheet.setTabDescription(tabId, formattedDescription); } else { tabSheet.setTabDescription(tabId, null); } tabSheet.setTabIcon(tabId, WebComponentsHelper.getIcon(window.getIcon())); tabSheet.setTabClosable(tabId, true); tabSheet.setTabCloseHandler(layout, (targetTabSheet, tabContent) -> { //noinspection SuspiciousMethodCalls WindowBreadCrumbs breadCrumbs1 = tabs.get(tabContent); if (!canWindowBeClosed(breadCrumbs1.getCurrentWindow())) { return; } Runnable closeTask = new TabCloseTask(breadCrumbs1); closeTask.run(); // it is needed to force redraw tabsheet if it has a lot of tabs and part of them are hidden targetTabSheet.markAsDirty(); }); tabSheet.setSelectedTab(layout); } else { tabs.put(layout, breadCrumbs); layout.addStyleName("c-app-single-window"); VerticalLayout mainLayout = workArea.getSingleWindowContainer(); mainLayout.removeAllComponents(); mainLayout.addComponent(layout); } return layout; }
From source file:org.eclipse.skalli.view.component.InformationBox.java
License:Open Source License
private InformationBox(String caption) { super(caption); setWidth("100%"); //$NON-NLS-1$ Layout layout = new CssLayout(); layout.setSizeFull(); setContent(layout);/* www . j a v a2 s . co m*/ addStyleName(STYLE); }
From source file:org.eclipse.skalli.view.component.PeopleComponent.java
License:Open Source License
protected PeopleComponent(final User user) { addStyleName(STYLE);//from w ww . j a va2 s . c o m Layout layout = new CssLayout(); layout.setSizeFull(); layout.setMargin(false); StringBuilder sb = new StringBuilder(); sb.append("<span class=\"v-img-peoplecomponent\">"); //$NON-NLS-1$ sb.append("<img src=\"/VAADIN/themes/simple/icons/people/team.png\" /> "); //$NON-NLS-1$ sb.append("</span>"); //$NON-NLS-1$ String userDetailsLink = UserDetailsUtil.getUserDetailsLink(user.getUserId()); if (userDetailsLink != null) { // user details link configured, render a link to user details dialog sb.append("<a href=\""); //$NON-NLS-1$ sb.append(userDetailsLink); sb.append("\" target=\"_blank\">"); //$NON-NLS-1$ sb.append(StringEscapeUtils.escapeHtml(user.getDisplayName())); sb.append("</a> "); //$NON-NLS-1$ } else { // not configured, just display the user name sb.append(StringEscapeUtils.escapeHtml(user.getDisplayName())); sb.append(" "); //$NON-NLS-1$ } sb.append("<span class=\"v-link-peoplecomponent\">"); //$NON-NLS-1$ if (user.hasEmail()) { sb.append("<a class=\"link\" href=\"mailto:"); //$NON-NLS-1$ sb.append(user.getEmail()); sb.append("\">"); //$NON-NLS-1$ sb.append("Mail"); sb.append("</a> "); //$NON-NLS-1$ } sb.append("<a class=\"link\" href=\""); //$NON-NLS-1$ sb.append(Consts.URL_PROJECTS_USER); sb.append(StringEscapeUtils.escapeHtml(user.getUserId())); sb.append("\">"); //$NON-NLS-1$ sb.append("Projects"); sb.append("</a> "); //$NON-NLS-1$ sb.append("</span>"); //$NON-NLS-1$ Label lbl = new Label(); lbl.setContentMode(Label.CONTENT_XHTML); lbl.setValue(sb.toString()); layout.addComponent(lbl); setCompositionRoot(layout); }
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.FeedInfoBox.java
License:Open Source License
@Override public Component getContent(Project project, ExtensionUtil util) { List<String> sources = getSources(project); if (sources.isEmpty()) { return null; // nothing to render }// www . jav a 2 s . co m Layout contentLayout = new CssLayout(); contentLayout.addStyleName(STYLE_TIMELINE_INFOBOX); contentLayout.setSizeFull(); maxFeedEntries = INITAL_MAX_FEED_ENTRIES; HashMap<String, SourceDetails> sourceFilter = new HashMap<String, SourceDetails>(); Map<String, String> captions = getCaptions(project, sources); for (String source : sources) { String caption = captions.get(source); if (StringUtils.isBlank(caption)) { caption = source; } sourceFilter.put(source, new SourceDetails(true, caption)); } renderContentPanel(contentLayout, project, util.getLoggedInUserId(), sourceFilter); return contentLayout; }
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ProjectActivityBox.java
License:Open Source License
@Override public Component getContent(Project project, ExtensionUtil util) { Layout layout = new CssLayout(); layout.addStyleName(STYLE_ACTIVITY_INFOBOX); layout.setSizeFull(); Label label;//from ww w. j a va 2 s.co m label = new Label("Latest commit activity (click for details):"); layout.addComponent(label); layout.addComponent(new Label(" ", Label.CONTENT_XHTML)); Link imgLink = getActivityGraphicUrl(project, util.getLoggedInUserId()); Link detailsLink = getActivityDetailsUrl(project, util.getLoggedInUserId()); Label activityArea = new Label(); activityArea.setContentMode(Label.CONTENT_XHTML); if (imgLink != null) { String imgTag = "<img src=\"" + imgLink.getUrl() + "\" " + "title=\"" + imgLink.getLabel() + "\" " + "onerror=\"document.getElementById('activityBoxError').style.visibility='visible';" + "document.getElementById('activityBoxImage').style.visibility='hidden';\" " + ">"; String content; if (detailsLink != null) { content = "<a href=\"" + detailsLink.getUrl() + "\" target=\"_new\">" + imgTag + "</a>"; } else { content = imgTag; } activityArea.setValue("<span id=\"activityBoxImage\">" + content + "</span>"); layout.addComponent(activityArea); Label errorArea = new Label("<span id=\"activityBoxError\" " + "style=\"visibility:hidden\">" + "<i>Currently there is no activity information available.</i>" + "</span>"); errorArea.setContentMode(Label.CONTENT_XHTML); layout.addComponent(errorArea); } else if (detailsLink != null) { activityArea.setValue("<a href=\"" + detailsLink.getUrl() + "\" target=\"_new\">Show details</a>"); layout.addComponent(activityArea); } return layout; }
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ProjectDevInfBox.java
License:Open Source License
@Override public Component getContent(Project project, ExtensionUtil util) { Layout layout = new CssLayout(); layout.addStyleName(STYLE_DEFINF_INFOBOX); layout.setSizeFull(); DevInfProjectExt devInf = project.getExtension(DevInfProjectExt.class); HtmlBuilder html = new HtmlBuilder(); if (devInf != null) { // Project Sources if (StringUtils.isNotBlank(devInf.getScmUrl())) { html.appendIconizedLink(ICON_SOURCES, "Project Sources", devInf.getScmUrl()).appendLineBreak(); }// ww w . j a v a2 s.c om // Bug Tracker if (StringUtils.isNotBlank(devInf.getBugtrackerUrl())) { Set<String> linkList = new HashSet<String>(); linkList.add(devInf.getBugtrackerUrl()); addCreateBugLinks(linkList, util.getLoggedInUserId(), project, devInf); html.appendIconizedLinks(ICON_BUGTRACKER, "Bug Tracker", "(Create Issue)", linkList) .appendLineBreak(); } // Code Metrics if (StringUtils.isNotBlank(devInf.getMetricsUrl())) { html.appendIconizedLink(ICON_METRICS, "Code Metrics", devInf.getMetricsUrl()).appendLineBreak(); } // CI / Build Server if (StringUtils.isNotBlank(devInf.getCiUrl())) { html.appendIconizedLink(ICON_CI_SERVER, "Continuous Integration / Build Server", devInf.getCiUrl()) .appendLineBreak(); } // Code Review if (StringUtils.isNotBlank(devInf.getReviewUrl())) { html.appendIconizedLink(ICON_REVIEW, "Code Review", devInf.getReviewUrl()).appendLineBreak(); } // Javadoc if (CollectionUtils.isNotBlank(devInf.getJavadocs())) { html.appendIconizedLinks(ICON_JAVADOC, "Javadoc", "(more Javadoc)", devInf.getJavadocs()) .appendLineBreak(); } // SCM Locations if (CollectionUtils.isNotBlank(devInf.getScmLocations())) { html.appendHeader("Source Locations", 4).append('\n'); html.append("<ul>\n"); //$NON-NLS-1$ ScmLocationMapper mapper = new ScmLocationMapper(ScmLocationMapper.ALL_PROVIDERS, ScmLocationMapper.PURPOSE_BROWSE, ScmLocationMapper.PURPOSE_REVIEW); for (String scmLocation : devInf.getScmLocations()) { html.append("<li>"); //$NON-NLS-1$ List<String> scmUrls = getScmUrls(scmLocation, util.getLoggedInUserId(), project); for (String scmUrl : scmUrls) { html.append(copyToClipboardLink(scmUrl, scmUrl)); } List<Link> mappedScmLinks = mapper.getMappedLinks(scmLocation, util.getLoggedInUserId(), project); html.appendLinks(mappedScmLinks); html.append("</li>\n"); //$NON-NLS-1$ } html.append("</ul>\n"); //$NON-NLS-1$ } } if (html.length() > 0) { createLabel(layout, html.toString()); } else { createLabel(layout, "This project has no development information."); } return layout; }
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ProjectIssuesBox.java
License:Open Source License
@Override @SuppressWarnings("nls") public Component getContent(Project project, ExtensionUtil util) { Layout layout = new CssLayout(); layout.addStyleName(STYLE_ISSUES_INFOBOX); layout.setSizeFull(); IssuesService issuesService = Services.getService(IssuesService.class); if (issuesService != null) { Issues issues = issuesService.loadEntity(Issues.class, project.getUuid()); StringBuilder sb = new StringBuilder(); if (issues != null) { if (issues.isStale()) { sb.append("<ul><li class=\"STALE\">No information about issues available.</li></ul>"); } else { SortedSet<Issue> issueSet = issues.getIssues(); if (!issueSet.isEmpty()) { sb.append(Issue.asHTMLList(null, issueSet)); if (util.isUserProjectAdmin(project)) { sb.append("<p>Click <a href=\"").append(Consts.URL_PROJECTS).append("/") .append(project.getProjectId()).append("?").append(Consts.PARAM_ACTION) .append("=").append(Consts.PARAM_VALUE_EDIT).append("\">here</a> to correct "); sb.append((issueSet.size() == 1) ? "this issue" : "these issues"); sb.append(".</p>"); }/*from www. j a v a 2 s. co m*/ } } if (util.isUserProjectAdmin(project)) { sb.append("<p>Click <a href=\"").append(Consts.URL_PROJECTS).append("/"); sb.append(project.getProjectId()).append("?").append(Consts.PARAM_ACTION).append("="); sb.append(Consts.PARAM_VALUE_VALIDATE).append("\">here</a> to validate the project now.</p>"); } createLabel(layout, sb.toString(), STYLE_ISSUES); } } return layout; }