List of usage examples for com.vaadin.ui Panel setHeight
@Override public void setHeight(String height)
From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java
public Component getThirdStage(Source s) { Label header = new Label(Language.get(Word.CRAWLER)); header.addStyleName(ValoTheme.LABEL_H1); Crawler crawler;//from w w w. j a v a 2s. c o m if (s.getCrawler() != null) { crawler = s.getCrawler(); } else { crawler = new Crawler(s); s.setCrawler(crawler); } GridLayout mainGrid = new GridLayout(2, 2); mainGrid.setSizeFull(); mainGrid.setSpacing(true); FormLayout layoutForms = new FormLayout(); //Exclude or Include RadioButtonGroup<Boolean> radios = new RadioButtonGroup<>(); radios.setItems(true, false); radios.setItemCaptionGenerator(b -> b ? Language.get(Word.INCLUDE_TAGS) : Language.get(Word.EXCLUDE_TAGS)); radios.setItemIconGenerator(b -> b ? VaadinIcons.CHECK : VaadinIcons.CLOSE); radios.setSelectedItem(true); radios.addValueChangeListener(event -> include = event.getValue()); //By Class CssLayout addByClassGroup = new CssLayout(); addByClassGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldAddByClass = new TextField(); textFieldAddByClass.setWidth("465px"); Button buttonAddByClass = new Button(VaadinIcons.PLUS); buttonAddByClass.addClickListener(e -> { crawler.addByClass(textFieldAddByClass.getValue(), include); refreshList(mainGrid, crawler); textFieldAddByClass.clear(); }); addByClassGroup.addComponents(textFieldAddByClass, buttonAddByClass); addByClassGroup.setCaption(Language.get(Word.BYCLASS)); //ByTag CssLayout addByTagGroup = new CssLayout(); addByTagGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldAddByTag = new TextField(); Button buttonAddByTag = new Button(VaadinIcons.PLUS); textFieldAddByTag.setWidth("465px"); buttonAddByTag.addClickListener(e -> { crawler.addByTag(textFieldAddByTag.getValue(), include); refreshList(mainGrid, crawler); textFieldAddByTag.clear(); }); addByTagGroup.addComponents(textFieldAddByTag, buttonAddByTag); addByTagGroup.setCaption(Language.get(Word.BYTAG)); //ByID CssLayout addByIDGroup = new CssLayout(); addByIDGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldAddByID = new TextField(); textFieldAddByID.setWidth("465px"); Button buttonAddByID = new Button(VaadinIcons.PLUS); buttonAddByID.addClickListener(e -> { crawler.addByID(textFieldAddByID.getValue(), include); refreshList(mainGrid, crawler); textFieldAddByID.clear(); }); addByIDGroup.addComponents(textFieldAddByID, buttonAddByID); addByIDGroup.setCaption(Language.get(Word.BYID)); //ByAttribute CssLayout addByAttributeGroup = new CssLayout(); addByAttributeGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldAddByAttributeKey = new TextField(); textFieldAddByAttributeKey.setWidth("233px"); TextField textFieldAddByAttributeValue = new TextField(); textFieldAddByAttributeValue.setWidth("232px"); Button buttonAddByAttribute = new Button(VaadinIcons.PLUS); buttonAddByAttribute.addClickListener(e -> { crawler.addByAttribute(textFieldAddByAttributeKey.getValue(), textFieldAddByAttributeValue.getValue(), include); refreshList(mainGrid, crawler); textFieldAddByAttributeKey.clear(); textFieldAddByAttributeValue.clear(); }); addByAttributeGroup.addComponents(textFieldAddByAttributeKey, textFieldAddByAttributeValue, buttonAddByAttribute); addByAttributeGroup.setCaption(Language.get(Word.BYATTRIBUTEVALUE)); layoutForms.addComponents(radios, addByClassGroup, addByTagGroup, addByIDGroup, addByAttributeGroup); mainGrid.addComponent(layoutForms); Label labelResult = new Label(); Panel panelResult = new Panel(labelResult); labelResult.setWidth("100%"); panelResult.setWidth("100%"); panelResult.setHeight("175px"); mainGrid.addComponent(panelResult, 0, 1, 1, 1); Button buttonTestURL = new Button(); buttonTestURL.setIcon(VaadinIcons.EXTERNAL_LINK); buttonTestURL.setCaption(Language.get(Word.OPEN_LINK)); Button buttonTest = new Button(Language.get(Word.TEST), VaadinIcons.CLIPBOARD_CHECK); buttonTest.addClickListener(ce -> { Article a = CrawlerUtils.executeRandom(crawler); labelResult.setValue(a.getBody()); if (reg != null) { reg.remove(); } reg = buttonTestURL .addClickListener(cev -> UI.getCurrent().getPage().open(a.getUrl(), "_blank", false)); }); refreshList(mainGrid, crawler); Runnable cancel = () -> close(); Runnable next = () -> validateThirdStage(s); VerticalLayout windowLayout = new VerticalLayout(); windowLayout.addComponents(header, mainGrid, getFooter(cancel, next, buttonTest, buttonTestURL)); windowLayout.setComponentAlignment(header, Alignment.MIDDLE_CENTER); windowLayout.setExpandRatio(mainGrid, 5); windowLayout.setWidth("1250px"); return windowLayout; }
From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java
private void refreshList(GridLayout grid, Crawler c) { VerticalLayout layoutList = new VerticalLayout(); layoutList.setWidth("100%"); layoutList.setSpacing(false);// www .jav a 2s . c om layoutList.setMargin(false); Panel panelList = new Panel(layoutList); panelList.setHeight("325px"); c.getIncludesByClass() .forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByClass(s, true), Language.get(Word.INCLUDE_TAGS) + " " + Language.get(Word.BYCLASS), s, null))); c.getIncludesByTag().forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByTag(s, true), Language.get(Word.INCLUDE_TAGS) + " " + Language.get(Word.BYTAG), s, null))); c.getIncludesByID().forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByID(s, true), Language.get(Word.INCLUDE_TAGS) + " " + Language.get(Word.BYID), s, null))); c.getIncludesByAttribute() .forEach((k, v) -> layoutList.addComponent(getRow(layoutList, () -> c.removeByAttribute(k, v, true), Language.get(Word.INCLUDE_TAGS) + " " + Language.get(Word.BYATTRIBUTEVALUE), k, v))); c.getExcludeByClass() .forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByClass(s, false), Language.get(Word.EXCLUDE_TAGS) + " " + Language.get(Word.BYCLASS), s, null))); c.getExcludeByTag().forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByTag(s, false), Language.get(Word.EXCLUDE_TAGS) + " " + Language.get(Word.BYTAG), s, null))); c.getExcludeByID().forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByID(s, false), Language.get(Word.EXCLUDE_TAGS) + " " + Language.get(Word.BYID), s, null))); c.getExcludeByAttribute().forEach( (k, v) -> layoutList.addComponent(getRow(layoutList, () -> c.removeByAttribute(k, v, false), Language.get(Word.EXCLUDE_TAGS) + " " + Language.get(Word.BYATTRIBUTEVALUE), k, v))); grid.removeComponent(1, 0); grid.addComponent(panelList, 1, 0); }
From source file:edu.kit.dama.ui.simon.panel.SimonMainPanel.java
License:Apache License
/** * Build the overview tab including the list of all categories and der * overall status./*from w ww . ja v a2 s .c o m*/ * * @param pCategories A list of all categories. * * @return The tab component. */ private Component buildOverviewTab(String[] pCategories) { AbsoluteLayout abLay = new AbsoluteLayout(); UIUtils7.GridLayoutBuilder layoutBuilder = new UIUtils7.GridLayoutBuilder(4, pCategories.length + 1); updateButton = new Button("Update Status"); updateButton.addClickListener(this); Embedded logo = new Embedded(null, new ThemeResource("img/simon.png")); abLay.addComponent(logo, "top:30px;left:30px;"); Label simonSaysLabel = new Label("", ContentMode.HTML); simonSaysLabel.setHeight("150px"); setSimonSaysContent(simonSaysLabel, "Everything is fine."); abLay.addComponent(simonSaysLabel, "top:30px;left:250px;"); int row = 0; for (String category : pCategories) { HorizontalLayout rowLayout = new HorizontalLayout(); Label name = new Label(category); name.setWidth("200px"); name.setHeight("24px"); List<AbstractProbe> probes = probesByCategory.get(category); Collections.sort(probes, new Comparator<AbstractProbe>() { @Override public int compare(AbstractProbe o1, AbstractProbe o2) { return o1.getCurrentStatus().compareTo(o2.getCurrentStatus()); } }); int failed = 0; int unknown = 0; int unavailable = 0; int charactersPerProbe = 100; if (probes.size() > 0) { charactersPerProbe = (int) Math.rint((700.0 / probes.size()) / 8.0); } for (AbstractProbe probe : probes) { Label probeLabel = new Label(StringUtils.abbreviate(probe.getName(), charactersPerProbe)); probeLabel.setHeight("24px"); switch (probe.getCurrentStatus()) { case UNKNOWN: probeLabel.setDescription(probe.getName() + ": UNKNOWN"); probeLabel.addStyleName("probe-unknown"); unknown++; break; case UPDATING: probeLabel.setDescription(probe.getName() + ": UPDATING"); probeLabel.addStyleName("probe-updating"); break; case UNAVAILABLE: probeLabel.setDescription(probe.getName() + ": UNAVAILABLE"); probeLabel.addStyleName("probe-unavailable"); unavailable++; break; case FAILED: probeLabel.setDescription(probe.getName() + ": FAILED"); probeLabel.addStyleName("probe-failed"); failed++; break; default: probeLabel.setDescription(probe.getName() + ": SUCCESS"); probeLabel.addStyleName("probe-success"); } probeLabel.addStyleName("probe"); rowLayout.addComponent(probeLabel); } if (failed != 0) { setSimonSaysContent(simonSaysLabel, "There are errors!"); } else { if (unknown != 0) { setSimonSaysContent(simonSaysLabel, "There are unknown states. Please select 'Update Status'."); } else { if (unavailable != 0) { setSimonSaysContent(simonSaysLabel, "Some probes are unavailable. Please check their configuration."); } } } rowLayout.setWidth("700px"); layoutBuilder.addComponent(name, Alignment.TOP_LEFT, 0, row, 1, 1).addComponent(rowLayout, Alignment.TOP_LEFT, 1, row, 3, 1); row++; } layoutBuilder.addComponent(updateButton, Alignment.BOTTOM_RIGHT, 3, row, 1, 1); GridLayout tabLayout = layoutBuilder.getLayout(); tabLayout.setSpacing(true); tabLayout.setMargin(true); Panel p = new Panel(); p.setContent(tabLayout); p.setWidth("1024px"); p.setHeight("400px"); abLay.addComponent(p, "top:160px;left:30px;"); abLay.setSizeFull(); return abLay; }
From source file:edu.nps.moves.mmowgli.modules.administration.VipListManager.java
License:Open Source License
@SuppressWarnings({ "unchecked", "serial" }) private void showViewOrDelete(final DeleteListener lis) { dialog = new Window("View / Delete VIPs"); dialog.setModal(true);/* ww w.j av a 2 s . c o m*/ VerticalLayout layout = new VerticalLayout(); dialog.setContent(layout); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); List<VipPii> vLis = VHibPii.getAllVips(); vipListSelect = new ListSelect("Select items to delete"); StringBuffer sb = new StringBuffer(); // for popup vipListSelect.addStyleName("m-greyborder"); String lf = System.getProperty("line.separator"); for (int i = 0; i < vLis.size(); i++) { VipPii v; vipListSelect.addItem(v = vLis.get(i)); sb.append(v.getEntry()); sb.append(lf); } if (sb.length() > 0) sb.setLength(sb.length() - 1); // last space vipListSelect.setNullSelectionAllowed(true); vipListSelect.setMultiSelect(true); vipListSelect.setImmediate(true); vipListSelect.addValueChangeListener(new VipSelectListener()); layout.addComponent(vipListSelect); Label copyPopupList = new HtmlLabel("<pre>" + sb.toString() + "</pre>"); Panel p = new Panel(); VerticalLayout lay = new VerticalLayout(); p.setContent(lay); lay.addComponent(copyPopupList); p.setWidth("400px"); p.setHeight("300px"); PopupView popup = new PopupView("Display list as copyable text", p); popup.setHideOnMouseOut(false); if (sb.length() <= 0) popup.setEnabled(false); layout.addComponent(popup); layout.setComponentAlignment(popup, Alignment.MIDDLE_CENTER); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); Button cancelButt = new Button("Cancel", new Button.ClickListener() { public void buttonClick(ClickEvent event) { dialog.close(); lis.continueOrCancel(null); } }); deleteButt = new Button("Delete & Close", new Button.ClickListener() { public void buttonClick(ClickEvent event) { Set<VipPii> set = (Set<VipPii>) vipListSelect.getValue(); if (set.size() <= 0) set = null; dialog.close(); lis.continueOrCancel(set); } }); deleteButt.setEnabled(false); hl.addComponent(cancelButt); hl.addComponent(deleteButt); hl.setComponentAlignment(cancelButt, Alignment.MIDDLE_RIGHT); hl.setExpandRatio(cancelButt, 1.0f); // The components added to the window are actually added to the window's // layout; you can use either. Alignments are set using the layout layout.addComponent(hl); dialog.setWidth("300px"); dialog.setHeight("350px"); hl.setWidth("100%"); vipListSelect.setWidth("99%"); vipListSelect.setHeight("99%"); layout.setExpandRatio(vipListSelect, 1.0f); UI.getCurrent().addWindow(dialog); dialog.center(); }
From source file:edu.nps.moves.mmowgli.modules.cards.IdeaDashboardTabPanel.java
License:Open Source License
protected void buildCardTable() { VerticalLayout vLay = new VerticalLayout(); vLay.setWidth("95%"); vLay.setHeight("100%"); getRightLayout().addComponent(vLay); vLay.addComponent(makeTableHeaders()); Panel pan = new Panel(); pan.setWidth("99%"); pan.setHeight("99%"); pan.setStyleName(Reindeer.PANEL_LIGHT); vLay.addComponent(pan);/*from w w w .j ava2s . c o m*/ vLay.setExpandRatio(pan, 1.0f); // all of it VerticalLayout tableLay; pan.setContent(tableLay = new VerticalLayout()); pan.addStyleName("m-greyborder"); tableLay.setWidth("99%"); List<Card> cards = getCardList(); for (Card c : cards) { if (confirmCard(c)) { CardSummaryLine csl; tableLay.addComponent(csl = new CardSummaryLine(c.getId())); csl.initGui(); csl.setWidth("98%"); } } }
From source file:edu.nps.moves.mmowgli.modules.userprofile.DefineAwardsDialog.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public DefineAwardsDialog() { setCaption("Define Player Award Types"); setModal(true);/*from www.j a v a2 s .c o m*/ setSizeUndefined(); setWidth("700px"); setHeight("400px"); VerticalLayout vLay = new VerticalLayout(); vLay.setMargin(true); vLay.setSpacing(true); vLay.setSizeFull(); setContent(vLay); vLay.addComponent(new HtmlLabel("<b>This dialog is not yet functional</b>")); Panel p = new Panel(); p.setWidth("99%"); p.setHeight("100%"); vLay.addComponent(p); vLay.setExpandRatio(p, 1.0f); gridLayout = new GridLayout(); gridLayout.addStyleName("m-headgrid"); gridLayout.setWidth("100%"); p.setContent(gridLayout); fillPanelTL(); HorizontalLayout buttPan = new HorizontalLayout(); buttPan.setWidth("100%"); buttPan.setSpacing(true); NativeButton addButt = new NativeButton("Add new type", new AddListener()); NativeButton delButt = new NativeButton("Delete type", new DelListener()); NativeButton saveButt = new NativeButton("Save", new SaveListener()); NativeButton cancelButt = new NativeButton("Cancel", new CancelListener()); buttPan.addComponent(addButt); buttPan.addComponent(delButt); Label lab; buttPan.addComponent(lab = new Label()); buttPan.setExpandRatio(lab, 1.0f); buttPan.addComponent(cancelButt); buttPan.addComponent(saveButt); vLay.addComponent(buttPan); //temp saveButt.setEnabled(false); delButt.setEnabled(false); }
From source file:edu.nps.moves.mmowgli.modules.userprofile.ManageAwardsDialog.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public ManageAwardsDialog(Object uId) { this.uId = uId; User u = User.getTL(uId);// ww w .jav a2 s. c o m setCaption("Manage Awards for " + u.getUserName()); setModal(true); setSizeUndefined(); setWidth("625px"); setHeight("400px"); VerticalLayout vLay = new VerticalLayout(); vLay.setMargin(true); vLay.setSpacing(true); vLay.setSizeFull(); setContent(vLay); Panel p = new Panel("Award Assignments -- a check applies the award to player " + u.getUserName()); p.setWidth("99%"); p.setHeight("99%"); vLay.addComponent(p); vLay.setExpandRatio(p, 1.0f); gridLayout = new GridLayout(); gridLayout.addStyleName("m-headgrid"); gridLayout.setWidth("100%"); p.setContent(gridLayout); fillPanelTL(u); //@HibernateUserRead HorizontalLayout buttPan = new HorizontalLayout(); buttPan.setWidth("100%"); buttPan.setSpacing(true); NativeButton defineButt = new NativeButton("Define Award Types", new DefineListener()); NativeButton saveButt = new NativeButton("Save", new SaveListener()); NativeButton cancelButt = new NativeButton("Cancel", new CancelListener()); buttPan.addComponent(defineButt); Label lab; buttPan.addComponent(lab = new Label()); buttPan.setExpandRatio(lab, 1.0f); buttPan.addComponent(cancelButt); buttPan.addComponent(saveButt); vLay.addComponent(buttPan); }
From source file:eu.eco2clouds.portal.page.SubmissionLayout.java
License:Apache License
public SubmissionLayout() { Panel apPanel = new Panel(); //apPanel.setStyleName("e2c"); apPanel.setWidth("100%"); apPanel.setHeight("400px"); apPanel.setContent(new ApplicationProfileLayout()); this.addComponent(apPanel); //Panel notificationPanel = new Panel(); //notificationPanel.setStyleName("e2c"); //notificationPanel.setWidth("100%"); //notificationPanel.setHeight("100%"); //notificationPanel.setContent(notificationTable); //this.addComponent(notificationPanel); //this.setExpandRatio(apPanel, 1.0f); //this.setExpandRatio(notificationPanel, 1.5f); }
From source file:eu.hurion.hello.vaadin.shiro.application.HelloScreen.java
License:Apache License
public HelloScreen(final HerokuShiroApplication app) { setSizeFull();/*from ww w .jav a 2 s . c o m*/ final Subject currentUser = SecurityUtils.getSubject(); final Panel welcomePanel = new Panel(); final FormLayout content = new FormLayout(); final Label label = new Label("Logged in as " + currentUser.getPrincipal().toString()); logout = new Button("logout"); logout.addClickListener(new HerokuShiroApplication.LogoutListener(app)); content.addComponent(label); content.addComponent(logout); welcomePanel.setContent(content); welcomePanel.setWidth("400px"); welcomePanel.setHeight("200px"); addComponent(welcomePanel); setComponentAlignment(welcomePanel, Alignment.MIDDLE_CENTER); final HorizontalLayout footer = new HorizontalLayout(); footer.setHeight("50px"); addComponent(footer); final Button adminButton = new Button("For admin only"); adminButton.setEnabled(currentUser.hasRole("admin")); adminButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { Notification.show("you're an admin"); } }); content.addComponent(adminButton); final Button userButton = new Button("For users with permission 1"); userButton.setEnabled(currentUser.isPermitted("permission_1")); userButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { Notification.show("you've got permission 1"); } }); content.addComponent(userButton); }
From source file:fi.jasoft.draganddrop.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { Panel showcase = new Panel(); showcase.setSizeUndefined();/*ww w. ja v a 2 s. co m*/ navigator = new Navigator(this, showcase); for (DemoView view : views) { navigator.addView(view.getViewPath(), view); } // default openView(views.get(0)); MenuBar demos = new MenuBar(); demos.setStyleName(ValoTheme.MENUBAR_BORDERLESS); for (final DemoView view : views) { demos.addItem(view.getViewCaption(), new Command() { @Override public void menuSelected(MenuItem selectedItem) { openView(view); } }); } VerticalLayout root = new VerticalLayout(demos, showcase); root.setSizeFull(); root.setExpandRatio(showcase, 1); root.setComponentAlignment(showcase, Alignment.MIDDLE_CENTER); setContent(root); HorizontalLayout sourceWrapperLayout = new HorizontalLayout(); Label caption = new Label("Source code for example"); caption.setStyleName("source-caption"); sourceWrapperLayout.addComponent(caption); Panel sourceWrapper = new Panel(codeLabel); sourceWrapper.setStyleName(ValoTheme.PANEL_BORDERLESS); sourceWrapper.setHeight(getPage().getBrowserWindowHeight() + "px"); sourceWrapperLayout.addComponent(sourceWrapper); sourceWrapperLayout.setExpandRatio(sourceWrapper, 1); Toolbox sourceBox = new Toolbox(); sourceBox.setOrientation(ORIENTATION.RIGHT_CENTER); sourceBox.setContent(sourceWrapperLayout); sourceBox.setOverflowSize(30); root.addComponent(sourceBox); }