⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clientinfo.java

📁 基于Ajax的WebOS————PhoneShow案例
💻 JAVA
字号:
package com.cownew.phoneshow.framework.common;

import nextapp.echo2.app.ApplicationInstance;
import nextapp.echo2.webcontainer.ContainerContext;
import nextapp.echo2.webrender.ClientProperties;

/**
 * 客户端信息提供者
 * @author 杨中科
 *
 */
public class ClientInfo
{
	private ClientProperties clientProps;

	public ClientInfo(ApplicationInstance appInstance)
	{
		super();
		ContainerContext cc = (ContainerContext) appInstance
				.getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
		clientProps = cc.getClientProperties();
	}

	/**
	 * 屏幕高度
	 * @return
	 */
	public int getScreenHeight()
	{
		return clientProps.getInt(ClientProperties.SCREEN_HEIGHT, -1);
	}

	/**
	 * 屏幕宽度
	 * @return
	 */
	public int getScreenWidth()
	{
		return clientProps.getInt(ClientProperties.SCREEN_WIDTH, -1);
	}

	/**
	 * 客户端主机地址
	 * @return
	 */
	public String getRemoteHost()
	{
		return clientProps.getString(ClientProperties.REMOTE_HOST);
	}

	/**
	 * 浏览器语言
	 * @return
	 */
	public String getNavigatorLanguage()
	{
		return clientProps.getString(ClientProperties.NAVIGATOR_LANGUAGE);
	}

	/**
	 * 操作系统
	 * @return
	 */
	public String getNavigatorPlatform()
	{
		return clientProps.getString(ClientProperties.NAVIGATOR_PLATFORM);
	}

	/**
	 * 浏览器名称
	 * @return
	 */
	public String getNavigatorAppName()
	{
		return clientProps.getString(ClientProperties.NAVIGATOR_APP_NAME);
	}

	/**
	 * 浏览器版本
	 * @return
	 */
	public String getNavigatorAppVersion()
	{
		return clientProps.getString(ClientProperties.NAVIGATOR_APP_VERSION);
	}

	/**
	 * 是否兼容Java插件
	 * @return
	 */
	public boolean getNavigatorJavaEnabled()
	{
		return clientProps.getBoolean(ClientProperties.NAVIGATOR_JAVA_ENABLED);
	}

	/**
	 * Cookie是否可用
	 * @return
	 */
	public boolean getNavigatorCookieEnabled()
	{
		return clientProps
				.getBoolean(ClientProperties.NAVIGATOR_COOKIE_ENABLED);
	}
	
	/**
	 * 用户取得我们没有进行封装的其他属性
	 * @param propertyName
	 * @return
	 */
	public Object get(String propertyName) {
		return clientProps.get(propertyName);
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -