Skip to content

Commit

Permalink
fix image resource path using portlet.properties (#61)
Browse files Browse the repository at this point in the history
* build image resource path using portlets.properties
  • Loading branch information
wow-such-code authored Sep 6, 2022
1 parent 5ac4971 commit 1a0a565
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>projectwizard-portlet</artifactId>
<groupId>life.qbic</groupId>
<version>1.13.0-SNAPSHOT</version>
<version>1.13.0</version>
<name>ProjectWizard Portlet</name>
<url>https://github.com/qbicsoftware/projectwizard-portlet</url>
<description>Creates hierarchical experiments using factorial design.</description>
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/life/qbic/portal/portlet/ProjectWizardUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.vaadin.teemu.wizards.Wizard;
Expand All @@ -33,8 +34,6 @@
import life.qbic.omero.BasicOMEROClient;
import life.qbic.openbis.openbisclient.IOpenBisClient;
import life.qbic.openbis.openbisclient.OpenBisClient;
import life.qbic.portal.portlet.QBiCPortletUI;
import life.qbic.portal.samplegraph.GraphPage;
import life.qbic.portal.utils.ConfigurationManager;
import life.qbic.portal.utils.ConfigurationManagerFactory;
import life.qbic.portal.utils.PortalUtils;
Expand Down Expand Up @@ -64,7 +63,7 @@ public class ProjectWizardUI extends QBiCPortletUI {
List<String> expTypes = new ArrayList<String>(
Arrays.asList("Q_EXPERIMENTAL_DESIGN", "Q_SAMPLE_EXTRACTION", "Q_SAMPLE_PREPARATION"));

private Logger logger = LogManager.getLogger(ProjectWizardUI.class);
private final static Logger logger = LogManager.getLogger(ProjectWizardUI.class);

private ConfigurationManager config;

Expand Down Expand Up @@ -284,17 +283,16 @@ public static String getPathToVaadinFolder() {
if (PortalUtils.isLiferayPortlet()) {
Properties prop = new Properties();
// workaround
GraphPage p = new GraphPage();
InputStream in = p.getClass().getClassLoader()
.getResourceAsStream("WEB-INF/liferay-plugin-package.properties");
InputStream in = ProjectWizardUI.class.getClassLoader()
.getResourceAsStream("portlet.properties");
try {
prop.load(in);
in.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
logger.error("Could not load portlet.properties");
e1.printStackTrace();
}
String portletName = prop.getProperty("name");
String portletName = prop.getProperty("artifact.id");

URI location = UI.getCurrent().getPage().getLocation();
// http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ public void buttonClick(ClickEvent event) {

Resource res =
new ExternalResource(ProjectWizardUI.getPathToVaadinFolder() + "img/isatools.png");
Image imNotYourC_Pal = new Image(null, res);
layout.addComponent(imNotYourC_Pal);
Image isaTools = new Image(null, res);
layout.addComponent(isaTools);

subWindow.setContent(layout);
// Center it in the browser window
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/portlet.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ include-and-override=${liferay.home}/qbic-ext.properties
# Do not modify the values. These are automatically resolved by maven during the build.
version=${project.version}
repository.url=${project.url}
artifact.id=${artifactId}

0 comments on commit 1a0a565

Please sign in to comment.