List of usage examples for com.vaadin.ui VerticalLayout setCaption
@Override public void setCaption(String caption)
From source file:org.bubblecloud.ilves.ui.user.AccountFlowlet.java
License:Apache License
@Override public void initialize() { final GridLayout gridLayout = new GridLayout(1, 6); gridLayout.setRowExpandRatio(0, 0.0f); gridLayout.setRowExpandRatio(1, 0.0f); gridLayout.setRowExpandRatio(2, 0.0f); gridLayout.setRowExpandRatio(3, 0.0f); gridLayout.setRowExpandRatio(4, 0.0f); gridLayout.setRowExpandRatio(5, 1.0f); gridLayout.setSizeFull();// w w w.jav a 2 s.c o m gridLayout.setMargin(false); gridLayout.setSpacing(true); gridLayout.setRowExpandRatio(4, 1f); setViewContent(gridLayout); final HorizontalLayout userAccountTitle = new HorizontalLayout(); userAccountTitle.setMargin(new MarginInfo(false, false, false, false)); userAccountTitle.setSpacing(true); final Embedded userAccountTitleIcon = new Embedded(null, getSite().getIcon("view-icon-user")); userAccountTitleIcon.setWidth(32, Unit.PIXELS); userAccountTitleIcon.setHeight(32, Unit.PIXELS); userAccountTitle.addComponent(userAccountTitleIcon); final Label userAccountTitleLabel = new Label("<h2>User Account</h2>", ContentMode.HTML); userAccountTitle.addComponent(userAccountTitleLabel); gridLayout.addComponent(userAccountTitle, 0, 0); final Button editUserButton = new Button("Edit User Account"); editUserButton.setIcon(getSite().getIcon("button-icon-edit")); gridLayout.addComponent(editUserButton, 0, 2); editUserButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final User entity = ((SecurityProviderSessionImpl) getSite().getSecurityProvider()) .getUserFromSession(); final UserAccountFlowlet customerView = getFlow().getFlowlet(UserAccountFlowlet.class); customerView.edit(entity, false); getFlow().forward(UserAccountFlowlet.class); } }); final Company company = getSite().getSiteContext().getObject(Company.class); if (company.isOpenIdLogin()) { final VerticalLayout mainPanel = new VerticalLayout(); mainPanel.setCaption("Choose OpenID Provider:"); gridLayout.addComponent(mainPanel, 0, 1); final HorizontalLayout openIdLayout = new HorizontalLayout(); mainPanel.addComponent(openIdLayout); openIdLayout.setMargin(new MarginInfo(false, false, true, false)); openIdLayout.setSpacing(true); final String returnViewName = "openidlink"; final Map<String, String> urlIconMap = OpenIdUtil.getOpenIdProviderUrlIconMap(); for (final String url : urlIconMap.keySet()) { openIdLayout.addComponent(OpenIdUtil.getLoginButton(url, urlIconMap.get(url), returnViewName)); } } if (SiteModuleManager.isModuleInitialized(CustomerModule.class)) { final List<FieldDescriptor> fieldDefinitions = SiteFields.getFieldDescriptors(Customer.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); filterDefinitions.add(new FilterDescriptor("companyName", "companyName", "Company Name", new TextField(), 101, "=", String.class, "")); filterDefinitions.add(new FilterDescriptor("lastName", "lastName", "Last Name", new TextField(), 101, "=", String.class, "")); final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class); entityContainer = new EntityContainer<Customer>(entityManager, true, false, false, Customer.class, 1000, new String[] { "companyName", "lastName" }, new boolean[] { false, false }, "customerId"); for (final FieldDescriptor fieldDefinition : fieldDefinitions) { entityContainer.addContainerProperty(fieldDefinition.getId(), fieldDefinition.getValueType(), fieldDefinition.getDefaultValue(), fieldDefinition.isReadOnly(), fieldDefinition.isSortable()); } final HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setMargin(new MarginInfo(true, false, false, false)); titleLayout.setSpacing(true); final Embedded titleIcon = new Embedded(null, getSite().getIcon("view-icon-customer")); titleIcon.setWidth(32, Unit.PIXELS); titleIcon.setHeight(32, Unit.PIXELS); titleLayout.addComponent(titleIcon); final Label titleLabel = new Label("<h2>Customer Accounts</h2>", ContentMode.HTML); titleLayout.addComponent(titleLabel); gridLayout.addComponent(titleLayout, 0, 3); final Table table = new Table(); table.setPageLength(5); entityGrid = new Grid(table, entityContainer); entityGrid.setFields(fieldDefinitions); entityGrid.setFilters(filterDefinitions); //entityGrid.setFixedWhereCriteria("e.owner.companyId=:companyId"); table.setColumnCollapsed("created", true); table.setColumnCollapsed("modified", true); table.setColumnCollapsed("company", true); gridLayout.addComponent(entityGrid, 0, 5); final HorizontalLayout customerButtonsLayout = new HorizontalLayout(); gridLayout.addComponent(customerButtonsLayout, 0, 4); customerButtonsLayout.setMargin(false); customerButtonsLayout.setSpacing(true); final Button editCustomerDetailsButton = new Button("Edit Customer Details"); customerButtonsLayout.addComponent(editCustomerDetailsButton); editCustomerDetailsButton.setEnabled(false); editCustomerDetailsButton.setIcon(getSite().getIcon("button-icon-edit")); editCustomerDetailsButton.addClickListener(new ClickListener() { /** * Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (entityGrid.getSelectedItemId() == null) { return; } final Customer entity = entityContainer.getEntity(entityGrid.getSelectedItemId()); final CustomerFlowlet customerView = getFlow().forward(CustomerFlowlet.class); customerView.edit(entity, false); } }); final Button editCustomerMembersButton = new Button("Edit Customer Members"); customerButtonsLayout.addComponent(editCustomerMembersButton); editCustomerMembersButton.setEnabled(false); editCustomerMembersButton.setIcon(getSite().getIcon("button-icon-edit")); editCustomerMembersButton.addClickListener(new ClickListener() { /** * Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (entityGrid.getSelectedItemId() == null) { return; } final Customer entity = entityContainer.getEntity(entityGrid.getSelectedItemId()); final GroupFlowlet view = getFlow().forward(GroupFlowlet.class); view.edit(entity.getMemberGroup(), false); } }); final Button editCustomerAdminsButton = new Button("Edit Customer Admins"); customerButtonsLayout.addComponent(editCustomerAdminsButton); editCustomerAdminsButton.setEnabled(false); editCustomerAdminsButton.setIcon(getSite().getIcon("button-icon-edit")); editCustomerAdminsButton.addClickListener(new ClickListener() { /** * Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (entityGrid.getSelectedItemId() == null) { return; } final Customer entity = entityContainer.getEntity(entityGrid.getSelectedItemId()); final GroupFlowlet view = getFlow().forward(GroupFlowlet.class); view.edit(entity.getAdminGroup(), false); } }); table.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(final Property.ValueChangeEvent event) { editCustomerDetailsButton.setEnabled(table.getValue() != null); editCustomerMembersButton.setEnabled(table.getValue() != null); editCustomerAdminsButton.setEnabled(table.getValue() != null); } }); } }
From source file:org.fatal1t.finbe.ui.views.SimpleLoginView.java
@Autowired public SimpleLoginView(LoginService service, AuthenticationService authenticationService1) { setSizeFull();// w ww . j a v a 2 s .c om this.loginService = service; this.authenticationService = authenticationService1; // Create login & registration button and add them to separate component loginButton = new Button("Login"); registerButton = new Button("Register"); buttons = new HorizontalLayout(loginButton, registerButton); // Create the user input field user = new TextField("User:"); user.setWidth("300px"); user.setRequired(true); user.setInputPrompt("Your username (eg. joe@email.com)"); user.setValue("test"); //user.addValidator(new EmailValidator( // "Username must be an email address")); //user.setInvalidAllowed(false); // Create the password input field password = new PasswordField("Password:"); password.setWidth("300px"); //password.addValidator(new PasswordValidator()); password.setRequired(true); password.setValue("123456"); password.setNullRepresentation(""); //add listeners and shortcuts this.loginButton.addClickListener(e -> this.loginButtonClick(e)); this.loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER); this.registerButton.addClickListener(e -> { System.out.println("Pozadavek na registraci"); this.getUI().getNavigator().navigateTo(RegistrationView.NAME); }); // Add both to a panel VerticalLayout fields = new VerticalLayout(user, password, buttons); fields.setCaption("Please login to access the application. (test@test.com/passw0rd)"); fields.setSpacing(true); fields.setMargin(new MarginInfo(true, true, true, true)); fields.setSizeUndefined(); // The view root layout VerticalLayout viewLayout = new VerticalLayout(fields); viewLayout.setSizeFull(); viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER); setCompositionRoot(viewLayout); }
From source file:org.icrisat.gdms.ui.GDMSMain.java
VerticalLayout buildWelcomeScreen() { VerticalLayout layoutForWelcomeTab = new VerticalLayout(); layoutForWelcomeTab.setMargin(true); layoutForWelcomeTab.setSpacing(true); layoutForWelcomeTab.setCaption("Welcome"); layoutForWelcomeTab.setStyleName(Reindeer.LAYOUT_WHITE); CssLayout cssLayout = new CssLayout(); cssLayout.setMargin(true);/*from w ww . j a va 2 s.c om*/ cssLayout.setWidth("100%"); layoutForWelcomeTab.addComponent(cssLayout); HeadingOne title = new HeadingOne("Welcome to Genotyping Data Management"); cssLayout.addComponent(title); HorizontalLayout horizLayoutForIntroPara = new HorizontalLayout(); horizLayoutForIntroPara.setSpacing(true); horizLayoutForIntroPara.setWidth("100%"); horizLayoutForIntroPara.setMargin(true, false, true, false); cssLayout.addComponent(horizLayoutForIntroPara); String strIntroPara1 = "<p>The Genotyping Data Management System aims to provide a comprehensive public repository " + "for genotype, linkage map and QTL data from crop species relevant in the semi-arid tropics.</p>"; String strIntroPara2 = "<p>This system is developed in Java and the database is MySQL. The initial release record " + "details of current genotype datasets generated for GCP mandate crops along with details of " + "molecular markers and related metadata. The Retrieve tab is a good starting point to browse " + "or query the database contents. The datasets available for each crop species can be queried. " + "Access to data sets requires a login.</p>"; String strIntroPara3 = "<p>Data may be currently exported to the following formats: 2x2 matrix and flapjack software formats. " + "Data submission is through templates; upload templates are available for genotype, QTL and " + "map data(type of markers - SSR, SNP and DArt). The templates are in the form of excel sheets with built-in " + "validation functions.</p>"; Label lblPara = new Label(strIntroPara1 + strIntroPara2 + strIntroPara3, Label.CONTENT_XHTML); horizLayoutForIntroPara.addComponent(lblPara); horizLayoutForIntroPara.setExpandRatio(lblPara, 1); //Spacer lblPara = new Label(""); lblPara.setWidth("20px"); horizLayoutForIntroPara.addComponent(lblPara); ThemeResource themeResource = new ThemeResource("images/FlowChart.jpg"); Embedded headerImage = new Embedded("", themeResource); headerImage.setWidth("500px"); headerImage.setHeight("400px"); horizLayoutForIntroPara.addComponent(headerImage); return layoutForWelcomeTab; }
From source file:org.icrisat.gdms.ui.GDMSMain.java
VerticalLayout buildAboutScreen() { VerticalLayout layoutForAboutTab = new VerticalLayout(); layoutForAboutTab.setMargin(true);// ww w .j a va 2 s. c o m layoutForAboutTab.setSpacing(true); layoutForAboutTab.setCaption("About"); layoutForAboutTab.setStyleName(Reindeer.LAYOUT_WHITE); CssLayout cssLayout = new CssLayout(); cssLayout.setMargin(true); cssLayout.setWidth("100%"); layoutForAboutTab.addComponent(cssLayout); HeadingOne title = new HeadingOne("About GDMS Version"); cssLayout.addComponent(title); HorizontalLayout horizLayoutForIntroPara = new HorizontalLayout(); horizLayoutForIntroPara.setSpacing(true); //horizLayoutForIntroPara.setWidth("100%"); horizLayoutForIntroPara.setMargin(true, false, true, false); cssLayout.addComponent(horizLayoutForIntroPara); //_main.getApplication().getContext().getBaseDirectory(); WebApplicationContext ctx = (WebApplicationContext) _main.getApplication().getContext(); //System.out.println(ctx.getHttpSession().getServletContext().getRealPath("\\")); final String strTemplateFolderPath = ctx.getHttpSession().getServletContext().getRealPath("\\"); final String strFileName = "License Agreement for software rev.doc"; final String licensePath = strTemplateFolderPath + "\\" + strFileName; final String strApplicationVersion = "<p>Application Version : 2.1.10</p>"; final String strLicense = ""; String strDBVersion = "<p>Database Verison : IBDBv2</p>"; String strContact = "<p>Contact : <a href='mailto:bioinformatics@cgiar.org'>bioinformatics@cgiar.org </a></p>"; Label lblPara = new Label(strApplicationVersion + strDBVersion + strContact, Label.CONTENT_XHTML); horizLayoutForIntroPara.addComponent(lblPara); horizLayoutForIntroPara.setExpandRatio(lblPara, 1); HorizontalLayout horizLayout = new HorizontalLayout(); horizLayout.setSpacing(true); //horizLayout.setWidth("50%"); horizLayout.setMargin(true, false, true, false); cssLayout.addComponent(horizLayout); //cssLayout.setWidth("600px"); btnDownloadMarker = new Button("License Information"); btnDownloadMarker.setImmediate(true); btnDownloadMarker.setStyleName(Reindeer.BUTTON_LINK); btnDownloadMarker.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { //strLicense = "License Information"; File strFileLoc = new File(strTemplateFolderPath + "\\" + strFileName); FileResource fileResource = new FileResource(strFileLoc, _main.getApplication()); if (strFileName.endsWith(".doc")) { _main.getWindow().open(fileResource, "", true); } } }); //Spacer lblPara = new Label(""); //lblPara.setWidth("20px"); horizLayout.addComponent(lblPara); horizLayout.addComponent(btnDownloadMarker); horizLayout.setComponentAlignment(btnDownloadMarker, Alignment.MIDDLE_LEFT); return layoutForAboutTab; }
From source file:org.investovator.ui.nngaming.DashboardPlayingView.java
License:Open Source License
private void createUI() { //Setup Layout content = new VerticalLayout(); content.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); HorizontalLayout row1 = new HorizontalLayout(); HorizontalLayout row2 = new HorizontalLayout(); HorizontalLayout row3 = new HorizontalLayout(); row1.setWidth("100%"); row2.setWidth("100%"); row3.setWidth("100%"); row1.setHeight(50, Unit.PERCENTAGE); row2.setHeight(20, Unit.PERCENTAGE); row3.setHeight(30, Unit.PERCENTAGE); row1.setMargin(new MarginInfo(true, true, false, true)); row2.setMargin(new MarginInfo(true, true, false, true)); row3.setMargin(new MarginInfo(true, true, true, true)); content.addComponent(row1);//from w w w . j ava2 s.com content.addComponent(row2); content.addComponent(row3); currentPriceChart = new BasicChart(); quantityChart = new QuantityChart(); orderBookSell = getSellSideTable(); orderBookSell.addStyleName("center-caption"); orderBookBuy = getBuySideTable(); orderBookBuy.addStyleName("center-caption"); quoteUI = new QuoteUI(); userPortfolio = new UserPortfolio(); HorizontalLayout orderBookLayout = new HorizontalLayout(); orderBookLayout.setWidth("100%"); orderBookLayout.addComponent(orderBookSell); orderBookLayout.addComponent(orderBookBuy); orderBookLayout.setComponentAlignment(orderBookSell, Alignment.MIDDLE_RIGHT); orderBookLayout.setComponentAlignment(orderBookBuy, Alignment.MIDDLE_LEFT); VerticalLayout orderBook = new VerticalLayout(); orderBook.addComponent(orderBookLayout); orderBook.setCaption("Order Book"); quoteUI.setCaption("Quote UI"); userPortfolio.setCaption(Session.getCurrentUser().toUpperCase(Locale.US) + " - Portfolio Summary"); orderBook.addStyleName("center-caption"); quoteUI.addStyleName("center-caption"); userPortfolio.addStyleName("center-caption"); row1.addComponent(currentPriceChart); row2.addComponent(quantityChart); row3.setSpacing(true); row3.addComponent(orderBook); row3.addComponent(quoteUI); row3.addComponent(userPortfolio); row3.setExpandRatio(orderBook, 1.2f); row3.setExpandRatio(quoteUI, 1.0f); row3.setExpandRatio(userPortfolio, 1.0f); row1.setComponentAlignment(currentPriceChart, Alignment.MIDDLE_CENTER); row2.setComponentAlignment(quantityChart, Alignment.MIDDLE_CENTER); content.setSizeFull(); this.setContent(content); }
From source file:org.lucidj.newview.NewView.java
License:Apache License
private Layout form_location_panel() { VerticalLayout rolldown = new VerticalLayout(); rolldown.setCaption("Location"); rolldown.setSpacing(true);/* ww w . j a va 2 s.c om*/ HorizontalLayout directory_and_browse = new HorizontalLayout(); directory_and_browse.setSpacing(true); directory_and_browse.setWidth(100, Unit.PERCENTAGE); frm_directory = new TextField(); frm_directory.setValue(projects_dir.toString()); frm_directory.setWidth(100, Unit.PERCENTAGE); directory_and_browse.addComponent(frm_directory); Button confirm = new Button("Save"); confirm.addStyleName(ValoTheme.BUTTON_PRIMARY); confirm.setVisible(false); directory_and_browse.addComponent(confirm); Button change_directory = new Button("Change location..."); directory_and_browse.addComponent(change_directory); directory_and_browse.setExpandRatio(frm_directory, 1.0f); rolldown.addComponent(directory_and_browse); Path projects_home = securityEngine.getSubject().getDefaultUserDir(); frm_directories = rendererFactory.newRenderer(projects_home); frm_directories.setVisible(false); rolldown.addComponent(frm_directories); change_directory.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { if (frm_directories.isVisible()) { change_directory.setCaption("Change location..."); frm_directories.setVisible(false); confirm.setVisible(false); } else { change_directory.setCaption("Cancel change"); frm_directories.setVisible(true); confirm.setVisible(true); } } }); frm_directories.addListener(new Listener() { @Override public void componentEvent(Event event) { if (event instanceof ItemClickEvent) { ItemClickEvent itemClickEvent = (ItemClickEvent) event; File item_id = ((File) itemClickEvent.getItemId()); log.info("CLICK item_path={}", item_id); frm_directory.setValue(item_id.getPath()); } } }); return (rolldown); }
From source file:org.vaadin.numberfield.NumberFieldUI.java
License:Apache License
private void addDefaultTest() { VerticalLayout layout = createLayout(); layout.setCaption("Default Test"); layout.addComponent(new NumberField("Default settings")); final NumberField numberField = new NumberField(); numberField.setLocale(Locale.FRANCE); numberField.setCaption("Modified settings:"); numberField.setDecimalPrecision(2);// ww w . ja va2 s. co m numberField.setDecimalSeparator(','); numberField.setGroupingSeparator('.'); numberField.setDecimalSeparatorAlwaysShown(true); numberField.setMinimumFractionDigits(2); numberField.setMinValue(5); layout.addComponent(numberField); Button alignmentButton = new Button("Toggle alignment"); alignmentButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { // note: this tests overriding of default styles by custom theme // there is no built-in alignment change if (!numberField.getStyleName().contains("left")) { numberField.addStyleName("left"); } else { numberField.removeStyleName("left"); } } }); layout.addComponent(alignmentButton); Button setValueButton = new Button("Set value programmatically"); setValueButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { numberField.setValue(119.9d); } }); layout.addComponent(setValueButton); mainLayout.addComponent(layout); }
From source file:org.vaadin.numberfield.NumberFieldUI.java
License:Apache License
private void addTestForRetrievingValue() { VerticalLayout layout = createLayout(); layout.setCaption("Test retrieving value"); final NumberField startHour = new NumberField(); startHour.setMinValue(0);// w w w. java 2 s .c om startHour.setMaxValue(59); startHour.setErrorText("global_invalid_format"); startHour.setWidth("60px"); startHour.setImmediate(true); layout.addComponent(startHour); Button checkValueButton = new Button("Get current value"); checkValueButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { String value = startHour.getValue(); if (value == null || value.isEmpty()) { Notification.show("no value"); } else { Notification.show(Integer.valueOf(value).toString()); } } }); layout.addComponent(checkValueButton); mainLayout.addComponent(layout); }
From source file:org.vaadin.numberfield.NumberFieldUI.java
License:Apache License
@SuppressWarnings("deprecation") private void addForm() { VerticalLayout layout = createLayout(); layout.setCaption("Form with FormFieldFactory"); final NumberField numberField = new NumberField(); numberField.setLocale(Locale.FRANCE); numberField.setCaption("Modified settings:"); numberField.setDecimalPrecision(2);//from w ww.j a v a 2 s . c om numberField.setDecimalSeparator(','); numberField.setGroupingSeparator('.'); numberField.setDecimalSeparatorAlwaysShown(true); numberField.setMinimumFractionDigits(2); numberField.setMinValue(5); Form form = new Form(); form.setFormFieldFactory(new FormFieldFactory() { @Override public Field<?> createField(Item item, Object propertyId, Component uiContext) { if ("number".equals(propertyId)) { return numberField; } else { return new TextField("placeholder textfield"); } } }); BeanItem<Bean> beanItem = new BeanItem<Bean>(new Bean()); form.setItemDataSource(beanItem); layout.addComponent(form); mainLayout.addComponent(layout); }
From source file:org.vaadin.numberfield.NumberFieldUI.java
License:Apache License
@SuppressWarnings({ "deprecation", "unchecked" }) private void addAnotherForm() { VerticalLayout layout = createLayout(); layout.setCaption("Form with DefaultFieldFactory"); final NumberField numberField = new NumberField(); numberField.setLocale(Locale.FRANCE); numberField.setCaption("Modified settings:"); numberField.setDecimalPrecision(2);//w w w .j a v a2s.co m numberField.setDecimalSeparator(','); numberField.setGroupingSeparator('.'); numberField.setDecimalSeparatorAlwaysShown(true); numberField.setMinimumFractionDigits(2); numberField.setMinValue(5); Form form = new Form(); form.setFormFieldFactory(new DefaultFieldFactory() { @Override public Field<?> createField(Item item, Object propertyId, Component uiContext) { if ("number".equals(propertyId)) { return numberField; } else { return super.createField(item, propertyId, uiContext); } } }); BeanItem<Bean> beanItem = new BeanItem<Bean>(new Bean()); form.setItemDataSource(beanItem); layout.addComponent(form); mainLayout.addComponent(layout); }