List of usage examples for com.vaadin.ui TextField getValue
@Override
public String getValue()
From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadConfirmationWindow.java
License:Open Source License
private void addFileNameLayout(final Item newItem, final String baseSoftwareModuleNameVersion, final String customFileName, final String itemId) { final HorizontalLayout horizontalLayout = new HorizontalLayout(); final TextField fileNameTextField = createTextField( baseSoftwareModuleNameVersion + "/" + customFileName + "/customFileName"); fileNameTextField.setData(baseSoftwareModuleNameVersion + "/" + customFileName); fileNameTextField.setValue(customFileName); newItem.getItemProperty(FILE_NAME).setValue(fileNameTextField.getValue()); final Label warningIconLabel = getWarningLabel(); warningIconLabel.setId(baseSoftwareModuleNameVersion + "/" + customFileName + "/icon"); setWarningIcon(warningIconLabel, fileNameTextField.getValue(), itemId); newItem.getItemProperty(WARNING_ICON).setValue(warningIconLabel); horizontalLayout.addComponent(fileNameTextField); horizontalLayout.setComponentAlignment(fileNameTextField, Alignment.MIDDLE_LEFT); horizontalLayout.addComponent(warningIconLabel); horizontalLayout.setComponentAlignment(warningIconLabel, Alignment.MIDDLE_RIGHT); newItem.getItemProperty(FILE_NAME_LAYOUT).setValue(horizontalLayout); fileNameTextField.addTextChangeListener(event -> onFileNameChange(event, warningIconLabel, newItem)); }
From source file:org.eclipse.skalli.view.component.LinkWindow.java
License:Open Source License
/** * Render the window//from w w w. jav a 2 s .co m */ @SuppressWarnings("serial") private void createContents(String title) { setModal(true); setCaption(title); setWidth("400px"); //$NON-NLS-1$ setHeight("300px"); //$NON-NLS-1$ root = new VerticalLayout(); root.setMargin(true); root.setSpacing(true); final ComboBox cbLinkGroup = new ComboBox("Link Group"); cbLinkGroup.setInputPrompt("Enter a new group name or select from the list"); cbLinkGroup.setWidth("100%"); //$NON-NLS-1$ for (String groupName : knownGroups) { cbLinkGroup.addItem(groupName); } if (oldGroup != null && knownGroups.contains(oldGroup.getCaption())) { cbLinkGroup.select(oldGroup.getCaption()); } cbLinkGroup.setImmediate(true); cbLinkGroup.setNullSelectionAllowed(false); cbLinkGroup.setNewItemsAllowed(true); cbLinkGroup.setNewItemHandler(new NewItemHandler() { @Override public void addNewItem(String newGroupName) { cbLinkGroup.removeAllItems(); for (String groupName : knownGroups) { cbLinkGroup.addItem(groupName); } if (!cbLinkGroup.containsId(newGroupName)) { cbLinkGroup.addItem(newGroupName); } cbLinkGroup.select(newGroupName); } }); cbLinkGroup.setRequired(true); cbLinkGroup.addValidator(new StringValidator()); root.addComponent(cbLinkGroup); final TextField tfLinkCaption = new TextField("Page Title"); tfLinkCaption.setInputPrompt("Enter a descriptive name for the page"); tfLinkCaption.setWidth("100%"); //$NON-NLS-1$ tfLinkCaption.setImmediate(true); tfLinkCaption.setRequired(true); tfLinkCaption.addValidator(new StringValidator()); if (link != null) { tfLinkCaption.setValue(link.getLabel()); } root.addComponent(tfLinkCaption); final TextField tfLinkURL = new TextField("URL"); tfLinkURL.setInputPrompt("e.g. http://www.your-site.domain/path"); tfLinkURL.setWidth("100%"); //$NON-NLS-1$ tfLinkURL.setImmediate(true); tfLinkURL.setRequired(true); tfLinkURL.addValidator(new StringValidator()); tfLinkURL.addValidator(new URLValidator()); if (link != null) { tfLinkURL.setValue(link.getUrl()); } root.addComponent(tfLinkURL); final Button okAndCloseButton = new Button("OK & Close"); okAndCloseButton.setIcon(ICON_BUTTON_OK); okAndCloseButton.setDescription("Performs the action and closes the dialog."); okAndCloseButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { validateInput(cbLinkGroup); validateInput(tfLinkURL); validateInput(tfLinkCaption); if (cbLinkGroup.isValid() && tfLinkURL.isValid() && tfLinkCaption.isValid()) { String groupName = String.valueOf(cbLinkGroup.getValue()); String linkLabel = String.valueOf(tfLinkCaption.getValue()); String linkUrl = String.valueOf(tfLinkURL.getValue()); if (linkAddedHandler != null) { Link link = new Link(linkUrl, linkLabel); linkAddedHandler.onLinkAdded(groupName, link); close(); } if (linkModifiedHandler != null) { boolean linkModified = !link.getLabel().equals(linkLabel) || !link.getUrl().equals(linkUrl); link.setLabel(linkLabel); link.setUrl(linkUrl); linkModifiedHandler.onLinkModified(oldGroup, groupName, link, linkModified); close(); } } } }); root.addComponent(okAndCloseButton); root.setSizeFull(); setContent(root); }
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ReviewComponent.java
License:Open Source License
@SuppressWarnings("serial") private Window createReviewWindow(final ProjectRating rating) { final Window subwindow = new Window("Rate and Review"); subwindow.setModal(true);/*from w ww .j a v a 2 s . c o m*/ subwindow.setWidth("420px"); //$NON-NLS-1$ subwindow.setHeight("320px"); //$NON-NLS-1$ VerticalLayout vl = (VerticalLayout) subwindow.getContent(); vl.setSpacing(true); vl.setSizeFull(); HorizontalLayout hl = new HorizontalLayout(); hl.setSizeUndefined(); Embedded icon = new Embedded(null, getIcon(rating)); Label iconLabel = new Label("<b>" + HSPACE + getReviewComment(rating) + "</b>", Label.CONTENT_XHTML); //$NON-NLS-1$ //$NON-NLS-2$ String captionTextField = getReviewCommentQuestion(rating); hl.addComponent(icon); hl.addComponent(iconLabel); hl.setComponentAlignment(iconLabel, Alignment.MIDDLE_LEFT); vl.addComponent(hl); final TextField editor = new TextField(captionTextField); editor.setRows(3); editor.setColumns(30); editor.setImmediate(true); vl.addComponent(editor); final User user = util.getLoggedInUser(); final ArrayList<String> userSelects = new ArrayList<String>(2); userSelects.add("I want to vote as " + user.getDisplayName()); if (extension.getAllowAnonymous()) { userSelects.add("I want to vote as Anonymous!"); } final OptionGroup userSelect = new OptionGroup(null, userSelects); userSelect.setNullSelectionAllowed(false); userSelect.select(userSelects.get(0)); vl.addComponent(userSelect); CssLayout css = new CssLayout() { @Override protected String getCss(Component c) { return "margin-left:5px;margin-right:5px;margin-top:10px"; //$NON-NLS-1$ } }; Button okButton = new Button("OK"); okButton.setIcon(ICON_BUTTON_OK); okButton.setDescription("Commit changes"); okButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { String comment = (String) editor.getValue(); if (StringUtils.isBlank(comment)) { comment = "No Comment"; } ((Window) subwindow.getParent()).removeWindow(subwindow); String userName = "Anonymous"; if (userSelects.get(0).equals(userSelect.getValue())) { userName = user.getDisplayName(); } ReviewEntry review = new ReviewEntry(rating, comment, userName, System.currentTimeMillis()); extension.addReview(review); util.persist(project); reviews = extension.getReviews(); size = reviews.size(); currentPage = 0; lastPage = size / currentPageLength; paintReviewList(); } }); css.addComponent(okButton); Button cancelButton = new Button("Cancel"); cancelButton.setIcon(ICON_BUTTON_CANCEL); cancelButton.setDescription("Discard changes"); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { ((Window) subwindow.getParent()).removeWindow(subwindow); } }); css.addComponent(cancelButton); vl.addComponent(css); vl.setComponentAlignment(css, Alignment.MIDDLE_CENTER); return subwindow; }
From source file:org.escidoc.browser.ui.listeners.OnContextAdminDescriptor.java
License:Open Source License
@SuppressWarnings("serial") public void adminDescriptorForm() { final Window subwindow = new Window("A modal subwindow"); subwindow.setModal(true);/* w w w .ja va 2 s. c o m*/ subwindow.setWidth("650px"); VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); final TextField txtName = new TextField("Name"); txtName.setImmediate(true); txtName.setValidationVisible(true); final TextArea txtContent = new TextArea("Content"); txtContent.setColumns(30); txtContent.setRows(40); Button addAdmDescButton = new Button("Add Description"); addAdmDescButton.addListener(new ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") ClickEvent event) { if (txtName.getValue().toString() == null) { router.getMainWindow().showNotification(ViewConstants.PLEASE_ENTER_A_NAME, Notification.TYPE_ERROR_MESSAGE); } else if (!XmlUtil.isWellFormed(txtContent.getValue().toString())) { router.getMainWindow().showNotification(ViewConstants.XML_IS_NOT_WELL_FORMED, Notification.TYPE_ERROR_MESSAGE); } else { AdminDescriptor newAdmDesc = controller.addAdminDescriptor(txtName.getValue().toString(), txtContent.getValue().toString()); (subwindow.getParent()).removeWindow(subwindow); router.getMainWindow().showNotification("Addedd Successfully", Notification.TYPE_HUMANIZED_MESSAGE); } } }); subwindow.addComponent(txtName); subwindow.addComponent(txtContent); subwindow.addComponent(addAdmDescButton); Button close = new Button(ViewConstants.CLOSE, new Button.ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); layout.addComponent(close); layout.setComponentAlignment(close, Alignment.TOP_RIGHT); router.getMainWindow().addWindow(subwindow); }
From source file:org.escidoc.browser.ui.listeners.OnContextAdminDescriptor.java
License:Open Source License
/** * Editing since it has a parameter//w w w.j a va2 s . c o m * * @param adminDescriptor */ public void adminDescriptorForm(AdminDescriptor adminDescriptor) { // Editing final Window subwindow = new Window("A modal subwindow"); subwindow.setModal(true); subwindow.setWidth("650px"); VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); final TextField txtName = new TextField("Name"); txtName.setValue(adminDescriptor.getName()); txtName.setImmediate(true); txtName.setValidationVisible(true); final TextArea txtContent = new TextArea("Content"); txtContent.setColumns(30); txtContent.setRows(40); try { txtContent.setValue(adminDescriptor.getContentAsString()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } txtContent.setColumns(30); Button addAdmDescButton = new Button("Add Description"); addAdmDescButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (txtName.getValue().toString() == null) { router.getMainWindow().showNotification(ViewConstants.PLEASE_ENTER_A_NAME, Notification.TYPE_ERROR_MESSAGE); } else if (!XmlUtil.isWellFormed(txtContent.getValue().toString())) { router.getMainWindow().showNotification(ViewConstants.XML_IS_NOT_WELL_FORMED, Notification.TYPE_ERROR_MESSAGE); } else { controller.addAdminDescriptor(txtName.getValue().toString(), txtContent.getValue().toString()); (subwindow.getParent()).removeWindow(subwindow); router.getMainWindow().showNotification("Addedd Successfully", Notification.TYPE_HUMANIZED_MESSAGE); } } }); subwindow.addComponent(txtName); subwindow.addComponent(txtContent); subwindow.addComponent(addAdmDescButton); Button close = new Button(ViewConstants.CLOSE, new Button.ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); layout.addComponent(close); layout.setComponentAlignment(close, Alignment.TOP_RIGHT); router.getMainWindow().addWindow(subwindow); }
From source file:org.escidoc.browser.ui.maincontent.CreateOrgUnitView.java
License:Open Source License
@SuppressWarnings("serial") private void buildForm() { form.setImmediate(true);/* w w w . ja va 2 s . c o m*/ // Name final TextField txtNameContext = new TextField(); txtNameContext.setCaption("Name"); txtNameContext.setImmediate(false); txtNameContext.setWidth("-1px"); txtNameContext.setHeight("-1px"); txtNameContext.setInvalidAllowed(false); txtNameContext.setRequired(true); form.addField("txtNameContext", txtNameContext); // Description final TextField txtDescContext = new TextField("Description"); txtDescContext.setImmediate(false); txtDescContext.setWidth("-1px"); txtDescContext.setHeight("-1px"); form.addField("txtDescContext", txtDescContext); // btnAddContext final Button btnAddContext = new Button("Submit", new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { final OrgUnitModel child = storeInRepository(txtNameContext, txtDescContext); updateTree(child); form.commit(); resetFields(); showSuccesfullMessage(txtNameContext); } catch (final EmptyValueException e) { mainWindow.showNotification("Please fill in all the required elements in the form", Window.Notification.TYPE_TRAY_NOTIFICATION); } catch (final Exception e) { mainWindow.showNotification(ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } finally { closeSubWindow(); } } private void updateTree(final OrgUnitModel child) { dataSource.addChild(parent, child); } private void showSuccesfullMessage(final TextField txtNameContext) { mainWindow.showNotification( "Organizational Unit " + txtNameContext.getValue().toString() + " created successfully ", Window.Notification.TYPE_TRAY_NOTIFICATION); } private void resetFields() { form.getField("txtNameContext").setValue(""); form.getField("txtDescContext").setValue(""); } private void closeSubWindow() { mainWindow.removeWindow(subwindow); } private OrgUnitModel storeInRepository(final TextField txtNameContext, final TextField txtDescContext) throws EscidocClientException, ParserConfigurationException, SAXException, IOException { final OrgUnitBuilder orgBuilder = new OrgUnitBuilder(); OrganizationalUnit orgUnit = orgBuilder .with(txtNameContext.getValue().toString(), txtDescContext.getValue().toString()).build(); if (parent != null) { Set set = new HashSet(); set.add(parent.getId()); orgBuilder.parents(set); } return repo.create(orgUnit); } }); btnAddContext.setWidth("-1px"); btnAddContext.setHeight("-1px"); form.getLayout().addComponent(btnAddContext); form.getField("txtNameContext").setRequired(true); form.getField("txtNameContext").setRequiredError("Name is missing"); form.getField("txtDescContext").setRequired(true); form.getField("txtDescContext").setRequiredError("Description is missing"); }
From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java
License:Open Source License
private Form buildCreateUserAccountForm() { final Form form = new Form(); form.setImmediate(true);//from w ww .j av a 2s.co m // loginName final TextField loginNameField = new TextField("Login Name"); loginNameField.setImmediate(false); loginNameField.setWidth("-1px"); loginNameField.setHeight("-1px"); form.addField("loginName", loginNameField); // Name final TextField realNameField = new TextField(); realNameField.setCaption("Real Name"); realNameField.setImmediate(false); realNameField.setWidth("-1px"); realNameField.setHeight("-1px"); realNameField.setInvalidAllowed(false); realNameField.setRequired(true); form.addField("realName", realNameField); // Password final PasswordField txtPassword = new PasswordField("Password"); txtPassword.setImmediate(false); txtPassword.setNullSettingAllowed(false); txtPassword.setWidth("-1px"); txtPassword.setHeight("-1px"); form.addField("txtPassword", txtPassword); // Verify Password final PasswordField txtPassword2 = new PasswordField("Verify Password"); txtPassword2.setImmediate(false); txtPassword2.setWidth("-1px"); txtPassword2.setHeight("-1px"); form.addField("txtPassword2", txtPassword2); // btnAddContext final Button addButton = new Button("Submit", new Button.ClickListener() { private static final long serialVersionUID = -1373866726572059290L; @Override public void buttonClick(final ClickEvent event) { try { form.commit(); if (!txtPassword.getValue().equals(txtPassword2.getValue())) { router.getMainWindow().showNotification( "Password verification failed, please try again and make sure you are typing the same password twice ", Window.Notification.TYPE_WARNING_MESSAGE); return; } controller.createResourceAddUserAccount(realNameField.getValue().toString(), loginNameField.getValue().toString(), txtPassword.getValue().toString()); router.getMainWindow().showNotification( "User Account" + realNameField.getValue().toString() + " created successfully ", Window.Notification.TYPE_TRAY_NOTIFICATION); form.getField("loginName").setValue(""); form.getField("realName").setValue(""); form.getField("txtPassword").setValue(""); form.getField("txtPassword2").setValue(""); } catch (final EmptyValueException e) { router.getMainWindow().showNotification("Please fill in all the required elements in the form", Window.Notification.TYPE_TRAY_NOTIFICATION); } catch (final Exception e) { router.getMainWindow().showNotification( ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } } }); addButton.setWidth("-1px"); addButton.setHeight("-1px"); form.getLayout().addComponent(addButton); form.getField("loginName").setRequired(true); form.getField("loginName").setRequiredError("Login Name is missing"); form.getField("realName").setRequired(true); form.getField("realName").setRequiredError("Real Name is missing"); return form; }
From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java
License:Open Source License
private Form buildCreateOrgUnitForm() { final Form form = new Form(); form.setImmediate(true);/* ww w . j av a 2 s. c om*/ // Name final TextField txtNameContext = new TextField(); txtNameContext.setCaption("Name"); txtNameContext.setImmediate(false); txtNameContext.setWidth("-1px"); txtNameContext.setHeight("-1px"); txtNameContext.setInvalidAllowed(false); txtNameContext.setRequired(true); form.addField("txtNameContext", txtNameContext); // Description final TextField txtDescContext = new TextField("Description"); txtDescContext.setImmediate(false); txtDescContext.setWidth("-1px"); txtDescContext.setHeight("-1px"); form.addField("txtDescContext", txtDescContext); final CheckBox checkStatusOpened = new CheckBox("Create OrgUnit in Status opened?", true); checkStatusOpened.setImmediate(true); form.addField("checkStatusOpened", checkStatusOpened); // btnAddContext final Button btnAddContext = new Button("Submit", new Button.ClickListener() { private static final long serialVersionUID = -1373866726572059290L; @Override public void buttonClick(final ClickEvent event) { try { form.commit(); controller.createResourceAddOrgUnit(txtNameContext.getValue().toString(), txtDescContext.getValue().toString(), (Boolean) checkStatusOpened.getValue(), router, router.getServiceLocation()); router.getMainWindow().showNotification("Organizational Unit " + txtNameContext.getValue().toString() + " created successfully ", Window.Notification.TYPE_TRAY_NOTIFICATION); form.getField("txtNameContext").setValue(""); form.getField("txtDescContext").setValue(""); } catch (final EmptyValueException e) { router.getMainWindow().showNotification("Please fill in all the required elements in the form", Window.Notification.TYPE_TRAY_NOTIFICATION); } catch (final Exception e) { router.getMainWindow().showNotification( ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } } }); btnAddContext.setWidth("-1px"); btnAddContext.setHeight("-1px"); form.getLayout().addComponent(btnAddContext); form.getField("txtNameContext").setRequired(true); form.getField("txtNameContext").setRequiredError("Name is missing"); form.getField("txtDescContext").setRequired(true); form.getField("txtDescContext").setRequiredError("Description is missing"); return form; }
From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java
License:Open Source License
private void formAddContentModel(final VerticalLayout vlAccCreateContentModel) { final Form frm = new Form(); frm.setImmediate(true);/* w w w .jav a2 s . c o m*/ // Name final TextField txtNameContext = new TextField(); txtNameContext.setCaption("Name"); txtNameContext.setImmediate(false); txtNameContext.setWidth("-1px"); txtNameContext.setHeight("-1px"); txtNameContext.setInvalidAllowed(false); txtNameContext.setRequired(true); frm.addField("txtNameContext", txtNameContext); // Description final TextField txtDescContext = new TextField("Description"); txtDescContext.setImmediate(false); txtDescContext.setWidth("-1px"); txtDescContext.setHeight("-1px"); frm.addField("txtDescContext", txtDescContext); // btnAddContext final Button btnAddContext = new Button("Submit", new Button.ClickListener() { private static final long serialVersionUID = -6461338505705399082L; @Override public void buttonClick(final ClickEvent event) { try { frm.commit(); controller.createResourceAddContentModel(txtNameContext.getValue().toString(), txtDescContext.getValue().toString(), router, router.getServiceLocation()); router.getMainWindow().showNotification( "ContentModel " + txtNameContext.getValue().toString() + " created successfully ", Window.Notification.TYPE_TRAY_NOTIFICATION); frm.getField("txtNameContext").setValue(""); frm.getField("txtDescContext").setValue(""); } catch (final EmptyValueException e) { router.getMainWindow().showNotification("Please fill in all the required elements in the form", Window.Notification.TYPE_TRAY_NOTIFICATION); } catch (final EscidocClientException e) { router.getMainWindow().showNotification( ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } } }); btnAddContext.setWidth("-1px"); btnAddContext.setHeight("-1px"); frm.getLayout().addComponent(btnAddContext); frm.getField("txtNameContext").setRequired(true); frm.getField("txtNameContext").setRequiredError("Name is missing"); frm.getField("txtDescContext").setRequired(true); frm.getField("txtDescContext").setRequiredError("Description is missing"); vlAccCreateContentModel.addComponent(frm); }
From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java
License:Open Source License
private void formAddContext(final VerticalLayout vlAccCreateContext) throws EscidocClientException { final Form frm = new Form(); frm.setImmediate(true);//from w w w . j a v a 2s .c om // Name final TextField txtNameContext = new TextField(); txtNameContext.setCaption("Name"); txtNameContext.setImmediate(false); txtNameContext.setWidth("-1px"); txtNameContext.setHeight("-1px"); txtNameContext.setInvalidAllowed(false); txtNameContext.setRequired(true); frm.addField("txtNameContext", txtNameContext); // Description final TextField txtDescContext = new TextField("Description"); txtDescContext.setImmediate(false); txtDescContext.setWidth("-1px"); txtDescContext.setHeight("-1px"); frm.addField("txtDescContext", txtDescContext); // Description final TextField txtType = new TextField("Type"); txtType.setImmediate(false); txtType.setWidth("-1px"); txtType.setHeight("-1px"); frm.addField("txtType", txtType); // OrgUnit final NativeSelect slOrgUnit = new NativeSelect("Organizational Unit"); slOrgUnit.setImmediate(true); slOrgUnit.setWidth("-1px"); slOrgUnit.setHeight("-1px"); slOrgUnit.setRequired(true); slOrgUnit.setNullSelectionAllowed(false); frm.addField("slOrgUnit", slOrgUnit); final OrgUnitService orgUnitService = new OrgUnitService(router.getServiceLocation().getEscidocUri(), router.getApp().getCurrentUser().getToken()); final Collection<OrganizationalUnit> orgUnits = orgUnitService.findAll(); for (final OrganizationalUnit organizationalUnit : orgUnits) { slOrgUnit.addItem(organizationalUnit.getObjid()); slOrgUnit.setItemCaption(organizationalUnit.getObjid(), organizationalUnit.getXLinkTitle()); } frm.getLayout().addComponent(slOrgUnit); final CheckBox checkStatusOpened = new CheckBox("Create Context in Status opened?", true); checkStatusOpened.setImmediate(true); frm.addField("checkStatusOpened", checkStatusOpened); // btnAddContext final Button btnAddContext = new Button("Submit", new Button.ClickListener() { private static final long serialVersionUID = -4696167135894721166L; @Override public void buttonClick(final ClickEvent event) { try { frm.commit(); controller.createResourceAddContext(txtNameContext.getValue().toString(), txtDescContext.getValue().toString(), txtType.getValue().toString(), slOrgUnit.getValue().toString(), (Boolean) checkStatusOpened.getValue(), repositories, router.getServiceLocation()); router.getMainWindow().showNotification( "Context " + txtNameContext.getValue().toString() + " created successfully ", Window.Notification.TYPE_TRAY_NOTIFICATION); frm.getField("txtNameContext").setValue(""); frm.getField("txtDescContext").setValue(""); frm.getField("txtType").setValue(""); frm.getField("slOrgUnit").setValue(null); // Ideally here should be a sync method to sync the tree } catch (final EmptyValueException e) { router.getMainWindow().showNotification("Please fill in all the required elements in the form", Window.Notification.TYPE_TRAY_NOTIFICATION); } catch (final EscidocClientException e) { router.getMainWindow().showNotification( ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } } }); btnAddContext.setWidth("-1px"); btnAddContext.setHeight("-1px"); frm.getLayout().addComponent(btnAddContext); frm.getField("txtNameContext").setRequired(true); frm.getField("txtNameContext").setRequiredError("Name is missing"); frm.getField("txtDescContext").setRequired(true); frm.getField("txtDescContext").setRequiredError("Description is missing"); frm.getField("txtType").setRequired(true); frm.getField("txtType").setRequiredError("Context Type is missing"); // frm.getField("slOrgUnit").setRequired(true); frm.getField("slOrgUnit").setRequiredError("Organizazional Unit is required"); vlAccCreateContext.addComponent(frm); }