Example usage for com.vaadin.server FontAwesome CHEVRON_RIGHT

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

Introduction

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

Prototype

FontAwesome CHEVRON_RIGHT

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

Click Source Link

Usage

From source file:com.esofthead.mycollab.module.crm.ui.components.CrmPreviewFormControlsGenerator.java

License:Open Source License

public HorizontalLayout createButtonControls(int buttonEnableFlags, final String permissionItem) {

    layout.setStyleName("control-buttons");
    layout.setSpacing(true);/*  ww w .  j  a  v a  2s  .c o m*/
    layout.setSizeUndefined();

    boolean canRead = true;
    boolean canWrite = true;
    boolean canAccess = true;
    if (permissionItem != null) {
        canRead = AppContext.canRead(permissionItem);
        canWrite = AppContext.canWrite(permissionItem);
        canAccess = AppContext.canAccess(permissionItem);
    }

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

    if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
        Button addBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        optionBtn.setPopupVisible(false);
                        final T item = previewForm.getBean();
                        previewForm.fireAddForm(item);
                    }
                });
        addBtn.setIcon(FontAwesome.PLUS);
        addBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        addBtn.setEnabled(canWrite);
        layout.addComponent(addBtn);
    }

    if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
        Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        optionBtn.setPopupVisible(false);
                        final T item = previewForm.getBean();
                        previewForm.fireEditForm(item);
                    }
                });
        editBtn.setIcon(FontAwesome.EDIT);
        editBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        editBtn.setEnabled(canWrite);
        layout.addComponent(editBtn);
    }

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

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        final T item = previewForm.getBean();
                        previewForm.fireDeleteForm(item);
                    }
                });
        deleteBtn.setIcon(FontAwesome.TRASH_O);
        deleteBtn.setStyleName(UIConstants.THEME_RED_LINK);
        layout.addComponent(deleteBtn);
        deleteBtn.setEnabled(canAccess);
    }

    if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
        Button cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        optionBtn.setPopupVisible(false);
                        final T item = previewForm.getBean();
                        previewForm.fireCloneForm(item);
                    }
                });
        cloneBtn.setIcon(FontAwesome.ROAD);
        cloneBtn.setStyleName("link");
        popupButtonsControl.addComponent(cloneBtn);
    }

    if ((buttonEnableFlags & HISTORY_BTN_PRESENTED) == HISTORY_BTN_PRESENTED) {
        Button historyBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_HISTORY),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        optionBtn.setPopupVisible(false);
                        previewForm.showHistory();
                    }
                });
        historyBtn.setIcon(FontAwesome.HISTORY);
        historyBtn.setStyleName("link");
        popupButtonsControl.addComponent(historyBtn);
    }

    optionBtn.setContent(popupButtonsControl);

    if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED
            | (buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {

        layout.addComponent(optionBtn);
    }

    ButtonGroup navigationBtns = new ButtonGroup();
    navigationBtns.setStyleName("navigation-btns");

    if ((buttonEnableFlags & PREVIOUS_BTN_PRESENTED) == PREVIOUS_BTN_PRESENTED) {
        Button previousItem = new Button(null, new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireGotoPrevious(item);
            }
        });
        previousItem.setStyleName(UIConstants.THEME_GREEN_LINK);
        previousItem.setIcon(FontAwesome.CHEVRON_LEFT);
        previousItem.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM));
        navigationBtns.addButton(previousItem);
        previousItem.setEnabled(canRead);
    }

    if ((buttonEnableFlags & NEXT_BTN_PRESENTED) == NEXT_BTN_PRESENTED) {
        Button nextItemBtn = new Button(null, new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireGotoNextItem(item);
            }
        });
        nextItemBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        nextItemBtn.setIcon(FontAwesome.CHEVRON_RIGHT);
        nextItemBtn.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM));
        navigationBtns.addButton(nextItemBtn);
        nextItemBtn.setEnabled(canRead);
    }

    layout.addComponent(navigationBtns);

    return layout;
}

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

License:Open Source License

public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) {
    optionBtn = new PopupButton();
    optionBtn.addStyleName(UIConstants.BOX);
    optionBtn.setIcon(FontAwesome.ELLIPSIS_H);

    if (permissionItem != null) {
        boolean canWrite = AppContext.canWrite(permissionItem);
        boolean canAccess = AppContext.canAccess(permissionItem);
        boolean canRead = AppContext.canRead(permissionItem);

        if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
            Button addBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            optionBtn.setPopupVisible(false);
                            T item = previewForm.getBean();
                            previewForm.fireAddForm(item);
                        }//from w  ww  .j a  v  a  2s .  c o  m
                    });
            addBtn.setIcon(FontAwesome.PLUS);
            addBtn.setStyleName(UIConstants.BUTTON_ACTION);
            addBtn.setEnabled(canWrite);
            editButtons.addComponent(addBtn);
        }

        if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
            Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            optionBtn.setPopupVisible(false);
                            T item = previewForm.getBean();
                            previewForm.fireEditForm(item);
                        }
                    });
            editBtn.setIcon(FontAwesome.EDIT);
            editBtn.setStyleName(UIConstants.BUTTON_ACTION);
            editBtn.setEnabled(canWrite);
            editButtons.addComponent(editBtn);
        }

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

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            T item = previewForm.getBean();
                            previewForm.fireDeleteForm(item);
                        }
                    });
            deleteBtn.setIcon(FontAwesome.TRASH_O);
            deleteBtn.setStyleName(UIConstants.BUTTON_DANGER);
            deleteBtn.setEnabled(canAccess);
            editButtons.addComponent(deleteBtn);
        }

        layout.with(editButtons);

        if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
            ButtonGroup navigationBtns = new ButtonGroup();
            Button previousItem = new Button(null, new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireGotoPrevious(item);
                }
            });
            previousItem.setIcon(FontAwesome.CHEVRON_LEFT);
            previousItem.setStyleName(UIConstants.BUTTON_ACTION);
            previousItem.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM));
            previousItem.setEnabled(canRead);
            navigationBtns.addButton(previousItem);

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireGotoNextItem(item);
                }
            });
            nextItemBtn.setIcon(FontAwesome.CHEVRON_RIGHT);
            nextItemBtn.setStyleName(UIConstants.BUTTON_ACTION);
            nextItemBtn.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM));
            nextItemBtn.setEnabled(canRead);
            navigationBtns.addButton(nextItemBtn);
            layout.with(navigationBtns);
        }

        if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
            Button cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            optionBtn.setPopupVisible(false);
                            T item = previewForm.getBean();
                            previewForm.fireCloneForm(item);
                        }
                    });
            cloneBtn.setIcon(FontAwesome.ROAD);
            cloneBtn.setEnabled(canWrite);
            popupButtonsControl.addOption(cloneBtn);
        }

        if (popupButtonsControl.getComponentCount() > 0) {
            optionBtn.setContent(popupButtonsControl);
            layout.with(optionBtn);
        }
    }
    return layout;
}

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

License:Open Source License

public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) {
    optionBtn = new PopupButton();
    optionBtn.addStyleName(UIConstants.BOX);
    optionBtn.setIcon(FontAwesome.ELLIPSIS_H);

    if (permissionItem != null) {
        boolean canWrite = CurrentProjectVariables.canWrite(permissionItem);
        boolean canAccess = CurrentProjectVariables.canAccess(permissionItem);
        boolean canRead = CurrentProjectVariables.canRead(permissionItem);

        if ((buttonEnableFlags & ASSIGN_BTN_PRESENTED) == ASSIGN_BTN_PRESENTED) {
            Button assignBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            T item = previewForm.getBean();
                            previewForm.fireAssignForm(item);
                        }/*  w  w w .j a  v  a2 s. co  m*/
                    });
            assignBtn.setIcon(FontAwesome.SHARE);
            assignBtn.setStyleName(UIConstants.BUTTON_ACTION);
            editButtons.addComponent(assignBtn);
            assignBtn.setEnabled(canWrite);
        }

        if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
            Button addBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            optionBtn.setPopupVisible(false);
                            T item = previewForm.getBean();
                            previewForm.fireAddForm(item);
                        }
                    });
            addBtn.setIcon(FontAwesome.PLUS);
            addBtn.setStyleName(UIConstants.BUTTON_ACTION);
            addBtn.setEnabled(canWrite);
            editButtons.addComponent(addBtn);
        }

        if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
            Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            optionBtn.setPopupVisible(false);
                            T item = previewForm.getBean();
                            previewForm.fireEditForm(item);
                        }
                    });
            editBtn.setIcon(FontAwesome.EDIT);
            editBtn.setStyleName(UIConstants.BUTTON_ACTION);
            editBtn.setEnabled(canWrite);
            editButtons.addComponent(editBtn);
        }

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

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            T item = previewForm.getBean();
                            previewForm.fireDeleteForm(item);
                        }
                    });
            deleteBtn.setIcon(FontAwesome.TRASH_O);
            deleteBtn.setStyleName(UIConstants.BUTTON_DANGER);
            deleteBtn.setEnabled(canAccess);
            editButtons.addComponent(deleteBtn);
        }

        if ((buttonEnableFlags & PRINT_BTN_PRESENTED) == PRINT_BTN_PRESENTED) {
            final PrintButton printBtn = new PrintButton();
            printBtn.addClickListener(new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.firePrintForm(printBtn, item);
                }
            });
            printBtn.setStyleName(UIConstants.BUTTON_OPTION);
            printBtn.setDescription(AppContext.getMessage(GenericI18Enum.ACTION_PRINT));
            printBtn.setEnabled(canRead);
            editButtons.addComponent(printBtn);
        }

        if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
            Button cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(final ClickEvent event) {
                            optionBtn.setPopupVisible(false);
                            T item = previewForm.getBean();
                            previewForm.fireCloneForm(item);
                        }
                    });
            cloneBtn.setIcon(FontAwesome.ROAD);
            cloneBtn.setEnabled(canWrite);
            popupButtonsControl.addOption(cloneBtn);
        }

        layout.with(editButtons);

        if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
            ButtonGroup navigationBtns = new ButtonGroup();
            Button previousItem = new Button(null, new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireGotoPrevious(item);
                }
            });
            previousItem.setIcon(FontAwesome.CHEVRON_LEFT);
            previousItem.setCaptionAsHtml(true);
            previousItem.setStyleName(UIConstants.BUTTON_OPTION);
            previousItem.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM));
            previousItem.setEnabled(canRead);
            navigationBtns.addButton(previousItem);

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireGotoNextItem(item);
                }
            });
            nextItemBtn.setIcon(FontAwesome.CHEVRON_RIGHT);
            nextItemBtn.setStyleName(UIConstants.BUTTON_OPTION);
            nextItemBtn.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM));
            nextItemBtn.setEnabled(canRead);
            navigationBtns.addButton(nextItemBtn);

            layout.addComponent(navigationBtns);
        }

        if (popupButtonsControl.getComponentCount() > 0) {
            optionBtn.setContent(popupButtonsControl);
            layout.addComponent(optionBtn);
        }
    }

    return layout;
}

From source file:com.foo01.components.ReservationComponent.java

public static Component build(final Reservation r) {
    final HorizontalLayout reservationComponentLayout = new HorizontalLayout();

    final VerticalLayout datesLayout = new VerticalLayout();
    Label beginningDate = new Label(
            (new SimpleDateFormat("E dd.MM.", Locale.getDefault())).format(r.getBeginning().getTime()));
    Label endingDate = new Label(
            (new SimpleDateFormat("E dd.MM.", Locale.getDefault())).format(r.getEnding().getTime()));
    beginningDate.addStyleName("datelabel");
    endingDate.addStyleName("datelabel");
    datesLayout.addComponent(beginningDate);
    datesLayout.addComponent(endingDate);
    datesLayout.setSpacing(true);/*w ww.j  ava2 s  .c o m*/
    reservationComponentLayout.addComponent(datesLayout);

    Label reservationInfoLabel = new Label(r.getUser() + "</br></br>" + r.getDescription(), ContentMode.HTML);
    reservationInfoLabel.addStyleName("informationlabel");
    reservationComponentLayout.addComponent(reservationInfoLabel);

    Label rightArrowIconLabel = new Label("</br>" + FontAwesome.CHEVRON_RIGHT.getHtml(), ContentMode.HTML);
    rightArrowIconLabel.addStyleName("rightArrowIconLabel");
    reservationComponentLayout.addComponent(rightArrowIconLabel);

    reservationComponentLayout.setSpacing(true);
    reservationComponentLayout.setWidth("100%");
    datesLayout.setWidth("85px");
    reservationInfoLabel.setSizeFull();
    rightArrowIconLabel.setHeight("100%");
    rightArrowIconLabel.setWidth("20px");
    reservationComponentLayout.setExpandRatio(reservationInfoLabel, 1.0f);

    reservationComponentLayout.addLayoutClickListener(new LayoutClickListener() {
        @Override
        public void layoutClick(LayoutClickEvent event) {
            //System.out.println(event.getClickedComponent().getParent().getId());
            ((foo01TouchKitUI) UI.getCurrent()).NAVIGATIONMANAGER.navigateTo(new ReservationView(r));
        }
    });

    return reservationComponentLayout;
}

From source file:com.mycollab.module.crm.ui.components.CrmPreviewFormControlsGenerator.java

License:Open Source License

public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) {
    boolean canRead = false;
    boolean canWrite = false;
    boolean canAccess = false;
    if (permissionItem != null) {
        canRead = UserUIContext.canRead(permissionItem);
        canWrite = UserUIContext.canWrite(permissionItem);
        canAccess = UserUIContext.canAccess(permissionItem);
    }/*from w w w  .j av a 2  s.c  om*/

    MHorizontalLayout editBtns = new MHorizontalLayout();
    layout.addComponent(editBtns);

    OptionPopupContent popupButtonsControl = new OptionPopupContent();

    if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
        MButton addBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), clickEvent -> {
            optionBtn.setPopupVisible(false);
            T item = previewForm.getBean();
            previewForm.fireAddForm(item);
        }).withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite);
        editBtns.addComponent(addBtn);
    }

    if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
        MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> {
            optionBtn.setPopupVisible(false);
            T item = previewForm.getBean();
            previewForm.fireEditForm(item);
        }).withIcon(FontAwesome.EDIT).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite);
        editBtns.addComponent(editBtn);
    }

    if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
        MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), clickEvent -> {
            T item = previewForm.getBean();
            previewForm.fireDeleteForm(item);
        }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_DANGER).withVisible(canAccess);
        editBtns.addComponent(deleteBtn);
    }

    if ((buttonEnableFlags & PRINT_BTN_PRESENTED) == PRINT_BTN_PRESENTED) {
        final PrintButton printBtn = new PrintButton();
        printBtn.withListener(clickEvent -> {
            T item = previewForm.getBean();
            previewForm.firePrintForm(printBtn, item);
        }).withStyleName(WebThemes.BUTTON_OPTION).withVisible(canRead);
        editBtns.addComponent(printBtn);
    }

    if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
        MButton cloneBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLONE), clickEvent -> {
            optionBtn.setPopupVisible(false);
            T item = previewForm.getBean();
            previewForm.fireCloneForm(item);
        }).withIcon(FontAwesome.ROAD).withVisible(canWrite);
        popupButtonsControl.addOption(cloneBtn);
    }

    optionBtn.setContent(popupButtonsControl);

    ButtonGroup navigationBtns = new ButtonGroup();
    navigationBtns.setStyleName("navigation-btns");

    if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
        MButton previousItem = new MButton("", clickEvent -> {
            T item = previewForm.getBean();
            previewForm.fireGotoPrevious(item);
        }).withIcon(FontAwesome.CHEVRON_LEFT).withStyleName(WebThemes.BUTTON_OPTION)
                .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM))
                .withVisible(canRead);
        navigationBtns.addButton(previousItem);

        MButton nextItemBtn = new MButton("", clickEvent -> {
            T item = previewForm.getBean();
            previewForm.fireGotoNextItem(item);
        }).withIcon(FontAwesome.CHEVRON_RIGHT).withStyleName(WebThemes.BUTTON_OPTION)
                .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM))
                .withVisible(canRead);
        navigationBtns.addButton(nextItemBtn);
    }

    layout.addComponent(navigationBtns);
    if (popupButtonsControl.getComponentCount() > 0) {
        optionBtn.setContent(popupButtonsControl);
        layout.addComponent(optionBtn);
    }
    return layout;
}

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

License:Open Source License

public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) {
    optionBtn = new PopupButton();
    optionBtn.addStyleName(WebThemes.BUTTON_OPTION);
    optionBtn.setIcon(FontAwesome.ELLIPSIS_H);

    if (permissionItem != null) {
        boolean canWrite = UserUIContext.canWrite(permissionItem);
        boolean canAccess = UserUIContext.canAccess(permissionItem);
        boolean canRead = UserUIContext.canRead(permissionItem);

        if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
            MButton addBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), clickEvent -> {
                optionBtn.setPopupVisible(false);
                T item = previewForm.getBean();
                previewForm.fireAddForm(item);
            }).withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite);
            editButtons.addComponent(addBtn);
        }//from  ww w  .ja  va2s. c  o m

        if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
            MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> {
                optionBtn.setPopupVisible(false);
                T item = previewForm.getBean();
                previewForm.fireEditForm(item);
            }).withIcon(FontAwesome.EDIT).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite);
            editButtons.addComponent(editBtn);
        }

        if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
            MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE),
                    clickEvent -> {
                        T item = previewForm.getBean();
                        previewForm.fireDeleteForm(item);
                    }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_DANGER)
                            .withVisible(canAccess);
            editButtons.addComponent(deleteBtn);
        }

        layout.with(editButtons);

        if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
            ButtonGroup navigationBtns = new ButtonGroup();
            MButton previousItem = new MButton("", clickEvent -> {
                T item = previewForm.getBean();
                previewForm.fireGotoPrevious(item);
            }).withIcon(FontAwesome.CHEVRON_LEFT).withStyleName(WebThemes.BUTTON_ACTION)
                    .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM))
                    .withVisible(canRead);
            navigationBtns.addButton(previousItem);

            MButton nextItemBtn = new MButton("", clickEvent -> {
                T item = previewForm.getBean();
                previewForm.fireGotoNextItem(item);
            }).withIcon(FontAwesome.CHEVRON_RIGHT).withStyleName(WebThemes.BUTTON_ACTION)
                    .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM))
                    .withVisible(canRead);
            navigationBtns.addButton(nextItemBtn);
            layout.with(navigationBtns);
        }

        if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
            MButton cloneBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLONE),
                    clickEvent -> {
                        optionBtn.setPopupVisible(false);
                        T item = previewForm.getBean();
                        previewForm.fireCloneForm(item);
                    }).withIcon(FontAwesome.ROAD).withVisible(canWrite);
            popupButtonsControl.addOption(cloneBtn);
        }

        if (popupButtonsControl.getComponentCount() > 0) {
            optionBtn.setContent(popupButtonsControl);
            layout.with(optionBtn);
        }
    }
    return layout;
}

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

License:Open Source License

public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) {
    optionBtn = new PopupButton();
    optionBtn.addStyleName(WebThemes.BUTTON_OPTION);
    optionBtn.setIcon(FontAwesome.ELLIPSIS_H);

    if (permissionItem != null) {
        boolean canWrite = CurrentProjectVariables.canWrite(permissionItem);
        boolean canAccess = CurrentProjectVariables.canAccess(permissionItem);
        boolean canRead = CurrentProjectVariables.canRead(permissionItem);

        if ((buttonEnableFlags & ASSIGN_BTN_PRESENTED) == ASSIGN_BTN_PRESENTED) {
            MButton assignBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ASSIGN),
                    clickEvent -> {//ww w  .j  a v a 2  s.c  om
                        T item = previewForm.getBean();
                        previewForm.fireAssignForm(item);
                    }).withIcon(FontAwesome.SHARE).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite);
            editButtons.addComponent(assignBtn);
        }

        if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
            MButton addBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), clickEvent -> {
                optionBtn.setPopupVisible(false);
                T item = previewForm.getBean();
                previewForm.fireAddForm(item);
            }).withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite);
            editButtons.addComponent(addBtn);
        }

        if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
            MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> {
                optionBtn.setPopupVisible(false);
                T item = previewForm.getBean();
                previewForm.fireEditForm(item);
            }).withIcon(FontAwesome.EDIT).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite);
            editButtons.addComponent(editBtn);
        }

        if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
            MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE),
                    clickEvent -> {
                        T item = previewForm.getBean();
                        previewForm.fireDeleteForm(item);
                    }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_DANGER)
                            .withVisible(canAccess);
            editButtons.addComponent(deleteBtn);
        }

        if ((buttonEnableFlags & PRINT_BTN_PRESENTED) == PRINT_BTN_PRESENTED) {
            final PrintButton printBtn = new PrintButton();
            printBtn.withListener(clickEvent -> {
                T item = previewForm.getBean();
                previewForm.firePrintForm(printBtn, item);
            }).withStyleName(WebThemes.BUTTON_OPTION)
                    .withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_PRINT))
                    .withVisible(canRead);
            editButtons.addComponent(printBtn);
        }

        if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
            MButton cloneBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLONE),
                    clickEvent -> {
                        optionBtn.setPopupVisible(false);
                        T item = previewForm.getBean();
                        previewForm.fireCloneForm(item);
                    }).withIcon(FontAwesome.ROAD).withVisible(canWrite);
            popupButtonsControl.addOption(cloneBtn);
        }

        layout.with(editButtons);

        if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
            ButtonGroup navigationBtns = new ButtonGroup();
            MButton previousItem = new MButton("", clickEvent -> {
                T item = previewForm.getBean();
                previewForm.fireGotoPrevious(item);
            }).withIcon(FontAwesome.CHEVRON_LEFT).withStyleName(WebThemes.BUTTON_OPTION)
                    .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM))
                    .withVisible(canRead);
            navigationBtns.addButton(previousItem);

            MButton nextItemBtn = new MButton("", clickEvent -> {
                T item = previewForm.getBean();
                previewForm.fireGotoNextItem(item);
            }).withIcon(FontAwesome.CHEVRON_RIGHT).withStyleName(WebThemes.BUTTON_OPTION)
                    .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM))
                    .withVisible(canRead);
            navigationBtns.addButton(nextItemBtn);
            layout.addComponent(navigationBtns);
        }

        if (popupButtonsControl.getComponentCount() > 0) {
            optionBtn.setContent(popupButtonsControl);
            layout.addComponent(optionBtn);
        }
    }

    return layout;
}

From source file:me.uni.emuseo.view.common.ExpandingPanel.java

License:Open Source License

protected void onToggle() {
    boolean toExpand = !this.expanded;
    if (toExpand) {
        this.addComponent(expandingContent);
        this.setExpandRatio(expandingContent, 1);
        addStyleName("expanded");
        expandingButton.setIcon(FontAwesome.CHEVRON_RIGHT);
    } else {/*from w  w w . ja v  a  2  s .c om*/
        this.removeComponent(expandingContent);
        removeStyleName("expanded");
        expandingButton.setIcon(FontAwesome.CHEVRON_DOWN);
    }
    this.expanded = !this.expanded;
}

From source file:org.jumpmind.metl.ui.views.design.EditParametersDialog.java

License:Open Source License

public EditParametersDialog(ApplicationContext context, Flow flow, boolean readOnly) {
    super("Flow Parameters");
    this.context = context;
    this.flow = flow;

    Button closeButton = new Button("Close");
    closeButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
    closeButton.addClickListener(new CloseClickListener());

    if (!readOnly) {
        ButtonBar buttonBar = new ButtonBar();
        buttonBar.addButton("Add", FontAwesome.PLUS, new AddClickListener());
        insertButton = buttonBar.addButton("Insert", FontAwesome.CHEVRON_RIGHT, new InsertClickListener());
        insertButton.setEnabled(false);//from  ww w.j  a va  2s  .c  om
        removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O, new RemoveClickListener());
        removeButton.setEnabled(false);
        addComponent(buttonBar);
    }

    table = new Table();
    table.setSizeFull();
    container = new BeanItemContainer<FlowParameter>(FlowParameter.class);
    table.setContainerDataSource(container);
    table.setSelectable(true);
    table.setSortEnabled(false);
    if (!readOnly) {
        table.setEditable(true);
        table.setDragMode(TableDragMode.ROW);
        table.setDropHandler(new TableDropHandler());
        table.setTableFieldFactory(new EditFieldFactory());
        table.addValueChangeListener(this);
    }
    table.setVisibleColumns("position", "name", "defaultValue");
    table.setColumnHeaders("#", "Name", "Default Value");
    table.setColumnExpandRatio("name", .3f);
    table.setColumnExpandRatio("defaultValue", .6f);
    addComponent(table, 1);

    addComponent(buildButtonFooter(closeButton));

    List<FlowParameter> params = flow.getFlowParameters();
    Collections.sort(params, new Comparator<FlowParameter>() {
        public int compare(FlowParameter o1, FlowParameter o2) {
            return new Integer(o1.getPosition()).compareTo(new Integer(o2.getPosition()));
        }
    });

    for (FlowParameter flowParameter : params) {
        table.addItem(flowParameter);
    }
}

From source file:org.lucidj.browser.BrowserView.java

License:Apache License

private void build_toolbar() {
    current_toolbar = new CssLayout();

    CssLayout local_toolbar = new CssLayout();
    current_toolbar.addComponent(local_toolbar);

    CssLayout navigation = new CssLayout();
    navigation.addStyleName("v-component-group");
    navigation.addStyleName("ui-toolbar-spacer");
    createButton(navigation, "prev-smartbox", FontAwesome.CHEVRON_LEFT, null, ShortcutAction.KeyCode.ARROW_UP,
            ShortcutAction.ModifierKey.CTRL);
    createButton(navigation, "next-smartbox", FontAwesome.CHEVRON_RIGHT, null,
            ShortcutAction.KeyCode.ARROW_DOWN, ShortcutAction.ModifierKey.CTRL);
    local_toolbar.addComponent(navigation);

    createButton(local_toolbar, "save", FontAwesome.SAVE).addStyleName("ui-toolbar-spacer");
    //        createButton (local_toolbar, "test", FontAwesome.MAGIC)
    //            .addStyleName("ui-toolbar-spacer");
    //        createButton (local_toolbar, "test2", FontAwesome.FLASK)
    //                .addStyleName("ui-toolbar-spacer");

    CssLayout edition = new CssLayout();
    edition.addStyleName("v-component-group");
    edition.addStyleName("ui-toolbar-spacer");
    createButton(edition, "undo-cell-edit", FontAwesome.UNDO, "Undo");
    createButton(edition, "redo-cell-edit", FontAwesome.REPEAT, null);
    createButton(edition, "delete-cell", FontAwesome.TRASH_O, null);
    local_toolbar.addComponent(edition);

    CssLayout view_controls = new CssLayout();
    view_controls.addStyleName("v-component-group");
    view_controls.addStyleName("ui-toolbar-spacer");
    createButton(view_controls, VM_NOTEBOOK,
            new ExternalResource("vaadin://~/Browser_libraries/notebook-view.png"));
    createButton(view_controls, VM_SINGLE, new ExternalResource("vaadin://~/Browser_libraries/single-view.png"),
            null, ShortcutAction.KeyCode.INSERT, ShortcutAction.ModifierKey.CTRL);
    local_toolbar.addComponent(view_controls);

    // TODO: CTRL+ENTER => RUN AND SKIP TO NEXT
    // TODO: SELECTION + SHIFT+ENTER => RUN ONLY SELECTED STATEMENTS

    final Button source_view = new Button();
    source_view.setId("output");
    source_view.addStyleName("ui-toolbar-spacer");
    source_view.setHtmlContentAllowed(true);
    String ico = "<path class=\"path1\" d=\"M1088 128h-64v-64c0-35.2-28.8-64-64-64h-896c-35.2 0-64 28.8-64 64v768c0 35.2 28.8 64 64 64h64v64c0 35.2 28.8 64 64 64h896c35.2 0 64-28.8 64-64v-768c0-35.2-28.8-64-64-64zM128 192v640h-63.886c-0.040-0.034-0.082-0.076-0.114-0.116v-767.77c0.034-0.040 0.076-0.082 0.114-0.114h895.77c0.040 0.034 0.082 0.076 0.116 0.116v63.884h-768c-35.2 0-64 28.8-64 64v0zM1088 959.884c-0.034 0.040-0.076 0.082-0.116 0.116h-895.77c-0.040-0.034-0.082-0.076-0.114-0.116v-767.77c0.034-0.040 0.076-0.082 0.114-0.114h895.77c0.040 0.034 0.082 0.076 0.116 0.116v767.768z\"></path>\n"
            + "<path class=\"path2\" d=\"M960 352c0 53.020-42.98 96-96 96s-96-42.98-96-96 42.98-96 96-96 96 42.98 96 96z\"></path>\n"
            + "<path class=\"path3\" d=\"M1024 896h-768v-128l224-384 256 320h64l224-192z\"></path>";
    source_view.setCaption(// w  w  w .j a  v a 2s  .  c o  m
            "<svg style=\"fill: currentColor; width: 1.5em; margin-top:0.3em;\" viewBox=\"0 0 1152 1024\">"
                    + ico + "</svg>");
    source_view.addStyleName("tiny");
    source_view.addStyleName("toolbar");
    source_view.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            handle_button_click(source_view);
        }
    });
    local_toolbar.addComponent(source_view);

    //        Button output_view = new Button ();
    //        output_view.setHtmlContentAllowed(true);
    //        String ico2 = "<path d=\"M249.649 792.806l-107.776 166.4 11.469 54.426 54.272-11.622 107.725-166.298c-11.469-6.144-22.835-12.698-33.843-19.968-11.162-7.219-21.811-14.95-31.846-22.938zM705.943 734.694c0.717-1.485 1.178-3.123 1.843-4.71 2.714-5.99 5.12-11.981 7.066-18.278 0.307-1.126 0.461-2.253 0.819-3.277 1.997-6.963 3.686-13.824 5.018-20.89 0-0.358 0-0.614 0-1.075 9.984-59.853-7.424-126.618-47.258-186.931l56.832-87.757c65.485 8.346 122.112-8.141 149.35-50.278 47.258-72.858-10.24-194.15-128.256-271.002-118.118-76.902-252.058-80.128-299.213-7.373-27.341 42.189-19.354 100.71 15.002 157.338l-56.934 87.757c-71.117-11.93-139.059-0.819-189.594 32.768-0.307 0.102-0.666 0.205-0.87 0.41-5.888 3.994-11.622 8.397-16.998 13.005-0.87 0.717-1.894 1.382-2.611 2.099-5.018 4.301-9.523 9.114-13.875 13.926-1.024 1.229-2.458 2.304-3.43 3.584-5.427 6.195-10.445 12.749-14.848 19.712-70.861 109.21-10.394 274.483 134.81 369.101 145.306 94.618 320.512 82.637 391.219-26.573 4.454-6.912 8.55-14.131 11.93-21.555zM664.215 224.845c-45.414-29.542-67.584-76.134-49.408-104.243 18.125-28.006 69.683-26.726 114.995 2.816 45.517 29.542 67.482 76.237 49.408 104.243s-69.53 26.726-114.995-2.816z\"></path>";
    //        output_view.setCaption("<svg style=\"fill: currentColor; width: 1.5em; margin-top:0.3em;\" viewBox=\"0 0 1024 1024\">" + ico2 + "</svg>");
    //        output_view.addStyleName("tiny");
    //        view_controls.addComponent (output_view);
    //
    //        Button run = new Button ();
    //        run.setHtmlContentAllowed(true);
    //        String ico3 = "<path class=\"path1\" d=\"M192 128l640 384-640 384z\"></path>";
    //        run.setCaption("<svg style=\"fill: currentColor; width: 1.5em; margin-top:0.3em;\" viewBox=\"0 0 1024 1024\">" + ico3 + "</svg>");
    //        run.addStyleName("tiny");
    //        view_controls.addComponent (run);

}