List of usage examples for com.vaadin.server FontAwesome GLOBE
FontAwesome GLOBE
To view the source code for com.vaadin.server FontAwesome GLOBE.
Click Source Link
From source file:com.javalego.store.environment.BaseEnvironment.java
@Override public synchronized Collection<RepositoryIcons<Icon>> getRepositoriesIcons() throws LocalizedException { if (repositories != null) { return repositories; }/*w w w.j a v a 2 s.com*/ repositories = new ArrayList<RepositoryIcons<Icon>>(); // Iconos de redes sociales usando FonAwesome icons. FontAwesomeIcons fa = FontAwesomeIcons.getCurrent(); fa.addIcon(MenuIcons2.BOOK, FontAwesome.BOOK); fa.addIcon(MenuIcons2.MONITOR, FontAwesome.DESKTOP); fa.addIcon(MenuIcons2.SOURCECODE, FontAwesome.CODE); fa.addIcon(MenuIcons2.GITHUB, FontAwesome.GITHUB); fa.addIcon(MenuIcons2.METRICS, FontAwesome.BAR_CHART_O); fa.addIcon(MenuIcons2.WEB, FontAwesome.GLOBE); fa.addIcon(MenuIcons2.TWITTER, FontAwesome.TWITTER); fa.addIcon(MenuIcons2.FORUM, FontAwesome.USERS); fa.addIcon(MenuIcons2.BLOG, FontAwesome.WORDPRESS); fa.addIcon(MenuIcons2.LINKEDIN, FontAwesome.LINKEDIN); fa.addIcon(MenuIcons2.FACEBOOK, FontAwesome.FACEBOOK); fa.addIcon(MenuIcons2.GOOGLEPLUS, FontAwesome.GOOGLE_PLUS); fa.addIcon(MenuIcons2.EMAIL, FontAwesome.ENVELOPE); fa.addIcon(MenuIcons2.TOOLS, FontAwesome.COGS); fa.addIcon(MenuIcons2.LICENSE, FontAwesome.FILE); // Resto de iconos ResourceIconsVaadin rep = ResourceIconsVaadin.getCurrent(); //rep.setLocale(Locale.US); rep.load(MenuIcons.class, "/menu_icons"); rep.load(MenuIcons2.class, "/menu_icons2"); rep.load(ProviderIcons.class, "/provider_icons"); rep.load(IconEditor.class, "/icons_editor"); repositories.add(fa); repositories.add(rep); return repositories; }
From source file:org.opencms.ui.dialogs.permissions.CmsPermissionView.java
License:Open Source License
/** * Constructor.<p>//w ww . j a v a 2 s .co m * * @param entry the access control entry * @param editable the editable flag * @param isFolder the is folder flag * @param inheritedFrom the inherited from path * @param changeHandler the change handler */ public CmsPermissionView(CmsAccessControlEntry entry, boolean editable, boolean isFolder, String inheritedFrom, PermissionChangeHandler changeHandler) { m_changeHandler = changeHandler; m_editable = editable; m_entry = entry; CmsVaadinUtils.readAndLocalizeDesign(this, CmsVaadinUtils.getWpMessagesForCurrentLocale(), null); CmsObject cms = A_CmsUI.getCmsObject(); // get name and type of the current entry I_CmsPrincipal principal; try { principal = CmsPrincipal.readPrincipalIncludingHistory(cms, entry.getPrincipal()); } catch (CmsException e) { principal = null; LOG.debug(e.getLocalizedMessage(), e); } m_principalName = (principal != null) ? principal.getName() : entry.getPrincipal().toString(); String ou = null; String displayName; int flags = 0; if ((principal != null) && (principal instanceof CmsHistoryPrincipal)) { // there is a history principal entry, handle it if (principal.isGroup()) { String niceName = OpenCms.getWorkplaceManager().translateGroupName(principal.getName(), false); displayName = CmsVaadinUtils.getMessageText( org.opencms.security.Messages.GUI_ORGUNIT_DISPLAY_NAME_2, ((CmsHistoryPrincipal) principal).getDescription(), niceName); ou = CmsOrganizationalUnit.getParentFqn(m_principalName); flags = CmsAccessControlEntry.ACCESS_FLAGS_GROUP; } else { displayName = ((CmsHistoryPrincipal) principal).getName(); ou = CmsOrganizationalUnit.getParentFqn(m_principalName); flags = CmsAccessControlEntry.ACCESS_FLAGS_USER; } } else if ((principal != null) && principal.isGroup()) { String niceName = OpenCms.getWorkplaceManager().translateGroupName(principal.getName(), false); displayName = CmsVaadinUtils.getMessageText(org.opencms.security.Messages.GUI_ORGUNIT_DISPLAY_NAME_2, ((CmsGroup) principal).getDescription(A_CmsUI.get().getLocale()), niceName); ou = CmsOrganizationalUnit.getParentFqn(m_principalName); flags = CmsAccessControlEntry.ACCESS_FLAGS_GROUP; } else if ((principal != null) && principal.isUser()) { displayName = ((CmsUser) principal).getFullName(); ou = CmsOrganizationalUnit.getParentFqn(m_principalName); flags = CmsAccessControlEntry.ACCESS_FLAGS_USER; } else if ((m_principalName != null) && m_principalName.equals(CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_ID.toString())) { m_principalName = CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME; displayName = CmsVaadinUtils.getMessageText(Messages.GUI_LABEL_ALLOTHERS_0); m_responsibleCheckbox.setVisible(false); flags = CmsAccessControlEntry.ACCESS_FLAGS_ALLOTHERS; } else if ((m_principalName != null) && m_principalName.equals(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID.toString())) { m_principalName = CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME; displayName = CmsVaadinUtils.getMessageText(Messages.GUI_LABEL_OVERWRITEALL_0); flags = CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE_ALL; } else { // check if it is the case of a role CmsRole role = CmsRole.valueOfId(entry.getPrincipal()); if (role != null) { displayName = role.getName(A_CmsUI.get().getLocale()); m_principalName = role.getRoleName(); flags = CmsAccessControlEntry.ACCESS_FLAGS_ROLE; } else { displayName = entry.getPrincipal().toString(); } } if ((flags > 0) && ((entry.getFlags() & flags) == 0)) { // the flag is set to the wrong principal type if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle(A_CmsUI.get().getLocale()).key(Messages.ERR_INVALID_ACE_1, entry.toString())); } entry = new CmsAccessControlEntry(entry.getResource(), entry.getPrincipal(), entry.getAllowedPermissions(), entry.getDeniedPermissions(), (entry.getFlags() | flags)); } else if (entry.getFlags() < CmsAccessControlEntry.ACCESS_FLAGS_USER) { // the flag is set to NO principal type if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle(A_CmsUI.get().getLocale()).key(Messages.ERR_INVALID_ACE_1, entry.toString())); } entry = new CmsAccessControlEntry(entry.getResource(), entry.getPrincipal(), entry.getAllowedPermissions(), entry.getDeniedPermissions(), (entry.getFlags() | CmsAccessControlEntry.ACCESS_FLAGS_GROUP)); } m_principalType = getEntryType(entry.getFlags(), false); if (m_principalName == null) { m_principalName = ""; } FontIcon icon = null; boolean isOverwriteAll = false; switch (flags) { case CmsAccessControlEntry.ACCESS_FLAGS_USER: icon = FontAwesome.USER; break; case CmsAccessControlEntry.ACCESS_FLAGS_GROUP: icon = FontAwesome.GROUP; break; case CmsAccessControlEntry.ACCESS_FLAGS_ALLOTHERS: icon = FontAwesome.GLOBE; break; case CmsAccessControlEntry.ACCESS_FLAGS_ROLE: icon = FontAwesome.GRADUATION_CAP; break; case CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE_ALL: icon = FontAwesome.EXCLAMATION_CIRCLE; isOverwriteAll = true; break; default: icon = FontAwesome.QUESTION_CIRCLE; } m_label.setContentMode(ContentMode.HTML); String ouName = null; if (ou != null) { try { ouName = OpenCms.getOrgUnitManager().readOrganizationalUnit(cms, ou) .getDisplayName(UI.getCurrent().getLocale()); } catch (CmsException e) { LOG.debug("Error reading OU name.", e); } } m_label.setValue(icon.getHtml() + " <b>" + displayName + "</b> " + entry.getPermissions().getPermissionString() + (ouName != null ? ("<br />" + ouName) : "")); m_label.setWidthUndefined(); m_details.setIcon(FontAwesome.PLUS_SQUARE_O); m_details.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { toggleDetails(); } }); m_setButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { setPermissions(); } }); m_deleteButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { deletePermissionSet(); } }); if (inheritedFrom != null) { m_inheritedFrom.setValue(inheritedFrom); } else { m_inheritedFrom.setVisible(false); } if (isOverwriteAll) { setDetailButtonVisible(false); if (m_editable) { addComponent(m_deleteButton, 2); m_deleteButton.addStyleName("o-permissions_delete"); } } else { // get all permissions of the current entry CmsPermissionSet permissions = entry.getPermissions(); IndexedContainer container = getPermissionContainer(permissions); m_permissions.setContainerDataSource(container); m_permissions.setColumnReorderingAllowed(false); m_permissions.setColumnHeader(PROPERTY_LABEL, CmsVaadinUtils.getMessageText(Messages.GUI_PERMISSION_0)); m_permissions.setColumnHeader(PROPERTY_ALLOWED, CmsVaadinUtils.getMessageText(Messages.GUI_PERMISSION_ALLOWED_0)); m_permissions.setColumnHeader(PROPERTY_DISPLAY_ALLOWED, CmsVaadinUtils.getMessageText(Messages.GUI_PERMISSION_ALLOWED_0)); m_permissions.setColumnHeader(PROPERTY_DENIED, CmsVaadinUtils.getMessageText(Messages.GUI_PERMISSION_DENIED_0)); m_permissions.setColumnHeader(PROPERTY_DISPLAY_DENIED, CmsVaadinUtils.getMessageText(Messages.GUI_PERMISSION_DENIED_0)); m_permissions.setPageLength(5); m_permissions.setSortEnabled(false); if (m_editable) { toggleDetails(); setDetailButtonVisible(false); m_permissions.setVisibleColumns(PROPERTY_LABEL, PROPERTY_ALLOWED, PROPERTY_DENIED); m_permissions.setTableFieldFactory(FIELD_FACTORY); m_permissions.setEditable(m_editable); m_responsibleCheckbox.setValue(isResponsible(entry.getFlags())); m_overwriteCheckbox.setValue(isOverWritingInherited(entry.getFlags())); m_inheritCheckbox.setVisible(isFolder); m_inheritCheckbox.setValue(Boolean.valueOf(m_entry.isInheriting())); m_buttonBar.setVisible(true); } else { m_permissions.setVisibleColumns(PROPERTY_LABEL, PROPERTY_DISPLAY_ALLOWED, PROPERTY_DISPLAY_DENIED); } } }
From source file:org.opennms.features.topology.app.internal.ui.ToolbarPanel.java
License:Open Source License
public ToolbarPanel(final ToolbarPanelController controller) { addStyleName(Styles.TOOLBAR);/* ww w . j a v a 2 s .c o m*/ this.layoutManager = controller.getLayoutManager(); final Property<Double> scale = controller.getScaleProperty(); final Boolean[] eyeClosed = new Boolean[] { false }; final Button showFocusVerticesBtn = new Button(); showFocusVerticesBtn.setIcon(FontAwesome.EYE); showFocusVerticesBtn.setDescription("Toggle Highlight Focus Nodes"); showFocusVerticesBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (eyeClosed[0]) { showFocusVerticesBtn.setIcon(FontAwesome.EYE); } else { showFocusVerticesBtn.setIcon(FontAwesome.EYE_SLASH); } eyeClosed[0] = !eyeClosed[0]; // toggle controller.toggleHighlightFocus(); } }); final Button magnifyBtn = new Button(); magnifyBtn.setIcon(FontAwesome.PLUS); magnifyBtn.setDescription("Magnify"); magnifyBtn.addClickListener( (Button.ClickListener) event -> scale.setValue(Math.min(1, scale.getValue() + 0.25))); final Button demagnifyBtn = new Button(); demagnifyBtn.setIcon(FontAwesome.MINUS); demagnifyBtn.setDescription("Demagnify"); demagnifyBtn.addClickListener( (Button.ClickListener) event -> scale.setValue(Math.max(0, scale.getValue() - 0.25))); m_szlOutBtn = new Button(); m_szlOutBtn.setId("szlOutBtn"); m_szlOutBtn.setIcon(FontAwesome.ANGLE_DOWN); m_szlOutBtn.setDescription("Decrease Semantic Zoom Level"); m_szlOutBtn.setEnabled(controller.getSemanticZoomLevel() > 0); m_szlOutBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { int szl = controller.getSemanticZoomLevel(); if (szl > 0) { setSemanticZoomLevel(controller, szl - 1); controller.saveHistory(); } } }); final Button szlInBtn = new Button(); szlInBtn.setId("szlInBtn"); szlInBtn.setIcon(FontAwesome.ANGLE_UP); szlInBtn.setDescription("Increase Semantic Zoom Level"); szlInBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { setSemanticZoomLevel(controller, controller.getSemanticZoomLevel() + 1); controller.saveHistory(); } }); m_zoomLevelLabel.setId("szlInputLabel"); m_panBtn = new Button(); m_panBtn.setIcon(FontAwesome.ARROWS); m_panBtn.setDescription("Pan Tool"); m_panBtn.addStyleName(Styles.SELECTED); m_selectBtn = new Button(); m_selectBtn.setIcon(IonicIcons.ANDROID_EXPAND); m_selectBtn.setDescription("Selection Tool"); m_selectBtn.setStyleName("toolbar-button"); m_selectBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { m_selectBtn.addStyleName(Styles.SELECTED); m_panBtn.removeStyleName(Styles.SELECTED); controller.setActiveTool(ActiveTool.select); } }); m_panBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { m_panBtn.addStyleName(Styles.SELECTED); m_selectBtn.removeStyleName(Styles.SELECTED); controller.setActiveTool(ActiveTool.pan); } }); Button showAllMapBtn = new Button(); showAllMapBtn.setId("showEntireMapBtn"); showAllMapBtn.setIcon(FontAwesome.GLOBE); showAllMapBtn.setDescription("Show Entire Map"); showAllMapBtn.addClickListener((Button.ClickListener) event -> controller.showAllMap()); Button centerSelectionBtn = new Button(); centerSelectionBtn.setIcon(FontAwesome.LOCATION_ARROW); centerSelectionBtn.setDescription("Center On Selection"); centerSelectionBtn.addClickListener((Button.ClickListener) event -> controller.centerMapOnSelection()); Button shareButton = new Button("", FontAwesome.SHARE_SQUARE_O); shareButton.setDescription("Share"); shareButton.addClickListener((x) -> { // Create the share link String fragment = getUI().getPage().getLocation().getFragment(); String url = getUI().getPage().getLocation().toString().replace("#" + fragment, ""); String shareLink = String.format("%s?%s=%s", url, PARAMETER_HISTORY_FRAGMENT, fragment); // Create the Window Window shareWindow = new Window(); shareWindow.setCaption("Share Link"); shareWindow.setModal(true); shareWindow.setClosable(true); shareWindow.setResizable(false); shareWindow.setWidth(400, Sizeable.Unit.PIXELS); TextArea shareLinkField = new TextArea(); shareLinkField.setValue(shareLink); shareLinkField.setReadOnly(true); shareLinkField.setRows(3); shareLinkField.setWidth(100, Sizeable.Unit.PERCENTAGE); // Close Button Button close = new Button("Close"); close.setClickShortcut(ShortcutAction.KeyCode.ESCAPE, null); close.addClickListener(event -> shareWindow.close()); // Layout for Buttons HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setMargin(true); buttonLayout.setSpacing(true); buttonLayout.setWidth("100%"); buttonLayout.addComponent(close); buttonLayout.setComponentAlignment(close, Alignment.BOTTOM_RIGHT); // Content Layout VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(true); verticalLayout.setSpacing(true); verticalLayout.addComponent( new Label("Please use the following link to share the current view with others.")); verticalLayout.addComponent(shareLinkField); verticalLayout.addComponent(buttonLayout); shareWindow.setContent(verticalLayout); getUI().addWindow(shareWindow); }); // Refresh Button Button refreshButton = new Button(); refreshButton.setId("refreshNow"); refreshButton.setIcon(FontAwesome.REFRESH); refreshButton.setDescription("Refresh Now"); refreshButton.addClickListener((event) -> controller.refreshUI()); // Layer Layout layerLayout = new VerticalLayout(); layerLayout.setId("layerComponent"); layerLayout.setSpacing(true); layerLayout.setMargin(true); // Layer Button layerButton = new Button(); layerButton.setId("layerToggleButton"); layerButton.setIcon(FontAwesome.BARS); layerButton.setDescription("Layers"); layerButton.addClickListener((event) -> { boolean isCollapsed = layerButton.getStyleName().contains(Styles.EXPANDED); setLayerLayoutVisible(!isCollapsed); }); // Save button layerSaveButton = new Button(); layerSaveButton.setId("saveLayerButton"); layerSaveButton.setIcon(FontAwesome.FLOPPY_O); layerSaveButton.addClickListener((event) -> controller.saveLayout()); // Actual Layout for the Toolbar CssLayout contentLayout = new CssLayout(); contentLayout.addStyleName("toolbar-component"); contentLayout.addComponent(createGroup(szlInBtn, m_zoomLevelLabel, m_szlOutBtn)); contentLayout.addComponent( createGroup(refreshButton, centerSelectionBtn, showAllMapBtn, layerButton, showFocusVerticesBtn)); contentLayout.addComponent(createGroup(m_panBtn, m_selectBtn)); contentLayout.addComponent(createGroup(magnifyBtn, demagnifyBtn)); contentLayout.addComponent(createGroup(shareButton)); contentLayout.addComponent(createGroup(layerSaveButton)); // Toolbar addComponent(contentLayout); }