Skip to content

Commit

Permalink
issue apache#3335 : Underline the name of a transform or action to mi…
Browse files Browse the repository at this point in the history
…mic a hyperlink (option)
  • Loading branch information
mattcasters committed Nov 1, 2023
1 parent 6cdcf9d commit 5a2f2a0
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 24 deletions.
18 changes: 9 additions & 9 deletions engine/src/main/java/org/apache/hop/core/gui/BasePainter.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public abstract class BasePainter<Hop extends BaseHopMeta<?>, 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;

Expand Down Expand Up @@ -95,7 +95,7 @@ public BasePainter(
String noteFontName,
int noteFontHeight,
double zoomFactor,
boolean drawingEditIcons,
boolean drawingBorderAroundName,
String mouseOverName) {
this.gc = gc;
this.variables = variables;
Expand All @@ -115,7 +115,7 @@ public BasePainter(

this.magnification = 1.0f;
this.zoomFactor = zoomFactor;
this.drawingEditIcons = drawingEditIcons;
this.drawingBorderAroundName = drawingBorderAroundName;

gc.setAntialias(true);

Expand Down Expand Up @@ -539,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;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public PipelinePainter(
boolean slowTransformIndicatorEnabled,
double zoomFactor,
Map<String, RowBuffer> outputRowsMap,
boolean drawingEditIcons,
boolean drawingBorderAroundName,
String mouseOverName,
Map<String, Object> stateMap) {
super(
Expand All @@ -116,7 +116,7 @@ public PipelinePainter(
noteFontName,
noteFontHeight,
zoomFactor,
drawingEditIcons,
drawingBorderAroundName,
mouseOverName);
this.pipelineMeta = pipelineMeta;

Expand Down Expand Up @@ -809,12 +809,9 @@ private void drawTransform(TransformMeta transformMeta) throws HopException {

// Help out the user working in single-click mode by allowing the name to be clicked to edit
//
if (isDrawingEditIcons()) {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public WorkflowPainter(
String noteFontName,
int noteFontHeight,
double zoomFactor,
boolean drawingEditIcons,
boolean drawingBorderAroundName,
String mouseOverName) {
super(
gc,
Expand All @@ -83,7 +83,7 @@ public WorkflowPainter(
noteFontName,
noteFontHeight,
zoomFactor,
drawingEditIcons,
drawingBorderAroundName,
mouseOverName);
this.workflowMeta = workflowMeta;

Expand Down Expand Up @@ -276,12 +276,9 @@ 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
//
Point nameExtent = gc.textExtent(name);
if (isDrawingEditIcons()) {
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,
Expand Down
10 changes: 10 additions & 0 deletions ui/src/main/java/org/apache/hop/ui/core/PropsUi.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3337,7 +3337,7 @@ public void drawPipelineImage(GC swtGc, int width, int height) {
propsUi.isIndicateSlowPipelineTransformsEnabled(),
propsUi.getZoomFactor(),
outputRowsMap,
!propsUi.useDoubleClick(),
propsUi.isBorderDrawnAroundCanvasNames(),
mouseOverName,
stateMap);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2846,7 +2846,7 @@ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5a2f2a0

Please sign in to comment.