Skip to content

Commit

Permalink
Fixed problems with the workflow helper (#2269)
Browse files Browse the repository at this point in the history
Fixed problems with the workflow helper not loading files properly.
Also made the table sortable by drag'n'drop and it is now also possible to reset the workflow.
  • Loading branch information
breiler committed Jul 29, 2023
1 parent 14f2591 commit 69d1a85
Show file tree
Hide file tree
Showing 53 changed files with 1,821 additions and 626 deletions.
1 change: 1 addition & 0 deletions test_files/spiral.gcode
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ G21 (Units in millimeters)
G90 (Absolute programming)
G17 (XY plane)
F900
G0 X0 Y0 Z0

G3 X0 Y0 I20 J0
G3 X0 Y0 z 20 I20 J0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This file is part of Universal Gcode Sender (UGS).

import com.google.gson.Gson;
import com.willwinder.ugs.nbm.visualizer.shared.RenderableUtils;
import com.willwinder.ugs.nbp.lib.Mode;
import com.willwinder.ugs.nbp.lib.lookup.CentralLookup;
import com.willwinder.ugs.nbp.lib.services.LocalizingService;
import static com.willwinder.ugs.nbp.lib.services.LocalizingService.lang;
Expand Down Expand Up @@ -65,7 +66,7 @@ This file is part of Universal Gcode Sender (UGS).
//iconBase="SET/PATH/TO/ICON/HERE",
persistenceType = TopComponent.PERSISTENCE_ALWAYS
)
@TopComponent.Registration(mode = "output", openAtStartup = false)
@TopComponent.Registration(mode = Mode.OUTPUT, openAtStartup = false)
@ActionID(
category = DowelTopComponent.DowelCategory,
id = DowelTopComponent.DowelActionId)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2017 Will Winder
Copyright 2017-2023 Will Winder
This file is part of Universal Gcode Sender (UGS).
Expand All @@ -18,6 +18,7 @@ This file is part of Universal Gcode Sender (UGS).
*/
package com.willwinder.ugp.tools;

import com.willwinder.ugs.nbp.lib.Mode;
import com.willwinder.ugs.nbp.lib.lookup.CentralLookup;
import com.willwinder.ugs.nbp.lib.services.LocalizingService;
import static com.willwinder.ugs.nbp.lib.services.LocalizingService.lang;
Expand Down Expand Up @@ -73,7 +74,7 @@ This file is part of Universal Gcode Sender (UGS).
//iconBase="SET/PATH/TO/ICON/HERE",
persistenceType = TopComponent.PERSISTENCE_ALWAYS
)
@TopComponent.Registration(mode = "output", openAtStartup = false)
@TopComponent.Registration(mode = Mode.OUTPUT, openAtStartup = false)
@ActionID(
category = GcodeTilerTopComponent.GcodeTilerCategory,
id = GcodeTilerTopComponent.GcodeTilerActionId)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2017-2018 Will Winder
Copyright 2017-2023 Will Winder
This file is part of Universal Gcode Sender (UGS).
Expand Down Expand Up @@ -30,6 +30,7 @@ This file is part of Universal Gcode Sender (UGS).
import com.google.gson.Gson;
import com.willwinder.ugs.nbm.visualizer.shared.Renderable;
import com.willwinder.ugs.nbm.visualizer.shared.RenderableUtils;
import com.willwinder.ugs.nbp.lib.Mode;
import com.willwinder.ugs.nbp.lib.lookup.CentralLookup;
import com.willwinder.ugs.nbp.lib.services.LocalizingService;
import static com.willwinder.ugs.nbp.lib.services.LocalizingService.lang;
Expand Down Expand Up @@ -72,7 +73,7 @@ This file is part of Universal Gcode Sender (UGS).
//iconBase="SET/PATH/TO/ICON/HERE",
persistenceType = TopComponent.PERSISTENCE_ALWAYS
)
@TopComponent.Registration(mode = "output", openAtStartup = false)
@TopComponent.Registration(mode = Mode.OUTPUT, openAtStartup = false)
@ActionID(
category = ProbeTopComponent.ProbeCategory,
id = ProbeTopComponent.ProbeActionId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ This file is part of Universal Gcode Sender (UGS).
import org.openide.util.Lookup;
import org.openide.windows.TopComponent;

import javax.swing.Box;
import javax.swing.JToolBar;
import java.awt.Component;
import java.awt.Dimension;
import javax.swing.*;
import java.awt.*;
import java.util.Arrays;
import java.util.logging.Logger;

Expand Down Expand Up @@ -88,9 +86,12 @@ public void componentActivated() {

private void setToolBarHeight() {
EditorUI editorUI = Utilities.getEditorUI(getEditorPane());
JToolBar toolBarComponent = editorUI.getToolBarComponent();
if (editorUI == null) {
return;
}

// Adds an element with vertical height
JToolBar toolBarComponent = editorUI.getToolBarComponent();
if (Arrays.stream(toolBarComponent.getComponents()).noneMatch(c -> c.equals(TOOLBAR_PADDING))) {
toolBarComponent.add(TOOLBAR_PADDING);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,17 @@ This file is part of Universal Gcode Sender (UGS).
*/
package com.willwinder.ugs.nbp.console;

import com.willwinder.ugs.nbp.lib.Mode;
import com.willwinder.ugs.nbp.lib.lookup.CentralLookup;
import com.willwinder.ugs.nbp.lib.services.LocalizingService;
import com.willwinder.universalgcodesender.i18n.Localization;
import com.willwinder.universalgcodesender.listeners.ControllerState;
import com.willwinder.universalgcodesender.listeners.MessageListener;
import com.willwinder.universalgcodesender.listeners.MessageType;
import com.willwinder.universalgcodesender.listeners.UGSEventListener;
import com.willwinder.universalgcodesender.model.BackendAPI;
import com.willwinder.universalgcodesender.model.UGSEvent;
import com.willwinder.universalgcodesender.model.events.ControllerStateEvent;
import com.willwinder.universalgcodesender.uielements.components.CommandTextArea;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.windows.IOColorPrint;
import org.openide.windows.IOColors;
import org.openide.windows.InputOutput;
import org.openide.windows.TopComponent;

import java.awt.BorderLayout;
import java.awt.Color;
import java.io.IOException;

/**
* A window that displays a console log for UGS
Expand All @@ -49,7 +39,7 @@ This file is part of Universal Gcode Sender (UGS).
preferredID = "ConsoleTopComponent"
)
@TopComponent.Registration(
mode = "output",
mode = Mode.OUTPUT,
openAtStartup = true
)
@ActionID(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2021 Will Winder
Copyright 2021-2023 Will Winder
This file is part of Universal Gcode Sender (UGS).
Expand All @@ -26,6 +26,7 @@ This file is part of Universal Gcode Sender (UGS).
import com.willwinder.ugs.nbp.designer.gui.ToolBox;
import com.willwinder.ugs.nbp.designer.logic.Controller;
import com.willwinder.ugs.nbp.designer.logic.ControllerFactory;
import com.willwinder.ugs.nbp.lib.Mode;
import com.willwinder.ugs.nbp.lib.lookup.CentralLookup;
import com.willwinder.universalgcodesender.model.BackendAPI;
import org.openide.awt.UndoRedo;
Expand All @@ -49,7 +50,7 @@ This file is part of Universal Gcode Sender (UGS).
preferredID = "DesignerTopComponent",
persistenceType = TopComponent.PERSISTENCE_NEVER
)
@TopComponent.Registration(mode = "editor", openAtStartup = false)
@TopComponent.Registration(mode = Mode.EDITOR_PRIMARY, openAtStartup = false)
public class DesignerTopComponent extends TopComponent implements UndoManagerListener, SelectionListener {
private static final long serialVersionUID = 3123334398723987873L;
private static final Logger LOGGER = Logger.getLogger(DesignerTopComponent.class.getSimpleName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This file is part of Universal Gcode Sender (UGS).
import com.willwinder.ugs.nbp.designer.logic.ControllerEventType;
import com.willwinder.ugs.nbp.designer.logic.ControllerFactory;
import com.willwinder.ugs.nbp.designer.logic.ControllerListener;
import com.willwinder.ugs.nbp.lib.Mode;
import org.openide.windows.TopComponent;

import javax.swing.JScrollPane;
Expand All @@ -36,7 +37,7 @@ This file is part of Universal Gcode Sender (UGS).
preferredID = "EntitiesTreeTopComponent",
persistenceType = TopComponent.PERSISTENCE_NEVER
)
@TopComponent.Registration(mode = "bottom_left", openAtStartup = false)
@TopComponent.Registration(mode = Mode.LEFT_BOTTOM, openAtStartup = false)
public class EntitiesTreeTopComponent extends TopComponent implements ControllerListener {
private static final long serialVersionUID = 432423498723987873L;
private transient EntitiesTree entitesTree;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
Copyright 2023 Will Winder
This file is part of Universal Gcode Sender (UGS).
UGS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
UGS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with UGS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.willwinder.ugs.nbp.designer.platform;

import com.google.common.io.Files;
Expand Down Expand Up @@ -75,7 +93,7 @@ public static SettingsTopComponent openSettings(Controller controller) {
SettingsTopComponent topComponent = new SettingsTopComponent();
topComponent.open();

Mode editorMode = WindowManager.getDefault().findMode("top_left");
Mode editorMode = WindowManager.getDefault().findMode(com.willwinder.ugs.nbp.lib.Mode.LEFT_TOP);
editorMode.dockInto(topComponent);
return topComponent;
});
Expand All @@ -93,7 +111,7 @@ public static EntitiesTreeTopComponent openEntitesTree(Controller controller) {
EntitiesTreeTopComponent topComponent = new EntitiesTreeTopComponent();
topComponent.open();

Mode editorMode = WindowManager.getDefault().findMode("bottom_left");
Mode editorMode = WindowManager.getDefault().findMode(com.willwinder.ugs.nbp.lib.Mode.LEFT_BOTTOM);
editorMode.dockInto(topComponent);
return topComponent;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2022 Will Winder
Copyright 2022-2023 Will Winder
This file is part of Universal Gcode Sender (UGS).
Expand All @@ -23,6 +23,7 @@ This file is part of Universal Gcode Sender (UGS).
import com.willwinder.ugs.nbp.designer.logic.ControllerEventType;
import com.willwinder.ugs.nbp.designer.logic.ControllerFactory;
import com.willwinder.ugs.nbp.designer.logic.ControllerListener;
import com.willwinder.ugs.nbp.lib.Mode;
import org.openide.windows.TopComponent;

/**
Expand All @@ -32,7 +33,7 @@ This file is part of Universal Gcode Sender (UGS).
preferredID = "SettingsTopComponent",
persistenceType = TopComponent.PERSISTENCE_NEVER
)
@TopComponent.Registration(mode = "top_left", openAtStartup = false)
@TopComponent.Registration(mode = Mode.LEFT_TOP, openAtStartup = false)
public class SettingsTopComponent extends TopComponent implements ControllerListener {
private static final long serialVersionUID = 324234398723987873L;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2015-2020 Will Winder
Copyright 2015-2023 Will Winder
This file is part of Universal Gcode Sender (UGS).
Expand All @@ -19,6 +19,7 @@ This file is part of Universal Gcode Sender (UGS).
package com.willwinder.ugs.nbp.dro;

import com.willwinder.ugs.nbp.dro.panels.DROPopup;
import com.willwinder.ugs.nbp.lib.Mode;
import com.willwinder.ugs.nbp.lib.services.LocalizingService;
import com.willwinder.ugs.nbp.lib.lookup.CentralLookup;
import com.willwinder.universalgcodesender.model.BackendAPI;
Expand All @@ -27,7 +28,6 @@ This file is part of Universal Gcode Sender (UGS).
import java.awt.BorderLayout;
import java.awt.Dimension;

import com.willwinder.universalgcodesender.utils.SwingHelpers;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.windows.TopComponent;
Expand All @@ -42,7 +42,7 @@ This file is part of Universal Gcode Sender (UGS).
persistenceType = TopComponent.PERSISTENCE_ALWAYS
)
@TopComponent.Registration(
mode = "top_left",
mode = Mode.LEFT_TOP,
openAtStartup = true
)
@ActionID(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This file is part of Universal Gcode Sender (UGS).

import com.willwinder.ugs.nbp.jog.actions.ShowABCStepSizeAction;
import com.willwinder.ugs.nbp.jog.actions.UseSeparateStepSizeAction;
import com.willwinder.ugs.nbp.lib.Mode;
import com.willwinder.ugs.nbp.lib.lookup.CentralLookup;
import com.willwinder.ugs.nbp.lib.services.LocalizingService;
import com.willwinder.universalgcodesender.listeners.UGSEventListener;
Expand Down Expand Up @@ -50,7 +51,7 @@ This file is part of Universal Gcode Sender (UGS).
preferredID = "JogTopComponent"
)
@TopComponent.Registration(
mode = "bottom_left",
mode = Mode.LEFT_BOTTOM,
openAtStartup = true,
position = 5000)
@ActionID(
Expand Down Expand Up @@ -90,9 +91,6 @@ public JogTopComponent() {
backend.addUGSEventListener(this);

setLayout(new BorderLayout());
setName(LocalizingService.JogControlTitle);
setToolTipText(LocalizingService.JogControlTooltip);

add(jogPanel, BorderLayout.CENTER);

// Right click options
Expand All @@ -118,6 +116,8 @@ protected void componentClosed() {
@Override
protected void componentOpened() {
super.componentOpened();
setName(LocalizingService.JogControlTitle);
setToolTipText(LocalizingService.JogControlTooltip);
updateControls();
updateSettings();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This file is part of Universal Gcode Sender (UGS).
*/
package com.willwinder.ugs.nbp.toolbox;

import com.willwinder.ugs.nbp.lib.Mode;
import com.willwinder.ugs.nbp.lib.services.ActionRegistrationService;
import com.willwinder.ugs.nbp.lib.services.LocalizingService;
import com.willwinder.ugs.nbp.toolbox.settings.ISettingsListener;
Expand All @@ -40,7 +41,7 @@ This file is part of Universal Gcode Sender (UGS).
@TopComponent.Description(
preferredID = "ugs-platform-plugin-toolboxTopComponent")
@TopComponent.Registration(
mode = "bottom_left",
mode = Mode.LEFT_BOTTOM,
openAtStartup = true,
position = 1000)
@ActionReference(path = ToolboxTopComponent.WINOW_PATH)
Expand All @@ -60,9 +61,6 @@ public final class ToolboxTopComponent extends TopComponent implements ISettings

public ToolboxTopComponent() {
setLayout(new BorderLayout());
setName(LocalizingService.ToolboxTitle);
setToolTipText(LocalizingService.ToolboxTooltip);

actionRegistrationService = Lookup.getDefault().lookup(ActionRegistrationService.class);
buttonGridPanel = new ButtonGridPanel();

Expand All @@ -79,6 +77,8 @@ protected void componentActivated() {
@Override
protected void componentOpened() {
super.componentOpened();
setName(LocalizingService.ToolboxTitle);
setToolTipText(LocalizingService.ToolboxTooltip);
Settings.addSettingsListener(this);
}

Expand Down
12 changes: 12 additions & 0 deletions ugs-platform/ugs-platform-plugin-workflow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
<version>${netbeans.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-util-ui</artifactId>
<version>${netbeans.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-windows</artifactId>
Expand All @@ -67,5 +73,11 @@
<artifactId>org-openide-util-lookup</artifactId>
<version>${netbeans.version}</version>
</dependency>
<dependency>
<groupId>com.willwinder</groupId>
<artifactId>ugs-platform-ugscore</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

0 comments on commit 69d1a85

Please sign in to comment.