Class Browser
Browser
class contains various class attributes that indicate basic properties of the browser and
whether certain features are enabled.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
Preferred font size increase if none is specified.static int
Preferred control size increase if none is specified.static String
Preferred default skin if none is specified.static boolean
Is the application running in a desktop browser? This is true ifisTablet
andisHandset
are bothfalse
.static boolean
Is the application running on a handset-sized device, with a typical screen width of around 3-4 inches?static boolean
Are theMultiWindow
APIs supported and cross-window optimizations enabled? By default this is true in themain window
ifOpenFin
is loaded, false otherwise.static boolean
Are we in an OpenFin environment? See class OpenFin for ways to call OpenFin methods from within Smart GWT.static boolean
Is the application running on a tablet device (e.g.static boolean
Is the application running on a touch device (e.g.static boolean
Whether browser is capable of rendering flat skins (e.g.static void
setIsDesktop
(boolean isDesktop) Setter forisDesktop
to allow this global variable to be changed at runtime.static void
setIsHandset
(boolean isHandset) Setter forisHandset
to allow this global variable to be changed at runtime.static void
setIsMultiWindow
(boolean isMultiWindow) Sets a non-default value forisMultiWindow
, such as enabling it even ifOpenFin
isn't present.static void
setIsTablet
(boolean isTablet) Setter forisTablet
to allow this global variable to be changed at runtime.static void
setIsTouch
(boolean isTouch) Setter forisTouch
to allow this global variable to be changed at runtime.
-
Constructor Details
-
Browser
public Browser()
-
-
Method Details
-
getDefaultFontIncrease
public static int getDefaultFontIncrease()Preferred font size increase if none is specified.- Returns:
- current value of defaultFontIncrease
-
getDefaultSizeIncrease
public static int getDefaultSizeIncrease()Preferred control size increase if none is specified.- Returns:
- current value of defaultSizeIncrease
-
getDefaultSkin
Preferred default skin if none is specified.- Returns:
- current value of defaultSkin
-
getIsDesktop
public static boolean getIsDesktop()Is the application running in a desktop browser? This is true ifisTablet
andisHandset
are bothfalse
.- Returns:
- current value of isDesktop
-
getIsHandset
public static boolean getIsHandset()Is the application running on a handset-sized device, with a typical screen width of around 3-4 inches?This typically implies that the application will be working with only 300-400 pixels.
- Returns:
- current value of isHandset
-
getIsMultiWindow
public static boolean getIsMultiWindow()Are theMultiWindow
APIs supported and cross-window optimizations enabled? By default this is true in themain window
ifOpenFin
is loaded, false otherwise. Inchild windows
, this property is read-only, and assumes the value from the main window.Note:
MultiWindow
is currently an experimental feature and not supported except by special arrangement- Returns:
- current value of isMultiWindow
-
getIsOpenFin
public static boolean getIsOpenFin()Are we in an OpenFin environment? See class OpenFin for ways to call OpenFin methods from within Smart GWT.- Returns:
- current value of isOpenFin
-
getIsTablet
public static boolean getIsTablet()Is the application running on a tablet device (e.g. iPad, Nexus 7)?Smart GWT can correctly determine whether the device is a tablet in most cases. On any uncommon device for which this variable is incorrect, you can define the
isc_isTablet
global with the correct value, and Smart GWT will useisc_isTablet
forBrowser.isTablet
instead of its own detection logic. Alternatively, you can usesetIsTablet()
to change this global variable before any components are created.The value of this variable is only meaningful on touch devices.
- Returns:
- current value of isTablet
-
getIsTouch
public static boolean getIsTouch()Is the application running on a touch device (e.g. iPhone, iPad, Android device, etc.)?Smart GWT's auto-detected value for
isTouch
can be overridden viasetIsTouch()
.- Returns:
- current value of isTouch
-
getSupportsFlatSkins
public static boolean getSupportsFlatSkins()Whether browser is capable of rendering flat skins (e.g. Tahoe).- Returns:
- current value of supportsFlatSkins
-
setIsDesktop
public static void setIsDesktop(boolean isDesktop) Setter forisDesktop
to allow this global variable to be changed at runtime. This advanced method is provided to override Smart GWT's detection of devices, since the framework can only detect devices that existed at the time the platform was released. Any changes toisDesktop
,isHandset
, orisTablet
must be made before any component is created; it is an application error to attempt to changeisDesktop
,isHandset
, orisTablet
after components have been created.Note that setting
Browser.isDesktop
might affect the values ofisHandset
andisTablet
.- Parameters:
isDesktop
- new setting forBrowser.isDesktop
.
-
setIsHandset
public static void setIsHandset(boolean isHandset) Setter forisHandset
to allow this global variable to be changed at runtime. This advanced method is provided to override Smart GWT's detection of devices, since the framework can only detect devices that existed at the time the platform was released. Any changes toisDesktop
,isHandset
, orisTablet
must be made before any component is created; it is an application error to attempt to changeisDesktop
,isHandset
, orisTablet
after components have been created.Note that setting
Browser.isHandset
might affect the values ofisDesktop
andisTablet
.- Parameters:
isHandset
- new setting forBrowser.isHandset
.
-
setIsMultiWindow
public static void setIsMultiWindow(boolean isMultiWindow) Sets a non-default value forisMultiWindow
, such as enabling it even ifOpenFin
isn't present.Note that this method may only be called from the
main window
, and only once.- Parameters:
isMultiWindow
- new setting forBrowser.isMultiWindow
.
-
setIsTablet
public static void setIsTablet(boolean isTablet) Setter forisTablet
to allow this global variable to be changed at runtime. This advanced method is provided to override Smart GWT's detection of devices, since the framework can only detect devices that existed at the time the platform was released. Any changes toisDesktop
,isHandset
, orisTablet
must be made before any component is created; it is an application error to attempt to changeisDesktop
,isHandset
, orisTablet
after components have been created.Note that setting
Browser.isTablet
might affect the values ofisDesktop
andisHandset
.- Parameters:
isTablet
- new setting forBrowser.isTablet
.
-
setIsTouch
public static void setIsTouch(boolean isTouch) Setter forisTouch
to allow this global variable to be changed at runtime. This advanced method is provided to override Smart GWT's auto-detection logic, since the framework can only detect touch devices that existed at the time the platform was released. Any change toisTouch
must be made before any component is created; it is an application error to attempt to changeisTouch
after components have been created.Note that setting
Browser.isTouch
might affect the values ofisDesktop
,isTablet
, and/orisHandset
.- Parameters:
isTouch
- new setting forBrowser.isTablet
.
-