List of usage examples for com.vaadin.ui CssLayout CssLayout
public CssLayout()
From source file:com.esofthead.mycollab.mobile.module.project.ui.form.field.ProjectFormAttachmentUploadField.java
License:Open Source License
protected void constructUI() { content = new VerticalLayout(); content.setStyleName("attachment-field"); rowWrap = new VerticalLayout(); rowWrap.setWidth("100%"); rowWrap.setStyleName("attachment-row-wrap"); Label compHeader = new Label(AppContext.getMessage(GenericI18Enum.M_FORM_ATTACHMENT)); compHeader.setStyleName("h2"); content.addComponent(compHeader);//from ww w .j a v a2s . c o m CssLayout btnWrap = new CssLayout(); btnWrap.setWidth("100%"); btnWrap.setStyleName("attachment-row"); btnWrap.addComponent(attachmentBtn); content.addComponent(btnWrap); content.addComponent(rowWrap); }
From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectCommentInput.java
License:Open Source License
private void constructUI() { this.setWidth("100%"); statusWrapper = new CssLayout(); statusWrapper.setWidth("100%"); statusWrapper.setStyleName("upload-status-wrap"); this.addComponent(statusWrapper); inputWrapper = new HorizontalLayout(); inputWrapper.setWidth("100%"); inputWrapper.setStyleName("comment-box"); inputWrapper.setSpacing(true);/* w ww . j ava 2 s .co m*/ inputWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); this.prepareUploadField(); inputWrapper.addComponent(uploadField); commentInput = new TextArea(); commentInput.setInputPrompt(AppContext.getMessage(GenericI18Enum.M_NOTE_INPUT_PROMPT)); commentInput.setSizeFull(); inputWrapper.addComponent(commentInput); inputWrapper.setExpandRatio(commentInput, 1.0f); Button postBtn = new Button(AppContext.getMessage(GenericI18Enum.M_BUTTON_SEND)); postBtn.setStyleName("submit-btn"); postBtn.setWidthUndefined(); postBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 6687918902751556313L; @Override public void buttonClick(Button.ClickEvent arg0) { final Comment comment = new Comment(); comment.setComment(commentInput.getValue()); comment.setCreatedtime(new GregorianCalendar().getTime()); comment.setCreateduser(AppContext.getUsername()); comment.setSaccountid(AppContext.getAccountId()); comment.setType(type.toString()); comment.setTypeid("" + typeid); comment.setExtratypeid(extraTypeId); final CommentService commentService = ApplicationContextUtil.getSpringBean(CommentService.class); int commentId = commentService.saveWithSession(comment, AppContext.getUsername(), isSendingEmailRelay, emailHandlerClass); String attachmentPath = AttachmentUtils.getProjectEntityCommentAttachmentPath(type, AppContext.getAccountId(), CurrentProjectVariables.getProjectId(), typeid, commentId); if (!"".equals(attachmentPath)) { saveContentsToRepo(attachmentPath); } // save success, clear comment area and load list // comments again commentInput.setValue(""); statusWrapper.removeAllComponents(); component.reload(); } }); inputWrapper.addComponent(postBtn); this.addComponent(inputWrapper); }
From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectCommentInputView.java
License:Open Source License
private void prepareUploadField() { statusWrapper = new CssLayout(); statusWrapper.setWidth("100%"); statusWrapper.setStyleName("upload-status-wrap"); receiver = createReceiver();// w ww . ja v a2 s. c o m uploadField = new MultiUpload(); uploadField.setButtonCaption("Click to upload"); uploadField.setImmediate(true); uploadField.setHandler(new MobileUploadHandler()); }
From source file:com.esofthead.mycollab.mobile.module.project.view.message.MessageAddViewImpl.java
License:Open Source License
public MessageAddViewImpl() { this.addStyleName("message-add-view"); this.setCaption(AppContext.getMessage(MessageI18nEnum.M_VIEW_ADD_TITLE)); this.content = new CssLayout(); this.content.setStyleName("content-layout"); this.content.setSizeFull(); this.setContent(this.content); VerticalLayout addFormLayout = new VerticalLayout(); addFormLayout.setStyleName("addform-layout"); addFormLayout.setWidth("100%"); subjectField = new TextField(); subjectField.setStyleName("title-field"); subjectField.setWidth("100%"); subjectField.setInputPrompt(AppContext.getMessage(MessageI18nEnum.FORM_TITLE)); addFormLayout.addComponent(subjectField); contentField = new TextArea(); contentField.setStyleName("content-field"); contentField.setWidth("100%"); contentField.setInputPrompt(AppContext.getMessage(MessageI18nEnum.M_FORM_CONTENT_FIELD_PROMPT)); addFormLayout.addComponent(contentField); VerticalComponentGroup bottomRow = new VerticalComponentGroup(); bottomRow.setStyleName("bottom-row"); bottomRow.setWidth("100%"); isStickField = new Switch(AppContext.getMessage(MessageI18nEnum.FORM_IS_STICK), false); bottomRow.addComponent(isStickField); attachment = new MessageAttachmentField(); attachment.setCaption(null);// ww w .ja v a 2 s . co m bottomRow.addComponent(attachment); this.content.addComponent(addFormLayout); this.content.addComponent(bottomRow); this.saveBtn = new Button(AppContext.getMessage(GenericI18Enum.M_BUTTON_DONE)); this.saveBtn.addStyleName("save-btn"); this.saveBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -2038682412445718948L; @Override public void buttonClick(Button.ClickEvent event) { final SimpleMessage message = new SimpleMessage(); message.setProjectid(CurrentProjectVariables.getProjectId()); message.setPosteddate(new GregorianCalendar().getTime()); if (!subjectField.getValue().toString().trim().equals("")) { message.setTitle(subjectField.getValue()); message.setMessage(contentField.getValue()); message.setPosteduser(AppContext.getUsername()); message.setSaccountid(AppContext.getAccountId()); message.setIsstick(isStickField.getValue()); MessageAddViewImpl.this.fireSaveItem(message); } else { subjectField.addStyleName("errorField"); NotificationUtil.showErrorNotification( AppContext.getMessage(MessageI18nEnum.FORM_TITLE_REQUIRED_ERROR)); } } }); this.setRightComponent(saveBtn); }
From source file:com.esofthead.mycollab.mobile.module.project.view.message.MessageReadViewImpl.java
License:Open Source License
@Override public void previewItem(SimpleMessage message) { this.bean = message; mainLayout.removeAllComponents();/*from ww w . ja va2 s.c o m*/ HorizontalLayout messageBlock = new HorizontalLayout(); messageBlock.setStyleName("message-block"); Image userAvatarImg = UserAvatarControlFactory .createUserAvatarEmbeddedComponent(message.getPostedUserAvatarId(), 32); userAvatarImg.setStyleName("user-avatar"); messageBlock.addComponent(userAvatarImg); CssLayout rightCol = new CssLayout(); rightCol.setWidth("100%"); HorizontalLayout metadataRow = new HorizontalLayout(); metadataRow.setWidth("100%"); metadataRow.setStyleName("metadata-row"); Label userNameLbl = new Label(message.getFullPostedUserName()); userNameLbl.setStyleName("user-name"); metadataRow.addComponent(userNameLbl); metadataRow.setExpandRatio(userNameLbl, 1.0f); Label messageTimePost = new Label( DateTimeUtils.getPrettyDateValue(message.getPosteddate(), AppContext.getUserLocale())); messageTimePost.setStyleName("time-post"); messageTimePost.setWidthUndefined(); metadataRow.addComponent(messageTimePost); rightCol.addComponent(metadataRow); HorizontalLayout titleRow = new HorizontalLayout(); titleRow.setWidth("100%"); titleRow.setStyleName("title-row"); Label messageTitle = new Label(message.getTitle()); messageTitle.setStyleName("message-title"); titleRow.addComponent(messageTitle); titleRow.setExpandRatio(messageTitle, 1.0f); if (message.getCommentsCount() > 0) { Label msgCommentCount = new Label(String.valueOf(message.getCommentsCount())); msgCommentCount.setStyleName("comment-count"); msgCommentCount.setWidthUndefined(); titleRow.addComponent(msgCommentCount); titleRow.addStyleName("has-comment"); titleRow.setComponentAlignment(messageTitle, Alignment.MIDDLE_LEFT); } rightCol.addComponent(titleRow); Label messageContent = new Label( StringUtils.trim(StringUtils.trimHtmlTags(message.getMessage()), 150, true)); messageContent.setStyleName("message-content"); rightCol.addComponent(messageContent); ResourceService attachmentService = ApplicationContextUtil.getSpringBean(ResourceService.class); List<Content> attachments = attachmentService .getContents(AttachmentUtils.getProjectEntityAttachmentPath(AppContext.getAccountId(), message.getProjectid(), AttachmentType.PROJECT_MESSAGE, message.getId())); if (attachments != null && !attachments.isEmpty()) { CssLayout attachmentPanel = new CssLayout(); attachmentPanel.setStyleName("attachment-panel"); attachmentPanel.setWidth("100%"); for (Content attachment : attachments) { attachmentPanel.addComponent(MobileAttachmentUtils.renderAttachmentRow(attachment)); } rightCol.addComponent(attachmentPanel); } messageBlock.addComponent(rightCol); messageBlock.setExpandRatio(rightCol, 1.0f); messageBlock.setWidth("100%"); mainLayout.addComponent(messageBlock); MessageCommentListDisplay commentDisplay = new MessageCommentListDisplay(CommentType.PRJ_MESSAGE, CurrentProjectVariables.getProjectId(), true, true, MessageRelayEmailNotificationAction.class); commentDisplay.loadComments("" + message.getId()); this.setToolbar(commentDisplay.getCommentBox()); mainLayout.addComponent(commentDisplay); }
From source file:com.esofthead.mycollab.mobile.module.project.view.ProjectDashboardViewImpl.java
License:Open Source License
public ProjectDashboardViewImpl() { super();/*from w w w. j a v a 2s .co m*/ this.setCaption(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_DASHBOARD)); mainLayout = new CssLayout(); mainLayout.setSizeFull(); mainLayout.setStyleName("project-dashboard"); this.setContent(mainLayout); }
From source file:com.esofthead.mycollab.mobile.module.project.view.ProjectLoginViewImpl.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);/*from w ww. j a v a 2s .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 Projects"); 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 ProjectEvent.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); }
From source file:com.esofthead.mycollab.mobile.module.user.view.LoginViewImpl.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);/*from w ww. j av a 2 s. c om*/ 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%"); welcomeTextWrapper.setHeight("15px"); Label welcomeText = new Label("Welcome Back!"); 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) { ShellController.doLogin(emailField.getValue(), pwdField.getValue(), 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); }
From source file:com.esofthead.mycollab.mobile.shell.ui.MainView.java
License:Open Source License
private void initUI() { this.setStyleName("main-view"); this.setSizeFull(); VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setStyleName("content-wrapper"); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); contentLayout.setMargin(true);//from w w w . ja v a 2 s . c om 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%"); welcomeTextWrapper.setHeight("15px"); contentLayout.addComponent(welcomeTextWrapper); ModuleButton crmButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_CRM)); crmButton.setWidth("100%"); crmButton.addStyleName("crm"); crmButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -1218427186205574547L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null)); } }); contentLayout.addComponent(crmButton); ModuleButton pmButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_PROJECT)); pmButton.setWidth("100%"); pmButton.addStyleName("project"); pmButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -5323408319082242586L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null)); } }); contentLayout.addComponent(pmButton); ModuleButton fileButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_DOCUMENT)); fileButton.setWidth("100%"); fileButton.addStyleName("document"); contentLayout.addComponent(fileButton); this.addComponent(contentLayout); }
From source file:com.esofthead.mycollab.mobile.shell.view.MainView.java
License:Open Source License
public MainView() { super();//from w w w . jav a 2 s . c om this.setSizeFull(); MVerticalLayout contentLayout = new MVerticalLayout().withStyleName("content-wrapper").withFullWidth(); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); 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%"); welcomeTextWrapper.setHeight("15px"); contentLayout.addComponent(welcomeTextWrapper); Button crmButton = new Button(AppContext.getMessage(GenericI18Enum.MODULE_CRM), new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null)); } }); crmButton.addStyleName(UIConstants.BUTTON_ACTION); crmButton.setWidth("100%"); contentLayout.addComponent(crmButton); Button pmButton = new Button(AppContext.getMessage(GenericI18Enum.MODULE_PROJECT), new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null)); } }); pmButton.setWidth("100%"); pmButton.addStyleName(UIConstants.BUTTON_ACTION); contentLayout.addComponent(pmButton); this.addComponent(contentLayout); }