Example usage for com.vaadin.server FontAwesome PLUS_SQUARE_O

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

Introduction

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

Prototype

FontAwesome PLUS_SQUARE_O

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

Click Source Link

Usage

From source file:annis.gui.admin.ImportPanel.java

License:Apache License

private void setLogVisible(boolean visible) {
    txtMessages.setVisible(visible);//w w  w  .  ja v a2  s .  c  om
    if (visible) {
        btDetailedLog.setCaption("Hide log");
        btDetailedLog.setIcon(FontAwesome.MINUS_SQUARE_O, "minus sign");
        layout.setExpandRatio(btDetailedLog, 0.0f);
    } else {
        btDetailedLog.setCaption("Show log");
        btDetailedLog.setIcon(FontAwesome.PLUS_SQUARE_O, "plus sign");
        layout.setExpandRatio(btDetailedLog, 1.0f);
    }
}

From source file:annis.gui.ReportBugWindow.java

License:Apache License

private void addScreenshotPreview(Layout layout, final byte[] rawImage, String mimeType) {
    StreamResource res = new StreamResource(new ScreenDumpStreamSource(rawImage),
            "screendump_" + UUID.randomUUID().toString() + ".png");
    res.setMIMEType(mimeType);/* w w  w.java 2 s .com*/

    final Image imgScreenshot = new Image("Attached screenshot", res);
    imgScreenshot.setAlternateText(
            "Screenshot of the ANNIS browser window, " + "no other window or part of the desktop is captured.");
    imgScreenshot.setVisible(false);
    imgScreenshot.setWidth("100%");

    Button btShowScreenshot = new Button("Show attached screenshot",
            new ShowScreenshotClickListener(imgScreenshot));
    btShowScreenshot.addStyleName(BaseTheme.BUTTON_LINK);
    btShowScreenshot.setIcon(FontAwesome.PLUS_SQUARE_O);

    layout.addComponent(btShowScreenshot);
    layout.addComponent(imgScreenshot);
}

From source file:com.hybridbpm.ui.component.development.FieldForm.java

License:Apache License

@Override
public void buttonClick(Button.ClickEvent event) {
    if (event.getButton().equals(btnShowMore)) {
        if (secondLayout.isVisible()) {
            btnShowMore.setIcon(FontAwesome.PLUS_SQUARE_O);
            btnShowMore.setDescription("Show details");
            secondLayout.setVisible(false);
        } else {/*from www.j  ava 2  s.c  o m*/
            btnShowMore.setIcon(FontAwesome.MINUS_SQUARE_O);
            btnShowMore.setDescription("Hide details");
            secondLayout.setVisible(true);
        }
    } else if (event.getButton().equals(btnRemove)) {
        ((VerticalLayout) getParent()).removeComponent(this);
    } else if (event.getButton().equals(btnUp)) {
        int index = ((VerticalLayout) getParent()).getComponentIndex(this);
        if (index != 0) {
            Component upComponent = ((VerticalLayout) getParent()).getComponent(index - 1);
            ((VerticalLayout) getParent()).replaceComponent(upComponent, this);
        }
    }
    if (event.getButton().equals(btnDown)) {
        int index = ((VerticalLayout) getParent()).getComponentIndex(this);
        if (((VerticalLayout) getParent()).getComponentCount() > 2
                && index < ((VerticalLayout) getParent()).getComponentCount() - 1) {
            Component downComponent = ((VerticalLayout) getParent()).getComponent(index + 1);
            if (downComponent instanceof FieldForm) {
                ((VerticalLayout) getParent()).replaceComponent(downComponent, this);
            }
        }
    }
}

From source file:com.hybridbpm.ui.component.development.FieldForm.java

License:Apache License

private void prepareComponents() {
    className.setCaption("Data type");
    className.setContainerDataSource(getClassesContainer());
    className.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
    className.setItemCaptionPropertyId(NAME);
    className.setWidth(100, Unit.PERCENTAGE);
    className.addValueChangeListener(new ClassChangeListener());

    name.setCaption("Name");
    name.setWidth(100, Unit.PERCENTAGE);
    name.setNullRepresentation("");
    name.setRequired(true);/* w ww. ja  va 2s.  com*/
    name.setImmediate(true);
    name.addValueChangeListener(new NameChangeListener());

    description.setCaption("Description");
    description.setWidth(100, Unit.PERCENTAGE);
    description.setNullRepresentation("");

    defaultValue.setCaption("Default Value");
    defaultValue.setWidth(100, Unit.PERCENTAGE);
    defaultValue.setNullRepresentation("");

    collection.setCaption("Collection");
    collection.setContainerDataSource(getCollectionContainer());
    collection.setNewItemsAllowed(false);
    collection.setNullSelectionAllowed(false);
    collection.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
    collection.setItemCaptionPropertyId(NAME);
    collection.setWidth(100, Unit.PERCENTAGE);

    editor.setCaption("Editor");
    editor.setContainerDataSource(getEditorContainer());
    editor.setNewItemsAllowed(false);
    editor.setNullSelectionAllowed(false);
    editor.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
    editor.setItemCaptionPropertyId(NAME);
    editor.setWidth(100, Unit.PERCENTAGE);
    editor.setVisible(!Objects.equals(classListType, CLASS_LIST_TYPE.COMPLEX_DATA));

    btnShowMore.setHeight(100, Unit.PERCENTAGE);
    btnShowMore.setIcon(FontAwesome.PLUS_SQUARE_O);
    btnShowMore.setDescription("Show more details");
    btnShowMore.addStyleName(ValoTheme.BUTTON_LINK);

    btnRemove.setHeight(100, Unit.PERCENTAGE);
    btnRemove.setIcon(FontAwesome.TIMES_CIRCLE);
    btnRemove.addStyleName(ValoTheme.BUTTON_LINK);

    btnUp.setHeight(100, Unit.PERCENTAGE);
    btnUp.setIcon(FontAwesome.ARROW_CIRCLE_UP);
    btnUp.addStyleName(ValoTheme.BUTTON_LINK);

    btnDown.setHeight(100, Unit.PERCENTAGE);
    btnDown.setIcon(FontAwesome.ARROW_CIRCLE_DOWN);
    btnDown.addStyleName(ValoTheme.BUTTON_LINK);
}

From source file:org.opencms.ui.dialogs.permissions.CmsPermissionView.java

License:Open Source License

/**
 * Constructor.<p>/*ww  w.j av a 2  s  . com*/
 *
 * @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.opencms.ui.dialogs.permissions.CmsPermissionView.java

License:Open Source License

/**
 * Toggles the details display.<p>
 *///  www  .j a  v a 2s  .  co  m
void toggleDetails() {

    if (m_permissions.isVisible()) {
        m_permissions.setVisible(false);
        m_details.setIcon(FontAwesome.PLUS_SQUARE_O);
    } else {
        m_permissions.setVisible(true);
        m_details.setIcon(FontAwesome.MINUS_SQUARE_O);
    }
    m_changeHandler.onViewChange();
}