From 526bb5ad00237fef86a4428847d4ce3e60856daf Mon Sep 17 00:00:00 2001 From: icecoldgold773 Date: Thu, 21 Sep 2023 17:03:38 +0200 Subject: [PATCH 1/9] Changed max row count of colored combobox from default to 20 rows --- .../java/net/tapaal/gui/petrinet/editor/ColorComboboxPanel.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboboxPanel.java b/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboboxPanel.java index 084d9d0f2..8e4fee48e 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboboxPanel.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboboxPanel.java @@ -143,6 +143,8 @@ private JComboBox createColoredCombobox(Context context, ColorType ct, boolean i combobox.setRenderer(new ColorComboBoxRenderer(combobox)); combobox.setPreferredSize(new Dimension(200,25)); + combobox.setMaximumRowCount(20); + if (includePlaceHolder) { combobox.addItem(new PlaceHolderColorExpression()); combobox.addItem(new JSeparator()); From a63f3868a48ecc48f2e2b75c0cca833f6c735deb Mon Sep 17 00:00:00 2001 From: icecoldgold773 Date: Mon, 25 Sep 2023 22:43:27 +0200 Subject: [PATCH 2/9] Fixed bug with ellipsis in ColorComboBoxRenderer --- .../editor/ColorComboBoxRenderer.java | 52 +++++++++++++------ 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboBoxRenderer.java b/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboBoxRenderer.java index 2ad31e22a..75cef0ecc 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboBoxRenderer.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboBoxRenderer.java @@ -17,34 +17,54 @@ public Component getListCellRendererComponent( int index, boolean isSelected, boolean cellHasFocus) { - if(value instanceof JSeparator){ - return new JSeparator(JSeparator.HORIZONTAL); + + int padding = 2; + + if (value instanceof JSeparator){ + return new JSeparator(JSeparator.HORIZONTAL); } - else if(value instanceof Variable){ - setText(ellipsis(((Variable)value).getName(), comboBox.getWidth() / 7)); + else if (value instanceof Variable){ + String text = ((Variable)value).getName(); + setText(ellipsis(text, maxChars(text, list, padding))); setFont(list.getFont()); } - else if(value != null) { - setText(ellipsis(value.toString(), comboBox.getWidth() / 7)); - + else if (value != null) { + String text = value.toString(); + + setText(ellipsis(text, maxChars(text, list, padding))); setFont(list.getFont()); } return this; } - //From here https://stackoverflow.com/questions/3597550/ideal-method-to-truncate-a-string-with-ellipsis - + + // Calculates max possible chars that can be shown on list - padding + private int maxChars(String text, JList list, int padding) { + FontMetrics metrics = list.getFontMetrics(list.getFont()); + + int width = 0; + int comboBoxWidth = comboBox.getWidth(); + + for (int i = 0; i < text.length(); ++i) { + int cWidth = metrics.charWidth(text.charAt(i)); + + if (width + cWidth > comboBoxWidth) { + return i - padding; + } + + width += cWidth; + } + + return text.length(); + } + + // Inspired by: https://stackoverflow.com/questions/3597550/ideal-method-to-truncate-a-string-with-ellipsis public static String ellipsis(final String text, int length) { - if(length > 3) { - // The letters [iIl1] are slim enough to only count as half a character. - length += Math.ceil(text.replaceAll("[^iIl]", "").length() / 2.0d); - - if (text.length() > length) { - return text.substring(0, length - 3) + "..."; - } + if (length > 3 && text.length() > length) { + return text.substring(0, length - 3) + "..."; } return text; From 4338a97abd102d7a69b006d9db023d1026b3788a Mon Sep 17 00:00:00 2001 From: icecoldgold773 Date: Tue, 26 Sep 2023 18:57:17 +0200 Subject: [PATCH 3/9] Added missing tool tips + fixed scrolling in edit query and edit place panel --- .../gui/petrinet/dialog/QueryDialog.java | 25 +++++++++++++------ .../petrinet/editor/ColoredArcGuardPanel.java | 3 ++- .../editor/ColoredTransitionGuardPanel.java | 3 ++- .../gui/petrinet/editor/PlaceEditorPanel.java | 2 +- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/main/java/net/tapaal/gui/petrinet/dialog/QueryDialog.java b/src/main/java/net/tapaal/gui/petrinet/dialog/QueryDialog.java index 08d9630b1..dc24c2483 100644 --- a/src/main/java/net/tapaal/gui/petrinet/dialog/QueryDialog.java +++ b/src/main/java/net/tapaal/gui/petrinet/dialog/QueryDialog.java @@ -17,11 +17,6 @@ import javax.swing.*; import javax.swing.border.LineBorder; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Vector; - import javax.swing.event.*; import javax.swing.text.MutableAttributeSet; import javax.swing.text.SimpleAttributeSet; @@ -414,6 +409,7 @@ private QueryDialog(EscapableDialog me, QueryDialogueOption option, TAPNQuery qu setLayout(new GridBagLayout()); + init(option, queryToCreateFrom); makeShortcuts(); toggleAdvancedSimpleView(false); @@ -687,11 +683,23 @@ public static TAPNQuery showQueryDialogue(QueryDialogueOption option, TAPNQuery // 2 Add query editor QueryDialog queryDialogue = new QueryDialog(guiDialog, option, queryToRepresent, tapnNetwork, guiModels, lens, tab); - contentPane.add(queryDialogue); - guiDialog.setResizable(false); + // Add scrolling when window gets too small for content + JScrollPane scrollPane = new JScrollPane(queryDialogue); + scrollPane.setViewportView(queryDialogue); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); - // Make window fit contents' preferred size + GridBagConstraints gbc = new GridBagConstraints(); + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridx = 0; + gbc.gridy = 0; + gbc.fill = GridBagConstraints.BOTH; + + contentPane.add(scrollPane, gbc); + + // Make window fit contents' preferred size guiDialog.pack(); // 'hack' for hiding the trace drop-down menu for HyperLTL on intial launch of the query dialogue panel @@ -1502,6 +1510,7 @@ private void init(QueryDialogueOption option, final TAPNQuery queryToCreateFrom) setEnabledReductionOptions(); rootPane.setDefaultButton(saveAndVerifyButton); + disableAllQueryButtons(); setSaveButtonsEnabled(); diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/ColoredArcGuardPanel.java b/src/main/java/net/tapaal/gui/petrinet/editor/ColoredArcGuardPanel.java index 445b48460..f1f0f65f6 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/ColoredArcGuardPanel.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/ColoredArcGuardPanel.java @@ -624,7 +624,8 @@ private void initExprField () { exprField.setBackground(java.awt.Color.white); exprField.setEditable(false); - exprField.setToolTipText("Tooltip missing"); + exprField.setToolTipText("Click on a part of the query you want to edit.
" + + "(Queries can also be edited manually by pressing the \"Edit Query\" button.)"); JScrollPane exprScrollPane = new JScrollPane(exprField); exprScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/ColoredTransitionGuardPanel.java b/src/main/java/net/tapaal/gui/petrinet/editor/ColoredTransitionGuardPanel.java index b1a1e210d..7aee60996 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/ColoredTransitionGuardPanel.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/ColoredTransitionGuardPanel.java @@ -541,7 +541,8 @@ private void initExprField() { exprField.setBackground(java.awt.Color.white); exprField.setEditable(false); - exprField.setToolTipText("Tooltip missing"); + exprField.setToolTipText("Click on a part of the query you want to edit.
" + +"(Queries can also be edited manually by pressing the \"Edit Query\" button.)"); JScrollPane exprScrollPane = new JScrollPane(exprField); exprScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); diff --git a/src/main/java/pipe/gui/petrinet/editor/PlaceEditorPanel.java b/src/main/java/pipe/gui/petrinet/editor/PlaceEditorPanel.java index 31c2fead9..0b19450d7 100644 --- a/src/main/java/pipe/gui/petrinet/editor/PlaceEditorPanel.java +++ b/src/main/java/pipe/gui/petrinet/editor/PlaceEditorPanel.java @@ -86,7 +86,7 @@ public PlaceEditorPanel(EscapableDialog parent,JRootPane rootPane, TimedPlaceCom else originalExpression = null; hideIrrelevantInformation(); scrollPane.setViewportView(mainPanel); - scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); add(scrollPane, BorderLayout.CENTER); } From 24bbe28132e0d2f762705c83fbb44df28ff2b99d Mon Sep 17 00:00:00 2001 From: mtygesen6 Date: Thu, 28 Sep 2023 18:42:10 +0200 Subject: [PATCH 4/9] Added prefered size of edit color type and edit variable + added scrollpane to component name and shared place to fix bug with OS that still allows resizing after setResize(false) --- .../gui/petrinet/dialog/QueryDialog.java | 5 +++-- .../editor/ColorComboBoxRenderer.java | 17 ++++++++++------ .../petrinet/editor/ColorComboboxPanel.java | 2 +- .../petrinet/editor/ColorTypeDialogPanel.java | 4 ++++ .../SharedPlacesAndTransitionsPanel.java | 9 ++++++++- .../gui/petrinet/editor/TemplateExplorer.java | 20 +++++++++++++++++-- .../petrinet/editor/VariablesDialogPanel.java | 5 ++++- 7 files changed, 49 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/tapaal/gui/petrinet/dialog/QueryDialog.java b/src/main/java/net/tapaal/gui/petrinet/dialog/QueryDialog.java index dc24c2483..8ad1edac7 100644 --- a/src/main/java/net/tapaal/gui/petrinet/dialog/QueryDialog.java +++ b/src/main/java/net/tapaal/gui/petrinet/dialog/QueryDialog.java @@ -684,9 +684,10 @@ public static TAPNQuery showQueryDialogue(QueryDialogueOption option, TAPNQuery // 2 Add query editor QueryDialog queryDialogue = new QueryDialog(guiDialog, option, queryToRepresent, tapnNetwork, guiModels, lens, tab); - // Add scrolling when window gets too small for content + guiDialog.setResizable(false); + + // setResizable seems to be platform dependent so use scrolling as a fallback JScrollPane scrollPane = new JScrollPane(queryDialogue); - scrollPane.setViewportView(queryDialogue); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboBoxRenderer.java b/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboBoxRenderer.java index 75cef0ecc..8e004d1fb 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboBoxRenderer.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboBoxRenderer.java @@ -7,8 +7,15 @@ public class ColorComboBoxRenderer extends JLabel implements ListCellRenderer { final JComboBox comboBox; + final int adjust; + public ColorComboBoxRenderer(JComboBox comboBox) { + this(comboBox, 0); + } + + public ColorComboBoxRenderer(JComboBox comboBox, int adjust) { this.comboBox = comboBox; + this.adjust = adjust; } public Component getListCellRendererComponent( @@ -18,21 +25,19 @@ public Component getListCellRendererComponent( boolean isSelected, boolean cellHasFocus) { - int padding = 2; - if (value instanceof JSeparator){ return new JSeparator(JSeparator.HORIZONTAL); } else if (value instanceof Variable){ String text = ((Variable)value).getName(); - setText(ellipsis(text, maxChars(text, list, padding))); + setText(ellipsis(text, maxChars(text, list, adjust))); setFont(list.getFont()); } else if (value != null) { String text = value.toString(); - setText(ellipsis(text, maxChars(text, list, padding))); + setText(ellipsis(text, maxChars(text, list, adjust))); setFont(list.getFont()); } @@ -40,7 +45,7 @@ else if (value != null) { } // Calculates max possible chars that can be shown on list - padding - private int maxChars(String text, JList list, int padding) { + private int maxChars(String text, JList list, int adjust) { FontMetrics metrics = list.getFontMetrics(list.getFont()); int width = 0; @@ -50,7 +55,7 @@ private int maxChars(String text, JList list, int padding) { int cWidth = metrics.charWidth(text.charAt(i)); if (width + cWidth > comboBoxWidth) { - return i - padding; + return i - adjust; } width += cWidth; diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboboxPanel.java b/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboboxPanel.java index 8e4fee48e..121b148eb 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboboxPanel.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/ColorComboboxPanel.java @@ -140,7 +140,7 @@ public void updateColorType(ColorType ct, Context context, boolean includePlaceH private JComboBox createColoredCombobox(Context context, ColorType ct, boolean includePlaceHolder) { JComboBox combobox = new JComboBox<>(); - combobox.setRenderer(new ColorComboBoxRenderer(combobox)); + combobox.setRenderer(new ColorComboBoxRenderer(combobox, 2)); combobox.setPreferredSize(new Dimension(200,25)); combobox.setMaximumRowCount(20); diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java b/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java index 1a3d2bd64..8e2989778 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java @@ -60,6 +60,7 @@ public class ColorTypeDialogPanel extends JPanel { private JScrollPane scrollPane; + private static final int MAXIMUM_INTEGER = 10000; public ColorTypeDialogPanel(ConstantsPane.ColorTypesListModel colorTypesListModel, @@ -88,12 +89,14 @@ public ColorTypeDialogPanel(ConstantsPane.ColorTypesListModel colorTypesListMode public void showDialog() { dialog = new EscapableDialog(TAPAALGUI.getApp(), "Edit color type", true); + dialog.add(scrollPane, BorderLayout.CENTER); dialog.getRootPane().setDefaultButton(okButton); dialog.setResizable(true); dialog.pack(); //size of range of integers panel dialog.setMinimumSize(new Dimension(447, 231)); + dialog.setLocationRelativeTo(null); dialog.setVisible(true); } @@ -387,6 +390,7 @@ private JPanel createCyclicAndFiniteEnumerationPanel() { final JPanel cyclicAndFiniteEnumeration = new JPanel(); cyclicAndFiniteEnumeration.setLayout(new GridBagLayout()); cyclicAndFiniteEnumeration.setBorder(BorderFactory.createTitledBorder("Cyclic and Finite Enumeration")); + cyclicAndFiniteEnumeration.setPreferredSize(new Dimension(450, 250)); //cyclicAndFiniteEnumeration.setSize(550,300); JButton moveUpButton = new JButton(new ImageIcon(Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource("Images/Up.png")))); JButton moveDownButton = new JButton(new ImageIcon(Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource("Images/Down.png")))); diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/SharedPlacesAndTransitionsPanel.java b/src/main/java/net/tapaal/gui/petrinet/editor/SharedPlacesAndTransitionsPanel.java index 879099cb6..11c05f12b 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/SharedPlacesAndTransitionsPanel.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/SharedPlacesAndTransitionsPanel.java @@ -15,6 +15,7 @@ import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.ScrollPaneConstants; import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; import javax.swing.event.ListSelectionEvent; @@ -401,7 +402,13 @@ private void showSharedPlaceNameDialog(SharedPlace placeToEdit) { contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); JPanel panel = new SharedPlaceNamePanel(guiDialog.getRootPane(), sharedPlacesListModel, new Context(tab), placeToEdit); - contentPane.add(panel); + + // setResizable seems to be platform dependent so use scrolling as a fallback + JScrollPane scrollPane = new JScrollPane(panel); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + + contentPane.add(scrollPane); guiDialog.setResizable(false); guiDialog.pack(); diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/TemplateExplorer.java b/src/main/java/net/tapaal/gui/petrinet/editor/TemplateExplorer.java index f514d5751..88bcab79a 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/TemplateExplorer.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/TemplateExplorer.java @@ -31,6 +31,7 @@ import javax.swing.KeyStroke; import javax.swing.ListCellRenderer; import javax.swing.ListSelectionModel; +import javax.swing.ScrollPaneConstants; import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; import javax.swing.event.ListSelectionEvent; @@ -551,8 +552,15 @@ private void initComponentsOfNewTemplateDialog(String nameToShow) { private void ShowNewTemplateDialog(String nameToShow) { dialog = new EscapableDialog(TAPAALGUI.getApp(), "Enter Component Name", true); + + // setResizable seems to be platform dependent so use scrolling as a fallback + JScrollPane scrollPane = new JScrollPane(container); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + initComponentsOfNewTemplateDialog(nameToShow); - dialog.add(container); + + dialog.add(scrollPane); dialog.setResizable(false); dialog.pack(); dialog.setLocationRelativeTo(null); @@ -635,8 +643,16 @@ private void showRenameTemplateDialog(String nameToShow) { else { initComponentsOfRenameTemplateDialog(nameToShow); } - dialog.add(container); + + // setResizable seems to be platform dependent so use scrolling as a fallback + JScrollPane scrollPane = new JScrollPane(container); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + + dialog.add(scrollPane); + dialog.setResizable(false); + dialog.pack(); dialog.setLocationRelativeTo(null); dialog.setVisible(true); diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/VariablesDialogPanel.java b/src/main/java/net/tapaal/gui/petrinet/editor/VariablesDialogPanel.java index ae84b453d..694100a35 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/VariablesDialogPanel.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/VariablesDialogPanel.java @@ -174,6 +174,9 @@ private void createColorTypesComboBox() { colorTypeComboBox = new JComboBox(); + colorTypeComboBox.setPreferredSize(new Dimension(330, 30)); + colorTypeComboBox.setRenderer(new ColorComboBoxRenderer(colorTypeComboBox, -4)); + int selectedVariableIndex = 0; int index = 0; for (ColorType element : colorTypes) { colorTypeComboBox.addItem(element); @@ -198,7 +201,7 @@ private void createColorTypesComboBox() { gbc.gridwidth = 1; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.HORIZONTAL; - container.add(colorTypeComboBox,gbc); + container.add(colorTypeComboBox, gbc); } private void createOKButton() { From 169e710e397347009e47b7a69223e09ae3fe8184 Mon Sep 17 00:00:00 2001 From: icecoldgold773 Date: Fri, 29 Sep 2023 13:27:12 +0200 Subject: [PATCH 5/9] Fixed component dialog size on first open --- .../net/tapaal/gui/petrinet/editor/TemplateExplorer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/TemplateExplorer.java b/src/main/java/net/tapaal/gui/petrinet/editor/TemplateExplorer.java index 88bcab79a..64c8e31f3 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/TemplateExplorer.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/TemplateExplorer.java @@ -553,12 +553,12 @@ private void initComponentsOfNewTemplateDialog(String nameToShow) { private void ShowNewTemplateDialog(String nameToShow) { dialog = new EscapableDialog(TAPAALGUI.getApp(), "Enter Component Name", true); + initComponentsOfNewTemplateDialog(nameToShow); + // setResizable seems to be platform dependent so use scrolling as a fallback JScrollPane scrollPane = new JScrollPane(container); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); - - initComponentsOfNewTemplateDialog(nameToShow); dialog.add(scrollPane); dialog.setResizable(false); @@ -650,9 +650,7 @@ private void showRenameTemplateDialog(String nameToShow) { scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dialog.add(scrollPane); - dialog.setResizable(false); - dialog.pack(); dialog.setLocationRelativeTo(null); dialog.setVisible(true); From ab749b708764843344c685beab4cd929b98ca31e Mon Sep 17 00:00:00 2001 From: icecoldgold773 Date: Fri, 29 Sep 2023 14:59:01 +0200 Subject: [PATCH 6/9] Fixed double border --- src/main/java/net/tapaal/gui/petrinet/dialog/QueryDialog.java | 1 + .../gui/petrinet/editor/SharedPlacesAndTransitionsPanel.java | 1 + .../java/net/tapaal/gui/petrinet/editor/TemplateExplorer.java | 4 +++- src/main/java/pipe/gui/petrinet/editor/PlaceEditorPanel.java | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/tapaal/gui/petrinet/dialog/QueryDialog.java b/src/main/java/net/tapaal/gui/petrinet/dialog/QueryDialog.java index 8ad1edac7..324a9319b 100644 --- a/src/main/java/net/tapaal/gui/petrinet/dialog/QueryDialog.java +++ b/src/main/java/net/tapaal/gui/petrinet/dialog/QueryDialog.java @@ -690,6 +690,7 @@ public static TAPNQuery showQueryDialogue(QueryDialogueOption option, TAPNQuery JScrollPane scrollPane = new JScrollPane(queryDialogue); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setBorder(null); GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 1.0; diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/SharedPlacesAndTransitionsPanel.java b/src/main/java/net/tapaal/gui/petrinet/editor/SharedPlacesAndTransitionsPanel.java index 11c05f12b..6e52250c3 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/SharedPlacesAndTransitionsPanel.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/SharedPlacesAndTransitionsPanel.java @@ -407,6 +407,7 @@ private void showSharedPlaceNameDialog(SharedPlace placeToEdit) { JScrollPane scrollPane = new JScrollPane(panel); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setBorder(null); contentPane.add(scrollPane); diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/TemplateExplorer.java b/src/main/java/net/tapaal/gui/petrinet/editor/TemplateExplorer.java index 64c8e31f3..51d56b7b1 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/TemplateExplorer.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/TemplateExplorer.java @@ -559,7 +559,8 @@ private void ShowNewTemplateDialog(String nameToShow) { JScrollPane scrollPane = new JScrollPane(container); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); - + scrollPane.setBorder(null); + dialog.add(scrollPane); dialog.setResizable(false); dialog.pack(); @@ -648,6 +649,7 @@ private void showRenameTemplateDialog(String nameToShow) { JScrollPane scrollPane = new JScrollPane(container); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setBorder(null); dialog.add(scrollPane); dialog.setResizable(false); diff --git a/src/main/java/pipe/gui/petrinet/editor/PlaceEditorPanel.java b/src/main/java/pipe/gui/petrinet/editor/PlaceEditorPanel.java index 0b19450d7..6eca19d6e 100644 --- a/src/main/java/pipe/gui/petrinet/editor/PlaceEditorPanel.java +++ b/src/main/java/pipe/gui/petrinet/editor/PlaceEditorPanel.java @@ -88,6 +88,7 @@ public PlaceEditorPanel(EscapableDialog parent,JRootPane rootPane, TimedPlaceCom scrollPane.setViewportView(mainPanel); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + scrollPane.setBorder(null); add(scrollPane, BorderLayout.CENTER); } From 6780c7be34e84c7c12625351c45d92cde5126809 Mon Sep 17 00:00:00 2001 From: Jiri Srba Date: Sat, 30 Sep 2023 11:17:42 +0200 Subject: [PATCH 7/9] Fixes bug when after removing colored tokens the GUI still showed the previous count. Bug: https://bugs.launchpad.net/tapaal/+bug/2037705 --- src/main/java/dk/aau/cs/model/tapn/TimedPlace.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/dk/aau/cs/model/tapn/TimedPlace.java b/src/main/java/dk/aau/cs/model/tapn/TimedPlace.java index e5cb148b8..76e8a0cfb 100644 --- a/src/main/java/dk/aau/cs/model/tapn/TimedPlace.java +++ b/src/main/java/dk/aau/cs/model/tapn/TimedPlace.java @@ -79,7 +79,8 @@ public void setNumberOfTokens(int numberOfTokens) { } public void resetNumberOfTokens() { - numberOfTokens = 0; + this.numberOfTokens = 0; + this.tokens().clear(); } /** From 14ad3041145dee0290a6ae5f5c822a525360144e Mon Sep 17 00:00:00 2001 From: mtygesen6 Date: Sat, 30 Sep 2023 15:15:18 +0200 Subject: [PATCH 8/9] Fixed double borders --- .../net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java | 2 ++ .../net/tapaal/gui/petrinet/editor/VariablesDialogPanel.java | 1 + src/main/java/pipe/gui/petrinet/editor/GuardDialogue.java | 1 + .../java/pipe/gui/petrinet/editor/TAPNTransitionEditor.java | 1 + 4 files changed, 5 insertions(+) diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java b/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java index 8e2989778..e82fc8b32 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/ColorTypeDialogPanel.java @@ -90,6 +90,8 @@ public ColorTypeDialogPanel(ConstantsPane.ColorTypesListModel colorTypesListMode public void showDialog() { dialog = new EscapableDialog(TAPAALGUI.getApp(), "Edit color type", true); + scrollPane.setBorder(null); + dialog.add(scrollPane, BorderLayout.CENTER); dialog.getRootPane().setDefaultButton(okButton); dialog.setResizable(true); diff --git a/src/main/java/net/tapaal/gui/petrinet/editor/VariablesDialogPanel.java b/src/main/java/net/tapaal/gui/petrinet/editor/VariablesDialogPanel.java index 694100a35..e3bf74e3d 100644 --- a/src/main/java/net/tapaal/gui/petrinet/editor/VariablesDialogPanel.java +++ b/src/main/java/net/tapaal/gui/petrinet/editor/VariablesDialogPanel.java @@ -71,6 +71,7 @@ public void showDialog() { dialog = new EscapableDialog(TAPAALGUI.getApp(), panelHeader, true); + scrollPane.setBorder(null); dialog.add(scrollPane, BorderLayout.CENTER); dialog.getRootPane().setDefaultButton(okButton); dialog.setResizable(false); diff --git a/src/main/java/pipe/gui/petrinet/editor/GuardDialogue.java b/src/main/java/pipe/gui/petrinet/editor/GuardDialogue.java index 33739b798..6bb2ec64b 100644 --- a/src/main/java/pipe/gui/petrinet/editor/GuardDialogue.java +++ b/src/main/java/pipe/gui/petrinet/editor/GuardDialogue.java @@ -73,6 +73,7 @@ public GuardDialogue(JRootPane rootPane, PetriNetObject objectToBeEdited, Contex scrollPane.setViewportView(mainPanel); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + scrollPane.setBorder(null); initTimeGuardPanel(); diff --git a/src/main/java/pipe/gui/petrinet/editor/TAPNTransitionEditor.java b/src/main/java/pipe/gui/petrinet/editor/TAPNTransitionEditor.java index b514b488f..e54a6fb7b 100644 --- a/src/main/java/pipe/gui/petrinet/editor/TAPNTransitionEditor.java +++ b/src/main/java/pipe/gui/petrinet/editor/TAPNTransitionEditor.java @@ -238,6 +238,7 @@ public void actionPerformed(ActionEvent arg0) { scrollPane.setViewportView(mainPanel); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setBorder(null); add(scrollPane, BorderLayout.CENTER); } From 761d987f632f38e2860f1c14aaa24b025d945695 Mon Sep 17 00:00:00 2001 From: mtygesen6 Date: Sat, 30 Sep 2023 18:00:49 +0200 Subject: [PATCH 9/9] Updated about menu --- src/main/java/net/tapaal/gui/GuiFrameController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/tapaal/gui/GuiFrameController.java b/src/main/java/net/tapaal/gui/GuiFrameController.java index ed594daf9..b3275bac0 100644 --- a/src/main/java/net/tapaal/gui/GuiFrameController.java +++ b/src/main/java/net/tapaal/gui/GuiFrameController.java @@ -244,7 +244,7 @@ public void showAbout() { buffer.append("TAPAAL GUI and Translations:\n"); buffer.append("Mathias Andersen, Sine V. Birch, Jacob Hjort Bundgaard, Joakim Byg, Malo Dautry, \nJakob Dyhr, Louise Foshammer, Malte Neve-Gr\u00E6sb\u00F8ll, "); buffer.append("Lasse Jacobsen, Morten Jacobsen,\nThomas S. Jacobsen, Jacob J. Jensen, Peter G. Jensen, "); - buffer.append("Mads Johannsen,\nKenneth Y. J\u00F8rgensen, Mikael H. M\u00F8ller, Christoffer Moesgaard, Kristian Morsing Pedersen,\nThomas Pedersen, Lena S. Ernstsen, Niels N. Samuelsen, Jiri Srba, Mathias G. S\u00F8rensen,\nJakob H. Taankvist and Peter H. Taankvist\n"); + buffer.append("Mads Johannsen,\nKenneth Y. J\u00F8rgensen, Mikael H. M\u00F8ller, Christoffer Moesgaard, Kristian Morsing Pedersen,\nThomas Pedersen, Lena S. Ernstsen, Niels N. Samuelsen, Jiri Srba, Mathias G. S\u00F8rensen,\nJakob H. Taankvist, Peter H. Taankvist and Mikkel Tygesen\n"); buffer.append("Aalborg University 2008-2023\n\n"); @@ -258,7 +258,7 @@ public void showAbout() { buffer.append("Aalborg University 2012-2023\n\n"); buffer.append("TAPAAL Untimed Engine (verifypn):\n"); - buffer.append("Alexander Bilgram, Frederik M. B\u00F8nneland, Jakob Dyhr, Peter Fogh, "); + buffer.append("Alexander Bilgram, Frederik M. B\u00F8nneland, Jakob Dyhr, Malo Dautry, Peter Fogh, "); buffer.append("Jonas F. Jensen,\nLasse S. Jensen, Peter G. Jensen, Nicolaj \u00D8. Jensen,"); buffer.append("Tobias S. Jepsen,\nMads Johannsen, Kenneth Y. J\u00F8rgensen, Mads Johannsen, Isabella Kaufmann,\n"); buffer.append("Andreas H. Klostergaard, S\u00F8ren M. Nielsen, Thomas S. Nielsen, ");