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 2020/12/31 12:33:07 UTC

[incubator-hop] branch master updated: HOP-2368: Wrap here with isWeb() as RAP does not allow painting on Image

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 f1a0944  HOP-2368: Wrap here with isWeb() as RAP does not allow painting on Image
     new 765747f  Merge pull request #515 from HiromuHota/HOP-2368
f1a0944 is described below

commit f1a0944b31af7c9667596f459a58dd385a166e98
Author: Hiromu Hota <hi...@gmail.com>
AuthorDate: Wed Dec 30 21:00:10 2020 -0800

    HOP-2368: Wrap here with isWeb() as RAP does not allow painting on Image
---
 .../main/java/org/apache/hop/ui/core/PropsUi.java  | 27 +++++++++++++---------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java b/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
index 7c41057..1aa37b8 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
@@ -35,6 +35,7 @@ import org.apache.hop.history.AuditState;
 import org.apache.hop.ui.core.gui.GuiResource;
 import org.apache.hop.ui.core.gui.HopNamespace;
 import org.apache.hop.ui.core.gui.WindowProperty;
+import org.apache.hop.ui.util.EnvironmentUtils;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.CTabFolder;
 import org.eclipse.swt.graphics.Color;
@@ -96,17 +97,21 @@ public class PropsUi extends Props {
   private PropsUi() {
     super();
 
-    // Calculate the native default zoom factor...
-    // We take the default font and render it, calculate the height.
-    // Compare that to the standard small icon size of 16
-    //
-    Image image = new Image( Display.getCurrent(), 500, 500 );
-    GC gc = new GC( image );
-    org.eclipse.swt.graphics.Point extent = gc.textExtent( "The quick brown fox jumped over the lazy dog!" );
-    nativeZoomFactor = (double) extent.y / (double) ConstUi.SMALL_ICON_SIZE;
-    gc.dispose();
-    image.dispose();
-    
+    if (EnvironmentUtils.getInstance().isWeb()) {
+      nativeZoomFactor = 1.0;
+    } else {
+      // Calculate the native default zoom factor...
+      // We take the default font and render it, calculate the height.
+      // Compare that to the standard small icon size of 16
+      //
+      Image image = new Image(Display.getCurrent(), 500, 500);
+      GC gc = new GC(image);
+      org.eclipse.swt.graphics.Point extent = gc.textExtent("The quick brown fox jumped over the lazy dog!");
+      nativeZoomFactor = (double) extent.y / (double) ConstUi.SMALL_ICON_SIZE;
+      gc.dispose();
+      image.dispose();
+    }
+
     setDefault();
   }