List of usage examples for com.vaadin.ui HorizontalLayout HorizontalLayout
public HorizontalLayout()
From source file:com.esofthead.mycollab.mobile.module.project.view.milestone.MilestoneReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);/* w w w . ja va2 s.c om*/ Button relatedBugs = new Button(); relatedBugs.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.PROJECT_BUG + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(ProjectCommonI18nEnum.VIEW_BUG) + "</div>"); relatedBugs.setHtmlContentAllowed(true); relatedBugs.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 2113811477874305745L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ShellEvent.PushView(this, getRelatedBugs())); } }); toolbarLayout.addComponent(relatedBugs); Button relatedTasks = new Button(); relatedTasks.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.PROJECT_TASK + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(ProjectCommonI18nEnum.VIEW_TASK) + "</div>"); relatedTasks.setHtmlContentAllowed(true); relatedTasks.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -9171495386840452500L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ShellEvent.PushView(this, getRelatedTasks())); } }); toolbarLayout.addComponent(relatedTasks); relatedComments = new Button(); relatedComments.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.PROJECT_MESSAGE + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(ProjectCommonI18nEnum.TAB_COMMENT) + "</div>"); relatedComments.setHtmlContentAllowed(true); relatedComments.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 2206489649468573076L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ShellEvent.PushView(this, associateComments)); } }); toolbarLayout.addComponent(relatedComments); return toolbarLayout; }
From source file:com.esofthead.mycollab.mobile.module.project.view.task.TaskGroupReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);//from w w w . j a v a2 s . com relatedComments = new Button(); relatedComments.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.PROJECT_MESSAGE + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(ProjectCommonI18nEnum.TAB_COMMENT) + "</div>"); relatedComments.setHtmlContentAllowed(true); relatedComments.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 2276465280812964681L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ShellEvent.PushView(this, associateComments)); } }); toolbarLayout.addComponent(relatedComments); return toolbarLayout; }
From source file:com.esofthead.mycollab.mobile.module.project.view.task.TaskReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createBottomPanel() { HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); toolbarLayout.setSpacing(true);/*from w ww. j a va 2 s .co m*/ relatedComments = new Button(); relatedComments.setCaption("<span aria-hidden=\"true\" data-icon=\"" + IconConstants.PROJECT_MESSAGE + "\"></span><div class=\"screen-reader-text\">" + AppContext.getMessage(ProjectCommonI18nEnum.TAB_COMMENT) + "</div>"); relatedComments.setHtmlContentAllowed(true); relatedComments.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 4889821151518627676L; @Override public void buttonClick(ClickEvent arg0) { EventBusFactory.getInstance().post(new ShellEvent.PushView(this, associateComments)); } }); toolbarLayout.addComponent(relatedComments); return toolbarLayout; }
From source file:com.esofthead.mycollab.mobile.ui.ConfirmDialog.java
License:Open Source License
private void constructUI(final String message, final String okCaption, final String cancelCaption) { VerticalLayout layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeightUndefined();// ww w. ja v a 2 s. c o m layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); VerticalLayout messageWrapper = new VerticalLayout(); messageWrapper.setStyleName("message-wrapper"); messageWrapper.setWidth("100%"); messageWrapper.setMargin(true); final Label messageDisplay = new Label(message); messageDisplay.setWidth("100%"); messageWrapper.addComponent(messageDisplay); layout.addComponent(messageWrapper); HorizontalLayout controlBtn = new HorizontalLayout(); controlBtn.setWidth("100%"); final Button okBtn = new Button(okCaption); okBtn.setWidth("100%"); okBtn.setHeight("35px"); final Button cancelBtn = new Button(cancelCaption); cancelBtn.setWidth("100%"); cancelBtn.setHeight("35px"); Button.ClickListener listener = new Button.ClickListener() { private static final long serialVersionUID = -8306231710367659086L; @Override public void buttonClick(ClickEvent event) { ConfirmDialog.this.setConfirmed(event.getButton() == okBtn); if (ConfirmDialog.this.getListener() != null) { ConfirmDialog.this.getListener().onClose(ConfirmDialog.this); } ConfirmDialog.this.close(); } }; okBtn.addClickListener(listener); cancelBtn.addClickListener(listener); controlBtn.addComponent(cancelBtn); controlBtn.addComponent(okBtn); layout.addComponent(controlBtn); this.setContent(layout); }
From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java
License:Open Source License
public Component addComponent(final Component field, final String caption, final int columns, final int rows, final int colspan, final String width, final Alignment alignment) { if (caption != null) { final Label l = new Label(caption); final HorizontalLayout captionWrapper = new HorizontalLayout(); captionWrapper.addComponent(l);/*from ww w .j av a2 s .c o m*/ captionWrapper.setComponentAlignment(l, alignment); captionWrapper.setStyleName("gridform-caption"); captionWrapper.setMargin(true); captionWrapper.setWidth(this.defaultCaptionWidth); if (columns == 0) { captionWrapper.addStyleName("first-col"); } if (rows == 0) { captionWrapper.addStyleName("first-row"); } if ((rows + 1) % 2 == 0) captionWrapper.addStyleName("even-row"); this.layout.addComponent(captionWrapper, 2 * columns, rows); captionWrapper.setHeight("100%"); } final HorizontalLayout fieldWrapper = new HorizontalLayout(); fieldWrapper.setStyleName("gridform-field"); fieldWrapper.setMargin(true); fieldWrapper.addComponent(field); if (!(field instanceof Button)) field.setCaption(null); field.setWidth(width); fieldWrapper.setWidth("100%"); if (rows == 0) { fieldWrapper.addStyleName("first-row"); } if ((rows + 1) % 2 == 0) { fieldWrapper.addStyleName("even-row"); } this.layout.addComponent(fieldWrapper, 2 * columns + 1, rows, 2 * (columns + colspan - 1) + 1, rows); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); return field; }
From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java
License:Open Source License
public Component addComponent(final Component field, final String caption, final int columns, final int rows, final String width, final Alignment alignment) { if (caption != null) { final Label l = new Label(caption); // l.setHeight("100%"); final HorizontalLayout captionWrapper = new HorizontalLayout(); captionWrapper.addComponent(l);/*from w w w .jav a2s . c o m*/ captionWrapper.setComponentAlignment(l, alignment); captionWrapper.setWidth(this.defaultCaptionWidth); captionWrapper.setHeight("100%"); captionWrapper.setStyleName("gridform-caption"); captionWrapper.setMargin(true); if (columns == 0) { captionWrapper.addStyleName("first-col"); } if (rows == 0) { captionWrapper.addStyleName("first-row"); } this.layout.addComponent(captionWrapper, 2 * columns, rows); } final HorizontalLayout fieldWrapper = new HorizontalLayout(); fieldWrapper.setStyleName("gridform-field"); if (!(field instanceof Button)) field.setCaption(null); fieldWrapper.addComponent(field); field.setWidth(width); fieldWrapper.setWidth("100%"); fieldWrapper.setMargin(true); if (rows == 0) { fieldWrapper.addStyleName("first-row"); } this.layout.addComponent(fieldWrapper, 2 * columns + 1, rows); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); return field; }
From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java
License:Open Source License
public Component addComponent(Component fieldValue, Component fieldCaption, String defaultCaptionWidth, String fieldValueWidth, int columns, int rows, Alignment alignment) { final HorizontalLayout captionWrapper = new HorizontalLayout(); captionWrapper.addComponent(fieldCaption); captionWrapper.setComponentAlignment(fieldCaption, alignment); captionWrapper.setWidth(defaultCaptionWidth); captionWrapper.setHeight("100%"); captionWrapper.setMargin(true);/* w ww . j av a 2 s . c o m*/ captionWrapper.setStyleName("gridform-caption"); if (columns == 0) { captionWrapper.addStyleName("first-col"); } if (rows == 0) { captionWrapper.addStyleName("first-row"); } this.layout.addComponent(captionWrapper, 2 * columns, rows); final HorizontalLayout fieldWrapper = new HorizontalLayout(); fieldWrapper.setStyleName("gridform-field"); if (!(fieldValue instanceof Button)) fieldValue.setCaption(null); fieldWrapper.addComponent(fieldValue); fieldValue.setWidth(fieldValueWidth); fieldWrapper.setWidth("100%"); fieldWrapper.setMargin(true); if (rows == 0) { fieldWrapper.addStyleName("first-row"); } this.layout.addComponent(fieldWrapper, 2 * columns + 1, rows); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); return fieldValue; }
From source file:com.esofthead.mycollab.mobile.ui.MobileAttachmentUtils.java
License:Open Source License
public static Component renderAttachmentRow(final Content attachment) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); HorizontalLayout attachmentRow = new HorizontalLayout(); attachmentRow.setStyleName("attachment-row"); attachmentRow.setWidth("100%"); attachmentRow.setSpacing(true);/* ww w . java 2 s.c o m*/ attachmentRow.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setWidth("25px"); thumbnailWrap.setHeight("40px"); thumbnailWrap.setStyleName("thumbnail-wrap"); Image thumbnail = new Image(null); if (org.apache.commons.lang3.StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setSource(DEFAULT_SOURCE); } else { thumbnail.setSource(VaadinResourceManager.getResourceManager() .getImagePreviewResource(attachment.getThumbnail(), DEFAULT_SOURCE)); } thumbnail.setWidth("100%"); thumbnailWrap.addComponent(thumbnail); attachmentRow.addComponent(thumbnailWrap); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); } if (MimeTypesUtil.isImageType(docName)) { Button b = new Button(attachment.getTitle(), new Button.ClickListener() { private static final long serialVersionUID = -1713187920922886934L; @Override public void buttonClick(Button.ClickEvent event) { AttachmentPreviewView previewView = new AttachmentPreviewView(VaadinResourceManager .getResourceManager().getImagePreviewResource(attachment.getPath(), DEFAULT_SOURCE)); EventBusFactory.getInstance().post(new ShellEvent.PushView(this, previewView)); } }); b.setWidth("100%"); attachmentRow.addComponent(b); attachmentRow.setExpandRatio(b, 1.0f); } else { Label l = new Label(attachment.getTitle()); l.setWidth("100%"); attachmentRow.addComponent(l); attachmentRow.setExpandRatio(l, 1.0f); } return attachmentRow; }
From source file:com.esofthead.mycollab.mobile.ui.MobileAttachmentUtils.java
License:Open Source License
public static Component renderAttachmentFieldRow(final Content attachment, Button.ClickListener additionalListener) { String docName = attachment.getPath(); int lastIndex = docName.lastIndexOf("/"); if (lastIndex != -1) { docName = docName.substring(lastIndex + 1, docName.length()); }/*from w w w .j a va 2s .c o m*/ final HorizontalLayout attachmentLayout = new HorizontalLayout(); attachmentLayout.setSpacing(true); attachmentLayout.setStyleName("attachment-row"); attachmentLayout.setWidth("100%"); attachmentLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); CssLayout thumbnailWrap = new CssLayout(); thumbnailWrap.setWidth("25px"); thumbnailWrap.setHeight("40px"); thumbnailWrap.setStyleName("thumbnail-wrap"); Image thumbnail = new Image(null); if (org.apache.commons.lang3.StringUtils.isBlank(attachment.getThumbnail())) { thumbnail.setSource(DEFAULT_SOURCE); } else { thumbnail.setSource(VaadinResourceManager.getResourceManager() .getImagePreviewResource(attachment.getThumbnail(), DEFAULT_SOURCE)); } thumbnail.setWidth("100%"); thumbnailWrap.addComponent(thumbnail); attachmentLayout.addComponent(thumbnailWrap); Label attachmentLink = new Label(docName); attachmentLayout.addComponent(attachmentLink); attachmentLayout.setExpandRatio(attachmentLink, 1.0f); Button removeAttachment = new Button( "<span aria-hidden=\"true\" data-icon=\"" + IconConstants.DELETE + "\"></span>", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ConfirmDialog.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.CloseListener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { ResourceService attachmentService = ApplicationContextUtil .getSpringBean(ResourceService.class); attachmentService.removeResource(attachment.getPath(), AppContext.getUsername(), AppContext.getAccountId()); ((ComponentContainer) attachmentLayout.getParent()) .removeComponent(attachmentLayout); } } }); } }); if (additionalListener != null) { removeAttachment.addClickListener(additionalListener); } removeAttachment.setHtmlContentAllowed(true); removeAttachment.setStyleName("link"); attachmentLayout.addComponent(removeAttachment); return attachmentLayout; }
From source file:com.esofthead.mycollab.module.crm.ui.components.CrmPreviewFormControlsGenerator.java
License:Open Source License
public CrmPreviewFormControlsGenerator(final AdvancedPreviewBeanForm<T> editForm) { this.previewForm = editForm; layout = new HorizontalLayout(); Button editButtons = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_OPTION), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from w w w . j a v a 2 s. c om public void buttonClick(ClickEvent event) { optionBtn.setPopupVisible(true); } }); editButtons.setWidthUndefined(); editButtons.addStyleName(UIConstants.THEME_GRAY_LINK); optionBtn = new SplitButton(editButtons); optionBtn.addStyleName(UIConstants.THEME_GRAY_LINK); }