List of usage examples for com.vaadin.ui VerticalLayout setCaption
@Override public void setCaption(String caption)
From source file:lifetime.component.welcome.contact.ContactView.java
License:Apache License
public ContactView(String language) { super(language); VerticalLayout contactView = new VerticalLayout(); contactView.setSizeUndefined();//from ww w.ja v a 2s . c om contactView.setCaption("Contact"); contactView.addComponent(new Label("Contact")); }
From source file:management.limbr.ui.login.LogInViewImpl.java
License:Open Source License
@PostConstruct public void init() { setSizeFull();/* ww w . j a va 2 s . c o m*/ usernameField = new TextField(messages.get("usernameFieldLabel")); usernameField.setWidth(20.0f, Unit.EM); usernameField.setRequired(true); usernameField.setInputPrompt(messages.get("usernameFieldPrompt")); usernameField .addValidator(new StringLengthValidator(messages.get("usernameFieldValidation"), 3, 256, false)); usernameField.setImmediate(true); usernameField.setInvalidAllowed(false); passwordField = new PasswordField(messages.get("passwordFieldLabel")); passwordField.setWidth(20.0f, Unit.EM); passwordField.setInputPrompt(messages.get("passwordFieldPrompt")); passwordField .addValidator(new StringLengthValidator(messages.get("passwordFieldValidation"), 8, 256, false)); passwordField.setImmediate(true); passwordField.setRequired(true); passwordField.setNullRepresentation(""); Button logInButton = new Button(messages.get("logInButtonLabel")); logInButton.addClickListener(event -> { usernameField.setValidationVisible(false); passwordField.setValidationVisible(false); try { usernameField.commit(); passwordField.commit(); } catch (Validator.InvalidValueException e) { Notification.show(e.getMessage()); usernameField.setValidationVisible(true); passwordField.setValidationVisible(true); LOG.debug("Validation of log in fields failed.", e); } listeners.forEach(LogInViewListener::logInClicked); }); VerticalLayout fields = new VerticalLayout(usernameField, passwordField, logInButton); fields.setCaption(messages.get("logInCaption", LimbrApplication.getApplicationName())); fields.setSpacing(true); fields.setMargin(new MarginInfo(true, true, true, false)); fields.setSizeUndefined(); VerticalLayout mainLayout = new VerticalLayout(fields); mainLayout.setSizeFull(); mainLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER); mainLayout.setStyleName(ValoTheme.FORMLAYOUT_LIGHT); setCompositionRoot(mainLayout); listeners.forEach(listener -> listener.viewInitialized(this)); }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Component getVerticalLayout() { HorizontalLayout controls = new HorizontalLayout(); controls.setSpacing(true);/*from w w w.j a va2 s .c om*/ controls.setStyleName("inline"); final VerticalLayout main = new VerticalLayout(); final VerticalLayout vl = new VerticalLayout(); vl.setSpacing(true); vl.setMargin(true); vl.setCaption("Layout Caption"); vl.setIcon(new ThemeResource("../runo/icons/16/document.png")); vl.addComponent(createImageFixedHeight()); vl.addComponent(createImageFixedHeight()); vl.addComponent(createImageFixedHeight()); controls.addComponent( new StyleController(vl, BennuTheme.LAYOUT_BIG, BennuTheme.LAYOUT_INSET, BennuTheme.LAYOUT_SECTION)); controls.addComponent(new SpacingController(vl)); controls.addComponent(new MarginController(vl)); main.addComponent(controls); main.addComponent(vl); return main; }
From source file:net.sf.gazpachoquest.questionnaires.views.login.OldLoginView.java
License:Open Source License
public OldLoginView() { setSizeFull();/*from ww w . j av a 2s. c o m*/ // Language bar in the top-right corner for selecting // invitation interface language final HorizontalLayout languageBar = new HorizontalLayout(); languageBar.setHeight("50px"); // addComponent(languageBar); // setComponentAlignment(languageBar, Alignment.TOP_RIGHT); // Allow selecting a language. We are in a constructor of a // CustomComponent, so preselecting the current // language of the application can not be done before // this (and the selection) component are attached to // the application. final ComboBox languageSelector = new ComboBox("Select a language") { @Override public void attach() { super.attach(); // setValue(getLocale()); } }; // for (int i=0; i<locales.length; i++) { String locale = "es"; languageSelector.addItem(locale); languageSelector.setItemCaption(locale, "espaol"); // Automatically select the current locale // if (locales[i].equals(getLocale())) languageSelector.setValue(locale); // } // Create the invitation input field invitationTextField = new TextField("Invitation key:"); invitationTextField.setWidth("300px"); invitationTextField.setRequired(true); invitationTextField.setInputPrompt("Your questionnair invitation key (eg. 12345678)"); invitationTextField.setInvalidAllowed(false); // Create login button enterButton = new Button("Enter", this); // Add both to a panel VerticalLayout fields = new VerticalLayout(languageSelector, invitationTextField, enterButton); fields.setCaption("Please enter your invitation key to access the questionnair"); fields.setSpacing(true); fields.setMargin(new MarginInfo(true, true, true, false)); fields.setSizeUndefined(); // The view root layout VerticalLayout viewLayout = new VerticalLayout(fields); viewLayout.setSizeFull(); viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER); viewLayout.setStyleName(Reindeer.LAYOUT_BLUE); setCompositionRoot(viewLayout); }
From source file:org.apache.ace.deployment.verifier.ui.ACEVerifierExtension.java
License:Apache License
/** * {@inheritDoc}//from www. j a v a 2 s. c om */ public Component create(Map<String, Object> context) { StatefulTargetObject target = getRepositoryObjectFromContext(context); Component content = new Label("This target is not yet registered, so it can not verify anything."); if (target.isRegistered()) { content = new ManifestArea(target.getID(), getManifest(target), target); } VerticalLayout result = new VerticalLayout(); result.setMargin(true); result.setCaption("Verify/resolve"); result.addComponent(content); return result; }
From source file:org.apache.ace.log.server.ui.LogViewerExtension.java
License:Apache License
/** * {@inheritDoc}/*from w w w .j a v a2 s . c o m*/ */ public Component create(Map<String, Object> context) { StatefulTargetObject target = getRepositoryObjectFromContext(context); if (!target.isRegistered()) { VerticalLayout result = new VerticalLayout(); result.setCaption(CAPTION); result.addComponent(new Label("This target is not yet registered, so it has no log.")); return result; } m_table = new Table() { @Override protected String formatPropertyValue(Object rowId, Object colId, Property property) { DateFormat formatter = SimpleDateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, getApplication().getLocale()); if (COL_TIME.equals(colId)) { return formatter.format(property.getValue()); } return super.formatPropertyValue(rowId, colId, property); } }; m_table.setWidth(FILL_AREA); m_table.setHeight(FILL_AREA); m_table.addContainerProperty(COL_TIME, Date.class, null, "Time", null, null); m_table.addContainerProperty(COL_TYPE, String.class, null, "Type", null, null); m_table.addContainerProperty(COL_PROPERTIES, TextArea.class, null, "Properties", null, null); m_table.setColumnExpandRatio(COL_PROPERTIES, 2); m_table.setColumnExpandRatio(COL_TYPE, 1); m_table.setColumnExpandRatio(COL_TIME, 1); m_table.setColumnCollapsingAllowed(true); try { fillTable(target, m_table); // Sort on time in descending order... m_table.setSortAscending(false); m_table.setSortContainerPropertyId(COL_TIME); } catch (IOException ex) { m_logService.log(LogService.LOG_WARNING, "Log viewer failed!", ex); } TextField tf = makeTextField(COL_TYPE); TextField pf = makeTextField(COL_PROPERTIES); HorizontalLayout filters = new HorizontalLayout(); filters.setSpacing(true); filters.addComponent(tf); filters.addComponent(pf); // main holds the two components: VerticalLayout main = new VerticalLayout(); main.setCaption(CAPTION); main.setSpacing(true); main.addComponent(filters); main.addComponent(m_table); return main; }
From source file:org.apache.ace.tageditor.ACETagEditorExtension.java
License:Apache License
/** * {@inheritDoc}//from w w w.j ava 2s . co m */ public Component create(Map<String, Object> context) { final RepositoryObject sgo = getRepositoryObjectFromContext(context); Component editor; if (sgo instanceof StatefulTargetObject) { StatefulTargetObject statefulTarget = (StatefulTargetObject) sgo; if (statefulTarget.isRegistered()) { editor = createTagEditor(sgo); } else { editor = new Label("This target is not yet registered, so you cannot add tags."); } } else { editor = createTagEditor(sgo); } VerticalLayout result = new VerticalLayout(); result.setCaption("Tag Editor"); result.addComponent(editor); result.setComponentAlignment(editor, Alignment.MIDDLE_CENTER); return result; }
From source file:org.apache.ace.webui.vaadin.Activator.java
License:Apache License
@Override public void init(BundleContext context, DependencyManager manager) throws Exception { manager.add(createComponent().setImplementation(VaadinResourceHandler.class) .add(createServiceDependency().setService(HttpService.class).setRequired(true))); Properties props = new Properties(); // ACE-472 - put Vaadin in production mode... props.put("init.productionMode", "true"); // register the main application for the ACE UI client manager.add(createComponent().setInterface(Servlet.class.getName(), props) .setImplementation(VaadinServlet.class) .add(createConfigurationDependency().setPid(PID).setPropagate(true))); props = new Properties(); props.put(UIExtensionFactory.EXTENSION_POINT_KEY, UIExtensionFactory.EXTENSION_POINT_VALUE_TARGET); props.put(Constants.SERVICE_RANKING, Integer.valueOf(100)); // shows off components that are contributed by extensions manager.add(createComponent().setInterface(UIExtensionFactory.class.getName(), props) .setImplementation(new UIExtensionFactory() { public Component create(Map<String, Object> context) { VerticalLayout vl = new VerticalLayout(); vl.setCaption("Info"); final StatefulTargetObject target = (StatefulTargetObject) context.get("statefulTarget"); Label info = new Label( "Target ID : " + target.getID() + "\n" + "Installed version : " + (target.getLastInstallVersion() == null ? "(none)" : target.getLastInstallVersion()) + "\n" + "Available version : " + target.getCurrentVersion() + "\n" + "Approval state : " + target.getApprovalState() + "\n" + "Store state : " + target.getStoreState() + "\n" + "Provisioning state : " + target.getProvisioningState() + "\n" + "Registration state : " + target.getRegistrationState()); info.setContentMode(Label.CONTENT_PREFORMATTED); vl.addComponent(info); return vl; }//from w ww . ja v a2 s . c o m })); }
From source file:org.azrul.langkuik.framework.customtype.attachment.AttachmentCustomTypeUICreator.java
private void createAtachmentList(final ListSelect attachmentList, final Collection<? extends CustomType> attachments, final Configuration config, final BeanView view, final FormLayout form) { attachmentList.setHeight(attachments.size() + 2, Sizeable.Unit.EM); attachmentList.setMultiSelect(true); VerticalLayout attachmentListCont = new VerticalLayout(); attachmentListCont.setCaption("Attachments"); attachmentListCont.addComponent(attachmentList); attachmentListCont.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override/*from w w w . j av a 2 s. com*/ public void layoutClick(LayoutEvents.LayoutClickEvent event) { if (event.getClickedComponent() == null) { return; } if (event.getClickedComponent().equals(attachmentList)) { Collection<AttachmentCustomType> attachments = (Collection<AttachmentCustomType>) attachmentList .getValue(); if (!attachments.isEmpty()) { AttachmentCustomType attachment = attachments.iterator().next(); final String fullPath = config.get("attachmentRepository") + File.separator + attachment.getRelativeLocation() + File.separator + attachment.getFileName(); FileResource res = new FileResource(new File(fullPath)); view.setViewResource("DOWNLOAD", res); ResourceReference rr = ResourceReference.create(res, view, "DOWNLOAD"); Page.getCurrent().open(rr.getURL(), null); } } } }); form.addComponent(attachmentListCont); }
From source file:org.bubblecloud.ilves.ui.anonymous.login.LoginFlowlet.java
License:Apache License
@SuppressWarnings("serial") @Override/*from w w w . j av a2 s. c om*/ public void initialize() { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); final Company company = getSite().getSiteContext().getObject(Company.class); if (company.isOpenIdLogin()) { final VerticalLayout mainPanel = new VerticalLayout(); mainPanel.setCaption(getSite().localize("header-open-id-login")); layout.addComponent(mainPanel); final HorizontalLayout openIdLayout = new HorizontalLayout(); mainPanel.addComponent(openIdLayout); openIdLayout.setMargin(new MarginInfo(false, false, true, false)); openIdLayout.setSpacing(true); final String returnViewName = "openidlogin"; final Map<String, String> urlIconMap = OpenIdUtil.getOpenIdProviderUrlIconMap(); for (final String url : urlIconMap.keySet()) { openIdLayout.addComponent(OpenIdUtil.getLoginButton(url, urlIconMap.get(url), returnViewName)); } } try { final CustomLayout loginFormLayout = new CustomLayout( JadeUtil.parse("/VAADIN/themes/ilves/layouts/login.jade")); Responsive.makeResponsive(loginFormLayout); loginFormLayout.setCaption(getSite().localize("header-email-and-password-login")); layout.addComponent(loginFormLayout); } catch (final IOException e) { throw new SiteException("Error loading login form.", e); } if (company.isSelfRegistration()) { final Button registerButton = new Button(getSite().localize("button-register") + " >>"); registerButton.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { getFlow().forward(RegisterFlowlet.class); } }); layout.addComponent(registerButton); } if (company.isEmailPasswordReset()) { final Button forgotPasswordButton = new Button(getSite().localize("button-forgot-password") + " >>"); forgotPasswordButton.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { getFlow().forward(ForgotPasswordFlowlet.class); } }); layout.addComponent(forgotPasswordButton); } final Panel panel = new Panel(); panel.setSizeUndefined(); panel.setContent(layout); setViewContent(panel); }