List of usage examples for com.vaadin.ui HorizontalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.klwork.explorer.ui.task.TaskInvolvedPeopleComponent.java
License:Apache License
protected void initTitle(HorizontalLayout headerLayout) { title = new Label(i18nManager.getMessage(Messages.TASK_PEOPLE)); title.addStyleName(ExplorerLayout.STYLE_H3); title.setWidth(100, Unit.PERCENTAGE); headerLayout.addComponent(title); headerLayout.setExpandRatio(title, 1.0f); }
From source file:com.klwork.explorer.ui.task.TaskInvolvedPeopleComponent.java
License:Apache License
protected void initAddPeopleButton(HorizontalLayout headerLayout) { addPeopleButton = new Button(); addPeopleButton.addStyleName(ExplorerLayout.STYLE_ADD); headerLayout.addComponent(addPeopleButton); addPeopleButton.addClickListener(new ClickListener() { private static final long serialVersionUID = -8050449471041932066L; public void buttonClick(ClickEvent event) { final SelectUsersPopupWindow involvePeoplePopupWindow = new SelectUsersPopupWindow( i18nManager.getMessage(Messages.PEOPLE_INVOLVE_POPUP_CAPTION), true); //???? involvePeoplePopupWindow.addListener(new SubmitEventListener() { private static final long serialVersionUID = 4294753752316281159L; protected void submitted(SubmitEvent event) { Collection<String> selectedUserIds = involvePeoplePopupWindow.getSelectedUserIds(); for (String userId : selectedUserIds) { String role = involvePeoplePopupWindow.getSelectedUserRole(userId); taskService.addUserIdentityLink(task.getId(), userId, role); }// w w w. j a va2 s. co m //???? taskDetailPanel.notifyPeopleInvolvedChanged(); } protected void cancelled(SubmitEvent event) { } }); ViewToolManager.showPopupWindow(involvePeoplePopupWindow); } }); }
From source file:com.klwork.explorer.ui.task.TaskRelatedContentComponent.java
License:Apache License
protected void initActions() { // WW_TODO ?/* w w w . j a v a 2s. c om*/ HorizontalLayout actionsContainer = new HorizontalLayout(); actionsContainer.setSizeFull(); // Title Label processTitle = new Label(i18nManager.getMessage(Messages.TASK_RELATED_CONTENT)); processTitle.addStyleName(ExplorerLayout.STYLE_H3); processTitle.setSizeFull(); actionsContainer.addComponent(processTitle); actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_LEFT); actionsContainer.setExpandRatio(processTitle, 1.0f); // Add content button Button addRelatedContentButton = new Button(); addRelatedContentButton.addStyleName(ExplorerLayout.STYLE_ADD); addRelatedContentButton.addClickListener(new com.vaadin.ui.Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { CreateAttachmentPopupWindow popup = new CreateAttachmentPopupWindow(); if (task.getProcessInstanceId() != null) { popup.setProcessInstanceId(task.getProcessInstanceId()); } else { popup.setTaskId(task.getId()); } // Add listener to update attachments when added popup.addListener(new SubmitEventListener() { private static final long serialVersionUID = 1L; @Override protected void submitted(SubmitEvent event) { taskDetailPanel.notifyRelatedContentChanged(); } @Override protected void cancelled(SubmitEvent event) { // No attachment was added so updating UI isn't // needed. } }); ViewToolManager.showPopupWindow(popup); } }); actionsContainer.addComponent(addRelatedContentButton); actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_RIGHT); addComponent(actionsContainer); }
From source file:com.klwork.explorer.ui.task.UserDetailsComponent.java
License:Apache License
protected void addUserDetails() { VerticalLayout detailsLayout = new VerticalLayout(); addComponent(detailsLayout);/*w ww . jav a2 s .c o m*/ // Layout for name + skype HorizontalLayout nameLayout = new HorizontalLayout(); nameLayout.setSpacing(true); detailsLayout.addComponent(nameLayout); // Name Label nameLabel = null; if (user != null) { nameLabel = new Label(user.getFirstName() + " " + user.getLastName()); nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD); } else { nameLabel = new Label(" ", Label.CONTENT_XHTML); } nameLayout.addComponent(nameLabel); // Layout for lower details HorizontalLayout actionsLayout = new HorizontalLayout(); actionsLayout.setSpacing(true); detailsLayout.addComponent(actionsLayout); // Role Label roleLabel = new Label(role); actionsLayout.addComponent(roleLabel); // Action button if (clickListener != null) { Button button = new Button(buttonCaption); button.addStyleName(Reindeer.BUTTON_SMALL); button.addClickListener(clickListener); actionsLayout.addComponent(button); } }
From source file:com.klwork.explorer.ui.user.ProfilePanel.java
License:Apache License
protected void initAboutSection() { // Header//from w w w .jav a 2 s . co m HorizontalLayout header = new HorizontalLayout(); header.setWidth(100, Unit.PERCENTAGE); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); infoPanelLayout.addComponent(header); Label aboutLabel = createProfileHeader(i18nManager.getMessage(Messages.PROFILE_ABOUT)); header.addComponent(aboutLabel); header.setExpandRatio(aboutLabel, 1.0f); // only show edit/save buttons if current user matches if (isCurrentLoggedInUser) { Button actionButton = null; if (!editable) { actionButton = initEditProfileButton(); } else { actionButton = initSaveProfileButton(); } header.addComponent(actionButton); header.setComponentAlignment(actionButton, Alignment.MIDDLE_RIGHT); } // 'About' fields GridLayout aboutLayout = createInfoSectionLayout(2, 4); // Name if (!editable && (isDefined(user.getFirstName()) || isDefined(user.getLastName()))) { addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_NAME), user.getFirstName() + " " + user.getLastName()); } else if (editable) { firstNameField = new TextField(); firstNameField.focus(); addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_FIRST_NAME), firstNameField, user.getFirstName()); lastNameField = new TextField(); addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LAST_NAME), lastNameField, user.getLastName()); } // Job title if (!editable && isDefined(jobTitle)) { addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_JOBTITLE), jobTitle); } else if (editable) { jobTitleField = new TextField(); addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_JOBTITLE), jobTitleField, jobTitle); } // Birthdate if (!editable && isDefined(birthDate)) { addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_BIRTHDATE), birthDate); } else if (editable) { birthDateField = new DateField(); birthDateField.setDateFormat(Constants.DEFAULT_DATE_FORMAT); birthDateField.setResolution(DateField.RESOLUTION_DAY); try { birthDateField.setValue(new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT).parse(birthDate)); } catch (Exception e) { } // do nothing addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_BIRTHDATE), birthDateField, null); } // Location if (!editable && isDefined(location)) { addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LOCATION), location); } else if (editable) { locationField = new TextField(); addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LOCATION), locationField, location); } }
From source file:com.kohmiho.mpsr.MPSRUI.java
private void initLayout() { setContent(splitPanel1);//from ww w .jav a 2 s .c o m VerticalLayout tableLayout = new VerticalLayout(); splitPanel1.setFirstComponent(tableLayout); splitPanel1.setSecondComponent(splitPanel2); splitPanel1.setSplitPosition(30); // percentage VerticalLayout treeLayout = new VerticalLayout(); splitPanel2.setFirstComponent(treeLayout); splitPanel2.setSecondComponent(welcomePage); splitPanel2.setSplitPosition(30); Label labelPrototype = new Label("Prototype"); labelPrototype.setStyleName("prototype2"); tree.setSizeFull(); treeLayout.addComponent(labelPrototype); treeLayout.addComponent(tree); treeLayout.setSizeFull(); treeLayout.setExpandRatio(tree, 1); // ***************************************************// HorizontalLayout tableLayoutTop = new HorizontalLayout(); tableLayout.addComponent(tableLayoutTop); tableLayoutTop.addComponent(pdflink); // tableLayoutTop.addComponent(wordLink); tableLayoutTop.addComponent(saveMPSRButton); tableLayoutTop.addComponent(removeMPSRButton); pdflink.setTargetName("_blank"); // wordLink.setTargetName("_blank"); tableLayout.addComponent(mpsrTable); HorizontalLayout bottomLeftLayout = new HorizontalLayout(); tableLayout.addComponent(bottomLeftLayout); bottomLeftLayout.addComponent(searchField); bottomLeftLayout.addComponent(addNewMPSRButton); tableLayout.setSizeFull(); tableLayout.setExpandRatio(mpsrTable, 1); tableLayoutTop.setWidth("100%"); mpsrTable.setSizeFull(); bottomLeftLayout.setWidth("100%"); searchField.setWidth("100%"); bottomLeftLayout.setExpandRatio(searchField, 1); }
From source file:com.kpg.diary.ui.MenuLayout.java
License:Apache License
/** * Builds the menu./* w ww .j a va2 s . c om*/ * * @param navigator * the navigator * @return the css layout */ private CssLayout buildMenu(Navigator navigator) { // Add items menuItemsMap(); HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.addStyleName(ValoTheme.MENU_TITLE); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName(ValoTheme.MENU_TITLE); menu.addComponent(top); // menu.addComponent(createThemeSelect()); menu.addComponent(top); Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); Label title = new Label("<h2>Diary</h2>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); for (final Entry<String, String> item : menuItems.entrySet()) { Button b = new Button(item.getValue(), new ClickListener() { @Override public void buttonClick(ClickEvent event) { navigator.navigateTo(item.getKey()); } }); b.setHtmlContentAllowed(true); b.setPrimaryStyleName(ValoTheme.MENU_ITEM); if (IConstants.NavigationMenu.ADDRESS.getKey().equals(item.getKey())) { b.setIcon(FontAwesome.BOOK); } else if (IConstants.NavigationMenu.PERSON.getKey().equals(item.getKey())) { b.setIcon(FontAwesome.USER); } else { b.setIcon(FontAwesome.APPLE); } menuItemsLayout.addComponent(b); } return menu; }
From source file:com.kpg.diary.ui.NativeSelects.java
License:Apache License
public NativeSelects() { setMargin(true);// w w w . j av a2s .co m Label h1 = new Label("Selects"); h1.addStyleName(ValoTheme.LABEL_H2); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); row.setSpacing(true); addComponent(row); NativeSelect select = new NativeSelect("Drop Down Select"); row.addComponent(select); ListSelect list = new ListSelect("List Select"); list.setNewItemsAllowed(true); row.addComponent(list); TwinColSelect tcs = new TwinColSelect("TwinCol Select"); tcs.setLeftColumnCaption("Left Column"); tcs.setRightColumnCaption("Right Column"); tcs.setNewItemsAllowed(true); row.addComponent(tcs); TwinColSelect tcs2 = new TwinColSelect("Sized TwinCol Select"); tcs2.setLeftColumnCaption("Left Column"); tcs2.setRightColumnCaption("Right Column"); tcs2.setNewItemsAllowed(true); tcs2.setWidth("280px"); tcs2.setHeight("200px"); row.addComponent(tcs2); for (int i = 1; i <= 10; i++) { select.addItem("Option " + i); list.addItem("Option " + i); tcs.addItem("Option " + i); tcs2.addItem("Option " + i); } }
From source file:com.liferay.mail.vaadin.AccountEditor.java
License:Open Source License
private void createComponents() { addressField = new TextField(Lang.get("email-address")); addressField.focus();/*from ww w . j a v a 2s . co m*/ loginField = new TextField(Lang.get("login")); personalNameField = new TextField(Lang.get("personal-name")); passwordField = new TextField(Lang.get("password")); passwordField.setSecret(true); passwordSavedCheckBox = new CheckBox(Lang.get("save-password")); mailInHostNameField = new TextField(Lang.get("incoming-imap-server")); mailInPortCombo = new ComboBox(Lang.get("incoming-port"), controller.getConfigurationManager().getIncomingPorts()); mailInSecureCheckBox = new CheckBox(Lang.get("use-secure-incoming-connection")); mailOutHostNameField = new TextField(Lang.get("outgoing-smtp-server")); mailOutPortCombo = new ComboBox(Lang.get("outgoing-port"), controller.getConfigurationManager().getOutgoingPorts()); mailOutSecureCheckBox = new CheckBox(Lang.get("use-secure-outgoing-connection")); // initial validation - the account is then tested addressField.setRequired(true); mailInHostNameField.setRequired(true); mailOutHostNameField.setRequired(true); addComponent(addressField); if (!useLocalPartOfEmailAddressAsLogin) { addComponent(loginField); } addComponent(personalNameField); addComponent(passwordField); addComponent(passwordSavedCheckBox); if (!hideSettings) { addComponent(mailInHostNameField); addComponent(mailInPortCombo); addComponent(mailInSecureCheckBox); addComponent(mailOutHostNameField); addComponent(mailOutPortCombo); addComponent(mailOutSecureCheckBox); } HorizontalLayout footer = new HorizontalLayout(); footer.setSpacing(true); okButton = new Button(Lang.get("save")); okButton.setStyleName("primary"); okButton.addListener(this); footer.addComponent(okButton); cancelButton = new Button(Lang.get("cancel")); cancelButton.addListener(this); footer.addComponent(cancelButton); // TODO add footer to layout in a cleaner manner addComponent(footer); }
From source file:com.liferay.mail.vaadin.ConfirmDialog.java
License:Open Source License
public ConfirmDialog() { setModal(true);//from ww w. ja va 2s . c o m VerticalLayout vl = new VerticalLayout(); vl.setMargin(true); vl.setSpacing(true); setContent(vl); setCaption(confirmWindowCaption); confirmButton.setCaption(Lang.get("ok")); confirmButton.setStyleName("primary"); cancelButton.setCaption(Lang.get("cancel")); cancelButton.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { closeDialog(); } }); vl.addComponent(message); vl.addComponent(extraLayout); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(confirmButton); buttons.addComponent(cancelButton); vl.addComponent(buttons); vl.setComponentAlignment(buttons, "right"); setWidth("300px"); setResizable(false); confirmButton.focus(); }