Package com.day.cq.wcm.mobile.api.device
Interface DeviceGroup
-
public interface DeviceGroup
ADeviceGroup
represents a segment of mobile devices. The segment is defined by the mobile device capabilities expected by the implementation.- Since:
- CQ 5.4.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
RESOURCE_TYPE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
drawHead(PageContext pageContext)
This method is to be used in a JSP script drawing the HTML head.java.util.Collection<DeviceCapability>
getCapabilities()
Returns allDeviceCapability
s supported by this device group.Emulator
getDefaultEmulator()
Returns theEmulator
configured for this device group.java.lang.String
getDescription()
Return the description of this device group as entered by the user.java.util.List<Emulator>
getEmulators()
Returns the emulators associated with this device.java.lang.String[]
getFilterNames()
Returns the names of filters as configured on a device group page.int
getMinimumScreenHeight()
Returns the minimum screen height devices must support in order to belong to this group.int
getMinimumScreenWidth()
Returns the minimum screen width devices must support in order to belong to this group.java.lang.String
getName()
Return the unique name of this device group.java.lang.String
getPath()
Return the path of the content page representing this device group.java.lang.String
getStaticCssPath()
Returns the path of "static.css" if the device group possesses one.java.lang.String
getTitle()
Returns the title of this device group as entered by the user.java.lang.String
getUserAgent()
A device class may optionally specify a mobile client user-agent string which devices must match in order to belong to this group.java.util.regex.Pattern
getUserAgentPattern()
Returns the regex pattern expected for the mobile device user agent to match.boolean
hasCapability(DeviceCapability capability)
Checks whether the device group supports the givenDeviceCapability
.boolean
hasCapability(java.lang.String name)
Checks whether the device group supports the givenDeviceCapability
.boolean
showEditEmulator()
Indicates whether the emulator shall be shown during editing of a page or not.
-
-
-
Field Detail
-
RESOURCE_TYPE
static final java.lang.String RESOURCE_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCapabilities
java.util.Collection<DeviceCapability> getCapabilities()
Returns allDeviceCapability
s supported by this device group.- Returns:
- A
Collection
containing all supported capabilities. If no capabilities are defined, an empty collection is returned.
-
getDefaultEmulator
Emulator getDefaultEmulator()
Returns theEmulator
configured for this device group.- Returns:
- The emulator.
-
getDescription
java.lang.String getDescription()
Return the description of this device group as entered by the user.- Returns:
- The description of this device group or
null
if not defined.
-
getEmulators
java.util.List<Emulator> getEmulators()
Returns the emulators associated with this device.- Returns:
- The emulators.
-
getMinimumScreenWidth
int getMinimumScreenWidth()
Returns the minimum screen width devices must support in order to belong to this group. The width is in pixels.- Returns:
- The minimum screen width in pixels. If not defined,
0
is returned, meaning all widths are accepted.
-
getMinimumScreenHeight
int getMinimumScreenHeight()
Returns the minimum screen height devices must support in order to belong to this group. The height is in pixels.- Returns:
- The minimum screen height in pixels. If not defined,
0
is returned, meaning all heights are accepted.
-
getName
java.lang.String getName()
Return the unique name of this device group.- Returns:
- A
String
representing the name of this device group.
-
getPath
java.lang.String getPath()
Return the path of the content page representing this device group.- Returns:
- A
String
representing the path of this device group.
-
getTitle
java.lang.String getTitle()
Returns the title of this device group as entered by the user.- Returns:
- The device group title or
null
if not defined.
-
getUserAgent
java.lang.String getUserAgent()
A device class may optionally specify a mobile client user-agent string which devices must match in order to belong to this group. If no user-agent string is defined,null
is returned.- Returns:
- A
String
representing the user-agent string expected by this device group, ornull
if not defined.
-
hasCapability
boolean hasCapability(DeviceCapability capability)
Checks whether the device group supports the givenDeviceCapability
.- Parameters:
capability
- The capability to check whether supported by the device group.- Returns:
true
if the device group supports the capability.
-
hasCapability
boolean hasCapability(java.lang.String name)
Checks whether the device group supports the givenDeviceCapability
.- Parameters:
name
- The name of the capability to check whether supported by the device group.- Returns:
true
if the device group supports the capability.
-
drawHead
void drawHead(PageContext pageContext) throws java.io.IOException, ServletException
This method is to be used in a JSP script drawing the HTML head. The method will provide all necessary JS and CSS includes and other initialization required for the device group emulator to work (in authoring mode only) and providing custom CSS for rendering.- Parameters:
pageContext
- The JSP page context.- Throws:
java.io.IOException
- If an error occurred during writing to the response.ServletException
- If an error occurred including the emulator's init component.
-
showEditEmulator
boolean showEditEmulator()
Indicates whether the emulator shall be shown during editing of a page or not. Even if the emulator is disabled for content editing, it will still be shown for preview modes.- Returns:
true
if the emulator shall be shown.
-
getUserAgentPattern
java.util.regex.Pattern getUserAgentPattern()
Returns the regex pattern expected for the mobile device user agent to match.- Returns:
- The pattern.
-
getStaticCssPath
java.lang.String getStaticCssPath()
Returns the path of "static.css" if the device group possesses one. The static.css is used for styling device group specifically the content of a page.- Returns:
- A
String
representing the static path of the CSS of this device group, ornull
if no CSS is present.
-
getFilterNames
java.lang.String[] getFilterNames()
Returns the names of filters as configured on a device group page.- Returns:
- The names.
- See Also:
DeviceMapper.getFilters()
-
-