List of usage examples for com.vaadin.ui Label getValue
public String getValue()
From source file:org.escidoc.browser.ui.maincontent.ContainerView.java
License:Open Source License
private void handleLayoutListeners() { if (hasAccess()) { vlPropertiesLeft.addListener(new LayoutClickListener() { private static final long serialVersionUID = 1L; @Override/*from w w w. j a v a 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() == "com.vaadin.ui.Label") { final Label child = (Label) event.getChildComponent(); if ((child.getDescription() == ViewConstants.DESC_STATUS) && (!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 { // // getWindow().showNotification( // // "The click was over a " + // event.getChildComponent().getClass().getCanonicalName() // // + event.getChildComponent().getStyleName()); // } } 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 { updateContainer(""); } } 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(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")) { // do nothing } else { cmbStatus.addItem(PublicStatus.valueOf(pubStatus)); } cmbStatus.select(1); return cmbStatus; } private boolean hasAccessDelResource() { try { return repositories.pdp().forCurrentUser().isAction(ActionIdConstants.DELETE_CONTAINER) .forResource(resourceProxy.getId()).permitted(); } catch (UnsupportedOperationException e) { mainWindow.showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE); e.printStackTrace(); return false; } catch (EscidocClientException e) { mainWindow.showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE); e.printStackTrace(); return false; } catch (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 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."); HorizontalLayout hl = new HorizontalLayout(); Button close = new Button("Update", new Button.ClickListener() { // inline click-listener @Override public void buttonClick(ClickEvent event) { // close the window by removing it from the // parent window updateContainer(editor.getValue().toString()); (subwindow.getParent()).removeWindow(subwindow); } }); Button cancel = new Button("Cancel", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); hl.addComponent(close); hl.addComponent(cancel); subwindow.addComponent(editor); subwindow.addComponent(hl); mainWindow.addWindow(subwindow); } private void updatePublicStatus(Container container, String comment) { // 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(container, repositories.container(), mainWindow); } try { repositories.container().changePublicStatus(container, 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(Container container, String comment) { // Update LockStatus if there is a change if (!resourceProxy.getLockStatus() .equals(lblLockstatus.getValue().toString().replace(lockStatus, ""))) { String lockStatusTxt = lblLockstatus.getValue().toString().replace(lockStatus, "") .toUpperCase(); try { if (lockStatusTxt.contains("LOCKED")) { repositories.container().unlockResource(container, comment); mainWindow.showNotification(new Window.Notification(ViewConstants.LOCKED, Notification.TYPE_TRAY_NOTIFICATION)); } else { repositories.container().lockResource(container, 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 updateContainer(String comment) { LOG.debug("Called the updateContainer"); Container container; try { container = repositories.container().findContainerById(resourceProxy.getId()); if (resourceProxy.getLockStatus().contains("unlocked")) { updatePublicStatus(container, comment); // retrive the container to get the last // modifiaction date. container = repositories.container().findContainerById(resourceProxy.getId()); updateLockStatus(container, comment); } else { updateLockStatus(container, comment); updatePublicStatus(container, comment); } } catch (final EscidocClientException e) { LOG.debug("Infrastructure Exception " + e.getLocalizedMessage()); } } }); } }
From source file:org.escidoc.browser.ui.maincontent.ContextView.java
License:Open Source License
private void handleLayoutListeners() { if (contextController.canUpdateContext()) { headerLayout.addListener(new LayoutClickListener() { @Override/* w w w .ja v a 2 s . co m*/ public void layoutClick(final LayoutClickEvent event) { if (event.getChildComponent() != null) { // Is Label? if (event.getChildComponent().getClass().getCanonicalName() == "com.vaadin.ui.Label") { final Label child = (Label) event.getChildComponent(); if ((child.getDescription() == ViewConstants.RESOURCE_NAME_CONTEXT)) { reSwapComponents(); oldComponent = event.getClickedComponent(); swapComponent = editName(child.getValue().toString() .replace(ViewConstants.RESOURCE_NAME_CONTEXT, ""), ViewConstants.RESOURCE_NAME_CONTEXT); headerLayout.replaceComponent(oldComponent, swapComponent); } } } else { reSwapComponents(); } } private Component editName(String name, String description) { final TextField txtType = new TextField(); txtType.setInvalidAllowed(false); txtType.setValue(name); txtType.setDescription(description); return txtType; } }); vlLeft.addListener(new LayoutClickListener() { private static final long serialVersionUID = 1L; @Override public void layoutClick(final LayoutClickEvent event) { if (event.getChildComponent() != null) { // Is Label? if (event.getChildComponent().getClass().getCanonicalName() == "com.vaadin.ui.Label") { final Label child = (Label) event.getChildComponent(); if ((child.getDescription() == ViewConstants.CONTEXT_TYPE)) { reSwapComponents(); oldComponent = event.getClickedComponent(); swapComponent = editType( child.getValue().toString().replace(ViewConstants.CONTEXT_TYPE, ""), ViewConstants.CONTEXT_TYPE); vlLeft.replaceComponent(oldComponent, swapComponent); } else if ((child.getDescription() == ViewConstants.DESC_STATUS) && (!child.getValue() .equals(resourceProxy.getType().getLabel() + " is closed"))) { reSwapComponents(); oldComponent = event.getClickedComponent(); swapComponent = editStatus(child.getValue().toString() .replace(resourceProxy.getType().getLabel() + " is ", "")); vlLeft.replaceComponent(oldComponent, swapComponent); } } } else { reSwapComponents(); } } private ComboBox cmbStatus; private Component editStatus(final String lockStatus) { cmbStatus = new ComboBox(); cmbStatus.setNullSelectionAllowed(false); if (lockStatus.contains(CREATED)) { cmbStatus.addItem(PublicStatus.OPENED.toString().toLowerCase()); } else { cmbStatus.addItem(PublicStatus.CLOSED.toString().toLowerCase()); } cmbStatus.select(Integer.valueOf(1)); return cmbStatus; } }); } }
From source file:org.escidoc.browser.ui.maincontent.FolderView.java
License:Open Source License
private void handleLayoutListeners() { if (folderController.hasAccess()) { vlLeft.addListener(new LayoutClickListener() { private static final long serialVersionUID = 1L; private Window subwindow; @Override// w w w. j a va2 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() == "com.vaadin.ui.Label") { final Label child = (Label) event.getChildComponent(); if ((child.getDescription() == ViewConstants.DESC_STATUS) && (!lblStatus.getValue().equals(status + "withdrawn"))) { reSwapComponents(); oldComponent = event.getClickedComponent(); swapComponent = editStatus(child.getValue().toString().replace(status, "")); vlLeft.replaceComponent(oldComponent, swapComponent); } else if (child.getDescription() == ViewConstants.DESC_LOCKSTATUS) { reSwapComponents(); oldComponent = event.getClickedComponent(); swapComponent = editLockStatus(child.getValue().toString().replace(status, "")); vlLeft.replaceComponent(oldComponent, swapComponent); } } // else { // // getWindow().showNotification( // // "The click was over a " + // event.getChildComponent().getClass().getCanonicalName() // // + event.getChildComponent().getStyleName()); // } } 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 { updateContainer(""); } } vlLeft.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(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")) { // do nothing } else { cmbStatus.addItem(PublicStatus.valueOf(pubStatus)); } cmbStatus.select(1); return cmbStatus; } private boolean hasAccessDelResource() { try { return repositories.pdp().forCurrentUser().isAction(ActionIdConstants.DELETE_CONTAINER) .forResource(resourceProxy.getId()).permitted(); } catch (UnsupportedOperationException e) { router.getMainWindow().showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE); e.printStackTrace(); return false; } catch (EscidocClientException e) { router.getMainWindow().showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE); e.printStackTrace(); return false; } catch (URISyntaxException e) { router.getMainWindow().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 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."); HorizontalLayout hl = new HorizontalLayout(); Button close = new Button("Update", new Button.ClickListener() { // inline click-listener @Override public void buttonClick(ClickEvent event) { // close the window by removing it from the // parent window updateContainer(editor.getValue().toString()); (subwindow.getParent()).removeWindow(subwindow); } }); Button cancel = new Button("Cancel", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); hl.addComponent(close); hl.addComponent(cancel); subwindow.addComponent(editor); subwindow.addComponent(hl); router.getMainWindow().addWindow(subwindow); } private void updatePublicStatus(Container container, String comment) { // 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(container, repositories.container(), router.getMainWindow()); } try { repositories.container().changePublicStatus(container, lblCurrentVersionStatus.getValue().toString().replace(status, "").toUpperCase(), comment); if (publicStatusTxt.equals("SUBMITTED")) { router.getMainWindow().showNotification(new Window.Notification( ViewConstants.SUBMITTED, Notification.TYPE_TRAY_NOTIFICATION)); } else if (publicStatusTxt.equals("IN_REVISION")) { router.getMainWindow().showNotification(new Window.Notification( ViewConstants.IN_REVISION, Notification.TYPE_TRAY_NOTIFICATION)); } else if (publicStatusTxt.equals("RELEASED")) { router.getMainWindow().showNotification(new Window.Notification( ViewConstants.RELEASED, Notification.TYPE_TRAY_NOTIFICATION)); } else if (publicStatusTxt.equals("WITHDRAWN")) { router.getMainWindow().showNotification(new Window.Notification( ViewConstants.WITHDRAWN, Notification.TYPE_TRAY_NOTIFICATION)); } } catch (EscidocClientException e) { router.getMainWindow().showNotification(new Window.Notification(ViewConstants.ERROR, e.getMessage(), Notification.TYPE_ERROR_MESSAGE)); } } } private void updateContainer(String comment) { LOG.debug("Called the updateContainer"); Container container; try { container = repositories.container().findContainerById(resourceProxy.getId()); if (resourceProxy.getLockStatus().contains("unlocked")) { container = repositories.container().findContainerById(resourceProxy.getId()); updatePublicStatus(container, comment); } else { updatePublicStatus(container, comment); } } catch (final EscidocClientException e) { LOG.debug("Infrastructure Exception " + e.getLocalizedMessage()); } } }); } }
From source file:org.escidoc.browser.ui.maincontent.OrgUnitView.java
License:Open Source License
private void handleLayoutListeners() { if (orgUnitController.hasAccess()) { vlLeft.addListener(new LayoutClickListener() { private static final long serialVersionUID = 1L; @Override/* w w w . j a v a2 s .co 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() == "com.vaadin.ui.Label") { final Label child = (Label) event.getChildComponent(); if ((child.getDescription() == ViewConstants.DESC_STATUS)) { reSwapComponents(); oldComponent = event.getClickedComponent(); swapComponent = editStatus(child.getValue().toString().replace(status, "")); vlLeft.replaceComponent(oldComponent, swapComponent); } } // else { // getWindow().showNotification( // "The click was over a " + event.getChildComponent().getClass().getCanonicalName() // + event.getChildComponent().getStyleName()); // } } else { reSwapComponents(); } } 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(PublicStatus.CREATED.toString())) { cmbStatus.setNullSelectionItemId(PublicStatus.CREATED.toString().toUpperCase()); cmbStatus.addItem(PublicStatus.OPENED.toString().toUpperCase()); } else if (publicStatus.equals(PublicStatus.OPENED.toString())) { cmbStatus.setNullSelectionItemId(PublicStatus.OPENED.toString().toUpperCase()); cmbStatus.addItem(PublicStatus.CLOSED.toString().toUpperCase()); } else if (publicStatus.equals(PublicStatus.CLOSED.toString())) { cmbStatus.setNullSelectionItemId(PublicStatus.WITHDRAWN.toString().toUpperCase()); } else { cmbStatus.addItem(PublicStatus.valueOf(pubStatus)); } cmbStatus.select(1); return cmbStatus; } /** * 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().toString().toUpperCase()); if (((ComboBox) swapComponent).getValue().toString().toUpperCase() .equals(PublicStatus.OPENED.toString())) { orgUnitController.openOU(); } if (((ComboBox) swapComponent).getValue().toString().toUpperCase() .equals(PublicStatus.WITHDRAWN.toString())) { orgUnitController.withdrawOU(); } else if (((ComboBox) swapComponent).getValue().toString().toUpperCase() .equals(PublicStatus.CLOSED.toString())) { orgUnitController.closeOU(); } } vlLeft.replaceComponent(swapComponent, oldComponent); swapComponent = null; } } }); } }
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/*w ww .j av a 2 s .co 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.jumpmind.vaadin.ui.sqlexplorer.QueryPanel.java
License:Open Source License
protected boolean execute(final boolean runAsScript, String sqlText, final int tabPosition, final boolean forceNewTab) { boolean scheduled = false; if (runnersInProgress == null) { runnersInProgress = new HashSet<SqlRunner>(); }//from www . j a v a 2s . c o m if (sqlText == null) { if (!runAsScript) { sqlText = selectSqlToRun(); } else { sqlText = sqlArea.getValue(); } sqlText = sqlText != null ? sqlText.trim() : null; } if (StringUtils.isNotBlank(sqlText)) { final HorizontalLayout executingLayout = new HorizontalLayout(); executingLayout.setMargin(true); executingLayout.setSizeFull(); final Label label = new Label("Executing:\n\n" + StringUtils.abbreviate(sqlText, 250), ContentMode.PREFORMATTED); label.setEnabled(false); executingLayout.addComponent(label); executingLayout.setComponentAlignment(label, Alignment.TOP_LEFT); final String sql = sqlText; final Tab executingTab; if (!forceNewTab && generalResultsTab != null) { replaceGeneralResultsWith(executingLayout, FontAwesome.SPINNER); executingTab = null; } else { executingTab = resultsTabs.addTab(executingLayout, StringUtils.abbreviate(sql, 20), FontAwesome.SPINNER, tabPosition); } if (executingTab != null) { executingTab.setClosable(true); resultsTabs.setSelectedTab(executingTab); } final SqlRunner runner = new SqlRunner(sql, runAsScript, user, db, settingsProvider.get(), this, generalResultsTab != null); runnersInProgress.add(runner); runner.setConnection(connection); runner.setListener(new SqlRunner.ISqlRunnerListener() { private static final long serialVersionUID = 1L; @Override public void writeSql(String sql) { QueryPanel.this.appendSql(sql); } @Override public void reExecute(String sql) { QueryPanel.this.reExecute(sql); } public void finished(final FontAwesome icon, final List<Component> results, final long executionTimeInMs, final boolean transactionStarted, final boolean transactionEnded) { VaadinSession.getCurrent().access(new Runnable() { @Override public void run() { try { if (transactionEnded) { transactionEnded(); } else if (transactionStarted) { rollbackButtonValue = true; commitButtonValue = true; setButtonsEnabled(); sqlArea.setStyleName("transaction-in-progress"); connection = runner.getConnection(); } addToSqlHistory(StringUtils.abbreviate(sql, 1024 * 8), runner.getStartTime(), executionTimeInMs, user); for (Component resultComponent : results) { resultComponent.setSizeFull(); if (forceNewTab || generalResultsTab == null || results.size() > 1) { if (resultComponent instanceof TabularResultLayout) { resultComponent = ((TabularResultLayout) resultComponent) .refreshWithoutSaveButton(); } addResultsTab(resultComponent, StringUtils.abbreviate(sql, 20), icon, tabPosition); } else { replaceGeneralResultsWith(resultComponent, icon); resultsTabs.setSelectedTab(generalResultsTab.getComponent()); } String statusVal; if (canceled) { statusVal = "Sql canceled after " + executionTimeInMs + " ms for " + db.getName() + ". Finished at " + SimpleDateFormat.getTimeInstance().format(new Date()); } else { statusVal = "Sql executed in " + executionTimeInMs + " ms for " + db.getName() + ". Finished at " + SimpleDateFormat.getTimeInstance().format(new Date()); } status.setValue(statusVal); resultStatuses.put(resultComponent, statusVal); canceled = false; } } finally { setButtonsEnabled(); if (executingTab != null) { resultsTabs.removeTab(executingTab); } else if (results.size() > 1) { resetGeneralResultsTab(); } runnersInProgress.remove(runner); runner.setListener(null); } } }); } }); final Button cancel = new Button("Cancel"); cancel.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { log.info("Canceling sql: " + sql); label.setValue("Canceling" + label.getValue().substring(9)); executingLayout.removeComponent(cancel); canceled = true; new Thread(new Runnable() { @Override public void run() { runner.cancel(); } }).start(); } }); executingLayout.addComponent(cancel); scheduled = true; runner.start(); } setButtonsEnabled(); return scheduled; }
From source file:org.ripla.web.controllers.RiplaBody.java
License:Open Source License
/** * We have to clone the separator label defined in the skin. * /*from w w w .j a v a 2s .co m*/ * @param inSeparator * Label * @return {@link Label} the cloned label */ private Label getSeparator(final Label inSeparator) { final Label out = new Label(inSeparator.getValue().toString(), inSeparator.getContentMode()); out.setWidth(inSeparator.getWidth(), inSeparator.getWidthUnits()); out.setStyleName(inSeparator.getStyleName()); return out; }
From source file:org.semanticsoft.vaaclipse.p2.install.ui.impl.LicenseView.java
License:Open Source License
@Override public void initUI() { // TODO Auto-generated method stub errorLayout.setHeight("30px"); mainLayout.addComponent(errorLayout); horizontalSplitPanel.setWidth("600px"); horizontalSplitPanel.setHeight("380px"); leftLayout.addComponent(treeRepo);/* ww w .jav a2 s . co m*/ horizontalSplitPanel.setFirstComponent(leftLayout); horizontalSplitPanel.setSecondComponent(rightLayout); leftLayout.setSizeFull(); rightLayout.setSizeFull(); checkBox = new CheckBox("I agree"); checkBox.setValue(false); mainLayout.addComponent(horizontalSplitPanel); mainLayout.addComponent(checkBox); treeRepo.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { // TODO Auto-generated method stub Object itemId = event.getItemId(); rightLayout.removeAllComponents(); for (IInstallableUnit inst : listReos) { if (inst.getId().equals(itemId)) { Label c = new Label(); Collection<ILicense> licenses = inst.getLicenses(); c.setValue(""); for (ILicense iLicense : licenses) { c.setValue(c.getValue() + iLicense.getBody()); } rightLayout.addComponent(c); } } } }); }
From source file:probe.com.view.body.quantdatasetsoverview.quantproteinstabsheet.studies.PeptidesComparisonsSequenceLayout.java
/** * * @param cp//from w ww . j ava 2 s . c o m * @param width * @param Quant_Central_Manager */ public PeptidesComparisonsSequenceLayout(QuantCentralManager Quant_Central_Manager, final DiseaseGroupsComparisonsProteinLayout cp, int width) { this.studiesMap = new LinkedHashMap<String, StudyInfoData>(); this.setColumns(4); this.setRows(3); this.setWidthUndefined(); this.setSpacing(true); this.setMargin(new MarginInfo(true, false, false, false)); comparisonTitle = new Label(); comparisonTitle.setContentMode(ContentMode.HTML); comparisonTitle.setStyleName("custChartLabelHeader"); comparisonTitle.setWidth((width - 55) + "px"); this.addComponent(comparisonTitle, 1, 0); this.setComponentAlignment(comparisonTitle, Alignment.TOP_LEFT); closeBtn = new VerticalLayout(); closeBtn.setWidth("20px"); closeBtn.setHeight("20px"); closeBtn.setStyleName("closebtn"); this.addComponent(closeBtn, 2, 0); this.setComponentAlignment(closeBtn, Alignment.TOP_RIGHT); //end of toplayout //init comparison study layout GridLayout proteinSequenceComparisonsContainer = new GridLayout(2, cp.getComparison().getDatasetIndexes().length); proteinSequenceComparisonsContainer.setWidthUndefined(); proteinSequenceComparisonsContainer.setHeightUndefined(); proteinSequenceComparisonsContainer.setStyleName(Reindeer.LAYOUT_WHITE); proteinSequenceComparisonsContainer.setSpacing(true); proteinSequenceComparisonsContainer.setMargin(new MarginInfo(true, false, false, false)); this.addComponent(proteinSequenceComparisonsContainer, 1, 1); coverageWidth = (width - 100 - 180); Map<Integer, Set<QuantPeptide>> dsQuantPepMap = new HashMap<Integer, Set<QuantPeptide>>(); for (QuantPeptide quantPep : cp.getQuantPeptidesList()) { if (!dsQuantPepMap.containsKey(quantPep.getDsKey())) { Set<QuantPeptide> subList = new HashSet<QuantPeptide>(); dsQuantPepMap.put(quantPep.getDsKey(), subList); } Set<QuantPeptide> subList = dsQuantPepMap.get(quantPep.getDsKey()); subList.add(quantPep); dsQuantPepMap.put(quantPep.getDsKey(), subList); } int numb = 0; int panelWidth = Page.getCurrent().getBrowserWindowWidth() - 100; String groupCompTitle = cp.getComparison().getComparisonHeader(); String updatedHeader = groupCompTitle.split(" / ")[0].split("\n")[0] + " / " + groupCompTitle.split(" / ")[1].split("\n")[0];//+ " ( " + groupCompTitle.split(" / ")[1].split("\n")[1] + " )"; ; final StudyInformationPopupComponent studyInformationPopupPanel = new StudyInformationPopupComponent( panelWidth, cp.getProtName(), cp.getUrl(), cp.getComparison().getComparisonFullName()); studyInformationPopupPanel.setVisible(false); LayoutEvents.LayoutClickListener studyListener = new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { Integer dsId; if (event.getComponent() instanceof AbsoluteLayout) { dsId = (Integer) ((AbsoluteLayout) event.getComponent()).getData(); } else { dsId = (Integer) ((VerticalLayout) event.getComponent()).getData(); } studyInformationPopupPanel.updateContent(dsToStudyLayoutMap.get(dsId)); } }; TreeSet<QuantProtein> orderSet = new TreeSet<QuantProtein>(cp.getDsQuantProteinsMap().values()); for (QuantProtein quantProtein : orderSet) { StudyInfoData exportData = new StudyInfoData(); exportData.setCoverageWidth(coverageWidth); Label studyTitle = new Label();//"Study " + (numb + 1)); studyTitle.setStyleName("peptideslayoutlabel"); studyTitle.setHeightUndefined(); studyTitle.setWidth("200px"); Label iconTitle = new Label("#Patients (" + (quantProtein.getPatientsGroupIINumber() + quantProtein.getPatientsGroupINumber()) + ")"); exportData.setSubTitle(iconTitle.getValue()); iconTitle.setStyleName("peptideslayoutlabel"); iconTitle.setHeightUndefined(); if (quantProtein.getStringPValue().equalsIgnoreCase("Not Significant") || quantProtein.getStringFCValue().equalsIgnoreCase("Not regulated")) { iconTitle.setStyleName("notregicon"); exportData.setTrend(0); } else if (quantProtein.getStringFCValue().equalsIgnoreCase("Decreased")) { iconTitle.setStyleName("downarricon"); exportData.setTrend(-1); } else { exportData.setTrend(1); iconTitle.setStyleName("uparricon"); } iconTitle.setDescription(cp.getProteinAccssionNumber() + " : #Patients (" + (quantProtein.getPatientsGroupIINumber() + quantProtein.getPatientsGroupINumber()) + ") " + quantProtein.getStringFCValue() + " " + quantProtein.getStringPValue() + ""); VerticalLayout labelContainer = new VerticalLayout(); labelContainer.addComponent(studyTitle); labelContainer.addComponent(iconTitle); proteinSequenceComparisonsContainer.addComponent(labelContainer, 0, numb); proteinSequenceComparisonsContainer.setComponentAlignment(labelContainer, Alignment.TOP_CENTER); Map<Integer, ComparisonDetailsBean> patientGroupsNumToDsIdMap = new HashMap<Integer, ComparisonDetailsBean>(); ComparisonDetailsBean pGr = new ComparisonDetailsBean(); patientGroupsNumToDsIdMap .put((quantProtein.getPatientsGroupIINumber() + quantProtein.getPatientsGroupINumber()), pGr); QuantDatasetObject ds; ds = Quant_Central_Manager.getFullQuantDatasetMap().get(quantProtein.getDsKey()); StudyPopupLayout study = new StudyPopupLayout(panelWidth, quantProtein, ds, cp.getProteinAccssionNumber(), cp.getUrl(), cp.getProtName(), Quant_Central_Manager.getDiseaseHashedColorMap()); Set<QuantDatasetObject> qdsSet = new HashSet<QuantDatasetObject>(); qdsSet.add(ds); study.setInformationData(qdsSet, cp); dsToStudyLayoutMap.put(ds.getDsKey(), study); labelContainer.addLayoutClickListener(studyListener); labelContainer.setData(ds.getDsKey()); studyTitle.setValue("[" + (numb + 1) + "] " + ds.getAuthor()); exportData.setTitle(ds.getAuthor()); if (dsQuantPepMap.get(quantProtein.getDsKey()) == null) { Label noPeptidesInfoLabel = new Label("No Peptide Information Available "); noPeptidesInfoLabel.setHeightUndefined(); noPeptidesInfoLabel.setStyleName("peptideslayoutlabel"); VerticalLayout labelValueContainer = new VerticalLayout(); labelValueContainer.addComponent(noPeptidesInfoLabel); labelValueContainer.addLayoutClickListener(studyListener); labelValueContainer.setData(ds.getDsKey()); proteinSequenceComparisonsContainer.addComponent(labelValueContainer, 1, numb); proteinSequenceComparisonsContainer.setComponentAlignment(labelValueContainer, Alignment.TOP_CENTER); numb++; studiesMap.put((numb + 1) + ds.getAuthor(), exportData); continue; } String key = "_-_" + quantProtein.getDsKey() + "_-_" + cp.getProteinAccssionNumber() + "_-_"; PeptidesInformationOverviewLayout peptideInfoLayout = new PeptidesInformationOverviewLayout( cp.getSequence(), dsQuantPepMap.get(quantProtein.getDsKey()), coverageWidth, true, studyListener, ds.getDsKey()); exportData.setPeptidesInfoList(peptideInfoLayout.getStackedPeptides()); exportData.setLevelsNumber(peptideInfoLayout.getLevel()); hasPTM = peptideInfoLayout.isHasPTM(); peptidesInfoLayoutDSIndexMap.put(key, peptideInfoLayout); proteinSequenceComparisonsContainer.addComponent(peptideInfoLayout, 1, numb); numb++; studiesMap.put((numb + 1) + ds.getAuthor(), exportData); } String rgbColor = Quant_Central_Manager .getDiseaseHashedColor(groupCompTitle.split(" / ")[1].split("\n")[1]); comparisonTitle.setValue("<font color='" + rgbColor + "' style='font-weight: bold;'>" + updatedHeader + " (#Datasets " + numb + "/" + cp.getComparison().getDatasetIndexes().length + ")</font>"); comparisonTitle.setDescription(cp.getComparison().getComparisonFullName()); VerticalLayout bottomSpacer = new VerticalLayout(); bottomSpacer.setWidth((width - 100) + "px"); bottomSpacer.setHeight("10px"); bottomSpacer.setStyleName("dottedline"); this.addComponent(bottomSpacer, 1, 2); }
From source file:views.MetadataUploadView.java
License:Open Source License
protected void createVocabularySelectWindow(ComboBox selected, String propName, List<Label> entries) { Window subWindow = new Window(" " + propName); subWindow.setWidth("300px"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*from ww w . java 2 s .c o m*/ layout.setSpacing(true); // create combobox per unique value for this column to find a mapping to the source vocabulary Map<String, String> entriesToVocabValues = new HashMap<String, String>(); Set<String> uniqueEntries = new HashSet<String>(); // keep these old values in case user chooses different property afterwards List<String> oldEntries = new ArrayList<String>(); ValueChangeListener resetSelectionListener = new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { // reset labels to what they were before for (int i = 0; i < entries.size(); i++) { entries.get(i).setValue(oldEntries.get(i)); } // remove reset listener, it won't be needed until a vocabulary field is selected again selected.removeValueChangeListener(this); } }; selected.addValueChangeListener(resetSelectionListener); List<ComboBox> boxes = new ArrayList<ComboBox>(); Set<String> vocabOptions = propToVocabulary.get(propNameToCode.get(propName)).keySet(); for (Label l : entries) { String val = l.getValue(); oldEntries.add(val); if (!uniqueEntries.contains(val)) { ComboBox b = new ComboBox(val); b.addItems(vocabOptions); b.setNullSelectionAllowed(false); b.setStyleName(Styles.boxTheme); b.setFilteringMode(FilteringMode.CONTAINS); layout.addComponent(b); boxes.add(b); uniqueEntries.add(val); val = StringUtils.capitalize(val); if (vocabOptions.contains(val)) { b.setValue(val); b.setEnabled(false); } } } Button send = new Button("Ok"); send.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { boolean valid = true; for (ComboBox b : boxes) { if (b.getValue() != null) { String newVal = b.getValue().toString(); entriesToVocabValues.put(b.getCaption(), newVal); } else valid = false; } if (valid) { for (Label l : entries) { l.setValue(entriesToVocabValues.get(l.getValue())); } subWindow.close(); // check for collisions now that values have changed reactToTableChange(); } else { String error = "Please select a value for each entry."; Styles.notification("Missing Input", error, NotificationType.DEFAULT); } } }); layout.addComponent(send); subWindow.setContent(layout); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setIcon(FontAwesome.FLASK); subWindow.setResizable(false); ProjectwizardUI ui = (ProjectwizardUI) UI.getCurrent(); ui.addWindow(subWindow); }