Example usage for com.vaadin.ui Window setWidth

List of usage examples for com.vaadin.ui Window setWidth

Introduction

In this page you can find the example usage for com.vaadin.ui Window setWidth.

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:org.aksw.autosparql.tbsl.gui.vaadin.TBSLApplication.java

License:Apache License

private void onShowLearnedQuery() {
    String learnedSPARQLQuery = UserSession.getManager().getLearnedSPARQLQuery();
    VerticalLayout layout = new VerticalLayout();
    final Window w = new Window("Learned SPARQL Query", layout);
    w.setWidth("300px");
    w.setSizeUndefined();//from www. ja  v a2 s  .  co m
    w.setPositionX(200);
    w.setPositionY(100);
    getMainWindow().addWindow(w);
    w.addListener(new Window.CloseListener() {

        @Override
        public void windowClose(CloseEvent e) {
            getMainWindow().removeWindow(w);
        }
    });
    Label queryLabel = new Label(learnedSPARQLQuery, Label.CONTENT_PREFORMATTED);
    queryLabel.setWidth(null);
    layout.addComponent(queryLabel);

    Label nlLabel = new Label(UserSession.getManager().getNLRepresentation(learnedSPARQLQuery));
    layout.addComponent(nlLabel);

}

From source file:org.casbah.ui.IssuedCertificateList.java

License:Open Source License

private void collectKeyCertificateInfo() throws CAProviderException {
    final Window principalWindow = new Window("Specify Certificate Details");
    principalWindow.setPositionX(200);//from www .j  a v  a2 s  .c  o  m
    principalWindow.setPositionY(100);
    principalWindow.setWidth("600px");
    principalWindow.setHeight("500px");
    principalWindow.addListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1L;

        public void windowClose(CloseEvent e) {
            parentApplication.getMainWindow().removeWindow(principalWindow);

        }
    });

    VerticalLayout vl = new VerticalLayout();
    final PrincipalComponent pc = new PrincipalComponent();
    Principal parentPrincipal = new Principal(provider.getCACertificate().getSubjectX500Principal());
    pc.init(new Principal(parentPrincipal, provider.getRuleMap()));
    vl.addComponent(pc);
    HorizontalLayout passLayout = new HorizontalLayout();
    vl.addComponent(passLayout);
    final TextField pass1 = new TextField("Private key/keystore passphrase");
    pass1.setSecret(true);
    final TextField pass2 = new TextField();
    pass2.setSecret(true);
    passLayout.addComponent(pass1);
    passLayout.addComponent(pass2);
    passLayout.setComponentAlignment(pass1, Alignment.BOTTOM_CENTER);
    passLayout.setComponentAlignment(pass2, Alignment.BOTTOM_CENTER);

    final OptionGroup type = new OptionGroup("Bundle Type");
    type.addItem(BundleType.OPENSSL);
    type.addItem(BundleType.PKCS12);
    type.addItem(BundleType.JKS);
    type.setValue(BundleType.OPENSSL);
    vl.addComponent(type);

    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.addComponent(new Button("Create", new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            if (pass1.getValue().equals(pass2.getValue())) {
                try {
                    createKeyCertificatePair(pc.toPrincipal(), (String) pass1.getValue(),
                            (BundleType) type.getValue());
                    parentApplication.getMainWindow().removeWindow(principalWindow);
                } catch (Exception e) {
                    logger.severe(e.getMessage());
                    parentApplication.getMainWindow().showNotification(
                            "An error prevented the correct creation of the key/certificate pair",
                            Notification.TYPE_ERROR_MESSAGE);
                }
            } else {
                parentApplication.getMainWindow().showNotification("Passphrases do not match",
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    }));
    buttonsLayout.addComponent(new Button("Cancel", new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            parentApplication.getMainWindow().removeWindow(principalWindow);
        }
    }));

    vl.addComponent(buttonsLayout);
    principalWindow.setContent(vl);
    parentApplication.getMainWindow().addWindow(principalWindow);
}

From source file:org.casbah.ui.MainCAView.java

License:Open Source License

private void uploadAndSignCsr() throws CAProviderException {
    final Window csrWindow = new Window("Upload CSR");
    csrWindow.setPositionX(200);/*from   w w  w. j  ava  2 s. c o m*/
    csrWindow.setPositionY(100);
    csrWindow.setWidth("800px");
    csrWindow.setHeight("300px");
    csrWindow.addListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1L;

        public void windowClose(CloseEvent e) {
            application.getMainWindow().removeWindow(csrWindow);

        }
    });

    final TextField csrData = new TextField("DER Encoded CSR");
    csrData.setColumns(80);
    csrData.setRows(20);
    csrData.setWordwrap(false);
    csrWindow.addComponent(csrData);
    HorizontalLayout hl = new HorizontalLayout();
    csrWindow.addComponent(hl);
    hl.addComponent(new Button("Cancel", new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            application.getMainWindow().removeWindow(csrWindow);

        }
    }));
    hl.addComponent(new Button("Upload", new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            String csr = (String) csrData.getValue();
            try {
                X509Certificate result = provider.sign(csr);
                showEncodedCertificate(result, result.getSerialNumber().toString(16));

            } catch (CAProviderException cpe) {
                cpe.printStackTrace();
            }
        }
    }));
    csrWindow.setModal(true);
    application.getMainWindow().addWindow(csrWindow);
}

From source file:org.casbah.ui.MainCAView.java

License:Open Source License

private void showEncodedCertificate(X509Certificate cert, String serialNumber) throws CAProviderException {
    final Window certWindow = new Window(serialNumber);
    certWindow.setPositionX(200);//from   w  ww .j  a  va 2s .c  o  m
    certWindow.setPositionY(100);
    certWindow.setWidth("800px");
    certWindow.setHeight("300px");
    certWindow.addListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1L;

        public void windowClose(CloseEvent e) {
            application.getMainWindow().removeWindow(certWindow);

        }
    });
    String certData = CertificateHelper.encodeCertificate(cert, true);
    TextField encodedCert = new TextField("Encoded Certificate", certData);
    encodedCert.setReadOnly(true);
    encodedCert.setColumns(80);
    encodedCert.setRows(certData.split("\n").length);
    encodedCert.setWordwrap(false);
    certWindow.addComponent(encodedCert);
    certWindow.addComponent(new Button("Close", new Button.ClickListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            application.getMainWindow().removeWindow(certWindow);
        }
    }));
    certWindow.setModal(true);
    application.getMainWindow().addWindow(certWindow);

}

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);/* ww  w .  ja  v a 2 s  .c om*/
    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.AddMetaDataFileItemBehaviour.java

License:Open Source License

public void showAddWindow() {
    final Window subwindow = new Window(ViewConstants.ADD_ITEM_S_METADATA);
    subwindow.setWidth("600px");
    subwindow.setModal(true);// w  w  w .  j  a va 2  s . c o m
    receiver = new MetadataFileReceiver();
    // Make uploading start immediately when file is selected
    upload = new Upload("", receiver);
    upload.setImmediate(true);
    upload.setButtonCaption("Select file");

    progressLayout.setSpacing(true);
    progressLayout.setVisible(false);
    progressLayout.addComponent(pi);
    progressLayout.setComponentAlignment(pi, Alignment.MIDDLE_LEFT);

    /**
     * =========== Add needed listener for the upload component: start, progress, finish, success, fail ===========
     */

    upload.addListener(new Upload.StartedListener() {
        @Override
        public void uploadStarted(final StartedEvent event) {
            upload.setVisible(false);
            progressLayout.setVisible(true);
            pi.setValue(Float.valueOf(0f));
            pi.setPollingInterval(500);
            status.setValue("Uploading file \"" + event.getFilename() + "\"");
        }
    });

    upload.addListener(new Upload.SucceededListener() {

        @Override
        public void uploadSucceeded(final SucceededEvent event) {
            // This method gets called when the upload finished successfully
            status.setValue("Uploading file \"" + event.getFilename() + "\" succeeded");
            final String fileContent = receiver.getFileContent();
            final boolean isWellFormed = XmlUtil.isWellFormed(fileContent);
            receiver.setWellFormed(isWellFormed);
            if (isWellFormed) {
                status.setValue(ViewConstants.XML_IS_WELL_FORMED);
                hl.setVisible(true);
                upload.setEnabled(false);
            } else {
                status.setValue(ViewConstants.XML_IS_NOT_WELL_FORMED);
            }
        }
    });

    upload.addListener(new Upload.FailedListener() {
        @Override
        public void uploadFailed(final FailedEvent event) {
            // This method gets called when the upload failed
            status.setValue("Uploading interrupted");
        }
    });

    upload.addListener(new Upload.FinishedListener() {
        @Override
        public void uploadFinished(final FinishedEvent event) {
            // This method gets called always when the upload finished,
            // either succeeding or failing
            progressLayout.setVisible(false);
            upload.setVisible(true);
            upload.setCaption("Select another file");
        }
    });
    mdName = new TextField("Metadata name");
    mdName.setValue("");
    mdName.setImmediate(true);
    mdName.setValidationVisible(false);

    hl = new HorizontalLayout();
    hl.setMargin(true);
    final Button btnAdd = new Button("Save", new Button.ClickListener() {
        Item item;

        private boolean containSpace(final String text) {
            final Pattern pattern = Pattern.compile("\\s");
            final Matcher matcher = pattern.matcher(text);
            return matcher.find();
        }

        @Override
        public void buttonClick(final ClickEvent event) {
            if (mdName.getValue().equals("")) {
                mdName.setComponentError(new UserError("You have to add a name for your MetaData"));
            } else if (containSpace(((String) mdName.getValue()))) {
                mdName.setComponentError(new UserError("The name of MetaData can not contain space"));
            } else {
                mdName.setComponentError(null);

                if (receiver.getFileContent().isEmpty()) {
                    upload.setComponentError(
                            new UserError("Please select a well formed XML file as metadata."));
                } else if (!receiver.isWellFormed()) {
                    upload.setComponentError(new UserError(ViewConstants.XML_IS_NOT_WELL_FORMED));
                } else {
                    final MetadataRecord metadataRecord = new MetadataRecord(mdName.getValue().toString());
                    try {
                        item = repositories.item().findItemById(resourceProxy.getId());
                        metadataRecord.setContent(getMetadataContent());
                        repositories.item().addMetaData(metadataRecord, item);
                        upload.setEnabled(true);
                        subwindow.getParent().removeWindow(subwindow);
                    } catch (final EscidocClientException e) {
                        LOG.error(e.getLocalizedMessage());
                        mdName.setComponentError(new UserError(
                                "Failed to add the new Metadata record" + e.getLocalizedMessage()));
                    } catch (final SAXException e) {
                        LOG.error(e.getLocalizedMessage());
                        mdName.setComponentError(new UserError(
                                "Failed to add the new Metadata record" + e.getLocalizedMessage()));
                    } catch (final IOException e) {
                        LOG.error(e.getLocalizedMessage());
                        mdName.setComponentError(new UserError(
                                "Failed to add the new Metadata record" + e.getLocalizedMessage()));
                    } catch (final ParserConfigurationException e) {
                        LOG.error(e.getLocalizedMessage());
                        mdName.setComponentError(new UserError(
                                "Failed to add the new Metadata record" + e.getLocalizedMessage()));
                    }
                }
            }
        }

    });

    final Button cnclAdd = new Button("Cancel", new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            (subwindow.getParent()).removeWindow(subwindow);
        }
    });

    hl.addComponent(btnAdd);
    hl.addComponent(cnclAdd);
    subwindow.addComponent(mdName);
    subwindow.addComponent(status);
    subwindow.addComponent(upload);
    subwindow.addComponent(progressLayout);
    subwindow.addComponent(hl);
    mainWindow.addWindow(subwindow);

}

From source file:org.escidoc.browser.ui.listeners.AddMetaDataFileItemComponentBehaviour.java

License:Open Source License

public void showAddWindow() {
    final Window subwindow = new Window(ViewConstants.ADD_ITEM_S_METADATA);
    subwindow.setWidth("600px");
    subwindow.setModal(true);// w w w  .  j  a  va2s. co m
    receiver = new MetadataFileReceiver();
    // Make uploading start immediately when file is selected
    upload = new Upload("", receiver);
    upload.setImmediate(true);
    upload.setButtonCaption("Select file");

    progressLayout.setSpacing(true);
    progressLayout.setVisible(false);
    progressLayout.addComponent(pi);
    progressLayout.setComponentAlignment(pi, Alignment.MIDDLE_LEFT);

    /**
     * =========== Add needed listener for the upload component: start, progress, finish, success, fail ===========
     */

    upload.addListener(new Upload.StartedListener() {
        @Override
        public void uploadStarted(final StartedEvent event) {
            upload.setVisible(false);
            progressLayout.setVisible(true);
            pi.setValue(Float.valueOf(0f));
            pi.setPollingInterval(500);
            status.setValue("Uploading file \"" + event.getFilename() + "\"");
        }
    });

    upload.addListener(new Upload.SucceededListener() {

        @Override
        public void uploadSucceeded(final SucceededEvent event) {
            // This method gets called when the upload finished successfully
            status.setValue("Uploading file \"" + event.getFilename() + "\" succeeded");
            final String fileContent = receiver.getFileContent();
            final boolean isWellFormed = XmlUtil.isWellFormed(fileContent);
            receiver.setWellFormed(isWellFormed);
            if (isWellFormed) {
                status.setValue(ViewConstants.XML_IS_WELL_FORMED);
                hl.setVisible(true);
                upload.setEnabled(false);
            } else {
                status.setValue(ViewConstants.XML_IS_NOT_WELL_FORMED);
            }
        }
    });

    upload.addListener(new Upload.FailedListener() {
        @Override
        public void uploadFailed(final FailedEvent event) {
            // This method gets called when the upload failed
            status.setValue("Uploading interrupted");
        }
    });

    upload.addListener(new Upload.FinishedListener() {
        @Override
        public void uploadFinished(final FinishedEvent event) {
            // This method gets called always when the upload finished,
            // either succeeding or failing
            progressLayout.setVisible(false);
            upload.setVisible(true);
            upload.setCaption("Select another file");
        }
    });
    mdName = new TextField("Metadata name");
    mdName.setValue("");
    mdName.setImmediate(true);
    mdName.setValidationVisible(false);

    hl = new HorizontalLayout();
    hl.setMargin(true);
    final Button btnAdd = new Button("Save", new Button.ClickListener() {

        private boolean containSpace(final String text) {
            final Pattern pattern = Pattern.compile("\\s");
            final Matcher matcher = pattern.matcher(text);
            return matcher.find();
        }

        @Override
        public void buttonClick(final ClickEvent event) {
            if (mdName.getValue().equals("")) {
                mdName.setComponentError(new UserError("You have to add a name for your MetaData"));
            } else if (containSpace(((String) mdName.getValue()))) {
                mdName.setComponentError(new UserError("The name of MetaData can not contain space"));
            } else {
                mdName.setComponentError(null);

                if (receiver.getFileContent().isEmpty()) {
                    upload.setComponentError(
                            new UserError("Please select a well formed XML file as metadata."));
                } else if (!receiver.isWellFormed()) {
                    upload.setComponentError(new UserError(ViewConstants.XML_IS_NOT_WELL_FORMED));
                } else {
                    final MetadataRecord metadataRecord = new MetadataRecord(mdName.getValue().toString());
                    try {
                        metadataRecord.setContent(getMetadataContent());

                        MetadataRecords mdRecs = component.getMetadataRecords();
                        if (mdRecs == null) {
                            mdRecs = new MetadataRecords();
                        }
                        mdRecs.add(metadataRecord);
                        component.setMetadataRecords(mdRecs);

                        controller.updateComponent(component, itemProxy.getId());
                        itemComponentMDView.addNewItem(metadataRecord);
                        upload.setEnabled(true);
                        subwindow.getParent().removeWindow(subwindow);
                    }

                    catch (final SAXException e) {
                        LOG.error(e.getLocalizedMessage());
                        mdName.setComponentError(new UserError(
                                "Failed to add the new Metadata record" + e.getLocalizedMessage()));
                    } catch (final IOException e) {
                        LOG.error(e.getLocalizedMessage());
                        mdName.setComponentError(new UserError(
                                "Failed to add the new Metadata record" + e.getLocalizedMessage()));
                    } catch (final ParserConfigurationException e) {
                        LOG.error(e.getLocalizedMessage());
                        mdName.setComponentError(new UserError(
                                "Failed to add the new Metadata record" + e.getLocalizedMessage()));
                    } catch (EscidocClientException e) {
                        LOG.error(e.getLocalizedMessage());
                        mdName.setComponentError(new UserError(
                                "Failed to add the new Metadata record" + e.getLocalizedMessage()));
                    }
                }
            }
        }

    });

    final Button cnclAdd = new Button("Cancel", new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            (subwindow.getParent()).removeWindow(subwindow);
        }
    });

    hl.addComponent(btnAdd);
    hl.addComponent(cnclAdd);
    subwindow.addComponent(mdName);
    subwindow.addComponent(status);
    subwindow.addComponent(upload);
    subwindow.addComponent(progressLayout);
    subwindow.addComponent(hl);
    mainWindow.addWindow(subwindow);

}

From source file:org.escidoc.browser.ui.listeners.ContextAdminDescriptorsClickListener.java

License:Open Source License

@Override
public void buttonClick(ClickEvent event) {
    Window subwindow = new Window(wndname);
    subwindow.setWidth("600px");
    subwindow.setModal(true);/*w w  w . j a va  2s  . c o m*/

    Label msgWindow = new Label(content, Label.CONTENT_RAW);

    subwindow.addComponent(msgWindow);
    if (subwindow.getParent() != null) {
        mainWindow.showNotification("Window is already open");
    } else {
        mainWindow.addWindow(subwindow);
    }
}

From source file:org.escidoc.browser.ui.listeners.EditMetaDataFileItemComponentBehaviour.java

License:Open Source License

public void showWindow() {
    final Window subwindow = new Window(ViewConstants.EDIT_METADATA);
    subwindow.setWidth("600px");
    subwindow.setModal(true);/*from w  w w .  j  a  v a2s  .  com*/
    status = new Label(ViewConstants.EDIT_METADATA_UPLOAD_MESSAGE);

    // Make uploading start immediately when file is selected
    receiver = new MetadataFileReceiver();
    receiver.clearBuffer();

    upload = new Upload("", receiver);
    upload.setImmediate(true);
    upload.setButtonCaption("Select file");
    upload.setEnabled(true);
    progressLayout.setSpacing(true);
    progressLayout.setVisible(false);
    progressLayout.addComponent(progressIndicator);
    progressLayout.setComponentAlignment(progressIndicator, Alignment.MIDDLE_LEFT);

    /**
     * =========== Add needed listener for the upload component: start, progress, finish, success, fail ===========
     */

    upload.addListener(new Upload.StartedListener() {
        @Override
        public void uploadStarted(final StartedEvent event) {
            upload.setVisible(false);
            progressLayout.setVisible(true);
            progressIndicator.setValue(Float.valueOf(0.5f));
            progressIndicator.setPollingInterval(500);
            status.setValue("Uploading file \"" + event.getFilename() + "\"");
        }
    });

    upload.addListener(new Upload.SucceededListener() {
        @Override
        public void uploadSucceeded(final SucceededEvent event) {
            // This method gets called when the upload finished successfully
            status.setValue("Uploading file \"" + event.getFilename() + "\" succeeded");
            if (isValidXml(receiver.getFileContent())) {
                status.setValue(ViewConstants.XML_IS_WELL_FORMED);
                horizontalLayout.setVisible(true);
                upload.setEnabled(false);
            } else {
                status.setValue(ViewConstants.XML_IS_NOT_WELL_FORMED);
                receiver.clearBuffer();
            }
        }
    });

    upload.addListener(new Upload.FailedListener() {
        @Override
        public void uploadFailed(final FailedEvent event) {
            // This method gets called when the upload failed
            status.setValue("Uploading interrupted");
        }
    });

    upload.addListener(new Upload.FinishedListener() {
        @Override
        public void uploadFinished(final FinishedEvent event) {

            progressLayout.setVisible(false);
            upload.setVisible(true);
            upload.setCaption("Select another file");
        }
    });

    final Button btnAdd = new Button("Save", new Button.ClickListener() {
        Item item;

        @Override
        public void buttonClick(final ClickEvent event) {

            metadataRecord.setContent(metadataContent);
            controller.updateMetaDataComponent(metadataRecord, itemProxy, component);
            upload.setEnabled(true);

            subwindow.getParent().removeWindow(subwindow);
        }
    });

    final Button cnclAdd = new Button("Cancel", new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            (subwindow.getParent()).removeWindow(subwindow);
        }
    });
    horizontalLayout = new HorizontalLayout();
    horizontalLayout.setVisible(false);
    horizontalLayout.addComponent(btnAdd);
    horizontalLayout.addComponent(cnclAdd);

    subwindow.addComponent(status);
    subwindow.addComponent(upload);
    subwindow.addComponent(progressLayout);
    subwindow.addComponent(horizontalLayout);
    mainWindow.addWindow(subwindow);
}

From source file:org.escidoc.browser.ui.listeners.MetadataRecBehavour.java

License:Open Source License

@Override
public void buttonClick(final ClickEvent event) {
    final Window subwindow = new Window(ViewConstants.METADATA);
    subwindow.setWidth("600px");
    subwindow.setModal(true);/*from  ww  w  .  j a  v a2  s  .  c  om*/

    final StringBuilder builder = new StringBuilder();
    builder.append(NAME);
    builder.append(metadataRecord.getName());
    builder.append("<br />");
    builder.append(LINK);
    builder.append(metadataRecord.getXLinkTitle());
    final String mtRecinfo = builder.toString();

    final Label msgWindow = new Label(mtRecinfo, Label.CONTENT_RAW);
    final Label msgMetaDataXml = new Label(getContentAsString(metadataRecord.getContent()),
            Label.CONTENT_PREFORMATTED);

    subwindow.addComponent(msgWindow);
    subwindow.addComponent(msgMetaDataXml);
    if (subwindow.getParent() != null) {
        mainWindow.showNotification("Window is already open");
    } else {
        mainWindow.addWindow(subwindow);
    }
}