• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java WebBrowser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: injectMovieCoverStyles

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
private void injectMovieCoverStyles() {
    // Add all movie cover images as classes to CSSInject
    String styles = "";
    for (Movie m : DashboardUI.getDataProvider().getMovies()) {
        WebBrowser webBrowser = Page.getCurrent().getWebBrowser();

        String bg = "url(VAADIN/themes/" + UI.getCurrent().getTheme()
                + "/img/event-title-bg.png), url(" + m.getThumbUrl() + ")";

        // IE8 doesn't support multiple background images
        if (webBrowser.isIE() && webBrowser.getBrowserMajorVersion() == 8) {
            bg = "url(" + m.getThumbUrl() + ")";
        }

        styles += ".v-calendar-event-" + m.getId()
                + " .v-calendar-event-content {background-image:" + bg
                + ";}";
    }

    Page.getCurrent().getStyles().add(styles);
}
 
开发者ID:mcollovati,项目名称:vaadin-vertx-samples,代码行数:22,代码来源:ScheduleView.java


示例2: getOperatingSystem

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
/**
 * Gets the operating system.
 *
 * @param webBrowser
 *            the web browser
 * @return the operating system
 */
public static String getOperatingSystem(final WebBrowser webBrowser) {
	String osName = UNKNOWN;
       if (webBrowser.isLinux()) {
		osName = LINUX;
	} else if (webBrowser.isWindows()) {
		osName = WINDOWS2;
	} else if (webBrowser.isWindowsPhone()) {
		osName = WINDOWS_PHONE;
	} else if (webBrowser.isMacOSX()) {
		osName = MAC_OSX;
	} else if (webBrowser.isAndroid()) {
		osName = ANDROID;
	} else if (webBrowser.isIOS()) {
		osName = IOS;
	} else if (webBrowser.isIPad()) {
		osName = IPAD;
	} else if (webBrowser.isIPhone()) {
		osName = I_PHONE;
	}
	return osName;
}
 
开发者ID:Hack23,项目名称:cia,代码行数:29,代码来源:WebBrowserUtil.java


示例3: AboutWindow

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
public AboutWindow() {

        MHorizontalLayout content = new MHorizontalLayout().withMargin(true).withFullWidth();
        this.setContent(content);

        Image about = new Image("", new ExternalResource(StorageUtils.generateAssetRelativeLink(WebResourceIds._about)));
        MVerticalLayout rightPanel = new MVerticalLayout();
        ELabel versionLbl = ELabel.h2(String.format("MyCollab Community Edition %s", Version.getVersion()));
        Label javaNameLbl = new Label(String.format("%s, %s", System.getProperty("java.vm.name"),
                System.getProperty("java.runtime.version")));
        Label homeFolderLbl = new Label("Home folder: " + FileUtils.getHomeFolder().getAbsolutePath());
        WebBrowser browser = Page.getCurrent().getWebBrowser();
        Label osLbl = new Label(String.format("%s, %s", System.getProperty("os.name"),
                browser.getBrowserApplication()));
        osLbl.addStyleName(UIConstants.LABEL_WORD_WRAP);
        Div licenseDiv = new Div().appendChild(new Text("Powered by: "))
                .appendChild(new A("https://www.mycollab.com")
                        .appendText("MyCollab")).appendChild(new Text(". Open source under GPL license"));
        Label licenseLbl = ELabel.html(licenseDiv.write());
        Label copyRightLbl = ELabel.html(String.format("© %s - %s MyCollab Ltd. All rights reserved", "2011",
                new GregorianCalendar().get(Calendar.YEAR) + ""));
        rightPanel.with(versionLbl, javaNameLbl, osLbl, homeFolderLbl, licenseLbl, copyRightLbl)
                .withAlign(copyRightLbl, Alignment.BOTTOM_LEFT);
        content.with(about, rightPanel).expand(rightPanel);
    }
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:26,代码来源:AboutWindow.java


示例4: getScreenWidth

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
@Override
public int getScreenWidth() {
	WebBrowser browser = (Page.getCurrent() != null) ? Page.getCurrent().getWebBrowser() : null;
	if (browser != null) {
		return browser.getScreenWidth();
	}
	return -1;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:9,代码来源:DefaultDeviceInfo.java


示例5: getScreenHeight

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
@Override
public int getScreenHeight() {
	WebBrowser browser = (Page.getCurrent() != null) ? Page.getCurrent().getWebBrowser() : null;
	if (browser != null) {
		return browser.getScreenHeight();
	}
	return -1;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:9,代码来源:DefaultDeviceInfo.java


示例6: makeClientInfo

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
protected String makeClientInfo() {
    // timezone info is passed only on VaadinSession creation
    WebBrowser webBrowser = getWebBrowserDetails();

    //noinspection UnnecessaryLocalVariable
    String serverInfo = String.format("Web (%s:%s/%s) %s",
            globalConfig.getWebHostName(),
            globalConfig.getWebPort(),
            globalConfig.getWebContextName(),
            webBrowser.getBrowserApplication());

    return serverInfo;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:14,代码来源:ConnectionImpl.java


示例7: detectTimeZone

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
protected TimeZone detectTimeZone() {
    WebBrowser webBrowser = getWebBrowserDetails();

    int offset = webBrowser.getTimezoneOffset() / 1000 / 60;
    char sign = offset >= 0 ? '+' : '-';
    int absOffset = Math.abs(offset);

    String hours = StringUtils.leftPad(String.valueOf(absOffset / 60), 2, '0');
    String minutes = StringUtils.leftPad(String.valueOf(absOffset % 60), 2, '0');

    return TimeZone.getTimeZone("GMT" + sign + hours + minutes);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:13,代码来源:ConnectionImpl.java


示例8: getWebBrowserDetails

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
protected WebBrowser getWebBrowserDetails() {
    // timezone info is passed only on VaadinSession creation
    WebBrowser webBrowser = VaadinSession.getCurrent().getBrowser();
    VaadinRequest currentRequest = VaadinService.getCurrentRequest();
    // update web browser instance if current request is not null
    // it can be null in case of background/async processing of login request
    if (currentRequest != null) {
        webBrowser.updateRequestDetails(currentRequest);
    }
    return webBrowser;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:12,代码来源:ConnectionImpl.java


示例9: attach

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
@Override
public void attach() {
    super.attach();

    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    if (webBrowser.isIE() || webBrowser.isEdge()) {
        CubaImageObjectFitPolyfillExtension.get(getUI());
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:10,代码来源:CubaImage.java


示例10: WebFileUploadField

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
public WebFileUploadField() {
    fileUploading = AppBeans.get(FileUploadingAPI.NAME);
    exportDisplay = AppBeans.get(ExportDisplay.NAME);
    messages = AppBeans.get(Messages.NAME);

    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    if ((webBrowser.isIE() && !webBrowser.isEdge()) && webBrowser.getBrowserMajorVersion() < 10) {
        initOldUploadButton();
    } else {
        initUploadButton();
    }

    initComponent();
    attachListener(component);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:16,代码来源:WebFileUploadField.java


示例11: WebFileMultiUploadField

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
public WebFileMultiUploadField() {
    fileUploading = AppBeans.get(FileUploadingAPI.NAME);

    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    if ((webBrowser.isIE() && !webBrowser.isEdge()) && webBrowser.getBrowserMajorVersion() < 10) {
        initOldComponent();
    } else {
        initComponent();
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:WebFileMultiUploadField.java


示例12: getBrowserTimeZone

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
/**
 * Get browser time zone.
 *
 * @return TimeZone
 */
public static TimeZone getBrowserTimeZone() {
    final WebBrowser webBrowser = com.vaadin.server.Page.getCurrent().getWebBrowser();
    final String[] timeZones = TimeZone.getAvailableIDs(webBrowser.getRawTimezoneOffset());
    TimeZone tz = TimeZone.getDefault();
    for (final String string : timeZones) {
        final TimeZone t = TimeZone.getTimeZone(string);
        if (t.getRawOffset() == webBrowser.getRawTimezoneOffset()) {
            tz = t;
        }
    }
    return tz;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:18,代码来源:SPDateTimeUtil.java


示例13: getCtrlOrMetaModifier

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
/**
 * Returns the ctrl or meta modifier depending on the platform.
 * 
 * @return on mac return
 *         {@link com.vaadin.event.ShortcutAction.ModifierKey#META} other
 *         platform return
 *         {@link com.vaadin.event.ShortcutAction.ModifierKey#CTRL}
 */
public static int getCtrlOrMetaModifier() {
    final WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    if (webBrowser.isMacOSX()) {
        return ShortcutAction.ModifierKey.META;
    }

    return ShortcutAction.ModifierKey.CTRL;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:17,代码来源:ShortCutModifierUtils.java


示例14: init

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
@Override
protected void init(final VaadinRequest request) {
	VaadinSession.getCurrent().setErrorHandler(new UiInstanceErrorHandler(this));
	setSizeFull();
	springNavigator.addView("", mainView);
	setNavigator(springNavigator);


	final Page currentPage = Page.getCurrent();
	final String requestUrl = currentPage.getLocation().toString();
	final String language = request.getLocale().getLanguage();
	final UserConfiguration userConfiguration = configurationManager.getUserConfiguration(requestUrl, language);

	currentPage.setTitle(userConfiguration.getAgency().getAgencyName() + ":" + userConfiguration.getPortal().getPortalName() + ":" + userConfiguration.getLanguage().getLanguageName());

	if (getSession().getUIs().isEmpty()) {
		final WebBrowser webBrowser = currentPage.getWebBrowser();

		final CreateApplicationSessionRequest serviceRequest = new CreateApplicationSessionRequest();
		serviceRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());

		final String ipInformation = WebBrowserUtil.getIpInformation(webBrowser);
		serviceRequest.setIpInformation(ipInformation);
		serviceRequest.setUserAgentInformation(webBrowser.getBrowserApplication());
		serviceRequest.setLocale(webBrowser.getLocale().toString());
		serviceRequest.setOperatingSystem(WebBrowserUtil.getOperatingSystem(webBrowser));
		serviceRequest.setSessionType(ApplicationSessionType.ANONYMOUS);

		final ServiceResponse serviceResponse = applicationManager.service(serviceRequest);
		LOGGER.info(LOG_INFO_BROWSER_ADDRESS_APPLICATION_SESSION_ID_RESULT,requestUrl,language,ipInformation,webBrowser.getBrowserApplication(),serviceRequest.getSessionId(),serviceResponse.getResult().toString());
	}
}
 
开发者ID:Hack23,项目名称:cia,代码行数:33,代码来源:CitizenIntelligenceAgencyUI.java


示例15: getIpInformation

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
/**
 * Gets the ip information.
 *
 * @param webBrowser
 *            the web browser
 * @return the ip information
 */
public static String getIpInformation(final WebBrowser webBrowser) {
	String ipInformation=webBrowser.getAddress();

	final HttpServletRequest httpRequest=((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
	final String xForwardedForHeader = httpRequest.getHeader(X_FORWARDED_FOR);
	if (xForwardedForHeader != null) {
		final String[] split = xForwardedForHeader.split(",");
		if (split.length != 0) {
			ipInformation = split[0];
		}
	}
	return ipInformation;
}
 
开发者ID:Hack23,项目名称:cia,代码行数:21,代码来源:WebBrowserUtil.java


示例16: getClientTimeZone

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
public DateTimeZone getClientTimeZone() {

        final UI ui = UI.getCurrent();
        if (ui != null) {
            final Page page = ui.getPage();
            if (page != null) {
                final WebBrowser br = page.getWebBrowser();
                if (br != null) {
                    final int timezoneOffset = br.getTimezoneOffset();
                    return DateTimeZone.forOffsetMillis(timezoneOffset);
                }
            }
        }
        return DateTimeZone.forID("Europe/Moscow");
    }
 
开发者ID:ExtaSoft,项目名称:extacrm,代码行数:16,代码来源:InternalizationUtils.java


示例17: browserSupportCopy

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
protected boolean browserSupportCopy() {
    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    return !webBrowser.isSafari() && !webBrowser.isIOS() && !webBrowser.isWindowsPhone();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:5,代码来源:ExceptionDialog.java


示例18: getDeviceInfo

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
@Nullable
@Override
public DeviceInfo getDeviceInfo() {
    // per request cache
    HttpServletRequest currentServletRequest = VaadinServletService.getCurrentServletRequest();
    if (currentServletRequest == null) {
        return null;
    }

    DeviceInfo deviceInfo = (DeviceInfo) currentServletRequest.getAttribute(DeviceInfoProvider.NAME);
    if (deviceInfo != null) {
        return deviceInfo;
    }

    Page page = Page.getCurrent();

    if (page == null) {
        return null;
    }

    WebBrowser webBrowser = page.getWebBrowser();

    DeviceInfo di = new DeviceInfo();

    di.setAddress(webBrowser.getAddress());
    di.setBrowserApplication(webBrowser.getBrowserApplication());
    di.setBrowserMajorVersion(webBrowser.getBrowserMajorVersion());
    di.setBrowserMinorVersion(webBrowser.getBrowserMinorVersion());

    di.setChrome(webBrowser.isChrome());
    di.setChromeFrame(webBrowser.isChromeFrame());
    di.setChromeFrameCapable(webBrowser.isChromeFrameCapable());
    di.setEdge(webBrowser.isEdge());
    di.setFirefox(webBrowser.isFirefox());
    di.setOpera(webBrowser.isOpera());
    di.setIE(webBrowser.isIE());

    if (webBrowser.isWindows()) {
        di.setOperatingSystem(OperatingSystem.WINDOWS);
    } else if (webBrowser.isAndroid()) {
        di.setOperatingSystem(OperatingSystem.ANDROID);
    } else if (webBrowser.isIOS()) {
        di.setOperatingSystem(OperatingSystem.IOS);
    } else if (webBrowser.isMacOSX()) {
        di.setOperatingSystem(OperatingSystem.MACOSX);
    } else if (webBrowser.isLinux()) {
        di.setOperatingSystem(OperatingSystem.LINUX);
    }

    di.setIPad(webBrowser.isIPad());
    di.setIPhone(webBrowser.isIPhone());
    di.setWindowsPhone(webBrowser.isWindowsPhone());

    di.setSecureConnection(webBrowser.isSecureConnection());
    di.setLocale(webBrowser.getLocale());

    di.setScreenHeight(webBrowser.getScreenHeight());
    di.setScreenWidth(webBrowser.getScreenWidth());

    currentServletRequest.setAttribute(DeviceInfoProvider.NAME, di);

    return di;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:64,代码来源:WebDeviceInfoProvider.java


示例19: isUnsupportedBrowser

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
private static boolean isUnsupportedBrowser() {
    final WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    return webBrowser.isIE() && webBrowser.getBrowserMajorVersion() < 11;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:5,代码来源:AbstractHawkbitLoginUI.java


示例20: enter

import com.vaadin.server.WebBrowser; //导入依赖的package包/类
@Override
public void enter(ViewChangeEvent event) {
    logger.debug("Entering {} view ", QuestionnaireView.NAME);
    addStyleName(Reindeer.LAYOUT_BLUE);
    addStyleName("questionnaires");

    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    Integer screenWidth = webBrowser.getScreenWidth();
    Integer heightWidth = webBrowser.getScreenHeight();

    logger.debug("Browser screen settings  {} x {}", screenWidth, heightWidth);

    if (heightWidth <= 480) {
        renderingMode = RenderingMode.QUESTION_BY_QUESTION;
    }

    // centralLayout.addStyleName("questionnaires");
    // new Responsive(centralLayout);

    RespondentAccount respondent = (RespondentAccount) VaadinServletService.getCurrentServletRequest()
            .getUserPrincipal();
    if (respondent.hasPreferredLanguage()) {
        preferredLanguage =  Language.fromString(respondent.getPreferredLanguage());
    } else {
        preferredLanguage = Language.fromLocale(webBrowser.getLocale());
    }
    questionnaireId = respondent.getGrantedquestionnaireIds().iterator().next();
    logger.debug("Trying to fetch questionnair identified with id  = {} ", questionnaireId);
    QuestionnaireDefinitionDTO definition = questionnaireResource.getDefinition(questionnaireId);
    sectionInfoVisible = definition.isSectionInfoVisible();
    QuestionnairePageDTO page = questionnaireResource.getPage(questionnaireId, renderingMode, preferredLanguage,
            NavigationAction.ENTERING);

    logger.debug("Displaying page {}/{} with {} questions", page.getMetadata().getNumber(), page.getMetadata()
            .getCount(), page.getQuestions().size());
    questionsLayout = new VerticalLayout();
    update(page);

    Label questionnaireTitle = new Label(definition.getLanguageSettings().getTitle());
    questionnaireTitle.addStyleName(Reindeer.LABEL_H1);

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.setMargin(true);
    mainLayout.addComponent(questionnaireTitle);
    mainLayout.addComponent(questionsLayout);
    // Add the responsive capabilities to the components

    Panel centralLayout = new Panel();
    centralLayout.setContent(mainLayout);
    centralLayout.setSizeFull();
    centralLayout.getContent().setSizeUndefined();

    Responsive.makeResponsive(questionnaireTitle);
    setCompositionRoot(centralLayout);
    setSizeFull();
}
 
开发者ID:antoniomaria,项目名称:gazpachoquest,代码行数:58,代码来源:QuestionnaireView.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IWailaEntityAccessor类代码示例发布时间:2022-05-22
下一篇:
Java SoyMapData类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap