List of usage examples for com.vaadin.ui Label setSizeUndefined
@Override public void setSizeUndefined()
From source file:com.garyclayburg.vconsole.VConsole.java
License:Open Source License
private HorizontalLayout createTop() { topLayout = new HorizontalLayout(); topLayout.setWidth("100%"); topLayout.setSpacing(true);/*from w ww . j ava2s .c o m*/ topLayout.addStyleName("toolbar"); final Label title = new Label("Policy console"); title.setSizeUndefined(); title.addStyleName("h1"); topLayout.addComponent(title); topLayout.setComponentAlignment(title, Alignment.MIDDLE_LEFT); topLayout.setExpandRatio(title, 1); policyChangeStatus = new Label(""); policyChangeStatus.setSizeUndefined(); policyChangeStatus.addStyleName("policyNormal"); topLayout.addComponent(policyChangeStatus); topLayout.setComponentAlignment(policyChangeStatus, Alignment.MIDDLE_LEFT); createNotifyButton(); topLayout.addComponent(notify); topLayout.setComponentAlignment(notify, Alignment.MIDDLE_LEFT); return topLayout; }
From source file:com.github.peholmst.mvp4vaadin.navigation.ui.NavigationBar.java
License:Apache License
/** * Creates and adds a new separator label to the navigation bar. * /*w w w . j av a2 s . c o m*/ * @return the added separator label. */ protected Label addViewSeparator() { final Label lbl = new Label(""); lbl.setSizeUndefined(); lbl.addStyleName(BREADCRUMB_ELEMENT); addComponent(lbl); // setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); return lbl; }
From source file:com.github.peholmst.springsecuritydemo.ui.MainView.java
License:Apache License
/** * TODO Document me!/*from ww w. ja v a2s .c om*/ * * @return */ @SuppressWarnings("serial") protected Component createHeader() { final HorizontalLayout header = new HorizontalLayout(); header.setMargin(true); header.setWidth("100%"); /* * Header label will contain the name and version of the application. */ final Label headerLabel = new Label( getApplication().getMessage("app.title", getApplication().getVersion())); headerLabel.setStyleName("appHeaderText"); header.addComponent(headerLabel); header.setStyleName("appHeader"); header.setExpandRatio(headerLabel, 1.0f); header.setComponentAlignment(headerLabel, Alignment.MIDDLE_LEFT); /* * User links contains information about the current user and a button * for logging out. */ final HorizontalLayout userLinks = new HorizontalLayout(); userLinks.setStyleName("appHeaderUserLinks"); userLinks.setSpacing(true); /* * The user label contains the name of the current user. */ final Label userLabel = new Label( getApplication().getMessage("main.currentlyLoggedIn", getApplication().getUser().getName()), Label.CONTENT_XHTML); userLinks.addComponent(userLabel); userLinks.setComponentAlignment(userLabel, Alignment.MIDDLE_LEFT); userLabel.setSizeUndefined(); /* * The logout button closes the application, effectively logging the * user out. */ final Button logoutButton = new Button(getApplication().getMessage("main.logout.caption"), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { // TODO Add confirmation getApplication().close(); } }); logoutButton.setDescription(getApplication().getMessage("main.logout.descr")); logoutButton.setStyleName("small"); userLinks.addComponent(logoutButton); userLinks.setComponentAlignment(logoutButton, Alignment.MIDDLE_RIGHT); header.addComponent(userLinks); header.setComponentAlignment(userLinks, Alignment.MIDDLE_RIGHT); return header; }
From source file:com.haulmont.cuba.web.log.LogWindow.java
License:Apache License
private void initUI() { ClientConfig clientConfig = AppBeans.<Configuration>get(Configuration.NAME).getConfig(ClientConfig.class); String closeShortcut = clientConfig.getCloseShortcut(); KeyCombination closeCombination = KeyCombination.create(closeShortcut); com.vaadin.event.ShortcutAction closeShortcutAction = new com.vaadin.event.ShortcutAction( "closeShortcutAction", closeCombination.getKey().getCode(), KeyCombination.Modifier.codes(closeCombination.getModifiers())); addActionHandler(new com.vaadin.event.Action.Handler() { @Override//from ww w.j a va 2s . c o m public com.vaadin.event.Action[] getActions(Object target, Object sender) { return new com.vaadin.event.Action[] { closeShortcutAction }; } @Override public void handleAction(com.vaadin.event.Action action, Object sender, Object target) { if (Objects.equals(action, closeShortcutAction)) { close(); } } }); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setSizeFull(); setContent(layout); Panel scrollablePanel = new Panel(); scrollablePanel.setSizeFull(); VerticalLayout scrollContent = new VerticalLayout(); scrollContent.setSizeUndefined(); scrollablePanel.setContent(scrollContent); final Label label = new Label(); label.setContentMode(ContentMode.HTML); label.setValue(writeLog()); label.setSizeUndefined(); label.setStyleName("c-log-content"); ((Layout) scrollablePanel.getContent()).addComponent(label); HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setWidth("100%"); topLayout.setHeightUndefined(); Messages messages = AppBeans.get(Messages.NAME); Button refreshBtn = new CubaButton(messages.getMessage(getClass(), "logWindow.refreshBtn"), (Button.ClickListener) event -> label.setValue(writeLog())); topLayout.addComponent(refreshBtn); layout.addComponent(topLayout); layout.addComponent(scrollablePanel); layout.setExpandRatio(scrollablePanel, 1.0f); }
From source file:com.haulmont.cuba.web.sys.WindowBreadCrumbs.java
License:Apache License
public void update() { AppUI ui = AppUI.getCurrent();/*from w ww.j a v a 2 s. co m*/ boolean isTestMode = ui.isTestMode(); linksLayout.removeAllComponents(); btn2win.clear(); for (Iterator<Window> it = windows.iterator(); it.hasNext();) { Window window = it.next(); Button button = new CubaButton(StringUtils.trimToEmpty(window.getCaption()), new BtnClickListener()); button.setSizeUndefined(); button.setStyleName(BaseTheme.BUTTON_LINK); button.setTabIndex(-1); if (isTestMode) { button.setCubaId("breadCrubms_Button_" + window.getId()); button.setId(ui.getTestIdManager().getTestId("breadCrubms_Button_" + window.getId())); } btn2win.put(button, window); if (it.hasNext()) { linksLayout.addComponent(button); Label separatorLab = new Label(" > "); separatorLab.setStyleName("c-breadcrumbs-separator"); separatorLab.setSizeUndefined(); separatorLab.setContentMode(ContentMode.HTML); linksLayout.addComponent(separatorLab); } else { Label captionLabel = new Label(window.getCaption()); captionLabel.setStyleName("c-breadcrumbs-win-caption"); captionLabel.setSizeUndefined(); linksLayout.addComponent(captionLabel); this.label = captionLabel; } } }
From source file:com.hazelcast.examples.Tutorial.java
License:Open Source License
private final void prepareSourceCode() { String source = "/" + getClass().getName().replaceAll("\\.", "/") + ".java"; try {/*from w ww .ja va2 s .c o m*/ String code = StringUtils.replaceEach(IOUtils.toString(getClass().getResourceAsStream(source)), new String[] { "&", "<", ">", "\"", "'", "/" }, new String[] { "&", "<", ">", """, "'", "/" }); Label c = new Label("<pre class='prettyprint'>" + code + "</pre>"); c.setContentMode(ContentMode.HTML); c.setSizeUndefined(); addSelectedTabChangeListener(e -> JavaScript.eval("setTimeout(function(){prettyPrint();},300);")); sourceCode.add(c); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.klwork.explorer.ui.business.flow.act.MyTaskRelatedContentComponent.java
License:Apache License
protected void addEmptySpace(ComponentContainer container) { Label emptySpace = new Label(" ", Label.CONTENT_XHTML); emptySpace.setSizeUndefined(); container.addComponent(emptySpace);//from w w w . j a v a2 s .com }
From source file:com.klwork.explorer.ui.content.email.EmailDetailPanel.java
License:Apache License
protected void addSimpleRow(String labelMessageKey, String content) { addLabel(labelMessageKey);/*from w ww . j a va 2s.c o m*/ Label subjectLabel = new Label(content); subjectLabel.setSizeUndefined(); subjectLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD); gridLayout.addComponent(subjectLabel); gridLayout.setComponentAlignment(subjectLabel, Alignment.MIDDLE_LEFT); }
From source file:com.klwork.explorer.ui.content.email.EmailDetailPanel.java
License:Apache License
protected void addLabel(String messageKey) { Label theLabel = new Label(i18nManager.getMessage(messageKey)); theLabel.setSizeUndefined(); gridLayout.addComponent(theLabel);//from w w w . j av a 2 s .c om }
From source file:com.klwork.explorer.ui.content.file.ImageAttachmentRenderer.java
License:Apache License
@Override public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeUndefined();//from w w w . j a v a 2 s .c o m verticalLayout.setSpacing(true); verticalLayout.setMargin(true); Label description = new Label(attachment.getDescription()); description.setSizeUndefined(); verticalLayout.addComponent(description); // Image TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); String mimeType = extractMineType(attachment.getType()); InputStream imageStream = ImageUtil.resizeImage(taskService.getAttachmentContent(attachment.getId()), mimeType, 900, 550); Resource resource = new StreamResource(new InputStreamStreamSource(imageStream), attachment.getName() + extractExtention(attachment.getType())); Embedded image = new Embedded(null, resource); verticalLayout.addComponent(image); // Linke HorizontalLayout LinkLayout = new HorizontalLayout(); LinkLayout.setSpacing(true); verticalLayout.addComponent(LinkLayout); verticalLayout.setComponentAlignment(LinkLayout, Alignment.MIDDLE_CENTER); Label fullSizeLabel = new Label( ViewToolManager.getI18nManager().getMessage(Messages.RELATED_CONTENT_SHOW_FULL_SIZE)); LinkLayout.addComponent(fullSizeLabel); Link link = null; if (attachment.getUrl() != null) { link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); } else { taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); Resource res = new StreamResource( new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())), attachment.getName() + extractExtention(attachment.getType())); link = new Link(attachment.getName(), res); } link.setIcon(Images.RELATED_CONTENT_PICTURE); link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); LinkLayout.addComponent(link); return verticalLayout; }