List of usage examples for com.vaadin.ui Panel setHeight
@Override public void setHeight(float height, Unit unit)
From source file:com.klwork.explorer.ui.content.email.EmailDetailPanel.java
License:Apache License
protected void addHtmlContent(String html) { Panel panel = new Panel(); panel.setWidth(800, UNITS_PIXELS);/* ww w. j av a2 s .c o m*/ panel.setHeight(300, UNITS_PIXELS); content = new Label(html, Label.CONTENT_XHTML); content.setHeight(100, UNITS_PERCENTAGE); panel.setContent(content); mainLayout.addComponent(panel); }
From source file:com.skysql.manager.ui.OverviewPanel.java
License:Open Source License
/** * Instantiates a new overview panel./*from w w w.j av a2s . co m*/ */ public OverviewPanel() { HorizontalLayout overviewContainer = new HorizontalLayout(); overviewContainer.addStyleName("overviewPanel"); overviewContainer.setWidth("100%"); setContent(overviewContainer); systemInfo = VaadinSession.getCurrent().getAttribute(SystemInfo.class); systemRecord = systemInfo.getCurrentSystem(); systemLayout = new SystemLayout(systemRecord); overviewContainer.addComponent(systemLayout); VerticalLayout nodesSlot = new VerticalLayout(); nodesSlot.addStyleName("nodesSlot"); nodesSlot.setMargin(new MarginInfo(false, false, false, false)); overviewContainer.addComponent(nodesSlot); overviewContainer.setExpandRatio(nodesSlot, 1.0f); final HorizontalLayout nodesHeader = new HorizontalLayout(); nodesHeader.setStyleName("panelHeaderLayout"); nodesHeader.setWidth("100%"); nodesSlot.addComponent(nodesHeader); nodesLabel = new Label(" "); nodesLabel.setSizeUndefined(); nodesHeader.addComponent(nodesLabel); nodesHeader.setComponentAlignment(nodesLabel, Alignment.MIDDLE_CENTER); nodesHeader.setExpandRatio(nodesLabel, 1.0f); final HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSpacing(true); buttonsLayout.setMargin(new MarginInfo(false, true, false, false)); nodesHeader.addComponent(buttonsLayout); nodesHeader.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_RIGHT); addSystemButton = new Button("Add System..."); addSystemButton.setDescription("Add System"); addSystemButton.setVisible(false); buttonsLayout.addComponent(addSystemButton); addSystemButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { new SystemDialog(null, null); } }); addNodeButton = new Button("Add Node..."); addNodeButton.setDescription("Add Node to the current System"); addNodeButton.setVisible(false); buttonsLayout.addComponent(addNodeButton); addNodeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { new NodeDialog(null, null); } }); final Button editButton = new Button("Edit"); editButton.setDescription("Enter Editing mode"); final Button saveButton = new Button("Done"); saveButton.setDescription("Exit Editing mode"); buttonsLayout.addComponent(editButton); editButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { buttonsLayout.replaceComponent(editButton, saveButton); isEditable = true; systemLayout.setEditable(true); nodesLayout.setEditable(true); nodesHeader.setStyleName("panelHeaderLayout-editable"); if (systemRecord != null && !SystemInfo.SYSTEM_ROOT.equals(systemRecord.getID())) { addNodeButton.setVisible(true); } else { addSystemButton.setVisible(true); } if (systemRecord == null || (systemRecord != null && systemRecord.getNodes().length == 0)) { nodesLayout.placeholderLayout(null); } } }); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { buttonsLayout.replaceComponent(saveButton, editButton); isEditable = false; systemLayout.setEditable(false); nodesLayout.setEditable(false); nodesHeader.setStyleName("panelHeaderLayout"); if (systemRecord != null && systemRecord.getNodes().length == 0) { nodesLayout.placeholderLayout(null); } addNodeButton.setVisible(false); addSystemButton.setVisible(false); } }); Panel panel = new Panel(); panel.setHeight(PANEL_HEIGHT, Unit.PIXELS); panel.addStyleName(Runo.PANEL_LIGHT); nodesSlot.addComponent(panel); nodesLayout = new NodesLayout(systemRecord); nodesLayout.addStyleName("nodesLayout"); nodesLayout.setWidth("100%"); panel.setContent(nodesLayout); }
From source file:de.gedoplan.webclients.vaadin.VaadinDemoUi.java
public Panel createFooter() { Panel footer = new Panel(); footer.setStyleName(ValoTheme.PANEL_WELL); footer.setHeight(75, Unit.PIXELS); Label footerText = new Label(" 2016 gedoplan.de"); footerText.setSizeUndefined();//from www.j a v a2 s. co m VerticalLayout footerLayout = new VerticalLayout(); footerLayout.setSizeFull(); footerLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); footerLayout.addComponent(footerText); footer.setContent(footerLayout); return footer; }
From source file:de.kaiserpfalzEdv.vaadin.about.AboutViewImpl.java
License:Apache License
private void initializeLicense() { licenseLayout = createVerticalLayout("about.license.caption", "about.license.description", FontAwesome.FILE_TEXT);//from w ww .ja v a 2 s . c om Label text = new Label(licenseText, ContentMode.HTML); text.setWidth(100f, PERCENTAGE); Panel panel = new Panel(text); panel.setWidth(100f, PERCENTAGE); panel.setHeight(300f, PIXELS); licenseLayout.addComponent(panel); }
From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.ui.Popup.java
License:Apache License
private void init() { this.setModal(true); this.setHeight(325, Unit.PIXELS); this.setWidth(500, Unit.PIXELS); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();//from w ww .j av a 2 s .c om layout.setSpacing(true); layout.setMargin(true); setContent(layout); Panel panel = new Panel(); panel.setHeight(100, Unit.PERCENTAGE); panel.addStyleName(Runo.PANEL_LIGHT); layout.addComponent(panel); layout.setExpandRatio(panel, 1); messageLabel = new Label(); panel.setContent(messageLabel); Button close = new Button("Beenden", new Button.ClickListener() { private static final long serialVersionUID = -8385641161488292715L; public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(Popup.this); } }); layout.addComponent(close); layout.setComponentAlignment(close, Alignment.BOTTOM_RIGHT); }
From source file:edu.vserver.exercises.videoMcq.QuestionForm.java
License:Apache License
/** * Builds UI components and the layout for them. *//* w ww. j a v a 2 s . com*/ private void doLayout() { VerticalLayout questionUI = new VerticalLayout(); HorizontalLayout mainButtons = new HorizontalLayout(); //mainButtons.setMargin(true); mainButtons.setSpacing(true); this.newQuestionBtn.setWidth(100, Unit.PIXELS); this.cancelButton.setWidth(100, Unit.PIXELS); this.saveButton.setWidth(100, Unit.PIXELS); mainButtons.addComponents(this.newQuestionBtn, this.cancelButton, this.saveButton); questionUI.addComponent(mainButtons); this.initTextFields(); this.inputLayout.setSpacing(true); this.inputLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT); VerticalLayout questionLayout = new VerticalLayout(); this.timeLayout.setMargin(new MarginInfo(true, false, true, false)); this.timeLayout.addComponents(new Label("<strong>Time:</strong>", ContentMode.HTML), this.timeLabel, new Label("<strong> / </strong>", ContentMode.HTML), this.durationLabel); this.timeLayout.setSpacing(true); questionLayout.addComponents(this.timeLayout, this.questionField); VerticalLayout correctAnswers = new VerticalLayout(); correctAnswers.addComponents(this.answerField, this.answerDescriptionField); VerticalLayout wrongAnswers = new VerticalLayout(); wrongAnswers.setCaption("Incorrect answer choices"); HorizontalLayout wrongAnswerButtons = new HorizontalLayout(); wrongAnswerButtons.setDefaultComponentAlignment(Alignment.TOP_CENTER); wrongAnswerButtons.setSpacing(true); wrongAnswerButtons.setMargin(true); wrongAnswerButtons.addComponents(this.addIncorrectAnswer, this.clearIncorrectAnswers); Panel wrongAswersScroller = new Panel(); wrongAswersScroller.setSizeUndefined(); wrongAswersScroller.setHeight(100, Unit.PIXELS); wrongAswersScroller.setWidth(215, Unit.PIXELS); wrongAswersScroller.addStyleName("borderless"); wrongAswersScroller.setContent(this.wrongAnswersLayout); wrongAnswers.addComponents(wrongAnswerButtons, wrongAswersScroller); this.inputLayout.addComponents(questionLayout, correctAnswers, wrongAnswers); questionUI.addComponent(this.inputLayout); this.setCompositionRoot(questionUI); }
From source file:gms.demo.service.presentation.ui.MainUI.java
License:Open Source License
private void initLoginContent() { loginForm.setCaption("Login:"); loginForm.setDescription("<br/>This application does not use your SSO or LDAP " + "passwords. So don't go giving me all your " + "login info."); loginForm.addField("user", new TextField("User:")); loginForm.addField("pass", new PasswordField("Password:")); loginForm.getFooter().addComponent(loginButton); loginButton.addListener(this); // a panel will make this look a little nicer Panel loginPanel = new Panel(); loginPanel.addComponent(loginForm);/*from ww w.j a v a 2s . co m*/ loginPanel.setWidth(24f, Sizeable.UNITS_EM); loginPanel.setHeight(20f, Sizeable.UNITS_EM); // add the components to a root layout and center it loginLayout = new VerticalLayout(); loginLayout.addComponent(loginPanel); // this will keep the form near the top of the page loginLayout.setMargin(true); loginLayout.setComponentAlignment(loginPanel, Alignment.TOP_CENTER); // this would center it on the page // loginLayout.setSizeFull(); // loginLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); }
From source file:info.magnolia.ui.framework.overlay.OverlayPresenter.java
License:Open Source License
@Override public void openAlert(MessageStyleType type, String title, View body, String okButton, final AlertCallback callback) { final BaseDialog dialog = new LightDialog(); dialog.addStyleName(type.getCssClass()); dialog.addStyleName("alert"); dialog.setCaption(title);//from ww w.j a va 2s . c om CompositeIcon icon = (CompositeIcon) Classes.getClassFactory().newInstance(type.getIconClass()); icon.setStyleName("dialog-icon"); dialog.setHeaderToolbar(icon); dialog.showCloseButton(); dialog.setContent(body.asVaadinComponent()); Panel shortcutPanel = new Panel(); shortcutPanel.setStyleName("shortcut-panel"); shortcutPanel.setHeight(100, Unit.PERCENTAGE); shortcutPanel.setWidth(100, Unit.PERCENTAGE); shortcutPanel.setContent(dialog); final OverlayCloser overlayCloser = openOverlay(new ViewAdapter(shortcutPanel), ModalityLevel.LIGHT); final ShortcutListener escapeShortcut = new ShortcutListener("Escape shortcut", ShortcutAction.KeyCode.ESCAPE, null) { @Override public void handleAction(Object sender, Object target) { callback.onOk(); dialog.closeSelf(); } }; shortcutPanel.addShortcutListener(escapeShortcut); addOkHandler(dialog, okButton, overlayCloser, callback); dialog.addDialogCloseHandler(createCloseHandler(overlayCloser)); }
From source file:info.magnolia.ui.framework.overlay.OverlayPresenter.java
License:Open Source License
@Override public void openConfirmation(MessageStyleType type, String title, View body, String confirmButton, String cancelButton, boolean cancelIsDefault, final ConfirmationCallback callback) { final ConfirmationDialog dialog = new ConfirmationDialog(body.asVaadinComponent(), confirmButton, cancelButton, cancelIsDefault); dialog.addStyleName(type.getCssClass()); dialog.addStyleName("confirmation"); dialog.setCaption(title);//from w w w . j av a2 s.com CompositeIcon icon = (CompositeIcon) Classes.getClassFactory().newInstance(type.getIconClass()); icon.setStyleName("dialog-icon"); dialog.setHeaderToolbar(icon); dialog.showCloseButton(); dialog.setContent(body.asVaadinComponent()); Panel shortcutPanel = new Panel(); shortcutPanel.setStyleName("shortcut-panel"); shortcutPanel.setHeight(100, Unit.PERCENTAGE); shortcutPanel.setWidth(100, Unit.PERCENTAGE); shortcutPanel.setContent(dialog); final OverlayCloser overlayCloser = openOverlay(new ViewAdapter(shortcutPanel), ModalityLevel.LIGHT); final ShortcutListener escapeShortcut = new ShortcutListener("Escape shortcut", ShortcutAction.KeyCode.ESCAPE, null) { @Override public void handleAction(Object sender, Object target) { callback.onCancel(); dialog.closeSelf(); } }; shortcutPanel.addShortcutListener(escapeShortcut); dialog.addConfirmationHandler(new ConfirmationDialog.ConfirmationEvent.Handler() { @Override public void onConfirmation(ConfirmationEvent event) { if (event.isConfirmed()) { callback.onSuccess(); } else { callback.onCancel(); } overlayCloser.close(); } }); dialog.addDialogCloseHandler(createCloseHandler(overlayCloser)); }
From source file:module.contents.presentationTier.component.PageView.java
License:Open Source License
@Override public void attach() { super.attach(); final Panel layout = new Panel(); final SpacingHandler content = (SpacingHandler) layout.getContent(); content.setSpacing(true);/*from w ww . j av a 2s . co m*/ final MarginHandler marginHandler = (MarginHandler) layout.getContent(); marginHandler.setMargin(new MarginInfo(false)); setCompositionRoot(layout); layout.setHeight(500, UNITS_PIXELS); layout.addStyleName(BennuTheme.PANEL_LIGHT); final Label title = new Label("<h2>" + page.getTitle().getContent() + "</h2>", Label.CONTENT_XHTML); title.setSizeFull(); layout.addComponent(title); final PageIndex pageIndex = new PageIndex(); layout.addComponent(pageIndex); final PageContent pageContent = new PageContent(); layout.addComponent(pageContent); if (scrolledSection != null) { scrollIntoSection(scrolledSection.getExternalId()); } /* * renderPageMenuArea(horizontalSplitPanel); * renderPageContent(horizontalSplitPanel); */ }