List of usage examples for com.vaadin.ui VerticalLayout setSizeUndefined
@Override public void setSizeUndefined()
From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java
License:Open Source License
private Accordion buildCreateUserAccount() { // common part: create layout final Accordion add = new Accordion(); add.setImmediate(false);/*from w w w. j a v a 2 s .c o m*/ add.setWidth("100.0%"); add.setHeight("100.0%"); // vlPnlCreateOrgUnit final VerticalLayout layout = new VerticalLayout(); layout.setImmediate(false); layout.setSizeUndefined(); layout.setMargin(false); formAddUser(layout); add.addTab(layout, "Create User Account"); return add; }
From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java
License:Open Source License
private Accordion buildPnlCreateContext() { // common part: create layout final Accordion accCreateContext = new Accordion(); accCreateContext.setImmediate(false); accCreateContext.setWidth("100.0%"); accCreateContext.setHeight("100.0%"); // vlPnlCreateContext final VerticalLayout vlAccCreateContext = new VerticalLayout(); vlAccCreateContext.setImmediate(false); vlAccCreateContext.setMargin(false); vlAccCreateContext.setSpacing(false); vlAccCreateContext.setSizeUndefined(); // AddContext Form try {/* w w w.java2 s .co m*/ formAddContext(vlAccCreateContext); } catch (final EscidocClientException e) { router.getMainWindow().showNotification(ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } accCreateContext.addTab(vlAccCreateContext, "Create Context"); return accCreateContext; }
From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java
License:Open Source License
private Accordion buildCreateContentModel() { // common part: create layout final Accordion accCreateContentModel = new Accordion(); accCreateContentModel.setImmediate(false); accCreateContentModel.setWidth("100.0%"); accCreateContentModel.setHeight("100.0%"); // vlPnlCreate final VerticalLayout vlAccCreate = new VerticalLayout(); vlAccCreate.setImmediate(false);/*www .j a va 2s .c o m*/ vlAccCreate.setMargin(false); vlAccCreate.setSpacing(false); vlAccCreate.setSizeUndefined(); formAddContentModel(vlAccCreate); accCreateContentModel.addTab(vlAccCreate, "Create Content Model"); return accCreateContentModel; }
From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java
License:Open Source License
private Accordion buildPnlCreateOrgUnit() { // common part: create layout final Accordion accCreateOrgUnit = new Accordion(); accCreateOrgUnit.setImmediate(false); accCreateOrgUnit.setWidth("100.0%"); accCreateOrgUnit.setHeight("100.0%"); // vlPnlCreateOrgUnit final VerticalLayout vlAccCreateOrgUnit = new VerticalLayout(); vlAccCreateOrgUnit.setImmediate(false); vlAccCreateOrgUnit.setMargin(false); vlAccCreateOrgUnit.setSpacing(false); vlAccCreateOrgUnit.setSizeUndefined(); formAddOrgUnit(vlAccCreateOrgUnit);/* w w w . j av a2 s. c o m*/ accCreateOrgUnit.addTab(vlAccCreateOrgUnit, "Create Organizational Units"); return accCreateOrgUnit; }
From source file:org.escidoc.browser.ui.view.helpers.DirectMember.java
License:Open Source License
protected void createButtons() throws EscidocClientException { CssLayout cssLayout = headerButton(); panel.addComponent(cssLayout);// w w w. j ava 2 s .c o m panel.setStyleName("directmembers"); panel.setScrollable(true); final VerticalLayout panelLayout = (VerticalLayout) panel.getContent(); panelLayout.setSizeUndefined(); panelLayout.setWidth("100%"); panelLayout.setStyleName(Runo.PANEL_LIGHT); }
From source file:org.escidoc.browser.ui.view.helpers.ItemPropertiesVH.java
License:Open Source License
private void handleLayoutListeners() { if (controller.canUpdateItem()) { vlPropertiesLeft.addListener(new LayoutClickListener() { @Override/*from w w w . java 2 s .c o m*/ public void layoutClick(final LayoutClickEvent event) { // Get the child component which was clicked if (event.getChildComponent() != null) { // Is Label? if (event.getChildComponent().getClass().getCanonicalName().equals("com.vaadin.ui.Label")) { final Label child = (Label) event.getChildComponent(); if ((child.getDescription() == ViewConstants.DESC_STATUS2) && (!lblStatus.getValue().equals(status + "withdrawn"))) { reSwapComponents(); oldComponent = event.getClickedComponent(); swapComponent = editStatus(child.getValue().toString().replace(status, "")); vlPropertiesLeft.replaceComponent(oldComponent, swapComponent); } else if (child.getDescription() == ViewConstants.DESC_LOCKSTATUS) { reSwapComponents(); oldComponent = event.getClickedComponent(); swapComponent = editLockStatus(child.getValue().toString().replace(status, "")); vlPropertiesLeft.replaceComponent(oldComponent, swapComponent); } } } else { reSwapComponents(); } } /** * Switch the component back to the original component (Label) after inline editing */ private void reSwapComponents() { if (swapComponent != null) { if (swapComponent instanceof Label) { ((Label) oldComponent).setValue(((TextArea) swapComponent).getValue()); } else if ((swapComponent instanceof ComboBox) && ((ComboBox) swapComponent).getValue() != null) { ((Label) oldComponent).setValue(status + ((ComboBox) swapComponent).getValue()); // Because there should be no comment-window on // Delete Operation if (!(((ComboBox) swapComponent).getValue().equals("delete"))) { addCommentWindow(); } else { updateItem(""); } } vlPropertiesLeft.replaceComponent(swapComponent, oldComponent); swapComponent = null; } } private Component editLockStatus(final String lockStatus) { final ComboBox cmbLockStatus = new ComboBox(); cmbLockStatus.setNullSelectionAllowed(false); if (lockStatus.contains("unlocked")) { cmbLockStatus.addItem(LockStatus.LOCKED.toString().toLowerCase()); } else { cmbLockStatus.addItem(LockStatus.UNLOCKED.toString().toLowerCase()); } cmbLockStatus.select(Integer.valueOf(1)); return cmbLockStatus; } private Component editStatus(final String publicStatus) { final ComboBox cmbStatus = new ComboBox(); cmbStatus.setInvalidAllowed(false); cmbStatus.setNullSelectionAllowed(false); final String pubStatus = publicStatus.toUpperCase(); if (publicStatus.equals("pending")) { cmbStatus.addItem(PublicStatus.PENDING.toString().toLowerCase()); cmbStatus.addItem(PublicStatus.SUBMITTED.toString().toLowerCase()); cmbStatus.setNullSelectionItemId(PublicStatus.PENDING.toString().toLowerCase()); if (hasAccessDelResource()) { cmbStatus.addItem("delete"); } } else if (publicStatus.equals("submitted")) { cmbStatus.setNullSelectionItemId(PublicStatus.SUBMITTED.toString().toLowerCase()); cmbStatus.addItem(PublicStatus.SUBMITTED.toString().toLowerCase()); cmbStatus.addItem(PublicStatus.IN_REVISION.toString().toLowerCase()); cmbStatus.addItem(PublicStatus.RELEASED.toString().toLowerCase()); } else if (publicStatus.equals("in_revision")) { cmbStatus.setNullSelectionItemId(PublicStatus.IN_REVISION.toString().toLowerCase()); cmbStatus.addItem(PublicStatus.IN_REVISION.toString().toLowerCase()); cmbStatus.addItem(PublicStatus.SUBMITTED.toString().toLowerCase()); } else if (publicStatus.equals("released")) { cmbStatus.setNullSelectionItemId(PublicStatus.RELEASED.toString().toLowerCase()); cmbStatus.addItem(PublicStatus.RELEASED.toString().toLowerCase()); cmbStatus.addItem(PublicStatus.WITHDRAWN.toString().toLowerCase()); } else if (publicStatus.equals("withdrawn")) { lblStatus.setValue("withdrawn"); } else { cmbStatus.addItem(PublicStatus.valueOf(pubStatus)); } cmbStatus.select(Integer.valueOf(1)); return cmbStatus; } private boolean hasAccessDelResource() { try { return repositories.pdp().forCurrentUser().isAction(ActionIdConstants.DELETE_CONTAINER) .forResource(resourceProxy.getId()).permitted(); } catch (final UnsupportedOperationException e) { mainWindow.showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE); e.printStackTrace(); return false; } catch (final EscidocClientException e) { mainWindow.showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE); e.printStackTrace(); return false; } catch (final URISyntaxException e) { mainWindow.showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE); e.printStackTrace(); return false; } } public void addCommentWindow() { subwindow = new Window(ViewConstants.SUBWINDOW_EDIT); subwindow.setModal(true); // Configure the windws layout; by default a VerticalLayout final VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeUndefined(); final TextArea editor = new TextArea("Your Comment"); editor.setRequired(true); editor.setRequiredError("The Field may not be empty."); final HorizontalLayout hl = new HorizontalLayout(); final Button close = new Button("Update", new Button.ClickListener() { private static final long serialVersionUID = 1424933077274899865L; // inline click-listener @Override public void buttonClick(final ClickEvent event) { // close the window by removing it from the // parent window updateItem(editor.getValue().toString()); (subwindow.getParent()).removeWindow(subwindow); } }); final Button cancel = new Button("Cancel", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); hl.addComponent(close); hl.addComponent(cancel); subwindow.addComponent(editor); subwindow.addComponent(hl); mainWindow.addWindow(subwindow); } private void updatePublicStatus(final Item item, final String comment) { Preconditions.checkNotNull(item, "Item is null"); Preconditions.checkNotNull(comment, "Comment is null"); // Update PublicStatus if there is a change if (!resourceProxy.getVersionStatus() .equals(lblCurrentVersionStatus.getValue().toString().replace(status, ""))) { String publicStatusTxt = lblCurrentVersionStatus.getValue().toString().replace(status, "") .toUpperCase(); if (publicStatusTxt.equals("DELETE")) { new ResourceDeleteConfirmation(item, repositories.item(), mainWindow); } try { repositories.item().changePublicStatus(item, lblCurrentVersionStatus.getValue().toString().replace(status, "").toUpperCase(), comment); if (publicStatusTxt.equals("SUBMITTED")) { mainWindow.showNotification(new Window.Notification(ViewConstants.SUBMITTED, Notification.TYPE_TRAY_NOTIFICATION)); } else if (publicStatusTxt.equals("IN_REVISION")) { mainWindow.showNotification(new Window.Notification(ViewConstants.IN_REVISION, Notification.TYPE_TRAY_NOTIFICATION)); } else if (publicStatusTxt.equals("RELEASED")) { mainWindow.showNotification(new Window.Notification(ViewConstants.RELEASED, Notification.TYPE_TRAY_NOTIFICATION)); } else if (publicStatusTxt.equals("WITHDRAWN")) { mainWindow.showNotification(new Window.Notification(ViewConstants.WITHDRAWN, Notification.TYPE_TRAY_NOTIFICATION)); } } catch (EscidocClientException e) { mainWindow.showNotification(new Window.Notification(ViewConstants.ERROR, e.getMessage(), Notification.TYPE_ERROR_MESSAGE)); } } } private void updateLockStatus(final Item item, final String comment) { if (!resourceProxy.getLockStatus() .equals(lblLockstatus.getValue().toString().replace(lockStatus, ""))) { String lockStatusTxt = lblLockstatus.getValue().toString().replace(lockStatus, "") .toUpperCase(); try { if (lockStatusTxt.contains("LOCKED")) { repositories.item().lockResource(item, comment); mainWindow.showNotification(new Window.Notification(ViewConstants.LOCKED, Notification.TYPE_TRAY_NOTIFICATION)); } else { repositories.item().unlockResource(item, comment); mainWindow.showNotification(new Window.Notification(ViewConstants.UNLOCKED, Notification.TYPE_TRAY_NOTIFICATION)); } } catch (EscidocClientException e) { mainWindow.showNotification(new Window.Notification(ViewConstants.ERROR, e.getMessage(), Notification.TYPE_ERROR_MESSAGE)); } } } private void updateItem(final String comment) { Item item; try { item = repositories.item().findItemById(resourceProxy.getId()); if (resourceProxy.getLockStatus().equals("unlocked")) { updatePublicStatus(item, comment); // retrive the container to get the last // modifiaction date. item = repositories.item().findItemById(resourceProxy.getId()); updateLockStatus(item, comment); } else { updateLockStatus(item, comment); updatePublicStatus(item, comment); } } catch (final EscidocClientException e) { LOG.debug("Infrastructure Exception " + e.getLocalizedMessage()); } } }); } }
From source file:org.fatal1t.finbe.ui.views.SimpleLoginView.java
@Autowired public SimpleLoginView(LoginService service, AuthenticationService authenticationService1) { setSizeFull();/* w w w.j a v a 2 s . c o m*/ this.loginService = service; this.authenticationService = authenticationService1; // Create login & registration button and add them to separate component loginButton = new Button("Login"); registerButton = new Button("Register"); buttons = new HorizontalLayout(loginButton, registerButton); // Create the user input field user = new TextField("User:"); user.setWidth("300px"); user.setRequired(true); user.setInputPrompt("Your username (eg. joe@email.com)"); user.setValue("test"); //user.addValidator(new EmailValidator( // "Username must be an email address")); //user.setInvalidAllowed(false); // Create the password input field password = new PasswordField("Password:"); password.setWidth("300px"); //password.addValidator(new PasswordValidator()); password.setRequired(true); password.setValue("123456"); password.setNullRepresentation(""); //add listeners and shortcuts this.loginButton.addClickListener(e -> this.loginButtonClick(e)); this.loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER); this.registerButton.addClickListener(e -> { System.out.println("Pozadavek na registraci"); this.getUI().getNavigator().navigateTo(RegistrationView.NAME); }); // Add both to a panel VerticalLayout fields = new VerticalLayout(user, password, buttons); fields.setCaption("Please login to access the application. (test@test.com/passw0rd)"); fields.setSpacing(true); fields.setMargin(new MarginInfo(true, true, true, true)); fields.setSizeUndefined(); // The view root layout VerticalLayout viewLayout = new VerticalLayout(fields); viewLayout.setSizeFull(); viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER); setCompositionRoot(viewLayout); }
From source file:org.jdal.vaadin.ui.FormUtils.java
License:Apache License
/** * Show a YES/NO confirm dialog// w w w. ja v a 2 s. co m * @param window Window to attach the dialog * @param msg the msg */ public static void showConfirmDialog(UI ui, final Command command, String msg) { final Window dlg = new Window("Please Confirm"); VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); vl.setSpacing(true); vl.setMargin(true); Label label = new Label(msg, Label.CONTENT_XHTML); vl.addComponent(label); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); Button ok = new Button(StaticMessageSource.getMessage("yes")); ok.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { command.execute(null); closeWindow(dlg); } }); Button cancel = new Button(StaticMessageSource.getMessage("no")); cancel.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { closeWindow(dlg); } }); hl.setSpacing(true); hl.addComponent(ok); hl.addComponent(cancel); hl.setSizeFull(); vl.addComponent(hl); vl.setComponentAlignment(hl, Alignment.TOP_CENTER); dlg.setContent(vl); dlg.setModal(true); vl.setSizeUndefined(); ui.addWindow(dlg); }
From source file:org.jdal.vaadin.ui.table.PageableTable.java
License:Apache License
@SuppressWarnings("unchecked") @PostConstruct/*from ww w.jav a2 s .c o m*/ public void init() { // build Component VerticalLayout verticalLayout = getVerticalLayout(); verticalLayout.setSizeUndefined(); verticalLayout.setSpacing(true); // filter if (filterEditor != null && filterForm == null) { filterForm = (VaadinView<Filter>) getGuiFactory().getView(filterEditor); } if (filterForm != null) { if (beanFilter != null) { filterForm.setModel(beanFilter); } else { beanFilter = filterForm.getModel(); } verticalLayout.addComponent((Component) filterForm.getPanel()); } // action group if (getActions().size() > 0) { verticalLayout.addComponent(createButtonBox()); } // table verticalLayout.addComponent(getTable()); verticalLayout.setExpandRatio(getTable(), 1.0f); // paginator if (paginator != null) { paginator.setModel(page); paginator.addPaginatorListener(this); paginator.setNativeButtons(isNativeButtons()); page.setPageableDataSource(getService()); // set external sorting, ie don't call Container.sort() getTable().setSorter(new PageSorter()); Component p = paginator.getPanel(); verticalLayout.addComponent(p); verticalLayout.setComponentAlignment(p, Alignment.MIDDLE_CENTER); getTable().setPageLength(page.getPageSize()); if (beanFilter != null) page.setFilter(beanFilter); // get initial page and wrap data in container paginator.firstPage(); } getTable().addItemClickListener(this); this.setSizeUndefined(); }
From source file:org.jpos.qi.login.LoginView.java
License:Open Source License
private VerticalLayout createMainPanel(Component... components) { VerticalLayout vl = new VerticalLayout(); vl.setSizeUndefined(); vl.addStyleName("login-panel"); addComponent(vl);//w w w. jav a 2 s . com setComponentAlignment(vl, Alignment.MIDDLE_CENTER); for (Component c : components) vl.addComponent(c); return vl; }