Example usage for com.vaadin.server FontAwesome CHECK_SQUARE_O

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

Introduction

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

Prototype

FontAwesome CHECK_SQUARE_O

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

Click Source Link

Usage

From source file:com.esofthead.mycollab.module.file.view.components.ResourcesDisplayComponent.java

License:Open Source License

public ResourcesDisplayComponent(final String rootPath, final Folder rootFolder) {
    this.setSpacing(true);
    this.baseFolder = rootFolder;
    this.rootPath = rootPath;
    externalResourceService = ApplicationContextUtil.getSpringBean(ExternalResourceService.class);
    externalDriveService = ApplicationContextUtil.getSpringBean(ExternalDriveService.class);
    resourceService = ApplicationContextUtil.getSpringBean(ResourceService.class);

    VerticalLayout mainBodyLayout = new VerticalLayout();
    mainBodyLayout.setSpacing(true);/*from ww w .  j  a  va  2 s .c o m*/
    mainBodyLayout.addStyleName("box-no-border-left");

    // file breadcrum ---------------------
    HorizontalLayout breadcrumbContainer = new HorizontalLayout();
    breadcrumbContainer.setMargin(false);
    fileBreadCrumb = new FileBreadcrumb(rootPath);
    breadcrumbContainer.addComponent(fileBreadCrumb);
    mainBodyLayout.addComponent(breadcrumbContainer);

    // Construct controllGroupBtn
    controllGroupBtn = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true));

    final Button selectAllBtn = new Button();
    selectAllBtn.addStyleName(UIConstants.THEME_BROWN_LINK);
    selectAllBtn.setIcon(FontAwesome.SQUARE_O);
    selectAllBtn.setData(false);
    selectAllBtn.setImmediate(true);
    selectAllBtn.setDescription("Select all");

    selectAllBtn.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            if (!(Boolean) selectAllBtn.getData()) {
                selectAllBtn.setIcon(FontAwesome.CHECK_SQUARE_O);
                selectAllBtn.setData(true);
                resourcesContainer.setAllValues(true);
            } else {
                selectAllBtn.setData(false);
                selectAllBtn.setIcon(FontAwesome.SQUARE_O);
                resourcesContainer.setAllValues(false);
            }
        }
    });
    controllGroupBtn.with(selectAllBtn).withAlign(selectAllBtn, Alignment.MIDDLE_LEFT);

    Button goUpBtn = new Button("Up");
    goUpBtn.setIcon(FontAwesome.ARROW_UP);

    goUpBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            Folder parentFolder;
            if (baseFolder instanceof ExternalFolder) {
                if (baseFolder.getPath().equals("/")) {
                    parentFolder = baseFolder;
                } else {
                    parentFolder = externalResourceService.getParentResourceFolder(
                            ((ExternalFolder) baseFolder).getExternalDrive(), baseFolder.getPath());
                }
            } else if (!baseFolder.getPath().equals(rootPath)) {
                parentFolder = resourceService.getParentFolder(baseFolder.getPath());
            } else {
                parentFolder = baseFolder;
            }

            resourcesContainer.constructBody(parentFolder);
            baseFolder = parentFolder;
            fileBreadCrumb.gotoFolder(baseFolder);
        }
    });
    goUpBtn.setDescription("Back to parent folder");
    goUpBtn.setStyleName(UIConstants.THEME_BROWN_LINK);
    goUpBtn.setDescription("Go up");

    controllGroupBtn.with(goUpBtn).withAlign(goUpBtn, Alignment.MIDDLE_LEFT);

    ButtonGroup navButton = new ButtonGroup();
    navButton.addStyleName(UIConstants.THEME_BROWN_LINK);
    Button createBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CREATE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    AddNewFolderWindow addnewFolderWindow = new AddNewFolderWindow();
                    UI.getCurrent().addWindow(addnewFolderWindow);
                }
            });
    createBtn.setIcon(FontAwesome.PLUS);
    createBtn.addStyleName(UIConstants.THEME_BROWN_LINK);
    createBtn.setDescription("Create new folder");
    createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.PUBLIC_DOCUMENT_ACCESS));
    navButton.addButton(createBtn);

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

        @Override
        public void buttonClick(ClickEvent event) {
            MultiUploadContentWindow multiUploadWindow = new MultiUploadContentWindow();
            UI.getCurrent().addWindow(multiUploadWindow);
        }
    });
    uploadBtn.setIcon(FontAwesome.UPLOAD);
    uploadBtn.addStyleName(UIConstants.THEME_BROWN_LINK);
    uploadBtn.setDescription("Upload");

    uploadBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.PUBLIC_DOCUMENT_ACCESS));
    navButton.addButton(uploadBtn);

    Button downloadBtn = new Button("Download");

    LazyStreamSource streamSource = new LazyStreamSource() {
        private static final long serialVersionUID = 1L;

        @Override
        protected StreamSource buildStreamSource() {
            Collection<Resource> selectedResources = getSelectedResources();
            return StreamDownloadResourceUtil.getStreamSourceSupportExtDrive(selectedResources);
        }

        @Override
        public String getFilename() {
            Collection<Resource> selectedResources = getSelectedResources();
            return StreamDownloadResourceUtil.getDownloadFileName(selectedResources);
        }
    };
    OnDemandFileDownloader downloaderExt = new OnDemandFileDownloader(streamSource);
    downloaderExt.extend(downloadBtn);

    downloadBtn.setIcon(FontAwesome.DOWNLOAD);
    downloadBtn.addStyleName(UIConstants.THEME_BROWN_LINK);
    downloadBtn.setDescription("Download");
    downloadBtn.setEnabled(AppContext.canRead(RolePermissionCollections.PUBLIC_DOCUMENT_ACCESS));
    navButton.addButton(downloadBtn);

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

        @Override
        public void buttonClick(ClickEvent event) {
            Collection<Resource> selectedResources = getSelectedResources();
            if (CollectionUtils.isNotEmpty(selectedResources)) {
                MoveResourceWindow moveResourceWindow = new MoveResourceWindow(selectedResources);
                UI.getCurrent().addWindow(moveResourceWindow);
            } else {
                NotificationUtil.showWarningNotification("Please select at least one item to move");
            }
        }
    });
    moveToBtn.setIcon(FontAwesome.ARROWS);
    moveToBtn.addStyleName(UIConstants.THEME_BROWN_LINK);
    moveToBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.PUBLIC_DOCUMENT_ACCESS));
    moveToBtn.setDescription("Move to");
    navButton.addButton(moveToBtn);

    Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    Collection<Resource> selectedResources = getSelectedResources();
                    if (CollectionUtils.isEmpty(selectedResources)) {
                        NotificationUtil.showWarningNotification("Please select at least one item to delete");
                    } else {
                        deleteResourceAction();
                    }
                }
            });
    deleteBtn.setIcon(FontAwesome.TRASH_O);
    deleteBtn.addStyleName(UIConstants.THEME_RED_LINK);
    deleteBtn.setDescription("Delete resource");
    deleteBtn.setEnabled(AppContext.canAccess(RolePermissionCollections.PUBLIC_DOCUMENT_ACCESS));

    navButton.addButton(deleteBtn);
    controllGroupBtn.addComponent(navButton);

    mainBodyLayout.addComponent(controllGroupBtn);

    resourcesContainer = new ResourcesContainer(baseFolder);

    mainBodyLayout.addComponent(resourcesContainer);
    this.addComponent(mainBodyLayout);
}

From source file:com.esofthead.mycollab.vaadin.ui.SelectionOptionButton.java

License:Open Source License

@SuppressWarnings("serial")
public SelectionOptionButton(
        @SuppressWarnings("rawtypes") final HasSelectableItemHandlers selectableItemHandlers) {
    super();/*w w  w .  j  a v a2 s .co  m*/
    this.selectableItemHandlers = selectableItemHandlers;
    addStyleName(UIConstants.THEME_BLUE_LINK);
    addStyleName(UIConstants.BUTTON_SMALL_PADDING);
    setIcon(FontAwesome.SQUARE_O);

    addClickListener(new SplitButtonClickListener() {
        @Override
        public void splitButtonClick(final SplitButtonClickEvent event) {
            toggleChangeOption();
        }
    });

    addPopupVisibilityListener(new SplitButtonPopupVisibilityListener() {
        @Override
        public void splitButtonPopupVisibilityChange(final SplitButtonPopupVisibilityEvent event) {
            if (event.isPopupVisible()) {
                selectAllBtn.setCaption("Select All ("
                        + SelectionOptionButton.this.selectableItemHandlers.totalItemsCount() + ")");

                selectThisPageBtn.setCaption("Select This Page ("
                        + SelectionOptionButton.this.selectableItemHandlers.currentViewCount() + ")");
            }
        }
    });

    final VerticalLayout selectContent = new VerticalLayout();
    selectContent.setWidth("150px");

    selectAllBtn = new ButtonLink("", new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            isSelectAll = true;
            SelectionOptionButton.this.setIcon(FontAwesome.CHECK_SQUARE_O);
            fireSelectAll();
            SelectionOptionButton.this.setPopupVisible(false);
        }
    });
    selectContent.addComponent(selectAllBtn);

    selectThisPageBtn = new ButtonLink("", new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            isSelectAll = false;
            SelectionOptionButton.this.setIcon(FontAwesome.CHECK_SQUARE_O);
            fireSelectCurrentPage();
            SelectionOptionButton.this.setPopupVisible(false);
        }
    });
    selectContent.addComponent(selectThisPageBtn);

    Button deSelectBtn = new ButtonLink("Deselect All", new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            isSelectAll = false;
            SelectionOptionButton.this.setIcon(FontAwesome.SQUARE_O);
            fireDeselect();
            SelectionOptionButton.this.setPopupVisible(false);
        }
    });
    selectContent.addComponent(deSelectBtn);
    setContent(selectContent);
}

From source file:com.esofthead.mycollab.vaadin.ui.SelectionOptionButton.java

License:Open Source License

public void setSelectedChecbox(final boolean selected) {
    isSelected = selected;/*from   w  w  w.j  a  va2s .  com*/
    final Resource icon = (selected) ? FontAwesome.CHECK_SQUARE_O : FontAwesome.SQUARE_O;
    SelectionOptionButton.this.setIcon(icon);
}

From source file:com.esofthead.mycollab.vaadin.ui.SelectionOptionButton.java

License:Open Source License

private void toggleChangeOption() {
    if (isSelectAll) {
        return;// w  w w  .j  a va  2  s  .  c o m
    }

    isSelected = !isSelected;
    final Resource icon = (isSelected) ? FontAwesome.CHECK_SQUARE_O : FontAwesome.SQUARE_O;
    this.setIcon(icon);

    if (isSelected) {
        fireSelectCurrentPage();
    } else {
        fireDeselect();
    }
}

From source file:com.esofthead.mycollab.vaadin.web.ui.SelectionOptionButton.java

License:Open Source License

public SelectionOptionButton(final HasSelectableItemHandlers selectableItemHandlers) {
    super();/*from   www.  jav  a  2s  .c  om*/
    HasSelectableItemHandlers selectableItemHandlers1 = selectableItemHandlers;
    addStyleName(UIConstants.BUTTON_ACTION);
    addStyleName(UIConstants.BUTTON_SMALL_PADDING);
    setIcon(FontAwesome.SQUARE_O);

    addClickListener(new SplitButtonClickListener() {
        @Override
        public void splitButtonClick(final SplitButtonClickEvent event) {
            toggleChangeOption();
        }
    });

    addPopupVisibilityListener(new SplitButtonPopupVisibilityListener() {
        @Override
        public void splitButtonPopupVisibilityChange(final SplitButtonPopupVisibilityEvent event) {
            if (event.isPopupVisible()) {
                selectAllBtn.setCaption("Select All (" + selectableItemHandlers.totalItemsCount() + ")");

                selectThisPageBtn
                        .setCaption("Select This Page (" + selectableItemHandlers.currentViewCount() + ")");
            }
        }
    });

    final OptionPopupContent selectContent = new OptionPopupContent();

    selectAllBtn = new Button("", new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            isSelectAll = true;
            setIcon(FontAwesome.CHECK_SQUARE_O);
            fireSelectAll();
            setPopupVisible(false);
        }
    });
    selectContent.addOption(selectAllBtn);

    selectThisPageBtn = new Button("", new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            isSelectAll = false;
            setIcon(FontAwesome.CHECK_SQUARE_O);
            fireSelectCurrentPage();
            setPopupVisible(false);
        }
    });
    selectContent.addOption(selectThisPageBtn);

    Button deSelectBtn = new Button("Deselect All", new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            isSelectAll = false;
            setIcon(FontAwesome.SQUARE_O);
            fireDeselect();
            setPopupVisible(false);
        }
    });
    selectContent.addOption(deSelectBtn);
    setContent(selectContent);
}

From source file:com.esofthead.mycollab.vaadin.web.ui.SelectionOptionButton.java

License:Open Source License

public void setSelectedCheckbox(final boolean selected) {
    isSelected = selected;//from w  w w  . ja v a 2 s  .  c  o  m
    Resource icon = (selected) ? FontAwesome.CHECK_SQUARE_O : FontAwesome.SQUARE_O;
    this.setIcon(icon);
}

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

License:Apache License

@Override
public void refreshTable() {
    iTable.removeAllItems();/*from w  ww.j ava  2s  .c om*/
    List<Task> tasks = new ArrayList<>(0);

    if (Objects.equals(status, TaskModel.STATUS.TODO)) {
        tasks = HybridbpmUI.getBpmAPI().getMyTasksToDo(HybridbpmUI.getCurrent().getLocale());
    } else if (Objects.equals(status, TaskModel.STATUS.FINISHED)) {
        tasks = HybridbpmUI.getBpmAPI().getMyTasksDone(HybridbpmUI.getCurrent().getLocale());
    }

    for (Task task : tasks) {
        Item item = iTable.addItem(task);
        item.getItemProperty("id").setValue(task.getId().toString());
        item.getItemProperty("taskPriority").setValue(task.getTaskPriority());
        item.getItemProperty("taskTitle").setValue(task.getTaskTitle());
        item.getItemProperty("caseTitle").setValue(task.getCaseTitle());
        item.getItemProperty("dueDate").setValue(task.getDueDate());
        item.getItemProperty("updateDate").setValue(task.getUpdateDate());
        if (HybridbpmUI.getUser().getUsername().equals(task.getExecutor())) {
            iTable.setItemIcon(task, FontAwesome.CHECK_SQUARE_O);
        } else {
            iTable.setItemIcon(task, FontAwesome.SQUARE_O);
        }
    }
    iTable.sort(new Object[] { "updateDate" }, new boolean[] { false });
    if (Objects.equals(TaskModel.STATUS.TODO, status) && tasks.size() > 0) {
        HazelcastServer.sendDashboardNotificationEventIfExists(
                DashboardNotificationEvent.createViewNotification(HybridbpmUI.getUser().getId().toString(),
                        DashboardConstant.VIEW_URL_TASKS, "" + tasks.size()));
    } else {
        HazelcastServer
                .sendDashboardNotificationEventIfExists(DashboardNotificationEvent.createRemoveViewNotification(
                        HybridbpmUI.getUser().getId().toString(), DashboardConstant.VIEW_URL_TASKS));
    }
}

From source file:com.mycollab.vaadin.web.ui.SelectionOptionButton.java

License:Open Source License

public SelectionOptionButton(final HasSelectableItemHandlers selectableItemHandlers) {
    super();/*from  ww  w . j av a  2 s. co m*/
    addStyleName(WebThemes.BUTTON_ACTION);
    addStyleName(WebThemes.BUTTON_SMALL_PADDING);
    setIcon(FontAwesome.SQUARE_O);

    addClickListener(clickEvent -> toggleChangeOption());

    final OptionPopupContent selectContent = new OptionPopupContent();

    selectAllBtn = new Button("", clickEvent -> {
        isSelectAll = true;
        setIcon(FontAwesome.CHECK_SQUARE_O);
        fireSelectAll();
        setPopupVisible(false);
    });
    selectContent.addOption(selectAllBtn);

    selectThisPageBtn = new Button("", clickEvent -> {
        isSelectAll = false;
        setIcon(FontAwesome.CHECK_SQUARE_O);
        fireSelectCurrentPage();
        setPopupVisible(false);
    });
    selectContent.addOption(selectThisPageBtn);

    addPopupVisibilityListener(event -> {
        if (event.isPopupVisible()) {
            selectAllBtn.setCaption(UserUIContext.getMessage(GenericI18Enum.ACTION_SELECT_ALL_VALUE,
                    selectableItemHandlers.totalItemsCount()));
            selectThisPageBtn.setCaption(UserUIContext.getMessage(GenericI18Enum.ACTION_SELECT_PAGE_VALUE,
                    selectableItemHandlers.currentViewCount()));
        }
    });

    Button deSelectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.ACTION_DESELECT_ALL),
            clickEvent -> {
                isSelectAll = false;
                setIcon(FontAwesome.SQUARE_O);
                fireDeselect();
                setPopupVisible(false);
            });
    selectContent.addOption(deSelectBtn);
    setContent(selectContent);
}

From source file:org.vaadin.allaboutgrid.BooleanToFontIconConverter.java

License:Apache License

@Override
public String convertToPresentation(Boolean value, Class<? extends String> targetType, Locale locale)
        throws com.vaadin.data.util.converter.Converter.ConversionException {
    if (Boolean.TRUE.equals(value)) {
        return FontAwesome.CHECK_SQUARE_O.getHtml();
    } else {//from   w  w w .j  av  a2  s  . com
        return FontAwesome.SQUARE_O.getHtml();
    }
}