Package com.vaadin.server

Examples of com.vaadin.server.ThemeResource


        cb.addContainerProperty("icon", Resource.class, null);
        for (int i = 1; i < 200 + 1; i++) {
            Item item = cb.addItem(i);
            item.getItemProperty("caption").setValue("Item " + i);
            item.getItemProperty("icon").setValue(
                    new ThemeResource("../runo/icons/16/users.png"));
        }
        cb.setItemIconPropertyId("icon");
        cb.setItemCaptionPropertyId("caption");
        return cb;
    }
View Full Code Here


        componentIcon.setEnabled(false);
        componentIcon.addListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                if (componentIcon.getValue() != null) {
                    target.setIcon(new ThemeResource(componentIcon.getValue()
                            .toString()));
                } else {
                    target.setIcon(null);
                }
            }
View Full Code Here

                    public void execute(ComboBox c, String value, Object data) {
                        for (Object id : c.getItemIds()) {
                            if (value == null) {
                                c.setItemIcon(id, null);
                            } else {
                                c.setItemIcon(id, new ThemeResource(value + "?"
                                        + new Date().getTime()));
                            }
                        }
                    }
                });
View Full Code Here

        HierarchicalContainer hwContainer = new HierarchicalContainer();
        // Create containerproperty for name
        hwContainer.addContainerProperty(hw_PROPERTY_NAME, String.class, null);
        // Create containerproperty for icon
        hwContainer.addContainerProperty(hw_PROPERTY_ICON, ThemeResource.class,
                new ThemeResource("../runo/icons/16/document.png"));
        for (int i = 0; i < hardware.length; i++) {
            // Add new item
            item = hwContainer.addItem(itemId);
            // Add name property for item
            item.getItemProperty(hw_PROPERTY_NAME).setValue(hardware[i][0]);
            // Allow children
            hwContainer.setChildrenAllowed(itemId, true);
            itemId++;
            for (int j = 1; j < hardware[i].length; j++) {
                if (j == 1) {
                    item.getItemProperty(hw_PROPERTY_ICON).setValue(
                            new ThemeResource("../runo/icons/16/folder.png"));
                }
                // Add child items
                item = hwContainer.addItem(itemId);
                item.getItemProperty(hw_PROPERTY_NAME).setValue(hardware[i][j]);
                hwContainer.setParent(itemId, itemId - j);
View Full Code Here

    protected void setIcon(boolean value) {
        for (AbstractField<?> c : components) {
            if (!value) {
                c.setIcon(null);
            } else {
                c.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
            }
        }

    }
View Full Code Here

        addTestComponent(m);
    }

    private Resource getIcon() {
        return new ThemeResource("../runo/icons/16/user.png");
    }
View Full Code Here

        main.setSizeFull();
        setMainWindow(main);
        main.getContent().setSizeFull();

        MenuBar menuBar = new MenuBar();
        menuBar.addItem("Test", new ThemeResource("icons/16/calendar.png"),
                null);
        menuBar.addItem("ABC", new ThemeResource("icons/16/document.png"), null);
        menuBar.addItem("123", new ThemeResource("icons/16/help.png"), null);

        main.addComponent(menuBar);
        ((VerticalLayout) main.getContent()).setComponentAlignment(menuBar,
                Alignment.TOP_RIGHT);
View Full Code Here

        // Create form for editing address
        final Form f = new Form();
        f.setItemDataSource(new BeanItem<Address>(address, new String[] {
                "name", "street", "zip", "city", "state", "country" }));
        f.setCaption("Office address");
        f.setIcon(new ThemeResource("../runo/icons/16/document.png"));
        f.setDescription("Jep jpe, this is form description.");
        mainWin.addComponent(f);

        // Select to use buffered mode for editing to enable commit and discard
        f.setBuffered(true);
        Button commit = new Button("Commit", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                f.commit();
            }
        });
        Button discard = new Button("Discard", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                f.discard();
            }

        });
        HorizontalLayout ol = new HorizontalLayout();
        ol.setHeight("3em");
        ol.addComponent(commit);
        ol.setComponentAlignment(commit, Alignment.TOP_RIGHT);
        ol.addComponent(discard);
        f.setFooter(ol);

        // Add some validators for the form
        f.getField("zip").addValidator(
                new IntegerValidator("'{0}' is not a number"));
        ((AbstractComponent) f.getField("zip")).setDescription("Jepjep");
        ((AbstractComponent) f.getField("zip")).setIcon(new ThemeResource(
                "../runo/icons/16/folder.png"));
        f.getField("state").addValidator(new IsValidState());
        f.getField("name").setRequired(true);
        f.getField("street").setRequired(true);
        f.getField("city").setRequired(true);
View Full Code Here

                return AcceptAll.get();
            }

        });

        tree.setItemIcon("Item 1", new ThemeResource(
                "../runo/icons/32/folder.png"));
        tree.setItemIcon("Item 3", new ThemeResource(
                "../runo/icons/32/document.png"));
        tree.setItemIcon("Item 13", new ThemeResource(
                "../runo/icons/64/user.png"));
        tree.setItemIcon("Item 72", new ThemeResource(
                "../runo/icons/64/users.png"));
        tree.setItemIcon("Item 17", new ThemeResource(
                "../runo/icons/16/document-pdf.png"));

        return tree;
    }
View Full Code Here

    private ComboBox createComboBox(String caption) {
        ComboBox cb = new ComboBox(caption);
        cb.setImmediate(true);
        cb.addItem(1);
        cb.setItemCaption(1, "icon test");
        cb.setItemIcon(1, new ThemeResource("menubar/img/checked.png"));
        return cb;
    }
View Full Code Here

TOP

Related Classes of com.vaadin.server.ThemeResource

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.