List of usage examples for com.vaadin.server ThemeResource ThemeResource
public ThemeResource(String resourceId)
From source file:com.jain.common.header.Header.java
License:Apache License
private void addLogo() { Embedded em = new Embedded("", new ThemeResource(IMAGES_LOGO_PNG)); addComponent(em);//w ww .ja va2 s .c o m setComponentAlignment(em, Alignment.MIDDLE_RIGHT); setExpandRatio(em, 1); }
From source file:com.klwork.explorer.project.PublicProjectListPage.java
License:Apache License
Layout buildTree() { CssLayout margin = new CssLayout(); margin.setWidth("100%"); //margin.setMargin(new MarginInfo(true, false, true, true)); // Spacing/*from www. ja va 2 s. c o m*/ margin.addComponent(new Label(" ", ContentMode.HTML)); Label text = new Label("hello,word"); text.addStyleName(Runo.LABEL_SMALL); margin.addComponent(text); text.setWidth("90%"); Tree t = new Tree(); String itemId = "?"; t.addItem(itemId); t.select(itemId); t.setItemIcon(itemId, new ThemeResource("icons/16/calendar.png")); createTreeItem(t, "(5000)", itemId); t.expandItem(itemId); String itemId2 = ""; t.addItem(itemId2); t.setItemIcon(itemId2, new ThemeResource("icons/16/document.png")); createTreeItem(t, "?(300)", itemId2); createTreeItem(t, "log", itemId2); t.expandItem(itemId2); String itemId3 = "?"; t.addItem(itemId3); t.setItemIcon(itemId3, new ThemeResource("icons/16/document.png")); createTreeItem(t, "?(3009)", itemId3); createTreeItem(t, "(40000)", itemId3); t.expandItem(itemId3); margin.addComponent(t); return margin; }
From source file:com.klwork.explorer.ui.custom.ThemeImageColumnGenerator.java
License:Apache License
public ThemeImageColumnGenerator(String imageName) { image = new ThemeResource(imageName); }
From source file:com.lst.deploymentautomation.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 . j av a2 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); 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); }
From source file:com.lst.deploymentautomation.vaadin.page.TodoListView.java
License:Open Source License
@SuppressWarnings("serial") @Override/*w w w. j av a 2 s . com*/ protected Component createHeader(Component titleComponent) { LspsUI ui = (LspsUI) getUI(); actionBtn = new MenuBar(); actionBtn.addStyleName("menu-button-action"); actionBtn.setVisible(false); //initially hidden MenuItem actions = actionBtn.addItem("", new ThemeResource("../icons/popup-menu.png"), null); final ViewAction refreshTodos = new ViewAction() { @Override public void invoke() { toggleSelectionMode(false); container.refresh(); } }; actions.addItem(ui.getMessage("action.lock"), new Command() { @Override public void menuSelected(MenuItem selectedItem) { lock(); } }); actions.addItem(ui.getMessage("action.annotate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoAnnotation(getSelectedTodoIds(), refreshTodos)); } }); actions.addSeparator(); actions.addItem(ui.getMessage("action.unlock"), new Command() { @Override public void menuSelected(MenuItem selectedItem) { unlock(); } }); actions.addItem(ui.getMessage("action.reject") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoRejection(getSelectedTodoIds(), refreshTodos)); } }); actions.addItem(ui.getMessage("action.delegate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoDelegation(getSelectedTodoIds(), refreshTodos)); } }); actions.addItem(ui.getMessage("action.escalate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoEscalation(getSelectedTodoIds(), refreshTodos)); } }); selectBtn = new Button(ui.getMessage("action.select"), new ClickListener() { @Override public void buttonClick(ClickEvent event) { toggleSelectionMode(true); } }); selectBtn.addStyleName("menu-button"); cancelBtn = new Button(ui.getMessage("action.cancel"), new ClickListener() { @Override public void buttonClick(ClickEvent event) { toggleSelectionMode(false); } }); cancelBtn.setVisible(false); //initially hidden cancelBtn.addStyleName("menu-button"); titleComponent.addStyleName("l-content-title"); HorizontalLayout layout = new HorizontalLayout(); HorizontalLayout btnLayout = new HorizontalLayout(); layout.setWidth("100%"); layout.addComponent(titleComponent); layout.addComponent(btnLayout); layout.setSpacing(true); btnLayout.addComponent(actionBtn); btnLayout.addComponent(cancelBtn); btnLayout.addComponent(selectBtn); layout.setComponentAlignment(btnLayout, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.lst.deploymentautomation.vaadin.page.TodoView.java
License:Open Source License
@SuppressWarnings("serial") @Override/*from w w w .ja v a 2 s . co m*/ protected Component createHeader(Component titleComponent) { LspsUI ui = (LspsUI) getUI(); MenuBar menu = new MenuBar(); menu.addStyleName("menu-button-action"); MenuItem actions = menu.addItem("", new ThemeResource("../icons/popup-menu.png"), null); final ViewAction closeView = new ViewAction() { @Override public void invoke() { close(); //maybe close only if the to-do is not allocated to the user anymore } }; final ViewAction refreshAnnotations = new ViewAction() { @Override public void invoke() { Todo todo = todoService.getTodo(todoHolder.getTodo().getId()); refreshAnnotations(todo); } }; actions.addItem(ui.getMessage("action.info"), new Command() { @Override public void menuSelected(MenuItem selectedItem) { //get fresh info Todo todo = todoService.getTodo(todoHolder.getTodo().getId()); getUI().addWindow(new TodoDetails(todo)); } }); actions.addSeparator(); actions.addItem(ui.getMessage("action.annotate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { //get fresh info Todo todo = todoService.getTodo(todoHolder.getTodo().getId()); getUI().addWindow(new TodoAnnotation(todo, refreshAnnotations)); } }); actions.addSeparator(); actions.addItem(ui.getMessage("action.unlock"), new Command() { @Override public void menuSelected(MenuItem selectedItem) { unlock(); } }); actions.addItem(ui.getMessage("action.reject") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoRejection(todoHolder.getTodo().getId(), closeView)); } }); actions.addItem(ui.getMessage("action.delegate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoDelegation(todoHolder.getTodo().getId(), closeView)); } }); actions.addItem(ui.getMessage("action.escalate") + "...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { getUI().addWindow(new TodoEscalation(todoHolder.getTodo().getId(), closeView)); } }); HorizontalLayout layout = new HorizontalLayout(); layout.setWidth("100%"); layout.addComponent(titleComponent); layout.setExpandRatio(titleComponent, 1); layout.addComponent(menu); layout.setComponentAlignment(menu, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.mcparland.john.ComponentCollection.java
License:Apache License
/** * @param size//from w ww. j a v a 2s.co m * @param icon * @return */ private Image createImage(String size, String icon) { final Resource imageResource = new ThemeResource("../runo/icons/" + size + "/" + icon); final Image image = new Image(null, imageResource); return image; }
From source file:com.mcparland.john.vaadin_mvn_arch.samples.Menu.java
License:Apache License
public Menu(Navigator navigator) { this.navigator = navigator; setPrimaryStyleName(ValoTheme.MENU_ROOT); menuPart = new CssLayout(); menuPart.addStyleName(ValoTheme.MENU_PART); // header of the menu final HorizontalLayout top = new HorizontalLayout(); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName(ValoTheme.MENU_TITLE); top.setSpacing(true);//from ww w. j a v a2 s . c o m Label title = new Label("My CRUD"); title.addStyleName(ValoTheme.LABEL_H3); title.setSizeUndefined(); Image image = new Image(null, new ThemeResource("img/table-logo.png")); image.setStyleName("logo"); top.addComponent(image); top.addComponent(title); menuPart.addComponent(top); // logout menu item MenuBar logoutMenu = new MenuBar(); logoutMenu.addItem("Logout", FontAwesome.SIGN_OUT, new Command() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void menuSelected(MenuItem selectedItem) { VaadinSession.getCurrent().getSession().invalidate(); Page.getCurrent().reload(); } }); logoutMenu.addStyleName("user-menu"); menuPart.addComponent(logoutMenu); // button for toggling the visibility of the menu when on a small screen final Button showMenu = new Button("Menu", new ClickListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) { menuPart.removeStyleName(VALO_MENU_VISIBLE); } else { menuPart.addStyleName(VALO_MENU_VISIBLE); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName(VALO_MENU_TOGGLE); showMenu.setIcon(FontAwesome.NAVICON); menuPart.addComponent(showMenu); // container for the navigation buttons, which are added by addView() menuItemsLayout = new CssLayout(); menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS); menuPart.addComponent(menuItemsLayout); addComponent(menuPart); }
From source file:com.mycollab.mobile.shell.view.MainView.java
License:Open Source License
public MainView() { super();// www.jav 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(UserUIContext.getMessage(GenericI18Enum.MODULE_CRM), clickEvent -> EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null))); crmButton.addStyleName(MobileUIConstants.BUTTON_ACTION); crmButton.setWidth("100%"); contentLayout.addComponent(crmButton); Button pmButton = new Button(UserUIContext.getMessage(GenericI18Enum.MODULE_PROJECT), clickEvent -> EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null))); pmButton.setWidth("100%"); pmButton.addStyleName(MobileUIConstants.BUTTON_ACTION); contentLayout.addComponent(pmButton); this.addComponent(contentLayout); }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.bodyeditor.BodyEditorViewImpl.java
License:Open Source License
private Layout createToolbarFormattingElements() { CssLayout wrapper = new CssLayout(); wrapper.addStyleName("toolbar-elements"); wrapper.addStyleName("toolbar-formatting"); for (int i = 0; i < 4; i++) { Button addButton = new Button(null, new Button.ClickListener() { @Override//from w w w . j ava 2s . co m public void buttonClick(Button.ClickEvent event) { notImplemented(); } }); addButton.setStyleName("toolbar-formatting-button"); ThemeResource tableResource = new ThemeResource("img/placeholder.png"); addButton.setIcon(tableResource); wrapper.addComponent(addButton); } return wrapper; }