List of usage examples for com.vaadin.server ThemeResource ThemeResource
public ThemeResource(String resourceId)
From source file:io.subutai.plugin.accumulo.ui.manager.AddNodeWindow.java
public AddNodeWindow(final Accumulo accumulo, final ExecutorService executorService, final Tracker tracker, final AccumuloClusterConfig accumuloClusterConfig, Set<EnvironmentContainerHost> nodes, final NodeType nodeType) { super("Add New Node"); setModal(true);/*from w ww .j av a2 s. c o m*/ setWidth(650, Unit.PIXELS); setHeight(450, Unit.PIXELS); GridLayout content = new GridLayout(1, 3); content.setSizeFull(); content.setMargin(true); content.setSpacing(true); HorizontalLayout topContent = new HorizontalLayout(); topContent.setSpacing(true); content.addComponent(topContent); topContent.addComponent(new Label("Nodes:")); final ComboBox hadoopNodes = new ComboBox(); hadoopNodes.setId("HadoopNodesCb"); hadoopNodes.setImmediate(true); hadoopNodes.setTextInputAllowed(false); hadoopNodes.setNullSelectionAllowed(false); hadoopNodes.setRequired(true); hadoopNodes.setWidth(200, Unit.PIXELS); for (EnvironmentContainerHost node : nodes) { hadoopNodes.addItem(node); hadoopNodes.setItemCaption(node, node.getHostname()); } if (nodes.size() == 0) { return; } hadoopNodes.setValue(nodes.iterator().next()); topContent.addComponent(hadoopNodes); final Button addNodeBtn = new Button("Add"); addNodeBtn.setId("AddSelectedNode"); topContent.addComponent(addNodeBtn); final Button ok = new Button("Ok"); addNodeBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { addNodeBtn.setEnabled(false); ok.setEnabled(false); showProgress(); EnvironmentContainerHost containerHost = (EnvironmentContainerHost) hadoopNodes.getValue(); final UUID trackID = accumulo.addNode(accumuloClusterConfig.getClusterName(), containerHost.getHostname(), nodeType); executorService.execute(new Runnable() { public void run() { while (track) { TrackerOperationView po = tracker.getTrackerOperation(AccumuloClusterConfig.PRODUCT_KEY, trackID); if (po != null) { setOutput(po.getDescription() + "\nState: " + po.getState() + "\nLogs:\n" + po.getLog()); if (po.getState() != OperationState.RUNNING) { hideProgress(); ok.setEnabled(true); break; } } else { setOutput("Product operation not found. Check logs"); break; } try { Thread.sleep(1000); } catch (InterruptedException ex) { break; } } } }); } }); outputTxtArea = new TextArea("Operation output"); outputTxtArea.setId("outputTxtArea"); outputTxtArea.setRows(13); outputTxtArea.setColumns(43); outputTxtArea.setImmediate(true); outputTxtArea.setWordwrap(true); content.addComponent(outputTxtArea); indicator = new Label(); indicator.setId("indicator"); indicator.setIcon(new ThemeResource("img/spinner.gif")); indicator.setContentMode(ContentMode.HTML); indicator.setHeight(11, Unit.PIXELS); indicator.setWidth(50, Unit.PIXELS); indicator.setVisible(false); ok.setId("btnOk"); ok.setStyleName("default"); ok.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { //close window track = false; close(); } }); HorizontalLayout bottomContent = new HorizontalLayout(); bottomContent.addComponent(indicator); bottomContent.setComponentAlignment(indicator, Alignment.MIDDLE_RIGHT); bottomContent.addComponent(ok); content.addComponent(bottomContent); content.setComponentAlignment(bottomContent, Alignment.MIDDLE_RIGHT); setContent(content); }
From source file:me.uni.emuseo.view.menu.MenuView.java
License:Open Source License
protected void init() { defaultIcon = new ThemeResource("img/profile-pic-300px.jpg"); authManager = EMuseoUtil.getAppContext().getBean(AuthManager.class); this.setWidth("100%"); this.addMenu(buildMenu()); reloadUserDetails();/*from w w w .j a v a2s.co m*/ }
From source file:net.gvcc.jgoffice.components.CommandBar.java
License:Open Source License
private HorizontalLayout buildHorizontalLayout_2() { // common part: create layout horizontalLayout_2 = new HorizontalLayout(); horizontalLayout_2.setImmediate(false); horizontalLayout_2.setWidth("100.0%"); horizontalLayout_2.setHeight("-1px"); horizontalLayout_2.setMargin(false); horizontalLayout_2.setSpacing(true); // logoPicture logoPicture = new Embedded(); logoPicture.setImmediate(false);/* ww w . j a v a2s . com*/ logoPicture.setWidth("-1px"); logoPicture.setHeight("-1px"); logoPicture.setSource(new ThemeResource("img/LogoSgvV1.png")); logoPicture.setType(1); logoPicture.setMimeType("image/png"); horizontalLayout_2.addComponent(logoPicture); // lblApplicationTitle lblApplicationTitle = new Label(); lblApplicationTitle.setStyleName("g-applicationtitle"); lblApplicationTitle.setImmediate(false); lblApplicationTitle.setWidth("-1px"); lblApplicationTitle.setHeight("-1px"); lblApplicationTitle.setValue("Label"); horizontalLayout_2.addComponent(lblApplicationTitle); horizontalLayout_2.setComponentAlignment(lblApplicationTitle, new Alignment(33)); // programList programList = new HorizontalLayout(); programList.setImmediate(false); programList.setWidth("-1px"); programList.setHeight("-1px"); programList.setMargin(false); programList.setSpacing(true); horizontalLayout_2.addComponent(programList); horizontalLayout_2.setExpandRatio(programList, 1.0f); horizontalLayout_2.setComponentAlignment(programList, new Alignment(34)); // btnLogout btnLogout = new Button(); btnLogout.setCaption("Logout"); btnLogout.setImmediate(true); btnLogout.setWidth("-1px"); btnLogout.setHeight("-1px"); horizontalLayout_2.addComponent(btnLogout); horizontalLayout_2.setComponentAlignment(btnLogout, new Alignment(34)); return horizontalLayout_2; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.dashboard.DashboardProvider.java
License:Apache License
@Override public Component getContent() { try {/* w w w. jav a 2 s .c om*/ BorderLayout bl = new BorderLayout(); //Add activity stream List<Activity> activities = ActivityServer.getActivities(); BeanItemContainer<Activity> container = new BeanItemContainer<>(Activity.class, activities); GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(container); gpc.addGeneratedProperty("avatar", new PropertyValueGenerator<Resource>() { @Override public Resource getValue(Item item, Object itemId, Object propertyId) { VmUser user = ((Activity) itemId).getSourceUser(); Resource image = new ThemeResource("VMSmall.png"); AvatarProvider ap = Lookup.getDefault().lookup(AvatarProvider.class); Resource icon = ap == null ? null : ap.getAvatar(user, 30); if (icon != null) { image = icon; } return image; } @Override public Class<Resource> getType() { return Resource.class; } }); Grid grid = new Grid(TRANSLATOR.translate("general.activity.stream"), gpc); Column at = grid.getColumn("activityType"); at.setHeaderCaption(TRANSLATOR.translate("activity.type")); at.setConverter(new Converter<String, ActivityType>() { int type; @Override public ActivityType convertToModel(String value, Class<? extends ActivityType> targetType, Locale locale) throws Converter.ConversionException { return new ActivityTypeJpaController(DataBaseManager.getEntityManagerFactory()) .findActivityType(type); } @Override public String convertToPresentation(ActivityType value, Class<? extends String> targetType, Locale locale) throws Converter.ConversionException { type = value.getId(); return TRANSLATOR.translate(value.getTypeName()); } @Override public Class<ActivityType> getModelType() { return ActivityType.class; } @Override public Class<String> getPresentationType() { return String.class; } }); Column type = grid.getColumn("activityType"); type.setHeaderCaption(TRANSLATOR.translate("general.type")); Column desc = grid.getColumn("description"); desc.setHeaderCaption(TRANSLATOR.translate("general.description")); Column user = grid.getColumn("sourceUser"); user.setHeaderCaption(TRANSLATOR.translate("general.user")); user.setConverter(new Converter<String, VmUser>() { private int user; @Override public String convertToPresentation(VmUser value, Class<? extends String> targetType, Locale l) throws Converter.ConversionException { try { user = value.getId(); return new VMUserServer(user).toString(); } catch (Exception ex) { Exceptions.printStackTrace(ex); } return ""; } @Override public Class<VmUser> getModelType() { return VmUser.class; } @Override public Class<String> getPresentationType() { return String.class; } @Override public VmUser convertToModel(String value, Class<? extends VmUser> targetType, Locale locale) throws Converter.ConversionException { return new VmUserJpaController(DataBaseManager.getEntityManagerFactory()).findVmUser(user); } }); Column avatar = grid.getColumn("avatar"); avatar.setHeaderCaption(""); avatar.setRenderer(new ImageRenderer()); Column time = grid.getColumn("activityTime"); time.setHeaderCaption(TRANSLATOR.translate("general.time")); grid.setColumns("avatar", "sourceUser", "activityType", "description", "activityTime"); grid.sort("activityTime", SortDirection.DESCENDING); bl.addComponent(grid, BorderLayout.Constraint.CENTER); bl.setId(getComponentCaption()); return bl; } catch (IllegalArgumentException | IllegalStateException ex) { Exceptions.printStackTrace(ex); } return null; }
From source file:org.apache.openaz.xacml.admin.XacmlAdminConsole.java
License:Apache License
@AutoGenerated private HorizontalLayout buildHorizontalLayout_1() { // common part: create layout horizontalLayout_1 = new HorizontalLayout(); horizontalLayout_1.setImmediate(false); horizontalLayout_1.setWidth("100.0%"); horizontalLayout_1.setHeight("40px"); horizontalLayout_1.setMargin(false); // embedded_1 embedded_1 = new Embedded(); embedded_1.setImmediate(false);//from w ww. ja va 2 s .co m embedded_1.setWidth("30px"); embedded_1.setHeight("30px"); embedded_1.setSource(new ThemeResource("img/att.png")); embedded_1.setType(1); embedded_1.setMimeType("image/png"); horizontalLayout_1.addComponent(embedded_1); horizontalLayout_1.setComponentAlignment(embedded_1, new Alignment(33)); // caption caption = new Label(); caption.setImmediate(false); caption.setWidth("-1px"); caption.setHeight("-1px"); caption.setValue("Apache OpenAZ Admin Console"); horizontalLayout_1.addComponent(caption); horizontalLayout_1.setExpandRatio(caption, 1.0f); horizontalLayout_1.setComponentAlignment(caption, new Alignment(33)); // labelWelcome labelWelcome = new Label(); labelWelcome.setImmediate(false); labelWelcome.setWidth("-1px"); labelWelcome.setHeight("40px"); labelWelcome.setValue("Label"); horizontalLayout_1.addComponent(labelWelcome); horizontalLayout_1.setComponentAlignment(labelWelcome, new Alignment(34)); return horizontalLayout_1; }
From source file:org.balisunrise.vaadin.components.header.FastMenuItem.java
private void init() { setStyleName("b-fast-menu-item"); ThemeResource i = new ThemeResource("img/tag1.png"); setIcon(i); }
From source file:org.bubblecloud.ilves.site.Site.java
License:Apache License
/** * Gets getIcon corresponding to given localization key. * @param key The localization key.// w w w.ja va 2 s . c om * @return The localized getIcon. */ public Resource getIcon(final String key) { return new ThemeResource("icons/" + key + ".png"); }
From source file:org.bubblecloud.ilves.site.view.valo.DefaultValoView.java
License:Apache License
private CssLayout buildMenu() { final HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setWidth("100%"); topLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); topLayout.addStyleName("valo-menu-title"); menu.addComponent(topLayout);//from w w w.j a v a 2 s . c om final Button showMenu = new Button("Menu", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); final Label title = new Label("<h3>" + Site.getCurrent().localize(getViewVersion().getTitle()) + "</h3>", ContentMode.HTML); title.setSizeUndefined(); topLayout.addComponent(title); topLayout.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); final String user = Site.getCurrent().getSecurityProvider().getUser(); final String userMenuCaption; final Resource userMenuIcon; if (user == null) { userMenuCaption = Site.getCurrent().localize("page-link-login"); userMenuIcon = new ThemeResource("ilves_logo.png"); } else { final URL gravatarUrl = GravatarUtil.getGravatarUrl(user, 64); userMenuIcon = new ExternalResource(gravatarUrl); userMenuCaption = ((SecurityProviderSessionImpl) Site.getCurrent().getSecurityProvider()) .getUserFromSession().getFirstName(); } final MenuBar.MenuItem settingsItem = settings.addItem(userMenuCaption, userMenuIcon, null); if (user != null) { settingsItem.addItem(Site.getCurrent().localize("page-link-account"), new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { UI.getCurrent().getNavigator().navigateTo("account"); } }); settingsItem.addSeparator(); settingsItem.addItem(Site.getCurrent().localize("button-logout"), new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { LoginService.logout(Site.getCurrent().getSiteContext()); final Company company = Site.getCurrent().getSiteContext().getObject(Company.class); getUI().getPage().setLocation(company.getUrl()); getSession().getSession().invalidate(); getSession().close(); } }); } else { settingsItem.addItem(Site.getCurrent().localize("page-link-login"), new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { UI.getCurrent().getNavigator().navigateTo("login"); } }); } menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); final Site site = Site.getCurrent(); final NavigationVersion navigationVersion = site.getCurrentNavigationVersion(); for (final String pageName : navigationVersion.getRootPages()) { final ViewVersion pageVersion = site.getCurrentViewVersion(pageName); if (pageVersion == null) { throw new SiteException("Unknown page: " + pageName); } if (pageVersion.getViewerRoles().length > 0) { boolean roleMatch = false; for (final String role : pageVersion.getViewerRoles()) { if (site.getSecurityProvider().getRoles().contains(role)) { roleMatch = true; break; } } if (!roleMatch) { continue; } } if (navigationVersion.hasChildPages(pageName)) { final String localizedPageName = pageVersion.isDynamic() ? pageName : site.localize("page-link-" + pageName); final Label label = new Label(localizedPageName, ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); final List<String> childPages = navigationVersion.getChildPages(pageName); for (final String childPage : childPages) { addMenuLink(navigationVersion, childPage); } label.setValue( label.getValue() + " <span class=\"valo-menu-badge\">" + childPages.size() + "</span>"); } else { addMenuLink(navigationVersion, pageName); } } return menu; }
From source file:org.eclipse.hawkbit.ui.decorators.SPUIEmbedDecorator.java
License:Open Source License
/** * Decorate./* w w w.j av a 2 s. c om*/ * * @param spUIEmbdValue * as DTO * @return Embedded as UI */ public static Embedded decorate(final SPUIEmbedValue spUIEmbdValue) { final Embedded spUIEmbd = new Embedded(); spUIEmbd.setImmediate(spUIEmbdValue.isImmediate()); spUIEmbd.setType(spUIEmbdValue.getType()); if (null != spUIEmbdValue.getId()) { spUIEmbd.setId(spUIEmbdValue.getId()); } if (null != spUIEmbdValue.getData()) { spUIEmbd.setData(spUIEmbdValue.getData()); } if (null != spUIEmbdValue.getStyleName()) { spUIEmbd.setStyleName(spUIEmbdValue.getStyleName()); } if (null != spUIEmbdValue.getSource()) { spUIEmbd.setSource(new ThemeResource(spUIEmbdValue.getSource())); } if (null != spUIEmbdValue.getMimeType()) { spUIEmbd.setMimeType(spUIEmbdValue.getMimeType()); } if (null != spUIEmbdValue.getDescription()) { spUIEmbd.setDescription(spUIEmbdValue.getDescription()); } return spUIEmbd; }
From source file:org.eclipse.hawkbit.ui.menu.DashboardMenu.java
License:Open Source License
private static Resource getImage(final boolean gravatar) { if (!gravatar) { return new ThemeResource("images/profile-pic-57px.jpg"); }//from w w w.j a v a2s .c om return UserDetailsFormatter.getCurrentUserEmail().map(email -> (Resource) new GravatarResource(email)) .orElse(new ThemeResource("images/profile-pic-57px.jpg")); }