Skip to content

Commit

Permalink
Auto-distributing doesn't activate the "Save" button apache#3102
Browse files Browse the repository at this point in the history
  • Loading branch information
nadment committed Jul 24, 2023
1 parent 310127f commit 4f84f3b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
7 changes: 6 additions & 1 deletion ui/src/main/java/org/apache/hop/ui/hopgui/HopGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
Expand Down Expand Up @@ -959,6 +958,7 @@ public void menuEditAlignLeft() {
IHopFileTypeHandler activeFileTypeHandler = getActiveFileTypeHandler();
if (activeFileTypeHandler instanceof IGraphSnapAlignDistribute) {
((IGraphSnapAlignDistribute) activeFileTypeHandler).alignLeft();
activeFileTypeHandler.updateGui();
}
}

Expand All @@ -974,6 +974,7 @@ public void menuEditAlignRight() {
IHopFileTypeHandler activeFileTypeHandler = getActiveFileTypeHandler();
if (activeFileTypeHandler instanceof IGraphSnapAlignDistribute) {
((IGraphSnapAlignDistribute) activeFileTypeHandler).alignRight();
activeFileTypeHandler.updateGui();
}
}

Expand All @@ -989,6 +990,7 @@ public void menuEditAlignTop() {
IHopFileTypeHandler activeFileTypeHandler = getActiveFileTypeHandler();
if (activeFileTypeHandler instanceof IGraphSnapAlignDistribute) {
((IGraphSnapAlignDistribute) activeFileTypeHandler).alignTop();
activeFileTypeHandler.updateGui();
}
}

Expand All @@ -1004,6 +1006,7 @@ public void menuEditAlignBottom() {
IHopFileTypeHandler activeFileTypeHandler = getActiveFileTypeHandler();
if (activeFileTypeHandler instanceof IGraphSnapAlignDistribute) {
((IGraphSnapAlignDistribute) activeFileTypeHandler).alignBottom();
activeFileTypeHandler.updateGui();
}
}

Expand All @@ -1019,6 +1022,7 @@ public void menuEditDistributeHorizontal() {
IHopFileTypeHandler activeFileTypeHandler = getActiveFileTypeHandler();
if (activeFileTypeHandler instanceof IGraphSnapAlignDistribute) {
((IGraphSnapAlignDistribute) activeFileTypeHandler).distributeHorizontal();
activeFileTypeHandler.updateGui();
}
}

Expand All @@ -1034,6 +1038,7 @@ public void menuEditDistributeVertical() {
IHopFileTypeHandler activeFileTypeHandler = getActiveFileTypeHandler();
if (activeFileTypeHandler instanceof IGraphSnapAlignDistribute) {
((IGraphSnapAlignDistribute) activeFileTypeHandler).distributeVertical();
activeFileTypeHandler.updateGui();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3601,6 +3601,11 @@ public PipelineMeta getManagedObject() {
return pipelineMeta;
}


/**
* Use method hasChanged()
*/
@Deprecated
public boolean hasContentChanged() {
return pipelineMeta.hasChanged();
}
Expand Down Expand Up @@ -3667,6 +3672,11 @@ public boolean hasChanged() {
return pipelineMeta.hasChanged();
}

@Override
public void setChanged() {
pipelineMeta.setChanged();
}

@Override
public synchronized void save() throws HopException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2860,12 +2860,17 @@ public void drawWorkflowImage(GC swtGc, int width, int height, float magnificati
}
CanvasFacade.setData(canvas, magnification, offset, workflowMeta);
}

@Override
public boolean hasChanged() {
return workflowMeta.hasChanged();
}

@Override
public void setChanged() {
workflowMeta.setChanged();
}

protected void newHop() {
List<ActionMeta> selection = workflowMeta.getSelectedActions();
if (selection == null || selection.size() < 2) {
Expand Down Expand Up @@ -3163,6 +3168,10 @@ public WorkflowMeta getManagedObject() {
return workflowMeta;
}

/**
* Use method hasChanged()
*/
@Deprecated
public boolean hasContentChanged() {
return workflowMeta.hasChanged();
}
Expand Down Expand Up @@ -3635,7 +3644,7 @@ public synchronized void start(WorkflowExecutionConfiguration executionConfigura

// Attach a listener to notify us that the pipeline has finished.
//
workflow.addWorkflowFinishedListener(workflow -> HopGuiWorkflowGraph.this.jobFinished());
workflow.addWorkflowFinishedListener(workflow -> HopGuiWorkflowGraph.this.workflowFinished());

// Show the execution results views
//
Expand Down Expand Up @@ -3688,7 +3697,7 @@ public void afterExecution(
}

/** This gets called at the very end, when everything is done. */
protected void jobFinished() {
protected void workflowFinished() {
// Do a final check to see if it all ended...
//
if (workflow != null && workflow.isInitialized() && workflow.isFinished()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ protected Display hopDisplay() {
}

public abstract boolean hasChanged();
public abstract void setChanged();

@Override
public void redraw() {
Expand Down Expand Up @@ -213,33 +214,40 @@ public void snapToGrid() {

private void snapToGrid(int size) {
createSnapAlignDistribute().snapToGrid(size);
setChanged();
}

public void alignLeft() {
createSnapAlignDistribute().allignleft();
setChanged();
}

public void alignRight() {
createSnapAlignDistribute().allignright();
setChanged();
}

public void alignTop() {
createSnapAlignDistribute().alligntop();
setChanged();
}

public void alignBottom() {
createSnapAlignDistribute().allignbottom();
setChanged();
}

@GuiKeyboardShortcut(alt = true, key = SWT.ARROW_RIGHT)
@GuiOsxKeyboardShortcut(alt = true, key = SWT.ARROW_RIGHT)
public void distributeHorizontal() {
createSnapAlignDistribute().distributehorizontal();
setChanged();
}

@GuiOsxKeyboardShortcut(alt = true, key = SWT.ARROW_UP)
public void distributeVertical() {
createSnapAlignDistribute().distributevertical();
setChanged();
}

/**
Expand Down

0 comments on commit 4f84f3b

Please sign in to comment.