From 9959a5e05964860fb5a481172d7f06778542245a Mon Sep 17 00:00:00 2001 From: Jim Bowring Date: Fri, 19 May 2017 07:11:46 -0400 Subject: [PATCH] Prototype Project Manager take 1. (#5) * revises look and feel * adds basic support arch * refactors * refactors * adds prefix tree (trie) for use with parsing spot names * fixes css location * prototypes new feature for project per Bodorkos * refactors apearance * refines look and feel * begins applying serializability to project * basic project save and open using serialization * tweaks to menu * prototypes project manager phase one * prototypes project manager phase one --- .gitignore | 1 + common.gradle | 2 +- .../squid/gui/ProjectManagerController.java | 199 ++++++++-- .../java/org/cirdles/squid/gui/SquidUI.java | 13 +- .../cirdles/squid/gui/SquidUIController.java | 132 +++++-- .../{ => gui}/utilities/BrowserControl.java | 2 +- .../org/cirdles/squid/gui/AboutSquid.fxml | 10 +- .../org/cirdles/squid/gui/ProjectManager.fxml | 94 +++-- .../cirdles/squid/gui/SquidUIController.fxml | 24 +- .../org/cirdles/squid/gui/{ => css}/about.css | 0 .../cirdles/squid/gui/{ => css}/newcss.css | 23 +- .../squid/gui/{ => css}/projectManager.css | 69 +++- squidCore/build.gradle | 27 +- .../org/cirdles/squid/ExpressionsForSquid2.g4 | 99 +++++ .../squid/constants/SquidConstants.java | 28 ++ .../squid/dialogs/SquidMessageDialog.java | 53 +++ .../squid/exceptions/SquidException.java | 46 +++ .../fileManagement/CalamariFileManager.java | 26 +- .../cirdles/squid/projects/SquidProject.java | 194 +++++++++- .../squid/utilities/SquidPersistentState.java | 209 +++++++++++ .../squid/utilities/SquidPrefixTree.java | 344 ++++++++++++++++++ .../squid/utilities/SquidSerializer.java | 84 +++++ .../squid/utilities/SquidUserPreferences.java | 76 ++++ 23 files changed, 1624 insertions(+), 131 deletions(-) rename squidApp/src/main/java/org/cirdles/squid/{ => gui}/utilities/BrowserControl.java (97%) rename squidApp/src/main/resources/org/cirdles/squid/gui/{ => css}/about.css (100%) rename squidApp/src/main/resources/org/cirdles/squid/gui/{ => css}/newcss.css (87%) rename squidApp/src/main/resources/org/cirdles/squid/gui/{ => css}/projectManager.css (59%) create mode 100644 squidCore/src/main/antlr/org/cirdles/squid/ExpressionsForSquid2.g4 create mode 100644 squidCore/src/main/java/org/cirdles/squid/constants/SquidConstants.java create mode 100644 squidCore/src/main/java/org/cirdles/squid/dialogs/SquidMessageDialog.java create mode 100644 squidCore/src/main/java/org/cirdles/squid/exceptions/SquidException.java create mode 100644 squidCore/src/main/java/org/cirdles/squid/utilities/SquidPersistentState.java create mode 100644 squidCore/src/main/java/org/cirdles/squid/utilities/SquidPrefixTree.java create mode 100644 squidCore/src/main/java/org/cirdles/squid/utilities/SquidSerializer.java create mode 100644 squidCore/src/main/java/org/cirdles/squid/utilities/SquidUserPreferences.java diff --git a/.gitignore b/.gitignore index 3c8d02aa2..30589f789 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ nbproject/ test_* *.ser *.zip +*.squid # Resources !squidApp/src/main/resources/org/cirdles/squid/gui/version.txt diff --git a/common.gradle b/common.gradle index 61e619578..79d2ab95e 100644 --- a/common.gradle +++ b/common.gradle @@ -6,7 +6,7 @@ apply plugin: 'java' apply plugin: 'maven' String mavenGroupId = 'org.cirdles' -String mavenVersion = '0.0.1' +String mavenVersion = '0.0.2' sourceCompatibility = '1.8' diff --git a/squidApp/src/main/java/org/cirdles/squid/gui/ProjectManagerController.java b/squidApp/src/main/java/org/cirdles/squid/gui/ProjectManagerController.java index 9f71679c0..29c537e70 100644 --- a/squidApp/src/main/java/org/cirdles/squid/gui/ProjectManagerController.java +++ b/squidApp/src/main/java/org/cirdles/squid/gui/ProjectManagerController.java @@ -17,12 +17,14 @@ import java.io.IOException; import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.Locale; import java.util.ResourceBundle; import java.util.function.Predicate; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; -import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; @@ -32,14 +34,25 @@ import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.control.MenuItem; +import javafx.scene.control.TabPane; import javafx.scene.control.TextField; +import javafx.scene.control.TreeItem; +import javafx.scene.control.TreeView; import javafx.scene.input.KeyEvent; +import javafx.scene.layout.Border; +import javafx.scene.layout.BorderStroke; +import javafx.scene.layout.BorderStrokeStyle; +import javafx.scene.layout.BorderWidths; +import javafx.scene.layout.CornerRadii; +import javafx.scene.paint.Color; import javax.xml.bind.JAXBException; import org.cirdles.calamari.prawn.PrawnFile.Run; +import org.cirdles.squid.dialogs.SquidMessageDialog; import org.cirdles.squid.gui.RunsViewModel.ShrimpFractionListCell; import org.cirdles.squid.gui.RunsViewModel.SpotNameMatcher; import static org.cirdles.squid.gui.SquidUI.primaryStageWindow; import static org.cirdles.squid.gui.SquidUIController.squidProject; +import org.cirdles.squid.utilities.SquidPrefixTree; import org.xml.sax.SAXException; /** @@ -51,11 +64,11 @@ */ public class ProjectManagerController implements Initializable { - - private ObservableList shrimpRuns; - private ObservableList shrimpRunsRefMat; + private static final String SPOT_LIST_CSS_STYLE_SPECS = "-fx-font-size: 12px; -fx-font-weight: bold; -fx-font-family: 'Courier New';"; + private static ObservableList shrimpRuns; + private static ObservableList shrimpRunsRefMat; private final RunsViewModel runsModel = new RunsViewModel(); - + @FXML private TextField orignalPrawnFileName; @FXML @@ -69,18 +82,29 @@ public class ProjectManagerController implements Initializable { @FXML private Label headerLabel; @FXML - private TextField filterSpotName; - @FXML private Label spotsShownLabel; @FXML private Label headerLabelRefMat; - private static final String spotListStyleSpecs = "-fx-font-size: 12px; -fx-font-weight: bold; -fx-font-family: 'Courier New';"; @FXML private Button saveSpotNameButton; @FXML private Button savePrawnFileButton; @FXML private Button setFilteredSpotsAsRefMatButton; + @FXML + private TreeView prawnAuditTree; + @FXML + private TabPane prawnFileTabPane; + @FXML + private Label summaryStatsLabel; + @FXML + private Label totalAnalysisTimeLabel; + @FXML + private TextField projectNameText; + @FXML + private TextField analystNameText; + @FXML + private TextField filterSpotNameText; /** * Initializes the controller class. @@ -95,38 +119,109 @@ public void initialize(URL url, ResourceBundle rb) { savePrawnFileButton.setDisable(true); saveSpotNameButton.setDisable(true); setFilteredSpotsAsRefMatButton.setDisable(true); + + prawnFileTabPane.setBorder(new Border(new BorderStroke(Color.GRAY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1)))); + + // detect if project opened from menu by deserialization + if (squidProject.prawnFileExists()) { + setUpPrawnFile(); + } } - @FXML - private void selectPrawnFileAction(ActionEvent event) { + private void setUpPrawnFile() { + projectNameText.setText(squidProject.getProjectName()); + analystNameText.setText(squidProject.getAnalystName()); - try { - if (squidProject.selectPrawnFile(primaryStageWindow)) { + orignalPrawnFileName.setText(squidProject.getPrawnXMLFileName()); - orignalPrawnFileName.setText(squidProject.getPrawnXMLFileName()); + softwareVersionLabel.setText( + "Software Version: " + + squidProject.getPrawnFileShrimpSoftwareVersionName()); + + shrimpRuns = squidProject.getListOfPrawnFileRuns(); + shrimpRunsRefMat = squidProject.getShrimpRunsRefMat(); + shrimpRefMatList.setItems(shrimpRunsRefMat); - softwareVersionLabel.setText( - "Software Version: " - + squidProject.getPrawnFileShrimpSoftwareVersionName()); + setUpShrimpFractionList(); - shrimpRuns = squidProject.getListOfPrawnFileRuns(); - shrimpRunsRefMat = FXCollections.observableArrayList(); + savePrawnFileButton.setDisable(false); + saveSpotNameButton.setDisable(false); + setFilteredSpotsAsRefMatButton.setDisable(false); - setUpShrimpFractionList(); + setUpPrawnFileAuditTreeView(); + } + + private void setUpPrawnFileAuditTreeView() { + prawnAuditTree.setStyle(SPOT_LIST_CSS_STYLE_SPECS); + + TreeItem rootItem = new TreeItem<>("Spots", null); + rootItem.setExpanded(true); + prawnAuditTree.setRoot(rootItem); + + SquidPrefixTree spotPrefixTree = squidProject.generatePrefixTreeFromSpotNames(); + + String summaryStatsString = buildSummaryDataString(spotPrefixTree); + rootItem.setValue("Spots by prefix:" + summaryStatsString); + + // format into rows for summary tab + summaryStatsLabel.setText("Session summary:\n\t" + summaryStatsString.replaceAll(";", "\n\t")); + + totalAnalysisTimeLabel.setText("Total session time in hours = " + (int) squidProject.getSessionDurationHours()); + + populatePrefixTreeView(rootItem, spotPrefixTree); + } + + private void populatePrefixTreeView(TreeItem parentItem, SquidPrefixTree squidPrefixTree) { + + List children = squidPrefixTree.getChildren(); + + for (int i = 0; i < children.size(); i++) { + if (!children.get(i).isleaf()) { + TreeItem item + = new TreeItem<>(children.get(i).getStringValue() + + buildSummaryDataString(children.get(i)) + ); + + parentItem.getChildren().add(item); + + if (children.get(i).hasChildren()) { + populatePrefixTreeView(item, children.get(i)); + } - savePrawnFileButton.setDisable(false); - saveSpotNameButton.setDisable(false); - setFilteredSpotsAsRefMatButton.setDisable(false); + } else { + parentItem.setValue(children.get(i).getParent().getStringValue() + + " Dups=" + String.format("%1$ 2d", children.get(i).getParent().getCountOfDups()) + + " Species=" + String.format("%1$ 2d", children.get(i).getCountOfSpecies()) + + " Scans=" + String.format("%1$ 2d", children.get(i).getCountOfScans()) + + ((String) (children.size() > 1 ? " ** see duplicates below **" : "")) + ); } + } + } - } catch (IOException | JAXBException | SAXException iOException) { + private String buildSummaryDataString(SquidPrefixTree tree) { + // build species and scans count string + String speciesCounts = ""; + for (Integer count : tree.getMapOfSpeciesFrequencies().keySet()) { + speciesCounts += "[" + String.format("%1$ 2d", count) + " in " + String.format("%1$ 3d", tree.getMapOfSpeciesFrequencies().get(count)) + "]"; + } + + String scansCounts = ""; + for (Integer count : tree.getMapOfScansFrequencies().keySet()) { + scansCounts += "[" + String.format("%1$ 2d", count) + " in " + String.format("%1$ 3d", tree.getMapOfScansFrequencies().get(count)) + "]"; } + String summary = " Analyses=" + String.format("%1$ 3d", tree.getCountOfLeaves()) + + "; Dups=" + String.format("%1$ 3d", tree.getCountOfDups()) + + "; Species:" + speciesCounts + + "; Scans:" + scansCounts; + + return summary; } private void setUpShrimpFractionListHeaders() { - headerLabel.setStyle(spotListStyleSpecs); + headerLabel.setStyle(SPOT_LIST_CSS_STYLE_SPECS); headerLabel.setText( String.format("%1$-" + 20 + "s", "Spot Name") + String.format("%1$-" + 12 + "s", "Date") @@ -134,7 +229,7 @@ private void setUpShrimpFractionListHeaders() { + String.format("%1$-" + 6 + "s", "Peaks") + String.format("%1$-" + 6 + "s", "Scans")); - headerLabelRefMat.setStyle(spotListStyleSpecs); + headerLabelRefMat.setStyle(SPOT_LIST_CSS_STYLE_SPECS); headerLabelRefMat.setText( String.format("%1$-" + 20 + "s", "Ref Mat Name") + String.format("%1$-" + 12 + "s", "Date") @@ -145,7 +240,7 @@ private void setUpShrimpFractionListHeaders() { private void setUpShrimpFractionList() { - shrimpFractionList.setStyle(spotListStyleSpecs); + shrimpFractionList.setStyle(SPOT_LIST_CSS_STYLE_SPECS); shrimpFractionList.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override @@ -169,19 +264,21 @@ public void changed(ObservableValue observable, Run oldValue, Run shrimpFractionList.itemsProperty().bind(runsModel.viewableShrimpRunsProperty()); - shrimpFractionList.setContextMenu(createContextMenu()); + shrimpFractionList.setContextMenu(createAllSpotsViewContextMenu()); // display of selected reference materials - shrimpRefMatList.setStyle(spotListStyleSpecs); + shrimpRefMatList.setStyle(SPOT_LIST_CSS_STYLE_SPECS); shrimpRefMatList.setCellFactory( (lv) -> new ShrimpFractionListCell() ); + shrimpRefMatList.setContextMenu(createRefMatSpotsViewContextMenu()); + } - private ContextMenu createContextMenu() { + private ContextMenu createAllSpotsViewContextMenu() { ContextMenu contextMenu = new ContextMenu(); MenuItem menuItem = new MenuItem("Remove this spot."); menuItem.setOnAction((evt) -> { @@ -194,17 +291,40 @@ private ContextMenu createContextMenu() { } }); contextMenu.getItems().add(menuItem); + + menuItem = new MenuItem("Split Prawn file starting with this run."); + menuItem.setOnAction((evt) -> { + Run selectedRun = shrimpFractionList.getSelectionModel().getSelectedItem(); + if (selectedRun != null) { + SquidMessageDialog.showInfoDialog("Coming soon!"); + } + }); + contextMenu.getItems().add(menuItem); + + return contextMenu; + } + + private ContextMenu createRefMatSpotsViewContextMenu() { + ContextMenu contextMenu = new ContextMenu(); + MenuItem menuItem = new MenuItem("Clear list."); + menuItem.setOnAction((evt) -> { + shrimpRunsRefMat.clear(); + shrimpRefMatList.setItems(shrimpRunsRefMat); + }); + contextMenu.getItems().add(menuItem); return contextMenu; } @FXML private void filterSpotNameKeyReleased(KeyEvent event) { - String filterString = filterSpotName.getText().toUpperCase(Locale.US).trim(); + filterRuns(); + } + + private void filterRuns() { + String filterString = filterSpotNameText.getText().toUpperCase(Locale.US).trim(); Predicate filter = new SpotNameMatcher(filterString); runsModel.filterProperty().set(filter); spotsShownLabel.setText(runsModel.showFilteredOverAllCount()); - - squidProject.setFilterForRefMatSpotNames(filterString); } @FXML @@ -213,6 +333,7 @@ private void saveSpotNameAction(ActionEvent event) { ((Run) saveSpotNameButton.getUserData()).getPar().get(0).setValue(selectedSpotNameText.getText().trim().toUpperCase(Locale.US)); shrimpFractionList.refresh(); shrimpRefMatList.refresh(); + setUpPrawnFileAuditTreeView(); } } @@ -220,6 +341,7 @@ private void saveSpotNameAction(ActionEvent event) { private void setFilteredSpotsToRefMatAction(ActionEvent event) { shrimpRunsRefMat = runsModel.getViewableShrimpRuns(); shrimpRefMatList.setItems(shrimpRunsRefMat); + squidProject.setFilterForRefMatSpotNames(filterSpotNameText.getText().toUpperCase(Locale.US).trim()); } @FXML @@ -229,7 +351,20 @@ private void savePrawnFileAction(ActionEvent event) { orignalPrawnFileName.setText(SquidUIController.squidProject.getPrawnXMLFileName()); shrimpFractionList.refresh(); shrimpRefMatList.refresh(); + setUpPrawnFileAuditTreeView(); } catch (IOException | JAXBException | SAXException iOException) { } } + + /** + * Saves underlying List to squidProject so it can be serialized + */ + public static void saveProjectData() { + List plainListRefMat = new ArrayList<>(shrimpRunsRefMat.size()); + for (Run r : shrimpRunsRefMat) { + plainListRefMat.add(r); + } + squidProject.setShrimpRunsRefMat(plainListRefMat); + } + } diff --git a/squidApp/src/main/java/org/cirdles/squid/gui/SquidUI.java b/squidApp/src/main/java/org/cirdles/squid/gui/SquidUI.java index 6f372213d..edd96fb43 100644 --- a/squidApp/src/main/java/org/cirdles/squid/gui/SquidUI.java +++ b/squidApp/src/main/java/org/cirdles/squid/gui/SquidUI.java @@ -53,7 +53,7 @@ public class SquidUI extends Application { String releaseDate = "date"; // get version number and release date written by pom.xml - Path resourcePath = squidResourceExtractor.extractResourceAsPath("version.txt"); + Path resourcePath = SquidUI.squidResourceExtractor.extractResourceAsPath("version.txt"); Charset charset = Charset.forName("US-ASCII"); try (BufferedReader reader = Files.newBufferedReader(resourcePath, charset)) { String line = reader.readLine(); @@ -75,13 +75,13 @@ public class SquidUI extends Application { RELEASE_DATE = releaseDate; // get content for about window - resourcePath = squidResourceExtractor.extractResourceAsPath("/org/cirdles/squid/gui/content/aboutContent.txt"); + resourcePath = SquidUI.squidResourceExtractor.extractResourceAsPath("/org/cirdles/squid/gui/content/aboutContent.txt"); try (BufferedReader reader = Files.newBufferedReader(resourcePath, charset)) { - aboutWindowContent = new StringBuilder(); + SquidUI.aboutWindowContent = new StringBuilder(); String thisLine; while ((thisLine = reader.readLine()) != null) { - aboutWindowContent.append(thisLine); + SquidUI.aboutWindowContent.append(thisLine); } } catch (IOException x) { @@ -105,15 +105,14 @@ public void start(Stage primaryStage) throws Exception { primaryStage.setScene(scene); primaryStage.show(); // this produces non-null window after .show() - this.primaryStageWindow = primaryStage.getScene().getWindow(); + SquidUI.primaryStageWindow = primaryStage.getScene().getWindow(); primaryStage.setOnCloseRequest((WindowEvent e) -> { Platform.exit(); System.exit(0); }); - squidAboutWindow = new SquidAboutWindow(primaryStage); - squidAboutWindow.loadAboutWindow(); + SquidUI.squidAboutWindow = new SquidAboutWindow(primaryStage); } /** diff --git a/squidApp/src/main/java/org/cirdles/squid/gui/SquidUIController.java b/squidApp/src/main/java/org/cirdles/squid/gui/SquidUIController.java index 747d5ceec..c75cd3d3a 100644 --- a/squidApp/src/main/java/org/cirdles/squid/gui/SquidUIController.java +++ b/squidApp/src/main/java/org/cirdles/squid/gui/SquidUIController.java @@ -29,10 +29,16 @@ import javafx.scene.layout.Pane; import javafx.scene.layout.Priority; import javafx.scene.layout.VBox; +import javax.xml.bind.JAXBException; +import org.cirdles.calamari.core.PrawnFileHandler; +import org.cirdles.squid.dialogs.SquidMessageDialog; import org.cirdles.squid.fileManagement.CalamariFileManager; +import static org.cirdles.squid.gui.SquidUI.primaryStageWindow; import org.cirdles.squid.projects.SquidProject; -import org.cirdles.squid.utilities.BrowserControl; -import static org.cirdles.squid.utilities.BrowserControl.urlEncode; +import org.cirdles.squid.gui.utilities.BrowserControl; +import static org.cirdles.squid.gui.utilities.BrowserControl.urlEncode; +import org.cirdles.squid.utilities.SquidSerializer; +import org.xml.sax.SAXException; /** * FXML Controller class @@ -61,9 +67,18 @@ public class SquidUIController implements Initializable { private MenuItem closeSquidProjectMenuItem; @FXML private Menu manageRatiosMenu; - @FXML private Pane mainPane; + @FXML + private Menu manageReportsMenu; + @FXML + private MenuItem projectManagerMenuItem; + + private Pane projectManagerUI; + @FXML + private MenuItem saveSquidProjectMenuItem; + @FXML + private MenuItem newSquidProjectByMergeMenuItem; /** * Initializes the controller class. @@ -78,44 +93,102 @@ public void initialize(URL url, ResourceBundle rb) { manageRatiosMenu.setDisable(true); manageTasksMenu.setDisable(true); manageAnalysisMenu.setDisable(true); + manageReportsMenu.setDisable(true); + + // Squid project menu items newSquidProjectMenuItem.setDisable(false); - openSquidProjectMenuItem.setDisable(true); + newSquidProjectByMergeMenuItem.setDisable(false); + openSquidProjectMenuItem.setDisable(false); openRecentSquidProjectMenuItem.setDisable(true); + saveSquidProjectMenuItem.setDisable(true); saveAsSquidProjectMenuItem.setDisable(true); + projectManagerMenuItem.setDisable(true); closeSquidProjectMenuItem.setDisable(true); - } - @FXML - private void newSquidProjectAction(ActionEvent event) { - newSquidProjectMenuItem.setDisable(true); + CalamariFileManager.initExamplePrawnFiles(); + } - squidProject = new SquidProject(); - CalamariFileManager.initCalamariFiles(squidProject.getPrawnFileHandler(), "1.4.3"); + private void launchProjectManager() { try { - Pane projectManagerUI = FXMLLoader.load(getClass().getResource("ProjectManager.fxml")); + // prevent stacking of project panes + mainPane.getChildren().remove(projectManagerUI); + + projectManagerUI = FXMLLoader.load(getClass().getResource("ProjectManager.fxml")); projectManagerUI.setId("ProjectManager"); VBox.setVgrow(projectManagerUI, Priority.ALWAYS); HBox.setHgrow(projectManagerUI, Priority.ALWAYS); - mainPane.getChildren().set(0, projectManagerUI); + mainPane.getChildren().add(projectManagerUI); projectManagerUI.setVisible(true); + + saveAsSquidProjectMenuItem.setDisable(false); + closeSquidProjectMenuItem.setDisable(false); + + } catch (IOException | RuntimeException iOException) { + System.out.println(">>>> " + iOException.getMessage()); + } + + } + + @FXML + private void newSquidProjectAction(ActionEvent event) { + squidProject = new SquidProject(); + + CalamariFileManager.initProjectFiles(squidProject.getPrawnFileHandler(), "1.4.5"); + + try { + if (squidProject.selectPrawnFile(primaryStageWindow)) { + launchProjectManager(); + } + } catch (IOException | JAXBException | SAXException anException) { + SquidMessageDialog.showWarningDialog("Squid encountered an error while trying to open the selected file(s)."); + } + } + + @FXML + private void newSquidProjectByMergeAction(ActionEvent event) { + SquidMessageDialog.showInfoDialog("Coming soon!"); + } + + @FXML + private void saveAsSquidProjectMenuItemAction(ActionEvent event) { + if (squidProject != null) { + ProjectManagerController.saveProjectData(); + try { + squidProject.saveProjectFile(SquidUI.primaryStageWindow); + } catch (IOException ex) { + } + } + } + + @FXML + private void openSquidProjectMenuItemAction(ActionEvent event) { + try { + String projectFileName = SquidProject.selectProjectFile(SquidUI.primaryStageWindow); + if (!"".equals(projectFileName)) { + squidProject = (SquidProject) SquidSerializer.GetSerializedObjectFromFile(projectFileName); + if (squidProject != null) { + squidProject.setPrawnFileHandler(new PrawnFileHandler()); + squidProject.updatePrawnFileHandlerWithFileLocation(); + launchProjectManager(); + } + } } catch (IOException iOException) { } } @FXML - private void contributeIssueOnGitHubAction(ActionEvent event) { - String version = "Squid3 Version: " + SquidUI.VERSION; - String javaVersion = "Java Version: " + System.getProperties().getProperty("java.version"); - String operatingSystem = "OS: " + System.getProperties().getProperty("os.name") + " " + System.getProperties().getProperty("os.version"); + private void closeSquidProjectMenuItemClose(ActionEvent event) { + mainPane.getChildren().remove(projectManagerUI); - StringBuilder issueBody = new StringBuilder(); - issueBody.append(urlEncode(version + "\n")); - issueBody.append(urlEncode(javaVersion + "\n")); - issueBody.append(urlEncode(operatingSystem + "\n")); - issueBody.append(urlEncode("==================================" + "\n")); + saveAsSquidProjectMenuItem.setDisable(true); + closeSquidProjectMenuItem.setDisable(true); + projectManagerMenuItem.setDisable(true); - BrowserControl.showURI("https://github.com/CIRDLES/Squid/issues/new?body=" + issueBody.toString()); + } + + @FXML + private void saveSquidProjectMenuItemAction(ActionEvent event) { } @FXML @@ -133,4 +206,19 @@ private void aboutSquidAction(ActionEvent event) { SquidUI.squidAboutWindow.loadAboutWindow(); } + @FXML + private void contributeIssueOnGitHubAction(ActionEvent event) { + String version = "Squid3 Version: " + SquidUI.VERSION; + String javaVersion = "Java Version: " + System.getProperties().getProperty("java.version"); + String operatingSystem = "OS: " + System.getProperties().getProperty("os.name") + " " + System.getProperties().getProperty("os.version"); + + StringBuilder issueBody = new StringBuilder(); + issueBody.append(urlEncode(version + "\n")); + issueBody.append(urlEncode(javaVersion + "\n")); + issueBody.append(urlEncode(operatingSystem + "\n")); + issueBody.append(urlEncode("\n\nIssue details:\n")); + + BrowserControl.showURI("https://github.com/CIRDLES/Squid/issues/new?body=" + issueBody.toString()); + } + } diff --git a/squidApp/src/main/java/org/cirdles/squid/utilities/BrowserControl.java b/squidApp/src/main/java/org/cirdles/squid/gui/utilities/BrowserControl.java similarity index 97% rename from squidApp/src/main/java/org/cirdles/squid/utilities/BrowserControl.java rename to squidApp/src/main/java/org/cirdles/squid/gui/utilities/BrowserControl.java index 61bf4d943..fc0284905 100644 --- a/squidApp/src/main/java/org/cirdles/squid/utilities/BrowserControl.java +++ b/squidApp/src/main/java/org/cirdles/squid/gui/utilities/BrowserControl.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.cirdles.squid.utilities; +package org.cirdles.squid.gui.utilities; import java.awt.Desktop; import java.io.IOException; diff --git a/squidApp/src/main/resources/org/cirdles/squid/gui/AboutSquid.fxml b/squidApp/src/main/resources/org/cirdles/squid/gui/AboutSquid.fxml index 5199ef587..cfbcbe42b 100644 --- a/squidApp/src/main/resources/org/cirdles/squid/gui/AboutSquid.fxml +++ b/squidApp/src/main/resources/org/cirdles/squid/gui/AboutSquid.fxml @@ -26,9 +26,9 @@ - + -