Example usage for com.vaadin.ui Button addListener

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

Introduction

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

Prototype

@Override
    public Registration addListener(Component.Listener listener) 

Source Link

Usage

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/*  w w  w .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 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   w  w  w  .  j  a  va  2  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/* w w w.  ja  va2 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.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/*w ww  .j  av  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.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  ww  .j  a v a 2 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// w  ww. j a  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/* w ww  .  j  a  v 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;
}

From source file:org.escidoc.browser.ui.view.WikiPageView.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 w ww .ja  v  a 2s .c  o m*/
        public void buttonClick(ClickEvent event) {
            controller.getRouter().getMainWindow().showNotification("Not yet Implemented " + child.getId(),
                    Notification.TYPE_HUMANIZED_MESSAGE);

        }
    });
    return edit;
}

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

License:Open Source License

private Button showShare(Version version) {
    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   w  w w.j  a va  2s  . c o m
        public void buttonClick(ClickEvent event) {
            controller.getRouter().getMainWindow().showNotification("Not yet Implemented ",
                    Notification.TYPE_HUMANIZED_MESSAGE);

        }
    });
    return edit;
}

From source file:org.escidoc.browser.ui.view.WikiPageView.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//www .j  a v  a2 s. c  om
        public void buttonClick(ClickEvent event) {
            try {
                router.getMainWindow().open(
                        new ExternalResource(buildUri(controller.getMetadata(ViewConstants.WIKIPAGEMD))),
                        "_blank");
            } catch (EscidocClientException e) {
                controller.getRouter().getMainWindow().showNotification(
                        "No content to download! Could it be that this Wiki is empty!?",
                        Notification.TYPE_HUMANIZED_MESSAGE);
            }

        }
    });
    return edit;
}