List of usage examples for com.vaadin.ui Panel setWidthUndefined
@Override public void setWidthUndefined()
From source file:de.fatalix.bookery.view.login.LoginView.java
License:Open Source License
private Component buildLoginForm() { FormLayout loginForm = new FormLayout(); loginForm.addStyleName("login-form"); loginForm.setSizeUndefined();/*from w ww . j a v a2 s.c om*/ loginForm.setMargin(false); loginForm.addComponent(username = new TextField("Username", "admin")); username.setWidth(15, Unit.EM); loginForm.addComponent(password = new PasswordField("Password")); password.setWidth(15, Unit.EM); password.setDescription(""); CssLayout buttons = new CssLayout(); buttons.setStyleName("buttons"); loginForm.addComponent(buttons); login = new Button("login"); buttons.addComponent(login); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { presenter.doLogin(username.getValue(), password.getValue()); } catch (AuthenticationException ex) { LoginView.this.showNotification( new Notification("Wrong login", Notification.Type.ERROR_MESSAGE), ValoTheme.NOTIFICATION_FAILURE); } finally { login.setEnabled(true); } } }); login.addStyleName(ValoTheme.BUTTON_FRIENDLY); buttons.addComponent(forgotPassword = new Button("Forgot password?")); forgotPassword.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { showNotification(new Notification("Hint: Ask me", Notification.Type.HUMANIZED_MESSAGE), ValoTheme.NOTIFICATION_SUCCESS); } }); forgotPassword.addStyleName(ValoTheme.BUTTON_LINK); Panel loginPanel = new Panel(loginForm); loginPanel.setWidthUndefined(); loginPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); loginPanel.addAction(new ShortcutListener("commit", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { try { presenter.doLogin(username.getValue(), password.getValue()); } catch (AuthenticationException ex) { LoginView.this.showNotification( new Notification("Wrong login", Notification.Type.ERROR_MESSAGE), ValoTheme.NOTIFICATION_FAILURE); } } }); return loginPanel; }
From source file:fi.jasoft.dragdroplayouts.demo.views.DragdropDragGrabFilterDemo.java
License:Apache License
private Panel createCompositeChild(String caption) { Panel compositePanel = new Panel(); compositePanel.setWidthUndefined(); compositePanel.setCaption("Composite Widget " + caption); VerticalLayout content = new VerticalLayout(); content.setWidthUndefined();/*from ww w.ja va 2 s . c o m*/ compositePanel.setContent(content); content.addComponent(new Label("Grab me to drag Panel")); content.addComponent(new Button("Cannot be grabbed")); content.addComponent(new TextField("Cannot be grabbed TextField")); content.addComponent(new Label("Grab me too!")); for (int i = 0; i < content.getComponentCount(); i++) { content.getComponent(i).setWidth(100, Unit.PERCENTAGE); } return compositePanel; }