Example usage for com.vaadin.ui Component setIcon

List of usage examples for com.vaadin.ui Component setIcon

Introduction

In this page you can find the example usage for com.vaadin.ui Component setIcon.

Prototype

public void setIcon(Resource icon);

Source Link

Document

Sets the icon of the component.

Usage

From source file:com.esofthead.mycollab.module.crm.view.CrmVerticalTabsheet.java

License:Open Source License

@Override
protected void setDefaulButtonIcon(Component btn, Boolean selected) {
    ButtonTabImpl btnTabImpl = (ButtonTabImpl) btn;
    String tabId = btnTabImpl.getTabId();

    Resource resource = CrmAssetsManager.getAsset(tabId);
    btn.setIcon(resource);

}

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

License:Open Source License

@Override
protected void setDefaulButtonIcon(Component btn, Boolean selected) {
    ButtonTabImpl btnTabImpl = (ButtonTabImpl) btn;
    String tabId = btnTabImpl.getTabId();

    Resource resource = ProjectAssetsManager.getAsset(tabId);
    btn.setIcon(resource);
}

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

License:Open Source License

@Override
protected void setDefaulButtonIcon(Component btn, Boolean selected) {
    ButtonTabImpl btnTabImpl = (ButtonTabImpl) btn;
    String tabId = btnTabImpl.getTabId();

    Resource resource = SettingAssetsManager.getAsset(tabId);
    btn.setIcon(resource);
}

From source file:com.foc.vaadin.gui.FocXMLGuiComponentStatic.java

License:Apache License

public static void applyAttributes(FocXMLGuiComponent xmlComponent, Attributes attributes) {
    if (attributes != null && xmlComponent != null) {
        try {/*from ww w .j  a  v a2 s  . c om*/
            Component component = (Component) xmlComponent;

            String visible = attributes.getValue(FXML.ATT_VISIBLE);
            if (visible != null) {
                if (visible.equals("false")) {
                    component.setVisible(false);
                } else {
                    component.setVisible(true);
                }
            }

            String captionMode = attributes.getValue(FXML.ATT_CAPTION_MODE);
            if (captionMode != null) {
                if (captionMode.equals("vertical")) {
                    component.addStyleName("vertical");
                }
            }

            applyAttributes_WidthHeight(component, attributes);

            if (component instanceof AbstractOrderedLayout) {
                String spacing = attributes.getValue(FXML.ATT_SPACING);
                if (spacing == null || spacing.equals("false")) {
                    ((AbstractOrderedLayout) component).setSpacing(false);
                } else {
                    ((AbstractOrderedLayout) component).setSpacing(true);
                }
            }

            if (component instanceof AbstractLayout) {
                String margin = attributes.getValue(FXML.ATT_MARGIN);
                if (Globals.isValo()) {
                    if (margin != null && margin.equals("true")) {
                        ((AbstractLayout) component).addStyleName("focMargin");
                    }
                } else {
                    if (margin == null || margin.equals("false")) {
                        ((AbstractLayout) component).addStyleName("focNoMargin");
                    }
                }
            }

            String description = attributes.getValue(FXML.ATT_DESCRIPTION);
            if (description != null && !description.isEmpty() && component instanceof AbstractComponent) {
                AbstractComponent abstractComponent = (AbstractComponent) component;
                abstractComponent.setDescription(description);
            }

            String caption = attributes.getValue(FXML.ATT_CAPTION);
            String captPos = attributes.getValue(FXML.ATT_CAPTION_POSITION);
            if (caption != null) {
                if (captPos != null) {
                    if (!captPos.equals("left") && !captPos.equals("right"))
                        component.setCaption(caption);
                } else {
                    component.setCaption(caption);
                }
            }

            String captMargin = attributes.getValue(FXML.ATT_CAPTION_MARGIN);
            if (captMargin != null && captMargin.equals("0")
                    && (caption == null || (captPos != null && !captPos.equals("top")))) {
                setCaptionMargin_Zero(component);
            }

            //Style Attribute
            String style = attributes.getValue(FXML.ATT_STYLE);
            applyStyle(component, style);

            xmlComponent.refreshEditable();
            if (attributes != null) {
                String border = attributes.getValue(FXML.ATT_BORDER);
                if (border != null) {
                    border = border.toLowerCase();
                    if (border.equals("true")) {
                        component.addStyleName("border");
                    } else {
                        component.addStyleName("foc-border-" + border);
                    }
                }
            }

            String tabIndexString = attributes.getValue(FXML.ATT_TABINDEX);
            if (!Utils.isStringEmpty(tabIndexString) && xmlComponent.getFormField() != null) {
                int tabIndex = Utils.parseInteger(tabIndexString, -1);
                xmlComponent.getFormField().setTabIndex(tabIndex);
            }

            String iconName = attributes.getValue(FXML.ATT_ICON);
            if (!Utils.isStringEmpty(iconName)) {
                FontIcon icon = FontAwesome.valueOf(iconName.toUpperCase());
                if (icon != null) {
                    component.setIcon(icon);
                }
            }
            if (!(component instanceof Layout) && ConfigInfo.isGuiRTL() && !(component instanceof FVTextField)
                    && !(component instanceof FVDateField) && !(component instanceof FVComboBox)
                    && !(component instanceof FVTextArea) && !(component instanceof FVObjectComboBox)
                    && !(component instanceof FVMultipleChoiceComboBox)) {
                component.addStyleName("foc-floatNone");
            }
        } catch (Exception e) {
            Globals.logException(e);
        }
    }
}

From source file:com.mycollab.module.crm.view.CrmVerticalTabsheet.java

License:Open Source License

@Override
protected void setDefaultButtonIcon(Component btn, Boolean selected) {
    ButtonTabImpl btnTabImpl = (ButtonTabImpl) btn;
    String tabId = btnTabImpl.getTabId();

    Resource resource = CrmAssetsManager.getAsset(tabId);
    btn.setIcon(resource);
}

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

License:Open Source License

@Override
protected void setDefaultButtonIcon(Component btn, Boolean selected) {
    ButtonTabImpl btnTabImpl = (ButtonTabImpl) btn;
    String tabId = btnTabImpl.getTabId();

    Resource resource = ProjectAssetsManager.getAsset(tabId);
    btn.setIcon(resource);
}

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

License:Open Source License

@Override
protected void setDefaultButtonIcon(Component btn, Boolean selected) {
    ButtonTabImpl btnTabImpl = (ButtonTabImpl) btn;
    String tabId = btnTabImpl.getTabId();
    Resource resource = SettingAssetsManager.getAsset(tabId);
    btn.setIcon(resource);
}