List of usage examples for com.vaadin.ui Panel setHeight
@Override public void setHeight(String height)
From source file:annis.visualizers.component.pdf.PDFFullVisualizer.java
License:Apache License
@Override public Panel createComponent(VisualizerInput input, VisualizationToggle visToggle) { Panel p = new Panel(); p.setHeight(input.getMappings().getProperty("height", "-1") + "px"); p.setContent(new PDFPanel(input, "-1")); return p;/*from ww w . j av a 2s. co m*/ }
From source file:com.cavisson.gui.dashboard.components.controls.Panels.java
License:Apache License
public Panels() { setMargin(true);/*from w w w . j av a2 s. co m*/ Label h1 = new Label("Panels & Layout panels"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); TestIcon testIcon = new TestIcon(60); Panel panel = new Panel("Normal"); panel.setIcon(testIcon.get()); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Sized"); panel.setIcon(testIcon.get()); panel.setWidth("10em"); panel.setHeight("250px"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Custom Caption"); panel.setIcon(testIcon.get()); panel.addStyleName("color1"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Custom Caption"); panel.setIcon(testIcon.get()); panel.addStyleName("color2"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Custom Caption"); panel.setIcon(testIcon.get()); panel.addStyleName("color3"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Borderless style"); panel.setIcon(testIcon.get()); panel.addStyleName("borderless"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Borderless + scroll divider"); panel.setIcon(testIcon.get()); panel.addStyleName("borderless"); panel.addStyleName("scroll-divider"); panel.setContent(panelContentScroll()); panel.setHeight("17em"); row.addComponent(panel); panel = new Panel("Well style"); panel.setIcon(testIcon.get()); panel.addStyleName("well"); panel.setContent(panelContent()); row.addComponent(panel); CssLayout layout = new CssLayout(); layout.setIcon(testIcon.get()); layout.setCaption("Panel style layout"); layout.addStyleName("card"); layout.addComponent(panelContent()); row.addComponent(layout); layout = new CssLayout(); layout.addStyleName("card"); row.addComponent(layout); HorizontalLayout panelCaption = new HorizontalLayout(); panelCaption.addStyleName("v-panel-caption"); panelCaption.setWidth("100%"); // panelCaption.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label label = new Label("Panel style layout"); panelCaption.addComponent(label); panelCaption.setExpandRatio(label, 1); Button action = new Button(); action.setIcon(FontAwesome.PENCIL); action.addStyleName("borderless-colored"); action.addStyleName("small"); action.addStyleName("icon-only"); panelCaption.addComponent(action); MenuBar dropdown = new MenuBar(); dropdown.addStyleName("borderless"); dropdown.addStyleName("small"); MenuItem addItem = dropdown.addItem("", FontAwesome.CHEVRON_DOWN, null); addItem.setStyleName("icon-only"); addItem.addItem("Settings", null); addItem.addItem("Preferences", null); addItem.addSeparator(); addItem.addItem("Sign Out", null); panelCaption.addComponent(dropdown); layout.addComponent(panelCaption); layout.addComponent(panelContent()); layout.setWidth("14em"); layout = new CssLayout(); layout.setIcon(testIcon.get()); layout.setCaption("Well style layout"); layout.addStyleName("well"); layout.addComponent(panelContent()); row.addComponent(layout); }
From source file:com.cerebro.gorgone.landingpage.SignInWindow.java
private Component setFirstStep() { VerticalLayout firstStep = new VerticalLayout(); firstStep.setMargin(true);/*from www .ja v a 2s . co m*/ // Body HorizontalLayout body = new HorizontalLayout(); FormLayout datiIniziali = new FormLayout(); TextField nomePG = new TextField("Nome del Personaggio"); nomePG.setRequired(true); TextField cognomePG = new TextField("Cognome del Personaggio"); cognomePG.setRequired(true); OptionGroup sessoPG = new OptionGroup("Sesso del Personaggio"); sessoPG.setRequired(true); sessoPG.addItems("Maschio", "Femmina"); ComboBox razzaPG = new ComboBox("Razza"); razzaPG.setRequired(true); Slider age = new Slider("Et"); age.setImmediate(true); age.setWidth("200px"); age.setVisible(false); 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"); } }); ageDescription.addComponents(ageText, ageValue, periodoVita); ageDescription.setVisible(false); datiIniziali.addComponents(nomePG, cognomePG, sessoPG, razzaPG, age, ageDescription); Panel descrizioneRazza = new Panel(); CssLayout descrizioneRazzaContent = new CssLayout(); descrizioneRazza.setWidth("400px"); descrizioneRazza.setHeight("500px"); descrizioneRazza.setContent(descrizioneRazzaContent); // Dettagli di popolazione e comportamento ComboBox TableQuery tq_races = new TableQuery(DatabaseTables.RACES_TABLE, connPool); tq_races.setVersionColumn(DatabaseTables.RACES_VERSION); SQLContainer container_races = null; try { container_races = new SQLContainer(tq_races); } catch (Exception ex) { logger.error(ex.getMessage()); } razzaPG.setContainerDataSource(container_races); razzaPG.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); razzaPG.setItemCaptionPropertyId(DatabaseTables.RACES_NAME); razzaPG.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (razzaPG.getValue() != null) { logger.info("Razza selezionata: " + razzaPG.getValue()); age.setVisible(true); ageDescription.setVisible(true); descrizioneRazzaContent.removeAllComponents(); Item item = razzaPG.getContainerDataSource().getItem(razzaPG.getValue()); race = (String) item.getItemProperty(DatabaseTables.RACES_NAME).getValue(); Label nameRace = new Label(race); FileResource imageSrc = new FileResource( new File(MyUI.basePath + item.getItemProperty(DatabaseTables.RACES_IMAGE).getValue())); Image imageRace = new Image(null, imageSrc); imageRace.setWidth("200px"); Label descriptionRace = new Label( (String) item.getItemProperty(DatabaseTables.RACES_DESCRIPTION).getValue(), ContentMode.HTML); min_age = (int) item.getItemProperty(DatabaseTables.RACES_MIN_AGE).getValue(); max_age = (int) item.getItemProperty(DatabaseTables.RACES_MAX_AGE).getValue(); age.setMin(min_age); age.setMax(max_age); strenght = (int) item.getItemProperty(DatabaseTables.RACES_STRENGHT).getValue(); resistance = (int) item.getItemProperty(DatabaseTables.RACES_RESISTANCE).getValue(); agility = (int) item.getItemProperty(DatabaseTables.RACES_AGILITY).getValue(); intelligence = (int) item.getItemProperty(DatabaseTables.RACES_INTELLIGENCE).getValue(); wisdom = (int) item.getItemProperty(DatabaseTables.RACES_WISDOM).getValue(); charm = (int) item.getItemProperty(DatabaseTables.RACES_CHARM).getValue(); Label min_ageL = new Label("Et minima: " + min_age); Label max_ageL = new Label("Et masima " + max_age); // Panel levels = new Panel(); // VerticalLayout levelsContent = new VerticalLayout(); // levels.setContent(levelsContent); // Label strenghtL = new Label("Forza: " + strenght); // levelsContent.addComponents(strenghtL); String levelTable = "<table><tr><td>Forza</td><td>Resistenza</td><td>Agilit</td><td>Intelligenza</td>" + "<td>Saggezza</td><td>Carisma</td></tr><tr>" + "<td>" + strenght + "</td>" + "<td>" + resistance + "</td>" + "<td>" + agility + "</td>" + "<td>" + intelligence + "</td>" + "<td>" + wisdom + "</td>" + "<td>" + charm + "</td>" + "</tr></table>"; Label levels = new Label(levelTable, ContentMode.HTML); descrizioneRazzaContent.addComponents(nameRace, imageRace, descriptionRace, min_ageL, max_ageL, levels); } } }); body.addComponents(datiIniziali, descrizioneRazza); CssLayout footer = new CssLayout(); Button next = new Button("Avanti ->"); next.addClickListener((Button.ClickEvent event) -> { user.setNomePG(nomePG.getValue()); user.setCognomePG(cognomePG.getValue()); user.setSessoPG(sessoPG.getValue().toString()); user.setRazzaPG(race); user.setEtaPG(age.getValue().toString()); user.setForzaPG(strenght); user.setResistenzaPG(resistance); user.setAgilitaPG(agility); user.setIntelligenzaPG(intelligence); user.setSaggezzaPG(wisdom); user.setCarismaPG(charm); this.setContent(setSecondStep()); }); footer.addComponents(next, createCancelButton()); firstStep.addComponents(setHeader("2/4"), body, footer); return firstStep; }
From source file:com.cms.utils.CommonUtils.java
public static Panel addOg2Panel(OptionGroup og, String caption, String height) { og.setWidth("100%"); og.setHeight("-1px"); og.setImmediate(true);/*from www. jav a 2 s. c o m*/ og.setMultiSelect(true); VerticalLayout layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeightUndefined(); layout.setImmediate(true); layout.setMargin(true); layout.setSpacing(true); layout.addComponent(og); layout.setComponentAlignment(og, Alignment.MIDDLE_LEFT); Panel panel = new Panel(); if (!DataUtil.isStringNullOrEmpty(caption)) { panel.setCaption(caption); } panel.setWidth("100%"); panel.setImmediate(true); if (!DataUtil.isStringNullOrEmpty(height)) { panel.setHeight(height); } else { panel.setHeight("200px"); } panel.addStyleName(Runo.PANEL_LIGHT); panel.setContent(layout); return panel; }
From source file:com.jiangyifen.ec2.ui.LoginLayout.java
/** * ?/*from w ww . j a v a 2s. c om*/ * * @param roleType ? */ public LoginLayout(RoleType roleType, Ec2LoginLayout ec2LoginLayout) { // ?? this.setSpacing(true); this.setMargin(true); this.roleType = roleType; this.ec2LoginLayout = ec2LoginLayout; userLoginService = SpringContextHolder.getBean("userLoginService"); userService = SpringContextHolder.getBean("userService"); // ?Cookie this.getCookies(); Panel loginPanel = new Panel(roleType.name().toUpperCase() + " LOGIN INTERFACE"); loginPanel.setWidth("380px"); loginPanel.setHeight("260px"); this.addComponent(loginPanel); this.setComponentAlignment(loginPanel, Alignment.BOTTOM_CENTER); // ? VerticalLayout panelContent = (VerticalLayout) loginPanel.getContent(); createLoginMainComponents(panelContent, roleType); // ??? (?, ?) createConflictManageWindow(); }
From source file:com.lizardtech.expresszip.ui.FindLayersPresenter.java
License:Apache License
private void addClusteredVectorLayer() { if (clusterLayer != null) { findLayersMap.removeLayer(clusterLayer); }//from w ww .j a v a 2 s .co m clusterLayer = new VectorLayer(); clusterLayer.setSelectionMode(SelectionMode.SIMPLE); clusterLayer.addListener(new org.vaadin.vol.VectorLayer.VectorSelectedListener() { @Override public void vectorSelected(org.vaadin.vol.VectorLayer.VectorSelectedEvent event) { Vector[] vectors = event.getVectors(); if (null == vectors) return; if (null != popup) { findLayersMap.removeComponent(popup); } popup = new Popup(); findLayersMap.addPopup(popup); CssLayout cssLayout = new CssLayout(); VerticalLayout verticalLayout = new VerticalLayout(); Panel panel = new Panel(); panel.setStyleName(Runo.PANEL_LIGHT); panel.setContent(verticalLayout); int height = Math.min(400, (vectors.length + 1) * 32 + 10); panel.setHeight(height + "px"); cssLayout.addComponent(panel); popup.addComponent(cssLayout); TreeTable popupTable = findLayersView.getPopupTable(); popupTable.removeAllItems(); verticalLayout.addComponent(popupTable); List<ExpressZipLayer> layers = new ArrayList<ExpressZipLayer>(); for (Vector selected : vectors) { final ExpressZipLayer layer = (ExpressZipLayer) selected.getData(); findLayersView.addLayerItem(layer, popupTable); layers.add(layer); } Bounds b = MapModel.getBoundsForLayers(layers, MapModel.EPSG4326); popup.setLat((b.getMinLat() + b.getMaxLat()) / 2.0d); popup.setLon((b.getMaxLon() + b.getMinLon()) / 2.0d); } }); clusterLayer.addListener(new org.vaadin.vol.VectorLayer.VectorUnSelectedListener() { @Override public void vectorUnSelected(VectorUnSelectedEvent event) { if (null != popup) { findLayersMap.removeComponent(popup); popup = null; } } }); clusterLayer.setImmediate(true); findLayersMap.addLayer(clusterLayer); }
From source file:com.logicbomb.newschool.MyAppWidgetSet.core.DayWidget.java
public DayWidget() { //Creating Panel Panel iPanel = new Panel(); iPanel.addStyleName("backColorWhite"); iPanel.setWidth("876px"); iPanel.setHeight("41px"); ProgressBar iDayProgressBar = new ProgressBar(); iDayProgressBar.setCaption("Period 3, 10th October"); iDayProgressBar.setWidth("875px"); iDayProgressBar.setValue(0.3f);//from w ww. ja v a2 s .c o m addComponent(iDayProgressBar); //Adding Panel to Vertical Layout addComponent(iPanel); VerticalLayout iVerticalLayout = new VerticalLayout(); GridLayout iGridLayout = new GridLayout(9, 1); iGridLayout.setWidth("1000px"); iGridLayout.setHeight("40px"); for (int i = 1; i <= 8; i++) { HourWidget iHourAtAGlanceWidget = new HourWidget(i, 8); iHourAtAGlanceWidget.setSizeFull(); iGridLayout.addComponent(iHourAtAGlanceWidget); iGridLayout.setColumnExpandRatio(i, 1); } iVerticalLayout.addComponent(iGridLayout); iPanel.setContent(iVerticalLayout); }
From source file:com.logicbomb.newschool.MyAppWidgetSet.core.UserDetailsWidgetOld.java
public UserDetailsWidgetOld() { setSpacing(true);/* w ww . j a v a 2s. c o m*/ Panel iPanel = new Panel(); iPanel.setWidth("50px"); iPanel.setHeight("50px"); iPanel.setStyleName("backColorWhite"); addComponent(iPanel); String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath(); // Image as a file resource FileResource resource = new FileResource(new File(basepath + "/VAADIN/themes/mytheme/img/loginPage.jpg")); // Show the image in the application Image image = new Image("", resource); image.setSizeFull(); iPanel.setContent(image); }
From source file:com.mycompany.project.components.ContactDetails.java
public ContactDetails() { // setCaption("Contact Details"); VerticalLayout mainVLayout = new VerticalLayout(); mainVLayout.setMargin(true);/*from ww w .j a va2 s . c o m*/ mainVLayout.setSpacing(true); setContent(mainVLayout); tfName.setSizeFull(); tfAddress.setSizeFull(); tfPhone.setSizeFull(); tfEmail.setSizeFull(); Panel panel = new Panel("Grupos"); panel.setWidth("100%"); panel.setHeight("50px"); panel.setContent(groupsHLayout); mainVLayout.addComponent(tfName); mainVLayout.addComponent(tfAddress); mainVLayout.addComponent(tfPhone); mainVLayout.addComponent(tfEmail); mainVLayout.addComponent(groupsHLayout); Button btnUpdate = new Button("Actualizar"); mainVLayout.addComponent(btnUpdate); btnUpdate.addClickListener(new ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { //invoke business logic BusinessLogic bl = ((MyVaadinUI) getUI()).getBusinessLogic(); String name = tfName.getValue(); String address = tfAddress.getValue(); String phone = tfPhone.getValue(); String email = tfEmail.getValue(); ArrayList<String> selectedGroupIds = new ArrayList<String>(); Set<String> groupIdSet = groupsMap.keySet(); for (String groupId : groupIdSet) { CheckBox cb = groupsMap.get(groupId); if (cb.getValue()) { selectedGroupIds.add(groupId); } } boolean success = bl.updateContact(selectedContactId, name, address, phone, email, selectedGroupIds); if (success) { load(selectedContactId); Notification.show("Informacion", "Contacto Actualizado", Notification.Type.TRAY_NOTIFICATION); } else { Notification.show("Error", "\nSomething bad happened", Notification.Type.ERROR_MESSAGE); } } }); ContactDetails.this.setVisible(false); }
From source file:com.squadd.chat.ChatController.java
public static Panel createDatePanel(ChatMessage mess) { Panel datePanel = new Panel(); //FormLayout form = new FormLayout(); //form.setMargin(false); Label dateLabel = new Label(mess.getFormattedDate()); dateLabel.addStyleName("dateLabel"); dateLabel.setValue("YrMOOOm"); //form.addComponent(dateLabel); //datePanel.setContent(form); datePanel.setContent(dateLabel);/*from ww w. ja v a 2s . co m*/ datePanel.setWidth("100px"); datePanel.setHeight("50px"); return datePanel; }