Example usage for com.vaadin.ui Button setStyleName

List of usage examples for com.vaadin.ui Button setStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Button setStyleName.

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:org.escidoc.browser.ui.navigation.menubar.ItemAddView.java

License:Open Source License

@SuppressWarnings("serial")
private void addMetaData() {
    // Slow down the upload
    receiver.setSlow(true);/* w w  w  .  j  a  va 2s.  c o  m*/

    addForm.addComponent(status);
    addForm.addComponent(upload);
    addForm.addComponent(progressLayout);

    // Make uploading start immediately when file is selected
    upload.setImmediate(true);
    upload.setButtonCaption("Select file");

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

    final Button cancelProcessing = new Button("Cancel");
    cancelProcessing.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            upload.interruptUpload();
        }
    });
    cancelProcessing.setStyleName("small");
    progressLayout.addComponent(cancelProcessing);

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

    upload.addListener(new Upload.StartedListener() {
        @Override
        public void uploadStarted(final StartedEvent event) {
            // This method gets called immediately after upload is started
            upload.setVisible(false);
            progressLayout.setVisible(true);
            progressIndicator.setValue(Float.valueOf(0f));
            progressIndicator.setPollingInterval(500);
            status.setValue("Uploading file \"" + event.getFilename() + "\"");
        }
    });

    upload.addListener(new Upload.ProgressListener() {
        @Override
        public void updateProgress(final long readBytes, final long contentLength) {
            // This method gets called several times during the update
            progressIndicator.setValue(new Float(readBytes / (float) contentLength));
        }

    });

    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 boolean isWellFormed = XmlUtil.isWellFormed(receiver.getFileContent());
            receiver.setWellFormed(isWellFormed);
            if (isWellFormed) {
                status.setValue(ViewConstants.XML_IS_WELL_FORMED);
            } 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");
        }
    });

}

From source file:org.escidoc.browser.ui.tools.BulkTasksView.java

License:Open Source License

private void addResult() {
    final HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setWidth("100%");
    horizontalLayout.setSpacing(true);/*from   ww w .j av a  2  s  . c o  m*/

    textField.setWidth("100%");

    createResourceOptions();

    final Button filterButton = new Button(ViewConstants.FILTER);
    filterButton.setStyleName(Reindeer.BUTTON_SMALL);
    filterButton.addListener(new FilterButtonListener(this, router.getMainWindow(), repositories));

    horizontalLayout.addComponent(resourceOption);
    horizontalLayout.addComponent(createHelpView());
    horizontalLayout.addComponent(textField);
    horizontalLayout.addComponent(filterButton);
    horizontalLayout.setExpandRatio(textField, 1.0f);

    addComponent(horizontalLayout);
}

From source file:org.escidoc.browser.ui.tools.FilterButtonListener.java

License:Open Source License

private void showDeleteView() {
    buttonLayout.setSpacing(true);//from w w  w.  ja va  2  s .c om
    final Button deleteButton = new Button(ViewConstants.DELETE);
    deleteButton.setStyleName(Reindeer.BUTTON_SMALL);
    buttonLayout.addComponent(deleteButton);

    deleteButton.addListener(new BulkDeleteListener(this, repositories, mainWindow, resultDataSource));
}

From source file:org.escidoc.browser.ui.tools.FilterButtonListener.java

License:Open Source License

private void showExportView() {
    buttonLayout.setSpacing(true);/*from  w ww.ja  v  a2  s  . c  o m*/

    final Button exportButton = new Button(ViewConstants.EXPORT);
    exportButton.setStyleName(Reindeer.BUTTON_SMALL);
    buttonLayout.addComponent(exportButton);
    exportButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(@SuppressWarnings("unused") final ClickEvent event) {
            final Set<ResourceModel> selectedResources = getSelectedResources();
            mainWindow.open(new StreamResource(new StreamSource() {

                @Override
                public InputStream getStream() {
                    try {
                        return zip(selectedResources);
                    } catch (final IOException e) {
                        FilterButtonListener.this.bulkTasksView.showErrorMessage(e);
                    } catch (final EscidocClientException e) {
                        FilterButtonListener.this.bulkTasksView.showErrorMessage(e);
                    }
                    return null;
                }

            }, EXPORT_FILENAME, FilterButtonListener.this.bulkTasksView.router.getApp()), "_blank");
        }
    });
}

From source file:org.escidoc.browser.ui.tools.FilterButtonListener.java

License:Open Source License

private void addPurgeButton() {
    final Button purgeButton = new Button(ViewConstants.PURGE);
    purgeButton.setStyleName(Reindeer.BUTTON_SMALL);
    buttonLayout.addComponent(purgeButton);
    purgeButton.addListener(new PurgeButtonListener(this, mainWindow, resultDataSource));
}

From source file:org.escidoc.browser.ui.tools.ImportView.java

License:Open Source License

private void addContent() {
    final Label urlLabel = new Label(ViewConstants.URL);
    final TextField sourceUrlField = new TextField();
    sourceUrlField.setWidth("400px");
    sourceUrlField.setValue(ViewConstants.DEFAULT_CONTENT_MODEL_URI);
    final Button importButton = new Button(ViewConstants.IMPORT);
    importButton.setStyleName(Reindeer.BUTTON_SMALL);
    importButton.addListener(new ImportListener(sourceUrlField));

    final HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);//  ww  w .  j  av  a 2  s  . c  om
    hl.addComponent(urlLabel);
    hl.addComponent(sourceUrlField);
    hl.addComponent(importButton);
    addComponent(hl);
}

From source file:org.escidoc.browser.ui.view.helpers.CloseTabsViewHelper.java

License:Open Source License

private void buildButton() {
    Button btnRemoveTabs = new Button();
    ThemeResource icon = new ThemeResource("images/assets/close.gif");
    btnRemoveTabs.setStyleName(BaseTheme.BUTTON_LINK);
    btnRemoveTabs.addStyleName("closeallTabs");
    btnRemoveTabs.setDescription(ViewConstants.CLOSE_ALL_OPEN_TABS);
    btnRemoveTabs.setIcon(icon);/*from w w  w  .j  a v  a  2  s  . c o  m*/
    btnRemoveTabs.addStyleName(ViewConstants.FLOAT_RIGHT);
    btnRemoveTabs.addListener(this);
    layout.addComponent(btnRemoveTabs);
}

From source file:org.escidoc.browser.ui.view.helpers.CreateResourceLinksVH.java

License:Open Source License

public CreateResourceLinksVH(String url, ResourceProxy resourceProxy,
        AbstractComponentContainer componentContainer, Router router) {
    HorizontalLayout vl = buildInitialElements();

    if (resourceProxy.getType().equals(ResourceType.ITEM)) {
        vl.setStyleName("permanentLinkItem");
    } else {//from  w ww.j  a v  a 2 s.  c om
        vl.setStyleName("permanentLink");
    }
    if (!resourceProxy.getType().equals(ResourceType.CONTEXT)) {

        final Button btnVersionHistory = new Button(" ", new VersionHistoryClickListener(resourceProxy,
                router.getMainWindow(), router.getRepositories()));
        btnVersionHistory.setStyleName(BaseTheme.BUTTON_LINK);
        btnVersionHistory.setDescription("Show Version history in a Pop-up");
        btnVersionHistory.addStyleName("paddingright10");
        btnVersionHistory.setIcon(ICON_HISTORY);
        vl.addComponent(btnVersionHistory);
    }
    try {
        l = new Link("",
                new ExternalResource(
                        url + "?id=" + resourceProxy.getId() + "&type=" + resourceProxy.getType().toString()
                                + "&escidocurl=" + router.getServiceLocation().getEscidocUrl()));
        l.setDescription(ViewConstants.PERMANENT_LINK);
        l.setIcon(new ThemeResource("images/wpzoom/globe-1.png"));
        vl.addComponent(l);

    } catch (MalformedURLException e) {
        componentContainer.getWindow().showNotification(ViewConstants.COULD_NOT_RETRIEVE_APPLICATION_URL);
        LOG.error(ViewConstants.COULD_NOT_RETRIEVE_APPLICATION_URL + e.getLocalizedMessage());
    }
    componentContainer.addComponent(hl);
}

From source file:org.escidoc.browser.ui.view.helpers.CreateResourceLinksVH.java

License:Open Source License

public CreateResourceLinksVH(String url, UserProxy userProxy, AbstractComponentContainer componentContainer,
        Router router, UserAccountController controller) {
    buildInitialElements();// w  ww .j a  v a  2s . com
    // Checking if has access on changing password here as well
    HorizontalLayout hl = buildInitialElements();
    hl.setStyleName("permanentLink");
    final Button btnVersionHistory = new Button(" ", new ChangeUserPassword(userProxy, router, controller));
    btnVersionHistory.setStyleName(BaseTheme.BUTTON_LINK);
    btnVersionHistory.setDescription("Change user password");
    btnVersionHistory.addStyleName("paddingright10");
    btnVersionHistory.setIcon(ICON_KEY);
    hl.addComponent(btnVersionHistory);
    componentContainer.addComponent(hl);
}

From source file:org.escidoc.browser.ui.view.helpers.DirectMember.java

License:Open Source License

@SuppressWarnings("serial")
private CssLayout headerButton() throws EscidocClientException {
    CssLayout cssLayout = new CssLayout();
    cssLayout.addStyleName("v-accordion-item-caption v-caption v-captiontext");
    cssLayout.setWidth("100%");
    cssLayout.setMargin(false);/*from  w ww  . j a v  a 2  s.com*/

    final Label nameofPanel = new Label(ViewConstants.DIRECT_MEMBERS, Label.CONTENT_RAW);
    nameofPanel.setStyleName("accordion v-captiontext");
    nameofPanel.setWidth("70%");
    cssLayout.addComponent(nameofPanel);

    ThemeResource plusIcon = new ThemeResource("images/assets/plus.png");
    if (resourceType == ResourceType.CONTAINER.toString()) {
        resourceProxy = new ContainerProxyImpl(
                router.getRepositories().container().findContainerById(parentId));
        contextId = resourceProxy.getContext().getObjid();
    } else {
        // It has to be a context
        resourceProxy = router.getRepositories().context().findById(parentId);
    }

    final Button addResourceButton = new Button();
    addResourceButton.setStyleName(BaseTheme.BUTTON_LINK);
    addResourceButton.addStyleName("floatright paddingtop3");
    addResourceButton.setWidth("20px");
    addResourceButton.setIcon(plusIcon);
    addResourceButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(@SuppressWarnings("unused") final ClickEvent event) {
            try {
                new ResourceAddViewImpl(resourceProxy, contextId, router).openSubWindow();
            } catch (final EscidocClientException e) {
                mainWindow.showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
            }

        }
    });
    cssLayout.addComponent(nameofPanel);
    cssLayout.addComponent(addResourceButton);
    return cssLayout;
}