Example usage for com.vaadin.ui Embedded addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

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 w  w . j  a  va 2s  .  c  om
                        .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)));
        //?//w ww  .ja  v a 2s  .  c om
        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.business.outproject.AbstractFlowManagerPage.java

License:Apache License

@Override
public HorizontalLayout createSelectHead() {
    HorizontalLayout tableHeadLayout = new HorizontalLayout();
    // tableHeadLayout.setSizeFull();
    tableHeadLayout.setSpacing(true);//from w  ww .j a va2 s. c om
    tableHeadLayout.setMargin(true);
    Resource pictureResource = Images.TASK_LIST;
    Embedded picture = new Embedded(null, pictureResource);
    picture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
    picture.setType(Embedded.TYPE_IMAGE);
    tableHeadLayout.addComponent(picture);
    tableHeadLayout.setComponentAlignment(picture, Alignment.MIDDLE_LEFT);

    Label nameLabel = createTitleLabel();
    nameLabel.addStyleName("taskListLabel");
    // nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
    tableHeadLayout.addComponent(nameLabel);
    tableHeadLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT);
    return tableHeadLayout;
}

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

License:Apache License

@Override
public HorizontalLayout createSelectHead() {
    HorizontalLayout tableHeadLayout = new HorizontalLayout();
    // tableHeadLayout.setSizeFull();
    tableHeadLayout.setSpacing(true);//ww  w. j  a  v  a 2  s.  co m
    tableHeadLayout.setMargin(true);
    Resource pictureResource = Images.TASK_LIST;
    Embedded picture = new Embedded(null, pictureResource);
    picture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
    picture.setType(Embedded.TYPE_IMAGE);
    tableHeadLayout.addComponent(picture);
    tableHeadLayout.setComponentAlignment(picture, Alignment.MIDDLE_LEFT);

    Label nameLabel = null;
    nameLabel = new Label("");
    nameLabel.addStyleName("taskListLabel");
    // nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
    tableHeadLayout.addComponent(nameLabel);
    tableHeadLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT);
    return tableHeadLayout;
}

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

License:Apache License

protected void addTaskEventPicture(final Comment taskEvent, GridLayout eventGrid) {
    final Picture userPicture = identityService.getUserPicture(taskEvent.getUserId());
    Embedded authorPicture = null;

    if (userPicture != null) {
        StreamResource imageresource = new StreamResource(new StreamSource() {
            private static final long serialVersionUID = 1L;

            public InputStream getStream() {
                return userPicture.getInputStream();
            }/*  ww  w. j av  a  2  s . c o  m*/
        }, "event_" + taskEvent.getUserId() + "."
                + Constants.MIMETYPE_EXTENSION_MAPPING.get(userPicture.getMimeType()));
        authorPicture = new Embedded(null, imageresource);
    } else {
        authorPicture = new Embedded(null, Images.USER_50);
    }

    authorPicture.setType(Embedded.TYPE_IMAGE);
    authorPicture.setHeight("48px");
    authorPicture.setWidth("48px");
    authorPicture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
    eventGrid.addComponent(authorPicture);
}

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 w w  w.j  a v a  2s. c  o  m*/

            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 addTaskEventPicture(final org.activiti.engine.task.Event taskEvent, GridLayout eventGrid) {
    final Picture userPicture = identityService.getUserPicture(taskEvent.getUserId());
    Embedded authorPicture = null;

    if (userPicture != null) {
        /*StreamResource imageresource = new StreamResource(new StreamSource() {
          private static final long serialVersionUID = 1L;
          public InputStream getStream() {
            return userPicture.getInputStream();
          }//from www  .  j  av a 2  s. co  m
        }, "event_" + taskEvent.getUserId() + "." + Constants.MIMETYPE_EXTENSION_MAPPING.get(userPicture.getMimeType()), ExplorerApp.get());
        authorPicture = new Embedded(null, imageresource);*/
    } else {
        authorPicture = new Embedded(null, Images.USER_50);
    }

    authorPicture.setType(Embedded.TYPE_IMAGE);
    authorPicture.setHeight("48px");
    authorPicture.setWidth("48px");
    authorPicture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
    eventGrid.addComponent(authorPicture);
}

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 o m*/

    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 www. j  a  v a  2 s .co  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:com.klwork.explorer.ui.user.ProfilePanel.java

License:Apache License

protected void initPicture() {
    StreamResource imageresource = new StreamResource(new StreamSource() {
        private static final long serialVersionUID = 1L;

        public InputStream getStream() {
            return picture.getInputStream();
        }/*from  w  w w.  j a  v  a2s  .c om*/
    }, user.getId());
    imageresource.setCacheTime(0);

    Embedded picture = new Embedded(null, imageresource);
    picture.setType(Embedded.TYPE_IMAGE);
    picture.setHeight(200, UNITS_PIXELS);
    picture.setWidth(200, UNITS_PIXELS);
    picture.addStyleName(ExplorerLayout.STYLE_PROFILE_PICTURE);

    imageLayout.addComponent(picture);
    imageLayout.setWidth(picture.getWidth() + 5, picture.getWidthUnits());

    // Change picture button
    if (isCurrentLoggedInUser) {
        Upload changePictureButton = initChangePictureButton();
        imageLayout.addComponent(changePictureButton);
        imageLayout.setComponentAlignment(changePictureButton, Alignment.MIDDLE_CENTER);
    }
}