List of usage examples for com.vaadin.ui Label setStyleName
@Override public void setStyleName(String style)
From source file:ch.bfh.ti.soed.hs16.srs.white.view.subviews.CustomMenuItem.java
License:Open Source License
public CustomMenuItem(String caption, String icon) { this.setStyleName("menu-item"); if (icon == null || icon.isEmpty()) { icon = "no-icon"; }// w ww .j av a 2s.c om StringBuilder iconStyle = new StringBuilder("menu-item-icon").append("-").append(icon); Label imageIcon = new Label(); imageIcon.setStyleName(iconStyle.toString()); Label itemCaption = new Label(caption); itemCaption.setStyleName("menu-item-caption"); itemCaption.setWidthUndefined(); this.addComponents(imageIcon, itemCaption); }
From source file:ch.bfh.ti.soed.hs16.srs.white.view.subviews.RoomsView.java
License:Open Source License
@Override public Component createHeader() { GridLayout headerGrid = new GridLayout(3, 1); headerGrid.setStyleName("table-parent"); Label labelID = new Label("ID"); labelID.setStyleName("display-table-header"); Label labelName = new Label("Name"); labelName.setStyleName("display-table-header"); Label labelSeats = new Label("Seats Available"); labelSeats.setStyleName("display-table-header"); headerGrid.addComponent(labelID);//from w ww . j ava 2 s.com headerGrid.addComponent(labelName); headerGrid.addComponent(labelSeats); return headerGrid; }
From source file:ch.bfh.ti.soed.hs16.srs.white.view.subviews.UsersView.java
License:Open Source License
@Override public Component createHeader() { GridLayout headerGrid = new GridLayout(4, 1); headerGrid.setStyleName("table-parent"); Label labelID = new Label("ID"); labelID.setStyleName("display-table-header"); Label labelFName = new Label("First Name"); labelFName.setStyleName("display-table-header"); Label labelLName = new Label("Last Name"); labelLName.setStyleName("display-table-header"); Label labelEMail = new Label("E-Mail"); labelEMail.setStyleName("display-table-header"); headerGrid.addComponent(labelID);/*from ww w .j ava 2 s . com*/ headerGrid.addComponent(labelFName); headerGrid.addComponent(labelLName); headerGrid.addComponent(labelEMail); return headerGrid; }
From source file:com.abien.vaadin.helloapp.HelloApp.java
License:Apache License
@Override public void init() { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*from w w w . j a v a 2 s . c o m*/ Label header = new Label("Vaadin on Java EE"); header.setStyleName("h1"); layout.addComponent(header); final TextField nameField = new TextField("Input something:"); final Label greetingLbl = new Label(); layout.addComponent(nameField); layout.addComponent( new Button("Say slow Hello, clicking this shouldn't stall other users", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { try { Thread.sleep(20 * 1000); } catch (InterruptedException ex) { Logger.getLogger(HelloApp.class.getName()).log(Level.SEVERE, null, ex); } getMainWindow().showNotification("Hello!"); } })); layout.addComponent(new Button("Say Hello", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { greetingLbl.setCaption(greetingService.sayHello(nameField.getValue().toString())); buttonEvents.fire(event); } })); layout.addComponent(greetingLbl); Window mainWindow = new Window("Vaadin 6.8 - Java EE Integration", layout); setMainWindow(mainWindow); }
From source file:com.cms.utils.CommonUtils.java
/** * * @param areaDTO//from w w w.j a v a 2 s .co m */ public static void boldLabel(Label label) { label.setStyleName("v-label-bold"); }
From source file:com.esofthead.mycollab.common.ui.components.CommentRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(final SimpleComment comment, int rowIndex) { final MHorizontalLayout layout = new MHorizontalLayout().withSpacing(true).withMargin(false) .withWidth("100%").withStyleName("message"); MVerticalLayout userBlock = new MVerticalLayout().withSpacing(true).withMargin(false).withWidth("80px"); userBlock.setDefaultComponentAlignment(Alignment.TOP_CENTER); ClickListener gotoUser = new ClickListener() { private static final long serialVersionUID = 1L; @Override//w w w .j a va 2 s . c o m public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoRead(this, comment.getCreateduser())); } }; Button userAvatarBtn = UserAvatarControlFactory.createUserAvatarButtonLink(comment.getOwnerAvatarId(), comment.getOwnerFullName()); userAvatarBtn.addClickListener(gotoUser); userBlock.addComponent(userAvatarBtn); Button userName = new Button(comment.getOwnerFullName()); userName.setStyleName("user-name"); userName.addStyleName("link"); userName.addStyleName(UIConstants.WORD_WRAP); userName.addClickListener(gotoUser); userBlock.addComponent(userName); layout.addComponent(userBlock); CssLayout rowLayout = new CssLayout(); rowLayout.setStyleName("message-container"); rowLayout.setWidth("100%"); MHorizontalLayout messageHeader = new MHorizontalLayout().withSpacing(true) .withMargin(new MarginInfo(true, true, false, true)).withWidth("100%") .withStyleName("message-header"); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label timePostLbl = new Label( AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), DateTimeUtils.getPrettyDateValue(comment.getCreatedtime(), AppContext.getUserLocale())), ContentMode.HTML); timePostLbl.setDescription(AppContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setSizeUndefined(); timePostLbl.setStyleName("time-post"); messageHeader.addComponent(timePostLbl); messageHeader.setExpandRatio(timePostLbl, 1.0f); // Message delete button Button msgDeleteBtn = new Button(); msgDeleteBtn.setIcon(FontAwesome.TRASH_O); msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY); messageHeader.addComponent(msgDeleteBtn); if (hasDeletePermission(comment)) { msgDeleteBtn.setVisible(true); msgDeleteBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { CommentService commentService = ApplicationContextUtil .getSpringBean(CommentService.class); commentService.removeWithSession(comment.getId(), AppContext.getUsername(), AppContext.getAccountId()); CommentRowDisplayHandler.this.owner.removeRow(layout); } } }); } }); } else { msgDeleteBtn.setVisible(false); } rowLayout.addComponent(messageHeader); Label messageContent = new UrlDetectableLabel(comment.getComment()); messageContent.setStyleName("message-body"); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withMargin(true) .withWidth("100%").withStyleName("message-footer"); AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments); attachmentDisplay.setWidth("100%"); messageFooter.addComponent(attachmentDisplay); messageFooter.setComponentAlignment(attachmentDisplay, Alignment.MIDDLE_RIGHT); rowLayout.addComponent(messageFooter); } layout.addComponent(rowLayout); layout.setExpandRatio(rowLayout, 1.0f); return layout; }
From source file:com.esofthead.mycollab.community.view.NotPresentedView.java
License:Open Source License
public NotPresentedView() { this.setHeight("370px"); this.setWidth("100%"); VerticalLayout layoutWapper = new VerticalLayout(); layoutWapper.setWidth("100%"); VerticalLayout layout = new VerticalLayout(); final Embedded titleIcon = new Embedded(); titleIcon.setSource(MyCollabResource.newResource("icons/not_present.png")); layout.addComponent(titleIcon);// w w w . ja v a2s .co m layout.setComponentAlignment(titleIcon, Alignment.MIDDLE_CENTER); Label label = new Label("Module is not presented for community edition"); label.setStyleName("h2_community"); layout.addComponent(label); layout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); layoutWapper.addComponent(layout); layoutWapper.setComponentAlignment(layout, Alignment.MIDDLE_CENTER); this.addComponent(layoutWapper); this.setComponentAlignment(layoutWapper, Alignment.MIDDLE_CENTER); }
From source file:com.esofthead.mycollab.form.view.DynaFormLayout.java
License:Open Source License
@Override public Layout getLayout() { layout = new VerticalLayout(); int sectionCount = dynaForm.getSectionCount(); sectionMappings = new HashMap<DynaSection, GridFormLayoutHelper>(); for (int i = 0; i < sectionCount; i++) { DynaSection section = dynaForm.getSection(i); if (section.isDeletedSection()) { continue; }//ww w . j a v a 2s . c o m Label header = new Label(section.getHeader()); header.setStyleName("h2"); layout.addComponent(header); GridFormLayoutHelper gridLayout; if (section.isDeletedSection() || section.getFieldCount() == 0) { continue; } if (section.getLayoutType() == LayoutType.ONE_COLUMN) { gridLayout = new GridFormLayoutHelper(2, section.getFieldCount(), "100%", "167px", Alignment.TOP_LEFT); } else if (section.getLayoutType() == LayoutType.TWO_COLUMN) { gridLayout = new GridFormLayoutHelper(2, (section.getFieldCount() + 3) / 2, "100%", "167px", Alignment.TOP_LEFT); } else { throw new MyCollabException("Does not support attachForm layout except 1 or 2 columns"); } gridLayout.getLayout().setWidth("100%"); gridLayout.getLayout().setMargin(false); gridLayout.getLayout().setSpacing(false); gridLayout.getLayout().addStyleName("colored-gridlayout"); layout.addComponent(gridLayout.getLayout()); sectionMappings.put(section, gridLayout); } return layout; }
From source file:com.esofthead.mycollab.mobile.form.view.DynaFormLayout.java
License:Open Source License
@Override public ComponentContainer getLayout() { layout = new VerticalLayout(); int sectionCount = dynaForm.getSectionCount(); sectionMappings = new HashMap<DynaSection, GridFormLayoutHelper>(); for (int i = 0; i < sectionCount; i++) { DynaSection section = dynaForm.getSection(i); if (section.isDeletedSection()) { continue; }/* ww w .ja va 2 s. c o m*/ Label header = new Label(section.getHeader()); header.setStyleName("h2"); layout.addComponent(header); GridFormLayoutHelper gridLayout; if (section.isDeletedSection() || section.getFieldCount() == 0) { continue; } gridLayout = new GridFormLayoutHelper(1, section.getFieldCount(), "100%", "150px", Alignment.TOP_RIGHT); gridLayout.getLayout().setWidth("100%"); gridLayout.getLayout().setMargin(false); gridLayout.getLayout().setSpacing(false); gridLayout.getLayout().addStyleName("colored-gridlayout"); layout.addComponent(gridLayout.getLayout()); sectionMappings.put(section, gridLayout); } return layout; }
From source file:com.esofthead.mycollab.mobile.module.crm.view.CrmLoginViewImpl.java
License:Open Source License
private void initUI() { this.setStyleName("login-view"); this.setSizeFull(); VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setStyleName("content-wrapper"); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); contentLayout.setMargin(true);/* ww w .j a v a 2 s. c o m*/ contentLayout.setSpacing(true); contentLayout.setWidth("320px"); Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png")); contentLayout.addComponent(mainLogo); Label introText = new Label( "MyCollab helps you do all your office jobs on the computers, phones and tablets you use"); introText.setStyleName("intro-text"); contentLayout.addComponent(introText); CssLayout welcomeTextWrapper = new CssLayout(); welcomeTextWrapper.setStyleName("welcometext-wrapper"); welcomeTextWrapper.setWidth("100%"); Label welcomeText = new Label("Login to CRM"); welcomeText.setWidth("150px"); welcomeTextWrapper.addComponent(welcomeText); contentLayout.addComponent(welcomeTextWrapper); final EmailField emailField = new EmailField(); emailField.setWidth("100%"); emailField.setInputPrompt("E-mail Address"); emailField.setStyleName("email-input"); contentLayout.addComponent(emailField); final PasswordField pwdField = new PasswordField(); pwdField.setWidth("100%"); pwdField.setInputPrompt("Password"); pwdField.setStyleName("password-input"); contentLayout.addComponent(pwdField); final CheckBox rememberPassword = new CheckBox(); rememberPassword.setWidth("100%"); rememberPassword.setCaption("Remember password"); rememberPassword.setValue(true); contentLayout.addComponent(rememberPassword); Button signInBtn = new Button("Sign In"); signInBtn.setWidth("100%"); signInBtn.addStyleName(UIConstants.BUTTON_BIG); signInBtn.addStyleName(UIConstants.COLOR_BLUE); signInBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new CrmEvent.PlainLogin(this, new String[] { emailField.getValue(), pwdField.getValue(), String.valueOf(rememberPassword.getValue()) })); } }); contentLayout.addComponent(signInBtn); Button createAccountBtn = new Button("Create Account"); createAccountBtn.setWidth("100%"); createAccountBtn.addStyleName(UIConstants.BUTTON_BIG); createAccountBtn.addStyleName(UIConstants.COLOR_GRAY); contentLayout.addComponent(createAccountBtn); this.addComponent(contentLayout); }