List of usage examples for com.vaadin.ui CssLayout CssLayout
public CssLayout()
From source file:com.cerebro.gorgone.landingpage.SignInWindow.java
private Component setThirdStep() { VerticalLayout thirdStep = new VerticalLayout(); CssLayout body = new CssLayout(); Label title = null;//from w ww . j a v a2 s .c o m if (user.getSessoPG().equals("Maschio")) { title = new Label("Caro " + user.getNomeUtente() + " stai per registrare il seguente personaggio: "); } else if (user.getSessoPG().equals("Femmina")) { title = new Label("Cara " + user.getNomeUtente() + " stai per registrare il seguente personaggio: "); } Label nomePG = new Label("Nome: " + user.getNomePG()); Label cognomePG = new Label("Cognome: " + user.getCognomePG()); Label sessoPG = new Label("Sesso: " + user.getSessoPG()); Label etaPG = new Label("Et: " + user.getEtaPG()); Label razzaPG = new Label("Razza: " + user.getRazzaPG()); Label carrieraPG = new Label("Carriera: " + user.getCarrieraPG()); Label orientamentoPG = new Label("Orientamento: " + user.getOrientamentoPG()); String valuesTable = "<table><tr><td>Forza</td><td>Resistenza</td><td>Agilit</td><td>Intelligenza</td>" + "<td>Saggezza</td><td>Carisma</td></tr><tr>" + "<td>" + user.getForzaPG() + "</td>" + "<td>" + user.getResistenzaPG() + "</td>" + "<td>" + user.getAgilitaPG() + "</td>" + "<td>" + user.getIntelligenzaPG() + "</td>" + "<td>" + user.getSaggezzaPG() + "</td>" + "<td>" + user.getCarismaPG() + "</td>" + "</tr></table>"; Label values = new Label(valuesTable, ContentMode.HTML); Label alert = new Label("Premendo il tasto di iscrizione ti verr inviata una mail di conferma " + "all'indirizzo che hai inserito all'inizio. Se non lo confermi non potrai giocare!"); // Aggiungere le condizioni d'uso body.addComponents(title, nomePG, cognomePG, sessoPG, etaPG, razzaPG, carrieraPG, orientamentoPG, values, alert); CssLayout footer = new CssLayout(); Button signIn = new Button("Iscriviti"); signIn.addClickListener((Button.ClickEvent event) -> { logger.info("Iscrizione in corso"); // Creazione del codice String confCode = RandomStringUtils.random(10, true, true); user.setCodiceConferma(confCode); // Salvataggio dei dati nel database user.signInNewUser(); // Invio della mail // SendConfEmail sendConfEmail = new SendConfEmail(user.getEmail(), confCode); // SendConfMailjet sendConf = new SendConfMailjet(user.getEmail(), confCode); // Chiusura della finestra this.close(); }); footer.addComponents(signIn, createCancelButton()); thirdStep.addComponents(setHeader("4/4"), body, footer); return thirdStep; }
From source file:com.cerebro.provevaadin.SignIn.java
private VerticalLayout setFirstStep() { VerticalLayout firstStep = new VerticalLayout(); CssLayout header = new CssLayout(); Label title = new Label("Benvenuto " + u.getNomeUtente() + "!"); Label istructions = new Label("Crea il tuo personaggio"); Label step = new Label("1/*"); header.addComponents(title, istructions, step); HorizontalLayout body = new HorizontalLayout(); FormLayout datiIniziali = new FormLayout(); TextField nomePG = new TextField("Nome del Personaggio"); TextField cognomePG = new TextField("Cognome del Personaggio"); OptionGroup sessoPG = new OptionGroup("Sesso del Personaggio"); sessoPG.addItems("Maschio", "Femmina"); ComboBox razzaPG = new ComboBox("Razza"); datiIniziali.addComponents(nomePG, cognomePG, sessoPG, razzaPG); HorizontalLayout descrizioneRazza = new HorizontalLayout(); descrizioneRazza.setWidth(datiIniziali.getWidth(), datiIniziali.getWidthUnits()); // Dettagli di popolazione e comportamento ComboBox razzaPG.addItem("Essere umano"); body.addComponents(datiIniziali, descrizioneRazza); CssLayout footer = new CssLayout(); Button next = new Button("Avanti ->"); next.addClickListener((Button.ClickEvent event) -> { u.setNomePG(nomePG.getValue());// w w w. j a v a 2 s.c o m u.setCognomePG(cognomePG.getValue()); u.setSessoPG(sessoPG.getValue().toString()); u.setRazzaPG(razzaPG.getValue().toString()); this.setContent(setSecondStep()); }); footer.addComponents(next, createCancelButton()); firstStep.addComponents(header, body, footer); return firstStep; }
From source file:com.cerebro.provevaadin.SignIn.java
private VerticalLayout setSecondStep() { VerticalLayout secondStep = new VerticalLayout(); CssLayout header = new CssLayout(); Label title = new Label("Benvenuto " + u.getNomeUtente() + "!"); Label istructions = new Label("Crea il tuo personaggio"); Label step = new Label("2/*"); header.addComponents(title, istructions, step); VerticalLayout body = new VerticalLayout(); Label ageIstruction = new Label("Indica l'et del tuo personaggio in anni"); // Cambiare i parametri in base alla razza Slider age = new Slider(1, 150); age.setImmediate(true);/* www .ja v a 2 s . c o m*/ age.setSizeFull(); HorizontalLayout ageDescription = new HorizontalLayout(); ageDescription.setHeight("250px"); Label ageText = new Label("Valore dell'et: "); Label ageValue = new Label(age.getValue().toString()); Label periodoVita = new Label(""); ageDescription.addComponents(ageText, ageValue, periodoVita); age.addValueChangeListener((Property.ValueChangeEvent event) -> { System.out.println("Valore: " + age.getValue().toString()); ageValue.setValue(age.getValue().toString()); Double value = (100 * (age.getValue()) / (age.getMax())); if (value < 14) { periodoVita.setValue("Bambino"); } else if (value > 14 && value < 24) { periodoVita.setValue("Adolescenza"); } else if (value > 24 && value < 73) { periodoVita.setValue("Et adulta"); } else if (value > 73) { periodoVita.setValue("Et anziana"); } }); body.addComponents(ageIstruction, age, ageDescription); CssLayout footer = new CssLayout(); Button next = new Button("Avanti ->"); next.addClickListener((Button.ClickEvent event) -> { u.setEtaPG(age.getValue().toString()); this.setContent(setThirdStep()); }); footer.addComponents(next, createCancelButton()); secondStep.addComponents(header, body, footer); return secondStep; }
From source file:com.cerebro.provevaadin.SignIn.java
private Component setThirdStep() { VerticalLayout thirdStep = new VerticalLayout(); CssLayout header = new CssLayout(); Label title = new Label("Benvenuto " + u.getNomeUtente() + "!"); Label istructions = new Label("Crea il tuo personaggio"); Label step = new Label("3/*"); header.addComponents(title, istructions, step); HorizontalLayout body = new HorizontalLayout(); VerticalLayout carrieraPanel = new VerticalLayout(); ComboBox carriera = new ComboBox("Scegli la tua carriera:"); carriera.addItem("Guerriero"); HorizontalLayout descrizioneCarriera = new HorizontalLayout(); // Comportamento ComboBox carrieraPanel.addComponents(carriera, descrizioneCarriera); VerticalLayout orientamentoPanel = new VerticalLayout(); ComboBox orientamento = new ComboBox("Scegli il tuo orientamento"); orientamento.addItem("Buono Ordine"); HorizontalLayout descrizioneOrientamento = new HorizontalLayout(); // Comportamento ComboBox orientamentoPanel.addComponents(orientamento, descrizioneOrientamento); body.addComponents(carrieraPanel, orientamentoPanel); CssLayout footer = new CssLayout(); Button next = new Button("Avanti ->"); next.addClickListener((Button.ClickEvent event) -> { u.setCarrieraPG(carriera.getValue().toString()); u.setOrientamentoPG(orientamento.getValue().toString()); this.setContent(setFourthStep()); });/*from w ww . j a v a 2 s .co m*/ footer.addComponents(next, createCancelButton()); thirdStep.addComponents(header, body, footer); return thirdStep; }
From source file:com.cerebro.provevaadin.SignIn.java
private Component setFourthStep() { VerticalLayout fourthStep = new VerticalLayout(); CssLayout header = new CssLayout(); Label title = new Label("Benvenuto " + u.getNomeUtente() + "!"); Label istructions = new Label("Crea il tuo personaggio"); Label step = new Label("3/*"); header.addComponents(title, istructions, step); CssLayout body = new CssLayout(); Label resoconto = new Label("Stai per registrare il seguente personaggio: "); Label nomePG = new Label(u.getNomePG()); CssLayout footer = new CssLayout(); Button next = new Button("Fine"); next.addClickListener((Button.ClickEvent event) -> { // Salvare i dati nel database, inviare la mail, rimandare all'ultima pagina this.setContent(setFourthStep()); });/*from w w w . j a v a 2 s. co m*/ footer.addComponents(next, createCancelButton()); fourthStep.addComponents(header, body, footer); return fourthStep; }
From source file:com.cms.component.CollapseablePanel.java
public CollapseablePanel(String title, Component body) { super();// w ww .j ava 2 s . c o m root = new CssLayout(); root.addStyleName("collapseblebox-container"); setCompositionRoot(root); draw(title, body); }
From source file:com.cms.component.CollapseablePanel.java
void draw(String title, Component body) { CssLayout titleLayout = new CssLayout(); titleLayout.addStyleName("collapsablebox-title"); titleLayout.addComponent(new Label(title)); titleLayout.addListener(new LayoutClickListener() { private static final long serialVersionUID = -4750845792730551399L; @Override//from w w w. j ava2 s .com public void layoutClick(LayoutClickEvent event) { toggleBodyVisible(); } }); bodyContainer = new CssLayout(); bodyContainer.addStyleName("collapsablebox-body"); bodyContainer.addComponent(body); root.addComponent(titleLayout); root.addComponent(bodyContainer); }
From source file:com.constellio.app.ui.pages.base.MainLayoutImpl.java
public MainLayoutImpl(AppLayerFactory appLayerFactory) { this.presenter = new MainLayoutPresenter(this); mainMenuContentFooterLayout = new HorizontalLayout(); mainMenuContentFooterLayout.setSizeFull(); mainMenuContentFooterLayout.addStyleName("main-menu-content-footer"); contentViewWrapper = new Panel(); Navigator navigator = new Navigator(UI.getCurrent(), contentViewWrapper); NavigatorConfigurationService navigatorConfigurationService = appLayerFactory .getNavigatorConfigurationService(); navigatorConfigurationService.configure(navigator); UI.getCurrent().setNavigator(navigator); contentFooterWrapperLayout = new CssLayout(); contentFooterWrapperLayout.setId("content-footer-wrapper"); contentFooterLayout = new VerticalLayout(); contentFooterLayout.addStyleName("content-footer"); header = buildHeader();/*from www . j a v a 2 s.c o m*/ header.setSizeUndefined(); mainMenu = buildMainMenu(); userDocumentsWindow = new UserDocumentsWindow(); dragAndDropWrapper = new DragAndDropWrapper(mainMenuContentFooterLayout); dragAndDropWrapper.setSizeFull(); dragAndDropWrapper.setDropHandler(userDocumentsWindow); navigator.addViewChangeListener(new ViewChangeListener() { @Override public boolean beforeViewChange(ViewChangeEvent event) { return true; } @Override public void afterViewChange(ViewChangeEvent event) { View newView = event.getNewView(); if (newView instanceof NoDragAndDrop) { dragAndDropWrapper.setDropHandler(null); } else if (newView instanceof DropHandler) { dragAndDropWrapper.setDropHandler((DropHandler) newView); } else { List<DropHandler> viewDropHandlers = ComponentTreeUtils.getChildren((Component) newView, DropHandler.class); if (viewDropHandlers.size() > 1) { dragAndDropWrapper.setDropHandler(null); } else if (viewDropHandlers.size() == 1) { dragAndDropWrapper.setDropHandler(viewDropHandlers.get(0)); } else if (dragAndDropWrapper.getDropHandler() != userDocumentsWindow) { dragAndDropWrapper.setDropHandler(userDocumentsWindow); } } // SerializationUtils.clone(event.getOldView()); // SerializationUtils.clone(newView); } }); addComponent(header); addComponent(dragAndDropWrapper); setExpandRatio(dragAndDropWrapper, 1); mainMenuContentFooterLayout.addComponent(mainMenu); mainMenuContentFooterLayout.addComponent(contentFooterWrapperLayout); mainMenuContentFooterLayout.setExpandRatio(contentFooterWrapperLayout, 1); contentFooterWrapperLayout.addComponent(contentFooterLayout); contentFooterLayout.addComponent(contentViewWrapper); Component message = buildMessage(); if (message != null) { message.addStyleName("message"); contentFooterLayout.addComponent(message); } contentFooterLayout.setExpandRatio(contentViewWrapper, 1); Component footer = buildFooter(); if (footer != null) { contentFooterLayout.addComponent(footer); } Component license = buildLicense(); if (license != null) { license.addStyleName("license"); } PagesComponentsExtensionParams params = new PagesComponentsExtensionParams(header, mainMenu, contentFooterLayout, this, contentViewWrapper, contentFooterWrapperLayout, presenter.getUser()); appLayerFactory.getExtensions().getSystemWideExtensions().decorateView(params); String collection = ConstellioUI.getCurrentSessionContext().getCurrentCollection(); if (collection != null) { appLayerFactory.getExtensions().forCollection(collection).decorateView(params); } buildInitJavascript(); }
From source file:com.cxplonka.feature.ui.vaadin.VaadinUI.java
private void initLayout() { final VerticalLayout root = new VerticalLayout(); root.setSizeFull();/*www. ja va 2s.c o m*/ root.setMargin(true); root.setSpacing(true); setContent(root); final CssLayout navigationBar = new CssLayout(); navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); navigationBar.addComponent(createNavigationButton("Default View", DefaultView.VIEW_NAME)); navigationBar.addComponent(createNavigationButton("Data View", DataTableView.VIEW_NAME)); root.addComponent(navigationBar); final Panel viewContainer = new Panel(); viewContainer.setSizeFull(); root.addComponent(viewContainer); root.setExpandRatio(viewContainer, 1.0f); Navigator navigator = new Navigator(this, viewContainer); navigator.addProvider(viewProvider); }
From source file:com.digitallabs.demos.Vaadin6BootstrapThemeDemo.java
License:Apache License
@Override public void init() { setTheme("bootstrap"); window = new Window("My Vaadin Application"); setMainWindow(window);//from w ww . j av a 2 s.co m Button button = new Button("Click Me"); button.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { window.addComponent(new Label("Thank you for clicking")); } }); CssLayout container = new CssLayout(); container.setWidth("100%"); container.addStyleName("container"); typography(container); tables(container); forms(container); buttons(container); window.setContent(container); }