Example usage for com.vaadin.ui Embedded addClickListener

List of usage examples for com.vaadin.ui Embedded addClickListener

Introduction

In this page you can find the example usage for com.vaadin.ui Embedded addClickListener.

Prototype

public Registration addClickListener(ClickListener listener) 

Source Link

Document

Add a click listener to the component.

Usage

From source file:com.foc.web.modules.photoAlbum.PhotoAlbum_Reduced_Form.java

License:Apache License

@Override
public void showValidationLayout(boolean showBackButton, int position) {
    super.showValidationLayout(showBackButton, position);

    FVValidationLayout vLay = getValidationLayout();
    if (vLay != null && getFocObject() != null && !getFocObject().isCreated()) {

        if (PhotoAlbumAppGroup.getCurrentAppGroup() != null
                && PhotoAlbumAppGroup.getCurrentAppGroup().isAllowDelete()) {
            Embedded valo_DeleteEmbedded = new Embedded();
            valo_DeleteEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);
            if (FocWebApplication.getInstanceForThread().isMobile()) {
                valo_DeleteEmbedded//from  w  ww. j a  v a2 s  .  c o  m
                        .setSource(FVIconFactory.getInstance().getFVIcon_Big(FVIconFactory.ICON_TRASH_WHITE));
            } else {
                valo_DeleteEmbedded
                        .setSource(FVIconFactory.getInstance().getFVIcon_Big(FVIconFactory.ICON_TRASH_BLACK));
            }
            valo_DeleteEmbedded.addClickListener(new MouseEvents.ClickListener() {
                @Override
                public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
                    deleteButtonClickListener();
                }
            });
            if (valo_DeleteEmbedded != null) {
                vLay.addComponent(valo_DeleteEmbedded);
                vLay.setComponentAlignment(valo_DeleteEmbedded, Alignment.BOTTOM_LEFT);
            }
        }
    }
}

From source file:com.klwork.explorer.ui.business.flow.act.MyTaskRelatedContentComponent.java

License:Apache License

@SuppressWarnings("unchecked")
protected void addAttachmentsToTable(List<Attachment> attachments) {
    for (Attachment attachment : attachments) {
        AttachmentRenderer renderer = attachmentRendererManager.getRenderer(attachment);
        Item attachmentItem = table.addItem(attachment.getId());
        attachmentItem.getItemProperty("name").setValue(renderer.getOverviewComponent(attachment, this));
        attachmentItem.getItemProperty("type").setValue(new Embedded(null, renderer.getImage(attachment)));
        //?//from  w w  w. j  a  va  2s .  c  o  m
        if (!readOnly) {
            Embedded deleteButton = new Embedded(null, Images.DELETE);
            deleteButton.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
            //
            deleteButton.addClickListener((ClickListener) new DeleteClickedListener(attachment));
            //delete
            attachmentItem.getItemProperty("delete").setValue(deleteButton);
        }
    }

    if (table.getItemIds().size() > 0) {
        table.setVisible(true);
    }
    table.setPageLength(table.size());
}

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

License:Apache License

@SuppressWarnings("unchecked")
protected void addAttachmentsToTable(List<Attachment> attachments) {
    for (Attachment attachment : attachments) {
        AttachmentRenderer renderer = attachmentRendererManager.getRenderer(attachment);
        Item attachmentItem = table.addItem(attachment.getId());
        attachmentItem.getItemProperty("name").setValue(renderer.getOverviewComponent(attachment, this));
        attachmentItem.getItemProperty("type").setValue(new Embedded(null, renderer.getImage(attachment)));

        Embedded deleteButton = new Embedded(null, Images.DELETE);
        deleteButton.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
        deleteButton.addClickListener((ClickListener) new DeleteClickedListener(attachment));
        attachmentItem.getItemProperty("delete").setValue(deleteButton);
    }//from   w w  w.j  a  v a2 s.c om

    if (table.getItemIds().size() > 0) {
        table.setVisible(true);
    }
    table.setPageLength(table.size());
}

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

License:Apache License

protected void addUserPicture() {
    Resource pictureResource = Images.USER_32; // default icon
    if (user != null) {
        final Picture userPicture = identityService.getUserPicture(user.getId());
        if (userPicture != null) {
            //WW_TODO ?,
            pictureResource = new StreamResource(new StreamSource() {
                public InputStream getStream() {
                    return userPicture.getInputStream();
                }//from   w w w .  j  a  v  a2s.  c  o m
            }, user.getId());

        }
    }
    Embedded picture = new Embedded(null, pictureResource);

    picture.setType(Embedded.TYPE_IMAGE);
    picture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
    if (user != null) {
        // Only set fixed height and width when user has image, otherwise icon's dimensions will be used
        picture.setHeight("32px");
        picture.setWidth("32px");
    }
    addComponent(picture);

    // Add profile popup listener
    if (user != null) {
        picture.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
        //
        picture.addClickListener(new com.vaadin.event.MouseEvents.ClickListener() {
            public void click(ClickEvent event) {
                // ViewToolManager.showProfilePopup(user.getId());
                ViewToolManager.showPopupWindow(new ProfilePopupWindow(user.getId()));
            }
        });
    }
}

From source file:org.lunifera.examples.kwiee.erp.module.financial.accounting.presentation.web.vaadin.UiModule.java

License:Open Source License

@SuppressWarnings("serial")
@Override/*from  ww w.j a  v a  2s  .c om*/
public Component getTopComponent() {
    if (topComponent == null) {
        topComponent = new CssLayout();
        Embedded action = new Embedded("Accounting", new ThemeResource("../kwiee/money_euro.png"));
        topComponent.addComponent(action);
        action.addClickListener(new MouseEvents.ClickListener() {
            @Override
            public void click(MouseEvents.ClickEvent event) {

            }
        });
    }
    return topComponent;
}