List of usage examples for com.vaadin.ui HorizontalLayout addComponent
@Override public void addComponent(Component c)
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. java 2 s. com 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; }
From source file:com.klwork.explorer.ui.content.GenericAttachmentRenderer.java
License:Apache License
public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeUndefined();/*from w w w. jav a 2 s. c o m*/ verticalLayout.setSpacing(true); verticalLayout.setMargin(true); Label description = new Label(attachment.getDescription()); description.setSizeUndefined(); verticalLayout.addComponent(description); HorizontalLayout linkLayout = new HorizontalLayout(); linkLayout.setSpacing(true); verticalLayout.addComponent(linkLayout); // Image linkLayout.addComponent(new Embedded(null, getImage(attachment))); // Link Link link = null; if (attachment.getUrl() != null) { link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); } else { TaskService 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); } // Set generic image and external window link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); linkLayout.addComponent(link); return verticalLayout; }
From source file:com.klwork.explorer.ui.content.url.UrlAttachmentRenderer.java
License:Apache License
public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSpacing(true);/* ww w . j av a2 s . com*/ verticalLayout.setMargin(true); verticalLayout.addComponent(new Label(attachment.getDescription())); HorizontalLayout linkLayout = new HorizontalLayout(); linkLayout.setSpacing(true); verticalLayout.addComponent(linkLayout); // Icon linkLayout.addComponent(new Embedded(null, Images.RELATED_CONTENT_URL)); // Link Link link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); linkLayout.addComponent(link); return verticalLayout; }
From source file:com.klwork.explorer.ui.custom.SelectUsersPopupWindow.java
License:Apache License
protected void initSearchField() { HorizontalLayout searchLayout = new HorizontalLayout(); searchLayout.setSpacing(true);/*w ww . j a v a 2 s . co m*/ windowLayout.addComponent(searchLayout); // textfield searchField = new TextField(); searchField.setInputPrompt(i18nManager.getMessage(Messages.PEOPLE_SEARCH)); searchField.setWidth(180, Unit.PIXELS); searchField.focus(); searchLayout.addComponent(searchField); // Logic to change table according to input searchField.addTextChangeListener(new TextChangeListener() { public void textChange(TextChangeEvent event) { searchPeople(event.getText()); } }); // initSelectMyselfButton(searchLayout); }
From source file:com.klwork.explorer.ui.custom.SelectUsersPopupWindow.java
License:Apache License
protected void initSelectMyselfButton(HorizontalLayout searchLayout) { final LoggedInUser loggedInUser = LoginHandler.getLoggedInUser(); if (ignoredUserIds == null || !ignoredUserIds.contains(loggedInUser.getId())) { Button meButton = new Button(i18nManager.getMessage(Messages.PEOPLE_SELECT_MYSELF)); meButton.setIcon(Images.USER_16); searchLayout.addComponent(meButton); searchLayout.setComponentAlignment(meButton, Alignment.MIDDLE_LEFT); if (multiSelect) { meButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { selectUser(loggedInUser.getId(), loggedInUser.getFullName()); }/*from w ww.ja v a 2 s. c om*/ }); } else { meButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { addMatchingUser(loggedInUser.getId(), loggedInUser.getFullName()); matchingUsersTable.select(loggedInUser.getId()); fireEvent(new SubmitEvent(doneButton, SubmitEvent.SUBMITTED)); close(); } }); } } }
From source file:com.klwork.explorer.ui.form.FormPropertiesForm.java
License:Apache License
protected void initButtons() { submitFormButton = new Button(); cancelFormButton = new Button(); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true);// w ww. ja v a 2s . c o m buttons.setWidth(100, Unit.PERCENTAGE); buttons.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); buttons.addComponent(submitFormButton); buttons.setComponentAlignment(submitFormButton, Alignment.BOTTOM_RIGHT); buttons.addComponent(cancelFormButton); buttons.setComponentAlignment(cancelFormButton, Alignment.BOTTOM_RIGHT); Label buttonSpacer = new Label(); buttons.addComponent(buttonSpacer); buttons.setExpandRatio(buttonSpacer, 1.0f); addComponent(buttons); }
From source file:com.klwork.explorer.ui.main.views.SampleMainView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();//from w w w .j a va2 s . c o m VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); HorizontalLayout usernameLayout = new HorizontalLayout(); usernameLayout.setSpacing(true); usernameLayout.addComponent(new Label("Username:")); usernameLayout.addComponent(usernameLabel); //HorizontalLayout userRolesLayout = new HorizontalLayout(); //userRolesLayout.setSpacing(true); //userRolesLayout.addComponent(new Label("Roles:")); //userRolesLayout.addComponent(rolesLabel); layout.addComponent(usernameLayout); //addComponent(userRolesLayout); Link roleUserView = new Link("Role \"user\" View (disabled, if user doesn't have access)", new ExternalResource("#!" + RoleUserView.NAME)); Link roleAdminView = new Link("Role \"admin\" View (disabled, if user doesn't have access)", new ExternalResource("#!" + RoleAdminView.NAME)); Link authenticatedView = new Link("@RequiresAuthentication View (disabled, if user doesn't have access)", new ExternalResource("#!" + AuthenticatedView.NAME)); Link guestView = new Link("@RequiresGuest View (disabled, if user doesn't have access)", new ExternalResource("#!" + GuestView.NAME)); Link userView = new Link("@RequiresUser View (disabled, if user doesn't have access)", new ExternalResource("#!" + UserView.NAME)); roleUserView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleUserView.class)); roleAdminView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleAdminView.class)); authenticatedView.setEnabled(ShiroSecurityNavigator.hasAccess(AuthenticatedView.class)); guestView.setEnabled(ShiroSecurityNavigator.hasAccess(GuestView.class)); userView.setEnabled(ShiroSecurityNavigator.hasAccess(UserView.class)); layout.addComponent(roleUserView); layout.addComponent(roleAdminView); layout.addComponent(authenticatedView); layout.addComponent(guestView); layout.addComponent(userView); layout.addComponent(new Link("Role \"admin\" View (throw exception, if user doesn't have access)", new ExternalResource("#!" + RoleAdminView.NAME))); layout.addComponent(new Link("Logout", new ExternalResource("/logout/"))); setContent(layout); }
From source file:com.klwork.explorer.ui.task.AbstractTaskPage.java
License:Apache License
@Override public HorizontalLayout createSelectHead() { HorizontalLayout tableHeadLayout = new HorizontalLayout(); // tableHeadLayout.setSizeFull(); tableHeadLayout.setSpacing(true);//from w w w .j av a2 s .com tableHeadLayout.setMargin(true); Resource pictureResource = Images.TASK_LIST; Embedded picture = new Embedded(null, pictureResource); picture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE); picture.setType(Embedded.TYPE_IMAGE); tableHeadLayout.addComponent(picture); tableHeadLayout.setComponentAlignment(picture, Alignment.MIDDLE_LEFT); Label nameLabel = null; nameLabel = new Label(""); nameLabel.addStyleName("taskListLabel"); // nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD); tableHeadLayout.addComponent(nameLabel); tableHeadLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT); return tableHeadLayout; }
From source file:com.klwork.explorer.ui.task.NewTaskPopupWindow.java
License:Apache License
protected void initCreateTaskButton() { HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setWidth(100, UNITS_PERCENTAGE); form.getFooter().setWidth(100, UNITS_PERCENTAGE); form.getFooter().addComponent(buttonLayout); Button createButton = new Button(i18nManager.getMessage(Messages.BUTTON_CREATE)); buttonLayout.addComponent(createButton); buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT); createButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { handleFormSubmit();/*from w w w. j a va 2s. c o m*/ } }); }
From source file:com.klwork.explorer.ui.task.NewTodoToTaskPopupWindow.java
License:Apache License
protected void initCreateTaskButton() { HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setWidth(100, Unit.PERCENTAGE); form.addComponent(buttonLayout);//from www . j a v a2s . co m Button createButton = new Button(i18nManager.getMessage(Messages.BUTTON_CREATE)); buttonLayout.addComponent(createButton); buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT); createButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { handleFormSubmit(); } }); }