List of usage examples for com.vaadin.ui HorizontalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.mycollab.vaadin.web.ui.StyleCalendarExp.java
License:Open Source License
public StyleCalendarExp() { this.setWidth("230px"); this.setHeightUndefined(); this.setSpacing(false); this.setStyleName("stylecalendar-ext"); this.setMargin(new MarginInfo(true, false, false, false)); styleCalendar.setRenderHeader(false); styleCalendar.setRenderWeekNumbers(false); styleCalendar.setImmediate(true);//from w ww . j a v a 2 s. co m styleCalendar.setWidth("100%"); setDateOptionsGenerator(); btnShowNextYear = new Button(); btnShowNextYear.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_year_next.png"))); btnShowNextYear.setStyleName(WebThemes.BUTTON_LINK); btnShowNextMonth = new Button(); btnShowNextMonth.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_month_next.png"))); btnShowNextMonth.setStyleName(WebThemes.BUTTON_LINK); btnShowPreviousMonth = new Button(); btnShowPreviousMonth.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_month_pre.png"))); btnShowPreviousMonth.setStyleName(WebThemes.BUTTON_LINK); btnShowPreviousYear = new Button(); btnShowPreviousYear.setIcon( new ExternalResource(StorageFactory.generateAssetRelativeLink("icons/16/cal_year_pre.png"))); btnShowPreviousYear.setStyleName(WebThemes.BUTTON_LINK); lbSelectedDate.setValue(UserUIContext.formatDate(new Date())); lbSelectedDate.addStyleName("calendarDateLabel"); lbSelectedDate.setWidth("80"); HorizontalLayout layoutControl = new HorizontalLayout(); layoutControl.setStyleName("calendarHeader"); layoutControl.setWidth("100%"); layoutControl.setHeight("35px"); HorizontalLayout layoutButtonPrevious = new HorizontalLayout(); layoutButtonPrevious.setSpacing(true); layoutButtonPrevious.addComponent(btnShowPreviousYear); layoutButtonPrevious.setComponentAlignment(btnShowPreviousYear, Alignment.MIDDLE_LEFT); layoutButtonPrevious.addComponent(btnShowPreviousMonth); layoutButtonPrevious.setComponentAlignment(btnShowPreviousMonth, Alignment.MIDDLE_LEFT); layoutControl.addComponent(layoutButtonPrevious); layoutControl.setComponentAlignment(layoutButtonPrevious, Alignment.MIDDLE_LEFT); layoutControl.addComponent(lbSelectedDate); layoutControl.setComponentAlignment(lbSelectedDate, Alignment.MIDDLE_CENTER); MHorizontalLayout layoutButtonNext = new MHorizontalLayout(); layoutButtonNext.addComponent(btnShowNextMonth); layoutButtonNext.setComponentAlignment(btnShowNextMonth, Alignment.MIDDLE_RIGHT); layoutButtonNext.addComponent(btnShowNextYear); layoutButtonNext.setComponentAlignment(btnShowNextYear, Alignment.MIDDLE_RIGHT); layoutControl.addComponent(layoutButtonNext); layoutControl.setComponentAlignment(layoutButtonNext, Alignment.MIDDLE_RIGHT); this.addComponent(layoutControl); this.setComponentAlignment(layoutControl, Alignment.TOP_CENTER); this.addComponent(styleCalendar); this.setExpandRatio(styleCalendar, 1.0f); }
From source file:com.mycompany.filmupo.Graficos.java
/** * Metodo de inicializacion de la clase/* w ww . j a va 2s . c o m*/ * * @param vaadinRequest VaadinRequest */ @Override protected void init(VaadinRequest vaadinRequest) { try { HorizontalLayout v2h2 = new HorizontalLayout(); v2h2.setMargin(true); final VerticalLayout v2h1 = new VerticalLayout(); v2h1.setMargin(true); final VerticalSplitPanel v2 = new VerticalSplitPanel(); v2.addComponent(v2h2); v2.addComponent(v2h1); v2.setSplitPosition(22, Unit.PERCENTAGE); v2.setLocked(true); VerticalLayout v1 = new VerticalLayout(); v1.setMargin(true); HorizontalSplitPanel layout = new HorizontalSplitPanel(); layout.addComponent(v1); layout.addComponent(v2); layout.setSplitPosition(28, Unit.PERCENTAGE); setContent(layout); //Creamos los 3 links de navegacion de la aplicacion y loa aadimos al layout declarado al principio del codigo Link pri = new Link("Principal", new ExternalResource("/Principal")); Link est = new Link("Graficos", new ExternalResource("/Graficos")); Link adm = new Link("Administracin", new ExternalResource("/Admin")); v2h2.addComponent(pri); v2h2.addComponent(new Label(" / ")); v2h2.addComponent(est); v2h2.addComponent(new Label(" / ")); v2h2.addComponent(adm); final DAO dao = new DAO(); dao.abrirConexion(); final List<Pelicula> listaPeliculas = dao.consultarPeliculas(); final List<Director> listaDirectores = dao.consultarDirectores(); final List<Actor> listaActores = dao.consultarActores(); //Creamos un unico arbol que contiene el acceso a las 4 graficas que hemos creado: // - Peliculas segun su duracion // - Peliculas segun su genero // - Numero de peliculas segun actor // - Numero de peliculas segun director Tree tree = new Tree(""); String a = "Estadisticas"; tree.addItem(a); String aa = "Peliculas segn su duracin"; tree.addItem(aa); tree.setParent(aa, a); tree.setChildrenAllowed(aa, false); String ab = "Peliculas segn su gnero"; tree.addItem(ab); tree.setParent(ab, a); tree.setChildrenAllowed(ab, false); String ac = "Numero de peliculas segn actor"; tree.addItem(ac); tree.setParent(ac, a); tree.setChildrenAllowed(ac, false); String ad = "Numero de peliculas segn director"; tree.addItem(ad); tree.setParent(ad, a); tree.setChildrenAllowed(ad, false); tree.setSelectable(true); tree.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { v2h1.removeAllComponents(); //Grafica de las peliculas segun su duracion if (event.getProperty().getValue().toString().contains("duracin")) { Chart chart = new Chart(ChartType.PIE); Configuration conf = chart.getConfiguration(); conf.setTitle("Peliculas"); conf.setSubTitle("Segn su duracin en minutos"); PlotOptionsPie options = new PlotOptionsPie(); options.setInnerSize(0); options.setSize("75%"); options.setCenter("50%", "50%"); conf.setPlotOptions(options); DataSeries series = new DataSeries(); for (Pelicula p : listaPeliculas) { series.add(new DataSeriesItem(p.getTitulo(), p.getDuracion())); } conf.addSeries(series); v2h1.addComponent(chart); //Grafica de las peliculas segun su genero } else if (event.getProperty().getValue().toString().contains("gnero")) { Chart chart = new Chart(ChartType.COLUMN); chart.setWidth("400px"); chart.setHeight("300px"); Configuration conf = chart.getConfiguration(); conf.setTitle("Peliculas"); conf.setSubTitle("Agrupadas segn su gnero"); PlotOptionsLine plotOptions = new PlotOptionsLine(); plotOptions.setMarker(new Marker(false)); conf.setPlotOptions(plotOptions); ListSeries series = new ListSeries("Numero de peliculas"); int i1 = 0, i2 = 0, i3 = 0, i4 = 0, i5 = 0; try { dao.abrirConexion(); i1 = dao.numGeneros("Accin"); i2 = dao.numGeneros("Ciencia Ficcin"); i3 = dao.numGeneros("Drama"); i4 = dao.numGeneros("Romance"); i5 = dao.numGeneros("Novela de Suspense"); } catch (IllegalAccessException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } series.addData(i1); series.addData(i2); series.addData(i3); series.addData(i4); series.addData(i5); conf.addSeries(series); XAxis xaxis = new XAxis(); xaxis.setTitle("Gnero"); xaxis.setCategories("Accin", "Ciencia Ficcin", "Drama", "Romance", "Novela de suspense"); conf.addxAxis(xaxis); YAxis yayis = new YAxis(); yayis.setTitle("Nmero de peliculas"); conf.addyAxis(yayis); v2h1.addComponent(chart); //Grafica de las peliculas segun actor } else if (event.getProperty().getValue().toString().contains("actor")) { Chart chart = new Chart(ChartType.PIE); Configuration conf = chart.getConfiguration(); conf.setTitle("Actores"); conf.setSubTitle("Nmero de peliculas que tienen"); PlotOptionsPie options = new PlotOptionsPie(); options.setInnerSize(0); options.setSize("75%"); options.setCenter("50%", "50%"); conf.setPlotOptions(options); DataSeries series = new DataSeries(); for (Actor a : listaActores) { int i = 0; try { dao.abrirConexion(); i = dao.numPeliculasA(a.getIdActor()); } catch (InstantiationException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } series.add(new DataSeriesItem(a.getNombreCompleto(), i)); } conf.addSeries(series); v2h1.addComponent(chart); //Grafica del numero de peliculas segun director } else if (event.getProperty().getValue().toString().contains("director")) { Chart chart = new Chart(ChartType.PIE); Configuration conf = chart.getConfiguration(); conf.setTitle("Directores"); conf.setSubTitle("Nmero de peliculas que tienen"); PlotOptionsPie options = new PlotOptionsPie(); options.setInnerSize(0); options.setSize("75%"); options.setCenter("50%", "50%"); conf.setPlotOptions(options); DataSeries series = new DataSeries(); for (Director d : listaDirectores) { int i = 0; try { dao.abrirConexion(); i = dao.numPeliculasD(d.getIdDirector()); } catch (InstantiationException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } series.add(new DataSeriesItem(d.getNombreCompleto(), i)); } conf.addSeries(series); v2h1.addComponent(chart); } } }); v1.addComponent(tree); dao.cerrarConexion(); } catch (SQLException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(Graficos.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.mycompany.project.views.ContactsView.java
public ContactsView() { VerticalLayout mainVLayout = new VerticalLayout(); mainVLayout.setMargin(true);/*from w ww . j av a 2s.c o m*/ mainVLayout.setSpacing(true); setContent(mainVLayout); // view header Label header = new Label("<div align=\"center\" style=\"font-size:12pt;\">Contactos</div>"); header.setContentMode(ContentMode.HTML); mainVLayout.addComponent(header); // set window properties window.setWidth("400px"); window.setCaption("Nuevo Contacto"); window.setModal(true); window.setContent(newContactForm); // add new cotact button Button btnNew = new Button("Agregar Nuevo Contacto"); mainVLayout.addComponent(btnNew); // clicking the button should display the NewContactForm btnNew.addClickListener(new ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (window.getParent() == null) { getUI().addWindow(window); } } }); //add a horozontal layout - left has a table, right has a ContactDetail component HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setSizeFull(); hLayout.setSpacing(true); mainVLayout.addComponent(hLayout); //add a table table.setWidth("600px"); table.setImmediate(true); hLayout.addComponent(table); // how does table get its data beanContainer.setBeanIdProperty("id"); table.setContainerDataSource(beanContainer); //set columns final Object[] NATURAL_COL_ORDER = new Object[] { "name", "phone", "email" }; final String[] COL_HEADERS_ENGLISH = new String[] { "Name", "Phone", "Email" }; table.setSelectable(true); table.setColumnCollapsingAllowed(true); table.setRowHeaderMode(RowHeaderMode.INDEX); table.setVisibleColumns(NATURAL_COL_ORDER); table.setColumnHeaders(COL_HEADERS_ENGLISH); // selecting a table row should enable/disale the ContactDetails component table.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { String contactId = (String) table.getValue(); contactDetails.setContactId(contactId); } }); //add a ContactDetails component // contactDetails.setWidth("500px"); hLayout.addComponent(contactDetails); // let the table fill the entire remaining width hLayout.setExpandRatio(contactDetails, 1); }
From source file:com.mycompany.project.views.GroupsView.java
public GroupsView() { VerticalLayout mainVLayout = new VerticalLayout(); mainVLayout.setMargin(true);/* www . ja v a 2s . co m*/ mainVLayout.setSpacing(true); setContent(mainVLayout); // view header Label header = new Label("<div align=\"center\" style=\"font-size:12pt;\">Grupos</div>"); header.setContentMode(ContentMode.HTML); mainVLayout.addComponent(header); // set window properties window.setWidth("400px"); window.setCaption("New Group"); window.setModal(true); window.setContent(newGroupForm); // add new cotact button Button btnNew = new Button("Add New Group"); mainVLayout.addComponent(btnNew); // clicking the button should display the NewContactForm btnNew.addClickListener(new ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (window.getParent() == null) { getUI().addWindow(window); } } }); //add a horozontal layout - left has a table, right has a ContactDetail component HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setSizeFull(); hLayout.setSpacing(true); mainVLayout.addComponent(hLayout); //add a table table.setWidth("600px"); table.setImmediate(true); hLayout.addComponent(table); // how does table get its data beanContainer.setBeanIdProperty("id"); table.setContainerDataSource(beanContainer); //set columns final Object[] NATURAL_COL_ORDER = new Object[] { "name" }; final String[] COL_HEADERS_ENGLISH = new String[] { "Name" }; table.setSelectable(true); table.setColumnCollapsingAllowed(true); table.setRowHeaderMode(RowHeaderMode.INDEX); table.setVisibleColumns(NATURAL_COL_ORDER); table.setColumnHeaders(COL_HEADERS_ENGLISH); // selecting a table row should enable/disale the ContactDetails component table.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { String groupId = (String) table.getValue(); groupDetails.setGroupId(groupId); } }); //add a ContactDetails component // contactDetails.setWidth("500px"); hLayout.addComponent(groupDetails); // let the table fill the entire remaining width hLayout.setExpandRatio(groupDetails, 1); }
From source file:com.naoset.framework.frontend.component.profile.CustomerEditWindowView.java
private Component builtButton() { HorizontalLayout hLayout = new HorizontalLayout(); Button bSave = new Button("Guardar"); Button bCancel = new Button("Cancelar"); bSave.addStyleName(ValoTheme.BUTTON_PRIMARY); bSave.addClickListener(new Button.ClickListener() { @Override/*from ww w . j a va 2s . c o m*/ public void buttonClick(Button.ClickEvent event) { } }); hLayout.addComponent(bSave); hLayout.addComponent(bCancel); return hLayout; }
From source file:com.naoset.framework.frontend.view.window.DialogWindow.java
public void setFooterButtons(DialogButton... buttons) { footer.removeAllComponents();/*w w w. ja va 2 s . c o m*/ HorizontalLayout innerLayout = new HorizontalLayout(); innerLayout.setSpacing(true); footer.addComponent(innerLayout); footer.setComponentAlignment(innerLayout, Alignment.TOP_RIGHT); for (DialogButton button : buttons) { Button btn = new Button(); if (button.equals(DialogButton.OK)) { btn.setCaption("OK"); btn.addStyleName(ValoTheme.BUTTON_PRIMARY); btn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { onButtonOKClicked(); } }); okButton = btn; } if (button.equals(DialogButton.CANCEL)) { btn.setCaption("CANCEL"); btn.addStyleName(ValoTheme.BUTTON_PRIMARY); btn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { onButtonCancelClicked(); } }); cancelButton = btn; } if (button.equals(DialogButton.YES)) { btn.setCaption("YES"); btn.addStyleName(ValoTheme.BUTTON_PRIMARY); btn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { onButtonYesClicked(); } }); yesButton = btn; } if (button.equals(DialogButton.NO)) { btn.setCaption("NO"); btn.addStyleName(ValoTheme.BUTTON_PRIMARY); btn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { onButtonNoClicked(); } }); noButton = btn; } if (button.equals(DialogButton.CLOSE)) { btn.setCaption("CLOSE"); btn.addStyleName(ValoTheme.BUTTON_PRIMARY); btn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { onButtonCloseClicked(); } }); closeButton = btn; } innerLayout.addComponent(btn); } }
From source file:com.naoset.framework.frontend.view.window.Window.java
private HorizontalLayout buildFooter() { HorizontalLayout layout = new HorizontalLayout(); layout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); layout.setWidth(100.0f, Unit.PERCENTAGE); //Si el objeto a mostrar hereda de Widget, mostraremos su cabecera con el men en la ventana. if (Widget.class.isInstance(body)) { //if (details.getClass().isInstance(Widget.class)) { Widget aux = (Widget) body;/*from www . j a v a2 s.c om*/ HorizontalLayout header = aux.getHeader(); header.setWidth(100.0f, Unit.PERCENTAGE); layout.addComponent(header); //layout.setComponentAlignment(header, Alignment.TOP_LEFT); layout.setExpandRatio(header, 1); } Button ok = new Button("Cerrar"); ok.addStyleName(ValoTheme.BUTTON_PRIMARY); ok.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { Boolean canClose = true; if (Widget.class.isInstance(body)) { Widget aux = (Widget) body; canClose = !aux.isModified(); } if (canClose) { close(); } else { buildConfirmCloseDialog(); } } }); ok.focus(); layout.addComponent(ok); layout.setComponentAlignment(ok, Alignment.TOP_RIGHT); return layout; }
From source file:com.neatresults.mgnltweaks.neatu2b.ui.form.field.U2BField.java
License:Open Source License
/** * Initialize the field. <br>//from w ww . java2 s. com * Create as many configured Field as we have related values already stored. */ @Override protected void initFields(final PropertysetItem newValue) { root.removeAllComponents(); final TextField id = createTextField("Id", newValue); root.addComponent(id); final TextField title = createTextField("Title", newValue); root.addComponent(title); final TextFieldDefinition def = new TextFieldBuilder("description").label("Description").rows(3) .definition(); final TextArea description = (TextArea) createLocalField(def, newValue.getItemProperty(def.getName()), false); newValue.addItemProperty(def.getName(), description.getPropertyDataSource()); description.setNullRepresentation(""); description.setWidth("100%"); description.setNullSettingAllowed(true); root.addComponent(description); HorizontalLayout ddLine = new HorizontalLayout(); final TextField publishedAt = createTextField("Published", newValue); ddLine.addComponent(publishedAt); final TextField duration = createTextField("Duration", newValue); ddLine.addComponent(duration); ddLine.addComponent(createTextField("Definition", newValue)); Button fetchButton = new Button("Fetch metadata"); fetchButton.addStyleName("magnoliabutton"); fetchButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { String idStr = id.getValue(); // extract id from url when whole url is passed if (idStr.startsWith("http")) { idStr = StringUtils.substringBefore(StringUtils.substringAfter(idStr, "?v="), "&"); } U2BService service = null; try { RestEasyClient client = (RestEasyClient) restClientRegistry.getRestClient("youtube"); service = client.getClientService(U2BService.class); } catch (RegistrationException e) { log.error("Failed to get a client for [" + U2BService.class.getName() + "] with: " + e.getMessage(), e); } if (service != null) { String key = u2bModule.getGoogleKey(); JsonNode response = service.meta(idStr, "snippet", key); try { if (response.get("items").getElements().hasNext()) { JsonNode videoItem = response.get("items").getElements().next(); String descriptionStr = videoItem.get("snippet").get("description").getTextValue(); newValue.getItemProperty("description").setValue(descriptionStr); String titleStr = videoItem.get("snippet").get("title").getTextValue(); newValue.getItemProperty("title").setValue(titleStr); Iterator<Entry<String, JsonNode>> thumbs = videoItem.get("snippet").get("thumbnails") .getFields(); while (thumbs.hasNext()) { Entry<String, JsonNode> entry = thumbs.next(); newValue.getItemProperty(entry.getKey() + "Url") .setValue(entry.getValue().get("url").getTextValue()); newValue.getItemProperty(entry.getKey() + "Width") .setValue("" + entry.getValue().get("width").getLongValue()); newValue.getItemProperty(entry.getKey() + "Height") .setValue("" + entry.getValue().get("height").getLongValue()); } String publishedAtStr = videoItem.get("snippet").get("publishedAt").getTextValue(); newValue.getItemProperty("published").setValue(publishedAtStr); } } catch (Exception e) { log.error("Failed to parse the video metadata.", e); } response = service.meta(idStr, "contentDetails", key); try { if (response.get("items").getElements().hasNext()) { JsonNode videoItem = response.get("items").getElements().next(); String durationStr = videoItem.get("contentDetails").get("duration").getTextValue(); newValue.getItemProperty("duration").setValue(durationStr); String definition = videoItem.get("contentDetails").get("definition").getTextValue(); newValue.getItemProperty("definition").setValue(definition); } } catch (Exception e) { log.error("Failed to parse the video duration.", e); } } } }); ddLine.addComponent(fetchButton); ddLine.setWidth(100, Unit.PERCENTAGE); ddLine.setHeight(-1, Unit.PIXELS); ddLine.setComponentAlignment(fetchButton, Alignment.BOTTOM_RIGHT); root.addComponent(ddLine); PropertysetItem item = (PropertysetItem) getPropertyDataSource().getValue(); root.addComponent(createEntryComponent("default", item), root.getComponentCount() - 1); root.addComponent(createEntryComponent("standard", item), root.getComponentCount() - 1); root.addComponent(createEntryComponent("medium", item), root.getComponentCount() - 1); root.addComponent(createEntryComponent("high", item), root.getComponentCount() - 1); root.addComponent(createEntryComponent("maxres", item), root.getComponentCount() - 1); }
From source file:com.neatresults.mgnltweaks.neatu2b.ui.form.field.U2BField.java
License:Open Source License
/** * Create a single element.<br>/*from w w w. j a v a 2 s . c o m*/ * This single element is composed of:<br> * - a configured field <br> * - a remove Button<br> */ private Component createEntryComponent(String propertyId, PropertysetItem newValue) { String cappedId = StringUtils.capitalize(propertyId); final HorizontalLayout layout = new HorizontalLayout(); layout.setWidth(100, Unit.PERCENTAGE); layout.setHeight(-1, Unit.PIXELS); TextField url = createTextField(cappedId + " Thumbnail", newValue, propertyId + "Url"); layout.addComponent(url); TextField width = createTextField("Width", newValue, propertyId + "Width"); layout.addComponent(width); TextField height = createTextField("Height", newValue, propertyId + "Height"); layout.addComponent(height); layout.setExpandRatio(url, .7f); layout.setExpandRatio(width, .15f); layout.setExpandRatio(height, .15f); return layout; }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.promote.ArticlePromotionViewImpl.java
License:Open Source License
private void createCenterPiece() { HorizontalLayout centerpieceLayout = new HorizontalLayout(); centerpieceLayout.setWidth("100%"); centerpieceLayout.setSpacing(true);/*from w w w . j a v a2 s . co m*/ VerticalLayout centerpieceSettings = new VerticalLayout(); centerpieceSettings.setWidth("100%"); centerpieceSettings.setSpacing(true); Field richTextField = listener.createRichTextField(); richTextField.setCaption("Teaser"); richTextField.setWidth("100%"); richTextField.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { try { articleItem.removeItemProperty("siteAlert"); articleItem.addItemProperty("siteAlert", DefaultPropertyUtil.newDefaultProperty(String.class, event.getProperty().getValue().toString())); articleItem.applyChanges(); } catch (RepositoryException e) { e.printStackTrace(); } } }); centerpieceSettings.addComponent(richTextField); Label placementLabel = new Label("", ContentMode.HTML); placementLabel.setCaption("Placement"); centerpieceSettings.addComponent(placementLabel); CheckBox home = listener.createCheckBox("Home Page"); centerpieceSettings.addComponent(home); CheckBox news = listener.createCheckBox("News Landing"); centerpieceSettings.addComponent(news); CheckBox comm = listener.createCheckBox("Community Landing"); centerpieceSettings.addComponent(comm); CheckBox team = listener.createCheckBox("Team Landing"); centerpieceSettings.addComponent(team); CheckBox cheer = listener.createCheckBox("Cheerleader Landing"); centerpieceSettings.addComponent(cheer); centerpieceLayout.addComponent(centerpieceSettings); Label previewLabel = new Label("", ContentMode.HTML); previewLabel.setCaption("Centerpiece preview"); centerpieceLayout.addComponent(previewLabel); centerPiece.setContent(centerpieceLayout); }