Merge lp:~tapaal-contributor/tapaal/only-dirs-batch-export-3.6-1870887 into lp:tapaal

Proposed by Peter Haahr Taankvist
Status: Rejected
Rejected by: Kenneth Yrke Jørgensen
Proposed branch: lp:~tapaal-contributor/tapaal/only-dirs-batch-export-3.6-1870887
Merge into: lp:tapaal
Diff against target: 727 lines (+362/-12) (has conflicts)
13 files modified
src/dk/aau/cs/gui/BatchProcessingDialog.java (+67/-0)
src/dk/aau/cs/gui/TabContent.java (+8/-0)
src/dk/aau/cs/gui/undo/MakePlaceNewSharedMultiCommand.java (+16/-0)
src/dk/aau/cs/gui/undo/MakePlaceSharedCommand.java (+6/-0)
src/dk/aau/cs/verification/batchProcessing/Undo/AddFileCommand.java (+34/-0)
src/dk/aau/cs/verification/batchProcessing/Undo/RemoveFileCommand.java (+35/-0)
src/net/tapaal/TAPAAL.java (+1/-1)
src/pipe/gui/ExportBatchDialog.java (+14/-3)
src/pipe/gui/undo/TranslatePetriNetObjectEdit.java (+24/-0)
src/pipe/gui/undo/UndoManager.java (+91/-0)
src/pipe/gui/widgets/filebrowser/FileBrowser.java (+3/-2)
src/pipe/gui/widgets/filebrowser/NativeFileBrowser.java (+33/-5)
src/pipe/gui/widgets/filebrowser/NativeFileBrowserFallback.java (+30/-1)
Text conflict in src/dk/aau/cs/gui/BatchProcessingDialog.java
Text conflict in src/dk/aau/cs/gui/TabContent.java
Text conflict in src/dk/aau/cs/gui/undo/MakePlaceNewSharedMultiCommand.java
Text conflict in src/dk/aau/cs/gui/undo/MakePlaceSharedCommand.java
Text conflict in src/pipe/gui/ExportBatchDialog.java
Text conflict in src/pipe/gui/undo/TranslatePetriNetObjectEdit.java
Text conflict in src/pipe/gui/undo/UndoManager.java
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/only-dirs-batch-export-3.6-1870887
Reviewer Review Type Date Requested Status
Jiri Srba Pending
Review via email: mp+383884@code.launchpad.net

Commit message

Batch export now only shows dirs in save dialog for windows and linux and has better functionality for mac.

To post a comment you must log in.

Unmerged revisions

1051. By Peter Taankvist <email address hidden>

Batch export now only shows dirs when selecting destination

1050. By Jiri Srba

merged in lp:~tapaal-contributor/tapaal/undo-redo-batchprocessing-3.6-1870904 fixing redo/undo in batch processing in the file selection dialog

1049. By Jiri Srba

merged in lp:~tapaal-contributor/tapaal/undo-redo-update-scrollbar-3.6-1875174 fixing unde/redo if a an object is placed outside of the drawing area

1048. By Jiri Srba

merged in lp:~tapaal-contributor/tapaal/fix-shared-places-exception-1871091 fixing exceptions in component copying and shared places

1047. By Jiri Srba

merged in lp:~tapaal-contributor/tapaal/fix-positionalInfo-detection-1870899 fixing positional info loading for PNML files

1046. By Jiri Srba

merged in lp:~tapaal-contributor/tapaal/shared-place-transition-rename-1871091 fixing problem with renaming of shared places

1045. By Jiri Srba

merged in lp:~tapaal-contributor/tapaal/pnml-disable-buttons-1868535 fixing enabled buttons when pnml file open fails

1044. By Jiri Srba

merged in lp:~tapaal-contributor/tapaal/open-on-windows-1868525 fixing .xml file open on windows

1043. By <email address hidden>

changed version number to 3.6.1 - this is the release version

1042. By <email address hidden>

changed year from 2019 to 2020

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/dk/aau/cs/gui/BatchProcessingDialog.java'
--- src/dk/aau/cs/gui/BatchProcessingDialog.java 2020-05-03 09:49:19 +0000
+++ src/dk/aau/cs/gui/BatchProcessingDialog.java 2020-05-13 15:54:44 +0000
@@ -24,14 +24,25 @@
24import javax.swing.table.TableModel;24import javax.swing.table.TableModel;
25import javax.swing.table.TableRowSorter;25import javax.swing.table.TableRowSorter;
2626
27<<<<<<< TREE
27import dk.aau.cs.gui.undo.AddFileBatchProcessingCommand;28import dk.aau.cs.gui.undo.AddFileBatchProcessingCommand;
28import dk.aau.cs.gui.undo.Command;29import dk.aau.cs.gui.undo.Command;
29import dk.aau.cs.gui.undo.RemoveFileBatchProcessingCommand;30import dk.aau.cs.gui.undo.RemoveFileBatchProcessingCommand;
31=======
32import dk.aau.cs.gui.undo.Command;
33import dk.aau.cs.verification.batchProcessing.Undo.AddFileCommand;
34import dk.aau.cs.verification.batchProcessing.Undo.RemoveFileCommand;
35>>>>>>> MERGE-SOURCE
30import pipe.dataLayer.TAPNQuery;36import pipe.dataLayer.TAPNQuery;
31import pipe.dataLayer.TAPNQuery.SearchOption;37import pipe.dataLayer.TAPNQuery.SearchOption;
32import pipe.gui.CreateGui;38import pipe.gui.CreateGui;
39<<<<<<< TREE
33import net.tapaal.swinghelpers.CustomJSpinner;40import net.tapaal.swinghelpers.CustomJSpinner;
34import pipe.gui.undo.UndoManager;41import pipe.gui.undo.UndoManager;
42=======
43import pipe.gui.undo.UndoManager;
44import pipe.gui.widgets.CustomJSpinner;
45>>>>>>> MERGE-SOURCE
35import pipe.gui.widgets.EscapableDialog;46import pipe.gui.widgets.EscapableDialog;
36import pipe.gui.widgets.filebrowser.FileBrowser;47import pipe.gui.widgets.filebrowser.FileBrowser;
37import pipe.gui.widgets.QueryPane;48import pipe.gui.widgets.QueryPane;
@@ -237,6 +248,7 @@
237 private static int memoryTimerCount = 0;248 private static int memoryTimerCount = 0;
238 private static int memoryTimerMode = 0;249 private static int memoryTimerMode = 0;
239 private static int peakMemory = -1;250 private static int peakMemory = -1;
251 private UndoManager undoManager = new UndoManager(null,null,null);
240 252
241 private void startMemoryTimer(){253 private void startMemoryTimer(){
242 if(memoryTimer.isRunning()){254 if(memoryTimer.isRunning()){
@@ -465,25 +477,51 @@
465 FileBrowser browser = FileBrowser.constructor("Timed-Arc Petri Nets","tapn", "xml", lastPath);477 FileBrowser browser = FileBrowser.constructor("Timed-Arc Petri Nets","tapn", "xml", lastPath);
466 File[] filesArray = browser.openFiles();478 File[] filesArray = browser.openFiles();
467 if (filesArray.length>0) {479 if (filesArray.length>0) {
480<<<<<<< TREE
468 undoManager.newEdit();481 undoManager.newEdit();
469 for (File file : filesArray) {482 for (File file : filesArray) {
483=======
484 undoManager.newEdit();
485 for (File file : filesArray) {
486>>>>>>> MERGE-SOURCE
470 lastPath = file.getParent();487 lastPath = file.getParent();
471 if (!files.contains(file)) {488 if (!files.contains(file)) {
489<<<<<<< TREE
472 Command c = new AddFileBatchProcessingCommand(listModel,file, files, this );490 Command c = new AddFileBatchProcessingCommand(listModel,file, files, this );
473 c.redo();491 c.redo();
474 undoManager.addEdit(c);492 undoManager.addEdit(c);
493=======
494 Command c = new AddFileCommand(listModel,file,files,this);
495 c.redo();
496 undoManager.addEdit(c);
497
498>>>>>>> MERGE-SOURCE
475 }499 }
476 }500 }
501<<<<<<< TREE
502=======
503 enableButtons();
504>>>>>>> MERGE-SOURCE
477 }505 }
478 }506 }
479507
480 private void removeSelectedFiles() {508 private void removeSelectedFiles() {
509<<<<<<< TREE
481 undoManager.newEdit();510 undoManager.newEdit();
511=======
512 undoManager.newEdit();
513>>>>>>> MERGE-SOURCE
482 for (Object o : fileList.getSelectedValuesList()) {514 for (Object o : fileList.getSelectedValuesList()) {
483 File file = (File) o;515 File file = (File) o;
516<<<<<<< TREE
484 Command c = new RemoveFileBatchProcessingCommand(listModel,file, files, this );517 Command c = new RemoveFileBatchProcessingCommand(listModel,file, files, this );
485 c.redo();518 c.redo();
486 undoManager.addEdit(c);519 undoManager.addEdit(c);
520=======
521 Command c = new RemoveFileCommand(listModel, file,files,this);
522 c.redo();
523 undoManager.addEdit(c);
524>>>>>>> MERGE-SOURCE
487 }525 }
488 }526 }
489 527
@@ -1383,6 +1421,7 @@
1383 }1421 }
13841422
1385 private void clearFiles() {1423 private void clearFiles() {
1424<<<<<<< TREE
1386 undoManager.newEdit();1425 undoManager.newEdit();
13871426
1388 for (Object o : listModel.toArray()) {1427 for (Object o : listModel.toArray()) {
@@ -1391,6 +1430,15 @@
1391 c.redo();1430 c.redo();
1392 undoManager.addEdit(c);1431 undoManager.addEdit(c);
1393 }1432 }
1433=======
1434 undoManager.newEdit();
1435 for (Object o : listModel.toArray()) {
1436 File file = (File)o;
1437 Command c = new RemoveFileCommand(listModel,file, files, this );
1438 c.redo();
1439 undoManager.addEdit(c);
1440 }
1441>>>>>>> MERGE-SOURCE
1394 }1442 }
13951443
1396 private void disableButtonsDuringProcessing() {1444 private void disableButtonsDuringProcessing() {
@@ -1425,6 +1473,25 @@
14251473
1426 enabledVerificationOptionButtons();1474 enabledVerificationOptionButtons();
1427 }1475 }
1476 private void makeShortcuts(){
1477 int shortcutkey = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
1478 ActionMap am = splitpane.getActionMap();
1479 am.put("undo", new AbstractAction() {
1480 @Override
1481 public void actionPerformed(ActionEvent e) {
1482 undoManager.undo();
1483 }
1484 });
1485 am.put("redo", new AbstractAction() {
1486 @Override
1487 public void actionPerformed(ActionEvent e) {
1488 undoManager.redo();
1489 }
1490 });
1491 InputMap im = splitpane.getInputMap(JPanel.WHEN_IN_FOCUSED_WINDOW);
1492 im.put(KeyStroke.getKeyStroke('Z', shortcutkey), "undo");
1493 im.put(KeyStroke.getKeyStroke('Y', shortcutkey), "redo");
1494 }
14281495
1429 // Custom cell renderer for the Query Column of the result table display the1496 // Custom cell renderer for the Query Column of the result table display the
1430 // property of the query1497 // property of the query
14311498
=== modified file 'src/dk/aau/cs/gui/TabContent.java'
--- src/dk/aau/cs/gui/TabContent.java 2020-04-30 12:51:14 +0000
+++ src/dk/aau/cs/gui/TabContent.java 2020-05-13 15:54:44 +0000
@@ -51,6 +51,7 @@
51 private TimedArcPetriNetNetwork tapnNetwork = new TimedArcPetriNetNetwork();51 private TimedArcPetriNetNetwork tapnNetwork = new TimedArcPetriNetNetwork();
52 private HashMap<TimedArcPetriNet, DataLayer> guiModels = new HashMap<TimedArcPetriNet, DataLayer>();52 private HashMap<TimedArcPetriNet, DataLayer> guiModels = new HashMap<TimedArcPetriNet, DataLayer>();
53 private HashMap<TimedArcPetriNet, Zoomer> zoomLevels = new HashMap<TimedArcPetriNet, Zoomer>();53 private HashMap<TimedArcPetriNet, Zoomer> zoomLevels = new HashMap<TimedArcPetriNet, Zoomer>();
54<<<<<<< TREE
5455
5556
56 private UndoManager undoManager = new UndoManager();57 private UndoManager undoManager = new UndoManager();
@@ -182,6 +183,9 @@
182183
183 private HashMap<TimedArcPetriNet, Boolean> hasPositionalInfos = new HashMap<TimedArcPetriNet, Boolean>();184 private HashMap<TimedArcPetriNet, Boolean> hasPositionalInfos = new HashMap<TimedArcPetriNet, Boolean>();
184185
186=======
187 private HashMap<TimedArcPetriNet, Boolean> hasPositionalInfos = new HashMap<TimedArcPetriNet, Boolean>();
188>>>>>>> MERGE-SOURCE
185 private JScrollPane drawingSurfaceScroller;189 private JScrollPane drawingSurfaceScroller;
186 private JScrollPane editorSplitPaneScroller;190 private JScrollPane editorSplitPaneScroller;
187 private JScrollPane animatorSplitPaneScroller;191 private JScrollPane animatorSplitPaneScroller;
@@ -229,7 +233,11 @@
229 for (TimedArcPetriNet net : tapnNetwork.allTemplates()) {233 for (TimedArcPetriNet net : tapnNetwork.allTemplates()) {
230 guiModels.put(net, new DataLayer());234 guiModels.put(net, new DataLayer());
231 zoomLevels.put(net, new Zoomer());235 zoomLevels.put(net, new Zoomer());
236<<<<<<< TREE
232 hasPositionalInfos.put(net, Boolean.FALSE);237 hasPositionalInfos.put(net, Boolean.FALSE);
238=======
239 hasPositionalInfos.put(net, new Boolean(false));
240>>>>>>> MERGE-SOURCE
233 }241 }
234 242
235 drawingSurface = new DrawingSurfaceImpl(new DataLayer(), this, managerRef);243 drawingSurface = new DrawingSurfaceImpl(new DataLayer(), this, managerRef);
236244
=== modified file 'src/dk/aau/cs/gui/undo/MakePlaceNewSharedMultiCommand.java'
--- src/dk/aau/cs/gui/undo/MakePlaceNewSharedMultiCommand.java 2020-04-18 14:41:05 +0000
+++ src/dk/aau/cs/gui/undo/MakePlaceNewSharedMultiCommand.java 2020-05-13 15:54:44 +0000
@@ -36,6 +36,7 @@
36 boolean first = true;36 boolean first = true;
37 for(Template template : context.tabContent().allTemplates()) {37 for(Template template : context.tabContent().allTemplates()) {
38 TimedPlaceComponent component = (TimedPlaceComponent)template.guiModel().getPlaceByName(place.getName());38 TimedPlaceComponent component = (TimedPlaceComponent)template.guiModel().getPlaceByName(place.getName());
39<<<<<<< TREE
3940
40 if (component != null) {41 if (component != null) {
41 if (first) { //We make a new shared place with the first place42 if (first) { //We make a new shared place with the first place
@@ -50,6 +51,21 @@
50 commands.add(command);51 commands.add(command);
51 }52 }
52 }53 }
54=======
55 //We make a new shared place with the first place
56 if(component != null && i < 1) {
57 command = new MakePlaceNewSharedCommand(template.model(), newSharedName, component.underlyingPlace(), component, context.tabContent(), true);
58 command.redo();
59 sharedPlace = (SharedPlace)component.underlyingPlace();
60 commands.add(command);
61 i++;
62 //For the rest we make them shared with the recently made place
63 } else if (component != null && i >= 1){
64 command = new MakePlaceSharedCommand(context.activeModel(), sharedPlace, component.underlyingPlace(), component, context.tabContent(), true);
65 command.redo();
66 commands.add(command);
67 }
68>>>>>>> MERGE-SOURCE
53 }69 }
54 }70 }
5571
5672
=== modified file 'src/dk/aau/cs/gui/undo/MakePlaceSharedCommand.java'
--- src/dk/aau/cs/gui/undo/MakePlaceSharedCommand.java 2020-04-18 14:41:05 +0000
+++ src/dk/aau/cs/gui/undo/MakePlaceSharedCommand.java 2020-05-13 15:54:44 +0000
@@ -27,9 +27,15 @@
27 27
28 private final Hashtable<TAPNQuery, TAPNQuery> newQueryToOldQueryMapping;28 private final Hashtable<TAPNQuery, TAPNQuery> newQueryToOldQueryMapping;
29 private final List<TimedToken> oldTokens;29 private final List<TimedToken> oldTokens;
30<<<<<<< TREE
30 private final TabContent currentTab;31 private final TabContent currentTab;
3132
32 public MakePlaceSharedCommand(TimedArcPetriNet tapn, SharedPlace sharedPlace, TimedPlace place, TimedPlaceComponent placeComponent, TabContent currentTab, boolean multishare){33 public MakePlaceSharedCommand(TimedArcPetriNet tapn, SharedPlace sharedPlace, TimedPlace place, TimedPlaceComponent placeComponent, TabContent currentTab, boolean multishare){
34=======
35 private TabContent currentTab;
36
37 public MakePlaceSharedCommand(TimedArcPetriNet tapn, SharedPlace sharedPlace, TimedPlace place, TimedPlaceComponent placeComponent, TabContent currentTab, boolean multishare){
38>>>>>>> MERGE-SOURCE
33 Require.that(tapn != null, "tapn cannot be null");39 Require.that(tapn != null, "tapn cannot be null");
34 Require.that(sharedPlace != null, "sharedPlace cannot be null");40 Require.that(sharedPlace != null, "sharedPlace cannot be null");
35 Require.that(place != null, "timedPlace cannot be null");41 Require.that(place != null, "timedPlace cannot be null");
3642
=== added directory 'src/dk/aau/cs/verification/batchProcessing/Undo'
=== added file 'src/dk/aau/cs/verification/batchProcessing/Undo/AddFileCommand.java'
--- src/dk/aau/cs/verification/batchProcessing/Undo/AddFileCommand.java 1970-01-01 00:00:00 +0000
+++ src/dk/aau/cs/verification/batchProcessing/Undo/AddFileCommand.java 2020-05-13 15:54:44 +0000
@@ -0,0 +1,34 @@
1package dk.aau.cs.verification.batchProcessing.Undo;
2
3import dk.aau.cs.gui.BatchProcessingDialog;
4import dk.aau.cs.gui.undo.Command;
5
6import javax.swing.*;
7import java.io.File;
8import java.util.List;
9
10public class AddFileCommand extends Command {
11 private DefaultListModel listModel;
12 List<File> files;
13 File file;
14 private BatchProcessingDialog dialog;
15 public AddFileCommand(DefaultListModel listModel, File file, List<File> files, BatchProcessingDialog dialog){
16 this.listModel = listModel;
17 this.file = file;
18 this.files = files;
19 this.dialog = dialog;
20 }
21 @Override
22 public void redo() {
23 files.add(file);
24 listModel.addElement(file);
25 dialog.enableButtons();
26 }
27
28 @Override
29 public void undo() {
30 files.remove(file);
31 listModel.removeElement(file);
32 dialog.enableButtons();
33 }
34}
035
=== added file 'src/dk/aau/cs/verification/batchProcessing/Undo/RemoveFileCommand.java'
--- src/dk/aau/cs/verification/batchProcessing/Undo/RemoveFileCommand.java 1970-01-01 00:00:00 +0000
+++ src/dk/aau/cs/verification/batchProcessing/Undo/RemoveFileCommand.java 2020-05-13 15:54:44 +0000
@@ -0,0 +1,35 @@
1package dk.aau.cs.verification.batchProcessing.Undo;
2
3import dk.aau.cs.gui.BatchProcessingDialog;
4import dk.aau.cs.gui.undo.Command;
5
6import javax.swing.*;
7import java.io.File;
8import java.util.List;
9
10public class RemoveFileCommand extends Command {
11 private DefaultListModel listModel;
12 List<File> files;
13 File file;
14 private BatchProcessingDialog dialog;
15 public RemoveFileCommand(DefaultListModel listModel, File file, List<File> files, BatchProcessingDialog dialog){
16 this.listModel = listModel;
17 this.file = file;
18 this.files = files;
19 this.dialog = dialog;
20 }
21 @Override
22 public void redo() {
23 files.remove(file);
24 listModel.removeElement(file);
25 dialog.enableButtons();
26 }
27
28 @Override
29 public void undo() {
30 files.add(file);
31 listModel.addElement(file);
32 dialog.enableButtons();
33 }
34}
35
036
=== modified file 'src/net/tapaal/TAPAAL.java'
--- src/net/tapaal/TAPAAL.java 2020-04-18 16:13:35 +0000
+++ src/net/tapaal/TAPAAL.java 2020-05-13 15:54:44 +0000
@@ -39,7 +39,7 @@
39public class TAPAAL {39public class TAPAAL {
4040
41 public static final String TOOLNAME = "TAPAAL";41 public static final String TOOLNAME = "TAPAAL";
42 public static final String VERSION = "DEV"; 42 public static final String VERSION = "3.6.1";
4343
44 public static String getProgramName(){44 public static String getProgramName(){
45 return "" + TAPAAL.TOOLNAME + " " + TAPAAL.VERSION;45 return "" + TAPAAL.TOOLNAME + " " + TAPAAL.VERSION;
4646
=== modified file 'src/pipe/gui/ExportBatchDialog.java'
--- src/pipe/gui/ExportBatchDialog.java 2020-04-18 16:08:44 +0000
+++ src/pipe/gui/ExportBatchDialog.java 2020-05-13 15:54:44 +0000
@@ -235,10 +235,21 @@
235 gbc.anchor = GridBagConstraints.WEST;235 gbc.anchor = GridBagConstraints.WEST;
236 gbc.insets = new Insets(0, 10, 0, 0);236 gbc.insets = new Insets(0, 10, 0, 0);
237 JButton destinationPathSelector = new JButton("Select destination folder");237 JButton destinationPathSelector = new JButton("Select destination folder");
238<<<<<<< TREE
238 destinationPathSelector.addActionListener(e -> {239 destinationPathSelector.addActionListener(e -> {
239 selectDestinationPath();240 selectDestinationPath();
240 destinationPathField.setText(destinationFile.getParent());241 destinationPathField.setText(destinationFile.getParent());
241 enableButtons();242 enableButtons();
243=======
244 destinationPathSelector.addActionListener(new ActionListener() {
245 public void actionPerformed(ActionEvent e) {
246 selectDestinationPath();
247 if(destinationFile != null) {
248 destinationPathField.setText(lastExportPath);
249 }
250 enableButtons();
251 }
252>>>>>>> MERGE-SOURCE
242 });253 });
243 chooserPanel.add(destinationPathSelector, gbc);254 chooserPanel.add(destinationPathSelector, gbc);
244 255
@@ -450,10 +461,10 @@
450 }461 }
451 462
452 private void selectDestinationPath() {463 private void selectDestinationPath() {
453 String chosenFile = FileBrowser.constructor("Select an export folder", ".", lastExportPath).saveFile("Export");464 File chosenFile = FileBrowser.constructor("Select an export folder", ".", lastExportPath).saveFileToDir();
454 if(chosenFile != null) {465 if(chosenFile != null) {
455 destinationFile = new File(chosenFile);466 destinationFile = chosenFile;
456 lastExportPath = chosenFile;467 lastExportPath = destinationFile.getAbsolutePath();
457 }468 }
458 else return;469 else return;
459 }470 }
460471
=== modified file 'src/pipe/gui/undo/TranslatePetriNetObjectEdit.java'
--- src/pipe/gui/undo/TranslatePetriNetObjectEdit.java 2020-05-02 15:30:09 +0000
+++ src/pipe/gui/undo/TranslatePetriNetObjectEdit.java 2020-05-13 15:54:44 +0000
@@ -4,7 +4,11 @@
44
5package pipe.gui.undo;5package pipe.gui.undo;
66
7<<<<<<< TREE
7import pipe.gui.canvas.DrawingSurfaceImpl;8import pipe.gui.canvas.DrawingSurfaceImpl;
9=======
10import pipe.gui.DrawingSurfaceImpl;
11>>>>>>> MERGE-SOURCE
8import pipe.gui.graphicElements.PetriNetObject;12import pipe.gui.graphicElements.PetriNetObject;
9import dk.aau.cs.gui.undo.Command;13import dk.aau.cs.gui.undo.Command;
1014
@@ -17,29 +21,49 @@
17 PetriNetObject pnObject;21 PetriNetObject pnObject;
18 Integer transX;22 Integer transX;
19 Integer transY;23 Integer transY;
24<<<<<<< TREE
20 DrawingSurfaceImpl ds;25 DrawingSurfaceImpl ds;
26=======
27 DrawingSurfaceImpl view;
28>>>>>>> MERGE-SOURCE
2129
22 /** Creates a new instance of */30 /** Creates a new instance of */
23 public TranslatePetriNetObjectEdit(PetriNetObject _pnObject,31 public TranslatePetriNetObjectEdit(PetriNetObject _pnObject,
32<<<<<<< TREE
24 Integer _transX, Integer _transY, DrawingSurfaceImpl drawingSurface) {33 Integer _transX, Integer _transY, DrawingSurfaceImpl drawingSurface) {
34=======
35 Integer _transX, Integer _transY, DrawingSurfaceImpl view) {
36>>>>>>> MERGE-SOURCE
25 pnObject = _pnObject;37 pnObject = _pnObject;
26 transX = _transX;38 transX = _transX;
27 transY = _transY;39 transY = _transY;
40<<<<<<< TREE
28 ds = drawingSurface;41 ds = drawingSurface;
42=======
43 this.view = view;
44>>>>>>> MERGE-SOURCE
29 }45 }
3046
31 /** */47 /** */
32 @Override48 @Override
33 public void undo() {49 public void undo() {
34 pnObject.translate(-transX, -transY);50 pnObject.translate(-transX, -transY);
51<<<<<<< TREE
35 ds.updatePreferredSize();52 ds.updatePreferredSize();
53=======
54 view.updatePreferredSize();
55>>>>>>> MERGE-SOURCE
36 }56 }
3757
38 /** */58 /** */
39 @Override59 @Override
40 public void redo() {60 public void redo() {
41 pnObject.translate(transX, transY);61 pnObject.translate(transX, transY);
62<<<<<<< TREE
42 ds.updatePreferredSize();63 ds.updatePreferredSize();
64=======
65 view.updatePreferredSize();
66>>>>>>> MERGE-SOURCE
43 }67 }
4468
45 @Override69 @Override
4670
=== modified file 'src/pipe/gui/undo/UndoManager.java'
--- src/pipe/gui/undo/UndoManager.java 2020-05-03 09:49:19 +0000
+++ src/pipe/gui/undo/UndoManager.java 2020-05-13 15:54:44 +0000
@@ -38,10 +38,21 @@
38 /**38 /**
39 * Creates a new instance of UndoManager39 * Creates a new instance of UndoManager
40 */40 */
41<<<<<<< TREE
41 public UndoManager() {42 public UndoManager() {
4243
43 app.ifPresent(a -> a.setUndoActionEnabled(false));44 app.ifPresent(a -> a.setUndoActionEnabled(false));
44 app.ifPresent(a -> a.setRedoActionEnabled(false));45 app.ifPresent(a -> a.setRedoActionEnabled(false));
46=======
47 public UndoManager(DrawingSurfaceImpl _view, DataLayer _model, GuiFrame _app) {
48 view = _view;
49 guiModel = _model;
50 app = _app;
51 if(app != null) {
52 app.setUndoActionEnabled(false);
53 app.setRedoActionEnabled(false);
54 }
55>>>>>>> MERGE-SOURCE
45 for (int i = 0; i < UNDO_BUFFER_CAPACITY; i++) {56 for (int i = 0; i < UNDO_BUFFER_CAPACITY; i++) {
46 edits.add(null);57 edits.add(null);
47 }58 }
@@ -50,7 +61,14 @@
50 public void redo() {61 public void redo() {
5162
52 if (undoneEdits > 0) {63 if (undoneEdits > 0) {
64<<<<<<< TREE
53 checkArcBeingDrawn();65 checkArcBeingDrawn();
66=======
67 if(app != null && view != null) {
68 checkArcBeingDrawn();
69 checkMode();
70 }
71>>>>>>> MERGE-SOURCE
5472
55 // The currentEdit to redo73 // The currentEdit to redo
56 for (Command command : edits.get(indexOfNextAdd)) {74 for (Command command : edits.get(indexOfNextAdd)) {
@@ -59,10 +77,21 @@
59 indexOfNextAdd = (indexOfNextAdd + 1) % UNDO_BUFFER_CAPACITY;77 indexOfNextAdd = (indexOfNextAdd + 1) % UNDO_BUFFER_CAPACITY;
60 sizeOfBuffer++;78 sizeOfBuffer++;
61 undoneEdits--;79 undoneEdits--;
80<<<<<<< TREE
62 if (undoneEdits == 0) {81 if (undoneEdits == 0) {
63 app.ifPresent(a -> a.setRedoActionEnabled(false));82 app.ifPresent(a -> a.setRedoActionEnabled(false));
83=======
84 if(app != null) {
85 if (undoneEdits == 0) {
86 app.setRedoActionEnabled(false);
87 }
88 app.setUndoActionEnabled(true);
89>>>>>>> MERGE-SOURCE
64 }90 }
91<<<<<<< TREE
65 app.ifPresent(a -> a.setUndoActionEnabled(true));92 app.ifPresent(a -> a.setUndoActionEnabled(true));
93=======
94>>>>>>> MERGE-SOURCE
66 }95 }
67 }96 }
6897
@@ -79,7 +108,14 @@
79 public void undo() {108 public void undo() {
80109
81 if (sizeOfBuffer > 0) {110 if (sizeOfBuffer > 0) {
111<<<<<<< TREE
82 checkArcBeingDrawn();112 checkArcBeingDrawn();
113=======
114 if(app != null && view != null) {
115 checkArcBeingDrawn();
116 checkMode();
117 }
118>>>>>>> MERGE-SOURCE
83119
84 if (--indexOfNextAdd < 0) {120 if (--indexOfNextAdd < 0) {
85 indexOfNextAdd += UNDO_BUFFER_CAPACITY;121 indexOfNextAdd += UNDO_BUFFER_CAPACITY;
@@ -92,11 +128,22 @@
92 for (int i = currentEdit.size() - 1; i >= 0; i--) {128 for (int i = currentEdit.size() - 1; i >= 0; i--) {
93 currentEdit.get(i).undo();129 currentEdit.get(i).undo();
94 }130 }
131<<<<<<< TREE
95132
96 if (sizeOfBuffer == 0) {133 if (sizeOfBuffer == 0) {
97 app.ifPresent(a -> a.setUndoActionEnabled(false));134 app.ifPresent(a -> a.setUndoActionEnabled(false));
135=======
136 if(app != null) {
137 if (sizeOfBuffer == 0) {
138 app.setUndoActionEnabled(false);
139 }
140 app.setRedoActionEnabled(true);
141>>>>>>> MERGE-SOURCE
98 }142 }
143<<<<<<< TREE
99 app.ifPresent(a -> a.setRedoActionEnabled(true));144 app.ifPresent(a -> a.setRedoActionEnabled(true));
145=======
146>>>>>>> MERGE-SOURCE
100 }147 }
101 }148 }
102149
@@ -116,11 +163,21 @@
116 }163 }
117164
118 undoneEdits = 0;165 undoneEdits = 0;
166<<<<<<< TREE
119 app.ifPresent(a -> a.setUndoActionEnabled(true));167 app.ifPresent(a -> a.setUndoActionEnabled(true));
120 app.ifPresent(a -> a.setRedoActionEnabled(false));168 app.ifPresent(a -> a.setRedoActionEnabled(false));
121 if(CreateGui.getCurrentTab() != null) {169 if(CreateGui.getCurrentTab() != null) {
122 CreateGui.getCurrentTab().setNetChanged(true);170 CreateGui.getCurrentTab().setNetChanged(true);
123 }171 }
172=======
173 if(app != null) {
174 app.setUndoActionEnabled(true);
175 app.setRedoActionEnabled(false);
176 }
177 if(view != null){
178 view.setNetChanged(true);
179 }
180>>>>>>> MERGE-SOURCE
124181
125 ArrayList<Command> compoundEdit = new ArrayList<Command>();182 ArrayList<Command> compoundEdit = new ArrayList<Command>();
126 edits.set(indexOfNextAdd, compoundEdit);183 edits.set(indexOfNextAdd, compoundEdit);
@@ -143,6 +200,40 @@
143 addEdit(undoableEdit);200 addEdit(undoableEdit);
144 }201 }
145202
203<<<<<<< TREE
204=======
205 private void deleteSelection(PetriNetObject pnObject) {
206 if(pnObject instanceof PlaceTransitionObject){
207 PlaceTransitionObject pto = (PlaceTransitionObject)pnObject;
208
209 for(Arc arc : pto.getPreset()){
210 deleteObject(arc);
211 }
212
213 for(Arc arc : pto.getPostset()){
214 deleteObject(arc);
215 }
216 }
217
218 deleteObject(pnObject);
219 }
220
221 public void deleteSelection(ArrayList<PetriNetObject> selection) {
222 for (PetriNetObject pnObject : selection) {
223 deleteSelection(pnObject);
224 }
225 }
226
227 public void translateSelection(ArrayList<PetriNetObject> objects,
228 int transX, int transY) {
229 newEdit(); // new "transaction""
230 Iterator<PetriNetObject> iterator = objects.iterator();
231 while (iterator.hasNext()) {
232 addEdit(new TranslatePetriNetObjectEdit(iterator.next(), transX,
233 transY, view));
234 }
235 }
236>>>>>>> MERGE-SOURCE
146237
147 private int currentIndex() {238 private int currentIndex() {
148 int lastAdd = indexOfNextAdd - 1;239 int lastAdd = indexOfNextAdd - 1;
149240
=== modified file 'src/pipe/gui/widgets/filebrowser/FileBrowser.java'
--- src/pipe/gui/widgets/filebrowser/FileBrowser.java 2020-04-18 15:39:19 +0000
+++ src/pipe/gui/widgets/filebrowser/FileBrowser.java 2020-05-13 15:54:44 +0000
@@ -11,8 +11,8 @@
11 //Default value null makes the open dialog open default folder, For Windows, My Documents, For *nix ~ , etc11 //Default value null makes the open dialog open default folder, For Windows, My Documents, For *nix ~ , etc
12 //XXX 2018-05-23 moved from CreateGUI, refactor with regards to usage with lastPath local var in this class12 //XXX 2018-05-23 moved from CreateGUI, refactor with regards to usage with lastPath local var in this class
13 public static String userPath = null;13 public static String userPath = null;
14 static String lastSavePath = null;14 static String lastSavePath = ".";
15 static String lastOpenPath = null;15 static String lastOpenPath = ".";
1616
17 public static FileBrowser constructor(String filetype, final String ext) {17 public static FileBrowser constructor(String filetype, final String ext) {
18 return constructor(filetype, ext, null);18 return constructor(filetype, ext, null);
@@ -48,5 +48,6 @@
48 }48 }
4949
50 public abstract String saveFile(String suggestedName);50 public abstract String saveFile(String suggestedName);
51 public abstract File saveFileToDir();
5152
52}53}
5354
=== modified file 'src/pipe/gui/widgets/filebrowser/NativeFileBrowser.java'
--- src/pipe/gui/widgets/filebrowser/NativeFileBrowser.java 2020-04-18 15:39:19 +0000
+++ src/pipe/gui/widgets/filebrowser/NativeFileBrowser.java 2020-05-13 15:54:44 +0000
@@ -7,8 +7,7 @@
7import java.util.regex.Matcher;7import java.util.regex.Matcher;
8import java.util.regex.Pattern;8import java.util.regex.Pattern;
99
10import javax.swing.JOptionPane;10import javax.swing.*;
11
12import pipe.gui.CreateGui;11import pipe.gui.CreateGui;
1312
14class NativeFileBrowser extends FileBrowser {13class NativeFileBrowser extends FileBrowser {
@@ -23,7 +22,7 @@
23 NativeFileBrowser(String filetype, final String ext, final String optionalExt, String path) {22 NativeFileBrowser(String filetype, final String ext, final String optionalExt, String path) {
24 fc = new FileDialog(CreateGui.getAppGui(), filetype);23 fc = new FileDialog(CreateGui.getAppGui(), filetype);
25 this.specifiedPath = path;24 this.specifiedPath = path;
26 25
27 if (filetype == null) {26 if (filetype == null) {
28 filetype = "file";27 filetype = "file";
29 }28 }
@@ -85,7 +84,7 @@
85 lastOpenPath = fc.getDirectory();84 lastOpenPath = fc.getDirectory();
86 return selectedFiles;85 return selectedFiles;
87 }86 }
88 87
89 public String saveFile(String suggestedName) {88 public String saveFile(String suggestedName) {
90 if(specifiedPath == null) specifiedPath = lastSavePath;89 if(specifiedPath == null) specifiedPath = lastSavePath;
91 fc.setDirectory(specifiedPath);90 fc.setDirectory(specifiedPath);
@@ -146,5 +145,34 @@
146145
147 return file;146 return file;
148 }147 }
149148 public File saveFileToDir(){
149 //In Windows the native FileDialog only works with files
150 //So we make a JFileChooser in which we can control it
151 if(System.getProperty("os.name").startsWith("Windows")) {
152 File selectedDir = null;
153 if (specifiedPath == null) specifiedPath = lastSavePath;
154 JFileChooser c = new JFileChooser(specifiedPath);
155 c.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
156 c.setDialogTitle("Choose target directory for export");
157 int rVal = c.showSaveDialog(c);
158 if (rVal == JFileChooser.APPROVE_OPTION) {
159 selectedDir = c.getSelectedFile();
160 lastSavePath = selectedDir.getPath();
161 }
162
163 return selectedDir;
164 } else{
165 //For Mac we can set Directories only
166 //For linux a save dialog only shows directories
167 System.setProperty("apple.awt.fileDialogForDirectories", "true");
168 String selection = saveFile("Choose Directory");
169 System.setProperty("apple.awt.fileDialogForDirectories", "false");
170 if(selection != null) {
171 return new File(fc.getDirectory());
172 } else{
173 return null;
174 }
175 }
176
177 }
150}178}
151179
=== modified file 'src/pipe/gui/widgets/filebrowser/NativeFileBrowserFallback.java'
--- src/pipe/gui/widgets/filebrowser/NativeFileBrowserFallback.java 2020-04-18 14:41:05 +0000
+++ src/pipe/gui/widgets/filebrowser/NativeFileBrowserFallback.java 2020-05-13 15:54:44 +0000
@@ -10,7 +10,6 @@
10import javax.swing.JFileChooser;10import javax.swing.JFileChooser;
11import javax.swing.JOptionPane;11import javax.swing.JOptionPane;
12import javax.swing.filechooser.FileNameExtensionFilter;12import javax.swing.filechooser.FileNameExtensionFilter;
13
14import pipe.gui.CreateGui;13import pipe.gui.CreateGui;
1514
16class NativeFileBrowserFallback extends FileBrowser {15class NativeFileBrowserFallback extends FileBrowser {
@@ -159,4 +158,34 @@
159 }158 }
160 return file;159 return file;
161 }160 }
161 public File saveFileToDir(){
162 //In Windows the native FileDialog only works with files
163 //So we make a JFileChooser in which we can control it
164 if(System.getProperty("os.name").startsWith("Windows")) {
165 File selectedDir = null;
166 if (specifiedPath == null) specifiedPath = lastSavePath;
167 JFileChooser c = new JFileChooser(specifiedPath);
168 c.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
169 c.setDialogTitle("Choose target directory for export");
170 int rVal = c.showSaveDialog(c);
171 if (rVal == JFileChooser.APPROVE_OPTION) {
172 selectedDir = c.getSelectedFile();
173 lastSavePath = selectedDir.getPath();
174 }
175
176 return selectedDir;
177 } else{
178 //For Mac we can set Directories only
179 //For linux a save dialog only shows directories
180 System.setProperty("apple.awt.fileDialogForDirectories", "true");
181 String selection = saveFile("Choose Directory");
182 System.setProperty("apple.awt.fileDialogForDirectories", "false");
183 if(selection != null) {
184 return new File(fc.getDirectory());
185 } else{
186 return null;
187 }
188 }
189
190 }
162}191}

Subscribers

People subscribed via source and target branches