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:com.klwork.explorer.ui.content.GenericAttachmentRenderer.java

License:Apache License

public Component getOverviewComponent(final Attachment attachment, final RelatedContentComponent parent) {
    Button attachmentLink = new Button(attachment.getName());
    attachmentLink.addStyleName(Reindeer.BUTTON_LINK);

    attachmentLink.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            parent.showAttachmentDetail(attachment);
        }/*from  w ww  . j a  va2s .co  m*/
    });
    return attachmentLink;
}

From source file:com.klwork.explorer.ui.content.url.UrlAttachmentRenderer.java

License:Apache License

public Component getOverviewComponent(final Attachment attachment, final RelatedContentComponent parent) {

    // If the attachment has no description, overview link is link to actual page
    // instead of showing popup with details.
    if (attachment.getDescription() != null && !"".equals(attachment.getDescription())) {
        Button attachmentLink = new Button(attachment.getName());
        attachmentLink.addStyleName(Reindeer.BUTTON_LINK);

        attachmentLink.addListener(new ClickListener() {
            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {
                parent.showAttachmentDetail(attachment);
            }/*from  www  .  j av a  2s  . co  m*/
        });
        return attachmentLink;
    } else {
        return new Link(attachment.getName(), new ExternalResource(attachment.getUrl()));
    }
}

From source file:com.klwork.explorer.ui.task.HistoricTaskDetailPanel.java

License:Apache License

protected void initParentTaskLink() {
    if (historicTask.getParentTaskId() != null) {
        final HistoricTaskInstance parentTask = historyService.createHistoricTaskInstanceQuery()
                .taskId(historicTask.getParentTaskId()).singleResult();

        Button showParentTaskButton = new Button(
                i18nManager.getMessage(Messages.TASK_SUBTASK_OF_PARENT_TASK, parentTask.getName()));
        showParentTaskButton.addStyleName(Reindeer.BUTTON_LINK);
        showParentTaskButton.addListener(new ClickListener() {
            public void buttonClick(ClickEvent event) {
                viewManager.showTaskPage(parentTask.getId());
            }/*w  ww. j a  va2 s  . c  om*/
        });

        centralLayout.addComponent(showParentTaskButton);
    }
}

From source file:com.klwork.explorer.ui.task.HistoricTaskDetailPanel.java

License:Apache License

protected void populateSubTasks(List<HistoricTaskInstance> subTasks) {
    for (final HistoricTaskInstance subTask : subTasks) {
        // icon// w  ww .  ja v  a2s .c  o  m
        Embedded icon = new Embedded(null, Images.TASK_22);
        icon.setWidth(22, UNITS_PIXELS);
        icon.setWidth(22, UNITS_PIXELS);
        subTaskGrid.addComponent(icon);

        // Link to subtask
        Button subTaskLink = new Button(subTask.getName());
        subTaskLink.addStyleName(Reindeer.BUTTON_LINK);
        subTaskLink.addListener(new ClickListener() {
            public void buttonClick(ClickEvent event) {
                ViewToolManager.getMainView().showTaskPage(subTask.getId());
            }
        });
        subTaskGrid.addComponent(subTaskLink);
        subTaskGrid.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT);
    }
}

From source file:com.klwork.explorer.ui.task.NewTaskPopupWindow.java

License:Apache License

protected void initCreateTaskButton() {
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setWidth(100, UNITS_PERCENTAGE);
    form.getFooter().setWidth(100, UNITS_PERCENTAGE);
    form.getFooter().addComponent(buttonLayout);

    Button createButton = new Button(i18nManager.getMessage(Messages.BUTTON_CREATE));
    buttonLayout.addComponent(createButton);
    buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT);

    createButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            handleFormSubmit();/*from   ww  w  . jav a 2  s .co m*/
        }
    });
}

From source file:com.klwork.explorer.ui.task.SubTaskComponent.java

License:Apache License

protected void populateSubTasks(List<HistoricTaskInstance> subTasks) {
    if (subTasks.size() > 0) {
        for (final HistoricTaskInstance subTask : subTasks) {
            // icon
            Embedded icon = null;/*from   ww  w . j  a  va2  s. com*/

            if (subTask.getEndTime() != null) {//?
                icon = new Embedded(null, Images.TASK_FINISHED_22);
            } else {
                icon = new Embedded(null, Images.TASK_22);
            }
            icon.setWidth(22, UNITS_PIXELS);
            icon.setWidth(22, UNITS_PIXELS);
            subTaskLayout.addComponent(icon);

            // Link to subtask
            Button subTaskLink = new Button(subTask.getName());
            subTaskLink.addStyleName(Reindeer.BUTTON_LINK);
            subTaskLink.addListener(new ClickListener() {
                public void buttonClick(ClickEvent event) {
                    //ExplorerApp.get().getViewManager().showTaskPage(subTask.getId());
                }
            });
            subTaskLayout.addComponent(subTaskLink);
            subTaskLayout.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT);

            if (subTask.getEndTime() == null) {
                // Delete icon only appears when task is not finished yet
                Embedded deleteIcon = new Embedded(null, Images.DELETE);
                deleteIcon.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
                deleteIcon.addListener(new DeleteSubTaskClickListener(subTask, this));
                subTaskLayout.addComponent(deleteIcon);
                subTaskLayout.setComponentAlignment(deleteIcon, Alignment.MIDDLE_RIGHT);
            } else {
                // Next line of grid
                subTaskLayout.newLine();
            }
        }
    } else {
        Label noSubTasksLabel = new Label(i18nManager.getMessage(Messages.TASK_NO_SUBTASKS));
        noSubTasksLabel.setSizeUndefined();
        noSubTasksLabel.addStyleName(Reindeer.LABEL_SMALL);
        subTaskLayout.addComponent(noSubTasksLabel);
    }

}

From source file:com.klwork.explorer.ui.task.TaskEventsPanel.java

License:Apache License

protected void addInputField() {
    HorizontalLayout hLayout = new HorizontalLayout();
    hLayout.setSpacing(true);/*w  w w  . jav  a 2s  .co m*/
    hLayout.setWidth(100, Unit.PERCENTAGE);
    pMainContent.addComponent(hLayout);
    //?
    initAddEventInput(hLayout);

    Button addCommentButton = new Button(i18nManager.getMessage(Messages.TASK_ADD_COMMENT));
    hLayout.addComponent(addCommentButton);
    hLayout.setComponentAlignment(addCommentButton, Alignment.MIDDLE_LEFT);
    addCommentButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            addNewComment(commentInputField.getValue().toString());
        }
    });
}

From source file:com.klwork.explorer.ui.user.ChangePasswordPopupWindow.java

License:Apache License

protected void initChangePasswordButton() {
    errorLabel = new Label("&nbsp", Label.CONTENT_XHTML);
    errorLabel.addStyleName(Reindeer.LABEL_SMALL);
    errorLabel.addStyleName(ExplorerLayout.STYLE_LABEL_RED);
    layout.addComponent(errorLabel);//from   w  w w .jav a2s.c  o  m

    Button changePasswordButton = new Button(i18nManager.getMessage(Messages.PASSWORD_CHANGE));
    layout.addComponent(changePasswordButton);
    layout.setComponentAlignment(changePasswordButton, Alignment.MIDDLE_CENTER);

    changePasswordButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            handlePasswordChange();
        }
    });
}

From source file:com.kreative.webportal.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    window = new Window("My Vaadin Application");
    setMainWindow(window);//from  w  ww .ja v  a 2s  . co  m
    Button button = new Button("Click Me");
    button.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            window.addComponent(new Label("Thank you for clicking"));
        }
    });
    window.addComponent(button);
    //

}

From source file:com.liferay.mail.vaadin.Folders.java

License:Open Source License

private Button createComposeButton() {

    Button compose = new NativeButton("Compose new message");
    compose.addListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            Controller.get().getApplication().switchToCompose(new Composer(), null);
        }//from   www .  j a  v  a 2s.  c  o m
    });

    compose.setStyleName("compose");
    compose.setWidth("100%");

    return compose;
}