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/hop.git
The following commit(s) were added to refs/heads/master by this push:
new 0a337ef098 option aded to look and feel to hide the viewport, fixes
#2310
new 71e3cc2d44 Merge pull request #2982 from hansva/master
0a337ef098 is described below
commit 0a337ef098434119688178121cd5d48ef0255ad4
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Thu Jun 1 11:50:25 2023 +0200
option aded to look and feel to hide the viewport, fixes #2310
---
core/src/main/java/org/apache/hop/core/Props.java | 9 ++--
.../java/org/apache/hop/core/gui/BasePainter.java | 9 ++--
.../org/apache/hop/pipeline/PipelinePainter.java | 54 +++++++++++++---------
.../main/java/org/apache/hop/ui/core/PropsUi.java | 9 ++++
.../hopgui/file/pipeline/HopGuiPipelineGraph.java | 1 +
.../hopgui/file/workflow/HopGuiWorkflowGraph.java | 18 ++++----
.../configuration/tabs/ConfigGuiOptionsTab.java | 25 +++++++++-
.../perspective/dataorch/HopGuiAbstractGraph.java | 2 -
.../core/dialog/messages/messages_en_US.properties | 2 +
9 files changed, 86 insertions(+), 43 deletions(-)
diff --git a/core/src/main/java/org/apache/hop/core/Props.java
b/core/src/main/java/org/apache/hop/core/Props.java
index eb0011e2a8..13001f804d 100644
--- a/core/src/main/java/org/apache/hop/core/Props.java
+++ b/core/src/main/java/org/apache/hop/core/Props.java
@@ -17,15 +17,14 @@
package org.apache.hop.core;
+import java.util.Iterator;
+import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.apache.hop.core.config.HopConfig;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.logging.ILogChannel;
import org.apache.hop.core.logging.LogChannel;
-import java.util.Iterator;
-import java.util.Map;
-
/**
* We use Props to store all kinds of user interactive information such as the
selected colors,
* fonts, positions of windows, etc.
@@ -75,6 +74,8 @@ public class Props implements Cloneable {
public static final String STRING_OPEN_LAST_FILE = "OpenLastFile";
public static final String STRING_SHOW_CANVAS_GRID = "ShowCanvasGrid";
+
+ public static final String STRING_HIDE_VIEWPORT = "HideViewport";
public static final String STRING_SHOW_TABLE_VIEW_TOOLBAR =
"ShowTableViewToolbar";
public static final String STRING_SHOW_EXIT_WARNING = "ShowExitWarning";
@@ -94,7 +95,7 @@ public class Props implements Cloneable {
public static final int WIDGET_STYLE_TOOLBAR = 5;
public static final int WIDGET_STYLE_PUSH_BUTTON = 6;
public static final int WIDGET_STYLE_TREE = 7;
-
+
public Props() {
log = new LogChannel(STRING_USER_PREFERENCES);
}
diff --git a/engine/src/main/java/org/apache/hop/core/gui/BasePainter.java
b/engine/src/main/java/org/apache/hop/core/gui/BasePainter.java
index b96483d162..e82b42db9f 100644
--- a/engine/src/main/java/org/apache/hop/core/gui/BasePainter.java
+++ b/engine/src/main/java/org/apache/hop/core/gui/BasePainter.java
@@ -17,6 +17,7 @@
package org.apache.hop.core.gui;
+import java.util.List;
import org.apache.hop.base.BaseHopMeta;
import org.apache.hop.base.IBaseMeta;
import org.apache.hop.core.Const;
@@ -30,8 +31,6 @@ import org.apache.hop.core.util.Utils;
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.pipeline.transform.stream.StreamIcon;
-import java.util.List;
-
public abstract class BasePainter<Hop extends BaseHopMeta<?>, Part extends
IBaseMeta> {
public final double theta = Math.toRadians(11); // arrowhead sharpness
@@ -238,7 +237,7 @@ public abstract class BasePainter<Hop extends
BaseHopMeta<?>, Part extends IBase
}
protected Point real2screen(int x, int y) {
- Point screen = new Point((int)(x + offset.x), (int)(y + offset.y));
+ Point screen = new Point((int) (x + offset.x), (int) (y + offset.y));
return screen;
}
@@ -270,13 +269,13 @@ public abstract class BasePainter<Hop extends
BaseHopMeta<?>, Part extends IBase
Point bounds = gc.getDeviceBounds();
for (int x = 0; x < bounds.x; x += gridSize) {
for (int y = 0; y < bounds.y; y += gridSize) {
- gc.drawPoint((int)(x + (offset.x % gridSize)), (int)(y + (offset.y %
gridSize)));
+ gc.drawPoint((int) (x + (offset.x % gridSize)), (int) (y + (offset.y %
gridSize)));
}
}
}
protected int round(double value) {
- return (int)Math.round(value);
+ return (int) Math.round(value);
}
protected int calcArrowLength() {
diff --git a/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java
b/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java
index b8b85f2606..4ae178c1c5 100644
--- a/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java
+++ b/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java
@@ -17,6 +17,11 @@
package org.apache.hop.pipeline;
+import java.text.DecimalFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.apache.hop.core.Const;
import org.apache.hop.core.NotePadMeta;
import org.apache.hop.core.exception.HopException;
@@ -50,17 +55,6 @@ import org.apache.hop.pipeline.transform.stream.IStream;
import org.apache.hop.pipeline.transform.stream.IStream.StreamType;
import org.apache.hop.pipeline.transform.stream.StreamIcon;
-import java.text.DecimalFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.hop.core.gui.IGc.EColor;
-import static org.apache.hop.core.gui.IGc.EFont;
-import static org.apache.hop.core.gui.IGc.EImage;
-import static org.apache.hop.core.gui.IGc.ELineStyle;
-
public class PipelinePainter extends BasePainter<PipelineHopMeta,
TransformMeta> {
private static final Class<?> PKG = PipelinePainter.class; // For Translator
@@ -202,7 +196,7 @@ public class PipelinePainter extends
BasePainter<PipelineHopMeta, TransformMeta>
// Draw the pipeline onto the image
//
- gc.setTransform((float)offset.x, (float)offset.y, magnification);
+ gc.setTransform((float) offset.x, (float) offset.y, magnification);
gc.setAlpha(255);
drawPipeline();
@@ -790,7 +784,7 @@ public class PipelinePainter extends
BasePainter<PipelineHopMeta, TransformMeta>
// Show an information icon in the upper left corner of the transform...
//
- if ( !Utils.isEmpty(transformMeta.getDescription()) ) {
+ if (!Utils.isEmpty(transformMeta.getDescription())) {
int xInfo = x - (miniIconSize / 2) - 1;
int yInfo = y - (miniIconSize / 2) - 1;
gc.drawImage(EImage.INFO_DISABLED, xInfo, yInfo, magnification);
@@ -805,7 +799,7 @@ public class PipelinePainter extends
BasePainter<PipelineHopMeta, TransformMeta>
pipelineMeta,
transformMeta));
}
-
+
Point namePosition = getNamePosition(name, screen, iconSize);
// Help out the user working in single-click mode by allowing the name to
be clicked to edit
@@ -1237,32 +1231,44 @@ public class PipelinePainter extends
BasePainter<PipelineHopMeta, TransformMeta>
}
}
- /** @return the transformLogMap */
+ /**
+ * @return the transformLogMap
+ */
public Map<String, String> getTransformLogMap() {
return transformLogMap;
}
- /** @param transformLogMap the transformLogMap to set */
+ /**
+ * @param transformLogMap the transformLogMap to set
+ */
public void setTransformLogMap(Map<String, String> transformLogMap) {
this.transformLogMap = transformLogMap;
}
- /** @param startHopTransform the start Hop Transform to set */
+ /**
+ * @param startHopTransform the start Hop Transform to set
+ */
public void setStartHopTransform(TransformMeta startHopTransform) {
this.startHopTransform = startHopTransform;
}
- /** @param endHopLocation the endHopLocation to set */
+ /**
+ * @param endHopLocation the endHopLocation to set
+ */
public void setEndHopLocation(Point endHopLocation) {
this.endHopLocation = endHopLocation;
}
- /** @param noInputTransform the no Input Transform to set */
+ /**
+ * @param noInputTransform the no Input Transform to set
+ */
public void setNoInputTransform(TransformMeta noInputTransform) {
this.noInputTransform = noInputTransform;
}
- /** @param endHopTransform the end Hop Transform to set */
+ /**
+ * @param endHopTransform the end Hop Transform to set
+ */
public void setEndHopTransform(TransformMeta endHopTransform) {
this.endHopTransform = endHopTransform;
}
@@ -1332,7 +1338,9 @@ public class PipelinePainter extends
BasePainter<PipelineHopMeta, TransformMeta>
return outputRowsMap;
}
- /** @param outputRowsMap The outputRowsMap to set */
+ /**
+ * @param outputRowsMap The outputRowsMap to set
+ */
public void setOutputRowsMap(Map<String, RowBuffer> outputRowsMap) {
this.outputRowsMap = outputRowsMap;
}
@@ -1346,7 +1354,9 @@ public class PipelinePainter extends
BasePainter<PipelineHopMeta, TransformMeta>
return stateMap;
}
- /** @param stateMap The stateMap to set */
+ /**
+ * @param stateMap The stateMap to set
+ */
public void setStateMap(Map<String, Object> stateMap) {
this.stateMap = stateMap;
}
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 df1ef8b17e..81103f9390 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
@@ -454,6 +454,15 @@ public class PropsUi extends Props {
setProperty(STRING_SHOW_CANVAS_GRID, anti ? YES : NO);
}
+ public boolean isHideViewportEnabled() {
+ String showViewport = getProperty(STRING_HIDE_VIEWPORT, NO);
+ return YES.equalsIgnoreCase(showViewport); // Default: don't hide the
viewport
+ }
+
+ public void setHideViewportEnabled(boolean anti) {
+ setProperty(STRING_HIDE_VIEWPORT, anti ? YES : NO);
+ }
+
public boolean showExitWarning() {
String show = getProperty(STRING_SHOW_EXIT_WARNING, YES);
return YES.equalsIgnoreCase(show); // Default: show repositories dialog at
startup
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
index ff94ded268..f85294ebca 100644
---
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
+++
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java
@@ -3309,6 +3309,7 @@ public class HopGuiPipelineGraph extends
HopGuiAbstractGraph
pipelinePainter.setMaximum(maximum);
pipelinePainter.setShowingNavigationView(true);
pipelinePainter.setScreenMagnification(magnification);
+
pipelinePainter.setShowingNavigationView(!PropsUi.getInstance().isHideViewportEnabled());
try {
pipelinePainter.drawPipelineImage();
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
index aa646666bc..25c62bac8f 100644
---
a/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
+++
b/ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java
@@ -17,6 +17,14 @@
package org.apache.hop.ui.hopgui.file.workflow;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.vfs2.FileName;
import org.apache.commons.vfs2.FileObject;
@@ -157,15 +165,6 @@ import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.ToolTip;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
/** Handles the display of Workflows in HopGui, in a graphical form. */
@GuiPlugin(description = "Workflow Graph tab")
public class HopGuiWorkflowGraph extends HopGuiAbstractGraph
@@ -2827,6 +2826,7 @@ public class HopGuiWorkflowGraph extends
HopGuiAbstractGraph
workflowPainter.setMaximum(maximum);
workflowPainter.setShowingNavigationView(true);
workflowPainter.setScreenMagnification(magnification);
+
workflowPainter.setShowingNavigationView(!PropsUi.getInstance().isHideViewportEnabled());
try {
workflowPainter.drawWorkflow();
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/tabs/ConfigGuiOptionsTab.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/tabs/ConfigGuiOptionsTab.java
index 416e6bffd0..868bb05b2f 100644
---
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/tabs/ConfigGuiOptionsTab.java
+++
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/tabs/ConfigGuiOptionsTab.java
@@ -82,6 +82,7 @@ public class ConfigGuiOptionsTab {
private Text wGridSize;
private Button wDarkMode;
private Button wShowCanvasGrid;
+ private Button wHideViewport;
private Button wHideMenuBar;
private Button wShowTableViewToolbar;
private Combo wDefaultLocale;
@@ -420,6 +421,27 @@ public class ConfigGuiOptionsTab {
wShowCanvasGrid.setLayoutData(fdShowCanvasGrid);
wShowCanvasGrid.addListener(SWT.Selection, e -> saveValues());
+ // Hide Viewport
+ Label wlHideViewport = new Label(wLookComp, SWT.RIGHT);
+ wlHideViewport.setText(BaseMessages.getString(PKG,
"EnterOptionsDialog.ShowViewport.Label"));
+ wlHideViewport.setToolTipText(
+ BaseMessages.getString(PKG,
"EnterOptionsDialog.ShowViewport.ToolTip"));
+ PropsUi.setLook(wlHideViewport);
+ FormData fdlHideViewport = new FormData();
+ fdlHideViewport.left = new FormAttachment(0, 0);
+ fdlHideViewport.right = new FormAttachment(middle, -margin);
+ fdlHideViewport.top = new FormAttachment(wShowCanvasGrid, margin);
+ wlHideViewport.setLayoutData(fdlHideViewport);
+ wHideViewport = new Button(wLookComp, SWT.CHECK);
+ PropsUi.setLook(wHideViewport);
+ wHideViewport.setSelection(props.isHideViewportEnabled());
+ FormData fdHideViewport = new FormData();
+ fdHideViewport.left = new FormAttachment(middle, 0);
+ fdHideViewport.right = new FormAttachment(100, -margin);
+ fdHideViewport.top = new FormAttachment(wlHideViewport, 0, SWT.CENTER);
+ wHideViewport.setLayoutData(fdHideViewport);
+ wHideViewport.addListener(SWT.Selection, e -> saveValues());
+
// Hide menu bar?
Label wlHideMenuBar = new Label(wLookComp, SWT.RIGHT);
wlHideMenuBar.setText(BaseMessages.getString(PKG,
"EnterOptionsDialog.HideMenuBar.Label"));
@@ -429,7 +451,7 @@ public class ConfigGuiOptionsTab {
FormData fdlHideMenuBar = new FormData();
fdlHideMenuBar.left = new FormAttachment(0, 0);
fdlHideMenuBar.right = new FormAttachment(middle, -margin);
- fdlHideMenuBar.top = new FormAttachment(wShowCanvasGrid, 2 * margin);
+ fdlHideMenuBar.top = new FormAttachment(wHideViewport, 2 * margin);
wlHideMenuBar.setLayoutData(fdlHideMenuBar);
wHideMenuBar = new Button(wLookComp, SWT.CHECK);
PropsUi.setLook(wHideMenuBar);
@@ -716,6 +738,7 @@ public class ConfigGuiOptionsTab {
props.setCanvasGridSize(Const.toInt(wGridSize.getText(), 1));
props.setGlobalZoomFactor(Const.toDouble(wGlobalZoom.getText().replace("%",
""), 100) / 100);
props.setShowCanvasGridEnabled(wShowCanvasGrid.getSelection());
+ props.setHideViewportEnabled(wHideViewport.getSelection());
props.setDarkMode(wDarkMode.getSelection());
props.setHidingMenuBar(wHideMenuBar.getSelection());
props.setShowTableViewToolbar(wShowTableViewToolbar.getSelection());
diff --git
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/dataorch/HopGuiAbstractGraph.java
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/dataorch/HopGuiAbstractGraph.java
index 8a56901d69..14733dd3b0 100644
---
a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/dataorch/HopGuiAbstractGraph.java
+++
b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/dataorch/HopGuiAbstractGraph.java
@@ -34,9 +34,7 @@ import org.apache.hop.ui.hopgui.file.IHopFileType;
import org.apache.hop.ui.hopgui.perspective.execution.DragViewZoomBase;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
diff --git
a/ui/src/main/resources/org/apache/hop/ui/core/dialog/messages/messages_en_US.properties
b/ui/src/main/resources/org/apache/hop/ui/core/dialog/messages/messages_en_US.properties
index 1521e1717d..0016102b8b 100644
---
a/ui/src/main/resources/org/apache/hop/ui/core/dialog/messages/messages_en_US.properties
+++
b/ui/src/main/resources/org/apache/hop/ui/core/dialog/messages/messages_en_US.properties
@@ -119,6 +119,8 @@ EnterOptionsDialog.RestartWarning.Option1=Close
EnterOptionsDialog.RestartWarning.Option2=Please don't show this message again
EnterOptionsDialog.ShowCanvasGrid.Label=Show Canvas Grid
EnterOptionsDialog.ShowCanvasGrid.ToolTip=If enabled, the canvas grid will be
visible
+EnterOptionsDialog.ShowViewport.Label=Hide Viewport
+EnterOptionsDialog.ShowViewport.ToolTip=If enabled, the viewport in the bottom
right will be hidden
EnterOptionsDialog.HideMenuBar.ToolTip=Enabling this option hides the menu bar
from the user interface.
EnterOptionsDialog.HideMenuBar.Label=Hide the menu bar
EnterOptionsDialog.TableOutput.SortMappings.Label=Table Output: sort mappings