List of usage examples for com.vaadin.server FontAwesome ROAD
FontAwesome ROAD
To view the source code for com.vaadin.server FontAwesome ROAD.
Click Source Link
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);//from w w w .java 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); }//w w w . j av a 2s. c om }); 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.ui.PreviewFormControlsGenerator.java
License:Open Source License
public HorizontalLayout createButtonControls(String permissionItem) { layout = new MHorizontalLayout().withStyleName("control-buttons"); layout.setSizeUndefined();/*from ww w.j a va 2 s. co m*/ optionParentBtn = new Button("Option", new Button.ClickListener() { private static final long serialVersionUID = 695008443208333680L; @Override public void buttonClick(ClickEvent event) { optionBtn.setPopupVisible(true); } }); optionBtn = new SplitButton(optionParentBtn); optionBtn.setWidthUndefined(); optionBtn.addStyleName(UIConstants.THEME_GRAY_LINK); popupButtonsControl = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true)) .withWidth("100px"); editButtons = new MHorizontalLayout(); editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { optionBtn.setPopupVisible(false); B item = previewForm.getBean(); previewForm.fireEditForm(item); } }); editBtn.setIcon(FontAwesome.EDIT); editBtn.setStyleName("link"); popupButtonsControl.addComponent(editBtn); deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { B item = previewForm.getBean(); previewForm.fireDeleteForm(item); } }); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.setStyleName(UIConstants.THEME_RED_LINK); editButtons.addComponent(deleteBtn); editButtons.setComponentAlignment(deleteBtn, Alignment.MIDDLE_CENTER); cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { optionBtn.setPopupVisible(false); B item = previewForm.getBean(); previewForm.fireCloneForm(item); } }); cloneBtn.setIcon(FontAwesome.ROAD); cloneBtn.setStyleName("link"); popupButtonsControl.addComponent(cloneBtn); optionBtn.setContent(popupButtonsControl); editButtons.addComponent(optionBtn); editButtons.setComponentAlignment(optionBtn, Alignment.MIDDLE_CENTER); layout.addComponent(editButtons); layout.setComponentAlignment(editButtons, Alignment.MIDDLE_CENTER); layout.setExpandRatio(editButtons, 1.0f); if (permissionItem != null) { boolean canWrite = AppContext.canWrite(permissionItem); boolean canAccess = AppContext.canAccess(permissionItem); editBtn.setEnabled(canWrite); cloneBtn.setEnabled(canWrite); deleteBtn.setEnabled(canAccess); } return layout; }
From source file:com.esofthead.mycollab.vaadin.ui.ProjectPreviewFormControlsGenerator.java
License:Open Source License
public HorizontalLayout createButtonControls(int buttonEnableFlags, final String permissionItem) { Button optionParentBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_OPTION), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from ww w. j av a 2 s.co m public void buttonClick(ClickEvent event) { optionBtn.setPopupVisible(true); } }); optionBtn = new SplitButton(optionParentBtn); optionBtn.setWidthUndefined(); optionBtn.addStyleName(UIConstants.THEME_GRAY_LINK); if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) { 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); editButtons.addComponent(addBtn); editButtons.setComponentAlignment(addBtn, Alignment.MIDDLE_CENTER); } if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) { 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); editButtons.addComponent(editBtn); editButtons.setComponentAlignment(editBtn, Alignment.MIDDLE_CENTER); } if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) { 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); editButtons.addComponent(deleteBtn); editButtons.setComponentAlignment(deleteBtn, Alignment.MIDDLE_CENTER); } if ((buttonEnableFlags & ASSIGN_BTN_PRESENTED) == ASSIGN_BTN_PRESENTED) { assignBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final T item = previewForm.getBean(); previewForm.fireAssignForm(item); } }); assignBtn.setIcon(FontAwesome.SHARE_SQUARE_O); assignBtn.setStyleName(UIConstants.THEME_GREEN_LINK); editButtons.addComponent(assignBtn, 0); } if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) { 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 (popupButtonsControl.getComponentCount() > 0) { optionBtn.setContent(popupButtonsControl); editButtons.addComponent(optionBtn); editButtons.setComponentAlignment(optionBtn, Alignment.MIDDLE_CENTER); } layout.addComponent(editButtons); layout.setComponentAlignment(editButtons, Alignment.MIDDLE_CENTER); layout.setExpandRatio(editButtons, 1.0f); if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) { ButtonGroup navigationBtns = new ButtonGroup(); navigationBtns.setStyleName("navigation-btns"); Button previousItem = new Button("<", 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.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM)); navigationBtns.addButton(previousItem); Button nextItemBtn = new Button(">", 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.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM)); navigationBtns.addButton(nextItemBtn); layout.addComponent(navigationBtns); layout.setComponentAlignment(navigationBtns, Alignment.MIDDLE_RIGHT); } if (permissionItem != null) { final boolean canWrite = CurrentProjectVariables.canWrite(permissionItem); final boolean canAccess = CurrentProjectVariables.canAccess(permissionItem); if (assignBtn != null) { assignBtn.setEnabled(canWrite); } if (addBtn != null) { addBtn.setEnabled(canWrite); } if (editBtn != null) { editBtn.setEnabled(canWrite); } if (cloneBtn != null) { cloneBtn.setEnabled(canWrite); } if (deleteBtn != null) { deleteBtn.setEnabled(canAccess); } } 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); }//from w ww .j a va 2 s .com }); 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.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 ww . j a va2s.co m 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 www . ja v a2 s . 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. java2 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; }