diff --git a/docs/hop-user-manual/modules/ROOT/pages/hop-gui/perspective-configuration.adoc b/docs/hop-user-manual/modules/ROOT/pages/hop-gui/perspective-configuration.adoc index 9a3852916bd..136beb84423 100644 --- a/docs/hop-user-manual/modules/ROOT/pages/hop-gui/perspective-configuration.adoc +++ b/docs/hop-user-manual/modules/ROOT/pages/hop-gui/perspective-configuration.adoc @@ -80,13 +80,17 @@ TIP: Hops will be shown in bold when a transform or action can be dropped on it |Show help tooltips|Show help tooltips where available in Hop GUI|yes -|Use double click on canvas -a|double-click instead of single click on e.g. transform and action dialogs. +|Use double click on canvas? +|double-click instead of single click on e.g. transform and action dialogs. enabled: double-click on a transform or action icon to open its properties. A single click on the icon opens the context dialog. disabled (default): (single) click on a transform or action icon to open the context dialog. (single) click on a transform or action name to open its properties |no +|Draw border around names on canvas? +|If this option is enabled, a border will be drawn around the names of transforms and actions on the canvas. +|no + |Use global bookmarks in the file dialog|Bookmarks in the file dialog are global (across projects) by default. Enable to make them project-specific|yes |=== 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 e82b42db9f0..252faf79e4d 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 @@ -47,7 +47,7 @@ public abstract class BasePainter, Part extends IBase public static final int CORNER_RADIUS_3 = 6; public static final int CORNER_RADIUS_2 = 4; - protected boolean drawingEditIcons; + protected boolean drawingBorderAroundName; protected double zoomFactor; @@ -79,6 +79,7 @@ public abstract class BasePainter, Part extends IBase protected float screenMagnification; protected Rectangle graphPort; protected Rectangle viewPort; + protected String mouseOverName; public BasePainter( IGc gc, @@ -94,7 +95,8 @@ public BasePainter( String noteFontName, int noteFontHeight, double zoomFactor, - boolean drawingEditIcons) { + boolean drawingBorderAroundName, + String mouseOverName) { this.gc = gc; this.variables = variables; this.subject = subject; @@ -113,7 +115,7 @@ public BasePainter( this.magnification = 1.0f; this.zoomFactor = zoomFactor; - this.drawingEditIcons = drawingEditIcons; + this.drawingBorderAroundName = drawingBorderAroundName; gc.setAntialias(true); @@ -121,6 +123,7 @@ public BasePainter( this.noteFontHeight = noteFontHeight; this.screenMagnification = 1.0f; + this.mouseOverName = mouseOverName; } public static EImage getStreamIconImage(StreamIcon streamIcon, boolean enabled) { @@ -536,17 +539,17 @@ public void setZoomFactor(double zoomFactor) { /** * Gets drawingEditIcons * - * @return value of drawingEditIcons + * @return value of drawingBorderAroundName */ - public boolean isDrawingEditIcons() { - return drawingEditIcons; + public boolean isDrawingBorderAroundName() { + return drawingBorderAroundName; } /** - * @param drawingEditIcons The drawingEditIcons to set + * @param drawingBorderAroundName The option to set */ - public void setDrawingEditIcons(boolean drawingEditIcons) { - this.drawingEditIcons = drawingEditIcons; + public void setDrawingBorderAroundName(boolean drawingBorderAroundName) { + this.drawingBorderAroundName = drawingBorderAroundName; } /** @@ -672,4 +675,22 @@ public Rectangle getViewPort() { public void setViewPort(Rectangle viewPort) { this.viewPort = viewPort; } + + /** + * Gets mouseOverName + * + * @return value of mouseOverName + */ + public String getMouseOverName() { + return mouseOverName; + } + + /** + * Sets mouseOverName + * + * @param mouseOverName value of mouseOverName + */ + public void setMouseOverName(String mouseOverName) { + this.mouseOverName = mouseOverName; + } } 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 4ae178c1c5a..11d4effb7ca 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java +++ b/engine/src/main/java/org/apache/hop/pipeline/PipelinePainter.java @@ -99,7 +99,8 @@ public PipelinePainter( boolean slowTransformIndicatorEnabled, double zoomFactor, Map outputRowsMap, - boolean drawingEditIcons, + boolean drawingBorderAroundName, + String mouseOverName, Map stateMap) { super( gc, @@ -115,7 +116,8 @@ public PipelinePainter( noteFontName, noteFontHeight, zoomFactor, - drawingEditIcons); + drawingBorderAroundName, + mouseOverName); this.pipelineMeta = pipelineMeta; this.candidate = candidate; @@ -146,6 +148,7 @@ public PipelinePainter( int noteFontHeight, double zoomFactor, boolean drawingEditIcons, + String mouseOverName, Map stateMap) { this( gc, @@ -166,6 +169,7 @@ public PipelinePainter( zoomFactor, new HashMap<>(), drawingEditIcons, + mouseOverName, stateMap); } @@ -801,18 +805,13 @@ private void drawTransform(TransformMeta transformMeta) throws HopException { } Point namePosition = getNamePosition(name, screen, iconSize); + Point nameExtent = gc.textExtent(name); // Help out the user working in single-click mode by allowing the name to be clicked to edit // - if (isDrawingEditIcons()) { - - Point nameExtent = gc.textExtent(name); - + if (isDrawingBorderAroundName()) { int tmpAlpha = gc.getAlpha(); gc.setAlpha(230); - - gc.drawImage(EImage.EDIT, namePosition.x - 6, namePosition.y - 2, magnification); - gc.setBackground(EColor.LIGHTGRAY); gc.fillRoundRectangle( namePosition.x - 8, @@ -822,24 +821,36 @@ private void drawTransform(TransformMeta transformMeta) throws HopException { BasePainter.CORNER_RADIUS_5 + 15, BasePainter.CORNER_RADIUS_5 + 15); gc.setAlpha(tmpAlpha); - - areaOwners.add( - new AreaOwner( - AreaType.TRANSFORM_NAME, - namePosition.x - 8, - namePosition.y - 2, - nameExtent.x + 15, - nameExtent.y + 8, - offset, - transformMeta, - name)); } + // Add the area owner for the transform name + // + areaOwners.add( + new AreaOwner( + AreaType.TRANSFORM_NAME, + namePosition.x - 8, + namePosition.y - 2, + nameExtent.x + 15, + nameExtent.y + 8, + offset, + transformMeta, + name)); + gc.setForeground(EColor.BLACK); gc.setFont(EFont.GRAPH); gc.drawText(name, namePosition.x, namePosition.y + 2, true); boolean partitioned = false; + // See if we need to draw a line under the name to make the name look like a hyperlink. + // + if (name.equals(mouseOverName)) { + gc.drawLine( + namePosition.x, + namePosition.y + nameExtent.y, + namePosition.x + nameExtent.x , + namePosition.y + nameExtent.y); + } + TransformPartitioningMeta meta = transformMeta.getTransformPartitioningMeta(); if (transformMeta.isPartitioned() && meta != null) { partitioned = true; diff --git a/engine/src/main/java/org/apache/hop/pipeline/PipelineSvgPainter.java b/engine/src/main/java/org/apache/hop/pipeline/PipelineSvgPainter.java index b6c80ec1ac2..c8df89a9e0b 100644 --- a/engine/src/main/java/org/apache/hop/pipeline/PipelineSvgPainter.java +++ b/engine/src/main/java/org/apache/hop/pipeline/PipelineSvgPainter.java @@ -65,6 +65,7 @@ public static final String generatePipelineSvg( 10, zoomFactor, false, + null, new HashMap<>()); pipelinePainter.setMagnification(magnification); pipelinePainter.drawPipelineImage(); diff --git a/engine/src/main/java/org/apache/hop/workflow/WorkflowPainter.java b/engine/src/main/java/org/apache/hop/workflow/WorkflowPainter.java index 1163776666d..a50caa28fe2 100644 --- a/engine/src/main/java/org/apache/hop/workflow/WorkflowPainter.java +++ b/engine/src/main/java/org/apache/hop/workflow/WorkflowPainter.java @@ -17,6 +17,9 @@ package org.apache.hop.workflow; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; import org.apache.hop.core.NotePadMeta; import org.apache.hop.core.Result; import org.apache.hop.core.exception.HopException; @@ -38,10 +41,6 @@ import org.apache.hop.core.variables.IVariables; import org.apache.hop.workflow.action.ActionMeta; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - public class WorkflowPainter extends BasePainter { private WorkflowMeta workflowMeta; @@ -68,7 +67,8 @@ public WorkflowPainter( String noteFontName, int noteFontHeight, double zoomFactor, - boolean drawingEditIcons) { + boolean drawingBorderAroundName, + String mouseOverName) { super( gc, variables, @@ -83,7 +83,8 @@ public WorkflowPainter( noteFontName, noteFontHeight, zoomFactor, - drawingEditIcons); + drawingBorderAroundName, + mouseOverName); this.workflowMeta = workflowMeta; this.candidate = candidate; @@ -99,7 +100,7 @@ public void drawWorkflow() throws HopException { // Draw the pipeline onto the image // gc.setAlpha(255); - gc.setTransform((float)offset.x, (float)offset.y, magnification); + gc.setTransform((float) offset.x, (float) offset.y, magnification); drawActions(); // Draw the navigation view in native pixels to make calculation a bit easier. @@ -211,10 +212,10 @@ private void drawActions() throws HopException { round(offset.x + n.x + iconSize + 5), round(offset.y + n.y + iconSize + 5)); gc.drawLine( - round(offset.x + n.x - 5), - round(offset.y + n.y + iconSize + 5), - round(offset.x + n.x + iconSize + 5), - round(offset.y + n.y - 5)); + round(offset.x + n.x - 5), + round(offset.y + n.y + iconSize + 5), + round(offset.x + n.x + iconSize + 5), + round(offset.y + n.y - 5)); } try { @@ -274,15 +275,10 @@ protected void drawAction(ActionMeta actionMeta) throws HopException { // Help out the user working in single-click mode by allowing the name to be clicked to edit // - if (isDrawingEditIcons()) { - - Point nameExtent = gc.textExtent(name); - + Point nameExtent = gc.textExtent(name); + if (isDrawingBorderAroundName()) { int tmpAlpha = gc.getAlpha(); gc.setAlpha(230); - - gc.drawImage(EImage.EDIT, xPos - 6, yPos - 2, magnification); - gc.setBackground(EColor.LIGHTGRAY); gc.fillRoundRectangle( xPos - 8, @@ -292,21 +288,31 @@ protected void drawAction(ActionMeta actionMeta) throws HopException { BasePainter.CORNER_RADIUS_5 + 15, BasePainter.CORNER_RADIUS_5 + 15); gc.setAlpha(tmpAlpha); - - areaOwners.add( - new AreaOwner( - AreaType.ACTION_NAME, - xPos - 8, - yPos - 2, - nameExtent.x + 15, - nameExtent.y + 4, - offset, - actionMeta, - name)); } + // Add the area owner for the action name + // + areaOwners.add( + new AreaOwner( + AreaType.ACTION_NAME, + xPos - 8, + yPos - 2, + nameExtent.x + 15, + nameExtent.y + 4, + offset, + actionMeta, + name)); + + gc.setForeground(EColor.BLACK); + gc.setFont(EFont.GRAPH); gc.drawText(name, xPos, yPos, true); + // See if we need to draw a line under the name to make the name look like a hyperlink. + // + if (name.equals(mouseOverName)) { + gc.drawLine(xPos, yPos + nameExtent.y, xPos + nameExtent.x, yPos + nameExtent.y); + } + if (activeActions != null && activeActions.contains(actionMeta)) { gc.setForeground(EColor.BLUE); int iconX = (x + iconSize) - (miniIconSize / 2) + 1; @@ -325,10 +331,10 @@ protected void drawAction(ActionMeta actionMeta) throws HopException { } else { gc.setForeground(EColor.BLACK); } - + // Show an information icon in the upper left corner of the action... // - if ( !Utils.isEmpty(actionMeta.getDescription()) ) { + if (!Utils.isEmpty(actionMeta.getDescription())) { int xInfo = x - (miniIconSize / 2) - 1; int yInfo = y - (miniIconSize / 2) - 1; gc.drawImage(EImage.INFO_DISABLED, xInfo, yInfo, magnification); @@ -642,12 +648,16 @@ public void setActiveActions(List activeActions) { this.activeActions = activeActions; } - /** @return the actionResults */ + /** + * @return the actionResults + */ public List getActionResults() { return actionResults; } - /** @param actionResults Sets AND sorts the action results by name and number */ + /** + * @param actionResults Sets AND sorts the action results by name and number + */ public void setActionResults(List actionResults) { this.actionResults = actionResults; Collections.sort(this.actionResults); diff --git a/engine/src/main/java/org/apache/hop/workflow/WorkflowSvgPainter.java b/engine/src/main/java/org/apache/hop/workflow/WorkflowSvgPainter.java index c966ac5ff99..966537709ac 100644 --- a/engine/src/main/java/org/apache/hop/workflow/WorkflowSvgPainter.java +++ b/engine/src/main/java/org/apache/hop/workflow/WorkflowSvgPainter.java @@ -43,7 +43,7 @@ public static final String generateWorkflowSvg( variables, workflowMeta, maximum, - new DPoint(0,0), + new DPoint(0, 0), null, null, new ArrayList<>(), @@ -53,7 +53,8 @@ public static final String generateWorkflowSvg( "Arial", 10, 1.0d, - false); + false, + null); workflowPainter.setMagnification(magnification); workflowPainter.drawWorkflow(); 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 97f49df3841..27dd83aadbf 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 @@ -81,6 +81,8 @@ public class PropsUi extends Props { private static final String USE_DOUBLE_CLICK_ON_CANVAS = "UseDoubleClickOnCanvas"; + private static final String DRAW_BORDER_AROUND_CANVAS_NAMES = "DrawBorderAroundCanvasNames"; + private static final String USE_GLOBAL_FILE_BOOKMARKS = "UseGlobalFileBookmarks"; private static final String DARK_MODE = "DarkMode"; @@ -779,6 +781,14 @@ public void setUseDoubleClickOnCanvas(boolean use) { setProperty(USE_DOUBLE_CLICK_ON_CANVAS, use ? YES : NO); } + public boolean isBorderDrawnAroundCanvasNames() { + return YES.equalsIgnoreCase(getProperty(DRAW_BORDER_AROUND_CANVAS_NAMES, NO)); + } + + public void setDrawBorderAroundCanvasNames(boolean draw) { + setProperty(DRAW_BORDER_AROUND_CANVAS_NAMES, draw ? YES : NO); + } + public boolean useGlobalFileBookmarks() { return YES.equalsIgnoreCase(getProperty(USE_GLOBAL_FILE_BOOKMARKS, YES)); } 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 3468483ed45..02c3043b3d3 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 @@ -785,10 +785,10 @@ public void mouseDown(MouseEvent e) { if (hop != null) { // Delete hop with on click if (e.button == 1 && shift && control) { - // Delete the hop + // Delete the hop pipelineHopDelegate.delHop(pipelineMeta, hop); updateGui(); - } + } // User held control and clicked a hop between steps - We want to flip the active state of // the hop. // @@ -863,6 +863,7 @@ public void mouseUp(MouseEvent e) { PipelineHopMeta selectedHop = findPipelineHop(e.x, e.y); updateErrorMetaForHop(selectedHop); boolean singleClick = false; + mouseOverName = null; viewDrag = false; viewDragStart = null; SingleClickType singleClickType = null; @@ -1222,7 +1223,8 @@ private boolean showTransformOutputData(TransformMeta dataTransformMeta, RowBuff previewRowsDialog.setTitleMessage(title, prefix + message); previewRowsDialog.open(); } catch (Exception ex) { - new ErrorDialog(hopGui.getDisplay().getActiveShell(), "Error", "Error showing preview dialog", ex); + new ErrorDialog( + hopGui.getDisplay().getActiveShell(), "Error", "Error showing preview dialog", ex); } } } @@ -1368,6 +1370,7 @@ public void mouseMove(MouseEvent e) { boolean shift = (e.stateMask & SWT.SHIFT) != 0; noInputTransform = null; mouseMovedSinceClick = true; + boolean doRedraw = false; // disable the tooltip // @@ -1414,6 +1417,22 @@ public void mouseMove(MouseEvent e) { LogChannel.GENERAL.logError("Error calling PipelineGraphMouseMoved extension point", ex); } + // Mouse over the name of the transform + // + if (!PropsUi.getInstance().useDoubleClick()) { + if (areaOwner != null && areaOwner.getAreaType() == AreaType.TRANSFORM_NAME) { + if (mouseOverName == null) { + doRedraw = true; + } + mouseOverName = (String) areaOwner.getOwner(); + } else { + if (mouseOverName != null) { + doRedraw = true; + } + mouseOverName = null; + } + } + // // First see if the icon we clicked on was selected. // If the icon was not selected, we should un-select all other @@ -1425,20 +1444,20 @@ public void mouseMove(MouseEvent e) { selectedTransforms = new ArrayList<>(); selectedTransforms.add(selectedTransform); previousTransformLocations = new Point[] {selectedTransform.getLocation()}; - redraw(); + doRedraw = true; } else if (selectedNote != null && !selectedNote.isSelected()) { pipelineMeta.unselectAll(); selectedNote.setSelected(true); selectedNotes = new ArrayList<>(); selectedNotes.add(selectedNote); previousNoteLocations = new Point[] {selectedNote.getLocation()}; - redraw(); + doRedraw = true; } else if (selectionRegion != null && startHopTransform == null) { // Did we select a region...? // selectionRegion.width = real.x - selectionRegion.x; selectionRegion.height = real.y - selectionRegion.y; - redraw(); + doRedraw = true; } else if (selectedTransform != null && lastButton == 1 && !shift @@ -1494,7 +1513,7 @@ public void mouseMove(MouseEvent e) { } } - redraw(); + doRedraw = true; } else if ((startHopTransform != null && endHopTransform == null) || (endHopTransform != null && startHopTransform == null)) { // Are we creating a new hop with the middle button or pressing SHIFT? @@ -1533,11 +1552,11 @@ public void mouseMove(MouseEvent e) { } else { if (candidate != null) { candidate = null; - redraw(); + doRedraw = true; } } - redraw(); + doRedraw = true; } else { // Drag the view around with middle button on the background? // @@ -1579,9 +1598,12 @@ public void mouseMove(MouseEvent e) { } } - redraw(); + doRedraw = true; } } + if (doRedraw) { + redraw(); + } } @Override @@ -2770,7 +2792,7 @@ public void copyNotePadToClipboard(HopGuiPipelineNoteContext context) { pipelineClipboardDelegate.copySelected( pipelineMeta, Collections.emptyList(), Arrays.asList(context.getNotePadMeta())); } - + @GuiContextAction( id = "pipeline-graph-edit-pipeline", parentId = HopGuiPipelineContext.CONTEXT_ID, @@ -3315,7 +3337,8 @@ public void drawPipelineImage(GC swtGc, int width, int height) { propsUi.isIndicateSlowPipelineTransformsEnabled(), propsUi.getZoomFactor(), outputRowsMap, - !propsUi.useDoubleClick(), + propsUi.isBorderDrawnAroundCanvasNames(), + mouseOverName, stateMap); pipelinePainter.setMagnification((float) (magnification * PropsUi.getNativeZoomFactor())); @@ -3354,7 +3377,8 @@ public void drawPipelineImage(GC swtGc, int width, int height) { } } catch (Exception e) { - new ErrorDialog(hopGui.getDisplay().getActiveShell(), "Error", "Error drawing pipeline image", e); + new ErrorDialog( + hopGui.getDisplay().getActiveShell(), "Error", "Error drawing pipeline image", e); } } finally { gc.dispose(); @@ -3621,10 +3645,7 @@ public PipelineMeta getManagedObject() { return pipelineMeta; } - - /** - * Use method hasChanged() - */ + /** Use method hasChanged() */ @Deprecated public boolean hasContentChanged() { return pipelineMeta.hasChanged(); @@ -3673,11 +3694,10 @@ public boolean editProperties( } Shell shell = hopGui.getDisplay().getActiveShell(); - if(shell == null){ + if (shell == null) { shell = hopGui.getShell(); } - PipelineDialog tid = - new PipelineDialog(shell, SWT.NONE, variables, pipelineMeta, currentTab); + PipelineDialog tid = new PipelineDialog(shell, SWT.NONE, variables, pipelineMeta, currentTab); if (tid.open() != null) { hopGui.setParametersAsVariablesInUI(pipelineMeta, variables); updateGui(); @@ -3696,7 +3716,7 @@ public boolean hasChanged() { public void setChanged() { pipelineMeta.setChanged(); } - + @Override public synchronized void save() throws HopException { try { @@ -5229,7 +5249,7 @@ public void copyTransformToClipboard(HopGuiPipelineTransformContext context) { pipelineClipboardDelegate.copySelected( pipelineMeta, Arrays.asList(context.getTransformMeta()), Collections.emptyList()); } - + @GuiKeyboardShortcut(key = ' ') @GuiOsxKeyboardShortcut(key = ' ') public void showOutputFields() { 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 b7b1f40d000..f14f6d3d34d 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 @@ -624,18 +624,18 @@ public void mouseDown(MouseEvent e) { if (hop != null) { // Delete hop with on click if (e.button == 1 && shift && control) { - // Delete the hop + // Delete the hop workflowHopDelegate.delHop(workflowMeta, hop); updateGui(); } - // User held control and clicked a hop between actions - We want to flip the active state of + // User held control and clicked a hop between actions - We want to flip the active state + // of // the hop. // else if (e.button == 2 || (e.button == 1 && control)) { hop.setEnabled(!hop.isEnabled()); updateGui(); - } - else { + } else { // A hop: show the hop context menu in the mouseUp() listener // clickedWorkflowHop = hop; @@ -707,6 +707,7 @@ public void mouseUp(MouseEvent e) { WorkflowHopMeta singleClickHop = null; viewDrag = false; viewDragStart = null; + mouseOverName = null; if (iconOffset == null) { iconOffset = new Point(0, 0); @@ -1078,6 +1079,7 @@ private void showContextDialog( public void mouseMove(MouseEvent e) { boolean shift = (e.stateMask & SWT.SHIFT) != 0; noInputAction = null; + boolean doRedraw = false; // disable the tooltip // @@ -1119,6 +1121,22 @@ public void mouseMove(MouseEvent e) { } } + // Mouse over the name of the transform + // + if (!PropsUi.getInstance().useDoubleClick()) { + if (areaOwner != null && areaOwner.getAreaType() == AreaOwner.AreaType.ACTION_NAME) { + if (mouseOverName == null) { + doRedraw = true; + } + mouseOverName = (String) areaOwner.getOwner(); + } else { + if (mouseOverName != null) { + doRedraw = true; + } + mouseOverName = null; + } + } + // // First see if the icon we clicked on was selected. // If the icon was not selected, we should un-select all other @@ -1130,20 +1148,20 @@ public void mouseMove(MouseEvent e) { selectedActions = new ArrayList<>(); selectedActions.add(selectedAction); previousTransformLocations = new Point[] {selectedAction.getLocation()}; - redraw(); + doRedraw = true; } else if (selectedNote != null && !selectedNote.isSelected()) { workflowMeta.unselectAll(); selectedNote.setSelected(true); selectedNotes = new ArrayList<>(); selectedNotes.add(selectedNote); previousNoteLocations = new Point[] {selectedNote.getLocation()}; - redraw(); + doRedraw = true; } else if (selectionRegion != null && startHopAction == null) { // Did we select a region...? // selectionRegion.width = real.x - selectionRegion.x; selectionRegion.height = real.y - selectionRegion.y; - redraw(); + doRedraw = true; } else if (selectedAction != null && lastButton == 1 && !shift && startHopAction == null) { // Move around transforms & notes // @@ -1195,7 +1213,7 @@ public void mouseMove(MouseEvent e) { } } - redraw(); + doRedraw = true; } else if ((startHopAction != null && endHopAction == null) || (endHopAction != null && startHopAction == null)) { // Are we creating a new hop with the middle button or pressing SHIFT? @@ -1226,11 +1244,11 @@ public void mouseMove(MouseEvent e) { } else { if (hopCandidate != null) { hopCandidate = null; - redraw(); + doRedraw = true; } } - redraw(); + doRedraw = true; } else { // Drag the view around with middle button on the background? // @@ -1270,9 +1288,12 @@ public void mouseMove(MouseEvent e) { } } - redraw(); + doRedraw = true; } } + if (doRedraw) { + redraw(); + } } @Override @@ -1328,7 +1349,9 @@ private void addCandidateAsHop() { boolean cancel = false; workflowMeta.addWorkflowHop(hopCandidate); if (workflowMeta.hasLoop(hopCandidate.getToAction())) { - MessageBox mb = new MessageBox(hopGui.getDisplay().getActiveShell(), SWT.OK | SWT.CANCEL | SWT.ICON_WARNING); + MessageBox mb = + new MessageBox( + hopGui.getDisplay().getActiveShell(), SWT.OK | SWT.CANCEL | SWT.ICON_WARNING); mb.setMessage(BaseMessages.getString(PKG, "WorkflowGraph.Dialog.HopCausesLoop.Message")); mb.setText(BaseMessages.getString(PKG, "WorkflowGraph.Dialog.HopCausesLoop.Title")); int choice = mb.open(); @@ -1960,7 +1983,7 @@ public void pasteFromClipboard() { workflowClipboardDelegate.fromClipboard(), lastMove == null ? new Point(50, 50) : lastMove); } - + @GuiContextAction( id = "workflow-graph-workflow-clipboard-paste", parentId = HopGuiWorkflowContext.CONTEXT_ID, @@ -2823,7 +2846,8 @@ public void drawWorkflowImage(GC swtGc, int width, int height, float magnificati propsUi.getNoteFont().getName(), propsUi.getNoteFont().getHeight(), propsUi.getZoomFactor(), - !propsUi.useDoubleClick()); + propsUi.isBorderDrawnAroundCanvasNames(), + mouseOverName); // correct the magnification with the overall zoom factor // @@ -2882,7 +2906,7 @@ public void drawWorkflowImage(GC swtGc, int width, int height, float magnificati } CanvasFacade.setData(canvas, magnification, offset, workflowMeta); } - + @Override public boolean hasChanged() { return workflowMeta.hasChanged(); @@ -2890,7 +2914,7 @@ public boolean hasChanged() { @Override public void setChanged() { - workflowMeta.setChanged(); + workflowMeta.setChanged(); } protected void newHop() { @@ -3190,9 +3214,7 @@ public WorkflowMeta getManagedObject() { return workflowMeta; } - /** - * Use method hasChanged() - */ + /** Use method hasChanged() */ @Deprecated public boolean hasContentChanged() { return workflowMeta.hasChanged(); @@ -3212,7 +3234,7 @@ public boolean editProperties( } Shell shell = hopGui.getDisplay().getActiveShell(); - if(shell == null){ + if (shell == null) { shell = hopGui.getShell(); } WorkflowDialog jd = new WorkflowDialog(shell, SWT.NONE, variables, workflowMeta); @@ -3276,7 +3298,9 @@ public void saveAs(String filename) throws HopException { FileObject fileObject = HopVfs.getFileObject(filename); if (fileObject.exists()) { - MessageBox box = new MessageBox(hopGui.getDisplay().getActiveShell(), SWT.YES | SWT.NO | SWT.ICON_QUESTION); + MessageBox box = + new MessageBox( + hopGui.getDisplay().getActiveShell(), SWT.YES | SWT.NO | SWT.ICON_QUESTION); box.setText("Overwrite?"); box.setMessage("Are you sure you want to overwrite file '" + filename + "'?"); int answer = box.open(); @@ -3666,7 +3690,8 @@ public synchronized void start(WorkflowExecutionConfiguration executionConfigura // Attach a listener to notify us that the pipeline has finished. // - workflow.addWorkflowFinishedListener(workflow -> HopGuiWorkflowGraph.this.workflowFinished()); + workflow.addWorkflowFinishedListener( + workflow -> HopGuiWorkflowGraph.this.workflowFinished()); // Show the execution results views // diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/tabs/ConfigGeneralOptionsTab.java b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/tabs/ConfigGeneralOptionsTab.java index 045bfda2b60..32a71c12ea9 100644 --- a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/tabs/ConfigGeneralOptionsTab.java +++ b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/configuration/tabs/ConfigGeneralOptionsTab.java @@ -62,6 +62,7 @@ public class ConfigGeneralOptionsTab { private Button wToolTip; private Button wHelpTip; private Button wbUseDoubleClick; + private Button wbDrawBorderAroundCanvasNames; private Button wbUseGlobalFileBookmarks; private Button wSortFieldByName; private Text wMaxExecutionLoggingTextSize; @@ -383,7 +384,8 @@ public void addGeneralOptionsTab(CTabFolder wTabFolder) { wHelpTip.addListener(SWT.Selection, this::saveValues); lastControl = wlHelpTip; - // Help tool tips + // Use double click on the canvas + // Label wlUseDoubleClick = new Label(wGeneralComp, SWT.RIGHT); wlUseDoubleClick.setText( BaseMessages.getString(PKG, "EnterOptionsDialog.UseDoubleClickOnCanvas.Label")); @@ -404,6 +406,28 @@ public void addGeneralOptionsTab(CTabFolder wTabFolder) { wbUseDoubleClick.addListener(SWT.Selection, this::saveValues); lastControl = wlUseDoubleClick; + // Use double click on the canvas + // + Label wlDrawBorderAroundCanvasNames = new Label(wGeneralComp, SWT.RIGHT); + wlDrawBorderAroundCanvasNames.setText( + BaseMessages.getString(PKG, "EnterOptionsDialog.DrawBorderAroundCanvasNamesOnCanvas.Label")); + PropsUi.setLook(wlDrawBorderAroundCanvasNames); + FormData fdlDrawBorderAroundCanvasNames = new FormData(); + fdlDrawBorderAroundCanvasNames.left = new FormAttachment(0, 0); + fdlDrawBorderAroundCanvasNames.top = new FormAttachment(lastControl, margin); + fdlDrawBorderAroundCanvasNames.right = new FormAttachment(middle, -margin); + wlDrawBorderAroundCanvasNames.setLayoutData(fdlDrawBorderAroundCanvasNames); + wbDrawBorderAroundCanvasNames = new Button(wGeneralComp, SWT.CHECK); + PropsUi.setLook(wbDrawBorderAroundCanvasNames); + wbDrawBorderAroundCanvasNames.setSelection(props.useDoubleClick()); + FormData fdbDrawBorderAroundCanvasNames = new FormData(); + fdbDrawBorderAroundCanvasNames.left = new FormAttachment(middle, 0); + fdbDrawBorderAroundCanvasNames.top = new FormAttachment(wlDrawBorderAroundCanvasNames, 0, SWT.CENTER); + fdbDrawBorderAroundCanvasNames.right = new FormAttachment(100, 0); + wbDrawBorderAroundCanvasNames.setLayoutData(fdbDrawBorderAroundCanvasNames); + wbDrawBorderAroundCanvasNames.addListener(SWT.Selection, this::saveValues); + lastControl = wlDrawBorderAroundCanvasNames; + // Use global file bookmarks? Label wlUseGlobalFileBookmarks = new Label(wGeneralComp, SWT.RIGHT); wlUseGlobalFileBookmarks.setText( @@ -505,6 +529,7 @@ private void saveValues(Event event) { props.setSortFieldByName(wSortFieldByName.getSelection()); props.setShowingHelpToolTips(wHelpTip.getSelection()); props.setUseDoubleClickOnCanvas(wbUseDoubleClick.getSelection()); + props.setDrawBorderAroundCanvasNames(wbDrawBorderAroundCanvasNames.getSelection()); props.setUseGlobalFileBookmarks(wbUseGlobalFileBookmarks.getSelection()); props.setMaxExecutionLoggingTextSize( Const.toInt( 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 d8b5b29f760..0da6a4d6c70 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 @@ -17,6 +17,9 @@ package org.apache.hop.ui.hopgui.perspective.dataorch; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; import org.apache.hop.core.gui.DPoint; import org.apache.hop.core.gui.Point; import org.apache.hop.core.gui.Rectangle; @@ -40,10 +43,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.ToolTip; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - /** * The beginnings of a common graph object, used by JobGraph and HopGuiPipelineGraph to share common * behaviors. @@ -73,6 +72,8 @@ public abstract class HopGuiAbstractGraph extends DragViewZoomBase protected ToolTip toolTip; + protected String mouseOverName; + /** * This is a state map which can be used by plugins to render extra states on top of pipelines and * workflows or their components. @@ -375,4 +376,22 @@ protected void enableSnapAlignDistributeMenuItems( IHopFileType.CAPABILITY_DISTRIBUTE_VERTICAL, selectedTransform); } + + /** + * Gets mouseOverName + * + * @return value of mouseOverName + */ + public String getMouseOverName() { + return mouseOverName; + } + + /** + * Sets mouseOverName + * + * @param mouseOverName value of mouseOverName + */ + public void setMouseOverName(String mouseOverName) { + this.mouseOverName = mouseOverName; + } } diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/execution/PipelineExecutionViewer.java b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/execution/PipelineExecutionViewer.java index e290a8849f3..f5d852471c8 100644 --- a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/execution/PipelineExecutionViewer.java +++ b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/execution/PipelineExecutionViewer.java @@ -712,6 +712,7 @@ public void drawPipelineImage(GC swtGc, int width, int height, float magnificati propsUi.getZoomFactor(), Collections.emptyMap(), false, + null, Collections.emptyMap()); // correct the magnification with the overall zoom factor diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/execution/WorkflowExecutionViewer.java b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/execution/WorkflowExecutionViewer.java index 81ace46d00d..5371cb1bb2f 100644 --- a/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/execution/WorkflowExecutionViewer.java +++ b/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/execution/WorkflowExecutionViewer.java @@ -613,7 +613,8 @@ public void drawWorkflowImage(GC swtGc, int width, int height, float magnificati propsUi.getNoteFont().getName(), propsUi.getNoteFont().getHeight(), propsUi.getZoomFactor(), - false); + false, + null); // correct the magnification with the overall zoom factor // @@ -682,7 +683,8 @@ public void drawWorkflowImage(GC swtGc, int width, int height, float magnificati viewPort = workflowPainter.getViewPort(); graphPort = workflowPainter.getGraphPort(); } catch (Exception e) { - new ErrorDialog(hopGui.getDisplay().getActiveShell(), "Error", "Error drawing workflow image", e); + new ErrorDialog( + hopGui.getDisplay().getActiveShell(), "Error", "Error drawing workflow image", e); } } finally { gc.dispose(); 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 0016102b8b0..e2e0c2862cc 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 @@ -129,6 +129,7 @@ EnterOptionsDialog.ToolTipsEnabled.Label=Display tooltips EnterOptionsDialog.Transform.Label=Transforms EnterOptionsDialog.UseDatabaseCache.Label=Use database cache EnterOptionsDialog.UseDoubleClickOnCanvas.Label=Use double click on canvas? +EnterOptionsDialog.DrawBorderAroundCanvasNamesOnCanvas.Label=Draw border around names on canvas? EnterOptionsDialog.UseGlobalFileBookmarks.Label=Use global bookmarks in the file dialog? EnterOptionsDialog.ShowTableViewToolbar.Label=Show a toolbar above tables? EnterOptionsDialog.ShowTableViewToolbar.ToolTip=Enabling this option makes a toolbar appear above all tables in the Hop GUI.