Example usage for com.vaadin.server FontAwesome getHtml

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

Introduction

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

Prototype

@Override
    public String getHtml() 

Source Link

Usage

From source file:com.esofthead.mycollab.mobile.ui.FormSectionBuilder.java

License:Open Source License

public static final MHorizontalLayout build(FontAwesome icon, Component comp) {
    MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withStyleName(UIConstants.FORM_SECTION);
    layout.with(new ELabel(icon.getHtml(), ContentMode.HTML).withWidthUndefined(), comp).expand(comp);
    return layout;
}

From source file:com.esofthead.mycollab.module.project.view.AbstractProjectPageView.java

License:Open Source License

public AbstractProjectPageView(String headerText, FontAwesome icon) {
    super();//from w  w  w. j  a v  a  2  s. c  om

    this.headerText = new Label(icon.getHtml() + " " + headerText, ContentMode.HTML);
    super.addComponent(constructHeader());

    contentWrapper = new CssLayout();
    contentWrapper.setStyleName("content-wrapper");
    super.addComponent(contentWrapper);

}

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

License:Open Source License

public FontIconLabel(FontAwesome icon) {
    super(icon.getHtml(), ContentMode.HTML);
}

From source file:com.foc.vaadin.gui.components.tableAndTree.FVColGen_FocProperty.java

License:Apache License

private Object getDisplayObject_ForProperty_NonEditable(FocObject focObject, FProperty property,
        FVTableColumn column, Object columnId) {
    Object objReturned = null;//from  ww w . j a  v  a  2s  . com
    FField field = property != null ? property.getFocField() : null;
    if (property != null) {
        // Remove the editable component in case the editing status has changed
        // --------------------------------------------------------------------
        String objRef = focObject != null && focObject.getReference() != null
                ? focObject.getReference().toString()
                : null;
        String compName = TableTreeDelegate.newComponentName(getTableName(), objRef, (String) column.getName());
        FocXMLLayout focXMLLayout = getFocXMLLayout();
        if (focXMLLayout != null) {
            FocXMLGuiComponent comp = focXMLLayout.removeComponentByName(compName);
            if (comp != null) {
                comp.dispose();
            }
        }
        // --------------------------------------------------------------------
        objReturned = property.vaadin_TableDisplayObject(column.getFormat(), column.getCaptionProp());

        if (objReturned instanceof Boolean) {
            if (((Boolean) objReturned).booleanValue()) {
                objReturned = new Embedded("", new ThemeResource("../runo/icons/16/ok.png"));
            } else {
                // objReturned = new Embedded("", new
                // ThemeResource("../runo/icons/16/cancel.png"));
                objReturned = FVIconFactory.getInstance().getFVIcon_Embedded(FVIconFactory.ICON_EMPTY,
                        FVIconFactory.SIZE_SMALL);
            }
        } else if (field instanceof FCloudStorageField) {
            FCloudStorageProperty csProp = (FCloudStorageProperty) property;
            if (csProp != null) {
                FVImageField imageField = new FVImageField(csProp, column.getAttributes());
                if (imageField.getBufferedImage() == null) {
                    Resource resource = imageField.getResourceAndSetIcon();
                    if (resource != null) {
                        Button docIcon = new Button();
                        docIcon.setStyleName(Runo.BUTTON_LINK);
                        docIcon.setWidth("-1px");
                        docIcon.setHeight("-1px");
                        docIcon.setIcon(resource);
                        objReturned = docIcon;
                    }
                } else {
                    Image image = imageField.getEmbedded();
                    if (image != null) {
                        int maxWidth = 150;
                        int maxHeight = 150;
                        imageField.resizeImage(image, maxWidth, maxHeight);
                    }
                    objReturned = imageField;
                }
            }
        } else if (property instanceof FObject || property instanceof FDate || property instanceof FString
                || property instanceof FDouble || property instanceof FInt
                || property instanceof FMultipleChoice) {
            if (property instanceof FMultipleChoice) {
                objReturned = property.getString();
            }
            FVLabel lbl = null;
            String styleAttrib = column.getAttributes() != null
                    ? column.getAttributes().getValue(FXML.ATT_STYLE)
                    : null;
            int maxCharacters = column.getMaxCharacters();
            String ttt = null;

            if (styleAttrib != null && !styleAttrib.isEmpty()) {
                lbl = new FVLabel((String) objReturned);
                lbl.parseStyleAttributeValue(styleAttrib);
                objReturned = lbl;
            } else if (property instanceof FDouble
                    || (property instanceof FInt && !(property instanceof FMultipleChoice))) {
                lbl = new FVLabelInTable(property, focObject, column);
                lbl.copyMemoryToGui();
                lbl.addStyleName("foc-text-right");
                objReturned = lbl;
            }

            if (property instanceof FMultipleChoice) {
                Object itemObj = ((FMultipleChoice) property).getValue();
                if (itemObj != null && itemObj instanceof FMultipleChoiceItem) {
                    FMultipleChoiceItem item = (FMultipleChoiceItem) itemObj;
                    if (lbl == null) {
                        String iconNameInFontAwesome = item != null ? item.getIconFontAwesomeName() : null;
                        if (iconNameInFontAwesome == null) {
                            lbl = new FVLabel(item.getTitle());
                            //                        lbl.setIcon(FVIconFactory.getInstance().getFVIcon_Small(path));
                        } else {
                            FontAwesome icon = FontAwesome.valueOf(iconNameInFontAwesome);
                            lbl = new FVLabel("");
                            lbl.setCaption(null);
                            lbl.setContentMode(ContentMode.HTML);
                            lbl.setValue(item.getTitle() + " " + icon.getHtml());
                        }

                        objReturned = lbl;
                    }
                }
            }

            //If RTL I have t put the String in a label to align right
            if (lbl == null && getFocXMLLayout().isRTL()) {
                lbl = new FVLabelInTable(property, focObject, column);
                lbl.copyMemoryToGui();
                lbl.addStyleName("foc-text-right");
                objReturned = lbl;
            }

            //Setting the TTT is necessary
            //We have 2 conditions: either the objReturned is String or Label.
            //----------------------------
            if (lbl != null) {
                String originalValue = lbl.getValue();
                if (maxCharacters > 0 && originalValue != null && originalValue.length() > maxCharacters) {
                    ttt = originalValue;

                    //                  lbl.setLocale();
                    if (getFocXMLLayout().isRTL()) {
                        lbl.addStyleName("foc-cellComment-left");
                        //                     lbl.setLocale(new Locale("ar"));
                        StringBuffer buff = new StringBuffer(ttt.substring(0, maxCharacters));
                        //                     buff.append("...");
                        buff.append("...");
                        lbl.setValue(buff.toString());
                    } else {
                        lbl.addStyleName("foc-cellComment-right");
                        lbl.setValue(ttt.substring(0, maxCharacters) + "...");
                    }
                }
            } else if (objReturned instanceof String) {
                String originalValue = (String) objReturned;
                if (maxCharacters > 0 && originalValue != null && originalValue.length() > maxCharacters) {
                    ttt = originalValue;
                    if (getFocXMLLayout().isRTL()) {
                        objReturned = ttt.substring(0, maxCharacters) + "...";
                    } else {
                        objReturned = ttt.substring(0, maxCharacters) + "...";
                    }
                }
            }
            if (ttt != null && getTableTreeDelegate() != null) {
                getTableTreeDelegate().addCellTooltipText(focObject.getReference(), columnId, ttt);
            }
            //----------------------------

            if (lbl != null) {
                if (getFocXMLLayout().isRTL())
                    lbl.addStyleName("foc-text-right");
                FocXMLGuiComponent focXMLGuiComponent = lbl;
                FocXMLGuiComponentDelegate componentDelegate = focXMLGuiComponent.getDelegate();
                if (componentDelegate != null) {
                    componentDelegate.setColumnId(columnId);
                    if (focObject != null && focObject.getReference() != null) {
                        componentDelegate.setRowId(focObject.getReference().getLong());
                    }
                }
            }
            if (lbl != null && getFocXMLLayout() != null)
                getFocXMLLayout().putComponent(compName, lbl);
            FocXMLAttributes attributes = column.getAttributes();
            if (attributes != null && attributes.getValue(FXML.ATT_LINK) != null
                    && attributes.getValue(FXML.ATT_LINK).equals("true")) {
                HyperLinkButton button = new HyperLinkButton(focObject, objReturned, compName);
                button.addClickListener(hyperLinkButtonListener);
                button.addStyleName("focLinkInTable");
                objReturned = button;

                //               if(getTableTreeDelegate().getViewContainer_ForOpen() == ITableTree.VIEW_CONTAINER_NEW_BROWSER_TAB){
                //                 BrowserWindowOpener opener = null; 
                //                 opener = new BrowserWindowOpener(UI.getCurrent().getClass());
                //                opener.extend(button);
                //               }
            }
        } else {
            objReturned = property;
            //            if((property instanceof FMultipleChoice)){
            //               FocXMLAttributes attributes = column.getAttributes();
            //               if(attributes != null && attributes.getValue(FXML.ATT_LINK) != null && attributes.getValue(FXML.ATT_LINK).equals("true")){
            //                  HyperLinkButton button = new HyperLinkButton(focObject, property.getString());
            //                  button.addClickListener(hyperLinkButtonListener);
            //                  button.addStyleName("focLinkInTable");
            //                  objReturned = button;
            //               }
            //            }
        }
    }
    //      if(objReturned instanceof String){
    //         objReturned = new Label(objReturned.toString());
    //      }
    return objReturned;
}

From source file:com.mycollab.module.project.ui.components.AbstractPreviewItemComp.java

License:Open Source License

public AbstractPreviewItemComp(String headerText, FontAwesome iconResource, ReadViewLayout layout) {
    ELabel headerLbl = ELabel.h2("").withWidthUndefined();
    this.previewLayout = layout;

    header = new MHorizontalLayout().withStyleName("hdr-view").withFullWidth()
            .withMargin(new MarginInfo(true, false, true, false));
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    if (iconResource != null) {
        String title = iconResource.getHtml() + " " + headerText;
        headerLbl.setValue(title);/*  w ww  . j av a  2s .  co m*/
    } else {
        headerLbl.setValue(headerText);
    }

    if (SiteConfiguration.isCommunityEdition()) {
        header.with(headerLbl).expand(headerLbl);
    } else {
        favoriteBtn = new Button(FontAwesome.STAR);
        favoriteBtn.addClickListener(clickEvent -> toggleFavorite());

        Label spaceLbl = new Label();
        header.with(headerLbl, favoriteBtn, spaceLbl).expand(spaceLbl);
    }

    this.addComponent(header);
    ComponentContainer extraComp;
    if ((extraComp = createExtraControls()) != null) {
        this.addComponent(extraComp);
    }
    initContent();
}

From source file:com.mycollab.module.project.view.AbstractProjectPageView.java

License:Open Source License

public AbstractProjectPageView(String headerText, FontAwesome icon) {
    super();/*www  .j av  a  2 s .com*/

    this.headerText = ELabel.h2(icon.getHtml() + " " + headerText);
    super.addComponent(constructHeader());

    contentWrapper = new MCssLayout().withStyleName(WebThemes.CONTENT_WRAPPER);
    super.addComponent(contentWrapper);

}

From source file:com.mycollab.vaadin.ui.ELabel.java

License:Open Source License

public static ELabel fontIcon(FontAwesome icon) {
    return ELabel.html(icon.getHtml()).withWidthUndefined();
}

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

License:Open Source License

public AbstractPreviewItemComp(String headerText, FontAwesome iconResource, ReadViewLayout layout) {
    ELabel headerLbl = ELabel.h2("").withWidthUndefined();
    this.previewLayout = layout;

    header = new MHorizontalLayout().withStyleName("hdr-view").withFullWidth();
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    if (iconResource != null) {
        String title = iconResource.getHtml() + " " + headerText;
        headerLbl.setValue(title);/*w  w w .ja  v a 2  s.com*/
    } else {
        headerLbl.setValue(headerText);
    }

    if (SiteConfiguration.isCommunityEdition()) {
        header.with(headerLbl).expand(headerLbl);
    } else {
        favoriteBtn = new MButton("", clickEvent -> toggleFavorite()).withIcon(FontAwesome.HEART);

        Label spaceLbl = new Label();
        header.with(headerLbl, favoriteBtn, spaceLbl).expand(spaceLbl);
    }

    this.addComponent(header);
    ComponentContainer extraComp;
    if ((extraComp = createExtraControls()) != null) {
        this.addComponent(extraComp);
    }
    initContent();
}

From source file:lifetime.component.custom.LabeledInfoView.java

License:Apache License

public LabeledInfoView(String key, Object value, FontAwesome icon) {
    this.info = (value instanceof Number) ? new Label(format.format(value)) : new Label(value.toString());
    this.label = new Label(key);
    this.iconLabel = (icon == null) ? new Label() : new Label(icon.getHtml(), ContentMode.HTML);
    // customize components
    info.addStyleName("i-value");
    label.addStyleName("i-tag");
    iconLabel.addStyleName("i-icon");
    // add components to layout
    super.addComponents(this.iconLabel, this.info, this.label);
    super.setStyleName("l-info");
    super.setSizeUndefined();
    super.setSpacing(true);
}