Example usage for com.vaadin.server ThemeResource ThemeResource

List of usage examples for com.vaadin.server ThemeResource ThemeResource

Introduction

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

Prototype

public ThemeResource(String resourceId) 

Source Link

Document

Creates a resource.

Usage

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

License:Open Source License

private void initUI() {
    this.setStyleName("login-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);//from w  w w. ja  v  a  2 s.co m
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    Label welcomeText = new Label("Login to CRM");
    welcomeText.setWidth("150px");
    welcomeTextWrapper.addComponent(welcomeText);
    contentLayout.addComponent(welcomeTextWrapper);

    final EmailField emailField = new EmailField();
    emailField.setWidth("100%");
    emailField.setInputPrompt("E-mail Address");
    emailField.setStyleName("email-input");
    contentLayout.addComponent(emailField);

    final PasswordField pwdField = new PasswordField();
    pwdField.setWidth("100%");
    pwdField.setInputPrompt("Password");
    pwdField.setStyleName("password-input");
    contentLayout.addComponent(pwdField);

    final CheckBox rememberPassword = new CheckBox();
    rememberPassword.setWidth("100%");
    rememberPassword.setCaption("Remember password");
    rememberPassword.setValue(true);
    contentLayout.addComponent(rememberPassword);

    Button signInBtn = new Button("Sign In");
    signInBtn.setWidth("100%");
    signInBtn.addStyleName(UIConstants.BUTTON_BIG);
    signInBtn.addStyleName(UIConstants.COLOR_BLUE);
    signInBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new CrmEvent.PlainLogin(this, new String[] {
                    emailField.getValue(), pwdField.getValue(), String.valueOf(rememberPassword.getValue()) }));
        }
    });
    contentLayout.addComponent(signInBtn);

    Button createAccountBtn = new Button("Create Account");
    createAccountBtn.setWidth("100%");
    createAccountBtn.addStyleName(UIConstants.BUTTON_BIG);
    createAccountBtn.addStyleName(UIConstants.COLOR_GRAY);
    contentLayout.addComponent(createAccountBtn);

    this.addComponent(contentLayout);
}

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

License:Open Source License

private void initUI() {
    this.setStyleName("login-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);//from  ww  w .jav a2s  . c  o  m
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    Label welcomeText = new Label("Login to Projects");
    welcomeText.setWidth("150px");
    welcomeTextWrapper.addComponent(welcomeText);
    contentLayout.addComponent(welcomeTextWrapper);

    final EmailField emailField = new EmailField();
    emailField.setWidth("100%");
    emailField.setInputPrompt("E-mail Address");
    emailField.setStyleName("email-input");
    contentLayout.addComponent(emailField);

    final PasswordField pwdField = new PasswordField();
    pwdField.setWidth("100%");
    pwdField.setInputPrompt("Password");
    pwdField.setStyleName("password-input");
    contentLayout.addComponent(pwdField);

    final CheckBox rememberPassword = new CheckBox();
    rememberPassword.setWidth("100%");
    rememberPassword.setCaption("Remember password");
    rememberPassword.setValue(true);
    contentLayout.addComponent(rememberPassword);

    Button signInBtn = new Button("Sign In");
    signInBtn.setWidth("100%");
    signInBtn.addStyleName(UIConstants.BUTTON_BIG);
    signInBtn.addStyleName(UIConstants.COLOR_BLUE);
    signInBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new ProjectEvent.PlainLogin(this, new String[] {
                    emailField.getValue(), pwdField.getValue(), String.valueOf(rememberPassword.getValue()) }));
        }
    });
    contentLayout.addComponent(signInBtn);

    Button createAccountBtn = new Button("Create Account");
    createAccountBtn.setWidth("100%");
    createAccountBtn.addStyleName(UIConstants.BUTTON_BIG);
    createAccountBtn.addStyleName(UIConstants.COLOR_GRAY);
    contentLayout.addComponent(createAccountBtn);

    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.mobile.module.user.view.LoginViewImpl.java

License:Open Source License

private void initUI() {
    this.setStyleName("login-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);/*from   w w w.  ja v a2  s  . c o  m*/
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    welcomeTextWrapper.setHeight("15px");
    Label welcomeText = new Label("Welcome Back!");
    welcomeText.setWidth("150px");
    welcomeTextWrapper.addComponent(welcomeText);
    contentLayout.addComponent(welcomeTextWrapper);

    final EmailField emailField = new EmailField();
    emailField.setWidth("100%");
    emailField.setInputPrompt("E-mail Address");
    emailField.setStyleName("email-input");
    contentLayout.addComponent(emailField);

    final PasswordField pwdField = new PasswordField();
    pwdField.setWidth("100%");
    pwdField.setInputPrompt("Password");
    pwdField.setStyleName("password-input");
    contentLayout.addComponent(pwdField);

    final CheckBox rememberPassword = new CheckBox();
    rememberPassword.setWidth("100%");
    rememberPassword.setCaption("Remember password");
    rememberPassword.setValue(true);
    contentLayout.addComponent(rememberPassword);

    Button signInBtn = new Button("Sign In");
    signInBtn.setWidth("100%");
    signInBtn.addStyleName(UIConstants.BUTTON_BIG);
    signInBtn.addStyleName(UIConstants.COLOR_BLUE);
    signInBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            ShellController.doLogin(emailField.getValue(), pwdField.getValue(), rememberPassword.getValue());
        }
    });
    contentLayout.addComponent(signInBtn);

    Button createAccountBtn = new Button("Create Account");
    createAccountBtn.setWidth("100%");
    createAccountBtn.addStyleName(UIConstants.BUTTON_BIG);
    createAccountBtn.addStyleName(UIConstants.COLOR_GRAY);
    contentLayout.addComponent(createAccountBtn);

    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.mobile.shell.ui.MainView.java

License:Open Source License

private void initUI() {
    this.setStyleName("main-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);// w w w  .j av  a 2 s.c  o m
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    welcomeTextWrapper.setHeight("15px");
    contentLayout.addComponent(welcomeTextWrapper);

    ModuleButton crmButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_CRM));
    crmButton.setWidth("100%");
    crmButton.addStyleName("crm");
    crmButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = -1218427186205574547L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null));
        }
    });

    contentLayout.addComponent(crmButton);

    ModuleButton pmButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_PROJECT));
    pmButton.setWidth("100%");
    pmButton.addStyleName("project");
    pmButton.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -5323408319082242586L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null));
        }
    });
    contentLayout.addComponent(pmButton);

    ModuleButton fileButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_DOCUMENT));
    fileButton.setWidth("100%");
    fileButton.addStyleName("document");
    contentLayout.addComponent(fileButton);

    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.mobile.shell.view.MainView.java

License:Open Source License

public MainView() {
    super();//  www.ja  v a 2s .  c  o  m
    this.setSizeFull();

    MVerticalLayout contentLayout = new MVerticalLayout().withStyleName("content-wrapper").withFullWidth();
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    welcomeTextWrapper.setHeight("15px");
    contentLayout.addComponent(welcomeTextWrapper);

    Button crmButton = new Button(AppContext.getMessage(GenericI18Enum.MODULE_CRM), new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null));
        }
    });
    crmButton.addStyleName(UIConstants.BUTTON_ACTION);
    crmButton.setWidth("100%");

    contentLayout.addComponent(crmButton);

    Button pmButton = new Button(AppContext.getMessage(GenericI18Enum.MODULE_PROJECT),
            new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent clickEvent) {
                    EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null));
                }
            });
    pmButton.setWidth("100%");
    pmButton.addStyleName(UIConstants.BUTTON_ACTION);
    contentLayout.addComponent(pmButton);

    this.addComponent(contentLayout);
}

From source file:com.etest.valo.ComboBoxes.java

License:Apache License

public ComboBoxes() {
    setMargin(true);/*w w  w . j a  v a  2s .  c  o  m*/

    Label h1 = new Label("Combo Boxes");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    ComboBox combo = new ComboBox("Normal");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setNullSelectionAllowed(false);
    combo.select(combo.getItemIds().iterator().next());
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.setItemIcon(combo.getItemIds().iterator().next(), new ThemeResource("../runo/icons/16/document.png"));
    row.addComponent(combo);

    CssLayout group = new CssLayout();
    group.setCaption("Grouped with a Button");
    group.addStyleName("v-component-group");
    row.addComponent(group);

    combo = new ComboBox();
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setNullSelectionAllowed(false);
    combo.select(combo.getItemIds().iterator().next());
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.setWidth("240px");
    group.addComponent(combo);
    Button today = new Button("Do It");
    group.addComponent(today);

    combo = new ComboBox("Explicit size");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setWidth("260px");
    combo.setHeight("60px");
    row.addComponent(combo);

    combo = new ComboBox("No text input allowed");
    combo.setInputPrompt("You can click here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setTextInputAllowed(false);
    combo.setNullSelectionAllowed(false);
    combo.select("Option One");
    row.addComponent(combo);

    combo = new ComboBox("Error");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setNullSelectionAllowed(false);
    combo.select("Option One");
    combo.setComponentError(new UserError("Fix it, now!"));
    row.addComponent(combo);

    combo = new ComboBox("Error, borderless");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setNullSelectionAllowed(false);
    combo.select("Option One");
    combo.setComponentError(new UserError("Fix it, now!"));
    combo.addStyleName("borderless");
    row.addComponent(combo);

    combo = new ComboBox("Disabled");
    combo.setInputPrompt("You can't type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setEnabled(false);
    row.addComponent(combo);

    combo = new ComboBox("Custom color");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("color1");
    row.addComponent(combo);

    combo = new ComboBox("Custom color");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("color2");
    row.addComponent(combo);

    combo = new ComboBox("Custom color");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("color3");
    row.addComponent(combo);

    combo = new ComboBox("Small");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("small");
    row.addComponent(combo);

    combo = new ComboBox("Large");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("large");
    row.addComponent(combo);

    combo = new ComboBox("Borderless");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.addStyleName("borderless");
    row.addComponent(combo);

    combo = new ComboBox("Tiny");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("tiny");
    row.addComponent(combo);

    combo = new ComboBox("Huge");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("huge");
    row.addComponent(combo);
}

From source file:com.foc.vaadin.FocWebVaadinWindow.java

License:Apache License

protected Component newLogoEmbedded() {
    //      Button iconButton = new Button();
    //      setStyleName(BaseTheme.BUTTON_LINK);
    //      iconButton.addClickListener(new ClickListener() {
    //         @Override
    //         public void buttonClick(ClickEvent event) {
    //            
    //         }/*from  ww  w .j av a2  s. c  o  m*/
    //      });
    //      iconButton.setIcon(new ThemeResource("img/logo.png"));
    //      iconButton.addStyleName("foc-UpperLogo");
    //      return iconButton;

    Link iconLink = new Link();
    //      iconLink.setIcon(new ThemeResource("img/everpro_logo.png"));

    iconLink.setIcon(new ThemeResource("img/logo.png"));
    String logoURL = getLogoURL();
    if (logoURL != null) {
        iconLink.setResource(new ExternalResource(logoURL));
    }

    //      iconLink.setStyleName("everproLogo");
    iconLink.setStyleName("foc-UpperLogo");

    return iconLink;
}

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   w  w w. j  a v  a2  s.  c  om
    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.foc.vaadin.gui.components.TableTreeDelegate.java

License:Apache License

private Object getDisplayObject_ForProperty_NonEditable(FProperty property, FVTableColumn column) {
    Object objReturned = null;//from ww w  .j  a  va 2s.c  o  m
    if (property != null) {
        objReturned = property.vaadin_TableDisplayObject(null, 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"));
            }
        } else if (property instanceof FObject || property instanceof FDate || property instanceof FString
                || property instanceof FDouble) {

            FVLabel lbl = null;
            String styleAttrib = column.getAttributes().getValue(FXML.ATT_STYLE);
            if (styleAttrib != null && !styleAttrib.isEmpty()) {
                lbl = new FVLabel((String) objReturned);
                lbl.parseStyleAttributeValue(styleAttrib);
                objReturned = lbl;
            } else if (property instanceof FDouble) {
                lbl = new FVLabel((String) objReturned);
                lbl.addStyleName("foc-text-right");
                objReturned = lbl;
            }

        } else {
            objReturned = property;
        }
    }

    return objReturned;
}

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

License:Apache License

public Embedded getFVIcon(String iconName, boolean dispLayCaption) {
    Resource iconResourse = new ThemeResource("../" + THEME_DIR + "/icons/" + iconName);

    Embedded embedded = new Embedded(null, iconResourse);

    if (!iconName.equals(ICON_TRASH_SMALL)) {
        embedded.setWidth("32px");
        embedded.setHeight("32px");
    }//w  w  w . j  ava  2s .c  o  m

    if (dispLayCaption) {
        embedded.setCaption(iconName);
    }

    return embedded;
}