List of usage examples for com.vaadin.ui Panel Panel
public Panel()
From source file:edu.nps.moves.mmowgli.modules.cards.IdeaDashboardTabSuperActive.java
License:Open Source License
@Override public void initGui() { Label leftLabel = new Label("Super-active chains are sets of cards that have two or more authors " + "and four or more follow-on cards at two levels."); this.getLeftLayout().addComponent(leftLabel, "top:0px;left:0px"); Panel pan = new Panel(); getRightLayout().addComponent(pan, "top:0px;left:0px"); pan.setSizeUndefined();//from w ww. j ava 2 s . c om pan.setStyleName(Reindeer.PANEL_LIGHT); VerticalLayout tableLay = new VerticalLayout(); pan.setContent(tableLay); tableLay.setMargin(false); // default comes back from panel w/ margins tableLay.setSizeUndefined(); tree = new CardChainTree(null, true); // no cards at first tree.setWidth("680px"); tree.setHeight("730px"); tree.addStyleName("m-greyborder"); tableLay.addComponent(tree); }
From source file:edu.nps.moves.mmowgli.modules.gamemaster.EventMonitorPanel.java
License:Open Source License
@Override public void initGui() { setWidth("950px"); addStyleName("m-greyborder"); addStyleName("m-background-lightgrey"); addStyleName("m-marginleft-25"); setMargin(true);/*ww w . j ava 2 s .c o m*/ setSpacing(false); buildTopInfo(this); pan = new Panel(); addComponent(pan); pan.setWidth("99%"); pan.setHeight(PANEL_HEIGHT); vLay = new VerticalLayout(); vLay.setMargin(true); pan.setContent(vLay); setComponentAlignment(pan, Alignment.TOP_CENTER); pan.addStyleName("m-greyborder"); NativeButton moreButt = new NativeButton("Get another page of prior events", this); addComponent(moreButt); setComponentAlignment(moreButt, Alignment.TOP_RIGHT); Label lab; addComponent(lab = new Label()); lab.setHeight("10px"); addComponent(new Label("Broadcast message to game masters")); messageTA = new TextArea(); messageTA.setRows(2); messageTA.setWidth("100%"); addComponent(messageTA); NativeButton sendButt = new NativeButton("Send", new SendListener()); addComponent(sendButt); loadEvents(); }
From source file:edu.nps.moves.mmowgli.modules.gamemaster.SetBlogHeadlineWindow.java
License:Open Source License
@Override public void attach() { Panel p = new Panel(); setContent(p);//from w w w . j a va 2 s . c o m p.setSizeFull(); VerticalLayout layout = new VerticalLayout(); layout.addStyleName("m-blogheadline"); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); p.setContent(layout); layout.addComponent(infoLab = new Label( "Game masters can communicate with players throughout the game. Add a new headling, tooltip and link here.")); layout.addComponent(textLab = new Label("Enter headline:")); textTF = new TextField(); textTF.setInputPrompt("Enter new headline or choose from previous ones below"); textTF.setWidth("100%"); textTF.addStyleName("m-blogtextfield"); layout.addComponent(textTF); layout.addComponent(toolTipLab = new Label("Enter headline tooltip:")); toolTipTF = new TextField(); toolTipTF.setWidth("100%"); layout.addComponent(toolTipTF); layout.addComponent(urlLab = new Label("Enter blog entry url:")); urlTF = new TextField(); urlTF.setWidth("100%"); layout.addComponent(urlTF); table = new Table("Previous headlines"); table.setSizeFull(); table.setImmediate(true); table.setColumnExpandRatio("date", 1); table.setColumnExpandRatio("text", 1); table.setColumnExpandRatio("tooltip", 1); table.setColumnExpandRatio("url", 1); table.setSelectable(true); table.setMultiSelect(true); // return whole pojo table.addItemClickListener(this); table.setContainerDataSource(MessageUrl.getContainer()); layout.addComponent(table); layout.addComponent(nullCheckBox); nullCheckBox.addValueChangeListener(new CBListener()); HorizontalLayout buttHl = new HorizontalLayout(); buttHl.setSpacing(true); buttHl.addComponent(cancelButt); buttHl.addComponent(okButt); layout.addComponent(buttHl); layout.setComponentAlignment(buttHl, Alignment.TOP_RIGHT); layout.setExpandRatio(table, 1.0f); // gets all setWidth("675px"); setHeight("455px"); }
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 ww w .j av a 2s . 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.UserProfileMyMailPanel.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public UserProfileMyMailPanel(Object uid) { super(uid);/*from ww w . j a v a 2 s .c o m*/ if (!userIsMe) return; mailPanel = new Panel(); mailPanel.setSizeFull(); mailPanel.setContent(panelVL = new VerticalLayout()); panelVL.setSpacing(false);//(true); }
From source file:edu.vcu.csbc.vahmpexplorer.main.VaHMPExplorer.java
public Component createToolBar(boolean loggedIn) { HorizontalLayout h = new HorizontalLayout(); h.setMargin(true);/*from w ww.jav a 2 s. c o m*/ h.setWidth("100%"); Embedded headerImg = new Embedded(null, new ThemeResource("../vahmpexplorer/img/header.png")); headerImg.setWidth(311, Embedded.UNITS_PIXELS); headerImg.setHeight(45, Embedded.UNITS_PIXELS); headerImg.setType(Embedded.TYPE_IMAGE); headerImg.setStyleName(BaseTheme.BUTTON_LINK); headerImg.setDescription("Version " + HelpMessages.VERSION); h.addComponent(headerImg); if (loggedIn) { Panel panel = new Panel(); Label loggedInUser = new Label( "Welcome: " + user.getFirstName() + " " + user.getLastName() + " (" + user.getLogin() + ")"); changePassword = new Button("Change Password"); changePassword.setStyleName(BaseTheme.BUTTON_LINK); changePassword.addListener((Button.ClickListener) this); logout = new Button("Logout"); logout.setStyleName(BaseTheme.BUTTON_LINK); logout.addListener((Button.ClickListener) this); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.addComponent(changePassword); hl.addComponent(logout); panel.addComponent(loggedInUser); panel.addComponent(hl); h.addComponent(panel); h.setComponentAlignment(panel, Alignment.MIDDLE_RIGHT); } PopupView help = new PopupView(new MainHelpPopup()); h.addComponent(help); h.setComponentAlignment(help, Alignment.MIDDLE_RIGHT); h.setComponentAlignment(headerImg, Alignment.MIDDLE_LEFT); return h; }
From source file:edu.vserver.exercises.videoMcq.QuestionForm.java
License:Apache License
/** * Builds UI components and the layout for them. *//* w w w . j a v a 2 s . c o m*/ 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: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();// w ww . j a v 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:eu.maxschuster.vaadin.signaturefield.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle(pageTitle);/*from w w w .j av a 2 s. c o m*/ final VerticalLayout margin = new VerticalLayout(); setContent(margin); final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setWidth("658px"); margin.addComponent(layout); margin.setComponentAlignment(layout, Alignment.TOP_CENTER); final Label header1 = new Label(pageTitle); header1.addStyleName("h1"); header1.setSizeUndefined(); layout.addComponent(header1); layout.setComponentAlignment(header1, Alignment.TOP_CENTER); final TabSheet tabSheet = new TabSheet(); tabSheet.setWidth("100%"); layout.addComponent(tabSheet); layout.setComponentAlignment(tabSheet, Alignment.TOP_CENTER); final Panel signaturePanel = new Panel(); signaturePanel.addStyleName("signature-panel"); signaturePanel.setWidth("100%"); tabSheet.addTab(signaturePanel, "Demo"); final VerticalLayout signatureLayout = new VerticalLayout(); signatureLayout.setMargin(true); signatureLayout.setSpacing(true); signatureLayout.setSizeFull(); signaturePanel.setContent(signatureLayout); final SignatureField signatureField = new SignatureField(); signatureField.setWidth("100%"); signatureField.setHeight("318px"); signatureField.setPenColor(Color.ULTRAMARINE); signatureField.setBackgroundColor("white"); signatureField.setConverter(new StringToDataUrlConverter()); signatureField.setPropertyDataSource(dataUrlProperty); signatureField.setVelocityFilterWeight(0.7); signatureLayout.addComponent(signatureField); signatureLayout.setComponentAlignment(signatureField, Alignment.MIDDLE_CENTER); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setWidth("100%"); signatureLayout.addComponent(buttonLayout); final Button clearButton = new Button("Clear", new ClickListener() { @Override public void buttonClick(ClickEvent event) { signatureField.clear(); } }); buttonLayout.addComponent(clearButton); buttonLayout.setComponentAlignment(clearButton, Alignment.MIDDLE_LEFT); final Label message = new Label("Sign above"); message.setSizeUndefined(); buttonLayout.addComponent(message); buttonLayout.setComponentAlignment(message, Alignment.MIDDLE_CENTER); final ButtonLink saveButtonLink = new ButtonLink("Save", null); saveButtonLink.setTargetName("_blank"); buttonLayout.addComponent(saveButtonLink); buttonLayout.setComponentAlignment(saveButtonLink, Alignment.MIDDLE_RIGHT); final Panel optionsPanel = new Panel(); optionsPanel.setSizeFull(); tabSheet.addTab(optionsPanel, "Options"); final FormLayout optionsLayout = new FormLayout(); optionsLayout.setMargin(true); optionsLayout.setSpacing(true); optionsPanel.setContent(optionsLayout); final ComboBox mimeTypeComboBox = new ComboBox(null, mimeTypeContainer); optionsLayout.addComponent(mimeTypeComboBox); mimeTypeComboBox.setItemCaptionPropertyId("mimeType"); mimeTypeComboBox.setNullSelectionAllowed(false); mimeTypeComboBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { MimeType mimeType = (MimeType) event.getProperty().getValue(); signatureField.setMimeType(mimeType); } }); mimeTypeComboBox.setValue(MimeType.PNG); mimeTypeComboBox.setCaption("Result MIME-Type"); final CheckBox immediateCheckBox = new CheckBox("immediate", false); optionsLayout.addComponent(immediateCheckBox); immediateCheckBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean immediate = (Boolean) event.getProperty().getValue(); signatureField.setImmediate(immediate); } }); final CheckBox readOnlyCheckBox = new CheckBox("readOnly", false); optionsLayout.addComponent(readOnlyCheckBox); readOnlyCheckBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean readOnly = (Boolean) event.getProperty().getValue(); signatureField.setReadOnly(readOnly); mimeTypeComboBox.setReadOnly(readOnly); clearButton.setEnabled(!readOnly); } }); final CheckBox requiredCheckBox = new CheckBox("required (causes bug that clears field)", false); optionsLayout.addComponent(requiredCheckBox); requiredCheckBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean required = (Boolean) event.getProperty().getValue(); signatureField.setRequired(required); } }); final CheckBox clearButtonEnabledButton = new CheckBox("clearButtonEnabled", false); optionsLayout.addComponent(clearButtonEnabledButton); clearButtonEnabledButton.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean clearButtonEnabled = (Boolean) event.getProperty().getValue(); signatureField.setClearButtonEnabled(clearButtonEnabled); } }); final Panel resultPanel = new Panel("Results:"); resultPanel.setWidth("100%"); layout.addComponent(resultPanel); final VerticalLayout resultLayout = new VerticalLayout(); resultLayout.setMargin(true); resultPanel.setContent(resultLayout); final Image stringPreviewImage = new Image("String preview image:"); stringPreviewImage.setWidth("500px"); resultLayout.addComponent(stringPreviewImage); final Image dataUrlPreviewImage = new Image("DataURL preview image:"); dataUrlPreviewImage.setWidth("500px"); resultLayout.addComponent(dataUrlPreviewImage); final TextArea textArea = new TextArea("DataURL:"); textArea.setWidth("100%"); textArea.setHeight("300px"); resultLayout.addComponent(textArea); final Label emptyLabel = new Label(); emptyLabel.setCaption("Is Empty:"); emptyLabel.setValue(String.valueOf(signatureField.isEmpty())); resultLayout.addComponent(emptyLabel); signatureField.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String signature = (String) event.getProperty().getValue(); stringPreviewImage.setSource(signature != null ? new ExternalResource(signature) : null); textArea.setValue(signature); emptyLabel.setValue(String.valueOf(signatureField.isEmpty())); } }); dataUrlProperty.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { try { final DataUrl signature = (DataUrl) event.getProperty().getValue(); dataUrlPreviewImage.setSource( signature != null ? new ExternalResource(serializer.serialize(signature)) : null); StreamResource streamResource = null; if (signature != null) { StreamSource streamSource = new StreamSource() { @Override public InputStream getStream() { return new ByteArrayInputStream(signature.getData()); } }; MimeType mimeType = MimeType.valueOfMimeType(signature.getMimeType()); String extension = null; switch (mimeType) { case JPEG: extension = "jpg"; break; case PNG: extension = "png"; break; } streamResource = new StreamResource(streamSource, "signature." + extension); streamResource.setMIMEType(signature.getMimeType()); streamResource.setCacheTime(0); } saveButtonLink.setResource(streamResource); } catch (MalformedURLException e) { logger.error(e.getMessage(), e); } } }); }