You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2021/04/04 13:22:46 UTC
[incubator-hop] branch master updated: Use logo_icon.svg as favicon
This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git
The following commit(s) were added to refs/heads/master by this push:
new 9f441cc Use logo_icon.svg as favicon
new db43de9 Merge pull request #731 from HiromuHota/HOP-2739
9f441cc is described below
commit 9f441cc48cfd94cf612bdf5a831d911e2674f17b
Author: Hiromu Hota <hi...@gmail.com>
AuthorDate: Sat Apr 3 17:12:26 2021 -0700
Use logo_icon.svg as favicon
---
.../main/java/org/apache/hop/ui/hopgui/HopWeb.java | 28 ++++++++++++++++++----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/rap/src/main/java/org/apache/hop/ui/hopgui/HopWeb.java b/rap/src/main/java/org/apache/hop/ui/hopgui/HopWeb.java
index 14f9445..0aa7682 100644
--- a/rap/src/main/java/org/apache/hop/ui/hopgui/HopWeb.java
+++ b/rap/src/main/java/org/apache/hop/ui/hopgui/HopWeb.java
@@ -17,12 +17,18 @@
package org.apache.hop.ui.hopgui;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
-
+import org.apache.batik.transcoder.TranscoderException;
+import org.apache.batik.transcoder.TranscoderInput;
+import org.apache.batik.transcoder.TranscoderOutput;
+import org.apache.batik.transcoder.image.PNGTranscoder;
import org.apache.commons.io.FilenameUtils;
import org.eclipse.rap.rwt.application.Application;
import org.eclipse.rap.rwt.application.ApplicationConfiguration;
@@ -32,11 +38,23 @@ import org.eclipse.rap.rwt.service.ResourceLoader;
public class HopWeb implements ApplicationConfiguration {
public void configure( Application application ) {
- application.addResource( "ui/images/hopUi.ico", new ResourceLoader() {
+ application.addResource("ui/images/logo_icon.png", new ResourceLoader() {
public InputStream getResourceAsStream( String resourceName ) throws IOException {
- return this.getClass().getClassLoader().getResourceAsStream( "ui/images/hopUi.ico" );
+ // Convert svg to png without Display
+ PNGTranscoder t = new PNGTranscoder();
+ InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("ui/images/logo_icon.svg");
+ TranscoderInput input = new TranscoderInput(inputStream);
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ TranscoderOutput output = new TranscoderOutput(outputStream);
+ try {
+ t.transcode(input, output);
+ } catch (TranscoderException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return new ByteArrayInputStream(outputStream.toByteArray());
}
- } );
+ });
Arrays.asList(
"org/apache/hop/ui/hopgui/clipboard.js"
).stream().forEach( str -> {
@@ -49,7 +67,7 @@ public class HopWeb implements ApplicationConfiguration {
});
Map<String, String> properties = new HashMap<String, String>();
properties.put( WebClient.PAGE_TITLE, "Hop" );
- properties.put( WebClient.FAVICON, "ui/images/hopUi.ico" );
+ properties.put( WebClient.FAVICON, "ui/images/logo_icon.png" );
application.addEntryPoint( "/ui", HopWebEntryPoint.class, properties );
application.setOperationMode( Application.OperationMode.SWT_COMPATIBILITY );