blob: 1fb4cbba749fc00c3e2b440029ac43c40490fb88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/*
@ITMillApache2LicenseForJavaFiles@
*/
package com.vaadin.terminal.gwt.server;
import java.util.Locale;
import com.vaadin.terminal.Terminal;
@SuppressWarnings("serial")
public class WebBrowser implements Terminal {
private int screenHeight = 0;
private int screenWidth = 0;
private String browserApplication = null;
private Locale locale;
private String address;
private boolean secureConnection;
/**
* There is no default-theme for this terminal type.
*
* @return Allways returns null.
*/
public String getDefaultTheme() {
return null;
}
/**
* Get the height of the users display in pixels.
*
*/
public int getScreenHeight() {
return screenHeight;
}
/**
* Get the width of the users display in pixels.
*
*/
public int getScreenWidth() {
return screenWidth;
}
/**
* Get the browser user-agent string.
*
* @return
*/
public String getBrowserApplication() {
return browserApplication;
}
/**
* For internal use by AbstractApplicationServlet/AbstractApplicationPortlet
* only.
*/
void updateBrowserProperties(Locale locale, String address,
boolean secureConnection, String agent, String sw, String sh) {
this.locale = locale;
this.address = address;
this.secureConnection = secureConnection;
if (agent != null) {
browserApplication = agent;
}
if (sw != null) {
try {
screenHeight = Integer.parseInt(sh);
screenWidth = Integer.parseInt(sw);
} catch (final NumberFormatException e) {
screenHeight = screenWidth = 0;
}
}
}
/**
* Get the IP-address of the web browser. If the application is running
* inside a portlet, this method will return null.
*
* @return IP-address in 1.12.123.123 -format
*/
public String getAddress() {
return address;
}
/** Get the default locate of the browser. */
public Locale getLocale() {
return locale;
}
/** Is the connection made using HTTPS? */
public boolean isSecureConnection() {
return secureConnection;
}
}
|