List of usage examples for com.vaadin.ui HorizontalLayout setSizeFull
@Override public void setSizeFull()
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java
License:Open Source License
public void appendGeneralToolBar(Panel theToolBarPanel) { HorizontalLayout toolBar = new HorizontalLayout(); toolBar.setWidth("100%"); toolBar.setStyleName("toolbar"); NativeButton deleteButton = new NativeButton("Delete"); deleteButton.setIcon(new ThemeResource("icons/deleteNew.png")); deleteButton.addListener(new ClickListener() { private static final long serialVersionUID = 1289257412952359727L; @Override//from w ww . ja v a 2 s .c o m public void buttonClick(ClickEvent event) { theCanvas.delete(); } }); deleteButton.setEnabled(false); NativeButton copyButton = new NativeButton("Copy"); final NativeButton pasteButton = new NativeButton("Paste"); copyButton.setIcon(new ThemeResource("icons/editcopy.png")); copyButton.addListener(new ClickListener() { private static final long serialVersionUID = -1740735587078805580L; @Override public void buttonClick(ClickEvent event) { theCanvas.copy(); pasteButton.setEnabled(true); } }); copyButton.setEnabled(false); pasteButton.setIcon(new ThemeResource("icons/editpaste.png")); pasteButton.addListener(new ClickListener() { private static final long serialVersionUID = -8732259244009686729L; @Override public void buttonClick(ClickEvent event) { theCanvas.paste(); pasteButton.setEnabled(false); } }); pasteButton.setEnabled(false); final NativeButton bracketButton = new NativeButton("Bracket"); bracketButton.setIcon(new ThemeResource("icons/bracket.png")); bracketButton.addListener(new ClickListener() { private static final long serialVersionUID = 5201094306113759901L; @Override public void buttonClick(ClickEvent event) { theCanvas.addBracket(); } }); bracketButton.setEnabled(false); final NativeButton repeatButton = new NativeButton("Repeat"); repeatButton.setIcon(new ThemeResource("icons/repeat.png")); repeatButton.addListener(new ClickListener() { private static final long serialVersionUID = -23302591439643695L; @Override public void buttonClick(ClickEvent event) { try { theCanvas.addRepeat(); } catch (Exception ex) { showMessage(ex.getMessage(), "400px", "100px", "Error creating repeat"); } } }); repeatButton.setEnabled(false); componentsWithResidueSelectionDependency.add(repeatButton); componentsWithResidueSelectionDependency.add(bracketButton); componentsWithResidueSelectionDependency.add(deleteButton); componentsWithResidueSelectionDependency.add(copyButton); final NativeButton orientationButton = new NativeButton("Orientation"); orientationButton.setIcon(new ThemeResource("icons/" + theCanvas.getOrientationIcon())); orientationButton.addListener(new ClickListener() { private static final long serialVersionUID = 6621021858668446143L; @Override public void buttonClick(ClickEvent event) { theCanvas.changeOrientation(); orientationButton.setIcon(new ThemeResource("icons/" + theCanvas.getOrientationIcon())); } }); final NativeButton selectAllButton = new NativeButton("Select all"); selectAllButton.setIcon(new ThemeResource("icons/selectall.png")); selectAllButton.addListener(new ClickListener() { private static final long serialVersionUID = -5848923636575805154L; @Override public void buttonClick(ClickEvent event) { theCanvas.selectAll(); theCanvas.documentUpdated(); } }); final NativeButton deSelectAllButton = new NativeButton("Select none"); deSelectAllButton.setIcon(new ThemeResource("icons/deselect.png")); deSelectAllButton.addListener(new ClickListener() { private static final long serialVersionUID = 8339468775345706027L; @Override public void buttonClick(ClickEvent event) { theCanvas.resetSelection(); theCanvas.documentUpdated(); } }); final NativeButton moveCWButton = new NativeButton("Move CW"); moveCWButton.setIcon(new ThemeResource("icons/rotatecw.png")); moveCWButton.addListener(new ClickListener() { private static final long serialVersionUID = -6061975045440741204L; @Override public void buttonClick(ClickEvent event) { theCanvas.onMoveCW(); } }); componentsWithResidueSelectionDependency.add(moveCWButton); final NativeButton moveCCWButton = new NativeButton("Move CCW"); moveCCWButton.setIcon(new ThemeResource("icons/rotateccw.png")); moveCCWButton.addListener(new ClickListener() { private static final long serialVersionUID = 3555726070782377309L; @Override public void buttonClick(ClickEvent event) { theCanvas.onMoveCCW(); } }); componentsWithResidueSelectionDependency.add(moveCCWButton); toolBar.addComponent(deleteButton); toolBar.addComponent(copyButton); toolBar.addComponent(pasteButton); toolBar.addComponent(orientationButton); toolBar.addComponent(selectAllButton); toolBar.addComponent(deSelectAllButton); toolBar.addComponent(bracketButton); toolBar.addComponent(repeatButton); toolBar.addComponent(moveCWButton); toolBar.addComponent(moveCCWButton); HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); toolBar.addComponent(layout); toolBar.setExpandRatio(layout, 1); theToolBarPanel.setContent(toolBar); }
From source file:annis.gui.HelpUsWindow.java
License:Apache License
public HelpUsWindow() { setSizeFull();/*from w w w .j a v a 2s . c o m*/ layout = new VerticalLayout(); setContent(layout); layout.setSizeFull(); layout.setMargin(new MarginInfo(false, false, true, false)); HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setSizeFull(); hLayout.setMargin(false); VerticalLayout labelLayout = new VerticalLayout(); labelLayout.setMargin(true); labelLayout.setSizeFull(); Label lblOpenSource = new Label(); lblOpenSource.setValue("<h1>ANNIS is <a href=\"http://opensource.org/osd\">Open Source</a> " + "software.</h1>" + "<p>This means you are free to download the source code and add new " + "features or make other adjustments to ANNIS on your own.<p/>" + "Here are some examples how you can help ANNIS:" + "<ul>" + "<li>Fix or report problems (bugs) you encounter when using the ANNIS software.</li>" + "<li>Add new features.</li>" + "<li>Enhance the documentation</li>" + "</ul>" + "<p>Feel free to visit our GitHub page for more information: <a href=\"https://github.com/korpling/ANNIS\" target=\"_blank\">https://github.com/korpling/ANNIS</a></p>"); lblOpenSource.setContentMode(ContentMode.HTML); lblOpenSource.setStyleName("opensource"); lblOpenSource.setWidth("100%"); lblOpenSource.setHeight("-1px"); labelLayout.addComponent(lblOpenSource); Link lnkFork = new Link(); lnkFork.setResource(new ExternalResource("https://github.com/korpling/ANNIS")); lnkFork.setIcon( new ExternalResource("https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png")); lnkFork.setTargetName("_blank"); hLayout.addComponent(labelLayout); hLayout.addComponent(lnkFork); hLayout.setComponentAlignment(labelLayout, Alignment.TOP_LEFT); hLayout.setComponentAlignment(lnkFork, Alignment.TOP_RIGHT); hLayout.setExpandRatio(labelLayout, 1.0f); layout.addComponent(hLayout); final HelpUsWindow finalThis = this; btClose = new Button("Close"); btClose.addClickListener(new OkClickListener(finalThis)); layout.addComponent(btClose); layout.setComponentAlignment(hLayout, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER); layout.setExpandRatio(hLayout, 1.0f); }
From source file:annis.gui.ShareSingleMatchGenerator.java
License:Apache License
public ShareSingleMatchGenerator(List<ResolverEntry> visualizers, Match match, PagedResultQuery query, String segmentation, PluginSystem ps) { this.match = match; this.query = query; this.segmentation = segmentation; this.ps = ps; setResizeLazy(true);// ww w . ja va 2 s . co m directURL = new ObjectProperty<>(""); iframeCode = new ObjectProperty<>(""); visContainer = new BeanItemContainer<>(ResolverEntry.class); visContainer.addAll(visualizers); txtDirectURL = new TextArea(directURL); txtDirectURL.setCaption("Link for publications"); txtDirectURL.setWidth("100%"); txtDirectURL.setHeight("-1px"); txtDirectURL.addStyleName(ValoTheme.TEXTFIELD_LARGE); txtDirectURL.addStyleName("shared-text"); txtDirectURL.setWordwrap(true); txtDirectURL.setReadOnly(true); txtIFrameCode = new TextArea(iframeCode); txtIFrameCode.setCaption("Code for embedding visualization into web page"); txtIFrameCode.setWidth("100%"); txtIFrameCode.setHeight("-1px"); txtIFrameCode.addStyleName(ValoTheme.TEXTFIELD_LARGE); txtIFrameCode.addStyleName("shared-text"); txtIFrameCode.setWordwrap(true); txtIFrameCode.setReadOnly(true); preview = new BrowserFrame(); preview.setCaption("Preview"); preview.addStyleName("shared-text"); preview.setSizeFull(); generatedLinks = new VerticalLayout(txtDirectURL, txtIFrameCode, preview); generatedLinks.setComponentAlignment(txtDirectURL, Alignment.TOP_LEFT); generatedLinks.setComponentAlignment(txtIFrameCode, Alignment.TOP_LEFT); generatedLinks.setExpandRatio(preview, 1.0f); visSelector = new Grid(visContainer); visSelector.setCaption("Select visualization"); visSelector.setHeight("100%"); visSelector.setColumns("displayName"); visSelector.setSelectionMode(Grid.SelectionMode.SINGLE); visSelector.addSelectionListener(ShareSingleMatchGenerator.this); visSelector.select(visContainer.getIdByIndex(0)); visSelector.setWidth("300px"); visSelector.getColumn("displayName").setSortable(false); generatedLinks.setSizeFull(); Label infoText = new Label( "<p style=\"font-size: 18px\" >" + "<strong>Share your match:</strong> " + "1. Choose the visualization to share. 2. Copy the generated link or code. " + "3. Share this link with your peers or include the code in your website. " + "</p>", ContentMode.HTML); HorizontalLayout hLayout = new HorizontalLayout(visSelector, generatedLinks); hLayout.setSizeFull(); hLayout.setSpacing(true); hLayout.setExpandRatio(generatedLinks, 1.0f); Button btClose = new Button("Close"); btClose.setSizeUndefined(); btClose.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { getUI().removeWindow(ShareSingleMatchGenerator.this); } }); layout = new VerticalLayout(infoText, hLayout, btClose); layout.setSizeFull(); layout.setExpandRatio(hLayout, 1.0f); layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER); setContent(layout); }
From source file:at.peppol.webgui.app.LoginWindow.java
License:Mozilla Public License
private void init() { HorizontalLayout h1 = new HorizontalLayout(); h1.setSizeFull(); FormLayout fl = new FormLayout(); fl.setSizeUndefined();// ww w . ja va 2s. c om usernameField = new TextField("Username:"); usernameField.setImmediate(true); fl.addComponent(usernameField); passwordField = new PasswordField("Password:"); passwordField.setImmediate(true); fl.addComponent(passwordField); Button loginButton = new Button("Login"); loginButton.addStyleName("default"); loginButton.addListener(this); fl.addComponent(loginButton); loginButton.setClickShortcut(KeyCode.ENTER); h1.addComponent(fl); h1.setComponentAlignment(fl, Alignment.MIDDLE_CENTER); addComponent(h1); }
From source file:au.org.scoutmaster.views.ContactView.java
@Override protected AbstractLayout getAdvancedSearchLayout() { final VerticalLayout advancedSearchLayout = new VerticalLayout(); advancedSearchLayout.setSpacing(true); final HorizontalLayout tagSearchLayout = new HorizontalLayout(); this.tagSearchField = new TagField("Search Tags", true); tagSearchLayout.addComponent(this.tagSearchField); tagSearchLayout.setSizeFull(); advancedSearchLayout.addComponent(tagSearchLayout); final HorizontalLayout stringSearchLayout = new HorizontalLayout(); stringSearchLayout.addComponent(this.searchField); stringSearchLayout.setWidth("100%"); advancedSearchLayout.addComponent(stringSearchLayout); final Button searchButton = new Button("Search"); final Action1<ClickEvent> searchClickAction = new SearchClickAction(); ButtonEventSource.fromActionOf(searchButton).subscribe(searchClickAction); advancedSearchLayout.addComponent(searchButton); advancedSearchLayout.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT); return advancedSearchLayout; }
From source file:by.bigvova.MainUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { EventBus.register(this); getPage().setTitle("FoodNote"); UI.getCurrent().setLocale(Locale.forLanguageTag("ru-RU")); // Let's register a custom error handler to make the 'access denied' messages a bit friendlier. setErrorHandler(new DefaultErrorHandler() { @Override/*w ww . j a v a 2s .c o m*/ public void error(com.vaadin.server.ErrorEvent event) { if (SecurityExceptionUtils.isAccessDeniedException(event.getThrowable())) { Notification.show("Sorry, you don't have access to do that."); } else { super.error(event); } } }); HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); // By adding a security item filter, only views that are accessible to the user will show up in the side bar. sideBar.setItemFilter(new VaadinSecurityItemFilter(vaadinSecurity)); sideBar.setHeader(new CssLayout() { { Label header = new Label("<span>Food</span>Note", ContentMode.HTML); header.setWidth(100, Unit.PERCENTAGE); header.setHeightUndefined(); addComponent(header); addComponent(buildUserMenu()); } }); sideBar.getHeader().setStyleName("branding"); layout.addComponent(sideBar); CssLayout viewContainer = new CssLayout(); viewContainer.setSizeFull(); layout.addComponent(viewContainer); layout.setExpandRatio(viewContainer, 1f); Navigator navigator = new Navigator(this, viewContainer); // Without an AccessDeniedView, the view provider would act like the restricted views did not exist at all. springViewProvider.setAccessDeniedViewClass(AccessDeniedView.class); navigator.addProvider(springViewProvider); navigator.setErrorView(ErrorView.class); navigator.navigateTo(navigator.getState()); setContent(layout); // Call this here because the Navigator must have been configured before the Side Bar can be attached to a UI. }
From source file:ch.wscr.management.ui.view.MemberView.java
/** * Kopfzeile fr das Grid erstellen/*from ww w. j a v a 2 s .c om*/ * * @param grid das Grid dem die Kopfzeile hinzugefgt werden soll */ private void setHeaderRow(final Grid grid) { // TODO Erstellung neuer Mitglieder muss noch optimiert werden final Button addMember = new Button("Neu", clickEvent -> { BeanItem<Member> beanItem = memberBeanItemContainer.addItem(new Member()); grid.setEditorEnabled(true); //grid.editItem(beanItem); }); addMember.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); addMember.setIcon(FontAwesome.PLUS_CIRCLE); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSizeFull(); buttonLayout.setSpacing(true); buttonLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); buttonLayout.addComponent(addMember); HeaderRow headerRow = grid.prependHeaderRow(); headerRow.join("memberId", "lastName", "firstName", "adrStreet", "adrPostalCode", "adrCity", "adrCountry", "birthDate", "driverLicense"); headerRow.getCell("lastName").setComponent(buttonLayout); }
From source file:com.esofthead.mycollab.mobile.module.crm.ui.NotesList.java
License:Open Source License
private void initUI() { noteList = new BeanList<NoteService, NoteSearchCriteria, SimpleNote>(noteService, NoteRowDisplayHandler.class); noteList.setDisplayEmptyListText(false); noteList.setStyleName("noteList"); noteListContainer = new VerticalLayout(); this.setContent(noteListContainer); displayNotes();/*from ww w .java2 s. c om*/ HorizontalLayout commentBox = new HorizontalLayout(); commentBox.setSizeFull(); commentBox.setStyleName("comment-box"); commentBox.setSpacing(true); commentBox.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); final TextArea noteInput = new TextArea(); noteInput.setInputPrompt(AppContext.getMessage(GenericI18Enum.M_NOTE_INPUT_PROMPT)); noteInput.setSizeFull(); commentBox.addComponent(noteInput); commentBox.setExpandRatio(noteInput, 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 = -5095455325725786794L; @Override public void buttonClick(Button.ClickEvent event) { final Note note = new Note(); note.setCreateduser(AppContext.getUsername()); note.setNote(noteInput.getValue()); note.setSaccountid(AppContext.getAccountId()); note.setSubject(""); note.setType(type); note.setTypeid(typeid); note.setCreatedtime(new GregorianCalendar().getTime()); note.setLastupdatedtime(new GregorianCalendar().getTime()); noteService.saveWithSession(note, AppContext.getUsername()); // Save Relay Email -- having time must refact to // Aop // ------------------------------------------------------ RelayEmailNotification relayNotification = new RelayEmailNotification(); relayNotification.setChangeby(AppContext.getUsername()); relayNotification.setChangecomment(noteInput.getValue()); relayNotification.setSaccountid(AppContext.getAccountId()); relayNotification.setType(type); relayNotification.setAction(MonitorTypeConstants.ADD_COMMENT_ACTION); relayNotification.setTypeid("" + typeid); if (type.equals(CrmTypeConstants.ACCOUNT)) { relayNotification.setEmailhandlerbean(AccountRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CONTACT)) { relayNotification.setEmailhandlerbean(ContactRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CAMPAIGN)) { relayNotification.setEmailhandlerbean(CampaignRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.LEAD)) { relayNotification.setEmailhandlerbean(LeadRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.OPPORTUNITY)) { relayNotification.setEmailhandlerbean(OpportunityRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CASE)) { relayNotification.setEmailhandlerbean(CaseRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.TASK)) { relayNotification.setEmailhandlerbean(TaskRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.MEETING)) { relayNotification.setEmailhandlerbean(MeetingRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CALL)) { relayNotification.setEmailhandlerbean(CallRelayEmailNotificationAction.class.getName()); } RelayEmailNotificationService relayEmailNotificationService = ApplicationContextUtil .getSpringBean(RelayEmailNotificationService.class); relayEmailNotificationService.saveWithSession(relayNotification, AppContext.getUsername()); noteInput.setValue(""); displayNotes(); } }); commentBox.addComponent(postBtn); this.setToolbar(commentBox); }
From source file:com.esofthead.mycollab.module.file.view.components.AbstractResourceMovingWindow.java
License:Open Source License
private void constructBody() { MVerticalLayout contentLayout = new MVerticalLayout().withSpacing(true).withMargin(true); this.setContent(contentLayout); final HorizontalLayout resourceContainer = new HorizontalLayout(); resourceContainer.setSizeFull(); this.folderTree = new TreeTable(); this.folderTree.setMultiSelect(false); this.folderTree.setSelectable(true); this.folderTree.setImmediate(true); this.folderTree.addContainerProperty("Name", String.class, ""); this.folderTree.addContainerProperty("Date Modified", String.class, ""); this.folderTree.setColumnWidth("Date Modified", UIConstants.TABLE_DATE_TIME_WIDTH); this.folderTree.setColumnExpandRatio("Name", 1.0f); this.folderTree.setWidth("100%"); resourceContainer.addComponent(this.folderTree); this.folderTree.addExpandListener(new Tree.ExpandListener() { private static final long serialVersionUID = 1L; @Override//from ww w .j a v a2 s . c om public void nodeExpand(final ExpandEvent event) { final Folder expandFolder = (Folder) event.getItemId(); // load externalResource if currentExpandFolder is // rootFolder if (rootPath.equals(expandFolder.getPath())) { List<ExternalDrive> externalDrives = externalDriveService .getExternalDrivesOfUser(AppContext.getUsername()); for (ExternalDrive externalDrive : externalDrives) { ExternalFolder externalMapFolder = new ExternalFolder("/"); externalMapFolder.setStorageName(externalDrive.getStoragename()); externalMapFolder.setExternalDrive(externalDrive); externalMapFolder.setName(externalDrive.getFoldername()); Calendar cal = GregorianCalendar.getInstance(); cal.setTime(externalDrive.getCreatedtime()); externalMapFolder.setCreated(cal); expandFolder.addChild(externalMapFolder); AbstractResourceMovingWindow.this.folderTree .addItem( new Object[] { externalMapFolder.getName(), AppContext .formatDateTime(externalMapFolder.getCreated().getTime()) }, externalMapFolder); AbstractResourceMovingWindow.this.folderTree.setItemIcon(externalMapFolder, MyCollabResource.newResource("icons/16/ecm/dropbox.png")); AbstractResourceMovingWindow.this.folderTree.setItemCaption(externalMapFolder, externalMapFolder.getName()); AbstractResourceMovingWindow.this.folderTree.setParent(externalMapFolder, expandFolder); } } if (expandFolder instanceof ExternalFolder) { List<ExternalFolder> subFolders = externalResourceService.getSubFolders( ((ExternalFolder) expandFolder).getExternalDrive(), expandFolder.getPath()); for (final Folder subFolder : subFolders) { expandFolder.addChild(subFolder); Date dateTime = ((ExternalFolder) subFolder).getExternalDrive().getCreatedtime(); AbstractResourceMovingWindow.this.folderTree.addItem( new Object[] { subFolder.getName(), AppContext.formatDateTime(dateTime) }, subFolder); AbstractResourceMovingWindow.this.folderTree.setItemIcon(subFolder, MyCollabResource.newResource("icons/16/ecm/dropbox_subfolder.png")); AbstractResourceMovingWindow.this.folderTree.setItemCaption(subFolder, subFolder.getName()); AbstractResourceMovingWindow.this.folderTree.setParent(subFolder, expandFolder); } } else { final List<Folder> subFolders = AbstractResourceMovingWindow.this.resourceService .getSubFolders(expandFolder.getPath()); AbstractResourceMovingWindow.this.folderTree.setItemIcon(expandFolder, MyCollabResource.newResource("icons/16/ecm/folder_open.png")); if (subFolders != null) { for (final Folder subFolder : subFolders) { expandFolder.addChild(subFolder); AbstractResourceMovingWindow.this.folderTree.addItem( new Object[] { subFolder.getName(), AppContext.formatDateTime(subFolder.getCreated().getTime()) }, subFolder); AbstractResourceMovingWindow.this.folderTree.setItemIcon(subFolder, MyCollabResource.newResource("icons/16/ecm/folder_close.png")); AbstractResourceMovingWindow.this.folderTree.setItemCaption(subFolder, subFolder.getName()); AbstractResourceMovingWindow.this.folderTree.setParent(subFolder, expandFolder); } } } } }); this.folderTree.addCollapseListener(new Tree.CollapseListener() { private static final long serialVersionUID = 1L; @Override public void nodeCollapse(final CollapseEvent event) { final Folder collapseFolder = (Folder) event.getItemId(); if (collapseFolder instanceof ExternalFolder) { if (collapseFolder.getPath().equals("/")) AbstractResourceMovingWindow.this.folderTree.setItemIcon(collapseFolder, MyCollabResource.newResource("icons/16/ecm/dropbox.png")); else AbstractResourceMovingWindow.this.folderTree.setItemIcon(collapseFolder, MyCollabResource.newResource("icons/16/ecm/dropbox_subfolder.png")); } else { AbstractResourceMovingWindow.this.folderTree.setItemIcon(collapseFolder, MyCollabResource.newResource("icons/16/ecm/folder_close.png")); } for (Folder folder : collapseFolder.getChilds()) { recursiveRemoveSubItem(folder); } } private void recursiveRemoveSubItem(Folder collapseFolder) { List<Folder> childs = collapseFolder.getChilds(); if (childs.size() > 0) { for (final Folder subFolder : childs) { recursiveRemoveSubItem(subFolder); } AbstractResourceMovingWindow.this.folderTree.removeItem(collapseFolder); } else { AbstractResourceMovingWindow.this.folderTree.removeItem(collapseFolder); } } }); this.folderTree.addItemClickListener(new ItemClickEvent.ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final ItemClickEvent event) { AbstractResourceMovingWindow.this.baseFolder = (Folder) event.getItemId(); } }); contentLayout.addComponent(resourceContainer); displayFiles(); HorizontalLayout controlGroupBtnLayout = new HorizontalLayout(); controlGroupBtnLayout.setSpacing(true); Button moveBtn = new Button("Move", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (resourceEditting != null) { try { resourceMover.moveResource(resourceEditting, baseFolder, AppContext.getUsername(), AppContext.getAccountId()); displayAfterMoveSuccess(AbstractResourceMovingWindow.this.baseFolder, false); } finally { AbstractResourceMovingWindow.this.close(); } } else if (!CollectionUtils.isEmpty(lstResEditting)) { boolean checkingFail = false; for (Resource res : lstResEditting) { try { resourceMover.moveResource(res, baseFolder, AppContext.getUsername(), AppContext.getAccountId()); } catch (Exception e) { checkingFail = true; } } AbstractResourceMovingWindow.this.close(); displayAfterMoveSuccess(AbstractResourceMovingWindow.this.baseFolder, checkingFail); } } }); moveBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlGroupBtnLayout.addComponent(moveBtn); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { AbstractResourceMovingWindow.this.close(); } }); cancelBtn.addStyleName(UIConstants.THEME_GRAY_LINK); controlGroupBtnLayout.addComponent(cancelBtn); contentLayout.with(controlGroupBtnLayout).withAlign(controlGroupBtnLayout, Alignment.MIDDLE_CENTER); }
From source file:com.esofthead.mycollab.module.project.view.settings.ProjectNotificationSettingViewComponent.java
License:Open Source License
public ProjectNotificationSettingViewComponent(final ProjectNotificationSetting bean) { super(AppContext.getMessage(ProjectSettingI18nEnum.VIEW_TITLE)); VerticalLayout bodyWrapper = new VerticalLayout(); bodyWrapper.setSpacing(true);/* w w w.j a va2 s . com*/ bodyWrapper.setMargin(true); bodyWrapper.setSizeFull(); HorizontalLayout notificationLabelWrapper = new HorizontalLayout(); notificationLabelWrapper.setSizeFull(); notificationLabelWrapper.setMargin(true); notificationLabelWrapper.setStyleName("notification-label"); Label notificationLabel = new Label(AppContext.getMessage(ProjectSettingI18nEnum.EXT_LEVEL)); notificationLabel.addStyleName("h2"); notificationLabel.setHeightUndefined(); notificationLabelWrapper.addComponent(notificationLabel); bodyWrapper.addComponent(notificationLabelWrapper); VerticalLayout body = new VerticalLayout(); body.setSpacing(true); body.setMargin(new MarginInfo(true, false, false, false)); final OptionGroup optionGroup = new OptionGroup(null); optionGroup.setItemCaptionMode(ItemCaptionMode.EXPLICIT); optionGroup.addItem(NotificationType.Default.name()); optionGroup.setItemCaption(NotificationType.Default.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_DEFAULT_SETTING)); optionGroup.addItem(NotificationType.None.name()); optionGroup.setItemCaption(NotificationType.None.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_NONE_SETTING)); optionGroup.addItem(NotificationType.Minimal.name()); optionGroup.setItemCaption(NotificationType.Minimal.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_MINIMUM_SETTING)); optionGroup.addItem(NotificationType.Full.name()); optionGroup.setItemCaption(NotificationType.Full.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_MAXIMUM_SETTING)); optionGroup.setHeight("100%"); body.addComponent(optionGroup); body.setExpandRatio(optionGroup, 1.0f); body.setComponentAlignment(optionGroup, Alignment.MIDDLE_LEFT); String levelVal = bean.getLevel(); if (levelVal == null) { optionGroup.select(NotificationType.Default.name()); } else { optionGroup.select(levelVal); } Button updateBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { try { bean.setLevel((String) optionGroup.getValue()); ProjectNotificationSettingService projectNotificationSettingService = ApplicationContextUtil .getSpringBean(ProjectNotificationSettingService.class); if (bean.getId() == null) { projectNotificationSettingService.saveWithSession(bean, AppContext.getUsername()); } else { projectNotificationSettingService.updateWithSession(bean, AppContext.getUsername()); } NotificationUtil.showNotification( AppContext.getMessage(ProjectSettingI18nEnum.DIALOG_UPDATE_SUCCESS)); } catch (Exception e) { throw new MyCollabException(e); } } }); updateBtn.addStyleName(UIConstants.THEME_GREEN_LINK); updateBtn.setIcon(FontAwesome.REFRESH); body.addComponent(updateBtn); body.setComponentAlignment(updateBtn, Alignment.BOTTOM_LEFT); bodyWrapper.addComponent(body); this.addComponent(bodyWrapper); }