Example usage for com.vaadin.server FontAwesome CHECK

List of usage examples for com.vaadin.server FontAwesome CHECK

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome CHECK.

Prototype

FontAwesome CHECK

To view the source code for com.vaadin.server FontAwesome CHECK.

Click Source Link

Usage

From source file:ch.bfh.ti.soed.hs16.srs.black.view.reservationView.ReservationMakeView.java

License:Open Source License

public ReservationMakeView() {
    fromField = new DateField("Start Date");
    fromField.setLocale(new Locale("de", "DE"));
    fromField.setResolution(Resolution.MINUTE);
    fromField.setDateFormat("dd.MM.yyyy HH:mm");
    fromField.setIcon(FontAwesome.CALENDAR);
    fromField.setWidth(12, Unit.EM);//from ww  w  . j  a va  2 s.com
    toField = new DateField("End Date");
    toField.setLocale(new Locale("de", "DE"));
    toField.setResolution(Resolution.MINUTE);
    toField.setDateFormat("dd.MM.yyyy HH:mm");
    toField.setIcon(FontAwesome.CALENDAR);
    toField.setWidth(12, Unit.EM);
    roomSelect = new NativeSelect("Room Number");
    roomSelect.setIcon(FontAwesome.BED);
    roomSelect.setNullSelectionAllowed(true);
    roomSelect.setImmediate(true);
    makeReservationButton = new Button("Make Reservation", FontAwesome.CHECK);
    makeReservationButton.setWidth(12, Unit.EM);
    logoutButton = new Button("Logout");

    Panel panel = new Panel("Create New Reservation");
    FormLayout content = new FormLayout();
    content.addComponents(fromField, toField, roomSelect, makeReservationButton);
    content.setSizeUndefined();
    content.setMargin(true);
    VerticalLayout formAndLogout = new VerticalLayout(content, logoutButton);
    formAndLogout.setMargin(true);
    panel.setContent(formAndLogout);
    makeViewLayout = new VerticalLayout(panel);
    makeViewLayout.setSizeUndefined();
    makeViewLayout.setMargin(true);
}

From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogEditWindow.java

License:Open Source License

private void initUI() {
    this.setWidth("900px");

    headerPanel = new MHorizontalLayout().withWidth("100%");
    content.addComponent(headerPanel);//from ww w  .j a  va 2  s .  c  o  m
    constructSpentTimeEntryPanel();
    constructRemainTimeEntryPanel();

    this.tableItem = new DefaultPagedBeanTable<>(
            ApplicationContextUtil.getSpringBean(ItemTimeLoggingService.class), SimpleItemTimeLogging.class,
            Arrays.asList(TimeTableFieldDef.logUser, TimeTableFieldDef.logForDate, TimeTableFieldDef.logValue,
                    TimeTableFieldDef.billable,
                    new TableViewField(null, "id", UIConstants.TABLE_CONTROL_WIDTH)));

    this.tableItem.addGeneratedColumn("logUserFullName", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(final Table source, final Object itemId,
                final Object columnId) {
            final SimpleItemTimeLogging timeLoggingItem = TimeLogEditWindow.this.tableItem
                    .getBeanByIndex(itemId);

            return new ProjectUserLink(timeLoggingItem.getLoguser(), timeLoggingItem.getLogUserAvatarId(),
                    timeLoggingItem.getLogUserFullName());

        }
    });

    this.tableItem.addGeneratedColumn("logforday", new ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(final Table source, final Object itemId,
                final Object columnId) {
            final SimpleItemTimeLogging monitorItem = TimeLogEditWindow.this.tableItem.getBeanByIndex(itemId);
            final Label l = new Label();
            l.setValue(AppContext.formatDate(monitorItem.getLogforday()));
            return l;
        }
    });

    this.tableItem.addGeneratedColumn("logvalue", new ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(final Table source, final Object itemId,
                final Object columnId) {
            final SimpleItemTimeLogging itemTimeLogging = TimeLogEditWindow.this.tableItem
                    .getBeanByIndex(itemId);
            final Label l = new Label();
            l.setValue(itemTimeLogging.getLogvalue() + "");
            return l;
        }
    });

    this.tableItem.addGeneratedColumn("isbillable", new ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            final SimpleItemTimeLogging monitorItem = tableItem.getBeanByIndex(itemId);
            FontIconLabel icon;
            if (monitorItem.getIsbillable()) {
                icon = new FontIconLabel(FontAwesome.CHECK);
            } else {
                icon = new FontIconLabel(FontAwesome.TIMES);
            }
            icon.setStyleName(UIConstants.BUTTON_ICON_ONLY);
            return icon;
        }
    });

    this.tableItem.addGeneratedColumn("id", new ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(final Table source, final Object itemId,
                final Object columnId) {
            final SimpleItemTimeLogging itemTimeLogging = TimeLogEditWindow.this.tableItem
                    .getBeanByIndex(itemId);
            final Button deleteBtn = new Button(null, new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    TimeLogEditWindow.this.itemTimeLoggingService.removeWithSession(itemTimeLogging.getId(),
                            AppContext.getUsername(), AppContext.getAccountId());
                    TimeLogEditWindow.this.loadTimeValue();
                }
            });
            deleteBtn.setIcon(FontAwesome.TRASH_O);
            deleteBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY);
            itemTimeLogging.setExtraData(deleteBtn);

            deleteBtn.setEnabled(CurrentProjectVariables.isAdmin()
                    || AppContext.getUsername().equals(itemTimeLogging.getLoguser()));
            return deleteBtn;
        }
    });

    this.tableItem.setWidth("100%");
    content.addComponent(tableItem);
}

From source file:com.esofthead.mycollab.module.project.view.time.TimeTrackingTableDisplay.java

License:Open Source License

public TimeTrackingTableDisplay(List<TableViewField> displayColumns) {
    super(ApplicationContextUtil.getSpringBean(ItemTimeLoggingService.class), SimpleItemTimeLogging.class,
            displayColumns);/*from   ww w .  jav  a 2 s .  co m*/

    this.addGeneratedColumn("logUserFullName", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(final Table source, final Object itemId,
                final Object columnId) {
            final SimpleItemTimeLogging timeItem = TimeTrackingTableDisplay.this.getBeanByIndex(itemId);

            return new ProjectUserLink(timeItem.getLoguser(), timeItem.getLogUserAvatarId(),
                    timeItem.getLogUserFullName());

        }
    });

    this.addGeneratedColumn("summary", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(final Table source, final Object itemId,
                final Object columnId) {
            SimpleItemTimeLogging itemLogging = TimeTrackingTableDisplay.this.getBeanByIndex(itemId);

            try {
                VerticalLayout summaryWrapper = new VerticalLayout();

                String type = itemLogging.getType();

                if (type == null) {
                    return new Label(itemLogging.getNote(), ContentMode.HTML);
                } else {
                    Label timeTrackingLink = new Label(buildItemValue(itemLogging), ContentMode.HTML);
                    timeTrackingLink.addStyleName("link");
                    timeTrackingLink.addStyleName(UIConstants.WORD_WRAP);
                    timeTrackingLink.setWidth("100%");

                    if (ProjectTypeConstants.BUG.equals(type)) {
                        if (BugStatus.Verified.name().equals(itemLogging.getStatus())) {
                            timeTrackingLink.addStyleName(UIConstants.LINK_COMPLETED);
                        } else if (itemLogging.getDueDate() != null
                                && (itemLogging.getDueDate().before(DateTimeUtils.getCurrentDateWithoutMS()))) {
                            timeTrackingLink.addStyleName(UIConstants.LINK_OVERDUE);
                        }
                    } else if (type.equals(ProjectTypeConstants.TASK)) {
                        if (itemLogging.getPercentageComplete() != null
                                && 100d == itemLogging.getPercentageComplete()) {
                            timeTrackingLink.addStyleName(UIConstants.LINK_COMPLETED);
                        } else {
                            if (OptionI18nEnum.StatusI18nEnum.Pending.name().equals(itemLogging.getStatus())) {
                                timeTrackingLink.addStyleName(UIConstants.LINK_PENDING);
                            } else if (itemLogging.getDueDate() != null && (itemLogging.getDueDate()
                                    .before(DateTimeUtils.getCurrentDateWithoutMS()))) {
                                timeTrackingLink.addStyleName(UIConstants.LINK_OVERDUE);
                            }
                        }
                    } else {
                        if (OptionI18nEnum.StatusI18nEnum.Closed.name().equals(itemLogging.getStatus())) {
                            timeTrackingLink.addStyleName(UIConstants.LINK_COMPLETED);
                        } else if (itemLogging.getDueDate() != null
                                && (itemLogging.getDueDate().before(DateTimeUtils.getCurrentDateWithoutMS()))) {
                            timeTrackingLink.addStyleName(UIConstants.LINK_OVERDUE);
                        }
                    }
                    summaryWrapper.addComponent(timeTrackingLink);

                    if (StringUtils.isNotBlank(itemLogging.getNote())) {
                        summaryWrapper.addComponent(new Label(itemLogging.getNote(), ContentMode.HTML));
                    }

                    return summaryWrapper;
                }

            } catch (Exception e) {
                LOG.error("Error: " + BeanUtility.printBeanObj(itemLogging), e);
                return new Label("");
            }

        }
    }

    );

    this.

            addGeneratedColumn("projectName", new ColumnGenerator() {
                private static final long serialVersionUID = 1L;

                @Override
                public Object generateCell(Table source, Object itemId, Object columnId) {
                    final SimpleItemTimeLogging itemLogging = TimeTrackingTableDisplay.this
                            .getBeanByIndex(itemId);

                    LabelLink b = new LabelLink(itemLogging.getProjectName(),
                            ProjectLinkBuilder.generateProjectFullLink(itemLogging.getProjectid()));
                    b.setIconLink(ProjectAssetsManager.getAsset(ProjectTypeConstants.PROJECT));
                    return b;
                }
            }

    );

    this.

            addGeneratedColumn("isbillable", new ColumnGenerator() {
                private static final long serialVersionUID = 1L;

                @Override
                public Object generateCell(Table source, Object itemId, Object columnId) {
                    final SimpleItemTimeLogging timeLogging = TimeTrackingTableDisplay.this
                            .getBeanByIndex(itemId);
                    FontIconLabel icon;
                    if (timeLogging.getIsbillable()) {
                        icon = new FontIconLabel(FontAwesome.CHECK);
                    } else {
                        icon = new FontIconLabel(FontAwesome.TIMES);
                    }
                    return icon;
                }
            }

    );

    this.

            addGeneratedColumn("logforday", new ColumnGenerator() {
                private static final long serialVersionUID = 1L;

                @Override
                public com.vaadin.ui.Component generateCell(final Table source, final Object itemId,
                        final Object columnId) {
                    final SimpleItemTimeLogging timeLogging = TimeTrackingTableDisplay.this
                            .getBeanByIndex(itemId);
                    final Label l = new Label();
                    l.setValue(AppContext.formatDate(timeLogging.getLogforday()));
                    return l;
                }
            }

    );

    this.

            addGeneratedColumn("id", new Table.ColumnGenerator() {
                private static final long serialVersionUID = 1L;

                @Override
                public Object generateCell(Table source, Object itemId, Object columnId) {
                    final SimpleItemTimeLogging itemLogging = TimeTrackingTableDisplay.this
                            .getBeanByIndex(itemId);

                    MHorizontalLayout layout = new MHorizontalLayout();
                    Button editBtn = new Button("", new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(ClickEvent event) {
                            fireTableEvent(
                                    new TableClickEvent(TimeTrackingTableDisplay.this, itemLogging, "edit"));

                        }
                    });
                    editBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY);
                    editBtn.setIcon(FontAwesome.EDIT);

                    Button deleteBtn = new Button("", new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(ClickEvent event) {
                            fireTableEvent(
                                    new TableClickEvent(TimeTrackingTableDisplay.this, itemLogging, "delete"));

                        }
                    });
                    deleteBtn.setIcon(FontAwesome.TRASH_O);
                    deleteBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY);
                    layout.with(editBtn, deleteBtn);
                    return layout;
                }

            }

    );

    this.

            setWidth("100%");
}

From source file:com.esofthead.mycollab.module.user.accountsettings.profile.view.ProfilePhotoUploadViewImpl.java

License:Open Source License

@SuppressWarnings("serial")
@Override/*  w ww. jav  a 2  s .  c  o  m*/
public void editPhoto(final byte[] imageData) {
    this.removeAllComponents();
    LOG.debug("Receive avatar upload with size: " + imageData.length);
    try {
        originalImage = ImageIO.read(new ByteArrayInputStream(imageData));
    } catch (IOException e) {
        throw new UserInvalidInputException("Invalid image type");
    }
    originalImage = ImageUtil.scaleImage(originalImage, 650, 650);

    MHorizontalLayout previewBox = new MHorizontalLayout().withSpacing(true)
            .withMargin(new MarginInfo(false, true, true, false)).withWidth("100%");

    Resource defaultPhoto = UserAvatarControlFactory.createAvatarResource(AppContext.getUserAvatarId(), 100);
    previewImage = new Embedded(null, defaultPhoto);
    previewImage.setWidth("100px");
    previewBox.addComponent(previewImage);
    previewBox.setComponentAlignment(previewImage, Alignment.TOP_LEFT);

    VerticalLayout previewBoxRight = new VerticalLayout();
    previewBoxRight.setMargin(new MarginInfo(false, true, false, true));
    Label lbPreview = new Label(
            "<p style='margin: 0px;'><strong>To the left is what your profile photo will look like.</strong></p><p style='margin-top: 0px;'>To make adjustment, you can drag around and resize the selection square below. When you are happy with your photo, click the &ldquo;Accept&ldquo; button.</p>",
            ContentMode.HTML);
    previewBoxRight.addComponent(lbPreview);

    MHorizontalLayout controlBtns = new MHorizontalLayout();
    controlBtns.setSizeUndefined();

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    EventBusFactory.getInstance()
                            .post(new ProfileEvent.GotoProfileView(ProfilePhotoUploadViewImpl.this, null));
                }
            });
    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);

    Button acceptBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ACCEPT),
            new Button.ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    if (scaleImageData != null && scaleImageData.length > 0) {

                        try {
                            BufferedImage image = ImageIO.read(new ByteArrayInputStream(scaleImageData));
                            UserAvatarService userAvatarService = ApplicationContextUtil
                                    .getSpringBean(UserAvatarService.class);
                            userAvatarService.uploadAvatar(image, AppContext.getUsername(),
                                    AppContext.getUserAvatarId());
                            Page.getCurrent().getJavaScript().execute("window.location.reload();");
                        } catch (IOException e) {
                            throw new MyCollabException("Error when saving user avatar", e);
                        }

                    }

                }
            });
    acceptBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    acceptBtn.setIcon(FontAwesome.CHECK);

    controlBtns.with(acceptBtn, cancelBtn).alignAll(Alignment.MIDDLE_LEFT);

    previewBoxRight.addComponent(controlBtns);
    previewBoxRight.setComponentAlignment(controlBtns, Alignment.TOP_LEFT);

    previewBox.addComponent(previewBoxRight);
    previewBox.setExpandRatio(previewBoxRight, 1.0f);

    this.addComponent(previewBox);

    CssLayout cropBox = new CssLayout();
    cropBox.addStyleName(UIConstants.PHOTO_CROPBOX);
    cropBox.setWidth("100%");
    VerticalLayout currentPhotoBox = new VerticalLayout();
    Resource resource = new ByteArrayImageResource(ImageUtil.convertImageToByteArray(originalImage),
            "image/png");
    CropField cropField = new CropField(resource);
    cropField.setImmediate(true);
    cropField.setSelectionAspectRatio(1.0f);
    cropField.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            VCropSelection newSelection = (VCropSelection) event.getProperty().getValue();
            int x1 = newSelection.getXTopLeft();
            int y1 = newSelection.getYTopLeft();
            int x2 = newSelection.getXBottomRight();
            int y2 = newSelection.getYBottomRight();
            if (x2 > x1 && y2 > y1) {
                BufferedImage subImage = originalImage.getSubimage(x1, y1, (x2 - x1), (y2 - y1));
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                try {
                    ImageIO.write(subImage, "png", outStream);
                    scaleImageData = outStream.toByteArray();
                    displayPreviewImage();
                } catch (IOException e) {
                    LOG.error("Error while scale image: ", e);
                }
            }

        }

    });
    currentPhotoBox.setWidth("650px");
    currentPhotoBox.setHeight("650px");

    currentPhotoBox.addComponent(cropField);

    cropBox.addComponent(currentPhotoBox);

    this.addComponent(previewBox);
    this.addComponent(cropBox);
    this.setExpandRatio(cropBox, 1.0f);
}

From source file:com.esofthead.mycollab.module.user.ui.components.ImagePreviewCropWindow.java

License:Open Source License

public ImagePreviewCropWindow(final ImageSelectionCommand imageSelectionCommand, final byte[] imageData) {
    super("Preview and modify image");
    setModal(true);// w  ww.ja  v  a 2  s.  c o  m
    setResizable(false);
    setWidth("700px");
    center();

    MVerticalLayout content = new MVerticalLayout();
    setContent(content);

    try {
        originalImage = ImageIO.read(new ByteArrayInputStream(imageData));
    } catch (IOException e) {
        throw new UserInvalidInputException("Invalid image type");
    }
    originalImage = ImageUtil.scaleImage(originalImage, 650, 650);

    MHorizontalLayout previewBox = new MHorizontalLayout().withSpacing(true)
            .withMargin(new MarginInfo(false, true, true, false)).withFullWidth();

    previewPhoto = new VerticalLayout();
    previewPhoto.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    previewPhoto.setWidth("100px");

    previewBox.with(previewPhoto).withAlign(previewPhoto, Alignment.TOP_LEFT);

    VerticalLayout previewBoxTitle = new VerticalLayout();
    previewBoxTitle.setMargin(new MarginInfo(false, true, false, true));
    Label lbPreview = new Label("<p style='margin: 0px;'><strong>To the bottom is what your profile photo will "
            + "look like.</strong></p>"
            + "<p style='margin-top: 0px;'>To make adjustment, you can drag around and resize the selection square below. "
            + "When you are happy with your photo, click the &ldquo;Accept&ldquo; button.</p>",
            ContentMode.HTML);
    previewBoxTitle.addComponent(lbPreview);

    MHorizontalLayout controlBtns = new MHorizontalLayout();
    controlBtns.setSizeUndefined();

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                    close();
                }
            });
    cancelBtn.setStyleName(UIConstants.BUTTON_OPTION);

    Button acceptBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ACCEPT),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                    if (scaleImageData != null && scaleImageData.length > 0) {
                        try {
                            BufferedImage image = ImageIO.read(new ByteArrayInputStream(scaleImageData));
                            imageSelectionCommand.process(image);
                            close();
                        } catch (IOException e) {
                            throw new MyCollabException("Error when saving user avatar", e);
                        }
                    }
                }
            });
    acceptBtn.setStyleName(UIConstants.BUTTON_ACTION);
    acceptBtn.setIcon(FontAwesome.CHECK);

    controlBtns.with(acceptBtn, cancelBtn).alignAll(Alignment.MIDDLE_LEFT);

    previewBoxTitle.addComponent(controlBtns);
    previewBoxTitle.setComponentAlignment(controlBtns, Alignment.TOP_LEFT);
    previewBox.with(previewBoxTitle).expand(previewBoxTitle);

    CssLayout cropBox = new CssLayout();
    cropBox.setWidth("100%");
    VerticalLayout currentPhotoBox = new VerticalLayout();
    Resource resource = new ByteArrayImageResource(ImageUtil.convertImageToByteArray(originalImage),
            "image/png");
    CropField cropField = new CropField(resource);
    cropField.setImmediate(true);
    cropField.setSelectionAspectRatio(1.0f);
    cropField.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            VCropSelection newSelection = (VCropSelection) event.getProperty().getValue();
            int x1 = newSelection.getXTopLeft();
            int y1 = newSelection.getYTopLeft();
            int x2 = newSelection.getXBottomRight();
            int y2 = newSelection.getYBottomRight();
            if (x2 > x1 && y2 > y1) {
                BufferedImage subImage = originalImage.getSubimage(x1, y1, (x2 - x1), (y2 - y1));
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                try {
                    ImageIO.write(subImage, "png", outStream);
                    scaleImageData = outStream.toByteArray();
                    displayPreviewImage();
                } catch (IOException e) {
                    LOG.error("Error while scale image: ", e);
                }
            }
        }
    });
    currentPhotoBox.setWidth("520px");
    currentPhotoBox.setHeight("470px");
    currentPhotoBox.addComponent(cropField);
    cropBox.addComponent(currentPhotoBox);

    content.with(previewBox, ELabel.hr(), cropBox);
    displayPreviewImage();
}

From source file:com.example.testzbox.vista.TabChecklist.java

private IndexedContainer crearContenedor(CheckListVO checkListVO) {
    IndexedContainer idxCont = new IndexedContainer();

    idxCont.addContainerProperty("No.", Integer.class, "");
    idxCont.addContainerProperty("Id Documento", String.class, "");
    idxCont.addContainerProperty("Nombre Documento", String.class, "");
    idxCont.addContainerProperty("Tipo Documental", String.class, "");
    idxCont.addContainerProperty("Cargado", Label.class, "");
    idxCont.addContainerProperty("Area", String.class, "");
    idxCont.addContainerProperty("Obligatorio", String.class, "");

    VerificarChecklist verChecklist = new VerificarChecklist();

    List<DocumentoVO> documentoVoLt = verChecklist.verificarChecklist(checkListVO, checkListVO);
    int contador = 1;
    for (DocumentoVO doc : documentoVoLt) {
        Item item = idxCont.getItem(idxCont.addItem());
        item.getItemProperty("No.").setValue(contador++);
        item.getItemProperty("Id Documento")
                .setValue(doc.getIdDocumento() != null ? doc.getIdDocumento() : "N.E.");
        item.getItemProperty("Nombre Documento")
                .setValue(doc.getNombreDocumento() != null ? doc.getNombreDocumento() : "N.E.");
        item.getItemProperty("Tipo Documental").setValue(doc.getTipoDocumental());
        item.getItemProperty("Cargado")
                .setValue(doc.getCargado() == true ? new Label(FontAwesome.CHECK.getHtml(), ContentMode.HTML)
                        : new Label(FontAwesome.CLOSE.getHtml(), ContentMode.HTML));
        item.getItemProperty("Area").setValue(doc.getAreaResponsable());
        item.getItemProperty("Obligatorio").setValue(doc.getObligatorioCheckList() == true ? "SI" : "NO");
    }/*www  . j  ava 2 s. c o  m*/

    return idxCont;
}

From source file:com.hybridbpm.ui.component.bpm.TaskLayout.java

License:Apache License

public TaskLayout(String taskId, String processName, String taskName, boolean showHeader) {
    this.taskId = taskId;
    this.processName = processName;
    this.taskName = taskName;
    this.showHeader = showHeader;

    Responsive.makeResponsive(this);
    btnAccept.setIcon(FontAwesome.CHECK);
    btnEscalate.setIcon(FontAwesome.ARROW_UP);
    btnDelegate.setIcon(FontAwesome.ARROW_DOWN);
    btnSchedule.setIcon(FontAwesome.CALENDAR);
    btnSave.setIcon(FontAwesome.SAVE);/*from   www. j  a va 2 s. c om*/
    btnSend.setIcon(FontAwesome.SEND);
    //        btnClose.setIcon(FontAwesome.TIMES);

    btnSend.setStyleName(ValoTheme.BUTTON_PRIMARY);

    btnAccept.addStyleName(ValoTheme.BUTTON_SMALL);
    btnEscalate.addStyleName(ValoTheme.BUTTON_SMALL);
    btnDelegate.addStyleName(ValoTheme.BUTTON_SMALL);
    btnSchedule.addStyleName(ValoTheme.BUTTON_SMALL);
    btnSave.addStyleName(ValoTheme.BUTTON_SMALL);
    btnSend.addStyleName(ValoTheme.BUTTON_SMALL);
    btnClose.addStyleName(ValoTheme.BUTTON_SMALL);

    priorityMenubar.setStyleName(ValoTheme.MENUBAR_SMALL);

    //        buttonBar.setWidth(100, Unit.PERCENTAGE);
    buttonBar.setSpacing(true);
    buttonBar.addStyleName("toolbar");
    //        buttonBar.setExpandRatio(btnAccept, 1f);
    //        buttonBar.setComponentAlignment(priorityMenubar, Alignment.MIDDLE_LEFT);
    buttonBar.setComponentAlignment(btnAccept, Alignment.MIDDLE_RIGHT);
    //        buttonBar.setComponentAlignment(btnEscalate, Alignment.MIDDLE_RIGHT);
    //        buttonBar.setComponentAlignment(btnDelegate, Alignment.MIDDLE_RIGHT);
    buttonBar.setComponentAlignment(btnSchedule, Alignment.MIDDLE_RIGHT);
    buttonBar.setComponentAlignment(btnSave, Alignment.MIDDLE_RIGHT);
    buttonBar.setComponentAlignment(btnSend, Alignment.MIDDLE_RIGHT);
    buttonBar.setComponentAlignment(btnClose, Alignment.MIDDLE_RIGHT);

    tabSheet.setStyleName(ValoTheme.TABSHEET_COMPACT_TABBAR);
    tabSheet.setStyleName(ValoTheme.TABSHEET_FRAMED);
    tabSheet.setSizeFull();

    setSizeFull();
    setSpacing(true);
    if (showHeader) {
        addComponent(taskFormHeader);
    }
    addComponent(buttonBar);
    setComponentAlignment(buttonBar, Alignment.MIDDLE_RIGHT);
    addComponent(tabSheet);
    setExpandRatio(tabSheet, 1f);
    loadForm();
}

From source file:com.hybridbpm.ui.component.bpm.TaskLayout.java

License:Apache License

private void configureVisibilityAndAccess() {
    if (hCase == null) {
        btnAccept.setVisible(false);//from   w  w  w.  jav  a  2s.  co m
        btnSave.setVisible(false);
        btnEscalate.setVisible(false);
        btnSchedule.setVisible(false);
        btnDelegate.setVisible(false);
        priorityMenubar.setVisible(false);
    } else {
        priorityItem.setText(task.getTaskPriority() != null ? task.getTaskPriority().name()
                : TaskModel.TASK_PRIORITY.NORMAL.name());
        priorityItem.setIcon(task.getTaskPriority() != null && task.getTaskPriority().getIcon() != null
                ? FontAwesome.valueOf(task.getTaskPriority().getIcon())
                : null);
        if (task.getExecutor() == null) {
            priorityMenubar.setEnabled(false);
            btnAccept.setIcon(FontAwesome.CHECK);
            btnAccept.setCaption("Accept");
            btnAccept.setEnabled(true);
            btnEscalate.setEnabled(false);
            btnDelegate.setEnabled(false);
            btnSchedule.setEnabled(false);
            btnSave.setEnabled(false);
            btnSend.setEnabled(false);
            tabSheet.setReadOnly(true);
            tabSheet.setEnabled(false);
        } else if (task.getExecutor().equals(HybridbpmUI.getUser().getUsername())) {
            priorityMenubar.setEnabled(true);
            btnAccept.setIcon(FontAwesome.TIMES);
            btnAccept.setCaption("Deny");
            btnAccept.setEnabled(true);
            btnEscalate.setEnabled(true);
            btnSchedule.setEnabled(true);
            btnDelegate.setEnabled(true);
            btnSave.setEnabled(true);
            btnSend.setEnabled(true);
            tabSheet.setReadOnly(false);
            tabSheet.setEnabled(true);
        }
    }
    // for other statuses than TODO
    if (!Objects.equals(task.getStatus(), TaskModel.STATUS.TODO)) {
        btnAccept.setVisible(false);
        btnSave.setVisible(false);
        btnSend.setVisible(false);
        btnEscalate.setVisible(false);
        btnSchedule.setVisible(false);
        btnDelegate.setVisible(false);
        priorityMenubar.setVisible(false);
        for (Component comp : tabSheet) {
            comp.setReadOnly(true);
            comp.setEnabled(false);
        }
    }
}

From source file:com.hybridbpm.ui.component.bpm.TaskLayout.java

License:Apache License

@Override
public void buttonClick(Button.ClickEvent event) {
    if (event.getButton().equals(btnSave)) {
        taskForm.commit();// w w  w.ja  v a 2  s  .co  m
        Map<String, Object> variables = taskForm.getProcessVariablesValues();
        Map<String, List<File>> files = taskForm.getProcessFiles();
        List<String> idsToDelete = taskForm.getFilesIdToDelete();
        task.setStartDate(task.getStartDate() != null ? task.getStartDate() : startDate);
        HybridbpmUI.getBpmAPI().saveTask(task, variables, files, idsToDelete);
        close();
    } else if (event.getButton().equals(btnSend)) {
        taskForm.commit();
        Map<String, Object> variables = taskForm.getProcessVariablesValues();
        Map<String, List<File>> files = taskForm.getProcessFiles();
        if (hCase == null && taskId == null) {
            HybridbpmUI.getBpmAPI().startCase(processName, HybridbpmUI.getUser(), taskName, startDate,
                    variables, files);
        } else {
            List<String> idsToDelete = taskForm.getFilesIdToDelete();
            task.setStartDate(task.getStartDate() != null ? task.getStartDate() : startDate);
            HybridbpmUI.getBpmAPI().finishTask(task, variables, files, idsToDelete);
        }
        close();
    } else if (event.getButton().equals(btnAccept)) {
        if (btnAccept.getIcon().equals(FontAwesome.CHECK)) {
            HybridbpmUI.getBpmAPI().acceptTask(taskId);
            loadForm();
        } else {
            HybridbpmUI.getBpmAPI().denyTask(taskId);
            loadForm();
        }
    } else if (event.getButton().equals(btnSchedule)) {
        openTaskOptions();
    } else if (event.getButton().equals(btnClose)) {
        close();
    }
}

From source file:com.mycollab.module.crm.view.lead.LeadConvertInfoWindow.java

License:Open Source License

private ComponentContainer createBody() {
    final CssLayout layout = new CssLayout();
    layout.setSizeFull();//from  w  w  w .  j  av  a2  s.  co m

    Label shortDescription = ELabel.html(
            "<p>&nbsp;&nbsp;&nbsp;By clicking the \"Convert\" button, the following tasks will be done:</p>");
    layout.addComponent(shortDescription);

    MVerticalLayout infoLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, true));

    String createAccountTxt = FontAwesome.CHECK.getHtml() + " Create Account: " + lead.getAccountname();
    Label createAccountLbl = new Label(createAccountTxt, ContentMode.HTML);
    infoLayout.addComponent(createAccountLbl);

    String createContactTxt = FontAwesome.CHECK.getHtml() + " Create Contact: " + lead.getLastname()
            + (lead.getFirstname() != null ? " " + lead.getFirstname() : "");
    Label createContactLbl = new Label(createContactTxt, ContentMode.HTML);
    infoLayout.addComponent(createContactLbl);

    final CheckBox isCreateOpportunityChk = new CheckBox("Create a new opportunity for this account");
    isCreateOpportunityChk.addValueChangeListener(valueChangeEvent -> {
        Boolean isSelected = isCreateOpportunityChk.getValue();
        if (isSelected) {
            opportunityForm = new LeadOpportunityForm();
            Opportunity opportunity = new Opportunity();

            // this is a trick to pass validation
            opportunity.setAccountid(0);
            opportunityForm.setBean(opportunity);
            layout.addComponent(opportunityForm);
        } else {
            layout.removeComponent(opportunityForm);
        }
    });

    infoLayout.addComponent(isCreateOpportunityChk);
    layout.addComponent(infoLayout);
    return layout;
}