List of usage examples for com.vaadin.ui VerticalLayout setStyleName
@Override public void setStyleName(String style)
From source file:de.symeda.sormas.ui.samples.SampleGridComponent.java
License:Open Source License
private void styleGridLayout(VerticalLayout gridLayout) { gridLayout.setSpacing(false);/*from ww w . j a v a2 s .c o m*/ gridLayout.setSizeFull(); gridLayout.setExpandRatio(grid, 1); gridLayout.setStyleName("crud-main-layout"); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.QbicmainportletUI.java
License:Open Source License
/** * builds page if user is not logged in/*from www . ja v a 2 s. co m*/ */ private void buildNotLoggedinLayout() { // Mail to qbic ExternalResource resource = new ExternalResource("mailto:info@qbic.uni-tuebingen.de"); Link mailToQbicLink = new Link("", resource); mailToQbicLink.setIcon(new ThemeResource("mail9.png")); ThemeDisplay themedisplay = (ThemeDisplay) VaadinService.getCurrentRequest() .getAttribute(WebKeys.THEME_DISPLAY); // redirect to liferay login page Link loginPortalLink = new Link("", new ExternalResource(themedisplay.getURLSignIn())); loginPortalLink.setIcon(new ThemeResource("lock12.png")); // left part of the page VerticalLayout signIn = new VerticalLayout(); signIn.addComponent( new Label("<h3>Sign in to manage your projects and access your data:</h3>", ContentMode.HTML)); signIn.addComponent(loginPortalLink); signIn.setStyleName("no-user-login"); // right part of the page VerticalLayout contact = new VerticalLayout(); contact.addComponent( new Label("<h3>If you are interested in doing projects get in contact:</h3>", ContentMode.HTML)); contact.addComponent(mailToQbicLink); contact.setStyleName("no-user-login"); // build final layout, with some gaps between HorizontalLayout notSignedInLayout = new HorizontalLayout(); Label expandingGap1 = new Label(); expandingGap1.setWidth("100%"); notSignedInLayout.addComponent(expandingGap1); notSignedInLayout.addComponent(signIn); notSignedInLayout.addComponent(contact); notSignedInLayout.setExpandRatio(expandingGap1, 0.16f); notSignedInLayout.setExpandRatio(signIn, 0.36f); notSignedInLayout.setExpandRatio(contact, 0.36f); notSignedInLayout.setWidth("100%"); notSignedInLayout.setSpacing(true); setContent(notSignedInLayout); }
From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.projectlist.ProjectListViewImpl.java
License:Open Source License
/** * Diese Methode ndert die Hintergrundfarben der Projekte. * Das selektierte Projekt wird hervorgehoben. * /*from w ww . j a v a 2 s . c o m*/ * @param i * : index des selektierten Projekts * * @author Marco Glaser */ public void switchProjectsStyle(int i) { int counter = 0; Iterator<VerticalLayout> iter = singleProjectList.iterator(); VerticalLayout projectLayout; while (iter.hasNext()) { projectLayout = iter.next(); if (counter == i) { projectLayout.setStyleName("singleProjectSelected"); } else { projectLayout.setStyleName("singleProject"); } counter++; } }
From source file:ed.cracken.pos.ui.products.ProductForm.java
public void initComponents() { setId("product-form"); setStyleName("product-form-wrapper"); addStyleName("product-form"); VerticalLayout formLayout = new VerticalLayout(); formLayout.setHeightUndefined();//from w w w. j a va 2s.c o m formLayout.setSpacing(true); formLayout.setStyleName("form-layout"); formLayout.addComponent(productName = new TextField("Name")); HorizontalLayout priceAndStockLayout = new HorizontalLayout(); priceAndStockLayout.addComponent(price = new TextField("Price")); priceAndStockLayout.addComponent(stockCount = new TextField("Stock")); formLayout.addComponent(priceAndStockLayout); formLayout.addComponent(availability = new ComboBox("Availability")); formLayout.addComponent(category = new CategoryField("Category")); CssLayout separator = new CssLayout(); separator.setStyleName("expander"); formLayout.addComponent(separator); formLayout.addComponent(save = new Button("Save") { { setStyleName("primary"); setId("save"); } }); formLayout.addComponent(cancel = new Button("Cancel") { { setStyleName("cancel"); setId("cancel"); } }); formLayout.addComponent(delete = new Button("Delete") { { setStyleName("danger"); setId("delete"); } }); addComponent(formLayout); }
From source file:ed.cracken.pos.ui.purchases.PurchaseItemForm.java
public PurchaseItemForm(PurchaserLogic viewLogic) { setId("product-form"); setStyleName("product-form-wrapper"); addStyleName("product-form"); VerticalLayout formLayout = new VerticalLayout(); formLayout.setHeightUndefined();// ww w . j a v a 2 s.c om formLayout.setSpacing(true); formLayout.setStyleName("form-layout"); formLayout.addComponent(productId = new TextField("Code")); formLayout.addComponent(description = new TextField("Description")); formLayout.addComponent(price = new DecimalNumberField("Price")); formLayout.addComponent(quantity = new DecimalNumberField("Quantity")); formLayout.addComponent(discount = new DecimalNumberField("Discount")); formLayout.addComponent(subtotal = new DecimalNumberField("Subtotal")); price.setConverter(BigDecimal.class); quantity.addTextChangeListener((FieldEvents.TextChangeEvent event) -> { if (!event.getText().isEmpty()) { try { NumberFormat nf = DecimalFormat.getInstance(); nf.setMaximumFractionDigits(2); ItemTo item; BigDecimal r = BigDecimal.valueOf(nf.parse(event.getText()).longValue()) .multiply((item = fieldGroup.getItemDataSource().getBean()).getPrice()); subtotal.setReadOnly(false); subtotal.setValue(nf.format(r.doubleValue())); subtotal.setReadOnly(true); } catch (ParseException ex) { Logger.getLogger(PurchaseItemForm.class.getName()).log(Level.SEVERE, null, ex); } } }); CssLayout separator = new CssLayout(); separator.setStyleName("expander"); formLayout.addComponent(separator); formLayout.addComponent(save = new StyledButton("Aplicar", "primary", "save")); formLayout.addComponent(cancel = new StyledButton("Cancelar", "cancel", "cancel")); formLayout.addComponent(delete = new StyledButton("Quitar", "danger", "delete")); save.addClickListener((Button.ClickEvent event) -> { try { fieldGroup.commit(); viewLogic.updateItem(fieldGroup.getItemDataSource().getBean()); } catch (FieldGroup.CommitException e) { e.printStackTrace(System.err); } }); cancel.addClickListener((Button.ClickEvent event) -> { viewLogic.cancelItemChanges(); }); delete.addClickListener((Button.ClickEvent event) -> { viewLogic.removeItem(fieldGroup.getItemDataSource().getBean()); }); addComponent(formLayout); configBinding(); }
From source file:ed.cracken.pos.ui.purchases.PurchaserView.java
public PurchaserView() { summary = SellSummaryTo.builder().count(BigDecimal.ZERO).total(BigDecimal.ZERO).build(); setSizeFull();// w w w . j av a 2s. co m addStyleName("crud-view"); viewLogic = new PurchaserLogic(this); paymentView = new PurchaserPaymentView(); grid = new PurchaserGrid(); grid.addSelectionListener((SelectionEvent event) -> { viewLogic.editItem(grid.getSelectedRow()); }); VerticalLayout mainContent = new VerticalLayout(); HorizontalLayout foot; mainContent.addComponent(createTopBar()); mainContent.addComponent(grid); mainContent.addComponent(foot = createFooter()); mainContent.setMargin(true); mainContent.setSpacing(true); mainContent.setSizeFull(); mainContent.setExpandRatio(grid, 1); mainContent.setStyleName("crud-main-layout"); mainContent.setComponentAlignment(foot, Alignment.TOP_CENTER); addComponent(mainContent); addComponent(purchaseItemForm = new PurchaseItemForm(viewLogic)); }
From source file:ed.cracken.pos.ui.seller.SellerView.java
public SellerView() { summary = SellSummaryTo.builder().count(BigDecimal.ZERO).total(BigDecimal.ZERO).build(); setSizeFull();/* w w w .j a v a2 s . c om*/ addStyleName("crud-view"); viewLogic = new SellerLogic(this); paymentView = new SellerPaymentView(); grid = new SellerGrid(); grid.addSelectionListener((SelectionEvent event) -> { viewLogic.editItem(grid.getSelectedRow()); }); VerticalLayout barAndGridLayout = new VerticalLayout(); HorizontalLayout foot; barAndGridLayout.addComponent(createTopBar()); barAndGridLayout.addComponent(grid); barAndGridLayout.addComponent(foot = createFooter()); barAndGridLayout.setMargin(true); barAndGridLayout.setSpacing(true); barAndGridLayout.setSizeFull(); barAndGridLayout.setExpandRatio(grid, 1); barAndGridLayout.setStyleName("crud-main-layout"); barAndGridLayout.setComponentAlignment(foot, Alignment.TOP_CENTER); addComponent(barAndGridLayout); addComponent(sellItemForm = new SellItemForm(viewLogic)); }
From source file:ed.cracken.pos.ui.seller.SellItemForm.java
public SellItemForm(SellerLogic viewLogic) { setId("product-form"); setStyleName("product-form-wrapper"); addStyleName("product-form"); VerticalLayout formLayout = new VerticalLayout(); formLayout.setHeightUndefined();/* w ww . ja va 2 s . c o m*/ formLayout.setSpacing(true); formLayout.setStyleName("form-layout"); formLayout.addComponent(productId = new TextField("Code")); formLayout.addComponent(description = new TextField("Description")); formLayout.addComponent(price = new DecimalNumberField("Price")); formLayout.addComponent(quantity = new DecimalNumberField("Quantity")); formLayout.addComponent(discount = new DecimalNumberField("Discount")); formLayout.addComponent(subtotal = new DecimalNumberField("Subtotal")); price.setConverter(BigDecimal.class); quantity.addTextChangeListener((FieldEvents.TextChangeEvent event) -> { if (!event.getText().isEmpty()) { try { NumberFormat nf = DecimalFormat.getInstance(); nf.setMaximumFractionDigits(2); ItemTo item; BigDecimal r = BigDecimal.valueOf(nf.parse(event.getText()).longValue()) .multiply((item = fieldGroup.getItemDataSource().getBean()).getPrice()); subtotal.setReadOnly(false); subtotal.setValue(nf.format(r.doubleValue())); subtotal.setReadOnly(true); } catch (ParseException ex) { Logger.getLogger(SellItemForm.class.getName()).log(Level.SEVERE, null, ex); } } }); CssLayout separator = new CssLayout(); separator.setStyleName("expander"); formLayout.addComponent(separator); formLayout.addComponent(save = new StyledButton("Aplicar", "primary", "save")); formLayout.addComponent(cancel = new StyledButton("Cancelar", "cancel", "cancel")); formLayout.addComponent(delete = new StyledButton("Quitar", "danger", "delete")); save.addClickListener((Button.ClickEvent event) -> { try { fieldGroup.commit(); viewLogic.updateItem(fieldGroup.getItemDataSource().getBean()); } catch (FieldGroup.CommitException e) { e.printStackTrace(System.err); } }); cancel.addClickListener((Button.ClickEvent event) -> { viewLogic.cancelItemChanges(); }); delete.addClickListener((Button.ClickEvent event) -> { viewLogic.removeItem(fieldGroup.getItemDataSource().getBean()); }); addComponent(formLayout); configBinding(); }
From source file:edu.cornell.qatarmed.planrnaseq.SimpleLoginView.java
public SimpleLoginView() { setSizeFull();/*from ww w.ja v a2s . c o m*/ // Create the user input field user = new TextField("User:"); user.setWidth("300px"); user.setRequired(true); user.setInputPrompt("Your username (eg. joe@email.com)"); 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(""); password.setNullRepresentation(""); // Create login button loginButton = new Button("Login", this); // Add both to a panel VerticalLayout fields = new VerticalLayout(user, password, loginButton); fields.setCaption("Please login to access the application. (test@test.com/passw0rd)"); fields.setSpacing(true); fields.setMargin(new MarginInfo(true, true, true, false)); fields.setSizeUndefined(); // The view root layout VerticalLayout viewLayout = new VerticalLayout(fields); viewLayout.setSizeFull(); viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER); viewLayout.setStyleName(Reindeer.LAYOUT_BLUE); setCompositionRoot(viewLayout); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabThePlan2.java
License:Open Source License
@Override public void initGui() { setSizeUndefined(); // let flow to right VerticalLayout leftLay = getLeftLayout(); leftLay.setSpacing(false);/*from w w w . j a v a 2 s . c o m*/ leftLay.setMargin(false); VerticalLayout flowLay = new VerticalLayout(); leftLay.addComponent(flowLay); flowLay.setSpacing(true); Label missionLab = new Label("Authors, this is your workspace."); flowLay.addComponent(missionLab); flowLay.setComponentAlignment(missionLab, Alignment.TOP_LEFT); missionLab.addStyleName("m-actionplan-mission-title-text"); ActionPlan actPln = ActionPlan.getTL(apId); Label missionContentLab; if (!isMockup) missionContentLab = new HtmlLabel(actPln.getPlanInstructions()); else { Game g = Game.getTL(); missionContentLab = new HtmlLabel(g.getDefaultActionPlanThePlanText()); } MovePhase ph = MovePhase.getCurrentMovePhaseTL(); flowLay.addComponent(missionContentLab); flowLay.setComponentAlignment(missionContentLab, Alignment.TOP_LEFT); flowLay.addStyleName("m-actionplan-mission-content-text"); VerticalLayout rightLay = getRightLayout(); rightLay.setMargin(false); rightLay.setSpacing(false); flowLay = new VerticalLayout(); flowLay.setWidth("100%"); rightLay.addComponent(flowLay); flowLay.setSpacing(true); flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside .m-actionplan-plan-headling { blah:blah;} ) Label lab = new Label(); lab.setHeight("20px"); flowLay.addComponent(lab); flowLay.addComponent(whoGroup = buildTextAreaGroup( ph.getActionPlanWhoIsInvolvedHeader()/*"Who is involved?"*/, whoTA, "Who-is-involved history", "Previous values", "Text", "getSubTitleEditHistory", "getSubTitle", "setSubTitleWithHistoryTL")); whoGroup.setValueTL(actPln.getSubTitle()); // misnamed since we're calling it it who is involved instead of subtitle flowLay.addComponent(whatGroup = buildTextAreaGroup(ph.getActionPlanWhatIsItHeader()/*"What is it?"*/, whatTA, "What-is-it history", "Previous values", "Text", "getWhatIsItEditHistory", "getWhatIsItText", "setWhatIsItTextWithHistoryTL")); whatGroup.setValueTL(actPln.getWhatIsItText()); flowLay.addComponent( whatTakeGroup = buildTextAreaGroup(ph.getActionPlanWhatWillItTakeHeader()/*"What will it take?"*/, whatWillItTakeTA, "What-will-it-take history", "Previous values", "Text", "getWhatTakeEditHistory", "getWhatWillItTakeText", "setWhatWillItTakeTextWithHistoryTL")); whatTakeGroup.setValueTL(actPln.getWhatWillItTakeText()); flowLay.addComponent( howGroup = buildTextAreaGroup(ph.getActionPlanHowWillItWorkHeader()/*"How will it work?"*/, howWorkTA, "How-will-it-work history", "Previous values", "Text", "getHowWorkEditHistory", "getHowWillItWorkText", "setHowWillItWorkTextWithHistoryTL")); howGroup.setValueTL(actPln.getHowWillItWorkText()); flowLay.addComponent(howChangeGroup = buildTextAreaGroup( ph.getActionPlanHowWillItChangeHeader()/*"How will it change the situation?"*/, howChangeTA, "How-will-it-change-things history", "Previous values", "Text", "getHowChangeEditHistory", "getHowWillItChangeText", "setHowWillItChangeTextWithHistoryTL")); howChangeGroup.setValueTL(actPln.getHowWillItChangeText()); }