* resolve to. | * resolve to. | ||||
* | * | ||||
* @return the URL of the frontend protocol | * @return the URL of the frontend protocol | ||||
* @since 8.1 | |||||
*/ | */ | ||||
public String getFrontendUrl() { | public String getFrontendUrl() { | ||||
return frontendUrl; | return frontendUrl; |
return browserDetails.isSafari(); | return browserDetails.isSafari(); | ||||
} | } | ||||
/** | |||||
* Returns true if the browser is Safari or is a browser that is running on | |||||
* iOS and using the Safari rendering engine. | |||||
* | |||||
* @return true if the browser is using the Safari rendering engine | |||||
* @since 8.1 | |||||
*/ | |||||
public boolean isSafariOrIOS() { | public boolean isSafariOrIOS() { | ||||
return browserDetails.isSafariOrIOS(); | return browserDetails.isSafariOrIOS(); | ||||
} | } |
* Sets the number of items that are visible. If only one item is visible, | * Sets the number of items that are visible. If only one item is visible, | ||||
* then the box will be displayed as a drop-down list (the default). | * then the box will be displayed as a drop-down list (the default). | ||||
* | * | ||||
* @since | |||||
* @since 8.1 | |||||
* @param visibleItemCount | * @param visibleItemCount | ||||
* the visible item count | * the visible item count | ||||
*/ | */ | ||||
* Gets the number of items that are visible. If only one item is visible, | * Gets the number of items that are visible. If only one item is visible, | ||||
* then the box will be displayed as a drop-down list. | * then the box will be displayed as a drop-down list. | ||||
* | * | ||||
* @since | |||||
* @since 8.1 | |||||
* @return the visible item count | * @return the visible item count | ||||
*/ | */ | ||||
public int getVisibleItemCount() { | public int getVisibleItemCount() { |
* | * | ||||
* @return <code>true</code> if the browser supports ES6, <code>false</code> | * @return <code>true</code> if the browser supports ES6, <code>false</code> | ||||
* otherwise. | * otherwise. | ||||
* @since 8.1 | |||||
*/ | */ | ||||
public boolean isEs6Supported() { | public boolean isEs6Supported() { | ||||
if (browserDetails == null) { | if (browserDetails == null) { |
import org.osgi.service.http.NamespaceException; | import org.osgi.service.http.NamespaceException; | ||||
import com.vaadin.osgi.resources.OSGiVaadinResources; | import com.vaadin.osgi.resources.OSGiVaadinResources; | ||||
import com.vaadin.osgi.resources.VaadinResourceService; | |||||
import com.vaadin.osgi.resources.OSGiVaadinResources.ResourceBundleInactiveException; | import com.vaadin.osgi.resources.OSGiVaadinResources.ResourceBundleInactiveException; | ||||
import com.vaadin.osgi.resources.VaadinResourceService; | |||||
/** | |||||
* OSGi service component registering bootstrap JS as published resources in | |||||
* OSGi environments. | |||||
* | |||||
* @author Vaadin Ltd | |||||
* @since 8.1 | |||||
*/ | |||||
@Component(immediate = true) | @Component(immediate = true) | ||||
public class BootstrapContribution { | public class BootstrapContribution { | ||||
private static final String[] RESOURCES = { "vaadinBootstrap.js", | private static final String[] RESOURCES = { "vaadinBootstrap.js", | ||||
@Reference | @Reference | ||||
void setHttpService(HttpService service) { | void setHttpService(HttpService service) { | ||||
this.httpService = service; | |||||
httpService = service; | |||||
} | } | ||||
void unsetHttpService(HttpService service) { | void unsetHttpService(HttpService service) { | ||||
this.httpService = null; | |||||
httpService = null; | |||||
} | } | ||||
} | } |
* Sets the number of items that are visible. If only one item is visible, | * Sets the number of items that are visible. If only one item is visible, | ||||
* then the box will be displayed as a drop-down list (the default). | * then the box will be displayed as a drop-down list (the default). | ||||
* | * | ||||
* @since | |||||
* @since 8.1 | |||||
* @param visibleItemCount | * @param visibleItemCount | ||||
* the visible item count | * the visible item count | ||||
* @throws IllegalArgumentException | * @throws IllegalArgumentException | ||||
* Gets the number of items that are visible. If only one item is visible, | * Gets the number of items that are visible. If only one item is visible, | ||||
* then the box will be displayed as a drop-down list. | * then the box will be displayed as a drop-down list. | ||||
* | * | ||||
* @since | |||||
* @since 8.1 | |||||
* @return the visible item count | * @return the visible item count | ||||
*/ | */ | ||||
public int getVisibleItemCount() { | public int getVisibleItemCount() { |
public static final String PUBLISHED_PROTOCOL_NAME = "published"; | public static final String PUBLISHED_PROTOCOL_NAME = "published"; | ||||
public static final String PUBLISHED_PROTOCOL_PREFIX = PUBLISHED_PROTOCOL_NAME | public static final String PUBLISHED_PROTOCOL_PREFIX = PUBLISHED_PROTOCOL_NAME | ||||
+ "://"; | + "://"; | ||||
/** | |||||
* An internal protocol used for referencing frontend resources. | |||||
* | |||||
* @see #FRONTEND_URL | |||||
* | |||||
* @since 8.1 | |||||
*/ | |||||
public static final String FRONTEND_PROTOCOL_PREFIX = "frontend://"; | public static final String FRONTEND_PROTOCOL_PREFIX = "frontend://"; | ||||
/** | /** | ||||
* <p> | * <p> | ||||
* By default, this is "vaadin://es6" ("vaadin://es5" for browsers which | * By default, this is "vaadin://es6" ("vaadin://es5" for browsers which | ||||
* does not support ES6). | * does not support ES6). | ||||
* | |||||
* @since 8.1 | |||||
*/ | */ | ||||
public static final String FRONTEND_URL = "frontendUrl"; | public static final String FRONTEND_URL = "frontendUrl"; | ||||
/** | /** | ||||
* Configuration name for the {@literal frontend://} URL when using a | * Configuration name for the {@literal frontend://} URL when using a | ||||
* browser which is not ES6 compatible (i.e. IE11 or Safari 9). | * browser which is not ES6 compatible (i.e. IE11 or Safari 9). | ||||
* | |||||
* @since 8.1 | |||||
*/ | */ | ||||
public static final String FRONTEND_URL_ES5 = "frontend.url.es5"; | public static final String FRONTEND_URL_ES5 = "frontend.url.es5"; | ||||
/** | /** | ||||
* Configuration name for the {@literal frontend://} URL when using an ES6 | * Configuration name for the {@literal frontend://} URL when using an ES6 | ||||
* compatible browser. | * compatible browser. | ||||
* | |||||
* @since 8.1 | |||||
*/ | */ | ||||
public static final String FRONTEND_URL_ES6 = "frontend.url.es6"; | public static final String FRONTEND_URL_ES6 = "frontend.url.es6"; | ||||
/** | /** | ||||
* Default value of the configuration of the build URL of ES6 web | * Default value of the configuration of the build URL of ES6 web | ||||
* components. | * components. | ||||
* | |||||
* @since 8.1 | |||||
*/ | */ | ||||
public static final String FRONTEND_URL_ES6_DEFAULT_VALUE = VAADIN_PROTOCOL_PREFIX | public static final String FRONTEND_URL_ES6_DEFAULT_VALUE = VAADIN_PROTOCOL_PREFIX | ||||
+ "frontend/es6/"; | + "frontend/es6/"; | ||||
/** | /** | ||||
* Default value of the configuration of the build URL of ES5 web | * Default value of the configuration of the build URL of ES5 web | ||||
* components. | * components. | ||||
* | |||||
* @since 8.1 | |||||
*/ | */ | ||||
public static final String FRONTEND_URL_ES5_DEFAULT_VALUE = VAADIN_PROTOCOL_PREFIX | public static final String FRONTEND_URL_ES5_DEFAULT_VALUE = VAADIN_PROTOCOL_PREFIX | ||||
+ "frontend/es5/"; | + "frontend/es5/"; |
* iOS). | * iOS). | ||||
* | * | ||||
* @return true if it is Safari or running on IOS, false otherwise | * @return true if it is Safari or running on IOS, false otherwise | ||||
* @since 8.1 | |||||
*/ | */ | ||||
public boolean isSafariOrIOS() { | public boolean isSafariOrIOS() { | ||||
return isSafari() || isIOS(); | return isSafari() || isIOS(); | ||||
return false; | return false; | ||||
} | } | ||||
/** | |||||
* Checks whether the browser should support ES6 based on its vendor and | |||||
* version number. | |||||
* | |||||
* @return true if the browser supports ES6 | |||||
* @since 8.1 | |||||
*/ | |||||
public boolean isEs6Supported() { | public boolean isEs6Supported() { | ||||
if (isTooOldToFunctionProperly()) { | if (isTooOldToFunctionProperly()) { | ||||
return false; | return false; |
* | * | ||||
* @return the absolute or relative URL to the frontend files, ending with a | * @return the absolute or relative URL to the frontend files, ending with a | ||||
* slash '/' | * slash '/' | ||||
* @since 8.1 | |||||
*/ | */ | ||||
protected abstract String getFrontendUrl(); | protected abstract String getFrontendUrl(); | ||||
} | } |
*/ | */ | ||||
public String emptySelectionCaption = ""; | public String emptySelectionCaption = ""; | ||||
/** | |||||
* The number of items that are visible. If only one item is visible, then | |||||
* the box will be displayed as a drop-down list. | |||||
* | |||||
* @since 8.1 | |||||
*/ | |||||
@DelegateToWidget | @DelegateToWidget | ||||
public int visibleItemCount = 1; | public int visibleItemCount = 1; | ||||