List of usage examples for com.vaadin.ui VerticalLayout addStyleName
@Override public void addStyleName(String style)
From source file:com.lizardtech.expresszip.vaadin.FindLayersViewComponent.java
License:Apache License
public FindLayersViewComponent() { treeTable = new ExpressZipTreeTable(); popupTable = new ExpressZipTreeTable(); configureTable(treeTable);/* w w w. j a v a 2 s . c om*/ popupSelectionListener = new Property.ValueChangeListener() { private static final long serialVersionUID = 625365970493526725L; @Override public void valueChange(ValueChangeEvent event) { // the current popup selection Set<ExpressZipLayer> popupSelection = (Set<ExpressZipLayer>) event.getProperty().getValue(); // get the tree's current selection HashSet<ExpressZipLayer> treeSelection = new HashSet<ExpressZipLayer>( (Set<ExpressZipLayer>) treeTable.getValue()); // remove all items in common with popup treeSelection.removeAll(popupTable.getItemIds()); // set the treeTable selection to the union Set<ExpressZipLayer> unionSelection = new HashSet<ExpressZipLayer>(); unionSelection.addAll(popupSelection); unionSelection.addAll(treeSelection); treeTable.setValue(unionSelection); } }; popupTable.addListener(popupSelectionListener); treeTable.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 6236114836521221107L; @Override public void valueChange(ValueChangeEvent event) { Set<ExpressZipLayer> highlightedLayers = (Set<ExpressZipLayer>) event.getProperty().getValue(); for (FindLayersViewListener listener : listeners) { listener.layerHighlightedEvent(highlightedLayers); } // reset selection of popup table popupTable.removeListener(popupSelectionListener); // intersection of treeTable's selection and popupTable items Set<ExpressZipLayer> popupSelection = new HashSet<ExpressZipLayer>(); popupSelection.addAll(highlightedLayers); popupSelection.retainAll(popupTable.getItemIds()); popupTable.setValue(popupSelection); popupTable.addListener(popupSelectionListener); } }); configureTable(popupTable); filter = new Filter(this); filterButtonListener = new FilterListeners(); axisSelectedListener = new AxisSelected(); listeners = new ArrayList<FindLayersViewListener>(); btnNext = new ExpressZipButton("Next", Style.STEP); btnBack = new ExpressZipButton("Back", Style.STEP); btnAddFilter = new ExpressZipButton("Add Filter", Style.ACTION); btnAddFilter.addStyleName("filter-flow"); hshFilterButtons = new HashMap<Button, FilterObject>(); cssLayers = new CssLayout(); basemapSelector = new ComboBox(); basemapSelector.setWidth(100.0f, UNITS_PERCENTAGE); basemapSelector.setTextInputAllowed(false); basemapSelector.setImmediate(true); basemapSelector.setNullSelectionAllowed(false); basemapSelector.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -7358667131762099215L; @Override public void valueChange(ValueChangeEvent event) { ProjectedLayer l = (ProjectedLayer) basemapSelector.getValue(); boolean enableCheckbox = false; if (l instanceof WebMapServiceLayer) { for (ExpressZipLayer local : mapModel.getLocalBaseLayers()) { if (l.toString().equals(local.getName())) { enableCheckbox = true; break; } } } includeBasemap.setEnabled(enableCheckbox); if (!enableCheckbox) { includeBasemap.setValue(false); } if (mapModel.getBaseLayerTerms(l) != null && !mapModel.getBaseLayerTermsAccepted(l)) { final Window modal = new Window("Terms of Use"); modal.setModal(true); modal.setClosable(false); modal.setResizable(false); modal.getContent().setSizeUndefined(); // trick to size around content Button bOK = new ExpressZipButton("OK", Style.ACTION, new ClickListener() { private static final long serialVersionUID = -2872178665349848542L; @Override public void buttonClick(ClickEvent event) { ProjectedLayer l = (ProjectedLayer) basemapSelector.getValue(); mapModel.setBaseLayerTermsAccepted(l); for (FindLayersViewListener listener : listeners) listener.baseMapChanged(l); ((ExpressZipWindow) getApplication().getMainWindow()).removeWindow(modal); } }); Button bCancel = new ExpressZipButton("Cancel", Style.ACTION, new ClickListener() { private static final long serialVersionUID = -3044064554876422836L; @Override public void buttonClick(ClickEvent event) { basemapSelector.select(mapModel.getBaseLayers().get(0)); ((ExpressZipWindow) getApplication().getMainWindow()).removeWindow(modal); } }); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(bOK); buttons.addComponent(bCancel); Label termsText = new Label(mapModel.getBaseLayerTerms(l)); termsText.setContentMode(Label.CONTENT_XHTML); VerticalLayout vlay = new VerticalLayout(); vlay.addComponent(termsText); vlay.addComponent(buttons); vlay.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT); vlay.setWidth(400, UNITS_PIXELS); modal.getContent().addComponent(vlay); ((ExpressZipWindow) getApplication().getMainWindow()).addWindow(modal); } else { for (FindLayersViewListener listener : listeners) listener.baseMapChanged(l); } } }); includeBasemap = new CheckBox(); includeBasemap.setDescription("Include this basemap in the exported image."); includeBasemap.setWidth(64f, UNITS_PIXELS); HorizontalLayout basemapLayout = new HorizontalLayout(); basemapLayout.setWidth(100f, UNITS_PERCENTAGE); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); setSizeFull(); Label step = new Label("Step 1: Select Layers"); step.addStyleName("step"); layout.addComponent(step); layout.addComponent(treeTable); layout.setSpacing(true); treeTable.setSizeFull(); layout.setExpandRatio(treeTable, 1f); layout.addComponent(new Panel(BASEMAP, basemapLayout)); basemapLayout.addComponent(basemapSelector); basemapLayout.setExpandRatio(basemapSelector, 1f); basemapLayout.addComponent(includeBasemap); layout.addComponent(cssLayers); cssLayers.addComponent(btnAddFilter); HorizontalLayout backSubmitLayout = new HorizontalLayout(); backSubmitLayout.setWidth("100%"); backSubmitLayout.addComponent(btnBack); backSubmitLayout.addComponent(btnNext); backSubmitLayout.setComponentAlignment(btnBack, Alignment.BOTTOM_LEFT); backSubmitLayout.setComponentAlignment(btnNext, Alignment.BOTTOM_RIGHT); VerticalLayout navLayout = new VerticalLayout(); navLayout.addComponent(backSubmitLayout); navLayout.setSpacing(true); ThemeResource banner = new ThemeResource("img/ProgressBar1.png"); navLayout.addComponent(new Embedded(null, banner)); layout.addComponent(navLayout); layout.setComponentAlignment(navLayout, Alignment.BOTTOM_CENTER); btnNext.addListener(this); btnNext.setEnabled(false); btnBack.setEnabled(false); // always disabled btnAddFilter.addListener(this); layout.addStyleName("findlayers"); setCompositionRoot(layout); }
From source file:com.mcparland.john.vaadin_mvn_arch.samples.crud.ProductForm.java
License:Apache License
public ProductForm(SampleCrudLogic sampleCrudLogic) { viewLogic = sampleCrudLogic;//from ww w .jav a 2s .c o m addStyleName("product-form-wrapper"); setId("product-form"); productName.setWidth("100%"); price.setConverter(new EuroConverter()); stockCount.setWidth("80px"); availability.setNullSelectionAllowed(false); availability.setTextInputAllowed(false); for (Availability s : Availability.values()) { availability.addItem(s); } category.setWidth("100%"); saveButton.addStyleName(ValoTheme.BUTTON_PRIMARY); cancelButton.addStyleName("cancel"); removeButton.addStyleName(ValoTheme.BUTTON_DANGER); VerticalLayout layout = new VerticalLayout(); layout.setHeight("100%"); layout.setSpacing(true); layout.addStyleName("form-layout"); HorizontalLayout priceAndStock = new HorizontalLayout(price, stockCount); priceAndStock.setSpacing(true); priceAndStock.setWidth("100%"); price.setWidth("100%"); stockCount.setWidth("100%"); availability.setWidth("100%"); layout.addComponent(productName); layout.addComponent(priceAndStock); layout.addComponent(availability); layout.addComponent(category); CssLayout expander = new CssLayout(); expander.addStyleName("expander"); layout.addComponent(expander); layout.setExpandRatio(expander, 1); layout.addComponent(saveButton); layout.addComponent(cancelButton); layout.addComponent(removeButton); addComponent(layout); fieldGroup = new BeanFieldGroup<Product>(Product.class); fieldGroup.bindMemberFields(this); // perform validation and enable/disable buttons while editing ValueChangeListener valueListener = new ValueChangeListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { formHasChanged(); } }; for (Field<?> f : fieldGroup.getFields()) { f.addValueChangeListener(valueListener); } fieldGroup.addCommitHandler(new CommitHandler() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void preCommit(CommitEvent commitEvent) throws CommitException { } @Override public void postCommit(CommitEvent commitEvent) throws CommitException { DataService.get().updateProduct(fieldGroup.getItemDataSource().getBean()); } }); saveButton.addClickListener(new ClickListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { try { fieldGroup.commit(); // only if validation succeeds Product product = fieldGroup.getItemDataSource().getBean(); viewLogic.saveProduct(product); } catch (CommitException e) { Notification n = new Notification("Please re-check the fields", Type.ERROR_MESSAGE); n.setDelayMsec(500); n.show(getUI().getPage()); } } }); cancelButton.setClickShortcut(KeyCode.ESCAPE); cancelButton.addClickListener(new ClickListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { viewLogic.cancelProduct(); } }); removeButton.addClickListener(new ClickListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { Product product = fieldGroup.getItemDataSource().getBean(); viewLogic.deleteProduct(product); } }); }
From source file:com.mycollab.module.user.accountsettings.team.view.UserListViewImpl.java
License:Open Source License
private Component generateMemberBlock(final SimpleUser member) { VerticalLayout blockContent = new VerticalLayout(); blockContent.setWidth("350px"); blockContent.setStyleName("member-block"); if (RegisterStatusConstants.NOT_LOG_IN_YET.equals(member.getRegisterstatus())) { blockContent.addStyleName("inactive"); }/*w w w .j a va2s. c o m*/ MHorizontalLayout blockTop = new MHorizontalLayout().withFullWidth(); Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getAvatarid(), 100); memberAvatar.addStyleName(UIConstants.CIRCLE_BOX); blockTop.addComponent(memberAvatar); MVerticalLayout memberInfo = new MVerticalLayout().withMargin(false); MHorizontalLayout buttonControls = new MHorizontalLayout(); buttonControls.setDefaultComponentAlignment(Alignment.TOP_RIGHT); buttonControls.setVisible(UserUIContext.canWrite(RolePermissionCollections.ACCOUNT_USER)); if (RegisterStatusConstants.NOT_LOG_IN_YET.equals(member.getRegisterstatus())) { MButton resendBtn = new MButton(UserUIContext.getMessage(UserI18nEnum.ACTION_RESEND_INVITATION), clickEvent -> { SendUserInvitationEvent invitationEvent = new SendUserInvitationEvent(member.getUsername(), null, member.getInviteUser(), MyCollabUI.getSubDomain(), MyCollabUI.getAccountId()); AsyncEventBus asyncEventBus = AppContextUtil.getSpringBean(AsyncEventBus.class); asyncEventBus.post(invitationEvent); NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_SUCCESS), UserUIContext.getMessage(UserI18nEnum.OPT_SEND_INVITATION_SUCCESSFULLY, member.getDisplayName())); }).withStyleName(WebThemes.BUTTON_LINK); buttonControls.with(resendBtn); } MButton editBtn = new MButton("", clickEvent -> EventBusFactory.getInstance() .post(new UserEvent.GotoEdit(UserListViewImpl.this, member))).withIcon(FontAwesome.EDIT) .withStyleName(WebThemes.BUTTON_LINK); buttonControls.with(editBtn); MButton deleteBtn = new MButton("", clickEvent -> ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { UserService userService = AppContextUtil.getSpringBean(UserService.class); userService.pendingUserAccounts(Collections.singletonList(member.getUsername()), MyCollabUI.getAccountId()); EventBusFactory.getInstance() .post(new UserEvent.GotoList(UserListViewImpl.this, null)); } })).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK); buttonControls.with(deleteBtn); memberInfo.addComponent(buttonControls); memberInfo.setComponentAlignment(buttonControls, Alignment.MIDDLE_RIGHT); A memberLink = new A( AccountLinkGenerator.generatePreviewFullUserLink(MyCollabUI.getSiteUrl(), member.getUsername())) .appendText(member.getDisplayName()); ELabel memberLinkLbl = ELabel.h3(memberLink.write()).withStyleName(UIConstants.TEXT_ELLIPSIS); memberInfo.addComponent(memberLinkLbl); memberInfo.addComponent(ELabel.hr()); if (member.getRoleid() != null) { String memberRoleLinkPrefix = String.format("<a href=\"%s\"", AccountLinkBuilder.generatePreviewFullRoleLink(member.getRoleid())); ELabel memberRole = new ELabel(ContentMode.HTML).withStyleName(UIConstants.TEXT_ELLIPSIS); if (Boolean.TRUE.equals(member.getIsAccountOwner())) { memberRole.setValue(String.format("%sstyle=\"color: #B00000;\">%s</a>", memberRoleLinkPrefix, UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER))); } else { memberRole.setValue(String.format("%sstyle=\"color:gray;font-size:12px;\">%s</a>", memberRoleLinkPrefix, member.getRoleName())); } memberInfo.addComponent(memberRole); } else if (Boolean.TRUE.equals(member.getIsAccountOwner())) { Label memberRole = new Label(String.format("<a style=\"color: #B00000;\">%s</a>", UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER)), ContentMode.HTML); memberInfo.addComponent(memberRole); } else { Label lbl = new Label(); lbl.setHeight("10px"); memberInfo.addComponent(lbl); } if (Boolean.TRUE.equals(MyCollabUI.showEmailPublicly())) { Label memberEmailLabel = ELabel .html(String.format("<a href='mailto:%s'>%s</a>", member.getUsername(), member.getUsername())) .withStyleName(UIConstants.TEXT_ELLIPSIS, UIConstants.META_INFO).withFullWidth(); memberInfo.addComponent(memberEmailLabel); } ELabel memberSinceLabel = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE, UserUIContext.formatPrettyTime(member.getRegisteredtime()))) .withDescription(UserUIContext.formatDateTime(member.getRegisteredtime())).withFullWidth(); memberInfo.addComponent(memberSinceLabel); ELabel lastAccessTimeLbl = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_LOGGED_IN, UserUIContext.formatPrettyTime(member.getLastaccessedtime()))) .withDescription(UserUIContext.formatDateTime(member.getLastaccessedtime())); memberInfo.addComponent(lastAccessTimeLbl); blockTop.with(memberInfo).expand(memberInfo); blockContent.addComponent(blockTop); return blockContent; }
From source file:com.mycollab.module.user.accountsettings.view.AccountModuleImpl.java
License:Open Source License
public AccountModuleImpl() { addStyleName("module"); ControllerRegistry.addController(new UserAccountController(this)); MHorizontalLayout topPanel = new MHorizontalLayout().withFullWidth().withMargin(true) .withStyleName("border-bottom"); AccountSettingBreadcrumb breadcrumb = ViewManager.getCacheComponent(AccountSettingBreadcrumb.class); MButton helpBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_HELP)) .withIcon(FontAwesome.MORTAR_BOARD).withStyleName(WebThemes.BUTTON_LINK); ExternalResource helpRes = new ExternalResource("https://community.mycollab.com/docs/account-management/"); BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes); helpOpener.extend(helpBtn);//from w w w . j a v a 2s. co m topPanel.with(breadcrumb, helpBtn).expand(breadcrumb).alignAll(Alignment.MIDDLE_LEFT); tabSheet = new VerticalTabsheet(); tabSheet.setSizeFull(); tabSheet.setNavigatorStyleName("sidebar-menu"); tabSheet.addToggleNavigatorControl(); VerticalLayout contentWrapper = tabSheet.getContentWrapper(); contentWrapper.addStyleName("main-content"); contentWrapper.addComponentAsFirst(topPanel); this.buildComponents(); this.setContent(tabSheet); }
From source file:com.mycompany.project.components.NewContactForm.java
public NewContactForm() { VerticalLayout mainVLayout = new VerticalLayout(); mainVLayout.setMargin(true);/*from w ww. java 2s . c om*/ mainVLayout.setSpacing(true); mainVLayout.addStyleName(boostrap.Forms.FORM.styleName()); setContent(mainVLayout); // field properties tfName.setSizeFull(); tfPhone.setSizeFull(); tfemail.setSizeFull(); tfName.focus(); mainVLayout.addComponent(tfName); mainVLayout.addComponent(tfPhone); mainVLayout.addComponent(tfemail); Button btnSave = new Button("Guardar"); mainVLayout.addComponent(btnSave); btnSave.addClickListener(new ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // get hold of the business logic String name = tfName.getValue(); String phone = tfPhone.getValue(); String email = tfemail.getValue(); BusinessLogic bl = ((MyVaadinUI) getUI()).getBusinessLogic(); String newContactId = bl.saveNewContact(name, phone, email); if (newContactId != null) { //saved successfully Notification.show("Success", name + " saved", Notification.Type.TRAY_NOTIFICATION); //reset fields resetFields(); } else { //something bad happened Notification.show("Error", "\nContact could not be saved", Notification.Type.ERROR_MESSAGE); } } }); }
From source file:com.peergreen.example.webconsole.extensions.ConfirmDialogExtension.java
License:Open Source License
public ConfirmDialogExtension() { setSizeFull();/* w w w . j av a2 s . co m*/ setSpacing(true); setMargin(true); Link showCodeSource = new Link("Show code source", new ExternalResource(GitHubClassURL.getURL(ConfirmDialogExtension.class))); showCodeSource.setTargetName("_blank"); addComponent(showCodeSource); setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT); Label title = new Label("Drag and drop components from a panel to another"); title.addStyleName("h1"); addComponent(title); setComponentAlignment(title, Alignment.MIDDLE_CENTER); HorizontalLayout row = new HorizontalLayout(); row.setSizeFull(); row.setSpacing(true); row.setMargin(true); VerticalLayout leftPanel = new VerticalLayout(); leftPanel.setSpacing(true); leftPanel.addStyleName("dashed-area"); leftPanel.addComponent(getDraggableComponent(new Label("Label"))); leftPanel.addComponent(getDraggableComponent(new Button("Button"))); DragAndDropWrapper leftPanelWrapper = new DragAndDropWrapper(leftPanel); row.addComponent(leftPanelWrapper); row.setComponentAlignment(leftPanelWrapper, Alignment.TOP_LEFT); VerticalLayout rightPanel = new VerticalLayout(); rightPanel.setSpacing(true); rightPanel.addStyleName("dashed-area"); DragAndDropWrapper rightPanelWrapper = new DragAndDropWrapper(rightPanel); row.addComponent(rightPanelWrapper); row.setComponentAlignment(rightPanelWrapper, Alignment.TOP_RIGHT); leftPanelWrapper.setDropHandler(new ConfirmDialogExtensionDropHandler(rightPanel, leftPanel)); rightPanelWrapper.setDropHandler(new ConfirmDialogExtensionDropHandler(leftPanel, rightPanel)); addComponent(row); setExpandRatio(row, 1.5f); }
From source file:com.peergreen.webconsole.core.vaadin7.BaseUI.java
License:Open Source License
/** * Build login view// w ww.j a v a 2 s. c om * * @param exit */ private void buildLoginView(final boolean exit) { if (exit) { root.removeAllComponents(); } notifierService.closeAll(); addStyleName("login"); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setId("webconsole_loginlayout_id"); loginLayout.setSizeFull(); loginLayout.addStyleName("login-layout"); root.addComponent(loginLayout); final CssLayout loginPanel = new CssLayout(); loginPanel.addStyleName("login-panel"); HorizontalLayout labels = new HorizontalLayout(); labels.setWidth(MAX_WIDTH); labels.setMargin(true); loginPanel.addComponent(labels); Label welcome = new Label("Welcome"); welcome.addStyleName("h4"); labels.addComponent(welcome); labels.setComponentAlignment(welcome, Alignment.MIDDLE_LEFT); Label title = new Label(consoleName); //title.setSizeUndefined(); title.addStyleName("h2"); title.addStyleName("light"); labels.addComponent(title); labels.setComponentAlignment(title, Alignment.MIDDLE_RIGHT); HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true); fields.setMargin(true); fields.addStyleName("fields"); final TextField username = new TextField("Username"); username.focus(); username.setId("webconsole_login_username"); fields.addComponent(username); final PasswordField password = new PasswordField("Password"); password.setId("webconsole_login_password"); fields.addComponent(password); final Button signin = new Button("Sign In"); signin.setId("webconsole_login_signin"); signin.addStyleName("default"); fields.addComponent(signin); fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT); final ShortcutListener enter = new ShortcutListener("Sign In", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { signin.click(); } }; signin.addShortcutListener(enter); loginPanel.addComponent(fields); HorizontalLayout bottomRow = new HorizontalLayout(); bottomRow.setWidth(MAX_WIDTH); bottomRow.setMargin(new MarginInfo(false, true, false, true)); final CheckBox keepLoggedIn = new CheckBox("Keep me logged in"); bottomRow.addComponent(keepLoggedIn); bottomRow.setComponentAlignment(keepLoggedIn, Alignment.MIDDLE_LEFT); // Add new error message final Label error = new Label("Wrong username or password.", ContentMode.HTML); error.setId("webconsole_login_error"); error.addStyleName("error"); error.setSizeUndefined(); error.addStyleName("light"); // Add animation error.addStyleName("v-animate-reveal"); error.setVisible(false); bottomRow.addComponent(error); bottomRow.setComponentAlignment(error, Alignment.MIDDLE_RIGHT); loginPanel.addComponent(bottomRow); signin.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (authenticate(username.getValue(), password.getValue())) { // if (keepLoggedIn.getValue()) { // //Cookie userCookie = getCookieByName(PEERGREEN_USER_COOKIE_NAME); // if (getCookieByName(PEERGREEN_USER_COOKIE_NAME) == null) { // // Get a token for this user and create a cooki // Page.getCurrent().getJavaScript().execute( String.format("document.cookie = '%s=%s; path=%s'", // PEERGREEN_USER_COOKIE_NAME, token, VaadinService.getCurrentRequest().getContextPath())); // } else { // // update token // userCookie.setValue(token); // userCookie.setPath(VaadinService.getCurrentRequest().getContextPath()); // } // } buildMainView(); } else { error.setVisible(true); } } }); loginLayout.addComponent(loginPanel); loginLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); }
From source file:com.peergreen.webconsole.scope.deployment.internal.DeploymentScope.java
License:Open Source License
@PostConstruct public void init() { deploymentViewManager = createDeploymentViewManager(); OptionGroup option = new OptionGroup(); HorizontalLayout toolBar = new HorizontalLayout(); toolBar.setWidth("100%"); toolBar.setSpacing(true);// w ww .jav a 2 s. co m toolBar.setMargin(true); VerticalLayout uploadLayout = new VerticalLayout(); Upload uploader = new Upload("Upload a file here", null); uploader.setButtonCaption("Upload"); final FileUploader fileUploader = new FileUploader(deploymentViewManager, notifierService, artifactBuilder, option); uploader.setReceiver(fileUploader); uploader.addSucceededListener(fileUploader); uploader.addStartedListener(fileUploader); uploadLayout.addComponent(uploader); HorizontalLayout target = new HorizontalLayout(); option.addContainerProperty("id", String.class, null); option.setItemCaptionPropertyId("id"); option.addItem(DeployableContainerType.DEPLOYABLE.attribute()).getItemProperty("id") .setValue("Add to deployables"); option.addItem(DeployableContainerType.DEPLOYED.attribute()).getItemProperty("id").setValue("Deploy"); option.addItem(DeployableContainerType.DEPLOYMENT_PLAN.attribute()).getItemProperty("id") .setValue("Create a deployment plan"); option.addStyleName("horizontal"); option.select(DeployableContainerType.DEPLOYABLE.attribute()); target.addComponent(option); uploadLayout.addComponent(target); toolBar.addComponent(uploadLayout); Label infoLabel = new Label("Drop files here to create a deployment plan"); infoLabel.setSizeUndefined(); final VerticalLayout deploymentPlanMaker = new VerticalLayout(infoLabel); deploymentPlanMaker.setComponentAlignment(infoLabel, Alignment.MIDDLE_CENTER); Button draft = new Button("A draft is under construction"); draft.addStyleName("link"); draft.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { deploymentViewManager.showDeploymentPlanView(); } }); draft.setVisible(false); deploymentViewManager.setDeploymentPlanDraftViewer(draft); deploymentPlanMaker.addComponent(draft); deploymentPlanMaker.setComponentAlignment(draft, Alignment.TOP_CENTER); deploymentPlanMaker.setSizeFull(); deploymentPlanMaker.addStyleName("drop-area"); deploymentPlanMakerWrapper = new DragAndDropWrapper(deploymentPlanMaker); deploymentPlanMakerWrapper.setSizeFull(); toolBar.addComponent(deploymentPlanMakerWrapper); addComponent(toolBar); addComponent(framesContainer); setExpandRatio(framesContainer, 1.5f); helpWindow = notifierService.createHelpOverlay("Deployment module", "<p>To deploy, or undeploy, artifacts, you can drag and drop elements from deployables panel " + "to deployed panel and vice versa.</p>" + "<p>You can also drag files from desktop and drop them where you want to add them."); }
From source file:com.rdonasco.config.web.ConfigApplication.java
License:Apache License
@Override public void init() { Window mainWindow = new Window("rdonasco Config"); setMainWindow(mainWindow);/*from w w w . j a v a 2 s . c o m*/ final ConfigDataView controlledView = getConfigDataViewController().getControlledView(); // controlledView.setSizeFull(); final VerticalLayout mainWindowLayout = (VerticalLayout) mainWindow.getContent(); Button logoutButton = new Button("Refresh"); logoutButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { try { getConfigDataViewController().refreshView(); } catch (WidgetException ex) { LOG.log(Level.WARNING, ex.getMessage(), ex); } } }); setTheme("config"); mainWindowLayout.setMargin(true); mainWindowLayout.setSpacing(true); mainWindowLayout.addStyleName("mainWindow"); mainWindowLayout.setSizeFull(); mainWindowLayout.addComponent(logoutButton); mainWindowLayout.addComponent(controlledView); mainWindowLayout.setExpandRatio(controlledView, 1); }
From source file:com.selzlein.lojavirtual.vaadin.page.SettingsView.java
License:Open Source License
private void createView() { ui = (LspsUI) getUI();// w w w . j a v a 2s. c o m user = ui.getUser().getPerson(); userRights = user.getRights(); setTitle(ui.getMessage(TITLE)); Panel panel = new Panel(); panel.addStyleName("l-border-none"); setContent(panel); VerticalLayout layout = new VerticalLayout(); layout.addStyleName("l-settings"); layout.setSizeFull(); layout.setSpacing(true); layout.setMargin(true); panel.setContent(layout); //user data and settings will be laid out next to each other HorizontalLayout topSection = new HorizontalLayout(); topSection.setSpacing(true); topSection.setWidth("100%"); layout.addComponent(topSection); VerticalLayout userData = createUserDataSection(ui, user); topSection.addComponent(userData); topSection.setExpandRatio(userData, 1); Label spacer = new Label(); spacer.setWidth("20px"); topSection.addComponent(spacer); VerticalLayout settings = createSettingsSection(ui); topSection.addComponent(settings); topSection.setExpandRatio(settings, 1); //substitution section VerticalLayout substitution = createSubstitutionSection(); layout.addComponent(substitution); layout.setExpandRatio(substitution, 2); //buttons HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button saveButton = new Button(ui.getMessage("action.save"), new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (save()) { if (requestReload) { JavaScript.getCurrent().execute("window.location.reload()"); } else { close(); } } } }); saveButton.setData(BUTTON_TYPE_SAVE); buttons.addComponent(saveButton); Button cancelButton = new Button(ui.getMessage("action.cancel"), new ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); buttons.addComponent(cancelButton); layout.addComponent(buttons); }