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.nfl.dm.clubsites.cms.articles.subapp.articleeditor.bodyeditor.BodyEditorViewImpl.java

License:Open Source License

private Layout createToolbarContentElements() {
    ThemeResource placeHolder = new ThemeResource("img/placeholder.png");
    CssLayout wrapper = new CssLayout();
    wrapper.addStyleName("toolbar-elements");
    Button addTableButton = new Button("table", new Button.ClickListener() {
        @Override/* w w  w. java2s.c o  m*/
        public void buttonClick(Button.ClickEvent event) {
            notImplemented();
        }
    });
    addTableButton.setStyleName("ax-shape-button");
    ThemeResource tableResource = new ThemeResource("img/table.png");
    addTableButton.setIcon(tableResource);

    wrapper.addComponent(addTableButton);

    Button addRuleButton = new Button("rule", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            notImplemented();
        }
    });
    addRuleButton.setStyleName("ax-shape-button");
    addRuleButton.setIcon(placeHolder);

    wrapper.addComponent(addRuleButton);

    Button addParagraphButton = new Button("section", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            listener.createSection("Section");
        }
    });
    addParagraphButton.setStyleName("ax-shape-button");
    ThemeResource sectionResource = new ThemeResource("img/section_sign.gif");
    addParagraphButton.setIcon(sectionResource);

    wrapper.addComponent(addParagraphButton);

    Button addPullQuoteButton = new Button("pullquote", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            notImplemented();
        }
    });
    addPullQuoteButton.setStyleName("ax-shape-button");
    addPullQuoteButton.setIcon(placeHolder);

    wrapper.addComponent(addPullQuoteButton);
    return wrapper;
}

From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.bodyeditor.BodyEditorViewImpl.java

License:Open Source License

private Layout createToolbarAssetsElements() {
    final CssLayout wrapper = new CssLayout();
    wrapper.addStyleName("toolbar-elements");

    final Button addPhotographButton = new Button("photograph");
    addPhotographButton.addClickListener(new Button.ClickListener() {
        @Override//from   w w w . j  a va  2 s .  c  o  m
        public void buttonClick(Button.ClickEvent event) {
            listener.openMediaGallery();
        }
    });
    addPhotographButton.setStyleName("ax-shape-button");
    ThemeResource sectionResource = new ThemeResource("img/photograph.png");
    addPhotographButton.setIcon(sectionResource);
    wrapper.addComponent(addPhotographButton);

    List<String> assetElements = Arrays.asList(new String[] { "video", "poll", "related link", "iFrame" });
    for (String name : assetElements) {
        Button addButton = new Button(name, new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                notImplemented();
            }
        });
        addButton.setStyleName("ax-shape-button");
        ThemeResource tableResource = new ThemeResource("img/placeholder.png");
        addButton.setIcon(tableResource);

        wrapper.addComponent(addButton);
    }

    return wrapper;
}

From source file:com.ocs.dynamo.ui.component.BaseBanner.java

License:Apache License

/**
 * Constructor/*  ww w . j av a 2  s.  co  m*/
 * 
 * @param imagePath
 *            the path to the image
 */
public BaseBanner(String imagePath) {
    super(true, false, false);
    this.imagePath = imagePath;

    setId("banner");
    setSizeFull();

    image = new Image(null, new ThemeResource(imagePath));
    image.setWidth(null);
    addComponent(image);
    setComponentAlignment(image, Alignment.MIDDLE_LEFT);
}

From source file:com.parship.roperty.ui.LoginUI.java

License:Apache License

@AutoGenerated
private HorizontalLayout buildHorizontalLayout_1() {
    // common part: create layout
    horizontalLayout_1 = new HorizontalLayout();
    horizontalLayout_1.setImmediate(false);
    horizontalLayout_1.setWidth("-1px");
    horizontalLayout_1.setHeight("-1px");
    horizontalLayout_1.setMargin(false);

    // logoImage/*from w  ww  .j a  va 2 s.  c o m*/
    logoImage = new Embedded();
    logoImage.setImmediate(false);
    logoImage.setWidth("-1px");
    logoImage.setHeight("-1px");
    logoImage.setSource(new ThemeResource("img/component/embedded_icon.png"));
    logoImage.setType(1);
    logoImage.setMimeType("image/jpg");
    horizontalLayout_1.addComponent(logoImage);

    return horizontalLayout_1;
}

From source file:com.peergreen.webconsole.vaadin.tabs.DefaultTab.java

License:Open Source License

/**
 * Add extension shortcut to the default tab content
 *
 * @param extension     extension object
 * @param extensionName extension name/*ww  w . j  a  v a  2 s  . c  o  m*/
 */
public void addExtension(Component extension, final String extensionName) {
    addExtension(extension, extensionName, new ThemeResource("img/default-module-icon.png"));
}

From source file:com.rex.components.valo.ComboBoxes.java

License:Apache License

public ComboBoxes() {
    setMargin(true);//from   w w w  .jav a2  s  .  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(ReportEngineUI.generateContainer(200, false));
    combo.setNullSelectionAllowed(false);
    combo.select(combo.getItemIds().iterator().next());
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.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(ReportEngineUI.generateContainer(200, false));
    combo.setNullSelectionAllowed(false);
    combo.select(combo.getItemIds().iterator().next());
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.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(ReportEngineUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY);
    combo.addStyleName("color1");
    row.addComponent(combo);

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

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

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

    combo = new ComboBox("Large");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.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(ReportEngineUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY);
    combo.addStyleName("tiny");
    row.addComponent(combo);

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

From source file:com.scsb.crpro.MessageBox.java

License:Apache License

/**
 * Similar to {@link #MessageBox(Window, String, Icon, String, Alignment, ButtonConfig...)},
 * but the message component is defined explicitly. The component can be even a composite
 * of a layout manager and manager further Vaadin components.
 * /*from   ww  w  . j  ava  2  s.  c om*/
 * @param messageComponent a Vaadin component
 */
public MessageBox(String dialogWidth, String dialogHeight, String dialogCaption, Icon dialogIcon,
        Component messageComponent, Alignment buttonsAlignment, ButtonConfig... buttonConfigs) {
    super();
    setResizable(false);
    setClosable(false);
    setSizeUndefined();
    setWidth(dialogWidth);
    //setHeight(dialogHeight);
    setCaption(dialogCaption);

    GridLayout mainLayout = new GridLayout(2, 2);
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainLayout.setSizeUndefined();
    mainLayout.setWidth(GRID_DEFAULT_WIDTH1);

    // Add Content
    messageComponent.setSizeUndefined();
    messageComponent.setWidth(GRID_DEFAULT_WIDTH2);
    if (dialogIcon == null || Icon.NONE.equals(dialogIcon)) {
        mainLayout.addComponent(messageComponent, 0, 0, 1, 0);
        mainLayout.setRowExpandRatio(0, 1.0f);
        mainLayout.setColumnExpandRatio(0, 1.0f);
    } else {
        mainLayout.addComponent(messageComponent, 1, 0);
        mainLayout.setRowExpandRatio(0, 1.0f);
        mainLayout.setColumnExpandRatio(1, 1.0f);

        Embedded icon = null;
        switch (dialogIcon) {
        case QUESTION:
            icon = new Embedded(null, new ThemeResource("images/question.png"));
            break;
        case INFO:
            icon = new Embedded(null, new ThemeResource("images/info.png"));
            break;
        case WARN:
            icon = new Embedded(null, new ThemeResource("images/warn.png"));
            break;
        case ERROR:
            icon = new Embedded(null, new ThemeResource("images/error.png"));
            break;
        }
        mainLayout.addComponent(icon, 0, 0);
        icon.setWidth(ICON_DEFAULT_SIZE);
        icon.setHeight(ICON_DEFAULT_SIZE);
    }

    // Add Buttons
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    mainLayout.addComponent(buttonLayout, 0, 1, 1, 1);
    mainLayout.setComponentAlignment(buttonLayout, buttonsAlignment);
    for (ButtonConfig buttonConfig : buttonConfigs) {
        Button button = new Button(buttonConfig.getCaption(),
                new ButtonClickListener(buttonConfig.getButtonType()));
        if (buttonConfig.getWidth() != null) {
            button.setWidth(buttonConfig.getWidth());
        }
        if (buttonConfig.getOptionalResource() != null) {
            button.setIcon(buttonConfig.getOptionalResource());
        } else {
            Resource icon = null;
            switch (buttonConfig.getButtonType()) {
            case ABORT:
                icon = new ThemeResource("images/famfamfam/cross.png");
                break;
            case CANCEL:
                icon = new ThemeResource("images/famfamfam/cross.png");
                break;
            case CLOSE:
                icon = new ThemeResource("images/famfamfam/door.png");
                break;
            case HELP:
                icon = new ThemeResource("images/famfamfam/lightbulb.png");
                break;
            case OK:
                icon = new ThemeResource("images/famfamfam/tick.png");
                break;
            case YES:
                icon = new ThemeResource("images/famfamfam/tick.png");
                break;
            case NO:
                icon = new ThemeResource("images/famfamfam/cross.png");
                break;
            case SAVE:
                icon = new ThemeResource("images/famfamfam/disk.png");
                break;
            case RETRY:
                icon = new ThemeResource("images/famfamfam/arrow_refresh.png");
                break;
            case IGNORE:
                icon = new ThemeResource("images/famfamfam/lightning_go.png");
                break;
            }
            button.setIcon(icon);
        }
        buttonLayout.addComponent(button);
    }

    setContent(mainLayout);
}

From source file:com.scsb.vaadin.composite.MessageBox.java

License:Apache License

/**
 * Similar to {@link #MessageBox(Window, String, Icon, String, Alignment, ButtonConfig...)},
 * but the message component is defined explicitly. The component can be even a composite
 * of a layout manager and manager further Vaadin components.
 * /*from  w ww . ja  v a2 s .c o  m*/
 * @param messageComponent a Vaadin component
 */
public MessageBox(String dialogWidth, String dialogHeight, String dialogCaption, Icon dialogIcon,
        Component messageComponent, Alignment buttonsAlignment, ButtonConfig... buttonConfigs) {
    super();
    setResizable(false);
    setClosable(false);
    setSizeUndefined();
    setWidth(dialogWidth);
    //setHeight(dialogHeight);
    setCaption(dialogCaption);

    GridLayout mainLayout = new GridLayout(2, 2);
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainLayout.setSizeUndefined();
    mainLayout.setWidth(GRID_DEFAULT_WIDTH1);

    // Add Content
    messageComponent.setSizeUndefined();
    messageComponent.setWidth(GRID_DEFAULT_WIDTH2);
    if (dialogIcon == null || Icon.NONE.equals(dialogIcon)) {
        mainLayout.addComponent(messageComponent, 0, 0, 1, 0);
        mainLayout.setRowExpandRatio(0, 1.0f);
        mainLayout.setColumnExpandRatio(0, 1.0f);
    } else {
        mainLayout.addComponent(messageComponent, 1, 0);
        mainLayout.setRowExpandRatio(0, 1.0f);
        mainLayout.setColumnExpandRatio(1, 1.0f);

        Embedded icon = null;
        switch (dialogIcon) {
        case QUESTION:
            icon = new Embedded(null, new ThemeResource("./images/question.png"));
            break;
        case INFO:
            icon = new Embedded(null, new ThemeResource("./images/info.png"));
            break;
        case WARN:
            icon = new Embedded(null, new ThemeResource("./images/warn.png"));
            break;
        case ERROR:
            icon = new Embedded(null, new ThemeResource("./images/error.png"));
            break;
        }
        mainLayout.addComponent(icon, 0, 0);
        icon.setWidth(ICON_DEFAULT_SIZE);
        icon.setHeight(ICON_DEFAULT_SIZE);
    }

    // Add Buttons
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    mainLayout.addComponent(buttonLayout, 0, 1, 1, 1);
    mainLayout.setComponentAlignment(buttonLayout, buttonsAlignment);
    for (ButtonConfig buttonConfig : buttonConfigs) {
        Button button = new Button(buttonConfig.getCaption(),
                new ButtonClickListener(buttonConfig.getButtonType()));
        if (buttonConfig.getWidth() != null) {
            button.setWidth(buttonConfig.getWidth());
        }
        if (buttonConfig.getOptionalResource() != null) {
            button.setIcon(buttonConfig.getOptionalResource());
        } else {
            Resource icon = null;
            switch (buttonConfig.getButtonType()) {
            case ABORT:
                icon = new ThemeResource("images/famfamfam/cross.png");
                break;
            case CANCEL:
                icon = new ThemeResource("images/famfamfam/cross.png");
                break;
            case CLOSE:
                icon = new ThemeResource("images/famfamfam/door.png");
                break;
            case HELP:
                icon = new ThemeResource("images/famfamfam/lightbulb.png");
                break;
            case OK:
                icon = new ThemeResource("images/famfamfam/tick.png");
                break;
            case YES:
                icon = new ThemeResource("images/famfamfam/tick.png");
                break;
            case NO:
                icon = new ThemeResource("images/famfamfam/cross.png");
                break;
            case SAVE:
                icon = new ThemeResource("images/famfamfam/disk.png");
                break;
            case RETRY:
                icon = new ThemeResource("images/famfamfam/arrow_refresh.png");
                break;
            case IGNORE:
                icon = new ThemeResource("images/famfamfam/lightning_go.png");
                break;
            }
            button.setIcon(icon);
        }
        buttonLayout.addComponent(button);
    }

    setContent(mainLayout);
}

From source file:com.selzlein.lojavirtual.vaadin.core.NavigationMenu.java

License:Open Source License

private void buildUserMenu() {
    Command logoutCmd = new Command() {

        private static final long serialVersionUID = 1L;

        @Override//from   w  w  w.j ava 2  s  . c  o m
        public void menuSelected(MenuItem selectedItem) {
            ui.logout();
        }
    };
    Command settingsCmd = new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            ui.navigateTo(SettingsView.ID);
        }
    };
    Command mobileMenu = new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            removeMenuStyles();
            ui.addStyleName(MENU_MOBILE);
            user.setSetting("l-menu", MENU_MOBILE);
            mobileMenuStyleItem.setStyleName("l-hidden");
        }
    };
    Command tabletMenu = new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            removeMenuStyles();
            ui.addStyleName(MENU_TABLET);
            user.setSetting("l-menu", MENU_TABLET);
            tabletMenuStyleItem.setStyleName("l-hidden");
        }
    };
    Command desktopMenu = new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            removeMenuStyles();
            user.setSetting("l-menu", "");
            desktopMenuStyleItem.setStyleName("l-hidden");
        }
    };
    final MenuBar userMenu = new MenuBar();
    userMenu.addStyleName("user-menu");
    final MenuItem userMenuItem = userMenu.addItem(user.getPerson().getFullName(),
            new ThemeResource("../lsps-valo-base/img/profile-pic-300px.jpg"), null);
    mobileMenuStyleItem = userMenuItem.addItem("Mobile Menu", mobileMenu);
    tabletMenuStyleItem = userMenuItem.addItem("Tablet Menu", tabletMenu);
    desktopMenuStyleItem = userMenuItem.addItem("Desktop Menu", desktopMenu);
    userMenuItem.addSeparator();
    MenuItem currentItem = userMenuItem.addItem(ui.getMessage(SettingsView.TITLE), settingsCmd);
    currentItem.setStyleName("l-menu-settings");
    currentItem = userMenuItem.addItem(ui.getMessage("nav.logout", ""), logoutCmd);
    currentItem.setStyleName("l-menu-logout");
    this.addComponent(userMenu);
}

From source file:com.selzlein.lojavirtual.vaadin.page.TodoListView.java

License:Open Source License

@SuppressWarnings("serial")
private void createView() {
    final LspsUI ui = (LspsUI) getUI();

    setTitle(ui.getMessage(TITLE));/*  w w  w.  java  2  s . c o  m*/

    VerticalLayout layout = new VerticalLayout();
    setContent(layout);

    table = new Table();
    table.setSizeFull();
    table.setSelectable(true);
    table.setMultiSelectMode(MultiSelectMode.SIMPLE);
    table.setSortEnabled(false);
    table.setColumnReorderingAllowed(true);
    table.setColumnCollapsingAllowed(true);

    table.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            final Object sel = event.getProperty().getValue();
            if (sel instanceof Set) {
                selection = (Set<Long>) sel;
            } else if (sel instanceof Long) {
                selection = Collections.singleton((Long) sel);
            } else {
                selection = Collections.emptySet();
            }

            //enable todo actions only if the sel is non-empty
            actionBtn.setEnabled(selection.size() > 0);
        }
    });
    table.addItemClickListener(new ItemClickListener() {

        @Override
        public void itemClick(ItemClickEvent event) {
            if (table.isMultiSelect()) {
                return; //don't do anything if in selection mode
            }
            if (event.getButton() != MouseButton.LEFT || event.isDoubleClick()) {
                return; //ignore right-clicks
            }

            final Item item = event.getItem();
            final Long todoId = (Long) item.getItemProperty("id").getValue();
            try {
                ((LspsUI) getUI()).openTodo(todoId);
            } catch (Exception e) {
                Utils.log(e, "could not open to-do " + todoId, log);
                final LspsUI ui = (LspsUI) getUI();
                ui.showErrorMessage("app.unknownErrorOccurred", e); //todo.openFailed?
            }
        }
    });

    table.setContainerDataSource(container);

    Object[] defaultColumns = new Object[] { "title", "notes", "priority", "authorization", "modelInstanceId",
            "issuedDate" };
    //load table settings
    String settings = ui.getUser().getSettingString(SETTINGS_KEY, null);
    if (settings == null) {
        table.setVisibleColumns(defaultColumns);
        originalSettings = getColumnSettings();
    } else {
        originalSettings = settings;
        try {
            applyTableSettings(settings);
        } catch (Exception e) {
            table.setVisibleColumns(defaultColumns);
            Utils.log(e, "could not load todo list settings", log);
        }
    }

    table.setColumnHeader("title", ui.getMessage("todo.title"));
    table.setColumnHeader("notes", ui.getMessage("todo.notes"));
    table.setColumnHeader("priority", ui.getMessage("todo.priority"));
    table.setColumnHeader("authorization", ui.getMessage("todo.authorizationShort"));
    table.setColumnHeader("modelInstanceId", ui.getMessage("todo.process"));
    table.setColumnHeader("issuedDate", ui.getMessage("todo.issued"));

    table.setColumnAlignment("modelInstanceId", Table.Align.CENTER);
    if (table.getItemIds().size() > 0) {
        table.setColumnExpandRatio("title", 2);
        table.setColumnExpandRatio("notes", 1);
    }

    //localize todo titles
    table.addGeneratedColumn("title", new ColumnGenerator() {

        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            @SuppressWarnings("unchecked")
            BeanItem<Todo> item = (BeanItem<Todo>) source.getItem(itemId);
            return ui.localizeEngineText(item.getBean().getTitle());
        }
    });

    //show icons for authorization
    table.addGeneratedColumn("authorization", new ColumnGenerator() {

        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            @SuppressWarnings("unchecked")
            BeanItem<Todo> item = (BeanItem<Todo>) source.getItem(itemId);
            String icon;
            String text;
            switch (item.getBean().getAuthorization()) {
            case INITIAL_PERFORMER:
                icon = "auth_performer.gif";
                text = ui.getMessage("todo.authorizationPerformer");
                break;
            case DELEGATE:
                icon = "auth_delegate.gif";
                text = ui.getMessage("todo.authorizationDelegate");
                break;
            case SUBSTITUTE:
                icon = "auth_substitute.gif";
                text = ui.getMessage("todo.authorizationSubstitute");
                break;
            case NOT_PERMITTED:
            default:
                icon = "auth_unknown.gif";
                text = ui.getMessage("todo.authorizationUnknown");
                break;
            }
            Embedded authIcon = new Embedded(null, new ThemeResource("../icons/" + icon));
            authIcon.setDescription(text);

            if (item.getBean().getAllocatedTo() != null) {
                HorizontalLayout layout = new HorizontalLayout();
                layout.setSpacing(true);

                layout.addComponent(authIcon);

                Embedded lockedIcon = new Embedded(null, new ThemeResource("../icons/lock.gif"));
                lockedIcon.setDescription(
                        ui.getMessage("todo.lockedBy", item.getBean().getAllocatedToFullName()));
                layout.addComponent(lockedIcon);
                return layout;
            } else {
                return authIcon;
            }
        }
    });

    //format date
    final SimpleDateFormat df = new SimpleDateFormat(ui.getMessage("app.dateTimeFormat"));
    table.addGeneratedColumn("issuedDate", new ColumnGenerator() {

        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            @SuppressWarnings("unchecked")
            BeanItem<Todo> item = (BeanItem<Todo>) source.getItem(itemId);
            return df.format(item.getBean().getIssuedDate());
        }
    });

    layout.addComponent(table);
    layout.setExpandRatio(table, 1);
}