Skip to content

Commit

Permalink
Added a new property for managing the themed top bar's title (#1524)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrizzi committed Oct 5, 2022
1 parent 4a516da commit 3f61baf
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 3 deletions.
@@ -1,6 +1,7 @@
# We need duplicate this file and have it here as a Workaround for not being able
# to consume org.jboss.windup.util.* because of java.lang.NoClassDefFoundError in windup-distribution
# TODO: Fix this issue in https://issues.redhat.com/browse/WINDUP-3283 and then remove this block of code
distributionTopBarTitle=Migration Toolkit for Applications
distributionBrandName=Migration Toolkit for Applications by Red Hat (MTA)
distributionBrandNameAcronym=MTA
distributionBrandWebsiteUrl=https://developers.redhat.com/products/mta/overview/
Expand Down
@@ -1,6 +1,7 @@
# We need duplicate this file and have it here as a Workaround for not being able
# to consume org.jboss.windup.util.* because of java.lang.NoClassDefFoundError in windup-distribution
# TODO: Fix this issue in https://issues.redhat.com/browse/WINDUP-3283 and then remove this block of code
distributionTopBarTitle=Migration Toolkit for Runtimes
distributionBrandName=Migration Toolkit for Runtimes by Red Hat (MTR)
distributionBrandNameAcronym=MTR
distributionBrandWebsiteUrl=https://developers.redhat.com/products/mtr/overview/
Expand Down
@@ -1,6 +1,7 @@
# We need duplicate this file and have it here as a Workaround for not being able
# to consume org.jboss.windup.util.* because of java.lang.NoClassDefFoundError in windup-distribution
# TODO: Fix this issue in https://issues.redhat.com/browse/WINDUP-3283 and then remove this block of code
distributionTopBarTitle=Tackle Analysis
distributionBrandName=Tackle Analysis
distributionBrandNameAcronym=TACKLE
distributionBrandWebsiteUrl=https://github.com/konveyor/tackle2-addon-windup
Expand Down
@@ -1,6 +1,7 @@
# We need duplicate this file and have it here as a Workaround for not being able
# to consume org.jboss.windup.util.* because of java.lang.NoClassDefFoundError in windup-distribution
# TODO: Fix this issue in https://issues.redhat.com/browse/WINDUP-3283 and then remove this block of code
distributionTopBarTitle=Windup
distributionBrandName=Windup
distributionBrandNameAcronym=WINDUP
distributionBrandWebsiteUrl=https://windup.github.io/
Expand Down
@@ -0,0 +1,19 @@
package org.jboss.windup.reporting.freemarker;

import java.util.List;

import org.jboss.windup.util.ThemeProvider;

import freemarker.template.TemplateModelException;

public class GetWindupTopBarTitleMethod implements WindupFreeMarkerMethod {
@Override
public String getDescription() {
return "Returns the tool top bar title for the current theme.";
}

@Override
public Object exec(List arguments) throws TemplateModelException {
return ThemeProvider.getInstance().getTheme().getTopBarTitle();
}
}
@@ -1,2 +1,2 @@
<strong class="wu-navbar-header">${getWindupBrandName()}</strong>
<strong class="wu-navbar-header">${getWindupTopBarTitle()}</strong>
<img align="right" class="wu-navbar-header" src="${logoPrefix}resources/img/${getWindupBrandNameAcronym()}/brand-horizontal.png" />
8 changes: 7 additions & 1 deletion utils/src/main/java/org/jboss/windup/util/Theme.java
Expand Up @@ -2,6 +2,7 @@

public class Theme {

private final String topBarTitle;
private final String brandName;
private final String brandNameAcronym;
private final String brandWebsiteUrl;
Expand All @@ -10,7 +11,8 @@ public class Theme {
private final String cliVersion;
private final String componentsVersion;

public Theme(String brandName, String brandNameAcronym, String brandWebsiteUrl, String brandDocumentationUrl, String cliName, String cliVersion, String componentsVersion) {
public Theme(String topBarTitle, String brandName, String brandNameAcronym, String brandWebsiteUrl, String brandDocumentationUrl, String cliName, String cliVersion, String componentsVersion) {
this.topBarTitle = topBarTitle;
this.brandName = brandName;
this.brandNameAcronym = brandNameAcronym;
this.brandWebsiteUrl = brandWebsiteUrl;
Expand All @@ -20,6 +22,10 @@ public Theme(String brandName, String brandNameAcronym, String brandWebsiteUrl,
this.componentsVersion = componentsVersion;
}

public String getTopBarTitle() {
return topBarTitle;
}

public String getBrandName() {
return brandName;
}
Expand Down
3 changes: 2 additions & 1 deletion utils/src/main/java/org/jboss/windup/util/ThemeProvider.java
Expand Up @@ -35,6 +35,7 @@ private Theme load(InputStream input) throws IOException {
Properties prop = new Properties();
prop.load(input);

final String topBarTitle = prop.getProperty("distributionTopBarTitle");
final String brandName = prop.getProperty("distributionBrandName");
final String nameAcronym = prop.getProperty("distributionBrandNameAcronym");
final String websiteUrl = prop.getProperty("distributionBrandWebsiteUrl");
Expand All @@ -51,7 +52,7 @@ private Theme load(InputStream input) throws IOException {
// do nothing because the execution continues with the fallback method below
}
}
return new Theme(brandName, nameAcronym, websiteUrl, documentationUrl, cliName, cliVersion, getRuntimeAPIVersion());
return new Theme(topBarTitle, brandName, nameAcronym, websiteUrl, documentationUrl, cliName, cliVersion, getRuntimeAPIVersion());
}

public static ThemeProvider getInstance() {
Expand Down

0 comments on commit 3f61baf

Please sign in to comment.