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.view.helpers.FolderChildrenVH.java

License:Open Source License

private Button showIcon(final ResourceModel child) {
    Button icon = new Button();
    icon.setStyleName(BaseTheme.BUTTON_LINK);
    LOG.debug(child.getType().toString());
    if (child.getType().toString().equals(ResourceType.CONTAINER.toString())) {
        icon.setDescription("Container");
        icon.setIcon(new ThemeResource("images/Container.png"));
    } else {/*from w ww.ja  v a2 s.  c om*/
        icon.setDescription("Item");
        icon.setIcon(new ThemeResource("images/Item.png"));
    }

    return icon;
}

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

License:Open Source License

private Button showEdit(final ResourceModel child) {
    Button edit = new Button();
    edit.setStyleName(BaseTheme.BUTTON_LINK);
    edit.setDescription("Edit");
    edit.setIcon(new ThemeResource("images/wpzoom/pencil.png"));
    edit.addListener(new Button.ClickListener() {
        @Override// w w w  .j  av  a 2  s .c  o  m
        public void buttonClick(ClickEvent event) {
            folderController.getRouter().getMainWindow().showNotification(
                    "Not yet Implemented " + child.getId(), Notification.TYPE_HUMANIZED_MESSAGE);

        }
    });
    return edit;
}

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

License:Open Source License

private Button showDelete(final ResourceModel child) {
    Button edit = new Button();
    edit.setStyleName(BaseTheme.BUTTON_LINK);
    edit.setDescription(ViewConstants.PROPERTY_DELETE);
    edit.setIcon(new ThemeResource("images/wpzoom/trash.png"));
    edit.addListener(new Button.ClickListener() {
        @Override/*ww  w  . j  a v a 2s .  co  m*/
        public void buttonClick(ClickEvent event) {
            folderController.getRouter().getMainWindow().showNotification(
                    "Not yet Implemented " + child.getId(), Notification.TYPE_HUMANIZED_MESSAGE);

        }
    });
    return edit;
}

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

License:Open Source License

private Button showShare(final ResourceModel child) {
    Button edit = new Button();
    edit.setStyleName(BaseTheme.BUTTON_LINK);
    edit.setDescription(ViewConstants.PROPERTY_SHARE);
    edit.setIcon(new ThemeResource("images/wpzoom/share.png"));
    edit.addListener(new Button.ClickListener() {
        @Override//from  www .j av  a2  s.com
        public void buttonClick(ClickEvent event) {
            folderController.getRouter().getMainWindow().showNotification(
                    "Not yet Implemented " + child.getId(), Notification.TYPE_HUMANIZED_MESSAGE);

        }
    });
    return edit;
}

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

License:Open Source License

private Button downloadShow(final ResourceModel child) {
    Button edit = new Button();
    edit.setStyleName(BaseTheme.BUTTON_LINK);
    edit.setDescription(ViewConstants.PROPERTY_DOWNLOAD);
    edit.setIcon(new ThemeResource("images/wpzoom/eye.png"));
    edit.addListener(new Button.ClickListener() {
        @Override/*from  w ww.  j  a  v a 2  s.  co m*/
        public void buttonClick(ClickEvent event) {
            folderController.getRouter().getMainWindow().showNotification(
                    "Not yet Implemented " + child.getId(), Notification.TYPE_HUMANIZED_MESSAGE);

        }
    });
    return edit;
}

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

License:Open Source License

private Button createDownloadLink(final Component comp) {
    final Button link = new Button();
    link.setStyleName(BaseTheme.BUTTON_LINK);
    link.setIcon(createEmbeddedImage(comp));
    link.addListener(new Button.ClickListener() {

        private static final long serialVersionUID = 651483473875504715L;

        @Override//from  w w  w  . j a  v  a  2 s . c om
        public void buttonClick(@SuppressWarnings("unused") final ClickEvent event) {
            mainWindow.open(
                    new ExternalResource(serviceLocation.getEscidocUri() + comp.getContent().getXLinkHref(),
                            comp.getProperties().getMimeType()),
                    "_new");
        }
    });
    return link;
}

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

License:Open Source License

@SuppressWarnings("serial")
private Button buildMdUpdateLink(final Window modalWindow) {
    Button mdUpdateLink = new Button(ViewConstants.OPEN_METADATA_IN_EDITOR, new Button.ClickListener() {

        @Override/*w  ww.ja va 2 s . co m*/
        public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {
            closeModalWindow(modalWindow);
            openMetadataEditor();
        }

        private void openMetadataEditor() {
            mainWindow.open(new ExternalResource(buildMdUpdateUri(getAppBaseUri()), "_blank"));
        }

        private String getAppBaseUri() {
            StringBuilder builder = new StringBuilder();
            // @formatter:off
            builder.append(getAppUrl().getProtocol()).append("://").append(getAppUrl().getAuthority());
            // @formatter:on
            return builder.toString();
        }

        private URL getAppUrl() {
            return mainWindow.getApplication().getURL();
        }

        private void closeModalWindow(final Window modalWindow) {
            mainWindow.removeWindow(modalWindow);
        }
    });
    mdUpdateLink.setStyleName(BaseTheme.BUTTON_LINK);
    return mdUpdateLink;
}

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

License:Open Source License

@Override
protected HierarchicalContainer populateContainerTable() {
    // Create new container
    tableContainer = new HierarchicalContainer();
    // Create container property for name
    tableContainer.addContainerProperty(ViewConstants.PROPERTY_NAME, String.class, null);
    tableContainer.addContainerProperty(ViewConstants.PROPERTY_LINK, Button.class, null);

    for (final OrganizationalUnitRef organizationalUnit : organizationalUnits) {
        Item item = tableContainer.addItem(organizationalUnit.getObjid());
        if (item != null) {
            item.getItemProperty(ViewConstants.PROPERTY_NAME).setValue(organizationalUnit.getXLinkTitle());
            final Button openInNewTabLink = new Button("View");
            openInNewTabLink.setStyleName(BaseTheme.BUTTON_LINK);
            openInNewTabLink.addListener(new Button.ClickListener() {

                @Override//from  w  w w . j a va2  s. c  o  m
                public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {
                    try {
                        router.show(new ResourceModel() {
                            @Override
                            public ResourceType getType() {
                                return ResourceType.ORG_UNIT;
                            }

                            @Override
                            public String getName() {
                                return organizationalUnit.getXLinkTitle();
                            }

                            @Override
                            public String getId() {
                                return organizationalUnit.getObjid();
                            }
                        }, true);
                    } catch (EscidocClientException e) {
                        controller.showError(e);
                    }
                }
            });

            item.getItemProperty(ViewConstants.PROPERTY_LINK).setValue(openInNewTabLink);
        }
    }
    table.setColumnWidth(ViewConstants.PROPERTY_LINK, 40);
    return tableContainer;
}

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

License:Open Source License

@Override
protected HierarchicalContainer populateContainerTable() {
    tableContainer = new HierarchicalContainer();
    // Create container property for name
    tableContainer.addContainerProperty(ViewConstants.PROPERTY_NAME, String.class, null);
    tableContainer.addContainerProperty(ViewConstants.PROPERTY_LINK, Button.class, null);

    List<ResourceModel> l = orgUnitProxy.getParentList();
    for (final ResourceModel rm : l) {
        Item item = tableContainer.addItem(rm.getId());

        final Button parentOrgUnitLink = new Button("View");
        parentOrgUnitLink.setStyleName(BaseTheme.BUTTON_LINK);
        parentOrgUnitLink.addListener(new ClickListener() {
            @Override/*from w  w  w. ja  v a 2  s.c  o  m*/
            public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {
                try {
                    router.show(rm, true);
                } catch (EscidocClientException e) {
                    controller.showError(e.getMessage());
                }
            }
        });
        if (item != null) {
            item.getItemProperty(ViewConstants.PROPERTY_NAME).setValue(rm.getName());
            item.getItemProperty(ViewConstants.PROPERTY_LINK).setValue(parentOrgUnitLink);
        }

    }
    table.setColumnWidth(ViewConstants.PROPERTY_LINK, 40);
    return tableContainer;
}

From source file:org.escidoc.browser.ui.view.WikiPageView.java

License:Open Source License

private Button showDelete(final ResourceModel child) {
    Button edit = new Button();
    edit.setStyleName(BaseTheme.BUTTON_LINK);
    edit.setDescription(ViewConstants.PROPERTY_DELETE);
    edit.setIcon(new ThemeResource("images/wpzoom/trash.png"));
    edit.addListener(new Button.ClickListener() {
        @Override//  ww  w.  j av a  2  s.  c o m
        public void buttonClick(ClickEvent event) {
            MessageBox mb = new MessageBox(router.getMainWindow().getWindow(), "Are you sure?",
                    MessageBox.Icon.QUESTION, "Do you really want to continue?",
                    new MessageBox.ButtonConfig(MessageBox.ButtonType.YES, "Yes"),
                    new MessageBox.ButtonConfig(MessageBox.ButtonType.NO, "No"));
            mb.show(new MessageBox.EventListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClicked(ButtonType buttonType) {
                    if (buttonType.equals(MessageBox.ButtonType.YES)) {
                        controller.deleteItem();
                    }
                }
            });

        }
    });
    return edit;
}