Skip to content

Commit

Permalink
Fix UIProvider backwards compatibility with AppWidgetset
Browse files Browse the repository at this point in the history
Change-Id: Ia3171f4398caa9824f9b511da6576baa7b40be07
  • Loading branch information
Teemu Suo-Anttila authored and Vaadin Code Review committed May 11, 2016
1 parent 14eebab commit 790b9cb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion all/src/main/templates/release-notes.html
Expand Up @@ -112,7 +112,7 @@ <h3 id="incompatible">Incompatible or Behavior-altering Changes in @version-mino
<ul> <ul>
<li>Vaadin artifacts no longer bring a transitive dependency to javax.servlet:servlet-api.</li> <li>Vaadin artifacts no longer bring a transitive dependency to javax.servlet:servlet-api.</li>
<li>System properties now override application parameters for settings such as production mode (see above).</li> <li>System properties now override application parameters for settings such as production mode (see above).</li>
<li>The return type of UIProvider.getWidgetset() and BootstrapHandler.getWidgetsetForUI() has changed.</li> <li>The return type of BootstrapHandler.getWidgetsetForUI() has changed.</li>
</ul> </ul>
<h3 id="knownissues">Known Issues and Limitations</h3> <h3 id="knownissues">Known Issues and Limitations</h3>
<ul> <ul>
Expand Down
Expand Up @@ -470,7 +470,7 @@ public WidgetsetInfo getWidgetsetForUI(BootstrapContext context) {
UICreateEvent event = new UICreateEvent(context.getRequest(), UICreateEvent event = new UICreateEvent(context.getRequest(),
context.getUIClass()); context.getUIClass());
WidgetsetInfo widgetset = context.getBootstrapResponse() WidgetsetInfo widgetset = context.getBootstrapResponse()
.getUIProvider().getWidgetset(event); .getUIProvider().getWidgetsetInfo(event);
if (widgetset == null) { if (widgetset == null) {
// TODO do we want to move WidgetsetInfoImpl elsewhere? // TODO do we want to move WidgetsetInfoImpl elsewhere?
widgetset = new WidgetsetInfoImpl(request.getService() widgetset = new WidgetsetInfoImpl(request.getService()
Expand Down
34 changes: 28 additions & 6 deletions server/src/main/java/com/vaadin/server/UIProvider.java
Expand Up @@ -123,6 +123,30 @@ public String getTheme(UICreateEvent event) {
} }
} }


/**
* Finds the widgetset to use for a specific UI. If no specific widgetset is
* required, <code>null</code> is returned.
* <p>
* This method uses the Widgetset definition priority order from
* {@link #getWidgetsetInfo(UICreateEvent)}.
* <p>
* <strong>Note:</strong> This method exists only for backwards
* compatibility and overriding it won't have the effect it used to.
*
* @param event
* the UI create event with information about the UI and the
* current request.
* @return the name of the widgetset, or <code>null</code> if the default
* widgetset should be used
* @deprecated This method has been replaced by
* {@link #getWidgetsetInfo(UICreateEvent)} in 7.7
*/
@Deprecated
public String getWidgetset(UICreateEvent event) {
WidgetsetInfo widgetsetInfo = getWidgetsetInfo(event);
return widgetsetInfo != null ? widgetsetInfo.getWidgetsetName() : null;
}

/** /**
* Finds the widgetset to use for a specific UI. If no specific widgetset is * Finds the widgetset to use for a specific UI. If no specific widgetset is
* required, <code>null</code> is returned. * required, <code>null</code> is returned.
Expand All @@ -137,17 +161,15 @@ public String getTheme(UICreateEvent event) {
* <li>null to use the default widgetset otherwise</li> * <li>null to use the default widgetset otherwise</li>
* </ul> * </ul>
* *
* Note that the return type of this method changed in Vaadin 7.7. * @since 7.7
* *
* @param event * @param event
* the UI create event with information about the UI and the * the UI create event with information about the UI and the
* current request. * current request.
* @return the name of the widgetset, or <code>null</code> if the default * @return the widgetset info, or <code>null</code> if the default widgetset
* widgetset should be used * should be used
*
* @since 7.7
*/ */
public WidgetsetInfo getWidgetset(UICreateEvent event) { public WidgetsetInfo getWidgetsetInfo(UICreateEvent event) {
Widgetset uiWidgetset = getAnnotationFor(event.getUIClass(), Widgetset uiWidgetset = getAnnotationFor(event.getUIClass(),
Widgetset.class); Widgetset.class);


Expand Down

0 comments on commit 790b9cb

Please sign in to comment.