List of usage examples for com.vaadin.ui TwinColSelect setRows
public void setRows(int rows)
From source file:com.tenforce.lodms.extractors.views.CkanExtractFieldFactory.java
@Override public Field createField(Item item, Object propertyId, Component uiContext) { if ("baseUri".equals(propertyId)) { TextField uriField = new TextField("CKAN Url"); uriField.setRequired(true);//from www . j a v a2s. c o m uriField.setRequiredError("CKAN Url is required!"); uriField.setWidth(350, VerticalLayout.UNITS_PIXELS); uriField.setDescription("Base url of the ckan portal."); uriField.setImmediate(true); uriField.addValidator(new AbstractStringValidator(null) { @Override protected boolean isValidString(String value) { try { new URIImpl(value); return true; } catch (Exception ex) { setErrorMessage("Invalid CKAN Url: " + ex.getMessage()); return false; } } }); return uriField; } else if ("httpMethod".equals(propertyId)) { Select selector = new Select("Http Method"); selector.addItem(HttpMethod.GET); selector.addItem(HttpMethod.POST); return selector; } else if ("publisher".equals(propertyId)) { Field field = super.createField(item, propertyId, uiContext); field.setDescription("The foaf:agent responsible for this catalog."); field.setRequired(true); return field; } else if ("title".equals(propertyId)) { Field field = super.createField(item, propertyId, uiContext); field.setDescription("Title for this catalog."); field.setRequired(true); return field; } else if ("license".equals(propertyId)) { Field field = super.createField(item, propertyId, uiContext); field.setDescription("license for this catalog."); field.setRequired(true); return field; } else if ("description".equals(propertyId)) { Field field = super.createField(item, propertyId, uiContext); field.setDescription("Description for this catalog."); field.setWidth(350, VerticalLayout.UNITS_PIXELS); field.setRequired(true); return field; } else if ("ignoredKeys".equals(propertyId)) { Field field = super.createField(item, propertyId, uiContext); field.setDescription( "A comma seperated list of attributes in the metadata that should be ignored by the extractor."); return field; } else if ("subjectPrefix".equals(propertyId)) { TextField subjectField = new TextField("Subject Prefix"); subjectField.setRequired(true); subjectField.setDescription("This prefix will be used to generate the subject url."); subjectField.setRequiredError("Subject Prefix is required!"); subjectField.setWidth(350, VerticalLayout.UNITS_PIXELS); return subjectField; } else if ("predicatePrefix".equals(propertyId)) { TextField predicateField = new TextField("Predicate Prefix"); predicateField.setRequired(true); predicateField.setDescription( "All json attributes will be prefixed with this string to generate a predicate."); predicateField.setRequiredError("Predicate Prefix is required!"); predicateField.setWidth(350, VerticalLayout.UNITS_PIXELS); return predicateField; } else if ("packageIds".equals(propertyId)) { TwinColSelect select = new TwinColSelect("Select catalog records to harvest"); select.setLeftColumnCaption("Available records"); select.setRightColumnCaption("Selected records"); select.setRows(20); select.setWidth(500, VerticalLayout.UNITS_PIXELS); return select; } else if ("allDatasets".equals(propertyId)) { CheckBox box = new CheckBox("harvest all datasets"); box.setImmediate(true); return box; } return super.createField(item, propertyId, uiContext); }
From source file:cz.opendata.linked.metadata.form.ExtractorDialog.java
private void setTcsConfig(LinkedList<URL> list, LinkedList<URL> possibleList, TwinColSelect tcs) { for (URL c : possibleList) tcs.addItem(c.toString());/*w w w .j a va 2 s. c o m*/ tcs.setRows(possibleList.size()); for (URL l : list) { if (!tcs.containsId(l.toString())) tcs.addItem(l.toString()); } Collection<String> srcs = new LinkedList<String>(); for (URL l : list) { srcs.add(l.toString()); } tcs.setValue(srcs); }
From source file:de.kaiserpfalzEdv.vaadin.LayoutHelper.java
License:Apache License
public <T> TwinColSelect createJpaTwinColSelect(final EntityManager em, final Class<?> clasz, final String displayColumn, final String caption, final String captionLeft, final String captionRight, final int tabIndex, final int startColumn, final int startRow, final int endColumn, final int endRow) { JPAContainer<T> data = createJpaContainer(em, clasz, displayColumn); TwinColSelect result = new TwinColSelect(i18n.get(caption), data); result.setLeftColumnCaption(i18n.get(captionLeft)); result.setRightColumnCaption(i18n.get(captionRight)); result.setMultiSelect(true);//from w ww .j a v a 2 s.c om result.setRows(2); result.setItemCaptionPropertyId(displayColumn); result.setConverter(new SingleSelectConverter<T>(result)); addToLayout(result, tabIndex, startColumn, startRow, endColumn, endRow); return result; }
From source file:de.kaiserpfalzEdv.vaadin.ui.defaultviews.editor.impl.BaseEditorImpl.java
License:Apache License
protected TwinColSelect createTwinColListSelect(final String i18nBase, final String displayColumn, final int rows, final int tabIndex, final Class<? extends BaseEntity> clasz) { JPAContainer container = presenter.getContainer(clasz); container.getEntityProvider().setLazyLoadingDelegate(null); TwinColSelect result = new TwinColSelect(presenter.translate(i18nBase), container); result.setTabIndex(tabIndex);/*from ww w. j av a 2 s . co m*/ result.setLeftColumnCaption(presenter.translate(i18nBase + ".available")); result.setRightColumnCaption(presenter.translate(i18nBase + ".assigned")); result.setWidth(100f, PERCENTAGE); result.setBuffered(true); result.setMultiSelect(true); result.setRows(rows); result.setItemCaptionPropertyId(displayColumn); result.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); result.setConverter(new MultiSelectListEntityConverter(result)); result.addValueChangeListener( event -> LOG.trace("'{}' changed: {}", i18nBase, event.getProperty().getValue())); return result; }
From source file:de.kaiserpfalzEdv.vaadin.ui.defaultviews.editor.impl.BaseEditorImpl.java
License:Apache License
protected TwinColSelect createTwinColSelect(final String i18nBase, final String displayColumn, final int rows, final int tabIndex, final Class<? extends BaseEntity> clasz) { JPAContainer container = presenter.getContainer(clasz); container.getEntityProvider().setLazyLoadingDelegate(null); TwinColSelect result = new TwinColSelect(presenter.translate(i18nBase), container); result.setTabIndex(tabIndex);// w w w . j av a2s. c o m result.setLeftColumnCaption(presenter.translate(i18nBase + ".available")); result.setRightColumnCaption(presenter.translate(i18nBase + ".assigned")); result.setWidth(100f, PERCENTAGE); result.setBuffered(true); result.setMultiSelect(true); result.setRows(rows); result.setItemCaptionPropertyId(displayColumn); result.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); result.setConverter(new MultiSelectSetEntityConverter(result)); result.addValueChangeListener( event -> LOG.trace("'{}' changed: {}", i18nBase, event.getProperty().getValue())); return result; }
From source file:eu.unifiedviews.plugins.transformer.metadata.MetadataVaadinDialog.java
License:Creative Commons License
private void setTcsConfig(LinkedList<String> list, LinkedList<String> possibleList, TwinColSelect tcs) { for (String c : possibleList) { tcs.addItem(c.toString());/* www . j a v a2 s .c o m*/ } tcs.setRows(possibleList.size()); for (String l : list) { if (!tcs.containsId(l.toString())) { tcs.addItem(l.toString()); } } Collection<String> srcs = new LinkedList<>(); for (String l : list) { srcs.add(l.toString()); } tcs.setValue(srcs); }
From source file:io.subutai.plugin.accumulo.ui.wizard.ConfigurationStep.java
public static TwinColSelect getTwinSelect(String title, String captionProperty, String leftTitle, String rightTitle, int rows) { TwinColSelect twinColSelect = new TwinColSelect(title); twinColSelect.setItemCaptionPropertyId(captionProperty); twinColSelect.setRows(rows); twinColSelect.setMultiSelect(true);// w w w . j av a 2 s.c om twinColSelect.setImmediate(true); twinColSelect.setLeftColumnCaption(leftTitle); twinColSelect.setRightColumnCaption(rightTitle); twinColSelect.setWidth(100, Sizeable.Unit.PERCENTAGE); twinColSelect.setRequired(true); return twinColSelect; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.component.UserComponent.java
License:Apache License
private Component getProjectRoleManager() { VerticalLayout vl = new VerticalLayout(); ProjectTreeComponent tree = new ProjectTreeComponentBuilder().setShowRequirement(false) .setShowTestCase(false).setShowExecution(false).createProjectTreeComponent(); vl.addComponent(tree);/*from ww w .j a v a2s .co m*/ TwinColSelect roles = new TwinColSelect(TRANSLATOR.translate("general.role")); tree.addValueChangeListener((Property.ValueChangeEvent event) -> { Project selected = (Project) tree.getValue(); if (user.getUserHasRoleList() == null) { user.setUserHasRoleList(new ArrayList<>()); } if (selected != null) { HashSet<Role> values = new HashSet<>(); user.getUserHasRoleList().forEach(uhr -> { if (uhr.getProjectId() != null && Objects.equals(uhr.getProjectId().getId(), selected.getId())) { values.add(uhr.getRole()); } }); roles.setValue(values); } }); List<Role> list = new RoleJpaController(DataBaseManager.getEntityManagerFactory()).findRoleEntities(); Collections.sort(list, (Role r1, Role r2) -> TRANSLATOR.translate(r1.getRoleName()) .compareTo(TRANSLATOR.translate(r2.getRoleName()))); BeanItemContainer<Role> roleContainer = new BeanItemContainer<>(Role.class, list); roles.setContainerDataSource(roleContainer); roles.setRows(5); roles.setLeftColumnCaption(TRANSLATOR.translate("available.roles")); roles.setRightColumnCaption(TRANSLATOR.translate("current.roles")); list.forEach(r -> { roles.setItemCaption(r, TRANSLATOR.translate(r.getDescription())); }); roles.addValueChangeListener(event -> { Set<Role> selected = (Set<Role>) event.getProperty().getValue(); UserHasRoleJpaController c = new UserHasRoleJpaController(DataBaseManager.getEntityManagerFactory()); ProjectServer ps = new ProjectServer((Project) tree.getValue()); if (ps.getUserHasRoleList().isEmpty()) { ps.setUserHasRoleList(new ArrayList<>()); } selected.forEach(r -> { //Look for the existing ones boolean found = false; for (UserHasRole uhr : ps.getUserHasRoleList()) { if (Objects.equals(uhr.getVmUser().getId(), user.getId()) && Objects.equals(uhr.getRole().getId(), r.getId())) { found = true; break; } } if (!found) { try { //Create a new one UserHasRole uhr = new UserHasRole(); uhr.setProjectId(ps.getEntity()); uhr.setRole(r); uhr.setVmUser(user.getEntity()); c.create(uhr); user.update(); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); } } }); }); vl.addComponent(roles); return vl; }
From source file:org.diretto.web.richwebclient.view.windows.UploadSettingsWindow.java
/** * Constructs an {@link UploadSettingsWindow}. * // www . j a v a 2s. com * @param mainWindow The corresponding {@code MainWindow} * @param uploadSection The corresponding {@code UploadSection} * @param fileInfo The {@code FileInfo} object * @param mediaType The {@code MediaType} of the file * @param uploadSettings The corresponding {@code UploadSettings} * @param otherFiles The names of the other upload files */ public UploadSettingsWindow(final MainWindow mainWindow, final UploadSection uploadSection, FileInfo fileInfo, MediaType mediaType, UploadSettings uploadSettings, List<String> otherFiles) { super("Upload Settings"); this.mainWindow = mainWindow; setModal(true); setStyleName(Reindeer.WINDOW_BLACK); setWidth("940px"); setHeight((((int) mainWindow.getHeight()) - 160) + "px"); setResizable(false); setClosable(false); setDraggable(false); setPositionX((int) (mainWindow.getWidth() / 2.0f) - 470); setPositionY(126); wrapperLayout = new HorizontalLayout(); wrapperLayout.setSizeFull(); wrapperLayout.setMargin(true, true, true, true); addComponent(wrapperLayout); mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.setSpacing(true); HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setWidth("100%"); mainLayout.addComponent(titleLayout); HorizontalLayout leftTitleLayout = new HorizontalLayout(); titleLayout.addComponent(leftTitleLayout); titleLayout.setComponentAlignment(leftTitleLayout, Alignment.MIDDLE_LEFT); Label fileNameLabel = StyleUtils.getLabelH2(fileInfo.getName()); leftTitleLayout.addComponent(fileNameLabel); leftTitleLayout.setComponentAlignment(fileNameLabel, Alignment.MIDDLE_LEFT); Label bullLabel = StyleUtils.getLabelHTML( " • "); leftTitleLayout.addComponent(bullLabel); leftTitleLayout.setComponentAlignment(bullLabel, Alignment.MIDDLE_LEFT); Label titleLabel = StyleUtils.getLabelHTML("<b>Title</b> "); leftTitleLayout.addComponent(titleLabel); leftTitleLayout.setComponentAlignment(titleLabel, Alignment.MIDDLE_LEFT); final TextField titleField = new TextField(); titleField.setMaxLength(50); titleField.setWidth("100%"); titleField.setImmediate(true); if (uploadSettings != null && uploadSettings.getTitle() != null) { titleField.setValue(uploadSettings.getTitle()); } titleField.focus(); titleField.setCursorPosition(((String) titleField.getValue()).length()); titleLayout.addComponent(titleField); titleLayout.setComponentAlignment(titleField, Alignment.MIDDLE_RIGHT); titleLayout.setExpandRatio(leftTitleLayout, 0); titleLayout.setExpandRatio(titleField, 1); mainLayout.addComponent(StyleUtils.getHorizontalLine()); GridLayout topGridLayout = new GridLayout(2, 3); topGridLayout.setColumnExpandRatio(0, 1.0f); topGridLayout.setColumnExpandRatio(1, 0.0f); topGridLayout.setWidth("100%"); topGridLayout.setSpacing(true); mainLayout.addComponent(topGridLayout); Label descriptionLabel = StyleUtils.getLabelBold("Description"); topGridLayout.addComponent(descriptionLabel, 0, 0); final TextArea descriptionArea = new TextArea(); descriptionArea.setSizeFull(); descriptionArea.setImmediate(true); if (uploadSettings != null && uploadSettings.getDescription() != null) { descriptionArea.setValue(uploadSettings.getDescription()); } topGridLayout.addComponent(descriptionArea, 0, 1); VerticalLayout tagsWrapperLayout = new VerticalLayout(); tagsWrapperLayout.setHeight("30px"); tagsWrapperLayout.setSpacing(false); topGridLayout.addComponent(tagsWrapperLayout, 0, 2); HorizontalLayout tagsLayout = new HorizontalLayout(); tagsLayout.setWidth("100%"); tagsLayout.setSpacing(true); Label tagsLabel = StyleUtils.getLabelBoldHTML("Tags "); tagsLabel.setSizeUndefined(); tagsLayout.addComponent(tagsLabel); tagsLayout.setComponentAlignment(tagsLabel, Alignment.MIDDLE_LEFT); addTagField = new TextField(); addTagField.setImmediate(true); addTagField.setInputPrompt("Enter new Tag"); addTagField.addShortcutListener(new ShortcutListener(null, KeyCode.ENTER, new int[0]) { private static final long serialVersionUID = -4767515198819351723L; @Override public void handleAction(Object sender, Object target) { if (target == addTagField) { addTag(); } } }); tagsLayout.addComponent(addTagField); tagsLayout.setComponentAlignment(addTagField, Alignment.MIDDLE_LEFT); tabSheet = new TabSheet(); tabSheet.setStyleName(Reindeer.TABSHEET_SMALL); tabSheet.addStyleName("view"); tabSheet.addListener(new ComponentDetachListener() { private static final long serialVersionUID = -657657505471281795L; @Override public void componentDetachedFromContainer(ComponentDetachEvent event) { tags.remove(tabSheet.getTab(event.getDetachedComponent()).getCaption()); } }); Button addTagButton = new Button("Add", new Button.ClickListener() { private static final long serialVersionUID = 5914473126402594623L; @Override public void buttonClick(ClickEvent event) { addTag(); } }); addTagButton.setStyleName(Reindeer.BUTTON_DEFAULT); tagsLayout.addComponent(addTagButton); tagsLayout.setComponentAlignment(addTagButton, Alignment.MIDDLE_LEFT); Label spaceLabel = StyleUtils.getLabelHTML(""); spaceLabel.setSizeUndefined(); tagsLayout.addComponent(spaceLabel); tagsLayout.setComponentAlignment(spaceLabel, Alignment.MIDDLE_LEFT); tagsLayout.addComponent(tabSheet); tagsLayout.setComponentAlignment(tabSheet, Alignment.MIDDLE_LEFT); tagsLayout.setExpandRatio(tabSheet, 1.0f); tagsWrapperLayout.addComponent(tagsLayout); tagsWrapperLayout.setComponentAlignment(tagsLayout, Alignment.TOP_LEFT); if (uploadSettings != null && uploadSettings.getTags() != null && uploadSettings.getTags().size() > 0) { for (String tag : uploadSettings.getTags()) { addTagField.setValue(tag); addTag(); } } Label presettingLabel = StyleUtils.getLabelBold("Presetting"); topGridLayout.addComponent(presettingLabel, 1, 0); final TwinColSelect twinColSelect; if (otherFiles != null && otherFiles.size() > 0) { twinColSelect = new TwinColSelect(null, otherFiles); } else { twinColSelect = new TwinColSelect(); } twinColSelect.setWidth("400px"); twinColSelect.setRows(10); topGridLayout.addComponent(twinColSelect, 1, 1); topGridLayout.setComponentAlignment(twinColSelect, Alignment.TOP_RIGHT); Label otherFilesLabel = StyleUtils .getLabelSmallHTML("Select the files which should get the settings of this file as presetting."); otherFilesLabel.setSizeUndefined(); topGridLayout.addComponent(otherFilesLabel, 1, 2); topGridLayout.setComponentAlignment(otherFilesLabel, Alignment.MIDDLE_CENTER); mainLayout.addComponent(StyleUtils.getHorizontalLine()); final UploadGoogleMap googleMap; if (uploadSettings != null && uploadSettings.getTopographicPoint() != null) { googleMap = new UploadGoogleMap(mediaType, 12, uploadSettings.getTopographicPoint().getLatitude(), uploadSettings.getTopographicPoint().getLongitude(), MapType.HYBRID); } else { googleMap = new UploadGoogleMap(mediaType, 12, 48.42255269321401d, 9.956477880477905d, MapType.HYBRID); } googleMap.setWidth("100%"); googleMap.setHeight("300px"); mainLayout.addComponent(googleMap); mainLayout.addComponent(StyleUtils.getHorizontalLine()); GridLayout bottomGridLayout = new GridLayout(3, 3); bottomGridLayout.setSizeFull(); bottomGridLayout.setSpacing(true); mainLayout.addComponent(bottomGridLayout); Label licenseLabel = StyleUtils.getLabelBold("License"); bottomGridLayout.addComponent(licenseLabel, 0, 0); final TextArea licenseArea = new TextArea(); licenseArea.setWidth("320px"); licenseArea.setHeight("175px"); licenseArea.setImmediate(true); if (uploadSettings != null && uploadSettings.getLicense() != null) { licenseArea.setValue(uploadSettings.getLicense()); } bottomGridLayout.addComponent(licenseArea, 0, 1); final Label startTimeLabel = StyleUtils.getLabelBold("Earliest possible Start Date"); startTimeLabel.setSizeUndefined(); bottomGridLayout.setComponentAlignment(startTimeLabel, Alignment.TOP_CENTER); bottomGridLayout.addComponent(startTimeLabel, 1, 0); final InlineDateField startTimeField = new InlineDateField(); startTimeField.setImmediate(true); startTimeField.setResolution(InlineDateField.RESOLUTION_SEC); boolean currentTimeAdjusted = false; if (uploadSettings != null && uploadSettings.getTimeRange() != null && uploadSettings.getTimeRange().getStartDateTime() != null) { startTimeField.setValue(uploadSettings.getTimeRange().getStartDateTime().toDate()); } else { currentTimeAdjusted = true; startTimeField.setValue(new Date()); } bottomGridLayout.setComponentAlignment(startTimeField, Alignment.TOP_CENTER); bottomGridLayout.addComponent(startTimeField, 1, 1); final CheckBox exactTimeCheckBox = new CheckBox("This is the exact point in time."); exactTimeCheckBox.setImmediate(true); bottomGridLayout.setComponentAlignment(exactTimeCheckBox, Alignment.TOP_CENTER); bottomGridLayout.addComponent(exactTimeCheckBox, 1, 2); final Label endTimeLabel = StyleUtils.getLabelBold("Latest possible Start Date"); endTimeLabel.setSizeUndefined(); bottomGridLayout.setComponentAlignment(endTimeLabel, Alignment.TOP_CENTER); bottomGridLayout.addComponent(endTimeLabel, 2, 0); final InlineDateField endTimeField = new InlineDateField(); endTimeField.setImmediate(true); endTimeField.setResolution(InlineDateField.RESOLUTION_SEC); if (uploadSettings != null && uploadSettings.getTimeRange() != null && uploadSettings.getTimeRange().getEndDateTime() != null) { endTimeField.setValue(uploadSettings.getTimeRange().getEndDateTime().toDate()); } else { endTimeField.setValue(startTimeField.getValue()); } bottomGridLayout.setComponentAlignment(endTimeField, Alignment.TOP_CENTER); bottomGridLayout.addComponent(endTimeField, 2, 1); if (!currentTimeAdjusted && ((Date) startTimeField.getValue()).equals((Date) endTimeField.getValue())) { exactTimeCheckBox.setValue(true); endTimeLabel.setEnabled(false); endTimeField.setEnabled(false); } exactTimeCheckBox.addListener(new ValueChangeListener() { private static final long serialVersionUID = 7193545421803538364L; @Override public void valueChange(ValueChangeEvent event) { if ((Boolean) event.getProperty().getValue()) { endTimeLabel.setEnabled(false); endTimeField.setEnabled(false); } else { endTimeLabel.setEnabled(true); endTimeField.setEnabled(true); } } }); mainLayout.addComponent(StyleUtils.getHorizontalLine()); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setMargin(true, false, false, false); buttonLayout.setSpacing(false); HorizontalLayout uploadButtonLayout = new HorizontalLayout(); uploadButtonLayout.setMargin(false, true, false, false); uploadButton = new Button("Upload File", new Button.ClickListener() { private static final long serialVersionUID = 8013811216568950479L; @Override @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { String titleValue = titleField.getValue().toString().trim(); Date startTimeValue = (Date) startTimeField.getValue(); Date endTimeValue = (Date) endTimeField.getValue(); boolean exactTimeValue = (Boolean) exactTimeCheckBox.getValue(); if (titleValue.equals("")) { ConfirmWindow confirmWindow = new ConfirmWindow(mainWindow, "Title Field", StyleUtils.getLabelHTML("A title entry is required.")); mainWindow.addWindow(confirmWindow); } else if (titleValue.length() < 5 || titleValue.length() > 50) { ConfirmWindow confirmWindow = new ConfirmWindow(mainWindow, "Title Field", StyleUtils .getLabelHTML("The number of characters of the title has to be between 5 and 50.")); mainWindow.addWindow(confirmWindow); } else if (!exactTimeValue && startTimeValue.after(endTimeValue)) { ConfirmWindow confirmWindow = new ConfirmWindow(mainWindow, "Date Entries", StyleUtils.getLabelHTML("The second date has to be after the first date.")); mainWindow.addWindow(confirmWindow); } else if (startTimeValue.after(new Date()) || (!exactTimeValue && endTimeValue.after(new Date()))) { ConfirmWindow confirmWindow = new ConfirmWindow(mainWindow, "Date Entries", StyleUtils.getLabelHTML("The dates are not allowed to be in the future.")); mainWindow.addWindow(confirmWindow); } else { disableButtons(); String descriptionValue = descriptionArea.getValue().toString().trim(); String licenseValue = licenseArea.getValue().toString().trim(); TopographicPoint topographicPointValue = googleMap.getMarkerPosition(); Collection<String> presettingValues = (Collection<String>) twinColSelect.getValue(); if (exactTimeValue) { endTimeValue = startTimeValue; } TimeRange timeRange = new TimeRange(new DateTime(startTimeValue), new DateTime(endTimeValue)); UploadSettings uploadSettings = new UploadSettings(titleValue, descriptionValue, licenseValue, new Vector<String>(tags), topographicPointValue, timeRange); mainWindow.removeWindow(event.getButton().getWindow()); requestRepaint(); uploadSection.upload(uploadSettings, new Vector<String>(presettingValues)); } } }); uploadButton.setStyleName(Reindeer.BUTTON_DEFAULT); uploadButtonLayout.addComponent(uploadButton); buttonLayout.addComponent(uploadButtonLayout); HorizontalLayout cancelButtonLayout = new HorizontalLayout(); cancelButtonLayout.setMargin(false, true, false, false); cancelButton = new Button("Cancel", new Button.ClickListener() { private static final long serialVersionUID = -2565870159504952913L; @Override public void buttonClick(ClickEvent event) { disableButtons(); mainWindow.removeWindow(event.getButton().getWindow()); requestRepaint(); uploadSection.cancelUpload(); } }); cancelButton.setStyleName(Reindeer.BUTTON_DEFAULT); cancelButtonLayout.addComponent(cancelButton); buttonLayout.addComponent(cancelButtonLayout); cancelAllButton = new Button("Cancel All", new Button.ClickListener() { private static final long serialVersionUID = -8578124709201789182L; @Override public void buttonClick(ClickEvent event) { disableButtons(); mainWindow.removeWindow(event.getButton().getWindow()); requestRepaint(); uploadSection.cancelAllUploads(); } }); cancelAllButton.setStyleName(Reindeer.BUTTON_DEFAULT); buttonLayout.addComponent(cancelAllButton); mainLayout.addComponent(buttonLayout); mainLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_CENTER); wrapperLayout.addComponent(mainLayout); }
From source file:org.hip.vif.admin.member.ui.SelectMemberLookup.java
License:Open Source License
/** View constructor. * * @param inSubtitle String/*w ww . j a v a 2 s. c o m*/ * @param inRightColumnTitle String * @param inMembers {@link MemberBeanContainer} the available members to select from * @param inAdmins {@link Collection} the collection of members already selected (must be a subset of * <code>inMembers</code>) * @param inTask {@link AbstrachtMemberLookupTask} */ public SelectMemberLookup(final String inSubtitle, final String inRightColumnTitle, final MemberBeanContainer inMembers, final Collection<MemberBean> inAdmins, final AbstrachtMemberLookupTask inTask) { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout); final IMessages lMessages = Activator.getMessages(); lLayout.setStyleName("vif-view"); //$NON-NLS-1$ lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", //$NON-NLS-1$ lMessages.getMessage("ui.member.lookup.title.page")), ContentMode.HTML)); //$NON-NLS-1$ lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-description", inSubtitle), //$NON-NLS-1$ ContentMode.HTML)); final TwinColSelect lSelect = new TwinColSelect(); lSelect.setContainerDataSource(inMembers); lSelect.setValue(inAdmins); lSelect.setLeftColumnCaption(lMessages.getMessage("ui.member.lookup.available")); //$NON-NLS-1$ lSelect.setRightColumnCaption(inRightColumnTitle); //$NON-NLS-1$ lSelect.setWidth(650, Unit.PIXELS); lSelect.setRows(19); lSelect.setImmediate(true); lLayout.addComponent(lSelect); lLayout.addComponent(RiplaViewHelper.createSpacer()); final Button lSave = new Button(lMessages.getMessage("ui.member.button.save")); //$NON-NLS-1$ lSave.addClickListener(new Button.ClickListener() { @Override @SuppressWarnings("unchecked") public void buttonClick(final ClickEvent inEvent) { if (!inTask.selectMembers((Collection<MemberBean>) lSelect.getValue())) { Notification.show(lMessages.getMessage("ui.member.lookup.error.msg"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } }); lLayout.addComponent(lSave); }