Package com.vaadin.terminal

Examples of com.vaadin.terminal.Resource


    public static Resource getIcon(String fileName) {
        return getIconByMineType(getMIMEType(fileName));
    }

    private static Resource getIconByMineType(String mimeType) {
        final Resource icon = MIMEToIconMap.get(mimeType);
        if (icon != null) {
            return icon;
        }

        // If nothing is known about the file-type, general file
View Full Code Here


     * @return the icon corresponding to the given file
     */
    public static Resource getIcon(String fileName) {

        final String mimeType = getMIMEType(fileName);
        final Resource icon = (Resource) MIMEToIconMap.get(mimeType);
        if (icon != null) {
            return icon;
        }

        // If nothing is known about the file-type, general file
View Full Code Here

     * @return the icon corresponding to the given file
     */
    public static Resource getIcon(File file) {

        final String mimeType = getMIMEType(file);
        final Resource icon = (Resource) MIMEToIconMap.get(mimeType);
        if (icon != null) {
            return icon;
        }

        // If nothing is known about the file-type, general file
View Full Code Here

                target.addAttribute("command", true);
            } else {
                target.addAttribute("command", false);
            }

            Resource icon = item.getIcon();
            if (icon != null) {
                target.addAttribute("icon", icon);
            }

            if (item.hasChildren()) {
View Full Code Here

                && !ids.contains(getNullSelectionItemId())) {
            // Gets the option attribute values
            final Object id = getNullSelectionItemId();
            final String key = itemIdMapper.key(id);
            final String caption = getItemCaption(id);
            final Resource icon = getItemIcon(id);
            // Paints option
            target.startTag("so");
            if (icon != null) {
                target.addAttribute("icon", icon);
            }
            target.addAttribute("caption", caption);
            target.addAttribute("nullselection", true);
            target.addAttribute("key", key);
            if (isSelected(id)) {
                target.addAttribute("selected", true);
                selectedKeys[keyIndex++] = key;
            }
            target.endTag("so");
        }

        final Iterator i = getItemIds().iterator();
        // Paints the available selection options from data source
        while (i.hasNext()) {
            // Gets the option attribute values
            final Object id = i.next();
            if (!isNullSelectionAllowed() && id != null
                    && id.equals(getNullSelectionItemId())) {
                // Remove item if it's the null selection item but null
                // selection is not allowed
                continue;
            }
            final String key = itemIdMapper.key(id);
            final String caption = getItemCaption(id);
            // add listener for each item, to cause repaint if an item changes
            getCaptionChangeListener().addNotifierForItem(id);
            final Resource icon = getItemIcon(id); // Paints the option
            target.startTag("so");
            if (icon != null) {
                target.addAttribute("icon", icon);
            }
            target.addAttribute("caption", caption);
View Full Code Here

     * @param itemId
     *            the id of the item to be assigned an icon.
     * @return the Icon for the item or null, if not specified.
     */
    public Resource getItemIcon(Object itemId) {
        final Resource explicit = (Resource) itemIcons.get(itemId);
        if (explicit != null) {
            return explicit;
        }

        if (getItemIconPropertyId() == null) {
View Full Code Here

    @Override
    public void moveComponentsFrom(ComponentContainer source) {
        for (final Iterator i = source.getComponentIterator(); i.hasNext();) {
            final Component c = (Component) i.next();
            String caption = null;
            Resource icon = null;
            if (TabSheet.class.isAssignableFrom(source.getClass())) {
                caption = ((TabSheet) source).getTabCaption(c);
                icon = ((TabSheet) source).getTabIcon(c);
            }
            source.removeComponent(c);
View Full Code Here

            if (!tab.isVisible()) {
                target.addAttribute("hidden", true);
            }

            final Resource icon = tab.getIcon();
            if (icon != null) {
                target.addAttribute("icon", icon);
            }
            final String caption = tab.getCaption();
            if (caption != null && caption.length() > 0) {
View Full Code Here

        Tab newTab = tabs.get(newComponent);
        Tab oldTab = tabs.get(oldComponent);

        // Gets the captions
        String oldCaption = null;
        Resource oldIcon = null;
        String newCaption = null;
        Resource newIcon = null;

        if (oldTab != null) {
            oldCaption = oldTab.getCaption();
            oldIcon = oldTab.getIcon();
        }
View Full Code Here

            }

            // Gets the option attribute values
            final String key = itemIdMapper.key(id);
            final String caption = getItemCaption(id);
            final Resource icon = getItemIcon(id);
            getCaptionChangeListener().addNotifierForItem(id);

            // Paints the option
            target.startTag("so");
            if (icon != null) {
View Full Code Here

TOP

Related Classes of com.vaadin.terminal.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.