当前位置: 首页>>代码示例>>Java>>正文


Java Resource类代码示例

本文整理汇总了Java中com.vaadin.server.Resource的典型用法代码示例。如果您正苦于以下问题:Java Resource类的具体用法?Java Resource怎么用?Java Resource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Resource类属于com.vaadin.server包,在下文中一共展示了Resource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAudio

import com.vaadin.server.Resource; //导入依赖的package包/类
@Test
public void testAudio() {
    final Resource audioResource = new ExternalResource(
            "http://mirrors.creativecommons.org/ccmixter/contrib/Wired/The%20Rapture%20-%20Sister%20Saviour%20(Blackstrobe%20Remix).mp3");
    FAudio audio = new FAudio().withAltText("alt")
                               .withAutoplay(true)
                               .withCaption("My audio")
                               .withHtmlContentAllowed(true)
                               .withMuted(true)
                               .withLoop(true)
                               .withPreload(PreloadMode.METADATA)
                               .withSource(audioResource)
                               .withShowControls(true);

    assertEquals("alt", audio.getAltText());
    assertEquals("My audio", audio.getCaption());
    assertTrue(audio.isAutoplay());
    assertTrue(audio.isHtmlContentAllowed());
    assertTrue(audio.isShowControls());
    assertTrue(audio.isLoop());
    assertTrue(audio.isMuted());
    assertEquals(PreloadMode.METADATA, audio.getPreload());
    assertEquals(audioResource, audio.getSources().get(0));

}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:26,代码来源:FluentMediaTest.java

示例2: init

import com.vaadin.server.Resource; //导入依赖的package包/类
/**
 * Initialize the ComboBoxMultiselect with default settings and register client to server RPC implementation.
 */
private void init() {
    registerRpc(this.rpc);
    registerRpc(new FocusAndBlurServerRpcDecorator(this, this::fireEvent));

    addDataGenerator((final T data, final JsonObject jsonObject) -> {
        String caption = getItemCaptionGenerator().apply(data);
        if (caption == null) {
            caption = "";
        }
        jsonObject.put(DataCommunicatorConstants.NAME, caption);
        final String style = this.itemStyleGenerator.apply(data);
        if (style != null) {
            jsonObject.put(ComboBoxMultiselectConstants.STYLE, style);
        }
        final Resource icon = getItemIconGenerator().apply(data);
        if (icon != null) {
            final String iconUrl = ResourceReference.create(icon, ComboBoxMultiselect.this, null)
                    .getURL();
            jsonObject.put(ComboBoxMultiselectConstants.ICON, iconUrl);
        }
    });
}
 
开发者ID:bonprix,项目名称:vaadin-combobox-multiselect,代码行数:26,代码来源:ComboBoxMultiselect.java

示例3: setUser

import com.vaadin.server.Resource; //导入依赖的package包/类
private void setUser(String name, Resource icon) {
	sideMenu.setUserName(name);
	sideMenu.setUserIcon(icon);

	sideMenu.clearUserMenu();
       sideMenu.addUserMenuItem("Settings", VaadinIcons.WRENCH, () -> Notification.show("Showing settings", Type.TRAY_NOTIFICATION));
       sideMenu.addUserMenuItem("Sign out", () -> Notification.show("Logging out..", Type.TRAY_NOTIFICATION));

	sideMenu.addUserMenuItem("Hide logo", () -> {
		if (!logoVisible) {
			sideMenu.setMenuCaption(menuCaption, logo);
		} else {
			sideMenu.setMenuCaption(menuCaption);
		}
		logoVisible = !logoVisible;
	});
}
 
开发者ID:tsuoanttila,项目名称:sidemenu-addon,代码行数:18,代码来源:DemoUI.java

示例4: getLogoResource

import com.vaadin.server.Resource; //导入依赖的package包/类
private Resource getLogoResource()
{
	if (logoFilename == null)
	{
		return Constants.RESOURCE_Logo;
	}
	if (logoFilename.trim().isEmpty())
	{
		return Constants.RESOURCE_Logo;
	}
	
	final File logoFile = new File(logoFilename.trim());
	if (!logoFile.isFile() || !logoFile.canRead())
	{
		logger.warn("Using default log because {} does not exist or it's not readable", logoFile);
		return Constants.RESOURCE_Logo;
	}
	
	return new FileResource(logoFile);
}
 
开发者ID:metasfresh,项目名称:metasfresh-procurement-webui,代码行数:21,代码来源:LoginView.java

示例5: markMenuStructureAsDirty

import com.vaadin.server.Resource; //导入依赖的package包/类
protected void markMenuStructureAsDirty() {
    markAsDirty();
    this.structureChanged = true;

    for (String menuIconsKey : menuIconResourceKeys) {
        Resource resource = getResource(menuIconsKey);
        menuIconsKeyMapper.remove(resource);
        setResource(menuIconsKey, null);
    }

    menuItemIdMapper.removeAll();
    menuIconsKeyMapper.removeAll();

    // all badges will be sent to client with items
    badgeUpdates.clear();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:CubaSideMenu.java

示例6: getFontIconResource

import com.vaadin.server.Resource; //导入依赖的package包/类
/**
 * @deprecated use the {@link Icons#get(com.haulmont.cuba.gui.icons.Icons.Icon)} bean
 * and {@link com.haulmont.cuba.gui.icons.CubaIcon} icon set instead
 */
@Deprecated
@Nullable
public static Resource getFontIconResource(String fontIcon)
        throws NoSuchFieldException, IllegalAccessException {
    if (StringUtils.isNotEmpty(fontIcon)) {
        String fontIconName = "font-awesome-icon";
        String fontIconField;
        if (fontIcon.contains(":")) {
            fontIconName = StringUtils.substring(fontIcon, 0, fontIcon.indexOf(":"));
            fontIconField = StringUtils.substring(fontIcon, fontIcon.indexOf(":") + 1);
        } else {
            fontIconField = fontIcon;
        }
        return getFontIconResource(fontIconName, fontIconField);
    }
    return null;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:22,代码来源:WebComponentsHelper.java

示例7: createGroupTableComponent

import com.vaadin.server.Resource; //导入依赖的package包/类
protected CubaGroupTable createGroupTableComponent() {
    return new CubaGroupTable() {
        @Override
        @SuppressWarnings({"unchecked"})
        public Resource getItemIcon(Object itemId) {
            return WebGroupTable.this.getItemIcon(itemId);
        }

        @Override
        protected boolean changeVariables(Map<String, Object> variables) {
            boolean b = super.changeVariables(variables);
            b = handleSpecificVariables(variables) || b;
            return b;
        }

        @Override
        public void groupBy(Object[] properties) {
            groupBy(properties, rerender);
        }
    };
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:22,代码来源:WebGroupTable.java

示例8: getItemIcon

import com.vaadin.server.Resource; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected Resource getItemIcon(Object itemId) {
    if (iconProvider == null) {
        return null;
    }
    E item = (E) datasource.getItem(itemId);
    if (item == null) {
        return null;
    }
    String resourceUrl = iconProvider.getItemIcon(item);
    if (StringUtils.isBlank(resourceUrl)) {
        return null;
    }
    // noinspection ConstantConditions
    if (!resourceUrl.contains(":")) {
        resourceUrl = "theme:" + resourceUrl;
    }
    return WebComponentsHelper.getResource(resourceUrl);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:WebAbstractTable.java

示例9: WebTable

import com.vaadin.server.Resource; //导入依赖的package包/类
public WebTable() {
    component = new CubaTable() {
        @Override
        public Resource getItemIcon(Object itemId) {
            return WebTable.this.getItemIcon(itemId);
        }

        @Override
        protected boolean changeVariables(Map<String, Object> variables) {
            boolean b = super.changeVariables(variables);
            b = handleSpecificVariables(variables) || b;
            return b;
        }
    };
    initComponent(component);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:WebTable.java

示例10: getType

import com.vaadin.server.Resource; //导入依赖的package包/类
@Override
public Class<?> getType(Object propertyId) {
       if (propertyId.equals(PROPERTY_ID)) {
           return String.class;
       }
       if (propertyId.equals(PROPERTY_NAME)) {
           return String.class;
       }
       if (propertyId.equals(PROPERTY_DESCRIPTION)) {
           return String.class;
       }
       if (propertyId.equals(PROPERTY_ICON)) {
           return Resource.class;
       }
       if (propertyId.equals(PROPERTY_STATUS)) {
           return String.class;
       }
       if (propertyId.equals(PROPERTY_POLICIES)) {
           return Set.class;
       }
       if (propertyId.equals(PROPERTY_PIPCONFIG)) {
           return Set.class;
       }
	return null;
}
 
开发者ID:apache,项目名称:incubator-openaz,代码行数:26,代码来源:PDPContainer.java

示例11: decorate

import com.vaadin.server.Resource; //导入依赖的package包/类
/**
 * Decorate Button and return.
 * 
 * @param button
 *            as Button
 * @param style
 *            as String
 * @param setStyle
 *            as String
 * @param icon
 *            as resource
 * @return Button
 */
@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    // Set Style
    if (null != style && setStyle) {
        button.addStyleName(style);
    }
    button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    // Set icon
    if (null != icon) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.addStyleName("button-no-border");
        button.setIcon(icon);
    }

    return button;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:30,代码来源:SPUIButtonStyleSmallNoBorder.java

示例12: decorate

import com.vaadin.server.Resource; //导入依赖的package包/类
@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {

    button.setImmediate(true);
    button.addStyleName("generatedColumnPadding button-no-border" + " " + ValoTheme.BUTTON_BORDERLESS + " "
            + "button-tag-no-border");

    // Set Style
    if (null != style) {
        if (setStyle) {
            button.setStyleName(style);
        } else {
            button.addStyleName(style);
        }
    }
    // Set icon
    if (null != icon) {
        button.setIcon(icon);
    }
    return button;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:22,代码来源:SPUITagButtonStyle.java

示例13: decorate

import com.vaadin.server.Resource; //导入依赖的package包/类
@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    button.addStyleName(ValoTheme.BUTTON_TINY);
    // Set Style
    if (null != style) {
        if (setStyle) {
            button.setStyleName(style);
        } else {
            button.addStyleName(style);
        }
    }
    // Set icon
    if (null != icon) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.setIcon(icon);
    }
    return button;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:19,代码来源:SPUIButtonStyleTiny.java

示例14: decorate

import com.vaadin.server.Resource; //导入依赖的package包/类
@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    // Set Style
    if (null != style) {
        if (setStyle) {
            button.setStyleName(style);
        } else {
            button.addStyleName(style);
        }
    }
    // Set icon
    if (null != icon) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.setIcon(icon);
    }
    return button;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:19,代码来源:SPUIButtonStyleSmall.java

示例15: addItemBefore

import com.vaadin.server.Resource; //导入依赖的package包/类
@Override
public MenuItem addItemBefore(String caption, Resource icon,
        Command command, MenuItem itemToAddBefore) {
    if (caption == null) {
        throw new IllegalArgumentException("caption cannot be null");
    }

    MenuItem newItem = new MenuItemImpl(caption, icon, command);
    if (menuItems.contains(itemToAddBefore)) {
        int index = menuItems.indexOf(itemToAddBefore);
        menuItems.add(index, newItem);

    } else {
        menuItems.add(newItem);
    }

    markAsDirty();

    return newItem;
}
 
开发者ID:vaadin,项目名称:context-menu,代码行数:21,代码来源:AbstractMenu.java


注:本文中的com.vaadin.server.Resource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。