Skip to content

Commit

Permalink
Addresses #349 (comment)
Browse files Browse the repository at this point in the history
Simplifies DefaultThemeProvider#defaultTheme() methods
  • Loading branch information
martin-g committed Nov 19, 2014
1 parent fc81375 commit 58a8e22
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,26 @@ public DefaultThemeProvider addDefaultTheme(final ITheme theme) {
/**
* sets the default theme.
*
* @param theme The new default theme
* @param newDefaultTheme The new default theme
* @return This instance
*/
public DefaultThemeProvider defaultTheme(final ITheme theme) {
return defaultTheme(theme.name());
public DefaultThemeProvider defaultTheme(final ITheme newDefaultTheme) {
if (newDefaultTheme != null && !newDefaultTheme.equals(defaultTheme)) {
defaultTheme = newDefaultTheme;
}

return this;
}

/**
* sets the default theme.
*
* @param themeName The new default theme
* @param themeName The name of the new default theme
* @return This instance
*/
public DefaultThemeProvider defaultTheme(final String themeName) {
ITheme newDefaultTheme = byName(themeName);

if (newDefaultTheme != null && !newDefaultTheme.equals(defaultTheme)) {
defaultTheme = newDefaultTheme;
}

return this;
return defaultTheme(newDefaultTheme);
}

@Override
Expand Down

0 comments on commit 58a8e22

Please sign in to comment.