diff --git a/.gitignore b/.gitignore index a4a252a1f..efe58ff74 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,6 @@ -/prolinestudio-dpm/target/ -/prolinestudio-mzscope/target/ -/prolinestudio-R/target/ -/prolinestudio-resultexplorer/target/ -/application/target/ -/builder/target/ -/prolinestudio-mzscope/prolinestudio-mzscope.iml -/branding/prolinestudio-branding.iml -/prolinestudio-commons/prolinestudio-commons.iml -/prolinestudio-R/prolinestudio-R.iml -/prolinestudio-dam/prolinestudio-dam.iml -/prolinestudio-corewrapper/prolinestudio-corewrapper.iml -/prolinestudio-dpm/prolinestudio-dpm.iml -/application/prolinestudio-app.iml -/prolinestudio-resultexplorer/prolinestudio-resultexplorer.iml -/prolinestudio-parent.iml -/prolinestudio-logger/prolinestudio-logger.iml -/branding/target/ -/builder/ProlineStudio.iml -/prolinestudio-commons/target/ -/prolinestudio-corewrapper/target/ -/prolinestudio-dam/target/ -/prolinestudio-logger/target/ +**/target/ +/.idea/ +*.iml +.flattened-pom.xml +nb-configuration.xml +/prolinestudio-commons/src/main/java/fr/proline/studio/JavaVersion.java diff --git a/application/nbactions.xml b/application/nbactions.xml deleted file mode 100644 index 7283c14d9..000000000 --- a/application/nbactions.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - build - - package - - - - rebuild - - clean - package - - - - build-with-dependencies - also-make - - package - - - - CUSTOM-Install - Install - - install - - - diff --git a/application/pom.xml b/application/pom.xml deleted file mode 100644 index 2895bc261..000000000 --- a/application/pom.xml +++ /dev/null @@ -1,228 +0,0 @@ - - - 4.0.0 - - - fr.proline - prolinestudio-parent - 2.1.2 - - - prolinestudio-app - nbm-application - ProlineStudio-app - - - UTF-8 - - ${netbeans.run.params.ide} -J-Xmx1024m -J-Dfr.proline.level=1000 - ${project.build.directory}/${brandingToken} - 1.0.392 - ${project.build.directory}/${brandingToken}/sqlite4java - - - - - - - - org.netbeans.cluster - platform - ${netbeans.version} - pom - - - - - org.netbeans.api - org-netbeans-modules-nbjunit - ${netbeans.version} - test - - - - - org.netbeans.api - org-openide-util - ${netbeans.version} - - - org.netbeans.api - org-openide-awt - ${netbeans.version} - - - org.netbeans.modules - org-netbeans-modules-utilities-project - ${netbeans.version} - - - - - ${project.groupId} - prolinestudio-branding - ${project.version} - - - - ${project.groupId} - prolinestudio-resultexplorer - ${project.version} - - - commons-pool - commons-pool - - - commons-dbcp - commons-dbcp - - - - - - - - - org.codehaus.mojo - nbm-maven-plugin - - src/main/resources/prolinestudio.conf - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - - ${all.clusters} - ${brandingToken} - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy - compile - - copy - - - - - - com.almworks.sqlite4java - sqlite4java-win32-x64 - ${sqlite4java.version} - dll - true - ${sqlite4java.library.path} - - - - com.almworks.sqlite4java - libsqlite4java-linux-amd64 - ${sqlite4java.version} - so - true - ${sqlite4java.library.path} - - - - - - - - - copy-dependencies - prepare-package - - unpack-dependencies - - - zip - ${project.build.directory}/${brandingToken} - true - - - - - - - maven-resources-plugin - - - copy-resources - prepare-package - - copy-resources - - - true - ${project.build.directory}/${brandingToken} - - - src/main/resources - - **/logback.xml - - true - - - - - - - - - - - - deployment - - - - org.codehaus.mojo - nbm-maven-plugin - - - extra - - autoupdate - webstart-app - build-installers - - - - - - - - - diff --git a/application/src/main/resources/prolinestudio.conf b/application/src/main/resources/prolinestudio.conf deleted file mode 100644 index df8133245..000000000 --- a/application/src/main/resources/prolinestudio.conf +++ /dev/null @@ -1,16 +0,0 @@ -# ${HOME} will be replaced by user home directory according to platform -default_userdir="${HOME}/.${APPNAME}/dev" -default_mac_userdir="${HOME}/Library/Application Support/${APPNAME}/dev" - -# options used by the launcher by default, can be overridden by explicit -# command line switches -default_options="--branding prolinestudio -J-Xms128m -J-Xmx1024m -J-XX:MaxPermSize=128m -J-Djava.library.path=.\sqlite4java -J-Dnetbeans.slow.system.clipboard.hack=false -J-Dlogback.configurationFile=logback.xml" - -# for development purposes you may wish to append: -J-Dnetbeans.logger.console=true -J-ea - -# default location of JDK/JRE, can be overridden by using --jdkhome switch -#jdkhome="/path/to/jdk" -#jdkhome="./jre1.7.0_17_64" - -# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices) -#extra_clusters= diff --git a/branding/pom.xml b/branding/pom.xml deleted file mode 100644 index 1e3fa3558..000000000 --- a/branding/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - 4.0.0 - - - fr.proline - prolinestudio-parent - 2.1.2 - - - prolinestudio-branding - nbm - - ProlineStudio-branding - - - UTF-8 - - - - - - - org.codehaus.mojo - nbm-maven-plugin - - - - - diff --git a/branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/startup/Bundle.properties b/branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/startup/Bundle.properties deleted file mode 100644 index f970413e0..000000000 --- a/branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/startup/Bundle.properties +++ /dev/null @@ -1,9 +0,0 @@ -currentVersion=ProlineStudio {0} -LBL_splash_window_title=Starting Proline Studio -SPLASH_HEIGHT=341 -SPLASH_WIDTH=530 -SplashProgressBarBounds=0,310,530,6 -SplashProgressBarColor=0xF88734 -SplashRunningTextBounds=10,319,503,13 -SplashRunningTextColor=0xF88734 -SplashRunningTextFontSize=10 diff --git a/branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/ui/Bundle.properties b/branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/ui/Bundle.properties deleted file mode 100644 index e3887f797..000000000 --- a/branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/ui/Bundle.properties +++ /dev/null @@ -1,2 +0,0 @@ -LBL_Copyright=Proline Studio is developped in the context of ProFI ( French Proteomics National Infrastructure).

3 laboratories contribute to this software:
- iRTSV (Grenoble): EDyP Team, BGE Laboratory (U1038 CEA/INSERM/UJF)
- IPBS (Toulouse):UMR 5089 (CNRS/UPS)
- LSMBO (Strasbourg) :UMR 7178 (CNRS/UdS) -URL_ON_IMG= diff --git a/branding/src/main/nbm-branding/modules/org-netbeans-core-ide.jar/org/netbeans/core/ide/Bundle.properties b/branding/src/main/nbm-branding/modules/org-netbeans-core-ide.jar/org/netbeans/core/ide/Bundle.properties deleted file mode 100644 index a0472c49b..000000000 --- a/branding/src/main/nbm-branding/modules/org-netbeans-core-ide.jar/org/netbeans/core/ide/Bundle.properties +++ /dev/null @@ -1,2 +0,0 @@ -CTL_ServicesTabAction=&Databases -LBL_Services=Databases diff --git a/branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties b/branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties deleted file mode 100644 index 81bea9d58..000000000 --- a/branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties +++ /dev/null @@ -1,2 +0,0 @@ -CTL_MainWindow_Title=ProlineStudio {0} -CTL_MainWindow_Title_No_Project=ProlineStudio {0} diff --git a/branding/src/main/nbm-branding/modules/org-netbeans-core.jar/org/netbeans/core/actions/Bundle.properties b/branding/src/main/nbm-branding/modules/org-netbeans-core.jar/org/netbeans/core/actions/Bundle.properties deleted file mode 100644 index 35948c4da..000000000 --- a/branding/src/main/nbm-branding/modules/org-netbeans-core.jar/org/netbeans/core/actions/Bundle.properties +++ /dev/null @@ -1,2 +0,0 @@ -MSG_LogTab_name=Application &Log -MSG_ShortLogTab_name=Application Log diff --git a/branding/src/main/nbm-branding/modules/org-netbeans-core.jar/org/netbeans/core/ui/Bundle.properties b/branding/src/main/nbm-branding/modules/org-netbeans-core.jar/org/netbeans/core/ui/Bundle.properties deleted file mode 100644 index 0aac4caa8..000000000 --- a/branding/src/main/nbm-branding/modules/org-netbeans-core.jar/org/netbeans/core/ui/Bundle.properties +++ /dev/null @@ -1 +0,0 @@ -LBL_ProductInformation=ProlineStudio diff --git a/branding/src/main/nbm-branding/modules/org-netbeans-modules-javahelp.jar/org/netbeans/modules/javahelp/resources/Bundle.properties b/branding/src/main/nbm-branding/modules/org-netbeans-modules-javahelp.jar/org/netbeans/modules/javahelp/resources/Bundle.properties deleted file mode 100644 index 3dcbd7079..000000000 --- a/branding/src/main/nbm-branding/modules/org-netbeans-modules-javahelp.jar/org/netbeans/modules/javahelp/resources/Bundle.properties +++ /dev/null @@ -1,2 +0,0 @@ -Actions/Help/master-help.xml=Database Help -Menu/Help/master-help.xml=Database Help diff --git a/branding/src/main/nbm/manifest.mf b/branding/src/main/nbm/manifest.mf deleted file mode 100644 index 8125f252f..000000000 --- a/branding/src/main/nbm/manifest.mf +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -OpenIDE-Module-Layer: fr/proline/prolinestudio/branding/layer.xml -OpenIDE-Module-Localizing-Bundle: fr/proline/prolinestudio/branding/Bundle.properties -AutoUpdate-Essential-Module: true diff --git a/branding/src/main/nbm/module.xml b/branding/src/main/nbm/module.xml deleted file mode 100644 index 660e5296c..000000000 --- a/branding/src/main/nbm/module.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - diff --git a/branding/src/main/resources/fr/proline/prolinestudio/branding/Bundle.properties b/branding/src/main/resources/fr/proline/prolinestudio/branding/Bundle.properties deleted file mode 100644 index b0eaa19d1..000000000 --- a/branding/src/main/resources/fr/proline/prolinestudio/branding/Bundle.properties +++ /dev/null @@ -1,5 +0,0 @@ -# Localized module labels. Defaults taken from POM (, , ) if unset. -#OpenIDE-Module-Name= -#OpenIDE-Module-Short-Description= -#OpenIDE-Module-Long-Description= -#OpenIDE-Module-Display-Category= diff --git a/branding/src/main/resources/fr/proline/prolinestudio/branding/layer.xml b/branding/src/main/resources/fr/proline/prolinestudio/branding/layer.xml deleted file mode 100644 index ccc0ff2f4..000000000 --- a/branding/src/main/resources/fr/proline/prolinestudio/branding/layer.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/builder/assembly/assembly.xml b/builder/assembly/assembly.xml index f7c12327e..a7e4bc9b6 100644 --- a/builder/assembly/assembly.xml +++ b/builder/assembly/assembly.xml @@ -15,6 +15,7 @@ documentation/** + @@ -23,23 +24,39 @@ R/** + ${project.build.directory}/${project.artifactId}-${project.version}/prolinestudio + + */** + + + start_studio.bat + + ${project.build.directory}/${project.artifactId}-${project.version} + prolinestudio/** - + + + + ${project.build.directory}/${project.artifactId}-${project.version}/prolinestudio/start_studio.bat + + true + + diff --git a/builder/pom.xml b/builder/pom.xml index 8e6e58384..78c55681f 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -3,18 +3,19 @@ 4.0.0 fr.proline ProlineStudio - 2.1.2 + 2.2.0 pom UTF-8 - 2.1.2 + ${project.version} + .\jre\bin\ fr.proline - prolinestudio-app + prolinestudio-resultexplorer ${studio.version} zip @@ -41,28 +42,28 @@ - - com.google.code.maven-replacer-plugin - replacer - 1.5.3 - - - package - - replace - - - - - ${project.build.directory}/${project.artifactId}-${project.version}/prolinestudio/etc/prolinestudio.conf - - - #jdkhome="/path/to/jdk" - jdkhome="./jre" - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -84,7 +85,6 @@ true - @@ -135,7 +135,6 @@ ${project.groupId} ${project.artifactId} ${project.version} - zip ${os.classifier} zip diff --git a/builder/src/main/resources/documentation/Proline_UserGuide.docx.html b/builder/src/main/resources/documentation/Proline_UserGuide.docx.html new file mode 100644 index 000000000..018c0169a --- /dev/null +++ b/builder/src/main/resources/documentation/Proline_UserGuide.docx.html @@ -0,0 +1 @@ +

Proline User Guide

Release 2.2.0


Proline Software Suite

Proline is a production grade software suite, which provides an environment for large-scale MS data management, visualization, analysis and curation with the main objective of promoting the production and sharing of high quality proteomic datasets. Proline can be used (i) to produce reliable identification and quantification results through robust automated processes, (ii) for data curation, (iii) to systematically save and keep track of metadata from processing steps, parameters and generated data, and (iv) to submit highly qualified datasets to public repositories.

 

A workflow in Proline is implemented as a collection of tasks (see Figure) that can be performed by the user through the graphical user interface. Users can import multiple identification results corresponding, for example, to fractions and replicates of a biological sample and combine them before or after validation. The resulting datasets can then be compared or quantified using spectral counting or DDA label-free quantification, before exporting the results in different file formats.

The software suite is based on two main components: a server handling processing tasks and based on relational database management system storing the data generated and two different graphical user interfaces, both allowing users to start tasks and visualize the data: Proline Studio which is a rich client interface and Proline Web the web client interface. An additional component called ProlineAdmin is used by system administrators to set up and manage Proline. Proline Zero is an all-in-one, “zero installation” solution containing the server and Proline Studio.

Document organization

This document is organized in two sections:

  • The Concepts & Principles section presents the main concepts and algorithms implemented in Proline as well as the different parameters of these algorithms.
  • The How to section gives more details on how to proceed with the Proline Studio graphical interface.

Proline Concepts & Principles

  • Dataset types:
  • Data Processing:
  • Data Import/Export:

Identification results

Proline considers different types of identification data: Result Files, Search Results and Identification Summaries which will be defined in the following sections.

Result File

A result file produced by a search engine can be imported into Proline in their native format. OMSSA (.omx files), Mascot (.dat files) and X!Tandem (.xml files) search engines are currently supported. In addition, the mzIdentML format is supported to allow the output from any other search engine compatible with this standard to be imported (e.g. MS-GF+). A first version for MaxQuant support has been implemented. It is possible to import only search results or to import search results as well as quantitation (beta version) values from MaxQuant files.

Search engines may provide different types of searches for MS and MS/MS data. It is important to highlight that Proline only supports MS/MS ions searches at this point.

Search Result

A search result is the raw interpretation of a given set of MS/MS spectra given by a search engine. It contains one or many peptides matching the submitted MS/MS spectra (PSM, i.e. Peptide Spectrum Match), and the protein sequences these peptides belong to. The search result also contains additional information such as search parameters, used protein sequence databank, etc.

A search result is created when a result file is imported in Proline. During this step, no filtering or thresholding is applied: along with the search parameters, all submitted spectra, peptide spectrum matches (PSMs) and protein hits suggested by the search engine are retained in the Proline database to allow subsequent validation of putative identifications. In the case of a target-decoy search, two search results are created: one for the target PSMs, one for decoy PSMs.

Content of a search result

Importing a result file creates a new search result in the database which contains the following information:

  • Search Settings: software name and version, parameters values
  • Peaklist and Spectrum information: file name, MS level, precursor m/z, …
  • Search result data:
  • Protein sequences
  • Peptide sequences
  • Spectra
  • Two kinds of Matches:
  • Peptide Spectrum Matches (PSM), i.e. the matching between a peptide and a spectrum, with some related data such as the score, fragment matches…
  • Protein Matches, i.e. the proteins in the databank corresponding to the PSMs identified by the search engine

Search engine specificities

  • Mascot
  • The PSM score corresponds to the Mascot ion score.
  • OMSSA
  • The PSM score corresponds to the negative common logarithm of the E-value:  
    Score = -log10(E-value). Note that Proline only supports OMSSA Result Files generated with the 2.1.9 release.
  • X!Tandem
  • The X!Tandem standard hyperscore is used as a PSM score. Note that Proline supports X!Tandem Result Files generated with the Sledgehammer release (or later).

Decoy Searches

Proline handles decoy searches performed from two different strategies:

  • Concatenated searches:
  • A protein databank is created by concatenating target protein sequence to decoy protein sequence. Decoy could be created using reverse or random strategy. A unique search is done using that databank.
  • When importing a Search Result from a decoy concatenated databank, decoy data are extracted from the Result File and stored in Proline databases as a decoy Search Result independent of the target Search result. Nevertheless both searches are linked to each other.
  • Separated searches:
  • Two searches are done using the same peaklist, one on a target protein databank and one on a decoy protein databank. These searches are then combined to retrieve useful information such as FDR. Mascot allows the user to check a decoy option and automatically creates a decoy databank.
  • The two performed searches are stored in Proline databases and are linked together. 

Identification Summary

An Identification Summary is a set of identified proteins inferred from a subset of the PSM contained in the search result that have been declared valid. The subset of PSM taken into account are the PSM that have been validated by a filtering process (example: PSM fulfilling some specified criteria such as score greater than a threshold value).

Content of an identification summary

  • Peptide Set
  • A set of peptides identifying one or more proteins.
  • Protein Set
  • Typical Protein or representative protein. Protein “chosen” to represent the ProteinSet.
  • Sameset : all proteins identified by the same set of peptides than the typical one.
  • Subset: Proteins identified by a subset of peptides. All these peptides should also identify typical protein.

Protein Inference

All peptides identifying a protein are grouped in a Peptides Set. A same Peptides Set can identify many proteins, represented by one Proteins Set. In this case, one protein of this Protein Set is chosen to represent the set, it is the Typical Protein. If only a subset of peptides identify a (or some) protein(s), a new Peptide Set is created. This Peptide Set is a subset of the first one, and identified Proteins are Subset Proteins.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\pepprotset1.png

  • In the first example, P2 and P5 are identified by the same peptide set {pe1, pe4, pe5, pe8}. P2 was chosen as typical protein. One subset composed of {pe4, pe5, pe8} identifies subset protein P4.
  • In the second example, another protein set represented by P3 shares some peptides with the protein set represented by P2. Both protein sets have specific peptides.
  • Sharing could involve many protein sets as shown in example 3.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\pepprotset2.png

All peptides sets and associated protein sets are represented, even if there are no specific peptides. In both cases above, no choice is done on which protein set / peptide set to keep. These protein sets could be filtered after inference (see Protein sets filtering).

Modification Dataset

From an Identification Summary, users can ask to Identify Modification Sites and Clusters, thus creating a Modification Dataset containing the result. This dataset contains

  • Modification Sites: a modification type at a given location on a given protein. They are only extracted for the proteins that are representative of a validated protein set. Only modifications of interest are used in this process.
  • Modification Clusters: co-localized modification sites are grouped into clusters. Identify Modification Sites and Clusters describe this grouping process.

Proteins and Protein sets scoring

There are multiple algorithms that could be used to calculate the Proteins and Protein Sets scores. Proteins scores are computed during the importation phase while Protein Sets scores are computed during the validation phase.

Protein

Each individual protein match is scored according to all peptide matches associated with this protein, independently of any validation of these peptide matches. The sum of the peptide matches scores is used as protein score (called standard scoring for Mascot result files).

Protein Set

Each individual protein set is scored according to the validated peptide matches belonging to this protein set (see inference).

Scoring schemes

Mascot Standard Scoring

The score associated with each identified protein (or protein set) is the sum of the score of all peptide matches identifying this protein (or protein set). In case of duplicate peptide matches (peptide matched by multiple queries) only the match with the best score is considered.

Mascot MudPIT Scoring

This scoring scheme is also based on the sum of all non-duplicate peptide matches score. However the score for each peptide match is not its absolute value, but the amount that it is above the threshold: the score offset. Therefore, peptide matches with a score below the threshold do not contribute to the protein score. Finally, the average of the thresholds used is added to the score. For each peptide match, the “threshold” is the homology threshold if it exists, otherwise it is the identity threshold. The algorithm below illustrates the MudPIT score computation procedure:

Protein score = 0
For each peptide match {
 If there is a homology threshold and ions score > homology threshold {
         Protein score += peptide score - homology threshold
 } else if ions score > identity threshold {
         Protein score += peptide score - identity threshold
 }
}
Protein score += 1 * average of all the subtracted thresholds

  • if there are no significant peptide matches, the protein score will be 0.
  • homology and identity threshold values depend on a given p-value. By default Mascot and Proline compute these thresholds with a p-value of 5%.
  • In the case of separated target-decoy searches we obtain two values for each threshold: one for the target search and another one for the decoy search. In order to obtain a single value we apply the following procedure:
  • the homology threshold is the decoy value if it exists else the target value
  • the identity threshold is the mean of target and decoy values.

The benefit of the MudPIT score over the standard score is that it removes many of the junk protein sets, which have a high standard score but no high scoring peptide matches. Indeed, protein sets with a large number of weak peptide matches do not have a good MudPIT score.

Mascot Modified MudPIT Scoring

This scoring scheme, introduced by Proline, is a modified version of the Mascot MudPIT one. The difference with the latter is that it does not take into account the average of the substracted thresholds:

Protein score = 0
For each peptide match {
 If there is a homology threshold and ions score > homology threshold {
         Protein score += peptide score - homology threshold
 } else if ions score > identity threshold {
         Protein score += peptide score - identity threshold
 }
}

This score has the same benefits than the MudPIT one. The main difference is that the minimum value of this modified version will be always close to zero while the genuine MudPIT score defines a minimum value which is not constant between the datasets and the proteins (i.e. the average of all the subtracted thresholds).

Fisher

This scoring scheme rely on the Fisher’s test to define protein scores and p-value from the scores of the best subset of peptides. The scoring is extensively described in (https://doi.org/10.1021/acs.analchem.0c00328).

Search result validation

Once a result file has been imported and a search result created, the validation is performed in four main steps:

  1. Peptide Matches filtering and Validation
  2. Protein Inference (peptides and proteins grouping)
  3. Protein and Proteins Sets scoring
  4. Protein Sets Filtering and Validation

Finally, the identification summary issued from these steps is stored in the identification database. Different validation of a Search Result can be performed and a new Identification Summary of this Search Result is created for each validation.

When validating a merged Search Result, it is possible to propagate the same validation parameters to all childs Search Results. In this case Peptide Matches filtering and validation will be applied on childs as well as Protein Sets filtering. Note: actually, Protein Sets validation is not propagated to childs Search Results.

Peptide matches filtering

Peptide Matches identified in search results can be filtered using one or multiple predefined filters (described hereafter). Only validated peptide matches will be considered for further steps.

Score filter

All PSMs with a score lower than a given threshold are discarded. For some search engines, Proline computes the PSM score value itself by applying a mathematical transformation to another PSM property. For instance, the score values for PSMs from X!Tandem search results correspond to the log10 transformation of the PSMs expectation values. 

Pretty Rank filter

This filter is applied after having temporarily joined target and decoy PSMs corresponding to the same query. For each query, target/decoy PSMs are then sorted by score. As in Mascot, a pretty rank is computed for each PSM depending on their ranking: PSM with almost equal score (difference < 0.1) are assigned the same rank. All PSMs with a pretty rank greater than the cut-off specified are discarded.

Minimum sequence Length filter (Length)

PSMs corresponding to peptide sequences shorter than the cut-off stipulated will be discarded when this parameter is applied. 

Mascot e-Value filter (e-Value)

This filter is used to select PSMs based on the Mascot expectation value (e-value) which reflects the difference between the PSM’s score and the Mascot identity threshold (p=0.05). PSMs with an e-value greater than the threshold specified are discarded.

Mascot adjusted e-Value filter (Adjusted e-Value)

Proline can compute an adjusted e-value. It first selects the lowest threshold between the identity and homology e-values (p=0.05). Then, it computes the e-value using this selected threshold. PSMs for which the adjusted e-value is greater than the specified cut-off are discarded.

Mascot p-Value based on identity filter (Identity p-Value)

Given a specific p-value, the Mascot identity threshold is calculated for each query and all peptide matches associated with the query for which the score is lower than the identity threshold calculated are discarded. 

Mascot p-Value based on homology filter (Homology p-Value)

Given a specific p-value, the Mascot homology threshold is inferred for each query and all peptide matches associated with the query which have a score lower than the calculated homology threshold are discarded.

Single PSM per MS Query filter

This filter validates only one PSM per Query. To select a PSM, following rules are applied:

For each query:

  • Select PSM with higher score.
  • If several PSM with same score:
  • Choose PSM which identify the protein which have the max number of valid PSM
  • If still equality choose the PSM with the lower delta moz
  • If still equality, select the first PSM using alphabetic order
  • If still equality, select the first one. Warning : may be different in different versions of Prolline...

Single PSM per Rank filter

This filter selects only one PSM per pretty rank, which is already the case when a given pretty rank is associated with a single PSM. When multiple PSMs have the same pretty rank, the same selection than “Single PSM per Query” is used

    Select PSM that identify the protein which have the max number of valid PSM.

    If several PSM are equals

o      Choose the PSM with the lower delta moz.

o      If still equality, select the first PSM using alphabetic order.

o      If still equality, select the first one. Warning : may be different in different versions of Proline...

Thus, if this filter is combined with the “Pretty rank” filter, the result obtained should be identical to the result of the “Single PSM per MS query” filter.

Single Sequence per Rank filter

This filter selects the best PSM per pretty rank and all PSMs that have the same sequence, without considering Post translational modification. The best PSM is selected using the same rules than Single PSM per Rank filter described above.

Isotope Offset filter

This filter validates PSMs which have been validated using an isotope offset less or equal than specified one. This corresponds to identification search engine parameters such as Mascot isotope error and could be used to invalidate PSM identified using one or more 13C .

Peptide matches validation

In addition to these filters a PSM level validation step may be specified using:

  • A target-decoy approach (Elias and Gygi, 2007), which  can be performed by adjusting a user-specified validation criterion until it reaches a user-specified false discovery rate (FDR). The search engine score can be used as a generic validation criterion for any of the search engines supported by Proline. For results obtained with the Mascot search engine, other criteria can be used to control the FDR: Mascot e-Value, Mascot adjusted e-Value, Mascot p-Value based on identity threshold, or Mascot p-Value based on homology threshold.
  • A method based on the Benjamini-Hochberg procedure to control the FDR proposed in (https://doi.org/10.1021/acs.analchem.0c00328)

FDR estimation for Target Decoy validation

There are several ways to calculate FDR depending on the database search type. In Proline the FDR is calculated at PSM and protein levels using the following rules:

  • if the Search has been done on a concatenated Target/Decoy bank or if rank filter has been used during validation :

Note: when computing PSM FDR, peptide sequences matching a Target Protein and a Decoy Protein are taken into account in both cases.

  • if the Search has been done on a separated Target/Decoy bank :

 

Protein sets filtering

Any Identification Summary, generated by a validation process or by merging datasets could be filtered.

Filtering consists in invalidating Protein Sets which doesn't follow specified criteria. Invalidated Protein Sets are not taken into account for further algorithms or display.

Available filtering criteria are defined below.

Specific peptides filter

This filter invalidates protein sets that don't have at least x peptides identifying only that protein set. The specificity is considered at the DataSet level.

This filtering goes through all Protein Sets from worse score to best score. For each, if the protein set is invalidated, associated peptides properties are updated before going to the next protein set. Peptide property is the number of identified protein sets.

Peptides count filter

This filter invalidates protein sets that don't have at least x peptides identifying that protein set, independently of the number of protein sets identified by the same peptide.

This filtering goes through all Protein Sets. For each, if the protein set is invalidated, associated peptides properties are updated before going to the next protein set. Peptide property is the number of identified protein sets.

Peptide sequence count filter

This filter invalidates protein sets that don't have at least x different peptide sequences (independently of PTMs) identifying that protein set.

This filtering goes through all Protein Sets from worse score to best score. For each, if the protein set is invalidated, associated peptides properties are updated before going to the next protein set. Peptide property is the number of identified protein sets.

Protein set score filter

This filter invalidates protein sets which score is below a given value. 

Protein sets validation

Once prefilters (see above) have been applied, a validation algorithm can be run to control the FDR. In the same way as for PSM, FDR may be controlled using :

Target-Decoy Strategy:

See how FDR is calculated.

At the moment, it is only possible to control the FDR by changing the Protein Set Score threshold. Three different protein set scoring functions are available.

Given an expected FDR, the system tries to estimate the best score threshold to reach this FDR. Two validation rules (R1 and R2) corresponding to two different groups of protein sets (see below the detailed procedure) are optimized by the algorithm. Each rule defines the optimum score threshold allowing to obtain the closest FDR to the expected one for the corresponding group of protein sets.

Here is the procedure used for FDR optimization:

  • protein sets are segregated in two groups, the ones identified by a single validated peptide (G1) and the ones identified by multiple validated peptides (G2), with potentially multiple identified PSMs per peptide.
  • for each of the validation rules, the FDR computation is performed by merging target and decoy protein sets and by sorting them by descending score. The score threshold is then modulated by using successively the score of each protein set of this sorted list. For each new threshold, a new FDR is computed by counting the number of target/decoy protein sets having a score above or equivalent to this value. The procedure stops when there are no more protein sets in the list or when a maximum FDR of 50% is reached. It has to be noted that the two validation rules are optimized separately:
  • G2 FDR is first optimized leading to the R2 score threshold. The validation status of G2 protein sets is then fixed.
  • final FDR (G1+G2) is then optimized leading to the R1 score threshold. Only the G1 protein sets are here used for the score threshold modulation procedure. However the FDR is computed by taking into account the G2 validated target/decoy protein sets.

The separation of proteins sets in two groups allows to increase the power of discrimination between target and decoy hits. Indeed, the score threshold of the G1 group is often much higher than the G2 one. If we were using a single average threshold, this would reduce the number of G2 validated proteins, leading to a decrease in sensitivity for a same value of FDR.

Combining datasets

Identification results can be combined to construct a parent dataset, and create a non-redundant list of identified peptides and proteins. This combination can be performed either before validation (on search results) or after validation (on identification summaries). Since this operation could be recursively performed, it leads to hierarchical structuring of search results and/or identification summaries. On the one hand, combination before validation (taking into account all PSMs identified by the search engine) may, for example, be relevant when analyzing results obtained after peptide fractionation: in that case, several peptides belonging to the same protein may be spread across different result sets; these sets should be merged before protein validation. On the other hand, merging identification summaries is appropriate when seeking to group the validated results from series of individual samples to be compared or when combining data from different search engines.

When datasets are combined, their PSMs are collected to generate a non-redundant set of peptides before recomputing protein inference. Additionally, the mappings between peptides and FASTA entries observed across the different datasets are also collected and merged into a single final mapping list. This list reflects thus the whole set of peptide and protein matches that were observed in the individual datasets.

Users can combine search results or identification summaries. The main difference is the set of spectra and peptides (and thus PSMs) considered. When combining search results, all spectra, peptides and PSMs in the dataset are considered, whereas when combining identification summaries, only validated PSMs are taken into account. In addition, Proline can be used to control how PSMs are collected in the parent dataset: in union mode, PSMs originating from combined datasets are added, while in aggregation mode, all PSMs identifying the same peptide are aggregated into a single representative PSM.

Combining datasets in Proline. Datasets are represented as a tripartite graph composed of spectra, peptides and proteins; edges between spectrum and peptides represent PSM. When the blue and orange datasets are combined, PSMs from both datasets are collected together, generating a non-redundant set of peptides. The combination can be performed in 2 modes: union or aggregation mode.

Identifying Modification sites and clusters

A list of Post translational modification (PTM) sites identified among the peptides of an identification summary can be extracted by Proline. A modification site is characterized by a modification type, at a given location on a given protein. The list of modification sites extracted by the software is restricted to the proteins that are representative of a validated protein set and to the modifications of interest specified by the user. This means that a peptide identified with two different modifications of equal interest to the user will appear twice in the list, one for each modification location.

In a second phase, co-localized modification sites are grouped into clusters as soon as evidence of their co-existence exists. The required evidence is a peptide sequence identified in the dataset with all the clusterized modification sites.

The figure below represents different peptides (blue rectangles), co-localized on a protein sequence (in red). In this example, modifications of interest (Phosphorylation (Ph)) are shown in orange. Peptide 1 proves that Phosphorylation at positions m, x and y occurs simultaneously. Peptides 2 and 3 are considered as isomorphic since the oxidation of peptide 2 is ignored (only Phosphorylations have been declared of interest by the user in this example). Peptides 4 and 5 are partially isomorphic: they confirm Phosphorylation respectively at position (m, x) and (x, y). Conversely peptides 6 and 7 are not in accordance, suggesting that there are two other proteoforms, one with Phosphorylations at position (m,y) but no modification at x and one with a Phosphorylation at position m but not at x. These two peptides could be grouped into another cluster.

The user can choose between two different modification clustering methods:

  • Partially Isomorphic Matching (aka Exact Position matching):  Two sequence matches are clusterized if they are Isomorphic or Partially Isomorphic. Partially Isomorphic matches could belong to multiple clusters.
  • Only Isomorphic Matching: two sequence matches are clusterized if they are Isomorphic.

In Proline, clusters co-localisation concept is used. Co-localized clusters are clusters that have overlapping on protein sequence. These clusters may share one or more sites, but they could also cover the same protein sequence without any common site. See co-localized clusters example below.

Spectral Counting

Principles

Proline can be used to compare protein sets based on spectral counts through a previously presented algorithm (Hesse et al., 2016). This algorithm notably computes a weighted spectral count metric (called adjusted spectral count in the original publication). Basically, the algorithm takes both unique and shared peptides into account, and for each shared peptide, the proportion of MS/MS spectra that should be attributed to the different protein sets is determined. This proportion (also called weight) is based on the spectral counting of proteotypic (or specific) peptides identifying the different protein sets sharing the peptide to be attributed.

Spectral counting is calculated from a hierarchy of identification summaries. The parent identification summary (at the top of the hierarchy) is where the list of protein sets to compare and the list of specific peptides are created. The list of specific peptides is then used to compute the protein sets respective weights but users can choose any“child” dataset where the weights must be calculated.

First, Proline compute the peptide spectral count at each level of the dataset hierarchy using the following rules:

  • If the dataset is a “leaf” identification summary of the hierarchy (not issued from a merge, no child dataset), the peptide spectral count is the number of MS/MS spectra matching a peptide (equal to the number of peptide spectrum matches).
  • If the dataset is a merged identification summary, the peptide spectral count  is the sum of it’s child peptide spectral count.
  • If the dataset is a merged of search results, the peptide spectral count is the sum of validated children peptide spectral count. Validated children are PSMs that meet validation criteria applied to parent Identification Summaries.

Once, peptide spectral count is calculated for each peptide, the protein spectral count is computed using the following rules:

  • Protein basic spectral count (BSC) is the sum of the peptide spectral count of all peptides matching a protein.
  • Protein specific spectral count (SSC) is the sum of the peptide spectral count of specific peptides. A specific peptide, is a peptide which does not identify any other protein sets in the context of the identification summaries.
  • Protein weighted spectral count (WSC) is the Protein specific spectral count (SSC) + weighted peptide spectral count of shared peptides.

Simple example

Protein sets weights

The protein set respective weights computation is based on the proteotypic peptides. The level in the dataset hierarchy where these weights are calculated can be chosen by the user, it could be the top level of the dataset hierarchy or at a lower level. In the following example, the weights (WP1 and WP2) are calculated at the “parent dataset” level. At this level, P1 and P2 are respectively identified by the red and dark blue peptides/psm, each protein set weight is calculated using their specific spectral counting. These weights are thus used to calculate the weighted spectral count of P1 and P2 in the two “child” dataset “Condition 1” and “Condition 2”.

FAQ

Why is the BSC less than Peptide Count ?

When running SC even on a simple hierarchy (1 parent, 2 childs) in some cases we obtain a BSC value smaller than the peptide count of the protein set. This occurs only for invalid protein sets. Invalid protein sets are the one that are present at the parent level but are filtered at child level (if a specific peptide filter have been applied for example).

Indeed, the peptide count value is read in the child protein sets. On the other hand, the BSC is calculated by getting the spectral count information at child level for each peptide identified at parent level. If a protein set is invalid, its peptides are not taken into account during the merging so some of them could be missing at parent level if they were not identified in the other child.

This case is illustrated in the following figure:

Label-free LC-MS quantitation workflow

Proline detects chromatographic peaks from raw data converted to the mzDB format (Bouyssié et al., 2015). The converter, named raw2mzdb is based on ProteoWizard, ensuring compatibility with a wide range of instrument vendors.

After a first signal extraction step, the algorithm associates the chromatographic peaks detected with validated PSMs, first by retrieving the corresponding MS/MS spectra acquired during the peptide elution, and then by matching the precursor m/z value of these spectra to the chromatographic peak m/z value. After the deisotoping step, the abundance of each ion is estimated from the apex of the chromatographic peak, which corresponds to the theoretically most abundant isotopologue (inferred from the peptide’s atomic composition). The software then aligns the retention time of these annotated ions for all the LC-MS runs to be compared, and uses this information to cross-assign MS/MS data to ions (i.e. chromatographic peaks) that were detected but not identified in other runs . The resulting ion abundances are finally stored in the Proline database, making them available for rapid data visualization and further post-processing.

Finally, peptide ion measurements can be summarized as protein abundances using different computational methods. The user can opt to perform additional operations such as excluding peptides or ions based on their characteristics (missed cleavages, variable modifications, sequence specificity, etc.) or normalizing peptide and protein abundances between runs. These post-processing steps can be executed on-demand using different parameters or methods; there is no need to repeat the whole quantification process when changes are made.

Signal extraction

During an LC-MS experiment, the m/z and intensity values for each peptide ion detected are recorded in MS1 scans acquired during the elution of this peptide from the chromatographic column. Most existing peak picking algorithms analyze these MS scans individually or sequentially. The Proline algorithm performs the signal detection in a different way. It first takes advantage of the mzDB format to detect chromatographic peaks in spectrum slices (5 m/z wide by default) across the whole chromatographic time. Then, in a given slice, m/z peaks are sorted in decreasing order of intensity. Thus, starting from the most intense m/z peak (apex), the algorithm searches for a peak with the same m/z value in the previous and subsequent MS1 scans, while applying a user-defined m/z tolerance. This lookup procedure stops when the ion signal is absent from more than a predefined number of consecutive scans. The [RT, m/z, intensity] peak list obtained, which is comparable to an extracted ion chromatogram (XIC), is then smoothed using a Savitzky-Golay filter (Savitzky and Golay, 1964). The resulting smoothed chromatogram is then split into the time dimension to form chromatographic peaks, by applying a peak picking procedure that will search for significant minima and maxima of signal intensity. When the signals of two ions overlap in the time dimension, a minimum is generally surrounded by two maxima. If the corresponding valley is deep enough, i.e. at least 66% of the lower surrounding maximum, this minimum will be considered significant (and thus will trigger the generation of two peaks). Once the smoothed chromatogram has been fully analyzed, the algorithm removes the corresponding detected peaks from the current spectrum slice, and performs another lookup using the next available apex. The result of this whole procedure is a list of chromatographic peaks defined by an m/z value, an apex elution time and an elution time range.

Parameters

These parameters are used by signal extraction algorithms.

  • Extraction m/z tolerance: this corresponds to the error tolerance used when searching for a m/z peak in the previous and subsequent MS1 scans (see above).
  • Use previous/last peakel detection: If a quantitation has already been done on a run, use the previously detected peakels file for this run. Warning: In this case, the extraction m/z tolerance parameter is ignored since the signal extraction is already done !

PSM assignment and deisotoping

In a single run, validated PSMs are MS/MS spectra assigned to a peptide sequence, and each spectrum is characterized by a precursor mass, a charge state and a retention time (RT). The algorithm assigns PSMs to detected chromatographic peaks by matching the spectrum precursor m/z ratio to the chromatographic peak m/z and verifies that the spectrum retention time falls within the peak time range. The PSM charge state assigned is then used to search for chromatographic peaks corresponding to the ion’s isotopologues, considering the precursor mass-to-charge ratio of the spectrum as the monoisotope. The peptide ion intensity is summarized by retaining only the apex of the peak corresponding to the theoretically most abundant isotopologue (inferred from the peptide’s atomic composition). All peptide ion signals (a.k.a. LC-MS features) extracted from an mzDB file and assigned to a PSM are used to construct an LC-MS map. For the sake of simplicity no distinction is made between LC-MS runs and LC-MS maps in this manuscript.

Parameters

  • PSM/Peakel matching m/z tolerance is the m/z error allowed to match a peakel to a PSM

Clustering is applied to group peakels that are matching the same identified ion.

  • Cluster time computation: you have the choice between 2 computation methods: most intense or median. For most intense method, the cluster time corresponds to the time of the most intense feature composing the cluster. For the median method, cluster time is the median of the feature times forming the cluster.
  • Cluster intensity computation: you have the choice between 2 computation methods: most intense or sum. For most intense method, the cluster intensity corresponds to the intensity of the most intense feature of features forming the cluster. For the sum method, cluster intensity is the sum of the intensities of features composing the cluster.

Retention time alignment

As soon as the PSM are matched to peakels, the software then aligns the retention time of the annotated ions for all the LC-MS runs to be compared, and uses this information to cross-assign MS/MS data to ions (i.e. chromatographic peaks) that were detected but not identified in other runs. Because chromatographic separation is not completely reproducible, LC-MS runs must be aligned. The retention time alignment procedure is a critical step in MS1 label-free quantification. Proline’s alignment algorithm selects a reference run and generates a set of functions that will be used to predict the RT (retention time) for missing features from another run. These functions are obtained by performing pairwise alignments between the different runs to be compared (Bylund et al., 2002; Jaitly et al., 2006; Sadygov et al., 2006). The first step consists in computing a scatter plot (see Figure below) of the observed time difference between the two runs as a function of the reference run’s time-scale. This mapping can be based on the peptide identity (same sequence and same post-translational modifications) of identified features, or by mapping the detected features of the pair of runs, taking user-defined time and mass error ranges into account (the default feature mapping time and m/z tolerance values are set to 600 seconds and 5 ppm, respectively).

RT prediction using computed alignments. The two scatter plots on the left correspond to computed run alignments between the reference run and two other runs (A and B). The red curves on these plots correspond to the median RT prediction for each alignment, obtained by applying a moving median calculation. The graphs on the right illustrate the case of a peptide ion that is present in runs A and B, but has only been fragmented by MS/MS in run A. Knowing the retention time in run A (TA), we can predict TB by two consecutive time conversions. TA is first converted to the reference run scale (TREF = TA + DA) using the first run alignment, then to TB = TREF + DB using the alignment for the second run.

RT prediction functions are then obtained by smoothing these scatter plots using a moving median calculation or a local regression. To decrease the number of alignment combinations (i.e., pairs of maps), the reference run is determined by an iterative method. The algorithms begin by selecting a random run as a reference and compute all alignments against this map. The algorithm then determines a new reference run by selecting the run with the smallest sum of RT differences in the resulting run alignments. The iteration stops after a user-specified maximum number of iterations or when the reference run remains unchanged between two iterations. The software can also be configured to compute all possible RT alignment combinations (all possible pairs of maps, “exhaustive” option), but this can be very computationally expensive when there is a high number of maps to be compared. The alignments computed can then be used to predict the retention times for peptide ions in a specific sample where they were not identified.

Parameters

Alignment

  • Map Alignment: alignment can be disabled. In this case the cross assignment step could be executed but without any retention time prediction
  • Method : is the name of the method used to determine the reference run
  • Exhaustive: the exhaustive algorithm computes the distance between maps for each possible couple of maps and selects the map with the lowest sum of distances to be the reference map.
  • Iterative:  the algorithm iteratively selects the best reference run as described above.
  • Maximum number of iterations: this option is available only for the iterative method. This is a stop condition of the iterative algorithm, when the algorithm has reached its maximum number of iterations, it stops.
  • Ignore alignment error : allow or not to continue quantitation even if there are some errors in alignment.

Feature mapping

  • Feature mapping is needed to build the alignment scatter plot  of the observed time difference between two runs. The method used could be:
  • Feature coordinates : the mapping is based on features RT and m/z coordinates taking into account a tolerance for each of these values.
  • m/z tolerance : m/z window used to match features between two compared maps.
  • Peptide Identity :  the mapping is based on peptides identification (same sequence and same post-translational modifications)
  • Time tolerance in seconds: time window used to match features/peptides between two compared maps.

Alignment smoothing

When features of two runs are matched, a trend can be extracted from the scatter plot by using a smoothing method.

  • Smoothing method: you have the choice between three smoothing methods: LOESS, time window or landmark range:
  • LOESS : no specific parameter
  • Landmark range
  • Number of landmarks/window size: time of aligned map is corrected using median computed on windows containing a specified number of landmarks. The run is divided into windows of size the specified number of landmarks. You have to provide the number of landmarks by window. The smoothing method is applied considering the number of landmarks present in the window, and computes the median point for this window.
  • Sliding window overlap: overlap is used to compute the step to move the smoothing window forward to calculate a smoothing point for this new smoothing window. Overlap gives the percentage of overlapping between two consecutive windows. For example, if window size is 200 (seconds or landmarks depending on which smoothing method is selected) and overlap is 20%, the step forward = 200*((100-20)/100) = 160 seconds or landmarks, i.e. the smoothing window is moved forward by a step of 160, so two successive windows overlaps each other by a step of 40 seconds or landmarks corresponding to 20% of 200
  • Time window : time of aligned map is corrected using median in a time window.
  • Window size/time interval: You have to provide the time interval. This time interval corresponds to the window size in which time median will be computed.
  • Minimum number of landmarks: This allows you to specify the minimum number of landmarks a window must contain to compute a median on it, it is not significant to compute a median on less landmarks.
  • Sliding window overlap: overlap is used to compute the step to move the smoothing window forward to calculate a smoothing point for this new smoothing window. Overlap gives the percentage of overlapping between two consecutive windows. For example, if window size is 200 (seconds or landmarks depending on which smoothing method is selected) and overlap is 20%, the step forward = 200*((100-20)/100) = 160 seconds or landmarks, i.e. the smoothing window is moved forward by a step of 160, so two successive windows overlap each other by a step of 40 seconds or landmarks corresponding to 20% of 200.

Cross Assignment

Proline uses a hybrid approach to retrieve intensity values for ions that were not identified. As indicated above, identified and quantified features are obtained by detecting chromatographic peaks in raw files without a-priori, using an identification-based deisotoping method. During the PSM assignment step, the identification data provides the monoisotopic mass and the charge state for the ion, guiding the deisotoping procedure to group together the detected chromatographic peaks. These grouped peaks are then removed from the list of peaks to be assigned, thereby reducing the data density when annotating subsequent chromatographic peaks during the cross-assignment step. Ions that were not identified in a run can then be sought out in this restricted list of detected peaks using their m/z and RT coordinates. The m/z value is the theoretical m/z value obtained following identification of this ion in another run. The RT value is predicted from the apex RT of the feature detected in the run providing the highest identification score. This RT prediction computation may involve the use of one or two alignment functions. Using these two coordinates, associated with user-defined m/z and RT tolerances, the algorithm seeks a corresponding signal among the chromatographic peaks that have not already been assigned to an identified ion. To avoid the propagation of erroneous cross-assignments between runs, an additional but optional control (named “use only confident features”) is applied to ensure that this peak is the monoisotope of a peptide ion with a charge state identical to the master feature one. This is done by fitting its observed isotope pattern to a theoretical one.

Parameters

  • allow cross assignment between all runs or only between runs of the same groups: the user can completely disable the cross assignment or can control runs between which cross assignment is applied:
  • Between all runs
  • Within groups only: cross assignment is applied only between runs belonging to the same group.

Feature mapping

  • m/z tolerance (ppm or dalton): when mapping features from two different maps of the map set, delta m/z between features must be lower than the m/z tolerance to be considered as the same feature seen on two different maps.
  • Time/RT tolerance (seconds): when mapping features from two different maps of the map set, delta time between features must be lower than the time tolerance to be considered as the same feature seen on two different maps.

Filtering/Correction

  • Use only confident features: is applied to ensure that the cross assigned peak is the monoisotope of a peptide ion with a charge state identical to the master feature one. This is done by fitting its observed isotope pattern to a theoretical one.
  • Master feature intensity filter (optional): a filter can be applied to the map features to keep the best features (above threshold) to build the master map.
  • Two methods are available to filter features: the filter can be applied directly on intensity values (Intensity method) or it can be a proportion of the map median intensity (Relative intensity method).
  • intensity threshold/value: this provides the threshold for the filtering method. Only features above or below (depending on the operator) this threshold are considered for the master map building process.

If you choose Relative intensity for master feature filter type, the only possibility you have is percent, so features which intensities are beyond the relative intensity threshold in percentage of the median intensity are removed. If you choose Intensity for master feature filter type, you also have only one possibility at the moment of the intensity method: basic. Features which intensities are beyond the intensity threshold are removed and not considered for the master map building process.

Normalizing LC-MS maps

The comparison of LC-MS maps is confronted to another problem which is the variability of the MS signals measured by the instrument. This variability can be technical or biological. Technical variations between MS signals in two analyses can depend on the injected quantity of material, the reproducibility of the instrument configuration and also the software used for the signal processing. The observed systematic biases on the intensity measurements between two successive and similar analysis are mainly due to errors in the total amount of injected material in each case, or the LC-MS system instabilities that can cause variable performances during a series of analysis and thus a different response in MS signal for peptides having the same abundance. Data may not be used if the difference is too important. It is always recommended to do a quality control of the acquisition before considering any computational analysis. However, there are always biases in any analytic measurement but they can usually be fixed by normalizing the signals. Numerous normalization methods have been developed, each of them using a different mathematical approach (Christin, Bischoff et al. 2011). Methods are usually split in two categories, linear and non-linear calculation methods, and it has been demonstrated that linear methods can fix most of the biases (Callister, Barry et al. 2006). Three different linear methods have been implemented in Proline by calculating normalization factors as the ratio of the sum of the intensities, as the ratio of the median of the intensities, or as the ratio of the median of the intensities.

Sum of the intensities

How to calculate this factor:

  1. For each map, sum the intensities of the features
  1. The reference map is the median map
  1. The normalization factor of a map = sum of the intensities of the reference map / sum of the intensities of the map

Median of the intensities

How to calculate this factor:

  1. For each map, calculate the median of the intensities in the map
  1. The reference map is the median map
  1. The normalization factor of a map = median of the intensities of the reference map / median of the intensities of the map

Median of ratios

This last strategy has been published in 2006 (Dieterle, Ross et al. 2006) and gives the best results. It consists in calculating the intensity ratios between two maps to be compared then set the normalization factor as the inverse value of the median of these ratios (cf. figure below). The procedure is the following:

  1. For each map in a “map set”, sum the intensities of the features
  1. The reference map is the median map
  1. For each feature of the master map, ratio = intensity of the feature in the reference map / intensity of the feature for this map
  1. Normalization factor = median of these ratios

Distribution of the ratios transformed in log2 and calculated with the intensities of features observed in two LC-MS maps. The red line representing the median is slightly off-centered. The normalization factor is equal to the inverse of this median value. The normalization process will refocus the ratio distribution on 0 which is represented by the black arrow

Proline makes this normalization process for each match with the reference map and has a normalization factor for each map, independently of the choice of the algorithm. The normalization factor for the reference map is equal to 1.

Post-processing of LC-MS quantitative results

This procedure is used to compute peptide and protein abundances. Several filters can also be set to increase the quality of quantitative results.

Here is the description of the parameters that can be modified by the user.

Peptide filters

  • Peptides selection method: define which peptides are to be considered for quantitation.
  • All peptides: all peptides are taken into account at this step. Further filters may invalidate some peptides.
  • specific peptides: peptides shared between different protein sets are discarded for protein set abundance calculation and  statistical analysis.
  • Razor and specific: In addition to specific peptides, quantitation of shared peptides are considered for the “best” ProteinsSet. The best is actually based on the score.
  • Discard missed cleaved peptides: if checked, peptides containing missed cleavages are discarded from the statistical analysis. It has to be noted that perfect tryptic peptides whose sequence is included in an observed missed cleaved peptide are also discarded if this option is enabled.
  • Discard modified peptides: if checked, peptides containing specific modifications are discarded for protein set abundance calculation and  the statistical analysis.
  • only those modified peptides or also non-modified peptides whose sequence is the same as these peptides may be  discarded depending on the chosen filtering method.

Summarize peptides ions into peptide abundance

To calculate peptide abundance, associated peptide ion abundances can be summed or the best ion is used.  To choose the best peptide ion following rules are defined :

  • Select the peptide ions identified and quantified in the maximum of quant channels(runs)
  • If more than one, select peptide ions with the maximum of PSMs  count
  • If more than one, choose the peptide ion with the higher abundance.

Peptide and protein common parameters

  • Normalization: the normalization factors are computed as the median of the ratios distributions between each run and a run of reference. A similar procedure is used for the normalization of LC-MS features.

Summarize peptides abundances into protein abundance

Peptide abundances can be summarized into protein abundances using several mathematical methods:

  • sum: for each quantitative channel (raw file) the sum of observed peptides abundances is computed
  • mean: for each quantitative channel (raw file) the mean of observed peptides abundances is computed
  • mean of TOP3 peptides: same procedure but applied on the 3 most abundant peptides. Peptides are sorted by descending median abundances (computed across all compared samples for peptide). Then the 3 first peptides are kept.
  • median: for each quantitative channel, the median of observed peptides abundances is computed
  • median profile: a matrix of peptide abundance ratios is first computed (rows correspond to peptides and columns to quantitative channels). The median of these ratios is then computed for each column. The relative values are then converted back into absolute values using a scaling factor. This factor is computed as the maximum value from the means of TOP3 peptides abundances.
  • normalized median profile: matrix of peptide abundance ratios is first computed (rows correspond to peptides and columns to quantitative channels). This matrix is then normalized and then summarized using the median method described above. The obtained median abundances are then adjusted by using a scaling factor. This factor is computed as the maximum value from the means of TOP3 peptides abundances.
  • Median Ratio Fitting: MRF computes a matrix of abundance ratios calculated between any two runs from ion abundances for each protein. For each pair-wise ratio, the median of the ion ratios is then calculated and used to represent the protein ratio between these two runs. A least-squares regression is then performed to approximate the relative abundance of the protein in each run in the dataset. This abundance is finally rescaled to the sum of the ion abundances across runs.

Aggregation of Label-Free quantitative results

Two or more quantitations can be combined such that an ion quantified in multiple aggregated quantitations is represented only once in the aggregation result. The abundance of this ion is a combination of its abundance measured in the different aggregated quantitations. This could be useful to combine for example quantitation of fractions into a single quantitation result.

The experimental design of the aggregation is based on the experimental design of the aggregated quantitation: the number of group/condition and the number of replicates per condition remains the same. However, the user can modify the correspondence between the groups and replicates if needed. In the following example the abundance of ion1 in the aggregated quantitation (in green) is based on the quantitation of this same ion in "Fraction 1" and "Fraction 2". Since ion2 is quantified only in "Fraction 1", its abundance values in the aggregated quantitation are the same as the abundances measured in "Fraction 1".

In this simple example, the correspondence between experimental designs is such that the abundance of ion1 in the replicate Repl1 is based on the measured abundance of ion1 in Repl1’ in “Fraction 1” and Repl1’’ in “Fraction 2”. This could be modified by the user to take into account differences in the replicates order in aggregated quantitations or to account for the absence of a replicate (see for example replicate 3 in “Fraction 1”).

In the current version, the abundance at the aggregation level is the sum of the abundances in aggregated quantitations.

 

Identification Summary Export

When exporting a whole Identification Summary in an excel file, the following sheets may be generated:

  • Search settings and info : Contains information on project and search settings parameters
  • Import and filters : Summary of used parameters during import, filtering and validation process
  • Protein sets : List of all Protein Sets, valid or invalidated (configurable in custom option) during Protein Sets Filtering. Some columns description :
  • #sequences (#specific sequences ) : number of different peptide sequences identifying the Protein Set (specific : which does not identify any other valid Protein Set )
  • #peptides (#peptides) : number of different peptide (sequence + PTM) identifying the Protein Set (specific : which does not identify any other valid Protein Set )
  • #spectral_count (specific_spectral_count) : number of different peptide spectrum matches identifying the Protein Set (specific : which does not identify any other valid Protein Set )
  • Protein matches in protein set : list of Protein Matches in each Protein Set. A same Protein Match could thus appear a few times if it belongs to different Protein Sets. (same column as protein set)
  • Best PSM from protein sets : List of best peptide spectrum matches (a single PSM per peptide is listed) for each Protein Set. Some columns description :
  • #psm_prot_sets : number of Valid Protein Sets identified by this PSM.
  • #psm_prot_matches : number of Protein Match, which belong to at least 1 valid Protein Set, identified by this PSM.
  • #psm_db_prot_matches : number of Protein Match, validated or not, identified by this PSM. This is equivalent to the number of proteins in fasta files containing the PSM.
  • All PSMs from protein sets : List of all peptide spectrum matches for each Protein Set. (same column as best PSM from protein sets)
  • PTM Cluster (filled only if “identify Modifications sites” has been run): All clusters (protein-set of localised ptms) identified in this identification summary.
  • Dataset statistics : Some statistical values for the exported Identification Summary : number of Protein Set, modified peptides …

Advanced features

Allowing  multiple imports

By default, Proline does not allow importing multiple results files at the same time. This was due to the obsolete Peptide database which has been removed in Proline version 2.0. Nevertheless, if multiple results files could now be imported at the same time there is still a restriction at project level.  Indeed, result files should be inserted sequentially in the same project. In addition, depending on Proline Server configuration, there could not be as many import threads as wanted or as the number of  projects.

This is why a configuration allows the user (administrator) to specify groups of projects which will belong to the same “import thread”. For instance, if Proline Server enables 3 threads for import services, you can specify 2 groups of projects:

  • Import Thread 1 : project 1, project 3, project 5
  • Import Thread 2 : project 6, project 7
  • Import Thread 3 : all other project (and new projects)

This means that for projects 1, 3 and 5 imports will be sequential but in parallel of import to project 6 or 7…

If you specify more groups than allowed thread, some project groups will be grouped into a single one.

To define a project group, you should add the following  string to project.serialized_properties in uds_db database. Currently this could be done only with PGAdmin (or any database server administration tool) :

{“import_group”:”1”}

In the following example, the user has defined 3 specific groups, and the default group is always defined for all other projects.


Raw2mzdb

Raw file conversion to mzDB

The conversion is done using raw2mzDB.

Installation

  1. get the zip archive on Proline download section
  1. install of MSFileReader from Thermo ( here, will install all necessary c++ redistribuables)
  2. ensure your regional settings parameters are '.' for the decimal symbol and ',' for the list separator

Use case procedure

Open a command line window in the directory containing raw2mzdb.exe

Enter:

raw2mzdb.exe -i <rawfilename> -o <outputfilename>

By default, the raw file will be converted in the “fitted” mode for the MS1 (MS2 is often in centroid mode and can not be converted in fitted mode). If the MS2 (or superior) are acquired in high resolution (i.e in profile mode), you could specify that you want to convert several MSs in the required mode: raw2mzdb.exe -i <rawfilename> -o <outputfilename> -f 1-2 will try to convert MS1 to MS2 in fitted mode.

There are two other available conversion modes:

  1. profile”, the command line is then: raw2mzdb.exe -i <rawfilename> -o <outputfilename> -p 1 (means you want profile mode for MS1, others MS will be stored as they were stored in the raw file)
  2. centroid” : raw2mzdb.exe -i <rawfilename> -o <outputfilename> -c 1 (means you want centroid mode for MS1, others MS will be stored as they were stored in the raw file)

Proline Studio

How to

Note: Read the Concepts & Principles documentation to understand main concepts and algorithms used in Proline.

Creation/Deletion

Display

Save, import and export

Algorithm and other operation

Quantitation


List of Abbreviations

Calc. Mass: Calculated Mass

Delta MoZ: Delta Mass to Charge Ratio

Exp. MoZ: Experimental Mass to Charge Ratio

Ion Parent Int.: Ion Parent Intensity

Missed Cl.: Missed Cleavage

Modification D. Mass: Modification Delta Mass

Modification Loc.: Modification Location

Next AA: Next Amino-Acid

Prev. AA: Previous Amino-Acid

Protein Loc.: Protein Location of the Modification

Protein S. Matches: Protein Set Matches

PSM: Peptide Spectrum Match

PTM: Post Translational Modification

PTM D. Mass: PTM Delta Mass

RT: Retention Time

SC: Spectral Counting

Server Connection

When you start Proline Studio for the first time, the Server Connection Dialog is automatically displayed.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\login_dialog.png

You must fill the following fields:

- Server Host: this information must be asked to your IT Administrator. It corresponds to the Proline server name

- User: your username (an account must have been previously created by the IT Administrator).

- Password: password corresponding to your account (username).

If the field “Remember Password” is checked, the password is saved for future use. Server connection dialog continues to open with Proline Studio, the user though does not need to fill in his password, unless the last one is changed after his last login.

Create a New Project

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\addprojectpopupprolinev3.png                D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\addprojectdialogprolinev3.png

To create a Project, click on “+“ button at the right of the Project Combobox. The Add Project Dialog opens.

Fill the following fields:

- Name: name of your project

- Description: description of your project

You can specify other people to share this new project with them. Then click on OK Button

Creation of a Project can take a few seconds. During its creation, the Project is displayed grayed with a small hourglass over it.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\newprojectcreatedprolinev3.png

Create a Dataset

In the Identification tree, you can create a Dataset to group your data

To create a Dataset:

- right click on Identifications or on a Dataset to display the popup.

- click on the menu “Add Dataset…”

On the dialog opened:

- fill the name of the Dataset

- choose the type of the Dataset

- optional: click on “Create Multiple Datasets” and select the number of datasets you want to create

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\addaggregatewindowprolinev3.png

Let's see the result of the creation of 3 datasets named “Replicate”:

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\addaggregateresultprolinev4.png

Create a Folder

In both Identification and Quantitation tree, you can create Folders to organize your data

To create a Folder :

- right click on Identifications, Quantitations or on a Folder to display the popup.

- click on the menu “Add Identification Folder…” or “Add Quantitation Folder…”

Import a Search Result

See Concept & Principle section

Import Mascot/X!Tandem/OMSSA/MzIdentML

There are two possibilities to import Search Results:

- import multiple Search Results in “All Imported” and put them later in different datasets.

- import directly a Search Result in a dataset.

Import in "All Imported"

To import in “All Imported”:

- right click on “All Imported” to show the popup

- click on the menu “Import Search Result…”

Import directly in a Dataset

It is possible to import Search Results directly in a Dataset. Even in this case, Search Results are  available in “All Imported”.

To import a Search Result in a Dataset, right click on a dataset and then click on “Import Search Result…” menu. Same dialog and parameters as in “Import in “All Imported”” above will be displayed.

 

Import Search Result Parameters

In the Import Search Results Dialog:

- select the file(s) you want to import thanks to the file button (the Parser will be automatically selected according to the type of file selected)

- select the different parameters (see description below)

- click on OK button

Note 1: You can only browse the files accessible from the server according to the configuration done by your IT Administrator. Ask him if your files are not reachable. (Look for Setting up Mount-points paragraph in Installation & Setup page).

Note 2: Proline is able to import OMSSA files compressed with BZip2.

Parameters description: 

  • Software Engine: the software which generated your Result File (this parameter will be automatically set when files are selected or you can select it)
  • Instrument: mass-spectrometer (with specific configuration) used for sample analysis
  • Fragmentation Rule Set: The fragmentation rules specified in software. by clicking on you could visualize all rules for a specific rule set. This is necessary to generate spectrum matches.
  • Peaklist Software: the software used for the peaklist creation (mandatory for LCMS XIC quantitation)
  • Decoy Strategy: The type of decoy search which was performed.
  • “No Decoy”: if the search was performed against a target database only.
  • “Concatenated Decoy”: if target and decoy sequences were merged into a single database.
  • “Software Engine Decoy”: if the decoy sequences were generated on-the-fly by your search engine.
  • Decoy Accession Regex: for concatenated searches only. Select the rule to apply for the discrimination of target and decoy protein matches.
  • Parser Parameters: according to your Software Engine, some extra-parameters are displayed:
  • Mascot:
  • Subset Threshold: the percentage of score between a given protein match and the master protein match (superset). Protein matches with a relative score lower than
           
    Master_protein_score * (1-subset threshold)
    won't be imported.
  • Omssa:
  • Usermods file path: an XML file containing the definitions for each user defined PTM used in the OMSSA search.
  • PTM Composition file path: a text file containing the chemical composition for each user defined PTM. This is required for PTMs not already imported in another Search Result. The format is the following:
    PTM name=<PTM composition> (one per line).

    Example:
    Acetyl peptide N-term=H(-6) C(-7) O(-1)
  • X!Tandem:
  • Protein parsing rule: Specify the rule (regular expression) to be used to retrieve  protein accession from protein info. As an example, to use the Uniprot Entry Name as protein accession, use the following rule:  ..\|[^|]*\|([^ ]*)

Importing a Search Result can take some time. While the import is not finished, the “All Imported” or “selected dataset” is shown grayed with an hourglass and you can follow the imports in the Tasks Log Window (Menu Window > Tasks Log to show it).         

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\importidentificationlogv3.png

To show all the Search Results imported, double click on “All Imported”, or right click to popup the contextual menu and select “Display List”

If needed, from the All Imported window, you can drag and drop one or multiple Search Result to an existing dataset.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\draganddropsearchresultprolinev3.png

Import MaxQuant result

To import a MaxQuant Search Result, right click on a dataset and then select “Import MaxQuant”

Note 1: MaxQuant import will generate a dataset hierarchy with the result from the different acquisition.

The following dialog will be displayed

- select the directory containing the files generated by MaxQuant.  This folder should look like:
        <root_folder>\mqpar.xml
        <root_folder>\combined\txt\summary.txt
        <root_folder>\combined\txt\proteinGroups.txt
        <root_folder>\combined\txt\parameters.txt
        <root_folder>\combined\txt\msmsScans.txt
        <root_folder>\combined\txt\msms.txt

- select the Instrument: mass-spectrometer used for sample analysis different parameters

- specify, if needed, the regular expression to extract protein accessions from  MaxQuant protein ids.

- you can choose to import also quantitative data

- click on OK button

Delete Data

You can delete Search Results, Identification Summaries and Datasets in the data tree. You can also delete XIC or Spectral Counts in the quantitation tree.

Delete the Datasets (identification or quantitation…) from the tree view (Search Result always accessible from “All Imported” view…).

There are two ways to delete data: use the contextual popup or drag and drop data to the Trash.

Delete Data from the contextual popup

Select the data you want to delete, right-click to open the contextual menu and click on delete menu.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\deletedatasetpopup.png

The selected data is put in the Trash. So it is possible to restore it while the Trash has not been emptied.

Delete Data by Drag and Drop

Select the data you want to delete and drag it to the Trash. It is possible to restore data while the Trash has not been emptied

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\deletedatasetprolinedndprolinev3.png

Empty the Trash

To empty the Trash, you have to Right click on it and select the “Empty Trash” menu.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\emptytrashprolinev3.png

A confirmation dialog is displayed and if accepted Dataset will be removed from the Trash.

Search Results are not completely removed, you can retrieve them from the “All Imported” window.

Delete a Project

It is not possible to delete a Project by yourself. If you need to do it, ask your IT Administrator.

Connection Management

Once user is connected (see Server Connection), it is possible to:

  • Reconnect with a different login

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\reconnect_dialog.png

  • Change password

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\changepassword.png

Display MS Queries, Peptides/PSM or Proteins of a Search Result

All information, validated or not, can be accessible from this menu. Indeed, Search Result contains all data imported from a result file without any validation consideration.

Functionality Access

To display data of a Search Result:

- right click on a Search Result

- click on the menu “Display Search Result >” and on the sub-menu “MSQueries” or “PSM” or “Proteins”

MSQueries Window

If you click on MSQueries sub-menu, you obtain this window:

Upper View: list of MSQueries.  Some columns may not be (correctly) filled if the Peaklist software were not correctly specified during import. It is possible to change this information using ‘Update Spectrum ..

Bottom Window: list of all Peptides linked to the current selected MSQuery.

Note: Abbreviations used are listed here 

PSMs (Peptides) Window

If you click on PSMs sub-menu, you obtain this window:

Upper View: list of all Peptide Spectrum Matches

Middle View: Spectrum, Spectrum Error, Spectrum Values and Fragmentation Table of the selected PSM. If no annotation is displayed, you can generate Spectrum Matches by clicking on the according button

Bottom Window: list of all Proteins identified by the currently selected Peptide.

Note: Abbreviations used are listed here 

Proteins Window

If you click on Proteins sub-menu, you obtain this window:

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\displaysearchresultproteindialogv3.png

Upper View: list of all Proteins

Bottom View: list of all Peptides identifying the selected Protein.

Note: Abbreviations used are listed here 

Display MS Queries, PSM, Peptides, Protein Sets or Adjacency Matrices of an Identification Summary

From this menu, all displayed information is Identification Summary data, which has been validated according to user specified rules. To view the raw information as defined at import, use the Search Result sub menu.

Functionality Access

To display data of an Identification Summary:

- right click on an Identification Summary

- click on the menu “Display Identification Summary >” and on the sub-menu “MSQueries”, “PSM”, “Peptides”, “Protein Sets”, “PTM Protein Sites” or “Adjacency Matrix

MSQueries Window

If you click on MSQueries sub-menu, you obtain this window:

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\msqueryrsm.png

Upper View: list of MSQueries.

Bottom Window: list of all Peptides linked to the current selected MSQuery.

Note: Abbreviations used are listed here 

This view contains all MSQueries even if it doesn’t bring an identification.

PSMs Window

If you click on PSM sub-menu, you obtain this window:

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\displayidspsmdialogv3.png

Note: Abbreviations used are listed here 

Peptides Window

If you click on Peptides sub-menu, you obtain this window:

Upper View: list of all Peptides with best PSM information (charge, score ...)

Middle View: list of all Protein Sets identified by the selected peptide.

Bottom Left View: list of all Proteins of the selected Protein Set

Bottom Right View: list of all Peptides of the selected Protein

Note: Abbreviations used are listed here 

Protein Sets Window

If you click on Protein Sets sub-menu, you obtain this window:

View 1 (upper): list of all Protein Sets of the identification Summary

Note: In the column Proteins, 8 (2, 6) means that there are 8 proteins in the protein set : 2 in the sameset, 6 in the subset.

View 2: list of all Proteins of the selected Protein Set, sameset or subset.

View 3: list of all Peptides of the selected Protein. If a subset is selected only peptides matching that protein will be listed.

View 4a: Protein Sequence of the previously selected Protein and Spectrum of the selected Peptide. Other tabs display Spectrum, Spectrum Error and Fragmentation Table.

View 4b: Graphic representation of the Protein with matching peptide and associated modifications.

Note: Abbreviations used are listed here 

Adjacency Matrix Window

If you click on Adjacency Matrix sub-menu, you obtain this window:

View 1: All the matrices. Each matrix corresponds to a cluster composed of linked Proteins/Peptides.

Note: use the Search tool to display an Adjacency Matrix for a particular Protein or Peptide

View 2: The currently selected matrix.

In the example, you can see two different protein sets which share only two peptides.

Thanks to the settings you can hide proteins with exactly the same peptides. 

Display Modification Site or Cluster of a Modification Dataset

Functionality Access

To display modification data associated to an Identification Summary:

  • right click on the Dataset
  • click on the Display Modification > “Sites”; “Clusters”; “Annotated Clusters”

If you click on one of Display Modifications sub-menu, you can obtain the following warning dialog.

This is due to the fact that you must run beforehand the “Identify Modification Sites” process. To do that, mouse right click on your Identification Summary and select the “Identify Modification Sites” menu.

The Annotated Clusters menu may also cause the display of this warning. Indeed, Annotated Clusters display is only available after Clusters have been modified and saved.

All displays, Sites and Clusters, are structured in the same way. In Sites windows, the upper view will list all individual Sites while in Clusters windows, Sites will be clustered using rules specified by user (see Identify Modification Sites)

 Clusters/Sites Windows

Upper View: This view lists all Modification Sites or Clusters. In this example, a Cluster view is shown. For each of them, many information is given : the number of Peptides belonging to the Cluster, how many sites have been clustered, The Confidence for the site combination, ...

Bottom Left view: Graphic illustration of the cluster/site peptides mapped to the protein sequence. All modification locations are represented above the protein sequence. An overview graphic is also given below.

Bottom Right view: Cluster/Site peptides list. The PSMs list is accessible in a hidden tab.

Display Additional Information on Search Result/Identification Summary

Functionality Access

To display properties of a Search Result or Identification Summary:

  • right click on a Search Result/Identification Summary
  • click on the menu “Properties”

Note: it is possible to select multiple Search Results/Identification Summaries to compare the values.

Properties Window

Property window opened:

General Information: Various information on the analysis (instrument name, peaklist software…)

Search Properties: Information extracted from the Result File (date, software version, search settings...)

Search Result Information: Amount of Queries, PSM and Proteins in the Search Result.

Identification Summary Information: Information obtained after validation process

Validation xxx: Information on validation process : parameters used to validate and result

Sql Ids: Database ids related to this item

Note: Identification Summary Number may differ from Validation Results. Indeed, on one hand, peptide matches count in Validation Results takes into account all PSMs that have been validated . On the other hand, the PSM Number in “Identification Summary Information” section considers only PSMs that identify a valid Protein Sets.

Property window opened with multiple Identification summaries selected:

The color of the type column indicates if the values are the same (white) or different (yellow)

.

Display a Spectral Count

You can display a generated Spectral Count by using the right mouse popup.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\displayscpopup.png

To have more details about the results, see spectral_count_result 

The overview is based by default on the weighted spectral count values. (Note: if you sort on the overview column, the sort is based on max (value-mean (values))/mean (values). So, you will obtain the most homogenous and confident rows first)

For each compared dataset, are displayed:

- status ( typical, sameset, / )

- peptide numbers

- the basic spectral count

- the specific spectral count

- the weighted spectral count

- the selection level

User can change the information displayed by the overview using the table settings icon ( ) .

Display a XIC

To display a XIC, right click on the selected XIC node in the Quantitation tree, and select “Display Abundances”, and then the level you want to display:

Note: You can also display the identification summary used as reference for the quantitation from the popup menu in the quantitation tree:

Display Protein Sets

Protein Sets

By clicking on “Display Abundances” / “Protein Sets”, you can see all quantified protein sets. For each quantified protein set, you can see below all peptides linked to the selected protein set and peptides Ions linked to the selected peptide. For each peptide Ion, you can see the different features and the graph of the peakels in each quantitation channel.

The overview is based by default on the abundance values.

Note: if you sort on the overview column, the sort is based on max (value-mean (values))/mean (values). So, you obtain the most homogenous and confident rows first. 

For each quantitation channel, are displayed:

- the raw abundance

- the peptide match count

- the abundance

- the selection level

By clicking on the using the “table setting” icon , you can choose the information you want to display or change the overview.

 

Peptides

The middle part of the window lists all peptides of the selected Protein set with the same kind of quantitative data. The status column indicates whether the peptide was used or not for protein set abundances. On the right part, a graph allows you to see the variations of the abundance (or raw abundance) of a peptide in the different quantitation channels.

Features and Peakels

You can see the different features in the different quantitation channels and the graph of the peakels: D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\xic_features.png

By clicking on D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\chart-arrow.pngyou can display either:

- the peaks of isotope 0 in all quantitation channels

- all isotopes for the selected quantitation channel:

By clicking on D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\wave.png you can see the chromatograms of the features and their first time scan and last time scan in mzScope. For more details see the mzScope section.

It is also possible to extract the corresponding chromatogram for one or all of the features.

 

The resulting chromatograms will be displayed in the same windows as peakel.

Display Peptides

By clicking on “Display Abundances“ / “Peptides”, you can see:

- identified and quantified Peptides

- non identified but quantified peptides

- identified but not quantified peptides (linked to a quantified protein)

The lower view lists all peptide ions (specific charge) of selected peptide. The status column indicates if the ion is valid or not and if it was used for peptide quantitation.

Display Peptides Ions

By clicking on “Display Abundances” / “Peptides Ions”, you can see:

- all identified and quantified Peptides Ions

- non identified but quantified peptides Ions

Display Modification Sites/Clusters

By clicking on “Display Abundances” / “Modification XXX” (Site, Clusters or Annotated Clusters), you can see the same Clusters/Sites information as in “Identification Summary/Display / Modification XX” , See Display Modification description

In addition, quantitative information is computed and displayed.

Upper View: This view lists all Modification Sites or Clusters. For each of them, in addition to cluster information, quantitative data is given.  Abundance is calculated using peptide’s abundance sum.

2nd view: Cluster/Site peptides list. The PSMs list is accessible in a hidden tab. Peptide quantitative information are displayed the same way it is done in other quantitative views.

3rd view : Graphic illustration of the cluster/site peptides mapped to the protein sequence is shown on the left.  On the right part, a graph allows you to see the variations of the abundance (or raw abundance) of these peptides in the different quantitation channels.

Bottom Right view: This view is the same as “Peptide” view in “Display Xic Protein Sets” above.

Display Experimental Design and Parameters

By clicking on “Exp. Design > Parameters”, you can see the experimental design and the parameters of the selected XIC.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\displayxicdesign.png

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\displayxicparam.png

If you have launched the “compute post processing ...” on the XIC, you can also display the corresponding parameters.

Display Map Alignment

By clicking on “Exp. Design > Map Alignment”, you can see the map of the variation of the alignment of the maps compared to the map alignment of the selected XIC. You can also calculate the predicted time in a map from an elution time in another map.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\displaymapalignment.png

Frame Toolbars Functionalities

A: Display Decoy Data.

B: Search in the Table. (Using * and ? wild cards)

C: Filter data displayed in the Table

D: Display settings dialog (you can modify displayed columns and perform double sorting)

E: Export data displayed in the Table

F: Send to Data Analyzer to compare data from different views

G: Create a Graphic : histogram or scatter plot . Only on PSMs table

H: Display number of entities in the table (number of PSMs / Peptides / Proteins…)

I: Right click on the marker bar to display Line Numbers or add Annotations/Bookmarks

J: Export view as an image

K: Generate Spectrum Matches (specific to spectrum grahic)

L: Expands the frame to its maximum (other frames are hidden). Click again to undo.

M: Gather the frame with the previous one as a tab.

N: Split the last tab as a frame underneath

O: Remove the last Tab or Frame

P: Open a dialog to let the user add a View (as a Frame, a Tab or a splitted Frame)

Q: Save the window as a user window, to display the same window with different data later

Create a custom User Window

You can lay out your own user window with the desired views.

You can do it from an already displayed window, or by using the right click mouse popup on a dataset like in the following example (Use menu “Search Result>New User Window…” or “Identification Summary>New User Window…”)

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\newuserwindowpopup.png

In the example, the user has clicked on “Identification Summary>New User Window…” and selects the Peptides View as the first view of his window.

You can add other views by using the '+' button.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\newuserwindowpeptides.png

In this example, the user has added a Spectrum View and he saves his window by clicking on the “Disk” Button.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\newuserwindowpeptidesandspectrum.png

The user selects 'Peptides Spectrum' as his user window name

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\newuserwindowsave.png

Now, the user can use his new 'Peptides Spectrum' on a different Identification Summary.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\newuserwindowpopupwithsavedwindow.png

Filter Tables

You can filter data displayed in the different tables thanks to the filter button at the top right corner of a table.

When you have clicked on the filter button, a dialog is opened. In this dialog you can select the columns of the table you want to filter thanks to the “+” button.

In the following example, we have added two filters:

- one on the Protein Name column (available wildcards are * to replace multiple characters and ? to replace one character)

- one on the Score Column (Score must be at least 100 and there is no maximum specified).

The result is all the proteins starting with GLPK (correspond to GLPK*) and with a score greater or equal than 100.

Note: for String filters, you can use the following wildcards: * matches zero or more characters, ? matches one character.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\filterresultprolinev2.png

Search Tables

In some tables, a Search Functionality is available thanks to the search button at the top right corner.

When you have clicked on the search button, a floating panel is opened. In this panel you can select the column searched and fill in the searched expression, or the value range.

For searched expressions, two wild cards are available:

  • '*' : can replace all characters
  • '?' : can replace one character

In the following example, the user searches for a protein set whose name contains “PGK”.

You can do an incremental search by clicking again on the search button of the floating panel, or by pressing the Enter key.

Graphics

Create a Graphic

There are two ways to obtain a graphic from data:

  1. In the windows with PSM of a Search Result or of an Identification Summary, you can ask for the display of a histogram in a new window to check the quality of your identification.
  2. In any window, you can click on the '+' button to add a graphic (Scatter Plot or Histogram) as a view in the same window

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\histogrambutton.png

If you have clicked on the '+' button, the Add View Dialog is opened and you must select the Graphic View

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\addaview.png

Graphic options

Graphic Toolbar

A: When this button is selected, you have the “Pointer Mode” activated.

In this mode :

- If you move with the left mouse button pressed on the middle of the graphic, you can scroll along the X and Y Axis.

- If you move with the right mouse button pressed from the top/left corner to the bottom/right corner, a zooming rectangle is displayed. When you release the mouse button, a zoom in according to the zooming rectangle is performed.

- If you move with the right mouse button pressed from the bottom/right corner to the left/top corner, a view all is done.

B: When this button is selected, you have the “Selection Mode” activated.

By clicking on the black right arrow, you can switch between the square selection mode and the lasso selection mode.

In this mode:

  • Use the left mouse button to do a square or lasso selection.
  • The right mouse button works as with the “Pointer Mode”

C: Zoom out / Zoom in / View all. Click on the black right arrow to select the zooming mode.

D: Display/Remove Grid toggle button

E: Display/Hide View All Map. The goal of this map is to display the whole graphic in a small zone even when you have zoomed

F: Open a settings dialog for the graphic. You can modify for example colors or bins of an histogram. 

G: Lock/Unlock incoming data. If it is unlocked, the graphic is updated when the user applies a new filter to the previous view (for instance Peptide Score >= 50) If it is locked, changing filtering on the previous view does not modify the graphic.

H: Select Data in the graphic according to data selected in the table in the previous view.

I: Select data in the table of the previous view according to data selected in the graphic.

J: Export graphic to image

K: Select the graphic type: Scatter Plot / Histogram

L/M: Select data used for X / Y axis.

Popup Menu on Graphic Area

By right mouse click on the graphic area, you get a popup with several menus:

  • Add Group: after selecting some data, you can create a group defined by a name and a color (there are two groups in the example : PSM xyz and PSM abc)
  • Select Group: Right click on a data group to select them.
  • Delete Group: Right click on a data group and delete it
  • Add Vertical Cursor: Add a vertical cursor, its X position is displayed on the X Axis.
  • Add Horizontal Cursor: Add an horizontal cursor, its Yposition is displayed on the Y Axis.
  • Delete Cursor: Right click on a cursor and delete it.

Popup Menu on Axis

By right mouse click on an axis, you get a popup with several menus:

  • Log 10 / Linear Axis : toggle the display of the axis between log and linear.
  • Hide / Display Title : hide the axis title if you want more space for the graphic
  • Remove / Add Vertical Grid
  • Set Visible Range : to set the minimum and maximum values of the axis
  • Width measurement : display 2 cursors and the measurement of the space between the cursors.

Zooming

There are several ways to perform zoom actions.

Zoom in:

  • Click on the Zoom in button in the toolbar.
  • Press the right mouse button and drag to the right bottom direction. A red box is displayed. Release the mouse button when you have selected the area to zoom in.
  • Put the mouse over an axis and roll upward the mouse wheel. The zoom in is centered around the middle of the axis. If you press on Ctrl Key at the same time, the zoom in is performed around the mouse position.

Zoom out:

  • Click on the Zoom out button in the toolbar.
  • Put the mouse over an axis and roll downward the mouse wheel. The zoom out is centered around the middle of the axis. If you press on Ctrl Key at the same time, the zoom out is performed around the mouse position.

View All:

  • Click on the View All button in the toolbar.
  • Press the right mouse button and drag to the left top direction. When you release the mouse button, the zooming is reset to view all.

Selecting

To be able to select data, you must be in “Selection Mode”

Select: You can select with a rectangle area or with a lasso according to the selected button. Press the left mouse button and drag the mouse to surround the data you want to select. When you release the button, the selection is done. Or left click on the data you want to select. It is possible to use the Ctrl key to add to the previous selection.

Unselect: Left click on an empty area to clear the selection.

View All Map

Click on View All Map button to display the map. This map always displays the whole graphic and the zoomed area. You can directly zoom on the view all map. You can resize it and move it.

Quality Control

Search Result QC

You can run a Quality Control on any leaf Search Result, that is to say an imported Result File not a merged search result. It consists in a transversal view of the imported data: rather than visualising the results per PSM or Proteins, results are sorted according to the score, charge state...

 

Choose the menu option:

Settings

Configure some settings before launching the process

  • Score windows: you can split your data in different groups based on the score. The default groups are : less than 20, between 20 and 40, between 40 and 60, over 60
  • Max rank: data can be filtered to get a view focused on the best ranks. Default is to consider only the first rank.

 

QC results

The report will appear in a matter of seconds (depending on the amount of data to be processed). You will get the following tabs:

Assigned and unassigned spectra: Pie chart presenting the ratio of assigned spectra

Score repartition for Target/Decoy data: Histogram presenting the amount of PSM per group of score, separating target and decoy data

PSM per charge and score: Histogram presenting the amount of PSM per group of score and charge state

Experimental M/z per charge and score: Box plot presenting M/z information for each category of score and charge state

Number of matches per minute of RT and score: histogram presenting the amount of PSM per score and retention time. This view is only calculated when retention time is available.

Each graph is also available in a table view

 


Ms Files Tab

In order to facilitate different actions on Ms Files, Proline Studio contains an homonym tab providing the end user with a view over his local and server remote file system, called Local File System and Proline Server File System respectively.

Furthermore, on local file system a series of actions can take place,  through an appropriate popup menu, on the encountered .mzdb and .raw files, including among others the:

  • Conversion of a .raw file to an .mzdb file
  • The upload of an .mzdb file
  • View .mzdb files
  • Detect its peakels

Apart from the popup menu supported functionality, since Proline Studio 1.5, uploads can be triggered via drag and drop mechanism.

mzDB File Upload

As mentioned earlier, after selecting a number of files, the user can either drag and drop them inside the remote site, or use the popup menu as shown in the following screenshot. It is important to precise that both approaches are not compatible with a selected group consisting of different file types.

As we can see, clicking on upload opens a dedicated dialog packing a series of uploading options:upload_dialog.png

  • The deletion of the file(s) after the successful upload
  • The creation of the file(s) parent directory in destination: only the direct parent folder will be created. Otherwise, the file will be uploaded at the mount point root.
  • The mounting point at the server: depending on server mounting points configuration.

Furthermore, the dialog permits us to add or remove .mzdb files to upload. The uploading tasks status could be viewed in  the Logs tab.

Raw File Conversion

In the same way, when the user desires to convert and upload a raw file, he or she can use the respective dialog through the popup menu.

convert_dialog.png

For the upload step, the same options as described above are shown.

For the conversion, the path to the converter exe file should be specified. This value will be saved upon different executions. A default path may be specified in the  general settings dialog. The same way mzdb file may be deleted after a successful upload, raw files could be deleted after a conversion .

TIC or BPI chromatogram

When the user chooses to “View” an mzDB file, the MzScope window is opened.

By default, the TIC chromatogram is displayed. You can click on “BPI” to see the best peak intensity graph.

By clicking in the graph, you can see below the scan at the selected time.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\mzscope.png

You can choose to display 2 or more chromatograms on the same graph, by selecting 2 files and clicking on “View

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\mzscopemultifile.pngYou can extract a chromatogram at a given mass by entering the specified value in the panel above.

Scan

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\mzscopescan.png

You can navigate through the scans

- by increasing or decreasing the scan Ids

- by entering a retention time

- by clicking the keys arrows on the keyboard (Ctrl+Arrows to keep the same ms level)

By double clicking on the scan, the corresponding chromatogram is displayed above (The Alt key or the check box “XIC overlay” allows you to overlay the chromatograms in the same graph).

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\mzscopechromato.png


Peakels

By selecting a file, you can click on “Detect Peakels” in the popup menu.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\mzscope_detectpeakels_menu.png

A dialog allows you to choose the parameters of the peakels detection: the tolerance and eventually a range of m/z, or a m/z value:

The results are displayed in a table:

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\mzscopepeakels.png

You can double-click (or through the popup menu) on a row to display the peakel in the corresponding raw file:

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\mzscopepeakelview.png

Export Data / Image

There are many ways to do an export:

- Export a Table using the export button (supported formats: {xlsx, xls, csv})

- Export data using Copy/Paste from the selected rows of a Table to an application like Excel.

- Export all data corresponding to an Identification Summary, XIC or Spectral Count

- Export an image of a view

- Export Identification Summary data into MzIdentML format ( for ProteomeXchange) .

- Export Identification Summary spectra list.

1. Export a Table

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\before_export.png

To export a table, click on the Export Button at the left top of a table.

An Export Dialog is opened, you can select the file path for the export and the format of the export (supported formats: {xlsx, xls, csv}).

In case that the selected format is either .xls or .xlsx, the user has now the ability to maintain in his exported excel document any rich text format elements (color, font weight etc.) apparent on the original table in Proline Studio. Choice is done using the checkbox shown on the following screenshot.

       

To perform the export, click on the Export Button. The task can take a few seconds if the table has a lot of rows and so a progress bar is displayed.

2. Copy/Paste a Table

To copy/Paste a Table:

- Select rows you want to copy

- Press Ctrl and C keys at the same time. The column titles are also copied

- Open your spreadsheet editor and press Ctrl and V keys at the same time to paste the copied rows. If paste is done in a text editor, the column separator used is the tabulations.

3. Export an Identification Summary, a XIC or a Spectral Count

To Export all data of a dataset (Identification Summary, XIC or Spectral Count), right-click on the dataset to open the contextual menu and select the “Export” menu and then “Excel...” sub-menu.

You can also export multiple dataset simultaneously, if they have the same type (Identification Summary or XIC or Spectral Count).

An Export Dialog is opened, you can select the file path and the type of the export : Excel (.xlsx) or Tabulation separated values (.tsv).

You can export with the default parameters or perform a custom export. To enable custom export, click on the tick box located on the right of the dialog:

Custom export allows a number of parameters in addition to the file format to be chosen.

  • Sheets to be created. You can enable/disable sheets to be exported, rename them (by double clicking on the title) or change their order by drag and drop.  Available sheets are dependent on the identification summary type, but you can export which parameters were used (search settings or import and filters), the list of protein sets, all proteins, PSMs… , modification Clusters or statistics data.
  • For each sheet, you can define the fields to be exported: change the title used in the exported file if needed, change the order of the fields using drag and drop of the corresponding row at the desired location.
  • Symbol to use for decimal output (comma ',' or point '.')
  • Timestamp format to use
  • Protein sets to export ('all' or 'validated only')
  • Export profile ('best' or 'all)

Description of the exported file is available here.

Note: The parameters could be saved and loaded in further export using the Save / Load buttons of the export dialog.

4. Export an Image

Any graphics in proline can be exported. Click on the Export Image Button at the left top of the image.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\export_image_button.png

An Export Dialog is opened where you can select the file path and the export type. Available formats are  PNG or SVG formats. SVG format produces a vector image that can be edited and resized afterwards.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\image_export_dialog.png

5. Export Identification Summary for ProteomeXchange

Actually it is possible to export Identification Summary into MzIdentML, Pride isn’t supported any more.

Note: Before exporting data all spectrum matches should have been generated. To do so, right click on the dataset and select “Generate Spectrum Matches”.

Right click on the dataset you want to export and select the “Export” menu and then “MzIdentML...” sub-menu

A dialog is opened where user information may be specified (name, organization …)

The file name and path should be specified in the next step. A progress bar is shown until the file is generated. The generated file contains identification and validation data issues from the dataset. All meta information including instrument configuration as well as search engine parameters are also extracted from dataset associated data.

6. Export Identification Summary spectra list

To export valid PSM Spectra from an Identification Summary or from a XIC Dataset. The exported tsv file is compatible with Peakview.

Note: all Spectrum Matches must be generated first.

Generate Spectrum Matches

When importing a Search Result in Proline, users can view PSM with their associated Spectrum but by default no annotation is defined. Users need to generate (and save) this information explicitly.

  • For a whole Search Result, Identification Summary or Quantitation Result :
  • right click on a Dataset
  • select “Generate Spectrum Matches”

In both cases, the following dialog will be opened. User can

  • Choose to force spectrum matches to be calculated even if it is defined. This could be useful if previous spectrum matches generation was done with the wrong rules set.
  • Use the fragmentation rules set defined at import. In some cases, this  information is not accessible and the user should then specify it.
  • Specify the  fragmentation rules set to use without taking into account the rules specified at import.

Once executed, the dataset views need to be loaded again  to effectively view the spectrum matches.

How to validate a Search Result

See description of Validation Algorithm.

It is possible to validate identification Search Result or merged ones. In the latest case, the filters and validation threshold can be propagated to child Search Results.

Starting Validation

 

To validate a Search Result:

- Select one or multiple Search Results to validate

- Right Click to display the popup

- Click on “Validate…” menu

Validation Dialog

In the Validation Dialog, fill the different Parameters (see Validation description):

- you can add multiple PSM Prefilter Parameters ( Rank, Length, Score, e-Value, Identity p-Value, Homology p-Value) by selecting them in the combobox.

- you can ensure a FDR on PSMs using BH or Taget/Decoy strategy. If using the latest, FDR will be reached according to the variable selected ( Score, e-Value, Identity p-Value, Homology p-Value,… )

- you can add a Protein Set Prefilter on Specific Peptides count, peptides or peptides sequence count  or on Protein Sets score.  

- you can also ensure a FDR on protein Sets or peptides using BH or Target/Decoy strategy. The strategy must be consistent between all levels where an FDR control is done (PSM, Peptide and ProteinSet)

Note: FDR can be used only for Search Results with Decoy Data.

If you run validation on a merged Search Result, you can choose to propagate it to child Search Result. Specified prefilters will be used as defined. For the FDR Filter, it is the threshold found by the validation algorithm which will be used for childs, as a prefilter.

In the second tab, you can define rules for choosing the Typical Protein of a Protein Set by using a match string with wildcards ( * or ? ) on Protein Accession or Protein Description. (see Change Typical Protein of Protein Sets).

Note: All validation parameters can be saved and loaded using appropriated buttons.

Validation Processing

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\validationprocessingprolinev2.png

Validating a Search Result can take some time. While it is not finished, the Search Results are shown greyed with an hourglass over them. The tasks are displayed as running in the “Tasks Log Dialog”.

Validation Done

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\validationdoneprolinev2.png

When the validation is finished, the icon becomes orange and blue. Orange part corresponds to the Identification Summary. Blue is for the Search Result part.

How to filter Protein Sets

See description of Protein Sets Filtering.

:!:The protein sets windows are not updated after filtering Protein Set. You should close and reopen the window :!:

Starting filtering

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\filterprotset.png

To filter Protein sets of Identification Summaries:

- Select one or multiple Identification Summaries to filter

- Right Click to display the popup

- Click on “Filter ProteinSets…” menu

Filtering Dialog

you can add multiple filters (Specific Peptides, Peptide count, Peptide sequence count, Protein Set Score) by selecting them in the combobox.

Once the filtering is done, you will have to open a new protein sets window in order to see modification.

Change Typical Protein of Protein Sets

 The protein sets windows are not updated after changing Typical Protein. You should close and reopen the window :!:

Open the Dialog

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\changetypicalproteinpopupv2.png

To change the Typical Protein of the Protein Sets of an Identification Summary:

- Select one or multiple Identification Summaries

- Right Click to display the popup

- Click on “Change Typical Protein…” menu

Dialog Parameters

You can set the choice for the Typical Protein of Protein Sets by using a match string with wildcards (* or ?) on Protein Accession or Protein Description.

For Advanced users, a fully regular expression could be specified. In this case, check the corresponding option.

Three rules could be specified. They are applied in priority order, i.e. if no protein of a protein set satisfies the first rule, the second one is tested and so on.

Processing

The modification of Typical Proteins can take some time. During the processing, Identification Summaries are displayed grayed with an hourglass and the tasks are displayed in the Tasks Log Window

Combine datasets

Merge can be done on Search Results or on Identification Summaries. You have also to specify which merge mode is to be used (aggregation or union). See description for combining Search Results or Identification Summaries.

Merge on Search Results

To merge a dataset with multiple Search Results:

- Select the parent dataset

- Right Click to display the popup

- Click on “Merge” menu

When the merge is finished, the dataset is displayed with an U or A in the blue part of the icon, indicating that the merge has been done using Union or Aggregation at a Search Result level.

Merge on Identification Summaries

If you merge a dataset containing Identification Summaries. The merge is done on an Identification Summary level. Therefore the dataset is displayed with an U or A in the orange part of the icon.

Data Analyzer

The purpose of the Data Analyzer is to easily do calculations/comparisons on data.

To open the data analyzer, you have two possibilities:

- you can use the dedicated button that you can find in the toolbar of all views. If you use this button, the corresponding data is directly sent to the data analyzer.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\startdatamixer.png

- you can use the menu “Window > Data Analyzer”

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\menudataanalyzer.png

In the Data Analyzer view, you can access all data views, to some functions and graphics. In the following example, we create a graph by adding by Drag & Drop the Spectral Count Data and the corresponding differential analysis function (beta-binomial BBinomial). Then we link them together.

You have to specify the parameters of the Function: right click on the function and select the “settings” menu

In the settings menu, select the two groups of columns on which you want to perform the BBinomial function. When the parameters are set, the calculation is started immediately and an hourglass icon is shown.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\datamixersettingsdialog.png

When the calculation is finished: the hourglass icon becomes a green tick, and the user can right click and select the “Display” menu to see the result (or click on the “table" icon).  

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\datamixerresult.png

Available Functions

STATISTICS FUNCTIONS

FDR Computation Function

This function is used by ProStar Macro to compute the FDR.

More information: http://bioconductor.org/packages/release/bioc/vignettes/Prostar/inst/doc/Prostar_UserManual.pdf 

PValue Adjustment Function / calibration Plot

Calibration Plot for Proteomics is described here: https://cran.r-project.org/web/packages/cp4p/index.html 

SC Differential Analysis Function

beta binomial function, useful for Spectral Count Quantitations

Xic Differential Analysis Function

This function is used by ProStar Macro. Two tests are available: Welch t-test and Limma t-test.

More information: http://bioconductor.org/packages/release/bioc/vignettes/Prostar/inst/doc/Prostar_UserManual.pdf 

Missing values filter Function

This function is used by ProStar Macro to remove rows with too many missing quantitative values.

The available missing values algorithm are:

  • Whole Groups: The lines (across all groups) in the quantitative dataset which contain less non-missing value than a user-defined threshold are deleted.
  • For every group: The lines for which each condition contains less non-missing value than a user-defined threshold are deleted.
  • At least one group: The lines for which at least one condition contains less non-missing value than a user-defined threshold are deleted.

Missing values imputation Function

This function is used by ProStar Macro to impute missing values.

More information: http://bioconductor.org/packages/release/bioc/vignettes/Prostar/inst/doc/Prostar_UserManual.pdf 

Normalization Function

This function is used by ProStar Macro to normalize quantitative values.

More information on algorithms: http://bioconductor.org/packages/release/bioc/vignettes/Prostar/inst/doc/Prostar_UserManual.pdf 

TABLE FUNCTIONS

Join Function

Join data from two tables according to the selected key.

Difference Function

Perform a difference between two joined table data according to a selected key. When a key value is not found in one of the data source tables, the line is displayed as empty. For numerical values a difference is done and for string values, the '<>' symbol is displayed when values are different.

Columns Filter Function

Columns filter, let the user remove unnecessary columns in a matrix. A combobox, with prefix and suffix of the columns allows to select multiple similar columns to filter them rapidly.

Rows Filter Function

Rows filter function lets the user filter some rows of a matrix according to settings on columns.

Log Function

Create a column by calculating the Log (2 or 10) of an existing column.

CSV/TSV Import

This module lets you import data from a CSV or TSV file. Then you can do calculations and display these data directly in Proline Studio.

 

The separator is automatically selected according to the csv file. But you can modify it.

The preview zone displays the first lines of the file as it will be loaded.

Expression Builder

The expression builder lets you create an expression with built-in functions or comparators and variables (columns from the linked matrix). In the example, we calculate the mean of a column in the matrix.

Prostar Macro

1 or 2: Add XIC Data to Data Analyzer from the Protein Set View or by importing data from a csv file.

3: Add Prostar Macro by a drag and drop and link XIC Data to the Macro. And do the calculation by clicking on the button Process Graph.

During the process, the Data Analyzer will ask you settings for each function.

4: Filter unnecessary columns from your data if. Settings can be validated with no parameters if you don't need it.

5: Filter is needed only if you want to remove contaminants. Settings can be validated with no parameters if you don't need it.

6: Log is needed to log abundances (Data from Proline). For Data coming from MaxQuant, data is already logged.

7 to 13: follow the settings asked ( you can find some help in Prostar documentation, or information in corresponding functions.)

During the process, results will be automatically displayed:

14: FDR Result

15: Calibration Plots

16: Result Table with differential Proteins Table and the corresponding scatter plot. You can select differential proteins in the table, to import them in the scatter plot and create a colored group with them.

If you want to look at other results, right click on a function and select “Display in New Window”

Prostar User Manual:

http://bioconductor.org/packages/release/bioc/vignettes/Prostar/inst/doc/Prostar_UserManual.pdf 

Prostar Tutorial :

http://bioconductor.org/packages/release/bioc/vignettes/Prostar/inst/doc/Prostar_Tutorial.pdf 

Calculator

Calculator lets you write python scripts to manipulate freely viewed data.

1) To open the calculator, click on the calculator icon (not available on all views for the moment)

On the left part of the calculator, you can access all viewed data, double click to add a table or a column to the script.

2) Write your python script on the text area

3) Execute it by clicking on the green Arrow.

4) When the script has been executed, the results of the calculations (variables, new columns) are available in the “Results” tab. Double click on a new column to add it to the table. Or like in the example, directly add the column to the table programmatically.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\calculatorv2.png

Examples

Script to calculate a log column

#### Algorithm to calculate the logarithm of a column ####

# get the Table 3 which corresponds to table newSC Quanti Protein Set
t = Table.get(3)

# get the constant column 10 of the table t ( Specific SC column)
# mutable() is called to be able to modify data
specificSCCol = t[10].mutable()

# number of rows of the column
 nb = len(specificSCCol)

# loop on the data of the column
for i in range (0,nb):
 # calculate the log (NaN values for errors)
 v = specificSCCol[i]
 if v <= 0:
  specificSCCol[i] = float('NaN')
 else:
  specificSCCol[i] = math.log(v)

# set the column name which will be used to the user
specificSCCol.setColumnName("log(specificSC)")

# add the created column to the table t
t.addColumn(specificSCCol)

Script to perform a difference and a mean between two columns

#### Algorithm to perform a difference and a mean between two columns ####

t = Table.get(9)
colAbundance1 = t[3]
colAbundance2 = t[5]

# difference between two columns
colDiff = colAbundance1-colAbundance2

# set the name of the column
colDiff.setColumnName("diff")

# mean between two columns
colMean = (colAbundance1+colAbundance2)/2

# set the name of the column
colMean.setColumnName("mean")

# add columns to the table
t.addColumn(colDiff)
t.addColumn(colMean)

Script to perform a perform a pvalue and a ttd on a XIC quantitation table

#### Algorithm to perform a pvalue and a ttd on abundances column of a XIC quantitation ####
t = Table.get(1)

pvalueCol = Stats.pvalue( (t[2], t[3]), (t[4],t[5]) )
ttdCol = Stats.ttd( (t[2], t[3]), (t[4],t[5]) )

pvalueCol.setColumnName("pvalue")
ttdCol.setColumnName("ttd")

t.addColumn(pvalueCol)
t.addColumn(ttdCol)

Update Spectrum using Peaklist software

When importing a search result, the software used for the peaklist creation has to be specified. This parameter is mandatory for the XIC quantitation as it is used to find scan number or RT in the spectrum title. Indeed, this information is then used to extract abundances in the raw files.

If an invalid software has been specified when importing, it is possible to change the peaklist software afterwards. This option is only valid for Identification DataSets.

Right click on the identification DataSet, and select “Update Spectrum using Peaklist software”

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\howtoupdatepeaklistsoftware.png

The following dialog will be displayed allowing the user to select the peaklist software to use.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\updatespectrummatches.png

Spectral Count

See description of Compare Identification Summaries with Spectral Count.

Generate a Spectral Count

To obtain a spectral count, right click on a Dataset with merged Identification Summaries and select the “Quantify  Spectral Counting” menu in the popup. This Dataset is used as the reference Dataset and Protein Set list as well as specifics peptides are defined there.

In the Spectral Count window, fill the name and description of your Spectral Count and press Next.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\sc_step1.png

Then select the Identification Summaries on which you want to perform the Spectral Count and press Next.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\sc_step2.png

Finally select the DataSet where shared peptides spectral count weight should be calculated and press OK.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\sc_step3.png

A Spectral Count is created and added to the Quantitations Panel.

D:\Proline_Data\Documentation\1.3\ProlineSuite_V1.3_MERGED_ODF\sc_dataset.png

Display a Spectral Count

You can then display a Spectral Count, see Display a Spectral Count 

XIC Quantitation

For description on LC-MS Quantitation you can first read the principles in this page: Quantitation: principles 

Create a New XIC Design

You can create a new XIC design by clicking on the “Quantify → Label Free” menu from Quantitation or from a dataset in the Identification tree. In this case, the selected dataset will be used as reference for the quantitation (from where the list of peptides and protein is extracted).

 

Settle Design

When you start the creation of a new XIC Design, the following dialog is opened:

xic_step1_create_group_sample.png

In the left Area, you can create your design :

  • by adding Group and Samples (thanks to mouse right click popup)
  • by  renaming every items ( thanks to F2 or mouse right click popup)
  • by rearranging order of groups and samples (thanks to drag & drop)

From the right Area, you can drag and drop desired identifications to the left Area. If you drop in the XIC or in a Group node,  Group and Sample nodes will be automatically added. But you can drop directly in a Sample node.

Note :  it is recommended that the XIC node is renamed.

When your design is ready, click on Next Button.

Link to Raw Files

The following panel is displayed:

In order to be able to perform any XiC design, all participating Sample Analysis must be associated with a corresponding raw file. The association is done at the second step of the XIC design by :

  • drag & drop the “mzDB File” into the raw corresponding to the correct sample analysis. It must be noted that although it is possible to overwrite an existing association (done in a previous quantitation using the same sample analysis dataset), there is no verification done to ensure compatibility between the mzDb file and the sample analysis dataset.
  • using the Drop Zone. This feature can be quite helpful in cases where multiple associations are missing or when the plethora of uploaded .mzdb files intimidates the user from manually searching the files one by one. The feature itself is extremely easy to use as it just requires dragging a set of files or folders containing .mzdb files from the user part. As soon as a drop takes place, all missing connections will be automatically created as long as a matching .mzdb file has been dropped in the Drop zone. It must also be noted that since version 1.5, users have now at their disposal indices about the association source. Furthermore, in order to protect  from a possible corruption of an existing association in the database, the latter ones cannot be overwritten.

When all participating Sample Analysis are associated with a raw file, click on Next Button.

XIC Parameters

Now you must select the parameters. See Label-free LC-MS quantitation configuration to have more details about the different parameters.

The XIC parameters are not all displayed. You can display a complete set of parameters by clicking on the “Advances Parameters”.

Note: all the parameters are already set with default values.

Clone a XIC Design

You can copy a XIC design by selecting the “Clone & Extract Abundances” option from an existing quantitation result. The new XIC is generated using an existing Experimental Design and parameters setting.

clone_extract_abundances.png

Display XIC Results

Newly generated XIC designs are immediately added to the Quantitation Tree. Through the latter one, and via a popup menu, the end user has the capacity either to view a design’s properties as seen to the following screenshot, or to apply a series of actions on it, including among others:

  • Delete a XIC Design, see how to Delete Data 
  • Rename a XIC Design, by clicking on “Rename…” in the popup menu.
  • Export the XIC results, see how to Export Data 

xic_properties.png

Xic Aggregation

It is possible to aggregate data from different XIC designs.

First you must select two or more XIC Designs in the Quantitation tree and do a mouse right click to obtain a popup and then select the menu “Aggregate Quantitations”.

The following dialog is opened:

This dialog is divided in three areas:

  • left area: aggregated experimental design. This design is inferred from the quantitations that will be aggregated.
  • center area : quantitation channels mapping. Each quantitation channel of the aggregation will correspond to sample analysis of aggregated quantitations.
  • right area : XIC Sources

You can completely modify the inferred aggregated experimental design. You can use drag & drop to modify the order of the items and the right mouse popup to create, delete or rename items.

You can modify the quantitation channels mapping by drag and drop from the right area to the center area. You can also remove or reorder the mapping thanks to the right mouse popup or thanks to the floating panel.

When you select a Channel, you can click on the help button to check what the aggregation will exactly do.

Compute Post Processing on abundances

Advanced Protein Sets abundances

Right click on the selected XIC node in the Quantitation tree, and select “Compute Post Processing on Abundances…”  

Configuration

In the dialog, you can:

- specify peptides to consider for quantitation

- configure parameters used for peptides quantitation

- configure parameters used for proteins quantitation

For more details, see Post-processing of LC-MS quantitative results 

Advanced XIC results

You can see the results by displaying the XIC (Display a XIC) or export them Export Data 


General Settings

Since version 1.4 Proline Studio includes a general settings dialog which can be accessed from the top menu bar clicking on “General Settings” as shown in the screenshot below.

access_general_settings.png

The latter one consists of a constantly but slowly growing number of user preferences regarding various aspects of the utilization of Proline Studio. Based on their context, for the time being, preferences are organized into the following four tabs:

  • JMS Settings
  • Conversion/Upload Settings
  • Table Parameters
  • General Application Settings

JMS Settings

JMS Settings tab contains parameters that concern the exchange of messages between your local machine and the JMS Server. It should be made clear that compared to other preferences, preferences that are included in this tab should be treated with caution. Mistreating a communication preference can lead either to communication/connection problems or to users’ confusion to whether they are connected to the correct server version.

jms_settings.png

Service Request Queue Name

Parameter can be seen as a name which represents a server address. The parameter’s existence is justified by the fact that multiple server versions might run on the same server machine imposing the need to be able to canalize Studio’s messages appropriately.

Table Parameters

Table parameters’ tab encapsulates a short list of preferences regarding all tables generated throughout Proline Studio. More specifically those preferences control the arrangement of the participating columns as well as their respective width.

table_parameters.png

Columns Arrangement

This field dictates the spatial arrangement of table columns. Three arrangements are possible:

  • Fixed Column Size
  • Automatic Columns Size
  • Smart Columns Size

When “Automatic Columns Size” is used, all columns are width-wise readjusted in a way that they all fit to their container. Given that it is a “fit-to-screen” approach, it lacks scrollbars and does not guarantee the readability of the presented date, especially when the number of columns is high.

automatic.png

On the other hand a simpler approach that guarantees readability is to select “Fixed Column Size”. In this case all table columns have a fixed width, explicitly dictated by the user using the parameter “Column Width”.

fixed.png

The less clear option is “Smart Column Size” which serves as a trade off between the aforementioned ones. It tackles with the cases that either we have too many columns to visualize using the “Automatic” approach or too few and the selected default and globally applied width imposes unneeded scrollbars ending in hiding some columns at the same time. In this context, “Smart Column Size” can be seen as a simple rule based on the ratio between the mean column width needed in case of “Automatic Column Size” for a specific table and the globally selected width. For the sake of simplicity we have set a threshold of 0.7 or 70% which on its turn determines which one of the two first modes will be used given a table. If the ratio is smaller than 0.7 then the table in question will be presented in “Fixed Column Size” mode. On contraire if ratio is equal or greater than 0.7, then we consider that using “Automatic Column Size” mode is more appropriate as it balances between a possible slightly smaller than desired width and the possibility of hiding a column using scrollbars.

Column Width

The second preference is more or less self explanatory and corresponds to the globally desired columns’ width when fixed rune is applied, either directly or as a result of the smart mode.

General Application Settings

general_application_settings.png

In this tab we can find a diverse set of preferences regarding various tasks encountered in Proline Studio. For the time being those preferences are:

  • Hide gettings Started Dialog
  • Default Search Name Source
  • Export Decorated
  • Use dataset type to create a XiC design by DnD

Default Search Name Source

Unlike the last three, Hide Getting Started Dialog is pretty much self explanatory. The second preference on the other hand, “Default Search Name Source” affects the way identification datasets are named on importation. For this preference we have three possible options:

  • Search Name (E.g Gamme Levure UPS1)
  • Peaklist (E.g OEMMA121101_36.raw)
  • MSI Search Filename (E.g F054967)
  • Mascot Rule (...)

Export Decorated

This parameter affects the .xls and .xlsx files that are produced in the process of export (client side). It could be easily described as a preservation of any existing Rich Text Feature in a table. (Colors, Font Weight etc.)

Use dataset type to create a XiC design by DnD

MsFiles

Converter (.exe)

Corresponds to the default raw2mzDB converter. While it is left at the discretion of the user, which version to choose, it must be noted that different versions do tend to work better with specific type raw files. Said that, it is also important to understand that in order for a conversion to be successful within Proline Studio, all system requirements set by the specific raw2mzDB version must be met.

Identify Modification Sites or Clusters

For description on sites and clusters you can first read the principles in this page: Identifying Modification sites and clusters

To identify Modification sites and create Modification clusters, right click on the Identification Summary and select Identify Modification sites.

A dialog is displayed where you can choose Modification of interest and configure the clustering method (see  Identifying Modification sites and clusters for more details).

Annotate and Edit Modification Clusters

After running Identify Modification for a specific Identification Summary or Quantitation dataset (see above and  Identifying Modification sites and clusters for more details), users can annotate and edit these clusters.

In the associated display, few operations are allowed.

  • Change the status of the cluster by clicking on the  icon. The following dialog appears, allowing user to
  •  Validate/Invalidate the cluster
  •  Add a confidence level : any number which signification is user specific
  • Add a free description

  • Edit the selected cluster by clicking on the  icon. In this case, the status dialog is displayed in addition with the list of peptides of the cluster. Same status annotation as described above can be done. Users can also remove some peptides from the cluster. The removed peptides will be removed from the whole “PTM Dataset”. They will not be added to an existing or new cluster. Note: Peptide used as reference could not be deleted, a single peptide could be deleted at a time.

  •  Merge co-localized clusters by clicking on  icon. Users must select clusters that should be merged. These clusters must be co-localized, see Identify Modification Sites or Clusters  .
  • Save edition by clicking in  icon. All modifications done on clusters will not be saved in datastore until user explicitly ask for it. When saving annotation, an Annotated Modification Dataset is created and will be accessible through the Annotated Clusters menu. This permits users to still access the initial Modification Dataset. Warning : there is only one Annotated Modification Dataset per Modification Dataset. If new annotation is done and saved from initial Modification Dataset, previous Annotated Modification Dataset will be erased

Administration

Some administration views and operations are accessible through the Proline Studio File > Admin menu. Edit functions are only permitted to advanced users, who at the same time hold the status of Admin..

User Accounts

The “User Accounts” tab, list all registered users with the group they belong to. Admin users can add new users  or modify existing one. Modifications consist in changing user groups or passwords.

user_accounts.png

   modify_existing_user.png

User account modification dialog

Peaklist Softwares

Peaklist Softwares tab permits users  to view the list of all available Peaklist Software. A detailed view could be displayed when selecting the “View Peaklist Software” button.

In both windows, It is possible to test a spectrum title to verify which data are extracted for a given Peaklist Software.

Admin users also have the possibility to add new Peaklist Software definition (name, version and extraction rules using regular expression) or to modify existing definitions by changing the name or version. Rules are not modifiable since some already parsed data may not be consistent with the new definition. New rules definition may be done by creation of a new peaklist software.

new_peaklist_software.png

Projects and Databases

This tab lists all projects defined on the Proline Suite.

Upper view: List of projects with associated generic information (owner, description) and more  administration information such as the name of the databases containing data, size of these databases, last dataset creation…  The satus column, first one, indicates if the project is active (green), inactive (blue) or archived (grey)

Lower view: for selected project, list of the mzdb files used for quantitation. This is useful to do some cleanup on disk when archiving projects. The status indicated if this mzdb file is used in active projects only (green), in active and archived projects (yellow) or in archived projects only (grey).

Fragmentation Rule Sets

This tab show all fragmentation rule sets defined in Proline Suite and the rules they use. The display is similar to the one defined by Mascot ®


This information is used for generating spectrum matches. Custom fragmentation rule set can be added if needed by “admin” user.

\ No newline at end of file diff --git a/builder/src/main/resources/documentation/images/image10.png b/builder/src/main/resources/documentation/images/image10.png new file mode 100644 index 000000000..78ae5dbf4 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image10.png differ diff --git a/builder/src/main/resources/documentation/images/image100.png b/builder/src/main/resources/documentation/images/image100.png new file mode 100644 index 000000000..7befa59c4 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image100.png differ diff --git a/builder/src/main/resources/documentation/images/image101.png b/builder/src/main/resources/documentation/images/image101.png new file mode 100644 index 000000000..afb6f6fcc Binary files /dev/null and b/builder/src/main/resources/documentation/images/image101.png differ diff --git a/builder/src/main/resources/documentation/images/image102.png b/builder/src/main/resources/documentation/images/image102.png new file mode 100644 index 000000000..6a01fe533 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image102.png differ diff --git a/builder/src/main/resources/documentation/images/image103.png b/builder/src/main/resources/documentation/images/image103.png new file mode 100644 index 000000000..44474e940 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image103.png differ diff --git a/builder/src/main/resources/documentation/images/image104.png b/builder/src/main/resources/documentation/images/image104.png new file mode 100644 index 000000000..778225159 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image104.png differ diff --git a/builder/src/main/resources/documentation/images/image105.png b/builder/src/main/resources/documentation/images/image105.png new file mode 100644 index 000000000..eb7b518ca Binary files /dev/null and b/builder/src/main/resources/documentation/images/image105.png differ diff --git a/builder/src/main/resources/documentation/images/image106.png b/builder/src/main/resources/documentation/images/image106.png new file mode 100644 index 000000000..baf126908 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image106.png differ diff --git a/builder/src/main/resources/documentation/images/image107.png b/builder/src/main/resources/documentation/images/image107.png new file mode 100644 index 000000000..7eb73209d Binary files /dev/null and b/builder/src/main/resources/documentation/images/image107.png differ diff --git a/builder/src/main/resources/documentation/images/image108.png b/builder/src/main/resources/documentation/images/image108.png new file mode 100644 index 000000000..a7aca5e69 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image108.png differ diff --git a/builder/src/main/resources/documentation/images/image109.png b/builder/src/main/resources/documentation/images/image109.png new file mode 100644 index 000000000..be240d6b5 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image109.png differ diff --git a/builder/src/main/resources/documentation/images/image11.png b/builder/src/main/resources/documentation/images/image11.png new file mode 100644 index 000000000..b6abd1449 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image11.png differ diff --git a/builder/src/main/resources/documentation/images/image110.png b/builder/src/main/resources/documentation/images/image110.png new file mode 100644 index 000000000..25653c2de Binary files /dev/null and b/builder/src/main/resources/documentation/images/image110.png differ diff --git a/builder/src/main/resources/documentation/images/image111.png b/builder/src/main/resources/documentation/images/image111.png new file mode 100644 index 000000000..8e92d64cf Binary files /dev/null and b/builder/src/main/resources/documentation/images/image111.png differ diff --git a/builder/src/main/resources/documentation/images/image112.png b/builder/src/main/resources/documentation/images/image112.png new file mode 100644 index 000000000..43220f29e Binary files /dev/null and b/builder/src/main/resources/documentation/images/image112.png differ diff --git a/builder/src/main/resources/documentation/images/image113.png b/builder/src/main/resources/documentation/images/image113.png new file mode 100644 index 000000000..ae5b7e5f5 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image113.png differ diff --git a/builder/src/main/resources/documentation/images/image114.png b/builder/src/main/resources/documentation/images/image114.png new file mode 100644 index 000000000..eba469352 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image114.png differ diff --git a/builder/src/main/resources/documentation/images/image115.png b/builder/src/main/resources/documentation/images/image115.png new file mode 100644 index 000000000..a249ffdcb Binary files /dev/null and b/builder/src/main/resources/documentation/images/image115.png differ diff --git a/builder/src/main/resources/documentation/images/image116.png b/builder/src/main/resources/documentation/images/image116.png new file mode 100644 index 000000000..41f5e97da Binary files /dev/null and b/builder/src/main/resources/documentation/images/image116.png differ diff --git a/builder/src/main/resources/documentation/images/image117.png b/builder/src/main/resources/documentation/images/image117.png new file mode 100644 index 000000000..97f6146f5 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image117.png differ diff --git a/builder/src/main/resources/documentation/images/image118.png b/builder/src/main/resources/documentation/images/image118.png new file mode 100644 index 000000000..06b09e275 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image118.png differ diff --git a/builder/src/main/resources/documentation/images/image119.png b/builder/src/main/resources/documentation/images/image119.png new file mode 100644 index 000000000..2c1f6e5ac Binary files /dev/null and b/builder/src/main/resources/documentation/images/image119.png differ diff --git a/builder/src/main/resources/documentation/images/image12.png b/builder/src/main/resources/documentation/images/image12.png new file mode 100644 index 000000000..4d50a037d Binary files /dev/null and b/builder/src/main/resources/documentation/images/image12.png differ diff --git a/builder/src/main/resources/documentation/images/image120.png b/builder/src/main/resources/documentation/images/image120.png new file mode 100644 index 000000000..c92f9554a Binary files /dev/null and b/builder/src/main/resources/documentation/images/image120.png differ diff --git a/builder/src/main/resources/documentation/images/image121.png b/builder/src/main/resources/documentation/images/image121.png new file mode 100644 index 000000000..95a4943dc Binary files /dev/null and b/builder/src/main/resources/documentation/images/image121.png differ diff --git a/builder/src/main/resources/documentation/images/image122.png b/builder/src/main/resources/documentation/images/image122.png new file mode 100644 index 000000000..f0fa4a823 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image122.png differ diff --git a/builder/src/main/resources/documentation/images/image123.png b/builder/src/main/resources/documentation/images/image123.png new file mode 100644 index 000000000..e1fab31af Binary files /dev/null and b/builder/src/main/resources/documentation/images/image123.png differ diff --git a/builder/src/main/resources/documentation/images/image124.png b/builder/src/main/resources/documentation/images/image124.png new file mode 100644 index 000000000..a51fd363a Binary files /dev/null and b/builder/src/main/resources/documentation/images/image124.png differ diff --git a/builder/src/main/resources/documentation/images/image125.png b/builder/src/main/resources/documentation/images/image125.png new file mode 100644 index 000000000..d55cc6405 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image125.png differ diff --git a/builder/src/main/resources/documentation/images/image126.png b/builder/src/main/resources/documentation/images/image126.png new file mode 100644 index 000000000..80b4873ef Binary files /dev/null and b/builder/src/main/resources/documentation/images/image126.png differ diff --git a/builder/src/main/resources/documentation/images/image127.png b/builder/src/main/resources/documentation/images/image127.png new file mode 100644 index 000000000..e1133fd6d Binary files /dev/null and b/builder/src/main/resources/documentation/images/image127.png differ diff --git a/builder/src/main/resources/documentation/images/image128.png b/builder/src/main/resources/documentation/images/image128.png new file mode 100644 index 000000000..b70a42c98 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image128.png differ diff --git a/builder/src/main/resources/documentation/images/image129.png b/builder/src/main/resources/documentation/images/image129.png new file mode 100644 index 000000000..1f3167bf8 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image129.png differ diff --git a/builder/src/main/resources/documentation/images/image13.png b/builder/src/main/resources/documentation/images/image13.png new file mode 100644 index 000000000..953c14d4a Binary files /dev/null and b/builder/src/main/resources/documentation/images/image13.png differ diff --git a/builder/src/main/resources/documentation/images/image130.png b/builder/src/main/resources/documentation/images/image130.png new file mode 100644 index 000000000..7ff42af88 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image130.png differ diff --git a/builder/src/main/resources/documentation/images/image131.png b/builder/src/main/resources/documentation/images/image131.png new file mode 100644 index 000000000..f8d91c2dd Binary files /dev/null and b/builder/src/main/resources/documentation/images/image131.png differ diff --git a/builder/src/main/resources/documentation/images/image132.png b/builder/src/main/resources/documentation/images/image132.png new file mode 100644 index 000000000..4c6c7d0d2 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image132.png differ diff --git a/builder/src/main/resources/documentation/images/image133.png b/builder/src/main/resources/documentation/images/image133.png new file mode 100644 index 000000000..b5de2f0ee Binary files /dev/null and b/builder/src/main/resources/documentation/images/image133.png differ diff --git a/builder/src/main/resources/documentation/images/image134.png b/builder/src/main/resources/documentation/images/image134.png new file mode 100644 index 000000000..b79928fa5 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image134.png differ diff --git a/builder/src/main/resources/documentation/images/image135.png b/builder/src/main/resources/documentation/images/image135.png new file mode 100644 index 000000000..ac31851c1 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image135.png differ diff --git a/builder/src/main/resources/documentation/images/image136.png b/builder/src/main/resources/documentation/images/image136.png new file mode 100644 index 000000000..e77141aa9 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image136.png differ diff --git a/builder/src/main/resources/documentation/images/image137.png b/builder/src/main/resources/documentation/images/image137.png new file mode 100644 index 000000000..42a5c73ec Binary files /dev/null and b/builder/src/main/resources/documentation/images/image137.png differ diff --git a/builder/src/main/resources/documentation/images/image138.png b/builder/src/main/resources/documentation/images/image138.png new file mode 100644 index 000000000..0bb0f7587 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image138.png differ diff --git a/builder/src/main/resources/documentation/images/image139.png b/builder/src/main/resources/documentation/images/image139.png new file mode 100644 index 000000000..5b715a626 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image139.png differ diff --git a/builder/src/main/resources/documentation/images/image14.png b/builder/src/main/resources/documentation/images/image14.png new file mode 100644 index 000000000..22d4779f9 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image14.png differ diff --git a/builder/src/main/resources/documentation/images/image140.png b/builder/src/main/resources/documentation/images/image140.png new file mode 100644 index 000000000..8b5cd0ad5 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image140.png differ diff --git a/builder/src/main/resources/documentation/images/image141.png b/builder/src/main/resources/documentation/images/image141.png new file mode 100644 index 000000000..a6e1941bb Binary files /dev/null and b/builder/src/main/resources/documentation/images/image141.png differ diff --git a/builder/src/main/resources/documentation/images/image142.png b/builder/src/main/resources/documentation/images/image142.png new file mode 100644 index 000000000..de6b7e456 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image142.png differ diff --git a/builder/src/main/resources/documentation/images/image143.png b/builder/src/main/resources/documentation/images/image143.png new file mode 100644 index 000000000..080ea1623 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image143.png differ diff --git a/builder/src/main/resources/documentation/images/image144.png b/builder/src/main/resources/documentation/images/image144.png new file mode 100644 index 000000000..93ae68101 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image144.png differ diff --git a/builder/src/main/resources/documentation/images/image145.png b/builder/src/main/resources/documentation/images/image145.png new file mode 100644 index 000000000..ffc9eefc2 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image145.png differ diff --git a/builder/src/main/resources/documentation/images/image146.png b/builder/src/main/resources/documentation/images/image146.png new file mode 100644 index 000000000..0d4a39390 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image146.png differ diff --git a/builder/src/main/resources/documentation/images/image147.png b/builder/src/main/resources/documentation/images/image147.png new file mode 100644 index 000000000..f9a196324 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image147.png differ diff --git a/builder/src/main/resources/documentation/images/image148.png b/builder/src/main/resources/documentation/images/image148.png new file mode 100644 index 000000000..1139afee4 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image148.png differ diff --git a/builder/src/main/resources/documentation/images/image149.png b/builder/src/main/resources/documentation/images/image149.png new file mode 100644 index 000000000..c39fce783 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image149.png differ diff --git a/builder/src/main/resources/documentation/images/image15.png b/builder/src/main/resources/documentation/images/image15.png new file mode 100644 index 000000000..3711bc35c Binary files /dev/null and b/builder/src/main/resources/documentation/images/image15.png differ diff --git a/builder/src/main/resources/documentation/images/image150.png b/builder/src/main/resources/documentation/images/image150.png new file mode 100644 index 000000000..85cd95e13 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image150.png differ diff --git a/builder/src/main/resources/documentation/images/image151.png b/builder/src/main/resources/documentation/images/image151.png new file mode 100644 index 000000000..83a97872d Binary files /dev/null and b/builder/src/main/resources/documentation/images/image151.png differ diff --git a/builder/src/main/resources/documentation/images/image152.png b/builder/src/main/resources/documentation/images/image152.png new file mode 100644 index 000000000..1cd28a289 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image152.png differ diff --git a/builder/src/main/resources/documentation/images/image153.gif b/builder/src/main/resources/documentation/images/image153.gif new file mode 100644 index 000000000..89a17886f Binary files /dev/null and b/builder/src/main/resources/documentation/images/image153.gif differ diff --git a/builder/src/main/resources/documentation/images/image154.png b/builder/src/main/resources/documentation/images/image154.png new file mode 100644 index 000000000..137baabe6 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image154.png differ diff --git a/builder/src/main/resources/documentation/images/image155.png b/builder/src/main/resources/documentation/images/image155.png new file mode 100644 index 000000000..f4eabc522 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image155.png differ diff --git a/builder/src/main/resources/documentation/images/image156.png b/builder/src/main/resources/documentation/images/image156.png new file mode 100644 index 000000000..3871dde5f Binary files /dev/null and b/builder/src/main/resources/documentation/images/image156.png differ diff --git a/builder/src/main/resources/documentation/images/image157.png b/builder/src/main/resources/documentation/images/image157.png new file mode 100644 index 000000000..768c989a6 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image157.png differ diff --git a/builder/src/main/resources/documentation/images/image158.png b/builder/src/main/resources/documentation/images/image158.png new file mode 100644 index 000000000..69a0f5f9f Binary files /dev/null and b/builder/src/main/resources/documentation/images/image158.png differ diff --git a/builder/src/main/resources/documentation/images/image159.png b/builder/src/main/resources/documentation/images/image159.png new file mode 100644 index 000000000..37ba586a3 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image159.png differ diff --git a/builder/src/main/resources/documentation/images/image16.png b/builder/src/main/resources/documentation/images/image16.png new file mode 100644 index 000000000..5c5da0caf Binary files /dev/null and b/builder/src/main/resources/documentation/images/image16.png differ diff --git a/builder/src/main/resources/documentation/images/image160.png b/builder/src/main/resources/documentation/images/image160.png new file mode 100644 index 000000000..8b440d612 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image160.png differ diff --git a/builder/src/main/resources/documentation/images/image161.png b/builder/src/main/resources/documentation/images/image161.png new file mode 100644 index 000000000..876e4d641 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image161.png differ diff --git a/builder/src/main/resources/documentation/images/image162.png b/builder/src/main/resources/documentation/images/image162.png new file mode 100644 index 000000000..8479244ab Binary files /dev/null and b/builder/src/main/resources/documentation/images/image162.png differ diff --git a/builder/src/main/resources/documentation/images/image163.png b/builder/src/main/resources/documentation/images/image163.png new file mode 100644 index 000000000..b1edfa811 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image163.png differ diff --git a/builder/src/main/resources/documentation/images/image164.png b/builder/src/main/resources/documentation/images/image164.png new file mode 100644 index 000000000..a0adfb848 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image164.png differ diff --git a/builder/src/main/resources/documentation/images/image165.png b/builder/src/main/resources/documentation/images/image165.png new file mode 100644 index 000000000..5dc29877e Binary files /dev/null and b/builder/src/main/resources/documentation/images/image165.png differ diff --git a/builder/src/main/resources/documentation/images/image166.png b/builder/src/main/resources/documentation/images/image166.png new file mode 100644 index 000000000..6f6ec800e Binary files /dev/null and b/builder/src/main/resources/documentation/images/image166.png differ diff --git a/builder/src/main/resources/documentation/images/image167.png b/builder/src/main/resources/documentation/images/image167.png new file mode 100644 index 000000000..94c0af8a7 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image167.png differ diff --git a/builder/src/main/resources/documentation/images/image168.png b/builder/src/main/resources/documentation/images/image168.png new file mode 100644 index 000000000..e84bdaa48 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image168.png differ diff --git a/builder/src/main/resources/documentation/images/image169.png b/builder/src/main/resources/documentation/images/image169.png new file mode 100644 index 000000000..0a82d8df9 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image169.png differ diff --git a/builder/src/main/resources/documentation/images/image17.png b/builder/src/main/resources/documentation/images/image17.png new file mode 100644 index 000000000..61784784f Binary files /dev/null and b/builder/src/main/resources/documentation/images/image17.png differ diff --git a/builder/src/main/resources/documentation/images/image170.png b/builder/src/main/resources/documentation/images/image170.png new file mode 100644 index 000000000..e2071727f Binary files /dev/null and b/builder/src/main/resources/documentation/images/image170.png differ diff --git a/builder/src/main/resources/documentation/images/image171.png b/builder/src/main/resources/documentation/images/image171.png new file mode 100644 index 000000000..dc8f173cf Binary files /dev/null and b/builder/src/main/resources/documentation/images/image171.png differ diff --git a/builder/src/main/resources/documentation/images/image172.png b/builder/src/main/resources/documentation/images/image172.png new file mode 100644 index 000000000..8f8350d25 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image172.png differ diff --git a/builder/src/main/resources/documentation/images/image173.png b/builder/src/main/resources/documentation/images/image173.png new file mode 100644 index 000000000..9e63cef00 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image173.png differ diff --git a/builder/src/main/resources/documentation/images/image174.png b/builder/src/main/resources/documentation/images/image174.png new file mode 100644 index 000000000..7277ffa11 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image174.png differ diff --git a/builder/src/main/resources/documentation/images/image175.png b/builder/src/main/resources/documentation/images/image175.png new file mode 100644 index 000000000..3cfae4a45 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image175.png differ diff --git a/builder/src/main/resources/documentation/images/image176.png b/builder/src/main/resources/documentation/images/image176.png new file mode 100644 index 000000000..84031ae53 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image176.png differ diff --git a/builder/src/main/resources/documentation/images/image177.png b/builder/src/main/resources/documentation/images/image177.png new file mode 100644 index 000000000..ba1252b17 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image177.png differ diff --git a/builder/src/main/resources/documentation/images/image178.png b/builder/src/main/resources/documentation/images/image178.png new file mode 100644 index 000000000..33cb3e9b3 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image178.png differ diff --git a/builder/src/main/resources/documentation/images/image179.png b/builder/src/main/resources/documentation/images/image179.png new file mode 100644 index 000000000..bfcb36c87 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image179.png differ diff --git a/builder/src/main/resources/documentation/images/image18.png b/builder/src/main/resources/documentation/images/image18.png new file mode 100644 index 000000000..494a5f762 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image18.png differ diff --git a/builder/src/main/resources/documentation/images/image180.png b/builder/src/main/resources/documentation/images/image180.png new file mode 100644 index 000000000..a0a333566 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image180.png differ diff --git a/builder/src/main/resources/documentation/images/image181.png b/builder/src/main/resources/documentation/images/image181.png new file mode 100644 index 000000000..b3edd61be Binary files /dev/null and b/builder/src/main/resources/documentation/images/image181.png differ diff --git a/builder/src/main/resources/documentation/images/image182.png b/builder/src/main/resources/documentation/images/image182.png new file mode 100644 index 000000000..665e4c17e Binary files /dev/null and b/builder/src/main/resources/documentation/images/image182.png differ diff --git a/builder/src/main/resources/documentation/images/image183.png b/builder/src/main/resources/documentation/images/image183.png new file mode 100644 index 000000000..e7dfa777a Binary files /dev/null and b/builder/src/main/resources/documentation/images/image183.png differ diff --git a/builder/src/main/resources/documentation/images/image184.png b/builder/src/main/resources/documentation/images/image184.png new file mode 100644 index 000000000..c6cd9ae37 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image184.png differ diff --git a/builder/src/main/resources/documentation/images/image185.png b/builder/src/main/resources/documentation/images/image185.png new file mode 100644 index 000000000..93774dde6 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image185.png differ diff --git a/builder/src/main/resources/documentation/images/image186.png b/builder/src/main/resources/documentation/images/image186.png new file mode 100644 index 000000000..d33e3b89c Binary files /dev/null and b/builder/src/main/resources/documentation/images/image186.png differ diff --git a/builder/src/main/resources/documentation/images/image187.png b/builder/src/main/resources/documentation/images/image187.png new file mode 100644 index 000000000..f3e239970 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image187.png differ diff --git a/builder/src/main/resources/documentation/images/image188.png b/builder/src/main/resources/documentation/images/image188.png new file mode 100644 index 000000000..0cd240dbd Binary files /dev/null and b/builder/src/main/resources/documentation/images/image188.png differ diff --git a/builder/src/main/resources/documentation/images/image189.jpg b/builder/src/main/resources/documentation/images/image189.jpg new file mode 100644 index 000000000..b459abc8a Binary files /dev/null and b/builder/src/main/resources/documentation/images/image189.jpg differ diff --git a/builder/src/main/resources/documentation/images/image19.png b/builder/src/main/resources/documentation/images/image19.png new file mode 100644 index 000000000..8ea3feb49 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image19.png differ diff --git a/builder/src/main/resources/documentation/images/image20.png b/builder/src/main/resources/documentation/images/image20.png new file mode 100644 index 000000000..c096bc6e3 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image20.png differ diff --git a/builder/src/main/resources/documentation/images/image21.png b/builder/src/main/resources/documentation/images/image21.png new file mode 100644 index 000000000..85e71327e Binary files /dev/null and b/builder/src/main/resources/documentation/images/image21.png differ diff --git a/builder/src/main/resources/documentation/images/image22.png b/builder/src/main/resources/documentation/images/image22.png new file mode 100644 index 000000000..672221594 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image22.png differ diff --git a/builder/src/main/resources/documentation/images/image23.png b/builder/src/main/resources/documentation/images/image23.png new file mode 100644 index 000000000..c770a84ab Binary files /dev/null and b/builder/src/main/resources/documentation/images/image23.png differ diff --git a/builder/src/main/resources/documentation/images/image24.png b/builder/src/main/resources/documentation/images/image24.png new file mode 100644 index 000000000..51021e82b Binary files /dev/null and b/builder/src/main/resources/documentation/images/image24.png differ diff --git a/builder/src/main/resources/documentation/images/image25.png b/builder/src/main/resources/documentation/images/image25.png new file mode 100644 index 000000000..63830f72b Binary files /dev/null and b/builder/src/main/resources/documentation/images/image25.png differ diff --git a/builder/src/main/resources/documentation/images/image26.png b/builder/src/main/resources/documentation/images/image26.png new file mode 100644 index 000000000..4d25e67bf Binary files /dev/null and b/builder/src/main/resources/documentation/images/image26.png differ diff --git a/builder/src/main/resources/documentation/images/image27.png b/builder/src/main/resources/documentation/images/image27.png new file mode 100644 index 000000000..9304d1e03 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image27.png differ diff --git a/builder/src/main/resources/documentation/images/image28.png b/builder/src/main/resources/documentation/images/image28.png new file mode 100644 index 000000000..2ee1c93ff Binary files /dev/null and b/builder/src/main/resources/documentation/images/image28.png differ diff --git a/builder/src/main/resources/documentation/images/image29.png b/builder/src/main/resources/documentation/images/image29.png new file mode 100644 index 000000000..2647c3292 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image29.png differ diff --git a/builder/src/main/resources/documentation/images/image3.png b/builder/src/main/resources/documentation/images/image3.png new file mode 100644 index 000000000..ca66c15a7 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image3.png differ diff --git a/builder/src/main/resources/documentation/images/image30.png b/builder/src/main/resources/documentation/images/image30.png new file mode 100644 index 000000000..168ee422a Binary files /dev/null and b/builder/src/main/resources/documentation/images/image30.png differ diff --git a/builder/src/main/resources/documentation/images/image31.png b/builder/src/main/resources/documentation/images/image31.png new file mode 100644 index 000000000..005df6b94 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image31.png differ diff --git a/builder/src/main/resources/documentation/images/image32.png b/builder/src/main/resources/documentation/images/image32.png new file mode 100644 index 000000000..9b1ea37d2 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image32.png differ diff --git a/builder/src/main/resources/documentation/images/image33.png b/builder/src/main/resources/documentation/images/image33.png new file mode 100644 index 000000000..8a981dc11 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image33.png differ diff --git a/builder/src/main/resources/documentation/images/image34.png b/builder/src/main/resources/documentation/images/image34.png new file mode 100644 index 000000000..5ada48d6b Binary files /dev/null and b/builder/src/main/resources/documentation/images/image34.png differ diff --git a/builder/src/main/resources/documentation/images/image35.png b/builder/src/main/resources/documentation/images/image35.png new file mode 100644 index 000000000..174ff9919 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image35.png differ diff --git a/builder/src/main/resources/documentation/images/image36.png b/builder/src/main/resources/documentation/images/image36.png new file mode 100644 index 000000000..4c52f8c81 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image36.png differ diff --git a/builder/src/main/resources/documentation/images/image37.png b/builder/src/main/resources/documentation/images/image37.png new file mode 100644 index 000000000..4d102afd5 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image37.png differ diff --git a/builder/src/main/resources/documentation/images/image38.png b/builder/src/main/resources/documentation/images/image38.png new file mode 100644 index 000000000..779aefdae Binary files /dev/null and b/builder/src/main/resources/documentation/images/image38.png differ diff --git a/builder/src/main/resources/documentation/images/image39.png b/builder/src/main/resources/documentation/images/image39.png new file mode 100644 index 000000000..71e2b8802 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image39.png differ diff --git a/builder/src/main/resources/documentation/images/image4.png b/builder/src/main/resources/documentation/images/image4.png new file mode 100644 index 000000000..16c440c86 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image4.png differ diff --git a/builder/src/main/resources/documentation/images/image40.png b/builder/src/main/resources/documentation/images/image40.png new file mode 100644 index 000000000..d2b542a98 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image40.png differ diff --git a/builder/src/main/resources/documentation/images/image41.png b/builder/src/main/resources/documentation/images/image41.png new file mode 100644 index 000000000..117c315bb Binary files /dev/null and b/builder/src/main/resources/documentation/images/image41.png differ diff --git a/builder/src/main/resources/documentation/images/image42.png b/builder/src/main/resources/documentation/images/image42.png new file mode 100644 index 000000000..3a568dab6 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image42.png differ diff --git a/builder/src/main/resources/documentation/images/image43.png b/builder/src/main/resources/documentation/images/image43.png new file mode 100644 index 000000000..21a63be05 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image43.png differ diff --git a/builder/src/main/resources/documentation/images/image44.png b/builder/src/main/resources/documentation/images/image44.png new file mode 100644 index 000000000..8d5055352 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image44.png differ diff --git a/builder/src/main/resources/documentation/images/image45.png b/builder/src/main/resources/documentation/images/image45.png new file mode 100644 index 000000000..a7ae8ec64 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image45.png differ diff --git a/builder/src/main/resources/documentation/images/image46.png b/builder/src/main/resources/documentation/images/image46.png new file mode 100644 index 000000000..599f721c4 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image46.png differ diff --git a/builder/src/main/resources/documentation/images/image47.png b/builder/src/main/resources/documentation/images/image47.png new file mode 100644 index 000000000..ec6f35f41 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image47.png differ diff --git a/builder/src/main/resources/documentation/images/image48.png b/builder/src/main/resources/documentation/images/image48.png new file mode 100644 index 000000000..81b632a63 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image48.png differ diff --git a/builder/src/main/resources/documentation/images/image49.png b/builder/src/main/resources/documentation/images/image49.png new file mode 100644 index 000000000..edbcbe1ee Binary files /dev/null and b/builder/src/main/resources/documentation/images/image49.png differ diff --git a/builder/src/main/resources/documentation/images/image5.png b/builder/src/main/resources/documentation/images/image5.png new file mode 100644 index 000000000..3d2741cc1 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image5.png differ diff --git a/builder/src/main/resources/documentation/images/image50.png b/builder/src/main/resources/documentation/images/image50.png new file mode 100644 index 000000000..be66b3028 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image50.png differ diff --git a/builder/src/main/resources/documentation/images/image51.png b/builder/src/main/resources/documentation/images/image51.png new file mode 100644 index 000000000..a09366392 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image51.png differ diff --git a/builder/src/main/resources/documentation/images/image52.png b/builder/src/main/resources/documentation/images/image52.png new file mode 100644 index 000000000..2af674ece Binary files /dev/null and b/builder/src/main/resources/documentation/images/image52.png differ diff --git a/builder/src/main/resources/documentation/images/image53.png b/builder/src/main/resources/documentation/images/image53.png new file mode 100644 index 000000000..db41e91c0 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image53.png differ diff --git a/builder/src/main/resources/documentation/images/image54.png b/builder/src/main/resources/documentation/images/image54.png new file mode 100644 index 000000000..ae1dba30a Binary files /dev/null and b/builder/src/main/resources/documentation/images/image54.png differ diff --git a/builder/src/main/resources/documentation/images/image55.png b/builder/src/main/resources/documentation/images/image55.png new file mode 100644 index 000000000..d567a728a Binary files /dev/null and b/builder/src/main/resources/documentation/images/image55.png differ diff --git a/builder/src/main/resources/documentation/images/image56.png b/builder/src/main/resources/documentation/images/image56.png new file mode 100644 index 000000000..64122ceb5 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image56.png differ diff --git a/builder/src/main/resources/documentation/images/image57.png b/builder/src/main/resources/documentation/images/image57.png new file mode 100644 index 000000000..eb2a86aa1 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image57.png differ diff --git a/builder/src/main/resources/documentation/images/image58.png b/builder/src/main/resources/documentation/images/image58.png new file mode 100644 index 000000000..c5a518ac9 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image58.png differ diff --git a/builder/src/main/resources/documentation/images/image59.png b/builder/src/main/resources/documentation/images/image59.png new file mode 100644 index 000000000..a9eb931db Binary files /dev/null and b/builder/src/main/resources/documentation/images/image59.png differ diff --git a/builder/src/main/resources/documentation/images/image6.png b/builder/src/main/resources/documentation/images/image6.png new file mode 100644 index 000000000..b748293cb Binary files /dev/null and b/builder/src/main/resources/documentation/images/image6.png differ diff --git a/builder/src/main/resources/documentation/images/image60.png b/builder/src/main/resources/documentation/images/image60.png new file mode 100644 index 000000000..7ff2fc48e Binary files /dev/null and b/builder/src/main/resources/documentation/images/image60.png differ diff --git a/builder/src/main/resources/documentation/images/image61.png b/builder/src/main/resources/documentation/images/image61.png new file mode 100644 index 000000000..738953f19 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image61.png differ diff --git a/builder/src/main/resources/documentation/images/image62.png b/builder/src/main/resources/documentation/images/image62.png new file mode 100644 index 000000000..c1b90009a Binary files /dev/null and b/builder/src/main/resources/documentation/images/image62.png differ diff --git a/builder/src/main/resources/documentation/images/image63.png b/builder/src/main/resources/documentation/images/image63.png new file mode 100644 index 000000000..a4144809b Binary files /dev/null and b/builder/src/main/resources/documentation/images/image63.png differ diff --git a/builder/src/main/resources/documentation/images/image64.png b/builder/src/main/resources/documentation/images/image64.png new file mode 100644 index 000000000..fda5be861 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image64.png differ diff --git a/builder/src/main/resources/documentation/images/image65.png b/builder/src/main/resources/documentation/images/image65.png new file mode 100644 index 000000000..a98ce6927 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image65.png differ diff --git a/builder/src/main/resources/documentation/images/image66.png b/builder/src/main/resources/documentation/images/image66.png new file mode 100644 index 000000000..bf15c877d Binary files /dev/null and b/builder/src/main/resources/documentation/images/image66.png differ diff --git a/builder/src/main/resources/documentation/images/image67.png b/builder/src/main/resources/documentation/images/image67.png new file mode 100644 index 000000000..84b1d8390 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image67.png differ diff --git a/builder/src/main/resources/documentation/images/image68.png b/builder/src/main/resources/documentation/images/image68.png new file mode 100644 index 000000000..17495f1a6 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image68.png differ diff --git a/builder/src/main/resources/documentation/images/image69.png b/builder/src/main/resources/documentation/images/image69.png new file mode 100644 index 000000000..51c823b89 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image69.png differ diff --git a/builder/src/main/resources/documentation/images/image7.png b/builder/src/main/resources/documentation/images/image7.png new file mode 100644 index 000000000..525a76eb2 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image7.png differ diff --git a/builder/src/main/resources/documentation/images/image70.png b/builder/src/main/resources/documentation/images/image70.png new file mode 100644 index 000000000..01edcc7bb Binary files /dev/null and b/builder/src/main/resources/documentation/images/image70.png differ diff --git a/builder/src/main/resources/documentation/images/image71.png b/builder/src/main/resources/documentation/images/image71.png new file mode 100644 index 000000000..2c0cc778b Binary files /dev/null and b/builder/src/main/resources/documentation/images/image71.png differ diff --git a/builder/src/main/resources/documentation/images/image72.png b/builder/src/main/resources/documentation/images/image72.png new file mode 100644 index 000000000..93e610124 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image72.png differ diff --git a/builder/src/main/resources/documentation/images/image73.png b/builder/src/main/resources/documentation/images/image73.png new file mode 100644 index 000000000..0c94ed24e Binary files /dev/null and b/builder/src/main/resources/documentation/images/image73.png differ diff --git a/builder/src/main/resources/documentation/images/image74.png b/builder/src/main/resources/documentation/images/image74.png new file mode 100644 index 000000000..7a995947b Binary files /dev/null and b/builder/src/main/resources/documentation/images/image74.png differ diff --git a/builder/src/main/resources/documentation/images/image75.png b/builder/src/main/resources/documentation/images/image75.png new file mode 100644 index 000000000..720a797b7 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image75.png differ diff --git a/builder/src/main/resources/documentation/images/image76.png b/builder/src/main/resources/documentation/images/image76.png new file mode 100644 index 000000000..65ecb8bd8 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image76.png differ diff --git a/builder/src/main/resources/documentation/images/image77.png b/builder/src/main/resources/documentation/images/image77.png new file mode 100644 index 000000000..dc6e7287e Binary files /dev/null and b/builder/src/main/resources/documentation/images/image77.png differ diff --git a/builder/src/main/resources/documentation/images/image78.png b/builder/src/main/resources/documentation/images/image78.png new file mode 100644 index 000000000..cb8932ce3 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image78.png differ diff --git a/builder/src/main/resources/documentation/images/image79.png b/builder/src/main/resources/documentation/images/image79.png new file mode 100644 index 000000000..a76ca7e58 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image79.png differ diff --git a/builder/src/main/resources/documentation/images/image8.png b/builder/src/main/resources/documentation/images/image8.png new file mode 100644 index 000000000..7b4e725da Binary files /dev/null and b/builder/src/main/resources/documentation/images/image8.png differ diff --git a/builder/src/main/resources/documentation/images/image80.png b/builder/src/main/resources/documentation/images/image80.png new file mode 100644 index 000000000..7fd3bb38b Binary files /dev/null and b/builder/src/main/resources/documentation/images/image80.png differ diff --git a/builder/src/main/resources/documentation/images/image81.png b/builder/src/main/resources/documentation/images/image81.png new file mode 100644 index 000000000..a727bc51b Binary files /dev/null and b/builder/src/main/resources/documentation/images/image81.png differ diff --git a/builder/src/main/resources/documentation/images/image82.png b/builder/src/main/resources/documentation/images/image82.png new file mode 100644 index 000000000..dc32ed81f Binary files /dev/null and b/builder/src/main/resources/documentation/images/image82.png differ diff --git a/builder/src/main/resources/documentation/images/image83.png b/builder/src/main/resources/documentation/images/image83.png new file mode 100644 index 000000000..96f1b551d Binary files /dev/null and b/builder/src/main/resources/documentation/images/image83.png differ diff --git a/builder/src/main/resources/documentation/images/image84.png b/builder/src/main/resources/documentation/images/image84.png new file mode 100644 index 000000000..42211582f Binary files /dev/null and b/builder/src/main/resources/documentation/images/image84.png differ diff --git a/builder/src/main/resources/documentation/images/image85.png b/builder/src/main/resources/documentation/images/image85.png new file mode 100644 index 000000000..4b707f0ad Binary files /dev/null and b/builder/src/main/resources/documentation/images/image85.png differ diff --git a/builder/src/main/resources/documentation/images/image86.png b/builder/src/main/resources/documentation/images/image86.png new file mode 100644 index 000000000..e637c06be Binary files /dev/null and b/builder/src/main/resources/documentation/images/image86.png differ diff --git a/builder/src/main/resources/documentation/images/image87.png b/builder/src/main/resources/documentation/images/image87.png new file mode 100644 index 000000000..1b1cfe9d8 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image87.png differ diff --git a/builder/src/main/resources/documentation/images/image88.png b/builder/src/main/resources/documentation/images/image88.png new file mode 100644 index 000000000..563efb7a8 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image88.png differ diff --git a/builder/src/main/resources/documentation/images/image89.png b/builder/src/main/resources/documentation/images/image89.png new file mode 100644 index 000000000..d1357b62a Binary files /dev/null and b/builder/src/main/resources/documentation/images/image89.png differ diff --git a/builder/src/main/resources/documentation/images/image9.png b/builder/src/main/resources/documentation/images/image9.png new file mode 100644 index 000000000..76d79f4f0 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image9.png differ diff --git a/builder/src/main/resources/documentation/images/image90.png b/builder/src/main/resources/documentation/images/image90.png new file mode 100644 index 000000000..bfe5dfecf Binary files /dev/null and b/builder/src/main/resources/documentation/images/image90.png differ diff --git a/builder/src/main/resources/documentation/images/image91.png b/builder/src/main/resources/documentation/images/image91.png new file mode 100644 index 000000000..ffbe18991 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image91.png differ diff --git a/builder/src/main/resources/documentation/images/image92.png b/builder/src/main/resources/documentation/images/image92.png new file mode 100644 index 000000000..9d70bc8c4 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image92.png differ diff --git a/builder/src/main/resources/documentation/images/image93.png b/builder/src/main/resources/documentation/images/image93.png new file mode 100644 index 000000000..ac10ec08c Binary files /dev/null and b/builder/src/main/resources/documentation/images/image93.png differ diff --git a/builder/src/main/resources/documentation/images/image94.png b/builder/src/main/resources/documentation/images/image94.png new file mode 100644 index 000000000..790e27aef Binary files /dev/null and b/builder/src/main/resources/documentation/images/image94.png differ diff --git a/builder/src/main/resources/documentation/images/image95.png b/builder/src/main/resources/documentation/images/image95.png new file mode 100644 index 000000000..905de1bfa Binary files /dev/null and b/builder/src/main/resources/documentation/images/image95.png differ diff --git a/builder/src/main/resources/documentation/images/image96.png b/builder/src/main/resources/documentation/images/image96.png new file mode 100644 index 000000000..524a27dde Binary files /dev/null and b/builder/src/main/resources/documentation/images/image96.png differ diff --git a/builder/src/main/resources/documentation/images/image97.png b/builder/src/main/resources/documentation/images/image97.png new file mode 100644 index 000000000..eadee2731 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image97.png differ diff --git a/builder/src/main/resources/documentation/images/image98.png b/builder/src/main/resources/documentation/images/image98.png new file mode 100644 index 000000000..b6dbe14f4 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image98.png differ diff --git a/builder/src/main/resources/documentation/images/image99.png b/builder/src/main/resources/documentation/images/image99.png new file mode 100644 index 000000000..193341219 Binary files /dev/null and b/builder/src/main/resources/documentation/images/image99.png differ diff --git a/pom.xml b/pom.xml index 0afa12754..8c646a249 100644 --- a/pom.xml +++ b/pom.xml @@ -6,21 +6,23 @@ profi-pom fr.proline - 1.0.0 + 1.1.0 prolinestudio-parent - 2.1.2 + 2.2.0 pom ProlineStudio-parent - prolinestudio-corewrapper prolinestudio-logger - branding - application prolinestudio-commons + prolinestudio-corewrapper + + + prolinestudio-dam prolinestudio-resultexplorer prolinestudio-dpm @@ -29,7 +31,6 @@ - RELEASE801 prolinestudio @@ -47,64 +48,27 @@
- - - - org.codehaus.mojo - nbm-maven-plugin - 3.7 - true - - ${brandingToken} - ${brandingToken} - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - 1.8 - 1.8 - 1.8 - false - - - - - - - maven-release-plugin - 2.5.2 - - - javasvn - - - - - com.google.code.maven-scm-provider-svnjava - maven-scm-provider-svnjava - 2.1.1 - compile - - - - - + + + + org.apache.maven.plugins + maven-surefire-plugin + + + false + true + -Xmx1024m -Xmx4096m -XX:-UseGCOverheadLimit + + + + + + + maven-release-plugin + + + \ No newline at end of file diff --git a/prolinestudio-R/pom.xml b/prolinestudio-R/pom.xml index d4056005b..f95adb245 100644 --- a/prolinestudio-R/pom.xml +++ b/prolinestudio-R/pom.xml @@ -4,12 +4,12 @@ prolinestudio-parent fr.proline - 2.1.2 + 2.2.0 prolinestudio-R - nbm + jar ProlineStudio-R @@ -44,12 +44,7 @@ - - org.netbeans.api - org-netbeans-modules-settings - ${netbeans.version} - jar - + ${project.groupId} @@ -73,35 +68,15 @@ ${project.groupId} prolinestudio-logger ${project.version} + pom ${project.groupId} prolinestudio-commons ${project.version} - - org.netbeans.api - org-openide-util - ${netbeans.version} - nbm - - - org.netbeans.api - org-netbeans-api-annotations-common - ${netbeans.version} - nbm - - - org.netbeans.api - org-openide-awt - ${netbeans.version} - - - org.netbeans.api - org-openide-windows - ${netbeans.version} - nbm - + + ${project.groupId} prolinestudio-dpm @@ -112,12 +87,7 @@ prolinestudio-dam ${project.version} - - org.netbeans.api - org-openide-modules - ${netbeans.version} - nbm - + org.slf4j @@ -165,30 +135,22 @@ - - + + - org.codehaus.mojo - nbm-maven-plugin - true - - - fr.proline.studio.calc - fr.proline.studio.python.data - fr.proline.studio.python.interpreter - fr.proline.studio.python.math - fr.proline.studio.python.model - fr.proline.studio.python.util - fr.proline.studio.rserver - fr.proline.studio.rserver.dialog - fr.proline.studio.types - org.python.core - - + com.google.code.maven-replacer-plugin + replacer + + + + + + + diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/data/Col.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/data/Col.java index 7fb5f156e..2b0b6c1dd 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/data/Col.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/data/Col.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.data; import fr.proline.studio.python.util.Conversion; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/data/ColBooleanData.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/data/ColBooleanData.java index 21af33b16..53b4bc84b 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/data/ColBooleanData.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/data/ColBooleanData.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.data; import java.util.ArrayList; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/data/ColDoubleData.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/data/ColDoubleData.java index ea3691fea..224f9761a 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/data/ColDoubleData.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/data/ColDoubleData.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.data; import fr.proline.studio.python.util.Conversion; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/data/ColRef.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/data/ColRef.java index 7bfa793bd..3d8f1bc6f 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/data/ColRef.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/data/ColRef.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.data; import fr.proline.studio.python.util.Conversion; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/data/PythonImage.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/data/PythonImage.java index 9fe32fe87..3ab4b16e2 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/data/PythonImage.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/data/PythonImage.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.data; import java.awt.image.BufferedImage; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/data/Table.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/data/Table.java index 1aeec4cd8..f3ace6612 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/data/Table.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/data/Table.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.data; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcCallback.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcCallback.java index e0fb47f92..709b0c4f5 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcCallback.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,17 +14,17 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.python.interpreter; - -import java.util.ArrayList; - -/** - * - * Callback used to return results after a calculation - * - * @author JM235353 - */ -public abstract class CalcCallback { - - public abstract void run(ArrayList variables, CalcError error); -} +package fr.proline.studio.python.interpreter; + +import java.util.ArrayList; + +/** + * + * Callback used to return results after a calculation + * + * @author JM235353 + */ +public abstract class CalcCallback { + + public abstract void run(ArrayList variables, CalcError error); +} diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcError.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcError.java index c8c11d80a..883ab0763 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcError.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcError.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.interpreter; import java.io.PrintWriter; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcInterpreterTask.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcInterpreterTask.java index 133d5b6c8..e38062e0c 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcInterpreterTask.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcInterpreterTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.interpreter; /** diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcInterpreterThread.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcInterpreterThread.java index 603aa8f16..78f0f9e21 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcInterpreterThread.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/CalcInterpreterThread.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.interpreter; import fr.proline.studio.python.data.ColBooleanData; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/ResultVariable.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/ResultVariable.java index 97d5973b2..d72d8ec11 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/ResultVariable.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/interpreter/ResultVariable.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.interpreter; import fr.proline.studio.python.data.ColBooleanData; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/math/Stats.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/math/Stats.java index 6de9285ab..5bc42dcbb 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/math/Stats.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/math/Stats.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.math; import fr.proline.studio.python.data.Col; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/math/StatsImplementation.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/math/StatsImplementation.java index b873c3a80..0d523ae3f 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/math/StatsImplementation.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/math/StatsImplementation.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.math; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/math/StatsRImplementation.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/math/StatsRImplementation.java index 2eb70b75c..db6a1e603 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/math/StatsRImplementation.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/math/StatsRImplementation.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.math; import fr.proline.studio.graphics.PlotType; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/math/StatsUtil.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/math/StatsUtil.java index 5eda5fc54..5a841d125 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/math/StatsUtil.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/math/StatsUtil.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.math; import fr.proline.studio.python.data.Col; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/model/ExprTableModel.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/model/ExprTableModel.java index f40ca4df2..dcac0b7d9 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/model/ExprTableModel.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/model/ExprTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.model; import fr.proline.studio.extendedtablemodel.ExtraDataType; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/model/FilterColumnTableModel.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/model/FilterColumnTableModel.java index 987c82dcc..84c510cbf 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/model/FilterColumnTableModel.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/model/FilterColumnTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.model; import fr.proline.studio.extendedtablemodel.ExtraDataType; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/model/QuantiFilterModel.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/model/QuantiFilterModel.java index ff2af2b2f..d77420cbc 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/model/QuantiFilterModel.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/model/QuantiFilterModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/model/ValuesTableModel.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/model/ValuesTableModel.java index e58d7cda9..9921244cd 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/model/ValuesTableModel.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/model/ValuesTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.model; import fr.proline.studio.extendedtablemodel.ExtraDataType; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/python/util/Conversion.java b/prolinestudio-R/src/main/java/fr/proline/studio/python/util/Conversion.java index 88de9830b..bc4308cc7 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/python/util/Conversion.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/python/util/Conversion.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.python.util; import fr.proline.studio.table.LazyData; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/rserver/RServerManager.java b/prolinestudio-R/src/main/java/fr/proline/studio/rserver/RServerManager.java index feacd0bdf..1ea262531 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/rserver/RServerManager.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/rserver/RServerManager.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,8 +16,10 @@ */ package fr.proline.studio.rserver; +import fr.proline.studio.NbPreferences; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dock.gui.InfoLabel; import fr.proline.studio.python.math.StatsUtil; -import fr.proline.studio.utils.StudioExceptions; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -30,7 +32,6 @@ import java.io.PrintWriter; import java.util.prefs.Preferences; import javax.swing.SwingUtilities; -import org.openide.util.NbPreferences; import org.rosuda.REngine.REXP; import org.rosuda.REngine.REXPMismatchException; import org.rosuda.REngine.REngineException; @@ -74,7 +75,7 @@ public synchronized static RServerManager getRServerManager() { public synchronized boolean startRProcessWithRetry() throws Exception { LoggerFactory.getLogger("ProlineStudio.R").info("startRProcessWithRetry()"); - + boolean RStarted = false; try { @@ -100,7 +101,7 @@ public synchronized boolean startRProcessWithRetry() throws Exception { if (RStarted && !isConnected()) { // R has started, but we can not connect correctly LoggerFactory.getLogger("ProlineStudio.R").info("startRProcessWithRetry() : R has started, but we can not connect correctly"); - + stopRProcess(); Thread.sleep(5000); RStarted = startRProcess(); @@ -119,14 +120,14 @@ private boolean startRProcess() throws Exception { if (m_RProcess != null) { LoggerFactory.getLogger("ProlineStudio.R").info("startRProcess() : Process already exists"); - + return true; } // process can have been created outside if (isConnected()) { LoggerFactory.getLogger("ProlineStudio.R").info("startRProcess() : Process created outside"); - + return true; } @@ -146,7 +147,7 @@ private boolean startRProcess() throws Exception { File f = null; LoggerFactory.getLogger("ProlineStudio.R").info("startRProcess() : Try to find R.exe if the path is defined in the RServerExePath key of the preference file"); - + // try to read R.exe path potentially defined in Properties file (saved in key "RServerExePath" ) Preferences preferences = NbPreferences.root(); String pathToExe = preferences.get("RServerExePath", null); @@ -165,13 +166,13 @@ private boolean startRProcess() throws Exception { // if R.exe path is not defined in Preferences file, we read it in default application path if (f == null) { LoggerFactory.getLogger("ProlineStudio.R").info("startRProcess() : Try to find R.exe in the path"); - + f = new File("."); pathToExe = f.getCanonicalPath() + File.separatorChar + "R" + File.separatorChar + "bin" + File.separatorChar + "R.exe"; f = new File(pathToExe); if (!f.exists()) { LoggerFactory.getLogger("ProlineStudio.R").error("R.exe not found: " + pathToExe); - StudioExceptions.notify("R.exe not found", new FileNotFoundException(pathToExe)); + WindowManager.getDefault().getMainWindow().alert(InfoLabel.INFO_LEVEL.ERROR, "R.exe not found", new FileNotFoundException(pathToExe)); return false; } } @@ -183,8 +184,8 @@ private boolean startRProcess() throws Exception { if (operatingSystem != null && operatingSystem.startsWith("Windows")) { LoggerFactory.getLogger("ProlineStudio.R").info("startRProcess() : Windows system, start R.exe"); - - + + String[] cmds = {pathToExe, "-e", "\"library(Rserve);Rserve(TRUE,args='--no-save')\"", "--no-save"}; //String[] cmds = {pathToExe, "-e", "\"library(Rserve);Rserve(TRUE,args='--no-save --slave')\"", "--no-save", "--slave"}; m_RProcess = Runtime.getRuntime().exec(cmds); @@ -204,7 +205,8 @@ private boolean startRProcess() throws Exception { // linux and MacIntosh ? LoggerFactory.getLogger("ProlineStudio.R").error("R Server not available for Linux or MacIntosh"); - StudioExceptions.notify("R Server not available for Linux or MacIntosh", new FileNotFoundException()); + WindowManager.getDefault().getMainWindow().alert(InfoLabel.INFO_LEVEL.ERROR, "R Server not available for Linux or MacIntosh", new FileNotFoundException()); + return false; // linux //command = "echo \"" + todo + "\"|" + cmd + " " + rargs; @@ -300,12 +302,9 @@ public RConnection connect(String host, int port, String user, String password, } catch (RserveException e) { if (log) { - LoggerFactory.getLogger("ProlineStudio.R").error("connect() failed", e); - - StudioExceptions.notify(e.getMessage(), e); - } else { - LoggerFactory.getLogger("ProlineStudio.R").info("connect() , no existing R Server found to connect"); - + LoggerFactory.getLogger("ProlineStudio.Commons").error(getClass().getSimpleName() + " failed", e); + WindowManager.getDefault().getMainWindow().alert(InfoLabel.INFO_LEVEL.ERROR, e); + } m_connection = null; throw new RServerException(e.getMessage()); diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/rserver/dialog/ImageViewerTopComponent.java b/prolinestudio-R/src/main/java/fr/proline/studio/rserver/dialog/ImageViewerTopComponent.java index 17ab52369..c4e6dce67 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/rserver/dialog/ImageViewerTopComponent.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/rserver/dialog/ImageViewerTopComponent.java @@ -1,21 +1,22 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rserver.dialog; +import fr.proline.studio.dock.AbstractTopPanel; import fr.proline.studio.export.ExportButton; import fr.proline.studio.gui.HourglassPanel; import fr.proline.studio.utils.IconManager; @@ -23,7 +24,6 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JToolBar; -import org.openide.windows.TopComponent; /** * @@ -31,7 +31,7 @@ * * @author JM235353 */ -public class ImageViewerTopComponent extends TopComponent { +public class ImageViewerTopComponent extends AbstractTopPanel { public ImageViewerTopComponent(String name, Image img) { @@ -48,10 +48,30 @@ public ImageViewerTopComponent(String name, Image img) { } @Override + public String getTopPanelIdentifierKey() { + return null; + } + public Image getIcon() { return IconManager.getImage(IconManager.IconType.WAVE); } + @Override + public String getTitle() { + return getName(); + } + + @Override + protected void componentOpened() { + // nothing to do + } + + @Override + public void componentClosed() { + // nothing to do + } + + public class ImagePanel extends HourglassPanel { private Dimension m_dimension = null; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/types/GroupSelection.java b/prolinestudio-R/src/main/java/fr/proline/studio/types/GroupSelection.java index 6c501c7b7..15b6179d9 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/types/GroupSelection.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/types/GroupSelection.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.types; import java.util.ArrayList; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/types/LogInfo.java b/prolinestudio-R/src/main/java/fr/proline/studio/types/LogInfo.java index 1ed0f5320..ba5379860 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/types/LogInfo.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/types/LogInfo.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.types; /** diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/types/LogRatio.java b/prolinestudio-R/src/main/java/fr/proline/studio/types/LogRatio.java index cbd5435ed..f745223c6 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/types/LogRatio.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/types/LogRatio.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,14 +14,14 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.types; - -/** - * Class used to add information to a Table Model in the Data Analyzer - * This class corresponds to a TAG to know if the column corresponds to a Log Ratio - * - * @author JM235353 - */ -public class LogRatio { - -} +package fr.proline.studio.types; + +/** + * Class used to add information to a Table Model in the Data Analyzer + * This class corresponds to a TAG to know if the column corresponds to a Log Ratio + * + * @author JM235353 + */ +public class LogRatio { + +} diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/types/PValue.java b/prolinestudio-R/src/main/java/fr/proline/studio/types/PValue.java index e28dcbc01..d82561a02 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/types/PValue.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/types/PValue.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,14 +14,14 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.types; - -/** - * Class used to add information to a Table Model in the Data Analyzer - * This class corresponds to a TAG to know if the column corresponds to a PValue - * - * @author JM235353 - */ -public class PValue { - -} +package fr.proline.studio.types; + +/** + * Class used to add information to a Table Model in the Data Analyzer + * This class corresponds to a TAG to know if the column corresponds to a PValue + * + * @author JM235353 + */ +public class PValue { + +} diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/types/PvalueAdjusted.java b/prolinestudio-R/src/main/java/fr/proline/studio/types/PvalueAdjusted.java index 009c0d50a..f8f8fd153 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/types/PvalueAdjusted.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/types/PvalueAdjusted.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,14 +14,14 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.types; - -/** - * Class used to add information to a Table Model in the Data Analyzer - * This class corresponds to a TAG to know if the column corresponds to an Adjusted PValue - * - * @author JM235353 - */ -public class PvalueAdjusted { - -} +package fr.proline.studio.types; + +/** + * Class used to add information to a Table Model in the Data Analyzer + * This class corresponds to a TAG to know if the column corresponds to an Adjusted PValue + * + * @author JM235353 + */ +public class PvalueAdjusted { + +} diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/types/QuantitationType.java b/prolinestudio-R/src/main/java/fr/proline/studio/types/QuantitationType.java index 4c1c2eba0..ad8ecff03 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/types/QuantitationType.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/types/QuantitationType.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.types; diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/types/XicGroup.java b/prolinestudio-R/src/main/java/fr/proline/studio/types/XicGroup.java index 4c0810a6e..246345312 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/types/XicGroup.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/types/XicGroup.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.types; /** diff --git a/prolinestudio-R/src/main/java/fr/proline/studio/types/XicMode.java b/prolinestudio-R/src/main/java/fr/proline/studio/types/XicMode.java index 21743e867..a7285ff93 100644 --- a/prolinestudio-R/src/main/java/fr/proline/studio/types/XicMode.java +++ b/prolinestudio-R/src/main/java/fr/proline/studio/types/XicMode.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.types; /** diff --git a/prolinestudio-commons/pom.xml b/prolinestudio-commons/pom.xml index b7c8a682d..51558f849 100644 --- a/prolinestudio-commons/pom.xml +++ b/prolinestudio-commons/pom.xml @@ -5,15 +5,17 @@ prolinestudio-parent fr.proline - 2.1.2 + 2.2.0 + fr.proline prolinestudio-commons - nbm + jar ProlineStudio-Commons + ${project.basedir}/src/main/java/fr/proline/studio/ UTF-8 @@ -30,29 +32,8 @@ --> - - - org.netbeans.api - org-openide-util - ${netbeans.version} - - - org.netbeans.api - org-openide-awt - ${netbeans.version} - - - org.netbeans.api - org-openide-windows - ${netbeans.version} - jar - - - org.netbeans.api - org-openide-nodes - ${netbeans.version} - nbm - + + com.google.code.gson gson @@ -68,6 +49,7 @@ ${project.groupId} prolinestudio-logger ${project.version} + pom @@ -106,92 +88,48 @@ commons-math3 jar + + junit + junit + 4.12 + - - - - - org.codehaus.mojo - nbm-maven-plugin - true - - - addargs - - run-platform - - - java.library.path=${project.build.directory}/bin - - - - - - com.thierry.filtering - com.thierry.filtering.report - fr.proline.studio.* - fr.proline.util - javax.xml.parsers - javax.xml.transform - javax.xml.transform.dom - javax.xml.transform.stream - org.jdesktop.beans - org.jdesktop.swingx.* - org.rosuda.REngine - org.rosuda.REngine.Rserve - org.rosuda.REngine.Rserve.protocol - - org.xml.sax - org.xml.sax.ext - org.xml.sax.helpers - javax.xml.stream.* - javax.xml.stream.events.* - javax.xml.* - org.dom4j.* - com.fasterxml.jackson.* - org.apache.commons.lang.* - - - + - - copy-dll - compile - - copy-dependencies - + java-version-generation + generate-sources - ${project.build.directory}/bin - dll,exe - true - false - false - true + false + + ${version.path}/JavaVersion.java.template + ${version.path}/JavaVersion.java + + + _moduleName_ + ${project.name} + + + _version_ + ${project.version}_${maven.build.timestamp}_${user.name} + + + - --> - + + diff --git a/prolinestudio-commons/src/main/java/com/thierry/filtering/ColorUtil.java b/prolinestudio-commons/src/main/java/com/thierry/filtering/ColorUtil.java index c4a73342a..d08023803 100644 --- a/prolinestudio-commons/src/main/java/com/thierry/filtering/ColorUtil.java +++ b/prolinestudio-commons/src/main/java/com/thierry/filtering/ColorUtil.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package com.thierry.filtering; import java.awt.Color; diff --git a/prolinestudio-commons/src/main/java/com/thierry/filtering/TableSelection.java b/prolinestudio-commons/src/main/java/com/thierry/filtering/TableSelection.java index f0329ccad..a48382fa1 100644 --- a/prolinestudio-commons/src/main/java/com/thierry/filtering/TableSelection.java +++ b/prolinestudio-commons/src/main/java/com/thierry/filtering/TableSelection.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package com.thierry.filtering; import java.awt.Toolkit; diff --git a/prolinestudio-commons/src/main/java/com/thierry/filtering/report/HTMLReportBuilder.java b/prolinestudio-commons/src/main/java/com/thierry/filtering/report/HTMLReportBuilder.java index 66efc7b1c..bbcd99a59 100644 --- a/prolinestudio-commons/src/main/java/com/thierry/filtering/report/HTMLReportBuilder.java +++ b/prolinestudio-commons/src/main/java/com/thierry/filtering/report/HTMLReportBuilder.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package com.thierry.filtering.report; import java.awt.Color; diff --git a/prolinestudio-commons/src/main/java/com/thierry/filtering/report/ReportBuilder.java b/prolinestudio-commons/src/main/java/com/thierry/filtering/report/ReportBuilder.java index 03443bbca..ec31db391 100644 --- a/prolinestudio-commons/src/main/java/com/thierry/filtering/report/ReportBuilder.java +++ b/prolinestudio-commons/src/main/java/com/thierry/filtering/report/ReportBuilder.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package com.thierry.filtering.report; import java.awt.Color; diff --git a/prolinestudio-commons/src/main/java/com/thierry/filtering/report/TableReportGenerator.java b/prolinestudio-commons/src/main/java/com/thierry/filtering/report/TableReportGenerator.java index 668472f9c..072a24d15 100644 --- a/prolinestudio-commons/src/main/java/com/thierry/filtering/report/TableReportGenerator.java +++ b/prolinestudio-commons/src/main/java/com/thierry/filtering/report/TableReportGenerator.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package com.thierry.filtering.report; import java.awt.Color; diff --git a/prolinestudio-commons/src/main/java/com/thierry/filtering/report/TextReportBuilder.java b/prolinestudio-commons/src/main/java/com/thierry/filtering/report/TextReportBuilder.java index d1edaab34..eafe3de6c 100644 --- a/prolinestudio-commons/src/main/java/com/thierry/filtering/report/TextReportBuilder.java +++ b/prolinestudio-commons/src/main/java/com/thierry/filtering/report/TextReportBuilder.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package com.thierry.filtering.report; import java.awt.Color; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/Exceptions.java b/prolinestudio-commons/src/main/java/fr/proline/studio/Exceptions.java new file mode 100644 index 000000000..11ae42e8e --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/Exceptions.java @@ -0,0 +1,12 @@ +package fr.proline.studio; + +import fr.proline.studio.dock.gui.InfoLabel; +import org.slf4j.LoggerFactory; + +public class Exceptions { + + public static void printStackTrace(Throwable t) { + LoggerFactory.getLogger("ProlineStudio.Commons").error(t.getMessage(), t); + WindowManager.getDefault().getMainWindow().alert(InfoLabel.INFO_LEVEL.ERROR, t); + } +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/ImageUtilities.java b/prolinestudio-commons/src/main/java/fr/proline/studio/ImageUtilities.java new file mode 100644 index 000000000..a044b85ae --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/ImageUtilities.java @@ -0,0 +1,29 @@ +package fr.proline.studio; + +import javax.imageio.ImageIO; +import javax.swing.*; +import java.awt.*; +import java.io.IOException; + +public class ImageUtilities { + + public static ImageIcon loadImageIcon(String path, boolean b) { + try { + return new ImageIcon(ImageIO.read(ClassLoader.getSystemResource(path))); + } catch (IOException e) { + + } + return null; + } + + public static Image loadImage(String path, boolean b) { + try { + return ImageIO.read(ClassLoader.getSystemResource(path)); + } catch (IOException e) { + + } + return null; + } + + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/JavaVersion.java.template b/prolinestudio-commons/src/main/java/fr/proline/studio/JavaVersion.java.template new file mode 100644 index 000000000..fb5735980 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/JavaVersion.java.template @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio; + + +public class JavaVersion { + + private static String moduleName = "_moduleName_"; + private static String version = "_version_"; + + private static String m_productVersion = null; + private static String m_productDate = null; + private static String m_milestoneVersion = null; + private static boolean m_isMilestone; + + public static String getProductVersion() { + decodeVersion(); + return m_productVersion; + } + + public static boolean isMileStoneVersion(){ + decodeVersion(); + return m_isMilestone; + } + + public static String getMilestoneProductVersion() { + decodeVersion(); + return m_milestoneVersion; + } + + public static String getProductDate() { + decodeVersion(); + return m_productDate; + } + + private static void decodeVersion() { + if (m_productVersion != null) { + // already decoded + return; + } + + String tmp = version; + m_productVersion = ""; + m_productDate = ""; + + // look for productVersion and Milestone status + m_isMilestone = version.contains("SNAPSHOT"); + int index = -1; + if(m_isMilestone){ + index = tmp.indexOf("SNAPSHOT")+8; + } else { + index = tmp.indexOf(('_')); + } + + if (index != -1) { + m_productVersion = tmp.substring(0, index); + tmp = tmp.substring(index + 1); + } + + index = tmp.indexOf('T'); + if (index != -1) { + m_productDate = tmp.substring(0, index); + } + + if(m_isMilestone){ + index = m_productVersion.indexOf(('-')); + if (index != -1) { + m_milestoneVersion = m_productVersion.substring(0, index)+" Milestone "+m_productDate; + } else + m_milestoneVersion = m_productVersion; + } + + } + + + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/NbPreferences.java b/prolinestudio-commons/src/main/java/fr/proline/studio/NbPreferences.java new file mode 100644 index 000000000..6d935b397 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/NbPreferences.java @@ -0,0 +1,79 @@ +package fr.proline.studio; + +import fr.proline.studio.settings.FilePreferences; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.prefs.Preferences; + +public class NbPreferences { + + protected static final Logger logger = LoggerFactory.getLogger("ProlineStudio.Commons"); + + private static FilePreferences m_preferences; + + public static Preferences root() { + + if (m_preferences == null) { + initPreferences(null); + } + + return m_preferences; + } + + public static void initPreferences(String path) { + + if (path == null) { + path = getUserHome()+File.separator+"Preferences.properties"; // by default Preferences.properties is saved in the local directory of the application + } else { + path = path+File.separator+"Preferences.properties"; + } + + m_preferences = new FilePreferences(new File(path), null, ""); + } + + + private static String getUserHome() { + + String userHome = null; + + String OS = System.getProperty("os.name").toLowerCase(); + if (OS.contains("win")) + { + //it is simply the location of the "AppData" folder + userHome = System.getenv("AppData"); + } else { // linux or Mac + + userHome = System.getProperty("user.home"); + + //if we are on a Mac, we are not done, we look for "Application Support" + if (OS.contains("mac")) { + userHome += "/Library/Application Support"; + } + } + + if (userHome != null) { + userHome = userHome +File.separator+".prolinestudio"+File.separator+"dev"+File.separator+"config"; + Path path = Paths.get(userHome); + try { + Files.createDirectories(path); + } catch (IOException ie) { + logger.warn("Impossible to create user directory: "+userHome); + } + + } + + if (userHome == null) { + // should not happen + userHome = "./"; + } + + return userHome; + } + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/Property.java b/prolinestudio-commons/src/main/java/fr/proline/studio/Property.java new file mode 100644 index 000000000..137f335dc --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/Property.java @@ -0,0 +1,24 @@ +package fr.proline.studio; + +public class Property { + + protected String m_key; + + protected String m_propName; + protected Class m_class; + protected Object m_value; + + public Property() { + + } + public Property(String propNameKey, String propName, Class c, Object value) { + m_key = propNameKey; + m_class = c; + m_propName = propName; + m_value = value; + } + + public String getKey() { + return m_key; + } +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/PropertySupport.java b/prolinestudio-commons/src/main/java/fr/proline/studio/PropertySupport.java new file mode 100644 index 000000000..c12dd3941 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/PropertySupport.java @@ -0,0 +1,20 @@ +package fr.proline.studio; + +import java.lang.reflect.InvocationTargetException; + +public class PropertySupport { + + + public static abstract class ReadOnly extends Property { + + + + public ReadOnly(String propNameKey, Class c, String propName, Object value) { + m_key = propNameKey; + m_class = c; + m_propName = propName; + m_value = value; + } + public abstract Object getValue() throws InvocationTargetException; + } +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/WindowManager.java b/prolinestudio-commons/src/main/java/fr/proline/studio/WindowManager.java new file mode 100644 index 000000000..843a40715 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/WindowManager.java @@ -0,0 +1,33 @@ +package fr.proline.studio; + +import fr.proline.studio.dock.AbstractDockFrame; + +import javax.swing.*; +import java.awt.event.ActionListener; + +public class WindowManager { + + private static WindowManager m_singleton = null; + + private AbstractDockFrame m_frame; + + private WindowManager() { + + } + + public static WindowManager getDefault() { + if (m_singleton == null) { + m_singleton = new WindowManager(); + } + return m_singleton; + } + + public AbstractDockFrame getMainWindow() { + return m_frame; + } + + public void setMainWindow(AbstractDockFrame frame) { + m_frame = frame; + } + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/AbstractDockFrame.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/AbstractDockFrame.java new file mode 100644 index 000000000..00d325ace --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/AbstractDockFrame.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock; + + +import fr.proline.studio.dock.gui.InfoLabel; + +import javax.swing.*; +import java.util.HashSet; + +public abstract class AbstractDockFrame extends JFrame { + + public AbstractDockFrame(String title) { + super(title); + } + + public abstract void closeWindow(AbstractTopPanel topPanel); + + public abstract void displayWindow(AbstractTopPanel topPanel); + + public abstract void resetWindows(); + + public abstract void closeDataWindows(); + + public abstract boolean isDisplayed(String windowKey); + + public abstract void toFront(String windowKey); + + public abstract HashSet getTopPanels(); + + public abstract void alert(InfoLabel.INFO_LEVEL level, String message, Throwable t); + public abstract void alert(InfoLabel.INFO_LEVEL level, Throwable t); + + public abstract void addLog(); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/AbstractTopPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/AbstractTopPanel.java new file mode 100644 index 000000000..6de2cb96f --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/AbstractTopPanel.java @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock; + +import fr.proline.studio.dock.container.DockComponent; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +public abstract class AbstractTopPanel extends JPanel { + + private boolean m_openedOnce = false; + + private List m_panelListeners; + + public abstract String getTopPanelIdentifierKey(); + + public abstract Image getIcon(); + + public abstract String getTitle(); + + + public void componentAdded() { + if (m_openedOnce == false) { + m_openedOnce = true; + componentOpened(); + } + } + + public Action[] getActions(DockComponent component) { + return null; + } + + protected abstract void componentOpened(); + + public abstract void componentClosed(); + + public boolean warnBeforeClosing(){ + return false; + } + + public String getWarnClosingMessage(){ + return ""; + } + + public void addTopPanelListener(TopPanelListener listener){ + if(m_panelListeners == null) + m_panelListeners = new ArrayList<>(); + m_panelListeners.add(listener); + } + + public void removeTopPanelListener(TopPanelListener listener){ + if(m_panelListeners == null) + return; + m_panelListeners.remove(listener); + } + + public void clearTopPanelListener(){ + m_panelListeners = null; + } + + protected void fireTopPanelPropertyChange(String property){ + if(m_panelListeners != null && !m_panelListeners.isEmpty()){ + m_panelListeners.forEach( listener -> listener.propertyChanged(property)); + } + } +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/TopPanelListener.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/TopPanelListener.java new file mode 100644 index 000000000..74c14bc97 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/TopPanelListener.java @@ -0,0 +1,8 @@ +package fr.proline.studio.dock; + +public interface TopPanelListener { + + final static String TITLE_PROPERTY = "TITLE"; + + public void propertyChanged(String property); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DocContainerMinimizeZone.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DocContainerMinimizeZone.java new file mode 100644 index 000000000..979863864 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DocContainerMinimizeZone.java @@ -0,0 +1,378 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.container; + +import fr.proline.studio.dock.AbstractTopPanel; +import fr.proline.studio.dock.dragdrop.OverArea; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.geom.AffineTransform; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +public class DocContainerMinimizeZone extends DockContainerMulti implements DockReplaceInterface { + + private DockMinimizePanel m_minimizePanel; + + private DockContainerMulti m_dockContainerMulti; + + private int m_previousSplitLocation = -1; + + public DocContainerMinimizeZone() { + + m_minimizePanel = new DockMinimizePanel(this); + + JPanel containerPanel = new JPanel(new BorderLayout()); + + containerPanel.add(m_minimizePanel, BorderLayout.WEST); + + m_component = containerPanel; + + } + + public void getTopPanels(HashSet set) { + m_dockContainerMulti.getTopPanels(set); + m_minimizePanel.getTopPanels(set); + } + + @Override + public DockContainer search(String windowKey) { + + DockContainer containerSearched = m_dockContainerMulti.search(windowKey); + if (containerSearched != null) { + return containerSearched; + } + + return m_minimizePanel.search(windowKey); + } + + @Override + public DockContainer searchZoneArea(String zoneArea) { + DockContainer containerSearched = m_dockContainerMulti.searchZoneArea(zoneArea); + if (containerSearched != null) { + return containerSearched; + } + + return m_minimizePanel.searchZoneArea(zoneArea); + } + + @Override + public void findAllDockComponents(ArrayList components) { + + m_dockContainerMulti.findAllDockComponents(components); + m_minimizePanel.findAllDockComponents(components); + + } + + public void set(DockContainerMulti containerMulti) { + m_dockContainerMulti = containerMulti; + containerMulti.setParent(this); + ((JPanel) m_component).add(containerMulti.getComponent(), BorderLayout.CENTER); + } + + + public void minimize(DockContainer container) { + m_minimizePanel.add(container); + + if (m_dockContainerMulti.isEmpty()) { + m_dockContainerMulti.getComponent().setVisible(false); + + + + if (getParent() instanceof DockContainerSplit) { + m_previousSplitLocation = ((JSplitPane) ((DockContainerSplit) getParent() ).getComponent()).getDividerLocation(); + ((JSplitPane) ((DockContainerSplit) getParent() ).getComponent()).resetToPreferredSizes(); + } + } + + } + + public void putBack(DockContainer container) { + if (m_dockContainerMulti.isEmpty()) { + m_dockContainerMulti.getComponent().setVisible(true); + } + + DockContainerTab tab = searchTab(container.getLastParentId()); + if (tab == null) { + tab = searchTab(-1); + } + + tab.add((DockComponent) container); + + + if (getParent() instanceof DockContainerSplit) { + ((JSplitPane) ((DockContainerSplit) getParent() ).getComponent()).setDividerLocation(m_previousSplitLocation); + } + + } + + public void toFront(DockContainer child) { + m_minimizePanel.maximize(child); + } + + @Override + public void check() { + + } + + @Override + public void remove(DockContainer container) { + // nothing to do + } + + public boolean isEmpty() { + return false; + } + + @Override + public DockContainerTab searchTab(int idContainer) { + return m_dockContainerMulti.searchTab(idContainer); + } + + + + @Override + public OverArea getOverArea(Point pointOnScreen) { + + if (! m_dockContainerMulti.getComponent().isVisible()) { + return null; + } + return m_dockContainerMulti.getOverArea(pointOnScreen); + } + + @Override + public void replace(DockContainerMulti previous, DockContainerMulti next) { + + if (m_dockContainerMulti == previous) { + m_component.remove(previous.getComponent()); + ((JPanel) m_component).add(next.getComponent(), BorderLayout.CENTER); + + m_dockContainerMulti = next; + next.setParent(this); + + m_component.repaint(); + + } + + } + + + public class DockMinimizePanel extends JPanel { + + private DocContainerMinimizeZone m_containerMinimizeZone; + private HashMap m_componentMap = new HashMap<>(); + + public DockMinimizePanel(DocContainerMinimizeZone containerMinimizeZone) { + + m_containerMinimizeZone = containerMinimizeZone; + + setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + + setBackground(Color.white); + + setVisible(false); + } + + public void getTopPanels(HashSet set) { + + for (DockContainer c : m_componentMap.keySet()) { + c.getTopPanels(set); + } + } + + public DockContainer search(String windowKey) { + for (DockContainer c : m_componentMap.keySet()) { + DockContainer containerSearched = c.search(windowKey); + if (containerSearched != null) { + return containerSearched; + } + } + return null; + + } + + public DockContainer searchZoneArea(String zoneArea) { + for (DockContainer c : m_componentMap.keySet()) { + DockContainer containerSearched = c.search(zoneArea); + if (containerSearched != null) { + return containerSearched; + } + } + return null; + } + + public void findAllDockComponents(ArrayList components) { + for (DockContainer c : m_componentMap.keySet()) { + c.findAllDockComponents(components); + } + } + + public void add(DockContainer component) { + + MinimizedLabel l = new MinimizedLabel(this, component); + add(l); + + m_componentMap.put(component, l); + + if (!isVisible()) { + setVisible(true); + } + + revalidate(); + repaint(); + } + + public void maximize(DockContainer component) { + + JComponent l = m_componentMap.remove(component); + + remove(l); + + m_containerMinimizeZone.putBack(component); + + revalidate(); + repaint(); + } + + + } + + + public class MinimizedLabel extends JPanel implements MouseListener, DockMaximizeInterface { + + private static final int PAD = 2; + + private DockMinimizePanel m_parentPanel; + private DockContainer m_component; + + + private Font m_font = javax.swing.UIManager.getDefaults().getFont("Label.font"); + private Dimension m_preferredSize = null; + + public MinimizedLabel(DockMinimizePanel parentPanel, DockContainer component) { + + m_parentPanel = parentPanel; + m_component = component; + + ((DockComponent) component).setMaximizeInterface(this); + + addMouseListener(this); + } + + @Override + public Dimension getPreferredSize() { + if (m_preferredSize == null) { + + Icon icon = ((DockComponent)m_component).getIcon(); + String title = ((DockComponent)m_component).getTitle(); + + FontMetrics fm = m_component.getComponent().getFontMetrics(m_font); + int stringWidth = fm.stringWidth(title); + + int height = PAD*3+ ((icon !=null) ? icon.getIconWidth() : 0)+stringWidth; + int width = Math.max(20, ((icon !=null) ? icon.getIconHeight(): 0) + PAD*2); + + + + m_preferredSize = new Dimension(width,height); + } + + return m_preferredSize; + } + + @Override + public void maximize() { + ((DockComponent) m_component).setMaximizeInterface(null); + m_parentPanel.maximize(m_component); + } + + @Override + public Dimension getMaximumSize() { + return getPreferredSize(); + } + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D) g; + + //g2d.setColor(Color.blue); + //g.fillRect(0,0,getWidth(), getHeight()); + + Font oldFont = g2d.getFont(); + + g2d.setFont(m_font); + + FontMetrics fm = g2d.getFontMetrics(); + + AffineTransform previousTransform = g2d.getTransform(); + + //g2d.rotate( Math.PI / 2 ); + //g2d.translate( 0, - getWidth() ); + g2d.rotate( - Math.PI / 2 ); + g2d.translate( - getHeight(), 0 ); + + Icon icon = ((DockComponent)m_component).getIcon(); + if (icon != null) { + icon.paintIcon(this, g2d, PAD, (getWidth()-icon.getIconHeight())/2 ); //JPM.TODO + } + + String title = ((DockComponent)m_component).getTitle(); + + if (title != null) { + int textX = 2*PAD + ((icon!=null) ? icon.getIconWidth() : 0); + int textY = PAD + fm.getAscent(); + + g2d.setColor(Color.black); + g2d.drawString(title, textX, textY); + + } + + g2d.setFont(oldFont); + g2d.setTransform( previousTransform ); + } + + @Override + public void mouseClicked(MouseEvent e) { + maximize(); + } + + @Override + public void mousePressed(MouseEvent e) { + + } + + @Override + public void mouseReleased(MouseEvent e) { + + } + + @Override + public void mouseEntered(MouseEvent e) { + + } + + @Override + public void mouseExited(MouseEvent e) { + + } + } +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockComponent.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockComponent.java new file mode 100644 index 000000000..872138d40 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockComponent.java @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.container; + + +import fr.proline.studio.dock.AbstractTopPanel; +import fr.proline.studio.dock.TopPanelListener; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.HashSet; + + +public class DockComponent extends DockContainer { + + final private String m_windowKey; + private String m_title; + final private Icon m_icon; + + private DockComponentListener m_componentListener = null; + private DockMaximizeInterface m_maximizeInterface = null; + + + private int m_properties = 0; + + public static final int PROP_NONE = 0; + public static final int PROP_CLOSE = 0b01; + public static final int PROP_MINIMIZE = 0b10; + + + public DockComponent(AbstractTopPanel topPanel, int properties) { + this(topPanel.getTopPanelIdentifierKey(), topPanel.getTitle(), (topPanel.getIcon() != null) ? new ImageIcon(topPanel.getIcon()) : null, topPanel, properties); + topPanel.addTopPanelListener(this); + } + + public DockComponent(String windowKey, String title, Icon icon, JComponent component, int properties) { + m_windowKey = windowKey; + m_title = title; + m_icon = icon; + m_component = component; + m_properties = properties; + } + + public void setDockComponentListener(DockComponentListener listener) { + m_componentListener = listener; + } + + public void removeDockComponentListener() { + m_componentListener = null; + } + + public void getTopPanels(HashSet set) { + + if (m_component instanceof AbstractTopPanel) { + set.add((AbstractTopPanel) m_component); + } + + } + + // TopPanelListener + @Override + public void propertyChanged(String property) { + if(property.equals(TopPanelListener.TITLE_PROPERTY) && (m_component instanceof AbstractTopPanel) ){ + setTitle(((AbstractTopPanel) m_component).getTitle()); + } + } + + @Override + public DockContainer search(String windowKey) { + + if (m_windowKey == null) { + return null; + } + + if (m_windowKey.equals(windowKey)) { + return this; + } + + return null; + } + + @Override + public DockContainer searchZoneArea(String zoneArea) { + + if ((m_zoneArea!=null) && (m_zoneArea.equals(zoneArea))) { + return this; + } + + return null; + } + + @Override + public void findAllDockComponents(ArrayList components) { + components.add(this); + } + + @Override + public void toFront() { + getParent().toFront(this); + } + + public void maximize() { + if (m_maximizeInterface != null) { + m_maximizeInterface.maximize(); + } + } + + public void setMaximizeInterface(DockMaximizeInterface maximizeInterface) { + m_maximizeInterface = maximizeInterface; + } + + + public void addProperties(int properties) { + m_properties |= properties; + } + + public boolean canClose() { + return (PROP_CLOSE & m_properties) != 0; + } + + public boolean canMinimize() { + return (PROP_MINIMIZE & m_properties) != 0; + } + + @Override + public String getTitle() { + return m_title; + } + + public void setTitle(String title) { + m_title = title; + if (m_componentListener != null) { + m_componentListener.titleChanged(); + } + } + + public Icon getIcon() { + return null; + } + + + public void check() { + + } + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/PropertiesProviderInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockComponentListener.java similarity index 55% rename from prolinestudio-commons/src/main/java/fr/proline/studio/utils/PropertiesProviderInterface.java rename to prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockComponentListener.java index 265e1da98..b54f4b955 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/PropertiesProviderInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockComponentListener.java @@ -1,32 +1,23 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.utils; +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ -import org.openide.nodes.Sheet; +package fr.proline.studio.dock.container; -/** - * A class must implements this interface to provide properties - * @author JM235353 - */ -public interface PropertiesProviderInterface { - - public Sheet createSheet(); - - public void loadDataForProperties(Runnable callback); - - +public interface DockComponentListener { + + void titleChanged(); } diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainer.java new file mode 100644 index 000000000..9dfdfb8fb --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainer.java @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.container; + + +import fr.proline.studio.dock.AbstractTopPanel; +import fr.proline.studio.dock.TopPanelListener; + +import javax.swing.*; +import java.util.ArrayList; +import java.util.HashSet; + +public abstract class DockContainer implements TopPanelListener { + + protected JComponent m_component = null; //correspond to graphical component associated to this DockContainer + private DockContainer m_parent; + + + protected String m_zoneArea = null; + + + private int m_id = ID_COUNT++; + private int m_lastParentId = -1; + private static int ID_COUNT = 0; + + public DockContainer() { + m_parent = null; + } + + public abstract DockContainer search(String windowKey); + public abstract DockContainer searchZoneArea(String zoneArea); + + public abstract void findAllDockComponents(ArrayList components); + + public void toFront() { + // nothing to do + } + public void toFront(DockContainer child) { + // nothing to do + } + + + + public void setParent(DockContainer parent) { + m_parent = parent; + if (parent != null) { + m_lastParentId = parent.getId(); + } + } + + public int getId() { + return m_id; + } + + public int getLastParentId() { + return m_lastParentId; + } + + + public void setZoneArea(String zoneArea) { + m_zoneArea = zoneArea; + } + + public String getZoneArea() { + if (m_zoneArea != null) { + return m_zoneArea; + } + if (m_parent != null) { + return m_parent.getZoneArea(); + } + return null; + } + + public abstract void getTopPanels(HashSet set); + + + public abstract void check(); + + + public DockContainer getParent() { + return m_parent; + } + + public void minimize(DockContainer container) { + if (m_parent != null) { + m_parent.minimize(container); + } + } + + public DockContainerRoot getRoot() { + DockContainer root = this; + while (root.getParent() != null) { + root = root.getParent(); + } + return (DockContainerRoot) root; + } + + + public JComponent getComponent() { + return m_component; + } + + public String getTitle() { + return ""; + } + + // TopPanelListener + @Override + public void propertyChanged(String property) { + //Default behaviour : Nothing to do + } +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainerMulti.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainerMulti.java new file mode 100644 index 000000000..d6d1a4a3c --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainerMulti.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.container; + +public abstract class DockContainerMulti extends DockContainer implements DockMultiInterface { + + protected boolean m_canRemoveChildren = true; + + public void setCanRemoveChildren(boolean v) { + m_canRemoveChildren = v; + } + + public abstract void remove(DockContainer container); + + public abstract boolean isEmpty(); + + public abstract DockContainerTab searchTab(int idContainer); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainerRoot.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainerRoot.java new file mode 100644 index 000000000..e0ed47d52 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainerRoot.java @@ -0,0 +1,227 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.container; + +import fr.proline.studio.dock.AbstractTopPanel; +import fr.proline.studio.dock.dragdrop.OverArea; +import fr.proline.studio.dock.gui.InfoLabel; +import fr.proline.studio.dock.gui.DraggingOverlayPanel; +import fr.proline.studio.dock.gui.MemoryPanel; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +public class DockContainerRoot extends DockContainer implements DockMultiInterface, DockReplaceInterface { + + private final HashMap m_containerMap = new HashMap<>(); + + + private final DraggingOverlayPanel m_draggingOverlayPanel; + + private JPanel m_mainPanel; + private InfoLabel m_infoLabel; + private MemoryPanel m_memoryPanel; + + + public DockContainerRoot() { + + m_component = new JPanel(new BorderLayout()); + + m_draggingOverlayPanel = new DraggingOverlayPanel(this); + + initComponents(); + } + + private void initComponents() { + + m_mainPanel = new JPanel(new BorderLayout()); + + m_mainPanel.add(m_component, BorderLayout.CENTER); + + JPanel southPanel = new JPanel(new GridBagLayout()); + + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.insets = new java.awt.Insets(2, 2, 2, 2); + + c.gridx = 0; + c.gridy = 0; + c.weightx = 0; + c.weighty = 0; + + m_memoryPanel = new MemoryPanel(); + southPanel.add(m_memoryPanel, c); + + //c.gridx++; + //southPanel.add(Box.createHorizontalStrut(6), c); + + c.gridx++; + c.weightx = 1; + m_infoLabel = new InfoLabel(); + southPanel.add(m_infoLabel, c); + + + + + + + m_mainPanel.add(southPanel, BorderLayout.SOUTH); + + + } + + public JPanel getMainPanel() { + return m_mainPanel; + } + + public InfoLabel getInfoLabel() { + return m_infoLabel; + } + + public MemoryPanel getMemoryPanel() { + return m_memoryPanel; + } + + public void getTopPanels(HashSet set) { + + for (DockContainerMulti c : m_containerMap.keySet()) { + c.getTopPanels(set); + } + + } + + @Override + public DockContainer search(String windowKey) { + + for (DockContainerMulti c : m_containerMap.keySet()) { + DockContainer containerSearched = c.search(windowKey); + if (containerSearched != null) { + return containerSearched; + + } + } + return null; + } + + @Override + public DockContainer searchZoneArea(String zoneArea) { + + for (DockContainerMulti c : m_containerMap.keySet()) { + DockContainer containerSearched = c.searchZoneArea(zoneArea); + if (containerSearched != null) { + return containerSearched; + + } + } + return null; + } + + @Override + public void findAllDockComponents(ArrayList components) { + for (DockContainerMulti c : m_containerMap.keySet()) { + c.findAllDockComponents(components); + } + + } + + + public void add(DockContainer container, DockPosition position) throws DockException { + + if (! (container instanceof DockContainerMulti)) { + throw new DockException("Must add DockContainerMulti to DockContainerRoot"); + } + + m_containerMap.put((DockContainerMulti) container, position); // can add only DockContainerMulti + ((JPanel) m_component).add(container.getComponent(), position.getBorderLayout()); + container.setParent(this); + } + + + public OverArea getOverArea(Point screenPoint) { + + for (DockContainerMulti container : m_containerMap.keySet()) { + + OverArea overArea = container.getOverArea(screenPoint); + if (overArea != null) { + return overArea; + } + + } + + return null; + } + + public void startDragging() { + + if (firstDrag) { + firstDrag = false; + JRootPane rootPane = m_component.getRootPane(); + rootPane.setGlassPane(m_draggingOverlayPanel); + } + + m_draggingOverlayPanel.setVisible(true); + + m_component.repaint(); + } + private boolean firstDrag = true; + + public void stopDragging() { + + m_draggingOverlayPanel.setVisible(false); + + m_component.repaint(); + } + + @Override + public void replace(DockContainerMulti previous, DockContainerMulti next) { + + + DockPosition position = m_containerMap.remove(previous); + + JPanel panel = (JPanel) m_component; + + panel.remove(previous.getComponent()); + + panel.add(next.getComponent(), position.getBorderLayout()); + + m_containerMap.put(next, position); + + next.setParent(this); + + panel.revalidate(); + panel.repaint(); + } + + + public void check() { + for (DockContainer c : m_containerMap.keySet()) { + if (c.getParent() != this) { + System.err.println("Wrong Parent"); + } + if (c.getComponent().getParent() != this.getComponent()) { + System.err.println("Wrong Parent AWT"); + } + + c.check(); + } + } +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainerSplit.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainerSplit.java new file mode 100644 index 000000000..550b2a705 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainerSplit.java @@ -0,0 +1,247 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.container; + +import fr.proline.studio.dock.AbstractTopPanel; +import fr.proline.studio.dock.dragdrop.OverArea; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.HashSet; + +public class DockContainerSplit extends DockContainerMulti implements DockReplaceInterface { + + private DockContainerMulti m_leftContainer; + private DockContainerMulti m_rightContainer; + + + + public DockContainerSplit() { + + } + + public DockContainerMulti getLeftContainer() { + return m_leftContainer; + } + + public DockContainerMulti getRightContainer() { + return m_rightContainer; + } + + public void getTopPanels(HashSet set) { + m_leftContainer.getTopPanels(set); + m_rightContainer.getTopPanels(set); + } + + @Override + public DockContainer search(String windowKey) { + + DockContainer containerSearched = m_leftContainer.search(windowKey); + if (containerSearched != null) { + return containerSearched; + + } + + containerSearched = m_rightContainer.search(windowKey); + if (containerSearched != null) { + return containerSearched; + + } + + return null; + } + + @Override + public DockContainer searchZoneArea(String zoneArea) { + + if ((m_zoneArea!=null) && (m_zoneArea.equals(zoneArea))) { + return this; + } + + DockContainer containerSearched = m_leftContainer.searchZoneArea(zoneArea); + if (containerSearched != null) { + return containerSearched; + + } + + containerSearched = m_rightContainer.searchZoneArea(zoneArea); + if (containerSearched != null) { + return containerSearched; + + } + + return null; + } + + @Override + public void findAllDockComponents(ArrayList components) { + m_leftContainer.findAllDockComponents(components); + m_rightContainer.findAllDockComponents(components); + } + + + + + + + public void add(boolean horizontal, DockContainerMulti leftContainer, DockContainerMulti rightContainer) { + + m_leftContainer = leftContainer; + m_rightContainer = rightContainer; + + JSplitPane splitPane = new JSplitPane(horizontal ? JSplitPane.HORIZONTAL_SPLIT : JSplitPane.VERTICAL_SPLIT, leftContainer.getComponent(), rightContainer.getComponent()); + m_component = splitPane; + + + leftContainer.setParent(this); + rightContainer.setParent(this); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + ((JSplitPane) m_component).setDividerLocation(0.5d); + } + }); + } + + + public void addLeft(DockContainerMulti leftContainer) { + + ((JSplitPane) m_component).setRightComponent(leftContainer.getComponent()); + leftContainer.setParent(this); + } + + + public void addRight(DockContainerMulti rightContainer) { + + ((JSplitPane) m_component).setRightComponent(rightContainer.getComponent()); + rightContainer.setParent(this); + } + + + @Override + public OverArea getOverArea(Point pointOnScreen) { + + OverArea overArea = m_leftContainer.getOverArea(pointOnScreen); + if (overArea != null) { + return overArea; + } + + return m_rightContainer.getOverArea(pointOnScreen); + + } + + @Override + public void replace(DockContainerMulti previous, DockContainerMulti next) { + + JSplitPane splitPane = (JSplitPane) m_component; + + final int oldLocation = splitPane.getDividerLocation(); + + if (m_leftContainer == previous) { + splitPane.remove(m_leftContainer.getComponent()); + splitPane.setLeftComponent(next.getComponent()); + + m_leftContainer = next; + next.setParent(this); + + splitPane.revalidate(); + splitPane.repaint(); + + } else if (m_rightContainer == previous) { + splitPane.remove(m_rightContainer.getComponent()); + splitPane.setRightComponent(next.getComponent()); + + m_rightContainer = next; + next.setParent(this); + + splitPane.revalidate(); + splitPane.repaint(); + + } + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + splitPane.setDividerLocation(oldLocation); + } + }); + } + + @Override + public void remove(DockContainer container) { + + if (!m_canRemoveChildren) { + return; + } + + JSplitPane splitPane = (JSplitPane) m_component; + + splitPane.remove(m_leftContainer.getComponent()); + splitPane.remove(m_rightContainer.getComponent()); + + DockContainerMulti keptContainer = (m_leftContainer == container) ? m_rightContainer : m_leftContainer; + + m_leftContainer = null; + m_rightContainer = null; + + ((DockReplaceInterface) getParent()).replace(this, keptContainer); + + + + } + + public boolean isEmpty() { + return m_leftContainer.isEmpty() && m_rightContainer.isEmpty(); + } + + @Override + public DockContainerTab searchTab(int idContainer) { + DockContainerTab tab = m_leftContainer.searchTab(idContainer); + if (tab != null) { + return tab; + } + + return m_rightContainer.searchTab(idContainer); + } + + + public void check() { + DockContainer c = m_leftContainer; + if (c.getParent() != this) { + System.err.println("Wrong Parent"); + } + if (c.getComponent().getParent() != this.getComponent()) { + System.err.println("Wrong Parent AWT"); + } + + c.check(); + + c = m_rightContainer; + if (c.getParent() != this) { + System.err.println("Wrong Parent"); + } + if (c.getComponent().getParent() != this.getComponent()) { + System.err.println("Wrong Parent AWT"); + } + + c.check(); + } +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainerTab.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainerTab.java new file mode 100644 index 000000000..6d1aa6a4e --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockContainerTab.java @@ -0,0 +1,314 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.container; + +import fr.proline.studio.dock.AbstractTopPanel; +import fr.proline.studio.dock.dragdrop.OverArea; +import fr.proline.studio.dock.gui.TabbedPaneLabel; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.HashSet; + +public class DockContainerTab extends DockContainerMulti { + + + private HashSet m_dockContainerSet = new HashSet(); + + public DockContainerTab() { + final JTabbedPane tabbedPane = new JTabbedPane(); + m_component = tabbedPane; + + } + + public void toFront(DockContainer child) { + JTabbedPane tabbedPane = ((JTabbedPane)m_component); + + int index = tabbedPane.indexOfComponent(child.getComponent()); + if (index != -1) { + tabbedPane.setSelectedIndex(index); + } + } + + public void getTopPanels(HashSet set) { + for (DockContainer c : m_dockContainerSet) { + c.getTopPanels(set); + } + } + + + @Override + public DockContainer search(String windowKey) { + + for (DockContainer c : m_dockContainerSet) { + DockContainer containerSearched = c.search(windowKey); + if (containerSearched != null) { + return containerSearched; + + } + } + return null; + } + + @Override + public DockContainer searchZoneArea(String zoneArea) { + + if ((m_zoneArea!=null) && (m_zoneArea.equals(zoneArea))) { + return this; + } + + + for (DockContainer c : m_dockContainerSet) { + DockContainer containerSearched = c.searchZoneArea(zoneArea); + if (containerSearched != null) { + return containerSearched; + + } + } + return null; + } + + @Override + public void findAllDockComponents(ArrayList components) { + + for (DockContainer c : m_dockContainerSet) { + c.findAllDockComponents(components); + } + } + + + + + + + public void add(DockContainer container, DockPosition dockPosition) throws DockException { + + if (! (container instanceof DockComponent)) { + throw new DockException("Must add DockComponent to DockContainerTab"); + } + + DockComponent component = (DockComponent) container; + DockReplaceInterface parent = (DockReplaceInterface) getParent(); + + + + switch(dockPosition.getPosition()) { + case DockPosition.CENTER: { + add(component); + break; + } + case DockPosition.WEST: { + DockContainerSplit dockContainerSplit = new DockContainerSplit(); + DockContainerTab containerTab = new DockContainerTab(); + containerTab.setZoneArea(getZoneArea()); + containerTab.add(component); + dockContainerSplit.add(true, containerTab, this); + parent.replace(this, dockContainerSplit); + break; + } + case DockPosition.EAST: { + DockContainerSplit dockContainerSplit = new DockContainerSplit(); + DockContainerTab containerTab = new DockContainerTab(); + containerTab.setZoneArea(getZoneArea()); + containerTab.add(component); + this.getComponent().getParent().remove(this.getComponent()); + dockContainerSplit.add(true, this, containerTab); + parent.replace(this, dockContainerSplit); + break; + } + case DockPosition.NORTH: { + DockContainerSplit dockContainerSplit = new DockContainerSplit(); + DockContainerTab containerTab = new DockContainerTab(); + containerTab.setZoneArea(getZoneArea()); + containerTab.add(component); + dockContainerSplit.add(false, containerTab, this); + parent.replace(this, dockContainerSplit); + break; + } + case DockPosition.SOUTH: { + DockContainerSplit dockContainerSplit = new DockContainerSplit(); + DockContainerTab containerTab = new DockContainerTab(); + containerTab.setZoneArea(getZoneArea()); + containerTab.add(component); + this.getComponent().getParent().remove(this.getComponent()); + dockContainerSplit.add(false, this, containerTab); + parent.replace(this, dockContainerSplit); + break; + } + default: { + add(component, dockPosition.getPosition()); + } + + } + + + + + + getRoot().check(); + } + + public void add(DockComponent container) { + + JTabbedPane tabbedPane = ((JTabbedPane)m_component); + + tabbedPane.addTab(container.getTitle(), container.getComponent()); + + int index = tabbedPane.indexOfComponent(container.getComponent()); + + TabbedPaneLabel tpl = new TabbedPaneLabel(this, container); + tabbedPane.setTabComponentAt(index, tpl); + tabbedPane.setSelectedIndex(index); + + m_dockContainerSet.add(container); + container.setParent(this); + + if (container.getComponent() instanceof AbstractTopPanel) { + AbstractTopPanel topPanel = (AbstractTopPanel) container.getComponent(); + topPanel.componentAdded(); + } + + } + + public void add(DockComponent container, int destIndex) { + + JTabbedPane tabbedPane = ((JTabbedPane)m_component); + + + tabbedPane.insertTab (container.getTitle(), null, container.getComponent(), null, destIndex); + + + TabbedPaneLabel tpl = new TabbedPaneLabel(this, container); + tabbedPane.setTabComponentAt(destIndex, tpl); + tabbedPane.setSelectedIndex(destIndex); + + m_dockContainerSet.add(container); + container.setParent(this); + + if (container.getComponent() instanceof AbstractTopPanel) { + AbstractTopPanel topPanel = (AbstractTopPanel) container.getComponent(); + topPanel.componentAdded(); + } + + } + + @Override + public void remove(DockContainer container) { + + m_dockContainerSet.remove(container); + + JTabbedPane tabbedPane = ((JTabbedPane)m_component); + + int index = tabbedPane.indexOfComponent(container.getComponent()); + if(container instanceof DockComponent) { //Remove TabbedPaneLabel from DockComponent + ((DockComponent) container).removeDockComponentListener(); + } + + tabbedPane.remove(index); + container.setParent(null); + + removeIfEmpty(); + + + } + + public boolean isEmpty() { + return m_dockContainerSet.isEmpty(); + } + + @Override + public DockContainerTab searchTab(int idContainer) { + if (idContainer == -1) { + return this; + } + if (idContainer == getId()) { + return this; + } + return null; + } + + public void removeIfEmpty() { + if (! m_dockContainerSet.isEmpty() || !m_canRemoveChildren) { + return; + } + ((DockContainerMulti) getParent()).remove(this); + + } + + @Override + public OverArea getOverArea(Point pointOnScreen) { + + Point localPoint = new Point(pointOnScreen); + SwingUtilities.convertPointFromScreen(localPoint, m_component); + + Rectangle bounds = m_component.getBounds(); + bounds.x = 0; + bounds.y = 0; + + if (! bounds.contains(localPoint)) { + return null; + } + + + JTabbedPane tabbedPane = ((JTabbedPane)m_component); + int tabCount = tabbedPane.getTabCount(); + for (int i=0;i=c.getX()-MARGIN) && (localPoint.x<=c.getX()+c.getWidth()+MARGIN) && (localPoint.y>=c.getY()-MARGIN) && (localPoint.y<=c.getY()+c.getWidth()+MARGIN)) { + return new OverArea(this, new DockPosition(i)); // Tab index + } + } + + + if (localPoint.y < bounds.y + bounds.height / 3) { + return new OverArea(this, new DockPosition(DockPosition.NORTH)); + } + + if (localPoint.y > bounds.y + bounds.height * 2 / 3) { + return new OverArea(this, new DockPosition(DockPosition.SOUTH)); + } + + if (localPoint.x > bounds.x + bounds.width * 2 / 3) { + return new OverArea(this, new DockPosition(DockPosition.EAST)); + } + + if (localPoint.x < bounds.x + bounds.width / 3) { + return new OverArea(this, new DockPosition(DockPosition.WEST)); + } + + return new OverArea(this, new DockPosition(DockPosition.CENTER)); + + } + + public void check() { + for (DockContainer c : m_dockContainerSet) { + if (c.getParent() != this) { + System.err.println("Wrong Parent"); + } + if (c.getComponent().getParent() != this.getComponent()) { + System.err.println("Wrong Parent AWT"); + } + + c.check(); + } + } + + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockException.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockException.java new file mode 100644 index 000000000..85afc1907 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockException.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.container; + +public class DockException extends Exception { + + public DockException(String message) { + super(message); + } +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockMaximizeInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockMaximizeInterface.java new file mode 100644 index 000000000..5613a174f --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockMaximizeInterface.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.container; + +public interface DockMaximizeInterface { + + void maximize(); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockMinimizePanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockMinimizePanel.java new file mode 100644 index 000000000..25939426d --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockMinimizePanel.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.container; + +import javax.swing.*; +import java.awt.*; +import java.util.HashMap; + +public class DockMinimizePanel extends JPanel { + + HashMap m_componentMap = new HashMap<>(); + + public DockMinimizePanel() { + setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + + setBackground(Color.white); + + setVisible(false); + } + + public void add(DockContainer component) { + + JLabel l = new JLabel(component.getTitle()); + + add(l); + + + m_componentMap.put(component, l); + + if (!isVisible()) { + setVisible(true); + } + + revalidate(); + repaint(); + } + + public void remove(DockContainer component) { + + JLabel l = m_componentMap.remove(component); + + remove(l); + + if (m_componentMap.isEmpty()) { + setVisible(false); + } + } + + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockMultiInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockMultiInterface.java new file mode 100644 index 000000000..91482c26b --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockMultiInterface.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.container; + +import fr.proline.studio.dock.dragdrop.OverArea; + +import java.awt.*; + +public interface DockMultiInterface { + + OverArea getOverArea(Point p); + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockPosition.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockPosition.java new file mode 100644 index 000000000..950bd2fd8 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockPosition.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.container; + +import java.awt.*; + +public class DockPosition { + + public static final int CENTER = -1; + public static final int WEST = -2; + public static final int EAST = -3; + public static final int NORTH = -4; + public static final int SOUTH = -5; + // positive value correspond to an index of a sub component. + + private int m_position; + + public DockPosition(int position) { + m_position = position; + } + + + public String getBorderLayout() { + switch (m_position) { + case DockPosition.CENTER: + return BorderLayout.CENTER; + case DockPosition.WEST: + return BorderLayout.WEST; + case DockPosition.EAST: + return BorderLayout.EAST; + case DockPosition.NORTH: + return BorderLayout.NORTH; + case DockPosition.SOUTH: + return BorderLayout.SOUTH; + } + return null; + } + + public int getPosition() { + return m_position; + } + + + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockReplaceInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockReplaceInterface.java new file mode 100644 index 000000000..85e689296 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/container/DockReplaceInterface.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.container; + +public interface DockReplaceInterface { + void replace(DockContainerMulti previous, DockContainerMulti next); + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/dragdrop/DockTransferable.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/dragdrop/DockTransferable.java new file mode 100644 index 000000000..b9082eb1c --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/dragdrop/DockTransferable.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.dragdrop; + +import fr.proline.studio.dock.container.DockComponent; +import fr.proline.studio.dock.container.DockContainerTab; + +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.IOException; + +public class DockTransferable implements Transferable +{ + public static final DataFlavor FLAVOR = new DataFlavor(DockTransferable.class, "DockTransferable"); + + private DockContainerTab m_dockContainerTab = null; + private DockComponent m_component = null; + + public DockTransferable(DockContainerTab tabbed, DockComponent component) { + m_dockContainerTab = tabbed; + m_component = component; + } + + + @Override + public DataFlavor[] getTransferDataFlavors() + { + return new DataFlavor[]{FLAVOR}; + } + + @Override + public boolean isDataFlavorSupported(DataFlavor flavor) { + return FLAVOR.equals(flavor); + } + + @Override + public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException + { + return this; + } + + public DockContainerTab getDockContainerTab() { + return m_dockContainerTab; + } + + public DockComponent getDockComponent() { + return m_component; + } + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/dragdrop/DockingExportTransferHandler.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/dragdrop/DockingExportTransferHandler.java new file mode 100644 index 000000000..5866c7476 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/dragdrop/DockingExportTransferHandler.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.dragdrop; + +import fr.proline.studio.dock.container.DockComponent; +import fr.proline.studio.dock.container.DockContainerRoot; +import fr.proline.studio.dock.container.DockContainerTab; + +import javax.swing.*; +import java.awt.datatransfer.Transferable; + +public class DockingExportTransferHandler extends TransferHandler { + + private DockContainerTab m_dockContainerTab = null; + private DockComponent m_component = null; + + public DockingExportTransferHandler(DockContainerTab tabbed, DockComponent component) { + m_dockContainerTab = tabbed; + m_component = component; + } + + @Override + public int getSourceActions(JComponent c) { + + return MOVE; + } + + @Override + public Transferable createTransferable(JComponent c) { + + ((DockContainerRoot) m_dockContainerTab.getRoot()).startDragging(); + + DockTransferable dockTransferable = new DockTransferable(m_dockContainerTab, m_component); + + return dockTransferable; + } + + @Override + public void exportDone(JComponent c, Transferable t, int action) { + ((DockContainerRoot) m_dockContainerTab.getRoot()).stopDragging(); + } +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/dragdrop/DockingImportTransfertHandler.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/dragdrop/DockingImportTransfertHandler.java new file mode 100644 index 000000000..e9992e604 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/dragdrop/DockingImportTransfertHandler.java @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.dragdrop; + +import fr.proline.studio.dock.gui.DraggingOverlayPanel; + +import javax.swing.*; +import java.awt.*; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.IOException; + + +public class DockingImportTransfertHandler extends TransferHandler +{ + private DraggingOverlayPanel m_overlayPanel; + + public DockingImportTransfertHandler(DraggingOverlayPanel overlayPanel) { + m_overlayPanel = overlayPanel; + } + + + @Override + public boolean canImport(TransferHandler.TransferSupport info) + { + Point point = info.getDropLocation().getDropPoint(); + Component source = info.getComponent(); + + + if (point == null) { + return false; + } + + SwingUtilities.convertPointToScreen(point, source); + + OverArea overArea = m_overlayPanel.getOverArea(point); + + if (overArea == null) { + return false; + } + + Transferable transferable = info.getTransferable(); + + DockTransferable data = null; + try { + data = (DockTransferable) transferable.getTransferData(DockTransferable.FLAVOR); + } catch (UnsupportedFlavorException | IOException ex2) {} + + if (data == null) { + return false; + } + + String zoneAreaSource = data.getDockComponent().getZoneArea(); + + String zoneAreaDestination = overArea.getDockContainerTab().getZoneArea(); + if (zoneAreaDestination != null) { + if ((zoneAreaSource == null) || (!zoneAreaSource.equals(zoneAreaDestination))) { + m_overlayPanel.resetOverArea(); + return false; + } + } + + + return info.isDataFlavorSupported(DockTransferable.FLAVOR); + } + + @Override + public boolean importData(TransferHandler.TransferSupport info) { + + Transferable transferable = info.getTransferable(); + + DockTransferable data = null; + + try { + data = (DockTransferable) transferable.getTransferData(DockTransferable.FLAVOR); + } catch (UnsupportedFlavorException | IOException ex2) {} + + if (data == null) { + return false; + } + + m_overlayPanel.importData(data); + + return true; + } + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/dragdrop/OverArea.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/dragdrop/OverArea.java new file mode 100644 index 000000000..ad79eb5b0 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/dragdrop/OverArea.java @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.dragdrop; + +import fr.proline.studio.dock.container.DockContainerTab; +import fr.proline.studio.dock.container.DockPosition; + +import javax.swing.*; +import java.awt.*; + +public class OverArea { + + private DockContainerTab m_container; + private DockPosition m_position; + private Rectangle m_zone; + + public OverArea(DockContainerTab container, DockPosition dockPosition) { + m_container = container; + m_position = dockPosition; + + JComponent c = container.getComponent(); + + int position = dockPosition.getPosition(); + + if (position>=0) { + // We are over a Tabbed Label + Component tabComponent = ((JTabbedPane) c).getTabComponentAt(position); + Point p = tabComponent.getLocationOnScreen(); + final int MARGIN = 5; + m_zone = new Rectangle(p.x-MARGIN, p.y-MARGIN, tabComponent.getWidth()+MARGIN*2, tabComponent.getHeight()+MARGIN*2); + } else { + + Point p = c.getLocationOnScreen(); + + + m_zone = new Rectangle(p.x, p.y, c.getWidth(), c.getHeight()); + + + switch (position) { + case DockPosition.NORTH: + m_zone.height /= 2; + break; + case DockPosition.SOUTH: + m_zone.height /= 2; + m_zone.y += m_zone.height; + break; + case DockPosition.WEST: + m_zone.width /= 2; + break; + case DockPosition.EAST: + m_zone.width /= 2; + m_zone.x += m_zone.width; + break; + } + } + + + } + + public DockContainerTab getDockContainerTab() { + return m_container; + } + public DockPosition getPosition() { + return m_position; + } + public Rectangle getZone(JComponent c) { + + Point p = new Point(m_zone.x, m_zone.y); + SwingUtilities.convertPointFromScreen(p, c); + Rectangle localZone = new Rectangle(p.x, p.y, m_zone.width, m_zone.height); + + return localZone; + + } + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/gui/DraggingOverlayPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/gui/DraggingOverlayPanel.java new file mode 100644 index 000000000..fc57228a4 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/gui/DraggingOverlayPanel.java @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.gui; + +import fr.proline.studio.dock.container.*; +import fr.proline.studio.dock.dragdrop.DockTransferable; +import fr.proline.studio.dock.dragdrop.DockingImportTransfertHandler; +import fr.proline.studio.dock.dragdrop.OverArea; + +import java.awt.*; + +public class DraggingOverlayPanel extends javax.swing.JPanel +{ + + private final DockContainerRoot m_dockContainerRoot; + + private static final AlphaComposite ALPHA_COMPOSITE = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f); + + private static final Color OVER_COLOR = new Color(51, 153, 255); + + private OverArea m_overArea = null; + + + public DraggingOverlayPanel(DockContainerRoot dockContainerRoot) { + m_dockContainerRoot = dockContainerRoot; + + setOpaque(false); + + DockingImportTransfertHandler transferHandler = new DockingImportTransfertHandler(this); + setTransferHandler(transferHandler); + + + + } + + @Override + public void paintComponent(Graphics g) { + + + Graphics2D g2D = (Graphics2D) g; + + if (m_overArea != null) { + + g2D.setColor(OVER_COLOR); + + + Composite previousComposite = g2D.getComposite(); + + g2D.setComposite(ALPHA_COMPOSITE); + g2D.fill(m_overArea.getZone(this)); + g2D.setComposite(previousComposite); + + } + + } + + public OverArea getOverArea(Point pointOnScreen) { + + m_overArea = m_dockContainerRoot.getOverArea(pointOnScreen); + + repaint(); + + return m_overArea; + } + + public void resetOverArea() { + m_overArea = null; + } + + + + + public void importData(DockTransferable dataSource) { + + if (m_overArea == null) { + return; + } + + // Source + DockContainerTab dockContainerTab = dataSource.getDockContainerTab(); + DockComponent dockComponent = dataSource.getDockComponent(); + + dockContainerTab.remove(dockComponent); + + DockContainerTab destination = m_overArea.getDockContainerTab(); + DockPosition position = m_overArea.getPosition(); + + try { + destination.add(dockComponent, position); + } catch (DockException e) { + // can not happen + } + + dockContainerTab.removeIfEmpty(); + + } + + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/gui/InfoLabel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/gui/InfoLabel.java new file mode 100644 index 000000000..1a66b84a7 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/gui/InfoLabel.java @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.gui; + +import fr.proline.studio.WindowManager; +import fr.proline.studio.gui.DefaultDialog; +import fr.proline.studio.utils.IconManager; + +import javax.swing.*; +import javax.swing.border.Border; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.io.PrintWriter; +import java.io.StringWriter; + +public class InfoLabel extends JLabel implements MouseListener { + + + public enum INFO_LEVEL { + INFO, + WARNING, + ERROR + } + + private INFO_LEVEL m_infoLevel = INFO_LEVEL.INFO; + private Throwable m_throwable = null; + + public InfoLabel() { + setInfo(INFO_LEVEL.INFO, "", null); + setBackground(Color.white); + + addMouseListener(this); + + // line border + Border border = BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.black, 1), BorderFactory.createEmptyBorder(2,2,2,2)); + setBorder(border); + } + + + public void setInfo(INFO_LEVEL infoLevel, Throwable t) { + setInfo(infoLevel, t.getMessage(), t); + + } + + public void setInfo(INFO_LEVEL infoLevel, String message, Throwable t) { + switch (infoLevel) { + case INFO: + setIcon(IconManager.getIcon(IconManager.IconType.INFORMATION)); + break; + case WARNING: + setIcon(IconManager.getIcon(IconManager.IconType.WARNING)); + break; + case ERROR: + setIcon(IconManager.getIcon(IconManager.IconType.EXCLAMATION)); + break; + } + setText(message); + + m_throwable = t; + + if (m_throwable != null) { + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } else { + setCursor(Cursor.getDefaultCursor()); + } + } + + + + @Override + public void mouseClicked(MouseEvent e) { + if (m_throwable != null) { + ExceptionDialog.getSingleton(m_throwable.getMessage(), m_throwable).setVisible(true); + } + //ResetPanel + setInfo(INFO_LEVEL.INFO, "", null); + } + + @Override + public void mousePressed(MouseEvent e) { } + + @Override + public void mouseReleased(MouseEvent e) { } + + @Override + public void mouseEntered(MouseEvent e) { } + + @Override + public void mouseExited(MouseEvent e) { } + + + + private static class ExceptionDialog extends DefaultDialog { + + private JTextArea m_textArea; + + private String _requestContent = ""; + private boolean m_firstDisplay = true; + + private static ExceptionDialog m_singleton = null; + + private ExceptionDialog() { + super(WindowManager.getDefault().getMainWindow()); + setTitle("Exception"); + + setButtonVisible(BUTTON_CANCEL, false); + setButtonVisible(BUTTON_HELP, false); + setStatusVisible(false); + + + JPanel mainPanel = new JPanel(new GridBagLayout()); + mainPanel.setPreferredSize(new Dimension(600, 400)); + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.insets = new java.awt.Insets(5, 5, 5, 5); + + + m_textArea = new JTextArea(); + m_textArea.setText(_requestContent); + m_textArea.setCaretPosition(0); + m_textArea.setEditable(false); + m_textArea.setLineWrap(true); + // --- add objects + c.gridx = 0; + c.gridy = 0; + c.weightx = 1; + c.weighty = 1; + JScrollPane top = new JScrollPane(m_textArea); + mainPanel.add(top, c); + + setInternalComponent(mainPanel); + + setResizable(true); + } + + public static ExceptionDialog getSingleton(String message, Throwable t) { + if (m_singleton == null) { + m_singleton = new ExceptionDialog(); + + } + + m_singleton.setContent(message, t); + + return m_singleton; + } + + @Override + public void setVisible(boolean v) { + if (m_firstDisplay) { + m_singleton.centerToWindow(WindowManager.getDefault().getMainWindow()); + m_firstDisplay = false; + } + + super.setVisible(v); + } + + private void setContent(String message, Throwable t) { + setTitle(message); + + StringWriter sw = new StringWriter(); + t.printStackTrace(new PrintWriter(sw)); + m_textArea.setText(sw.toString()); + + + } + + + } + + + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/dock/gui/MemoryPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/gui/MemoryPanel.java new file mode 100644 index 000000000..b96b336ae --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/dock/gui/MemoryPanel.java @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.dock.gui; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +public class MemoryPanel extends JPanel implements MouseListener { + + private static int NB_VALUES = 30; + private final static Color BLUE = new Color(116, 208, 241); + private final static Color MAX_COLOR = new Color(160, 7 , 26); + + private static final Dimension m_dimension = new Dimension(NB_VALUES*3,20); + private static final StringBuilder m_sb = new StringBuilder(); + + private ActionListener m_actionListener = null; + + private Font m_font; + + private long m_maxMemory; + private long m_totalMemory; + private long m_usedMemory; + + private long[] m_values = new long[NB_VALUES]; + private int valueCurIndex = 0; + + private boolean m_firstPaint = true; + + public MemoryPanel() { + setMinimumSize(m_dimension); + setPreferredSize(m_dimension); + + addMouseListener(this); + + } + + public void setActionListener(ActionListener actionListener) { + m_actionListener = actionListener; + + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } + + private void startAnimation() { + Timer t = new Timer(1000, new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + peekMemoryValue(); + repaint(); + } + }); + t.start(); + } + + private void peekMemoryValue() { + + m_maxMemory = Runtime.getRuntime().maxMemory(); + m_totalMemory = Runtime.getRuntime().totalMemory(); + m_usedMemory = m_totalMemory - Runtime.getRuntime().freeMemory(); + + m_values[valueCurIndex] = m_usedMemory; + valueCurIndex++; + if (valueCurIndex>=NB_VALUES) { + valueCurIndex = 0; + } + + } + + public void paint(Graphics g) { + + if (m_firstPaint) { + startAnimation(); + m_firstPaint = false; + } + + g.setColor(Color.white); + g.fillRect(0, 0, getWidth(), getHeight()); + + int maxMemoryHeight = (int) Math.round(getHeight() * 1); // * 0.8 + + + + g.setColor(BLUE); + int index = 0; + for (int i = valueCurIndex; i. + */ + +package fr.proline.studio.dock.gui; + +import fr.proline.studio.dock.AbstractTopPanel; +import fr.proline.studio.dock.container.DockComponent; +import fr.proline.studio.dock.container.DockComponentListener; +import fr.proline.studio.dock.container.DockContainer; +import fr.proline.studio.dock.container.DockContainerTab; +import fr.proline.studio.dock.dragdrop.DockingExportTransferHandler; +import fr.proline.studio.utils.IconManager; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseEvent; + +public class TabbedPaneLabel extends JPanel implements DockComponentListener { + + final DockContainerTab m_dockContainerTab; + final DockContainer m_dockComponent; + + private DockingExportTransferHandler m_transferHandler; + private MouseEvent m_mouseBegin; + private boolean m_exportAsDrag = false; + + private JLabel m_titleLabel; + private JButton m_closeButton = null; + private JButton m_minimizeButton = null; + + + public TabbedPaneLabel(DockContainerTab dockContainerTab, DockComponent dockComponent) { + m_dockContainerTab = dockContainerTab; + m_dockComponent = dockComponent; + dockComponent.setDockComponentListener(this); + + initComponents(dockComponent); + + + m_transferHandler = new DockingExportTransferHandler(dockContainerTab, dockComponent); + setTransferHandler(m_transferHandler); + + + } + + private void initComponents(DockComponent content) { + + setLayout(new FlowLayout(java.awt.FlowLayout.LEFT, 0, 0)); + setOpaque(false); + + + m_titleLabel = new JLabel(content.getTitle()); + m_titleLabel.setIcon(content.getIcon()); + m_titleLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 4)); + + m_titleLabel.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + } + public void mousePressed(MouseEvent evt) { + m_mouseBegin = evt; + } + public void mouseReleased(java.awt.event.MouseEvent evt) { + m_mouseBegin = null; + + if (evt.isPopupTrigger()) { + popup(evt.getX(), evt.getY()); + } else if (!m_exportAsDrag) { + ((JTabbedPane) m_dockContainerTab.getComponent()).setSelectedComponent(m_dockComponent.getComponent()); + } + + m_exportAsDrag = false; + } + }); + + m_titleLabel.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { + public void mouseDragged(java.awt.event.MouseEvent evt) { + mouseDraggedImpl(evt); + } + }); + + add(m_titleLabel); + + + if (content.canClose()) { + m_closeButton = new JButton(); + m_closeButton.setIcon(IconManager.getIcon(IconManager.IconType.CROSS_SMALL12)); + m_closeButton.setBorderPainted(false); + m_closeButton.setContentAreaFilled(false); + m_closeButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); + m_closeButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + if (m_dockComponent.getComponent() instanceof AbstractTopPanel) { + if(((AbstractTopPanel) m_dockComponent.getComponent()).warnBeforeClosing()) { + int closeTab = JOptionPane.showConfirmDialog(null, "Are you sure tou want to close this Windows ? " + ((AbstractTopPanel) m_dockComponent.getComponent()).getWarnClosingMessage(), "Close Warning",JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + if (closeTab == JOptionPane.NO_OPTION) + return; + } + } + m_dockContainerTab.remove(m_dockComponent); + if (m_dockComponent.getComponent() instanceof AbstractTopPanel) { + ((AbstractTopPanel) m_dockComponent.getComponent()).componentClosed(); + } + } + }); + add(m_closeButton); + } + + if (content.canMinimize()) { + m_minimizeButton = new JButton(); + m_minimizeButton.setIcon(IconManager.getIcon(IconManager.IconType.MINIFY)); + m_minimizeButton.setBorderPainted(false); + m_minimizeButton.setContentAreaFilled(false); + m_minimizeButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); + m_minimizeButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + + m_dockContainerTab.remove(m_dockComponent); + m_dockContainerTab.minimize(m_dockComponent); + + + } + }); + add(m_minimizeButton); + } + + } + + + + private void mouseDraggedImpl(MouseEvent evt) { + + if (m_mouseBegin != null) { + + int dx = m_mouseBegin.getX() - evt.getX(); + int dy = m_mouseBegin.getY() - evt.getY(); + if ((dx * dx + dy * dy) > 16) { + + JComponent component = m_dockComponent.getComponent(); + JTabbedPane tabbedPane = (JTabbedPane) m_dockContainerTab.getComponent(); + int index = tabbedPane.indexOfComponent(component); + + tabbedPane.setSelectedIndex(index); + + m_transferHandler.exportAsDrag(this, m_mouseBegin, TransferHandler.MOVE); + m_mouseBegin = null; + m_exportAsDrag = true; + } + } + + } + + public void popup(int x, int y) { + + JComponent component = m_dockComponent.getComponent(); + if (component instanceof AbstractTopPanel) { + Action[] actions = ((AbstractTopPanel) component).getActions((DockComponent) m_dockComponent); + if (actions == null) { + return; + } + + JPopupMenu popup = new JPopupMenu(); + for (Action action : actions) { + if (action == null) { + popup.addSeparator(); + } else { + popup.add(action); + } + } + popup.show((JComponent) this, x, y); + + + } + + + } + + + @Override + public void titleChanged() { + m_titleLabel.setText(m_dockComponent.getTitle()); + m_titleLabel.repaint(); + } +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/CSVExporter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/CSVExporter.java index 61859ffbd..c65a41e0f 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/CSVExporter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/CSVExporter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; import java.io.FileWriter; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/CheckboxTabPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/CheckboxTabPanel.java index c068be41e..04b7104d5 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/CheckboxTabPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/CheckboxTabPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/CustomExportDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/CustomExportDialog.java index 1e3cece7b..af9fb8bd4 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/CustomExportDialog.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/CustomExportDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,8 @@ */ package fr.proline.studio.export; +import fr.proline.studio.NbPreferences; +import fr.proline.studio.WindowManager; import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.utils.IconManager; @@ -40,7 +42,6 @@ import javax.swing.event.ChangeListener; import javax.swing.filechooser.FileNameExtensionFilter; -import org.openide.util.NbPreferences; import org.slf4j.LoggerFactory; import org.slf4j.Logger; @@ -51,7 +52,6 @@ import fr.proline.studio.gui.CollapseListener; import fr.proline.studio.gui.InfoDialog; import fr.proline.studio.settings.FilePreferences; -import org.openide.windows.WindowManager; /** * @@ -896,7 +896,7 @@ protected int sheetIdToSheetIndex(String sheetId) { /** * EXPORT ACTION - * generate configle file and export data + * generate config file and export data * * @return */ diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/DndTabbedPane.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/DndTabbedPane.java index 17be60e1b..7740b6413 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/DndTabbedPane.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/DndTabbedPane.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/Excel2003Exporter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/Excel2003Exporter.java index 057fbae81..c70c3a2f2 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/Excel2003Exporter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/Excel2003Exporter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; import java.io.FileOutputStream; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExcelXMLExporter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExcelXMLExporter.java index af35e6ab4..96a22f2bf 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExcelXMLExporter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExcelXMLExporter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; import java.io.FileOutputStream; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportButton.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportButton.java index e014a2d81..47a57f3f3 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportButton.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportButton.java @@ -1,21 +1,22 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; +import fr.proline.studio.WindowManager; import fr.proline.studio.progress.ProgressBarDialog; import fr.proline.studio.progress.ProgressInterface; import fr.proline.studio.utils.IconManager; @@ -27,7 +28,6 @@ import javax.swing.JPanel; import org.jdesktop.swingx.JXTable; -import org.openide.windows.WindowManager; /** * Button to export data of a table or image of a JPanel diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportConfig.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportConfig.java index af47b2fc3..e9c7b2475 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportConfig.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportConfig.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportDataExport.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportDataExport.java index af1aec3b2..dbdf7db96 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportDataExport.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportDataExport.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,9 +14,9 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.export; - -public class ExportDataExport { - boolean all_protein_set; // all proteins validated or even if not - boolean best_profile; // -} +package fr.proline.studio.export; + +public class ExportDataExport { + boolean all_protein_set; // all proteins validated or even if not + boolean best_profile; // +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportDialog.java index a69969526..be9b45dee 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportDialog.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportDialog.java @@ -1,21 +1,23 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; +import fr.proline.studio.NbPreferences; +import fr.proline.studio.WindowManager; import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.gui.InfoDialog; import fr.proline.studio.parameter.BooleanParameter; @@ -42,11 +44,9 @@ import javax.swing.filechooser.FileNameExtensionFilter; import org.jdesktop.swingx.JXTable; -import org.openide.util.NbPreferences; import org.slf4j.LoggerFactory; import org.jfree.graphics2d.svg.*; -import org.openide.windows.WindowManager; /** * Dialog used to export an image or a table @@ -167,7 +167,7 @@ private ExportDialog(Window parent, int type, Boolean showExportAllPSMsOption) { setInternalComponent(createExportPanel(defaultExportPath)); - setButtonName(BUTTON_OK, (m_exportType == ExporterFactory.EXPORT_IMAGE) ? "Export Image" : "Export"); + setButtonName(BUTTON_OK, (m_exportType == ExporterFactory.EXPORT_IMAGE) ? "Export Image" : "Export"); m_fchooser = new JFileChooser(new File(defaultExportPath)); m_fchooser.setMultiSelectionEnabled(false); diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportExcelSheet.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportExcelSheet.java index ee3acf4e2..e6983f44d 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportExcelSheet.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportExcelSheet.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportExcelSheetField.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportExcelSheetField.java index 7cc5ea88f..0b405474c 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportExcelSheetField.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportExcelSheetField.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportFontData.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportFontData.java index 2506924c7..3eebadda6 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportFontData.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportFontData.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; import java.awt.Font; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportManager.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportManager.java index 3a1b91658..b3b7bb64a 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportManager.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportManager.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportModelInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportModelInterface.java index 6da920c49..0da45fbb2 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportModelInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportModelInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; import java.util.ArrayList; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportModelUtilities.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportModelUtilities.java index bc1066358..aa3db5a8e 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportModelUtilities.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportModelUtilities.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportPictureWrapper.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportPictureWrapper.java index 8051a7771..f897d5e69 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportPictureWrapper.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportPictureWrapper.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportTextInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportTextInterface.java index 2a026ae2a..d5e5344ea 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportTextInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExportTextInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,18 +14,18 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.export; - -import java.util.ArrayList; - -/** - * Used by renderer to export data as text without rendering - * @author JM235353 - */ -public interface ExportTextInterface { - - public String getExportTextOLD(); - - public ArrayList getExportFontsOLD(); - -} +package fr.proline.studio.export; + +import java.util.ArrayList; + +/** + * Used by renderer to export data as text without rendering + * @author JM235353 + */ +public interface ExportTextInterface { + + public String getExportTextOLD(); + + public ArrayList getExportFontsOLD(); + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExporterFactory.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExporterFactory.java index 8c488f92e..3fe60701b 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExporterFactory.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExporterFactory.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; import java.util.ArrayList; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExporterInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExporterInterface.java index f0417dd9a..d801627ce 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExporterInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/ExporterInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; import java.io.IOException; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/Reorderable.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/Reorderable.java index 1f6527280..9d1bde3fb 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/Reorderable.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/Reorderable.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,9 +14,9 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.export; - -public interface Reorderable { - - public void reorder(int from, int to); -} +package fr.proline.studio.export; + +public interface Reorderable { + + public void reorder(int from, int to); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/TabTitleEditListener.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/TabTitleEditListener.java index 178bd1d77..ded7d47c8 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/TabTitleEditListener.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/TabTitleEditListener.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; import java.awt.Component; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/TableRowTransferHandler.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/TableRowTransferHandler.java index 68e899f5f..789e7e391 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/TableRowTransferHandler.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/TableRowTransferHandler.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; import java.awt.Cursor; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/TableUtil.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/TableUtil.java index 1170e5ec0..b968150b0 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/TableUtil.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/TableUtil.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; import fr.proline.studio.export.model.CustomExportTableModel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/export/model/CustomExportTableModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/export/model/CustomExportTableModel.java index 271c43736..2a4078510 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/export/model/CustomExportTableModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/export/model/CustomExportTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/AbstractJoinDataModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/AbstractJoinDataModel.java index 547aea3ed..8529550f5 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/AbstractJoinDataModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/AbstractJoinDataModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.extendedtablemodel; import fr.proline.studio.graphics.PlotDataSpec; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/AddDataAnalyzerButton.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/AddDataAnalyzerButton.java index 296391178..58cef65f5 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/AddDataAnalyzerButton.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/AddDataAnalyzerButton.java @@ -1,28 +1,28 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.extendedtablemodel; +import fr.proline.studio.WindowManager; import fr.proline.studio.progress.ProgressBarDialog; import fr.proline.studio.progress.ProgressInterface; import fr.proline.studio.utils.IconManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; -import org.openide.windows.WindowManager; /** * Button to send data to the data analyzer diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ChildModelInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ChildModelInterface.java index 46d5a281c..0557b6e42 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ChildModelInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ChildModelInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,17 +14,17 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.extendedtablemodel; - -import javax.swing.event.TableModelListener; - -/** - * A ChildModelInterface can be put in a CompoundTableModel which is a model which group different model together. - * (for instance when we want to add a filterModel to any data model loaded from the database) - * @author JM235353 - */ -public interface ChildModelInterface extends GlobalTableModelInterface, TableModelListener { - - public void setParentModel(GlobalTableModelInterface parentModel); - public GlobalTableModelInterface getParentModel(); -} +package fr.proline.studio.extendedtablemodel; + +import javax.swing.event.TableModelListener; + +/** + * A ChildModelInterface can be put in a CompoundTableModel which is a model which group different model together. + * (for instance when we want to add a filterModel to any data model loaded from the database) + * @author JM235353 + */ +public interface ChildModelInterface extends GlobalTableModelInterface, TableModelListener { + + public void setParentModel(GlobalTableModelInterface parentModel); + public GlobalTableModelInterface getParentModel(); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/CompoundTableModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/CompoundTableModel.java index aed01af59..7d1bfe90c 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/CompoundTableModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/CompoundTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/DiffDataModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/DiffDataModel.java index a0e70fa07..cecadad5f 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/DiffDataModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/DiffDataModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExpansionTableModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExpansionTableModel.java index 2e9d39ae2..ecbf9af63 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExpansionTableModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExpansionTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.extendedtablemodel; import fr.proline.studio.export.ExportFontData; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExtendedTableModelInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExtendedTableModelInterface.java index c197b881b..77edbf955 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExtendedTableModelInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExtendedTableModelInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.extendedtablemodel; import fr.proline.studio.graphics.PlotDataSpec; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExtraDataForTableModelInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExtraDataForTableModelInterface.java index 229eb8ae8..c5b99af66 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExtraDataForTableModelInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExtraDataForTableModelInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.extendedtablemodel; import java.util.ArrayList; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExtraDataType.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExtraDataType.java index 3e61a5765..2a116661a 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExtraDataType.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ExtraDataType.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.extendedtablemodel; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/GlobalTabelModelProviderInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/GlobalTabelModelProviderInterface.java index 06b024efc..01d599c3f 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/GlobalTabelModelProviderInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/GlobalTabelModelProviderInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.extendedtablemodel; import fr.proline.studio.graphics.CrossSelectionInterface; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/GlobalTableModelInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/GlobalTableModelInterface.java index d43d833a4..6879c7a73 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/GlobalTableModelInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/GlobalTableModelInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.extendedtablemodel; import fr.proline.studio.export.ExportModelInterface; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ImportedDataTableModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ImportedDataTableModel.java index 2405d849a..ce304bebf 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ImportedDataTableModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/ImportedDataTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.extendedtablemodel; import fr.proline.studio.export.ExportFontData; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/JoinDataModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/JoinDataModel.java index 6dfa76319..117df07a7 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/JoinDataModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/JoinDataModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.extendedtablemodel; import fr.proline.studio.export.ExportFontData; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/LockedDataModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/LockedDataModel.java index 2f06fa94c..172873a47 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/LockedDataModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/LockedDataModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.extendedtablemodel; import fr.proline.studio.graphics.BestGraphicsInterface; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/MultiJoinDataModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/MultiJoinDataModel.java index 20886114d..fd82557aa 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/MultiJoinDataModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/MultiJoinDataModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.extendedtablemodel; import fr.proline.studio.export.ExportFontData; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/SecondAxisTableModelInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/SecondAxisTableModelInterface.java index 429877a18..6d9b9cf71 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/SecondAxisTableModelInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/SecondAxisTableModelInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,12 +14,12 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.extendedtablemodel; - -/** - * Extendsion of the table model, to define methods needed for plotting, calculations and export - * @author JM235353 - */ -public interface SecondAxisTableModelInterface extends ExtendedTableModelInterface{ - +package fr.proline.studio.extendedtablemodel; + +/** + * Extendsion of the table model, to define methods needed for plotting, calculations and export + * @author JM235353 + */ +public interface SecondAxisTableModelInterface extends ExtendedTableModelInterface{ + } \ No newline at end of file diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/StatsModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/StatsModel.java index 1e4b47d40..c9cb68fda 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/StatsModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/extendedtablemodel/StatsModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.extendedtablemodel; import fr.proline.studio.graphics.PlotDataSpec; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/BooleanFilter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/BooleanFilter.java index bc09d06ae..3291c4d53 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/BooleanFilter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/BooleanFilter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; import java.awt.GridBagConstraints; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/ConvertValueInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/ConvertValueInterface.java index dc6a7407b..05a7de960 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/ConvertValueInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/ConvertValueInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,13 +14,13 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.filter; - -/** - * Interface used for filtering to convert a value (for instance a Peptide) to another value (for instance a String) - * which can be filtered - * @author JM235353 - */ -public interface ConvertValueInterface { - public Object convertValue(Object o); -} +package fr.proline.studio.filter; + +/** + * Interface used for filtering to convert a value (for instance a Peptide) to another value (for instance a String) + * which can be filtered + * @author JM235353 + */ +public interface ConvertValueInterface { + public Object convertValue(Object o); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/DateFilter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/DateFilter.java index fc5ed72ef..55456806e 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/DateFilter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/DateFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/DoubleFilter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/DoubleFilter.java index 500d04ab7..8cca6bdd0 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/DoubleFilter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/DoubleFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,201 +14,201 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.filter; - -import java.awt.GridBagConstraints; -import java.util.ArrayList; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -/** - * Filter on float or double values - * - * @author JM235353 - */ -public class DoubleFilter extends Filter { - - private static final Integer VALUE_MIN = 0; - private static final Integer VALUE_MAX = 1; - private Double m_min; - private Double m_max; - - public DoubleFilter(String variableName, ConvertValueInterface convertValueInterface, int modelColumn) { - super(variableName, convertValueInterface, modelColumn); - - m_valueKeys = new ArrayList<>(2); - m_valueKeys.add(VALUE_MIN); - m_valueKeys.add(VALUE_MAX); - } - - @Override - public Filter cloneFilter4Search() { - DoubleFilter clone = new DoubleFilter(m_variableName, m_convertValueInterface, m_modelColumn); - clone.m_min = m_min; - clone.m_max = m_max; - setValuesForClone(clone); - return clone; - } - - @Override - public FilterStatus checkValues() { - - Double min; - String minValue = ((JTextField) getComponent(VALUE_MIN)).getText().trim(); - if ((minValue == null) || (minValue.length() == 0)) { - min = null; - } else { - try { - min = Double.parseDouble(minValue); - } catch (NumberFormatException nfe) { - return new FilterStatus("Min Value is not a Number", m_components.get(VALUE_MIN)); - } - } - - Double max; - String maxValue = ((JTextField) getComponent(VALUE_MAX)).getText().trim(); - if ((maxValue == null) || (maxValue.length() == 0)) { - max = null; - } else { - try { - max = Double.parseDouble(maxValue); - } catch (NumberFormatException nfe) { - return new FilterStatus("Max Value is not a Number", m_components.get(VALUE_MAX)); - } - } - - if ((min != null) && (max != null) && (min > max)) { - return new FilterStatus("Min Value is greater than Max Value", m_components.get(VALUE_MIN)); - } - - return null; - } - - @Override - public boolean registerValues() { - - boolean hasChanged = false; - - if (isDefined()) { - - Double lastMinValue = m_min; - Double lastMaxValue = m_max; - - String minValue = ((JTextField) getComponent(VALUE_MIN)).getText().trim(); - if ((minValue == null) || (minValue.length() == 0)) { - m_min = null; - } else { - try { - m_min = Double.parseDouble(minValue); - } catch (NumberFormatException nfe) { - // should never happen - } - } - - String maxValue = ((JTextField) getComponent(VALUE_MAX)).getText().trim(); - if ((maxValue == null) || (maxValue.length() == 0)) { - m_max = null; - } else { - try { - m_max = Double.parseDouble(maxValue); - } catch (NumberFormatException nfe) { - // should never happen - } - } - - if (((lastMinValue == null) && (m_min!=null)) || ((lastMinValue != null) && (m_min==null))) { - hasChanged = true; - } else if (((lastMaxValue == null) && (m_max!=null)) || ((lastMaxValue != null) && (m_max==null))) { - hasChanged = true; - } else if ((lastMinValue != null) && (lastMinValue.doubleValue() != m_min.doubleValue())) { - hasChanged = true; - } else if ((lastMaxValue != null) && (lastMaxValue.doubleValue() != m_max.doubleValue())) { - hasChanged = true; - } - - } - - registerDefinedAsUsed(); - - return hasChanged; - } - - @Override - public boolean filter(Object v1, Object v2) { - - double value = ((Number) v1).doubleValue(); - - if (value != value) { // NaN - return false; - } - - if (m_min != null) { - if (value < m_min.doubleValue()) { - return false; - } - } - if (m_max != null) { - if (value > m_max.doubleValue()) { - return false; - } - } - return true; - - } - - @Override - public void createComponents(JPanel p, GridBagConstraints c) { - c.gridx++; - c.gridwidth = 1; - c.weightx = 1; - JTextField minTextField = ((JTextField) getComponent(VALUE_MIN)); - if (minTextField == null) { - minTextField = new JTextField(4); - if (m_min != null) { - minTextField.setText(m_min.toString()); - } - registerComponent(VALUE_MIN, minTextField); - } - p.add(minTextField, c); - - - - c.gridx++; - c.gridwidth = 1; - c.weightx = 0; - p.add(new JLabel("<="), c); - - c.gridx++; - c.gridwidth = 3; - c.weightx = 1; - JLabel nameLabel = new JLabel(getName()); - nameLabel.setHorizontalAlignment(JLabel.CENTER); - p.add(nameLabel, c); - - c.gridx += 3; - c.gridwidth = 1; - c.weightx = 0; - p.add(new JLabel("<="), c); - - c.gridx++; - c.gridwidth = 1; - c.weightx = 1; - JTextField maxTextField = ((JTextField) getComponent(VALUE_MAX)); - if (maxTextField == null) { - maxTextField = new JTextField(4); - if (m_max != null) { - maxTextField.setText(m_max.toString()); - } - registerComponent(VALUE_MAX, maxTextField); - } - p.add(maxTextField, c); - c.gridx++; - } - - @Override - public void reset() { - m_min = null; - m_max = null; - } -} +package fr.proline.studio.filter; + +import java.awt.GridBagConstraints; +import java.util.ArrayList; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +/** + * Filter on float or double values + * + * @author JM235353 + */ +public class DoubleFilter extends Filter { + + private static final Integer VALUE_MIN = 0; + private static final Integer VALUE_MAX = 1; + private Double m_min; + private Double m_max; + + public DoubleFilter(String variableName, ConvertValueInterface convertValueInterface, int modelColumn) { + super(variableName, convertValueInterface, modelColumn); + + m_valueKeys = new ArrayList<>(2); + m_valueKeys.add(VALUE_MIN); + m_valueKeys.add(VALUE_MAX); + } + + @Override + public Filter cloneFilter4Search() { + DoubleFilter clone = new DoubleFilter(m_variableName, m_convertValueInterface, m_modelColumn); + clone.m_min = m_min; + clone.m_max = m_max; + setValuesForClone(clone); + return clone; + } + + @Override + public FilterStatus checkValues() { + + Double min; + String minValue = ((JTextField) getComponent(VALUE_MIN)).getText().trim(); + if ((minValue == null) || (minValue.length() == 0)) { + min = null; + } else { + try { + min = Double.parseDouble(minValue); + } catch (NumberFormatException nfe) { + return new FilterStatus("Min Value is not a Number", m_components.get(VALUE_MIN)); + } + } + + Double max; + String maxValue = ((JTextField) getComponent(VALUE_MAX)).getText().trim(); + if ((maxValue == null) || (maxValue.length() == 0)) { + max = null; + } else { + try { + max = Double.parseDouble(maxValue); + } catch (NumberFormatException nfe) { + return new FilterStatus("Max Value is not a Number", m_components.get(VALUE_MAX)); + } + } + + if ((min != null) && (max != null) && (min > max)) { + return new FilterStatus("Min Value is greater than Max Value", m_components.get(VALUE_MIN)); + } + + return null; + } + + @Override + public boolean registerValues() { + + boolean hasChanged = false; + + if (isDefined()) { + + Double lastMinValue = m_min; + Double lastMaxValue = m_max; + + String minValue = ((JTextField) getComponent(VALUE_MIN)).getText().trim(); + if ((minValue == null) || (minValue.length() == 0)) { + m_min = null; + } else { + try { + m_min = Double.parseDouble(minValue); + } catch (NumberFormatException nfe) { + // should never happen + } + } + + String maxValue = ((JTextField) getComponent(VALUE_MAX)).getText().trim(); + if ((maxValue == null) || (maxValue.length() == 0)) { + m_max = null; + } else { + try { + m_max = Double.parseDouble(maxValue); + } catch (NumberFormatException nfe) { + // should never happen + } + } + + if (((lastMinValue == null) && (m_min!=null)) || ((lastMinValue != null) && (m_min==null))) { + hasChanged = true; + } else if (((lastMaxValue == null) && (m_max!=null)) || ((lastMaxValue != null) && (m_max==null))) { + hasChanged = true; + } else if ((lastMinValue != null) && (lastMinValue.doubleValue() != m_min.doubleValue())) { + hasChanged = true; + } else if ((lastMaxValue != null) && (lastMaxValue.doubleValue() != m_max.doubleValue())) { + hasChanged = true; + } + + } + + registerDefinedAsUsed(); + + return hasChanged; + } + + @Override + public boolean filter(Object v1, Object v2) { + + double value = ((Number) v1).doubleValue(); + + if (value != value) { // NaN + return false; + } + + if (m_min != null) { + if (value < m_min.doubleValue()) { + return false; + } + } + if (m_max != null) { + if (value > m_max.doubleValue()) { + return false; + } + } + return true; + + } + + @Override + public void createComponents(JPanel p, GridBagConstraints c) { + c.gridx++; + c.gridwidth = 1; + c.weightx = 1; + JTextField minTextField = ((JTextField) getComponent(VALUE_MIN)); + if (minTextField == null) { + minTextField = new JTextField(8); + if (m_min != null) { + minTextField.setText(m_min.toString()); + } + registerComponent(VALUE_MIN, minTextField); + } + p.add(minTextField, c); + + + + c.gridx++; + c.gridwidth = 1; + c.weightx = 0; + p.add(new JLabel("<="), c); + + c.gridx++; + c.gridwidth = 3; + c.weightx = 1; + JLabel nameLabel = new JLabel(getName()); + nameLabel.setHorizontalAlignment(JLabel.CENTER); + p.add(nameLabel, c); + + c.gridx += 3; + c.gridwidth = 1; + c.weightx = 0; + p.add(new JLabel("<="), c); + + c.gridx++; + c.gridwidth = 1; + c.weightx = 1; + JTextField maxTextField = ((JTextField) getComponent(VALUE_MAX)); + if (maxTextField == null) { + maxTextField = new JTextField(8); + if (m_max != null) { + maxTextField.setText(m_max.toString()); + } + registerComponent(VALUE_MAX, maxTextField); + } + p.add(maxTextField, c); + c.gridx++; + } + + @Override + public void reset() { + m_min = null; + m_max = null; + } +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/DurationFilter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/DurationFilter.java index f8f1942e0..60a40aab2 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/DurationFilter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/DurationFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/Filter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/Filter.java index fd47245fa..f75956c5d 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/Filter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/Filter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; import fr.proline.studio.table.LazyData; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterButton.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterButton.java index 2500ff1a2..d6e2f2333 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterButton.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterButton.java @@ -1,21 +1,22 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; +import fr.proline.studio.WindowManager; import fr.proline.studio.progress.ProgressBarDialog; import fr.proline.studio.utils.IconManager; import java.awt.event.ActionEvent; @@ -24,7 +25,6 @@ import java.util.Map; import javax.swing.Icon; import javax.swing.JButton; -import org.openide.windows.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterComboboxRenderer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterComboboxRenderer.java index 8863e87aa..32ddf3726 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterComboboxRenderer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterComboboxRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; import java.awt.Component; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterDialog.java index 1c5183544..423855bdb 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterDialog.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterMapInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterMapInterface.java index 9b0bcd782..633a29cb8 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterMapInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterMapInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,14 +14,14 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.filter; - -import java.util.LinkedHashMap; - -/** - * - * @author JM235353 - */ -public interface FilterMapInterface { - public LinkedHashMap getFilters(); -} +package fr.proline.studio.filter; + +import java.util.LinkedHashMap; + +/** + * + * @author JM235353 + */ +public interface FilterMapInterface { + public LinkedHashMap getFilters(); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterMirroredTableModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterMirroredTableModel.java index a60dfbb10..c70ddbaca 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterMirroredTableModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterMirroredTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterPanel.java index e06e9d503..e50b01c55 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterProviderInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterProviderInterface.java index 40d2a28e1..264f5b9e3 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterProviderInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterProviderInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,17 +14,17 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.filter; - - -import java.util.LinkedHashMap; - -/** - * Interface to extend for models which wants to enable filtering on some columns - * @author JM235353 - */ -public interface FilterProviderInterface { - - public void addFilters(LinkedHashMap filtersMap); - -} +package fr.proline.studio.filter; + + +import java.util.LinkedHashMap; + +/** + * Interface to extend for models which wants to enable filtering on some columns + * @author JM235353 + */ +public interface FilterProviderInterface { + + public void addFilters(LinkedHashMap filtersMap); + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterStatus.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterStatus.java index 643c8cc6f..010efb511 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterStatus.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterStatus.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; import java.awt.Component; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterTableModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterTableModel.java index 4acb2c4c9..7fda14565 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterTableModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterTableModel.java @@ -1,21 +1,23 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dock.gui.InfoLabel; import fr.proline.studio.extendedtablemodel.ExtraDataType; import fr.proline.studio.export.ExportFontData; import fr.proline.studio.graphics.PlotInformation; @@ -25,7 +27,6 @@ import fr.proline.studio.table.DecoratedTableModelInterface; import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; import fr.proline.studio.table.LazyData; -import fr.proline.studio.utils.StudioExceptions; import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashMap; @@ -35,6 +36,7 @@ import javax.swing.table.TableCellRenderer; import javax.swing.table.TableModel; import org.jdesktop.swingx.JXTable; +import org.slf4j.LoggerFactory; /** * Model use to filter data and/or restrain rows of another model @@ -251,7 +253,8 @@ public boolean filter() { } fireTableDataChanged(); } catch (Exception e) { - StudioExceptions.logAndNotify("ProlineStudio.Commons", "Error during table filtering", e); + LoggerFactory.getLogger("ProlineStudio.Commons").error("Error during table filtering", e); + WindowManager.getDefault().getMainWindow().alert(InfoLabel.INFO_LEVEL.ERROR, "Error during table filtering", e); } return true; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterTableModelInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterTableModelInterface.java index f3d8e85a5..2af8b485e 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterTableModelInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/FilterTableModelInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/IntegerFilter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/IntegerFilter.java index 9f39e816f..ce19afa28 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/IntegerFilter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/IntegerFilter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; import java.awt.GridBagConstraints; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/LockedFilterTableModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/LockedFilterTableModel.java index b5bff233d..9a217e430 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/LockedFilterTableModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/LockedFilterTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; import fr.proline.studio.extendedtablemodel.ExtraDataType; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/LongFilter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/LongFilter.java index 81e12ba23..888fba0b4 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/LongFilter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/LongFilter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; import java.awt.GridBagConstraints; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/StringDiffFilter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/StringDiffFilter.java index ddde380d0..403954f3b 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/StringDiffFilter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/StringDiffFilter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; import java.util.regex.Matcher; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/StringFilter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/StringFilter.java index 73de72868..f8d3ea699 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/StringFilter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/StringFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -17,6 +17,9 @@ package fr.proline.studio.filter; import static fr.proline.studio.filter.StringDiffFilter.SEARCH_TEXT_AREA; + +import fr.proline.studio.Exceptions; +import fr.proline.studio.WindowManager; import fr.proline.studio.utils.StringUtils; import java.awt.GridBagConstraints; import java.awt.Toolkit; @@ -40,9 +43,6 @@ import javax.swing.JTextField; import javax.swing.KeyStroke; import javax.swing.text.JTextComponent; -import org.openide.util.Exceptions; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -305,7 +305,7 @@ public void clearComponents() { */ protected JTextField createPasteTextField(String filterText) { JTextField vTextField = new JTextField(12); - String msg = NbBundle.getMessage(this.getClass(), "Filter_String_RegularExpression.tooltip.text"); + String msg = "Search is based on wildcards:
'*' : can replace all characters
'?' : can replace one character

Use 'FOO*' to search a string starting with FOO. "; vTextField.setToolTipText(msg); if (filterText != null) { vTextField.setText(filterText); @@ -324,7 +324,7 @@ protected JTextField createPasteTextField(String filterText) { protected JTextArea createPasteArea(String filterAreaText) { JTextArea vArea = new JTextArea(5, 20); - String msg = NbBundle.getMessage(this.getClass(), "Filter_String_RegularExpression.tooltip.text"); + String msg = "Search is based on wildcards:
'*' : can replace all characters
'?' : can replace one character

Use 'FOO*' to search a string starting with FOO. "; vArea.setToolTipText(msg); if (filterAreaText != null) { vArea.setText(filterAreaText); diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/ValueFilter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/ValueFilter.java index 092e31832..111f6f6c3 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/ValueFilter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/ValueFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/ValueListAssociatedStringFilter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/ValueListAssociatedStringFilter.java index 5bbe6bd5d..83a596039 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/ValueListAssociatedStringFilter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/ValueListAssociatedStringFilter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter; import java.awt.Color; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/actions/ClearRestrainAction.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/actions/ClearRestrainAction.java index d04e2572d..cfb678d49 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/actions/ClearRestrainAction.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/actions/ClearRestrainAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter.actions; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/actions/RestrainAction.java b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/actions/RestrainAction.java index 5a426d240..6da05f553 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/filter/actions/RestrainAction.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/filter/actions/RestrainAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.filter.actions; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/AbstractSelectionGesture.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/AbstractSelectionGesture.java index 95335aae0..ef4b087b2 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/AbstractSelectionGesture.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/AbstractSelectionGesture.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics; import java.awt.Graphics; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/Axis.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/Axis.java index 2b7ff243e..5fa36ade5 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/Axis.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/Axis.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -41,7 +41,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -100,7 +100,7 @@ public abstract class Axis { protected int m_minimumAxisWidth = 0; private boolean m_maxZoomDone = false; - + private boolean m_rangeModifiedByUser = false; protected static final double LOG_MIN_VALUE = 10e-13; @@ -369,7 +369,7 @@ public boolean getRangeModifiedByUser() { public void setRangeModifiedByUser(boolean rangeModifiedByUser) { m_rangeModifiedByUser = rangeModifiedByUser; } - + public void setRange(double min, double max, boolean rangeModifiedByUser) { setRange(min, max); setRangeModifiedByUser(rangeModifiedByUser); diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/AxisDataStore.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/AxisDataStore.java index 9b7ca51b5..06cab256c 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/AxisDataStore.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/AxisDataStore.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/AxisTicks.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/AxisTicks.java index 92199baa6..8995b62ac 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/AxisTicks.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/AxisTicks.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/BasePlotPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/BasePlotPanel.java index 6e340fe19..3c6564c4d 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/BasePlotPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/BasePlotPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/BasePlotPanelViewAll.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/BasePlotPanelViewAll.java index d91f65af3..5a5ed5906 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/BasePlotPanelViewAll.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/BasePlotPanelViewAll.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/BestGraphicsInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/BestGraphicsInterface.java index 9b48940e5..ebdd6cf07 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/BestGraphicsInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/BestGraphicsInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,14 +14,14 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.graphics; - -/** - * - * @author JM235353 - */ -public interface BestGraphicsInterface { - - public PlotType getBestPlotType(); - public int[] getBestColIndex(PlotType plotType); -} +package fr.proline.studio.graphics; + +/** + * + * @author JM235353 + */ +public interface BestGraphicsInterface { + + public PlotType getBestPlotType(); + public int[] getBestColIndex(PlotType plotType); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorButton.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorButton.java index eab2f18c7..9873d0469 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorButton.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorButton.java @@ -1,21 +1,22 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics; +import fr.proline.studio.WindowManager; import fr.proline.studio.graphics.colorpicker.ColorDataInterface; import fr.proline.studio.graphics.colorpicker.ColorPickerDialog; import fr.proline.studio.gui.DefaultDialog; @@ -26,7 +27,6 @@ import java.awt.event.ActionListener; import java.util.ArrayList; import javax.swing.JButton; -import org.openide.windows.WindowManager; /** * diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorButtonAndPalettePanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorButtonAndPalettePanel.java index 7caa6b084..3ecd9fe54 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorButtonAndPalettePanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorButtonAndPalettePanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics; import fr.proline.studio.graphics.colorpicker.ColorDataInterface; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorOrGradient.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorOrGradient.java index 9d38a3ade..b17d06cb1 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorOrGradient.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorOrGradient.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics; import java.awt.Color; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorOrGradientChooserPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorOrGradientChooserPanel.java index 67a238faa..368a7cd42 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorOrGradientChooserPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ColorOrGradientChooserPanel.java @@ -1,21 +1,22 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics; +import fr.proline.studio.WindowManager; import fr.proline.studio.graphics.colorpicker.ColorPickerDialog; import fr.proline.studio.gui.DefaultDialog; import java.awt.Color; @@ -37,7 +38,6 @@ import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.JRadioButton; -import org.openide.windows.WindowManager; /** * diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/CrossSelectionInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/CrossSelectionInterface.java index ed769d28c..2409e1ac0 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/CrossSelectionInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/CrossSelectionInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,16 +14,16 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.graphics; - -import java.util.ArrayList; - -/** - * - * @author JM235353 - */ -public interface CrossSelectionInterface { - - public void select(ArrayList uniqueIds); - public ArrayList getSelection(); -} +package fr.proline.studio.graphics; + +import java.util.ArrayList; + +/** + * + * @author JM235353 + */ +public interface CrossSelectionInterface { + + public void select(ArrayList uniqueIds); + public ArrayList getSelection(); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ExtendableButtonPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ExtendableButtonPanel.java index 7f22a62d9..636b17e8e 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ExtendableButtonPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ExtendableButtonPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ExtendableButtonPanelGroup.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ExtendableButtonPanelGroup.java index fd4b614ab..cc5370485 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ExtendableButtonPanelGroup.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ExtendableButtonPanelGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/GraphicColors.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/GraphicColors.java index b9e7128af..96cd0d576 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/GraphicColors.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/GraphicColors.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics; import java.util.ArrayList; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/GraphicDataGroup.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/GraphicDataGroup.java index 1538858f8..d1d13ea84 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/GraphicDataGroup.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/GraphicDataGroup.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics; import fr.proline.studio.graphics.marker.AbstractMarker; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/MonoGraphicsPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/MonoGraphicsPanel.java index c7b8473d9..40c239728 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/MonoGraphicsPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/MonoGraphicsPanel.java @@ -1,627 +1,628 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.graphics; - -import fr.proline.studio.graphics.core.GraphicsToolbarPanel; -import fr.proline.studio.extendedtablemodel.LockedDataModel; -import fr.proline.studio.export.ExportButton; -import static fr.proline.studio.graphics.PlotBaseAbstract.COL_X_ID; -import static fr.proline.studio.graphics.PlotBaseAbstract.COL_Y_ID; -import fr.proline.studio.gui.AdvancedSelectionPanel; -import fr.proline.studio.parameter.DefaultParameterDialog; -import fr.proline.studio.parameter.MultiObjectParameter; -import fr.proline.studio.parameter.ParameterList; -import fr.proline.studio.parameter.SettingsButton; -import fr.proline.studio.utils.IconManager; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import javax.swing.Box; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JToolBar; -import org.openide.windows.WindowManager; -import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; - -/** - * - * @author JM235353 - */ -public class MonoGraphicsPanel extends GraphicsToolbarPanel { - - private JComboBox m_allPlotsComboBox; - private JComboBox m_valueXComboBox; - private JComboBox m_valueYComboBox; - private JComboBox m_valueZComboBox; - private JButton m_selectDataColumnsButton; - private JLabel m_valueXLabel; - private JLabel m_valueYLabel; - private JLabel m_valueZLabel; - - private MultiObjectParameter m_columnsParameter = null; - - private PlotBaseAbstract m_plotGraphics = null; - - private ExtendedTableModelInterface m_values = null; - private CrossSelectionInterface m_crossSelectionInterface = null; - - private boolean m_isUpdatingCbx = false; - - - public MonoGraphicsPanel(boolean dataLocked) { - super(dataLocked, false); - fillGraphicToolbar(); - } - - public PlotBaseAbstract getPlotGraphics() { - return m_plotGraphics; - } - - public JPanel getPlotPanel() { - return m_plotPanel; - } - - @Override - protected final JPanel createInternalPanel() { - - JPanel internalPanel = new JPanel(); - internalPanel.setLayout(new GridBagLayout()); - - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(0, 5, 0, 5); - - PlotPanel panel = new PlotPanel(false); - m_plotPanel = panel.getBasePlotPanel(); - m_plotPanel.setPlotToolbarListener(this); - JPanel selectPanel = createSelectPanel(); - - c.gridx = 0; - c.gridy = 0; - internalPanel.add(selectPanel, c); - - c.gridy++; - c.weightx = 1; - c.weighty = 1; - internalPanel.add(panel, c); - - return internalPanel; - } - - @Override - public final void fillToolbar(JToolBar toolbar) { - - - SettingsButton settingsButton = new SettingsButton(null, m_plotPanel); - - - m_importSelectionButton = new JButton(IconManager.getIcon(IconManager.IconType.IMPORT_TABLE_SELECTION)); - m_importSelectionButton.setToolTipText( "Import Selection from Previous View"); - m_importSelectionButton.setFocusPainted(false); - m_importSelectionButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (m_crossSelectionInterface != null) { - ArrayList selection = m_crossSelectionInterface.getSelection(); - m_plotPanel.setSelection(selection); - } - } - }); - m_exportSelectionButton = new JButton(IconManager.getIcon(IconManager.IconType.EXPORT_TABLE_SELECTION)); - m_exportSelectionButton.setToolTipText("Export Selection to Previous View"); - m_exportSelectionButton.setFocusPainted(false); - m_exportSelectionButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (m_crossSelectionInterface != null) { - m_crossSelectionInterface.select(m_plotPanel.getSelection()); - } - } - }); - - - final JButton lockButton = new JButton(m_dataLocked ? IconManager.getIcon(IconManager.IconType.LOCK) : IconManager.getIcon(IconManager.IconType.UNLOCK)); - lockButton.setToolTipText( "Lock/Unlock Input Data"); - lockButton.setFocusPainted(false); - lockButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - - m_dataLocked = ! m_dataLocked; - if (m_dataLocked) { - m_values = new LockedDataModel(m_values); - } else { - m_values = ((LockedDataModel) m_values).getSrcDataInterface(); - } - - m_plotPanel.lockData(m_dataLocked); - setDataImpl(m_values, m_crossSelectionInterface); - - if (m_dataLocked) { - lockButton.setIcon(IconManager.getIcon(IconManager.IconType.LOCK)); - } else { - lockButton.setIcon(IconManager.getIcon(IconManager.IconType.UNLOCK)); - } - } - }); - - - ExportButton exportImageButton = new ExportButton("Graphic", m_plotPanel); - - - // add buttons to toolbar - toolbar.add(settingsButton); - toolbar.addSeparator(); // ---- - toolbar.add(lockButton); - toolbar.add(m_importSelectionButton); - toolbar.add(m_exportSelectionButton); - toolbar.addSeparator(); // ---- - toolbar.add(exportImageButton); - - } - - - private JPanel createSelectPanel() { - JPanel selectPanel = new JPanel(); - selectPanel.setLayout(new GridBagLayout()); - - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - JLabel selectLabel = new JLabel("Graphic :"); - m_allPlotsComboBox = new JComboBox(PlotType.ALL_PLOTS); - m_valueXComboBox = new JComboBox(); - m_valueYComboBox = new JComboBox(); - m_valueZComboBox = new JComboBox(); - m_selectDataColumnsButton = new JButton("Select Data Columns"); - m_valueXLabel = new JLabel(); - m_valueYLabel = new JLabel(); - m_valueZLabel = new JLabel(); - updateXYCbxVisibility(); - - m_allPlotsComboBox.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (m_isUpdatingCbx) { - return; - } - - - fillXYCombobox(false); - updateXYCbxVisibility(); - - } - }); - - m_selectDataColumnsButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - - ParameterList parameterList = new ParameterList("MULTI_COLUMNS_GRAPHICS"); - - if (m_columnsParameter == null) { - - ArrayList columnNamesArrayList = new ArrayList<>(); - ArrayList columnIdsArrayList = new ArrayList<>(); - - int nbColumns = m_values.getColumnCount(); - for (int i = 0; i < nbColumns; i++) { - Class c = m_values.getDataColumnClass(i); - if ((c.equals(Double.class)) || (c.equals(Float.class)) || (c.equals(Long.class)) || (c.equals(Integer.class)) || (c.equals(String.class))) { - columnNamesArrayList.add(m_values.getDataColumnIdentifier(i)); - columnIdsArrayList.add(i); - } - } - - int nb = columnNamesArrayList.size(); - - boolean[] selection = new boolean[nb]; - for (int i = 0; i < nb; i++) { - selection[i] = false; - } - - Object[] columnNamesArray = columnNamesArrayList.toArray(new String[nb]); - Object[] columnIdsArray = columnIdsArrayList.toArray(new Integer[nb]); - - m_columnsParameter = new MultiObjectParameter("MULTI_COLUMNS", "Columns Selection", "Selected Columns", "Unselected Columns", AdvancedSelectionPanel.class, columnNamesArray, columnIdsArray, selection, null); - - } - parameterList.add(m_columnsParameter); - - ArrayList parameterListArray = new ArrayList<>(1); - parameterListArray.add(parameterList); - - DefaultParameterDialog parameterDialog = new DefaultParameterDialog(WindowManager.getDefault().getMainWindow(), "Columns Parameters", parameterListArray); - parameterDialog.setLocationRelativeTo(m_plotPanel); - parameterDialog.setVisible(true); - - if (parameterDialog.getButtonClicked() == DefaultParameterDialog.BUTTON_OK) { - ArrayList selectedColumnsList = (ArrayList) m_columnsParameter.getAssociatedValues(true); - int nbSelected = selectedColumnsList.size(); - - int[] cols = new int[nbSelected]; - for (int i = 0; i < nbSelected; i++) { - cols[i] = selectedColumnsList.get(i); - } - m_plotGraphics.update(cols, null); - } - - } - }); - - - c.gridx = 0; - c.gridy = 0; - selectPanel.add(selectLabel, c); - - c.gridx++; - selectPanel.add(m_allPlotsComboBox, c); - - c.gridx++; - selectPanel.add(m_valueXLabel, c); - - c.gridx++; - selectPanel.add(m_valueXComboBox, c); - - c.gridx++; - selectPanel.add(m_selectDataColumnsButton, c); - - c.gridx++; - selectPanel.add(m_valueYLabel, c); - - c.gridx++; - selectPanel.add(m_valueYComboBox, c); - - c.gridx++; - selectPanel.add(m_valueZLabel, c); - - c.gridx++; - selectPanel.add(m_valueZComboBox, c); - - c.gridx++; - c.weightx = 1; - selectPanel.add(Box.createHorizontalGlue(), c); - - return selectPanel; - - } - - private void updateXYCbxVisibility() { - PlotType plotType = (PlotType) m_allPlotsComboBox.getSelectedItem(); - - m_valueXLabel.setVisible(plotType.needsX() || plotType.needsMultiData()); - m_valueXComboBox.setVisible(plotType.needsX()); - - m_selectDataColumnsButton.setVisible(plotType.needsMultiData()); - - m_valueYLabel.setVisible(plotType.needsY()); - m_valueYComboBox.setVisible(plotType.needsY()); - - m_valueZLabel.setVisible(plotType.needsZ()); - m_valueZComboBox.setVisible(plotType.needsZ()); - - if (plotType.needsX() || plotType.needsMultiData()) { - m_valueXLabel.setText(plotType.getXLabel()); - } - if (plotType.needsY()) { - m_valueYLabel.setText(plotType.getYLabel()); - } - if (plotType.needsZ()) { - m_valueZLabel.setText(plotType.getZLabel()); - } - - - } - - private void fillXYCombobox(boolean changePlotType) { - - m_isUpdatingCbx = true; - try { - - if (m_values == null) { - return; - } - - // clear combobox - ((DefaultComboBoxModel) m_valueXComboBox.getModel()).removeAllElements(); - ((DefaultComboBoxModel) m_valueYComboBox.getModel()).removeAllElements(); - ((DefaultComboBoxModel) m_valueZComboBox.getModel()).removeAllElements(); - - PlotType plotType = null; - if ((changePlotType) && (m_values instanceof BestGraphicsInterface)) { - plotType = ((BestGraphicsInterface)m_values).getBestPlotType(); - if (plotType != null) { - m_allPlotsComboBox.setSelectedItem(plotType); - } - } - if (plotType == null) { - plotType = (PlotType) m_allPlotsComboBox.getSelectedItem(); - } - if (changePlotType) { - updateXYCbxVisibility(); - } - - HashSet acceptedValues = plotType.getAcceptedXValues(); - - int nbValuesType = m_values.getColumnCount(); - - // find the best column for the current plot - int bestColX = -1; - int bestColY = -1; - if (m_values instanceof BestGraphicsInterface) { - BestGraphicsInterface bestGraphics = (BestGraphicsInterface) m_values; - int[] cols = bestGraphics.getBestColIndex(plotType); - if (cols!= null) { - bestColX = cols[0]; - bestColY = cols[1]; - } - - } - - // fill the comboboxes and find the index to be selected - int bestColIndexXCbx = 0; - int bestColIndexYCbx = (nbValuesType >= 2) ? 1 : 0; - int nbValuesInCbx = 0; - for (int i = 0; i < nbValuesType; i++) { - Class c = m_values.getDataColumnClass(i); - if (acceptedValues.contains(c)) { - ReferenceIdName ref = new ReferenceIdName(m_values.getDataColumnIdentifier(i), i); - ((DefaultComboBoxModel) m_valueXComboBox.getModel()).addElement(ref); - ((DefaultComboBoxModel) m_valueYComboBox.getModel()).addElement(ref); - if (bestColX == i) { - bestColIndexXCbx = nbValuesInCbx; - } - if (bestColY == i) { - bestColIndexYCbx = nbValuesInCbx; - } - nbValuesInCbx++; - - } - } - - m_valueXComboBox.setSelectedIndex(bestColIndexXCbx); - m_valueYComboBox.setSelectedIndex(bestColIndexYCbx); - - if (plotType.needsZ()) { - ArrayList zValues = plotType.getZValues(); - for (int i=0;i columnNamesArrayList = new ArrayList<>(); - ArrayList columnIdsArrayList = new ArrayList<>(); - - int nbColumns = m_values.getColumnCount(); - int indexCur = 0; - for (int i = 0; i < nbColumns; i++) { - Class c = m_values.getDataColumnClass(i); - - if ((c!= null) && ((c.equals(Double.class)) || (c.equals(Float.class)) || (c.equals(Long.class)) || (c.equals(Integer.class)) || (c.equals(String.class)))) { - columnNamesArrayList.add(m_values.getDataColumnIdentifier(i)); - columnIdsArrayList.add(i); - - if (cols != null) { - for (int j = 0; j < cols.length; j++) { - if ((!done[j]) && (cols[j] == i)) { - cols[j] = indexCur; - done[j] = true; - } - } - } - indexCur++; - } - } - - int nb = columnNamesArrayList.size(); - - boolean[] selection = new boolean[nb]; - for (int i = 0; i < nb; i++) { - selection[i] = false; - } - if (cols != null) { - for (int j = 0; j < cols.length; j++) { - selection[cols[j]] = true; - } - } - - Object[] columnNamesArray = columnNamesArrayList.toArray(new String[nb]); - Object[] columnIdsArray = columnIdsArrayList.toArray(new Integer[nb]); - - m_columnsParameter = new MultiObjectParameter("MULTI_COLUMNS", "Columns Selection", "Selected Columns", "Unselected Columns", AdvancedSelectionPanel.class, columnNamesArray, columnIdsArray, selection, null); - m_columnsParameter.getComponent(null); // finalize initialization, to be able to retrieve selected cols. - } - } else { - - ArrayList selectedColumnsList = (ArrayList) m_columnsParameter.getAssociatedValues(true); - int nbSelected = selectedColumnsList.size(); - - cols = new int[nbSelected]; - for (int i = 0; i < nbSelected; i++) { - cols[i] = selectedColumnsList.get(i); - } - } - - ReferenceIdName refX = (ReferenceIdName) m_valueXComboBox.getSelectedItem(); - ReferenceIdName refY = (ReferenceIdName) m_valueYComboBox.getSelectedItem(); - String zParameter = (String) m_valueZComboBox.getSelectedItem(); - - - // enable buttons before to reinit them - m_gridButton.setEnabled(true); - m_importSelectionButton.setEnabled(true); - m_exportSelectionButton.setEnabled(true); - - switch (plotType) { - case HISTOGRAM_PLOT: - m_plotGraphics = new PlotHistogram(m_plotPanel, m_values, m_crossSelectionInterface, refX.getColumnIndex(), zParameter); - m_plotPanel.setPlot(m_plotGraphics); - break; - case SCATTER_PLOT: - m_plotGraphics = new PlotScatter(m_plotPanel, m_values, m_crossSelectionInterface, refX.getColumnIndex(), refY.getColumnIndex()); - m_plotPanel.setPlot(m_plotGraphics); - break; - case VENN_DIAGRAM_PLOT: - m_plotGraphics = new PlotVennDiagram(m_plotPanel, m_values, m_crossSelectionInterface, cols); - m_plotPanel.setPlot(m_plotGraphics); - break; - case PARALLEL_COORDINATES_PLOT: - m_plotGraphics = new PlotParallelCoordinates(m_plotPanel, m_values, m_crossSelectionInterface, cols); - m_plotPanel.setPlot(m_plotGraphics); - break; - case LINEAR_PLOT: - m_plotGraphics = new PlotLinear(m_plotPanel, m_values, m_crossSelectionInterface, refX.getColumnIndex(), refY.getColumnIndex()); - m_plotPanel.setPlot(m_plotGraphics); - break; - } - - - - - } - - - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.graphics; + +import fr.proline.studio.WindowManager; +import fr.proline.studio.graphics.core.GraphicsToolbarPanel; +import fr.proline.studio.extendedtablemodel.LockedDataModel; +import fr.proline.studio.export.ExportButton; +import static fr.proline.studio.graphics.PlotBaseAbstract.COL_X_ID; +import static fr.proline.studio.graphics.PlotBaseAbstract.COL_Y_ID; +import fr.proline.studio.gui.AdvancedSelectionPanel; +import fr.proline.studio.parameter.DefaultParameterDialog; +import fr.proline.studio.parameter.MultiObjectParameter; +import fr.proline.studio.parameter.ParameterList; +import fr.proline.studio.parameter.SettingsButton; +import fr.proline.studio.utils.IconManager; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import javax.swing.Box; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JToolBar; + +import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; + +/** + * + * @author JM235353 + */ +public class MonoGraphicsPanel extends GraphicsToolbarPanel { + + private JComboBox m_allPlotsComboBox; + private JComboBox m_valueXComboBox; + private JComboBox m_valueYComboBox; + private JComboBox m_valueZComboBox; + private JButton m_selectDataColumnsButton; + private JLabel m_valueXLabel; + private JLabel m_valueYLabel; + private JLabel m_valueZLabel; + + private MultiObjectParameter m_columnsParameter = null; + + private PlotBaseAbstract m_plotGraphics = null; + + private ExtendedTableModelInterface m_values = null; + private CrossSelectionInterface m_crossSelectionInterface = null; + + private boolean m_isUpdatingCbx = false; + + + public MonoGraphicsPanel(boolean dataLocked) { + super(dataLocked, false); + fillGraphicToolbar(); + } + + public PlotBaseAbstract getPlotGraphics() { + return m_plotGraphics; + } + + public JPanel getPlotPanel() { + return m_plotPanel; + } + + @Override + protected final JPanel createInternalPanel() { + + JPanel internalPanel = new JPanel(); + internalPanel.setLayout(new GridBagLayout()); + + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.insets = new java.awt.Insets(0, 5, 0, 5); + + PlotPanel panel = new PlotPanel(); + m_plotPanel = panel.getBasePlotPanel(); + m_plotPanel.setPlotToolbarListener(this); + JPanel selectPanel = createSelectPanel(); + + c.gridx = 0; + c.gridy = 0; + internalPanel.add(selectPanel, c); + + c.gridy++; + c.weightx = 1; + c.weighty = 1; + internalPanel.add(panel, c); + + return internalPanel; + } + + @Override + public final void fillToolbar(JToolBar toolbar) { + + + SettingsButton settingsButton = new SettingsButton(null, m_plotPanel); + + + m_importSelectionButton = new JButton(IconManager.getIcon(IconManager.IconType.IMPORT_TABLE_SELECTION)); + m_importSelectionButton.setToolTipText( "Import Selection from Previous View"); + m_importSelectionButton.setFocusPainted(false); + m_importSelectionButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (m_crossSelectionInterface != null) { + ArrayList selection = m_crossSelectionInterface.getSelection(); + m_plotPanel.setSelection(selection); + } + } + }); + m_exportSelectionButton = new JButton(IconManager.getIcon(IconManager.IconType.EXPORT_TABLE_SELECTION)); + m_exportSelectionButton.setToolTipText("Export Selection to Previous View"); + m_exportSelectionButton.setFocusPainted(false); + m_exportSelectionButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (m_crossSelectionInterface != null) { + m_crossSelectionInterface.select(m_plotPanel.getSelection()); + } + } + }); + + + final JButton lockButton = new JButton(m_dataLocked ? IconManager.getIcon(IconManager.IconType.LOCK) : IconManager.getIcon(IconManager.IconType.UNLOCK)); + lockButton.setToolTipText( "Lock/Unlock Input Data"); + lockButton.setFocusPainted(false); + lockButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + + m_dataLocked = ! m_dataLocked; + if (m_dataLocked) { + m_values = new LockedDataModel(m_values); + } else { + m_values = ((LockedDataModel) m_values).getSrcDataInterface(); + } + + m_plotPanel.lockData(m_dataLocked); + setDataImpl(m_values, m_crossSelectionInterface); + + if (m_dataLocked) { + lockButton.setIcon(IconManager.getIcon(IconManager.IconType.LOCK)); + } else { + lockButton.setIcon(IconManager.getIcon(IconManager.IconType.UNLOCK)); + } + } + }); + + + ExportButton exportImageButton = new ExportButton("Graphic", m_plotPanel); + + + // add buttons to toolbar + toolbar.add(settingsButton); + toolbar.addSeparator(); // ---- + toolbar.add(lockButton); + toolbar.add(m_importSelectionButton); + toolbar.add(m_exportSelectionButton); + toolbar.addSeparator(); // ---- + toolbar.add(exportImageButton); + + } + + + private JPanel createSelectPanel() { + JPanel selectPanel = new JPanel(); + selectPanel.setLayout(new GridBagLayout()); + + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.insets = new java.awt.Insets(5, 5, 5, 5); + + JLabel selectLabel = new JLabel("Graphic :"); + m_allPlotsComboBox = new JComboBox(PlotType.ALL_PLOTS); + m_valueXComboBox = new JComboBox(); + m_valueYComboBox = new JComboBox(); + m_valueZComboBox = new JComboBox(); + m_selectDataColumnsButton = new JButton("Select Data Columns"); + m_valueXLabel = new JLabel(); + m_valueYLabel = new JLabel(); + m_valueZLabel = new JLabel(); + updateXYCbxVisibility(); + + m_allPlotsComboBox.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (m_isUpdatingCbx) { + return; + } + + + fillXYCombobox(false); + updateXYCbxVisibility(); + + } + }); + + m_selectDataColumnsButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + + ParameterList parameterList = new ParameterList("MULTI_COLUMNS_GRAPHICS"); + + if (m_columnsParameter == null) { + + ArrayList columnNamesArrayList = new ArrayList<>(); + ArrayList columnIdsArrayList = new ArrayList<>(); + + int nbColumns = m_values.getColumnCount(); + for (int i = 0; i < nbColumns; i++) { + Class c = m_values.getDataColumnClass(i); + if ((c.equals(Double.class)) || (c.equals(Float.class)) || (c.equals(Long.class)) || (c.equals(Integer.class)) || (c.equals(String.class))) { + columnNamesArrayList.add(m_values.getDataColumnIdentifier(i)); + columnIdsArrayList.add(i); + } + } + + int nb = columnNamesArrayList.size(); + + boolean[] selection = new boolean[nb]; + for (int i = 0; i < nb; i++) { + selection[i] = false; + } + + Object[] columnNamesArray = columnNamesArrayList.toArray(new String[nb]); + Object[] columnIdsArray = columnIdsArrayList.toArray(new Integer[nb]); + + m_columnsParameter = new MultiObjectParameter("MULTI_COLUMNS", "Columns Selection", "Selected Columns", "Unselected Columns", AdvancedSelectionPanel.class, columnNamesArray, columnIdsArray, selection, null); + + } + parameterList.add(m_columnsParameter); + + ArrayList parameterListArray = new ArrayList<>(1); + parameterListArray.add(parameterList); + + DefaultParameterDialog parameterDialog = new DefaultParameterDialog(WindowManager.getDefault().getMainWindow(), "Columns Parameters", parameterListArray); + parameterDialog.setLocationRelativeTo(m_plotPanel); + parameterDialog.setVisible(true); + + if (parameterDialog.getButtonClicked() == DefaultParameterDialog.BUTTON_OK) { + ArrayList selectedColumnsList = (ArrayList) m_columnsParameter.getAssociatedValues(true); + int nbSelected = selectedColumnsList.size(); + + int[] cols = new int[nbSelected]; + for (int i = 0; i < nbSelected; i++) { + cols[i] = selectedColumnsList.get(i); + } + m_plotGraphics.update(cols, null); + } + + } + }); + + + c.gridx = 0; + c.gridy = 0; + selectPanel.add(selectLabel, c); + + c.gridx++; + selectPanel.add(m_allPlotsComboBox, c); + + c.gridx++; + selectPanel.add(m_valueXLabel, c); + + c.gridx++; + selectPanel.add(m_valueXComboBox, c); + + c.gridx++; + selectPanel.add(m_selectDataColumnsButton, c); + + c.gridx++; + selectPanel.add(m_valueYLabel, c); + + c.gridx++; + selectPanel.add(m_valueYComboBox, c); + + c.gridx++; + selectPanel.add(m_valueZLabel, c); + + c.gridx++; + selectPanel.add(m_valueZComboBox, c); + + c.gridx++; + c.weightx = 1; + selectPanel.add(Box.createHorizontalGlue(), c); + + return selectPanel; + + } + + private void updateXYCbxVisibility() { + PlotType plotType = (PlotType) m_allPlotsComboBox.getSelectedItem(); + + m_valueXLabel.setVisible(plotType.needsX() || plotType.needsMultiData()); + m_valueXComboBox.setVisible(plotType.needsX()); + + m_selectDataColumnsButton.setVisible(plotType.needsMultiData()); + + m_valueYLabel.setVisible(plotType.needsY()); + m_valueYComboBox.setVisible(plotType.needsY()); + + m_valueZLabel.setVisible(plotType.needsZ()); + m_valueZComboBox.setVisible(plotType.needsZ()); + + if (plotType.needsX() || plotType.needsMultiData()) { + m_valueXLabel.setText(plotType.getXLabel()); + } + if (plotType.needsY()) { + m_valueYLabel.setText(plotType.getYLabel()); + } + if (plotType.needsZ()) { + m_valueZLabel.setText(plotType.getZLabel()); + } + + + } + + private void fillXYCombobox(boolean changePlotType) { + + m_isUpdatingCbx = true; + try { + + if (m_values == null) { + return; + } + + // clear combobox + ((DefaultComboBoxModel) m_valueXComboBox.getModel()).removeAllElements(); + ((DefaultComboBoxModel) m_valueYComboBox.getModel()).removeAllElements(); + ((DefaultComboBoxModel) m_valueZComboBox.getModel()).removeAllElements(); + + PlotType plotType = null; + if ((changePlotType) && (m_values instanceof BestGraphicsInterface)) { + plotType = ((BestGraphicsInterface)m_values).getBestPlotType(); + if (plotType != null) { + m_allPlotsComboBox.setSelectedItem(plotType); + } + } + if (plotType == null) { + plotType = (PlotType) m_allPlotsComboBox.getSelectedItem(); + } + if (changePlotType) { + updateXYCbxVisibility(); + } + + HashSet acceptedValues = plotType.getAcceptedXValues(); + + int nbValuesType = m_values.getColumnCount(); + + // find the best column for the current plot + int bestColX = -1; + int bestColY = -1; + if (m_values instanceof BestGraphicsInterface) { + BestGraphicsInterface bestGraphics = (BestGraphicsInterface) m_values; + int[] cols = bestGraphics.getBestColIndex(plotType); + if (cols!= null) { + bestColX = cols[0]; + bestColY = cols[1]; + } + + } + + // fill the comboboxes and find the index to be selected + int bestColIndexXCbx = 0; + int bestColIndexYCbx = (nbValuesType >= 2) ? 1 : 0; + int nbValuesInCbx = 0; + for (int i = 0; i < nbValuesType; i++) { + Class c = m_values.getDataColumnClass(i); + if (acceptedValues.contains(c)) { + ReferenceIdName ref = new ReferenceIdName(m_values.getDataColumnIdentifier(i), i); + ((DefaultComboBoxModel) m_valueXComboBox.getModel()).addElement(ref); + ((DefaultComboBoxModel) m_valueYComboBox.getModel()).addElement(ref); + if (bestColX == i) { + bestColIndexXCbx = nbValuesInCbx; + } + if (bestColY == i) { + bestColIndexYCbx = nbValuesInCbx; + } + nbValuesInCbx++; + + } + } + + m_valueXComboBox.setSelectedIndex(bestColIndexXCbx); + m_valueYComboBox.setSelectedIndex(bestColIndexYCbx); + + if (plotType.needsZ()) { + ArrayList zValues = plotType.getZValues(); + for (int i=0;i columnNamesArrayList = new ArrayList<>(); + ArrayList columnIdsArrayList = new ArrayList<>(); + + int nbColumns = m_values.getColumnCount(); + int indexCur = 0; + for (int i = 0; i < nbColumns; i++) { + Class c = m_values.getDataColumnClass(i); + + if ((c!= null) && ((c.equals(Double.class)) || (c.equals(Float.class)) || (c.equals(Long.class)) || (c.equals(Integer.class)) || (c.equals(String.class)))) { + columnNamesArrayList.add(m_values.getDataColumnIdentifier(i)); + columnIdsArrayList.add(i); + + if (cols != null) { + for (int j = 0; j < cols.length; j++) { + if ((!done[j]) && (cols[j] == i)) { + cols[j] = indexCur; + done[j] = true; + } + } + } + indexCur++; + } + } + + int nb = columnNamesArrayList.size(); + + boolean[] selection = new boolean[nb]; + for (int i = 0; i < nb; i++) { + selection[i] = false; + } + if (cols != null) { + for (int j = 0; j < cols.length; j++) { + selection[cols[j]] = true; + } + } + + Object[] columnNamesArray = columnNamesArrayList.toArray(new String[nb]); + Object[] columnIdsArray = columnIdsArrayList.toArray(new Integer[nb]); + + m_columnsParameter = new MultiObjectParameter("MULTI_COLUMNS", "Columns Selection", "Selected Columns", "Unselected Columns", AdvancedSelectionPanel.class, columnNamesArray, columnIdsArray, selection, null); + m_columnsParameter.getComponent(null); // finalize initialization, to be able to retrieve selected cols. + } + } else { + + ArrayList selectedColumnsList = (ArrayList) m_columnsParameter.getAssociatedValues(true); + int nbSelected = selectedColumnsList.size(); + + cols = new int[nbSelected]; + for (int i = 0; i < nbSelected; i++) { + cols[i] = selectedColumnsList.get(i); + } + } + + ReferenceIdName refX = (ReferenceIdName) m_valueXComboBox.getSelectedItem(); + ReferenceIdName refY = (ReferenceIdName) m_valueYComboBox.getSelectedItem(); + String zParameter = (String) m_valueZComboBox.getSelectedItem(); + + + // enable buttons before to reinit them + m_gridButton.setEnabled(true); + m_importSelectionButton.setEnabled(true); + m_exportSelectionButton.setEnabled(true); + + switch (plotType) { + case HISTOGRAM_PLOT: + m_plotGraphics = new PlotHistogram(m_plotPanel, m_values, m_crossSelectionInterface, refX.getColumnIndex(), zParameter); + m_plotPanel.setPlot(m_plotGraphics); + break; + case SCATTER_PLOT: + m_plotGraphics = new PlotScatter(m_plotPanel, m_values, m_crossSelectionInterface, refX.getColumnIndex(), refY.getColumnIndex()); + m_plotPanel.setPlot(m_plotGraphics); + break; + case VENN_DIAGRAM_PLOT: + m_plotGraphics = new PlotVennDiagram(m_plotPanel, m_values, m_crossSelectionInterface, cols); + m_plotPanel.setPlot(m_plotGraphics); + break; + case PARALLEL_COORDINATES_PLOT: + m_plotGraphics = new PlotParallelCoordinates(m_plotPanel, m_values, m_crossSelectionInterface, cols); + m_plotPanel.setPlot(m_plotGraphics); + break; + case LINEAR_PLOT: + m_plotGraphics = new PlotLinear(m_plotPanel, m_values, m_crossSelectionInterface, refX.getColumnIndex(), refY.getColumnIndex()); + m_plotPanel.setPlot(m_plotGraphics); + break; + } + + + + + } + + + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/MoveGesture.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/MoveGesture.java index e54ae8905..5fabd9595 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/MoveGesture.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/MoveGesture.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/MoveableInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/MoveableInterface.java index c81a43a62..9dc5fa466 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/MoveableInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/MoveableInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PanAxisGesture.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PanAxisGesture.java index 666906b36..a386b3a8a 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PanAxisGesture.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PanAxisGesture.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotBaseAbstract.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotBaseAbstract.java index c36ea6bb2..dae9e1519 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotBaseAbstract.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotBaseAbstract.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotDataSpec.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotDataSpec.java index 7074dd820..d41ee5734 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotDataSpec.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotDataSpec.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics; import java.awt.Color; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotHistogram.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotHistogram.java index 631ea65a2..2bccec436 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotHistogram.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotHistogram.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,7 @@ */ package fr.proline.studio.graphics; +import fr.proline.studio.WindowManager; import fr.proline.studio.extendedtablemodel.StatsModel; import fr.proline.studio.graphics.marker.AbstractMarker; import fr.proline.studio.graphics.marker.coordinates.DataCoordinates; @@ -44,7 +45,6 @@ import javax.swing.AbstractAction; import javax.swing.JPopupMenu; import javax.swing.JTextField; -import org.openide.windows.WindowManager; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; import fr.proline.studio.graphics.core.PlotToolbarListenerInterface; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotInformation.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotInformation.java index eb29201af..8a9c2c838 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotInformation.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotInformation.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotMultiDataAbstract.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotMultiDataAbstract.java index 7af6f5cd5..4f6f43d45 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotMultiDataAbstract.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotMultiDataAbstract.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotPanel.java index db6577444..e4498cf23 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -32,7 +32,7 @@ public class PlotPanel extends JPanel { private BasePlotPanel m_basePlotPanel; private JLayeredPane m_layeredPane; - public PlotPanel(boolean isDoubleYAxis) { + public PlotPanel() { m_basePlotPanel = new BasePlotPanel(); diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotPanelListener.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotPanelListener.java index e2b624da8..dc3d160bf 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotPanelListener.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotPanelListener.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics; import java.awt.event.MouseEvent; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotParallelCoordinates.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotParallelCoordinates.java index fa9c2f38c..d5ed21205 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotParallelCoordinates.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotParallelCoordinates.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotScatter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotScatter.java index 0ecd08e3e..a7f27a66e 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotScatter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotScatter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,8 @@ */ package fr.proline.studio.graphics; +import fr.proline.studio.NbPreferences; +import fr.proline.studio.WindowManager; import fr.proline.studio.graphics.cursor.AbstractCursor; import fr.proline.studio.graphics.cursor.CursorInfo; import fr.proline.studio.graphics.cursor.CursorInfoList; @@ -49,7 +51,6 @@ import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.JTextField; -import org.openide.windows.WindowManager; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; import fr.proline.studio.extendedtablemodel.ExtraDataForTableModelInterface; import fr.proline.studio.extendedtablemodel.LogAdapterModel; @@ -59,7 +60,6 @@ import fr.proline.studio.parameter.DoubleParameter; import fr.proline.studio.parameter.ObjectParameter; import javax.swing.JComboBox; -import org.openide.util.NbPreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -136,7 +136,7 @@ public PlotScatter(BasePlotPanel plotPanel, ExtendedTableModelInterface compareD cols[COL_X_ID] = colX; cols[COL_Y_ID] = colY; - // update(cols, null); //by call this methode, min max X, min max Y are calculated + //update(cols, null); //by call this methode, min max X, min max Y are calculated // Color parameter ParameterList colorParameteList = new ParameterList("Colors"); @@ -189,7 +189,7 @@ public void valueChanged(String value, Object associatedValue) { m_logAlgoParameter.addLinkedParameters(linkedParameters); update(cols, null); //by call this methode, min max X, min max Y are calculated - + int selection = Integer.parseInt(m_logAlgoParameter.getStringValue()); linkedParameters.valueChanged((String) logOptions[selection], objectTable[selection]); diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotStick.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotStick.java index d5ef655d8..4676b4a32 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotStick.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotStick.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotType.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotType.java index d99b589da..af183763b 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotType.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotType.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics; import java.util.ArrayList; @@ -91,6 +91,7 @@ public HashSet getAcceptedXValues() { acceptedValues.add(Double.class); acceptedValues.add(Float.class); acceptedValues.add(Integer.class); + acceptedValues.add(Long.class); break; case SCATTER_PLOT: case LINEAR_PLOT: @@ -99,6 +100,7 @@ public HashSet getAcceptedXValues() { acceptedValues.add(Float.class); acceptedValues.add(Integer.class); acceptedValues.add(String.class); + acceptedValues.add(Long.class); break; } return acceptedValues; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotVennDiagram.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotVennDiagram.java index ff0b2fa21..3d4b74815 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotVennDiagram.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotVennDiagram.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotXYAbstract.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotXYAbstract.java index d8bbaaff9..3ab1f3699 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotXYAbstract.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/PlotXYAbstract.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ReferenceIdName.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ReferenceIdName.java index 46e85bdd8..fdaeb8e3a 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ReferenceIdName.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ReferenceIdName.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/SelectionGestureLasso.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/SelectionGestureLasso.java index abc907901..cb98cb0c9 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/SelectionGestureLasso.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/SelectionGestureLasso.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/SelectionGestureSquare.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/SelectionGestureSquare.java index 3bbadfb92..303c5c963 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/SelectionGestureSquare.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/SelectionGestureSquare.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics; import static fr.proline.studio.graphics.AbstractSelectionGesture.ACTION_CLICK; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/XAxis.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/XAxis.java index 90b4555e1..c79506c1f 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/XAxis.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/XAxis.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/YAxis.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/YAxis.java index 4759b5c8e..efbccd139 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/YAxis.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/YAxis.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ZoomGesture.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ZoomGesture.java index 475304371..49b57caa4 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ZoomGesture.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/ZoomGesture.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorDataInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorDataInterface.java index 8031d1412..b978f3957 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorDataInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorDataInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.colorpicker; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorPalettePanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorPalettePanel.java index 9b0107f70..819c31899 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorPalettePanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorPalettePanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.colorpicker; import java.awt.BasicStroke; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorPickerDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorPickerDialog.java index 24faed199..be0f15521 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorPickerDialog.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorPickerDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.colorpicker; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorPickerPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorPickerPanel.java index 7e132c694..459eb14ec 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorPickerPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/colorpicker/ColorPickerPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.colorpicker; import java.awt.BasicStroke; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/core/GraphicsToolbarPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/core/GraphicsToolbarPanel.java index 2037662af..7bcb9ed29 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/core/GraphicsToolbarPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/core/GraphicsToolbarPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/AbstractCursor.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/AbstractCursor.java index d94c39237..6c05737cb 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/AbstractCursor.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/AbstractCursor.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.cursor; import fr.proline.studio.graphics.BasePlotPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/CursorInfo.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/CursorInfo.java index b9a90f4e4..085e7d8a9 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/CursorInfo.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/CursorInfo.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.cursor; import java.awt.BasicStroke; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/CursorInfoList.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/CursorInfoList.java index 8f9f3222e..773159efd 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/CursorInfoList.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/CursorInfoList.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.cursor; import java.util.ArrayList; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/HorizontalCursor.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/HorizontalCursor.java index ee9c36c0c..56b226da6 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/HorizontalCursor.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/HorizontalCursor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/VerticalCursor.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/VerticalCursor.java index a349b8d89..f710694af 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/VerticalCursor.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/cursor/VerticalCursor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/AbstractMarker.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/AbstractMarker.java index ef1687cd1..5c8c49d04 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/AbstractMarker.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/AbstractMarker.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.marker; import fr.proline.studio.graphics.BasePlotPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/IntervalMarker.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/IntervalMarker.java index 4044e8b4f..ef7576880 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/IntervalMarker.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/IntervalMarker.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.marker; import fr.proline.studio.graphics.BasePlotPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/LabelMarker.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/LabelMarker.java index 0b2762dfa..754e1ed02 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/LabelMarker.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/LabelMarker.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/LineMarker.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/LineMarker.java index 085df5974..53def2f4e 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/LineMarker.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/LineMarker.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.marker; import fr.proline.studio.graphics.BasePlotPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/PointMarker.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/PointMarker.java index 691bf997d..f0322c034 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/PointMarker.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/PointMarker.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.marker; import fr.proline.studio.graphics.BasePlotPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/WaveformAreaMarker.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/WaveformAreaMarker.java index 84c603031..6d5ee444c 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/WaveformAreaMarker.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/WaveformAreaMarker.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.marker; import fr.proline.studio.graphics.BasePlotPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/XDeltaMarker.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/XDeltaMarker.java index 225f31b45..c3913f12c 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/XDeltaMarker.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/XDeltaMarker.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.marker; import fr.proline.studio.graphics.BasePlotPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/AbstractCoordinates.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/AbstractCoordinates.java index 764df2fc0..cc1a18e2c 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/AbstractCoordinates.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/AbstractCoordinates.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,18 +14,18 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.graphics.marker.coordinates; - -import fr.proline.studio.graphics.BasePlotPanel; - -/** - * Base class for coordinates used to position objects like markers in a graphic - * - * @author JM235353 - */ -public abstract class AbstractCoordinates { - - public abstract int getPixelX(BasePlotPanel plotPanel); - public abstract int getPixelY(BasePlotPanel plotPanel); - public abstract void setPixelPosition(BasePlotPanel plotPanel, int pixelX, int pixelY); -} +package fr.proline.studio.graphics.marker.coordinates; + +import fr.proline.studio.graphics.BasePlotPanel; + +/** + * Base class for coordinates used to position objects like markers in a graphic + * + * @author JM235353 + */ +public abstract class AbstractCoordinates { + + public abstract int getPixelX(BasePlotPanel plotPanel); + public abstract int getPixelY(BasePlotPanel plotPanel); + public abstract void setPixelPosition(BasePlotPanel plotPanel, int pixelX, int pixelY); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/DataCoordinates.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/DataCoordinates.java index ddad294ae..b8ede93a2 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/DataCoordinates.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/DataCoordinates.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.marker.coordinates; import fr.proline.studio.graphics.BasePlotPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/PercentageCoordinates.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/PercentageCoordinates.java index 2cb5bce82..3bdf41443 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/PercentageCoordinates.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/PercentageCoordinates.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.marker.coordinates; import fr.proline.studio.graphics.BasePlotPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/PixelCoordinates.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/PixelCoordinates.java index 94f8adecd..a6a3ec123 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/PixelCoordinates.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/marker/coordinates/PixelCoordinates.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.marker.coordinates; import fr.proline.studio.graphics.BasePlotPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/AbstractMeasurement.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/AbstractMeasurement.java index ea6d3389c..8731e4d29 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/AbstractMeasurement.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/AbstractMeasurement.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.measurement; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/DeltaXMeasurement.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/DeltaXMeasurement.java index 0f45091b7..fc0386fa6 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/DeltaXMeasurement.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/DeltaXMeasurement.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.measurement; import fr.proline.studio.graphics.BasePlotPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/IntegralMeasurement.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/IntegralMeasurement.java index 11bf92085..d5f83bc1d 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/IntegralMeasurement.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/IntegralMeasurement.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.measurement; import fr.proline.studio.graphics.PlotBaseAbstract; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/WidthMeasurement.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/WidthMeasurement.java index a7c975522..04dc3aedb 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/WidthMeasurement.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/measurement/WidthMeasurement.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.measurement; import fr.proline.studio.graphics.PlotBaseAbstract; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/AbstractValue.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/AbstractValue.java index 97bb1d8b5..3d0b762aa 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/AbstractValue.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/AbstractValue.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/NumberValue.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/NumberValue.java index 0bc3d771e..294a0a8b6 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/NumberValue.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/NumberValue.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/ParallelCoordinatesAxis.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/ParallelCoordinatesAxis.java index e808a8936..11767eced 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/ParallelCoordinatesAxis.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/ParallelCoordinatesAxis.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/StringValue.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/StringValue.java index 9980e9cdb..20773d709 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/StringValue.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/parallelcoordinates/StringValue.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.parallelcoordinates; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/Calculations.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/Calculations.java index c88aeadee..00f8a6c47 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/Calculations.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/Calculations.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.venndiagram; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/Circle.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/Circle.java index f5442b0be..1da7371e2 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/Circle.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/Circle.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.venndiagram; import java.awt.geom.Point2D; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/IntersectArea.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/IntersectArea.java index 104193543..6b07b7a07 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/IntersectArea.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/IntersectArea.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.venndiagram; import fr.proline.studio.graphics.PlotVennDiagram; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/Set.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/Set.java index 6d2e91916..80001e7ca 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/Set.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/Set.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.venndiagram; import java.util.ArrayList; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/SetIntersection.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/SetIntersection.java index 1cab70416..60a89dcc3 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/SetIntersection.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/SetIntersection.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.venndiagram; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/SetList.java b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/SetList.java index 1e205a8f0..f048227a7 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/SetList.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/graphics/venndiagram/SetList.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.graphics.venndiagram; import java.awt.geom.Point2D; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/AboutDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/AboutDialog.java new file mode 100644 index 000000000..5520449e5 --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/AboutDialog.java @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.gui; + +import fr.proline.studio.JavaVersion; +import fr.proline.studio.utils.IconManager; + +import javax.swing.*; +import java.awt.*; + + +public class AboutDialog extends DefaultDialog { + + public AboutDialog(Window parent) { + super(parent, Dialog.ModalityType.MODELESS); + + setButtonVisible(BUTTON_CANCEL, false); + setButtonVisible(BUTTON_HELP, false); + setStatusVisible(false); + + Component internalComponent = createInternalComponent(); + + setInternalComponent(internalComponent); + } + + private Component createInternalComponent() { + + JPanel internalPanel = new JPanel(); + internalPanel.setLayout(new GridBagLayout()); + + GridBagConstraints c = new GridBagConstraints(); + c.gridx = 0; + c.gridy = 0; + c.fill = GridBagConstraints.BOTH; + c.anchor = GridBagConstraints.NORTHWEST; + c.weightx = 0; + c.weighty = 0; + c.insets = new Insets(5,5,5, 5); + + + internalPanel.add(new AboutImagePanel(), c); + + c.weightx = 1; + c.weighty = 1; + c.gridy++; + + String copyrightText = "Proline Studio is developped in the context of ProFI ( French Proteomics National Infrastructure).

3 laboratories contribute to this software:
- iRTSV (Grenoble): EDyP Team, BGE Laboratory (U1038 CEA/INSERM/UJF)
- IPBS (Toulouse):UMR 5089 (CNRS/UPS)
- LSMBO (Strasbourg) :UMR 7178 (CNRS/UdS)

Version: "+ JavaVersion.getProductVersion()+" / "+JavaVersion.getProductDate()+""; + JLabel textCopyrightLabel = new JLabel(copyrightText); + internalPanel.add(textCopyrightLabel, c); + + return internalPanel; + + } + + + + private class AboutImagePanel extends JPanel { + + private Dimension m_dimension; + + private static final int PAD = 5; + + @Override + public Dimension getPreferredSize() { + if (m_dimension == null) { + Image img = IconManager.getImage(IconManager.IconType.SPLASH); + m_dimension = new Dimension(img.getWidth(null)+PAD*2, img.getHeight(null)+PAD*2); + } + + return m_dimension; + } + + public void paint(Graphics g) { + + g.setColor(Color.white); + g.fillRect(0,0, getWidth(), getHeight()); + + Image img = IconManager.getImage(IconManager.IconType.SPLASH); + g.drawImage(img, PAD, PAD, null); + + + } + + + } + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/AbstractParameterListTree.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/AbstractParameterListTree.java index 4246c4eaa..c7d49b2ae 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/AbstractParameterListTree.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/AbstractParameterListTree.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; import fr.proline.studio.parameter.ParameterList; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/AdvancedSelectionPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/AdvancedSelectionPanel.java index 5a39ade99..b047907db 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/AdvancedSelectionPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/AdvancedSelectionPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; import fr.proline.studio.utils.IconManager; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/CheckBoxTitledBorder.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/CheckBoxTitledBorder.java index 700294a5d..d9a5c611b 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/CheckBoxTitledBorder.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/CheckBoxTitledBorder.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; import java.awt.Component; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/ClosableTabPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/ClosableTabPanel.java index 178dac9a7..7101178a8 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/ClosableTabPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/ClosableTabPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; import fr.proline.studio.utils.IconManager; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/CollapsablePanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/CollapsablePanel.java index 98838f89d..f8584f5ce 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/CollapsablePanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/CollapsablePanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; import fr.proline.studio.utils.IconManager; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/CollapseListener.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/CollapseListener.java index 49c426cf0..75103c732 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/CollapseListener.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/CollapseListener.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/ConnectionDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/ConnectionDialog.java index 1bc6c1401..8296aeba9 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/ConnectionDialog.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/ConnectionDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultDialog.java index 1109a872b..18dd412f5 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultDialog.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -480,7 +480,7 @@ private JPanel createButtonPanel() { c.gridx++; buttonPanel.add(m_buttons[BUTTON_HELP], c); - m_buttons[BUTTON_SAVE].setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.saveButton.text")); + m_buttons[BUTTON_SAVE].setText("Save"); setButtonVisible(BUTTON_SAVE, false); m_buttons[BUTTON_SAVE].addActionListener(new java.awt.event.ActionListener() { @Override @@ -489,7 +489,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - m_buttons[BUTTON_LOAD].setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.loadButton.text")); + m_buttons[BUTTON_LOAD].setText("Load"); setButtonVisible(BUTTON_LOAD, false); m_buttons[BUTTON_LOAD].addActionListener(new java.awt.event.ActionListener() { @Override @@ -498,7 +498,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - m_buttons[BUTTON_OK].setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.okButton.text")); + m_buttons[BUTTON_OK].setText("OK"); m_buttons[BUTTON_OK].addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -506,7 +506,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - m_buttons[BUTTON_CANCEL].setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.cancelButton.text")); + m_buttons[BUTTON_CANCEL].setText("Cancel"); m_buttons[BUTTON_CANCEL].addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -514,7 +514,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - m_buttons[BUTTON_DEFAULT].setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.defaultButton.text")); + m_buttons[BUTTON_DEFAULT].setText("Default"); setButtonVisible(BUTTON_DEFAULT, false); m_buttons[BUTTON_DEFAULT].addActionListener(new java.awt.event.ActionListener() { @Override @@ -523,7 +523,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - m_buttons[BUTTON_BACK].setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.backButton.text")); + m_buttons[BUTTON_BACK].setText("Back"); setButtonVisible(BUTTON_BACK, false); m_buttons[BUTTON_BACK].addActionListener(new java.awt.event.ActionListener() { @Override @@ -532,7 +532,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - //m_helpButton.setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.helpButton.text")); + m_buttons[BUTTON_HELP].addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultDialog.java.bak b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultDialog.java.bak deleted file mode 100644 index 258249cf1..000000000 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultDialog.java.bak +++ /dev/null @@ -1,870 +0,0 @@ -package fr.proline.studio.gui; - -import fr.proline.studio.utils.IconManager; -import fr.proline.studio.utils.HelpUtils; -import java.awt.*; -import java.awt.event.*; -import java.awt.image.BufferedImage; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import javax.swing.*; -import org.slf4j.LoggerFactory; - -/** - * All Dialogs of this application must extend this class which offers a common - * behaviour. - * - * @author JM235353 - */ -public class DefaultDialog extends javax.swing.JDialog { - - public static final int BUTTON_OK = 0; - public static final int BUTTON_CANCEL = 1; - public static final int BUTTON_DEFAULT = 2; - public static final int BUTTON_LOAD = 3; - public static final int BUTTON_SAVE = 4; - public static final int BUTTON_HELP = 5; - public static final int BUTTON_BACK = 6; - private static final int BUTTONS_NUMBER = 7; // ---- get in sync - - private JPanel m_internalPanel; - private ImagePanel m_imageInfoPanel; - - private JButton[] m_buttons; - - private JPanel m_statusPanel; - private JLabel m_statusLabel; - - private BusyGlassPane m_busyGlassPane = null; - private HighlightGlassPane m_highlightGlassPane = null; - - private DefaultDialog m_dialog; - - private boolean m_firstDisplay = true; - - protected int m_buttonClicked = BUTTON_CANCEL; - - private String m_documentationSuffix = null; - - private DefaultDialogListener m_defaultDialogListener; - - /** - * Creates new form AbstractDialog - */ - public DefaultDialog() { - this(null, Dialog.ModalityType.MODELESS); - } - - public DefaultDialog(Window parent) { - this(parent, Dialog.ModalityType.APPLICATION_MODAL); - } - - public DefaultDialog(Window parent, Dialog.ModalityType modalityType) { - super(parent, modalityType); - - init(); - } - - public DefaultDialog(Dialog owner) { - super(owner, true); - - init(); - } - - public void addDefaultDialogListener(DefaultDialogListener defaultDialogListener) { - m_defaultDialogListener = defaultDialogListener; - } - - public DefaultDialogListener getDefaultDialogListener() { - return m_defaultDialogListener; - } - - private void init() { - - m_buttons = new JButton[BUTTONS_NUMBER]; - - // Action when the user press on the dialog cross - addWindowListener(new WindowAdapter() { - - @Override - public void windowClosing(WindowEvent we) { - cancelButtonActionPerformed(); - } - }); - - // Escape Key Action - KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); - Action actionListener = new AbstractAction() { - - @Override - public void actionPerformed(ActionEvent actionEvent) { - cancelButtonActionPerformed(); - } - }; - InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); - inputMap.put(stroke, "ESCAPE"); - getRootPane().getActionMap().put("ESCAPE", actionListener); - - // Enter Action - stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0); - actionListener = new AbstractAction() { - - @Override - public void actionPerformed(ActionEvent actionEvent) { - doClick(BUTTON_OK); - } - }; - inputMap.put(stroke, "ENTER"); - getRootPane().getActionMap().put("ENTER", actionListener); - - initComponents(); - } - - public void setDocumentationSuffix(String documentationSuffix) { - m_documentationSuffix = documentationSuffix; - } - - public void setImageInfo(JPanel sourcePanel, int x, int y, int width, int height) { - m_imageInfoPanel.setVisible(true); - m_imageInfoPanel.setImageInfo(sourcePanel, x, y, width, height); - } - - public void hideInfoPanel() { - m_imageInfoPanel.setVisible(false); - revalidate(); - } - - @Override - public void setVisible(boolean v) { - pack(); - - if (v) { - // reinit button when dialog is opened - m_buttonClicked = BUTTON_CANCEL; - } - - m_dialog = this; - - super.setVisible(v); - - } - - @Override - public void pack() { - if (m_firstDisplay) { - super.pack(); - m_firstDisplay = false; - } - } - - public void repack() { - super.pack(); - } - - public int getButtonClicked() { - return m_buttonClicked; - } - - protected void setInternalComponent(Component component) { - - GridBagConstraints c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.fill = GridBagConstraints.BOTH; - c.anchor = GridBagConstraints.NORTHWEST; - c.weightx = 1; - c.weighty = 1; - - m_internalPanel.add(component, c); - - } - - protected void replaceInternaleComponent(Component component) { - m_internalPanel.removeAll(); - setInternalComponent(component); - } - - public void setButtonVisible(int buttonId, boolean visible) { - m_buttons[buttonId].setVisible(visible); - - } - - public void setButtonEnabled(int buttonId, boolean enabled) { - m_buttons[buttonId].setEnabled(enabled); - } - - public void setButtonName(int buttonId, String name) { - m_buttons[buttonId].setText(name); - } - - protected void setButtonIcon(int buttonId, Icon icon) { - m_buttons[buttonId].setIcon(icon); - } - - protected void doClick(int buttonId) { - m_buttons[buttonId].doClick(); - } - - protected void setStatusVisible(boolean visible) { - m_statusPanel.setVisible(visible); - } - - public void setStatus(boolean error, String text) { - if (error) { - m_statusLabel.setIcon(IconManager.getIcon(IconManager.IconType.EXCLAMATION)); - - if (statusStimer == null) { - final int DELAY_TO_ERASE_STATUS = 7000; - statusStimer = new Timer(DELAY_TO_ERASE_STATUS, new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - m_statusLabel.setIcon(IconManager.getIcon(IconManager.IconType.EMPTY)); - m_statusLabel.setText(""); - } - - }); - statusStimer.setRepeats(false); - } - if (!statusStimer.isRunning()) { - statusStimer.start(); - } else { - statusStimer.restart(); - } - - } else { - m_statusLabel.setIcon(IconManager.getIcon(IconManager.IconType.EMPTY)); - } - m_statusLabel.setText(text); - - } - private Timer statusStimer = null; - - protected boolean cancelCalled() { - if (m_defaultDialogListener != null) { - m_defaultDialogListener.cancelPerformed(this); - } - return true; - } - - protected boolean okCalled() { - if (m_defaultDialogListener != null) { - m_defaultDialogListener.okPerformed(this); - } - return true; - } - - protected boolean defaultCalled() { - if (m_defaultDialogListener != null) { - m_defaultDialogListener.defaultPerformed(this); - } - return false; - } - - protected boolean backCalled() { - if (m_defaultDialogListener != null) { - m_defaultDialogListener.backPerformed(this); - } - return false; - } - - protected boolean saveCalled() { - if (m_defaultDialogListener != null) { - m_defaultDialogListener.savePerformed(this); - } - return false; - } - - protected boolean loadCalled() { - if (m_defaultDialogListener != null) { - m_defaultDialogListener.loadPerformed(this); - } - return false; - } - - private void initComponents() { - - setResizable(false); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - setLayout(new GridBagLayout()); - - GridBagConstraints c = new GridBagConstraints(); - c.gridx = 0; - c.gridy = 0; - c.fill = GridBagConstraints.BOTH; - c.anchor = GridBagConstraints.NORTHWEST; - c.weightx = 1; - - m_imageInfoPanel = new ImagePanel(); - m_imageInfoPanel.setVisible(false); - add(m_imageInfoPanel, c); - - c.gridy++; - c.weighty = 1; - m_internalPanel = new JPanel(); - m_internalPanel.setLayout(new GridBagLayout()); - add(m_internalPanel, c); - - JPanel buttonPanel = createButtonPanel(); - c.gridy++; - c.weighty = 0; - add(buttonPanel, c); - - m_statusPanel = createStatusPanel(); - c.gridy++; - c.weightx = 1; - add(m_statusPanel, c); - } - - private JPanel createButtonPanel() { - - JPanel buttonPanel = new JPanel(); - buttonPanel.setLayout(new GridBagLayout()); - - GridBagConstraints c = new GridBagConstraints(); - c.insets = new Insets(5, 5, 5, 5); - c.gridx = 0; - c.gridy = 0; - c.fill = GridBagConstraints.BOTH; - c.anchor = GridBagConstraints.NORTHWEST; - c.weightx = 0; - c.weighty = 0; - - m_buttons[BUTTON_OK] = new JButton(IconManager.getIcon(IconManager.IconType.OK)); - m_buttons[BUTTON_CANCEL] = new JButton(IconManager.getIcon(IconManager.IconType.CANCEL)); - m_buttons[BUTTON_DEFAULT] = new JButton(IconManager.getIcon(IconManager.IconType.DEFAULT)); - m_buttons[BUTTON_BACK] = new JButton(IconManager.getIcon(IconManager.IconType.BACK)); - m_buttons[BUTTON_LOAD] = new JButton(IconManager.getIcon(IconManager.IconType.LOAD_SETTINGS)); - m_buttons[BUTTON_SAVE] = new JButton(IconManager.getIcon(IconManager.IconType.SAVE_SETTINGS)); - m_buttons[BUTTON_HELP] = new JButton(IconManager.getIcon(IconManager.IconType.QUESTION)); - Insets margin = m_buttons[BUTTON_HELP].getMargin(); - margin.left = 3; - margin.right = 3; - m_buttons[BUTTON_HELP].setMargin(margin); - - buttonPanel.add(m_buttons[BUTTON_SAVE], c); - - c.gridx++; - buttonPanel.add(m_buttons[BUTTON_LOAD], c); - - c.gridx++; - buttonPanel.add(m_buttons[BUTTON_DEFAULT], c); - - c.gridx++; - c.weightx = 1; - buttonPanel.add(Box.createHorizontalGlue(), c); - - c.gridx++; - c.weightx = 0; - buttonPanel.add(m_buttons[BUTTON_BACK], c); - - c.gridx++; - buttonPanel.add(m_buttons[BUTTON_OK], c); - - c.gridx++; - buttonPanel.add(m_buttons[BUTTON_CANCEL], c); - - c.gridx++; - buttonPanel.add(m_buttons[BUTTON_HELP], c); - - m_buttons[BUTTON_SAVE].setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.saveButton.text")); - setButtonVisible(BUTTON_SAVE, false); - m_buttons[BUTTON_SAVE].addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent evt) { - saveButtonActionPerformed(); - } - }); - - m_buttons[BUTTON_LOAD].setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.loadButton.text")); - setButtonVisible(BUTTON_LOAD, false); - m_buttons[BUTTON_LOAD].addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent evt) { - loadButtonActionPerformed(); - } - }); - - m_buttons[BUTTON_OK].setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.okButton.text")); - m_buttons[BUTTON_OK].addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent evt) { - okButtonActionPerformed(); - } - }); - - m_buttons[BUTTON_CANCEL].setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.cancelButton.text")); - m_buttons[BUTTON_CANCEL].addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent evt) { - cancelButtonActionPerformed(); - } - }); - - m_buttons[BUTTON_DEFAULT].setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.defaultButton.text")); - setButtonVisible(BUTTON_DEFAULT, false); - m_buttons[BUTTON_DEFAULT].addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent evt) { - defaultButtonActionPerformed(); - } - }); - - m_buttons[BUTTON_BACK].setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.backButton.text")); - setButtonVisible(BUTTON_BACK, false); - m_buttons[BUTTON_BACK].addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent evt) { - backButtonActionPerformed(); - } - }); - - //m_helpButton.setText(org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.helpButton.text")); - m_buttons[BUTTON_HELP].addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent evt) { - helpButtonActionPerformed(); - } - }); - - return buttonPanel; - } - - private void saveButtonActionPerformed() { - if (saveCalled()) { - m_buttonClicked = BUTTON_SAVE; - } - } - - private void loadButtonActionPerformed() { - if (loadCalled()) { - m_buttonClicked = BUTTON_LOAD; - } - } - - private void cancelButtonActionPerformed() { - if (cancelCalled()) { - m_buttonClicked = BUTTON_CANCEL; - setVisible(false); - } - } - - private void okButtonActionPerformed() { - if (okCalled()) { - m_buttonClicked = BUTTON_OK; - setVisible(false); - } - } - - private void defaultButtonActionPerformed() { - if (defaultCalled()) { - m_buttonClicked = BUTTON_DEFAULT; - setVisible(false); - } - } - - private void backButtonActionPerformed() { - if (backCalled()) { - m_buttonClicked = BUTTON_BACK; - } - } - - private void helpButtonActionPerformed() { - // Show help - if (m_documentationSuffix == null) { - LoggerFactory.getLogger("ProlineStudio.Commons").error(getClass().getSimpleName() + " failed"); - return; // should not happen - } - if (Desktop.isDesktopSupported()) { // JDK 1.6.0 - - try { - //Desktop.getDesktop().browse(new URL(MiscellaneousUtils.convertURLToCurrentHelp(m_helpURL)).toURI()); - Desktop.getDesktop().browse(HelpUtils.createRedirectTempFile(m_documentationSuffix)); - } catch (Exception ex) { - LoggerFactory.getLogger("ProlineStudio.Commons").error(getClass().getSimpleName() + " failed", ex); - } - } - } - - private JPanel createStatusPanel() { - - JPanel statusPanel = new JPanel(); - statusPanel.setLayout(new GridBagLayout()); - statusPanel.setBorder(BorderFactory.createLoweredSoftBevelBorder()); - - GridBagConstraints c = new GridBagConstraints(); - c.insets = new Insets(1, 1, 1, 1); - c.gridx = 0; - c.gridy = 0; - c.fill = GridBagConstraints.BOTH; - c.anchor = GridBagConstraints.NORTHWEST; - c.weightx = 1; - c.weighty = 0; - - m_statusLabel = new JLabel(" "); - m_statusLabel.setIcon(IconManager.getIcon(IconManager.IconType.EMPTY)); - - statusPanel.add(m_statusLabel, c); - - return statusPanel; - } - - @Override - public void setLocation(int x, int y) { - - // pack must have been done beforehand - pack(); - - // we do not allow the dialog to be partially out of the screen - // top left corner check - if (x < 0) { - x = 0; - } - if (y < 0) { - y = 0; - } - - // bottom right corner check - int width = getWidth(); - int height = getHeight() + 30; // +30 is for window task bar - - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - if (x + width > screenSize.width) { - x = screenSize.width - width; - } - if (y + height > screenSize.height) { - y = screenSize.height - height; - } - - super.setLocation(x, y); - } - - public void centerToWindow(Window w) { - - // pack must have been done beforehand - pack(); - - int width = getWidth(); - int height = getHeight(); - - int frameX = w.getX(); - int frameY = w.getY(); - int frameWidth = w.getWidth(); - int frameHeight = w.getHeight(); - - int x = frameX + (frameWidth - width) / 2; - int y = frameY + (frameHeight - height) / 2; - - setLocation(x, y); - - } - - public void centerToScreen() { - - // pack must have been done beforehand - pack(); - - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - - int width = getWidth(); - int height = getHeight(); - - int x = (screenSize.width - width) / 2; - int y = (screenSize.height - height) / 2; - - super.setLocation(x, y); - - } - - public void setBusy(boolean busy) { - - if (m_busyGlassPane == null) { - m_busyGlassPane = new BusyGlassPane(); - } - - setGlassPane(m_busyGlassPane); - - if (busy) { - m_busyGlassPane.setVisible(true); - - } else { - m_busyGlassPane.setVisible(false); - } - } - - public void startTask(ProgressTask task) { - setBusy(true); - m_busyGlassPane.setProgressBar(task); - - } - - public void highlight(Component c) { - - highlight(c, null); - } - - public void highlight(Component c, Rectangle zone) { - - if (m_highlightGlassPane == null) { - m_highlightGlassPane = new HighlightGlassPane(); - } - m_highlightGlassPane.setComponent(c, zone); - - setGlassPane(m_highlightGlassPane); - - m_highlightGlassPane.highlight(); - - } - - /** - * Glass Pane to set the dialog as busy - */ - private class BusyGlassPane extends JComponent implements PropertyChangeListener { - - private boolean m_firstProgressDisplay = true; - private JPanel m_progressPanel; - private JProgressBar m_progressBar; - - public BusyGlassPane() { - - setLayout(null); - - // get rid of all mouse events - MouseAdapter mouseAdapter = new MouseAdapter() { - }; - addMouseListener(mouseAdapter); - addMouseMotionListener(mouseAdapter); - - // set wait mouse cursor - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - - } - - @Override - protected void paintComponent(Graphics g) { - super.paintComponent(g); - - if (m_progressBar != null) { - - if (m_firstProgressDisplay) { - m_progressPanel.setBounds(30, getHeight() / 2 - 16, getWidth() - 60, 32); - m_progressBar.setBounds(6, 6, m_progressPanel.getWidth() - 12, m_progressPanel.getHeight() - 12); - - m_firstProgressDisplay = false; - } - - Color ppColor = new Color(140, 140, 140, 70); - g.setColor(ppColor); - g.fillRect(0, 0, getWidth() - 1, getHeight() - 1); - } - } - - protected void setProgressBar(ProgressTask task) { - - removeAll(); - - m_firstProgressDisplay = true; - - m_progressPanel = new JPanel(null) { - - @Override - public void paint(Graphics g) { - super.paint(g); - - g.setColor(Color.darkGray); - g.drawRect(1, 1, getWidth() - 3, getHeight() - 3); - } - }; - - m_progressPanel.setOpaque(true); - m_progressPanel.setBackground(Color.white); - - m_progressBar = new JProgressBar(task.getMinValue(), task.getMaxValue()); - m_progressBar.setIndeterminate(true); - m_progressBar.setStringPainted(false); - - m_progressPanel.add(m_progressBar); - - add(m_progressPanel); - - task.addPropertyChangeListener(this); - task.execute(); - - } - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if ("progress".equals(evt.getPropertyName())) { - int progress = (Integer) evt.getNewValue(); - if ((progress > 0) && (m_progressBar.isIndeterminate())) { - m_progressBar.setIndeterminate(false); - m_progressBar.setStringPainted(true); - } - m_progressBar.setValue(progress); - if (progress >= m_progressBar.getMaximum()) { - setBusy(false); - m_dialog.setVisible(false); - } - } - } - - } - - /** - * Glass Pane to highlight a component of the dialog - */ - private class HighlightGlassPane extends JComponent { - - private final int ANIMATION_DELAY = 400; - private final int DISPLAY_DELAY = 1300; - - private long m_timeStart = 0; - private Component m_comp; - private int m_x, m_y, m_width, m_height; - - public HighlightGlassPane() { - } - - @Override - protected void paintComponent(Graphics g) { - - Point p = SwingUtilities.convertPoint(m_comp, 0, 0, this); - - g.setColor(new Color(240, 0, 0)); - ((Graphics2D) g).setStroke(new BasicStroke(2)); - - long timeCur = System.currentTimeMillis(); - - final int START_ANGLE = 30; - final int DELTA_ANGLE = 380; - int deltaAngle; - if (timeCur - m_timeStart <= ANIMATION_DELAY) { - deltaAngle = START_ANGLE + (int) ((DELTA_ANGLE - START_ANGLE) * (((double) (timeCur - m_timeStart)) / ANIMATION_DELAY)); - } else { - deltaAngle = DELTA_ANGLE; - } - for (int angle = START_ANGLE; angle <= deltaAngle + START_ANGLE; angle += 3) { - int delta = (int) (((double) (angle - START_ANGLE) / ((double) DELTA_ANGLE)) * 10.0); //(DELTA_ANGLE-angle-START_ANGLE)/20; - - g.drawArc(p.x + m_x - delta, p.y + m_y - delta, m_width + delta * 2, m_height + delta * 2, angle, 3); - } - - } - - private void setComponent(Component c) { - - m_comp = c; - - m_x = -PAD; - m_y = -PAD; - m_width = c.getWidth() + PAD * 2; - m_height = c.getHeight() + PAD * 2; - } - - public void setComponent(Component c, Rectangle r) { - - if (r == null) { - setComponent(c); - return; - } - - m_comp = c; - - m_x = -PAD + r.x; - m_y = -PAD + r.y; - m_width = r.width + PAD * 2; - m_height = r.height + PAD * 2; - } - private static final int PAD = 10; - - public void highlight() { - - m_highlightGlassPane.setVisible(true); - - m_timeStart = System.currentTimeMillis(); - - ActionListener timerAction = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - - long timeCur = System.currentTimeMillis(); - if ((timeCur - m_timeStart) > ANIMATION_DELAY + DISPLAY_DELAY) { - m_highlightGlassPane.setVisible(false); - animationTimer.setRepeats(false); - } else { - repaint(); - } - } - }; - - animationTimer = new Timer(20, timerAction); - animationTimer.setRepeats(true); - animationTimer.start(); - - } - private Timer animationTimer = null; - - @Override - protected void processMouseEvent(MouseEvent e) { - if (e.getID() == MouseEvent.MOUSE_CLICKED) { - m_statusLabel.setIcon(IconManager.getIcon(IconManager.IconType.EMPTY)); - m_statusLabel.setText(""); - } - super.processMouseEvent(e); - - } - } - - public static abstract class ProgressTask extends SwingWorker { - - public abstract int getMinValue(); - - public abstract int getMaxValue(); - - } - - private class ImagePanel extends JPanel { - - private BufferedImage m_bi = null; - private final Dimension m_dimension = new Dimension(0, 0); - - public ImagePanel() { - } - - @Override - public Dimension getPreferredSize() { - return m_dimension; - } - - public void paint(Graphics g) { - if (m_bi == null) { - return; - } - - g.setColor(Color.white); - g.fillRect(0, 0, getWidth(), getHeight()); - - int xImage = (getWidth() - m_bi.getWidth()) / 2; - int yImage = 1; - g.drawImage(m_bi, xImage, yImage, null); - - g.setColor(Color.darkGray); - g.drawRect(xImage - 1, yImage - 1, m_bi.getWidth() + 1, m_bi.getHeight() + 1); - - } - - public void setImageInfo(JPanel sourcePanel, int x, int y, int width, int height) { - m_bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); - m_dimension.width = width + 2; - m_dimension.height = height + 2; - Graphics g = m_bi.getGraphics(); - g.translate(-x, -y); - sourcePanel.paint(g); - } - - } - -} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultDialogListener.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultDialogListener.java index 7b931f49b..bdd47ae0f 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultDialogListener.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultDialogListener.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultFloatingPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultFloatingPanel.java index b804bcc59..dc90db0e5 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultFloatingPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultFloatingPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,7 @@ */ package fr.proline.studio.gui; +import fr.proline.studio.WindowManager; import fr.proline.studio.utils.IconManager; import java.awt.Color; import java.awt.Component; @@ -32,7 +33,6 @@ import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; -import org.openide.windows.WindowManager; /** * diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultStorableDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultStorableDialog.java new file mode 100644 index 000000000..23f52b38f --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/DefaultStorableDialog.java @@ -0,0 +1,113 @@ +package fr.proline.studio.gui; + +import fr.proline.studio.Exceptions; +import fr.proline.studio.settings.FilePreferences; +import fr.proline.studio.settings.SettingsDialog; +import fr.proline.studio.settings.SettingsUtils; +import org.slf4j.LoggerFactory; + +import javax.swing.*; +import java.awt.*; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.prefs.Preferences; + +public abstract class DefaultStorableDialog extends DefaultDialog { + + public DefaultStorableDialog() { + super(); + init(); + } + + public DefaultStorableDialog(Window parent) { + super(parent); + init(); + } + + public DefaultStorableDialog(Window parent, ModalityType modalityType) { + super(parent, modalityType); + init(); + } + + public DefaultStorableDialog(Dialog owner) { + super(owner); + init(); + } + + private void init(){ + setButtonVisible(BUTTON_LOAD, true); + setButtonVisible(BUTTON_SAVE, true); + } + + + abstract protected String getSettingsKey(); + abstract protected void saveParameters(Preferences preferences) throws Exception; + abstract protected boolean checkParameters(); + abstract protected void resetParameters() throws Exception; + abstract protected void loadParameters(Preferences preferences) throws Exception; + + @Override + protected boolean saveCalled() { + // check parameters + if (!checkParameters()) { + return false; + } + + JFileChooser fileChooser = SettingsUtils.getFileChooser(getSettingsKey()); + int result = fileChooser.showSaveDialog(this); + if (result == JFileChooser.APPROVE_OPTION) { + try { + File f = fileChooser.getSelectedFile(); + if(f.exists()){ + FileOutputStream fos = new FileOutputStream(f); + fos.close(); + } + FilePreferences filePreferences = new FilePreferences(f, null, ""); + + saveParameters(filePreferences); + + SettingsUtils.addSettingsPath(getSettingsKey(), f.getAbsolutePath()); + SettingsUtils.writeDefaultDirectory(getSettingsKey(), f.getParent()); + } catch (Exception e) { + Exceptions.printStackTrace(e); + JOptionPane.showMessageDialog(this, "Error saving settings "+e.getMessage(), "Save Settings Error",JOptionPane.ERROR_MESSAGE); + } + + } + + return false; + } + + + + @Override + protected boolean loadCalled() { + + SettingsDialog settingsDialog = new SettingsDialog(this, getSettingsKey()); + settingsDialog.setLocationRelativeTo(this); + settingsDialog.setVisible(true); + + if (settingsDialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { + if (settingsDialog.isDefaultSettingsSelected()) { + try { + resetParameters(); + } catch (Exception e) { + LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Reset Settings Failed", e); + setStatus(true, "Reset Settings Failed"); + } + } else { + try { + File settingsFile = settingsDialog.getSelectedFile(); + FilePreferences filePreferences = new FilePreferences(settingsFile, null, ""); + loadParameters(filePreferences); + } catch (Exception e) { + LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Parsing of User Settings File Failed", e); + setStatus(true, "Parsing of your Settings File failed"); + } + } + } + return false; + } + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/HelpHeaderPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/HelpHeaderPanel.java index 431975570..476d5e206 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/HelpHeaderPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/HelpHeaderPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/HourglassPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/HourglassPanel.java index 47c24d278..5c99a169f 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/HourglassPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/HourglassPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; import fr.proline.studio.utils.IconManager; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/InfoDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/InfoDialog.java index f80dbc0ed..c5d717701 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/InfoDialog.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/InfoDialog.java @@ -1,26 +1,26 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; +import fr.proline.studio.NbPreferences; import fr.proline.studio.utils.IconManager; import java.awt.*; import java.util.prefs.Preferences; import javax.swing.*; -import org.openide.util.NbPreferences; @@ -37,14 +37,15 @@ public enum InfoType { NO_ICON } - private String m_message = null; + private String m_message; private JCheckBox m_showNextTimecheckBox = null; - private String m_showAtStartKey = null; + private String m_showAtStartKey; public InfoDialog(Window parent, InfoType type, String title, String message) { this(parent, type, title, message, null); } + public InfoDialog(Window parent, InfoType type, String title, String message, String showAtStartKey) { super(parent); @@ -146,7 +147,7 @@ private JPanel getInfoPanel() { if (m_message != null) { c.gridwidth = 2; - if (m_message.length() < 200) { + if (m_message.length() < 200 ) { String messageArray[] = m_message.split("\n"); Font font = null; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/JCheckBoxList.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/JCheckBoxList.java index e2aeffaf6..9e8ed1aa1 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/JCheckBoxList.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/JCheckBoxList.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; import java.awt.Component; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/JCheckBoxListPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/JCheckBoxListPanel.java index 3f36535c0..1193fb211 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/JCheckBoxListPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/JCheckBoxListPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; import fr.proline.studio.utils.IconManager; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/OptionDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/OptionDialog.java index ad2b32f56..68a659442 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/OptionDialog.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/OptionDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; import java.awt.*; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/ParameterDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/ParameterDialog.java index b104dcbb6..711893df9 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/ParameterDialog.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/ParameterDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; import fr.proline.studio.parameter.AbstractParameter; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/SplittedPanelContainer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/SplittedPanelContainer.java index 54c7ac8e8..67d4ba719 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/SplittedPanelContainer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/SplittedPanelContainer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; import fr.proline.studio.utils.IconManager; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/StringChooserPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/StringChooserPanel.java index a494a1e3c..d991e1ada 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/gui/StringChooserPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/gui/StringChooserPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.gui; import java.awt.GridBagConstraints; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/info/InfoFloatingPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/info/InfoFloatingPanel.java index 65ef19865..a8d825f72 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/info/InfoFloatingPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/info/InfoFloatingPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/info/InfoInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/info/InfoInterface.java index 83bb10334..fa315ab86 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/info/InfoInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/info/InfoInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,15 +14,15 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.info; - -/** - * - * Interface to be implemented to give info for the InfoToggleButton and the InfoFloatingPanel - * - * @author JM235353 - */ -public interface InfoInterface { - - public String getInfo(); -} +package fr.proline.studio.info; + +/** + * + * Interface to be implemented to give info for the InfoToggleButton and the InfoFloatingPanel + * + * @author JM235353 + */ +public interface InfoInterface { + + public String getInfo(); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/info/InfoToggleButton.java b/prolinestudio-commons/src/main/java/fr/proline/studio/info/InfoToggleButton.java index cc9d6839f..c04b06ff4 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/info/InfoToggleButton.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/info/InfoToggleButton.java @@ -1,28 +1,28 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.info; +import fr.proline.studio.WindowManager; import fr.proline.studio.progress.ProgressBarDialog; import fr.proline.studio.progress.ProgressInterface; import fr.proline.studio.utils.IconManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JToggleButton; -import org.openide.windows.WindowManager; /** * Button to access to an info floating panelo diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AbstractBar.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AbstractBar.java index 1b98a7bd8..e235d6758 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AbstractBar.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AbstractBar.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.markerbar; import javax.swing.JPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AbstractMarker.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AbstractMarker.java index 862410a2d..ab393622f 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AbstractMarker.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AbstractMarker.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.markerbar; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AnnotationMarker.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AnnotationMarker.java index 5264f0ded..e558f3ed5 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AnnotationMarker.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AnnotationMarker.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.markerbar; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AnnotationMarkerDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AnnotationMarkerDialog.java index 4ebffe5fd..6f34403cf 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AnnotationMarkerDialog.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AnnotationMarkerDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.markerbar; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AnnotationMarkerRenderer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AnnotationMarkerRenderer.java index 0e1f9aca7..4c0a68dae 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AnnotationMarkerRenderer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/AnnotationMarkerRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,17 +14,17 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.markerbar; - -import java.awt.Color; - -/** - * Renderer for Annotation Markers - * @author JM235353 - */ -public class AnnotationMarkerRenderer extends DefaultMarkerRenderer { - - public AnnotationMarkerRenderer() { - super(new Color(107,210,103)); - } -} +package fr.proline.studio.markerbar; + +import java.awt.Color; + +/** + * Renderer for Annotation Markers + * @author JM235353 + */ +public class AnnotationMarkerRenderer extends DefaultMarkerRenderer { + + public AnnotationMarkerRenderer() { + super(new Color(107,210,103)); + } +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/BookmarkMarker.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/BookmarkMarker.java index 0aa2a9578..741415fa3 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/BookmarkMarker.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/BookmarkMarker.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,18 +14,18 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.markerbar; - -/** - * Marker of type Bookmark (only on one row, no text) - * @author JM235353 - */ -public class BookmarkMarker extends DefaultMarker { - - public BookmarkMarker(int row) { - super(row, BOOKMARK_MARKER); - } - - - -} +package fr.proline.studio.markerbar; + +/** + * Marker of type Bookmark (only on one row, no text) + * @author JM235353 + */ +public class BookmarkMarker extends DefaultMarker { + + public BookmarkMarker(int row) { + super(row, BOOKMARK_MARKER); + } + + + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/BookmarkMarkerRenderer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/BookmarkMarkerRenderer.java index 6f6d24596..86a937a55 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/BookmarkMarkerRenderer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/BookmarkMarkerRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.markerbar; import java.awt.Color; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/DefaultMarker.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/DefaultMarker.java index 50ac2c281..bed21aec6 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/DefaultMarker.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/DefaultMarker.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.markerbar; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/DefaultMarkerRenderer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/DefaultMarkerRenderer.java index 17dae65eb..cd903e549 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/DefaultMarkerRenderer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/DefaultMarkerRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.markerbar; import java.awt.Color; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerBar.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerBar.java index c90ae3cd0..a6b8568d5 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerBar.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerBar.java @@ -1,21 +1,22 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.markerbar; +import fr.proline.studio.WindowManager; import fr.proline.studio.gui.DefaultDialog; import java.awt.*; import java.awt.event.ActionEvent; @@ -26,7 +27,6 @@ import java.util.Iterator; import java.util.TreeMap; import javax.swing.*; -import org.openide.windows.WindowManager; /** * Bar which displays visible markers according to the visible part of the Component diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerComponentInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerComponentInterface.java index 6ec94e8bf..1284b66df 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerComponentInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerComponentInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.markerbar; import javax.swing.event.TableModelListener; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerContainerPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerContainerPanel.java index e703a76a2..1eb7c1327 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerContainerPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerContainerPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.markerbar; import java.awt.Color; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerRendererInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerRendererInterface.java index f9d77c04c..997da070c 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerRendererInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/MarkerRendererInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,15 +14,15 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.markerbar; - -import java.awt.Graphics; - -/** - * Renderer of a Marker must implements this interface - * @author JM235353 - */ -public interface MarkerRendererInterface { - - public void paint(AbstractBar.BarType barType, Graphics g, int x, int y, int width, int height); -} +package fr.proline.studio.markerbar; + +import java.awt.Graphics; + +/** + * Renderer of a Marker must implements this interface + * @author JM235353 + */ +public interface MarkerRendererInterface { + + public void paint(AbstractBar.BarType barType, Graphics g, int x, int y, int width, int height); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/OverviewBar.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/OverviewBar.java index bcd129737..2e0b3564d 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/OverviewBar.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/OverviewBar.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.markerbar; import java.awt.Color; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/ViewChangeListener.java b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/ViewChangeListener.java index 067cdb49b..044ffd9f5 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/ViewChangeListener.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/markerbar/ViewChangeListener.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,14 +14,14 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.markerbar; - - -/** - * Interface to follow the modifications of a view - * @author JM235353 - */ -public interface ViewChangeListener { - - public void viewChanged(); -} +package fr.proline.studio.markerbar; + + +/** + * Interface to follow the modifications of a view + * @author JM235353 + */ +public interface ViewChangeListener { + + public void viewChanged(); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/mzscope/AddMzScopeButton.java b/prolinestudio-commons/src/main/java/fr/proline/studio/mzscope/AddMzScopeButton.java index 8e287f83c..454f5d409 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/mzscope/AddMzScopeButton.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/mzscope/AddMzScopeButton.java @@ -1,28 +1,28 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.mzscope; +import fr.proline.studio.WindowManager; import fr.proline.studio.progress.ProgressBarDialog; import fr.proline.studio.progress.ProgressInterface; import fr.proline.studio.utils.IconManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; -import org.openide.windows.WindowManager; /** * Button to access to mzScope diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/mzscope/MzScopeInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/mzscope/MzScopeInterface.java index 74ac14c8b..dfdcd2b0c 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/mzscope/MzScopeInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/mzscope/MzScopeInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.mzscope; import java.util.List; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/mzscope/MzdbInfo.java b/prolinestudio-commons/src/main/java/fr/proline/studio/mzscope/MzdbInfo.java index f463ede30..1ad641fd5 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/mzscope/MzdbInfo.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/mzscope/MzdbInfo.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.mzscope; import java.io.File; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/AbstractLinkedParameters.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/AbstractLinkedParameters.java index 6800c5058..cca572622 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/AbstractLinkedParameters.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/AbstractLinkedParameters.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/AbstractParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/AbstractParameter.java index 4da7af043..f41dbfa4d 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/AbstractParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/AbstractParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import java.awt.event.ActionListener; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/AbstractParameterToString.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/AbstractParameterToString.java index c258bdac6..7690cbcb6 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/AbstractParameterToString.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/AbstractParameterToString.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,13 +14,13 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.parameter; - -/** - * Base class to convert a Parameter to a String - * @author JM235353 - */ -public abstract class AbstractParameterToString { - - public abstract String toString(E o); -} +package fr.proline.studio.parameter; + +/** + * Base class to convert a Parameter to a String + * @author JM235353 + */ +public abstract class AbstractParameterToString { + + public abstract String toString(E o); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/BooleanParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/BooleanParameter.java index ee5fce054..5d2f7cbff 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/BooleanParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/BooleanParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import java.awt.event.ActionEvent; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ColorOrGradientParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ColorOrGradientParameter.java index 02e8b94e6..f1e047780 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ColorOrGradientParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ColorOrGradientParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import fr.proline.studio.graphics.ColorOrGradientChooserPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ColorParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ColorParameter.java index 2e0dc6ddc..1e093ea62 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ColorParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ColorParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import fr.proline.studio.graphics.ColorButton; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ComponentParameterInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ComponentParameterInterface.java index 916377d67..adbb1bf84 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ComponentParameterInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ComponentParameterInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import java.awt.event.ActionListener; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/DefaultParameterDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/DefaultParameterDialog.java index ce8285871..735193da2 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/DefaultParameterDialog.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/DefaultParameterDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/DisplayStubParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/DisplayStubParameter.java index 5ecf034a4..de4231bba 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/DisplayStubParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/DisplayStubParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import javax.swing.JComponent; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/DoubleParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/DoubleParameter.java index 733f2421c..a70fca136 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/DoubleParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/DoubleParameter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ExpressionParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ExpressionParameter.java index 0eacf0a3d..df95f9991 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ExpressionParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ExpressionParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import fr.proline.studio.gui.expressionbuilder.ExpressionBuilderPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/FileParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/FileParameter.java index 54acfaefb..2c14370df 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/FileParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/FileParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import fr.proline.studio.utils.IconManager; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/FloatParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/FloatParameter.java index 6a1fded55..5436c1cfc 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/FloatParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/FloatParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import java.util.ArrayList; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/IntegerParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/IntegerParameter.java index f8966137e..e473b92ef 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/IntegerParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/IntegerParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import java.awt.FlowLayout; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/MultiObjectParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/MultiObjectParameter.java index 40f7e9150..ebffb79fb 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/MultiObjectParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/MultiObjectParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import fr.proline.studio.gui.AdvancedSelectionPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/NoneParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/NoneParameter.java index 4f37484a0..9e0036e5a 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/NoneParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/NoneParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import javax.swing.JComponent; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ObjectParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ObjectParameter.java index a10bc0a45..a8409d36f 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ObjectParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ObjectParameter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ParameterError.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ParameterError.java index fecf2a137..fba7f72a3 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ParameterError.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ParameterError.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import javax.swing.JComponent; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ParameterList.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ParameterList.java index ab00fd914..a54bbd962 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ParameterList.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ParameterList.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,7 @@ */ package fr.proline.studio.parameter; +import fr.proline.studio.NbPreferences; import fr.proline.studio.gui.DefaultDialog; import java.awt.Dimension; import java.awt.GridBagConstraints; @@ -30,7 +31,6 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; -import org.openide.util.NbPreferences; /** * List of Parameters; possibility to generate a panel from this list @@ -73,7 +73,7 @@ public ParametersPanel getPanel() { return m_parametersPanel; } - Preferences preferences = NbPreferences.root(); + Preferences preferences = NbPreferences.root(); m_parametersPanel = new ParametersPanel(); m_parametersPanel.setLayout(new GridBagLayout()); diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ParameterValueRenderer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ParameterValueRenderer.java index 8bf911d61..7b9f6b14b 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ParameterValueRenderer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ParameterValueRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/SettingsButton.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/SettingsButton.java index 3db582eb5..6e084c1a3 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/SettingsButton.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/SettingsButton.java @@ -1,87 +1,87 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.parameter; - -import fr.proline.studio.progress.ProgressBarDialog; -import fr.proline.studio.progress.ProgressInterface; -import fr.proline.studio.utils.IconManager; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import javax.swing.JButton; -import org.openide.windows.WindowManager; - -/** - * Generic Settings Button - * @author JM235353 - */ -public class SettingsButton extends JButton implements ActionListener { - - private ProgressInterface m_progressInterface = null; - private SettingsInterface m_settingsInterface = null; - - public SettingsButton(ProgressInterface progressInterface, SettingsInterface settingsInterface) { - - m_settingsInterface = settingsInterface; - m_progressInterface = progressInterface; - - setIcon(IconManager.getIcon(IconManager.IconType.SETTINGS)); - setToolTipText("Settings..."); - setFocusPainted(false); - - addActionListener(this); - } - - - public final void setProgressInterface(ProgressInterface progressInterface) { - m_progressInterface = progressInterface; - } - - - @Override - public void actionPerformed(ActionEvent e) { - - - if ((m_progressInterface != null) && (!m_progressInterface.isLoaded())) { - - ProgressBarDialog dialog = ProgressBarDialog.getDialog(WindowManager.getDefault().getMainWindow(), m_progressInterface, "Data loading", "Settings dialog is not available while data is loading. Please Wait."); - dialog.setLocation(getLocationOnScreen().x + getWidth() + 5, getLocationOnScreen().y + getHeight() + 5); - dialog.setVisible(true); - - if (!dialog.isWaitingFinished()) { - return; - } - } - - ArrayList parameterListArray = m_settingsInterface.getParameters(); - if (parameterListArray == null) { - return; - } - DefaultParameterDialog parameterDialog = new DefaultParameterDialog(WindowManager.getDefault().getMainWindow(), "Settings", parameterListArray); - parameterDialog.setDocumentationSuffix("h.u8efk3coyb70"); - parameterDialog.setLocationRelativeTo(this); - parameterDialog.setVisible(true); - - - if (parameterDialog.getButtonClicked() == DefaultParameterDialog.BUTTON_OK) { - m_settingsInterface.parametersChanged(); - } else { - m_settingsInterface.parametersCanceled(); - } - - } +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.parameter; + +import fr.proline.studio.WindowManager; +import fr.proline.studio.progress.ProgressBarDialog; +import fr.proline.studio.progress.ProgressInterface; +import fr.proline.studio.utils.IconManager; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import javax.swing.JButton; + +/** + * Generic Settings Button + * @author JM235353 + */ +public class SettingsButton extends JButton implements ActionListener { + + private ProgressInterface m_progressInterface = null; + private SettingsInterface m_settingsInterface = null; + + public SettingsButton(ProgressInterface progressInterface, SettingsInterface settingsInterface) { + + m_settingsInterface = settingsInterface; + m_progressInterface = progressInterface; + + setIcon(IconManager.getIcon(IconManager.IconType.SETTINGS)); + setToolTipText("Settings..."); + setFocusPainted(false); + + addActionListener(this); + } + + + public final void setProgressInterface(ProgressInterface progressInterface) { + m_progressInterface = progressInterface; + } + + + @Override + public void actionPerformed(ActionEvent e) { + + + if ((m_progressInterface != null) && (!m_progressInterface.isLoaded())) { + + ProgressBarDialog dialog = ProgressBarDialog.getDialog(WindowManager.getDefault().getMainWindow(), m_progressInterface, "Data loading", "Settings dialog is not available while data is loading. Please Wait."); + dialog.setLocation(getLocationOnScreen().x + getWidth() + 5, getLocationOnScreen().y + getHeight() + 5); + dialog.setVisible(true); + + if (!dialog.isWaitingFinished()) { + return; + } + } + + ArrayList parameterListArray = m_settingsInterface.getParameters(); + if (parameterListArray == null) { + return; + } + DefaultParameterDialog parameterDialog = new DefaultParameterDialog(WindowManager.getDefault().getMainWindow(), "Settings", parameterListArray); + parameterDialog.setDocumentationSuffix("h.u8efk3coyb70"); + parameterDialog.setLocationRelativeTo(this); + parameterDialog.setVisible(true); + + + if (parameterDialog.getButtonClicked() == DefaultParameterDialog.BUTTON_OK) { + m_settingsInterface.parametersChanged(); + } else { + m_settingsInterface.parametersCanceled(); + } + + } } \ No newline at end of file diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/SettingsInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/SettingsInterface.java index acdb2f5f7..3d411b809 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/SettingsInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/SettingsInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,17 +14,17 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.parameter; - -import java.util.ArrayList; - -/** - * Interface to be implemented when we want to use the SettingButton to add settings - * to a view. - * @author JM235353 - */ -public interface SettingsInterface { - public ArrayList getParameters(); - public void parametersChanged(); - public boolean parametersCanceled(); -} +package fr.proline.studio.parameter; + +import java.util.ArrayList; + +/** + * Interface to be implemented when we want to use the SettingButton to add settings + * to a view. + * @author JM235353 + */ +public interface SettingsInterface { + public ArrayList getParameters(); + public void parametersChanged(); + public boolean parametersCanceled(); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/StringParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/StringParameter.java index 7a3098a45..a24368540 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/StringParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/StringParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import fr.proline.studio.gui.StringChooserPanel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ValuesFromComponentParameter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ValuesFromComponentParameter.java index 86c319feb..9c7c08909 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ValuesFromComponentParameter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/parameter/ValuesFromComponentParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.parameter; import java.util.ArrayList; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/performancetest/PerformanceTest.java b/prolinestudio-commons/src/main/java/fr/proline/studio/performancetest/PerformanceTest.java index 757c65e51..c58372944 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/performancetest/PerformanceTest.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/performancetest/PerformanceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/performancetest/PerformanceTestData.java b/prolinestudio-commons/src/main/java/fr/proline/studio/performancetest/PerformanceTestData.java index c10cf61b6..6e7f73383 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/performancetest/PerformanceTestData.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/performancetest/PerformanceTestData.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -213,7 +213,7 @@ public String getFullKey() { } public void display() { - + try { m_logger.debug(m_fullKey + " Total:" + m_totalTime + "ms" + " **** NbCalls:" + m_callNumbers + " Average:" + m_totalTime / m_callNumbers + "ms Min:" + m_minTime + "ms Max:" + m_maxTime + "ms"); } catch (Exception e) { diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/progress/ProgressBarDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/progress/ProgressBarDialog.java index ed3ea6dac..15584d857 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/progress/ProgressBarDialog.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/progress/ProgressBarDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.progress; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/progress/ProgressInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/progress/ProgressInterface.java index 33f4e738e..eff2ad070 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/progress/ProgressInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/progress/ProgressInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,15 +14,15 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.progress; - -/** - * Interface to be able to view the progress of a task - * @author JM235353 - */ -public interface ProgressInterface { - - public boolean isLoaded(); - - public int getLoadingPercentage(); -} +package fr.proline.studio.progress; + +/** + * Interface to be able to view the progress of a task + * @author JM235353 + */ +public interface ProgressInterface { + + public boolean isLoaded(); + + public int getLoadingPercentage(); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/search/AdvancedSearchFloatingPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/search/AdvancedSearchFloatingPanel.java index 75dd8c465..3c65fc78d 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/search/AdvancedSearchFloatingPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/search/AdvancedSearchFloatingPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.search; import fr.proline.studio.filter.Filter; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/search/ApplySearchInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/search/ApplySearchInterface.java index 5b0dacfda..a706edd4c 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/search/ApplySearchInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/search/ApplySearchInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,16 +14,16 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.search; - -import fr.proline.studio.filter.Filter; - -/** - * Interface to be implemented so a search can be applied by an external source - * @author JM235353 - */ -public interface ApplySearchInterface { - - public abstract void doSearch(Filter f, boolean firstSearch); - -} +package fr.proline.studio.search; + +import fr.proline.studio.filter.Filter; + +/** + * Interface to be implemented so a search can be applied by an external source + * @author JM235353 + */ +public interface ApplySearchInterface { + + public abstract void doSearch(Filter f, boolean firstSearch); + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/search/SearchInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/search/SearchInterface.java index 7c40c119b..2a409178d 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/search/SearchInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/search/SearchInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,15 +14,15 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.search; - -import fr.proline.studio.filter.Filter; - - -/** - * Interface to be implemented to be able to do a search through the SearchToggleButton/AdvancesSearchFloatingPanel - * @author JM235353 - */ -public interface SearchInterface { - public int search(Filter f, boolean newSearch); -} +package fr.proline.studio.search; + +import fr.proline.studio.filter.Filter; + + +/** + * Interface to be implemented to be able to do a search through the SearchToggleButton/AdvancesSearchFloatingPanel + * @author JM235353 + */ +public interface SearchInterface { + public int search(Filter f, boolean newSearch); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/search/SearchToggleButton.java b/prolinestudio-commons/src/main/java/fr/proline/studio/search/SearchToggleButton.java index 6c80e4fbb..de9f1762e 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/search/SearchToggleButton.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/search/SearchToggleButton.java @@ -1,21 +1,22 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.search; +import fr.proline.studio.WindowManager; import fr.proline.studio.filter.Filter; import fr.proline.studio.filter.FilterMapInterface; import fr.proline.studio.filter.FilterTableModelInterface; @@ -28,7 +29,6 @@ import java.util.Map; import javax.swing.JToggleButton; import org.jdesktop.swingx.JXTable; -import org.openide.windows.WindowManager; /** * Button to add to start a search. diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/settings/FilePreferences.java b/prolinestudio-commons/src/main/java/fr/proline/studio/settings/FilePreferences.java index 83de5fe73..a4578cf64 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/settings/FilePreferences.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/settings/FilePreferences.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.settings; import java.io.File; @@ -234,9 +234,9 @@ protected void flushSpi() throws BackingStoreException if (propKey.startsWith(path)) { String subKey = propKey.substring(path.length()); // Only do immediate descendants - if (subKey.indexOf('.') == -1) { + //if (subKey.indexOf('.') == -1) { //JPM : we do want to supress Validation.PSM_PRETTY_RANK for example : we don't use the parent mechanism toRemove.add(propKey); - } + //} } } diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/settings/SettingsDialog.java b/prolinestudio-commons/src/main/java/fr/proline/studio/settings/SettingsDialog.java index 6830ff285..737171589 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/settings/SettingsDialog.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/settings/SettingsDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.settings; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/settings/SettingsUtils.java b/prolinestudio-commons/src/main/java/fr/proline/studio/settings/SettingsUtils.java index a8b9555d9..a86cd7c5c 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/settings/SettingsUtils.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/settings/SettingsUtils.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.settings; import java.io.File; @@ -21,7 +21,8 @@ import java.util.prefs.Preferences; import javax.swing.JFileChooser; import javax.swing.filechooser.FileNameExtensionFilter; -import org.openide.util.NbPreferences; + +import fr.proline.studio.NbPreferences; /** * Utils methods to read/write settings diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/AbstractDecoratedGlobalTableModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/AbstractDecoratedGlobalTableModel.java index 33cbcf4ee..f515908c2 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/AbstractDecoratedGlobalTableModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/AbstractDecoratedGlobalTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/AbstractTableAction.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/AbstractTableAction.java index 99042f248..0c221c6ad 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/AbstractTableAction.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/AbstractTableAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/BeanTableModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/BeanTableModel.java index 430125e73..2ee951e24 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/BeanTableModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/BeanTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/CustomColumnControlButton.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/CustomColumnControlButton.java index 451ccb3f7..4df694d1a 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/CustomColumnControlButton.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/CustomColumnControlButton.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table; import fr.proline.studio.utils.IconManager; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/DataGroup.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/DataGroup.java index 41a551317..6ebdd22c6 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/DataGroup.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/DataGroup.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table; import fr.proline.studio.table.renderer.PropertiesRenderer; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedMarkerTable.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedMarkerTable.java index 8765fd798..65b7eb35f 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedMarkerTable.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedMarkerTable.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table; import fr.proline.studio.extendedtablemodel.CompoundTableModel; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedTable.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedTable.java index 32eebdc22..2ea2d3c62 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedTable.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedTable.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,7 @@ */ package fr.proline.studio.table; +import fr.proline.studio.NbPreferences; import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; import com.thierry.filtering.TableSelection; import fr.proline.studio.graphics.CrossSelectionInterface; @@ -54,7 +55,6 @@ import org.jdesktop.swingx.decorator.Highlighter; import org.jdesktop.swingx.decorator.HighlighterFactory; import org.jdesktop.swingx.table.TableColumnExt; -import org.openide.util.NbPreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedTableModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedTableModel.java index 4f1938ef7..d528a0b7b 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedTableModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedTableModelInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedTableModelInterface.java index d4d306b75..b5fb00740 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedTableModelInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/DecoratedTableModelInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,16 +14,16 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.table; - -import javax.swing.table.TableCellRenderer; - -/** - * Interface to add decoration (tooltip and renderer row/col) to a table model - * @author JM235353 - */ -public interface DecoratedTableModelInterface { - public String getToolTipForHeader(int col); - public String getTootlTipValue(int row, int col); - public TableCellRenderer getRenderer(int row, int col); -} +package fr.proline.studio.table; + +import javax.swing.table.TableCellRenderer; + +/** + * Interface to add decoration (tooltip and renderer row/col) to a table model + * @author JM235353 + */ +public interface DecoratedTableModelInterface { + public String getToolTipForHeader(int col); + public String getTootlTipValue(int row, int col); + public TableCellRenderer getRenderer(int row, int col); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/ExportTableSelectionInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/ExportTableSelectionInterface.java index 92f14942f..9b6280936 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/ExportTableSelectionInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/ExportTableSelectionInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,16 +14,16 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.table; - -import java.util.HashSet; - -/** - * Interface to export a selection from a table - * @author JM235353 - */ -public interface ExportTableSelectionInterface { - - public HashSet exportSelection(int[] rows); - -} +package fr.proline.studio.table; + +import java.util.HashSet; + +/** + * Interface to export a selection from a table + * @author JM235353 + */ +public interface ExportTableSelectionInterface { + + public HashSet exportSelection(int[] rows); + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/ImportTableSelectionInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/ImportTableSelectionInterface.java index dcbbac1b4..ba76933b3 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/ImportTableSelectionInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/ImportTableSelectionInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,14 +14,14 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.table; - -import java.util.HashSet; - -/** - * Interface to import a selection to a table - * @author JM235353 - */ -public interface ImportTableSelectionInterface { - public void importSelection(HashSet selectedData); -} +package fr.proline.studio.table; + +import java.util.HashSet; + +/** + * Interface to import a selection to a table + * @author JM235353 + */ +public interface ImportTableSelectionInterface { + public void importSelection(HashSet selectedData); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/LazyData.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/LazyData.java index bd8d76b37..f38638a71 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/LazyData.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/LazyData.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/LazyTableModelInterface.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/LazyTableModelInterface.java index d74fad558..d7b1fc216 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/LazyTableModelInterface.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/LazyTableModelInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/PropertiesTableModel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/PropertiesTableModel.java index a947fff03..b6cc6c318 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/PropertiesTableModel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/PropertiesTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/TableDefaultRendererManager.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/TableDefaultRendererManager.java index 7d7028655..2530f5ed2 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/TableDefaultRendererManager.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/TableDefaultRendererManager.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table; import javax.swing.JTable; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/TableInfo.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/TableInfo.java index 063b27f06..320c83438 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/TableInfo.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/TableInfo.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table; import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/TablePopupMenu.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/TablePopupMenu.java index 012b0c37a..f3a0631d9 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/TablePopupMenu.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/TablePopupMenu.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table; import java.awt.Component; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/TablePopupMouseAdapter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/TablePopupMouseAdapter.java index 15cdda431..afb65a08f 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/TablePopupMouseAdapter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/TablePopupMouseAdapter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table; import java.awt.event.MouseAdapter; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/BigFloatOrDoubleRenderer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/BigFloatOrDoubleRenderer.java index 0f9205d79..4dedd8e9b 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/BigFloatOrDoubleRenderer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/BigFloatOrDoubleRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table.renderer; import fr.proline.studio.utils.DataFormat; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/DefaultLeftAlignRenderer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/DefaultLeftAlignRenderer.java index 854b5415f..c30304e9f 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/DefaultLeftAlignRenderer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/DefaultLeftAlignRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table.renderer; import java.awt.Component; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/DefaultRightAlignRenderer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/DefaultRightAlignRenderer.java index ce63c625a..e184a8809 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/DefaultRightAlignRenderer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/DefaultRightAlignRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table.renderer; import java.awt.Component; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/DoubleRenderer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/DoubleRenderer.java index e1fa72d97..634cdba26 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/DoubleRenderer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/DoubleRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table.renderer; import fr.proline.studio.utils.DataFormat; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/GrayableTableCellRenderer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/GrayableTableCellRenderer.java index e11624915..3d07cea56 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/GrayableTableCellRenderer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/GrayableTableCellRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,15 +14,15 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.table.renderer; - -import javax.swing.table.TableCellRenderer; - -/** - * Interface to be extended when the renderer offers the possibility to be grayed - * @author JM235353 - */ -public interface GrayableTableCellRenderer extends TableCellRenderer { - - public void setGrayed(boolean v); -} +package fr.proline.studio.table.renderer; + +import javax.swing.table.TableCellRenderer; + +/** + * Interface to be extended when the renderer offers the possibility to be grayed + * @author JM235353 + */ +public interface GrayableTableCellRenderer extends TableCellRenderer { + + public void setGrayed(boolean v); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/GrayedRenderer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/GrayedRenderer.java index 0353b6d17..a3f74df1d 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/GrayedRenderer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/GrayedRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/PropertiesRenderer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/PropertiesRenderer.java index f64ff5bbf..6e7dd60c7 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/PropertiesRenderer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/table/renderer/PropertiesRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table.renderer; import fr.proline.studio.table.DataGroup; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/GridPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/GridPanel.java index a82902c01..a143b206e 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/GridPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/GridPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.tabs; import java.awt.BorderLayout; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/ILayoutPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/ILayoutPanel.java index 17f2bc670..20156146e 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/ILayoutPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/ILayoutPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.tabs; import java.awt.Component; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/IWrappedPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/IWrappedPanel.java index d079d2817..2e1f887c1 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/IWrappedPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/IWrappedPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.tabs; import java.awt.Component; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/PanelAsGrid.java b/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/PanelAsGrid.java index 6cc093a9d..a1851b91d 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/PanelAsGrid.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/PanelAsGrid.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.tabs; import java.awt.Component; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/PanelAsTab.java b/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/PanelAsTab.java index 531a17bf5..9180dfeb4 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/PanelAsTab.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/PanelAsTab.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.tabs; import java.awt.BorderLayout; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/TabsPanel.java b/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/TabsPanel.java index 59c3b4326..cde3dd12b 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/TabsPanel.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/tabs/TabsPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.tabs; import java.awt.BorderLayout; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/CyclicColorPalette.java b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/CyclicColorPalette.java index 301758a1f..3b015f247 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/CyclicColorPalette.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/CyclicColorPalette.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.utils; import java.awt.Color; @@ -183,7 +183,7 @@ public static Color getColor(Color color, int alpha) { * @param colorIndex * @return */ - public static String getHTMLColor(int colorIndex) { + public static String getHTMLColor(int colorIndex) { Color c = getColor(colorIndex); return getHTMLColor(c); } diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/DataFormat.java b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/DataFormat.java index 85f096348..1b8f94c34 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/DataFormat.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/DataFormat.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.utils; import java.text.DecimalFormat; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/GlobalValues.java b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/GlobalValues.java index 779fe87e6..9e94f0d16 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/GlobalValues.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/GlobalValues.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.utils; /** diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/HelpUtils.java b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/HelpUtils.java index 433ab50f0..ef4c50493 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/HelpUtils.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/HelpUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/IconManager.java b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/IconManager.java index 120f7ccf9..ff65fc802 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/IconManager.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/IconManager.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,8 @@ */ package fr.proline.studio.utils; +import fr.proline.studio.ImageUtilities; + import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; @@ -23,7 +25,6 @@ import java.util.HashMap; import javax.imageio.ImageIO; import javax.swing.ImageIcon; -import org.openide.util.ImageUtilities; /** * Manage all icons needed by the application. Each icon is loaded only one time @@ -71,6 +72,7 @@ public enum IconType { PLUS, CROSS_SMALL7, CROSS_SMALL16, + CROSS_SMALL12, CROSS_BLUE_SMALL16, DOCUMENT_LIST, WEB_LINK, @@ -104,6 +106,7 @@ public enum IconType { COLUMNS_VISIBILITY, PLUS_SMALL_10X10, PROPERTY_SMALL_10X10, + EDIT, EDIT_SMALL_10X10, IDENTIFICATION, ARROW_8X7, @@ -228,10 +231,14 @@ public enum IconType { VALIDATED_LOCALLY, CENTROID_SPECTRA, EXPORT_CENTROID, + SPLASH, + FRAME_ICON, + MINIFY, TIC, TIC_MS1, BPC, - MS2; + MS2, + MERGE_PTM; } private final static HashMap m_iconMap = new HashMap<>(); @@ -357,7 +364,7 @@ public static String getURLForIcon(IconType iconType) { bGr.dispose(); try { - File f = File.createTempFile("tmpicon", ".png", new File(".")); + File f = File.createTempFile("tmpicon", ".png"); f.deleteOnExit(); ImageIO.write(bimage, "png", f); @@ -441,6 +448,8 @@ private static String getIconFilePath(IconType iconType) { return "fr/proline/studio/images/cross-small7x7.png"; case CROSS_SMALL16: return "fr/proline/studio/images/cross-small16x16.png"; + case CROSS_SMALL12: + return "fr/proline/studio/images/cross-small12x16.png"; case CROSS_BLUE_SMALL16: return "fr/proline/studio/images/cross-smallblue16x16.png"; case DOCUMENT_LIST: @@ -505,6 +514,8 @@ private static String getIconFilePath(IconType iconType) { return "fr/proline/studio/images/plus-small10x10.png"; case PROPERTY_SMALL_10X10: return "fr/proline/studio/images/property-small10x10.png"; + case EDIT: + return "fr/proline/studio/images/edit.png"; case EDIT_SMALL_10X10: return "fr/proline/studio/images/edit-small10x10.png"; case IDENTIFICATION: @@ -751,6 +762,12 @@ private static String getIconFilePath(IconType iconType) { return "fr/proline/studio/images/centroid.png"; case EXPORT_CENTROID: return "fr/proline/studio/images/export-centroid.png"; + case SPLASH: + return "fr/proline/studio/images/splash.gif"; + case FRAME_ICON: + return "fr/proline/studio/images/frame48.gif"; + case MINIFY: + return "fr/proline/studio/images/minify.png"; case TIC: return "fr/proline/studio/images/tic.png"; case TIC_MS1: @@ -759,6 +776,8 @@ private static String getIconFilePath(IconType iconType) { return "fr/proline/studio/images/bpc.png"; case MS2: return "fr/proline/studio/images/ms2.png"; + case MERGE_PTM: + return "fr/proline/studio/images/merge_ptm.png"; } return null; // can not happen diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/RelativePainterHighlighter.java b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/RelativePainterHighlighter.java index 2a455259a..35e814b68 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/RelativePainterHighlighter.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/RelativePainterHighlighter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.utils; import fr.proline.studio.table.LazyData; diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/ResultCallback.java b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/ResultCallback.java index 7d478f195..b068f1635 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/ResultCallback.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/ResultCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,12 +14,12 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.utils; - -/** - * Basic callback used for breaking dependency between different part of code - * @author JM235353 - */ -public abstract class ResultCallback { - public abstract void run(boolean success); -} +package fr.proline.studio.utils; + +/** + * Basic callback used for breaking dependency between different part of code + * @author JM235353 + */ +public abstract class ResultCallback { + public abstract void run(boolean success); +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/SerializedPropertiesUtil.java b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/SerializedPropertiesUtil.java index a042d8b83..24e7d5e9f 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/SerializedPropertiesUtil.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/SerializedPropertiesUtil.java @@ -1,21 +1,24 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.utils; +import fr.proline.studio.Property; +import fr.proline.studio.PropertySupport; + import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collections; @@ -23,9 +26,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import org.openide.nodes.Node.Property; -import org.openide.nodes.PropertySupport; -import org.openide.nodes.Sheet; /** * Extract Properties form a Map of maps, lists and objects @@ -46,7 +46,7 @@ public static void getProperties(HashMap propertiesList, String * If the First Map contains only maps, we remove the first map and use the * key as each sub map as a Property Group * - * @param sheet + * @param propertiesList * @param name * @param serializedPropertiesMap */ @@ -79,52 +79,6 @@ private static void getPropertiesImpl(HashMap propertiesList, St } } - public static void getProperties(Sheet sheet, String name, Map serializedPropertiesMap) { - - getPropertiesImpl(sheet, name, serializedPropertiesMap); - - m_sb.setLength(0); - - } - - - /** - * If the First Map contains only maps, we remove the first map and use the - * key as each sub map as a Property Group - * - * @param sheet - * @param name - * @param serializedPropertiesMap - */ - private static void getPropertiesImpl(Sheet sheet, String name, Map serializedPropertiesMap) { - - if (serializedPropertiesMap == null) { - return; - } - - boolean nonMapObject = false; - Iterator it = serializedPropertiesMap.keySet().iterator(); - while (it.hasNext()) { - Object key = it.next(); - Object value = serializedPropertiesMap.get(key); - if (value instanceof Map) { - continue; - } - nonMapObject = true; - } - - if (nonMapObject) { - createPropertyGroup(sheet, name, serializedPropertiesMap); - } else { - it = serializedPropertiesMap.keySet().iterator(); - while (it.hasNext()) { - Object key = it.next(); - Map map = (Map) serializedPropertiesMap.get(key); - createPropertyGroup(sheet, key.toString(), map); - } - } - } - private static void createPropertyGroup(HashMap propertiesList, String name, Map map) { String nameParam = (name.compareTo("validation_properties") == 0) ? "validation_properties" : null; //JPM.WART : sometimes there is one more hierarchical level, and so validation_properties must be always displayed @@ -132,24 +86,6 @@ private static void createPropertyGroup(HashMap propertiesList, } - /** - * Create a Property Group for each map - * - * @param sheet - * @param name - * @param serializedPropertiesMap - */ - private static void createPropertyGroup(Sheet sheet, String name, Map map) { - - Sheet.Set propGroup = Sheet.createPropertiesSet(); - propGroup.setName(name); - propGroup.setDisplayName(name); - - addProperties(propGroup, null, map); - - sheet.put(propGroup); - - } private static void addProperties(HashMap propertiesList, String name, Map serializedPropertiesMap) { @@ -242,114 +178,4 @@ private static void addProperties(HashMap propertiesList, String } - /** - * Add recursively all properties to the Property Group - * - * @param propGroup - * @param name - * @param serializedPropertiesMap - */ - private static void addProperties(Sheet.Set propGroup, String name, Map serializedPropertiesMap) { - - ArrayList listOfKeyMap = null; - ArrayList listOfMaps = null; - - Iterator it = serializedPropertiesMap.keySet().iterator(); - while (it.hasNext()) { - Object key = it.next(); - Object value = serializedPropertiesMap.get(key); - String valueString; - if (value instanceof Map) { - if (listOfMaps == null) { - listOfMaps = new ArrayList<>(); - listOfKeyMap = new ArrayList<>(); - } - listOfMaps.add((Map) value); - listOfKeyMap.add(key); - - continue; - } else if (value instanceof List) { - - m_sb.setLength(0); - List l = (List) value; - Iterator itList = l.iterator(); - - while (itList.hasNext()) { - if (m_sb.length() > 0) { - m_sb.append(','); - } - Object valueList = itList.next(); - - if (valueList instanceof Map) { - if (listOfMaps == null) { - listOfMaps = new ArrayList<>(); - listOfKeyMap = new ArrayList<>(); - } - listOfMaps.add((Map) valueList); - listOfKeyMap.add(key); - - continue; - } - - if (valueList == null) { - m_sb.append("null"); - } else { - m_sb.append(valueList.toString()); - } - - } - - if (m_sb.length() == 0) { - continue; - } - valueString = m_sb.toString(); - } else { - - if (value == null) { - valueString = "null"; - } else { - valueString = value.toString(); - } - } - - String propName = (name == null) ? key.toString() : name + " / " + key.toString(); - - final String _valueString = valueString; - Property prop = new PropertySupport.ReadOnly( - propName, - String.class, - propName, - propName) { - - @Override - public Object getValue() throws InvocationTargetException { - return _valueString; - } - }; - propGroup.put(prop); - - } - - if (listOfMaps != null) { - Map propIndex = new HashMap<>(); - int nbMap = listOfMaps.size(); - for (int i = 0; i < nbMap; i++) { - Object key = listOfKeyMap.get(i); - StringBuilder keyName = new StringBuilder(key.toString()); - if (propIndex.containsKey(key)) { - keyName.append("#").append(propIndex.get(key).toString()); - propIndex.put(key, propIndex.get(key) + 1); - } else if (Collections.frequency(listOfKeyMap, key) > 1) { - keyName.append("#1"); - propIndex.put(key, 2); - } - - Map map = listOfMaps.get(i); - String propName = (name == null) ? keyName.toString() : name + " / " + keyName.toString(); - addProperties(propGroup, propName, map); - } - } - - } - } diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/StringUtils.java b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/StringUtils.java index 30a30222c..cd0a6df79 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/StringUtils.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/StringUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/StudioExceptions.java b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/StudioExceptions.java deleted file mode 100644 index b0ee8a1a7..000000000 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/StudioExceptions.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.utils; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.logging.Level; -import javax.swing.ImageIcon; -import org.openide.awt.NotificationDisplayer; -import org.openide.util.Exceptions; -import org.openide.util.ImageUtilities; -import org.slf4j.LoggerFactory; - -/** - * - * @author CB205360 - */ -public class StudioExceptions { - - private static ImageIcon exceptionIcon = ImageUtilities.loadImageIcon("org/netbeans/core/resources/exception.gif", false); - - public static void notify(String message, Throwable throwable) { - NotificationDisplayer.getDefault().notify("Proline Studio Error", exceptionIcon, message, new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - Exceptions.printStackTrace(Exceptions.attachSeverity(throwable, Level.SEVERE)); - } - }); - } - - public static void logAndNotify(String loggerName, String message, Throwable throwable) { - LoggerFactory.getLogger(loggerName).error(message, throwable); - notify(message, throwable); - } -} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/StudioResourceBundle.java b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/StudioResourceBundle.java new file mode 100644 index 000000000..2cae729bf --- /dev/null +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/StudioResourceBundle.java @@ -0,0 +1,32 @@ +package fr.proline.studio.utils; + +import java.util.ResourceBundle; + +public class StudioResourceBundle { + + /** + * Return a string for the given key from the resource bundle associated to specified class. + * ResourceBundle for a class is the "Bundle" resource found in the class package. + * + * @param c The class to get the ResourceBundle for + * @param key The key of the String to search for + * @return String Value associated to the bundle/key couple or the key if no value found + * @throws IllegalArgumentException if one of the parameter is null + */ + public static String getMessage(Class c, String key){ + if(c == null || key==null) { + throw new IllegalArgumentException("StudioResourceBundle: must specify a valid class and key."); + } + + StringBuilder sb = new StringBuilder(c.getPackage().getName()); + sb.append(".Bundle"); + try { + ResourceBundle rsc = ResourceBundle.getBundle(sb.toString()); + return ( rsc.getString(key)); + } catch (Exception e) { + return key; + } + } + + +} diff --git a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/URLCellRenderer.java b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/URLCellRenderer.java index 84f4505da..ff733ea07 100644 --- a/prolinestudio-commons/src/main/java/fr/proline/studio/utils/URLCellRenderer.java +++ b/prolinestudio-commons/src/main/java/fr/proline/studio/utils/URLCellRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.utils; import java.awt.Component; @@ -32,7 +32,8 @@ import javax.swing.table.JTableHeader; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; -import org.openide.util.NbPreferences; + +import fr.proline.studio.NbPreferences; import org.slf4j.LoggerFactory; /** diff --git a/prolinestudio-commons/src/main/resources/fr/proline/studio/images/cross-small12x16.png b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/cross-small12x16.png new file mode 100644 index 000000000..0c27ac8b6 Binary files /dev/null and b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/cross-small12x16.png differ diff --git a/prolinestudio-commons/src/main/resources/fr/proline/studio/images/edit.png b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/edit.png new file mode 100644 index 000000000..16c440c86 Binary files /dev/null and b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/edit.png differ diff --git a/branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/startup/frame.gif b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/frame.gif similarity index 100% rename from branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/startup/frame.gif rename to prolinestudio-commons/src/main/resources/fr/proline/studio/images/frame.gif diff --git a/branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/startup/frame32.gif b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/frame32.gif similarity index 100% rename from branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/startup/frame32.gif rename to prolinestudio-commons/src/main/resources/fr/proline/studio/images/frame32.gif diff --git a/branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/startup/frame48.gif b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/frame48.gif similarity index 100% rename from branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/startup/frame48.gif rename to prolinestudio-commons/src/main/resources/fr/proline/studio/images/frame48.gif diff --git a/prolinestudio-commons/src/main/resources/fr/proline/studio/images/icon_set.svg b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/icon_set.svg index e08e2a203..25fd8aa00 100644 --- a/prolinestudio-commons/src/main/resources/fr/proline/studio/images/icon_set.svg +++ b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/icon_set.svg @@ -13,10 +13,52 @@ viewBox="0 0 210 297" version="1.1" id="svg2319" - inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)" sodipodi:docname="icon_set.svg"> + + + + + + + + + @@ -1286,20 +1328,20 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="11.2" - inkscape:cx="187.34016" - inkscape:cy="162.13236" + inkscape:zoom="2.8" + inkscape:cx="70.897065" + inkscape:cy="867.93435" inkscape:document-units="mm" inkscape:current-layer="layer1" showgrid="true" - inkscape:window-width="1920" - inkscape:window-height="1017" - inkscape:window-x="-8" + inkscape:window-width="1680" + inkscape:window-height="987" + inkscape:window-x="1358" inkscape:window-y="-8" inkscape:window-maximized="1" objecttolerance="20" gridtolerance="1" - showguides="false" + showguides="true" inkscape:document-rotation="0">   -   @@ -4220,5 +3953,707 @@ uohJBEEQBCGp+P8YLoqTMCmvEwAAAABJRU5ErkJggg== inkscape:export-filename="C:\Users\cb205360\Pictures\Icons\same_ms_level.png" inkscape:export-xdpi="96" inkscape:export-ydpi="96" /> + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/prolinestudio-commons/src/main/resources/fr/proline/studio/images/merge_ptm.png b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/merge_ptm.png new file mode 100644 index 000000000..7b4e725da Binary files /dev/null and b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/merge_ptm.png differ diff --git a/prolinestudio-commons/src/main/resources/fr/proline/studio/images/minify.png b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/minify.png new file mode 100644 index 000000000..4d121e456 Binary files /dev/null and b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/minify.png differ diff --git a/branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/startup/splash.gif b/prolinestudio-commons/src/main/resources/fr/proline/studio/images/splash.gif similarity index 100% rename from branding/src/main/nbm-branding/core/core.jar/org/netbeans/core/startup/splash.gif rename to prolinestudio-commons/src/main/resources/fr/proline/studio/images/splash.gif diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/DoubleAxisPlotPanelTest.java b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/DoubleAxisPlotPanelTest.java index 3b10e392f..08c9cd6f3 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/DoubleAxisPlotPanelTest.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/DoubleAxisPlotPanelTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,7 @@ */ package fr.proline.studio.demo; +import fr.proline.studio.Exceptions; import fr.proline.studio.graphics.BasePlotPanel; import fr.proline.studio.graphics.PlotInformation; import fr.proline.studio.graphics.PlotLinear; @@ -27,7 +28,6 @@ import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.WindowConstants; -import org.openide.util.Exceptions; /** * diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/GraphicsPanelDemo.java b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/GraphicsPanelDemo.java index 338909224..0df78df91 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/GraphicsPanelDemo.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/GraphicsPanelDemo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,7 @@ */ package fr.proline.studio.demo; +import fr.proline.studio.Exceptions; import fr.proline.studio.graphics.MonoGraphicsPanel; import fr.proline.studio.sampledata.Sample; import java.awt.BorderLayout; @@ -24,7 +25,6 @@ import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.WindowConstants; -import org.openide.util.Exceptions; /** * diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/HistogramPlotDemo.java b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/HistogramPlotDemo.java index 8c74a0b92..0c46df7a6 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/HistogramPlotDemo.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/HistogramPlotDemo.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.demo; import fr.proline.studio.graphics.PlotHistogram; diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/LinearPlotDemo.java b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/LinearPlotDemo.java index 79016d78d..6769ec250 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/LinearPlotDemo.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/LinearPlotDemo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,7 @@ */ package fr.proline.studio.demo; +import fr.proline.studio.Exceptions; import fr.proline.studio.graphics.PlotLinear; import fr.proline.studio.graphics.BasePlotPanel; import fr.proline.studio.graphics.PlotPanel; @@ -27,15 +28,11 @@ import fr.proline.studio.sampledata.Sample; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Insets; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.WindowConstants; -import org.openide.util.Exceptions; /** * @@ -47,7 +44,7 @@ public class LinearPlotDemo extends JFrame { public LinearPlotDemo() { super("LinearPlot demo"); - plotPanel = new PlotPanel(false); + plotPanel = new PlotPanel(); final BasePlotPanel basePlot = plotPanel.getBasePlotPanel(); basePlot.setPlotTitle("graph title"); basePlot.setDrawCursor(true); diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/MultiPlotDemo.java b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/MultiPlotDemo.java index 4b2dd3399..20f2cc7ee 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/MultiPlotDemo.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/MultiPlotDemo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,25 +16,18 @@ */ package fr.proline.studio.demo; +import fr.proline.studio.Exceptions; import fr.proline.studio.graphics.BasePlotPanel; import fr.proline.studio.graphics.PlotLinear; import fr.proline.studio.graphics.PlotPanel; import fr.proline.studio.graphics.PlotScatter; -import fr.proline.studio.graphics.marker.IntervalMarker; -import fr.proline.studio.graphics.marker.LineMarker; -import fr.proline.studio.graphics.marker.PointMarker; -import fr.proline.studio.graphics.marker.XDeltaMarker; -import fr.proline.studio.graphics.marker.coordinates.DataCoordinates; import fr.proline.studio.sampledata.Sample; import java.awt.BorderLayout; -import java.awt.Color; -import javax.swing.JApplet; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.WindowConstants; -import org.openide.util.Exceptions; /** * @@ -46,7 +39,7 @@ public class MultiPlotDemo extends JFrame { public MultiPlotDemo() { super("MultiPlot demo"); - plotPanel = new PlotPanel(false); + plotPanel = new PlotPanel(); final BasePlotPanel basePlot = plotPanel.getBasePlotPanel(); basePlot.setPlotTitle("MultiPlot title"); diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/ScatterPlotDemo.java b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/ScatterPlotDemo.java index 692ef7459..5c26a7abb 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/ScatterPlotDemo.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/ScatterPlotDemo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,7 @@ */ package fr.proline.studio.demo; +import fr.proline.studio.Exceptions; import fr.proline.studio.graphics.BasePlotPanel; import fr.proline.studio.graphics.PlotPanel; import fr.proline.studio.graphics.PlotScatter; @@ -23,9 +24,6 @@ import fr.proline.studio.table.DecoratedTable; import fr.proline.studio.table.TablePopupMenu; import java.awt.BorderLayout; -import java.awt.Insets; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JScrollPane; @@ -34,7 +32,6 @@ import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.WindowConstants; -import org.openide.util.Exceptions; /** * @@ -48,7 +45,7 @@ public ScatterPlotDemo() { super("ScatterPlot demo"); JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT); split.setDividerLocation(150); - plotPanel = new PlotPanel(false); + plotPanel = new PlotPanel(); Sample sample = new Sample(3000); final BasePlotPanel basePlot = plotPanel.getBasePlotPanel(); PlotScatter scatter = new PlotScatter(basePlot, sample, null, 0, 3); diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/VennPlotDemo.java b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/VennPlotDemo.java index 55f4cf87e..f195b5169 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/demo/VennPlotDemo.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/demo/VennPlotDemo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,7 @@ */ package fr.proline.studio.demo; +import fr.proline.studio.Exceptions; import fr.proline.studio.graphics.BasePlotPanel; import fr.proline.studio.graphics.PlotPanel; import fr.proline.studio.graphics.PlotVennDiagram; @@ -31,7 +32,6 @@ import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.WindowConstants; -import org.openide.util.Exceptions; /** * @@ -43,7 +43,7 @@ public class VennPlotDemo extends JFrame { public VennPlotDemo() { super("LinearPlot demo"); - plotPanel = new PlotPanel(false); + plotPanel = new PlotPanel(); final BasePlotPanel basePlot = plotPanel.getBasePlotPanel(); basePlot.setPlotTitle("graph title"); basePlot.setDrawCursor(true); diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/export/CustomExportDialogDemo.java b/prolinestudio-commons/src/test/java/fr/proline/studio/export/CustomExportDialogDemo.java index 0c67d947e..71974ffbf 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/export/CustomExportDialogDemo.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/export/CustomExportDialogDemo.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.export; import java.awt.BorderLayout; diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/CurveSample.java b/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/CurveSample.java index 18b927b5a..d89ec36e9 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/CurveSample.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/CurveSample.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.sampledata; import java.util.ArrayList; diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/Gaussian2DSample.java b/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/Gaussian2DSample.java index 82e07841d..072644605 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/Gaussian2DSample.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/Gaussian2DSample.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.sampledata; import fr.proline.studio.extendedtablemodel.ExtraDataType; diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/Sample.java b/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/Sample.java index a2546f2ac..917f3fb89 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/Sample.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/Sample.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.sampledata; import fr.proline.studio.extendedtablemodel.ExtraDataType; diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/SampleDataGenerator.java b/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/SampleDataGenerator.java index dce75f868..db5bd602b 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/SampleDataGenerator.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/SampleDataGenerator.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.sampledata; import java.io.File; diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/SampleTableModel.java b/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/SampleTableModel.java index c94014e87..445f03c8f 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/SampleTableModel.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/sampledata/SampleTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.sampledata; import fr.proline.studio.table.DecoratedTableModelInterface; diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/table/CompoundTableDemo.java b/prolinestudio-commons/src/test/java/fr/proline/studio/table/CompoundTableDemo.java index 8c9e97f11..e09ce82de 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/table/CompoundTableDemo.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/table/CompoundTableDemo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,7 @@ */ package fr.proline.studio.table; +import fr.proline.studio.Exceptions; import fr.proline.studio.extendedtablemodel.CompoundTableModel; import fr.proline.studio.extendedtablemodel.ExpansionTableModel; import fr.proline.studio.extendedtablemodel.ImportedDataTableModel; @@ -29,7 +30,6 @@ import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.WindowConstants; -import org.openide.util.Exceptions; /** * diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/table/TableTest.java b/prolinestudio-commons/src/test/java/fr/proline/studio/table/TableTest.java index 6ecab59cc..a38d0f18b 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/table/TableTest.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/table/TableTest.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table; import java.awt.BorderLayout; diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/tabs/TabsPanelsFrameTest.java b/prolinestudio-commons/src/test/java/fr/proline/studio/tabs/TabsPanelsFrameTest.java index 4aae51c93..d1455c1bb 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/tabs/TabsPanelsFrameTest.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/tabs/TabsPanelsFrameTest.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.tabs; import fr.proline.studio.utils.IconManager; diff --git a/prolinestudio-commons/src/test/java/fr/proline/studio/tabs/TestPanel.java b/prolinestudio-commons/src/test/java/fr/proline/studio/tabs/TestPanel.java index 9a1e5b012..3c7450238 100644 --- a/prolinestudio-commons/src/test/java/fr/proline/studio/tabs/TestPanel.java +++ b/prolinestudio-commons/src/test/java/fr/proline/studio/tabs/TestPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.tabs; import java.awt.BorderLayout; diff --git a/prolinestudio-corewrapper/pom.xml b/prolinestudio-corewrapper/pom.xml index 043c0cb17..9c4050ab3 100644 --- a/prolinestudio-corewrapper/pom.xml +++ b/prolinestudio-corewrapper/pom.xml @@ -5,25 +5,43 @@ prolinestudio-parent fr.proline - 2.1.2 + 2.2.0 fr.proline prolinestudio-corewrapper - nbm + jar ProlineStudio-CoreWrapper UTF-8 - 2.1.2 - 2.1.2 - 1.0.0 + 2.2.0 + 2.2.0 + 1.1.0 - - true - - - - - fr.profi.jdbc - fr.profi.jdbc.easy - fr.profi.util - fr.profi.util.math - fr.profi.util.security - fr.proline.api.service - fr.proline.context - fr.proline.core.algo.msi - fr.proline.core.algo.msq - fr.proline.core.dal.* - fr.proline.core.om.builder - fr.proline.core.om.model.lcms - fr.proline.core.om.model.msi - fr.proline.core.om.model.msq - fr.proline.core.om.model.pdi - fr.proline.core.om.model.uds - fr.proline.core.om.msi - fr.proline.core.om.provider.* - fr.proline.core.om.storer.lcms - fr.proline.core.om.storer.lcms.impl - fr.proline.core.om.storer.msi - fr.proline.core.om.storer.msi.impl - fr.proline.core.om.storer.ps - fr.proline.core.om.utils - fr.proline.core.orm - fr.proline.core.orm.lcms - fr.proline.core.orm.msi - fr.proline.core.orm.msi.dto - fr.proline.core.orm.msi.repository - fr.proline.core.orm.pdi - fr.proline.core.orm.pdi.repository - fr.proline.core.orm.ps - fr.proline.core.orm.ps.repository - fr.proline.core.orm.uds - fr.proline.core.orm.uds.dto - fr.proline.core.orm.uds.repository - fr.proline.core.orm.util - fr.proline.core.orm.lcms.dto - fr.proline.core.parser.lcms - fr.proline.core.parser.lcms.impl - fr.proline.core.service.lcms - fr.proline.core.service.msi - fr.proline.core.service.msq - fr.proline.core.service.msq.impl - fr.proline.core.service.msq.quantitation - fr.proline.core.service.uds - fr.proline.core.utils.generator - fr.proline.core.utils.lzma - fr.proline.core.utils.serialization - fr.proline.module - fr.proline.module.parser.mascot - fr.proline.module.seq - fr.proline.module.seq.dto - fr.proline.repository - fr.proline.repository.util - fr.proline.security - fr.proline.studio.corewrapper.data - fr.proline.studio.corewrapper.util - fr.proline.util - fr.proline.util.version - javassist - javax.annotation - javax.annotation.concurrent - javax.annotation.meta - javax.persistence.* - javax.sql - javax.transaction.xa - javax.xml.parsers - javax.xml.transform.* - org.apache.commons.collections - org.apache.commons.lang3 - org.apache.commons.lang3.math - org.apache.commons.logging - org.apache.commons.logging.impl - org.hibernate - org.jboss.logging - org.joda.time - org.joda.time.format - org.w3c.dom - org.w3c.dom.html - org.w3c.dom.ls - org.dom4j.tree.* - org.w3c.dom.events.* - org.dom4j.* - org.xml.sax - org.xml.sax.ext - org.xml.sax.helpers - scala.* - org.slf4j.impl.* - org.apache.commons.* - com.fasterxml.* - com.fasterxml.jackson.databind.* - javax.jms.* - javax.inject.* - - - - - - diff --git a/prolinestudio-corewrapper/src/main/java/fr/proline/studio/corewrapper/util/PeptideClassesUtils.java b/prolinestudio-corewrapper/src/main/java/fr/proline/studio/corewrapper/util/PeptideClassesUtils.java index c7907eed9..7d8d7252e 100644 --- a/prolinestudio-corewrapper/src/main/java/fr/proline/studio/corewrapper/util/PeptideClassesUtils.java +++ b/prolinestudio-corewrapper/src/main/java/fr/proline/studio/corewrapper/util/PeptideClassesUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -25,8 +25,9 @@ */ public class PeptideClassesUtils { - public static final double PROTON_MASS =1.007825; //1.007276466812; - public static final double PEPTIDE_ISOTOPE_SHIFT=1.00335; + + public static final double PROTON_MASS = 1.007276466812; + public static final double PEPTIDE_ISOTOPE_SHIFT = 1.00335; final static double EXP_CSTE = StrictMath.pow(10, 6); public static Float getPPMFor(DPeptideMatch pepMatch, Peptide peptide) { @@ -41,7 +42,20 @@ public static Float getPPMFor(DPeptideMatch pepMatch, Peptide peptide) { } return ppm; } - + + public static Float getDeltaMozFor(double expMoz, double charge, Peptide peptide) { + double calculatedMass = peptide.getCalculatedMass() ; + double theoreticalMoz = (calculatedMass + (charge * PROTON_MASS)) / charge; + float ppm = (float) (((expMoz-theoreticalMoz)*EXP_CSTE)/theoreticalMoz); + + if ((calculatedMass >= -1e-10) && (calculatedMass <= 1e-10)) { + //calculatedMass == 0; // it was a bug, does no longer exist, but 0 values can exist in database. + ppm = 0; + } + return ppm; + } + + /** * * @param petideIonMoz diff --git a/prolinestudio-dam/pom.xml b/prolinestudio-dam/pom.xml index 318c0242d..1f278d561 100644 --- a/prolinestudio-dam/pom.xml +++ b/prolinestudio-dam/pom.xml @@ -5,12 +5,12 @@ prolinestudio-parent fr.proline - 2.1.2 + 2.2.0 fr.proline prolinestudio-dam - nbm + jar ProlineStudio-DAM @@ -20,24 +20,8 @@ - - org.netbeans.api - org-netbeans-modules-db - ${netbeans.version} - jar - - - - - org.netbeans.api - org-openide-util - ${netbeans.version} - + + @@ -54,6 +38,7 @@ ${project.groupId} prolinestudio-logger ${project.version} + pom @@ -86,25 +71,20 @@ + - org.codehaus.mojo - nbm-maven-plugin - - true - - - fr.proline.repository - fr.proline.studio.dam.* - fr.proline.studio.id - fr.proline.studio.repositorymgr - fr.proline.studio.repositorymgr.action - org.openide.awt - - + com.google.code.maven-replacer-plugin + replacer + + + + + + diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/AccessDatabaseThread.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/AccessDatabaseThread.java index 6ee192301..e2218f606 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/AccessDatabaseThread.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/AccessDatabaseThread.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam; import fr.proline.studio.dam.taskinfo.TaskError; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/AccessDatabaseWorkerPool.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/AccessDatabaseWorkerPool.java index dd434a482..c3faabc40 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/AccessDatabaseWorkerPool.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/AccessDatabaseWorkerPool.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/AccessDatabaseWorkerThread.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/AccessDatabaseWorkerThread.java index 33d85694c..38c24d4dd 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/AccessDatabaseWorkerThread.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/AccessDatabaseWorkerThread.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam; import fr.proline.studio.dam.tasks.AbstractDatabaseTask; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/DatabaseDataManager.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/DatabaseDataManager.java index 1470202e8..d9e853452 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/DatabaseDataManager.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/DatabaseDataManager.java @@ -1,37 +1,29 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam; -import fr.proline.core.orm.uds.Aggregation; -import fr.proline.core.orm.uds.FragmentationRule; -import fr.proline.core.orm.uds.FragmentationRuleSet; -import fr.proline.core.orm.uds.InstrumentConfiguration; -import fr.proline.core.orm.uds.PeaklistSoftware; -import fr.proline.core.orm.uds.Project; -import fr.proline.core.orm.uds.SpectrumTitleParsingRule; -import fr.proline.core.orm.uds.UserAccount; +import fr.proline.core.orm.uds.*; import fr.proline.module.seq.DatabaseAccess; import fr.proline.repository.IDatabaseConnector; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import org.openide.util.Exceptions; +import fr.proline.studio.Exceptions; +import fr.proline.studio.dam.tasks.data.ptm.PTMDataset; +import fr.proline.studio.dam.tasks.data.ptm.PTMDatasetPair; + +import java.util.*; /** * Static reference of the several UDS values : project, instruments .... @@ -50,10 +42,16 @@ public class DatabaseDataManager { private String m_jdbcURL; private String m_jdbcDriver; private HashMap m_serverConnectionProperties; - + private Project m_currentProject; + + private HashMap m_ptmDatasetSetPerDatasetId; + private HashMap m_ptmAnnotatedDatasetSetPerDatasetId; + private HashMap m_aggregationMap = null; private DatabaseDataManager() { + m_ptmDatasetSetPerDatasetId = new HashMap<>(); + m_ptmAnnotatedDatasetSetPerDatasetId = new HashMap<>(); } public static DatabaseDataManager getDatabaseDataManager() { @@ -68,7 +66,7 @@ public void setServerConnectionProperties(HashMap connProperties } public void setIntruments(List l) { - m_instruments = l.toArray(new InstrumentConfiguration[l.size()]); + m_instruments = l.toArray(new InstrumentConfiguration[0]); } public InstrumentConfiguration[] getInstrumentsArray() { @@ -85,7 +83,7 @@ public InstrumentConfiguration[] getInstrumentsWithNullArray() { } public void setPeaklistSofwares(List l) { - m_peaklistSoftwares = l.toArray(new PeaklistSoftware[l.size()]); + m_peaklistSoftwares = l.toArray(new PeaklistSoftware[0]); } public PeaklistSoftware[] getPeaklistSoftwaresArray() { @@ -149,7 +147,7 @@ public PeaklistSoftware[] getPeaklistSoftwaresWithNullArray() { } public void setFragmentationRules(List l) { - m_fragmentationRules = l.toArray(new FragmentationRule[l.size()]); + m_fragmentationRules = l.toArray(new FragmentationRule[0]); } public FragmentationRule[] getFragmentationRulesArray() { @@ -157,7 +155,7 @@ public FragmentationRule[] getFragmentationRulesArray() { } public void setFragmentationRuleSets(List l) { - m_fragmentationRuleSets = l.toArray(new FragmentationRuleSet[l.size()]); + m_fragmentationRuleSets = l.toArray(new FragmentationRuleSet[0]); } public FragmentationRuleSet[] getFragmentationRuleSetsArray() { @@ -199,17 +197,86 @@ public Aggregation getAggregation(Aggregation.ChildNature childNature) { public void setProjectUsers(List l) { - m_projectUsers = l.toArray(new UserAccount[l.size()]); + m_projectUsers = l.toArray(new UserAccount[0]); } public UserAccount[] getProjectUsersArray() { return m_projectUsers; } - + + public void setCurrentProject(Project currentProject){ + if(currentProject == null || !currentProject.equals(m_currentProject)) { + m_currentProject = currentProject; + m_ptmDatasetSetPerDatasetId.clear(); + } + } + + public Project getCurrentProject(){ + return m_currentProject; + } + + //VDS TODO: See how to be able to free memory without changing Project + public void addLoadedPTMDatasetSet(PTMDatasetPair ptmDSSet){ + m_ptmDatasetSetPerDatasetId.put(ptmDSSet.getDataset().getId(), ptmDSSet); + } + + public PTMDataset getClustersPTMDatasetForDS(Long dsId){ + if (m_ptmDatasetSetPerDatasetId.containsKey(dsId)) + return m_ptmDatasetSetPerDatasetId.get(dsId).getClusterPTMDataset(); + return null; + } + + + public PTMDataset getSitesPTMDatasetForDS(Long dsId){ + if (m_ptmDatasetSetPerDatasetId.containsKey(dsId)) + return m_ptmDatasetSetPerDatasetId.get(dsId).getSitePTMDataset(); + return null; + } + + public void removeAllPTMDatasetsForDS(Long dsId){ + if (m_ptmDatasetSetPerDatasetId.containsKey(dsId)) + m_ptmDatasetSetPerDatasetId.remove(dsId); + if (m_ptmAnnotatedDatasetSetPerDatasetId.containsKey(dsId)) + m_ptmAnnotatedDatasetSetPerDatasetId.remove(dsId); + } + + public void removeAnnotatedPTMDatasetsForDS(Long dsId){ + if (m_ptmAnnotatedDatasetSetPerDatasetId.containsKey(dsId)) + m_ptmAnnotatedDatasetSetPerDatasetId.remove(dsId); + } + + public PTMDatasetPair getPTMDatasetSetForDS(Long dsId){ + return m_ptmDatasetSetPerDatasetId.get(dsId); + } + + + //Annotated PTM Datasets + public void addLoadedAnnotatedPTMDatasetSet(PTMDatasetPair ptmDSSet){ + m_ptmAnnotatedDatasetSetPerDatasetId.put(ptmDSSet.getDataset().getId(), ptmDSSet); + } + + public PTMDataset getAnnotatedClustersPTMDatasetForDS(Long dsId){ + if (m_ptmAnnotatedDatasetSetPerDatasetId.containsKey(dsId)) + return m_ptmAnnotatedDatasetSetPerDatasetId.get(dsId).getClusterPTMDataset(); + return null; + } + + + public PTMDataset getAnnotatedSitesPTMDatasetForDS(Long dsId){ + if (m_ptmAnnotatedDatasetSetPerDatasetId.containsKey(dsId)) + return m_ptmAnnotatedDatasetSetPerDatasetId.get(dsId).getSitePTMDataset(); + return null; + } + + + public PTMDatasetPair getAnnotatedPTMDatasetSetForDS(Long dsId){ + return m_ptmAnnotatedDatasetSetPerDatasetId.get(dsId); + } + + public void setLoggedUser(UserAccount loggedUser) { m_loggedUser = loggedUser; } - public UserAccount getLoggedUser() { return m_loggedUser; } diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/AbstractData.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/AbstractData.java index 501991200..8113c9d19 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/AbstractData.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/AbstractData.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.data; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/AllImportedData.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/AllImportedData.java index a8870086d..8c2824578 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/AllImportedData.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/AllImportedData.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.data; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ClearProjectData.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ClearProjectData.java index f8391cbd2..e5971eb59 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ClearProjectData.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ClearProjectData.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.data; import fr.proline.core.orm.msi.MsiSearch; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/DataSetData.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/DataSetData.java index 507f1e3b8..08580849b 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/DataSetData.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/DataSetData.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/DatasetToCopy.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/DatasetToCopy.java index 4cbe8a97d..b21129588 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/DatasetToCopy.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/DatasetToCopy.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.data; import fr.proline.core.orm.uds.Aggregation; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ParentData.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ParentData.java index dc0622e8e..b8c0c6ca3 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ParentData.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ParentData.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.data; import fr.proline.studio.dam.AccessDatabaseThread; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ProjectIdentificationData.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ProjectIdentificationData.java index 27317e9f6..6b739b384 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ProjectIdentificationData.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ProjectIdentificationData.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.data; import fr.proline.core.orm.uds.Project; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ProjectQuantitationData.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ProjectQuantitationData.java index 8ef25eb13..4525c0903 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ProjectQuantitationData.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/ProjectQuantitationData.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.data; import fr.proline.core.orm.uds.Project; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/RunInfoData.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/RunInfoData.java index 6b96dcf3f..d56a4eb77 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/RunInfoData.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/RunInfoData.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/SelectLevelEnum.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/SelectLevelEnum.java new file mode 100644 index 000000000..0754654a7 --- /dev/null +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/data/SelectLevelEnum.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.dam.data; + +import java.util.HashMap; + +public enum SelectLevelEnum { + DESELECTED_MANUAL(0, "Invalidated manually"), + DESELECTED_AUTO(1, "Invalidated automatically"), + SELECTED_AUTO(2, "Validated automatically"), + SELECTED_MANUAL(3, "Validated Manual"), + UNKNOWN(-1, "Invalid (not quantified)"), + RESET_AUTO(-2, "Reset auto"); + + private int _intValue; + private String _description; + private static HashMap map = new HashMap<>(); + + SelectLevelEnum(int value, String description) { + this._intValue = value; + this._description = description; + } + + static { + for (SelectLevelEnum status : SelectLevelEnum.values()) { + map.put(status._intValue, status); + } + } + + public boolean isSelected() { + return this.equals(SELECTED_AUTO) || this.equals(SELECTED_MANUAL); + } + + public boolean isDeselected() { + return this.equals(DESELECTED_AUTO) || this.equals(DESELECTED_MANUAL); + } + + public int getIntValue() { + return _intValue; + } + + public String getDescription() { + return _description; + } + + public static SelectLevelEnum valueOf(int status) { + return map.get(status); + } + +} diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/memory/MemoryReference.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/memory/MemoryReference.java index 67464d8a2..8135f1146 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/memory/MemoryReference.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/memory/MemoryReference.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -44,6 +44,15 @@ public int compareTo(MemoryReference o) { if (cmp != 0) { return cmp; } + + if (m_clientName == null && o.m_clientName == null){ + return 0; + } else if(m_clientName == null){ + return 1; + } else if(o.m_clientName == null){ + return -1; + } + return m_clientName.compareTo(o.m_clientName); } diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/memory/TransientMemoryCacheManager.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/memory/TransientMemoryCacheManager.java index daf184990..f561e2a4e 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/memory/TransientMemoryCacheManager.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/memory/TransientMemoryCacheManager.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/AbstractLongTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/AbstractLongTask.java index cad16535c..a9ace0c97 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/AbstractLongTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/AbstractLongTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.taskinfo; /** diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/TaskError.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/TaskError.java index 3702b0af1..8743913cc 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/TaskError.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/TaskError.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.taskinfo; import java.io.PrintWriter; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/TaskInfo.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/TaskInfo.java index 4c14512d2..8cbb28f5a 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/TaskInfo.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/TaskInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/TaskInfoManager.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/TaskInfoManager.java index cb12e702f..c0bd7d475 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/TaskInfoManager.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/taskinfo/TaskInfoManager.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.taskinfo; import java.util.ArrayList; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/AbstractDatabaseCallback.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/AbstractDatabaseCallback.java index 7ccbc1d3e..75223e9ba 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/AbstractDatabaseCallback.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/AbstractDatabaseCallback.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; import fr.proline.studio.dam.taskinfo.TaskError; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/AbstractDatabaseSlicerTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/AbstractDatabaseSlicerTask.java index 210dcfbf7..fb3d1f493 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/AbstractDatabaseSlicerTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/AbstractDatabaseSlicerTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/AbstractDatabaseTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/AbstractDatabaseTask.java index f74cce3de..1c797ac93 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/AbstractDatabaseTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/AbstractDatabaseTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; import fr.proline.studio.dam.taskinfo.AbstractLongTask; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseAdminTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseAdminTask.java index 97ec0e0f5..d9e6a28e3 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseAdminTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseAdminTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; import fr.proline.core.orm.uds.FragmentationRule; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseBioSequenceTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseBioSequenceTask.java index 5e7855206..830ea14ec 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseBioSequenceTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseBioSequenceTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseClearProjectTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseClearProjectTask.java index 37b494ce8..42e5d7dc4 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseClearProjectTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseClearProjectTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; import fr.proline.core.orm.msi.ResultSet; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseConnectionTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseConnectionTask.java index 52f05cf92..55db72668 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseConnectionTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseConnectionTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -29,11 +29,11 @@ import java.util.Map; import javax.persistence.EntityManager; import javax.persistence.TypedQuery; -import org.netbeans.api.db.explorer.ConnectionManager; +/*import org.netbeans.api.db.explorer.ConnectionManager; import org.netbeans.api.db.explorer.DatabaseConnection; import org.netbeans.api.db.explorer.JDBCDriver; import org.netbeans.api.db.explorer.JDBCDriverManager; - +*/ /** * Used to connect to a UDS DB, MSI DB @@ -78,9 +78,14 @@ public DatabaseConnectionTask(AbstractDatabaseCallback callback) { public void initConnectionToUDS(Map databaseProperties, String projectUser) { setTaskInfo(new TaskInfo("Connection to UDS Database", false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_HIGH)); setPriority(Priority.TOP); - + + m_databaseProperties = databaseProperties; -// m_databaseProperties.put("hibernate.show_sql", Boolean.TRUE); +// m_databaseProperties.put("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect"); +// //m_databaseProperties.put("connection_pool_size", 1); +// m_databaseProperties.put("hbm2ddl.auto", 2); +// m_databaseProperties.put("cache.provider_class", "org.hibernate.cache.internal.StandardQueryCache"); +// m_databaseProperties.put("hibernate.show_sql", Boolean.TRUE); //TO TEST SQL query // m_databaseProperties.put("hibernate.format_sql", Boolean.TRUE); m_projectUser = projectUser; @@ -140,7 +145,9 @@ public boolean fetchData() { // UDS Connection try { - + + + IDatabaseConnector udsConn = DatabaseConnectorFactory.createDatabaseConnectorInstance(ProlineDatabaseType.UDS, m_databaseProperties); //VD #16961,IDatabaseConnector.ConnectionPoolType.SIMPLE_POOL_MANAGEMENT); DStoreCustomPoolConnectorFactory.getInstance().initialize(udsConn, "Proline STUDIO"); //VD #16961,IDatabaseConnector.ConnectionPoolType.SIMPLE_POOL_MANAGEMENT); } catch (Exception e) { @@ -192,13 +199,13 @@ public boolean fetchData() { String udsJdbcDriver = (String) m_databaseProperties.get("javax.persistence.jdbc.driver"); String udsJdbcUrl = (String) m_databaseProperties.get("javax.persistence.jdbc.url"); try { - ConnectionManager cm = ConnectionManager.getDefault(); + //ConnectionManager cm = ConnectionManager.getDefault(); - JDBCDriver driver = JDBCDriverManager.getDefault().getDrivers(udsJdbcDriver)[0]; + //JDBCDriver driver = JDBCDriverManager.getDefault().getDrivers(udsJdbcDriver)[0]; - DatabaseConnection dbconn = DatabaseConnection.create(driver, udsJdbcUrl, (String) m_databaseProperties.get("javax.persistence.jdbc.user"), "public", (String) m_databaseProperties.get("javax.persistence.jdbc.password"), true); + //DatabaseConnection dbconn = DatabaseConnection.create(driver, udsJdbcUrl, (String) m_databaseProperties.get("javax.persistence.jdbc.user"), "public", (String) m_databaseProperties.get("javax.persistence.jdbc.password"), true); - cm.addConnection(dbconn); + //cm.addConnection(dbconn); } catch (Exception e) { String message = e.getMessage(); diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseDataSetTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseDataSetTask.java index 628c2af88..ac86f38a6 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseDataSetTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseDataSetTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -43,10 +43,10 @@ import javax.persistence.EntityManager; import javax.persistence.Query; import javax.persistence.TypedQuery; -import org.netbeans.api.db.explorer.ConnectionManager; +/*import org.netbeans.api.db.explorer.ConnectionManager; import org.netbeans.api.db.explorer.DatabaseConnection; import org.netbeans.api.db.explorer.JDBCDriver; -import org.netbeans.api.db.explorer.JDBCDriverManager; +import org.netbeans.api.db.explorer.JDBCDriverManager;*/ import fr.proline.core.orm.uds.dto.DDataset; import fr.proline.core.orm.uds.dto.DDatasetType.QuantitationMethodInfo; @@ -56,7 +56,6 @@ import fr.proline.studio.dam.tasks.xic.DatabaseLoadXicMasterQuantTask; import java.io.IOException; import javax.persistence.NoResultException; -import org.netbeans.api.db.explorer.DatabaseException; import fr.proline.studio.dam.memory.TransientMemoryCacheManager; /** @@ -546,25 +545,25 @@ public int compare(DDataset d2, DDataset d1) { // add the MSIdb connection to the Netbeans Service ExternalDb msiDb = ExternalDbRepository.findExternalByTypeAndProject(entityManagerUDS, ProlineDatabaseType.MSI, entityManagerUDS.merge(m_project)); - try { - ConnectionManager cm = ConnectionManager.getDefault(); - JDBCDriver driver = JDBCDriverManager.getDefault().getDrivers(DatabaseDataManager.getDatabaseDataManager().getUdsJdbcDriver())[0]; //JPM.WART : same driver for uds and msi + //try { + //ConnectionManager cm = ConnectionManager.getDefault(); + //JDBCDriver driver = JDBCDriverManager.getDefault().getDrivers(DatabaseDataManager.getDatabaseDataManager().getUdsJdbcDriver())[0]; //JPM.WART : same driver for uds and msi String udsJdbcUrl = DatabaseDataManager.getDatabaseDataManager().getUdsJdbcURL(); String msiJdbcUrl = udsJdbcUrl.substring(0, udsJdbcUrl.lastIndexOf('/') + 1) + msiDb.getDbName(); String dbUser = (String)DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(projectId).getProperty(AbstractDatabaseConnector.PERSISTENCE_JDBC_USER_KEY); String dbPassword = (String)DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(projectId).getProperty(AbstractDatabaseConnector.PERSISTENCE_JDBC_PASSWORD_KEY); - DatabaseConnection dbconn = DatabaseConnection.create(driver, msiJdbcUrl, dbUser, "public", dbPassword, true); + //DatabaseConnection dbconn = DatabaseConnection.create(driver, msiJdbcUrl, dbUser, "public", dbPassword, true); - cm.addConnection(dbconn); - } catch (DatabaseException e) { + //cm.addConnection(dbconn); + /*} catch (DatabaseException e) { String message = e.getMessage(); if ((message == null) || (!message.contains("connection already exists"))) { //JPM.WART : avoid error because the connection already exist m_logger.error(getClass().getSimpleName() + " failed to add UDS connection to Services ", e); } - } + }*/ entityManagerUDS.getTransaction().commit(); @@ -944,7 +943,7 @@ private boolean fetchQuantitation() { private void setDDatasetQuantProperties(DDataset ddataset, Map objectTreeIdByName, EntityManager entityManagerUDS){ if (objectTreeIdByName != null){ for (Map.Entry entry: objectTreeIdByName.entrySet()) { - if (entry.getKey().startsWith("quantitation")) { + if (entry.getKey().startsWith("quantitation")|| entry.getKey().equals("proline.low_level_config")) { Long objectId = entry.getValue(); fr.proline.core.orm.uds.ObjectTree objectTree = entityManagerUDS.find(fr.proline.core.orm.uds.ObjectTree.class, objectId); ddataset.setObjectTree(objectTree); diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseDatasetPTMsTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseDatasetPTMsTask.java new file mode 100644 index 000000000..f707f70f2 --- /dev/null +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseDatasetPTMsTask.java @@ -0,0 +1,977 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.dam.tasks; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.google.gson.FieldNamingPolicy; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import fr.proline.core.orm.msi.*; +import fr.proline.core.orm.msi.dto.*; +import fr.proline.core.orm.msi.repository.ObjectTreeSchemaRepository; +import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.core.orm.util.DStoreCustomPoolConnectorFactory; +import fr.proline.studio.Exceptions; +import fr.proline.studio.dam.taskinfo.TaskError; +import fr.proline.studio.dam.taskinfo.TaskInfo; +import fr.proline.studio.dam.tasks.data.ptm.*; +import fr.proline.studio.performancetest.PerformanceTest; + +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.TypedQuery; +import java.io.IOException; +import java.util.*; +import java.util.stream.Collectors; + +/** + * + * @author JM235353 + */ +public class DatabaseDatasetPTMsTask extends AbstractDatabaseSlicerTask { + + private long m_projectId = -1; + private DDataset m_dataset = null; + private PTMDatasetPair m_ptmDatasetPair = null; + + private PTMDataset m_clusterPtmDataset = null; + private PTMDataset m_sitePtmDataset = null; + + private boolean m_loadAnnotatedDataset; + + //attributes to initialize when data is retrieve + private List m_ptmDatasetPairOutput = null; + private List m_ptmSitesOutput = null; + + public static final int NO_SUB_TASK_COUNT = 0; + + public static final int SUB_TASK_PTMSITE_PEPTIDES = 0; + public static final int SUB_TASK_PTMCLUSTER_PEPTIDES = 1; + public static final int SUB_TASK_COUNT_PTMDATASET = 2; // <<----- get in sync + + + public static final int SUB_TASK_PTMSITE_PEPINSTANCES = 0; + public static final int SUB_TASK_COUNT_PTMSITE_PEPINSTANCES = 1;// <<----- get in sync + + final int SLICE_SIZE = 1000; + + // data kept for sub tasks + private List m_bestSitesPepMatchIds = null; + private HashMap> m_ptmSiteIdsByBestPepMatchId = null; + private List m_bestClustersPepMatchIds = null; + private HashMap> m_ptmClustersByBestPepMatchId = null; + private List m_peptideIds = null; + + private int m_action; + private final static int LOAD_PTMDATASETPAIR = 0; + private final static int FILL_ALL_PTM_SITES_PEPINFO = 1; + private final static int SAVE_PTMDATASET = 2; + + public final static String ERROR_PTM_CLUSTER_LOADING = "PTM Cluster Loading Error"; + public final static String ERROR_PTM_CLUSTER_SAVING = "Error Saving Annotated PTM Dataset"; + + public DatabaseDatasetPTMsTask(AbstractDatabaseCallback callback) { + super(callback); + } + + + /** + * Read PTMDataset information from datastore (JSON...): create both object PTMDataset with cluster and PTMDataset for site only + * @param projectId : Id of the project the dataset belongs to + * @param dataset : dataset to get PTMDatasets for + * @param ptmDatasetset output list where to store created data + */ + public void initLoadPTMDataset(Long projectId, DDataset dataset, List ptmDatasetset, boolean loadAnnotatedDataset) { + init(SUB_TASK_COUNT_PTMDATASET, new TaskInfo("Load PTM Dataset for " + dataset.getName(), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + m_projectId = projectId; + m_ptmDatasetPairOutput = ptmDatasetset; + m_dataset = dataset; + m_loadAnnotatedDataset = loadAnnotatedDataset; + m_action = LOAD_PTMDATASETPAIR; + } + + /** + * Read PtmSite's peptide information from datastore and register in PTMSite object + * @param projectId : Project associated dataset belongs to + * @param ptmDSPair : PTMDatasets containing generic information (dataset and result summary info) + * @param ptmSitesToFill : PTMSite to fill with peptide info + */ + public void initFillPTMSites(long projectId, PTMDatasetPair ptmDSPair, List ptmSitesToFill) { + init(SUB_TASK_COUNT_PTMSITE_PEPINSTANCES, new TaskInfo("Load peptides of PTM Sites", false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + m_projectId = projectId; + m_ptmSitesOutput = ptmSitesToFill; + m_ptmDatasetPair = ptmDSPair; + m_dataset = m_ptmDatasetPair.getDataset(); + m_action = FILL_ALL_PTM_SITES_PEPINFO; + } + + /** + * Add annotated PTMDataset information in datastore : create new property object to resultsummary + * @param projectId : Id of the project the dataset belongs to + + * @param ptmDataset PTMDataset to save + */ + public void initAddAnnotatedPTMDataset(Long projectId, PTMDataset ptmDataset) { + init(NO_SUB_TASK_COUNT, new TaskInfo("Save PTM Dataset for " + ptmDataset.getDataset().getName(), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + m_projectId = projectId; + m_clusterPtmDataset = ptmDataset; + m_dataset = ptmDataset.getDataset(); + m_action = SAVE_PTMDATASET; + } + + @Override + public boolean needToFetch() { + switch (m_action) { + case FILL_ALL_PTM_SITES_PEPINFO: + return (m_peptideIds == null || m_peptideIds.isEmpty()); + case LOAD_PTMDATASETPAIR: { + return (m_ptmDatasetPairOutput == null || m_ptmDatasetPairOutput.isEmpty() ); + } + case SAVE_PTMDATASET: + return true; + } + return false; // should not be called + } + + @Override + public boolean fetchData() { + try { + switch (m_action) { + + case LOAD_PTMDATASETPAIR: { + if (needToFetch()) { + return fetchPTMDatasetSetMainTask(); + } else { + // fetch data of SubTasks + return fetchDataSubTaskFor(LOAD_PTMDATASETPAIR); + } + } + case FILL_ALL_PTM_SITES_PEPINFO: { + if (needToFetch()) { + return fetchAllPTMSitesPeptideMatches(); + } else // fetch data of SubTasks + { + return fetchDataSubTaskFor(FILL_ALL_PTM_SITES_PEPINFO); + } + } + case SAVE_PTMDATASET:{ + return savePTMDataset(); + } + } + } finally { + PerformanceTest.displayTimeAllThreads(); + } + return true; // should not happen + } + + /** + * Fetch data of a Subtask + * + * @return + */ + private boolean fetchDataSubTaskFor(int action) { + SubTask slice = m_subTaskManager.getNextSubTask(); + if (slice == null) { + return true; // nothing to do : should not happen + } + + EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); + try { + entityManagerMSI.getTransaction().begin(); + switch (action) { + case LOAD_PTMDATASETPAIR: + switch (slice.getSubTaskId()) { + case SUB_TASK_PTMSITE_PEPTIDES: + fetchSiteBestPeptideMatches(slice, entityManagerMSI); + break; + case SUB_TASK_PTMCLUSTER_PEPTIDES: + fetchClusterBestPeptideMatches(slice, entityManagerMSI); + break; + } + break; + case FILL_ALL_PTM_SITES_PEPINFO: + switch (slice.getSubTaskId()) { + case SUB_TASK_PTMSITE_PEPINSTANCES: + fetchPTMSitesPepInstances(slice, entityManagerMSI); + break; + } + } + entityManagerMSI.getTransaction().commit(); + } catch (Exception e) { + m_logger.error(getClass().getSimpleName() + " failed", e); + m_taskError = new TaskError(e); + try { + entityManagerMSI.getTransaction().rollback(); + } catch (Exception rollbackException) { + m_logger.error(getClass().getSimpleName() + " failed : potential network problem", rollbackException); + } + return false; + } finally { + entityManagerMSI.close(); + } + + return true; + } + + //Entry point for LOAD_PTMDATASETSET action + private boolean fetchPTMDatasetSetMainTask() { + + PerformanceTest.startTime("fetchPTMDatasetSetMainTask"); + EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); + + try { + + entityManagerMSI.getTransaction().begin(); + JSONPTMDataset jsonDS = readJSONPTMDataset(entityManagerMSI); + + //--- Create cluster PTMDataset + m_clusterPtmDataset = new PTMDataset(m_dataset); + m_clusterPtmDataset.setLeafResultSummaryIds(Arrays.asList(jsonDS.leafResultSummaryIds)); + + //--- Create site PTMDataset + m_sitePtmDataset = new PTMDataset(m_dataset); + m_sitePtmDataset.setLeafResultSummaryIds(Arrays.asList(jsonDS.leafResultSummaryIds)); + + m_ptmDatasetPairOutput.add(new PTMDatasetPair(m_sitePtmDataset,m_clusterPtmDataset)); + + //** Read and create PTMSite / PTMCluster + createPTMDatasetPTMSites(jsonDS, entityManagerMSI); + + for (Long i : jsonDS.ptmIds) { + List ptmSpecificities = DInfoPTM.getInfoPTMForPTM(i); + if(ptmSpecificities.size()>0){ + ptmSpecificities.forEach(dInfoPTM -> { + m_clusterPtmDataset.addInfoPTM(dInfoPTM); + m_sitePtmDataset.addInfoPTM(dInfoPTM); + }); + } + } + createPTMDatasetPTMClusters(jsonDS, entityManagerMSI); + + + } catch (Exception e) { + m_logger.error(getClass().getSimpleName() + " failed", e); + if (m_taskError == null) { + // we do not replace an error already set. + m_taskError = new TaskError(e); + } + try { + entityManagerMSI.getTransaction().rollback(); + } catch (Exception rollbackException) { + m_logger.error(getClass().getSimpleName() + " failed : potential network problem", rollbackException); + } + return false; + } finally { + entityManagerMSI.close(); + } + + PerformanceTest.stopTime("fetchPTMDatasetMainTask"); + + + return true; + } + + //Entry point for FILL_ALL_PTM_SITES_PEPINFO action + private boolean fetchAllPTMSitesPeptideMatches() { + + PerformanceTest.startTime("fetchAllPTMSitesPeptideMatches"); + + long start = System.currentTimeMillis(); + m_logger.debug(" START fetchAllPTMSitesPeptideMatches task "); + EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); + try { + + //*** Get Best Peptide MatchesProteinMatches + Set allPepIds = m_ptmSitesOutput.stream().flatMap(s -> s.getPeptideIds().stream()).collect(Collectors.toSet()); + m_peptideIds = new ArrayList<>(); + m_peptideIds.addAll(allPepIds); + + SubTask subTask = m_subTaskManager.sliceATaskAndGetFirst(SUB_TASK_PTMSITE_PEPINSTANCES, m_peptideIds.size(), SLICE_SIZE); + fetchPTMSitesPepInstances(subTask, entityManagerMSI); + + long stop = System.currentTimeMillis(); + m_logger.debug(" fetchAllPTMSitesPeptideMatches :{} of {} PTM Sites filled in {} ms", SLICE_SIZE, m_ptmSitesOutput.size(), (stop - start)); + + } catch (Exception e) { + m_logger.error(getClass().getSimpleName() + " failed", e); + m_taskError = new TaskError(e); + try { + entityManagerMSI.getTransaction().rollback(); + } catch (Exception rollbackException) { + m_logger.error(getClass().getSimpleName() + " failed : potential network problem", rollbackException); + } + return false; + } finally { + entityManagerMSI.close(); + } + + PerformanceTest.stopTime("fetchAllPTMSitesPeptideMatches"); + + + return true; + } + + //ENTRY POINT for SAVE_PTMDATASET action + private boolean savePTMDataset(){ + EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); + + try { + + ResultSummary rsm = entityManagerMSI.find(ResultSummary.class, m_dataset.getResultSummaryId()); + if(rsm ==null){ + m_taskError = new TaskError(ERROR_PTM_CLUSTER_SAVING," Unable to save PTMDataset for dataset "+m_clusterPtmDataset.getDataset().getName()+", No identification Summary attached"); + return false; + } + entityManagerMSI.getTransaction().begin(); + if (rsm.getObjectTreeIdByName() != null && rsm.getObjectTreeIdByName().get("result_summary.ptm_dataset_annotated") != null) { + //remove previous object tree + Long obId = rsm.getObjectTreeIdByName().get("result_summary.ptm_dataset_annotated"); + rsm.removeObject("result_summary.ptm_dataset_annotated"); +// entityManagerMSI.createNativeQuery("ALTER TABLE object_tree DISABLE TRIGGER ALL;").executeUpdate(); + entityManagerMSI.createNativeQuery("DELETE FROM result_summary_object_tree_map WHERE object_tree_id = " + obId + " AND schema_name = 'result_summary.ptm_dataset_annotated'; ").executeUpdate(); + entityManagerMSI.createNativeQuery("DELETE FROM object_tree WHERE id = " + obId +"; ").executeUpdate(); + } + + + + JSONPTMDataset jsonPTMDataset = m_clusterPtmDataset.createJSONPTMDataset(); + Gson gson = new GsonBuilder().serializeNulls().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create(); + String jsonString = gson.toJson(jsonPTMDataset); + + ObjectTree newPTMDataset = new ObjectTree() ; + newPTMDataset.setSchema(ObjectTreeSchemaRepository.loadOrCreateObjectTreeSchema(entityManagerMSI, ObjectTreeSchema.SchemaName.PTM_DATASET_ANNOTATED.toString())); + newPTMDataset.setClobData(jsonString); + entityManagerMSI.persist(newPTMDataset); + + rsm.putObject("result_summary.ptm_dataset_annotated", newPTMDataset.getId()); + entityManagerMSI.merge(rsm); + entityManagerMSI.getTransaction().commit(); + + }catch (Exception e){ + m_logger.error(getClass().getSimpleName() + " failed", e); + m_taskError = new TaskError(e); + try { + entityManagerMSI.getTransaction().rollback(); + } catch (Exception rollbackException) { + m_logger.error(getClass().getSimpleName() + " failed : potential network problem", rollbackException); + } + return false; + } finally { + entityManagerMSI.close(); + } + + return true; + } + + + + private JSONPTMDataset readJSONPTMDataset(EntityManager entityManagerMSI) throws JsonProcessingException { + //--- Read PTM data in object tree associated to rsm + ResultSummary rsm = entityManagerMSI.find(ResultSummary.class, m_dataset.getResultSummaryId()); + String schemaName = m_loadAnnotatedDataset ? "result_summary.ptm_dataset_annotated" : "result_summary.ptm_dataset"; + if (rsm.getObjectTreeIdByName().isEmpty() || rsm.getObjectTreeIdByName().get(schemaName) == null) { + m_taskError = new TaskError(ERROR_PTM_CLUSTER_LOADING, "\"Identification Modification Sites\" has not been run on this dataset."); + throw new RuntimeException("\"Identification Modification Sites\" has not been run on this dataset."); + } + ObjectTree ot = entityManagerMSI.find(ObjectTree.class, rsm.getObjectTreeIdByName().get(schemaName)); + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); + + return mapper.readValue(ot.getClobData(), JSONPTMDataset.class); + } + + + /* + * Private method called to create PTMSites from read JSON properties + * Read PTMSite V2 + */ + private void createPTMDatasetPTMSites(JSONPTMDataset jsonDataset, EntityManager entityManagerMSI){ + + + PerformanceTest.startTime("createPTMDatasetPTMSites"); + + List ptmSites = new ArrayList<>(); + List clusterPtmSites = new ArrayList<>(); + + //---- Get associated Parent RSM ProteinMatches + Long rsmId = m_clusterPtmDataset.getDataset().getResultSummaryId(); + TypedQuery typicalProteinQuery = entityManagerMSI.createQuery("SELECT new fr.proline.core.orm.msi.dto.DProteinMatch(pm.id, pm.accession, pm.score, pm.peptideCount, pm.resultSet.id, pm.description, pm.geneName, pm.serializedProperties, pepset.id, pepset.score, pepset.sequenceCount, pepset.peptideCount, pepset.peptideMatchCount, pepset.resultSummaryId) " + + "FROM PeptideSetProteinMatchMap pset_to_pm JOIN pset_to_pm.proteinMatch as pm JOIN pset_to_pm.peptideSet as pepset JOIN pepset.proteinSet as ps " + + "WHERE ps.resultSummary.id=:rsmId AND ps.isValidated=true AND ps.representativeProteinMatchId=pm.id ORDER BY pepset.score DESC", DProteinMatch.class); + + typicalProteinQuery.setParameter("rsmId", rsmId); + List typicalProteinMatchesArray = typicalProteinQuery.getResultList(); + + + //--- Get Protein Match mapping between parent and leaf rsm + List accessions = typicalProteinMatchesArray.stream().map(DProteinMatch::getAccession).collect(Collectors.toList()); + Map> allProtMatchesIdPerAccession = new HashMap<>(); + int bufferSize = 10000; + int readAccessionCount = 0; + while(readAccessionCount < accessions.size()){ + + PerformanceTest.startTime("createPTMDatasetPTMSites-STEP1"); + + Query protMatchQuery = entityManagerMSI.createQuery("SELECT pm.id, pm.accession FROM ProteinMatch pm, ResultSummary rsm WHERE pm.accession IN (:accList) AND rsm.resultSet.id = pm.resultSet.id AND rsm.id in (:rsmIds) "); + int lastIndex = Math.min((readAccessionCount + bufferSize), accessions.size()); + protMatchQuery.setParameter("accList", accessions.subList(readAccessionCount, lastIndex)); + protMatchQuery.setParameter("rsmIds", m_clusterPtmDataset.getLeafResultSummaryIds()); + + Iterator proteinMatchesResult = protMatchQuery.getResultList().iterator(); + while(proteinMatchesResult.hasNext()){ + Object[] results = proteinMatchesResult.next(); + Long prMatchAcc = (Long) results[0]; + String acc = (String) results[1]; + if(!allProtMatchesIdPerAccession.containsKey(acc)) + allProtMatchesIdPerAccession.put(acc, new ArrayList<>()); + allProtMatchesIdPerAccession.get(acc).add(prMatchAcc); + } + readAccessionCount = lastIndex; + + PerformanceTest.stopTime("createPTMDatasetPTMSites-STEP1"); + } + m_clusterPtmDataset.setLeafProtMatchesIdPerAccession(allProtMatchesIdPerAccession); + m_sitePtmDataset.setLeafProtMatchesIdPerAccession(allProtMatchesIdPerAccession); + + + //---- fetch Generic PTM Data + DatabasePTMsTask.fetchGenericPTMData(entityManagerMSI); + + m_ptmSiteIdsByBestPepMatchId = new HashMap<>(); + //---- Create the list of PTMSites + Map proteinMatchMap = typicalProteinMatchesArray.stream().collect(Collectors.toMap(DProteinMatch::getId, item -> item)); + PerformanceTest.startTime("createPTMDatasetPTMSites-STEP2"); + for (JSONPTMSite2 jsonSite : jsonDataset.ptmSites) { + + PTMSite site = new PTMSite(jsonSite, proteinMatchMap.get(jsonSite.proteinMatchId)); + site.setPTMSpecificity(DInfoPTM.getInfoPTMMap().get(jsonSite.ptmDefinitionId)); + if (site.getProteinMatch() != null) { + ptmSites.add(site); + } + + PTMSite clusterSite = new PTMSite(jsonSite, proteinMatchMap.get(jsonSite.proteinMatchId)); + clusterSite.setPTMSpecificity(DInfoPTM.getInfoPTMMap().get(jsonSite.ptmDefinitionId)); + if (clusterSite.getProteinMatch() != null) { + clusterPtmSites.add(clusterSite); + } + + m_ptmSiteIdsByBestPepMatchId.computeIfAbsent(jsonSite.bestPeptideMatchId, k -> new ArrayList<>()); + m_ptmSiteIdsByBestPepMatchId.get(jsonSite.bestPeptideMatchId).add(jsonSite.id); + } + PerformanceTest.stopTime("createPTMDatasetPTMSites-STEP2"); + m_clusterPtmDataset.setPTMSites(clusterPtmSites); + m_sitePtmDataset.setPTMSites(ptmSites); + + PerformanceTest.stopTime("createPTMDatasetPTMSites"); + + + //---- Runs subtasks to get peptide matches + //Get Best Peptide MatchesProteinMatches + m_bestSitesPepMatchIds = Arrays.stream(jsonDataset.ptmSites).map(site -> site.bestPeptideMatchId).distinct().collect(Collectors.toList()); + SubTask subTask = m_subTaskManager.sliceATaskAndGetFirst(SUB_TASK_PTMSITE_PEPTIDES, m_bestSitesPepMatchIds.size(), SLICE_SIZE); + fetchSiteBestPeptideMatches(subTask, entityManagerMSI); //get first slice + } + + + private boolean fillClusterPeptidesMaps(PTMCluster ptmCluster, Long bestPepMatchID) { + if (ptmCluster.getPTMSites() == null || ptmCluster.getPTMSites().isEmpty()) { + return false; + } + + m_bestClustersPepMatchIds.add(bestPepMatchID); + if (!m_ptmClustersByBestPepMatchId.containsKey(bestPepMatchID)) { + m_ptmClustersByBestPepMatchId.put(bestPepMatchID, new ArrayList<>()); + } + m_ptmClustersByBestPepMatchId.get(bestPepMatchID).add(ptmCluster); + return true; + } + + private void createPTMDatasetPTMClusters(JSONPTMDataset jsonDataset, EntityManager entityManagerMSI) { + + PerformanceTest.startTime("createPTMDatasetPTMClusters"); + + m_bestClustersPepMatchIds = new ArrayList<>(); + m_ptmClustersByBestPepMatchId = new HashMap<>(); + + //Create PTMCluster for SitePTMDataset + List allClusters = new ArrayList<>(); + for (PTMSite site : m_sitePtmDataset.getPTMSites()) { + PTMCluster ptmCluster = new PTMCluster(site.getId(), site.getLocalisationConfidence(), 2/*SELECTED AUTO*/,null, null, + Collections.singletonList(site.getId()), site.getPeptideIds(), m_sitePtmDataset); + Long bestPepMatchID = site.getBestProbabilityPepMatchId(); + if(fillClusterPeptidesMaps(ptmCluster, bestPepMatchID)) + allClusters.add(ptmCluster); + ptmCluster.setPTMSitesCount(1); //Only One PTMSite per Cluster. + } + m_sitePtmDataset.setPTMClusters(allClusters); + + //Create PTMCluster for SitePTMDataset + allClusters = new ArrayList<>(); + for (JSONPTMCluster cluster : jsonDataset.ptmClusters) { + PTMCluster ptmCluster = new PTMCluster(cluster, m_clusterPtmDataset); + Long bestPepMatchID = cluster.bestPeptideMatchId; + if(fillClusterPeptidesMaps(ptmCluster, bestPepMatchID)) + allClusters.add(ptmCluster); + } + m_clusterPtmDataset.setPTMClusters(allClusters); + + PerformanceTest.stopTime("createPTMDatasetPTMClusters"); + + // TODO : try to simplify this since the same peptideMatches will already be loaded for sites, except that this + // TODO: is done in a subtasks. When executing this method, the subtasks is not necessarily done. + //---- Runs subtasks to get peptide matches + SubTask subTask = m_subTaskManager.sliceATaskAndGetFirst(SUB_TASK_PTMCLUSTER_PEPTIDES, m_bestClustersPepMatchIds.size(), SLICE_SIZE); + fetchClusterBestPeptideMatches(subTask, entityManagerMSI); //get first slice + } + + // + private void fetchSiteBestPeptideMatches(SubTask subTask, EntityManager entityManagerMSI) { + List sliceOfPeptideMatchIds = subTask.getSubList(m_bestSitesPepMatchIds); + fetchBestPeptideMatches(sliceOfPeptideMatchIds, entityManagerMSI, true); + } + + private void fetchClusterBestPeptideMatches(SubTask subTask, EntityManager entityManagerMSI) { + List sliceOfPeptideMatchIds = subTask.getSubList(m_bestClustersPepMatchIds); + fetchBestPeptideMatches(sliceOfPeptideMatchIds, entityManagerMSI, false); + } + + /* Method called for subTask execution to get peptide Matches info + */ + private void fetchBestPeptideMatches(List sliceOfPeptideMatchIds, EntityManager entityManagerMSI, boolean isSite) { + + PerformanceTest.startTime("fetchBestPeptideMatches"); + + PerformanceTest.startTime("fetchBestPeptideMatches-STEP1"); + + Query peptidesQuery = entityManagerMSI.createQuery("SELECT pm.id, pm.rank, pm.charge, pm.deltaMoz, pm.experimentalMoz, pm.missedCleavage, pm.score, pm.resultSet.id, pm.cdPrettyRank, pm.sdPrettyRank, pm.serializedProperties, sp.firstTime, sp.precursorIntensity, sp.title, p, ms.id, ms.initialId, ptmString\n" + + " FROM fr.proline.core.orm.msi.PeptideInstancePeptideMatchMap pipm, fr.proline.core.orm.msi.PeptideMatch pm, fr.proline.core.orm.msi.PeptideInstance pi, fr.proline.core.orm.msi.Peptide p, fr.proline.core.orm.msi.PeptideReadablePtmString ptmString, fr.proline.core.orm.msi.MsQuery ms, fr.proline.core.orm.msi.Spectrum sp \n" + + " WHERE pipm.id.peptideMatchId IN (:peptideMatchList) AND pipm.id.peptideInstanceId=pi.id AND pipm.id.peptideMatchId=pm.id AND pm.peptideId=p.id AND pm.msQuery=ms AND ms.spectrum=sp AND pi.resultSummary.id in (:rmsIds) AND ptmString.peptide=p AND ptmString.resultSet.id=pm.resultSet.id"); + peptidesQuery.setParameter("peptideMatchList", sliceOfPeptideMatchIds); + List rsmIds = m_clusterPtmDataset.getLeafResultSummaryIds(); + rsmIds.add(m_clusterPtmDataset.getDataset().getResultSummaryId()); + peptidesQuery.setParameter("rmsIds", rsmIds); + + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); + + List l = peptidesQuery.getResultList(); + Iterator itPeptidesQuery = l.iterator(); + List allPepMatches = new ArrayList<>(); + //Create List of DPeptideMatch (linked to DSpectrum + DMsQuery) from query resumlt + + PerformanceTest.stopTime("fetchBestPeptideMatches-STEP1"); + + while (itPeptidesQuery.hasNext()) { + + PerformanceTest.startTime("fetchBestPeptideMatches-STEP2"); + + Object[] resCur = itPeptidesQuery.next(); + + Long pmId = (Long) resCur[0]; + Integer pmRank = (Integer) resCur[1]; + Integer pmCharge = (Integer) resCur[2]; + Float pmDeltaMoz = (Float) resCur[3]; + Double pmExperimentalMoz = (Double) resCur[4]; + Integer pmMissedCleavage = (Integer) resCur[5]; + Float pmScore = (Float) resCur[6]; + Long pmResultSetId = (Long) resCur[7]; + + Integer pmCdPrettyRank = (Integer) resCur[8]; + Integer pmSdPrettyRank = (Integer) resCur[9]; + String serializedProperties = (String) resCur[10]; + Float firstTime = (Float) resCur[11]; + Float precursorIntensity = (Float) resCur[12]; + String title = (String) resCur[13]; + + DSpectrum spectrum = new DSpectrum(); + spectrum.setFirstTime(firstTime); + spectrum.setPrecursorIntensity(precursorIntensity); + spectrum.setTitle(title); + + PerformanceTest.stopTime("fetchBestPeptideMatches-STEP2"); + + PerformanceTest.startTime("fetchBestPeptideMatches-STEP3"); + + DPeptideMatch pm = new DPeptideMatch(pmId, pmRank, pmCharge, pmDeltaMoz, pmExperimentalMoz, pmMissedCleavage, pmScore, pmResultSetId, pmCdPrettyRank, pmSdPrettyRank); + pm.setRetentionTime(firstTime); + pm.setSerializedProperties(serializedProperties); + + try { + JsonNode node = mapper.readTree(serializedProperties); + JsonNode child = node.get("ptm_site_properties"); + DPtmSiteProperties properties = mapper.treeToValue(child, DPtmSiteProperties.class); + pm.setPtmSiteProperties(properties); + } catch (IOException ex) { + //VDS FIXME : If no PTMSite properties, do we keep the peptide? + Exceptions.printStackTrace(ex); + } + + PerformanceTest.stopTime("fetchBestPeptideMatches-STEP3"); + + PerformanceTest.startTime("fetchBestPeptideMatches-STEP4"); + + Peptide p = (Peptide) resCur[14]; + Long msqId = (Long) resCur[15]; + Integer msqInitialId = (Integer) resCur[16]; + PeptideReadablePtmString ptmString = (PeptideReadablePtmString) resCur[17]; + p.getTransientData().setPeptideReadablePtmString(ptmString); + p.getTransientData().setPeptideReadablePtmStringLoaded(); + + DMsQuery msq = new DMsQuery(pmId, msqId, msqInitialId, precursorIntensity); + msq.setDSpectrum(spectrum); + + pm.setPeptide(p); + pm.setMsQuery(msq); + + PerformanceTest.stopTime("fetchBestPeptideMatches-STEP4"); + + PerformanceTest.startTime("fetchBestPeptideMatches-STEP5"); + + if (isSite) { + List siteIds = m_ptmSiteIdsByBestPepMatchId.get(pmId); + if (siteIds != null && !siteIds.isEmpty()) { + siteIds.forEach(siteId -> { + PTMSite finalSite = m_clusterPtmDataset.getPTMSite(siteId); + if (finalSite != null) { + finalSite.setBestProbabilityPepMatch(pm); + } + finalSite = m_sitePtmDataset.getPTMSite(siteId); + if (finalSite != null) { + finalSite.setBestProbabilityPepMatch(pm); + } + }); + } + } else { + List clusters = m_ptmClustersByBestPepMatchId.get(pmId); + if (clusters != null && !clusters.isEmpty()) { + clusters.forEach(cluster -> cluster.setRepresentativePepMatch(pm)); + } + } + allPepMatches.add(pm); + + PerformanceTest.stopTime("fetchBestPeptideMatches-STEP5"); + } + + + PerformanceTest.startTime("fetchBestPeptideMatches-STEP6"); + + //-- fetch Specific PTM Data for the Peptides Found + List pepId = allPepMatches.stream().map(peM -> peM.getPeptide().getId()).collect(Collectors.toList()); + + HashMap> ptmMap = DatabasePTMsTask.fetchPeptidePTMForPeptides(entityManagerMSI, new ArrayList<>(pepId)); + for (DPeptideMatch pm : allPepMatches) { + Peptide p = pm.getPeptide(); + Long idPeptide = p.getId(); + ArrayList ptmList = ptmMap.get(idPeptide); + pm.setPeptidePTMArray(ptmList); + + HashMap mapToPtm = new HashMap<>(); + if (ptmList != null) { + for (DPeptidePTM peptidePTM : ptmList) { + mapToPtm.put((int) peptidePTM.getSeqPosition(), peptidePTM); + } + p.getTransientData().setDPeptidePtmMap(mapToPtm); + } + } + + PerformanceTest.stopTime("fetchBestPeptideMatches-STEP6"); + PerformanceTest.stopTime("fetchBestPeptideMatches"); + } + + + private void fetchPTMSitesPepInstances(SubTask subTask, EntityManager entityManagerMSI) throws IOException { + List sliceOfPeptideIds = subTask.getSubList(m_peptideIds); + fetchPTMSitesPepInstances(sliceOfPeptideIds, entityManagerMSI); + } + + private void fetchPTMSitesPepInstances(List sliceOfPeptideIds, EntityManager entityManagerMSI) throws IOException { + + PerformanceTest.startTime("fetchPTMSitesPepInstances"); + + long start = System.currentTimeMillis(); + m_logger.debug(" @@ START fetchPTMSitesPepInstances SUBTASK "); + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); + + int nbrPepIds = sliceOfPeptideIds.size(); + Long rsetId = m_dataset.getResultSetId(); + if(rsetId == null && m_dataset.getResultSummary() != null && m_dataset.getResultSummary().getResultSet() != null) + rsetId = m_dataset.getResultSummary().getResultSet().getId(); + Long dsRsmId = m_dataset.getResultSummaryId(); + //Same getLeafResultSummaryIds for Cluster or SiteCluster PTMDataset + List allRsmIds = m_ptmDatasetPair.getClusterPTMDataset().getLeafResultSummaryIds(); + boolean datasetIsLeaf = (allRsmIds.size() == 1 && m_ptmDatasetPair.getClusterPTMDataset().getLeafResultSummaryIds().get(0).equals(dsRsmId)); + + //Test if dataset is also the leaf dataset + if(!datasetIsLeaf){ + allRsmIds.add(dsRsmId); + } + + PerformanceTest.startTime("peptidesQuery"); + + Query peptidesQuery = entityManagerMSI.createQuery("SELECT pi.id FROM fr.proline.core.orm.msi.PeptideInstance pi" + + " WHERE pi.peptide.id IN (:peptideIdsList) AND pi.resultSummary.id in (:rmsIds)"); + peptidesQuery.setParameter("peptideIdsList", sliceOfPeptideIds); + peptidesQuery.setParameter("rmsIds", allRsmIds); + + Iterator itPeptidesQuery = peptidesQuery.getResultList().iterator(); + List peptideInstanceIds = new ArrayList<>(); + while (itPeptidesQuery.hasNext()) { + Long resCur = itPeptidesQuery.next(); + peptideInstanceIds.add(resCur); + } + + int nbrPepInstIds = peptideInstanceIds.size(); + + PerformanceTest.stopTime("peptidesQuery"); + + long end = System.currentTimeMillis(); + m_logger.debug(" @@ fetchPTMSitesPepInstances: Read "+nbrPepInstIds+" pep instances corresponding to " + nbrPepIds+" peptides in "+(end-start)+" ms" ); + start = end; + + PerformanceTest.startTime("dataQuery"); + + HashMap allPeptidesMap = new HashMap<>(); + HashMap leafPeptideInstancesById = new HashMap<>(); + HashMap> leafPeptideInstancesByPepId = new HashMap<>(); + Map parentPeptideInstancesByPepId = new HashMap<>(); + + //---- Load Peptide Match + Spectrum / MSQuery information for all peptideInstance of PTMSite + Query dataQuery = entityManagerMSI.createQuery("SELECT pm, pi, sm, sp.firstTime, sp.precursorIntensity, sp.title, " + + " msq.id, msq.initialId " + + " FROM fr.proline.core.orm.msi.PeptideInstancePeptideMatchMap pipm, fr.proline.core.orm.msi.PeptideMatch pm, fr.proline.core.orm.msi.PeptideInstance pi, " + + " fr.proline.core.orm.msi.SequenceMatch sm , fr.proline.core.orm.msi.MsQuery msq , fr.proline.core.orm.msi.Spectrum sp " + + " WHERE pipm.id.peptideInstanceId IN ( :peptideInstanceList ) AND pipm.id.peptideInstanceId=pi.id AND pipm.id.peptideMatchId=pm.id " + + " AND sm.id.peptideId = pi.peptide.id AND sm.resultSetId = pm.resultSet.id AND sm.id.peptideId=pm.peptideId AND pm.msQuery.id = msq.id AND msq.spectrum.id = sp.id "); + dataQuery.setParameter("peptideInstanceList", new ArrayList<>(peptideInstanceIds)); + List l = dataQuery.getResultList(); + Iterator itPeptidesMatchesQuery = l.iterator(); + + PerformanceTest.stopTime("dataQuery"); + + //---- Create List of DPeptideMatch (linked to DSpectrum + DMsQuery) from query resumlt + end = System.currentTimeMillis(); + m_logger.debug(" @@ fetchPTMSitesPepInstances: query result size " + l.size()+" in "+(end-start)+" ms" ); + start= end; + + PerformanceTest.startTime("itPeptidesMatchesQuery loop"); + + while (itPeptidesMatchesQuery.hasNext()) { + + + PerformanceTest.startTime("STEP1"); + + Object[] resCur = itPeptidesMatchesQuery.next(); + + PeptideMatch pm = (PeptideMatch) resCur[0]; + PeptideInstance pi = (PeptideInstance) resCur[1]; + SequenceMatch sm = (SequenceMatch) resCur[2]; + Float firstTime = (Float) resCur[3]; + Float precursorIntensity = (Float) resCur[4]; + String spectrumTitle = (String) resCur[5]; + Long msQueryId = (Long) resCur[6]; + Integer msQueryInitialId = (Integer) resCur[7]; + + + PerformanceTest.stopTime("STEP1"); + + PerformanceTest.startTime("STEP2"); + + DSpectrum spectrum = new DSpectrum(); + spectrum.setFirstTime(firstTime); + spectrum.setPrecursorIntensity(precursorIntensity); + spectrum.setTitle(spectrumTitle); + + PerformanceTest.stopTime("STEP2"); + + PerformanceTest.startTime("STEP3"); + + DPeptideMatch dpm = new DPeptideMatch(pm.getId(), pm.getRank(), pm.getCharge(), pm.getDeltaMoz(), pm.getExperimentalMoz(), pm.getMissedCleavage(), pm.getScore(), pm.getResultSet().getId(), pm.getCDPrettyRank(), pm.getSDPrettyRank()); + dpm.setRetentionTime(spectrum.getFirstTime()); + dpm.setSerializedProperties(pm.getSerializedProperties()); + dpm.setSequenceMatch(sm); + + PerformanceTest.stopTime("STEP3"); + + PerformanceTest.startTime("STEP4"); + JsonNode node = mapper.readTree(dpm.getSerializedProperties()); + JsonNode child = node.get("ptm_site_properties"); + DPtmSiteProperties properties = mapper.treeToValue(child, DPtmSiteProperties.class); + dpm.setPtmSiteProperties(properties); + PerformanceTest.stopTime("STEP4"); + + + + + PerformanceTest.startTime("STEP5"); + Peptide p = pi.getPeptide(); + p.getTransientData().setPeptideReadablePtmStringLoaded(); + allPeptidesMap.put(p.getId(), p); + + DMsQuery msq = new DMsQuery(pm.getId(), msQueryId, msQueryInitialId, spectrum.getPrecursorIntensity()); + msq.setDSpectrum(spectrum); + + dpm.setPeptide(p); + dpm.setMsQuery(msq); + + PerformanceTest.stopTime("STEP5"); + + + PerformanceTest.startTime("STEP6"); + + //TEST IF Leaf or Parent + if(dsRsmId.equals(pi.getResultSummary().getId()) ) { + //PARENT PepInstance + if(!parentPeptideInstancesByPepId.containsKey(p.getId())){ + DPeptideInstance dpi = new DPeptideInstance(pi); + dpi.setResultSummary(pi.getResultSummary()); + dpi.setPeptide(p); + dpi.setPeptideMatches(new ArrayList<>()); + parentPeptideInstancesByPepId.put(p.getId(), dpi); + } + + if (pi.getBestPeptideMatchId() == dpm.getId()) { + parentPeptideInstancesByPepId.get(p.getId()).setBestPeptideMatch(dpm); + } + parentPeptideInstancesByPepId.get(p.getId()).getPeptideMatches().add(dpm); + + } + if( (!dsRsmId.equals(pi.getResultSummary().getId())) || datasetIsLeaf ) { + //LEAF PeptideInstance + if (!leafPeptideInstancesByPepId.containsKey(p.getId())) { + leafPeptideInstancesByPepId.put(p.getId(), new ArrayList<>()); + } + List pepInsts = leafPeptideInstancesByPepId.get(p.getId()); + boolean alreadyread = false; + for (DPeptideInstance readPepI : pepInsts) { + if (readPepI.getId() == pi.getId()) { + alreadyread = true; + } + } + if (!alreadyread) { + DPeptideInstance dpi = new DPeptideInstance(pi); + dpi.setResultSummary(pi.getResultSummary()); + dpi.setPeptide(p); + dpi.setPeptideMatches(new ArrayList<>()); + leafPeptideInstancesById.put(dpi.getId(), dpi); + pepInsts.add(dpi); + } + + if (pi.getBestPeptideMatchId() == dpm.getId()) { + leafPeptideInstancesById.get(pi.getId()).setBestPeptideMatch(dpm); + } + leafPeptideInstancesById.get(pi.getId()).getPeptideMatches().add(dpm); + } + + PerformanceTest.stopTime("STEP6"); + } + + + + PerformanceTest.stopTime("itPeptidesMatchesQuery loop"); + + end = System.currentTimeMillis(); + m_logger.debug(" @@ fetchPTMSitesPepInstances: Created leafPeptideInstancesById. Nbr : " + leafPeptideInstancesById.size()+" in "+(end-start)+" ms"); + start= end; + + //--- Retrieve PeptideReadablePtmString + + PerformanceTest.startTime("ptmStingQuery"); + DatabasePTMsTask.fillReadablePTMDataForPeptides(entityManagerMSI,rsetId,allPeptidesMap, null); + + PerformanceTest.stopTime("ptmStingQuery"); + + PerformanceTest.startTime("fetchGenericPTMData"); + + // fetch Generic PTM Data + DatabasePTMsTask.fetchGenericPTMData(entityManagerMSI); + + PerformanceTest.stopTime("fetchGenericPTMData"); + + + PerformanceTest.startTime("fetchPeptidePTMForPeptides"); + + //--- fetch Specific Data for the Peptides Found + HashMap> ptmMap = DatabasePTMsTask.fetchPeptidePTMForPeptides(entityManagerMSI, new ArrayList<>(allPeptidesMap.keySet())); + + PerformanceTest.stopTime("fetchPeptidePTMForPeptides"); + + PerformanceTest.startTime("parentPeptideInstancesByPepId.values().stream().flatMap"); + + List allpeptideMatches = leafPeptideInstancesById.values().stream().flatMap(pi -> pi.getPeptideMatches().stream()).collect(Collectors.toList()); + allpeptideMatches.addAll(parentPeptideInstancesByPepId.values().stream().flatMap(pi -> pi.getPeptideMatches().stream()).collect(Collectors.toList())); + + PerformanceTest.stopTime("parentPeptideInstancesByPepId.values().stream().flatMap"); + + end = System.currentTimeMillis(); + m_logger.debug(" @@ fetchPTMSitesPepInstances got PTM info for all peptideMatches . nbr " + allpeptideMatches.size()+" in "+(end-start)+" ms"); + start= end; + + PerformanceTest.startTime("allpeptideMatches loop"); + + for (DPeptideMatch pm : allpeptideMatches) { + Peptide p = pm.getPeptide(); + Long idPeptide = p.getId(); + ArrayList ptmList = ptmMap.get(idPeptide); + pm.setPeptidePTMArray(ptmList); + + HashMap mapToPtm = new HashMap<>(); + if (ptmList != null) { + for (DPeptidePTM peptidePTM : ptmList) { + mapToPtm.put((int) peptidePTM.getSeqPosition(), peptidePTM); + } + p.getTransientData().setDPeptidePtmMap(mapToPtm); + } + } + + PerformanceTest.stopTime("allpeptideMatches loop"); + + m_logger.info(" @@ {} peptides matching to {} peptide matches retrieved", allPeptidesMap.size(), allpeptideMatches.size()); + m_logger.info(" @@ {} peptide instances retrieved", parentPeptideInstancesByPepId.size()); + + PerformanceTest.startTime("m_ptmSitesOutput loop"); + for (PTMSite site : m_ptmSitesOutput) { + //Verify if PTM site has at least one pep in this 'subtask' + List leafPeptideInstances = new ArrayList<>(); + Set parentPeptideInstancesAsSet = new HashSet<>(); + for (Long pepId : site.getPeptideIds()) { + if (leafPeptideInstancesByPepId.containsKey(pepId)) { + leafPeptideInstances.addAll(leafPeptideInstancesByPepId.get(pepId)); + } + if (parentPeptideInstancesByPepId.containsKey(pepId)) { + parentPeptideInstancesAsSet.add(parentPeptideInstancesByPepId.get(pepId)); + } + } + if (!leafPeptideInstances.isEmpty() || !parentPeptideInstancesAsSet.isEmpty()) { + List parentPeptideInstances = new ArrayList<>(parentPeptideInstancesAsSet); + site.addPeptideInstances(parentPeptideInstances, leafPeptideInstances); + } + } + + PerformanceTest.stopTime("m_ptmSitesOutput loop"); + + end = System.currentTimeMillis(); + m_logger.debug(" @@ END fetchPTMSitesPepInstances subtask "+" in "+(end-start)+" ms"); + + PerformanceTest.stopTime("fetchPTMSitesPepInstances"); + + } + +} diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadMSQueriesTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadMSQueriesTask.java index c7cc68e19..e468f3f82 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadMSQueriesTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadMSQueriesTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; import fr.proline.core.orm.msi.MsiSearch; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadPeptideMatchTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadPeptideMatchTask.java index 94bca59ba..3cd7a711e 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadPeptideMatchTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadPeptideMatchTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -840,7 +840,7 @@ private void fetchPeptide(EntityManager entityManagerMSI, SubTask subTask) { peptideMap.put(peptide.getId(), peptide); } - DatabasePTMSitesTask.fetchPTMDataForPeptides(entityManagerMSI, peptideMap, null); + DatabasePTMsTask.fillPeptidePTMForPeptides(entityManagerMSI, peptideMap, null); } else { @@ -877,7 +877,7 @@ private void fetchPeptide(EntityManager entityManagerMSI, SubTask subTask) { peptide.getTransientData().setPeptideReadablePtmString(ptmString); } - DatabasePTMSitesTask.fetchPTMDataForPeptides(entityManagerMSI, peptideMap, null); + DatabasePTMsTask.fillPeptidePTMForPeptides(entityManagerMSI, peptideMap, null); } diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadPeptidesInstancesTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadPeptidesInstancesTask.java index 7c193a409..53ada3823 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadPeptidesInstancesTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadPeptidesInstancesTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -310,9 +310,9 @@ private boolean fetchDataForRsm() { private void fetchPTMData(EntityManager entityManagerMSI, SubTask subTask) { List sliceOfPeptideMatchIds = subTask.getSubList(m_peptideIds); - - DatabasePTMSitesTask.fetchReadablePTMData(entityManagerMSI, m_rsm.getResultSet().getId(), m_peptideMap, sliceOfPeptideMatchIds); - DatabasePTMSitesTask.fetchPTMDataForPeptides(entityManagerMSI, m_peptideMap, sliceOfPeptideMatchIds); + + DatabasePTMsTask.fillReadablePTMDataForPeptides(entityManagerMSI, m_rsm.getResultSet().getId(), m_peptideMap, sliceOfPeptideMatchIds); + DatabasePTMsTask.fillPeptidePTMForPeptides(entityManagerMSI, m_peptideMap, sliceOfPeptideMatchIds); } @@ -394,8 +394,8 @@ private boolean fetchDataForProteinMatch() { fetchPeptideDataForProteinMatch(entityManagerMSI, rsm, pm, peptideMap); } - - DatabasePTMSitesTask.fetchPTMDataForPeptides(entityManagerMSI, peptideMap, null); + + DatabasePTMsTask.fillPeptidePTMForPeptides(entityManagerMSI, peptideMap, null); entityManagerMSI.getTransaction().commit(); } catch (Exception e) { @@ -490,7 +490,7 @@ public static void fetchPeptideDataForProteinMatch(EntityManager entityManagerMS peptideInstanceList.add(dpi); } - DatabasePTMSitesTask.fetchReadablePTMData(entityManagerMSI, rsm.getResultSet().getId(), peptideMapForPtm, null); + DatabasePTMsTask.fillReadablePTMDataForPeptides(entityManagerMSI, rsm.getResultSet().getId(), peptideMapForPtm, null); int nbPeptides = peptideInstanceList.size(); DPeptideInstance[] peptideInstances = peptideInstanceList.toArray(new DPeptideInstance[nbPeptides]); diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadSpectrumsTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadSpectrumsTask.java index 6f20a7a1c..5db8b8283 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadSpectrumsTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseLoadSpectrumsTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseObjectTreeTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseObjectTreeTask.java index e4eb24715..9450a8d53 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseObjectTreeTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseObjectTreeTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; import fr.proline.core.orm.msi.ObjectTree; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabasePTMSitesTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabasePTMSitesTask.java deleted file mode 100644 index efe97f07d..000000000 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabasePTMSitesTask.java +++ /dev/null @@ -1,851 +0,0 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.dam.tasks; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.PropertyNamingStrategy; -import fr.proline.core.orm.msi.ObjectTree; -import fr.proline.core.orm.msi.ObjectTreeSchema; -import fr.proline.core.orm.msi.Peptide; -import fr.proline.core.orm.msi.PeptideInstance; -import fr.proline.core.orm.msi.PeptideMatch; -import fr.proline.core.orm.msi.PeptideReadablePtmString; -import fr.proline.core.orm.msi.PtmSpecificity; -import fr.proline.core.orm.msi.ResultSummary; -import fr.proline.core.orm.msi.dto.DMsQuery; -import fr.proline.core.orm.msi.dto.DPeptideMatch; -import fr.proline.core.orm.msi.dto.DProteinMatch; -import fr.proline.core.orm.msi.dto.DSpectrum; -import fr.proline.core.orm.msi.dto.DInfoPTM; -import fr.proline.core.orm.msi.dto.DPeptideInstance; -import fr.proline.core.orm.msi.dto.DPeptidePTM; -import fr.proline.core.orm.msi.dto.DPtmSiteProperties; -import fr.proline.core.orm.util.DStoreCustomPoolConnectorFactory; -import fr.proline.studio.dam.taskinfo.TaskError; -import fr.proline.studio.dam.taskinfo.TaskInfo; -import fr.proline.studio.dam.tasks.data.ptm.JSONPTMSite; -import fr.proline.studio.dam.tasks.data.ptm.PTMSite; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import javax.persistence.EntityManager; -import javax.persistence.Query; -import javax.persistence.TypedQuery; - - -/** - * - * @author JM235353 - */ -public class DatabasePTMSitesTask extends AbstractDatabaseTask { - - private long m_projectId = -1; - private ResultSummary m_rsm = null; - private List m_rsmIds = null; - - //attributes to initialize when data is retrieve - private PTMSite m_ptmSiteOutput = null; - private List m_ptmSitesOutput = null; - private List m_ptmsOutput = null; - - private final static int SLICE_SIZE = 1000; - - private int m_action; - - private final static int LOAD_ALL_PTM_SITES_FOR_RSMS = 0; - private final static int FILL_PTM_SITE_PEPINFO = 1; - private final static int LOAD_IDENTIFIED_PTM_SPECIFICITIES = 2; - private final static int FILL_ALL_PTM_SITES_PEPINFO = 3; - - - public DatabasePTMSitesTask(AbstractDatabaseCallback callback) { - super(callback, null); - } - - private void init(TaskInfo taskInfo) { - m_defaultPriority = Priority.NORMAL_1; - m_taskInfo = taskInfo; - } - - public void initLoadPTMSites(long projectId, ResultSummary rsm, List ptmSiteArray) { - init(new TaskInfo("Load All PTM Sites for " + rsm.getId(), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); - m_projectId = projectId; - m_rsm = rsm; - m_ptmSitesOutput = ptmSiteArray; - m_action = LOAD_ALL_PTM_SITES_FOR_RSMS; - } - - public void initFillPTMSite(long projectId, ResultSummary rsm, PTMSite ptmSiteToFill) { - init(new TaskInfo("Load peptides of PTM Site " + ptmSiteToFill, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); - m_projectId = projectId; - m_ptmSiteOutput = ptmSiteToFill; - m_rsm = rsm; - m_action = FILL_PTM_SITE_PEPINFO; - } - - public void initFillPTMSites(long projectId, ResultSummary rsm, List ptmSitesToFill) { - init(new TaskInfo("Load peptides of PTM Sites", false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); - m_projectId = projectId; - m_ptmSitesOutput = ptmSitesToFill; - m_rsm = rsm; - m_action = FILL_ALL_PTM_SITES_PEPINFO; - } - - public void initLoadUsedPTMs(Long projectId, Long rsmId, List ptmsToFill) { - init(new TaskInfo("Load used PTMs from RSM id" + rsmId, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); - m_projectId = projectId; - m_rsmIds = new ArrayList<>(); - m_rsmIds.add(rsmId); - m_ptmsOutput = ptmsToFill; - m_action = LOAD_IDENTIFIED_PTM_SPECIFICITIES; - } - - public void initLoadUsedPTMs(Long projectId, List rsmIds, List ptmsToFill) { - init(new TaskInfo("Load used PTMs from RSM ids" + rsmIds, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); - m_projectId = projectId; - m_rsmIds = rsmIds; - m_ptmsOutput = ptmsToFill; - m_action = LOAD_IDENTIFIED_PTM_SPECIFICITIES; - } - - - @Override - public boolean needToFetch() { - switch(m_action) { - case LOAD_IDENTIFIED_PTM_SPECIFICITIES: - case FILL_ALL_PTM_SITES_PEPINFO: - case LOAD_ALL_PTM_SITES_FOR_RSMS: { - return true; - } - case FILL_PTM_SITE_PEPINFO: { - return !m_ptmSiteOutput.isLoaded(); - } - } - return false; // should not be called - } - - @Override - public boolean fetchData() { - if (needToFetch()) { - switch (m_action) { - case LOAD_ALL_PTM_SITES_FOR_RSMS: { - return fetchAllPTMSites(); - } - case FILL_PTM_SITE_PEPINFO: { - return fetchPTMSitePeptideMatches(); - } - case LOAD_IDENTIFIED_PTM_SPECIFICITIES: { - return fetchIdentifiedPTMs(); - } - case FILL_ALL_PTM_SITES_PEPINFO: { - return fetchAllPTMSitesPeptideMatches(); - } - } - - return true; // should not happen - } - return true; // should not happen - } - - - private boolean fetchIdentifiedPTMs() { - long start = System.currentTimeMillis(); - EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); - try { - - entityManagerMSI.getTransaction().begin(); - long stop = System.currentTimeMillis(); - m_logger.debug("Identified PTM entityManagerMSI.getTransaction().begin {} ms", (stop-start)); - start = stop; - - TypedQuery query = entityManagerMSI.createQuery("SELECT DISTINCT(pp.specificity) FROM PeptidePtm pp, PeptideInstance pi JOIN FETCH pp.specificity.ptm ptm WHERE pi.resultSummary.id in (:rsmIds) AND pi.peptide.id = pp.peptide.id", PtmSpecificity.class); - query.setParameter("rsmIds", m_rsmIds); - m_ptmsOutput.addAll(query.getResultList()); - - stop = System.currentTimeMillis(); - m_logger.debug("Identified PTM fetched in {} ms", (stop-start)); - - } catch (Exception e) { - m_logger.error(getClass().getSimpleName() + " failed", e); - m_taskError = new TaskError(e); - try { - entityManagerMSI.getTransaction().rollback(); - } catch (Exception rollbackException) { - m_logger.error(getClass().getSimpleName() + " failed : potential network problem", rollbackException); - } - return false; - } finally { - entityManagerMSI.close(); - } - - return true; - } - - private boolean fetchPTMSitePeptideMatches(){ - - long start = System.currentTimeMillis(); - EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); - try { - - entityManagerMSI.getTransaction().begin(); - ObjectMapper mapper = new ObjectMapper(); - mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); - - fetchPTMSiteData(m_ptmSiteOutput, entityManagerMSI, mapper); - - long stop = System.currentTimeMillis(); - m_logger.debug("PTM Site {} filled in {} ms", m_ptmSiteOutput, (stop-start)); - - entityManagerMSI.getTransaction().commit(); - } catch (Exception e) { - m_logger.error(getClass().getSimpleName() + " failed", e); - m_taskError = new TaskError(e); - try { - entityManagerMSI.getTransaction().rollback(); - } catch (Exception rollbackException) { - m_logger.error(getClass().getSimpleName() + " failed : potential network problem", rollbackException); - } - return false; - } finally { - entityManagerMSI.close(); - } - - return true; - } - - private boolean fetchAllPTMSitesPeptideMatches(){ - - long start = System.currentTimeMillis(); - m_logger.debug(" START fetchAllPTMSitesPeptideMatches task "); - EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); - try { - - entityManagerMSI.getTransaction().begin(); - ObjectMapper mapper = new ObjectMapper(); - mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); -// int count = 1; -// for (PTMSite site : m_ptmSiteArray) { -// if (!site.isLoaded()) { -// if ( (count % 100) == 0) m_logger.info("#{} loading site {}", count, site); -// fetchPTMSiteData(site, entityManagerMSI, mapper); -// count++; -// } -// } - - fetchPTMSitesData(m_ptmSitesOutput, entityManagerMSI, mapper); - - long stop = System.currentTimeMillis(); - m_logger.debug("??/{} PTM Sites filled in {} ms", m_ptmSitesOutput.size(), (stop-start)); - - entityManagerMSI.getTransaction().commit(); - } catch (Exception e) { - m_logger.error(getClass().getSimpleName() + " failed", e); - m_taskError = new TaskError(e); - try { - entityManagerMSI.getTransaction().rollback(); - } catch (Exception rollbackException) { - m_logger.error(getClass().getSimpleName() + " failed : potential network problem", rollbackException); - } - return false; - } finally { - entityManagerMSI.close(); - } - - return true; - } - - private void fetchPTMSitesData(List sitesToFill, EntityManager entityManagerMSI, ObjectMapper mapper) throws IOException { - HashMap allPeptidesMap = new HashMap(); - HashMap leafPeptideInstancesById = new HashMap<>(); - - Set pepInstanceIds = sitesToFill.stream().flatMap( s -> Arrays.stream(s.getPeptideInstanceIds()) ).collect(Collectors.toSet()); - - m_logger.debug("fetchPTMSitesData: pepInstanceIds " +pepInstanceIds.size()); - //---- Load Peptide Match + Spectrum / MSQuery information for all peptideInstance of PTMSite - Query peptidesQuery = entityManagerMSI.createQuery("SELECT pm, pi, sp.firstTime, sp.precursorIntensity, sp.title, " - + " msq.id, msq.initialId " - + " FROM fr.proline.core.orm.msi.PeptideInstancePeptideMatchMap pipm, fr.proline.core.orm.msi.PeptideMatch pm, fr.proline.core.orm.msi.PeptideInstance pi, " - + " fr.proline.core.orm.msi.MsQuery msq , fr.proline.core.orm.msi.Spectrum sp " - + " WHERE pipm.id.peptideInstanceId IN ( :peptideInstanceList ) AND pipm.id.peptideInstanceId=pi.id AND pipm.id.peptideMatchId=pm.id AND pm.msQuery.id = msq.id AND msq.spectrum.id = sp.id "); - peptidesQuery.setParameter("peptideInstanceList",new ArrayList<>(pepInstanceIds)); - List l = peptidesQuery.getResultList(); - Iterator itPeptidesQuery = l.iterator(); - //---- Create List of DPeptideMatch (linked to DSpectrum + DMsQuery) from query resumlt - m_logger.debug("fetchPTMSitesData: query result size "+l.size()); - while (itPeptidesQuery.hasNext()) { - Object[] resCur = itPeptidesQuery.next(); - - PeptideMatch pm = (PeptideMatch) resCur[0]; - PeptideInstance pi = (PeptideInstance) resCur[1]; - Float firstTime = (Float) resCur[2]; - Float precursorIntensity = (Float) resCur[3]; - String spectrumTitle = (String) resCur[4]; - Long msQueryId = (Long) resCur[5]; - Integer msQueryInitialId = (Integer) resCur[6]; - - DSpectrum spectrum = new DSpectrum(); - spectrum.setFirstTime(firstTime); - spectrum.setPrecursorIntensity(precursorIntensity); - spectrum.setTitle(spectrumTitle); - - DPeptideMatch dpm = new DPeptideMatch(pm.getId(), pm.getRank(), pm.getCharge(), pm.getDeltaMoz(), pm.getExperimentalMoz(), pm.getMissedCleavage(), pm.getScore(), pm.getResultSet().getId(), pm.getCDPrettyRank(), pm.getSDPrettyRank()); - dpm.setRetentionTime(spectrum.getFirstTime()); - dpm.setSerializedProperties(pm.getSerializedProperties()); - - JsonNode node = mapper.readTree(dpm.getSerializedProperties()); - JsonNode child = node.get("ptm_site_properties"); - DPtmSiteProperties properties = mapper.treeToValue(child, DPtmSiteProperties.class); - dpm.setPtmSiteProperties(properties); - - Peptide p = (Peptide) pi.getPeptide(); - p.getTransientData().setPeptideReadablePtmStringLoaded(); - allPeptidesMap.put(p.getId(), p); - - DMsQuery msq = new DMsQuery(pm.getId(), msQueryId, msQueryInitialId, spectrum.getPrecursorIntensity()); - msq.setDSpectrum(spectrum); - - dpm.setPeptide(p); - dpm.setMsQuery(msq); - - if (!leafPeptideInstancesById.containsKey(pi.getId())) { - DPeptideInstance dpi = new DPeptideInstance(pi); - dpi.setResultSummary(pi.getResultSummary()); - dpi.setPeptide(p); - dpi.setPeptideMatches(new ArrayList<>()); - leafPeptideInstancesById.put(dpi.getId(), dpi); - } - if(pi.getBestPeptideMatchId() == dpm.getId()) - leafPeptideInstancesById.get(pi.getId()).setBestPeptideMatch(dpm); - leafPeptideInstancesById.get(pi.getId()).getPeptideMatches().add(dpm); - } - m_logger.debug(" created leafPeptideInstancesById. Nbr pepIns "+leafPeptideInstancesById.size()); - //--- Retrieve Parent peptideInstances - Long rsetId = m_rsm.getResultSet().getId(); - TypedQuery parentPeptideInstanceQuery = entityManagerMSI.createQuery("SELECT pi FROM fr.proline.core.orm.msi.PeptideInstance pi WHERE pi.peptide.id IN (:listId) AND pi.resultSummary.id=:rsmId", PeptideInstance.class); - parentPeptideInstanceQuery.setParameter("listId", allPeptidesMap.keySet()); - parentPeptideInstanceQuery.setParameter("rsmId", m_rsm.getId()); - Iterator it = parentPeptideInstanceQuery.getResultList().iterator(); - Map parentPeptideInstancesByPepId = new HashMap<>(); - while (it.hasNext()) { - PeptideInstance pi = it.next(); - DPeptideInstance dpi = new DPeptideInstance(pi); - dpi.setPeptide(pi.getPeptide()); - parentPeptideInstancesByPepId.put(dpi.getPeptideId(), dpi); - } - m_logger.debug(" parentPeptideInstancesByPepId created "); - //--- Retrieve PeptideReadablePtmString - Set allPeptides = allPeptidesMap.keySet(); - Query ptmStingQuery = entityManagerMSI.createQuery("SELECT p.id, ptmString FROM fr.proline.core.orm.msi.Peptide p, fr.proline.core.orm.msi.PeptideReadablePtmString ptmString WHERE p.id IN (:listId) AND ptmString.peptide=p AND ptmString.resultSet.id=:rsetId"); - ptmStingQuery.setParameter("listId", allPeptides); - ptmStingQuery.setParameter("rsetId", rsetId); - List ptmStrings = ptmStingQuery.getResultList(); - Iterator ito = ptmStrings.iterator(); - while (ito.hasNext()) { - Object[] res = ito.next(); - Long peptideId = (Long) res[0]; - PeptideReadablePtmString ptmString = (PeptideReadablePtmString) res[1]; - Peptide peptide = allPeptidesMap.get(peptideId); - peptide.getTransientData().setPeptideReadablePtmString(ptmString); - } - m_logger.debug(" PeptideReadablePtmString LOADED"); - // fetch Generic PTM Data - fetchGenericPTMData(entityManagerMSI); - //--- fetch Specific Data for the Peptides Found - HashMap> ptmMap = fetchPTMDataForPeptides(entityManagerMSI, new ArrayList(allPeptidesMap.keySet())); - List allpeptideMatches = leafPeptideInstancesById.values().stream().flatMap(pi -> pi.getPeptideMatches().stream()).collect(Collectors.toList()); - m_logger.debug(" allpeptideMatches "+allpeptideMatches.size()); - for (DPeptideMatch pm : allpeptideMatches) { - Peptide p = pm.getPeptide(); - Long idPeptide = p.getId(); - ArrayList ptmList = ptmMap.get(idPeptide); - pm.setPeptidePTMArray(ptmList); - - HashMap mapToPtm = new HashMap<>(); - if (ptmList != null) { - for (DPeptidePTM peptidePTM : ptmList) { - mapToPtm.put((int) peptidePTM.getSeqPosition(), peptidePTM); - } - p.getTransientData().setDPeptidePtmMap(mapToPtm); - } - } - m_logger.info("{} peptides matching to {} peptide matches retrieved", allPeptides.size(), allpeptideMatches.size()); - m_logger.info("{} peptide instances retrieved", parentPeptideInstancesByPepId.size()); - for (PTMSite site : sitesToFill) { - // insert .filter(key -> leafPeptideInstancesById.containsKey(key)) ? Theoretically no : all instances has been retrieved .. - List leafPeptideInstances = Arrays.stream(site.getPeptideInstanceIds()).map(id -> leafPeptideInstancesById.get(id)).collect(Collectors.toList()); - Set parentPeptideInstancesAsSet = leafPeptideInstances.stream().map(pi -> pi.getPeptideId()).map(id -> parentPeptideInstancesByPepId.get(id)).collect(Collectors.toSet()); - List parentPeptideInstances = new ArrayList<>(); - parentPeptideInstances.addAll(parentPeptideInstancesAsSet); - site.setPeptideInstances(parentPeptideInstances, leafPeptideInstances); - } - } - - - private void fetchPTMSiteData(PTMSite siteToFill, EntityManager entityManagerMSI, ObjectMapper mapper) throws IOException { - HashMap allPeptidesMap = new HashMap(); - HashMap leafPeptideInstancesById = new HashMap<>(); - - //Get PeptideInstance id : IF PTM v1 : data exist in PTMSite othewise we need to load them - ArrayList peptideInstanceIds = new ArrayList<>(); - Long[] pepInst = siteToFill.getPeptideInstanceIds(); - if(pepInst == null){ - ArrayList allPepIds = siteToFill.getPeptideIds(); - Query peptidesQuery = entityManagerMSI.createQuery("SELECT pi.id FROM fr.proline.core.orm.msi.PeptideInstance pi" - + " WHERE pi.peptide.id IN (:peptideIdsList) AND pi.resultSummary.id in (:rmsIds)"); - peptidesQuery.setParameter("peptideIdsList", allPepIds); - List rsmIds = siteToFill.getPTMdataset().getLeafResultSummaryIds(); - rsmIds.add(siteToFill.getPTMdataset().getDataset().getResultSummaryId()); - peptidesQuery.setParameter("rmsIds", rsmIds); - -// Iterator itPeptidesQuery = peptidesQuery.getResultList().iterator(); -// while (itPeptidesQuery.hasNext()) { - peptideInstanceIds.addAll( peptidesQuery.getResultList()); -// } - } else { - peptideInstanceIds.addAll(Arrays.asList(pepInst)); - } - - - //---- Load Peptide Match + Spectrum / MSQuery information for all peptideInstance of PTMSite - Query peptidesQuery = entityManagerMSI.createQuery("SELECT pm, pi, sp.firstTime, sp.precursorIntensity, sp.title " - + " msq.id, msq.initialId " - + " FROM fr.proline.core.orm.msi.PeptideInstancePeptideMatchMap pipm, fr.proline.core.orm.msi.PeptideMatch pm, fr.proline.core.orm.msi.PeptideInstance pi, " - + " fr.proline.core.orm.msi.MsQuery msq , fr.proline.core.orm.msi.Spectrum sp " - + " WHERE pipm.id.peptideInstanceId IN ( :peptideInstanceList ) AND pipm.id.peptideInstanceId=pi.id AND pipm.id.peptideMatchId=pm.id AND pm.msQuery.id = msq.id AND msq.spectrum.id = sp.id "); - peptidesQuery.setParameter("peptideInstanceList",peptideInstanceIds); - List l = peptidesQuery.getResultList(); - Iterator itPeptidesQuery = l.iterator(); - //---- Create List of DPeptideMatch (linked to DSpectrum + DMsQuery) from query resumlt - while (itPeptidesQuery.hasNext()) { - Object[] resCur = itPeptidesQuery.next(); - - PeptideMatch pm = (PeptideMatch) resCur[0]; - PeptideInstance pi = (PeptideInstance) resCur[1]; - Float firstTime = (Float) resCur[2]; - Float precursorIntensity = (Float) resCur[3]; - String spectrumTitle = (String) resCur[4]; - Long msQueryId = (Long) resCur[5]; - Integer msQueryInitialId = (Integer) resCur[6]; - - DSpectrum spectrum = new DSpectrum(); - spectrum.setFirstTime(firstTime); - spectrum.setPrecursorIntensity(precursorIntensity); - spectrum.setTitle(spectrumTitle); - - DPeptideMatch dpm = new DPeptideMatch(pm.getId(), pm.getRank(), pm.getCharge(), pm.getDeltaMoz(), pm.getExperimentalMoz(), pm.getMissedCleavage(), pm.getScore(), pm.getResultSet().getId(), pm.getCDPrettyRank(), pm.getSDPrettyRank()); - dpm.setRetentionTime(spectrum.getFirstTime()); - dpm.setSerializedProperties(pm.getSerializedProperties()); - - JsonNode node = mapper.readTree(dpm.getSerializedProperties()); - JsonNode child = node.get("ptm_site_properties"); - DPtmSiteProperties properties = mapper.treeToValue(child, DPtmSiteProperties.class); - dpm.setPtmSiteProperties(properties); - - Peptide p = (Peptide) pi.getPeptide(); - p.getTransientData().setPeptideReadablePtmStringLoaded(); - allPeptidesMap.put(p.getId(), p); - - DMsQuery msq = new DMsQuery(pm.getId(), msQueryId, msQueryInitialId, spectrum.getPrecursorIntensity()); - msq.setDSpectrum(spectrum); - - dpm.setPeptide(p); - dpm.setMsQuery(msq); - - if (!leafPeptideInstancesById.containsKey(pi.getId())) { - DPeptideInstance dpi = new DPeptideInstance(pi); - dpi.setResultSummary(pi.getResultSummary()); - dpi.setPeptide(p); - dpi.setPeptideMatches(new ArrayList<>()); - leafPeptideInstancesById.put(dpi.getId(), dpi); - } - - leafPeptideInstancesById.get(pi.getId()).getPeptideMatches().add(dpm); - } - //--- Retrieve Parent peptideInstances - Long rsetId = m_rsm.getResultSet().getId(); - TypedQuery parentPeptideInstanceQuery = entityManagerMSI.createQuery("SELECT pi FROM fr.proline.core.orm.msi.PeptideInstance pi WHERE pi.peptide.id IN (:listId) AND pi.resultSummary.id=:rsmId", PeptideInstance.class); - parentPeptideInstanceQuery.setParameter("listId", allPeptidesMap.keySet()); - parentPeptideInstanceQuery.setParameter("rsmId", m_rsm.getId()); - Iterator it = parentPeptideInstanceQuery.getResultList().iterator(); - List parentPeptideInstances = new ArrayList<>(); - while (it.hasNext()) { - PeptideInstance pi = it.next(); - DPeptideInstance dpi = new DPeptideInstance(pi); - dpi.setPeptide(pi.getPeptide()); - parentPeptideInstances.add(dpi); - } - //--- Retrieve PeptideReadablePtmString - Query ptmStingQuery = entityManagerMSI.createQuery("SELECT p.id, ptmString FROM fr.proline.core.orm.msi.Peptide p, fr.proline.core.orm.msi.PeptideReadablePtmString ptmString WHERE p.id IN (:listId) AND ptmString.peptide=p AND ptmString.resultSet.id=:rsetId"); - ptmStingQuery.setParameter("listId", allPeptidesMap.keySet()); - ptmStingQuery.setParameter("rsetId", rsetId); - List ptmStrings = ptmStingQuery.getResultList(); - Iterator ito = ptmStrings.iterator(); - while (ito.hasNext()) { - Object[] res = ito.next(); - Long peptideId = (Long) res[0]; - PeptideReadablePtmString ptmString = (PeptideReadablePtmString) res[1]; - Peptide peptide = allPeptidesMap.get(peptideId); - peptide.getTransientData().setPeptideReadablePtmString(ptmString); - } - // fetch Generic PTM Data - fetchGenericPTMData(entityManagerMSI); - //--- fetch Specific Data for the Peptides Found - HashMap> ptmMap = fetchPTMDataForPeptides(entityManagerMSI, new ArrayList(allPeptidesMap.keySet())); - List allpeptideMatches = leafPeptideInstancesById.values().stream().flatMap(pi -> pi.getPeptideMatches().stream()).collect(Collectors.toList()); - for (DPeptideMatch pm : allpeptideMatches) { - Peptide p = pm.getPeptide(); - Long idPeptide = p.getId(); - pm.setPeptidePTMArray(ptmMap.get(idPeptide)); - - HashMap mapToPtm = new HashMap<>(); - ArrayList ptmList = ptmMap.get(p.getId()); - if (ptmList != null) { - for (DPeptidePTM peptidePTM : ptmList) { - mapToPtm.put((int) peptidePTM.getSeqPosition(), peptidePTM); - } - p.getTransientData().setDPeptidePtmMap(mapToPtm); - } - } - siteToFill.setPeptideInstances(parentPeptideInstances, leafPeptideInstancesById.values().stream().collect(Collectors.toList())); - } - - private boolean fetchAllPTMSites() { - - long start = System.currentTimeMillis(); - m_logger.debug(" START fetchAllPTMSites"); - EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); - try { - - entityManagerMSI.getTransaction().begin(); - - Long rsmId = m_rsm.getId(); - - TypedQuery typicalProteinQuery = entityManagerMSI.createQuery("SELECT new fr.proline.core.orm.msi.dto.DProteinMatch(pm.id, pm.accession, pm.score, pm.peptideCount, pm.resultSet.id, pm.description, pm.geneName, pepset.id, pepset.score, pepset.sequenceCount, pepset.peptideCount, pepset.peptideMatchCount, pepset.resultSummaryId) FROM PeptideSetProteinMatchMap pset_to_pm JOIN pset_to_pm.proteinMatch as pm JOIN pset_to_pm.peptideSet as pepset JOIN pepset.proteinSet as ps WHERE ps.resultSummary.id=:rsmId AND ps.isValidated=true AND ps.representativeProteinMatchId=pm.id ORDER BY pepset.score DESC", DProteinMatch.class); - - typicalProteinQuery.setParameter("rsmId", rsmId); - List typicalProteinMatchesArray = typicalProteinQuery.getResultList(); - - ResultSummary rsm = entityManagerMSI.find(ResultSummary.class, rsmId); - // TODO : following line code will fail if ptm sites were not previously identified. Check this first and returns properly - // - if(rsm.getObjectTreeIdByName().isEmpty() || rsm.getObjectTreeIdByName().get(ObjectTreeSchema.SchemaName.PTM_SITES.toString())==null){ - throw new RuntimeException("Identify PTM algorythm should be run first !"); - } - ObjectTree ot = entityManagerMSI.find(ObjectTree.class, rsm.getObjectTreeIdByName().get(ObjectTreeSchema.SchemaName.PTM_SITES.toString())); - ObjectMapper mapper = new ObjectMapper(); - mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); - List values = mapper.readValue(ot.getClobData(), mapper.getTypeFactory().constructCollectionType(List.class, JSONPTMSite.class)); - - Long[] bestPeptideMatchIdsArray = values.stream().map(site -> site.bestPeptideMatchId).distinct().toArray(Long[]::new); -// Map peptideInstanceIdsBybestPMId = values.stream().collect(Collectors.toMap(site -> site.bestPeptideMatchId, site -> site.peptideInstanceIds, (l1, l2) -> {return Stream.concat(Arrays.stream(l1), Arrays.stream(l2)).distinct().toArray(Long[]::new);})); - - long stop = System.currentTimeMillis(); - m_logger.debug("{} typical ProtMatches and {} PTMSites loaded in {} ms", typicalProteinMatchesArray.size(), values.size(), (stop-start)); - start = stop; - - HashMap allPeptidesMap = new HashMap(); - ArrayList peptideMatchArray = new ArrayList<>(); - Map peptideMatchById = new HashMap(); - - SubTaskManager subTaskManager = new SubTaskManager(1); - SubTask subTask = subTaskManager.sliceATaskAndGetFirst(0, bestPeptideMatchIdsArray.length, SLICE_SIZE); - while (subTask != null) { -// Query peptidesQuery = entityManagerMSI.createQuery("SELECT pm.id, pm.rank, pm.charge, pm.deltaMoz, pm.experimentalMoz, pm.missedCleavage, pm.score, pm.resultSet.id, pm.cdPrettyRank, pm.sdPrettyRank, pm.serializedProperties, sp.firstTime, sp.precursorIntensity, sp.title, p, ms.id, ms.initialId\n" -// + " FROM fr.proline.core.orm.msi.PeptideInstancePeptideMatchMap pipm, fr.proline.core.orm.msi.PeptideMatch pm, fr.proline.core.orm.msi.PeptideInstance pi, fr.proline.core.orm.msi.Peptide p, fr.proline.core.orm.msi.MsQuery ms, fr.proline.core.orm.msi.Spectrum sp \n" -// + " WHERE pipm.id.peptideMatchId IN (:peptideMatchList) AND pi.id IN (:peptideInstanceList) AND pipm.id.peptideInstanceId=pi.id AND pipm.id.peptideMatchId=pm.id AND pm.peptideId=p.id AND pm.msQuery=ms AND ms.spectrum=sp "); -// List subList = subTask.getSubList(Arrays.asList(bestPeptideMatchIdsArray)); -// peptidesQuery.setParameter("peptideMatchList", subList); -// List peptideInstanceIds = peptideInstanceIdsBybestPMId.entrySet().stream().filter(entry -> subList.contains(entry.getKey())).map(entry -> entry.getValue()).flatMap(x -> Arrays.stream(x)).distinct().collect(Collectors.toList()); -// peptidesQuery.setParameter("peptideInstanceList", peptideInstanceIds); - - Query peptidesQuery = entityManagerMSI.createQuery("SELECT pm.id, pm.rank, pm.charge, pm.deltaMoz, pm.experimentalMoz, pm.missedCleavage, pm.score, pm.resultSet.id, pm.cdPrettyRank, pm.sdPrettyRank, pm.serializedProperties, sp.firstTime, sp.precursorIntensity, sp.title, p, ms.id, ms.initialId\n" - + " FROM fr.proline.core.orm.msi.PeptideInstancePeptideMatchMap pipm, fr.proline.core.orm.msi.PeptideMatch pm, fr.proline.core.orm.msi.PeptideInstance pi, fr.proline.core.orm.msi.Peptide p, fr.proline.core.orm.msi.MsQuery ms, fr.proline.core.orm.msi.Spectrum sp \n" - + " WHERE pipm.id.peptideMatchId IN (:peptideMatchList) AND pipm.id.peptideInstanceId=pi.id AND pipm.id.peptideMatchId=pm.id AND pm.peptideId=p.id AND pm.msQuery=ms AND ms.spectrum=sp"); - List subList = subTask.getSubList(Arrays.asList(bestPeptideMatchIdsArray)); - - peptidesQuery.setParameter("peptideMatchList", subList); - //peptidesQuery.setParameter("rmsId", rsmId); - - - List l = peptidesQuery.getResultList(); - Iterator itPeptidesQuery = l.iterator(); - //Create List of DPeptideMatch (linked to DSpectrum + DMsQuery) from query resumlt - while (itPeptidesQuery.hasNext()) { - Object[] resCur = itPeptidesQuery.next(); - - Long pmId = (Long) resCur[0]; - Integer pmRank = (Integer) resCur[1]; - Integer pmCharge = (Integer) resCur[2]; - Float pmDeltaMoz = (Float) resCur[3]; - Double pmExperimentalMoz = (Double) resCur[4]; - Integer pmMissedCleavage = (Integer) resCur[5]; - Float pmScore = (Float) resCur[6]; - Long pmResultSetId = (Long) resCur[7]; - - Integer pmCdPrettyRank = (Integer) resCur[8]; - Integer pmSdPrettyRank = (Integer) resCur[9]; - String serializedProperties = (String) resCur[10]; - Float firstTime = (Float) resCur[11]; - Float precursorIntensity = (Float) resCur[12]; - String title = (String) resCur[13]; - - DSpectrum spectrum = new DSpectrum(); - spectrum.setFirstTime(firstTime); - spectrum.setPrecursorIntensity(precursorIntensity); - spectrum.setTitle(title); - - DPeptideMatch pm = new DPeptideMatch(pmId, pmRank, pmCharge, pmDeltaMoz, pmExperimentalMoz, pmMissedCleavage, pmScore, pmResultSetId, pmCdPrettyRank, pmSdPrettyRank); - pm.setRetentionTime(firstTime); - pm.setSerializedProperties(serializedProperties); - - JsonNode node = mapper.readTree(serializedProperties); - JsonNode child = node.get("ptm_site_properties"); - DPtmSiteProperties properties = mapper.treeToValue(child, DPtmSiteProperties.class); - pm.setPtmSiteProperties(properties); - if(!peptideMatchById.containsKey(pmId)) - peptideMatchById.put(pmId, pm); - peptideMatchArray.add(pm); - - Peptide p = (Peptide) resCur[14]; - p.getTransientData().setPeptideReadablePtmStringLoaded(); - allPeptidesMap.put(p.getId(), p); - - Long msqId = (Long) resCur[15]; - Integer msqInitialId = (Integer) resCur[16]; - - DMsQuery msq = new DMsQuery(pmId, msqId, msqInitialId, precursorIntensity); - msq.setDSpectrum(spectrum); - - pm.setPeptide(p); - pm.setMsQuery(msq); - - } - - subTask = subTaskManager.getNextSubTask(); - - } - - stop = System.currentTimeMillis(); - m_logger.debug("Best PSM + Peptide + Spectrum + Query from PepInstances created in {} ms", (stop-start)); - start = stop; - - // Retrieve PeptideReadablePtmString - Long rsetId = m_rsm.getResultSet().getId(); - Query ptmStingQuery = entityManagerMSI.createQuery("SELECT p.id, ptmString FROM fr.proline.core.orm.msi.Peptide p, fr.proline.core.orm.msi.PeptideReadablePtmString ptmString WHERE p.id IN (:listId) AND ptmString.peptide=p AND ptmString.resultSet.id=:rsetId"); - ptmStingQuery.setParameter("listId", allPeptidesMap.keySet()); - ptmStingQuery.setParameter("rsetId", rsetId); - - List ptmStrings = ptmStingQuery.getResultList(); - Iterator it = ptmStrings.iterator(); - while (it.hasNext()) { - Object[] res = it.next(); - Long peptideId = (Long) res[0]; - PeptideReadablePtmString ptmString = (PeptideReadablePtmString) res[1]; - Peptide peptide = allPeptidesMap.get(peptideId); - peptide.getTransientData().setPeptideReadablePtmString(ptmString); - } - - stop = System.currentTimeMillis(); - m_logger.debug("PeptideReadablePtmString loaded in {} ms", (stop-start)); - start = stop; - - // fetch Generic PTM Data - fetchGenericPTMData(entityManagerMSI); - - stop = System.currentTimeMillis(); - m_logger.debug("Generic PTM data loaded in {} ms", (stop-start)); - start = stop; - - // fetch Specific Data for the Peptides Found - HashMap> ptmMap = fetchPTMDataForPeptides(entityManagerMSI, new ArrayList(allPeptidesMap.keySet())); - - for (DPeptideMatch pm : peptideMatchArray) { - Peptide p = pm.getPeptide(); - Long idPeptide = p.getId(); - pm.setPeptidePTMArray(ptmMap.get(idPeptide)); - - HashMap mapToPtm = new HashMap<>(); - ArrayList ptmList = ptmMap.get(idPeptide); - if (ptmList != null) { - for (DPeptidePTM peptidePTM : ptmList) { - mapToPtm.put((int) peptidePTM.getSeqPosition(), peptidePTM); - } - p.getTransientData().setDPeptidePtmMap(mapToPtm); - } - } - - stop = System.currentTimeMillis(); - m_logger.debug("PTM data for peptides loaded in {} ms", (stop-start)); - start = stop; - - // create the list of PTMSites - Map proteinMatchMap = typicalProteinMatchesArray.stream().collect(Collectors.toMap(item -> item.getId(), item -> item)); - // Map peptideMatchMap = peptideMatchArray.stream().collect(Collectors.toMap(item -> item.getId(), item -> item)); - - for (JSONPTMSite jsonSite : values) { - PTMSite site = new PTMSite(jsonSite,proteinMatchMap.get(jsonSite.proteinMatchId) ); - site.setBestProbabilityPepMatch(peptideMatchById.get(jsonSite.bestPeptideMatchId)); - site.setPTMSpecificity(DInfoPTM.getInfoPTMMap().get(jsonSite.ptmDefinitionId)); - if (site.getProteinMatch() != null) { - m_ptmSitesOutput.add(site); - } - } - - stop = System.currentTimeMillis(); - m_logger.debug("{} PTM Sites built in {} ms", m_ptmSitesOutput.size(), (stop-start)); - - entityManagerMSI.getTransaction().commit(); - } catch (Exception e) { - m_logger.error(getClass().getSimpleName() + " failed", e); - m_taskError = new TaskError(e); - try { - entityManagerMSI.getTransaction().rollback(); - } catch (Exception rollbackException) { - m_logger.error(getClass().getSimpleName() + " failed : potential network problem", rollbackException); - } - return false; - } finally { - entityManagerMSI.close(); - } - - return true; - } - - private boolean fetchGenericPTMData(EntityManager entityManagerMSI) { - - HashMap infoPTMMAp = DInfoPTM.getInfoPTMMap(); - if (!infoPTMMAp.isEmpty()) { - return true; // already loaded - } - - TypedQuery ptmInfoQuery = entityManagerMSI.createQuery("SELECT new fr.proline.core.orm.msi.dto.DInfoPTM(spec.id, spec.residue, spec.location, ptm.shortName, evidence.composition, evidence.monoMass) \n" - + "FROM fr.proline.core.orm.msi.PtmSpecificity as spec, fr.proline.core.orm.msi.Ptm as ptm, fr.proline.core.orm.msi.PtmEvidence as evidence \n" - + "WHERE spec.ptm=ptm AND ptm=evidence.ptm AND evidence.type='Precursor' ", DInfoPTM.class); - List ptmInfoList = ptmInfoQuery.getResultList(); - - Iterator it = ptmInfoList.iterator(); - while (it.hasNext()) { - DInfoPTM infoPTM = it.next(); - DInfoPTM.addInfoPTM(infoPTM); - } - - return true; - } - - - private HashMap> fetchPTMDataForPeptides(EntityManager entityManagerMSI, ArrayList allPeptidesIds) { - - HashMap> ptmMap = new HashMap<>(); - - SubTaskManager subTaskManager = new SubTaskManager(1); - SubTask subTask = subTaskManager.sliceATaskAndGetFirst(0, allPeptidesIds.size(), SLICE_SIZE); - while (subTask != null) { - - TypedQuery ptmQuery = entityManagerMSI.createQuery("SELECT new fr.proline.core.orm.msi.dto.DPeptidePTM(pptm.peptide.id, pptm.specificity.id, pptm.seqPosition) \n" - + "FROM PeptidePtm as pptm \n" - + "WHERE pptm.peptide.id IN (:peptideList) ", DPeptidePTM.class); - ptmQuery.setParameter("peptideList", subTask.getSubList(allPeptidesIds)); - - List ptmList = ptmQuery.getResultList(); - - Iterator it = ptmList.iterator(); - while (it.hasNext()) { - DPeptidePTM ptm = it.next(); - Long peptideId = ptm.getIdPeptide(); - ArrayList list = ptmMap.get(peptideId); - if (list == null) { - list =new ArrayList<>(); - ptmMap.put(peptideId, list); - } - list.add(ptm); - - } - - subTask = subTaskManager.getNextSubTask(); - } - - return ptmMap; - - } - - public static void fetchReadablePTMData(EntityManager entityManagerMSI, Long rsetId, HashMap peptideMap, List sliceOfPeptideMatchIds) { - if ((peptideMap == null) || peptideMap.isEmpty()) { - return; - } - - if (sliceOfPeptideMatchIds == null) { - sliceOfPeptideMatchIds = new ArrayList<>(peptideMap.keySet()); - } - - // Retrieve PeptideReadablePtmString - Query ptmStingQuery = entityManagerMSI.createQuery("SELECT p.id, ptmString " - + "FROM fr.proline.core.orm.msi.Peptide p, fr.proline.core.orm.msi.PeptideReadablePtmString ptmString " - + "WHERE p.id IN (:listId) AND ptmString.peptide=p AND ptmString.resultSet.id=:rsetId"); - ptmStingQuery.setParameter("listId", sliceOfPeptideMatchIds); - ptmStingQuery.setParameter("rsetId", rsetId); - - List ptmStrings = ptmStingQuery.getResultList(); - Iterator it = ptmStrings.iterator(); - while (it.hasNext()) { - Object[] res = it.next(); - Long peptideId = (Long) res[0]; - PeptideReadablePtmString ptmString = (PeptideReadablePtmString) res[1]; - Peptide peptide = peptideMap.get(peptideId); - peptide.getTransientData().setPeptideReadablePtmString(ptmString); - } - - } - - - public static void fetchPTMDataForPeptides(EntityManager entityManagerMSI, HashMap peptideMap, List sliceOfPeptideMatchIds) { - - if (!peptideMap.isEmpty()) { - - if (sliceOfPeptideMatchIds == null) { - sliceOfPeptideMatchIds = new ArrayList<>(peptideMap.keySet()); - } - - TypedQuery ptmQuery = entityManagerMSI.createQuery("SELECT new fr.proline.core.orm.msi.dto.DPeptidePTM(pptm.peptide.id, pptm.specificity.id, pptm.seqPosition) FROM fr.proline.core.orm.msi.PeptidePtm pptm WHERE pptm.peptide.id IN (:peptideIds)", DPeptidePTM.class); - ptmQuery.setParameter("peptideIds", sliceOfPeptideMatchIds); - List ptmList = ptmQuery.getResultList(); - - Iterator it = ptmList.iterator(); - while (it.hasNext()) { - DPeptidePTM ptm = it.next(); - - Peptide p = peptideMap.get(ptm.getIdPeptide()); - HashMap map = p.getTransientData().getDPeptidePtmMap(); - if (map == null) { - map = new HashMap<>(); - p.getTransientData().setDPeptidePtmMap(map); - } - - map.put((int) ptm.getSeqPosition(), ptm); - - } - } - - } - -} diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabasePTMsTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabasePTMsTask.java index 9dbbeef24..9c4f70349 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabasePTMsTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabasePTMsTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,125 +16,102 @@ */ package fr.proline.studio.dam.tasks; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.PropertyNamingStrategy; -import fr.proline.core.orm.msi.ObjectTree; import fr.proline.core.orm.msi.Peptide; -import fr.proline.core.orm.msi.PeptideInstance; -import fr.proline.core.orm.msi.PeptideMatch; import fr.proline.core.orm.msi.PeptideReadablePtmString; -import fr.proline.core.orm.msi.ResultSummary; -import fr.proline.core.orm.msi.SequenceMatch; -import fr.proline.core.orm.msi.dto.DMsQuery; -import fr.proline.core.orm.msi.dto.DPeptideMatch; -import fr.proline.core.orm.msi.dto.DProteinMatch; -import fr.proline.core.orm.msi.dto.DSpectrum; +import fr.proline.core.orm.msi.PtmSpecificity; import fr.proline.core.orm.msi.dto.DInfoPTM; -import fr.proline.core.orm.msi.dto.DPeptideInstance; import fr.proline.core.orm.msi.dto.DPeptidePTM; -import fr.proline.core.orm.msi.dto.DPtmSiteProperties; -import fr.proline.core.orm.uds.dto.DDataset; import fr.proline.core.orm.util.DStoreCustomPoolConnectorFactory; import fr.proline.studio.dam.taskinfo.TaskError; import fr.proline.studio.dam.taskinfo.TaskInfo; -import fr.proline.studio.dam.tasks.data.ptm.JSONPTMCluster; -import fr.proline.studio.dam.tasks.data.ptm.JSONPTMDataset; -import fr.proline.studio.dam.tasks.data.ptm.JSONPTMSite2; import fr.proline.studio.dam.tasks.data.ptm.PTMCluster; -import fr.proline.studio.dam.tasks.data.ptm.PTMDataset; import fr.proline.studio.dam.tasks.data.ptm.PTMSite; -import java.io.IOException; +import fr.proline.studio.performancetest.PerformanceTest; + +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.TypedQuery; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import javax.persistence.EntityManager; -import javax.persistence.Query; -import javax.persistence.TypedQuery; -import org.openide.util.Exceptions; - -import fr.proline.studio.performancetest.PerformanceTest; /** + * Tasks to get Generic PTM information * * @author JM235353 */ public class DatabasePTMsTask extends AbstractDatabaseSlicerTask { private long m_projectId = -1; - private DDataset m_dataset = null; - private PTMDataset m_ptmDataset = null; //attributes to initialize when data is retrieve - private List m_ptmSitesOutput = null; - private List m_ptmDatasetOutput = null; + private List m_ptmsOutput = null; + + //Parameters for PTMs info for specific RSMs + private List m_rsmIds = null; - public static final int SUB_TASK_PTMSITE_PEPTIDES = 0; - public static final int SUB_TASK_PTMCLUSTER_PEPTIDES = 1; - public static final int SUB_TASK_PTMSITE_PEPINSTANCES = 2; - public static final int SUB_TASK_COUNT = 3; // <<----- get in sync - final int SLICE_SIZE = 1000; + public static final int NO_SUB_TASK_COUNT = 0; - // data kept for sub tasks - private List m_bestSitesPepMatchIds = null; - private HashMap> m_ptmSitesByBestPepMatchId = null; - private List m_bestClustersPepMatchIds = null; - private HashMap> m_ptmClustersByBestPepMatchId = null; - private List m_peptideIds = null; private int m_action; - private final static int LOAD_PTMDATASET = 0; - private final static int FILL_ALL_PTM_SITES_PEPINFO = 1; - private final static int FILL_ALL_PTM_INFO = 2; + private final static int FILL_ALL_PTM_INFO = 0; + private final static int LOAD_IDENTIFIED_PTM_SPECIFICITIES = 1; - private boolean m_loadSitesAsClusters; - - public final static String ERROR_PTM_CLUSTER_LOADING = "PTM Cluster Loading Error"; public DatabasePTMsTask(AbstractDatabaseCallback callback) { super(callback); } + /** + * Get generic PTM information (DInfoPTM object from PTM Specificity) registered for specified project. + * + * @param projectId + */ public void initFillPTMInfo(Long projectId) { - init(SUB_TASK_COUNT, new TaskInfo("Load PTM Info", false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + init(NO_SUB_TASK_COUNT, new TaskInfo("Load PTM Info", false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); m_projectId = projectId; m_action = FILL_ALL_PTM_INFO; } - public void initFillPTMSites(long projectId, PTMDataset ptmDS, List ptmSitesToFill) { - init(SUB_TASK_COUNT, new TaskInfo("Load peptides of PTM Sites", false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + /** + * Get all PTMSpecificity used for specified result summary identification search + * @param projectId + * @param rsmId + * @param ptmsToFill + */ + public void initLoadUsedPTMs(Long projectId, Long rsmId, List ptmsToFill) { + init(NO_SUB_TASK_COUNT, new TaskInfo("Load used PTMs from RSM id" + rsmId, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); m_projectId = projectId; - m_ptmSitesOutput = ptmSitesToFill; - m_ptmDataset = ptmDS; - m_action = FILL_ALL_PTM_SITES_PEPINFO; + m_rsmIds = new ArrayList<>(); + m_rsmIds.add(rsmId); + m_ptmsOutput = ptmsToFill; + m_action = LOAD_IDENTIFIED_PTM_SPECIFICITIES; } - public void initLoadPTMDataset(Long projectId, DDataset dataset, List ptmDataset, boolean loadSitesAsClusters) { - init(SUB_TASK_COUNT, new TaskInfo("Load PTM Dataset for " + dataset.getName(), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + /** + * Get all PTMSpecificity used for all specified result summary identification searches + * @param projectId + * @param rsmIds + * @param ptmsToFill + */ + public void initLoadUsedPTMs(Long projectId, List rsmIds, List ptmsToFill) { + init(NO_SUB_TASK_COUNT, new TaskInfo("Load used PTMs from RSM ids" + rsmIds, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); m_projectId = projectId; - m_ptmDatasetOutput = ptmDataset; - m_dataset = dataset; - m_action = LOAD_PTMDATASET; - m_loadSitesAsClusters = loadSitesAsClusters; + m_rsmIds = rsmIds; + m_ptmsOutput = ptmsToFill; + m_action = LOAD_IDENTIFIED_PTM_SPECIFICITIES; } @Override public boolean needToFetch() { switch (m_action) { - case FILL_ALL_PTM_SITES_PEPINFO: - return (m_peptideIds == null || m_peptideIds.isEmpty()); - case LOAD_PTMDATASET: { - return (m_ptmDatasetOutput == null || m_ptmDatasetOutput.isEmpty()); - } case FILL_ALL_PTM_INFO: { return DInfoPTM.getInfoPTMMap().isEmpty(); } + case LOAD_IDENTIFIED_PTM_SPECIFICITIES: { + return true; + } } return false; // should not be called } @@ -143,25 +120,14 @@ public boolean needToFetch() { public boolean fetchData() { try { switch (m_action) { - case LOAD_PTMDATASET: { + case FILL_ALL_PTM_INFO: { if (needToFetch()) { - return fetchPTMDatasetMainTask(); - } else { - // fetch data of SubTasks - return fetchDataSubTaskFor(); + return fetchPTMInfo(); } } - case FILL_ALL_PTM_SITES_PEPINFO: { + case LOAD_IDENTIFIED_PTM_SPECIFICITIES: { if (needToFetch()) { - return fetchAllPTMSitesPeptideMatches(); - } else // fetch data of SubTasks - { - return fetchDataSubTaskFor(); - } - } - case FILL_ALL_PTM_INFO: { - if (needToFetch()) { - return fetchPTMInfo(); + return fetchIdentifiedPTMs(); } } } @@ -171,32 +137,58 @@ public boolean fetchData() { return true; // should not happen } - /** + /* * Fetch data of a Subtask * * @return */ - private boolean fetchDataSubTaskFor() { - SubTask slice = m_subTaskManager.getNextSubTask(); - if (slice == null) { - return true; // nothing to do : should not happen - } - + //No subtask define in this classe currently !! +// private boolean fetchDataSubTaskFor(int action) { +// SubTask slice = m_subTaskManager.getNextSubTask(); +// if (slice == null) { +// return true; // nothing to do : should not happen +// } +// +// EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); +// try { +// entityManagerMSI.getTransaction().begin(); +// switch (action) { +//// case FILL_ALL_PTM_SITES_PEPINFO: +//// switch (slice.getSubTaskId()) { +//// case SUB_TASK_PTMSITE_PEPINSTANCES: +//// fetchPTMSitesPepInstances(slice, entityManagerMSI); +//// break; +//// } +// } +// entityManagerMSI.getTransaction().commit(); +// } catch (Exception e) { +// m_logger.error(getClass().getSimpleName() + " failed", e); +// m_taskError = new TaskError(e); +// try { +// entityManagerMSI.getTransaction().rollback(); +// } catch (Exception rollbackException) { +// m_logger.error(getClass().getSimpleName() + " failed : potential network problem", rollbackException); +// } +// return false; +// } finally { +// entityManagerMSI.close(); +// } +// +// return true; +// } + + private boolean fetchIdentifiedPTMs() { +// PerformanceTest.startTime("fetchIdentifiedPTMs"); EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); try { + entityManagerMSI.getTransaction().begin(); - switch (slice.getSubTaskId()) { - case SUB_TASK_PTMSITE_PEPTIDES: - fetchSiteBestPeptideMatches(slice, entityManagerMSI); - break; - case SUB_TASK_PTMCLUSTER_PEPTIDES: - fetchClusterBestPeptideMatches(slice, entityManagerMSI); - break; - case SUB_TASK_PTMSITE_PEPINSTANCES: - fetchPTMSitesPepInstances(slice, entityManagerMSI); - } - entityManagerMSI.getTransaction().commit(); - } catch (Exception e) { + + TypedQuery query = entityManagerMSI.createQuery("SELECT DISTINCT(pp.specificity) FROM PeptidePtm pp, PeptideInstance pi JOIN FETCH pp.specificity.ptm ptm WHERE pi.resultSummary.id in (:rsmIds) AND pi.peptide.id = pp.peptide.id", PtmSpecificity.class); + query.setParameter("rsmIds", m_rsmIds); + m_ptmsOutput.addAll(query.getResultList()); + + } catch (Exception e) { m_logger.error(getClass().getSimpleName() + " failed", e); m_taskError = new TaskError(e); try { @@ -208,14 +200,16 @@ private boolean fetchDataSubTaskFor() { } finally { entityManagerMSI.close(); } - +// PerformanceTest.stopTime("fetchIdentifiedPTMs"); return true; } + + private boolean fetchPTMInfo() { EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); try { - this.fetchGenericPTMData(entityManagerMSI); + fetchGenericPTMData(entityManagerMSI); } catch (Exception e) { m_logger.error(getClass().getSimpleName() + " failed", e); @@ -232,250 +226,7 @@ private boolean fetchPTMInfo() { return true; } - // Entry point for this Database tasks. - private boolean fetchPTMDatasetMainTask() { - - PerformanceTest.startTime("fetchPTMDatasetMainTask"); - - long start = System.currentTimeMillis(); - //m_logger.debug(" START fetchPTMDatasetMainTask task "); - EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); - try { - - entityManagerMSI.getTransaction().begin(); - - //--- Read PTM data in object tree associated to rsm - ResultSummary rsm = entityManagerMSI.find(ResultSummary.class, m_dataset.getResultSummaryId()); - if (rsm.getObjectTreeIdByName().isEmpty() || rsm.getObjectTreeIdByName().get("result_summary.ptm_dataset") == null) { - m_taskError = new TaskError(ERROR_PTM_CLUSTER_LOADING, "\"Identification Modification Sites\" has not been run on this dataset."); - throw new RuntimeException("\"Identification Modification Sites\" has not been run on this dataset."); - } - ObjectTree ot = entityManagerMSI.find(ObjectTree.class, rsm.getObjectTreeIdByName().get("result_summary.ptm_dataset")); - ObjectMapper mapper = new ObjectMapper(); - mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); - JSONPTMDataset jsonDS = mapper.readValue(ot.getClobData(), JSONPTMDataset.class); - - //--- Create PTMDataset - m_ptmDataset = new PTMDataset(m_dataset); - m_ptmDataset.setIsVersion2(true); - m_ptmDataset.setLeafResultSummaryIds(Arrays.asList(jsonDS.leafResultSummaryIds)); - - m_ptmDatasetOutput.add(m_ptmDataset); - //** Read and create PTMSite - createPTMDatasetPTMSites(jsonDS, entityManagerMSI); - for (Long i : jsonDS.ptmIds) { - m_ptmDataset.addInfoPTM(DInfoPTM.getInfoPTMMap().get(i)); - } - if (!m_loadSitesAsClusters) { - //** Read and create PTMCluster - createPTMDatasetPTMCluster(jsonDS, entityManagerMSI); - } else { - createPTMDatasetPTMCluster(entityManagerMSI); - } - - } catch (Exception e) { - m_logger.error(getClass().getSimpleName() + " failed", e); - if (m_taskError == null) { - // we do not replace an error already set. - m_taskError = new TaskError(e); - } - try { - entityManagerMSI.getTransaction().rollback(); - } catch (Exception rollbackException) { - m_logger.error(getClass().getSimpleName() + " failed : potential network problem", rollbackException); - } - return false; - } finally { - entityManagerMSI.close(); - } - long end = System.currentTimeMillis(); - //m_logger.debug(" END fetchPTMDatasetMainTask task "+(end-start)+" ms"); - - PerformanceTest.stopTime("fetchPTMDatasetMainTask"); - - - return true; - } - - /* - * Private method called to create PTMSites from read JSON properties - * @param ptmDS - */ - private boolean createPTMDatasetPTMSites(JSONPTMDataset jsonDataset, EntityManager entityManagerMSI) throws Exception { - //Read PTMSite V2 - - PerformanceTest.startTime("createPTMDatasetPTMSites"); - - List ptmSites = new ArrayList<>(); - long start = System.currentTimeMillis(); - - //---- Get associated Parent RSM ProteinMatches - Long rsmId = m_ptmDataset.getDataset().getResultSummaryId(); - TypedQuery typicalProteinQuery = entityManagerMSI.createQuery("SELECT new fr.proline.core.orm.msi.dto.DProteinMatch(pm.id, pm.accession, pm.score, pm.peptideCount, pm.resultSet.id, pm.description, pm.geneName, pm.serializedProperties, pepset.id, pepset.score, pepset.sequenceCount, pepset.peptideCount, pepset.peptideMatchCount, pepset.resultSummaryId) " - + "FROM PeptideSetProteinMatchMap pset_to_pm JOIN pset_to_pm.proteinMatch as pm JOIN pset_to_pm.peptideSet as pepset JOIN pepset.proteinSet as ps " - + "WHERE ps.resultSummary.id=:rsmId AND ps.isValidated=true AND ps.representativeProteinMatchId=pm.id ORDER BY pepset.score DESC", DProteinMatch.class); - - typicalProteinQuery.setParameter("rsmId", rsmId); - List typicalProteinMatchesArray = typicalProteinQuery.getResultList(); - long stop = System.currentTimeMillis(); - m_logger.debug(" ** {} typical ProtMatches and {} PTMSites loaded in {} ms", typicalProteinMatchesArray.size(), jsonDataset.ptmSites.length, (stop - start)); - start = stop; - - //--- Get Protein Match mapping between parent and leaf rsm - List accessions = typicalProteinMatchesArray.stream().map(DProteinMatch::getAccession).collect(Collectors.toList()); - Map> allProtMatchesIdPerAccession = new HashMap<>(); - int bufferSize = 10000; - int readAccessionCount = 0; - while(readAccessionCount < accessions.size()){ - - PerformanceTest.startTime("STEP1"); - - Query protMatchQuery = entityManagerMSI.createQuery("SELECT pm.id, pm.accession FROM ProteinMatch pm, ResultSummary rsm WHERE pm.accession IN (:accList) AND rsm.resultSet.id = pm.resultSet.id AND rsm.id in (:rsmIds) "); - int lastIndex = ((readAccessionCount+bufferSize) > accessions.size()) ? accessions.size() : readAccessionCount+bufferSize; - protMatchQuery.setParameter("accList", accessions.subList(readAccessionCount, lastIndex)); - protMatchQuery.setParameter("rsmIds", m_ptmDataset.getLeafResultSummaryIds()); - - Iterator proteinMatchesResult = protMatchQuery.getResultList().iterator(); - while(proteinMatchesResult.hasNext()){ - Object[] results = proteinMatchesResult.next(); - Long prMatchAcc = (Long) results[0]; - String acc = (String) results[1]; - if(!allProtMatchesIdPerAccession.containsKey(acc)) - allProtMatchesIdPerAccession.put(acc, new ArrayList()); - allProtMatchesIdPerAccession.get(acc).add(prMatchAcc); - } - readAccessionCount = lastIndex; - - PerformanceTest.stopTime("STEP1"); - } - m_ptmDataset.setLeafProtMatchesIdPerAccession(allProtMatchesIdPerAccession); - stop = System.currentTimeMillis(); - m_logger.debug(" ** Creates ProtMatches map for leaf RSM, map size = {} ; loaded in {} ms", allProtMatchesIdPerAccession.size(), (stop - start)); - start = stop; - - //---- fetch Generic PTM Data - fetchGenericPTMData(entityManagerMSI); - - m_ptmSitesByBestPepMatchId = new HashMap<>(); - //---- Create the list of PTMSites - Map proteinMatchMap = typicalProteinMatchesArray.stream().collect(Collectors.toMap(item -> item.getId(), item -> item)); - for (JSONPTMSite2 jsonSite : jsonDataset.ptmSites) { - PTMSite site = new PTMSite(jsonSite, proteinMatchMap.get(jsonSite.proteinMatchId)); - //site.setBestPeptideMatch(peptideMatchMap.get(jsonSite.bestPeptideMatchId)); - site.setPTMSpecificity(DInfoPTM.getInfoPTMMap().get(jsonSite.ptmDefinitionId)); - if (site.getProteinMatch() != null) { - ptmSites.add(site); - } - - if (!m_ptmSitesByBestPepMatchId.containsKey(jsonSite.bestPeptideMatchId)) { - m_ptmSitesByBestPepMatchId.put(jsonSite.bestPeptideMatchId, new ArrayList<>()); - } - m_ptmSitesByBestPepMatchId.get(jsonSite.bestPeptideMatchId).add(site); - } - stop = System.currentTimeMillis(); - m_logger.debug(" ** {} PTM Sites built in {} ms", ptmSites.size(), (stop - start)); - start = stop; - m_ptmDataset.setPTMSites(ptmSites); - - - PerformanceTest.stopTime("createPTMDatasetPTMSites"); - - - //---- Runs subtasks to get peptide matches - //Get Best Peptide MatchesProteinMatches - m_bestSitesPepMatchIds = Arrays.asList(jsonDataset.ptmSites).stream().map(site -> site.bestPeptideMatchId).distinct().collect(Collectors.toList()); - SubTask subTask = m_subTaskManager.sliceATaskAndGetFirst(SUB_TASK_PTMSITE_PEPTIDES, m_bestSitesPepMatchIds.size(), SLICE_SIZE); - fetchSiteBestPeptideMatches(subTask, entityManagerMSI); //get first slice - stop = System.currentTimeMillis(); - - - - m_logger.debug(" ** First {} Best PSM + Peptide + Spectrum + Query from PepInstances created in {} ms", SLICE_SIZE, (stop - start)); - - return true; - } - - private boolean createPTMDatasetPTMCluster(JSONPTMDataset jsonDataset, EntityManager entityManagerMSI) throws Exception { - long start = System.currentTimeMillis(); - - PerformanceTest.startTime("createPTMDatasetPTMCluster"); - - m_bestClustersPepMatchIds = new ArrayList<>(); - - List allClusters = new ArrayList<>(); - m_ptmClustersByBestPepMatchId = new HashMap<>(); - for (JSONPTMCluster cluster : jsonDataset.ptmClusters) { - PTMCluster ptmCluster = new PTMCluster(cluster, m_ptmDataset); - if (ptmCluster.getPTMSites() == null || ptmCluster.getPTMSites().isEmpty()) { - continue; - } - Long bestPepMatchID = cluster.bestPeptideMatchId; - m_bestClustersPepMatchIds.add(bestPepMatchID); - allClusters.add(ptmCluster); - if (!m_ptmClustersByBestPepMatchId.containsKey(bestPepMatchID)) { - m_ptmClustersByBestPepMatchId.put(bestPepMatchID, new ArrayList<>()); - } - m_ptmClustersByBestPepMatchId.get(bestPepMatchID).add(ptmCluster); - } - m_ptmDataset.setPTMClusters(allClusters); - - PerformanceTest.stopTime("createPTMDatasetPTMCluster"); - - long stop = System.currentTimeMillis(); - m_logger.debug(" -- Created {} Cluster in {} ms", allClusters.size(), (stop - start)); - start = stop; - - //---- Runs subtasks to get peptide matches - //Get Best Peptide Matches - SubTask subTask = m_subTaskManager.sliceATaskAndGetFirst(SUB_TASK_PTMCLUSTER_PEPTIDES, m_bestClustersPepMatchIds.size(), SLICE_SIZE); - fetchClusterBestPeptideMatches(subTask, entityManagerMSI); //get first slice - stop = System.currentTimeMillis(); - m_logger.debug(" -- First {} Best PSM + Peptide + Spectrum + Query from PepInstances created in {} ms", SLICE_SIZE, (stop - start)); - return true; - } - - - private boolean createPTMDatasetPTMCluster(EntityManager entityManagerMSI) throws Exception { - - long start = System.currentTimeMillis(); - m_bestClustersPepMatchIds = new ArrayList<>(); - - PerformanceTest.startTime("createPTMDatasetPTMCluster"); - - List allClusters = new ArrayList<>(); - m_ptmClustersByBestPepMatchId = new HashMap<>(); - for (PTMSite site: m_ptmDataset.getPTMSites()) { - PTMCluster ptmCluster = new PTMCluster(site.getId(), site.getLocalisationConfidence(), Arrays.asList(site.getId()), site.getPeptideIds() , m_ptmDataset); - if (ptmCluster.getPTMSites() == null || ptmCluster.getPTMSites().isEmpty()) { - continue; - } - Long bestPepMatchID = site.getBestProbabilityPepMatchId(); - m_bestClustersPepMatchIds.add(bestPepMatchID); - allClusters.add(ptmCluster); - if (!m_ptmClustersByBestPepMatchId.containsKey(bestPepMatchID)) { - m_ptmClustersByBestPepMatchId.put(bestPepMatchID, new ArrayList<>()); - } - m_ptmClustersByBestPepMatchId.get(bestPepMatchID).add(ptmCluster); - } - m_ptmDataset.setPTMClusters(allClusters); - - PerformanceTest.stopTime("createPTMDatasetPTMCluster"); - - long stop = System.currentTimeMillis(); - m_logger.debug(" -- Created {} Cluster in {} ms", allClusters.size(), (stop - start)); - start = stop; - - // TODO : try to simplify this since the same peptideMatches will already be loaded for sites, except that this - // TODO: is done in a subtasks. When executing this method, the subtasks is not necessarily done. - //---- Runs subtasks to get peptide matches - SubTask subTask = m_subTaskManager.sliceATaskAndGetFirst(SUB_TASK_PTMCLUSTER_PEPTIDES, m_bestClustersPepMatchIds.size(), SLICE_SIZE); - fetchClusterBestPeptideMatches(subTask, entityManagerMSI); //get first slice - stop = System.currentTimeMillis(); - m_logger.debug(" -- First {} Best PSM + Peptide + Spectrum + Query from PepInstances created in {} ms", SLICE_SIZE, (stop - start)); - return true; - } - - private void fetchGenericPTMData(EntityManager entityManagerMSI) { + static protected void fetchGenericPTMData(EntityManager entityManagerMSI) { PerformanceTest.startTime("fetchGenericPTMData"); @@ -485,7 +236,7 @@ private void fetchGenericPTMData(EntityManager entityManagerMSI) { return; // already loaded } - TypedQuery ptmInfoQuery = entityManagerMSI.createQuery("SELECT new fr.proline.core.orm.msi.dto.DInfoPTM(spec.id, spec.residue, spec.location, ptm.shortName, evidence.composition, evidence.monoMass) \n" + TypedQuery ptmInfoQuery = entityManagerMSI.createQuery("SELECT new fr.proline.core.orm.msi.dto.DInfoPTM(spec.id, ptm.id, spec.residue, spec.location, ptm.shortName, evidence.composition, evidence.monoMass) \n" + "FROM fr.proline.core.orm.msi.PtmSpecificity as spec, fr.proline.core.orm.msi.Ptm as ptm, fr.proline.core.orm.msi.PtmEvidence as evidence \n" + "WHERE spec.ptm=ptm AND ptm=evidence.ptm AND evidence.type='Precursor' ", DInfoPTM.class); List ptmInfoList = ptmInfoQuery.getResultList(); @@ -498,174 +249,8 @@ private void fetchGenericPTMData(EntityManager entityManagerMSI) { PerformanceTest.stopTime("fetchGenericPTMData"); } - - // - private boolean fetchSiteBestPeptideMatches(SubTask subTask, EntityManager entityManagerMSI) { - List sliceOfPeptideMatchIds = subTask.getSubList(m_bestSitesPepMatchIds); - return fetchBestPeptideMatches(sliceOfPeptideMatchIds, entityManagerMSI, true); - } - - private boolean fetchClusterBestPeptideMatches(SubTask subTask, EntityManager entityManagerMSI) { - List sliceOfPeptideMatchIds = subTask.getSubList(m_bestClustersPepMatchIds); - return fetchBestPeptideMatches(sliceOfPeptideMatchIds, entityManagerMSI, false); - } - - /* Method called for subTask execution to get peptide Matches info - */ - private boolean fetchBestPeptideMatches(List sliceOfPeptideMatchIds, EntityManager entityManagerMSI, boolean isSite) { - long start = System.currentTimeMillis(); - PerformanceTest.startTime("fetchBestPeptideMatches"); - - PerformanceTest.startTime("STEP1"); - - Query peptidesQuery = entityManagerMSI.createQuery("SELECT pm.id, pm.rank, pm.charge, pm.deltaMoz, pm.experimentalMoz, pm.missedCleavage, pm.score, pm.resultSet.id, pm.cdPrettyRank, pm.sdPrettyRank, pm.serializedProperties, sp.firstTime, sp.precursorIntensity, sp.title, p, ms.id, ms.initialId, ptmString\n" - + " FROM fr.proline.core.orm.msi.PeptideInstancePeptideMatchMap pipm, fr.proline.core.orm.msi.PeptideMatch pm, fr.proline.core.orm.msi.PeptideInstance pi, fr.proline.core.orm.msi.Peptide p, fr.proline.core.orm.msi.PeptideReadablePtmString ptmString, fr.proline.core.orm.msi.MsQuery ms, fr.proline.core.orm.msi.Spectrum sp \n" - + " WHERE pipm.id.peptideMatchId IN (:peptideMatchList) AND pipm.id.peptideInstanceId=pi.id AND pipm.id.peptideMatchId=pm.id AND pm.peptideId=p.id AND pm.msQuery=ms AND ms.spectrum=sp AND pi.resultSummary.id in (:rmsIds) AND ptmString.peptide=p AND ptmString.resultSet.id=pm.resultSet.id"); - peptidesQuery.setParameter("peptideMatchList", sliceOfPeptideMatchIds); - List rsmIds = m_ptmDataset.getLeafResultSummaryIds(); - rsmIds.add(m_ptmDataset.getDataset().getResultSummaryId()); - peptidesQuery.setParameter("rmsIds", rsmIds); - - ObjectMapper mapper = new ObjectMapper(); - mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); - - List l = peptidesQuery.getResultList(); - Iterator itPeptidesQuery = l.iterator(); - List allPepMatches = new ArrayList<>(); - //Create List of DPeptideMatch (linked to DSpectrum + DMsQuery) from query resumlt - - PerformanceTest.stopTime("STEP1"); - - - - while (itPeptidesQuery.hasNext()) { - - PerformanceTest.startTime("STEP2"); - - Object[] resCur = itPeptidesQuery.next(); - - Long pmId = (Long) resCur[0]; - Integer pmRank = (Integer) resCur[1]; - Integer pmCharge = (Integer) resCur[2]; - Float pmDeltaMoz = (Float) resCur[3]; - Double pmExperimentalMoz = (Double) resCur[4]; - Integer pmMissedCleavage = (Integer) resCur[5]; - Float pmScore = (Float) resCur[6]; - Long pmResultSetId = (Long) resCur[7]; - - Integer pmCdPrettyRank = (Integer) resCur[8]; - Integer pmSdPrettyRank = (Integer) resCur[9]; - String serializedProperties = (String) resCur[10]; - Float firstTime = (Float) resCur[11]; - Float precursorIntensity = (Float) resCur[12]; - String title = (String) resCur[13]; - - DSpectrum spectrum = new DSpectrum(); - spectrum.setFirstTime(firstTime); - spectrum.setPrecursorIntensity(precursorIntensity); - spectrum.setTitle(title); - - PerformanceTest.stopTime("STEP2"); - - PerformanceTest.startTime("STEP3"); - - DPeptideMatch pm = new DPeptideMatch(pmId, pmRank, pmCharge, pmDeltaMoz, pmExperimentalMoz, pmMissedCleavage, pmScore, pmResultSetId, pmCdPrettyRank, pmSdPrettyRank); - pm.setRetentionTime(firstTime); - pm.setSerializedProperties(serializedProperties); - - try { - JsonNode node = mapper.readTree(serializedProperties); - JsonNode child = node.get("ptm_site_properties"); - DPtmSiteProperties properties = mapper.treeToValue(child, DPtmSiteProperties.class); - pm.setPtmSiteProperties(properties); - } catch (IOException ex) { - //VDS FIXME : If no PTMSite properties, do we keep the peptide? - Exceptions.printStackTrace(ex); - } - - PerformanceTest.stopTime("STEP3"); - - PerformanceTest.startTime("STEP4"); - - Peptide p = (Peptide) resCur[14]; - Long msqId = (Long) resCur[15]; - Integer msqInitialId = (Integer) resCur[16]; - PeptideReadablePtmString ptmString = (PeptideReadablePtmString) resCur[17]; - p.getTransientData().setPeptideReadablePtmString(ptmString); - p.getTransientData().setPeptideReadablePtmStringLoaded(); - - DMsQuery msq = new DMsQuery(pmId, msqId, msqInitialId, precursorIntensity); - msq.setDSpectrum(spectrum); - - pm.setPeptide(p); - pm.setMsQuery(msq); - - PerformanceTest.stopTime("STEP4"); - - PerformanceTest.startTime("STEP5"); - - if (isSite) { - List sites = m_ptmSitesByBestPepMatchId.get(pmId); - if (sites != null && !sites.isEmpty()) { - sites.stream().forEach(site -> { - PTMSite finalSite = m_ptmDataset.getPTMSite(site.getId()); - if (finalSite != null) { - finalSite.setBestProbabilityPepMatch(pm); - } - }); - } - } else { - List clusters = m_ptmClustersByBestPepMatchId.get(pmId); - if (clusters != null && !clusters.isEmpty()) { - clusters.stream().forEach(cluster -> { - cluster.setRepresentativePepMatch(pm); - }); - } - } - allPepMatches.add(pm); - - PerformanceTest.stopTime("STEP5"); - } - - long stop = System.currentTimeMillis(); - m_logger.debug(" --- {} PeptideMatches loaded in {} ms", sliceOfPeptideMatchIds.size(), (stop - start)); - start = stop; - - PerformanceTest.startTime("STEP6"); - - - //-- fetch Specific PTM Data for the Peptides Found - List pepId = allPepMatches.stream().map(peM -> peM.getPeptide().getId()).collect(Collectors.toList()); - - HashMap> ptmMap = fetchPeptidePTMForPeptides(entityManagerMSI, new ArrayList<>(pepId)); - for (DPeptideMatch pm : allPepMatches) { - Peptide p = pm.getPeptide(); - Long idPeptide = p.getId(); - ArrayList ptmList = ptmMap.get(idPeptide); - pm.setPeptidePTMArray(ptmList); - - HashMap mapToPtm = new HashMap<>(); - if (ptmList != null) { - for (DPeptidePTM peptidePTM : ptmList) { - mapToPtm.put((int) peptidePTM.getSeqPosition(), peptidePTM); - } - p.getTransientData().setDPeptidePtmMap(mapToPtm); - } - } - - PerformanceTest.stopTime("STEP6"); - - stop = System.currentTimeMillis(); - m_logger.debug(" --- Associated PTM data loaded in {} ms", (stop - start)); - - PerformanceTest.stopTime("fetchBestPeptideMatches"); - - - return true; - } - - private HashMap> fetchPeptidePTMForPeptides(EntityManager entityManagerMSI, ArrayList allPeptidesIds) { + protected static HashMap> fetchPeptidePTMForPeptides(EntityManager entityManagerMSI, ArrayList allPeptidesIds) { PerformanceTest.startTime("fetchPeptidePTMForPeptides"); @@ -680,350 +265,74 @@ private HashMap> fetchPeptidePTMForPeptides(EntityM while (it.hasNext()) { DPeptidePTM ptm = it.next(); Long peptideId = ptm.getIdPeptide(); - ArrayList list = ptmMap.get(peptideId); - if (list == null) { - list = new ArrayList<>(); - ptmMap.put(peptideId, list); - } + ArrayList list = ptmMap.computeIfAbsent(peptideId, k -> new ArrayList<>()); list.add(ptm); } PerformanceTest.stopTime("fetchPeptidePTMForPeptides"); - return ptmMap; } - private boolean fetchAllPTMSitesPeptideMatches() { - PerformanceTest.startTime("fetchAllPTMSitesPeptideMatches"); - - long start = System.currentTimeMillis(); - m_logger.debug(" START fetchAllPTMSitesPeptideMatches task "); - EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); - try { - - //*** Get Best Peptide MatchesProteinMatches - Set allPepIds = m_ptmSitesOutput.stream().flatMap(s -> s.getPeptideIds().stream()).collect(Collectors.toSet()); - m_peptideIds = new ArrayList<>(); - m_peptideIds.addAll(allPepIds); - - SubTask subTask = m_subTaskManager.sliceATaskAndGetFirst(SUB_TASK_PTMSITE_PEPINSTANCES, m_peptideIds.size(), SLICE_SIZE); - fetchPTMSitesPepInstances(subTask, entityManagerMSI); - - long stop = System.currentTimeMillis(); - m_logger.debug(" fetchAllPTMSitesPeptideMatches :{} of {} PTM Sites filled in {} ms", SLICE_SIZE, m_ptmSitesOutput.size(), (stop - start)); - - } catch (Exception e) { - m_logger.error(getClass().getSimpleName() + " failed", e); - m_taskError = new TaskError(e); - try { - entityManagerMSI.getTransaction().rollback(); - } catch (Exception rollbackException) { - m_logger.error(getClass().getSimpleName() + " failed : potential network problem", rollbackException); - } - return false; - } finally { - entityManagerMSI.close(); + public static void /*fetchReadablePTMData*/fillReadablePTMDataForPeptides(EntityManager entityManagerMSI, Long rsetId, HashMap peptideMap, List sliceOfPeptideMatchIds) { + if ((peptideMap == null) || peptideMap.isEmpty()) { + return; } - PerformanceTest.stopTime("fetchAllPTMSitesPeptideMatches"); - - - return true; - } - - private boolean fetchPTMSitesPepInstances(SubTask subTask, EntityManager entityManagerMSI) throws IOException { - List sliceOfPeptideIds = subTask.getSubList(m_peptideIds); - return fetchPTMSitesPepInstances(sliceOfPeptideIds, entityManagerMSI); - } - - private boolean fetchPTMSitesPepInstances(List sliceOfPeptideIds, EntityManager entityManagerMSI) throws IOException { - - PerformanceTest.startTime("fetchPTMSitesPepInstances"); - - long start = System.currentTimeMillis(); - m_logger.debug(" @@ START fetchPTMSitesPepInstances SUBTASK "); - ObjectMapper mapper = new ObjectMapper(); - mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); - - int nbrPepIds = sliceOfPeptideIds.size(); - Long rsetId = m_ptmDataset.getDataset().getResultSetId(); - if(rsetId == null && m_ptmDataset.getDataset().getResultSummary() != null && m_ptmDataset.getDataset().getResultSummary().getResultSet() != null) - rsetId = m_ptmDataset.getDataset().getResultSummary().getResultSet().getId(); - Long dsRsmId = m_ptmDataset.getDataset().getResultSummaryId(); - List allRsmIds = m_ptmDataset.getLeafResultSummaryIds(); - boolean datasetIsLeaf = (allRsmIds.size() == 1 && m_ptmDataset.getLeafResultSummaryIds().get(0).equals(dsRsmId)); - - //Test if dataset is also the leaf dataset - if(!datasetIsLeaf){ - allRsmIds.add(dsRsmId); + if (sliceOfPeptideMatchIds == null) { + sliceOfPeptideMatchIds = new ArrayList<>(peptideMap.keySet()); } - PerformanceTest.startTime("peptidesQuery"); - - Query peptidesQuery = entityManagerMSI.createQuery("SELECT pi.id FROM fr.proline.core.orm.msi.PeptideInstance pi" - + " WHERE pi.peptide.id IN (:peptideIdsList) AND pi.resultSummary.id in (:rmsIds)"); - peptidesQuery.setParameter("peptideIdsList", sliceOfPeptideIds); - peptidesQuery.setParameter("rmsIds", allRsmIds); + // Retrieve PeptideReadablePtmString + Query ptmStingQuery = entityManagerMSI.createQuery("SELECT p.id, ptmString " + + "FROM fr.proline.core.orm.msi.Peptide p, fr.proline.core.orm.msi.PeptideReadablePtmString ptmString " + + "WHERE p.id IN (:listId) AND ptmString.peptide=p AND ptmString.resultSet.id=:rsetId"); + ptmStingQuery.setParameter("listId", sliceOfPeptideMatchIds); + ptmStingQuery.setParameter("rsetId", rsetId); - Iterator itPeptidesQuery = peptidesQuery.getResultList().iterator(); - List peptideInstanceIds = new ArrayList<>(); - while (itPeptidesQuery.hasNext()) { - Long resCur = itPeptidesQuery.next(); - peptideInstanceIds.add(resCur); + List ptmStrings = ptmStingQuery.getResultList(); + Iterator it = ptmStrings.iterator(); + while (it.hasNext()) { + Object[] res = it.next(); + Long peptideId = (Long) res[0]; + PeptideReadablePtmString ptmString = (PeptideReadablePtmString) res[1]; + Peptide peptide = peptideMap.get(peptideId); + peptide.getTransientData().setPeptideReadablePtmString(ptmString); } - - int nbrPepInstIds = peptideInstanceIds.size(); - - PerformanceTest.stopTime("peptidesQuery"); - - long end = System.currentTimeMillis(); - m_logger.debug(" @@ fetchPTMSitesPepInstances: Read "+nbrPepInstIds+" pep instances corresponding to " + nbrPepIds+" peptides in "+(end-start)+" ms" ); - start = end; - - PerformanceTest.startTime("dataQuery"); - - HashMap allPeptidesMap = new HashMap(); - HashMap leafPeptideInstancesById = new HashMap<>(); - HashMap> leafPeptideInstancesByPepId = new HashMap<>(); - Map parentPeptideInstancesByPepId = new HashMap<>(); - //---- Load Peptide Match + Spectrum / MSQuery information for all peptideInstance of PTMSite - Query dataQuery = entityManagerMSI.createQuery("SELECT pm, pi, sm, sp.firstTime, sp.precursorIntensity, sp.title, " - + " msq.id, msq.initialId " - + " FROM fr.proline.core.orm.msi.PeptideInstancePeptideMatchMap pipm, fr.proline.core.orm.msi.PeptideMatch pm, fr.proline.core.orm.msi.PeptideInstance pi, " - + " fr.proline.core.orm.msi.SequenceMatch sm , fr.proline.core.orm.msi.MsQuery msq , fr.proline.core.orm.msi.Spectrum sp " - + " WHERE pipm.id.peptideInstanceId IN ( :peptideInstanceList ) AND pipm.id.peptideInstanceId=pi.id AND pipm.id.peptideMatchId=pm.id " - + " AND sm.id.peptideId = pi.peptide.id AND sm.resultSetId = pm.resultSet.id AND sm.id.peptideId=pm.peptideId AND pm.msQuery.id = msq.id AND msq.spectrum.id = sp.id "); - dataQuery.setParameter("peptideInstanceList", new ArrayList<>(peptideInstanceIds)); - List l = dataQuery.getResultList(); - Iterator itPeptidesMatchesQuery = l.iterator(); - - PerformanceTest.stopTime("dataQuery"); - - //---- Create List of DPeptideMatch (linked to DSpectrum + DMsQuery) from query resumlt - end = System.currentTimeMillis(); - m_logger.debug(" @@ fetchPTMSitesPepInstances: query result size " + l.size()+" in "+(end-start)+" ms" ); - start= end; - - PerformanceTest.startTime("itPeptidesMatchesQuery loop"); - - while (itPeptidesMatchesQuery.hasNext()) { - - - PerformanceTest.startTime("STEP1"); - - Object[] resCur = itPeptidesMatchesQuery.next(); - - PeptideMatch pm = (PeptideMatch) resCur[0]; - PeptideInstance pi = (PeptideInstance) resCur[1]; - SequenceMatch sm = (SequenceMatch) resCur[2]; - Float firstTime = (Float) resCur[3]; - Float precursorIntensity = (Float) resCur[4]; - String spectrumTitle = (String) resCur[5]; - Long msQueryId = (Long) resCur[6]; - Integer msQueryInitialId = (Integer) resCur[7]; - - - PerformanceTest.stopTime("STEP1"); - - PerformanceTest.startTime("STEP2"); - - DSpectrum spectrum = new DSpectrum(); - spectrum.setFirstTime(firstTime); - spectrum.setPrecursorIntensity(precursorIntensity); - spectrum.setTitle(spectrumTitle); - - PerformanceTest.stopTime("STEP2"); - - PerformanceTest.startTime("STEP3"); - - DPeptideMatch dpm = new DPeptideMatch(pm.getId(), pm.getRank(), pm.getCharge(), pm.getDeltaMoz(), pm.getExperimentalMoz(), pm.getMissedCleavage(), pm.getScore(), pm.getResultSet().getId(), pm.getCDPrettyRank(), pm.getSDPrettyRank()); - dpm.setRetentionTime(spectrum.getFirstTime()); - dpm.setSerializedProperties(pm.getSerializedProperties()); - dpm.setSequenceMatch(sm); - - PerformanceTest.stopTime("STEP3"); - - PerformanceTest.startTime("STEP4"); - JsonNode node = mapper.readTree(dpm.getSerializedProperties()); - JsonNode child = node.get("ptm_site_properties"); - DPtmSiteProperties properties = mapper.treeToValue(child, DPtmSiteProperties.class); - dpm.setPtmSiteProperties(properties); - PerformanceTest.stopTime("STEP4"); - - - - - PerformanceTest.startTime("STEP5"); - Peptide p = (Peptide) pi.getPeptide(); - p.getTransientData().setPeptideReadablePtmStringLoaded(); - allPeptidesMap.put(p.getId(), p); + } - DMsQuery msq = new DMsQuery(pm.getId(), msQueryId, msQueryInitialId, spectrum.getPrecursorIntensity()); - msq.setDSpectrum(spectrum); - dpm.setPeptide(p); - dpm.setMsQuery(msq); + public static void /*fetchPTMDataForPeptides*/ fillPeptidePTMForPeptides(EntityManager entityManagerMSI, HashMap peptideMap, List sliceOfPeptideMatchIds) { - PerformanceTest.stopTime("STEP5"); + if (!peptideMap.isEmpty()) { - - PerformanceTest.startTime("STEP6"); - - //TEST IF Leaf or Parent - if(dsRsmId.equals(pi.getResultSummary().getId()) ) { - //PARENT PepInstance - if(!parentPeptideInstancesByPepId.containsKey(p.getId())){ - DPeptideInstance dpi = new DPeptideInstance(pi); - dpi.setResultSummary(pi.getResultSummary()); - dpi.setPeptide(p); - dpi.setPeptideMatches(new ArrayList<>()); - parentPeptideInstancesByPepId.put(p.getId(), dpi); - } - - if (pi.getBestPeptideMatchId() == dpm.getId()) { - parentPeptideInstancesByPepId.get(p.getId()).setBestPeptideMatch(dpm); - } - parentPeptideInstancesByPepId.get(p.getId()).getPeptideMatches().add(dpm); - + if (sliceOfPeptideMatchIds == null) { + sliceOfPeptideMatchIds = new ArrayList<>(peptideMap.keySet()); } - if( (!dsRsmId.equals(pi.getResultSummary().getId())) || datasetIsLeaf ) { - //LEAF PeptideInstance - if (!leafPeptideInstancesByPepId.containsKey(p.getId())) { - leafPeptideInstancesByPepId.put(p.getId(), new ArrayList<>()); - } - List pepInsts = leafPeptideInstancesByPepId.get(p.getId()); - boolean alreadyread = false; - for (DPeptideInstance readPepI : pepInsts) { - if (readPepI.getId() == pi.getId()) { - alreadyread = true; - } - } - if (!alreadyread) { - DPeptideInstance dpi = new DPeptideInstance(pi); - dpi.setResultSummary(pi.getResultSummary()); - dpi.setPeptide(p); - dpi.setPeptideMatches(new ArrayList<>()); - leafPeptideInstancesById.put(dpi.getId(), dpi); - pepInsts.add(dpi); - } - if (pi.getBestPeptideMatchId() == dpm.getId()) { - leafPeptideInstancesById.get(pi.getId()).setBestPeptideMatch(dpm); - } - leafPeptideInstancesById.get(pi.getId()).getPeptideMatches().add(dpm); - } - - PerformanceTest.stopTime("STEP6"); - } - - - - PerformanceTest.stopTime("itPeptidesMatchesQuery loop"); - - end = System.currentTimeMillis(); - m_logger.debug(" @@ fetchPTMSitesPepInstances: Created leafPeptideInstancesById. Nbr : " + leafPeptideInstancesById.size()+" in "+(end-start)+" ms"); - start= end; - - //--- Retrieve PeptideReadablePtmString - - PerformanceTest.startTime("ptmStingQuery"); - - Set allPeptides = allPeptidesMap.keySet(); - Query ptmStingQuery = entityManagerMSI.createQuery("SELECT p.id, ptmString FROM fr.proline.core.orm.msi.Peptide p, fr.proline.core.orm.msi.PeptideReadablePtmString ptmString WHERE p.id IN (:listId) AND ptmString.peptide=p AND ptmString.resultSet.id=:rsetId"); - ptmStingQuery.setParameter("listId", allPeptides); - ptmStingQuery.setParameter("rsetId", rsetId); - List ptmStrings = ptmStingQuery.getResultList(); - Iterator ito = ptmStrings.iterator(); - while (ito.hasNext()) { - Object[] res = ito.next(); - Long peptideId = (Long) res[0]; - PeptideReadablePtmString ptmString = (PeptideReadablePtmString) res[1]; - Peptide peptide = allPeptidesMap.get(peptideId); - peptide.getTransientData().setPeptideReadablePtmString(ptmString); - } + TypedQuery ptmQuery = entityManagerMSI.createQuery("SELECT new fr.proline.core.orm.msi.dto.DPeptidePTM(pptm.peptide.id, pptm.specificity.id, pptm.seqPosition) FROM fr.proline.core.orm.msi.PeptidePtm pptm WHERE pptm.peptide.id IN (:peptideIds)", DPeptidePTM.class); + ptmQuery.setParameter("peptideIds", sliceOfPeptideMatchIds); + List ptmList = ptmQuery.getResultList(); - PerformanceTest.stopTime("ptmStingQuery"); - - PerformanceTest.startTime("fetchGenericPTMData"); - - // fetch Generic PTM Data - fetchGenericPTMData(entityManagerMSI); - - PerformanceTest.stopTime("fetchGenericPTMData"); + Iterator it = ptmList.iterator(); + while (it.hasNext()) { + DPeptidePTM ptm = it.next(); - - PerformanceTest.startTime("fetchPeptidePTMForPeptides"); - - //--- fetch Specific Data for the Peptides Found - HashMap> ptmMap = fetchPeptidePTMForPeptides(entityManagerMSI, new ArrayList(allPeptidesMap.keySet())); + Peptide p = peptideMap.get(ptm.getIdPeptide()); + HashMap map = p.getTransientData().getDPeptidePtmMap(); + if (map == null) { + map = new HashMap<>(); + p.getTransientData().setDPeptidePtmMap(map); + } - PerformanceTest.stopTime("fetchPeptidePTMForPeptides"); - - PerformanceTest.startTime("parentPeptideInstancesByPepId.values().stream().flatMap"); - - List allpeptideMatches = leafPeptideInstancesById.values().stream().flatMap(pi -> pi.getPeptideMatches().stream()).collect(Collectors.toList()); - allpeptideMatches.addAll(parentPeptideInstancesByPepId.values().stream().flatMap(pi -> pi.getPeptideMatches().stream()).collect(Collectors.toList())); - - PerformanceTest.stopTime("parentPeptideInstancesByPepId.values().stream().flatMap"); - - end = System.currentTimeMillis(); - m_logger.debug(" @@ fetchPTMSitesPepInstances got PTM info for all peptideMatches . nbr " + allpeptideMatches.size()+" in "+(end-start)+" ms"); - start= end; - - PerformanceTest.startTime("allpeptideMatches loop"); - - for (DPeptideMatch pm : allpeptideMatches) { - Peptide p = pm.getPeptide(); - Long idPeptide = p.getId(); - ArrayList ptmList = ptmMap.get(idPeptide); - pm.setPeptidePTMArray(ptmList); + map.put((int) ptm.getSeqPosition(), ptm); - HashMap mapToPtm = new HashMap<>(); - if (ptmList != null) { - for (DPeptidePTM peptidePTM : ptmList) { - mapToPtm.put((int) peptidePTM.getSeqPosition(), peptidePTM); - } - p.getTransientData().setDPeptidePtmMap(mapToPtm); } } - - PerformanceTest.stopTime("allpeptideMatches loop"); - m_logger.info(" @@ {} peptides matching to {} peptide matches retrieved", allPeptides.size(), allpeptideMatches.size()); - m_logger.info(" @@ {} peptide instances retrieved", parentPeptideInstancesByPepId.size()); - - PerformanceTest.startTime("m_ptmSitesOutput loop"); - for (PTMSite site : m_ptmSitesOutput) { - //Verify if PTM site has at least one pep in this 'subtask' - List leafPeptideInstances = new ArrayList<>(); - Set parentPeptideInstancesAsSet = new HashSet<>(); - for (Long pepId : site.getPeptideIds()) { - if (leafPeptideInstancesByPepId.containsKey(pepId)) { - leafPeptideInstances.addAll(leafPeptideInstancesByPepId.get(pepId)); - } - if (parentPeptideInstancesByPepId.containsKey(pepId)) { - parentPeptideInstancesAsSet.add(parentPeptideInstancesByPepId.get(pepId)); - } - } - if (!leafPeptideInstances.isEmpty() || !parentPeptideInstancesAsSet.isEmpty()) { - List parentPeptideInstances = new ArrayList<>(); - parentPeptideInstances.addAll(parentPeptideInstancesAsSet); - site.addPeptideInstances(parentPeptideInstances, leafPeptideInstances); - } - } - - PerformanceTest.stopTime("m_ptmSitesOutput loop"); - - end = System.currentTimeMillis(); - m_logger.debug(" @@ END fetchPTMSitesPepInstances subtask "+" in "+(end-start)+" ms"); - - PerformanceTest.stopTime("fetchPTMSitesPepInstances"); - - return true; } } diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabasePeaklistTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabasePeaklistTask.java index d3db07e94..740fcd886 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabasePeaklistTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabasePeaklistTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; import fr.proline.core.orm.msi.Peaklist; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProjectTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProjectTask.java index c6ca32947..7db9394ea 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProjectTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProjectTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinMatchesTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinMatchesTask.java index 2165836b8..eec44461b 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinMatchesTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinMatchesTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinSetsTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinSetsTask.java index 7c2d58992..2145f6055 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinSetsTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinSetsTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinsAndPeptidesTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinsAndPeptidesTask.java index 04bcb19ef..263c72070 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinsAndPeptidesTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinsAndPeptidesTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinsFromProteinSetTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinsFromProteinSetTask.java index 0e80bf75f..079c8fde8 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinsFromProteinSetTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseProteinsFromProteinSetTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRsetProperties.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRsetProperties.java index a81b91d37..32cacf89c 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRsetProperties.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRsetProperties.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRsetTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRsetTask.java index 4a938fcad..400182979 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRsetTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRsetTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRsummaryProperties.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRsummaryProperties.java index 160b92c72..18385aba7 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRsummaryProperties.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRsummaryProperties.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRunsTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRunsTask.java index 53c7d9259..71fcc0587 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRunsTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseRunsTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseVerifySpectrumFromResultSets.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseVerifySpectrumFromResultSets.java index a0318b2f2..5f86dee03 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseVerifySpectrumFromResultSets.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/DatabaseVerifySpectrumFromResultSets.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; import fr.proline.core.orm.util.DStoreCustomPoolConnectorFactory; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/PriorityChangement.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/PriorityChangement.java index 35e9bed2d..1543d3b38 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/PriorityChangement.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/PriorityChangement.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; /** diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/SubTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/SubTask.java index b41b0ce7e..f43185233 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/SubTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/SubTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; import java.util.List; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/SubTaskManager.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/SubTaskManager.java index b9e3e5a5a..1191be482 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/SubTaskManager.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/SubTaskManager.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks; import java.util.ArrayList; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/AdjacencyMatrixData.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/AdjacencyMatrixData.java index 169a72a16..06b0ecfcf 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/AdjacencyMatrixData.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/AdjacencyMatrixData.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks.data; import java.util.ArrayList; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/LightPeptideMatch.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/LightPeptideMatch.java index 07cfdee80..b835887c4 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/LightPeptideMatch.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/LightPeptideMatch.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks.data; /** diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/LightProteinMatch.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/LightProteinMatch.java index e6b99c5f2..fff38220e 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/LightProteinMatch.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/LightProteinMatch.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks.data; public class LightProteinMatch { diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ProjectInfo.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ProjectInfo.java index d3f30e8c3..6d8659274 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ProjectInfo.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ProjectInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/WeakPeptideReference.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/WeakPeptideReference.java index b98c85547..3595c3345 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/WeakPeptideReference.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/WeakPeptideReference.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks.data; import java.util.HashSet; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/AbstractJSONPTMSite.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/AbstractJSONPTMSite.java index 2d798dbae..9a1f5fb29 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/AbstractJSONPTMSite.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/AbstractJSONPTMSite.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks.data.ptm; import java.util.List; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/AggregatedMasterQuantPeptide.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/AggregatedMasterQuantPeptide.java index 93ab90893..82c365564 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/AggregatedMasterQuantPeptide.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/AggregatedMasterQuantPeptide.java @@ -14,14 +14,34 @@ public class AggregatedMasterQuantPeptide extends DMasterQuantPeptide { private final DMasterQuantitationChannel m_masterQC; public AggregatedMasterQuantPeptide(List mqPeptides, DMasterQuantitationChannel masterQC) { + //super(mqPeptides.get(0).getId(), mqPeptides.get(0).getSelectionLevel(), mqPeptides.get(0).getObjectTreeId(), mqPeptides.get(0).getSerializedProperties(), mqPeptides.get(0).getQuantResultSummaryId()); m_mqPeptides = mqPeptides; m_masterQC = masterQC; - for(DQuantitationChannel qc : m_masterQC.getQuantitationChannels()) { + for (DQuantitationChannel qc : m_masterQC.getQuantitationChannels()) { List qPeps = mqPeptides.stream().map(mqp -> mqp.getQuantPeptideByQchIds().get(qc.getId())).filter(qp -> qp != null).collect(Collectors.toList()); if (qPeps != null && !qPeps.isEmpty()) m_quantPeptideByQchIds.put(qc.getId(), new AggregatedQuantPeptide(qPeps)); } } + + public List getAggregatedMQPeptides(){ + return m_mqPeptides; + } +// +// @Override +// public DPeptideInstance getPeptideInstance() { +// return this.m_mqPeptides.get(0).getPeptideInstance(); +// } +// +// @Override +// public long getPeptideInstanceId() { +// return this.m_mqPeptides.get(0).getPeptideInstanceId(); +// } +// +// @Override +// public DPeptideMatch getRepresentativePepMatch() { +// return this.m_mqPeptides.get(0).getRepresentativePepMatch(); +// } } class AggregatedQuantPeptide extends DQuantPeptide { diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMCluster.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMCluster.java index 95d5a57f6..0a3fcda30 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMCluster.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMCluster.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -27,6 +27,15 @@ public class JSONPTMCluster { public Long id; + // + //**** Annotation specific entry + // Idem as for Quanti/Ident: DESELECTED_MANUAL(0) DESELECTED_AUTO(1) SELECTED_AUTO(2) SELECTED_MANUAL(3) + public Integer selectionLevel; + //Notation for selection_level confidence + public Integer selectionConfidence; + //Description for selection_level reason or precision + public String selectionInformation; + // Array of PTM site locations Ids public Long[] ptmSiteLocations; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMDataset.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMDataset.java index 211e37505..8ddaeb317 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMDataset.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMDataset.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks.data.ptm; /** diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMSite.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMSite.java index ffaee424e..06cc69708 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMSite.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMSite.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks.data.ptm; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMSite2.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMSite2.java index f077547bb..6d4929dd2 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMSite2.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/JSONPTMSite2.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks.data.ptm; /** diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMCluster.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMCluster.java index e54616c6c..1cdcd7166 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMCluster.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMCluster.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -38,9 +38,15 @@ public class PTMCluster implements Comparable{ private final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ptm"); private final List m_sites; + private int m_sitesCount; private final List m_peptideIds; private final Long m_id; - private final Float m_localizationConfidence; + private Float m_localizationConfidence; + + private int m_selectionLevel; + private Integer m_selectionNotation; + private String m_selectionInfo; + private List m_positionsOnProtein; private List m_probabilities; @@ -56,24 +62,128 @@ public class PTMCluster implements Comparable{ private final PTMDataset m_ptmDataset; public PTMCluster(JSONPTMCluster jsonValue, PTMDataset ptmds) { - this(jsonValue.id, jsonValue.localizationConfidence, Arrays.asList(jsonValue.ptmSiteLocations), Arrays.asList(jsonValue.peptideIds), ptmds); + this(jsonValue.id, jsonValue.localizationConfidence, jsonValue.selectionLevel,jsonValue.selectionConfidence, jsonValue.selectionInformation, Arrays.asList(jsonValue.ptmSiteLocations), Arrays.asList(jsonValue.peptideIds), ptmds); } - public PTMCluster(Long id, Float confidence, List ptmSiteIds, List peptideIds, PTMDataset ptmds) { + public PTMCluster(Long id, Float confidence, Integer selectionLevel, Integer selectionNotation, String selectionInfo, List ptmSiteIds, List peptideIds, PTMDataset ptmds) { m_ptmDataset = ptmds; - m_peptideIds = peptideIds; + m_peptideIds = new ArrayList<>(); + m_peptideIds.addAll(peptideIds); m_localizationConfidence = confidence; m_sites = m_ptmDataset.getPTMSites().stream().filter(site -> ptmSiteIds.contains(site.getId())).sorted(Comparator.comparing(PTMSite::getPositionOnProtein)).collect(Collectors.toList()); + m_sitesCount = m_sites.size(); m_id = id; + m_selectionLevel = selectionLevel != null ? selectionLevel : 2; + m_selectionNotation = selectionNotation; + m_selectionInfo = selectionInfo != null ? selectionInfo : ""; + if(!m_sites.isEmpty()) { - //Get ProteinMatch from one of the PTMSite : all should have same. VDS TODO To test ? + //Get ProteinMatch from one of the PTMSite : all should have same. m_proteinMatch = m_sites.get(0).getProteinMatch(); m_masterQuantProteinSet = m_sites.get(0).getMasterQuantProteinSet(); } } + public int getSelectionLevel(){ + return m_selectionLevel; + } + + public void setSelectionLevel(int selectionLevel){ + if(selectionLevel < 0 || selectionLevel >3) + throw new IllegalArgumentException("Invalid selection level specified"); + + m_selectionLevel = selectionLevel; + } + + /** + * + * @return PTLCluster status confidence as a positive number. Negative number indicates no notation has been done. + */ + public Integer getSelectionNotation() { + return m_selectionNotation; + } + + public void setSelectionNotation(Integer selectionNotation) { + this.m_selectionNotation = selectionNotation; + } + + /** + * @return Return description of PTMCluster status or empty String if none is defined + */ + public String getSelectionInfo() { + return m_selectionInfo; + } + + public void setSelectionInfo(String selectionInfo) { + this.m_selectionInfo = selectionInfo; + } + + protected void addSites(List newSites){ + boolean listChanged = false; + for(PTMSite s : newSites){ + if(!m_sites.contains(s)) { + m_sites.add(s); + listChanged = true; + } + } + if(listChanged){ + m_positionsOnProtein = null; + m_probabilities = null; + m_parentPTMPeptideInstances = null; + m_leafPTMPeptideInstances = null; + m_parentPeptideInstances = null; + } + } + + protected void addPeptideIds(List newPepIds){ + boolean listChanged = false; + for(Long s : newPepIds){ + if(!m_peptideIds.contains(s)) { + m_peptideIds.add(s); + listChanged = true; + } + } + if(listChanged){ + m_positionsOnProtein = null; + m_probabilities = null; + m_parentPTMPeptideInstances = null; + m_leafPTMPeptideInstances = null; + m_parentPeptideInstances = null; + } + } + + public void removePeptide(PTMPeptideInstance pep){ + if(pep == null) + return; + Long pepId = pep.getPeptideInstance().getPeptideId(); + if(m_peptideIds.contains(pepId)){ + m_peptideIds.remove(pepId); + + //Recalculated MQPep if needed + DMasterQuantPeptide finalClusterMQpep = getRepresentativeMQPepMatch(); + if (finalClusterMQpep != null && finalClusterMQpep instanceof AggregatedMasterQuantPeptide) { + Map mqPepByPepInstId = new HashMap<>(); + ((AggregatedMasterQuantPeptide) finalClusterMQpep).getAggregatedMQPeptides().forEach(mqPep -> { + if(m_peptideIds.contains(mqPep.getPeptideInstance().getPeptideId())) + mqPepByPepInstId.put(mqPep.getPeptideInstanceId(), mqPep); + }); + setRepresentativeMQPepMatch(m_ptmDataset.getRepresentativeMQPeptideForCluster(this, mqPepByPepInstId)); + } else if(finalClusterMQpep != null ) { + //Should not occur + m_logger.warn(" ERROR. PTM Cluster in Quantitation do not used AggregatedMasterQuantPeptide. Unable to create new quantiation values "); + } + + m_parentPTMPeptideInstances = null; + m_leafPTMPeptideInstances = null; + m_parentPeptideInstances = null; + } + } + + protected void setLocalizationConfidence(Float localizationConfidence){ + m_localizationConfidence = localizationConfidence; + } public Long getId() { return m_id; } @@ -216,11 +326,26 @@ public List getSiteConfidences() { public List getPTMSites(){ return m_sites; } + + public Integer getPTMSitesCount(){ + return m_sitesCount; + } + + public void setPTMSitesCount(Integer sitesCount){ + m_sitesCount = sitesCount; + } + + public Integer getPeptideCount() { return m_peptideIds.size(); } - + + + public List getPeptideIds() { + return m_peptideIds; + } + public void setQuantProteinSet(DMasterQuantProteinSet mqps) { m_masterQuantProteinSet = mqps; } @@ -228,7 +353,19 @@ public void setQuantProteinSet(DMasterQuantProteinSet mqps) { public DMasterQuantProteinSet getMasterQuantProteinSet() { return m_masterQuantProteinSet; } - + + @Override + public boolean equals(Object obj) { + if(obj == null) + return false; + + if(! (obj instanceof PTMCluster )) + return false; + + PTMCluster objCluster= (PTMCluster) obj; + return objCluster.m_id.equals(m_id); //ID Should be enough ! && objCluster.m_proteinMatch.equals(m_proteinMatch) && objCluster.m_sites.equals(m_sites); + } + @Override public int compareTo(PTMCluster o) { if(o == null) diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMDataset.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMDataset.java index 3cf9fb3d0..56e9ee5c3 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMDataset.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMDataset.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,24 +16,16 @@ */ package fr.proline.studio.dam.tasks.data.ptm; +import fr.profi.util.StringUtils; import fr.proline.core.orm.msi.SequenceMatch; -import fr.proline.core.orm.msi.dto.DInfoPTM; -import fr.proline.core.orm.msi.dto.DMasterQuantProteinSet; -import fr.proline.core.orm.msi.dto.DPeptideInstance; -import fr.proline.core.orm.msi.dto.DProteinMatch; +import fr.proline.core.orm.msi.dto.*; import fr.proline.core.orm.uds.dto.DDataset; -import java.util.ArrayList; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.*; +import java.util.stream.Collectors; + /** * Represents a set of PTM sites, displayed from a quantification dataset or from an identification dataset. * @@ -46,26 +38,23 @@ public class PTMDataset { private DDataset m_dataset; private List m_proteinPTMSites; - - //data for v2 + private List m_leafRSMIds; // Ids of the Leaf RSM where PTM info are read private List m_ptmOfInterest; // Specified PTM to consider - private List m_ptmClusters; - + private List m_ptmClusters; + //Lists of all PTMPeptideInstance for a specific Peptide and Protein Match : For parent RSM and leaf RSM private final Map>> m_parentPtmPepInstByPepIdByProtMatchId = new HashMap<>(); private final Map>> m_leafPtmPepInstByPepInstIdByProtMatchId = new HashMap<>(); //VDS: to overcome a missing information in ORM : Link between Protein Matches in merged RSM and child RSM private Map> m_allLeafProtMatchesIdPerAccession; - private Boolean m_isVersion2; - + public PTMDataset(DDataset dataset) { if (dataset == null) throw new IllegalArgumentException("dataset from which PTM sites are extracted cannot be null"); this.m_dataset = dataset; - m_isVersion2 = false; m_ptmOfInterest = new ArrayList<>(); } @@ -74,22 +63,15 @@ public DDataset getDataset() { } public List getLeafResultSummaryIds(){ - if(!isVersion2() || m_leafRSMIds == null) - return Collections.emptyList(); - return new ArrayList(m_leafRSMIds); + if(m_leafRSMIds == null) + return Collections.emptyList(); + return new ArrayList<>(m_leafRSMIds); } public void setLeafResultSummaryIds(List l){ m_leafRSMIds = new ArrayList<>(l); } - - public boolean isVersion2(){ - return m_isVersion2; - } - public void setIsVersion2(boolean isV2){ - m_isVersion2 = isV2; - } public boolean isIdentification() { return m_dataset.isIdentification(); @@ -102,13 +84,17 @@ public boolean isQuantitation() { public void addInfoPTM(DInfoPTM ptm){ m_ptmOfInterest.add(ptm); } - + + public List getInfoPTMs(){ + return m_ptmOfInterest; + } + public List getPTMSites() { return m_proteinPTMSites; } public void setPTMSites(List proteinPTMSites) { - proteinPTMSites.stream().forEach(site -> site.setDataset(this)); + proteinPTMSites.forEach(site -> site.setDataset(this)); this.m_proteinPTMSites = proteinPTMSites; } @@ -116,17 +102,73 @@ public List getPTMClusters() { return m_ptmClusters; } - public void setPTMClusters(List ptmClusters) { + public PTMCluster getPTMCluster(Long clusterId) { + Optional clusterOp = m_ptmClusters.stream().filter(c -> c.getId().equals(clusterId)).findFirst(); + if(clusterOp.isPresent()) + return clusterOp.get(); + else + return null; + } + + +// +// public List getSiteAsPTMClusters() { +// Map> clustersPerSite = new HashMap<>(); +// for(PTMCluster c : m_ptmClusters){ +// for(PTMSite site : c.getPTMSites() ){ +// List clusters = clustersPerSite.computeIfAbsent(site, k -> new ArrayList<>()); +// clusters.add(c); +// } +// } +// +// if(m_ptmSiteAsClusters == null){ +// m_ptmSiteAsClusters = new ArrayList<>(); +// for (PTMSite site: m_proteinPTMSites) { +// PTMCluster ptmCluster = new PTMCluster(site.getId(), site.getLocalisationConfidence(), Collections.singletonList(site.getId()), site.getPeptideIds() , this); +// if (ptmCluster.getPTMSites() == null || ptmCluster.getPTMSites().isEmpty()) { +// continue; +// } +// DPeptideMatch bestPepMatch = site.getMostConfidentPepMatch(); +// ptmCluster.setRepresentativePepMatch(bestPepMatch); +// +// if(isQuantitation()) { +// ptmCluster.setQuantProteinSet(site.getMasterQuantProteinSet()); +// +// Long bestPepMatchPepId = bestPepMatch.getPeptide().getId(); +// if(clustersPerSite.containsKey(site)) { +// for (PTMCluster cl : clustersPerSite.get(site)) { +// Long clPepId = null; +// if (cl.getRepresentativeMQPepMatch() != null && cl.getRepresentativeMQPepMatch().getPeptideInstance() != null) { +// clPepId = cl.getRepresentativeMQPepMatch().getPeptideInstance().getPeptideId(); +// } else if (cl.getRepresentativeMQPepMatch() != null && cl.getRepresentativeMQPepMatch().getRepresentativePepMatch() != null && cl.getRepresentativeMQPepMatch().getRepresentativePepMatch().getPeptide() != null) { +// clPepId = cl.getRepresentativeMQPepMatch().getRepresentativePepMatch().getPeptide().getId(); +// } +// +// if (clPepId != null && clPepId.equals(bestPepMatchPepId)) { +// DMasterQuantPeptide mqPep = cl.getRepresentativeMQPepMatch(); +// ptmCluster.setRepresentativeMQPepMatch(mqPep); +// break; +// } +// } +// } +// if(ptmCluster.getRepresentativeMQPepMatch() == null){ +// LOG.warn(" In QUANT Dataset did not found getRepresentativeMQPepMatch for siteAscluster id "+ptmCluster.getId()); +// } +// +// } +// m_ptmSiteAsClusters.add(ptmCluster); +// } +// } +// return m_ptmSiteAsClusters; +// } + + public void setPTMClusters(List ptmClusters) { this.m_ptmClusters = ptmClusters; } public PTMSite getPTMSite(Long id){ - if(!isVersion2()) - return null; - else { - Optional ptmSite = m_proteinPTMSites.stream().filter(site -> site.getId().equals(id)).findFirst(); - return ptmSite.orElse(null); - } + Optional ptmSite = m_proteinPTMSites.stream().filter(site -> site.getId().equals(id)).findFirst(); + return ptmSite.orElse(null); } public void setQuantProteinSets(List masterQuantProteinSetList, Map typicalProteinMatchIdByProteinMatchId) { @@ -153,7 +195,12 @@ public void setQuantProteinSets(List masterQuantProteinS } } - + public boolean isQuantDataLoaded(){ + if(m_ptmClusters == null || m_ptmClusters.isEmpty()) + return false; + return (m_ptmClusters.get(0).getMasterQuantProteinSet() != null); + } + /** * Get all PTMPeptideInstance defined for specified protein match Id and peptide instance. * The returned PTMPeptideInstance correspond to parent PTMPeptideInstance @@ -167,7 +214,7 @@ public List getLeafPTMPeptideInstances(Long proteinMatchId, if(m != null) return m.get(pepInstId); else - return Collections.EMPTY_LIST; + return Collections.emptyList(); } public void addLeafPTMPeptideInstance(PTMPeptideInstance pepInst, Long proteinMatchId){ @@ -200,9 +247,9 @@ public void addLeafPTMPeptideInstance(PTMPeptideInstance pepInst, Long proteinMa public Collection getPTMPeptideInstances(Long proteinMatchId) { Map> m = m_parentPtmPepInstByPepIdByProtMatchId.get(proteinMatchId); if(m != null) - return m.values().stream().flatMap(entry -> entry.stream()).collect(Collectors.toList()); + return m.values().stream().flatMap(Collection::stream).collect(Collectors.toList()); else - return Collections.EMPTY_LIST; + return Collections.emptyList(); } @@ -237,7 +284,7 @@ public PTMPeptideInstance getPTMPeptideInstance(DProteinMatch proteinMatch, DPep //Get correct start position if(peptideInstance.getPeptideMatches() != null){ - List pepInsSequenceMatches = peptideInstance.getPeptideMatches().stream().map(pepM -> pepM.getSequenceMatch()).collect(Collectors.toList()); + List pepInsSequenceMatches = peptideInstance.getPeptideMatches().stream().map(DPeptideMatch::getSequenceMatch).collect(Collectors.toList()); for(SequenceMatch sm : pepInsSequenceMatches){ if(protPosition >= sm.getId().getStart() && protPosition <= sm.getId().getStop()){ //found correct sm @@ -256,11 +303,21 @@ public PTMPeptideInstance getPTMPeptideInstance(DProteinMatch proteinMatch, DPep return foundPtmPepIns; } - public void updateParentPTMPeptideInstanceClusters(){ + protected void updateParentPTMPeptideInstanceClusters(boolean updateSiteCount){ if(m_ptmClusters != null && !m_ptmClusters.isEmpty()){ m_ptmClusters.forEach( ptmC -> { + final Integer[] siteCount = {ptmC.getPTMSitesCount()}; List ptmPepInsForCluster = ptmC.getParentPTMPeptideInstances(); - ptmPepInsForCluster.forEach( peI -> peI.addCluster(ptmC)); + ptmPepInsForCluster.forEach( + peI -> { + peI.addCluster(ptmC); + if(updateSiteCount) { + Long peISiteCount = peI.getPTMSites().stream().filter(ptmSite -> m_ptmOfInterest.contains(ptmSite.getPTMSpecificity())).count(); + if (siteCount[0] < peISiteCount) + siteCount[0] = peISiteCount.intValue(); + } + }); + ptmC.setPTMSitesCount(siteCount[0]); } ); } @@ -273,5 +330,256 @@ public void setLeafProtMatchesIdPerAccession(Map> allProtMatc public List getProtMatchesIdForAccession(String protMatcherAccession){ return m_allLeafProtMatchesIdPerAccession.getOrDefault(protMatcherAccession, new ArrayList<>()); } - + + public List getColocatedClusters(PTMCluster cluster){ + + ArrayList colocatedClusters = new ArrayList(); + DProteinMatch pmatch = cluster.getProteinMatch(); + + int minStart = -1; + int maxEnd = -1; + try { + minStart = cluster.getParentPTMPeptideInstances().stream().map(pi -> pi.getStartPosition()).min(Comparator.naturalOrder()).get(); + maxEnd = cluster.getParentPTMPeptideInstances().stream().map(pi -> pi.getStopPosition()).max(Comparator.naturalOrder()).get(); + }catch (NoSuchElementException e){ + LOG.error("Errpr getting peptides min/max bounds for cluster",e ); + return colocatedClusters; + } + + for(PTMCluster c : this.m_ptmClusters){ + if(c.getProteinMatch().equals(pmatch)) { + if(c.getParentPTMPeptideInstances() != null) { + int clMinStart = c.getParentPTMPeptideInstances().stream().map(pi -> pi.getStartPosition()).min(Comparator.naturalOrder()).get(); + int clMaxEnd = c.getParentPTMPeptideInstances().stream().map(pi -> pi.getStopPosition()).max(Comparator.naturalOrder()).get(); + if( ( minStart <= clMinStart && clMinStart < maxEnd ) || ( minStart <= clMaxEnd && clMaxEnd <= maxEnd ) || ( clMinStart <= minStart && minStart < clMaxEnd )) + colocatedClusters.add(c); + } + } + } + return colocatedClusters; + } + + private boolean areColocalized(PTMCluster firstCluster, PTMCluster secondCluster){ + if(firstCluster == null || secondCluster == null) + return false; + + DProteinMatch pmatch = firstCluster.getProteinMatch(); + if(!pmatch.equals(secondCluster.getProteinMatch())) + return false; + + //Get first cluster bounds + int minStart = -1; + int maxEnd = -1; + try { + minStart = firstCluster.getParentPTMPeptideInstances().stream().map(pi -> pi.getStartPosition()).min(Comparator.naturalOrder()).get(); + maxEnd = firstCluster.getParentPTMPeptideInstances().stream().map(pi -> pi.getStopPosition()).max(Comparator.naturalOrder()).get(); + }catch (NoSuchElementException e){ + LOG.error("Error getting peptides min/max bounds for cluster",e ); + return false; + } + + if(secondCluster.getParentPTMPeptideInstances() != null) { + int clMinStart = secondCluster.getParentPTMPeptideInstances().stream().map(pi -> pi.getStartPosition()).min(Comparator.naturalOrder()).get(); + int clMaxEnd = secondCluster.getParentPTMPeptideInstances().stream().map(pi -> pi.getStopPosition()).max(Comparator.naturalOrder()).get(); + if( ( minStart <= clMinStart && clMinStart < maxEnd ) || ( minStart <= clMaxEnd && clMaxEnd <= maxEnd ) || ( clMinStart <= minStart && minStart < clMaxEnd )) + return true; + } + + + return false; + } + + public boolean mergeClusters(List clusters2Merge){ + + if(clusters2Merge == null || clusters2Merge.size() <= 1) + return false; + + List finalClusters2Merge = clusters2Merge.stream().filter( c -> c.getSelectionLevel()>=2).collect(Collectors.toList()); + if(finalClusters2Merge.size() <= 1) + return false; + + PTMCluster firstCluster = finalClusters2Merge.get(0); + finalClusters2Merge = finalClusters2Merge.stream().filter( c -> areColocalized(firstCluster, c)).collect(Collectors.toList()); + + if(finalClusters2Merge.size() <= 1) + return false; + + List siteIds = firstCluster.getPTMSites().stream().map(PTMSite::getId).collect(Collectors.toList()); + String firstClusterAnnot = firstCluster.getSelectionInfo(); + PTMCluster mergedCluster = new PTMCluster(firstCluster.getId(), firstCluster.getLocalizationConfidence(), firstCluster.getSelectionLevel(), + firstCluster.getSelectionNotation(), firstClusterAnnot, siteIds, firstCluster.getPeptideIds(), this); + mergedCluster.setRepresentativePepMatch(firstCluster.getRepresentativePepMatch()); + + StringBuilder selectionInfoSB = new StringBuilder(); + if(StringUtils.isNotEmpty(firstClusterAnnot)){ + selectionInfoSB.append(firstClusterAnnot).append("; "); + } + selectionInfoSB.append("Merged clusters : "); + selectionInfoSB.append(firstCluster.getId()).append("; "); + + //If Quant Data, Get data to calculate MqPeptide for merged + //Warning : assume cluster representative MQPepMatch is an AggregatedMasterQuantPeptide ! + Map mqPepByPepInstId = new HashMap<>(); + if(isQuantitation()) { + DMasterQuantPeptide finalClusterMQpep = firstCluster.getRepresentativeMQPepMatch(); + if (finalClusterMQpep instanceof AggregatedMasterQuantPeptide) { + ((AggregatedMasterQuantPeptide) finalClusterMQpep).getAggregatedMQPeptides().forEach(mqPep -> { + mqPepByPepInstId.put(mqPep.getPeptideInstanceId(), mqPep); + }); + } else { + //Should not occur + mqPepByPepInstId.put(finalClusterMQpep.getPeptideInstanceId(), finalClusterMQpep); + } + } + + // Go through Clusters and merge data into 'mergedCluster', if next cluster is colocated with first one ! + for(int i=1; i currentPepM.getPtmSiteProperties().getMascotDeltaScore()){ + mergedCluster.setRepresentativePepMatch(nextPepM); + } + + } else { + if(nextPepM.getPtmSiteProperties() !=null && nextPepM.getPtmSiteProperties().getMascotDeltaScore() != null){ + mergedCluster.setRepresentativePepMatch(nextPepM); + } + } + + //For all cluster ptmPeptideInstance, change associated cluster to merged one + nextCluster.getParentPTMPeptideInstances().forEach(ptmPepI -> { + ptmPepI.addCluster(mergedCluster); + ptmPepI.removeCluster(nextCluster); + }); + + nextCluster.getLeafPTMPeptideInstances().forEach(ptmPepI -> { + ptmPepI.addCluster(mergedCluster); + ptmPepI.removeCluster(nextCluster); + }); + + + // If Quanti data get quant information to calculated new adundance + if(isQuantitation()) { + DMasterQuantPeptide nextClusterMQpep = nextCluster.getRepresentativeMQPepMatch(); + if (nextClusterMQpep instanceof AggregatedMasterQuantPeptide) { + ((AggregatedMasterQuantPeptide) nextClusterMQpep).getAggregatedMQPeptides().forEach(mqPep -> { + if (!mqPepByPepInstId.containsKey(mqPep.getPeptideInstance().getPeptideId())) + mqPepByPepInstId.put(mqPep.getPeptideInstanceId(), mqPep); + }); + } else { + //Should not occur + mqPepByPepInstId.put(nextClusterMQpep.getPeptideInstanceId(), nextClusterMQpep); + } + } + + } //End go through clusters + + if(isQuantitation()) + mergedCluster.setRepresentativeMQPepMatch(getRepresentativeMQPeptideForCluster(mergedCluster, mqPepByPepInstId)); + + mergedCluster.setSelectionInfo(selectionInfoSB.toString()); + int index = m_ptmClusters.indexOf(firstCluster); + m_ptmClusters.removeAll(finalClusters2Merge); + m_ptmClusters.add(index, mergedCluster); + return true; + } + + public JSONPTMDataset createJSONPTMDataset() throws IllegalAccessException { + JSONPTMDataset ptmDS = new JSONPTMDataset(); + + List ptmInfos = getInfoPTMs(); + List ptmInfoIds = new ArrayList<>(); + for(int i=0 ; i leafRsmIds =getLeafResultSummaryIds(); + Long[] rsmIds = new Long[leafRsmIds.size()]; + for(int i=0 ; i allSites = getPTMSites(); + JSONPTMSite2[] allJSONSites = new JSONPTMSite2[allSites.size()]; + for(int i=0 ; i allClusters = getPTMClusters(); + JSONPTMCluster[] allJSONClusters = new JSONPTMCluster[allClusters.size()]; + for(int i=0 ; i mqPepByPepInstId ){ + DMasterQuantPeptide bestMQPep = null; + + if (cluster.getMasterQuantProteinSet() != null) { + + // Get Parent DPeptideInstance + List parentPeptideInstances = cluster.getParentPeptideInstances(); + + // + // Sum of peptides + List mqPeps = parentPeptideInstances.stream().map(parentPepI -> mqPepByPepInstId.get(parentPepI.getId())).filter(Objects::nonNull).collect(Collectors.toList()); + bestMQPep = new AggregatedMasterQuantPeptide(mqPeps, m_dataset.getMasterQuantitationChannels().get(0)); + } + return bestMQPep; + } } diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMDatasetPair.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMDatasetPair.java new file mode 100644 index 000000000..c9a431432 --- /dev/null +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMDatasetPair.java @@ -0,0 +1,62 @@ +package fr.proline.studio.dam.tasks.data.ptm; + +import fr.proline.core.orm.uds.dto.DDataset; + +public class PTMDatasetPair { + + private PTMDataset m_sitePTMDataset; + private PTMDataset m_clusterPTMDataset; + private int m_ptmDatasetType; + private boolean m_shouldSave = false; + + public static int RAW_PTM_DATASET= 0; + public static int ANNOTATED_PTM_DATASET= 1; + + public PTMDatasetPair(PTMDataset sitePTMDataset, PTMDataset clusterPTMDataset) { + this(sitePTMDataset, clusterPTMDataset, false); + } + + public PTMDatasetPair(PTMDataset sitePTMDataset, PTMDataset clusterPTMDataset, boolean isAnnotated) { + if(sitePTMDataset == null || clusterPTMDataset == null) + throw new IllegalArgumentException("PTMDatasets should not be null"); + m_sitePTMDataset = sitePTMDataset; + m_clusterPTMDataset = clusterPTMDataset; + m_ptmDatasetType = isAnnotated ? ANNOTATED_PTM_DATASET : RAW_PTM_DATASET; + } + + + public boolean shouldSavePTMDataset(){ + return m_shouldSave; + } + + public void setShouldSavePTMDataset(boolean shouldSave){ + m_shouldSave = shouldSave; + } + + + public DDataset getDataset() { + return m_clusterPTMDataset.getDataset(); + } + + public PTMDataset getSitePTMDataset() { + return m_sitePTMDataset; + } + + public PTMDataset getClusterPTMDataset() { + return m_clusterPTMDataset; + } + + public void updateParentPTMPeptideInstanceClusters(){ + m_sitePTMDataset.updateParentPTMPeptideInstanceClusters(false); + m_clusterPTMDataset.updateParentPTMPeptideInstanceClusters(true); + } + + public int getPTMDatasetType() { + return m_ptmDatasetType; + } + + public void changePTMDatasetType(int datasetType) { + if(datasetType == ANNOTATED_PTM_DATASET || datasetType == RAW_PTM_DATASET ) + m_ptmDatasetType = datasetType; + } +} diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMPeptideInstance.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMPeptideInstance.java index 9c9cca183..9a12f3e5a 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMPeptideInstance.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMPeptideInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -81,7 +81,11 @@ public List getPTMSites() { public void addCluster(PTMCluster cluster){ m_clusters.add(cluster); } - + + public void removeCluster(PTMCluster cluster){ + m_clusters.remove(cluster); + } + public List getClusters(){ return m_clusters; } @@ -96,13 +100,13 @@ public DPeptideMatch getRepresentativePepMatch(List clusters) { return matchingClusters.isEmpty() ? null : _getRepresentativePepMatch(matchingClusters); } - public DPeptideMatch _getRepresentativePepMatch(List clusters) { + private DPeptideMatch _getRepresentativePepMatch(List clusters) { //TODO: to be improved in case of searching the representative PSM for multiple clusters simultaneously if (clusters.size() > 1) { m_logger.debug("searching a representative PSM for multiple clusters simultaneously not yet implemented: use only the first cluster"); } - PTMCluster cluster = m_clusters.get(0); + PTMCluster cluster = clusters.get(0); DPeptideMatch pepMatch = null; //Try using ptmSite PTMSitePeptideInstance @@ -120,7 +124,8 @@ public DPeptideMatch _getRepresentativePepMatch(List clusters) { public List getPepMatchesOnProteinMatch(DProteinMatch proteinMatch) { List pepMatches = new ArrayList<>(); - List allowedProtMatchIds = m_sites.get(0).getPTMdataset().getProtMatchesIdForAccession(proteinMatch.getAccession()); + String accession = proteinMatch==null ? null : proteinMatch.getAccession(); + List allowedProtMatchIds = m_sites.get(0).getPTMdataset().getProtMatchesIdForAccession(accession); pepMatches.addAll(m_peptideInstance.getPeptideMatches().stream().filter(dpm -> allowedProtMatchIds.contains(dpm.getSequenceMatch().getId().getProteinMatchId())).collect(Collectors.toList())); return pepMatches; } diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMSite.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMSite.java index 40d7f440e..8288f6d27 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMSite.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMSite.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -63,7 +63,11 @@ public PTMSite(AbstractJSONPTMSite jsonSite, DProteinMatch proteinMatch) { public Long getId(){ return m_id; } - + + public AbstractJSONPTMSite getJSONPtmSite(){ + return m_site; + } + @Override public String toString() { StringBuilder builder = new StringBuilder(); @@ -105,20 +109,20 @@ public void setPTMSpecificity(DInfoPTM specificity) { public DInfoPTM getPTMSpecificity() { return m_ptmSpecificity; } - - /** - * With leafInstances, we can create a map of leafPepInstanceByPepId - * For each peptide found in parentPeptideInstances, we instantiate a PTMPeptideInstance, set it's start postion. - * With the peptideId, we can find all of it's leafPeptide, so that a new PTMSitePeptideInstance is create. - * at last, we put this PTMSitePeptideInstance in the m_ptmSitePeptideInstanceByPepId. - * @param parentPeptideInstances - * @param leafInstances - */ - public void setPeptideInstances(List parentPeptideInstances, List leafInstances) { - m_parentPeptideInstances = parentPeptideInstances; - m_ptmSitePeptideInstanceByPepId = new HashMap<>(); - linkPeptideInstances(parentPeptideInstances, leafInstances); - } +// +// /** +// * With leafInstances, we can create a map of leafPepInstanceByPepId +// * For each peptide found in parentPeptideInstances, we instantiate a PTMPeptideInstance, set it's start postion. +// * With the peptideId, we can find all of it's leafPeptide, so that a new PTMSitePeptideInstance is create. +// * at last, we put this PTMSitePeptideInstance in the m_ptmSitePeptideInstanceByPepId. +// * @param parentPeptideInstances +// * @param leafInstances +// */ +// public void setPeptideInstances(List parentPeptideInstances, List leafInstances) { +// m_parentPeptideInstances = parentPeptideInstances; +// m_ptmSitePeptideInstanceByPepId = new HashMap<>(); +// linkPeptideInstances(parentPeptideInstances, leafInstances); +// } public void addPeptideInstances(List parentPeptideInstances, List leafInstances) { if(m_parentPeptideInstances ==null) @@ -185,8 +189,7 @@ private DPeptideMatch getMostConfidentPepMatch(List peptideIns proba = pepMatch.getPtmSiteProperties().getMascotProbabilityBySite().get(m_ptmSpecificity.toOtherReadablePtmString(position)); } //END VDS Workaround - - if (proba > bestProba[0]) { + if (proba != null && proba > bestProba[0]) { bestPM[0] = pepMatch; bestProba[0] = proba; } @@ -229,6 +232,23 @@ public String toProteinReadablePtmString() { return builder.toString(); } + public String peptideSpecificReadablePtmString(Long peptideId) { + + Integer pepPosition = getPositionOnPeptide(peptideId); + StringBuilder builder = new StringBuilder(); + if (m_ptmSpecificity != null) { + builder.append(m_ptmSpecificity.getPtmShortName()).append("("); + if (m_ptmSpecificity.getLocationSpecificity().equals("Anywhere")) { + builder.append(m_ptmSpecificity.getResidueAASpecificity()); + } else { + builder.append(m_ptmSpecificity.getLocationSpecificity()); + } + builder.append(pepPosition).append(")"); + } else { + builder.append("PTM ID").append(m_site.ptmDefinitionId).append("-").append(pepPosition); + } + return builder.toString(); + } public String toReadablePtmString(Long peptideId) { return m_ptmSpecificity.toReadablePtmString(getPositionOnPeptide(peptideId)); diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMSitePeptideInstance.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMSitePeptideInstance.java index 9551fc9c1..6b0da441d 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMSitePeptideInstance.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/data/ptm/PTMSitePeptideInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/DatabaseLoadLcMSTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/DatabaseLoadLcMSTask.java index 4bb893630..87d19ed8f 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/DatabaseLoadLcMSTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/DatabaseLoadLcMSTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -48,98 +48,100 @@ public class DatabaseLoadLcMSTask extends AbstractDatabaseSlicerTask { // used to slice the task in sub tasks private static final int SLICE_SIZE = 300; - // different possible subtasks - public static final int SUB_TASK_COUNT_MAP = 0; // <<----- get in sync - public static final int SUB_TASK_COUNT_PEAKEL = 1; // <<----- get in sync - public static final int SUB_TASK_PEAKEL = 0; - public static final int SUB_TASK_COUNT_FEATURE = 1; // <<----- get in sync - public static final int SUB_TASK_FEATURE = 0; - public static final int SUB_TASK_COUNT_MASTER_FEATURE = 0; // <<----- get in sync - public static final int SUB_TASK_COUNT_CHILD_FEATURE = 0; // <<----- get in sync - public static final int SUB_TASK_COUNT_PEAKEL_FOR_FEATURE = 1;// <<----- get in sync - public static final int SUB_TASK_PEAKEL_FOR_FEATURE = 0; - public static final int SUB_TASK_COUNT_MASTER_PEPTIDE_ION_WITH_PEAKELS = 0; // <<----- get in sync - public static final int SUB_TASK_MAP_ALIGNMENT = 0; // <<----- get in sync - - private Long m_projectId; + private Long m_projectId; private DDataset m_dataset; - private Map m_map; - private List m_mapList; - private List m_peakelList; - private List m_featureList; - private DMasterQuantPeptide m_masterQuantPeptide; - private Feature m_masterFeature; - private List m_masterFeatureList; +// private Map m_map; +// private List m_mapList; +// private List m_peakelList; +// private List m_featureList; +// private DMasterQuantPeptide m_masterQuantPeptide; +// private Feature m_masterFeature; +// private List m_masterFeatureList; private DMasterQuantPeptideIon m_masterQuantPeptideIon; private DQuantitationChannel[] m_quantChannels; private List m_childFeatureList; - private List m_childFeatureListForMaster; +// private List m_childFeatureListForMaster; private Feature m_childFeature; private List m_peakelForChildFeatureList; private List> m_peakelListPerFeature; // data kept for sub tasks - private List m_peakelIds = null; - private List m_featureIds = null; +// private List m_peakelIds = null; +// private List m_featureIds = null; private List m_peakelForFeatureIds = null; private int action; - private static final int LOAD_MAP_FOR_XIC = 0; - private static final int LOAD_PEAKELS_FOR_MAP = 1; - private static final int LOAD_FEATURES_FOR_MAP = 2; - private static final int LOAD_MASTER_FEATURE_FOR_PEPTIDE = 3; - private static final int LOAD_FEATURE_FOR_MASTER = 4; +// private static final int LOAD_MAP_FOR_XIC = 0; +// private static final int LOAD_PEAKELS_FOR_MAP = 1; +// private static final int LOAD_FEATURES_FOR_MAP = 2; +// private static final int LOAD_MASTER_FEATURE_FOR_PEPTIDE = 3; +// private static final int LOAD_FEATURE_FOR_MASTER = 4; + private static final int LOAD_PEAKELS_FOR_FEATURE = 5; private static final int LOAD_FEATURE_FOR_PEPTIDE_ION_WITH_PEAKELS = 6; private static final int LOAD_ALIGNMENT_FOR_XIC = 7; - public DatabaseLoadLcMSTask(AbstractDatabaseCallback callback) { - super(callback); - } - - public void initLoadMapForXic(long projectId, DDataset dataset, List mapList) { - init(SUB_TASK_COUNT_MAP, new TaskInfo("Load Maps of XIC " + dataset.getName(), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); - m_projectId = projectId; - m_dataset = dataset; - m_mapList = mapList; - action = LOAD_MAP_FOR_XIC; - } - - public void initLoadPeakelForMap(long projectId, Map map, List peakelList) { - init(SUB_TASK_COUNT_PEAKEL, new TaskInfo("Load Peakels of Map " + (map == null ? "" : map.getName()), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); - m_projectId = projectId; - m_map = map; - m_peakelList = peakelList; - action = LOAD_PEAKELS_FOR_MAP; - } + // different possible subtasks + public static final int SUB_TASK_COUNT_MAP = 0; // <<----- get in sync +// public static final int SUB_TASK_COUNT_PEAKEL = 1; // <<----- get in sync +// public static final int SUB_TASK_PEAKEL = 0; +// public static final int SUB_TASK_COUNT_FEATURE = 1; // <<----- get in sync +// public static final int SUB_TASK_FEATURE = 0; +// public static final int SUB_TASK_COUNT_MASTER_FEATURE = 0; // <<----- get in sync + public static final int SUB_TASK_COUNT_CHILD_FEATURE = 0; // <<----- get in sync + public static final int SUB_TASK_COUNT_PEAKEL_FOR_FEATURE = 1;// <<----- get in sync + public static final int SUB_TASK_PEAKEL_FOR_FEATURE = 0; +// public static final int SUB_TASK_COUNT_MASTER_PEPTIDE_ION_WITH_PEAKELS = 0; // <<----- get in sync +// public static final int SUB_TASK_MAP_ALIGNMENT = 0; // <<----- get in sync - public void initLoadFeatureForMap(long projectId, Map map, List featureList) { - init(SUB_TASK_COUNT_FEATURE, new TaskInfo("Load Features of Map " + (map == null ? "" : map.getName()), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); - m_projectId = projectId; - m_map = map; - m_featureList = featureList; - action = LOAD_FEATURES_FOR_MAP; - } - public void initLoadMasterFeatureForPeptide(long projectId, DMasterQuantPeptide masterQuantPeptide, List masterFeatureList) { - String peptideName = ""; - if (masterQuantPeptide != null && masterQuantPeptide.getPeptideInstance() != null && masterQuantPeptide.getPeptideInstance().getPeptide() != null) { - peptideName = masterQuantPeptide.getPeptideInstance().getPeptide().getSequence(); - } - init(SUB_TASK_COUNT_MASTER_FEATURE, new TaskInfo("Load Master Features for Peptide " + peptideName, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); - m_projectId = projectId; - m_masterQuantPeptide = masterQuantPeptide; - m_masterFeatureList = masterFeatureList; - action = LOAD_MASTER_FEATURE_FOR_PEPTIDE; + public DatabaseLoadLcMSTask(AbstractDatabaseCallback callback) { + super(callback); } - public void initLoadChildFeatureForMasterFeature(long projectId, Feature masterFeature, List childFeatureList) { - init(SUB_TASK_COUNT_CHILD_FEATURE, new TaskInfo("Load Child Features for Master Feature " + (masterFeature == null ? "" : (masterFeature.getElutionTime())), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); - m_projectId = projectId; - m_masterFeature = masterFeature; - m_childFeatureListForMaster = childFeatureList; - action = LOAD_FEATURE_FOR_MASTER; - } +// public void initLoadMapForXic(long projectId, DDataset dataset, List mapList) { +// init(SUB_TASK_COUNT_MAP, new TaskInfo("Load Maps of XIC " + dataset.getName(), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); +// m_projectId = projectId; +// m_dataset = dataset; +// m_mapList = mapList; +// action = LOAD_MAP_FOR_XIC; +// } +// +// public void initLoadPeakelForMap(long projectId, Map map, List peakelList) { +// init(SUB_TASK_COUNT_PEAKEL, new TaskInfo("Load Peakels of Map " + (map == null ? "" : map.getName()), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); +// m_projectId = projectId; +// m_map = map; +// m_peakelList = peakelList; +// action = LOAD_PEAKELS_FOR_MAP; +// } +// +// public void initLoadFeatureForMap(long projectId, Map map, List featureList) { +// init(SUB_TASK_COUNT_FEATURE, new TaskInfo("Load Features of Map " + (map == null ? "" : map.getName()), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); +// m_projectId = projectId; +// m_map = map; +// m_featureList = featureList; +// action = LOAD_FEATURES_FOR_MAP; +// } +// +// public void initLoadMasterFeatureForPeptide(long projectId, DMasterQuantPeptide masterQuantPeptide, List masterFeatureList) { +// String peptideName = ""; +// if (masterQuantPeptide != null && masterQuantPeptide.getPeptideInstance() != null && masterQuantPeptide.getPeptideInstance().getPeptide() != null) { +// peptideName = masterQuantPeptide.getPeptideInstance().getPeptide().getSequence(); +// } +// init(SUB_TASK_COUNT_MASTER_FEATURE, new TaskInfo("Load Master Features for Peptide " + peptideName, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); +// m_projectId = projectId; +// m_masterQuantPeptide = masterQuantPeptide; +// m_masterFeatureList = masterFeatureList; +// action = LOAD_MASTER_FEATURE_FOR_PEPTIDE; +// } +// +// public void initLoadChildFeatureForMasterFeature(long projectId, Feature masterFeature, List childFeatureList) { +// init(SUB_TASK_COUNT_CHILD_FEATURE, new TaskInfo("Load Child Features for Master Feature " + (masterFeature == null ? "" : (masterFeature.getElutionTime())), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); +// m_projectId = projectId; +// m_masterFeature = masterFeature; +// m_childFeatureListForMaster = childFeatureList; +// action = LOAD_FEATURE_FOR_MASTER; +// } public void initLoadChildFeatureForPeptideIonWithPeakel(long projectId, DMasterQuantPeptideIon masterQuantPeptideIon, DQuantitationChannel[] quantChannels, List childFeatureList, List> peakelListPerFeature, DDataset dataset) { init(SUB_TASK_COUNT_CHILD_FEATURE, new TaskInfo("Load Child Features + peakels for PeptideIon " + (masterQuantPeptideIon == null ? "" : (masterQuantPeptideIon.getId())), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); @@ -172,21 +174,21 @@ public void initLoadAlignmentForXic(long projectId, DDataset dataset) { public void abortTask() { super.abortTask(); switch (action) { - case LOAD_MAP_FOR_XIC: - m_mapList = null; - break; - case LOAD_PEAKELS_FOR_MAP: - m_peakelList = null; - break; - case LOAD_FEATURES_FOR_MAP: - m_featureList = null; - break; - case LOAD_MASTER_FEATURE_FOR_PEPTIDE: - m_masterFeatureList = null; - break; - case LOAD_FEATURE_FOR_MASTER: - m_childFeatureListForMaster = null; - break; +// case LOAD_MAP_FOR_XIC: +// m_mapList = null; +// break; +// case LOAD_PEAKELS_FOR_MAP: +// m_peakelList = null; +// break; +// case LOAD_FEATURES_FOR_MAP: +// m_featureList = null; +// break; +// case LOAD_MASTER_FEATURE_FOR_PEPTIDE: +// m_masterFeatureList = null; +// break; +// case LOAD_FEATURE_FOR_MASTER: +// m_childFeatureListForMaster = null; +// break; case LOAD_PEAKELS_FOR_FEATURE: m_peakelForChildFeatureList = null; break; @@ -202,34 +204,35 @@ public void abortTask() { @Override public boolean fetchData() { - if (action == LOAD_MAP_FOR_XIC) { - if (needToFetch()) { - m_taskError = DatabaseLoadXicMasterQuantTask.fetchDataQuantChannels(m_projectId, m_dataset); - return fetchDataMainTaskMapForXic(); - } - } else if (action == LOAD_PEAKELS_FOR_MAP) { - if (needToFetch()) { - return fetchDataMainTaskPeakelForMap(); - } else { - // fetch data of SubTasks - return fetchPeakelDataSubTask(); - } - } else if (action == LOAD_FEATURES_FOR_MAP) { - if (needToFetch()) { - return fetchDataMainTaskFeatureForMap(); - } else { - // fetch data of SubTasks - return fetchFeatureDataSubTask(); - } - } else if (action == LOAD_MASTER_FEATURE_FOR_PEPTIDE) { - if (needToFetch()) { - return fetchDataMainTaskMasterFeatureForPeptide(); - } - } else if (action == LOAD_FEATURE_FOR_MASTER) { - if (needToFetch()) { - return fetchDataMainTaskChildFeatureForMaster(); - } - } else if (action == LOAD_PEAKELS_FOR_FEATURE) { +// if (action == LOAD_MAP_FOR_XIC) { +// if (needToFetch()) { +// m_taskError = DatabaseLoadXicMasterQuantTask.fetchDataQuantChannels(m_projectId, m_dataset); +// return fetchDataMainTaskMapForXic(); +// } +// } else if (action == LOAD_PEAKELS_FOR_MAP) { +// if (needToFetch()) { +// return fetchDataMainTaskPeakelForMap(); +// } else { +// // fetch data of SubTasks +// return fetchPeakelDataSubTask(); +// } +// } else if (action == LOAD_FEATURES_FOR_MAP) { +// if (needToFetch()) { +// return fetchDataMainTaskFeatureForMap(); +// } else { +// // fetch data of SubTasks +// return fetchFeatureDataSubTask(); +// } +// } else if (action == LOAD_MASTER_FEATURE_FOR_PEPTIDE) { +// if (needToFetch()) { +// return fetchDataMainTaskMasterFeatureForPeptide(); +// } +// } else if (action == LOAD_FEATURE_FOR_MASTER) { +// if (needToFetch()) { +// return fetchDataMainTaskChildFeatureForMaster(); +// } +// } else + if (action == LOAD_PEAKELS_FOR_FEATURE) { if (needToFetch()) { return fetchDataMainTaskPeakelForFeature(); } else { @@ -257,16 +260,16 @@ public boolean fetchData() { @Override public boolean needToFetch() { switch (action) { - case LOAD_MAP_FOR_XIC: - return (m_mapList == null || m_mapList.isEmpty()); - case LOAD_PEAKELS_FOR_MAP: - return (m_peakelList == null || m_peakelList.isEmpty()); - case LOAD_FEATURES_FOR_MAP: - return (m_featureList == null || m_featureList.isEmpty()); - case LOAD_MASTER_FEATURE_FOR_PEPTIDE: - return (m_masterFeatureList == null || m_masterFeatureList.isEmpty()); - case LOAD_FEATURE_FOR_MASTER: - return (m_childFeatureListForMaster == null || m_childFeatureListForMaster.isEmpty()); +// case LOAD_MAP_FOR_XIC: +// return (m_mapList == null || m_mapList.isEmpty()); +// case LOAD_PEAKELS_FOR_MAP: +// return (m_peakelList == null || m_peakelList.isEmpty()); +// case LOAD_FEATURES_FOR_MAP: +// return (m_featureList == null || m_featureList.isEmpty()); +// case LOAD_MASTER_FEATURE_FOR_PEPTIDE: +// return (m_masterFeatureList == null || m_masterFeatureList.isEmpty()); +// case LOAD_FEATURE_FOR_MASTER: +// return (m_childFeatureListForMaster == null || m_childFeatureListForMaster.isEmpty()); case LOAD_PEAKELS_FOR_FEATURE: return (m_peakelForChildFeatureList == null || m_peakelForChildFeatureList.isEmpty()); case LOAD_FEATURE_FOR_PEPTIDE_ION_WITH_PEAKELS: @@ -277,150 +280,150 @@ public boolean needToFetch() { return false; // should not happen } - /** - * main task to load all maps for a xic - * - * @return - */ - private boolean fetchDataMainTaskMapForXic() { - EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); - try { - entityManagerLCMS.getTransaction().begin(); - if (m_dataset != null && m_dataset.getMasterQuantitationChannels() != null) { - List listMasterQuantitationChannels = m_dataset.getMasterQuantitationChannels(); - for (DMasterQuantitationChannel masterQuantitationChannel : listMasterQuantitationChannels) { - List listQuantChannels = masterQuantitationChannel.getQuantitationChannels(); - if (listQuantChannels != null && !listQuantChannels.isEmpty()) { - List listMapIds = new ArrayList(); - for (DQuantitationChannel quantitationChannel : listQuantChannels) { - listMapIds.add(quantitationChannel.getLcmsMapId()); - } - String queryRawMapIds = "SELECT pmrm.rawMap.id " - + "FROM fr.proline.core.orm.lcms.Map m, ProcessedMap pm, ProcessedMapRawMapMapping pmrm " - + "WHERE m.id IN (:listId) " - + "AND m.id = pm.id " - + "AND pm.id = pmrm.id.processedMapId "; - TypedQuery queryRawMapLcms = entityManagerLCMS.createQuery(queryRawMapIds, Long.class); - queryRawMapLcms.setParameter("listId", listMapIds); - List rawMapIds = queryRawMapLcms.getResultList(); - String queryMap = "SELECT m " - + "FROM fr.proline.core.orm.lcms.Map m " - + "WHERE m.id IN (:listId) " - + "ORDER BY m.id "; - TypedQuery queryMapLcms = entityManagerLCMS.createQuery(queryMap, Map.class); - queryMapLcms.setParameter("listId", rawMapIds); - List mapList = queryMapLcms.getResultList(); - m_mapList.addAll(mapList); - } - } - } - entityManagerLCMS.getTransaction().commit(); - } catch (Exception e) { - m_logger.error(getClass().getSimpleName() + " failed", e); - m_taskError = new TaskError(e); - entityManagerLCMS.getTransaction().rollback(); - return false; - } finally { - entityManagerLCMS.close(); - } - - // set priority as low for the possible sub tasks - m_defaultPriority = Priority.LOW; - m_currentPriority = Priority.LOW; - return true; - } - - /** - * main task to load all peakels for a map - * - * @return - */ - private boolean fetchDataMainTaskPeakelForMap() { - EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); - try { - entityManagerLCMS.getTransaction().begin(); - String queryP = "SELECT p.id " - + "FROM fr.proline.core.orm.lcms.Peakel p " - + "WHERE p.map.id =:mapId " - + "ORDER BY p.id ASC "; - TypedQuery queryPeakel = entityManagerLCMS.createQuery(queryP, Long.class); - queryPeakel.setParameter("mapId", m_map == null ? -1 : m_map.getId()); - List listIds = queryPeakel.getResultList(); - m_peakelIds = listIds; - - for (Long peakelId : m_peakelIds) { - Peakel p = new Peakel(); - p.setId(peakelId); - m_peakelList.add(p); - } - - // slice the task and get the first one - SubTask subTask = m_subTaskManager.sliceATaskAndGetFirst(SUB_TASK_PEAKEL, m_peakelIds.size(), SLICE_SIZE); - - // execute the first slice now - fetchPeakelData(subTask, entityManagerLCMS); - - entityManagerLCMS.getTransaction().commit(); - } catch (Exception e) { - m_logger.error(getClass().getSimpleName() + " failed", e); - m_taskError = new TaskError(e); - entityManagerLCMS.getTransaction().rollback(); - return false; - } finally { - entityManagerLCMS.close(); - } - - // set priority as low for the possible sub tasks - m_defaultPriority = Priority.LOW; - m_currentPriority = Priority.LOW; - return true; - } - - /** - * main task to load all features for a map - * - * @return - */ - private boolean fetchDataMainTaskFeatureForMap() { - EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); - try { - entityManagerLCMS.getTransaction().begin(); - String queryF = "SELECT f.id " - + "FROM fr.proline.core.orm.lcms.Feature f " - + "WHERE f.map.id =:mapId " - + "ORDER BY f.id ASC "; - TypedQuery queryFeature = entityManagerLCMS.createQuery(queryF, Long.class); - queryFeature.setParameter("mapId", m_map == null ? -1 : m_map.getId()); - List listIds = queryFeature.getResultList(); - m_featureIds = listIds; - - for (Long featureId : m_featureIds) { - Feature f = new Feature(); - f.setId(featureId); - m_featureList.add(f); - } - - // slice the task and get the first one - SubTask subTask = m_subTaskManager.sliceATaskAndGetFirst(SUB_TASK_FEATURE, m_featureIds.size(), SLICE_SIZE); - - // execute the first slice now - fetchFeatureData(subTask, entityManagerLCMS); - - entityManagerLCMS.getTransaction().commit(); - } catch (Exception e) { - m_logger.error(getClass().getSimpleName() + " failed", e); - m_taskError = new TaskError(e); - entityManagerLCMS.getTransaction().rollback(); - return false; - } finally { - entityManagerLCMS.close(); - } - - // set priority as low for the possible sub tasks - m_defaultPriority = Priority.LOW; - m_currentPriority = Priority.LOW; - return true; - } +// /** +// * main task to load all maps for a xic +// * +// * @return +// */ +// private boolean fetchDataMainTaskMapForXic() { +// EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); +// try { +// entityManagerLCMS.getTransaction().begin(); +// if (m_dataset != null && m_dataset.getMasterQuantitationChannels() != null) { +// List listMasterQuantitationChannels = m_dataset.getMasterQuantitationChannels(); +// for (DMasterQuantitationChannel masterQuantitationChannel : listMasterQuantitationChannels) { +// List listQuantChannels = masterQuantitationChannel.getQuantitationChannels(); +// if (listQuantChannels != null && !listQuantChannels.isEmpty()) { +// List listMapIds = new ArrayList(); +// for (DQuantitationChannel quantitationChannel : listQuantChannels) { +// listMapIds.add(quantitationChannel.getLcmsMapId()); +// } +// String queryRawMapIds = "SELECT pmrm.rawMap.id " +// + "FROM fr.proline.core.orm.lcms.Map m, ProcessedMap pm, ProcessedMapRawMapMapping pmrm " +// + "WHERE m.id IN (:listId) " +// + "AND m.id = pm.id " +// + "AND pm.id = pmrm.id.processedMapId "; +// TypedQuery queryRawMapLcms = entityManagerLCMS.createQuery(queryRawMapIds, Long.class); +// queryRawMapLcms.setParameter("listId", listMapIds); +// List rawMapIds = queryRawMapLcms.getResultList(); +// String queryMap = "SELECT m " +// + "FROM fr.proline.core.orm.lcms.Map m " +// + "WHERE m.id IN (:listId) " +// + "ORDER BY m.id "; +// TypedQuery queryMapLcms = entityManagerLCMS.createQuery(queryMap, Map.class); +// queryMapLcms.setParameter("listId", rawMapIds); +// List mapList = queryMapLcms.getResultList(); +// m_mapList.addAll(mapList); +// } +// } +// } +// entityManagerLCMS.getTransaction().commit(); +// } catch (Exception e) { +// m_logger.error(getClass().getSimpleName() + " failed", e); +// m_taskError = new TaskError(e); +// entityManagerLCMS.getTransaction().rollback(); +// return false; +// } finally { +// entityManagerLCMS.close(); +// } +// +// // set priority as low for the possible sub tasks +// m_defaultPriority = Priority.LOW; +// m_currentPriority = Priority.LOW; +// return true; +// } +// +// /** +// * main task to load all peakels for a map +// * +// * @return +// */ +// private boolean fetchDataMainTaskPeakelForMap() { +// EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); +// try { +// entityManagerLCMS.getTransaction().begin(); +// String queryP = "SELECT p.id " +// + "FROM fr.proline.core.orm.lcms.Peakel p " +// + "WHERE p.map.id =:mapId " +// + "ORDER BY p.id ASC "; +// TypedQuery queryPeakel = entityManagerLCMS.createQuery(queryP, Long.class); +// queryPeakel.setParameter("mapId", m_map == null ? -1 : m_map.getId()); +// List listIds = queryPeakel.getResultList(); +// m_peakelIds = listIds; +// +// for (Long peakelId : m_peakelIds) { +// Peakel p = new Peakel(); +// p.setId(peakelId); +// m_peakelList.add(p); +// } +// +// // slice the task and get the first one +// SubTask subTask = m_subTaskManager.sliceATaskAndGetFirst(SUB_TASK_PEAKEL, m_peakelIds.size(), SLICE_SIZE); +// +// // execute the first slice now +// fetchPeakelData(subTask, entityManagerLCMS); +// +// entityManagerLCMS.getTransaction().commit(); +// } catch (Exception e) { +// m_logger.error(getClass().getSimpleName() + " failed", e); +// m_taskError = new TaskError(e); +// entityManagerLCMS.getTransaction().rollback(); +// return false; +// } finally { +// entityManagerLCMS.close(); +// } +// +// // set priority as low for the possible sub tasks +// m_defaultPriority = Priority.LOW; +// m_currentPriority = Priority.LOW; +// return true; +// } +// +// /** +// * main task to load all features for a map +// * +// * @return +// */ +// private boolean fetchDataMainTaskFeatureForMap() { +// EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); +// try { +// entityManagerLCMS.getTransaction().begin(); +// String queryF = "SELECT f.id " +// + "FROM fr.proline.core.orm.lcms.Feature f " +// + "WHERE f.map.id =:mapId " +// + "ORDER BY f.id ASC "; +// TypedQuery queryFeature = entityManagerLCMS.createQuery(queryF, Long.class); +// queryFeature.setParameter("mapId", m_map == null ? -1 : m_map.getId()); +// List listIds = queryFeature.getResultList(); +// m_featureIds = listIds; +// +// for (Long featureId : m_featureIds) { +// Feature f = new Feature(); +// f.setId(featureId); +// m_featureList.add(f); +// } +// +// // slice the task and get the first one +// SubTask subTask = m_subTaskManager.sliceATaskAndGetFirst(SUB_TASK_FEATURE, m_featureIds.size(), SLICE_SIZE); +// +// // execute the first slice now +// fetchFeatureData(subTask, entityManagerLCMS); +// +// entityManagerLCMS.getTransaction().commit(); +// } catch (Exception e) { +// m_logger.error(getClass().getSimpleName() + " failed", e); +// m_taskError = new TaskError(e); +// entityManagerLCMS.getTransaction().rollback(); +// return false; +// } finally { +// entityManagerLCMS.close(); +// } +// +// // set priority as low for the possible sub tasks +// m_defaultPriority = Priority.LOW; +// m_currentPriority = Priority.LOW; +// return true; +// } /** * main task to load all peakels for a feature @@ -469,37 +472,37 @@ private boolean fetchDataMainTaskPeakelForFeature() { return true; } - /** - * subTask to load peakel - * - * @return - */ - private boolean fetchPeakelDataSubTask() { - SubTask slice = m_subTaskManager.getNextSubTask(); - if (slice == null) { - return true; // nothing to do : should not happen - } - - EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); - try { - entityManagerLCMS.getTransaction().begin(); - switch (slice.getSubTaskId()) { - case SUB_TASK_PEAKEL: - fetchPeakelData(slice, entityManagerLCMS); - break; - } - entityManagerLCMS.getTransaction().commit(); - } catch (Exception e) { - m_logger.error(getClass().getSimpleName() + " failed", e); - m_taskError = new TaskError(e); - entityManagerLCMS.getTransaction().rollback(); - return false; - } finally { - entityManagerLCMS.close(); - } - - return true; - } +// /** +// * subTask to load peakel +// * +// * @return +// */ +// private boolean fetchPeakelDataSubTask() { +// SubTask slice = m_subTaskManager.getNextSubTask(); +// if (slice == null) { +// return true; // nothing to do : should not happen +// } +// +// EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); +// try { +// entityManagerLCMS.getTransaction().begin(); +// switch (slice.getSubTaskId()) { +// case SUB_TASK_PEAKEL: +// fetchPeakelData(slice, entityManagerLCMS); +// break; +// } +// entityManagerLCMS.getTransaction().commit(); +// } catch (Exception e) { +// m_logger.error(getClass().getSimpleName() + " failed", e); +// m_taskError = new TaskError(e); +// entityManagerLCMS.getTransaction().rollback(); +// return false; +// } finally { +// entityManagerLCMS.close(); +// } +// +// return true; +// } /** * subTask to load peakel @@ -533,50 +536,50 @@ private boolean fetchPeakelForFeatureDataSubTask() { return true; } - /** - * subTask to load feature - * - * @return - */ - private boolean fetchFeatureDataSubTask() { - SubTask slice = m_subTaskManager.getNextSubTask(); - if (slice == null) { - return true; // nothing to do : should not happen - } - - EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); - try { - entityManagerLCMS.getTransaction().begin(); - switch (slice.getSubTaskId()) { - case SUB_TASK_FEATURE: - fetchFeatureData(slice, entityManagerLCMS); - break; - } - entityManagerLCMS.getTransaction().commit(); - } catch (Exception e) { - m_logger.error(getClass().getSimpleName() + " failed", e); - m_taskError = new TaskError(e); - entityManagerLCMS.getTransaction().rollback(); - return false; - } finally { - entityManagerLCMS.close(); - } - - return true; - } - - /** - * * - * load Peakels data for a given subTask - * - * @param subTask - * @param entityManagerLCMS - * @return - */ - private boolean fetchPeakelData(SubTask subTask, EntityManager entityManagerLCMS) { - List sliceOfPeakelsIds = subTask.getSubList(m_peakelIds); - return fetchPeakelData(entityManagerLCMS, sliceOfPeakelsIds, m_peakelList); - } +// /** +// * subTask to load feature +// * +// * @return +// */ +// private boolean fetchFeatureDataSubTask() { +// SubTask slice = m_subTaskManager.getNextSubTask(); +// if (slice == null) { +// return true; // nothing to do : should not happen +// } +// +// EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); +// try { +// entityManagerLCMS.getTransaction().begin(); +// switch (slice.getSubTaskId()) { +// case SUB_TASK_FEATURE: +// fetchFeatureData(slice, entityManagerLCMS); +// break; +// } +// entityManagerLCMS.getTransaction().commit(); +// } catch (Exception e) { +// m_logger.error(getClass().getSimpleName() + " failed", e); +// m_taskError = new TaskError(e); +// entityManagerLCMS.getTransaction().rollback(); +// return false; +// } finally { +// entityManagerLCMS.close(); +// } +// +// return true; +// } + +// /** +// * * +// * load Peakels data for a given subTask +// * +// * @param subTask +// * @param entityManagerLCMS +// * @return +// */ +// private boolean fetchPeakelData(SubTask subTask, EntityManager entityManagerLCMS) { +// List sliceOfPeakelsIds = subTask.getSubList(m_peakelIds); +// return fetchPeakelData(entityManagerLCMS, sliceOfPeakelsIds, m_peakelList); +// } /** * * @@ -591,18 +594,18 @@ private boolean fetchPeakelForFeatureData(SubTask subTask, EntityManager entityM return fetchPeakelData(entityManagerLCMS, sliceOfPeakelsIds, m_peakelForChildFeatureList); } - /** - * * - * load Features data for a given subTask - * - * @param subTask - * @param entityManagerLCMS - * @return - */ - private boolean fetchFeatureData(SubTask subTask, EntityManager entityManagerLCMS) { - List sliceOfFeaturesIds = subTask.getSubList(m_featureIds); - return fetchFeatureData(entityManagerLCMS, sliceOfFeaturesIds); - } +// /** +// * * +// * load Features data for a given subTask +// * +// * @param subTask +// * @param entityManagerLCMS +// * @return +// */ +// private boolean fetchFeatureData(SubTask subTask, EntityManager entityManagerLCMS) { +// List sliceOfFeaturesIds = subTask.getSubList(m_featureIds); +// return fetchFeatureData(entityManagerLCMS, sliceOfFeaturesIds); +// } /** * load peakel data for a given list of Ids @@ -636,135 +639,135 @@ private boolean fetchPeakelData(EntityManager entityManagerLCMS, List list return true; } - /** - * load feature data for a given list of Ids - * - * @param entityManagerLCMS - * @param listFeaturesIds - * @return - */ - private boolean fetchFeatureData(EntityManager entityManagerLCMS, List listFeaturesIds) { - int nbF = m_featureList.size(); - String queryF = "SELECT f " - + "FROM fr.proline.core.orm.lcms.Feature f " - + "WHERE f.id IN (:listId) " - + "ORDER BY f.id ASC "; - TypedQuery queryFeature = entityManagerLCMS.createQuery(queryF, Feature.class); - queryFeature.setParameter("listId", listFeaturesIds); - List resultList = queryFeature.getResultList(); - for (Feature feature : resultList) { - // index - int index = -1; - for (int k = 0; k < nbF; k++) { - if (m_featureList.get(k).getId().equals(feature.getId())) { - index = k; - break; - } - } - // update the list - m_featureList.set(index, feature); - } - - return true; - } - - /** - * main task to load all master features for a masterQuantPeptide - * - * @return - */ - private boolean fetchDataMainTaskMasterFeatureForPeptide() { - EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); - EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); - try { - entityManagerMSI.getTransaction().begin(); - entityManagerLCMS.getTransaction().begin(); - if (m_masterQuantPeptide != null) { - String queryPepIon = "SELECT mqpi.lcmsMasterFeatureId " - + "FROM MasterQuantPeptideIon mqpi " - + "WHERE mqpi.masterQuantPeptideId=:masterQuantPeptideId " - + "ORDER BY mqpi.charge ASC"; - TypedQuery peptidesIonQuery = entityManagerMSI.createQuery(queryPepIon, Long.class); - peptidesIonQuery.setParameter("masterQuantPeptideId", m_masterQuantPeptide.getId()); - List listLcmsIds = (List) peptidesIonQuery.getResultList(); - if (listLcmsIds != null && !listLcmsIds.isEmpty()) { - String queryMaster = "SELECT f " - + "FROM fr.proline.core.orm.lcms.Feature f " - + "WHERE f.id IN (:listId) " - + "ORDER BY f.elutionTime ASC "; - TypedQuery masterQuery = entityManagerLCMS.createQuery(queryMaster, Feature.class); - masterQuery.setParameter("listId", listLcmsIds); - m_masterFeatureList.addAll(masterQuery.getResultList()); - } - } - entityManagerMSI.getTransaction().commit(); - entityManagerLCMS.getTransaction().commit(); - } catch (Exception e) { - m_logger.error(getClass().getSimpleName() + " failed", e); - m_taskError = new TaskError(e); - entityManagerMSI.getTransaction().rollback(); - entityManagerLCMS.getTransaction().rollback(); - return false; - } finally { - entityManagerMSI.close(); - entityManagerLCMS.close(); - } - - // set priority as low for the possible sub tasks - m_defaultPriority = Priority.LOW; - m_currentPriority = Priority.LOW; - return true; - } - - /** - * main task to load all child features for a masterFeature - * - * @return - */ - private boolean fetchDataMainTaskChildFeatureForMaster() { - EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); - try { - entityManagerLCMS.getTransaction().begin(); - if (m_masterFeature != null) { - String query = "SELECT f " - + "FROM fr.proline.core.orm.lcms.Feature f, fr.proline.core.orm.lcms.MasterFeatureItem mfi " - + "WHERE f.id = mfi.childFeature.id AND " - + "mfi.masterFeature.id =:masterFeatureId "; - TypedQuery queryChild = entityManagerLCMS.createQuery(query, Feature.class); - queryChild.setParameter("masterFeatureId", m_masterFeature.getId()); - List resultList = queryChild.getResultList(); - for (Feature feature : resultList) { - String queryF = "SELECT f " - + "FROM fr.proline.core.orm.lcms.Feature f, fr.proline.core.orm.lcms.MasterFeatureItem mfi " - + "WHERE f.id = mfi.childFeature.id AND " - + "mfi.masterFeature.id =:masterFeatureId "; - TypedQuery queryChildF = entityManagerLCMS.createQuery(queryF, Feature.class); - queryChildF.setParameter("masterFeatureId", feature.getId()); - List r2 = queryChildF.getResultList(); - if (r2 != null && !r2.isEmpty()) { - // load childs for this cluster feature - m_childFeatureListForMaster.addAll(r2); - } else { - // no childs: load this feature - m_childFeatureListForMaster.add(feature); - } - } - } - entityManagerLCMS.getTransaction().commit(); - } catch (Exception e) { - m_logger.error(getClass().getSimpleName() + " failed", e); - m_taskError = new TaskError(e); - entityManagerLCMS.getTransaction().rollback(); - return false; - } finally { - entityManagerLCMS.close(); - } - - // set priority as low for the possible sub tasks - m_defaultPriority = Priority.LOW; - m_currentPriority = Priority.LOW; - return true; - } +// /** +// * load feature data for a given list of Ids +// * +// * @param entityManagerLCMS +// * @param listFeaturesIds +// * @return +// */ +// private boolean fetchFeatureData(EntityManager entityManagerLCMS, List listFeaturesIds) { +// int nbF = m_featureList.size(); +// String queryF = "SELECT f " +// + "FROM fr.proline.core.orm.lcms.Feature f " +// + "WHERE f.id IN (:listId) " +// + "ORDER BY f.id ASC "; +// TypedQuery queryFeature = entityManagerLCMS.createQuery(queryF, Feature.class); +// queryFeature.setParameter("listId", listFeaturesIds); +// List resultList = queryFeature.getResultList(); +// for (Feature feature : resultList) { +// // index +// int index = -1; +// for (int k = 0; k < nbF; k++) { +// if (m_featureList.get(k).getId().equals(feature.getId())) { +// index = k; +// break; +// } +// } +// // update the list +// m_featureList.set(index, feature); +// } +// +// return true; +// } + +// /** +// * main task to load all master features for a masterQuantPeptide +// * +// * @return +// */ +// private boolean fetchDataMainTaskMasterFeatureForPeptide() { +// EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(m_projectId).createEntityManager(); +// EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); +// try { +// entityManagerMSI.getTransaction().begin(); +// entityManagerLCMS.getTransaction().begin(); +// if (m_masterQuantPeptide != null) { +// String queryPepIon = "SELECT mqpi.lcmsMasterFeatureId " +// + "FROM MasterQuantPeptideIon mqpi " +// + "WHERE mqpi.masterQuantPeptideId=:masterQuantPeptideId " +// + "ORDER BY mqpi.charge ASC"; +// TypedQuery peptidesIonQuery = entityManagerMSI.createQuery(queryPepIon, Long.class); +// peptidesIonQuery.setParameter("masterQuantPeptideId", m_masterQuantPeptide.getId()); +// List listLcmsIds = (List) peptidesIonQuery.getResultList(); +// if (listLcmsIds != null && !listLcmsIds.isEmpty()) { +// String queryMaster = "SELECT f " +// + "FROM fr.proline.core.orm.lcms.Feature f " +// + "WHERE f.id IN (:listId) " +// + "ORDER BY f.elutionTime ASC "; +// TypedQuery masterQuery = entityManagerLCMS.createQuery(queryMaster, Feature.class); +// masterQuery.setParameter("listId", listLcmsIds); +// m_masterFeatureList.addAll(masterQuery.getResultList()); +// } +// } +// entityManagerMSI.getTransaction().commit(); +// entityManagerLCMS.getTransaction().commit(); +// } catch (Exception e) { +// m_logger.error(getClass().getSimpleName() + " failed", e); +// m_taskError = new TaskError(e); +// entityManagerMSI.getTransaction().rollback(); +// entityManagerLCMS.getTransaction().rollback(); +// return false; +// } finally { +// entityManagerMSI.close(); +// entityManagerLCMS.close(); +// } +// +// // set priority as low for the possible sub tasks +// m_defaultPriority = Priority.LOW; +// m_currentPriority = Priority.LOW; +// return true; +// } + +// /** +// * main task to load all child features for a masterFeature +// * +// * @return +// */ +// private boolean fetchDataMainTaskChildFeatureForMaster() { +// EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(m_projectId).createEntityManager(); +// try { +// entityManagerLCMS.getTransaction().begin(); +// if (m_masterFeature != null) { +// String query = "SELECT f " +// + "FROM fr.proline.core.orm.lcms.Feature f, fr.proline.core.orm.lcms.MasterFeatureItem mfi " +// + "WHERE f.id = mfi.childFeature.id AND " +// + "mfi.masterFeature.id =:masterFeatureId "; +// TypedQuery queryChild = entityManagerLCMS.createQuery(query, Feature.class); +// queryChild.setParameter("masterFeatureId", m_masterFeature.getId()); +// List resultList = queryChild.getResultList(); +// for (Feature feature : resultList) { +// String queryF = "SELECT f " +// + "FROM fr.proline.core.orm.lcms.Feature f, fr.proline.core.orm.lcms.MasterFeatureItem mfi " +// + "WHERE f.id = mfi.childFeature.id AND " +// + "mfi.masterFeature.id =:masterFeatureId "; +// TypedQuery queryChildF = entityManagerLCMS.createQuery(queryF, Feature.class); +// queryChildF.setParameter("masterFeatureId", feature.getId()); +// List r2 = queryChildF.getResultList(); +// if (r2 != null && !r2.isEmpty()) { +// // load childs for this cluster feature +// m_childFeatureListForMaster.addAll(r2); +// } else { +// // no childs: load this feature +// m_childFeatureListForMaster.add(feature); +// } +// } +// } +// entityManagerLCMS.getTransaction().commit(); +// } catch (Exception e) { +// m_logger.error(getClass().getSimpleName() + " failed", e); +// m_taskError = new TaskError(e); +// entityManagerLCMS.getTransaction().rollback(); +// return false; +// } finally { +// entityManagerLCMS.close(); +// } +// +// // set priority as low for the possible sub tasks +// m_defaultPriority = Priority.LOW; +// m_currentPriority = Priority.LOW; +// return true; +// } /** @@ -1012,6 +1015,7 @@ private boolean fetchDataMainTaskAlignmentForXic() { return (m_taskError == null); } + public static TaskError fetchDataMainTaskAlignmentForXic(Long projectId, DDataset dataset) { EntityManager entityManagerLCMS = DStoreCustomPoolConnectorFactory.getInstance().getLcMsDbConnector(projectId).createEntityManager(); @@ -1081,6 +1085,7 @@ public static TaskError fetchDataMainTaskAlignmentForXic(Long projectId, DDatase for (ProcessedMap pm : rs3) { // force initialization of raw map collection Hibernate.initialize(pm.getRawMaps()); + Hibernate.initialize(pm.getProcessedMapMozCalibration()); allMaps.add(pm); } dataset.setMaps(allMaps); diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/DatabaseLoadXicMasterQuantTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/DatabaseLoadXicMasterQuantTask.java index 77384ed8a..e0496b556 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/DatabaseLoadXicMasterQuantTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/DatabaseLoadXicMasterQuantTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -55,10 +55,8 @@ import fr.proline.studio.corewrapper.data.QuantPostProcessingParams; import fr.proline.studio.dam.taskinfo.TaskError; import fr.proline.studio.dam.taskinfo.TaskInfo; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; -import fr.proline.studio.dam.tasks.AbstractDatabaseSlicerTask; -import fr.proline.studio.dam.tasks.DatabasePTMSitesTask; -import fr.proline.studio.dam.tasks.SubTask; +import fr.proline.studio.dam.tasks.*; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -74,7 +72,6 @@ import javax.persistence.NonUniqueResultException; import javax.persistence.Query; import javax.persistence.TypedQuery; -import org.openide.util.Exceptions; /** * @@ -86,25 +83,22 @@ public class DatabaseLoadXicMasterQuantTask extends AbstractDatabaseSlicerTask { private static final int SLICE_SIZE = 1000; // different possible subtasks - public static final int SUB_TASK_COUNT_QC = 0; - - public static final int SUB_TASK_PROTEIN_SET = 1; - public static final int SUB_TASK_COUNT_PROTEIN = 2; + public static final int NO_SUB_TASK = 0;// <<----- get in sync - public static final int SUB_TASK_COUNT_PEPTIDE = 3; - public static final int SUB_TASK_PEPTIDE_INSTANCE = 4; + public static final int SUB_TASK_PROTEIN_SET = 0; + public static final int NBR_SUB_TASK_PROTEIN = 1; // <<----- get in sync - public static final int SUB_TASK_COUNT_PEPTIDE_ION = 5; - public static final int SUB_TASK_PEPTIDE_ION = 6; + public static final int SUB_TASK_PEPTIDE_INSTANCE = 0; + public static final int NBR_SUB_TASK_PEPTIDE = 1; // <<----- get in sync - public static final int SUB_TASK_PEPTIDE = 7; - public static final int SUB_TASK_MSQUERY = 8; - public static final int SUB_TASK_PROTEINSET_NAME_LIST = 9; - public static final int SUB_TASK_COUNT_PSM = 10; + public static final int SUB_TASK_PEPTIDE_ION = 0; + public static final int NBR_SUB_TASK_PEPTIDE_ION = 1; - public static final int SUB_TASK_PTM_PEPTIDE_INSTANCE = 11; + public static final int SUB_TASK_PEPTIDE = 0; + public static final int SUB_TASK_MSQUERY = 1; + public static final int SUB_TASK_PROTEINSET_NAME_LIST = 2; + public static final int NBR_SUB_TASK_PSM = 3;// <<----- get in sync - public static final int SUB_TASK_NB = 12; // <<----- get in sync // data kept for sub tasks private List m_proteinSetIds = null; @@ -153,7 +147,7 @@ public DatabaseLoadXicMasterQuantTask(AbstractDatabaseCallback callback) { } public void initLoadProteinSets(long projectId, DDataset dataset, List masterQuantProteinSetList) { - init(SUB_TASK_NB, new TaskInfo("Load Protein Sets of XIC " + dataset.getName(), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + init(NBR_SUB_TASK_PROTEIN, new TaskInfo("Load Protein Sets of XIC " + dataset.getName(), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); m_projectId = projectId; m_dataset = dataset; m_masterQuantProteinSetList = masterQuantProteinSetList; @@ -161,14 +155,14 @@ public void initLoadProteinSets(long projectId, DDataset dataset, List masterQuantPeptideList, boolean xic) { - init(SUB_TASK_NB, new TaskInfo("Load Peptides of XIC " + dataset.getName(), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + init(NBR_SUB_TASK_PEPTIDE, new TaskInfo("Load Peptides of XIC " + dataset.getName(), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); m_projectId = projectId; m_dataset = dataset; @@ -182,7 +176,7 @@ public void initLoadPeptides(long projectId, DDataset dataset, DMasterQuantProte if (masterQuantProteinSet != null) { proteinSetName = getMasterQuantProteinSetName(masterQuantProteinSet); } - init(SUB_TASK_NB, new TaskInfo("Load Peptides of proteinSet " + proteinSetName, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + init(NO_SUB_TASK, new TaskInfo("Load Peptides of proteinSet " + proteinSetName, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); m_projectId = projectId; m_dataset = dataset; m_masterQuantPeptideList = masterQuantPeptideList; @@ -193,7 +187,7 @@ public void initLoadPeptides(long projectId, DDataset dataset, DMasterQuantProte public void initLoadPeptides(long projectId, DDataset dataset, Long[] peptideInstanceIdArray, List masterQuantPeptideList, boolean xic) { - init(SUB_TASK_NB, new TaskInfo("Load Peptides from peptide Instances ", false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + init(NBR_SUB_TASK_PEPTIDE, new TaskInfo("Load Peptides from peptide Instances ", false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); m_projectId = projectId; m_dataset = dataset; m_masterQuantPeptideList = masterQuantPeptideList; @@ -202,28 +196,12 @@ public void initLoadPeptides(long projectId, DDataset dataset, Long[] peptideIns action = LOAD_PEPTIDE_FROM_PEPTIDES_INSTANCES; } -// public void initLoadPeptidesWithIds(long projectId, DDataset dataset, List listPeptideInstanceIds, DMasterQuantProteinSet masterQuantProteinSet, List masterQuantPeptideList) { -// //EntityManager entityManagerMSI, List listPeptideInstanceIds, boolean xic -// String proteinSetName = ""; -// if (masterQuantProteinSet != null) { -// proteinSetName = getMasterQuantProteinSetName(masterQuantProteinSet); -// } -// -// init(SUB_TASK_NB, new TaskInfo("Load Peptides of protein " + proteinSetName, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); -// m_projectId = projectId; -// m_dataset = dataset; -// m_masterQuantPeptideList = masterQuantPeptideList; -// m_peptideInstanceIds = listPeptideInstanceIds; -// m_dMasterQuantProteinSet = masterQuantProteinSet; -// m_xic = true; -// action = LOAD_PEPTIDE_WITH_ID; -// } public void initLoadPeptideIons(long projectId, DDataset dataset, DMasterQuantPeptide masterQuantPeptide, List masterQuantPeptideIonList) { String peptideName = ""; if (masterQuantPeptide != null && masterQuantPeptide.getPeptideInstance() != null && masterQuantPeptide.getPeptideInstance().getPeptide() != null) { peptideName = masterQuantPeptide.getPeptideInstance().getPeptide().getSequence(); } - init(SUB_TASK_NB, new TaskInfo("Load Peptides Ions of peptide " + peptideName, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + init(NO_SUB_TASK, new TaskInfo("Load Peptides Ions of peptide " + peptideName, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); m_projectId = projectId; m_dataset = dataset; m_masterQuantPeptide = masterQuantPeptide; @@ -237,7 +215,7 @@ public void initLoadParentPeptideIons(long projectId, DDataset dataset, DMasterQ peptideName = aggregatedMasterQuantPeptide.getRepresentativePepMatch().getPeptide().getSequence(); } - init(SUB_TASK_NB, new TaskInfo("Load Parents Peptides Ions of peptide " + peptideName, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + init(NO_SUB_TASK, new TaskInfo("Load Parents Peptides Ions of peptide " + peptideName, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); m_projectId = projectId; m_dataset = dataset; m_masterQuantPeptide = masterQuantPeptide; @@ -249,7 +227,7 @@ public void initLoadParentPeptideIons(long projectId, DDataset dataset, DMasterQ } public void initLoadPeptideIons(long projectId, DDataset dataset, List masterQuantPeptideIonList) { - init(SUB_TASK_NB, new TaskInfo("Load Peptides Ions of XIC " + dataset.getName(), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + init(NBR_SUB_TASK_PEPTIDE_ION, new TaskInfo("Load Peptides Ions of XIC " + dataset.getName(), false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); m_projectId = projectId; m_dataset = dataset; m_masterQuantPeptideIonList = masterQuantPeptideIonList; @@ -261,7 +239,7 @@ public void initLoadPSMForPeptide(long projectId, DDataset dataset, DMasterQuant if (masterQuantPeptide != null && masterQuantPeptide.getPeptideInstance() != null && masterQuantPeptide.getPeptideInstance().getPeptide() != null) { peptideName = masterQuantPeptide.getPeptideInstance().getPeptide().getSequence(); } - init(SUB_TASK_NB, new TaskInfo("Load Peptide Match of peptide " + peptideName, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); + init(NBR_SUB_TASK_PSM, new TaskInfo("Load Peptide Match of peptide " + peptideName, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_MEDIUM)); m_projectId = projectId; m_dataset = dataset; m_masterQuantPeptideForPSM = masterQuantPeptide; @@ -383,16 +361,6 @@ public boolean fetchData() { return fetchDataPeptideIonForPeptideMainTask(); } - } else if (action == LOAD_PEPTIDE_ION_FOR_PEPTIDE) { - if (needToFetch()) { - // first data are fetched - //fetchDataQuantChannels(m_projectId, m_dataset, m_taskError); - if ((m_dataset.getMapAlignments() == null || m_dataset.getMapAlignments().isEmpty())) { - m_taskError = DatabaseLoadLcMSTask.fetchDataMainTaskAlignmentForXic(m_projectId, m_dataset); - } - return fetchDataPeptideIonForPeptideMainTask(); - } - } else if (action == LOAD_PEPTIDE_ION_FOR_AGGREGATE_PEPTIDE_ION) { if (needToFetch()) { /*if ((m_dataset.getMapAlignments() == null || m_dataset.getMapAlignments().isEmpty())) { //JPM.PARENT.TODO : useful ? @@ -462,12 +430,10 @@ public boolean needToFetch() { case LOAD_QUANT_CHANNELS_FOR_XIC: return true; case LOAD_PEPTIDE_FOR_XIC: - return (m_masterQuantPeptideList == null || m_masterQuantPeptideList.isEmpty()); case LOAD_PEPTIDE_FOR_PROTEIN_SET: case LOAD_PEPTIDE_FROM_PEPTIDES_INSTANCES: return (m_masterQuantPeptideList == null || m_masterQuantPeptideList.isEmpty()); case LOAD_PEPTIDE_ION_FOR_XIC: - return (m_masterQuantPeptideIonList == null || m_masterQuantPeptideIonList.isEmpty()); case LOAD_PEPTIDE_ION_FOR_PEPTIDE: case LOAD_PEPTIDE_ION_FOR_AGGREGATE_PEPTIDE_ION: return (m_masterQuantPeptideIonList == null || m_masterQuantPeptideIonList.isEmpty()); @@ -482,7 +448,6 @@ public boolean needToFetch() { * * @param projectId * @param dataset - * @param taskError * @return */ public static TaskError fetchDataQuantChannels(Long projectId, DDataset dataset) { @@ -504,6 +469,7 @@ public static TaskError fetchDataQuantChannels(Long projectId, DDataset dataset) dataset.setQuantitationMethod(quantMethodDB); // load labels lazydata List labels = quantMethodDB.getLabels(); + //noinspection ResultOfMethodCallIgnored = init lazydata labels.size(); dataset.setDescription(datasetDB.getDescription()); List masterQuantitationChannels = null; @@ -522,13 +488,12 @@ public static TaskError fetchDataQuantChannels(Long projectId, DDataset dataset) // load the dataset for which the id is stored in the serialized properties //Since V2 : ref dataset and resultSummary identification are stored in masterQuantChannel DDataset identDataset = null; - Long identResultSummaryId = null; Dataset identDatasetDB = masterQuantitationChannel.getIdentDataset(); if (identDatasetDB != null) { identDataset = new DDataset(identDatasetDB.getId(), identDatasetDB.getProject(), identDatasetDB.getName(), identDatasetDB.getType(), identDatasetDB.getChildrenCount(), identDatasetDB.getResultSetId(), identDatasetDB.getResultSummaryId(), identDatasetDB.getNumber()); } - identResultSummaryId = masterQuantitationChannel.getIdentResultSummaryId(); + Long identResultSummaryId = masterQuantitationChannel.getIdentResultSummaryId(); dMaster.setIdentDataset(identDataset); dMaster.setIdentResultSummaryId(identResultSummaryId); @@ -542,7 +507,8 @@ public static TaskError fetchDataQuantChannels(Long projectId, DDataset dataset) Long resultSummaryId = masterQuantitationChannel.getQuantResultSummaryId(); if (dataset.getResultSummary() == null || dataset.getResultSetId() == null || dataset.getResultSet() == null) { ResultSummary rsm = entityManagerMSI.find(ResultSummary.class, resultSummaryId); - Set objTreeByName = rsm.getObjectTreeIdByName().keySet(); //to init Lazy map + //noinspection unused: to init Lazy map + Set objTreeByName = rsm.getObjectTreeIdByName().keySet(); if(dataset.getResultSummaryId() == null) dataset.setResultSummaryId(resultSummaryId); if(dataset.getResultSummary() == null) @@ -575,7 +541,7 @@ public static TaskError fetchDataQuantChannels(Long projectId, DDataset dataset) if (!dataset.getMasterQuantitationChannels().isEmpty()) { List listQch = dataset.getMasterQuantitationChannels().get(0).getQuantitationChannels(); if (dataset.getGroupSetup() != null && !dataset.getGroupSetup().getBiologicalGroups().isEmpty()) { - List sortedQch = new ArrayList(); + List sortedQch = new ArrayList<>(); List listBiolGroup = dataset.getGroupSetup().getBiologicalGroups(); for (BiologicalGroup biolGroup : listBiolGroup) { List listBiologicalSamples = biolGroup.getBiologicalSamples(); @@ -603,7 +569,7 @@ public static TaskError fetchDataQuantChannels(Long projectId, DDataset dataset) // load ObjectTree linked to the dataset if (objectTreeIdByName != null) { for (Map.Entry entry : objectTreeIdByName.entrySet()) { - if (entry.getKey().startsWith("quantitation")) { + if (entry.getKey().startsWith("quantitation") || entry.getKey().equals("proline.low_level_config")) { Long objectId = entry.getValue(); fr.proline.core.orm.uds.ObjectTree objectTree = entityManagerUDS.find(fr.proline.core.orm.uds.ObjectTree.class, objectId); dataset.setObjectTree(objectTree); @@ -616,8 +582,7 @@ public static TaskError fetchDataQuantChannels(Long projectId, DDataset dataset) entityManagerLCMS.getTransaction().commit(); m_logger.info("fetchQuantChannels took " + (System.currentTimeMillis() - start) + " ms"); } catch (Exception e) { - //logger.error(getClass().getSimpleName() + " failed", e); - String trace2String = Arrays.stream(e.getStackTrace()).map(es -> es.toString()).collect(Collectors.joining("\n")); + String trace2String = Arrays.stream(e.getStackTrace()).map(StackTraceElement::toString).collect(Collectors.joining("\n")); m_logger.error("fetchDataQuantChannels failed: {}, \n StackTrace:\n{}", e, trace2String); TaskError taskError = new TaskError(e); try { @@ -668,7 +633,7 @@ public static TaskError fetchDataset(Long projectId, ArrayList childrenDat entityManagerUDS.getTransaction().commit(); } catch (Exception e) { - String trace2String = Arrays.stream(e.getStackTrace()).map(es -> es.toString()).collect(Collectors.joining("\n")); + String trace2String = Arrays.stream(e.getStackTrace()).map(StackTraceElement::toString).collect(Collectors.joining("\n")); m_logger.error("fetchDataQuantChannels failed: {}, \n StackTrace:\n{}", e, trace2String); TaskError taskError = new TaskError(e); try { @@ -709,7 +674,7 @@ public static TaskError fetchDataQuantChannels(HashSet ids, HashMap es.toString()).collect(Collectors.joining("\n")); + String trace2String = Arrays.stream(e.getStackTrace()).map(StackTraceElement::toString).collect(Collectors.joining("\n")); m_logger.error("fetchDataQuantChannels failed: {}, \n StackTrace:\n{}", e, trace2String); TaskError taskError = new TaskError(e); try { @@ -728,7 +693,7 @@ public static TaskError fetchDataQuantChannels(HashSet ids, HashMap createDQuantChannelsForMQC(Long projectId, MasterQuantitationChannel masterQuantitationChannel, EntityManager entityManagerMSI, EntityManager entityManagerUDS, EntityManager entityManagerLCMS) { List listQuantitationChannels = masterQuantitationChannel.getQuantitationChannels(); - List listDQuantChannels = new ArrayList(); + List listDQuantChannels = new ArrayList<>(); for (QuantitationChannel qc : listQuantitationChannels) { DQuantitationChannel dqc = new DQuantitationChannel(qc); // search resultFileName and raw path @@ -749,7 +714,7 @@ static private List createDQuantChannelsForMQC(Long projec resultFileName = resultFileName.substring(0, resultFileName.indexOf('.')); } rsId = (Long) res[2]; - } catch (NoResultException | NonUniqueResultException e) { + } catch (NoResultException | NonUniqueResultException ignored) { } @@ -765,10 +730,9 @@ static private List createDQuantChannelsForMQC(Long projec queryQCNameQ.setParameter("projectId", projectId); try { Object[] res = (Object[]) queryQCNameQ.getSingleResult(); - String name = (String) res[0]; - resultFileName = name; + resultFileName = (String) res[0]; rawFileIdentifier = (String) res[1]; - } catch (NoResultException | NonUniqueResultException e2) { + } catch (NoResultException | NonUniqueResultException ignored) { } dqc.setResultFileName(resultFileName); @@ -781,7 +745,7 @@ static private List createDQuantChannelsForMQC(Long projec //mzdbFile = (String) queryMzdb.getSingleResult(); mzdbFile = qc.getRun().getRawFile().getMzDbFileName(); } catch (Exception e) { - String trace2String = Arrays.stream(e.getStackTrace()).map(es -> es.toString()).collect(Collectors.joining("\n")); + String trace2String = Arrays.stream(e.getStackTrace()).map(StackTraceElement::toString).collect(Collectors.joining("\n")); m_logger.error("Error while retrieving mzdb file: {}, \n StackTrace:\n{}", e, trace2String); } dqc.setMzdbFileName(mzdbFile); @@ -796,7 +760,7 @@ static private List createDQuantChannelsForMQC(Long projec try { Long rawMapId = queryRawMapLcms.getSingleResult(); dqc.setLcmsRawMapId(rawMapId); - } catch (NoResultException | NonUniqueResultException e) { + } catch (NoResultException | NonUniqueResultException ignored) { } if (rsId != null) { @@ -859,8 +823,7 @@ private boolean fetchDataProteinMainTask() { m_logger.debug("------- > fetchDataProteinMainTask : get ProtSet with MQPS: " + nbProteinSet); m_proteinSetIds = new ArrayList<>(nbProteinSet); m_resultSetIds = new ArrayList<>(nbProteinSet); - for (int i = 0; i < nbProteinSet; i++) { - Long id = proteinSets.get(i); + for (Long id : proteinSets) { m_proteinSetIds.add(id); m_resultSetIds.add(resultSummaryId); DMasterQuantProteinSet dMasterQuantProteinSet = new DMasterQuantProteinSet(); @@ -918,7 +881,7 @@ private boolean fetchDataPeptideMainTask(boolean xic, Long[] peptideInstanceIdAr entityManagerMSI.getTransaction().begin(); boolean pepInstSpecified = (peptideInstanceIdArray!= null); boolean mqPepCreatedForSpecifiedPepInstance = true; - m_peptideInstanceIds = new ArrayList(); + m_peptideInstanceIds = new ArrayList<>(); if (pepInstSpecified) { m_peptideInstanceIds.addAll(Arrays.asList(peptideInstanceIdArray)); mqPepCreatedForSpecifiedPepInstance = false; @@ -929,7 +892,7 @@ private boolean fetchDataPeptideMainTask(boolean xic, Long[] peptideInstanceIdAr for (DMasterQuantitationChannel masterQuantitationChannel : listMasterQuantitationChannels) { Long quantResultSummaryId = masterQuantitationChannel.getQuantResultSummaryId(); if (quantResultSummaryId != null ) { - List currentMQChPepInstanceIds = new ArrayList(); + List currentMQChPepInstanceIds = new ArrayList<>(); //--- Get PeptideInstance Ids if (!pepInstSpecified) { //get quant RSM peptide instance Ids @@ -952,7 +915,7 @@ private boolean fetchDataPeptideMainTask(boolean xic, Long[] peptideInstanceIdAr } //--- Create corresponding DMasterQuantPeptide - List listDMasterQuantPeptideFake = new ArrayList(); + List listDMasterQuantPeptideFake = new ArrayList<>(); for (Long m_peptideInstanceId : currentMQChPepInstanceIds) { DMasterQuantPeptide f = new DMasterQuantPeptide(-1, -1, -1, "", quantResultSummaryId); f.setPeptideInstanceId(m_peptideInstanceId); @@ -1171,7 +1134,7 @@ private boolean fetchPeptideInstanceData(EntityManager entityManagerMSI, List peptideMap = new HashMap<>(); // map qcId rsmId Map rsmIdVsQcId = new HashMap<>(); - List rsmIdList = new ArrayList(); + List rsmIdList = new ArrayList<>(); List listMasterQuantitationChannels = m_dataset.getMasterQuantitationChannels(); for (DMasterQuantitationChannel masterQuantChannel : listMasterQuantitationChannels) { List listQc = masterQuantChannel.getQuantitationChannels(); @@ -1183,7 +1146,7 @@ private boolean fetchPeptideInstanceData(EntityManager entityManagerMSI, List peptideInstanceList = new ArrayList(); + List peptideInstanceList = new ArrayList<>(); String querySelect; if (xic) { querySelect = "SELECT pi, pm.id, pm.rank, pm.charge, pm.deltaMoz, pm.experimentalMoz, pm.missedCleavage, pm.score, pm.resultSet.id, pm.cdPrettyRank, pm.sdPrettyRank, p, pm.serializedProperties, mqpi.elutionTime " @@ -1205,7 +1168,7 @@ private boolean fetchPeptideInstanceData(EntityManager entityManagerMSI, List resultList = query.getResultList(); HashMap peptideMatchMap = new HashMap<>(); Iterator itPeptidesQuery = resultList.iterator(); @@ -1246,8 +1209,8 @@ private boolean fetchPeptideInstanceData(EntityManager entityManagerMSI, List resultListMQPeptide = mqPeptideQ.getResultList(); - List listObjectTreeId = new ArrayList(); - List listPeptideId = new ArrayList(); - List listMasterQP = new ArrayList(); + List listObjectTreeId = new ArrayList<>(); + List listPeptideId = new ArrayList<>(); + List listMasterQP = new ArrayList<>(); m_masterQuantPeptideIonList = new ArrayList<>(); for (Object[] resCur : resultListMQPeptide) { int i = 0; @@ -1270,7 +1233,7 @@ private boolean fetchPeptideInstanceData(EntityManager entityManagerMSI, List> identPSMPerQCIdPerPepId = new HashMap(); + Map> identPSMPerQCIdPerPepId = new HashMap<>(); if (!listPeptideId.isEmpty()) { String queryCountPSM = "SELECT pi.peptideMatchCount, pi.resultSummary.id, pi.peptide.id " + "FROM PeptideInstance pi " @@ -1321,22 +1284,22 @@ private boolean fetchPeptideInstanceData(EntityManager entityManagerMSI, List resultListPSM = queryPSM.getResultList(); + for (Iterator iterator = resultListPSM.iterator(); iterator.hasNext();) { Object[] nb = (Object[]) (iterator.next()); - int psm = ((Integer) nb[0]).intValue(); + int psm = (Integer) nb[0]; Long rsmId = ((Long) nb[1]); Long qcId = rsmIdVsQcId.get(rsmId); Long peptideId = ((Long) nb[2]); Map identPSMPerQCId = identPSMPerQCIdPerPepId.get(peptideId); if (identPSMPerQCId == null) { - identPSMPerQCId = new HashMap(); + identPSMPerQCId = new HashMap<>(); } identPSMPerQCId.put(qcId, psm); identPSMPerQCIdPerPepId.put(peptideId, identPSMPerQCId); } } - List listOt = new ArrayList(); + List listOt = new ArrayList<>(); if (listObjectTreeId.size() > 0) { String otQuery = "SELECT ot FROM fr.proline.core.orm.msi.ObjectTree ot WHERE id IN (:listId) "; TypedQuery queryObjectTree = entityManagerMSI.createQuery(otQuery, ObjectTree.class); @@ -1393,7 +1356,7 @@ private boolean fetchPeptideInstanceData(EntityManager entityManagerMSI, List(); String querySelect2 = "SELECT pi, pm.id, pm.rank, pm.charge, pm.deltaMoz, pm.experimentalMoz, pm.missedCleavage, pm.score, pm.resultSet.id, pm.cdPrettyRank, pm.sdPrettyRank, pm.serializedProperties, p " + "FROM fr.proline.core.orm.msi.PeptideInstance pi, " @@ -1405,7 +1368,7 @@ private boolean fetchPeptideInstanceData(EntityManager entityManagerMSI, List resultList2 = query2.getResultList(); //HashMap peptideMatchMap = new HashMap<>(); itPeptidesQuery = resultList2.iterator(); @@ -1468,9 +1431,9 @@ private boolean fetchPeptideInstanceData(EntityManager entityManagerMSI, List quantProteinSetByQchIds = new HashMap(); - List resultListPSM = queryPSM.getResultList(); - for (Iterator iterator = resultListPSM.iterator(); iterator.hasNext();) { + Map quantProteinSetByQchIds = new HashMap<>(); + List resultListPSM = queryPSM.getResultList(); + for (Iterator iterator = resultListPSM.iterator(); iterator.hasNext();) { Object[] nb = (Object[]) (iterator.next()); int psm = ((Integer) nb[0]); Long rsmId = ((Long) nb[1]); @@ -1486,8 +1449,8 @@ private boolean fetchPeptideInstanceData(EntityManager entityManagerMSI, List listQC = new ArrayList(); - Map> protMatchStatusByIdByQcId = new HashMap(); - Map> protMatchPepNumberByIdByQcId = new HashMap(); + List listQC = new ArrayList<>(); + Map> protMatchStatusByIdByQcId = new HashMap<>(); + Map> protMatchPepNumberByIdByQcId = new HashMap<>(); //Get ProtMatches PepCount and Status in all Quant Channels RSMs if (dataset != null && dataset.getMasterQuantitationChannels() != null && !dataset.getMasterQuantitationChannels().isEmpty()) { listQC = dataset.getMasterQuantitationChannels().get(0).getQuantitationChannels(); for (DQuantitationChannel qch : listQC) { Long identQCRsmId = qch.getIdentResultSummaryId(); - Map statusByProtMatchId = new HashMap(); - Map pepNumberByProtMatchId = new HashMap(); + Map statusByProtMatchId = new HashMap<>(); + Map pepNumberByProtMatchId = new HashMap<>(); queryProtSetStatus.setParameter("rsmId", identQCRsmId); queryPepCountByProtMatch.setParameter("rsmId", identQCRsmId); - List rStatus = queryProtSetStatus.getResultList(); - List rPepNumber = queryPepCountByProtMatch.getResultList(); - for (Object resSt : rStatus) { - Object[] res = (Object[]) resSt; + List rStatus = queryProtSetStatus.getResultList(); + List rPepNumber = queryPepCountByProtMatch.getResultList(); + for (Object[] res : rStatus) { Long proteinMatchId = (Long) res[1]; Boolean isInSubset = (Boolean) res[2]; Long typProteinMatchId = (Long) res[3]; @@ -1731,10 +1692,9 @@ public static boolean fetchProteinSetData(EntityManager entityManagerMSI, DDatas } statusByProtMatchId.put(proteinMatchId, protMatchStatus); } - for (Object resPn : rPepNumber) { - Object[] res = (Object[]) resPn; - Long proteinMatchId = (Long) res[1]; - Integer pepNumber = (Integer) res[0]; + for (Object[] resPep : rPepNumber) { + Long proteinMatchId = (Long) resPep[1]; + Integer pepNumber = (Integer) resPep[0]; pepNumberByProtMatchId.put(proteinMatchId, pepNumber); } protMatchStatusByIdByQcId.put(qch.getId(), statusByProtMatchId); @@ -1782,9 +1742,9 @@ public static boolean fetchProteinSetData(EntityManager entityManagerMSI, DDatas queryCountPepAndQuantPep.setParameter("proteinSetId", masterQuantProteinSet.getProteinSetId()); int nbPep = 0; int nbPepQuant = 0; - List resultList = queryCountPepAndQuantPep.getResultList(); + List resultList = queryCountPepAndQuantPep.getResultList(); if (!resultList.isEmpty()) { - Object[] nb = (Object[]) resultList.get(0); + Object[] nb = resultList.get(0); nbPep = (Integer) nb[1]; nbPepQuant = ((Long) nb[0]).intValue(); } @@ -1792,9 +1752,7 @@ public static boolean fetchProteinSetData(EntityManager entityManagerMSI, DDatas //try to get nbPepQuant from masterQuantProteinSet MasterQuantProteinSetProperties mqPSprop = masterQuantProteinSet.getMasterQuantProtSetProperties(); if(mqPSprop!= null){ - int nbPepQuantSpecific2ProtSet = mqPSprop.getSelectedMasterQuantPeptideIds().size(); -// m_logger.debug(" **** global nbPepQuant "+nbPepQuant+" specific to mqProtSet "+nbPepQuantSpecific2ProtSet); - nbPepQuant = nbPepQuantSpecific2ProtSet; + nbPepQuant = mqPSprop.getSelectedMasterQuantPeptideIds().size(); } @@ -1813,8 +1771,8 @@ public static boolean fetchProteinSetData(EntityManager entityManagerMSI, DDatas // load status and peptideNumber by QcId // VDS version 2.2.0 load quantPeptideNumberByQchIds is deprecated as it is now saved in quantProteinSet. Keep for previous SpectralCount. To be removed in version++ - Map quantStatusByQchIds = new HashMap(); - Map quantPeptideNumberByQchIds = new HashMap(); + Map quantStatusByQchIds = new HashMap<>(); + Map quantPeptideNumberByQchIds = new HashMap<>(); for (DQuantitationChannel qch : listQC) { String status = "Undefined"; Integer pepNumber = -1; //0; @@ -2066,7 +2024,7 @@ private boolean fetchDataPeptideIonForAggregatePeptideIonMainTask() { for (String quantChannelIdString : aggMasterQuantPeptideIonMap.keySet()) { //Long quantChannelId = Long.valueOf(quantChannelIdString); - ArrayList parentMasterQuantIdList = (ArrayList) aggMasterQuantPeptideIonMap.get(quantChannelIdString); + ArrayList parentMasterQuantIdList = aggMasterQuantPeptideIonMap.get(quantChannelIdString); for (Integer id : parentMasterQuantIdList) { masterQuantPeptideIonIds.add(id.longValue()); } @@ -2158,7 +2116,7 @@ private boolean fetchPeptideIonData(EntityManager entityManagerMSI, List l int nbM = m_masterQuantPeptideIonList.size(); int nbMsub = listMasterPeptideIonsIds == null ? 0 : listMasterPeptideIonsIds.size(); - long start = System.currentTimeMillis(); +// long start = System.currentTimeMillis(); String queryMasterPeptideIons = "SELECT new fr.proline.core.orm.msi.dto.DMasterQuantPeptideIon(pi, mqpi, p, pm) " + "FROM fr.proline.core.orm.msi.PeptideInstance pi, fr.proline.core.orm.msi.MasterQuantPeptideIon mqpi, " @@ -2168,12 +2126,12 @@ private boolean fetchPeptideIonData(EntityManager entityManagerMSI, List l TypedQuery queryMasterIons = entityManagerMSI.createQuery(queryMasterPeptideIons, DMasterQuantPeptideIon.class); queryMasterIons.setParameter("listId", listMasterPeptideIonsIds); - List resultListIons = new ArrayList(); + List resultListIons = new ArrayList<>(); if (listMasterPeptideIonsIds != null && !listMasterPeptideIonsIds.isEmpty()) { resultListIons = queryMasterIons.getResultList(); } - List indexes = new ArrayList(); - List listObjectTreeId = new ArrayList(); + List indexes = new ArrayList<>(); + List listObjectTreeId = new ArrayList<>(); ArrayList peptideInstanceIds = new ArrayList(resultListIons.size()); HashMap peptideInstanceMap = new HashMap<>(); @@ -2211,8 +2169,8 @@ private boolean fetchPeptideIonData(EntityManager entityManagerMSI, List l indexes.add(index); } // end for - m_logger.info("DMQPep ions for " + nbMsub + " ions duration = " + (System.currentTimeMillis() - start) + " ms"); - start = System.currentTimeMillis(); +// m_logger.info("DMQPep ions for " + nbMsub + " ions duration = " + (System.currentTimeMillis() - start) + " ms"); +// start = System.currentTimeMillis(); ///////////////////////////////// HashMap peptideMap = new HashMap<>(); @@ -2229,7 +2187,7 @@ private boolean fetchPeptideIonData(EntityManager entityManagerMSI, List l Query query = entityManagerMSI.createQuery(querySelect); query.setParameter("listId", peptideInstanceIds); - List resultList = query.getResultList(); + List resultList = query.getResultList(); Iterator itPeptidesQuery = resultList.iterator(); while (itPeptidesQuery.hasNext()) { Object[] resCur = itPeptidesQuery.next(); @@ -2264,8 +2222,8 @@ private boolean fetchPeptideIonData(EntityManager entityManagerMSI, List l } - DatabasePTMSitesTask.fetchReadablePTMData(entityManagerMSI, m_dataset.getResultSetId(), peptideMap, null); - DatabasePTMSitesTask.fetchPTMDataForPeptides(entityManagerMSI, peptideMap, null); + DatabasePTMsTask.fillReadablePTMDataForPeptides(entityManagerMSI, m_dataset.getResultSetId(), peptideMap, null); + DatabasePTMsTask.fillPeptidePTMForPeptides(entityManagerMSI, peptideMap, null); ArrayList peptideMatchIds = new ArrayList<>(peptideMatchMap.size()); peptideMatchIds.addAll(peptideMatchMap.keySet()); @@ -2275,15 +2233,15 @@ private boolean fetchPeptideIonData(EntityManager entityManagerMSI, List l fetchPeptideIonAbundances(listObjectTreeId, entityManagerMSI, indexes); // peptideIons without peptide - indexes = new ArrayList(); - listObjectTreeId = new ArrayList(); + indexes = new ArrayList<>(); + listObjectTreeId = new ArrayList<>(); String queryPeptideIonWithoutPeptide = "SELECT new fr.proline.core.orm.msi.dto.DMasterQuantPeptideIon(mqpi) " + "FROM fr.proline.core.orm.msi.MasterQuantPeptideIon mqpi " + "WHERE mqpi.id IN (:listId) AND mqpi.peptideInstance is NULL " + "ORDER BY mqpi.id ASC"; TypedQuery queryMasterIons2 = entityManagerMSI.createQuery(queryPeptideIonWithoutPeptide, DMasterQuantPeptideIon.class); queryMasterIons2.setParameter("listId", listMasterPeptideIonsIds); - List resultListIons2 = new ArrayList(); + List resultListIons2 = new ArrayList<>(); if (listMasterPeptideIonsIds != null && !listMasterPeptideIonsIds.isEmpty()) { resultListIons2 = queryMasterIons2.getResultList(); } @@ -2304,15 +2262,15 @@ private boolean fetchPeptideIonData(EntityManager entityManagerMSI, List l fetchPeptideIonAbundances(listObjectTreeId, entityManagerMSI, indexes); - m_logger.info("Fetch ions pepInstance, pepMatch & Ab. for " + nbMsub + " ions duration = " + (System.currentTimeMillis() - start) + " ms"); - start = System.currentTimeMillis(); +// m_logger.info("Fetch ions pepInstance, pepMatch & Ab. for " + nbMsub + " ions duration = " + (System.currentTimeMillis() - start) + " ms"); +// start = System.currentTimeMillis(); return true; } private void fetchPeptideIonAbundances(List listObjectTreeId, EntityManager entityManagerMSI, List indexes) { //object tree - List listOt = new ArrayList(); + List listOt = new ArrayList<>(); if (listObjectTreeId.size() > 0) { String otQuery = "SELECT ot FROM fr.proline.core.orm.msi.ObjectTree ot WHERE id IN (:listId) "; TypedQuery queryObjectTree = entityManagerMSI.createQuery(otQuery, ObjectTree.class); @@ -2357,9 +2315,9 @@ private boolean fetchDataPSMForPeptideMainTask() { List listMasterQuantitationChannels = m_dataset.getMasterQuantitationChannels(); - m_peptideMatchIds = new ArrayList(); - m_peptideMatchMap = new HashMap(); - m_peptideMatchSequenceMatchArrayMap = new HashMap(); + m_peptideMatchIds = new ArrayList<>(); + m_peptideMatchMap = new HashMap<>(); + m_peptideMatchSequenceMatchArrayMap = new HashMap<>(); if (listMasterQuantitationChannels != null && !listMasterQuantitationChannels.isEmpty()) { for (DMasterQuantitationChannel masterQuantitationChannel : listMasterQuantitationChannels) { @@ -2402,11 +2360,7 @@ private boolean fetchDataPSMForPeptideMainTask() { m_peptideMatchIds.add(pmId); m_peptideMatchMap.put(pmId, psm); - ArrayList sequenceMatchArray = m_peptideMatchSequenceMatchArrayMap.get(pmId); - if (sequenceMatchArray == null) { - sequenceMatchArray = new ArrayList<>(); - m_peptideMatchSequenceMatchArrayMap.put(pmId, sequenceMatchArray); - } + ArrayList sequenceMatchArray = m_peptideMatchSequenceMatchArrayMap.computeIfAbsent(pmId, k -> new ArrayList<>()); sequenceMatchArray.add(psm); } m_psmIdPerQC.put(qcId, listPeptideMatchIds); @@ -2530,7 +2484,7 @@ private void fetchMsQuery(EntityManager entityManagerMSI, SubTask subTask) { long msqId = (Long) o[i++]; int msqInitialId = (Integer) o[i++]; Float precursorIntensity = (Float) o[i++]; - Float retentionTime = (Float) o[i++]; + Float retentionTime = (Float) o[i]; DMsQuery q = new DMsQuery(pmId, msqId, msqInitialId, precursorIntensity); DPeptideMatch peptideMatch = m_peptideMatchMap.get(q.getPeptideMatchId()); @@ -2567,7 +2521,7 @@ public static void fetchProteinSetName(EntityManager entityManagerMSI, List slic proteinSetQuery.setParameter("listId", sliceOfPeptideMatchIds); - ArrayList proteinSetNameArray = new ArrayList(); + ArrayList proteinSetNameArray = new ArrayList<>(); long prevPeptideMatchId = -1; List msQueries = proteinSetQuery.getResultList(); @@ -2580,7 +2534,7 @@ public static void fetchProteinSetName(EntityManager entityManagerMSI, List slic if (peptideMatchId != prevPeptideMatchId) { if (prevPeptideMatchId != -1) { DPeptideMatch prevPeptideMatch = peptideMatchMap.get(prevPeptideMatchId); - String[] proteinSetNames = proteinSetNameArray.toArray(new String[proteinSetNameArray.size()]); + String[] proteinSetNames = proteinSetNameArray.toArray(new String[0]); prevPeptideMatch.setProteinSetStringArray(proteinSetNames); proteinSetNameArray.clear(); proteinSetNameArray.add(proteinName); @@ -2595,7 +2549,7 @@ public static void fetchProteinSetName(EntityManager entityManagerMSI, List slic } if (prevPeptideMatchId != -1) { DPeptideMatch prevPeptideMatch = peptideMatchMap.get(prevPeptideMatchId); - String[] proteinSetNames = proteinSetNameArray.toArray(new String[proteinSetNameArray.size()]); + String[] proteinSetNames = proteinSetNameArray.toArray(new String[0]); prevPeptideMatch.setProteinSetStringArray(proteinSetNames); } diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/DatabaseModifyPeptideTask.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/DatabaseModifyPeptideTask.java index f97a7e8cf..163733b7e 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/DatabaseModifyPeptideTask.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/DatabaseModifyPeptideTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/MapAlignmentConverter.java b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/MapAlignmentConverter.java index 88f6cc137..d589d1cf0 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/MapAlignmentConverter.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/dam/tasks/xic/MapAlignmentConverter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks.xic; import fr.proline.core.orm.lcms.MapAlignment; @@ -108,7 +108,7 @@ public static Double calcTargetMapElutionTime(MapAlignment mapAlignment, Double int i = 0; for(MapTime mapTime: mapTimeList){ times[i] = mapTime.getTime(); - deltaTimes[i] = mapTime.getDeltaTime(); + deltaTimes[i] = mapTime.getDeltaValue(); i++; } return refTime + linearInterpolation(refTime, times, deltaTimes); diff --git a/prolinestudio-dam/src/main/java/fr/proline/studio/id/ProjectId.java b/prolinestudio-dam/src/main/java/fr/proline/studio/id/ProjectId.java index 564ac72df..eef709afc 100644 --- a/prolinestudio-dam/src/main/java/fr/proline/studio/id/ProjectId.java +++ b/prolinestudio-dam/src/main/java/fr/proline/studio/id/ProjectId.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.id; /** diff --git a/prolinestudio-dam/src/test/java/fr/proline/studio/dam/tasks/ptm/PTMDatasetReaderTest.java b/prolinestudio-dam/src/test/java/fr/proline/studio/dam/tasks/ptm/PTMDatasetReaderTest.java index 4d2bd4e70..3d5db6451 100644 --- a/prolinestudio-dam/src/test/java/fr/proline/studio/dam/tasks/ptm/PTMDatasetReaderTest.java +++ b/prolinestudio-dam/src/test/java/fr/proline/studio/dam/tasks/ptm/PTMDatasetReaderTest.java @@ -1,23 +1,24 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks.ptm; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import fr.proline.studio.Exceptions; import fr.proline.studio.dam.tasks.data.ptm.JSONPTMDataset; import java.io.BufferedReader; import java.io.File; @@ -30,7 +31,6 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.openide.util.Exceptions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/prolinestudio-dam/src/test/java/fr/proline/studio/dam/tasks/xic/MapAlignmentConverterTest.java b/prolinestudio-dam/src/test/java/fr/proline/studio/dam/tasks/xic/MapAlignmentConverterTest.java index 186f040e2..c965fabc7 100644 --- a/prolinestudio-dam/src/test/java/fr/proline/studio/dam/tasks/xic/MapAlignmentConverterTest.java +++ b/prolinestudio-dam/src/test/java/fr/proline/studio/dam/tasks/xic/MapAlignmentConverterTest.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dam.tasks.xic; import fr.proline.core.orm.lcms.MapAlignment; @@ -23,13 +23,14 @@ import fr.proline.core.orm.lcms.ProcessedMap; import java.util.ArrayList; import java.util.List; + +import fr.proline.studio.Exceptions; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; -import org.openide.util.Exceptions; /** * diff --git a/prolinestudio-dpm/pom.xml b/prolinestudio-dpm/pom.xml index 99ff75c97..fc654aadd 100644 --- a/prolinestudio-dpm/pom.xml +++ b/prolinestudio-dpm/pom.xml @@ -5,12 +5,12 @@ prolinestudio-parent fr.proline - 2.1.2 + 2.2.0 fr.proline prolinestudio-dpm - nbm + jar ProlineStudio-DPM @@ -24,20 +24,9 @@ ${project.groupId} prolinestudio-logger ${project.version} + pom - - com.google.http-client - google-http-client - 1.20.0 - - - - commons-logging - commons-logging - - - - - net.minidev - json-smart - 2.2 - + + + + + + org.hibernate.javax.persistence @@ -164,23 +131,23 @@ + + + - org.codehaus.mojo - nbm-maven-plugin - - true - - - fr.proline.studio.dpm.* - javax.jms.* - org.jboss.logging.* - javax.annotation.* - - + com.google.code.maven-replacer-plugin + replacer + + + + + + + diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/AccessJMSManagerThread.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/AccessJMSManagerThread.java index f51553132..386e12ab4 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/AccessJMSManagerThread.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/AccessJMSManagerThread.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm; import fr.proline.studio.dam.taskinfo.TaskInfoManager; @@ -34,7 +34,7 @@ public class AccessJMSManagerThread extends Thread { private Connection m_connection; private Session m_session; private LinkedList m_taskList = new LinkedList<>(); - + public static AccessJMSManagerThread getAccessJMSManagerThread() { if (m_instance == null) { m_instance = new AccessJMSManagerThread(); @@ -47,8 +47,10 @@ private AccessJMSManagerThread() { super("AccessJMSManagerThread"); // useful for debugging initSession(); } - + + public Session getSession(){ + return m_session; } @@ -76,7 +78,10 @@ public void run() { // init session if needed initSession(); - + + //VD TEST : To remove + LoggerFactory.getLogger("ProlineStudio.DPM").debug("**JMSTEST** "+Thread.currentThread().getId()+":"+Thread.currentThread().getName()+" task.askJMS "+task.getClass()); + // fetch data task.askJMS(); @@ -95,7 +100,7 @@ private void initSession() { try { // Get JMS Connection m_connection = JMSConnectionManager.getJMSConnectionManager().getJMSConnection(); - m_connection.start(); // Explicitely start connection to begin Consumer reception + m_connection.start();// Explicitly start connection to begin Consumer reception m_session = m_connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); } catch (JMSException je) { LoggerFactory.getLogger("ProlineStudio.DPM").error("Unexpected exception when initializing JMS Connection", je); @@ -119,6 +124,7 @@ public final void addTask(AbstractJMSTask task) { notifyAll(); } } + public void cleanup() { if (m_session != null) { diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/ServerConnectionManager.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/ServerConnectionManager.java index d214af352..b504ba530 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/ServerConnectionManager.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/ServerConnectionManager.java @@ -1,21 +1,23 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm; +import fr.proline.studio.NbPreferences; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.DatabaseDataManager; import fr.proline.studio.dam.taskinfo.TaskError; @@ -29,10 +31,11 @@ import java.util.HashMap; import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; -import org.openide.util.NbPreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.swing.*; + /** * Management of the connection to the Jetty Server and to the databases * @@ -145,7 +148,6 @@ public void tryServerConnection(final Runnable connectionCallback, final String //throw new RuntimeException("Error creating connection to JMS Server "+e.getMessage()); } - userAuthenticateJMS(connectionCallback, serverURL, projectUser, userPassword, changingUser); } @@ -200,12 +202,17 @@ public void run(boolean success) { connectionCallback.run(); } } + + + } }; m_loggerProline.debug(" ---- WILL RUN AuthenticateUserTask "); AuthenticateUserTask task = new AuthenticateUserTask(callback, projectUser, userPassword, databasePassword); AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); + + } diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/data/CVParam.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/data/CVParam.java index 9490a2415..76efc663a 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/data/CVParam.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/data/CVParam.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.data; import java.util.Objects; diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/data/ChangeTypicalRule.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/data/ChangeTypicalRule.java index b4fe9d5e9..6b98e48ae 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/data/ChangeTypicalRule.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/data/ChangeTypicalRule.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.data; /** diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/data/JMSNotificationMessage.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/data/JMSNotificationMessage.java index 64ed9e271..cc2e34696 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/data/JMSNotificationMessage.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/data/JMSNotificationMessage.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.data; import static fr.proline.studio.dam.taskinfo.TaskInfo.*; diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/serverfilesystem/RootInfo.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/serverfilesystem/RootInfo.java index de5e2ab94..81a76fde4 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/serverfilesystem/RootInfo.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/serverfilesystem/RootInfo.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.serverfilesystem; /** diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/serverfilesystem/ServerFile.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/serverfilesystem/ServerFile.java index 2dcaafcc5..91a25668d 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/serverfilesystem/ServerFile.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/serverfilesystem/ServerFile.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.serverfilesystem; import java.io.File; diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/serverfilesystem/ServerFileSystemView.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/serverfilesystem/ServerFileSystemView.java index bdfd01687..eea591287 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/serverfilesystem/ServerFileSystemView.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/serverfilesystem/ServerFileSystemView.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.serverfilesystem; import fr.proline.studio.dpm.AccessJMSManagerThread; diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AbstractJMSCallback.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AbstractJMSCallback.java index 17ea87300..c2d518efa 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AbstractJMSCallback.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AbstractJMSCallback.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import fr.proline.studio.dam.taskinfo.TaskError; diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AbstractJMSTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AbstractJMSTask.java index 864efce2d..cc1c9d598 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AbstractJMSTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AbstractJMSTask.java @@ -1,288 +1,355 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.dpm.task.jms; - -import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; -import fr.proline.core.orm.uds.UserAccount; -import fr.proline.studio.dam.DatabaseDataManager; -import fr.proline.studio.dam.taskinfo.AbstractLongTask; -import fr.proline.studio.dam.taskinfo.TaskError; -import fr.proline.studio.dam.taskinfo.TaskInfo; -import fr.proline.studio.dpm.AccessJMSManagerThread; -import fr.proline.studio.dpm.task.util.JMSConnectionManager; -import fr.proline.studio.dpm.task.util.JMSMessageUtil; -import fr.proline.studio.gui.InfoDialog; -import fr.proline.studio.utils.StudioExceptions; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.concurrent.atomic.AtomicInteger; -import javax.jms.*; -import javax.swing.SwingUtilities; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author JM235353 - */ -public abstract class AbstractJMSTask extends AbstractLongTask implements MessageListener { - - public enum JMSState { - STATE_FAILED, - STATE_WAITING, - STATE_DONE - }; - - // callback is called by the AccessServiceThread when the service is done - protected AbstractJMSCallback m_callback; - - protected MessageProducer m_producer = null; - protected MessageConsumer m_responseConsumer = null; - protected TemporaryQueue m_replyQueue = null; - - protected JMSState m_currentState = null; - - protected TaskError m_taskError = null; - - protected boolean m_synchronous; - private int responseTimeout = 10000; - - protected static final Logger m_loggerProline = LoggerFactory.getLogger("ProlineStudio.DPM.Task"); - - public static final String TASK_LIST_INFO = "Services JMS"; - - - /* To count received messages */ - public final AtomicInteger MESSAGE_COUNT_SEQUENCE = new AtomicInteger(0); - - public AbstractJMSTask(AbstractJMSCallback callback, TaskInfo taskInfo) { - super(taskInfo); - - m_callback = callback; - m_synchronous = false; - } - - public AbstractJMSTask(AbstractJMSCallback callback, boolean synchronous, TaskInfo taskInfo) { - super(taskInfo); - m_taskInfo = taskInfo; - m_callback = callback; - m_synchronous = synchronous; - } - - /** - * Specify the timeout value (in milliseconds) to wait for message. This is - * only used for synchronuous tasks. Default value is 10000 ms. - * - * @param timeout - */ - protected void setResponseTimeout(int timeout) { - responseTimeout = timeout; - } - - /** - * Method called by the AccessJMSManagerThread to ask for the service to be - * done - * - * @throws javax.jms.JMSException - */ - public void askJMS() throws JMSException { - try { - - /* - * Thread specific : Session, Producer, Consumer ... - */ - // Get JMS Session (Session MUST be confined in current Thread) - Session m_session = AccessJMSManagerThread.getAccessJMSManagerThread().getSession(); - - // Step 6. Create a JMS Message Producer (Producer MUST be confined in current Thread) - m_producer = m_session.createProducer(JMSConnectionManager.getJMSConnectionManager().getServiceQueue()); - - m_replyQueue = m_session.createTemporaryQueue(); - m_responseConsumer = m_session.createConsumer(m_replyQueue); - if (!m_synchronous) { - m_responseConsumer.setMessageListener(this); - } - - m_currentState = JMSState.STATE_WAITING; - taskRun(); - if (m_synchronous) { - Message responseMsg = m_responseConsumer.receive(responseTimeout); - onMessage(responseMsg); - } - } catch (Exception ex) { - m_loggerProline.error("Error sending JMS Message", ex); - m_currentState = JMSState.STATE_FAILED; - m_taskError = new TaskError(ex); - callback(false); - } - } - - /** - * Called when the task must be started. The implementation should call - * setTaskInfoRequest to register request informations - * - * @throws JMSException - */ - public abstract void taskRun() throws JMSException; - - public void setTaskInfoRequest(String content) throws JMSException { - m_taskInfo.setRequestURL(m_producer.getDestination().toString()); - m_taskInfo.setRequestContent(content); - } - - protected void addSourceToMessage(Message message) throws JMSException { - - StringBuilder userLoginSB = new StringBuilder(); - UserAccount user = DatabaseDataManager.getDatabaseDataManager().getLoggedUser(); - if (user != null) { - userLoginSB.append(user.getLogin()); - } else { - userLoginSB.append("Unknown user"); - } - String hostIP; - try { - hostIP = InetAddress.getLocalHost().getHostAddress(); - } catch (UnknownHostException uhe) { - hostIP = "Unknown"; - } - userLoginSB.append(" (host ").append(hostIP).append(")"); - message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_SOURCE_KEY, userLoginSB.toString()); - - } - - protected void addDescriptionToMessage(Message message) throws JMSException { - message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_DESCR_KEY, m_taskInfo.getTaskDescription()); - } - - /** - * Called when the task is done - * - * @param jmsMessage - * @throws Exception - */ - public abstract void taskDone(final Message jmsMessage) throws Exception; - - /** - * Method called by the ServiceStatusThread to check if the service is done - * - * @return current JMS Task State (one of AbstractJMSTask.JMSState) - */ - public AbstractJMSTask.JMSState getJMSState() { - return m_currentState; - } - - /** - * task listen received message, finished - * - * @param jmsMessage :received Message - */ - @Override - public final void onMessage(final Message jmsMessage) { - - long endRun = System.currentTimeMillis(); -// this.m_taskInfo.setDuration(endRun-m_startRun); - this.m_taskInfo.setDuration(endRun - m_taskInfo.getStartTimestamp()); - - if (jmsMessage != null) { - m_loggerProline.info("Receiving message n° " + MESSAGE_COUNT_SEQUENCE.incrementAndGet() + " : " + JMSMessageUtil.formatMessage(jmsMessage)); - - try { - taskDone(jmsMessage); - } catch (JSONRPC2Error jsonErr) { - m_currentState = JMSState.STATE_FAILED; - m_loggerProline.error("Error handling JMS Message", jsonErr); - if (jsonErr.getCode() == JMSConnectionManager.JMS_CANCELLED_TASK_ERROR_CODE) { - m_taskInfo.setAborted(); - } - m_taskError = new TaskError(jsonErr); - } catch (Exception e) { - m_currentState = JMSState.STATE_FAILED; - m_loggerProline.error("Error handling JMS Message", e); - m_taskError = new TaskError(e); - } - } else { - String msg = "Error receiving message n° " + MESSAGE_COUNT_SEQUENCE.incrementAndGet() + ": timeout should have occured "; - m_loggerProline.info(msg); - m_currentState = JMSState.STATE_FAILED; - m_taskError = new TaskError(new RuntimeException(msg)); - } - - if (m_currentState == JMSState.STATE_FAILED) { - callback(false); - } else if (m_currentState == JMSState.STATE_DONE) { - callback(true); - } else { - // should never happen : state not set - m_taskError = new TaskError("Task with State not set"); - m_currentState = JMSState.STATE_FAILED; - callback(false); - } - - try { - if (jmsMessage != null) { - jmsMessage.acknowledge(); - } - } catch (JMSException ex) { - m_loggerProline.error("Error running JMS Message acknowledge", ex); - } - - } - - /** - * Method called after the service has been done - * - * @param success boolean indicating if the fetch has succeeded - */ - protected void callback(final boolean success) { - if (m_callback == null) { - - getTaskInfo().setFinished(success, m_taskError, true); - - return; - } - - m_callback.setTaskInfo(m_taskInfo); - m_callback.setTaskError(m_taskError); - - if (m_callback.mustBeCalledInAWT()) { - // Callback must be executed in the Graphical thread (AWT) - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - showError(m_taskError); - m_callback.run(success); - - getTaskInfo().setFinished(success, m_taskError, true); - } - }); - } else { - showError(m_taskError); - // Method called in the current thread - // In this case, we assume the execution is fast. - m_callback.run(success); - getTaskInfo().setFinished(success, m_taskError, true); - } - } - - protected void showError(TaskError taskErr) { - if (taskErr != null) { - StudioExceptions.notify("JMS Task Error", new Exception(taskErr.getErrorTitle() + "\n" + taskErr.getErrorText())); - } - } - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.dpm.task.jms; + +import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; +import fr.proline.core.orm.uds.Project; +import fr.proline.core.orm.uds.UserAccount; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dam.DatabaseDataManager; +import fr.proline.studio.dam.taskinfo.AbstractLongTask; +import fr.proline.studio.dam.taskinfo.TaskError; +import fr.proline.studio.dam.taskinfo.TaskInfo; +import fr.proline.studio.dock.gui.InfoLabel; +import fr.proline.studio.dpm.AccessJMSManagerThread; +import fr.proline.studio.dpm.task.util.JMSConnectionManager; +import fr.proline.studio.dpm.task.util.JMSMessageUtil; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.concurrent.atomic.AtomicInteger; +import javax.jms.*; +import javax.swing.SwingUtilities; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author JM235353 + */ +public abstract class AbstractJMSTask extends AbstractLongTask implements MessageListener { + + public enum JMSState { + STATE_FAILED, + STATE_WAITING, + STATE_DONE + }; + + // callback is called by the AccessServiceThread when the service is done + protected AbstractJMSCallback m_callback; + + protected MessageProducer m_producer = null; + protected MessageConsumer m_responseConsumer = null; + protected TemporaryQueue m_replyQueue = null; + + protected JMSState m_currentState = null; + + protected TaskError m_taskError = null; + + protected boolean m_synchronous; + private int responseTimeout = 10000; + + protected static final Logger m_loggerProline = LoggerFactory.getLogger("ProlineStudio.DPM.Task"); + + public static final String TASK_LIST_INFO = "Services JMS"; + + protected Session m_session; + + /* To count received messages */ + public final AtomicInteger MESSAGE_COUNT_SEQUENCE = new AtomicInteger(0); + + public AbstractJMSTask(AbstractJMSCallback callback, TaskInfo taskInfo) { + super(taskInfo); + + m_callback = callback; + m_synchronous = false; + } + + public AbstractJMSTask(AbstractJMSCallback callback, boolean synchronous, TaskInfo taskInfo) { + super(taskInfo); + m_taskInfo = taskInfo; + m_callback = callback; + m_synchronous = synchronous; + + } + + /** + * Specify the timeout value (in milliseconds) to wait for message. This is + * only used for synchronuous tasks. Default value is 10000 ms. + * + * @param timeout + */ + protected void setResponseTimeout(int timeout) { + responseTimeout = timeout; + } + + /** + * Method called by the AccessJMSManagerThread to ask for the service to be + * done + * + * @throws javax.jms.JMSException + */ + public void askJMS() throws JMSException { + try { + + LoggerFactory.getLogger("ProlineStudio.DPM").debug("**JMSTEST** "+Thread.currentThread().getId()+":"+Thread.currentThread().getName()+" askJMS Start "+getClass()); + + + /* + * Thread specific : Session, Producer, Consumer ... + */ + // Get JMS Session (Session MUST be confined in current Thread) + m_session = AccessJMSManagerThread.getAccessJMSManagerThread().getSession(); + + // Step 6. Create a JMS Message Producer (Producer MUST be confined in current Thread) + m_producer = m_session.createProducer(JMSConnectionManager.getJMSConnectionManager().getServiceQueue()); + + m_replyQueue = m_session.createTemporaryQueue(); + m_responseConsumer = m_session.createConsumer(m_replyQueue); + if (!m_synchronous) { + m_responseConsumer.setMessageListener(this); + } + + m_currentState = JMSState.STATE_WAITING; + taskRun(); + if (m_synchronous) { + Message responseMsg = m_responseConsumer.receive(responseTimeout); + onMessage(responseMsg); + } + + LoggerFactory.getLogger("ProlineStudio.DPM").debug("**JMSTEST** "+Thread.currentThread().getId()+":"+Thread.currentThread().getName()+" askJMS end "+getClass()); + + } catch (Exception ex) { + + LoggerFactory.getLogger("ProlineStudio.DPM").debug("**JMSTEST** "+Thread.currentThread().getId()+":"+Thread.currentThread().getName()+" askJMS error "+getClass()); + ex.printStackTrace(); + + m_loggerProline.error("Error sending JMS Message", ex); + m_currentState = JMSState.STATE_FAILED; + m_taskError = new TaskError(ex); + callback(false); + } + } + + /** + * Called when the task must be started. The implementation should call + * setTaskInfoRequest to register request informations + * + * @throws JMSException + */ + public abstract void taskRun() throws JMSException; + + public void setTaskInfoRequest(String content) throws JMSException { + m_taskInfo.setRequestURL(m_producer.getDestination().toString()); + m_taskInfo.setRequestContent(content); + } + + protected void addSupplementaryInfo(Message message, Long projectId )throws JMSException { + addSourceToMessage(message); + addDescriptionToMessage(message); + addProjectIdToMessage(message, projectId); + } + + protected void addSupplementaryInfo(Message message)throws JMSException { + addSourceToMessage(message); + addDescriptionToMessage(message); + addProjectIdToMessage(message, null); + } + + protected void addSourceToMessage(Message message) throws JMSException { + + StringBuilder userLoginSB = new StringBuilder(); + UserAccount user = DatabaseDataManager.getDatabaseDataManager().getLoggedUser(); + if (user != null) { + userLoginSB.append(user.getLogin()); + } else { + userLoginSB.append("Unknown user"); + } + String hostIP; + try { + hostIP = InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException uhe) { + hostIP = "Unknown"; + } + userLoginSB.append(" (host ").append(hostIP).append(")"); + message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_SOURCE_KEY, userLoginSB.toString()); + + } + + protected void addDescriptionToMessage(Message message) throws JMSException { + message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_DESCR_KEY, m_taskInfo.getTaskDescription()); + } + + protected void addProjectIdToMessage(Message message, Long projectId) throws JMSException { + String pId = null; + if(projectId == null) { + Project p = DatabaseDataManager.getDatabaseDataManager().getCurrentProject(); + if(p!=null) + projectId = p.getId(); + } + + if(projectId != null) + pId = String.valueOf(projectId); + + message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_PROJECT_ID_KEY, pId); + } + + /** + * Called when the task is done + * + * @param jmsMessage + * @throws Exception + */ + public abstract void taskDone(final Message jmsMessage) throws Exception; + + /** + * Method called by the ServiceStatusThread to check if the service is done + * + * @return current JMS Task State (one of AbstractJMSTask.JMSState) + */ + public AbstractJMSTask.JMSState getJMSState() { + return m_currentState; + } + + /** + * task listen received message, finished + * + * @param jmsMessage :received Message + */ + @Override + public final void onMessage(final Message jmsMessage) { + + + + LoggerFactory.getLogger("ProlineStudio.DPM").debug("**JMSTEST** "+Thread.currentThread().getId()+":"+Thread.currentThread().getName()+" onMessage start "+getClass()); + + long endRun = System.currentTimeMillis(); +// this.m_taskInfo.setDuration(endRun-m_startRun); + this.m_taskInfo.setDuration(endRun - m_taskInfo.getStartTimestamp()); + + if (jmsMessage != null) { + m_loggerProline.info("Receiving message n° " + MESSAGE_COUNT_SEQUENCE.incrementAndGet() + " : " + JMSMessageUtil.formatMessage(jmsMessage)); + + try { + taskDone(jmsMessage); + + + } catch (JSONRPC2Error jsonErr) { + + LoggerFactory.getLogger("ProlineStudio.DPM").debug("**JMSTEST** "+Thread.currentThread().getId()+":"+Thread.currentThread().getName()+" onMessage error "+getClass()); + jsonErr.printStackTrace(); + + m_currentState = JMSState.STATE_FAILED; + m_loggerProline.error("Error handling JMS Message", jsonErr); + if (jsonErr.getCode() == JMSConnectionManager.JMS_CANCELLED_TASK_ERROR_CODE) { + m_taskInfo.setAborted(); + } + m_taskError = new TaskError(jsonErr); + } catch (Exception e) { + + LoggerFactory.getLogger("ProlineStudio.DPM").debug("**JMSTEST** "+Thread.currentThread().getId()+":"+Thread.currentThread().getName()+" onMessage error2 "+getClass()); + e.printStackTrace(); + + m_currentState = JMSState.STATE_FAILED; + m_loggerProline.error("Error handling JMS Message", e); + m_taskError = new TaskError(e); + } + } else { + String msg = "Error receiving message n° " + MESSAGE_COUNT_SEQUENCE.incrementAndGet() + ": timeout should have occured "; + + LoggerFactory.getLogger("ProlineStudio.DPM").debug("**JMSTEST** "+Thread.currentThread().getId()+":"+Thread.currentThread().getName()+" onMessage error3 "+getClass()); + + + m_loggerProline.info(msg); + m_currentState = JMSState.STATE_FAILED; + m_taskError = new TaskError(new RuntimeException(msg)); + } + + + try { + if (jmsMessage != null) { + jmsMessage.acknowledge(); + } + } catch (JMSException ex) { + + LoggerFactory.getLogger("ProlineStudio.DPM").debug("**JMSTEST** "+Thread.currentThread().getId()+":"+Thread.currentThread().getName()+" onMessage error4 "+getClass()); + ex.printStackTrace(); + + m_loggerProline.error("Error running JMS Message acknowledge", ex); + } + + if (m_currentState == JMSState.STATE_FAILED) { + callback(false); + } else if (m_currentState == JMSState.STATE_DONE) { + callback(true); + } else { + // should never happen : state not set + m_taskError = new TaskError("Task with State not set"); + m_currentState = JMSState.STATE_FAILED; + callback(false); + } + + + + } + + /** + * Method called after the service has been done + * + * @param success boolean indicating if the fetch has succeeded + */ + protected void callback(final boolean success) { + + + + if (m_callback == null) { + + getTaskInfo().setFinished(success, m_taskError, true); + + return; + } + + m_callback.setTaskInfo(m_taskInfo); + m_callback.setTaskError(m_taskError); + + if (m_callback.mustBeCalledInAWT()) { + // Callback must be executed in the Graphical thread (AWT) + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + showError(m_taskError); + m_callback.run(success); + + getTaskInfo().setFinished(success, m_taskError, true); + } + }); + } else { + showError(m_taskError); + // Method called in the current thread + // In this case, we assume the execution is fast. + m_callback.run(success); + getTaskInfo().setFinished(success, m_taskError, true); + } + } + + protected void showError(TaskError taskErr) { + if (taskErr != null) { + WindowManager.getDefault().getMainWindow().alert(InfoLabel.INFO_LEVEL.ERROR, new Exception(taskErr.getErrorTitle() + "\n" + taskErr.getErrorText())); + } + } + +} diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AggregateQuantitationTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AggregateQuantitationTask.java index 344fdb091..e2c766e20 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AggregateQuantitationTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AggregateQuantitationTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -60,13 +60,12 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); - addSourceToMessage(message); - addDescriptionToMessage(message); + addSupplementaryInfo(message); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); setTaskInfoRequest(message.getText()); diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AuthenticateUserTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AuthenticateUserTask.java index 460d328c9..32db15a0d 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AuthenticateUserTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/AuthenticateUserTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -25,7 +25,6 @@ import fr.profi.util.security.SecurityUtils; import fr.proline.studio.dam.taskinfo.TaskInfo; import fr.proline.studio.dpm.AccessJMSManagerThread; -import static fr.proline.studio.dpm.task.jms.AbstractJMSTask.m_loggerProline; import static fr.proline.studio.dpm.task.util.JMSConnectionManager.JMS_EXPIRED_MSG_ERROR_CODE; import fr.proline.studio.dpm.task.util.JMSConnectionManager; import java.util.HashMap; @@ -44,6 +43,8 @@ public class AuthenticateUserTask extends AbstractJMSTask { private String m_password; private String[] m_databasePassword; private static int TASK_TIMEOUT_MS = 20000; + + public static int count = 0; public AuthenticateUserTask(AbstractJMSCallback callback, String m_userName, String m_password, String[] m_databasePassword) { super(callback, true,new TaskInfo("Check User " + m_userName, false, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_HIGH)); @@ -51,6 +52,8 @@ public AuthenticateUserTask(AbstractJMSCallback callback, String m_userName, Str this.m_password = m_password; this.m_databasePassword = m_databasePassword; super.setResponseTimeout(TASK_TIMEOUT_MS); + + count++; } @Override @@ -59,14 +62,13 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_USER_AUTHENTICATE_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/admin/UserAccount"); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message m_producer.send(message); @@ -92,6 +94,8 @@ public void taskDone(Message jmsMessage) throws Exception { final JSONRPC2Message jsonMessage = JSONRPC2Message.parse(jsonString); if(jsonMessage instanceof JSONRPC2Notification) { + System.out.println(count); + m_loggerProline.warn("JSON Notification method: " + ((JSONRPC2Notification) jsonMessage).getMethod()+" instead of JSON Response"); throw new Exception("Invalid JSONRPC2Message type"); diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CancelTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CancelTask.java index 17759b13e..d0937c87f 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CancelTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CancelTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -49,15 +49,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request("cancel", Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setJMSCorrelationID(m_messageId); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); // message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); + addSupplementaryInfo(message); setTaskInfoRequest(message.getText()); diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CertifyIdentificationTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CertifyIdentificationTask.java index 7c4683c35..48e869676 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CertifyIdentificationTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CertifyIdentificationTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -66,13 +66,12 @@ public void taskRun() throws JMSException { //Add Service parameters jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/dps/msi/CertifyResultFiles"); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ChangePasswordTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ChangePasswordTask.java index 17abf5e92..9d3a2482a 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ChangePasswordTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ChangePasswordTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -57,15 +57,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(m_methodName, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); //message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ChangeTypicalProteinTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ChangeTypicalProteinTask.java index 1d8ce3388..1e4115345 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ChangeTypicalProteinTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ChangeTypicalProteinTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -56,14 +56,13 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/dps/msi/ChangeTypicalProteinMatch"); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message @@ -92,38 +91,38 @@ private HashMap createParams() { @Override public void taskDone(final Message jmsMessage) throws Exception { - + final TextMessage textMessage = (TextMessage) jmsMessage; final String jsonString = textMessage.getText(); final JSONRPC2Message jsonMessage = JSONRPC2Message.parse(jsonString); - if(jsonMessage instanceof JSONRPC2Notification) { - m_loggerProline.warn("JSON Notification method: " + ((JSONRPC2Notification) jsonMessage).getMethod()+" instead of JSON Response"); + if (jsonMessage instanceof JSONRPC2Notification) { + m_loggerProline.warn("JSON Notification method: " + ((JSONRPC2Notification) jsonMessage).getMethod() + " instead of JSON Response"); throw new Exception("Invalid JSONRPC2Message type"); - + } else if (jsonMessage instanceof JSONRPC2Response) { - + final JSONRPC2Response jsonResponse = (JSONRPC2Response) jsonMessage; - m_loggerProline.debug("JSON Response Id: " + jsonResponse.getID()); - + m_loggerProline.debug("JSON Response Id: " + jsonResponse.getID()); + final JSONRPC2Error jsonError = jsonResponse.getError(); - if (jsonError != null) { - m_loggerProline.error("JSON Error code {}, message : \"{}\"", jsonError.getCode(), jsonError.getMessage()); - m_loggerProline.error("JSON Throwable", jsonError); + if (jsonError != null) { + m_loggerProline.error("JSON Error code {}, message : \"{}\"", jsonError.getCode(), jsonError.getMessage()); + m_loggerProline.error("JSON Throwable", jsonError); throw jsonError; - } - + } + final Object result = jsonResponse.getResult(); - if (result == null || ! Boolean.class.isInstance(result) ) { - m_loggerProline.debug("Invalid result"); - throw new Exception("Invalid result "+result); - } else { - m_loggerProline.debug("Result :\n" + result); - } + if (result == null || !Boolean.class.isInstance(result)) { + m_loggerProline.debug("Invalid result"); + throw new Exception("Invalid result " + result); + } else { + m_loggerProline.debug("Result :\n" + result); + } } - m_currentState = JMSState.STATE_DONE; - + m_currentState = JMSState.STATE_DONE; + } } diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ChangeUserGroupTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ChangeUserGroupTask.java index 82e1efbeb..c88b795b4 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ChangeUserGroupTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ChangeUserGroupTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -60,15 +60,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(m_methodName, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); //message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ClearProjectTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ClearProjectTask.java index 49eb34fe4..390723cb4 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ClearProjectTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ClearProjectTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -55,15 +55,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); //message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ComputeQuantPostProcessingTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ComputeQuantPostProcessingTask.java index d484891de..638eb66c0 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ComputeQuantPostProcessingTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ComputeQuantPostProcessingTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -57,14 +57,13 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); + addSupplementaryInfo(message); setTaskInfoRequest(message.getText()); diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CreateProjectTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CreateProjectTask.java index 685967676..562294e1e 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CreateProjectTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CreateProjectTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -70,15 +70,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); //message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CreateUserAccountTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CreateUserAccountTask.java index 085bedf3c..7ccd3346e 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CreateUserAccountTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/CreateUserAccountTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -64,15 +64,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(m_methodName, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); //message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/DownloadFileTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/DownloadFileTask.java index edc1cfd9f..ebf3c4c47 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/DownloadFileTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/DownloadFileTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -61,13 +61,12 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_GET_RSC_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/misc/ProlineResourceService"); - addSourceToMessage(message); - addDescriptionToMessage(message); + addSupplementaryInfo(message); setTaskInfoRequest(message.getText()); diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/DownloadProcessedFileTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/DownloadProcessedFileTask.java index b7b0f0ed0..d77216c6b 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/DownloadProcessedFileTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/DownloadProcessedFileTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -58,15 +58,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_GET_RSC_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/misc/ResourceService"); message.setStringProperty(JMSConnectionManager.PROLINE_NODE_ID_KEY, m_serverNodeId); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ExportDatasetTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ExportDatasetTask.java index 082a18a24..5f5597155 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ExportDatasetTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ExportDatasetTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -86,15 +86,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ExtractChromatogramTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ExtractChromatogramTask.java index 5103a497a..d114e6a46 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ExtractChromatogramTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ExtractChromatogramTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -68,13 +68,12 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); - addSourceToMessage(message); - addDescriptionToMessage(message); + addSupplementaryInfo(message); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); setTaskInfoRequest(message.getText()); diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FileSystemBrowseTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FileSystemBrowseTask.java index b9b5ccca1..3d5523d14 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FileSystemBrowseTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FileSystemBrowseTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -57,14 +57,13 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request("retrieve_directory_content", Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/misc/FileSystem"); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FileSystemRootsTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FileSystemRootsTask.java index a8ed1f899..21e73c4f1 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FileSystemRootsTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FileSystemRootsTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -56,13 +56,12 @@ public void taskRun() throws JMSException { Map params = new HashMap<>(); // no parameter jsonRequest.setNamedParams(params); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/misc/FileSystem"); - addSourceToMessage(message); - addDescriptionToMessage(message); + addSupplementaryInfo(message); setTaskInfoRequest(message.getText()); m_taskInfo.setJmsMessageID(message.getJMSMessageID()); diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FileUploadTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FileUploadTask.java index ef087acef..cdee84c05 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FileUploadTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FileUploadTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -20,6 +20,7 @@ import com.thetransactioncompany.jsonrpc2.JSONRPC2Message; import com.thetransactioncompany.jsonrpc2.JSONRPC2Notification; import com.thetransactioncompany.jsonrpc2.JSONRPC2Response; +import fr.proline.studio.Exceptions; import fr.proline.studio.dam.taskinfo.TaskInfo; import fr.proline.studio.dpm.AccessJMSManagerThread; import static fr.proline.studio.dpm.task.jms.AbstractJMSTask.m_loggerProline; @@ -39,7 +40,6 @@ import javax.jms.JMSException; import javax.jms.Message; import javax.jms.TextMessage; -import org.openide.util.Exceptions; /** * Upload Files for MaxQuant Result : Specific for MAxQuant by searching opnly @@ -89,7 +89,7 @@ public void taskRun() throws JMSException { InputStream in = null; try { - final BytesMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createBytesMessage(); + final BytesMessage message = m_session.createBytesMessage(); File uploadFile = null; @@ -119,8 +119,7 @@ public void taskRun() throws JMSException { message.setStringProperty("dest_folder_path", m_mountLabel + m_destinationPath); } - addSourceToMessage(message); - addDescriptionToMessage(message); + addSupplementaryInfo(message); in = new FileInputStream(uploadFile); BufferedInputStream inBuf = new BufferedInputStream(in); diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FilterProteinSetsTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FilterProteinSetsTask.java index c246f243f..a2521e2b6 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FilterProteinSetsTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/FilterProteinSetsTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -75,15 +75,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); //message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GenerateMSDiagReportTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GenerateMSDiagReportTask.java index 2af5f2eb9..9ad008a77 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GenerateMSDiagReportTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GenerateMSDiagReportTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -59,15 +59,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); //message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GenerateSpectrumMatchTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GenerateSpectrumMatchTask.java index b5fdd2b55..19aa2f3f5 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GenerateSpectrumMatchTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GenerateSpectrumMatchTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -64,15 +64,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); //message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GetDBConnectionTemplateTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GetDBConnectionTemplateTask.java index 19efe2a3b..ac0626660 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GetDBConnectionTemplateTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GetDBConnectionTemplateTask.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -55,15 +55,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); //message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GetExportInformationTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GetExportInformationTask.java index 6f0e1b05e..efde5db2b 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GetExportInformationTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/GetExportInformationTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -63,14 +63,13 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_request); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/IdentifyPtmSitesTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/IdentifyPtmSitesTask.java index b5f502cd9..fe6d7c86a 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/IdentifyPtmSitesTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/IdentifyPtmSitesTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -65,16 +65,15 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); if(m_version != null ) message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message @@ -104,38 +103,38 @@ private HashMap createParams() { @Override public void taskDone(final Message jmsMessage) throws Exception { - + final TextMessage textMessage = (TextMessage) jmsMessage; final String jsonString = textMessage.getText(); final JSONRPC2Message jsonMessage = JSONRPC2Message.parse(jsonString); - if(jsonMessage instanceof JSONRPC2Notification) { - m_loggerProline.warn("JSON Notification method: " + ((JSONRPC2Notification) jsonMessage).getMethod()+" instead of JSON Response"); + if (jsonMessage instanceof JSONRPC2Notification) { + m_loggerProline.warn("JSON Notification method: " + ((JSONRPC2Notification) jsonMessage).getMethod() + " instead of JSON Response"); throw new Exception("Invalid JSONRPC2Message type"); - - } else if (jsonMessage instanceof JSONRPC2Response) { - + + } else if (jsonMessage instanceof JSONRPC2Response) { + final JSONRPC2Response jsonResponse = (JSONRPC2Response) jsonMessage; - m_loggerProline.debug("JSON Response Id: " + jsonResponse.getID()); - + m_loggerProline.debug("JSON Response Id: " + jsonResponse.getID()); + final JSONRPC2Error jsonError = jsonResponse.getError(); - if (jsonError != null) { - m_loggerProline.error("JSON Error code {}, message : \"{}\"", jsonError.getCode(), jsonError.getMessage()); - m_loggerProline.error("JSON Throwable", jsonError); + if (jsonError != null) { + m_loggerProline.error("JSON Error code {}, message : \"{}\"", jsonError.getCode(), jsonError.getMessage()); + m_loggerProline.error("JSON Throwable", jsonError); throw jsonError; - } - + } + final Object result = jsonResponse.getResult(); - if (result == null || ! Boolean.class.isInstance(result) ) { - m_loggerProline.debug("Invalid result"); - throw new Exception("Invalid result "+result); - } else { - m_loggerProline.debug("Result :\n" + result); - } + if (result == null || !Boolean.class.isInstance(result)) { + m_loggerProline.debug("Invalid result"); + throw new Exception("Invalid result " + result); + } else { + m_loggerProline.debug("Result :\n" + result); + } } - m_currentState = JMSState.STATE_DONE; - + m_currentState = JMSState.STATE_DONE; + } } diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ImportIdentificationTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ImportIdentificationTask.java index b9739a291..0f20a718f 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ImportIdentificationTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ImportIdentificationTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -73,15 +73,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); //SERVICE - ImportValidateGenerateSpectrumMatches service TEST // message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/dps/msi/ImportValidateGenerateSM"); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/dps/msi/ImportResultFiles"); - addSourceToMessage(message); - addDescriptionToMessage(message); + addSupplementaryInfo(message, m_projectId); setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ImportMaxQuantTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ImportMaxQuantTask.java index 864cf1e7b..46c63c9df 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ImportMaxQuantTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ImportMaxQuantTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -82,16 +82,15 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/dps/msi/ImportMaxQuantResults"); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, "2.0"); - - addSourceToMessage(message); - addDescriptionToMessage(message); - + + addSupplementaryInfo(message, m_projectId); + setTaskInfoRequest(message.getText()); // Send the Message m_producer.send(message); diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/MergeTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/MergeTask.java index 65d6529e9..9315ac4d9 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/MergeTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/MergeTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -100,15 +100,14 @@ public void taskRun() throws JMSException { } jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/dps/msi/MergeResults"); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, "2.0"); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/PurgeConsumer.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/PurgeConsumer.java index f632ce0ba..144483a08 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/PurgeConsumer.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/PurgeConsumer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -80,7 +80,10 @@ public void removeCallback(AbstractJMSCallback callback){ public void clearMessage(String msgIdToRemove) { final String selectorString = "JMSMessageID = \'" +msgIdToRemove+"\'"; - + + //JPM.DOCK + + /* new Thread() { @Override @@ -108,7 +111,7 @@ public void run() { if (replyDestination == null) { m_logger.warn("Message has no JMSReplyTo Destination : Cannot send JSON Response to Client"); } else { - /* Try to send a JSON-RPC Error to client Producer */ + // Try to send a JSON-RPC Error to client Producer final JSONRPC2Error jsonError = new JSONRPC2Error(JMSConnectionManager.JMS_CANCELLED_TASK_ERROR_CODE, "JMS message was cancelled "); final JSONRPC2Response jsonResponse = new JSONRPC2Response(jsonError, null); // Step 7. Create a Text Message @@ -165,6 +168,6 @@ public void run() { } } //End Run }.start(); - + */ } } diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/RegisterRawFileTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/RegisterRawFileTask.java index fdbf589ab..1df3c6bc6 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/RegisterRawFileTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/RegisterRawFileTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -109,15 +109,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); //message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ResetPasswordTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ResetPasswordTask.java index 7c470dbbd..de052c958 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ResetPasswordTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ResetPasswordTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -62,15 +62,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(m_methodName, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); //message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/RetrieveBioSeqTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/RetrieveBioSeqTask.java index f89328220..ed12d788d 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/RetrieveBioSeqTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/RetrieveBioSeqTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -55,13 +55,12 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/seq/RetrieveBioSeqForRSMs"); - addSourceToMessage(message); - addDescriptionToMessage(message); + addSupplementaryInfo(message); setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/RunQuantitationTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/RunQuantitationTask.java index 14df46bfd..3363a99c7 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/RunQuantitationTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/RunQuantitationTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -61,13 +61,13 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); - addSourceToMessage(message); - addDescriptionToMessage(message); + addSupplementaryInfo(message); + message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); setTaskInfoRequest(message.getText()); diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/SendProjectidAndRsmTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/SendProjectidAndRsmTask.java index 899647d41..71d35c1bb 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/SendProjectidAndRsmTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/SendProjectidAndRsmTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -47,11 +47,10 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/dps/msi/GetProteinSequence"); - addSourceToMessage(message); - addDescriptionToMessage(message); + addSupplementaryInfo(message); setTaskInfoRequest(message.getText()); m_producer.send(message); m_loggerProline.info("Message [{}] sent", message.getJMSMessageID()); diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/SpectralCountTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/SpectralCountTask.java index 91fbea105..bfe51c42e 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/SpectralCountTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/SpectralCountTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -75,16 +75,15 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version_2_0); - - addSourceToMessage(message); - addDescriptionToMessage(message); - + + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/SystemInfoTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/SystemInfoTask.java index a452fe181..8cd326666 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/SystemInfoTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/SystemInfoTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -51,15 +51,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/UpdateSpectraParamsTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/UpdateSpectraParamsTask.java index d65344af9..b75d3c41b 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/UpdateSpectraParamsTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/UpdateSpectraParamsTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.jms; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -57,15 +57,14 @@ public void taskRun() throws JMSException { final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); jsonRequest.setNamedParams(createParams()); - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); /* ReplyTo = Temporary Destination Queue for Server -> Client response */ message.setJMSReplyTo(m_replyQueue); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, m_serviceName); message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - + addSupplementaryInfo(message); + setTaskInfoRequest(message.getText()); // Send the Message diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ValidationTask.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ValidationTask.java index 208d4822b..dea63559c 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ValidationTask.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/jms/ValidationTask.java @@ -1,9 +1,9 @@ -/* - * Copyright (C) 2019 VD225637 +/* + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 + * ; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -11,7 +11,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * CeCILL License V2.1 for more details. * - * You should have received a copy of the CeCILL License + * You should have received a copy of the CeCILL License * along with this program; If not, see . */ package fr.proline.studio.dpm.task.jms; @@ -30,252 +30,258 @@ import java.util.Map; /** - * * @author JM235353 */ -public class ValidationTask extends AbstractJMSTask { +public class ValidationTask extends AbstractJMSTask { - //PSM PreFilter + //PSM PreFilter - public enum PSMFilter { + public enum PSMFilter { - RANK("PRETTY_RANK", "Pretty Rank"), - SCORE("SCORE", "Score"), - PEP_LENGTH("PEP_SEQ_LENGTH", "Length"), - MASCOT_EVAL("MASCOT_EVALUE","e-Value"), - MASCOT_ADJUSTED_EVALUE("MASCOT_ADJUSTED_EVALUE","Adjusted e-Value"), - MASCOT_IT_SCORE("SCORE_IT_P-VALUE", "Identity p-Value"), - MASCOT_HT_SCORE("SCORE_HT_P-VALUE", "Homology p-Value"), - SINGLE_PSM_QUERY("SINGLE_PSM_PER_QUERY","Single PSM per MS Query"), - SINGLE_PSM_RANK("SINGLE_PSM_PER_RANK","Single PSM per Rank"), - ISOTOPE_OFFSET("ISOTOPE_OFFSET", "Isotope Offset"); + RANK("PRETTY_RANK", "Pretty Rank"), + SCORE("SCORE", "Score"), + PEP_LENGTH("PEP_SEQ_LENGTH", "Length"), + MASCOT_EVAL("MASCOT_EVALUE", "e-Value"), + MASCOT_ADJUSTED_EVALUE("MASCOT_ADJUSTED_EVALUE", "Adjusted e-Value"), + MASCOT_IT_SCORE("SCORE_IT_P-VALUE", "Identity p-Value"), + MASCOT_HT_SCORE("SCORE_HT_P-VALUE", "Homology p-Value"), + SINGLE_PSM_QUERY("SINGLE_PSM_PER_QUERY", "Single PSM per MS Query"), + SINGLE_PSM_RANK("SINGLE_PSM_PER_RANK", "Single PSM per Rank"), + SINGLE_SEQ_RANK("SINGLE_SEQ_PER_PRETTY_RANK", "Single Sequence per Pretty Rank"), + ISOTOPE_OFFSET("ISOTOPE_OFFSET", "Isotope Offset"); - public final String key; - public final String name; + public final String key; + public final String name; - PSMFilter(String key, String name) { - this.key = key; - this.name = name; - } + PSMFilter(String key, String name) { + this.key = key; + this.name = name; + } + } + + public enum ValidationParameters { + + FDR_METHOD("fdr_method", "FDR control method"), + EXPECTED_FDR("expected_fdr", "FDR"), + EXPECTED_FDR_PARAM("expected_fdr_parameter", "FDR Variable"), + PROTEIN_EXPECTED_FDR("protein_expected_fdr", "Protein FDR"), + PEPTIDE_EXPECTED_FDR("peptide_expected_fdr", "Peptide FDR"), + TD_ANALYZER("td_analyzer", "Target/Decoy method"); + + public final String key; + public final String name; + + ValidationParameters(String key, String name) { + this.key = key; + this.name = name; } + } + + private final DDataset m_dataset; + private final String m_description; //Not used on server side + private final HashMap m_argumentsMap; + private final String m_scoringType; + private final Integer[] m_resultSummaryId; + private Map m_rsmIdsPerRsIds = null; + private String m_version = "3.0"; + + public ValidationTask(AbstractJMSCallback callback, DDataset dataset, String description, HashMap argumentsMap, Integer[] resultSummaryId, String scoringType) { + super(callback, new TaskInfo("JMS Validation of Search Result " + dataset.getName(), true, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_HIGH)); + m_dataset = dataset; + m_description = description; + m_argumentsMap = argumentsMap; + m_resultSummaryId = resultSummaryId; + m_scoringType = scoringType; + } + + public ValidationTask(AbstractJMSCallback callback, DDataset dataset, String description, HashMap argumentsMap, Integer[] resultSummaryId, HashMap rsmIdsPerRsIds, String scoringType) { + super(callback, new TaskInfo("JMS Validation of Search Result " + dataset.getName(), true, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_HIGH)); + m_dataset = dataset; + m_description = description; + m_argumentsMap = argumentsMap; + m_rsmIdsPerRsIds = rsmIdsPerRsIds; + m_resultSummaryId = resultSummaryId; + m_scoringType = scoringType; + } + + @Override + public void taskRun() throws JMSException { + final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); + jsonRequest.setNamedParams(createParams()); + + final TextMessage message = m_session.createTextMessage(jsonRequest.toJSONString()); + + /* ReplyTo = Temporary Destination Queue for Server -> Client response */ + message.setJMSReplyTo(m_replyQueue); + message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/dps/msi/ValidateResultSet"); + if (m_version != null) + message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); + addSupplementaryInfo(message); + + setTaskInfoRequest(message.getText()); + + // Step 8. Send the Message + m_producer.send(message); + m_loggerProline.info("ValidationTask Message [{}] sent", message.getJMSMessageID()); + m_taskInfo.setJmsMessageID(message.getJMSMessageID()); + } + + @Override + public void taskDone(final Message jmsMessage) throws Exception { + + final TextMessage textMessage = (TextMessage) jmsMessage; + final String jsonString = textMessage.getText(); + + final JSONRPC2Message jsonMessage = JSONRPC2Message.parse(jsonString); + if (jsonMessage instanceof JSONRPC2Notification) { + m_loggerProline.warn("JSON Notification method: " + ((JSONRPC2Notification) jsonMessage).getMethod() + " instead of JSON Response"); + throw new Exception("Invalid JSONRPC2Message type"); + } else if (jsonMessage instanceof JSONRPC2Response) { + + final JSONRPC2Response jsonResponse = (JSONRPC2Response) jsonMessage; + m_loggerProline.debug("JSON Response Id: " + jsonResponse.getID()); - public enum ValidationParameters { - - FDR_METHOD("fdr_method", "FDR control method"), - EXPECTED_FDR("expected_fdr", "FDR"), - EXPECTED_FDR_PARAM("expected_fdr_parameter", "FDR Variable"), - PROTEIN_EXPECTED_FDR("protein_expected_fdr", "Protein FDR"), - PEPTIDE_EXPECTED_FDR("peptide_expected_fdr", "Peptide FDR"), - TD_ANALYZER("td_analyzer", "Target/Decoy method"); - - public final String key; - public final String name; - - ValidationParameters(String key, String name) { - this.key = key; - this.name = name; + final JSONRPC2Error jsonError = jsonResponse.getError(); + + if (jsonError != null) { + m_loggerProline.error("JSON Error code {}, message : \"{}\"", jsonError.getCode(), jsonError.getMessage()); + m_loggerProline.error("JSON Throwable", jsonError); + throw jsonError; + } + + final Object result = jsonResponse.getResult(); + + if (result == null || !Map.class.isInstance(result)) { + m_loggerProline.debug("Invalid or no result"); + throw new Exception("null or invalid result " + result); + } else { + m_loggerProline.debug("Result :\n" + result); + Long rsmId = (Long) ((Map) result).get(m_dataset.getResultSetId().toString()); + m_resultSummaryId[0] = rsmId.intValue(); + if (m_rsmIdsPerRsIds != null) { + ((Map) result).forEach((String key, Long value) -> { + m_rsmIdsPerRsIds.put(Long.parseLong(key), value); + }); } + } } - private final DDataset m_dataset; - private final String m_description; //Not used on server side - private final HashMap m_argumentsMap; - private final String m_scoringType; - private final Integer[] m_resultSummaryId; - private Map m_rsmIdsPerRsIds = null; - private String m_version = "3.0"; - - public ValidationTask(AbstractJMSCallback callback, DDataset dataset, String description, HashMap argumentsMap, Integer[] resultSummaryId, String scoringType) { - super(callback, new TaskInfo("JMS Validation of Search Result " + dataset.getName(), true, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_HIGH)); - m_dataset = dataset; - m_description = description; - m_argumentsMap = argumentsMap; - m_resultSummaryId = resultSummaryId; - m_scoringType = scoringType; + /* + * TODO Use JSON-RPC Response + */ + //traceJSONResponse(jsonString); + m_currentState = JMSState.STATE_DONE; + + } + + + private HashMap createParams() { + + HashMap params = new HashMap<>(); + params.put("project_id", m_dataset.getProject().getId()); + params.put("result_set_id", m_dataset.getResultSetId()); + params.put("description", m_description); //JPM.TODO : string is "" + + // PSM Pre-PSMFilter + ArrayList psmFilters = new ArrayList(); + + if (m_argumentsMap.containsKey("PSM_" + PSMFilter.RANK.key)) { + Map filterCfg = new HashMap<>(); + filterCfg.put("parameter", PSMFilter.RANK.key); + filterCfg.put("threshold", Integer.valueOf(m_argumentsMap.get("PSM_" + PSMFilter.RANK.key))); + psmFilters.add(filterCfg); } - - public ValidationTask(AbstractJMSCallback callback, DDataset dataset, String description, HashMap argumentsMap, Integer[] resultSummaryId, HashMap rsmIdsPerRsIds, String scoringType) { - super(callback, new TaskInfo("JMS Validation of Search Result " + dataset.getName(), true, TASK_LIST_INFO, TaskInfo.INFO_IMPORTANCE_HIGH)); - m_dataset = dataset; - m_description = description; - m_argumentsMap = argumentsMap; - m_rsmIdsPerRsIds = rsmIdsPerRsIds; - m_resultSummaryId = resultSummaryId; - m_scoringType = scoringType; + if (m_argumentsMap.containsKey("PSM_" + PSMFilter.SCORE.key)) { + Map filterCfg = new HashMap<>(); + filterCfg.put("parameter", PSMFilter.SCORE.key); + filterCfg.put("threshold", Float.valueOf(m_argumentsMap.get("PSM_" + PSMFilter.SCORE.key))); + psmFilters.add(filterCfg); } - - @Override - public void taskRun() throws JMSException { - final JSONRPC2Request jsonRequest = new JSONRPC2Request(JMSConnectionManager.PROLINE_PROCESS_METHOD_NAME, Integer.valueOf(m_taskInfo.getId())); - jsonRequest.setNamedParams(createParams()); - - final TextMessage message = AccessJMSManagerThread.getAccessJMSManagerThread().getSession().createTextMessage(jsonRequest.toJSONString()); - - /* ReplyTo = Temporary Destination Queue for Server -> Client response */ - message.setJMSReplyTo(m_replyQueue); - message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_NAME_KEY, "proline/dps/msi/ValidateResultSet"); - if(m_version != null ) - message.setStringProperty(JMSConnectionManager.PROLINE_SERVICE_VERSION_KEY, m_version); - addSourceToMessage(message); - addDescriptionToMessage(message); - - setTaskInfoRequest(message.getText()); - - // Step 8. Send the Message - m_producer.send(message); - m_loggerProline.info("ValidationTask Message [{}] sent", message.getJMSMessageID()); - m_taskInfo.setJmsMessageID(message.getJMSMessageID()); + if (m_argumentsMap.containsKey("PSM_" + PSMFilter.MASCOT_EVAL.key)) { + HashMap filterCfg = new HashMap(); + filterCfg.put("parameter", PSMFilter.MASCOT_EVAL.key); + filterCfg.put("threshold", Float.valueOf(m_argumentsMap.get("PSM_" + PSMFilter.MASCOT_EVAL.key))); + psmFilters.add(filterCfg); } - - @Override - public void taskDone(final Message jmsMessage) throws Exception { - - final TextMessage textMessage = (TextMessage) jmsMessage; - final String jsonString = textMessage.getText(); - - final JSONRPC2Message jsonMessage = JSONRPC2Message.parse(jsonString); - if(jsonMessage instanceof JSONRPC2Notification) { - m_loggerProline.warn("JSON Notification method: " + ((JSONRPC2Notification) jsonMessage).getMethod()+" instead of JSON Response"); - throw new Exception("Invalid JSONRPC2Message type"); - } else if (jsonMessage instanceof JSONRPC2Response) { - - final JSONRPC2Response jsonResponse = (JSONRPC2Response) jsonMessage; - m_loggerProline.debug("JSON Response Id: " + jsonResponse.getID()); - - final JSONRPC2Error jsonError = jsonResponse.getError(); - - if (jsonError != null) { - m_loggerProline.error("JSON Error code {}, message : \"{}\"", jsonError.getCode(), jsonError.getMessage()); - m_loggerProline.error("JSON Throwable", jsonError); - throw jsonError; - } - - final Object result = jsonResponse.getResult(); - - if (result == null || !Map.class.isInstance(result)) { - m_loggerProline.debug("Invalid or no result"); - throw new Exception("null or invalid result " + result); - } else { - m_loggerProline.debug("Result :\n" + result); - Long rsmId = (Long) ((Map) result).get(m_dataset.getResultSetId().toString()); - m_resultSummaryId[0] = rsmId.intValue(); - if (m_rsmIdsPerRsIds != null) { - ((Map) result).forEach((String key, Long value) -> { - m_rsmIdsPerRsIds.put(Long.parseLong(key), value); - }); - } - } - } - - /* - * TODO Use JSON-RPC Response - */ - //traceJSONResponse(jsonString); - m_currentState = JMSState.STATE_DONE; - + if (m_argumentsMap.containsKey("PSM_" + PSMFilter.MASCOT_ADJUSTED_EVALUE.key)) { + HashMap filterCfg = new HashMap(); + filterCfg.put("parameter", PSMFilter.MASCOT_ADJUSTED_EVALUE.key); + filterCfg.put("threshold", Float.valueOf(m_argumentsMap.get("PSM_" + PSMFilter.MASCOT_ADJUSTED_EVALUE.key))); + psmFilters.add(filterCfg); + } + if (m_argumentsMap.containsKey("PSM_" + PSMFilter.PEP_LENGTH.key)) { + HashMap filterCfg = new HashMap(); + filterCfg.put("parameter", PSMFilter.PEP_LENGTH.key); + filterCfg.put("threshold", Integer.valueOf(m_argumentsMap.get("PSM_" + PSMFilter.PEP_LENGTH.key))); + psmFilters.add(filterCfg); + } + if (m_argumentsMap.containsKey("PSM_" + PSMFilter.MASCOT_IT_SCORE.key)) { + HashMap filterCfg = new HashMap(); + filterCfg.put("parameter", PSMFilter.MASCOT_IT_SCORE.key); + filterCfg.put("threshold", Float.valueOf(m_argumentsMap.get("PSM_" + PSMFilter.MASCOT_IT_SCORE.key))); + psmFilters.add(filterCfg); + } + if (m_argumentsMap.containsKey("PSM_" + PSMFilter.MASCOT_HT_SCORE.key)) { + HashMap filterCfg = new HashMap(); + filterCfg.put("parameter", PSMFilter.MASCOT_HT_SCORE.key); + filterCfg.put("threshold", Float.valueOf(m_argumentsMap.get("PSM_" + PSMFilter.MASCOT_HT_SCORE.key))); + psmFilters.add(filterCfg); + } + if (m_argumentsMap.containsKey("PSM_" + PSMFilter.SINGLE_PSM_QUERY.key)) { + HashMap filterCfg = new HashMap(); + filterCfg.put("parameter", PSMFilter.SINGLE_PSM_QUERY.key); + filterCfg.put("threshold", 1); + filterCfg.put("post_validation", Boolean.valueOf(m_argumentsMap.get("PSM_" + PSMFilter.SINGLE_PSM_QUERY.key))); + psmFilters.add(filterCfg); + } + if (m_argumentsMap.containsKey("PSM_" + PSMFilter.SINGLE_PSM_RANK.key)) { + HashMap filterCfg = new HashMap(); + filterCfg.put("parameter", PSMFilter.SINGLE_PSM_RANK.key); + filterCfg.put("threshold", 1); + filterCfg.put("post_validation", Boolean.valueOf(m_argumentsMap.get("PSM_" + PSMFilter.SINGLE_PSM_RANK.key))); + psmFilters.add(filterCfg); + } + if (m_argumentsMap.containsKey("PSM_" + PSMFilter.SINGLE_SEQ_RANK.key)) { + HashMap filterCfg = new HashMap(); + filterCfg.put("parameter", PSMFilter.SINGLE_SEQ_RANK.key); + filterCfg.put("threshold", 1); +// filterCfg.put("post_validation", Boolean.valueOf(m_argumentsMap.get("PSM_" + PSMFilter.SINGLE_PSM_RANK.key))); + psmFilters.add(filterCfg); + } + if (m_argumentsMap.containsKey("PSM_" + PSMFilter.ISOTOPE_OFFSET.key)) { + HashMap filterCfg = new HashMap(); + filterCfg.put("parameter", PSMFilter.ISOTOPE_OFFSET.key); + filterCfg.put("threshold", Integer.valueOf(m_argumentsMap.get("PSM_" + PSMFilter.ISOTOPE_OFFSET.key))); + psmFilters.add(filterCfg); } - - - private HashMap createParams() { - - HashMap params = new HashMap<>(); - params.put("project_id", m_dataset.getProject().getId()); - params.put("result_set_id", m_dataset.getResultSetId()); - params.put("description", m_description); //JPM.TODO : string is "" - - // PSM Pre-PSMFilter - ArrayList psmFilters = new ArrayList(); - - if (m_argumentsMap.containsKey("PSM_"+ PSMFilter.RANK.key)) { - Map filterCfg = new HashMap<>(); - filterCfg.put("parameter", PSMFilter.RANK.key); - filterCfg.put("threshold", Integer.valueOf(m_argumentsMap.get("PSM_"+ PSMFilter.RANK.key))); - psmFilters.add(filterCfg); - } - if (m_argumentsMap.containsKey("PSM_"+ PSMFilter.SCORE.key)) { - Map filterCfg = new HashMap<>(); - filterCfg.put("parameter", PSMFilter.SCORE.key); - filterCfg.put("threshold", Float.valueOf(m_argumentsMap.get("PSM_"+ PSMFilter.SCORE.key))); - psmFilters.add(filterCfg); - } - if (m_argumentsMap.containsKey("PSM_"+ PSMFilter.MASCOT_EVAL.key)) { - HashMap filterCfg = new HashMap(); - filterCfg.put("parameter", PSMFilter.MASCOT_EVAL.key); - filterCfg.put("threshold", Float.valueOf(m_argumentsMap.get("PSM_"+ PSMFilter.MASCOT_EVAL.key))); - psmFilters.add(filterCfg); - } - if (m_argumentsMap.containsKey("PSM_"+ PSMFilter.MASCOT_ADJUSTED_EVALUE.key)) { - HashMap filterCfg = new HashMap(); - filterCfg.put("parameter", PSMFilter.MASCOT_ADJUSTED_EVALUE.key); - filterCfg.put("threshold", Float.valueOf(m_argumentsMap.get("PSM_"+ PSMFilter.MASCOT_ADJUSTED_EVALUE.key))); - psmFilters.add(filterCfg); - } - if (m_argumentsMap.containsKey("PSM_"+ PSMFilter.PEP_LENGTH.key)) { - HashMap filterCfg = new HashMap(); - filterCfg.put("parameter", PSMFilter.PEP_LENGTH.key); - filterCfg.put("threshold", Integer.valueOf(m_argumentsMap.get("PSM_"+ PSMFilter.PEP_LENGTH.key))); - psmFilters.add(filterCfg); - } - if (m_argumentsMap.containsKey("PSM_"+ PSMFilter.MASCOT_IT_SCORE.key)) { - HashMap filterCfg = new HashMap(); - filterCfg.put("parameter", PSMFilter.MASCOT_IT_SCORE.key); - filterCfg.put("threshold", Float.valueOf(m_argumentsMap.get("PSM_"+ PSMFilter.MASCOT_IT_SCORE.key))); - psmFilters.add(filterCfg); - } - if (m_argumentsMap.containsKey("PSM_"+ PSMFilter.MASCOT_HT_SCORE.key)) { - HashMap filterCfg = new HashMap(); - filterCfg.put("parameter", PSMFilter.MASCOT_HT_SCORE.key); - filterCfg.put("threshold", Float.valueOf(m_argumentsMap.get("PSM_"+ PSMFilter.MASCOT_HT_SCORE.key))); - psmFilters.add(filterCfg); - } - if (m_argumentsMap.containsKey("PSM_"+ PSMFilter.SINGLE_PSM_QUERY.key)) { - HashMap filterCfg = new HashMap(); - filterCfg.put("parameter", PSMFilter.SINGLE_PSM_QUERY.key); - filterCfg.put("threshold", 1); - filterCfg.put("post_validation", Boolean.valueOf(m_argumentsMap.get("PSM_"+ PSMFilter.SINGLE_PSM_QUERY.key))); - psmFilters.add(filterCfg); - } - if (m_argumentsMap.containsKey("PSM_"+ PSMFilter.SINGLE_PSM_RANK.key)) { - HashMap filterCfg = new HashMap(); - filterCfg.put("parameter", PSMFilter.SINGLE_PSM_RANK.key); - filterCfg.put("threshold", 1); - filterCfg.put("post_validation", Boolean.valueOf(m_argumentsMap.get("PSM_"+ PSMFilter.SINGLE_PSM_RANK.key))); - psmFilters.add(filterCfg); - } - if (m_argumentsMap.containsKey("PSM_"+ PSMFilter.ISOTOPE_OFFSET.key)) { - HashMap filterCfg = new HashMap(); - filterCfg.put("parameter", PSMFilter.ISOTOPE_OFFSET.key); - filterCfg.put("threshold", Integer.valueOf(m_argumentsMap.get("PSM_"+ PSMFilter.ISOTOPE_OFFSET.key))); - psmFilters.add(filterCfg); - } - params.put("pep_match_filters", psmFilters); + params.put("pep_match_filters", psmFilters); - // PSM Validator - if (m_argumentsMap.containsKey(ValidationParameters.EXPECTED_FDR.key)) { - HashMap pepMatchValidator = new HashMap(); - pepMatchValidator.put("parameter", m_argumentsMap.get(ValidationParameters.EXPECTED_FDR_PARAM.key)); - pepMatchValidator.put("expected_fdr", m_argumentsMap.get(ValidationParameters.EXPECTED_FDR.key)); - params.put("pep_match_validator_config", pepMatchValidator); - } + // PSM Validator + if (m_argumentsMap.containsKey(ValidationParameters.EXPECTED_FDR.key)) { + HashMap pepMatchValidator = new HashMap(); + pepMatchValidator.put("parameter", m_argumentsMap.get(ValidationParameters.EXPECTED_FDR_PARAM.key)); + pepMatchValidator.put("expected_fdr", m_argumentsMap.get(ValidationParameters.EXPECTED_FDR.key)); + params.put("pep_match_validator_config", pepMatchValidator); + } - HashMap fdrConfig = new HashMap(); - if (m_argumentsMap.containsKey(ValidationParameters.EXPECTED_FDR.key) || + HashMap fdrConfig = new HashMap(); + if (m_argumentsMap.containsKey(ValidationParameters.EXPECTED_FDR.key) || m_argumentsMap.containsKey(ValidationParameters.PEPTIDE_EXPECTED_FDR.key) || m_argumentsMap.containsKey(ValidationParameters.PROTEIN_EXPECTED_FDR.key)) { - - if ((m_argumentsMap.containsKey(ValidationParameters.FDR_METHOD.key))) { - fdrConfig.put("method_name", (m_argumentsMap.get(ValidationParameters.FDR_METHOD.key))); - - if (m_argumentsMap.get(ValidationParameters.FDR_METHOD.key).equals("TARGET_DECOY") ) { - // force basic tdAnalyzer usage - HashMap tdAnalyzerConfig = new HashMap(); - tdAnalyzerConfig.put("method_name", "BASIC"); - fdrConfig.put("td_analyzer_config", tdAnalyzerConfig); - } - - } - + + if ((m_argumentsMap.containsKey(ValidationParameters.FDR_METHOD.key))) { + fdrConfig.put("method_name", (m_argumentsMap.get(ValidationParameters.FDR_METHOD.key))); + + if (m_argumentsMap.get(ValidationParameters.FDR_METHOD.key).equals("TARGET_DECOY")) { + // force basic tdAnalyzer usage + HashMap tdAnalyzerConfig = new HashMap(); + tdAnalyzerConfig.put("method_name", "BASIC"); + fdrConfig.put("td_analyzer_config", tdAnalyzerConfig); + } + + } + // if (m_argumentsMap.containsKey(ValidationParameters.TD_ANALYZER.key)) { // HashMap tdAnalyzerConfig = new HashMap(); // tdAnalyzerConfig.put("method_name", m_argumentsMap.get(ValidationParameters.TD_ANALYZER.key)); @@ -287,64 +293,64 @@ private HashMap createParams() { // } // fdrConfig.put("td_analyzer_config", tdAnalyzerConfig); // } - - params.put("fdr_analyzer_config", fdrConfig); - } - - // Peptide validator - if (m_argumentsMap.containsKey(ValidationParameters.PEPTIDE_EXPECTED_FDR.key)) { - HashMap peptideValidatorConfig = new HashMap(); - peptideValidatorConfig.put("parameter", "BH"); - peptideValidatorConfig.put("expected_fdr", m_argumentsMap.get(ValidationParameters.PEPTIDE_EXPECTED_FDR.key)); - params.put("pep_validator_config", peptideValidatorConfig); - } - - params.put("pep_set_score_type", m_scoringType); - - // Protein Pre-Filters - ArrayList proteinFilters = new ArrayList(); - - for (FilterProteinSetsTask.Filter filter: FilterProteinSetsTask.Filter.values()) { - String filterKeyOfInMap = "PROT_"+filter.key; - if (m_argumentsMap.containsKey(filterKeyOfInMap)) { - HashMap filterCfg = new HashMap(); - filterCfg.put("parameter", filter.key); - if (filter == FilterProteinSetsTask.Filter.SCORE) { - filterCfg.put("threshold", Double.valueOf(m_argumentsMap.get(filterKeyOfInMap))); - } else { - filterCfg.put("threshold", Integer.valueOf(m_argumentsMap.get(filterKeyOfInMap))); - } - proteinFilters.add(filterCfg); - } - } - params.put("prot_set_filters", proteinFilters); - - - // protein parameters - if (m_argumentsMap.containsKey(ValidationParameters.PROTEIN_EXPECTED_FDR.key)) { - HashMap protSetValidator = new HashMap(); - protSetValidator.put("parameter", "SCORE"); - protSetValidator.put("expected_fdr", m_argumentsMap.get(ValidationParameters.PROTEIN_EXPECTED_FDR.key)); - protSetValidator.put("validation_method", "PROTEIN_SET_RULES"); - params.put("prot_set_validator_config", protSetValidator); - // Verify that a td_analyzer_config have been supplied at PSM level, if not set it to BASIC - if (!fdrConfig.containsKey("td_analyzer_config")) { - HashMap tdAnalyzerConfig = new HashMap(); - tdAnalyzerConfig.put("method_name", "BASIC"); - fdrConfig.put("td_analyzer_config", tdAnalyzerConfig); - } - } - - if(m_argumentsMap.containsKey("propagate_prot_set_filters") ){ - params.put("propagate_prot_set_filters", Boolean.parseBoolean(m_argumentsMap.get("propagate_prot_set_filters"))); - } - - if(m_argumentsMap.containsKey("propagate_pep_match_filters")) { - params.put("propagate_pep_match_filters", Boolean.parseBoolean(m_argumentsMap.get("propagate_pep_match_filters"))); + params.put("fdr_analyzer_config", fdrConfig); + } + + // Peptide validator + if (m_argumentsMap.containsKey(ValidationParameters.PEPTIDE_EXPECTED_FDR.key)) { + HashMap peptideValidatorConfig = new HashMap(); + peptideValidatorConfig.put("parameter", "BH"); + peptideValidatorConfig.put("expected_fdr", m_argumentsMap.get(ValidationParameters.PEPTIDE_EXPECTED_FDR.key)); + params.put("pep_validator_config", peptideValidatorConfig); + } + + params.put("pep_set_score_type", m_scoringType); + + // Protein Pre-Filters + ArrayList proteinFilters = new ArrayList(); + + for (FilterProteinSetsTask.Filter filter : FilterProteinSetsTask.Filter.values()) { + String filterKeyOfInMap = "PROT_" + filter.key; + if (m_argumentsMap.containsKey(filterKeyOfInMap)) { + HashMap filterCfg = new HashMap(); + filterCfg.put("parameter", filter.key); + if (filter == FilterProteinSetsTask.Filter.SCORE) { + filterCfg.put("threshold", Double.valueOf(m_argumentsMap.get(filterKeyOfInMap))); + } else { + filterCfg.put("threshold", Integer.valueOf(m_argumentsMap.get(filterKeyOfInMap))); } - - return params; + proteinFilters.add(filterCfg); + } + } + + params.put("prot_set_filters", proteinFilters); + + + // protein parameters + if (m_argumentsMap.containsKey(ValidationParameters.PROTEIN_EXPECTED_FDR.key)) { + HashMap protSetValidator = new HashMap(); + protSetValidator.put("parameter", "SCORE"); + protSetValidator.put("expected_fdr", m_argumentsMap.get(ValidationParameters.PROTEIN_EXPECTED_FDR.key)); + protSetValidator.put("validation_method", "PROTEIN_SET_RULES"); + params.put("prot_set_validator_config", protSetValidator); + // Verify that a td_analyzer_config have been supplied at PSM level, if not set it to BASIC + if (!fdrConfig.containsKey("td_analyzer_config")) { + HashMap tdAnalyzerConfig = new HashMap(); + tdAnalyzerConfig.put("method_name", "BASIC"); + fdrConfig.put("td_analyzer_config", tdAnalyzerConfig); + } + } + + if (m_argumentsMap.containsKey("propagate_prot_set_filters")) { + params.put("propagate_prot_set_filters", Boolean.parseBoolean(m_argumentsMap.get("propagate_prot_set_filters"))); } - + + if (m_argumentsMap.containsKey("propagate_pep_match_filters")) { + params.put("propagate_pep_match_filters", Boolean.parseBoolean(m_argumentsMap.get("propagate_pep_match_filters"))); + } + + return params; + } + } diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/ConnectionListener.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/ConnectionListener.java index 3b0877001..5261bd171 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/ConnectionListener.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/ConnectionListener.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.util; import java.util.EventListener; diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/JMSConnectionManager.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/JMSConnectionManager.java index 2d493773c..b33f3a438 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/JMSConnectionManager.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/JMSConnectionManager.java @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2019 VD225637 +/* + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,19 +16,14 @@ */ package fr.proline.studio.dpm.task.util; +import fr.proline.studio.NbPreferences; import fr.proline.studio.dpm.AccessJMSManagerThread; import fr.proline.studio.parameter.ParameterList; import fr.proline.studio.parameter.StringParameter; import java.util.HashMap; import java.util.Map; import java.util.prefs.Preferences; -import javax.jms.Connection; -import javax.jms.JMSException; -import javax.jms.MessageConsumer; -import javax.jms.Queue; -import javax.jms.QueueBrowser; -import javax.jms.Session; -import javax.jms.Topic; +import javax.jms.*; import javax.swing.JTextField; import javax.swing.event.EventListenerList; import org.hornetq.api.core.TransportConfiguration; @@ -37,7 +32,6 @@ import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory; import org.hornetq.core.remoting.impl.netty.TransportConstants; import org.hornetq.jms.client.HornetQConnectionFactory; -import org.openide.util.NbPreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -68,6 +62,8 @@ private JMSConnectionManager() { public static final String PROLINE_SERVICE_NAME_KEY = "Proline_ServiceName"; + public static final String PROLINE_SERVICE_PROJECT_ID_KEY = "Proline_Service_ProjectId"; + public static final String PROLINE_SERVICE_VERSION_KEY = "Proline_ServiceVersion"; public static final String PROLINE_SERVICE_SOURCE_KEY = "Proline_ServiceSource"; @@ -95,17 +91,21 @@ private JMSConnectionManager() { private final EventListenerList m_connectionListenersList;//ConnectionListeners list private int m_connectionState;//Connection current state - public String m_jmsServerHost = null;/* Default = HornetQ Proline Prod Grenoble = "132.168.72.129" */ + public String m_jmsServerHost = null; public static int m_jmsServerPort = 5445; + //Queue objects private Connection m_connection = null; private Queue m_serviceQueue = null; - private Topic m_notificationTopic = null; + private Session m_mainSession = null; - private QueueBrowser m_browser = null; + //Topic objects + private Topic m_notificationTopic = null; private ServiceNotificationListener m_notifListener = null; private MessageConsumer m_topicSuscriber; + private QueueBrowser m_browser = null; + private static JMSConnectionManager m_jmsConnectionManager = null; public static synchronized JMSConnectionManager getJMSConnectionManager() { @@ -192,6 +192,7 @@ public Queue getServiceQueue() throws Exception { return m_serviceQueue; } + private void createConnection() throws JMSException { try { if (m_jmsServerHost == null) { @@ -207,8 +208,11 @@ private void createConnection() throws JMSException { m_jmsSettingsPList.loadParameters(NbPreferences.root()); String queueName = m_parameter.getStringValue(); - m_loggerProline.info(" Use JMS Queue " + queueName); + m_loggerProline.info(" Use JMS Queue " + queueName+" and JMS topic "+SERVICE_MONITORING_NOTIFICATION_TOPIC_NAME); + //Queue Data m_serviceQueue = HornetQJMSClient.createQueue(queueName); + + //Topic data m_notificationTopic = HornetQJMSClient.createTopic(SERVICE_MONITORING_NOTIFICATION_TOPIC_NAME); // Step 2. Instantiate the TransportConfiguration object which contains the knowledge of what @@ -233,6 +237,7 @@ private void createConnection() throws JMSException { // Step 5. Create a JMS Session (Session MUST be confined in current Thread) // Not transacted, AUTO_ACKNOWLEDGE m_mainSession = m_connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + // Step 6. Create the subscription and the subscriber.//TODO : create & listen only when asked !? m_topicSuscriber = m_mainSession.createConsumer(m_notificationTopic); m_notifListener = new ServiceNotificationListener(); @@ -240,7 +245,7 @@ private void createConnection() throws JMSException { m_connectionState = ConnectionListener.CONNECTION_DONE; fireConnectionStateChanged(ConnectionListener.CONNECTION_DONE); } catch (RuntimeException | JMSException je) { - if (m_connection != null) { + if (m_connection != null ){ try { m_connection.close(); m_loggerProline.info("JMS Connection closed on error " + je.getMessage()); @@ -259,7 +264,7 @@ private void createConnection() throws JMSException { public ServiceNotificationListener getNotificationListener() { return m_notifListener; } - + /** * Get Proline Server service Queue QueueBrowser, create JMS connection if necessary * @return @@ -274,10 +279,12 @@ public QueueBrowser getQueueBrowser() { return null; } } - - try { + + try { m_browser = m_mainSession.createBrowser(m_serviceQueue); } catch (JMSException ex) { + ex.printStackTrace(); + m_browser = null; } } @@ -295,6 +302,7 @@ public void closeConnection() { m_connection.close(); m_loggerProline.info("JMS Connection closed"); + } catch (Exception exClose) { m_loggerProline.error("Error closing JMS Connection", exClose); } finally { diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/JMSMessageUtil.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/JMSMessageUtil.java index 91cb14901..16dc4654b 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/JMSMessageUtil.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/JMSMessageUtil.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.util; import com.thetransactioncompany.jsonrpc2.JSONRPC2Error; @@ -24,184 +24,182 @@ import com.thetransactioncompany.jsonrpc2.JSONRPC2Response; import fr.profi.util.StringUtils; import fr.proline.studio.dpm.data.JMSNotificationMessage; + import java.util.Enumeration; import java.util.Map; import java.util.Set; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.TextMessage; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * * @author VD225637 */ public class JMSMessageUtil { - protected static final Logger m_loggerProline = LoggerFactory.getLogger("ProlineStudio.DPM.Task"); - private static final String TAB = " "; - private static final String DATE_FORMAT = "%td/% nameEnum = message.getPropertyNames(); + buff.append(TAB).append("JMSReplyTo "); + append(buff, message.getJMSReplyTo()); + buff.append(StringUtils.LINE_SEPARATOR); - while (nameEnum.hasMoreElements()) { - final String propertyName = nameEnum.nextElement(); - buff.append(TAB).append('[').append(propertyName).append("] : "); + final Enumeration nameEnum = message.getPropertyNames(); - final String propertyValue = message.getStringProperty(propertyName); + while (nameEnum.hasMoreElements()) { + final String propertyName = nameEnum.nextElement(); + buff.append(TAB).append('[').append(propertyName).append("] : "); - if (propertyValue == null) { - buff.append("NULL"); - } else { - buff.append('[').append(propertyValue).append(']'); - } + final String propertyValue = message.getStringProperty(propertyName); - buff.append(StringUtils.LINE_SEPARATOR); - } + if (propertyValue == null) { + buff.append("NULL"); + } else { + buff.append('[').append(propertyValue).append(']'); + } - if (message instanceof TextMessage) { - buff.append(TAB).append(((TextMessage) message).getText()); - } + buff.append(StringUtils.LINE_SEPARATOR); + } - buff.append(StringUtils.LINE_SEPARATOR); - } catch (Exception ex) { - m_loggerProline.error("Error retrieving JMS Message header or content", ex); - } + if (message instanceof TextMessage) { + buff.append(TAB).append(((TextMessage) message).getText()); + } - return buff.toString(); + buff.append(StringUtils.LINE_SEPARATOR); + } catch (Exception ex) { + m_loggerProline.error("Error retrieving JMS Message header or content", ex); } - - - - private static void append(final StringBuilder sb, final Object obj) { - assert (sb != null) : "append() sb is null"; - if (obj == null) { - sb.append("NULL"); - } else { - sb.append(obj); - } + return buff.toString(); + } + + + private static void append(final StringBuilder sb, final Object obj) { + assert (sb != null) : "append() sb is null"; - } - - public static void traceJSONResponse(final String jsonString) throws JSONRPC2ParseException { - final JSONRPC2Message jsonMessage = JSONRPC2Message.parse(jsonString); + if (obj == null) { + sb.append("NULL"); + } else { + sb.append(obj); + } + + } - if (jsonMessage instanceof JSONRPC2Notification) { - final JSONRPC2Notification jsonNotification = (JSONRPC2Notification) jsonMessage; + public static void traceJSONResponse(final String jsonString) throws JSONRPC2ParseException { + final JSONRPC2Message jsonMessage = JSONRPC2Message.parse(jsonString); - m_loggerProline.debug("JSON Notification method: " + jsonNotification.getMethod()); + if (jsonMessage instanceof JSONRPC2Notification) { + final JSONRPC2Notification jsonNotification = (JSONRPC2Notification) jsonMessage; - final Map namedParams = jsonNotification.getNamedParams(); + m_loggerProline.debug("JSON Notification method: " + jsonNotification.getMethod()); - if ((namedParams != null) && !namedParams.isEmpty()) { - final StringBuilder buff = new StringBuilder("Params: "); + final Map namedParams = jsonNotification.getNamedParams(); - boolean first = true; + if ((namedParams != null) && !namedParams.isEmpty()) { + final StringBuilder buff = new StringBuilder("Params: "); - final Set> entries = namedParams.entrySet(); + boolean first = true; - for (final Map.Entry entry : entries) { + final Set> entries = namedParams.entrySet(); - if (first) { - first = false; - } else { - buff.append(" | "); - } + for (final Map.Entry entry : entries) { - buff.append(entry.getKey()); - buff.append(" : ").append(entry.getValue()); - } + if (first) { + first = false; + } else { + buff.append(" | "); + } - m_loggerProline.debug(buff.toString()); - } + buff.append(entry.getKey()); + buff.append(" : ").append(entry.getValue()); + } - } else if (jsonMessage instanceof JSONRPC2Response) { - final JSONRPC2Response jsonResponse = (JSONRPC2Response) jsonMessage; + m_loggerProline.debug(buff.toString()); + } - m_loggerProline.debug("JSON Response Id: " + jsonResponse.getID()); + } else if (jsonMessage instanceof JSONRPC2Response) { + final JSONRPC2Response jsonResponse = (JSONRPC2Response) jsonMessage; - final JSONRPC2Error jsonError = jsonResponse.getError(); + m_loggerProline.debug("JSON Response Id: " + jsonResponse.getID()); - if (jsonError != null) { - m_loggerProline.error("JSON Error code {}, message : \"{}\"", jsonError.getCode(), jsonError.getMessage()); - m_loggerProline.error("JSON Throwable", jsonError); - } + final JSONRPC2Error jsonError = jsonResponse.getError(); - final Object result = jsonResponse.getResult(); + if (jsonError != null) { + m_loggerProline.error("JSON Error code {}, message : \"{}\"", jsonError.getCode(), jsonError.getMessage()); + m_loggerProline.error("JSON Throwable", jsonError); + } - if (result == null) { - m_loggerProline.debug("No result"); - } else { - m_loggerProline.debug("Result :\n" + result); - } + final Object result = jsonResponse.getResult(); - } + if (result == null) { + m_loggerProline.debug("No result"); + } else { + m_loggerProline.debug("Result :\n" + result); + } } + + } } diff --git a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/ServiceNotificationListener.java b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/ServiceNotificationListener.java index 144535335..8335d159d 100644 --- a/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/ServiceNotificationListener.java +++ b/prolinestudio-dpm/src/main/java/fr/proline/studio/dpm/task/util/ServiceNotificationListener.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.dpm.task.util; import com.thetransactioncompany.jsonrpc2.JSONRPC2Notification; @@ -75,16 +75,23 @@ public void removeCallback(AbstractJMSCallback callback){ @Override public void onMessage(Message jmsMessage) { - if (m_callbacks.size() <= 0 ) { - m_loggerProline.debug("SKIP Notification message : " + JMSMessageUtil.formatMessage(jmsMessage)); - - } else { - m_loggerProline.debug("Notification Listener Receiving message : " + JMSMessageUtil.formatMessage(jmsMessage)); +// if (m_callbacks.size() <= 0 ) { +// m_loggerProline.debug("SKIP Notification message : " + JMSMessageUtil.formatMessage(jmsMessage)); +// +// } else { + m_loggerProline.info(" *** JMSNOTIF 1 *** Notification Listener Receiving message : " + JMSMessageUtil.formatMessage(jmsMessage)); if (jmsMessage instanceof TextMessage) { - final TextMessage textMessage = (TextMessage) jmsMessage; + final TextMessage textMessage = (TextMessage) jmsMessage; + m_loggerProline.info(" *** JMSNOTIF 2 *** message : "+textMessage.toString()); try { final String jsonString = textMessage.getText(); + m_loggerProline.info(" *** JMSNOTIF 3 *** text message : "+jsonString); + if(!jsonString.startsWith("{\"method\":")) { + m_loggerProline.error(" *** None valide JSONRPC2Notification : Do not start with method entry."); + return; + } final JSONRPC2Notification jsonNotif = JSONRPC2Notification.parse(jsonString); + m_loggerProline.info(" *** JMSNOTIF 4 *** JSONRPC2Notification : "+jsonNotif.toJSONString()); Map params = jsonNotif.getNamedParams(); final JMSNotificationMessage resultMsg = new JMSNotificationMessage(params.getOrDefault(NOTIFICATION_SERVICE_NAME_KEY, "Undefined").toString(),params.getOrDefault(NOTIFICATION_SERVICE_VERSION_KEY, "default").toString(), params.getOrDefault(NOTIFICATION_SERVICE_SOURCE_KEY, "Unknown").toString(), params.getOrDefault(NOTIFICATION_SERVICE_DESCR_KEY, "").toString(), @@ -113,15 +120,20 @@ public void run() { callback.run(true); } } - + m_loggerProline.info(" *** JMSNOTIF *** DONE "); } catch (JMSException | JSONRPC2ParseException ex) { - m_loggerProline.error("Error handling JMS Message", ex); + m_loggerProline.error(" *** JMSNOTIF *** Error handling JMS Message", ex); } } else { - m_loggerProline.warn("Invalid JMS Message type"); + try { + m_loggerProline.warn("**** Invalid JMS Message type : "+jmsMessage); + m_loggerProline.warn("**** Invalid JMS Message type : "+jmsMessage.getJMSType()); + } catch (JMSException e) { + e.printStackTrace(); + } } - } +// } } } diff --git a/prolinestudio-logger/pom.xml b/prolinestudio-logger/pom.xml index f500ce9ca..2f7d7b772 100644 --- a/prolinestudio-logger/pom.xml +++ b/prolinestudio-logger/pom.xml @@ -5,12 +5,12 @@ prolinestudio-parent fr.proline - 2.1.2 + 2.2.0 fr.proline prolinestudio-logger - nbm + pom ProlineStudio-Logger @@ -36,26 +36,4 @@ - - - - - org.codehaus.mojo - nbm-maven-plugin - - true - - - org.slf4j - org.slf4j.helpers - org.slf4j.spi - org.slf4j.impl - ch.qos.logback.core.* - ch.qos.logback.classic.* - - - - - - diff --git a/prolinestudio-mzscope/pom.xml b/prolinestudio-mzscope/pom.xml index 09c0de645..a04361aee 100644 --- a/prolinestudio-mzscope/pom.xml +++ b/prolinestudio-mzscope/pom.xml @@ -4,12 +4,12 @@ prolinestudio-parent fr.proline - 2.1.2 + 2.2.0 fr.proline prolinestudio-mzscope - nbm + jar ProlineStudio-mzScope Proline module to display mzdb files @@ -26,7 +26,7 @@ fr.profi mzdb-access_${scala.version} - 1.0.0 + 1.1.0 xerces @@ -37,7 +37,7 @@ fr.profi mzdb-processing_${scala.version} - 1.0.0 + 1.1.0 joda-time @@ -48,7 +48,7 @@ fr.profi timstof-access - 1.0.0 + 1.1.0 xerces @@ -73,17 +73,9 @@ ${project.groupId} prolinestudio-logger ${project.version} + pom - - org.netbeans.api - org-openide-util - ${netbeans.version} - - - org.netbeans.api - org-openide-windows - ${netbeans.version} - + com.google.guava @@ -203,50 +195,23 @@ - + + + - org.codehaus.mojo - nbm-maven-plugin - - true - - - - fr.proline.mzscope.* - fr.proline.studio.mzscope - org.xmlpull.v1.* - com.google.common.* - org.apache.xerces.parsers.* - org.apache.xml.serialize.* - fr.profi.mzdb.* - com.almworks.sqlite4java.* - - - - - - - - maven-release-plugin - 2.5.2 - - - javasvn - - - - - com.google.code.maven-scm-provider-svnjava - maven-scm-provider-svnjava - 2.1.1 - compile - - + com.google.code.maven-replacer-plugin + replacer + + + + + + diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/IMzScope.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/IMzScope.java index fa9137c03..5251368f9 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/IMzScope.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/IMzScope.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope; import java.io.File; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/MzScope.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/MzScope.java index a04b20a92..4b5b8ae84 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/MzScope.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/MzScope.java @@ -1,97 +1,97 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.mzscope; - -import fr.proline.mzscope.model.IRawFile; -import fr.proline.mzscope.ui.MzScopePanel; -import fr.proline.mzscope.ui.RawFileManager; -import java.awt.Frame; -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import javax.swing.JPanel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * main entry point for mzscope - * @author MB243701 - */ -public class MzScope implements IMzScope{ - - private final static Logger logger = LoggerFactory.getLogger("ProlineStudio.mzScope"); - private MzScopePanel mzScopePanel; - - public MzScope() { - } - - /** - * create the mzscope panel, relative to the specified frame - * @param frame - * @return - */ - public JPanel createMzScopePanel(Frame frame){ - mzScopePanel = new MzScopePanel(frame); - return mzScopePanel; - - } - - /** - * open the specified file, and extract at the moz specified value - * @param file - * @param moz - * @param elutionTime - * @param firstScanTime - * @param lastScanTime - */ - @Override - public void openRawAndExtract(File file, double moz, double elutionTime, double firstScanTime, double lastScanTime) { - mzScopePanel.openRawAndExtract(file, moz, elutionTime, firstScanTime, lastScanTime); - } - - - @Override - public void openRaw(File file, boolean display) { - logger.debug("openRaw for "+file.getName()); - mzScopePanel.openRaw(Collections.singletonList(file), display); - } - - - @Override - public void openRaw(List files, boolean display) { - logger.debug("openRaw for list"); - mzScopePanel.openRaw(files, display); - } - - @Override - public void detectPeakels(File file) { - logger.debug("detectPeakel on "+file.getName()); - mzScopePanel.detectPeakels(Collections.singletonList(RawFileManager.getInstance().getFile(file.getName()))); - } - - @Override - public void detectPeakels(List fileList) { - List listRawFile = new ArrayList(); - for (File file : fileList) { - IRawFile rawFile = RawFileManager.getInstance().getFile(file.getName()); - listRawFile.add(rawFile); - } - mzScopePanel.detectPeakels(listRawFile); - } - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.mzscope; + +import fr.proline.mzscope.model.IRawFile; +import fr.proline.mzscope.ui.MzScopePanel; +import fr.proline.mzscope.ui.RawFileManager; +import java.awt.Frame; +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import javax.swing.JPanel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * main entry point for mzscope + * @author MB243701 + */ +public class MzScope implements IMzScope{ + + private final static Logger logger = LoggerFactory.getLogger("ProlineStudio.mzScope"); + private MzScopePanel mzScopePanel; + + public MzScope() { + } + + /** + * create the mzscope panel, relative to the specified frame + * @param frame + * @return + */ + public JPanel createMzScopePanel(Frame frame){ + mzScopePanel = new MzScopePanel(frame); + return mzScopePanel; + + } + + /** + * open the specified file, and extract at the moz specified value + * @param file + * @param moz + * @param elutionTime + * @param firstScanTime + * @param lastScanTime + */ + @Override + public void openRawAndExtract(File file, double moz, double elutionTime, double firstScanTime, double lastScanTime) { + mzScopePanel.openRawAndExtract(file, moz, elutionTime, firstScanTime, lastScanTime); + } + + + @Override + public void openRaw(File file, boolean display) { + logger.debug("openRaw for "+file.getName()); + mzScopePanel.openRaw(Collections.singletonList(file), display); + } + + + @Override + public void openRaw(List files, boolean display) { + logger.debug("openRaw for list"); + mzScopePanel.openRaw(files, display); + } + + @Override + public void detectPeakels(File file) { + logger.debug("detectPeakel on "+file.getName()); + mzScopePanel.detectPeakels(Collections.singletonList(RawFileManager.getInstance().getFile(file.getAbsolutePath()))); + } + + @Override + public void detectPeakels(List fileList) { + List listRawFile = new ArrayList(); + for (File file : fileList) { + IRawFile rawFile = RawFileManager.getInstance().getFile(file.getAbsolutePath()); + listRawFile.add(rawFile); + } + mzScopePanel.detectPeakels(listRawFile); + } + +} diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/AbstractLcMsMapSpectrum.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/AbstractLcMsMapSpectrum.java index d071691b5..a38e5c2da 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/AbstractLcMsMapSpectrum.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/AbstractLcMsMapSpectrum.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map; /** diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMap.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMap.java index 2b9c75970..ec4ccd092 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMap.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMap.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map; import java.io.File; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapChunk.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapChunk.java index 9da6d3ec1..9d0d13f4d 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapChunk.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapChunk.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapMzSpectrum.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapMzSpectrum.java index 155915ebb..5f5ca2c26 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapMzSpectrum.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapMzSpectrum.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map; import fr.profi.mzdb.model.SpectrumSlice; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapRtSpectrum.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapRtSpectrum.java index 7507d6d00..5607759e5 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapRtSpectrum.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapRtSpectrum.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map; import fr.profi.mzdb.model.SpectrumSlice; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapSpectrum.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapSpectrum.java index 03fc3bdb8..1f59a4e5a 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapSpectrum.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsMapSpectrum.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map; /** diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewer.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewer.java index 58e52abb6..91c96794a 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewer.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewerEvent.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewerEvent.java index 2133ff0ea..0e307ac17 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewerEvent.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewerEvent.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map; /** diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewerListener.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewerListener.java index 40dfe9ffc..126f922ba 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewerListener.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewerListener.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,11 +14,11 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.mzscope.map; - -/** - * @author JeT LcMsViewer listeners definition - */ -public interface LcMsViewerListener { - public void onLcMsViewerEvent(LcMsViewerEvent e); -} +package fr.proline.mzscope.map; + +/** + * @author JeT LcMsViewer listeners definition + */ +public interface LcMsViewerListener { + public void onLcMsViewerEvent(LcMsViewerEvent e); +} diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewport.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewport.java index be07e5c75..b1db98dea 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewport.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/LcMsViewport.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map; import java.awt.geom.Point2D; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityFirePainter.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityFirePainter.java index 5bd649037..51f9521f1 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityFirePainter.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityFirePainter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map.color; import java.awt.Color; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityGrayPainter.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityGrayPainter.java index 47d72ad86..e0c7aac7a 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityGrayPainter.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityGrayPainter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map.color; import java.awt.Color; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityPainter.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityPainter.java index d956de72f..298c78909 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityPainter.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityPainter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map.color; import java.awt.Color; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityTempPainter.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityTempPainter.java index 0b5787150..fc62b5593 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityTempPainter.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/color/IntensityTempPainter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map.color; import java.awt.Color; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/AbstractLcMsViewerManipulator.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/AbstractLcMsViewerManipulator.java index dbf282827..e9918d562 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/AbstractLcMsViewerManipulator.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/AbstractLcMsViewerManipulator.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map.control; import javax.swing.JPanel; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerController.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerController.java index 816ae77f3..c4dd62224 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerController.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerController.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map.control; import java.awt.event.MouseEvent; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerExtractorManipulator.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerExtractorManipulator.java index 42231d06b..49cb11326 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerExtractorManipulator.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerExtractorManipulator.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map.control; import java.awt.BasicStroke; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerManipulator.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerManipulator.java index a865564ff..10b014279 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerManipulator.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerManipulator.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map.control; import java.awt.Graphics2D; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerNavigateManipulator.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerNavigateManipulator.java index 5db4cd7eb..d5025178e 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerNavigateManipulator.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerNavigateManipulator.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map.control; import java.awt.Cursor; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerSelectionManipulator.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerSelectionManipulator.java index ec50e6d50..05b6ad2a0 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerSelectionManipulator.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/control/LcMsViewerSelectionManipulator.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map.control; import java.awt.BasicStroke; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1D.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1D.java index 6f1fb13e0..56fbfcd5b 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1D.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1D.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DComposite.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DComposite.java index c441bd13d..ab79fb349 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DComposite.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DComposite.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DIdentity.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DIdentity.java index dd8c371e1..bb5f098ce 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DIdentity.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DIdentity.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DLinear.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DLinear.java index 6f2ff0326..e7df37bb4 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DLinear.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DLinear.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DLog.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DLog.java index bef5e61fa..6db3292be 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DLog.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/math/Function1DLog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/ui/JLcMsMapPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/ui/JLcMsMapPanel.java index 19605b606..0024e3a34 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/ui/JLcMsMapPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/ui/JLcMsMapPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map.ui; import java.awt.Color; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/ui/LcMsMapSpectrumPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/ui/LcMsMapSpectrumPanel.java index 73ba15506..a69a2f632 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/ui/LcMsMapSpectrumPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/ui/LcMsMapSpectrumPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map.ui; import java.awt.BasicStroke; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/ui/LcMsViewerUI.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/ui/LcMsViewerUI.java index ec0d391a3..f9cfb429f 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/ui/LcMsViewerUI.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/map/ui/LcMsViewerUI.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/AnnotatedChromatogram.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/AnnotatedChromatogram.java index df91f1809..26b44e3fc 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/AnnotatedChromatogram.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/AnnotatedChromatogram.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/BasePeakel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/BasePeakel.java index a07b96bde..3f0ce681f 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/BasePeakel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/BasePeakel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/Chromatogram.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/Chromatogram.java index ed438fd49..59084d92b 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/Chromatogram.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/Chromatogram.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.model; import java.util.Arrays; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/ExtractionObject.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/ExtractionObject.java index 870aa8e04..28de6380c 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/ExtractionObject.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/ExtractionObject.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/ExtractionRequest.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/ExtractionRequest.java index 1cc7cca4a..8aec15dd2 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/ExtractionRequest.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/ExtractionRequest.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.model; import org.apache.commons.lang3.builder.ToStringBuilder; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/FeaturesExtractionRequest.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/FeaturesExtractionRequest.java index e0952786f..a2468637f 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/FeaturesExtractionRequest.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/FeaturesExtractionRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,205 +14,216 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.mzscope.model; - -/** - * @author CB205360 - */ -public class FeaturesExtractionRequest extends MsnExtractionRequest { - - public static final boolean REMOVE_BASELINE = false; - public static final boolean USE_SMOOTHING = true; - public static final int MIN_PEAKS_COUNT = 5; - public static final int MIN_MAX_DISTANCE = 3; - public static final float MIN_MAX_RATIO = 0.75f; - public static final float INTENSITY_PERCENTILE = 0.9f; - public static final int MAX_CONSECUTIVE_GAPS = 3; - - public enum ExtractionMethod { - EXTRACT_MS2_FEATURES, DETECT_PEAKELS, DETECT_FEATURES - } - - public static class Builder> extends MsnExtractionRequest.Builder { - - ExtractionMethod extractionMethod; - boolean removeBaseline = REMOVE_BASELINE; - boolean useSmoothing = USE_SMOOTHING; - int minPeaksCount = MIN_PEAKS_COUNT; - int minmaxDistanceThreshold = MIN_MAX_DISTANCE; - int maxConsecutiveGaps = MAX_CONSECUTIVE_GAPS; - float maxIntensityRelativeThreshold = MIN_MAX_RATIO; - float intensityPercentile = INTENSITY_PERCENTILE; - - @Override - public T setMzTolPPM(float mzTolPPM) { - this.mzTolPPM = mzTolPPM; - return self(); - } - - @Override - public T setMz(double mz) { - this.mz = mz; - this.maxMz = (mz + mz * mzTolPPM / 1e6f); - this.minMz = (mz - mz * mzTolPPM / 1e6f); - return self(); - } - - @Override - public T setMaxMz(double maxMz) { - this.maxMz = maxMz; - return self(); - } - - @Override - public T setMinMz(double minMz) { - this.minMz = minMz; - return self(); - } - - public T setExtractionMethod(ExtractionMethod extractionMethod) { - this.extractionMethod = extractionMethod; - return self(); - } - - public T setRemoveBaseline(boolean removeBaseline) { - this.removeBaseline = removeBaseline; - return self(); - } - - public T setUseSmoothing(boolean useSmoothing) { - this.useSmoothing = useSmoothing; - return self(); - } - - public T setMinPeaksCount(int minPeaksCount) { - this.minPeaksCount = minPeaksCount; - return self(); - } - - public T setMinmaxDistanceThreshold(int minmaxDistanceThreshold) { - this.minmaxDistanceThreshold = minmaxDistanceThreshold; - return self(); - } - - public T setIntensityPercentile(float intensityPercentile) { - this.intensityPercentile = intensityPercentile; - return self(); - } - - public T setMaxIntensityRelativeThreshold(float maxIntensityRelativeThreshold) { - this.maxIntensityRelativeThreshold = maxIntensityRelativeThreshold; - return self(); - } - - public T setMaxConsecutiveGaps(int maxConsecutiveGaps) { - this.maxConsecutiveGaps = maxConsecutiveGaps; - return self(); - } - - public FeaturesExtractionRequest build() { - return new FeaturesExtractionRequest(this); - } - } - - @SuppressWarnings("rawtypes") - public static Builder builder() { - return new Builder(); - } - - private ExtractionMethod extractionMethod; - private boolean removeBaseline; - private boolean useSmoothing; - private int minPeaksCount; - private int minmaxDistanceThreshold; - private float maxIntensityRelativeThreshold; - private float intensityPercentile; - private int maxConsecutiveGaps; - - protected FeaturesExtractionRequest(Builder builder) { - super(builder); - this.extractionMethod = builder.extractionMethod; - this.removeBaseline = builder.removeBaseline; - this.useSmoothing = builder.useSmoothing; - this.minPeaksCount = builder.minPeaksCount; - this.minmaxDistanceThreshold = builder.minmaxDistanceThreshold; - this.maxIntensityRelativeThreshold = builder.maxIntensityRelativeThreshold; - this.intensityPercentile = builder.intensityPercentile; - this.maxConsecutiveGaps = builder.maxConsecutiveGaps; - } - - public ExtractionMethod getExtractionMethod() { - return extractionMethod; - } - - public boolean isRemoveBaseline() { - return removeBaseline; - } - - public boolean isUseSmoothing() { - return useSmoothing; - } - - public int getMinPeaksCount() { - return minPeaksCount; - } - - public int getMinmaxDistanceThreshold() { - return minmaxDistanceThreshold; - } - - public float getMaxIntensityRelativeThreshold() { - return maxIntensityRelativeThreshold; - } - - public float getIntensityPercentile() { - return intensityPercentile; - } - - public int getMaxConsecutiveGaps() { - return maxConsecutiveGaps; - } - - public String getExtractionParamsString() { - StringBuilder sb = new StringBuilder(); - String em = ""; - switch (getExtractionMethod()) { - case EXTRACT_MS2_FEATURES: { - em = "Extract MS2 Features"; - break; - } - case DETECT_PEAKELS: { - em = "Detect Peakels"; - break; - } - case DETECT_FEATURES: { - em = "Detect Features"; - break; - } - } - sb.append(""); - sb.append(em); - sb.append(":
"); - sb.append("m/z tolerance (ppm): "); - sb.append(Float.toString(getMzTolPPM())); - sb.append("
"); - if (isRemoveBaseline()) { - sb.append("Use Peakels baseline remover
"); - } - if (Double.compare(getMinMz(), getMaxMz()) == 0 && Double.compare(getMinMz(), 0.0) == 0) { - sb.append("no m/z bounds"); - } else if (Double.compare(getMz(), 0) != 0) { - sb.append("at m/z: "); - sb.append(getMz()); - } else { - sb.append("m/z bounds: "); - sb.append(getMinMz()); - sb.append(" - "); - sb.append(getMaxMz()); - } - sb.append(""); - - return sb.toString(); - } - -} +package fr.proline.mzscope.model; + +/** + * @author CB205360 + */ +public class FeaturesExtractionRequest extends MsnExtractionRequest { + + public static final boolean REMOVE_BASELINE = false; + public static final boolean USE_SMOOTHING = true; + public static final int MIN_PEAKS_COUNT = 5; + public static final int MIN_MAX_DISTANCE = 3; + public static final float MIN_MAX_RATIO = 0.75f; + public static final float INTENSITY_PERCENTILE = 0.9f; + public static final int MAX_CONSECUTIVE_GAPS = 3; + public static final float COELUTION_RT_TOLERANCE = 40; + + public enum ExtractionMethod { + EXTRACT_MS2_FEATURES, DETECT_PEAKELS, DETECT_FEATURES + } + + public static class Builder> extends MsnExtractionRequest.Builder { + + ExtractionMethod extractionMethod; + boolean removeBaseline = REMOVE_BASELINE; + boolean useSmoothing = USE_SMOOTHING; + int minPeaksCount = MIN_PEAKS_COUNT; + int minmaxDistanceThreshold = MIN_MAX_DISTANCE; + int maxConsecutiveGaps = MAX_CONSECUTIVE_GAPS; + float maxIntensityRelativeThreshold = MIN_MAX_RATIO; + float intensityPercentile = INTENSITY_PERCENTILE; + + @Override + public T setMzTolPPM(float mzTolPPM) { + this.mzTolPPM = mzTolPPM; + return self(); + } + + @Override + public T setMz(double mz) { + this.mz = mz; + this.maxMz = (mz + mz * mzTolPPM / 1e6f); + this.minMz = (mz - mz * mzTolPPM / 1e6f); + return self(); + } + + @Override + public T setMaxMz(double maxMz) { + this.maxMz = maxMz; + return self(); + } + + @Override + public T setMinMz(double minMz) { + this.minMz = minMz; + return self(); + } + + public T setExtractionMethod(ExtractionMethod extractionMethod) { + this.extractionMethod = extractionMethod; + return self(); + } + + public T setRemoveBaseline(boolean removeBaseline) { + this.removeBaseline = removeBaseline; + return self(); + } + + public T setUseSmoothing(boolean useSmoothing) { + this.useSmoothing = useSmoothing; + return self(); + } + + public T setMinPeaksCount(int minPeaksCount) { + this.minPeaksCount = minPeaksCount; + return self(); + } + + public T setMinmaxDistanceThreshold(int minmaxDistanceThreshold) { + this.minmaxDistanceThreshold = minmaxDistanceThreshold; + return self(); + } + + public T setIntensityPercentile(float intensityPercentile) { + this.intensityPercentile = intensityPercentile; + return self(); + } + + public T setMaxIntensityRelativeThreshold(float maxIntensityRelativeThreshold) { + this.maxIntensityRelativeThreshold = maxIntensityRelativeThreshold; + return self(); + } + + public T setMaxConsecutiveGaps(int maxConsecutiveGaps) { + this.maxConsecutiveGaps = maxConsecutiveGaps; + return self(); + } + + public FeaturesExtractionRequest build() { + return new FeaturesExtractionRequest(this); + } + } + + @SuppressWarnings("rawtypes") + public static Builder builder() { + return new Builder(); + } + + private ExtractionMethod extractionMethod; + private boolean removeBaseline; + private boolean useSmoothing; + private int minPeaksCount; + private int minmaxDistanceThreshold; + private float maxIntensityRelativeThreshold; + private float intensityPercentile; + private int maxConsecutiveGaps; + private float coelutionRtTolerance; + + protected FeaturesExtractionRequest(Builder builder) { + super(builder); + this.extractionMethod = builder.extractionMethod; + this.removeBaseline = builder.removeBaseline; + this.useSmoothing = builder.useSmoothing; + this.minPeaksCount = builder.minPeaksCount; + this.minmaxDistanceThreshold = builder.minmaxDistanceThreshold; + this.maxIntensityRelativeThreshold = builder.maxIntensityRelativeThreshold; + this.intensityPercentile = builder.intensityPercentile; + this.maxConsecutiveGaps = builder.maxConsecutiveGaps; + this.coelutionRtTolerance = COELUTION_RT_TOLERANCE; + } + + public ExtractionMethod getExtractionMethod() { + return extractionMethod; + } + + public boolean isRemoveBaseline() { + return removeBaseline; + } + + public boolean isUseSmoothing() { + return useSmoothing; + } + + public int getMinPeaksCount() { + return minPeaksCount; + } + + public int getMinmaxDistanceThreshold() { + return minmaxDistanceThreshold; + } + + public float getMaxIntensityRelativeThreshold() { + return maxIntensityRelativeThreshold; + } + + public float getIntensityPercentile() { + return intensityPercentile; + } + + public int getMaxConsecutiveGaps() { + return maxConsecutiveGaps; + } + + public float getCoelutionRtTolerance() { + return coelutionRtTolerance; + } + + + public String getExtractionParamsString() { + StringBuilder sb = new StringBuilder(); + String em = ""; + switch (getExtractionMethod()) { + case EXTRACT_MS2_FEATURES: { + em = "Extract MS2 Features"; + break; + } + case DETECT_PEAKELS: { + em = "Detect Peakels"; + break; + } + case DETECT_FEATURES: { + em = "Detect Features"; + break; + } + } + sb.append(""); + sb.append(em); + sb.append(":
"); + sb.append("m/z tolerance (ppm): "); + sb.append(Float.toString(getMzTolPPM())); + sb.append("
"); + sb.append("rt coelution tolerance (s): "); + sb.append(Float.toString(getCoelutionRtTolerance())); + sb.append("
"); + if (isRemoveBaseline()) { + sb.append("Use Peakels baseline remover
"); + } + if (Double.compare(getMinMz(), getMaxMz()) == 0 && Double.compare(getMinMz(), 0.0) == 0) { + sb.append("no m/z bounds"); + } else if (Double.compare(getMz(), 0) != 0) { + sb.append("at m/z: "); + sb.append(getMz()); + } else { + sb.append("m/z bounds: "); + sb.append(getMinMz()); + sb.append(" - "); + sb.append(getMaxMz()); + } + sb.append(""); + + return sb.toString(); + } + +} diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IChromatogram.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IChromatogram.java index 6f9d5d329..b80f1a99c 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IChromatogram.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IChromatogram.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.model; public interface IChromatogram { diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IExportParameters.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IExportParameters.java index 749d88cb8..85b732db9 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IExportParameters.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IExportParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,16 +14,16 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.mzscope.model; - -/** - * export parameters (could be MGF or TSV for ScanHeader) - * @author MB243701 - */ -public interface IExportParameters { - - enum ExportType {MGF, SCAN_HEADER} ; - - public ExportType getExportType(); - -} +package fr.proline.mzscope.model; + +/** + * export parameters (could be MGF or TSV for ScanHeader) + * @author MB243701 + */ +public interface IExportParameters { + + enum ExportType {MGF, SCAN_HEADER} ; + + public ExportType getExportType(); + +} diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IPeakel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IPeakel.java index 85f4b7cd1..cd89ac1d5 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IPeakel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IPeakel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IRawFile.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IRawFile.java index 4030bf884..499565260 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IRawFile.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/IRawFile.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/MsnExtractionRequest.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/MsnExtractionRequest.java index 062c0f885..ffc5a1265 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/MsnExtractionRequest.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/MsnExtractionRequest.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.model; import fr.profi.mzdb.XicMethod; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/QCMetrics.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/QCMetrics.java index e1d3cbef5..3b28599e5 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/QCMetrics.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/QCMetrics.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.model; import java.util.ArrayList; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/Spectrum.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/Spectrum.java index a5e85ffca..47d0f17f4 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/Spectrum.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/model/Spectrum.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/Main.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/Main.java index 3df3390b2..1a20b864d 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/Main.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbFeatureWrapper.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbFeatureWrapper.java index f85908f98..ac34efc5d 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbFeatureWrapper.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbFeatureWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbMetricsCollector.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbMetricsCollector.java index 5898b1b9d..52d8cefcd 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbMetricsCollector.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbMetricsCollector.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.mzdb; import com.almworks.sqlite4java.SQLiteException; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbPeakelWrapper.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbPeakelWrapper.java index cbb205256..57f765180 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbPeakelWrapper.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbPeakelWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbRawFile.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbRawFile.java index 93d5a0eef..db0a08394 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbRawFile.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/MzdbRawFile.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -343,13 +343,11 @@ private List detectFeatures(FeaturesExtractionRequest params) { Arrays.sort(peakels, (p1, p2) -> Double.compare(p2.getApexIntensity(), p1.getApexIntensity())); + long start = System.currentTimeMillis(); PeakelsHelper helper = new PeakelsHelper(peakels); - //List features2 = helper.deisotopePeakels(reader, mzTolPPM); - //List features = helper.deisotopePeakelsFromMzdb(reader, params.getMzTolPPM()); - //List features = helper.deisotopePeakelsFromMzdb(reader, params.getMzTolPPM()); - List features = helper.deisotopePeakels(reader, params.getMzTolPPM()); - features.forEach(f -> result.add(new MzdbFeatureWrapper(f, this, 1))); - + Map> featuresMap = helper.deisotopePeakels(params.getMzTolPPM(), params.getCoelutionRtTolerance()); + featuresMap.get(PeakelsHelper.VALID_FEATURES).forEach(f -> result.add(new MzdbFeatureWrapper(f, this, 1))); + LOG.info("Deisotoping took {} ms", (System.currentTimeMillis()-start)); } catch (SQLiteException | StreamCorruptedException ex) { LOG.error("Error while getting LcMs RunSlice Iterator: " + ex); } @@ -640,8 +638,8 @@ public boolean exportRawFile(String outputFileName, IExportParameters exportPara try { MgfExportParameters mgfExportParam = (MgfExportParameters)exportParams; LOG.debug("MGF writer start for " + this.getName() + ": mgfFilePath=" + outputFileName - + ", precursorMzComputation=" + mgfExportParam.getPrecComp().getParamName() + - ", mzTol=" + mgfExportParam.getMzTolPPM() + + ", precursorMzComputation=" + mgfExportParam.getPrecComp().getParamName() + + ", mzTol=" + mgfExportParam.getMzTolPPM() + ", intensityCutoff=" + mgfExportParam.getIntensityCutoff() + ", exportProlineTitle=" + mgfExportParam.isExportProlineTitle()); MgfWriter writer = new MgfWriter(this.getFile().getAbsolutePath()); diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/ThreadedMzdbRawFile.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/ThreadedMzdbRawFile.java index 7ddddad7e..34f72aa28 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/ThreadedMzdbRawFile.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzdb/ThreadedMzdbRawFile.java @@ -1,271 +1,278 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.mzscope.mzdb; - -import fr.proline.mzscope.model.*; -import fr.proline.mzscope.model.IChromatogram; - -import java.io.File; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author CB205360 - */ -public class ThreadedMzdbRawFile implements IRawFile { - - private static final Logger logger = LoggerFactory.getLogger(ThreadedMzdbRawFile.class); - - private final ExecutorService service; - private final File file; - private MzdbRawFile mzdbRawFile; - - public ThreadedMzdbRawFile(File file) { - this.file = file; - this.service = Executors.newSingleThreadExecutor(); - init(); - } - - private void init() { - try { - Future future = service.submit(() -> { - mzdbRawFile = new MzdbRawFile(file); - }); - future.get(); - } catch (InterruptedException | ExecutionException ex) { - logger.error("mzdbRawFile initialisation failed", ex); - } - } - - @Override - public String getName() { - return file.getName(); - } - - @Override - public File getFile(){ - return file; - } - - - @Override - public String toString(){ - return file.getName(); - } - - @Override - public int getPreviousSpectrumId(final int spectrumIndex, final int msLevel) { - try { - return service.submit(() -> mzdbRawFile.getPreviousSpectrumId(spectrumIndex, msLevel)).get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("getPreviousSpectrumId call fail", ex); - } - return -1; - } - - @Override - public int getSpectrumCount() { - try { - return service.submit(() -> mzdbRawFile.getSpectrumCount()).get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("getPreviousSpectrumId call fail", ex); - } - return -1; - } - - @Override - public int getNextSpectrumId(final int spectrumIndex, final int msLevel) { - try { - return service.submit(() -> mzdbRawFile.getNextSpectrumId(spectrumIndex, msLevel)).get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("getNextSpectrumId call fail", ex); - } - return -1; - } - - @Override - public int getSpectrumId(final double retentionTime) { - try { - return service.submit(() -> mzdbRawFile.getSpectrumId(retentionTime)).get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("getSpectrumId call fail", ex); - } - return -1; - } - - @Override - public double[] getElutionTimes(int msLevel) { - try { - return service.submit(() -> mzdbRawFile.getElutionTimes(msLevel)).get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("getElutionTimes call fail", ex); - } - return null; - } - - @Override - public double getSpectrumElutionTime(int spectrumIndex) { - try { - return service.submit(() -> mzdbRawFile.getSpectrumElutionTime(spectrumIndex)).get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("getSpectrumElutionTime call fail", ex); - } - return -1.0; - } - - @Override - public Spectrum getSpectrum(final int spectrumIndex) { - try { - return service.submit(() -> mzdbRawFile.getSpectrum(spectrumIndex)).get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("getSpectrum call fail", ex); - } - return null; - } - - @Override - public List extractFeatures(FeaturesExtractionRequest params) { - try { - logger.info("extract feature starting"); - Future> future = service.submit(() -> { - List result = mzdbRawFile.extractFeatures(params); - result.stream().forEach( f -> f.setRawFile(ThreadedMzdbRawFile.this)); - return result; - }); - logger.info("waiting for feature extraction ... "); - return future.get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("extractFeatures call fail", ex); - } - return null; - } - - @Override - public List extractPeakels(final FeaturesExtractionRequest params) { - try { - logger.info("extract peakels starting"); - Future> future = service.submit(() -> { - List result = mzdbRawFile.extractPeakels(params); - result.stream().forEach( f -> f.setRawFile(ThreadedMzdbRawFile.this)); - return result; - }); - logger.info("waiting for peakels extraction ... "); - return future.get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("extractPeakels call fail", ex); - } - return null; - } - - @Override - public IChromatogram getBPI() { - try { - return service.submit(() -> { - IChromatogram chromatogram = mzdbRawFile.getBPI(); - return chromatogram; - }).get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("getBPI call fail", ex); - } - return null; - } - - @Override - public IChromatogram getXIC(final MsnExtractionRequest params) { - try { - return service.submit(() -> { - IChromatogram chromatogram = mzdbRawFile.getXIC(params); - return chromatogram; - }).get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("getXIC call fail", ex); - } - return null; - } - - @Override - public IChromatogram getTIC(int msLevel) { - try { - return service.submit(() -> { - IChromatogram chromatogram = mzdbRawFile.getTIC(msLevel); - return chromatogram; - }).get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("getTIC call fail", ex); - } - return null; - } - - @Override - public List getMsMsEvent(double minMz, double maxMz) { - return mzdbRawFile.getMsMsEvent(minMz, maxMz); - } - - @Override - public boolean exportRawFile(String mgfFileName, IExportParameters exportParams ){ - try { - return service.submit(() -> mzdbRawFile.exportRawFile(mgfFileName, exportParams)).get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("export call fail", ex); - } - return false; - } - - @Override - public boolean isDIAFile(){ - return mzdbRawFile.isDIAFile(); - } - - @Override - public Map getFileProperties() { - try { - return service.submit(() -> { - Map data = mzdbRawFile.getFileProperties(); - return data; - }).get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("getFileMetaData call fail", ex); - } - return null; - } - - @Override - public QCMetrics getFileMetrics() { - try { - return service.submit(() -> { - QCMetrics metrics = mzdbRawFile.getFileMetrics(); - metrics.setRawFile(ThreadedMzdbRawFile.this); - return metrics; - }).get(); - } catch (InterruptedException | ExecutionException ex ) { - logger.error("getFileMetaData call fail", ex); - } - return null; - } - - @Override - public void closeIRawFile() { - mzdbRawFile.closeIRawFile(); - } -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.mzscope.mzdb; + +import fr.proline.mzscope.model.*; +import fr.proline.mzscope.model.IChromatogram; + +import java.io.File; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author CB205360 + */ +public class ThreadedMzdbRawFile implements IRawFile { + + private static final Logger logger = LoggerFactory.getLogger(ThreadedMzdbRawFile.class); + + private final ExecutorService service; + private final File file; + private MzdbRawFile mzdbRawFile; + + public ThreadedMzdbRawFile(File file) { + this.file = file; + this.service = Executors.newSingleThreadExecutor(); + init(); + } + + private void init() { + try { + Future future = service.submit(() -> { + mzdbRawFile = new MzdbRawFile(file); + }); + future.get(); + } catch (InterruptedException | ExecutionException ex) { + logger.error("mzdbRawFile initialisation failed", ex); + } + } + + @Override + public String getName() { + return file.getName(); + } + + @Override + public File getFile(){ + return file; + } + + + @Override + public String toString(){ + return file.getName(); + } + + @Override + public int getPreviousSpectrumId(final int spectrumIndex, final int msLevel) { + try { + return service.submit(() -> mzdbRawFile.getPreviousSpectrumId(spectrumIndex, msLevel)).get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("getPreviousSpectrumId call fail", ex); + } + return -1; + } + + @Override + public int getSpectrumCount() { + try { + return service.submit(() -> mzdbRawFile.getSpectrumCount()).get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("getPreviousSpectrumId call fail", ex); + } + return -1; + } + + @Override + public int getNextSpectrumId(final int spectrumIndex, final int msLevel) { + try { + return service.submit(() -> mzdbRawFile.getNextSpectrumId(spectrumIndex, msLevel)).get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("getNextSpectrumId call fail", ex); + } + return -1; + } + + @Override + public int getSpectrumId(final double retentionTime) { + try { + return service.submit(() -> mzdbRawFile.getSpectrumId(retentionTime)).get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("getSpectrumId call fail", ex); + } + return -1; + } + + @Override + public double[] getElutionTimes(int msLevel) { + try { + return service.submit(() -> mzdbRawFile.getElutionTimes(msLevel)).get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("getElutionTimes call fail", ex); + } + return null; + } + + @Override + public double getSpectrumElutionTime(int spectrumIndex) { + try { + return service.submit(() -> mzdbRawFile.getSpectrumElutionTime(spectrumIndex)).get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("getSpectrumElutionTime call fail", ex); + } + return -1.0; + } + + @Override + public Spectrum getSpectrum(final int spectrumIndex) { + try { + return service.submit(() -> mzdbRawFile.getSpectrum(spectrumIndex)).get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("getSpectrum call fail", ex); + } + return null; + } + + @Override + public List extractFeatures(FeaturesExtractionRequest params) { + try { + logger.info("extract feature starting"); + Future> future = service.submit(() -> { + List result = mzdbRawFile.extractFeatures(params); + result.stream().forEach( f -> f.setRawFile(ThreadedMzdbRawFile.this)); + return result; + }); + logger.info("waiting for feature extraction ... "); + return future.get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("extractFeatures call fail", ex); + } + return null; + } + + @Override + public List extractPeakels(final FeaturesExtractionRequest params) { + try { + logger.info("extract peakels starting"); + Future> future = service.submit(() -> { + List result = mzdbRawFile.extractPeakels(params); + result.stream().forEach( f -> f.setRawFile(ThreadedMzdbRawFile.this)); + return result; + }); + logger.info("waiting for peakels extraction ... "); + return future.get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("extractPeakels call fail", ex); + } + return null; + } + + @Override + public IChromatogram getBPI() { + try { + return service.submit(() -> { + IChromatogram chromatogram = mzdbRawFile.getBPI(); + return chromatogram; + }).get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("getBPI call fail", ex); + } + return null; + } + + @Override + public IChromatogram getXIC(final MsnExtractionRequest params) { + try { + return service.submit(() -> { + IChromatogram chromatogram = mzdbRawFile.getXIC(params); + return chromatogram; + }).get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("getXIC call fail", ex); + } + return null; + } + + @Override + public IChromatogram getTIC(int msLevel) { + try { + return service.submit(() -> { + IChromatogram chromatogram = mzdbRawFile.getTIC(msLevel); + return chromatogram; + }).get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("getTIC call fail", ex); + } + return null; + } + + @Override + public List getMsMsEvent(double minMz, double maxMz) { + return mzdbRawFile.getMsMsEvent(minMz, maxMz); + } + + @Override + public boolean exportRawFile(String mgfFileName, IExportParameters exportParams ){ + try { + return service.submit(() -> mzdbRawFile.exportRawFile(mgfFileName, exportParams)).get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("export call fail", ex); + } + return false; + } + + @Override + public boolean isDIAFile(){ + return mzdbRawFile.isDIAFile(); + } + + @Override + public Map getFileProperties() { + try { + return service.submit(() -> { + Map data = mzdbRawFile.getFileProperties(); + return data; + }).get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("getFileMetaData call fail", ex); + } + return null; + } + + @Override + public QCMetrics getFileMetrics() { + try { + return service.submit(() -> { + QCMetrics metrics = mzdbRawFile.getFileMetrics(); + metrics.setRawFile(ThreadedMzdbRawFile.this); + return metrics; + }).get(); + } catch (InterruptedException | ExecutionException ex ) { + logger.error("getFileMetaData call fail", ex); + } + return null; + } + + @Override + public void closeIRawFile() { + try { + Future future = service.submit(() -> { + mzdbRawFile.closeIRawFile(); + }); + future.get(); + } catch (InterruptedException | ExecutionException ex) { + logger.error("mzdbRawFile clise failed", ex); + } + } +} diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/IndexPredictor.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/IndexPredictor.java index 77cf1e824..584169ce0 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/IndexPredictor.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/IndexPredictor.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.mzml; import fr.proline.mzscope.mzml.Scan; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/Main.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/Main.java index 5ebc131cf..bda1c58b6 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/Main.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/Main.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.mzml; import java.io.BufferedWriter; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/MzMLRawFile.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/MzMLRawFile.java index dda455a50..071a1a3fe 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/MzMLRawFile.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/MzMLRawFile.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/PreScan.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/PreScan.java index aaefcf22a..dd52de0c2 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/PreScan.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/PreScan.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,16 +14,16 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.mzscope.mzml; - -public class PreScan { - - int index; - String id; - String encodedMasses; - String encodedIntensities; - String masses_encoding; - String intensities_encoding; - String rt; - -} +package fr.proline.mzscope.mzml; + +public class PreScan { + + int index; + String id; + String encodedMasses; + String encodedIntensities; + String masses_encoding; + String intensities_encoding; + String rt; + +} diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/Scan.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/Scan.java index 1ab114e72..2ac3e2d81 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/Scan.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/Scan.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.mzml; public class Scan { diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/ScanFactory.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/ScanFactory.java index 9650f9a3c..493678a97 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/ScanFactory.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/ScanFactory.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.mzml; import fr.proline.mzscope.mzml.Scan; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/XICExtractor.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/XICExtractor.java index 85a327d06..67aa66574 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/XICExtractor.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/XICExtractor.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.mzml; import fr.proline.mzscope.model.Chromatogram; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/mzMLReader.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/mzMLReader.java index a29803beb..fdcfd83cb 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/mzMLReader.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/mzml/mzMLReader.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.mzml; import java.util.Collection; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/ChiSquareScorer.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/ChiSquareScorer.java index b252cba64..ca19f7229 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/ChiSquareScorer.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/ChiSquareScorer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/ChromatogramAnnotator.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/ChromatogramAnnotator.java index 8c61802c2..f9beffe0b 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/ChromatogramAnnotator.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/ChromatogramAnnotator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/DotProductScorer.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/DotProductScorer.java index 10ba36e8c..ff46a395b 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/DotProductScorer.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/DotProductScorer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -31,8 +31,8 @@ public class DotProductScorer implements Scorer { private static final Logger logger = LoggerFactory.getLogger(DotProductScorer.class); - private static final int MAX_SCORED_ISOTOPES = 8; - + private static final int MAX_SCORED_ISOTOPES = 8; + public Tuple2 score(SpectrumData currentSpectrum, double intialMz, int shift, int charge, double ppmTol) { double score = 0.0; double mz = intialMz - shift * IsotopePatternEstimator.avgIsoMassDiff() / charge; @@ -43,15 +43,12 @@ public Tuple2 score(SpectrumData currentSpect Double ipMoz = mz; double[] observed = new double[pattern.mzAbundancePairs().length]; double[] expected = new double[pattern.mzAbundancePairs().length]; - int observations = 0; - //logger.info("mz {} charge pattern {}+, nb isotopes = {}", mz, charge, pattern.mzAbundancePairs().length); for (int rank = 0; rank < pattern.mzAbundancePairs().length ; rank++) { ipMoz = (rank == 0) ? ipMoz : ipMoz + IsotopePatternEstimator.avgIsoMassDiff() / charge; int nearestPeakIdx = SpectrumUtils.getNearestPeakIndex(currentSpectrum.getMzList(), ipMoz); if (((1e6 * Math.abs(currentSpectrum.getMzList()[nearestPeakIdx] - ipMoz) / ipMoz) < ppmTol)) { observed[rank] = currentSpectrum.getIntensityList()[nearestPeakIdx]; - observations++; } else { // minus expected abundance to penalise signal absence observed[rank] = -(Float)pattern.mzAbundancePairs()[rank]._2 * scale; @@ -67,15 +64,14 @@ public Tuple2 score(SpectrumData currentSpect public static double dotProduct(double[] observed, double[] expected) { double sumObserved = 0.0; double sumExpected = 0.0; - double dotProduct = 0.0; + double product = 0.0; -// for (int k = 0; k < Math.min(observed.length, MAX_SCORED_ISOTOPES); k++) { - for (int k = 0; (k < observed.length) && (expected[k] > 0.1) ; k++) { - dotProduct += observed[k]*expected[k]; + for (int k = 0; k < observed.length; k++) { + product += observed[k]*expected[k]; sumExpected += expected[k]*expected[k]; sumObserved += observed[k]*observed[k]; } - return ((sumExpected == 0) || (sumObserved == 0)) ? 0.0 : dotProduct/(Math.sqrt(sumExpected)*Math.sqrt(sumObserved)); + return ((sumExpected == 0) || (sumObserved == 0)) ? 0.0 : product/(Math.sqrt(sumExpected)*Math.sqrt(sumObserved)); } } diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/IAnnotator.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/IAnnotator.java index ad82f535d..8931816f5 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/IAnnotator.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/IAnnotator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,14 +14,14 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.mzscope.processing; - -import fr.proline.mzscope.model.AnnotatedChromatogram; -import fr.proline.mzscope.model.IChromatogram; -import fr.proline.mzscope.model.IRawFile; -import fr.proline.mzscope.model.MsnExtractionRequest; - -public interface IAnnotator { - - AnnotatedChromatogram annotate(IRawFile rawFile, IChromatogram chromatogram, MsnExtractionRequest request, Integer expectedCharge); -} +package fr.proline.mzscope.processing; + +import fr.proline.mzscope.model.AnnotatedChromatogram; +import fr.proline.mzscope.model.IChromatogram; +import fr.proline.mzscope.model.IRawFile; +import fr.proline.mzscope.model.MsnExtractionRequest; + +public interface IAnnotator { + + AnnotatedChromatogram annotate(IRawFile rawFile, IChromatogram chromatogram, MsnExtractionRequest request, Integer expectedCharge); +} diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/IsotopicPatternUtils.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/IsotopicPatternUtils.java index 216114cc9..a7dfc42c9 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/IsotopicPatternUtils.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/IsotopicPatternUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -18,7 +18,8 @@ import fr.profi.ms.algo.IsotopePatternEstimator; import fr.profi.ms.model.TheoreticalIsotopePattern; -import fr.profi.mzdb.algo.IsotopicPatternScorer; +import fr.profi.mzdb.algo.DotProductPatternScorer; +import fr.profi.mzdb.algo.LegacyIsotopicPatternScorer; import fr.profi.mzdb.model.SpectrumData; import java.util.ArrayList; import java.util.Arrays; @@ -42,6 +43,8 @@ public class IsotopicPatternUtils { private static final Logger logger = LoggerFactory.getLogger(IsotopicPatternUtils.class); + private static final int MAX_CHARGE_STATE = 8; + static class Pattern { public double mz; @@ -55,7 +58,7 @@ public Pattern(double mz, int charge) { @Override public int hashCode() { - int hash = 5; + int hash = MAX_CHARGE_STATE; return hash; } @@ -93,7 +96,7 @@ public static Map> compareIsotopicPatternPredictions(Spec } } Map> map = new HashMap<>(); - Tuple2[] putativePatterns = IsotopicPatternScorer.calcIsotopicPatternHypotheses(spectrum, mz, fittedPpmTol); + Tuple2[] putativePatterns = LegacyIsotopicPatternScorer.calcIsotopicPatternHypotheses(spectrum, mz, fittedPpmTol); for (Tuple2 t : putativePatterns) { Pattern p = new Pattern(t._2.monoMz(), t._2.charge()); if (!map.containsKey(p)) map.put(p, new ArrayList<>()); @@ -101,7 +104,7 @@ public static Map> compareIsotopicPatternPredictions(Spec } //tracePredictions("Proline", mz, ppmTol, putativePatterns); - putativePatterns = calcIsotopicPatternHypotheses(spectrum, mz, fittedPpmTol, new ChiSquareScorer()); + putativePatterns = _calcIsotopicPatternHypotheses(spectrum, mz, fittedPpmTol, new ChiSquareScorer()); for (Tuple2 t : putativePatterns) { Pattern p = new Pattern(t._2.monoMz(), t._2.charge()); if (!map.containsKey(p)) { @@ -111,7 +114,7 @@ public static Map> compareIsotopicPatternPredictions(Spec map.get(p).add((Double)t._1); } - putativePatterns = calcIsotopicPatternHypotheses(spectrum, mz, fittedPpmTol, new DotProductScorer()); + putativePatterns = _calcIsotopicPatternHypotheses(spectrum, mz, fittedPpmTol, new DotProductScorer()); for (Tuple2 t : putativePatterns) { Pattern p = new Pattern(t._2.monoMz(), t._2.charge()); if (!map.containsKey(p)) { @@ -124,34 +127,39 @@ public static Map> compareIsotopicPatternPredictions(Spec return map; } - public static TheoreticalIsotopePattern predictIsotopicPattern(SpectrumData spectrum, double mz, double ppmTol) { - long start = System.currentTimeMillis(); + public static Tuple2 predictIsotopicPattern(SpectrumData spectrum, double mz, double ppmTol) { +// long start = System.currentTimeMillis(); double fittedPpmTol = ppmTol; - int nearestPeakIdx = SpectrumUtils.getNearestPeakIndex(spectrum.getMzList(), mz); - if (SpectrumUtils.isInRange(spectrum.getMzList()[nearestPeakIdx], mz, ppmTol)) { - if (spectrum.getLeftHwhmList()[nearestPeakIdx] > 0.0f) { - fittedPpmTol = (float) (1e6 * spectrum.getLeftHwhmList()[nearestPeakIdx] / spectrum.getMzList()[nearestPeakIdx]); - } - } +// int nearestPeakIdx = SpectrumUtils.getNearestPeakIndex(spectrum.getMzList(), mz); +// if (SpectrumUtils.isInRange(spectrum.getMzList()[nearestPeakIdx], mz, ppmTol) && (spectrum.getLeftHwhmList() != null)) { +// if (spectrum.getLeftHwhmList()[nearestPeakIdx] > 0.0f) { +// fittedPpmTol = (float) (1e6 * spectrum.getLeftHwhmList()[nearestPeakIdx] / spectrum.getMzList()[nearestPeakIdx]); +// } +// } - if (fittedPpmTol > ppmTol) { - logger.debug("tol set to {} instead of {}", fittedPpmTol, ppmTol); - } - //Tuple2[] putativePatterns = IsotopicPatternScorer.calcIsotopicPatternHypotheses(spectrum, mz, fittedPpmTol); - Tuple2[] putativePatterns = calcIsotopicPatternHypotheses(spectrum, mz, fittedPpmTol, new DotProductScorer()); + Tuple2[] putativePatterns = DotProductPatternScorer.calcIsotopicPatternHypotheses(spectrum, mz, fittedPpmTol); + Tuple2 bestPatternHypothese = DotProductPatternScorer.selectBestPatternHypothese(putativePatterns, 0.1); + +// if (bestPatternHypothese != putativePatterns[0]) { +// logger.info("isotopic pattern hypothesis have been re-ranked"); +// } + + //Tuple2[] putativePatterns = _calcIsotopicPatternHypotheses(spectrum, mz, fittedPpmTol, new WeightedDotProductScorer()); // AAAARRRRRRGGGG : CBy rule : if two DotProduct predictions are close, prefer higher charge state or lower mono MZ - selectBestHypothesis(putativePatterns, 0.2); - TheoreticalIsotopePattern pattern = (TheoreticalIsotopePattern) putativePatterns[0]._2; - logger.info("Prediction took {} ms", (System.currentTimeMillis() - start)); - return pattern; + //selectBestHypothesis(putativePatterns, 0.1); + //return putativePatterns[0]; + +// Tuple2[] putativePatterns = calcIsotopicPatternHypotheses(spectrum, mz, fittedPpmTol, new ProlineLikeScorer()); +// logger.info("Prediction took {} ms", (System.currentTimeMillis() - start)); + + return bestPatternHypothese; } - private static void selectBestHypothesis(Tuple2[] putativePatterns, double threshold) { + private static void selectBestHypothesis(Tuple2[] putativePatterns, double deltaScore) { double refScore = (Double)putativePatterns[0]._1; - List> list = Arrays.stream(putativePatterns).filter(t -> (Double)t._1 <= Math.max(threshold, refScore) ).collect(Collectors.toList()); - -// List> list = Arrays.stream(putativePatterns).filter(t -> (Double)t._1 < 0.1).collect(Collectors.toList()); + + List> list = Arrays.stream(putativePatterns).filter(t -> Math.abs((Double)t._1 - refScore) <= deltaScore ).collect(Collectors.toList()); if (list.isEmpty()) return; @@ -178,32 +186,6 @@ private static void selectBestHypothesis(Tuple2[] putativePatterns) { -// double refScore = (Double)putativePatterns[0]._1; -// List> list = Arrays.stream(putativePatterns).filter(t -> Math.abs(refScore - (Double)t._1) < 0.05).collect(Collectors.toList()); -// int maxCharge = list.stream().max(Comparator.comparing(t -> t._2.charge())).get()._2.charge(); -// Optional> betterPattern = list.stream().filter(t -> t._2.charge() == maxCharge).collect(Collectors.minBy(Comparator.comparing(t->t._2.monoMz()))); -// -// if (betterPattern.isPresent()) { -// // a simpler solution is to return a List from the prediction then insert bestPattern at the head of the list and -// // remove if from it's previous position. -// Tuple2 bestPattern = betterPattern.get(); -// if (bestPattern != putativePatterns[0]) { -// Tuple2 tmp = putativePatterns[0]; -// // search for bestPattern index k -// int k = 1; -// for (; k < putativePatterns.length; k++) { -// Tuple2 p = putativePatterns[k]; -// if (p == bestPattern) break; -// } -//// logger.debug("A better prediction is available at position {}, swap them", k); -// putativePatterns[0] = putativePatterns[k]; -// putativePatterns[k] = tmp; -// } -// } -// -// } private static void tracePredictions(String title, double mz, double ppmTol, Map> putativePatterns) { logger.info(" ######### "+title); @@ -227,47 +209,31 @@ private static void tracePredictions(String title, double mz, double ppmTol, Tup } - public static Tuple2[] calcIsotopicPatternHypotheses(SpectrumData currentSpectrum, double mz, double ppmTol) { - Tuple2[] patterns = calcIsotopicPatternHypotheses(currentSpectrum, mz, ppmTol, new DotProductScorer()); - selectBestHypothesis(patterns, 0.2); -// Tuple2[] patterns = IsotopicPatternScorer.calcIsotopicPatternHypotheses(currentSpectrum, mz, ppmTol); - return patterns; - } - - public static Tuple2[] calcIsotopicPatternHypotheses(SpectrumData currentSpectrum, double mz, double ppmTol, Scorer scorer) { - -// logger.debug("calculate IP hypotheses using scorer "+scorer.getClass().getSimpleName()); - + private static Tuple2[] _calcIsotopicPatternHypotheses(SpectrumData currentSpectrum, double mz, double ppmTol, Scorer scorer) { + List> result = new ArrayList<>(); - for (int charge = 1; charge <= 5; charge++) { + for (int charge = 1; charge <= MAX_CHARGE_STATE; charge++) { Tuple2 p = scorer.score(currentSpectrum, mz, 0, charge, ppmTol); int j = 1; - double backwardMz = mz - j/charge; + double backwardMz = mz - j*IsotopePatternEstimator.avgIsoMassDiff()/charge; int nearestPeakIdx = SpectrumUtils.getNearestPeakIndex(currentSpectrum.getMzList(), backwardMz); boolean existBackward = ((1e6 * Math.abs(currentSpectrum.getMzList()[nearestPeakIdx] - backwardMz) / backwardMz) < ppmTol); - //for (int j = 1; j <= p._2.theoreticalMaxPeakelIndex()+2; j++) { - // limit j < 8 because we predict up to 8 isotopes - while (existBackward && j < 8) { + while (existBackward && j <= p._2.theoreticalMaxPeakelIndex()+1) { Tuple2 alternativeP = scorer.score(currentSpectrum, mz, j, charge, ppmTol); result.add(alternativeP); j++; - backwardMz = mz - j/charge; + backwardMz = mz - j*IsotopePatternEstimator.avgIsoMassDiff()/charge; nearestPeakIdx = SpectrumUtils.getNearestPeakIndex(currentSpectrum.getMzList(), backwardMz); existBackward = ((1e6 * Math.abs(currentSpectrum.getMzList()[nearestPeakIdx] - backwardMz) / backwardMz) < ppmTol); } - //logger.info("mz ({}+) loop hypothese stop at iteration {}", charge, j); result.add(p); } if (!result.isEmpty()) { - Collections.sort(result, new Comparator>() { - @Override - public int compare(Tuple2 o1, Tuple2 o2) { - int sign = (int)Math.signum(o1._1 - o2._1); - return (sign == 0) ? o2._2.charge() - o1._2.charge() : sign; - } - + Collections.sort(result, (o1, o2) -> { + int sign = (int)Math.signum(o1._1 - o2._1); + return (sign == 0) ? o2._2.charge() - o1._2.charge() : sign; }); } Tuple2[] patterns = result.toArray(new Tuple2[result.size()]); diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/PeakelAnnotator.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/PeakelAnnotator.java index 67526eae7..eb2e5c00a 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/PeakelAnnotator.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/PeakelAnnotator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/PeakelsHelper.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/PeakelsHelper.java index 2e5af6249..d94b5301e 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/PeakelsHelper.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/PeakelsHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -21,22 +21,24 @@ import com.github.davidmoten.rtree.RTree; import com.github.davidmoten.rtree.geometry.Geometries; import com.github.davidmoten.rtree.geometry.Point; +import fr.profi.chemistry.model.MolecularConstants; +import fr.profi.ms.algo.IsotopePatternEstimator; import fr.profi.ms.model.TheoreticalIsotopePattern; import fr.profi.mzdb.MzDbReader; -import fr.profi.mzdb.algo.IsotopicPatternScorer; +import fr.profi.mzdb.algo.PeakelsPatternPredictor; import fr.profi.mzdb.model.Feature; import fr.profi.mzdb.model.Peakel; -import fr.profi.mzdb.model.PeakelCursor; import fr.profi.mzdb.model.SpectrumData; import static fr.proline.mzscope.processing.SpectrumUtils.MIN_CORRELATION_SCORE; import java.io.StreamCorruptedException; import java.util.*; +import fr.profi.mzdb.util.ms.MsUtils; import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; -import org.apache.commons.math3.stat.descriptive.MultivariateSummaryStatistics; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import scala.Tuple2; +import scala.Tuple4; import scala.collection.JavaConverters; /** @@ -45,8 +47,11 @@ */ public class PeakelsHelper { + public static final String VALID_FEATURES = "valid features"; + public static final String DUBIOUS_FEATURES = "dubious features"; + private static final Logger logger = LoggerFactory.getLogger(PeakelsHelper.class); - private static int HALF_MZ_WINDOW = 5; + public static int HALF_MZ_WINDOW = 5; private static float RT_TOLERANCE = 40.0f; private static float INTENSITY_PERCENTILE = 0.99f; @@ -62,12 +67,12 @@ public PeakelsHelper(List peakels) { this.peakels = peakels; this.rTree = RTree.create(); for (Peakel p : peakels) { - rTree = rTree.add(p, Geometries.point(p.getMz(), p.getApexElutionTime())); + rTree = rTree.add(p, Geometries.point(p.getMz(), p.getElutionTime())); } logger.info("built RTree contains {} peakels", rTree.size()); } - public List findCoelutigPeakels(double minMz, double maxMz, float minRt, float maxRt) { + public List findCoelutingPeakels(double minMz, double maxMz, float minRt, float maxRt) { List coelutingPeakels = new ArrayList<>(1000); Iterator> peakelIterator = rTree.search(Geometries.rectangle(minMz, minRt, maxMz, maxRt)).toBlocking().toIterable().iterator(); while (peakelIterator.hasNext()) { @@ -76,7 +81,7 @@ public List findCoelutigPeakels(double minMz, double maxMz, float minRt, return coelutingPeakels; } - public List findCoelutigPeakels(double minMz, double maxMz, float minRt, float maxRt, Map assigned) { + public List findCoelutingPeakels(double minMz, double maxMz, float minRt, float maxRt, Map assigned) { List coelutingPeakels = new ArrayList<>(1000); Iterator> peakelIterator = rTree.search(Geometries.rectangle(minMz, minRt, maxMz, maxRt)).toBlocking().toIterable().iterator(); while (peakelIterator.hasNext()) { @@ -87,7 +92,7 @@ public List findCoelutigPeakels(double minMz, double maxMz, float minRt, return coelutingPeakels; } - public List deisotopePeakels(MzDbReader reader, float mzTolPPM) throws StreamCorruptedException, SQLiteException { + public Map> deisotopePeakels(float mzTolPPM, float rtTolerance) throws StreamCorruptedException, SQLiteException { long start = System.currentTimeMillis(); @@ -95,56 +100,51 @@ public List deisotopePeakels(MzDbReader reader, float mzTolPPM) throws List features = new ArrayList<>(); List monoPeakelFeatures = new ArrayList<>(); - Map assigned = new HashMap<>(); - peakels.sort(new Comparator() { - @Override - public int compare(Peakel o1, Peakel o2) { - return Double.compare(o2.getApexIntensity(), o1.getApexIntensity()); - } - }); - - // for debug purposes - double REFMZ = 724.71024; - double REFRT = 133.866; - - float intensityThreshold = peakels.get(Math.min(peakels.size()-1, (int)(peakels.size()*INTENSITY_PERCENTILE))).getApexIntensity(); + peakels.sort((o1, o2) -> Double.compare(o2.getApexIntensity(), o1.getApexIntensity())); for (int k = 0; k < peakels.size(); k++) { if ((k % 10000) == 0) { logger.info("processing peakel " + k); } - if (!assigned.containsKey(peakels.get(k).getId())) { + final Peakel peakel = peakels.get(k); + + if (!assigned.containsKey(peakel.getId())) { - SpectrumData data = buildSpectrumDataFromPeakels(k, assigned); - -// Tuple2[] putativePatterns = IsotopicPatternScorer.calcIsotopicPatternHypotheses(data, peakels.get(k).getMz(), mzTolPPM); - Tuple2[] putativePatterns = IsotopicPatternUtils.calcIsotopicPatternHypotheses(data, peakels.get(k).getMz(), mzTolPPM); - TheoreticalIsotopePattern bestPattern = putativePatterns[0]._2; - List l = new ArrayList<>(bestPattern.isotopeCount() + 1); + SpectrumData data = buildSpectrumFromPeakels(k, assigned, rtTolerance); + TheoreticalIsotopePattern pattern = IsotopicPatternUtils.predictIsotopicPattern(data, peakel.getMz(), mzTolPPM)._2; + List l = new ArrayList<>(pattern.isotopeCount() + 1); int gapRank = 0; int indexOfMatching = 0; - for (Tuple2 t : bestPattern.mzAbundancePairs()) { - if (1e6 * (Math.abs(peakels.get(k).getMz() - (double) t._1) / peakels.get(k).getMz()) < mzTolPPM) { + for (Tuple2 t : pattern.mzAbundancePairs()) { + if (1e6 * (Math.abs(peakel.getMz() - (double) t._1) / peakel.getMz()) < mzTolPPM) { break; } indexOfMatching++; } - double scaling = peakels.get(k).getApexIntensity() / ((Float)bestPattern.mzAbundancePairs()[indexOfMatching]._2); - - for (Tuple2 t : bestPattern.mzAbundancePairs()) { + if ((Math.abs(peakel.getMz() - 762.70542) < 1e-4) && (Math.abs(peakel.getApexElutionTime() - 127.33*60.0) < 10)) { + logger.info("this one"); + } + double scaling = peakel.getApexIntensity() / ((Float)pattern.mzAbundancePairs()[indexOfMatching]._2); + int rank = 0; + + for (Tuple2 t : pattern.mzAbundancePairs()) { double patternMz = (double) t._1; float patternNormAbundance = (float)t._2; - List isotopes = findCoelutigPeakels(patternMz - (patternMz * mzTolPPM / 1e6), patternMz + (patternMz * mzTolPPM / 1e6), peakels.get(k).getFirstElutionTime(), peakels.get(k).getLastElutionTime(), assigned); + float minRt = peakel.getFirstElutionTime(); + float maxRt = peakel.getLastElutionTime(); + + //List isotopes = findCoelutingPeakels(patternMz - (patternMz * mzTolPPM / 1e6), patternMz + (patternMz * mzTolPPM / 1e6), minRt, maxRt, assigned); + List isotopes = findCoelutingPeakels(patternMz - (patternMz * mzTolPPM / 1e6), patternMz + (patternMz * mzTolPPM / 1e6), minRt, maxRt); Peakel bestMatching = null; double maxCorr = Double.MIN_VALUE; for (Peakel p : isotopes) { - double corr = SpectrumUtils.correlation(peakels.get(k), p); + double corr = SpectrumUtils.correlation(peakel, p); if (corr > MIN_CORRELATION_SCORE && (corr > maxCorr) && - (p.getApexIntensity() < 2.5 * patternNormAbundance * scaling)) { + (p.getApexIntensity() < 4 * patternNormAbundance * scaling)) { maxCorr = corr; bestMatching = p; } @@ -156,19 +156,20 @@ public int compare(Peakel o1, Peakel o2) { assigned.put(bestMatching.getId(), bestMatching); l.add(bestMatching); } else { - logger.trace("best isotope match found but already assigned"); + //logger.info("best isotope at {} match found but is already assigned (predicted from isotope {})", rank, indexOfMatching); } } else { gapRank++; } if (gapRank >= 3) break; + rank++; } if (l.isEmpty()) { - logger.trace("Strange situation: peakel {}, {} not found from pattern at mono {}, {}+ (gap: {})", peakels.get(k).getMz(), peakels.get(k).getApexElutionTime()/60.0, bestPattern.monoMz(), bestPattern.charge(), gapRank); - l.add(peakels.get(k)); + logger.info("Strange situation: peakel {}, {} not found from pattern at mono {}, {}+ (indexOfMatching: {})", peakel.getMz(), peakel.getElutionTime()/60.0, pattern.monoMz(), pattern.charge(), indexOfMatching); + l.add(peakel); } - Feature feature = new Feature(l.get(0).getMz(), bestPattern.charge(), JavaConverters.asScalaBufferConverter(l).asScala(), true); + Feature feature = new Feature(l.get(0).getMz(), pattern.charge(), JavaConverters.asScalaBufferConverter(l).asScala(), true); if (l.size() > 1) { features.add(feature); stats[0].addValue(feature.getBasePeakel().getApexIntensity()); @@ -185,17 +186,32 @@ public int compare(Peakel o1, Peakel o2) { double minMs1Count = stats[2].getPercentile(10); logger.info("Filter dubious features: Thresholds are minIntensity={}, maxDuration={}, minMs1Count{}", minIntensity, maxDuration, minMs1Count); + + Map> map = new HashMap<>(); + map.put(VALID_FEATURES, features); + map.put(DUBIOUS_FEATURES, new ArrayList<>()); + for(Feature f: monoPeakelFeatures) { - if ((f.getBasePeakel().getApexIntensity() >= minIntensity) && (f.calcDuration() <= maxDuration) && (f.getMs1Count() >= minMs1Count)) { - features.add(f); + + +// Option 1 + if (f.getCharge() > 1) { + map.get(VALID_FEATURES).add(f); } else { -// logger.info("Doubtful Feature = {}; {}; {}; {}; {} ",f.getMz(), f.getElutionTime() / 60.0, f.getCharge(), f.getBasePeakel().getApexIntensity(), f.getMs1Count()); - features.add(f); + map.get(DUBIOUS_FEATURES).add(f); } + +// Option 2 +// if ((f.getBasePeakel().getApexIntensity() >= minIntensity) && (f.calcDuration() <= maxDuration) && (f.getMs1Count() >= minMs1Count)) { +// map.get(VALID_FEATURES).add(f); +// } else { +// //logger.info("Doubtful Feature = {}; {}; {}; {}; {} ",f.getMz(), f.getElutionTime() / 60.0, f.getCharge(), f.getBasePeakel().getApexIntensity(), f.getMs1Count()); +// map.get(DUBIOUS_FEATURES).add(f); +// } } - logger.info("Features detected : {} in {} ms", features.size(), (System.currentTimeMillis() - start)); - return features; + logger.info("Features detected : {} in {} ms", map.get(VALID_FEATURES).size(), (System.currentTimeMillis() - start)); + return map; } public List deisotopePeakelsFromMzdb(MzDbReader reader, float mzTolPPM) throws StreamCorruptedException, SQLiteException { @@ -220,15 +236,12 @@ public int compare(Peakel o1, Peakel o2) { if (!assigned.containsKey(peakels.get(k).getId())) { SpectrumData data = reader.getSpectrumData(peakels.get(k).getApexSpectrumId()); - -// Tuple2[] putativePatterns = IsotopicPatternScorer.calcIsotopicPatternHypotheses(data, peakels.get(k).getMz(), mzTolPPM); - Tuple2[] putativePatterns = IsotopicPatternUtils.calcIsotopicPatternHypotheses(data, peakels.get(k).getMz(), mzTolPPM); - TheoreticalIsotopePattern bestPattern = putativePatterns[0]._2; + TheoreticalIsotopePattern bestPattern = IsotopicPatternUtils.predictIsotopicPattern(data, peakels.get(k).getMz(), mzTolPPM)._2; List l = new ArrayList<>(bestPattern.isotopeCount() + 1); for (Tuple2 t : bestPattern.mzAbundancePairs()) { double mz = (double) t._1; - List isotopes = findCoelutigPeakels(mz - (mz * mzTolPPM / 1e6), mz + (mz * mzTolPPM / 1e6), peakels.get(k).getFirstElutionTime(), peakels.get(k).getLastElutionTime()); + List isotopes = findCoelutingPeakels(mz - (mz * mzTolPPM / 1e6), mz + (mz * mzTolPPM / 1e6), peakels.get(k).getFirstElutionTime(), peakels.get(k).getLastElutionTime()); Peakel bestMatching = null; double maxCorr = Double.MIN_VALUE; for (Peakel p : isotopes) { @@ -319,33 +332,38 @@ public int compare(Peakel o1, Peakel o2) { // return result; // } - private SpectrumData buildSpectrumDataFromPeakels(int k, Map assigned) { -// List coelutingPeakels = findCoelutigPeakels(peakels.get(k).getApexMz() - HALF_MZ_WINDOW, -// peakels.get(k).getApexMz() + HALF_MZ_WINDOW, -// peakels.get(k).getApexElutionTime() - RT_TOLERANCE, -// peakels.get(k).getApexElutionTime() + RT_TOLERANCE); + private SpectrumData buildSpectrumFromPeakels(int k, Map assigned, float rtTolerance) { final Peakel peakel = peakels.get(k); - List coelutingPeakels = findCoelutigPeakels(peakel.getApexMz() - HALF_MZ_WINDOW, + + List coelutingPeakels = findCoelutingPeakels(peakel.getApexMz() - HALF_MZ_WINDOW, peakel.getApexMz() + HALF_MZ_WINDOW, - peakel.getFirstElutionTime(), - peakel.getLastElutionTime(), - assigned); + peakel.getElutionTime() - rtTolerance, + peakel.getElutionTime() + rtTolerance); - return buildSpectrumDataFromPeakels(peakel, coelutingPeakels); + return buildSpectrumFromPeakels(coelutingPeakels, peakel); } - public SpectrumData buildSpectrumDataFromPeakels(Peakel peakel, List coelutingPeakels) { - Tuple2 values = slicePeakels(coelutingPeakels, peakel); - SpectrumData data = new SpectrumData(values._1, values._2); + public SpectrumData buildSpectrumFromPeakels(List coelutingPeakels, Peakel peakel) { + + // Proline core implementation + + SpectrumData data = PeakelsPatternPredictor.buildSpectrumFromPeakels(JavaConverters.asScalaBufferConverter(coelutingPeakels).asScala(), peakel); + + // local alternative implementation + +// Tuple4 values = slicePeakels(coelutingPeakels, peakel.getApexSpectrumId()); +// SpectrumData data = new SpectrumData(values._1(), values._2(), values._3(), values._4()); + return data; } - private Tuple2 slicePeakels(List coelutingPeakels, Peakel matchingPeakel) { + private Tuple4 slicePeakels(List coelutingPeakels, Long matchingSpectrumId) { - Long matchingSpectrumId = matchingPeakel.getApexSpectrumId(); final List mzList = new ArrayList<>(coelutingPeakels.size()); final List intensityList = new ArrayList<>(coelutingPeakels.size()); + final List lfwhmList = new ArrayList<>(coelutingPeakels.size()); + final List rfwhmList = new ArrayList<>(coelutingPeakels.size()); coelutingPeakels.sort(new Comparator() { @Override @@ -354,62 +372,99 @@ public int compare(Peakel o1, Peakel o2) { } }); -// coelutingPeakels.stream().forEach(peakel -> { -// + final int SPAN = 1; + coelutingPeakels.stream().forEach(peakel -> { + + + int index = Arrays.binarySearch(peakel.getSpectrumIds(), matchingSpectrumId); + Boolean foundPeak = (index >= 0) && (index < peakel.peaksCount()); + if (!foundPeak) { + index = ~index; + foundPeak = (index > 0 && index < peakel.peaksCount()); + } + + float sum = 0; + int count = 0; // PeakelCursor peakelCursor = peakel.getNewCursor(); // boolean foundPeak = false; -// -// // TODO: optimize this search (start from the apex or implement binary search) -// while (peakelCursor.next() && foundPeak == false) { +// while (peakelCursor.next() && foundPeak == false) { // if (peakelCursor.getSpectrumId() == matchingSpectrumId) { // mzList.add(peakelCursor.getMz()); -// intensityList.add(peakelCursor.getIntensity()); // foundPeak = true; // } // } -// } -// ); -// - - final int SPAN = 3; - coelutingPeakels.stream().forEach(peakel -> { - - PeakelCursor peakelCursor = peakel.getNewCursor(); - boolean foundPeak = false; - float sum = 0; - int count = 0; - while (peakelCursor.next() && foundPeak == false) { - if (peakelCursor.getSpectrumId() == matchingSpectrumId) { - mzList.add(peakelCursor.getMz()); - foundPeak = true; - } - } if (foundPeak) { - int index = peakelCursor.cursorIndex(); +// int index = peakelCursor.cursorIndex(); + int minBound = Math.max(0, index - SPAN); int maxBound = Math.min(index + SPAN, peakel.getPeaksCount() - 1); for (int i = minBound; i <= maxBound; i++) { sum += peakel.intensityValues()[i]; count++; } + mzList.add(peakel.mzValues()[index]); intensityList.add(sum / count); + lfwhmList.add(peakel.getLeftHwhmMean()); + rfwhmList.add(peakel.getRightHwhmMean()); } }); - - int idx = 0; double[] mz = new double[mzList.size()]; - for (Double d : mzList) { - mz[idx++] = d; - } - idx = 0; float[] intensities = new float[intensityList.size()]; - for (Float f : intensityList) { - intensities[idx++] = f; + float[] lfwhm = new float[lfwhmList.size()]; + float[] rfwhm = new float[rfwhmList.size()]; + for (int idx = 0; idx < mzList.size(); idx++) { + mz[idx] = mzList.get(idx); + intensities[idx] = intensityList.get(idx); + lfwhm[idx] = lfwhmList.get(idx); + rfwhm[idx] = rfwhmList.get(idx); } + + return new Tuple4(mz, intensities, lfwhm, rfwhm); + } + + + public List findFeatureIsotopes(Peakel peakel, int charge, double mzTolPPM) { + + double peakelMz = peakel.getMz(); + + TheoreticalIsotopePattern pattern = IsotopePatternEstimator.getTheoreticalPattern(peakelMz, charge); + float intensityScalingFactor = (peakel.getApexIntensity()/(Float)pattern.mzAbundancePairs()[0]._2); + int gapRank = 0; + + List isotopes = new ArrayList(pattern.isotopeCount()); + + for (Tuple2 t : pattern.mzAbundancePairs()) { + double patternMz = (double) t._1; + float patternNormAbundance = (float)t._2; + float minRt = peakel.getFirstElutionTime(); + float maxRt = peakel.getLastElutionTime(); - return new Tuple2(mz, intensities); + List putativeIsotopes = findCoelutingPeakels(patternMz - (patternMz * mzTolPPM / 1e6), patternMz + (patternMz * mzTolPPM / 1e6), minRt, maxRt); + Peakel bestMatching = null; + double maxCorr = Double.MIN_VALUE; + for (Peakel p : putativeIsotopes) { + double corr = SpectrumUtils.correlation(peakel, p); + if (corr > MIN_CORRELATION_SCORE && (corr > maxCorr) && + (p.getApexIntensity() < 4 * patternNormAbundance * intensityScalingFactor)) { + maxCorr = corr; + bestMatching = p; + } + } + + if (bestMatching != null) { + gapRank = 0; + isotopes.add(bestMatching); + } else { + gapRank++; + } + if (gapRank >= 3) + break; + } + + return isotopes; } + } diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/Scorer.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/Scorer.java index aba158d61..378a21531 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/Scorer.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/Scorer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,16 +14,16 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.mzscope.processing; - -import fr.profi.ms.model.TheoreticalIsotopePattern; -import fr.profi.mzdb.model.SpectrumData; -import scala.Tuple2; - -/** - * - * @author CB205360 - */ -public interface Scorer { - public Tuple2 score(SpectrumData currentSpectrum, double intialMz, int shift, int charge, double ppmTol); +package fr.proline.mzscope.processing; + +import fr.profi.ms.model.TheoreticalIsotopePattern; +import fr.profi.mzdb.model.SpectrumData; +import scala.Tuple2; + +/** + * + * @author CB205360 + */ +public interface Scorer { + public Tuple2 score(SpectrumData currentSpectrum, double intialMz, int shift, int charge, double ppmTol); } \ No newline at end of file diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/SpectrumUtils.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/SpectrumUtils.java index ef4f731a2..bcfd1b27f 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/SpectrumUtils.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/SpectrumUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,8 @@ */ package fr.proline.mzscope.processing; +import fr.profi.mzdb.algo.signal.filtering.SavitzkyGolaySmoother; +import fr.profi.mzdb.algo.signal.filtering.SavitzkyGolaySmoothingConfig; import fr.profi.mzdb.model.Peakel; import fr.profi.mzdb.model.SpectrumHeader; import java.util.Arrays; @@ -23,11 +25,15 @@ import java.util.Comparator; import java.util.List; import java.util.stream.IntStream; + +import fr.profi.mzdb.peakeldb.PeakelDbHelper; +import fr.proline.mzscope.model.Signal; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.math3.stat.correlation.PearsonsCorrelation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import scala.Tuple2; /** * @@ -119,7 +125,7 @@ public int compare(Pair o1, Pair o2) { for (int i = lowerIdx; i <= upperIdx; i++) { int k = peakelIndexesByMz[i].getRight(); if ((1e6 * Math.abs(peakels[k].getMz() - moz) / moz < mzTolPPM) - && ((Math.abs(peakels[k].getApexElutionTime() - referencePeakel.getApexElutionTime()) / referencePeakel.calcDuration()) < 0.25) + && ((Math.abs(peakels[k].getElutionTime() - referencePeakel.getElutionTime()) / referencePeakel.calcDuration()) < 0.25) && (Math.abs(peakels[k].getMz() - moz) < min)) { min = Math.abs(peakels[k].getMz() - moz); resultIdx = k; @@ -146,8 +152,8 @@ public int compare(Pair o1, Pair o2) { for (int i = lowerIdx; i <= upperIdx; i++) { int k = peakelIndexesByMz[i].getRight(); if ((1e6 * Math.abs(peakels[k].getMz() - moz) / moz < mzTolPPM) - && (peakels[k].getApexElutionTime() >= referencePeakel.getFirstElutionTime()) - && (peakels[k].getApexElutionTime() <= referencePeakel.getLastElutionTime())) { + && (peakels[k].getElutionTime() >= referencePeakel.getFirstElutionTime()) + && (peakels[k].getElutionTime() <= referencePeakel.getLastElutionTime())) { double corr = correlation(referencePeakel, peakels[k]); //logger.debug("correlation "+referencePeakel.getMz()+ " with "+peakels[k].getMz()+" = "+corr); if (corr > MIN_CORRELATION_SCORE && (corr > maxCorr)) { @@ -164,7 +170,30 @@ public int compare(Pair o1, Pair o2) { * Returns the absolute value of the correlation between 2 peakels */ public static double correlation(Peakel p1, Peakel p2) { - return correlation(p1.getElutionTimes(), p1.getIntensityValues(), p2.getElutionTimes(), p2.getIntensityValues()); + + // not the most efficient solution to get smoothed intensities ... + int nbrPoints = Math.min(p1.peaksCount() / 4, 9); + SavitzkyGolaySmoother smoother = new SavitzkyGolaySmoother(new SavitzkyGolaySmoothingConfig(nbrPoints, 2, 1)); + Peakel sp1 = (nbrPoints > 0) ? smoother.smoothPeakel(p1) : p1; + nbrPoints = Math.min(p2.peaksCount() / 4, 9); + smoother = new SavitzkyGolaySmoother(new SavitzkyGolaySmoothingConfig(nbrPoints, 2, 1)); + Peakel sp2 = (nbrPoints > 0) ? smoother.smoothPeakel(p2) : p2; + + return correlation(sp1.getElutionTimes(), sp1.getIntensityValues(), sp2.getElutionTimes(), sp2.getIntensityValues()); + } + + public static double correlationOMP(Peakel p1, Peakel p2, boolean smooth) { + if (smooth) { + int nbrPoints = Math.min(p1.peaksCount() / 4, 9); + SavitzkyGolaySmoother smoother = new SavitzkyGolaySmoother(new SavitzkyGolaySmoothingConfig(nbrPoints, 2, 1)); + Peakel sp1 = smoother.smoothPeakel(p1); + nbrPoints = Math.min(p2.peaksCount() / 4, 9); + smoother = new SavitzkyGolaySmoother(new SavitzkyGolaySmoothingConfig(nbrPoints, 2, 1)); + Peakel sp2 = smoother.smoothPeakel(p2); + return PeakelDbHelper.computeCorrelation(sp1, sp2); + } else { + return PeakelDbHelper.computeCorrelation(p1, p2); + } } public static double correlation(float[] x1, float[] y1, float[] x2, float[] y2) { @@ -180,7 +209,7 @@ public static double correlation(double[] x1, double[] y1, double[] x2, double[] double corr = pearson.correlation(values.getLeft(), values.getRight()); return corr; } - + public static Pair zipValues(double[] x1, double[] y1, double[] x2, double[] y2) { int offset1 = 0; int offset2 = 0; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/WeightedDotProductScorer.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/WeightedDotProductScorer.java index 055ae817e..231722ea1 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/WeightedDotProductScorer.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/processing/WeightedDotProductScorer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -33,43 +33,59 @@ public class WeightedDotProductScorer implements Scorer { private static final int MAX_SCORED_ISOTOPES = 8; - public Tuple2 score(SpectrumData currentSpectrum, double intialMz, int shift, int charge, double ppmTol) { + public Tuple2 score(SpectrumData currentSpectrum, double intialMz, int shift, int charge, double initialPpmTol) { double score = 0.0; + double ppmTol = initialPpmTol; double mz = intialMz - shift * IsotopePatternEstimator.avgIsoMassDiff() / charge; TheoreticalIsotopePattern pattern = IsotopePatternEstimator.getTheoreticalPattern(mz, charge); + + double scale = currentSpectrum.getIntensityList()[SpectrumUtils.getNearestPeakIndex(currentSpectrum.getMzList(), intialMz)] / (Float)pattern.mzAbundancePairs()[shift]._2; + Double ipMoz = mz; double[] observed = new double[pattern.mzAbundancePairs().length]; double[] expected = new double[pattern.mzAbundancePairs().length]; - int observations = 0; - //logger.info("mz {} charge pattern {}+, nb isotopes = {}", mz, charge, pattern.mzAbundancePairs().length); for (int rank = 0; rank < pattern.mzAbundancePairs().length; rank++) { ipMoz = (rank == 0) ? ipMoz : ipMoz + IsotopePatternEstimator.avgIsoMassDiff() / charge; int nearestPeakIdx = SpectrumUtils.getNearestPeakIndex(currentSpectrum.getMzList(), ipMoz); if (((1e6 * Math.abs(currentSpectrum.getMzList()[nearestPeakIdx] - ipMoz) / ipMoz) < ppmTol)) { observed[rank] = currentSpectrum.getIntensityList()[nearestPeakIdx]; - observations++; + // Try: reassign ipMoz with the observed value ! + //ipMoz = currentSpectrum.getMzList()[nearestPeakIdx]; } else { - observed[rank] = 0.0; + observed[rank] = -(Float)pattern.mzAbundancePairs()[rank]._2 * scale; } + // Try: increase ppmTol for higher isotope rank + //double ppmIncr = Math.max(1, ppmTol/MAX_SCORED_ISOTOPES); + //ppmTol = Math.min( 2*initialPpmTol , ppmTol + ppmIncr); expected[rank] = (Float) pattern.mzAbundancePairs()[rank]._2; } score = dotProduct(observed, expected); - score = (1.0 - score)/observations; + score = (1.0 - score); //score = 1.0 - score; return new Tuple2(score, pattern); } public static double dotProduct(double[] observed, double[] expected) { + + double sumObserved = 0.0; double sumExpected = 0.0; double dotProduct = 0.0; + double sumWeight = 0.0; + double[] weight = {0.25, 0.25, 0.25, 0.08, 0.06, 0.05, 0.04, 0.02}; + + for (int k = 0; k < Math.min(observed.length, MAX_SCORED_ISOTOPES); k++) { + sumWeight += weight[k]; + } + for (int k = 0; k < Math.min(observed.length, MAX_SCORED_ISOTOPES); k++) { - dotProduct += observed[k]*expected[k]; - sumExpected += expected[k]*expected[k]; - sumObserved += observed[k]*observed[k]; + weight[k] = weight[k]/sumWeight; + dotProduct += observed[k]*expected[k]*weight[k]; + sumExpected += expected[k]*expected[k]*weight[k]; + sumObserved += observed[k]*observed[k]*weight[k]; } return ((sumExpected == 0) || (sumObserved == 0)) ? 0.0 : dotProduct/(Math.sqrt(sumExpected)*Math.sqrt(sumObserved)); diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/timstof/TimstofRawFile.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/timstof/TimstofRawFile.java index 1b5499d71..4cb014d9c 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/timstof/TimstofRawFile.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/timstof/TimstofRawFile.java @@ -8,7 +8,9 @@ import fr.profi.brucker.timstof.converter.SpectrumGeneratingMethod; import fr.profi.brucker.timstof.io.TimstofReader; import fr.profi.brucker.timstof.model.AbstractTimsFrame; +import fr.profi.brucker.timstof.model.TimsMSFrame; import fr.profi.brucker.timstof.model.TimsPASEFFrame; +import fr.profi.util.StringUtils; import fr.proline.mzscope.model.Chromatogram; import fr.proline.mzscope.model.FeaturesExtractionRequest; import fr.proline.mzscope.model.IChromatogram; @@ -19,6 +21,7 @@ import fr.proline.mzscope.model.MsnExtractionRequest; import fr.proline.mzscope.model.QCMetrics; import fr.proline.mzscope.model.Spectrum; + import java.io.File; import java.util.Collections; import java.util.HashMap; @@ -42,15 +45,34 @@ public class TimstofRawFile implements IRawFile{ private Map m_frame2FirstSpectraIndex; private IChromatogram m_ticChromato; private IChromatogram m_bpcChromato; - + private String m_ms1Format; + + public final static String MS1_SINGLE_SPECTRA = "Single Spectra"; + public final static String MS1_SPECTRA_PER_SCAN = "Spectra Per Scan"; private static final Logger LOG = LoggerFactory.getLogger(TimstofRawFile.class); public TimstofRawFile(File ttFile){ + this(ttFile,MS1_SINGLE_SPECTRA); + } + + public TimstofRawFile(File ttFile, String ms1SpectrumFormat){ long start = System.currentTimeMillis(); if(!ttFile.isDirectory()) throw new IllegalArgumentException("You should specify a brucker .d directory"); - + m_ms1Format = MS1_SINGLE_SPECTRA; + if(ms1SpectrumFormat != null && StringUtils.isNotEmpty(ms1SpectrumFormat)) { + switch(ms1SpectrumFormat){ + case MS1_SINGLE_SPECTRA: + m_ms1Format = MS1_SINGLE_SPECTRA; + break; + case MS1_SPECTRA_PER_SCAN: + m_ms1Format = MS1_SPECTRA_PER_SCAN; + break; + default: + LOG.warn("Invalid MS1 Spectra format specified ! Default is used (Single Spectra)"); + } + } m_ttDirFile = ttFile; init(); @@ -72,8 +94,9 @@ private void init() { m_frame2FirstSpectraIndex = new HashMap<>(); for(AbstractTimsFrame tf : m_ttFrames){ Integer nbrSpectrum = tf.getSpectrumCount(); - - + if(m_ms1Format.equals(MS1_SPECTRA_PER_SCAN) && TimsMSFrame.class.isInstance(tf)) + nbrSpectrum =((TimsMSFrame) tf).getNbrScans(); + m_frame2FirstSpectraIndex.put(tf.getId(),spectrumIndex); for(int i=0;i extractFeatures(FeaturesExtractionRequest params) { @Override public Spectrum getSpectrum(int spectrumIndex) { - Integer frameId = m_spectra2FrameIndex.get(spectrumIndex); + Integer frameId = m_spectra2FrameIndex.get(spectrumIndex); Optional opFrame = m_ttFrames.stream().filter(frame -> frameId.equals(frame.getId())).findFirst(); if(!opFrame.isPresent()) @@ -173,10 +196,24 @@ public Spectrum getSpectrum(int spectrumIndex) { spectrum = new Spectrum(spectrumIndex, (float) pasefFrame.getTime(), tfSp.getMasses(), tfSp.getIntensities(), 2); spectrum.setTitle(tfSp.getTitle()); } else if (!TimsPASEFFrame.class.isInstance(tf) ) { - //TODO VDS TO TEST if correct to fix SpectrumGeneratingMethod.SMOOTH or ask user... - fr.profi.brucker.timstof.model.Spectrum tfSp = tf.getSingleSpectrum(SpectrumGeneratingMethod.SMOOTH); - spectrum = new Spectrum(spectrumIndex, (float) tf.getTime(), tfSp.getMasses(), tfSp.getIntensities(), 1); - spectrum.setTitle(tfSp.getTitle()); + TimsMSFrame ms1Frame = (TimsMSFrame) tf; + if(m_ms1Format.equals(MS1_SPECTRA_PER_SCAN)) { + //Read spectrum corresponding to index... + Integer indexInFrameSpectra = spectrumIndex - m_frame2FirstSpectraIndex.get(ms1Frame.getId()); //Index relative to frame + fr.profi.brucker.timstof.model.Spectrum tfSp = ms1Frame.getScanSpectrum(indexInFrameSpectra); + if(tfSp != null){ + spectrum = new Spectrum(spectrumIndex, (float) ms1Frame.getTime(), tfSp.getMasses(), tfSp.getIntensities(), 1, Spectrum.ScanType.CENTROID); + spectrum.setTitle(tfSp.getTitle()+"_scan_"+indexInFrameSpectra); + } else { + spectrum = new Spectrum(spectrumIndex, (float) ms1Frame.getTime(), new double[0], new float[0], 1); + spectrum.setTitle(ms1Frame.getId()+"_empty_scan_"+indexInFrameSpectra); + } + } else { + //TODO VDS TO TEST if correct to fix SpectrumGeneratingMethod.SMOOTH or ask user... + fr.profi.brucker.timstof.model.Spectrum tfSp = tf.getSingleSpectrum(SpectrumGeneratingMethod.SMOOTH); + spectrum = new Spectrum(spectrumIndex, (float) tf.getTime(), tfSp.getMasses(), tfSp.getIntensities(), 1); + spectrum.setTitle(tfSp.getTitle()); + } } return spectrum; @@ -201,7 +238,7 @@ public int getSpectrumId(double retentionTime) { @Override public double[] getElutionTimes(int msLevel) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + throw new UnsupportedOperationException("TimsTof getElutionTimes: Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override @@ -280,12 +317,12 @@ public int getPreviousSpectrumId(int spectrumIndex, int msLevel) { @Override public List getMsMsEvent(double minMz, double maxMz) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + throw new UnsupportedOperationException("TimsTof getMsMsEvent: Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public boolean exportRawFile(String outFileName, IExportParameters exportParams) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + throw new UnsupportedOperationException("TimsTof exportRawFile: Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override @@ -295,12 +332,12 @@ public boolean isDIAFile() { @Override public Map getFileProperties() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + throw new UnsupportedOperationException("TimsTof getFileProperties: Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public QCMetrics getFileMetrics() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + throw new UnsupportedOperationException("TimsTof getFileMetrics: Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override @@ -315,6 +352,6 @@ public String toString(){ @Override public List extractPeakels(FeaturesExtractionRequest params) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + throw new UnsupportedOperationException("TimsTof extractPeakels: Not supported yet."); //To change body of generated methods, choose Tools | Templates. } } diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/AbstractMs1ExtractionWorker.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/AbstractMs1ExtractionWorker.java index ee99d728a..d4e2c1d86 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/AbstractMs1ExtractionWorker.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/AbstractMs1ExtractionWorker.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui; import fr.proline.mzscope.model.IChromatogram; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/AbstractRawFilePanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/AbstractRawFilePanel.java index 0733a567f..b48a87ca0 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/AbstractRawFilePanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/AbstractRawFilePanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ChromatogramPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ChromatogramPanel.java index b7873a32a..f5905cfe0 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ChromatogramPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ChromatogramPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -21,6 +21,7 @@ import fr.proline.mzscope.ui.event.AxisRangeChromatogramListener; import fr.proline.mzscope.ui.model.ChromatogramTableModel; import fr.proline.mzscope.utils.Display; +import fr.proline.studio.Exceptions; import fr.proline.studio.graphics.BasePlotPanel; import fr.proline.studio.graphics.PlotBaseAbstract; import fr.proline.studio.graphics.PlotLinear; @@ -38,7 +39,6 @@ import java.util.ArrayList; import java.util.List; import javax.swing.JPanel; -import org.openide.util.Exceptions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -73,7 +73,7 @@ public ChromatogramPanel() { private void initComponents() { this.setLayout(new BorderLayout()); - PlotPanel plotPanel = new PlotPanel(false); + PlotPanel plotPanel = new PlotPanel(); chromatogramPlotPanel = plotPanel.getBasePlotPanel(); chromatogramPlotPanel.addListener(this); chromatogramPlotPanel.setDrawCursor(true); diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ExtractionResultsPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ExtractionResultsPanel.java index 93a0ce28b..5018bfd58 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ExtractionResultsPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ExtractionResultsPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -23,6 +23,7 @@ import fr.proline.mzscope.ui.model.ExtractionResultsTableModel; import fr.proline.mzscope.ui.model.MzScopePreferences; import fr.proline.mzscope.utils.Display; +import fr.proline.studio.WindowManager; import fr.proline.studio.export.ExportButton; import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.markerbar.MarkerContainerPanel; @@ -50,7 +51,6 @@ import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.table.AbstractTableModel; -import org.openide.windows.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IExtractionResultsViewer.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IExtractionResultsViewer.java index 754a4215e..63286b28c 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IExtractionResultsViewer.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IExtractionResultsViewer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IMzScopeController.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IMzScopeController.java index ce17f6306..e2adcc449 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IMzScopeController.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IMzScopeController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,7 +16,10 @@ */ package fr.proline.mzscope.ui; +import fr.proline.mzscope.model.IFeature; import fr.proline.mzscope.model.IRawFile; +import java.util.List; +import java.util.Map; /** * @@ -29,4 +32,6 @@ public interface IMzScopeController { IRawFileViewer getRawFileViewer(IRawFile rawFile, boolean setVisible); IRawFileViewer getTabbedMultiRawFileViewer(); + + void displayFeatures(Map> features); } diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IRawFileLoading.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IRawFileLoading.java index b43c5e0c7..f6dfa521e 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IRawFileLoading.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IRawFileLoading.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,17 +14,17 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.mzscope.ui; - - -/** - * - * @author MB243701 - */ -public interface IRawFileLoading { - /** - * set a waiting action - * @param waitingState - */ - public void setWaitingState(boolean waitingState); -} +package fr.proline.mzscope.ui; + + +/** + * + * @author MB243701 + */ +public interface IRawFileLoading { + /** + * set a waiting action + * @param waitingState + */ + public void setWaitingState(boolean waitingState); +} diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IRawFileViewer.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IRawFileViewer.java index 220a3ba6e..2531e17b3 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IRawFileViewer.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/IRawFileViewer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/MgfExportParameters.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/MgfExportParameters.java index 6782ef137..05db76da4 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/MgfExportParameters.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/MgfExportParameters.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui; import fr.profi.mzdb.io.writer.mgf.IPrecursorComputation; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/MultiRawFilePanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/MultiRawFilePanel.java index 9782cf4ab..de71e1f90 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/MultiRawFilePanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/MultiRawFilePanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/MzScopePanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/MzScopePanel.java index a1ee7f2db..c5a6543de 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/MzScopePanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/MzScopePanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -20,7 +20,6 @@ import com.almworks.sqlite4java.SQLiteException; import fr.proline.mzscope.model.*; import fr.proline.mzscope.ui.peakels.DetectedFeaturesPanel; -import fr.proline.mzscope.ui.peakels.FeaturesPanel; import fr.proline.mzscope.ui.peakels.PeakelsPanel; import fr.proline.mzscope.utils.ButtonTabComponent; import com.google.common.base.Strings; @@ -38,6 +37,7 @@ import fr.proline.mzscope.ui.event.ExtractionEvent; import fr.proline.mzscope.ui.event.ExtractionStateListener; import fr.proline.mzscope.utils.Display; +import fr.proline.studio.Exceptions; import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.gui.DefaultDialog.ProgressTask; import java.awt.BorderLayout; @@ -60,7 +60,6 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.EventListenerList; -import org.openide.util.Exceptions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static scala.collection.JavaConversions.asJavaIterable; @@ -165,7 +164,7 @@ public IRawFileViewer getRawFileViewer(IRawFile rawfile, boolean setVisible) { public void openRaw(List files, boolean display) { List rawfiles = new ArrayList(); for (File f : files) { - IRawFile rawfile = RawFileManager.getInstance().getFile(f.getName()); + IRawFile rawfile = RawFileManager.getInstance().getFile(f.getAbsolutePath()); if (rawfile == null) { rawfile = RawFileManager.getInstance().addRawFile(f); } @@ -177,7 +176,7 @@ public void openRaw(List files, boolean display) { } public void openRawAndExtract(File file, final double moz, final double elutionTime, final double firstScanTime, final double lastScanTime) { - IRawFile tmpRawFile = RawFileManager.getInstance().getFile(file.getName()); + IRawFile tmpRawFile = RawFileManager.getInstance().getFile(file.getAbsolutePath()); if (tmpRawFile == null) { tmpRawFile = RawFileManager.getInstance().addRawFile(file); } @@ -717,4 +716,12 @@ private boolean isDIAFiles(List rawfiles) { return false; } + @Override + public void displayFeatures(Map> features) { + final DetectedFeaturesPanel featurePanel = new DetectedFeaturesPanel(this); + addFeatureTab("Generated Features", featurePanel, "generated"); + featuresTabPane.setSelectedComponent(featurePanel); + featurePanel.setFeatures(features, false); + } + } diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/PropertiesPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/PropertiesPanel.java index efb8a4f9d..c9982a593 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/PropertiesPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/PropertiesPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui; import fr.proline.mzscope.model.IRawFile; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/QCMetricsPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/QCMetricsPanel.java index fb0834af1..0f94d1e3e 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/QCMetricsPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/QCMetricsPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -237,7 +237,7 @@ public void actionPerformed(ActionEvent e) { toolbar.add(Box.createHorizontalGlue()); this.add(toolbar, BorderLayout.NORTH); - PlotPanel panel = new PlotPanel(false); + PlotPanel panel = new PlotPanel(); m_plotPanel = panel.getBasePlotPanel(); this.add(panel, BorderLayout.CENTER); } diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/RawFileManager.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/RawFileManager.java index 03bc0f5f4..c6385be3c 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/RawFileManager.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/RawFileManager.java @@ -1,121 +1,128 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.mzscope.ui; - -import fr.proline.mzscope.model.IRawFile; -import fr.proline.mzscope.mzdb.ThreadedMzdbRawFile; -import fr.proline.mzscope.mzml.MzMLRawFile; -import fr.proline.mzscope.timstof.TimstofRawFile; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author CB205360 - */ -public class RawFileManager { - - private static final Logger logger = LoggerFactory.getLogger(RawFileManager.class); - - private Map files; - - private IRawFile currentFile; - - private static RawFileManager instance; - - public static RawFileManager getInstance() { - if (instance == null) { - instance = new RawFileManager(); - } - return instance; - } - - private RawFileManager() { - files = new HashMap<>(); - } - - public IRawFile addRawFile(IRawFile rawFile) { - currentFile = rawFile; - files.put(rawFile.getName(), currentFile); - logger.info("Rawfile {} added to RawFileManager",rawFile.getFile().getAbsolutePath()); - return rawFile; - } - - public IRawFile addRawFile(File file) { - if (file.getAbsolutePath().toLowerCase().endsWith(".mzdb")) { - currentFile = new ThreadedMzdbRawFile(file); - files.put(file.getName(), currentFile); - logger.info("mzDB Rawfile {} added to RawFileManager",file.getAbsolutePath()); - } else if (file.getAbsolutePath().toLowerCase().endsWith(".mzml")) { - currentFile = new MzMLRawFile(file); - files.put(file.getName(), currentFile); - logger.info("mzML Rawfile {} added to RawFileManager",file.getAbsolutePath()); - } else if(file.getAbsolutePath().toLowerCase().endsWith(".d")){ - currentFile = new TimstofRawFile(file); - files.put(file.getName(), currentFile); - logger.info("TimsTof Rawfile {} added to RawFileManager",file.getAbsolutePath()); - } - return currentFile; - } - - public IRawFile getLastFile() { - return currentFile; - } - - public IRawFile getFile(String filename) { - if (files.containsKey(filename)) { - logger.info("RawFileManager will give access to {}",filename); - return files.get(filename); - } else { - logger.warn("RawFile {} not found", filename); - } - return null; - } - - public List getAllFiles(){ - return new ArrayList<>(files.values()); - } - - public void removeFile(IRawFile rawFile){ - if(files.containsValue(rawFile)){ - for(Map.Entry e : files.entrySet()){ - if(e.getValue().equals(rawFile) ){ - rawFile.closeIRawFile(); - files.remove(e.getKey()); - break; - } - } - } - } - - public void removeAllFiles(){ - for(IRawFile rFile : files.values()){ - rFile.closeIRawFile(); - } - files = new HashMap<>(); - } - - public boolean removeRawFile(IRawFile rawFile) { - IRawFile removedFile = files.remove(rawFile.getName()); - return (removedFile != null); - } -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.mzscope.ui; + +import fr.proline.mzscope.model.IRawFile; +import fr.proline.mzscope.mzdb.ThreadedMzdbRawFile; +import fr.proline.mzscope.mzml.MzMLRawFile; +import fr.proline.mzscope.timstof.TimstofRawFile; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.swing.JOptionPane; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author CB205360 + */ +public class RawFileManager { + + private static final Logger logger = LoggerFactory.getLogger(RawFileManager.class); + + private Map files; + + private IRawFile currentFile; + + private static RawFileManager instance; + + public static RawFileManager getInstance() { + if (instance == null) { + instance = new RawFileManager(); + } + return instance; + } + + private RawFileManager() { + files = new HashMap<>(); + } + + public IRawFile addRawFile(IRawFile rawFile) { + currentFile = rawFile; + files.put(rawFile.getFile().getAbsolutePath(), currentFile); + logger.info("Rawfile {} added to RawFileManager",rawFile.getFile().getAbsolutePath()); + return rawFile; + } + + public IRawFile addRawFile(File file) { + String absolutePath =file.getAbsolutePath(); + if (absolutePath.toLowerCase().endsWith(".mzdb")) { + currentFile = new ThreadedMzdbRawFile(file); + files.put(absolutePath, currentFile); + logger.info("mzDB Rawfile {} added to RawFileManager",absolutePath); + } else if (absolutePath.toLowerCase().endsWith(".mzml")) { + currentFile = new MzMLRawFile(file); + files.put(absolutePath, currentFile); + logger.info("mzML Rawfile {} added to RawFileManager",absolutePath); + } else if(absolutePath.toLowerCase().endsWith(".d")){ + String[] options = {TimstofRawFile.MS1_SINGLE_SPECTRA, TimstofRawFile.MS1_SPECTRA_PER_SCAN}; + int reply = JOptionPane.showOptionDialog(null, "MS1 Spectra display", "MS1 Format",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE, null, options, TimstofRawFile.MS1_SINGLE_SPECTRA); + if (reply == JOptionPane.YES_OPTION) + currentFile = new TimstofRawFile(file); + else + currentFile = new TimstofRawFile(file, TimstofRawFile.MS1_SPECTRA_PER_SCAN); + files.put(absolutePath, currentFile); + logger.info("TimsTof Rawfile {} added to RawFileManager",absolutePath); + } + return currentFile; + } + + public IRawFile getLastFile() { + return currentFile; + } + + public IRawFile getFile(String absoluteFilePath) { + if (files.containsKey(absoluteFilePath)) { + logger.info("RawFileManager will give access to {}",absoluteFilePath); + return files.get(absoluteFilePath); + } else { + logger.warn("RawFile {} not found", absoluteFilePath); + } + return null; + } + + public List getAllFiles(){ + return new ArrayList<>(files.values()); + } + + public void removeFile(IRawFile rawFile){ + if(files.containsValue(rawFile)){ + for(Map.Entry e : files.entrySet()){ + if(e.getValue().equals(rawFile) ){ + rawFile.closeIRawFile(); + files.remove(e.getKey()); + break; + } + } + } + } + + public void removeAllFiles(){ + for(IRawFile rFile : files.values()){ + rFile.closeIRawFile(); + } + files = new HashMap<>(); + } + + public boolean removeRawFile(IRawFile rawFile) { + IRawFile removedFile = files.remove(rawFile.getFile().getAbsolutePath()); + return (removedFile != null); + } +} diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/RawFilesPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/RawFilesPanel.java index ea07eb820..929aff92f 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/RawFilesPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/RawFilesPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui; import fr.proline.mzscope.ui.model.RawFileListModel; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ScanHeaderExportParameters.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ScanHeaderExportParameters.java index e34dcf3bb..f62749374 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ScanHeaderExportParameters.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ScanHeaderExportParameters.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui; import fr.proline.mzscope.model.IExportParameters; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ScanHeaderPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ScanHeaderPanel.java index 4ec9e9bcf..e72c02641 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ScanHeaderPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ScanHeaderPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ScanHeaderType.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ScanHeaderType.java index 720b0f5ee..10b393fa4 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ScanHeaderType.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/ScanHeaderType.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui; /** diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalEditorPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalEditorPanel.java index a86647f59..19a4cc1e9 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalEditorPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalEditorPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -26,6 +26,7 @@ import fr.proline.mzscope.model.Signal; import fr.proline.mzscope.ui.dialog.SmoothingParamDialog; import fr.proline.mzscope.ui.model.ScanTableModel; +import fr.proline.studio.WindowManager; import fr.proline.studio.graphics.BasePlotPanel; import fr.proline.studio.graphics.PlotLinear; import fr.proline.studio.graphics.PlotPanel; @@ -45,9 +46,7 @@ import java.util.List; import java.util.Map; import javax.swing.JButton; -import javax.swing.JPanel; import javax.swing.JToolBar; -import org.openide.windows.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import scala.Tuple2; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalMultipleEditorPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalMultipleEditorPanel.java index d81cf87ab..d269378e3 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalMultipleEditorPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalMultipleEditorPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,8 @@ */ package fr.proline.mzscope.ui; +import fr.profi.mzdb.algo.signal.filtering.SavitzkyGolaySmoother; +import fr.profi.mzdb.algo.signal.filtering.SavitzkyGolaySmoothingConfig; import fr.proline.mzscope.model.Signal; import fr.proline.mzscope.processing.DotProductScorer; import fr.proline.mzscope.processing.SpectrumUtils; @@ -29,6 +31,8 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.text.DecimalFormat; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; import javax.swing.JButton; @@ -37,6 +41,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import scala.Tuple2; /** * @@ -45,14 +50,14 @@ public class SignalMultipleEditorPanel extends JPanel { final private static Logger logger = LoggerFactory.getLogger(SignalMultipleEditorPanel.class); - + final private static DecimalFormat FORMATTER = new DecimalFormat("#.0000"); private final PlotPanel m_plotPanel; private final List m_plots; private final List m_signals; public SignalMultipleEditorPanel(List signals) { m_signals = signals; - m_plotPanel = new PlotPanel(false); + m_plotPanel = new PlotPanel(); m_plots = new ArrayList<>(); BasePlotPanel basePlot = m_plotPanel.getBasePlotPanel(); basePlot.setPlotTitle("2d signal"); @@ -84,12 +89,47 @@ public void actionPerformed(ActionEvent e) { @Override public void actionPerformed(ActionEvent e) { + + List input0 = m_signals.get(0).toScalaArrayTuple(false); + int nbrPoints = Math.min(input0.size()/4, 9); + SavitzkyGolaySmoother smoother = new SavitzkyGolaySmoother(new SavitzkyGolaySmoothingConfig(nbrPoints, 2, 1)); + + Tuple2[] result0 = smoother.smoothTimeIntensityPairs(input0.toArray(new Tuple2[input0.size()])); + double[] y0 = new double[result0.length]; + double[] x0 = new double[result0.length]; + for (int k = 0; k < result0.length; k++) { + x0[k] = (Double)result0[k]._1; + y0[k] = (Double)result0[k]._2; + } + Signal s = new Signal(x0,y0); + addSmoothedSignal(s, "S0 smoothed"); + + List input1 = m_signals.get(1).toScalaArrayTuple(false); + nbrPoints = Math.min(input1.size()/4, 9); + smoother = new SavitzkyGolaySmoother(new SavitzkyGolaySmoothingConfig(nbrPoints, 2, 1)); + + Tuple2[] result1 = smoother.smoothTimeIntensityPairs(input1.toArray(new Tuple2[input1.size()])); + double[] y1 = new double[result1.length]; + double[] x1 = new double[result1.length]; + for (int k = 0; k < result1.length; k++) { + x1[k] = (Double)result1[k]._1; + y1[k] = (Double)result1[k]._2; + } + s = new Signal(x1,y1); + addSmoothedSignal(s, "S1 smoothed"); + + + double smoothedValue = SpectrumUtils.correlation(x0, y0, x1, y1); double value = SpectrumUtils.correlation(m_signals.get(0).getXSeries(), m_signals.get(0).getYSeries(), m_signals.get(1).getXSeries(), m_signals.get(1).getYSeries()); - m_plots.get(0).addMarker(new LabelMarker(m_plotPanel.getBasePlotPanel(), new PixelCoordinates(10, 10), "Pearson Corr = "+value)); + m_plots.get(0).addMarker(new LabelMarker(m_plotPanel.getBasePlotPanel(), new PixelCoordinates(10, 10), MessageFormat.format("Pearson Corr = {0} ({1} smoothed)",value, smoothedValue))); - Pair values = SpectrumUtils.zipValues(m_signals.get(0).getXSeries(), m_signals.get(0).getYSeries(), m_signals.get(1).getXSeries(), m_signals.get(1).getYSeries()); + Pair values = SpectrumUtils.zipValues(x0, y0, x1, y1); + double smoothedCosineCorr = DotProductScorer.dotProduct(values.getLeft(), values.getRight()); + + values = SpectrumUtils.zipValues(m_signals.get(0).getXSeries(), m_signals.get(0).getYSeries(), m_signals.get(1).getXSeries(), m_signals.get(1).getYSeries()); double cosineCorr = DotProductScorer.dotProduct(values.getLeft(), values.getRight()); - m_plots.get(0).addMarker(new LabelMarker(m_plotPanel.getBasePlotPanel(), new PixelCoordinates(10, 60), "Cosine Corr = "+cosineCorr)); + + m_plots.get(0).addMarker(new LabelMarker(m_plotPanel.getBasePlotPanel(), new PixelCoordinates(10, 60), MessageFormat.format("Cosine Corr = {0} ({1} smoothed)", cosineCorr, smoothedCosineCorr))); m_plotPanel.getBasePlotPanel().repaintUpdateDoubleBuffer(); @@ -103,5 +143,17 @@ public void actionPerformed(ActionEvent e) { setPreferredSize(new Dimension(300,500)); } + private void addSmoothedSignal(Signal s, String title) { + + BasePlotPanel basePlot = m_plotPanel.getBasePlotPanel(); + SignalWrapper wrappedSignal = new SignalWrapper(s, "smoothed signal : "+title, CyclicColorPalette.getColor((basePlot.getPlots().size()+1)*2)); + PlotLinear linear = new PlotLinear(basePlot, wrappedSignal, null, 0, 1); + linear.setPlotInformation(wrappedSignal.getPlotInformation()); + linear.setStrokeFixed(true); + linear.setAntiAliasing(true); + basePlot.addPlot(linear, true); + basePlot.repaintUpdateDoubleBuffer(); + } + } diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalPanel.java index 4fdd8ac9f..56b68ce84 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalPanel.java @@ -5,8 +5,6 @@ */ package fr.proline.mzscope.ui; -import fr.profi.mzdb.algo.signal.detection.SmartPeakelFinder; -import fr.profi.mzdb.algo.signal.filtering.BaselineRemover; import fr.proline.mzscope.model.Signal; import fr.proline.mzscope.ui.model.ScanTableModel; import fr.proline.studio.graphics.BasePlotPanel; @@ -14,22 +12,13 @@ import fr.proline.studio.graphics.PlotPanel; import fr.proline.studio.graphics.PlotStick; import fr.proline.studio.graphics.PlotXYAbstract; -import fr.proline.studio.graphics.marker.LineMarker; import fr.proline.studio.utils.CyclicColorPalette; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JToolBar; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import scala.Tuple2; /** * @@ -45,7 +34,7 @@ public class SignalPanel extends JPanel { public SignalPanel(Signal signal) { m_signal = signal; - m_plotPanel = new PlotPanel(false); + m_plotPanel = new PlotPanel(); BasePlotPanel basePlot = m_plotPanel.getBasePlotPanel(); basePlot.setPlotTitle("2d signal"); diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalViewerBuilder.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalViewerBuilder.java index f446f9fcf..24e08b08f 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalViewerBuilder.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SignalViewerBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SingleRawFilePanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SingleRawFilePanel.java index 223932362..c1682aba3 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SingleRawFilePanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SingleRawFilePanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SpectrumPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SpectrumPanel.java index 73eeba158..825b7b92a 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SpectrumPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/SpectrumPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,8 +16,10 @@ */ package fr.proline.mzscope.ui; +import fr.proline.mzscope.ui.dialog.IsotopicPredictionParamDialog; import fr.proline.mzscope.ui.model.ScanTableModel; import fr.profi.ms.model.TheoreticalIsotopePattern; +import fr.profi.mzdb.algo.DotProductPatternScorer; import fr.profi.mzdb.algo.signal.filtering.ISignalSmoother; import fr.profi.mzdb.algo.signal.filtering.PartialSavitzkyGolaySmoother; import fr.profi.mzdb.algo.signal.filtering.SavitzkyGolaySmoother; @@ -32,6 +34,7 @@ import fr.proline.mzscope.processing.SpectrumUtils; import fr.proline.mzscope.ui.dialog.SmoothingParamDialog; import fr.proline.mzscope.utils.Display; +import fr.proline.studio.WindowManager; import fr.proline.studio.export.ExportButton; import fr.proline.studio.graphics.PlotXYAbstract; import fr.proline.studio.graphics.PlotLinear; @@ -57,6 +60,7 @@ import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -69,7 +73,6 @@ import javax.swing.JToggleButton; import javax.swing.JToolBar; import javax.swing.SwingUtilities; -import org.openide.windows.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import scala.Tuple2; @@ -102,7 +105,9 @@ public class SpectrumPanel extends JPanel implements ScanHeaderListener, PlotPan private JButton m_editSignalBtn; private JButton m_showCentroidBtn; - private JToggleButton m_freezeSpectrumBtn; + private JToggleButton m_freezeSpectrumBtn; + + private static final DecimalFormat df = new DecimalFormat("#.###"); class ScansSpinnerModel extends AbstractSpinnerModel { @@ -142,7 +147,7 @@ public SpectrumPanel(IRawFileViewer rawFilePanel) { public void initComponents() { // Create Scan Charts - PlotPanel plotPanel = new PlotPanel(false); + PlotPanel plotPanel = new PlotPanel(); spectrumPlotPanel = plotPanel.getBasePlotPanel(); spectrumPlotPanel.addListener(this); spectrumPlotPanel.setDrawCursor(true); @@ -169,7 +174,7 @@ private JToolBar getSpectrumToolbar() { displayIPBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - displayIsotopicPatterns(); + displayIsotopicPrediction(positionMarker.getValue()); } }); @@ -344,54 +349,81 @@ private Signal getSignal() { currentSignal.setSignalType(Signal.CENTROID); return currentSignal; } - - private void displayIsotopicPatterns() { - ipMarkers.stream().forEach((m) -> { - scanPlot.removeMarker(m); - }); - ipMarkers = new ArrayList(); - float ppmTol = MzScopePreferences.getInstance().getMzPPMTolerance(); - //IsotopicPatternUtils.compareIsotopicPatternPredictions(currentScan.getSpectrumData(), positionMarker.getValue(), ppmTol); + public void displayIsotopicPrediction(double mozToPredict) { - TheoreticalIsotopePattern pattern = IsotopicPatternUtils.predictIsotopicPattern(currentScan.getSpectrumData(), positionMarker.getValue(), ppmTol); - - // search for the index of the user selected mz value - int referenceMzIdx = 0; - int idx = SpectrumUtils.getNearestPeakIndex(currentScan.getSpectrumData().getMzList(), positionMarker.getValue()); - for (Tuple2 t : pattern.mzAbundancePairs()) { - if (1e6 * (Math.abs(currentScan.getSpectrumData().getMzList()[idx] - (double) t._1) / currentScan.getSpectrumData().getMzList()[idx]) < ppmTol) { - break; - } - referenceMzIdx++; - } + Spectrum spectrum = currentScan; - if (referenceMzIdx < pattern.isotopeCount()) { - float abundance = currentScan.getSpectrumData().getIntensityList()[idx]; - float normAbundance = (Float) pattern.mzAbundancePairs()[referenceMzIdx]._2; - for (Tuple2 t : pattern.mzAbundancePairs()) { - Double mz = (Double) t._1; - Float ab = (Float) t._2; - PointMarker m = new PointMarker(spectrumPlotPanel, new DataCoordinates(mz, ab * abundance / normAbundance), CyclicColorPalette.getColor(0)); - ipMarkers.add(m); - scanPlot.addMarker(m); - int peakIdx = SpectrumUtils.getPeakIndex(currentScan.getSpectrumData().getMzList(), mz, ppmTol); - if ((peakIdx != -1) && (currentScan.getSpectrumData().getIntensityList()[peakIdx] < 2.0 * ab * abundance / normAbundance)) { - logger.info("Peak found mz= " + mz + " expected= " + (ab * abundance / normAbundance) + " observed= " + currentScan.getSpectrumData().getIntensityList()[peakIdx]); - PointMarker pm = new PointMarker(spectrumPlotPanel, new DataCoordinates(currentScan.getSpectrumData().getMzList()[peakIdx], currentScan.getSpectrumData().getIntensityList()[peakIdx]), CyclicColorPalette.getColor(5)); - ipMarkers.add(pm); - scanPlot.addMarker(pm); - } - } - Double mz = 0.1+((Double)pattern.mzAbundancePairs()[0]._1 + (Double)pattern.mzAbundancePairs()[1]._1)/2.0; - Float ab = (Float)pattern.mzAbundancePairs()[0]._2 * 0.75f; - LabelMarker label = new LabelMarker(spectrumPlotPanel, new DataCoordinates(mz, ab * abundance / normAbundance), "charge "+pattern.charge()+"+", ORIENTATION_XY_MIDDLE,ORIENTATION_XY_MIDDLE, CyclicColorPalette.getColor(0)); - ipMarkers.add(label); - scanPlot.addMarker(label); + if (referenceSpectrum != null) { + IsotopicPredictionParamDialog dialog = new IsotopicPredictionParamDialog(WindowManager.getDefault().getMainWindow()); + dialog.pack(); + dialog.setVisible(true); + if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { + spectrum = (dialog.getSpectrum() == IsotopicPredictionParamDialog.CURRENT_SPECTRUM) ? currentScan : referenceSpectrum; + } + } + + ipMarkers.stream().forEach((m) -> { + scanPlot.removeMarker(m); + }); + ipMarkers = new ArrayList(); + float ppmTol = MzScopePreferences.getInstance().getMzPPMTolerance(); + + //IsotopicPatternUtils.compareIsotopicPatternPredictions(currentScan.getSpectrumData(), positionMarker.getValue(), ppmTol); + + Tuple2 prediction = IsotopicPatternUtils.predictIsotopicPattern(spectrum.getSpectrumData(), mozToPredict, ppmTol); + displayIsotopes(spectrum, mozToPredict, prediction, ppmTol, 5); + +// // display alternative scoring before prediction re-ranking +// Tuple2[] putativePatterns = DotProductPatternScorer.calcIsotopicPatternHypotheses(spectrum.getSpectrumData(), mozToPredict, ppmTol); +// +// if ((putativePatterns[0]._2.charge() != prediction._2.charge()) || (1e6*(Math.abs(putativePatterns[0]._2.monoMz() - prediction._2.monoMz())/putativePatterns[0]._2.monoMz()) > ppmTol)) { +// displayIsotopes(spectrum, mozToPredict, putativePatterns[0], ppmTol, 2); +// } else if ((putativePatterns[1]._2.charge() != prediction._2.charge()) || (1e6*(Math.abs(putativePatterns[1]._2.monoMz() - prediction._2.monoMz())/putativePatterns[1]._2.monoMz()) > ppmTol)) { +// displayIsotopes(spectrum, mozToPredict, putativePatterns[1], ppmTol, 2); +// } + + spectrumPlotPanel.repaintUpdateDoubleBuffer(); + } + + private void displayIsotopes(Spectrum spectrum, double mozToPredict, Tuple2 scoredPattern, float ppmTol, int colorIndex) { + // search for the index of the user selected mz value + int referenceMzIdx = 0; + TheoreticalIsotopePattern pattern = scoredPattern._2; + int idx = SpectrumUtils.getNearestPeakIndex(spectrum.getSpectrumData().getMzList(), mozToPredict); + for (Tuple2 t : pattern.mzAbundancePairs()) { + if (1e6 * (Math.abs(spectrum.getSpectrumData().getMzList()[idx] - (double) t._1) / spectrum.getSpectrumData().getMzList()[idx]) < ppmTol) { + break; + } + referenceMzIdx++; + } + if (referenceMzIdx < pattern.isotopeCount()) { + float abundance = spectrum.getSpectrumData().getIntensityList()[idx]; + float normAbundance = (Float) pattern.mzAbundancePairs()[referenceMzIdx]._2; + for (Tuple2 t : pattern.mzAbundancePairs()) { + Double mz = (Double) t._1; + Float ab = (Float) t._2; + PointMarker m = new PointMarker(spectrumPlotPanel, new DataCoordinates(mz, ab * abundance / normAbundance), CyclicColorPalette.getColor(0)); + ipMarkers.add(m); + scanPlot.addMarker(m); + int peakIdx = SpectrumUtils.getPeakIndex(spectrum.getSpectrumData().getMzList(), mz, ppmTol); + if ((peakIdx != -1) && (spectrum.getSpectrumData().getIntensityList()[peakIdx] < 2.0 * ab * abundance / normAbundance)) { + logger.info("Peak found mz= " + mz + " expected= " + (ab * abundance / normAbundance) + " observed= " + spectrum.getSpectrumData().getIntensityList()[peakIdx]); + PointMarker pm = new PointMarker(spectrumPlotPanel, new DataCoordinates(spectrum.getSpectrumData().getMzList()[peakIdx], spectrum.getSpectrumData().getIntensityList()[peakIdx]), CyclicColorPalette.getColor(colorIndex)); + ipMarkers.add(pm); + scanPlot.addMarker(pm); } - spectrumPlotPanel.repaintUpdateDoubleBuffer(); + } + Double mz = 0.1 + ((Double) pattern.mzAbundancePairs()[0]._1 + (Double) pattern.mzAbundancePairs()[1]._1) / 2.0; + Float ab = (Float) pattern.mzAbundancePairs()[0]._2 * 0.75f; + StringBuilder labelTxt = new StringBuilder("charge "); + labelTxt.append(pattern.charge()).append("+").append("(").append(df.format(scoredPattern._1)).append(")"); + LabelMarker label = new LabelMarker(spectrumPlotPanel, new DataCoordinates(mz, ab * abundance / normAbundance), labelTxt.toString(), ORIENTATION_XY_MIDDLE, ORIENTATION_XY_MIDDLE, CyclicColorPalette.getColor(0)); + ipMarkers.add(label); + scanPlot.addMarker(label); } + } @Override diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/StatusRenderer.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/StatusRenderer.java index 3ffaf3cb7..33a0202f6 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/StatusRenderer.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/StatusRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/TabbedMultiRawFilePanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/TabbedMultiRawFilePanel.java index f00ae5bb6..7dbf2d52b 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/TabbedMultiRawFilePanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/TabbedMultiRawFilePanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/XICExtractionPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/XICExtractionPanel.java index ba5f3b928..b03661f53 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/XICExtractionPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/XICExtractionPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -217,7 +217,7 @@ private JTextField getFragmentToleranceTF() { fragmentToleranceTF.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { - float ppm = Float.parseFloat(fragmentToleranceTF.getText().trim()); + float ppm = Float.parseFloat(fragmentToleranceTF.getText().trim()); MzScopePreferences.getInstance().setFragmentMzPPMTolerance(ppm); if (!getFragmentMassRangeTF().getText().isEmpty()) { startExtraction(); diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/ExportRawFileDialog.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/ExportRawFileDialog.java index 0aa50aad7..e502b91d3 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/ExportRawFileDialog.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/ExportRawFileDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui.dialog; import fr.profi.mzdb.io.writer.mgf.DefaultPrecursorComputer; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/ExtractionParamsDialog.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/ExtractionParamsDialog.java index 449ba1f21..df02dd742 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/ExtractionParamsDialog.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/ExtractionParamsDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui.dialog; import fr.proline.mzscope.model.FeaturesExtractionRequest; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/IsotopicPredictionParamDialog.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/IsotopicPredictionParamDialog.java new file mode 100644 index 000000000..918e3b53a --- /dev/null +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/IsotopicPredictionParamDialog.java @@ -0,0 +1,60 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package fr.proline.mzscope.ui.dialog; + +import fr.proline.studio.gui.DefaultDialog; +import org.jdesktop.swingx.JXComboBox; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; + +/** + * @author CB205360 + */ +public class IsotopicPredictionParamDialog extends DefaultDialog { + + JComboBox m_spectrum; + public final static String CURRENT_SPECTRUM = "Current Spectrum"; + public final static String REFERENCE_SPECTRUM = "Reference Spectrum"; + + String[] spectrum = {CURRENT_SPECTRUM, REFERENCE_SPECTRUM}; + + public IsotopicPredictionParamDialog(Window parent) { + super(parent, ModalityType.APPLICATION_MODAL); + setTitle("Isotopic prediction parameters"); + setInternalComponent(createInternalPanel()); + } + + private JPanel createInternalPanel() { + JPanel internalPanel = new JPanel(new GridBagLayout()); + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.insets = new java.awt.Insets(5, 5, 5, 5); + + c.gridx = 0; + c.gridy = 0; + c.gridwidth = 1; + c.weightx = 0; + JLabel nbrPointLabel = new JLabel("Spectrum to annotate:"); + internalPanel.add(nbrPointLabel, c); + + c.gridx++; + c.weightx = 1; + m_spectrum = new JXComboBox(spectrum); + m_spectrum.setSelectedItem(CURRENT_SPECTRUM); + internalPanel.add(m_spectrum, c); + + return internalPanel; + } + + public String getSpectrum() { + return m_spectrum.getSelectedItem().toString(); + } + +} diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/MzdbFilter.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/MzdbFilter.java index 256a34f73..b964ac383 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/MzdbFilter.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/MzdbFilter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui.dialog; import java.io.File; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/RTParamDialog.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/RTParamDialog.java new file mode 100644 index 000000000..7f5bd8437 --- /dev/null +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/RTParamDialog.java @@ -0,0 +1,74 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package fr.proline.mzscope.ui.dialog; + +import fr.proline.studio.gui.DefaultDialog; +import java.awt.Dialog; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Window; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +/** + * + * @author CB205360 + */ +public class RTParamDialog extends DefaultDialog{ + + JTextField m_rtToleranceTF; + + public RTParamDialog(Window parent) { + super(parent, Dialog.ModalityType.APPLICATION_MODAL); + setTitle("Retention Time tolerance"); + setInternalComponent(createInternalPanel()); + } + + private JPanel createInternalPanel() { + JPanel internalPanel = new JPanel(new GridBagLayout()); + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.insets = new java.awt.Insets(5, 5, 5, 5); + + c.gridx = 0; + c.gridy = 0; + c.gridwidth = 1; + c.weightx = 0; + JLabel nbrPointLabel = new JLabel("RT tolerance (s):"); + internalPanel.add(nbrPointLabel, c); + + c.gridx++; + c.weightx = 1; + m_rtToleranceTF = new JTextField(6); + m_rtToleranceTF.setText("40"); + m_rtToleranceTF.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + char c = e.getKeyChar(); + if (!((c >= '0') && (c <= '9') || + (c == '.') || + (c == KeyEvent.VK_BACK_SPACE) || + (c == KeyEvent.VK_DELETE))) { + getToolkit().beep(); + e.consume(); + } + } + }); + internalPanel.add(m_rtToleranceTF, c); + + + return internalPanel; + } + + public float getRTTolerance(){ + return Float.valueOf(m_rtToleranceTF.getText()); + } + +} diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/SmoothingParamDialog.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/SmoothingParamDialog.java index 8c4db01a1..22360c10d 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/SmoothingParamDialog.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/dialog/SmoothingParamDialog.java @@ -30,6 +30,7 @@ public class SmoothingParamDialog extends DefaultDialog{ public final static String SG_SMOOTHER = "Savitzky-Golay Smoother"; public final static String BOTH_SMOOTHER = "All Smoothers"; String[] methods = {PARTIAL_SG_SMOOTHER, SG_SMOOTHER, BOTH_SMOOTHER}; + public SmoothingParamDialog(Window parent) { super(parent, Dialog.ModalityType.APPLICATION_MODAL); setTitle("Smooting parameters "); diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/AxisRangeChromatogramListener.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/AxisRangeChromatogramListener.java index 83ebbeed8..dc953ea9f 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/AxisRangeChromatogramListener.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/AxisRangeChromatogramListener.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui.event; /** diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/ExtractionEvent.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/ExtractionEvent.java index f3699b619..5915a0263 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/ExtractionEvent.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/ExtractionEvent.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui.event; import java.util.EventObject; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/ExtractionStateListener.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/ExtractionStateListener.java index b7be5b4c3..67bc4f5e2 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/ExtractionStateListener.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/ExtractionStateListener.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,16 +14,16 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.mzscope.ui.event; - -import java.util.EventListener; - -/** - * - * @author MB243701 - */ -public interface ExtractionStateListener extends EventListener { - - public void extractionStateChanged(ExtractionEvent event); - -} +package fr.proline.mzscope.ui.event; + +import java.util.EventListener; + +/** + * + * @author MB243701 + */ +public interface ExtractionStateListener extends EventListener { + + public void extractionStateChanged(ExtractionEvent event); + +} diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/ScanHeaderListener.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/ScanHeaderListener.java index c657757ee..93fae28b6 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/ScanHeaderListener.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/event/ScanHeaderListener.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui.event; import java.util.EventListener; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/ChromatogramTableModel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/ChromatogramTableModel.java index 173dd02ff..1be88a8fd 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/ChromatogramTableModel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/ChromatogramTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui.model; import fr.proline.mzscope.model.IChromatogram; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/ExtractionResultsTableModel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/ExtractionResultsTableModel.java index b4a009c4c..22fd167a1 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/ExtractionResultsTableModel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/ExtractionResultsTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/MapDataGroup.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/MapDataGroup.java index 56848869a..2d8621ec9 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/MapDataGroup.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/MapDataGroup.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui.model; import fr.proline.studio.table.DataGroup; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/MapTableModel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/MapTableModel.java index f3615231a..5532978a0 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/MapTableModel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/MapTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/MzScopePreferences.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/MzScopePreferences.java index 782e2c3ae..4a564f99f 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/MzScopePreferences.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/MzScopePreferences.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui.model; /** diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/RawFileListModel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/RawFileListModel.java index f341e5ad1..870f1583c 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/RawFileListModel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/RawFileListModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui.model; import fr.proline.mzscope.model.IRawFile; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/ScanTableModel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/ScanTableModel.java index 1207dad79..cb3317843 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/ScanTableModel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/ScanTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui.model; import fr.proline.mzscope.model.Spectrum; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/StatisticsTableModel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/StatisticsTableModel.java index 6661d6ac7..1bf1596cc 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/StatisticsTableModel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/model/StatisticsTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.ui.model; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/AbstractPeakelsPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/AbstractPeakelsPanel.java index b33fa2c21..e225ed933 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/AbstractPeakelsPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/AbstractPeakelsPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -17,15 +17,20 @@ package fr.proline.mzscope.ui.peakels; import fr.profi.mzdb.model.Peakel; +import fr.proline.mzscope.model.BaseFeature; import fr.proline.mzscope.model.IPeakel; +import fr.proline.mzscope.processing.SpectrumUtils; import fr.proline.mzscope.ui.IMzScopeController; import fr.proline.studio.export.ExportButton; import fr.proline.studio.extendedtablemodel.CompoundTableModel; +import fr.proline.studio.extendedtablemodel.ImportedDataTableModel; import fr.proline.studio.filter.FilterButton; import fr.proline.studio.filter.actions.ClearRestrainAction; import fr.proline.studio.filter.actions.RestrainAction; import fr.proline.studio.graphics.BasePlotPanel; import fr.proline.studio.graphics.PlotLinear; +import fr.proline.studio.graphics.marker.LabelMarker; +import fr.proline.studio.graphics.marker.coordinates.PixelCoordinates; import fr.proline.studio.markerbar.MarkerContainerPanel; import fr.proline.studio.table.AbstractTableAction; import fr.proline.studio.table.DecoratedMarkerTable; @@ -37,10 +42,16 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.TableModelListener; +import javax.swing.filechooser.FileFilter; +import javax.swing.table.AbstractTableModel; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.io.File; +import java.text.MessageFormat; +import java.util.ArrayList; import java.util.List; +import java.util.prefs.Preferences; /** * Panel presenting a list of peakels in a table @@ -50,7 +61,9 @@ public abstract class AbstractPeakelsPanel extends JPanel { final private static Logger logger = LoggerFactory.getLogger(AbstractPeakelsPanel.class); + private final static String LAST_DIR = "mzscope.last.csv.features.directory"; + private JFileChooser m_fchooser; protected int m_modelSelectedRowBeforeSort = -1; protected DecoratedMarkerTable m_table; @@ -62,6 +75,18 @@ public abstract class AbstractPeakelsPanel extends JPanel { public AbstractPeakelsPanel(IMzScopeController controller) { this.m_viewersController = controller; + m_fchooser = new JFileChooser(); + m_fchooser.setFileFilter(new FileFilter() { + @Override + public boolean accept(File f) { + return f.getName().endsWith(".csv"); + } + + @Override + public String getDescription() { + return "*.csv"; + } + }); initComponents(); } @@ -87,12 +112,12 @@ public void mouseClicked(MouseEvent evt) { jScrollPane.setViewportView(m_table); m_table.setFillsViewportHeight(true); m_table.setViewport(jScrollPane.getViewport()); - m_table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent e) { - updatePeakelsViewer(getSelectedPeakels()); - } - }); + m_table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + @Override + public void valueChanged(ListSelectionEvent e) { + updatePeakelsViewer(getSelectedPeakels()); + } + }); JToolBar toolbar = initToolbar(); @@ -155,6 +180,19 @@ private void updatePeakelsViewer(List peakels) { plot.setPlotInformation(wrapper.getPlotInformation()); m_graphPlot.addPlot(plot); } + + m_graphPlot.getPlots().get(0).clearMarkers(); + + //for 2 peakels, compute and display correlation coefficient + if (peakels.size() == 2) { + double correlation = SpectrumUtils.correlation(peakels.get(0), peakels.get(1)); + double ompCorrelation = SpectrumUtils.correlationOMP(peakels.get(0), peakels.get(1), false); + double ompSmoothedCorrelation = SpectrumUtils.correlationOMP(peakels.get(0), peakels.get(1), true); + + LabelMarker marker = new LabelMarker(m_graphPlot, new PixelCoordinates(10, 60), MessageFormat.format("Corr: {0}, OMP: {1}, smooth OMP: {2}", correlation, ompCorrelation, ompSmoothedCorrelation)); + m_graphPlot.getPlots().get(0).addMarker(marker); + } + m_graphPlot.getYAxis().lockMinValue(0.0); m_graphPlot.getYAxis().setRange(0, maxY); m_graphPlot.repaint(); @@ -171,7 +209,89 @@ protected int getModelRowId(int rowId) { return rowId; } - private class DisplayRawFileAction extends AbstractTableAction { + + void matchCSVIons() { + Preferences prefs = Preferences.userNodeForPackage(this.getClass()); + String directory = prefs.get(LAST_DIR, m_fchooser.getCurrentDirectory().getAbsolutePath()); + m_fchooser.setCurrentDirectory(new File(directory)); + int result = m_fchooser.showOpenDialog(this); + if (result == JFileChooser.APPROVE_OPTION) { + File csvFile = m_fchooser.getSelectedFile(); + String fileName = csvFile.getName(); + if (!fileName.endsWith(".csv")) { + JOptionPane.showMessageDialog(this, "The file must be a csv file", "Error", JOptionPane.ERROR_MESSAGE); + return; + } + prefs.put(LAST_DIR, csvFile.getParentFile().getAbsolutePath()); + ImportedDataTableModel importedTableModel = new ImportedDataTableModel(); + Exception csvException = ImportedDataTableModel.loadFile(importedTableModel, csvFile.getAbsolutePath(), ';', true, false); + if (csvException == null) { + int mzColumnIdx = findColumn(importedTableModel, new String[]{"moz", "m/z", "mz", "exp. moz"}); + int rtColumnIdx = findColumn(importedTableModel, new String[]{"rt", "retention_time", "retention time", "elution_time", "elution time", "time"}); + int zColumnIdx = findColumn(importedTableModel, new String[]{"charge", "z"}); + int iColumnIdx = findColumn(importedTableModel, new String[]{"Abundance"}); + + if (mzColumnIdx != -1) { + List ions = new ArrayList<>(importedTableModel.getRowCount()); + for (int k = 0; k < importedTableModel.getRowCount(); k++) { + double mz = ((Double) importedTableModel.getValueAt(k, mzColumnIdx)); + float rt = ((rtColumnIdx != -1) ? ((Double) importedTableModel.getValueAt(k, rtColumnIdx)).floatValue() : -1.0f); + int z = ((zColumnIdx != -1) ? ((Long) importedTableModel.getValueAt(k, zColumnIdx)).intValue() : 0); + float i = ((iColumnIdx != -1)) ? ((Double) importedTableModel.getValueAt(k, iColumnIdx)).floatValue() : -1.0f; + + BaseFeature ion = new BaseFeature(mz, rt, rt, rt, null, 1); + ion.setCharge(z); + ion.setApexIntensity(i); + ions.add(ion); + } + logger.info("Matching features from {}", csvFile.getName()); + matchIons(ions, importedTableModel); + } else { + StringBuffer columnNamesBuffer = new StringBuffer("["); + for (int i = 0; i < importedTableModel.getColumnCount(); i++) { + columnNamesBuffer.append(importedTableModel.getColumnName(i)).append(";"); + } + columnNamesBuffer.deleteCharAt(columnNamesBuffer.length()-1); + columnNamesBuffer.append("]"); + + String message = "No column named \"mz\",\"moz\" or \"m/z\" detected in the imported file.\n Verify the column headers (the column separator must be \";\") \n" + + columnNamesBuffer.toString(); + JOptionPane.showMessageDialog(this, message, "Error", JOptionPane.ERROR_MESSAGE); + } + } else { + + JOptionPane.showMessageDialog(this, "Error while redading CSV file : "+csvException.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); + } + } + } + + protected abstract void matchIons(List ions, ImportedDataTableModel importedTableModel); + + protected String getRowAsString(int row, ImportedDataTableModel tableModel) { + StringBuilder stb = new StringBuilder(); + for (int k = 0; k < tableModel.getColumnCount(); k++) { + stb.append(tableModel.getValueAt(row, k)).append(", "); + } + return stb.toString(); + } + + + protected int findColumn(AbstractTableModel tableModel, String[] alternativeNames) { + int columnIdx = -1; + for (String name : alternativeNames) { + for (int i = 0; i < tableModel.getColumnCount(); i++) { + if (name.trim().equalsIgnoreCase(tableModel.getColumnName(i).trim())) { + columnIdx = i; + } + } + if (columnIdx != -1) { + break; + } + } + return columnIdx; + } + + protected class DisplayRawFileAction extends AbstractTableAction { public DisplayRawFileAction() { super("Display in the raw file"); @@ -191,7 +311,7 @@ public void updateEnabled(int row, int col, int[] selectedRows, JTable table) { } } - private class DisplayFeatureInCurrentRawFileAction extends AbstractTableAction { + protected class DisplayFeatureInCurrentRawFileAction extends AbstractTableAction { public DisplayFeatureInCurrentRawFileAction() { super("Display in the currently active raw file"); @@ -211,7 +331,7 @@ public void updateEnabled(int row, int col, int[] selectedRows, JTable table) { } } - private class FeatureTable extends DecoratedMarkerTable { + protected class FeatureTable extends DecoratedMarkerTable { @Override public TablePopupMenu initPopupMenu() { diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/DetectedFeaturesPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/DetectedFeaturesPanel.java index 95b8bb161..733bead21 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/DetectedFeaturesPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/DetectedFeaturesPanel.java @@ -1,39 +1,42 @@ package fr.proline.mzscope.ui.peakels; import fr.proline.mzscope.model.IFeature; +import fr.proline.mzscope.processing.PeakelsHelper; import fr.proline.mzscope.ui.IMzScopeController; import javax.swing.*; import java.awt.*; +import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; public class DetectedFeaturesPanel extends JPanel { private FeaturesPanel featuresPanel; - private FeaturesPanel invalidFeaturesPanel; + private FeaturesPanel dubiousFeaturesPanel; public DetectedFeaturesPanel(IMzScopeController controller) { featuresPanel = new FeaturesPanel(controller); - invalidFeaturesPanel = new FeaturesPanel(controller); + dubiousFeaturesPanel = new FeaturesPanel(controller); setLayout(new BorderLayout()); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.BOTTOM); - tabbedPane.add("Detected features", featuresPanel); - tabbedPane.add("Invalid features", invalidFeaturesPanel); + tabbedPane.add("Valid features", featuresPanel); + tabbedPane.add("Dubious features", dubiousFeaturesPanel); add(tabbedPane, BorderLayout.CENTER); } public void addFeatures(List features) { - Map> list = features.stream().collect(Collectors.partitioningBy(f -> f.getPeakelsCount() > 1)); - featuresPanel.addFeatures(list.get(Boolean.TRUE)); - invalidFeaturesPanel.addFeatures(list.get(Boolean.FALSE)); + featuresPanel.addFeatures(features); + } + + public void setFeatures(Map> features, boolean displayRawFileColumn) { + featuresPanel.setFeatures(features.get(PeakelsHelper.VALID_FEATURES), displayRawFileColumn); + dubiousFeaturesPanel.setFeatures(features.get(PeakelsHelper.DUBIOUS_FEATURES), displayRawFileColumn); } public void setFeatures(List features, boolean displayRawFileColumn) { - Map> list = features.stream().collect(Collectors.partitioningBy(f -> f.getPeakelsCount() > 1)); - featuresPanel.setFeatures(list.get(Boolean.TRUE), displayRawFileColumn); - invalidFeaturesPanel.setFeatures(list.get(Boolean.FALSE), displayRawFileColumn); + featuresPanel.setFeatures(features, displayRawFileColumn); + dubiousFeaturesPanel.setFeatures(new ArrayList<>(), displayRawFileColumn); } } diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/FeaturesPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/FeaturesPanel.java index 468887ceb..327f903f0 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/FeaturesPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/FeaturesPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -24,18 +24,18 @@ import fr.proline.mzscope.model.Spectrum; import fr.proline.mzscope.processing.PeakelsHelper; import fr.proline.mzscope.ui.IMzScopeController; +import fr.proline.mzscope.ui.dialog.RTParamDialog; +import fr.proline.mzscope.ui.model.MzScopePreferences; import fr.proline.studio.extendedtablemodel.CompoundTableModel; import fr.proline.studio.extendedtablemodel.ImportedDataTableModel; +import fr.proline.studio.gui.DefaultDialog; -import java.io.File; import java.util.*; -import java.util.prefs.Preferences; import java.util.stream.Collectors; import javax.swing.*; -import javax.swing.filechooser.FileFilter; -import javax.swing.table.AbstractTableModel; import fr.proline.studio.utils.IconManager; +import java.awt.Window; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; @@ -49,26 +49,12 @@ public class FeaturesPanel extends AbstractPeakelsPanel { final private static Logger logger = LoggerFactory.getLogger(FeaturesPanel.class); - private final static String LAST_DIR = "mzscope.last.csv.features.directory"; - private JFileChooser m_fchooser; private List m_features = new ArrayList<>(); private PeakelsHelper m_helper = null; public FeaturesPanel(IMzScopeController controller) { super(controller); - m_fchooser = new JFileChooser(); - m_fchooser.setFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - return f.getName().endsWith(".csv"); - } - - @Override - public String getDescription() { - return "*.csv"; - } - }); } protected CompoundTableModel buildTableModel() { @@ -103,13 +89,22 @@ private void buildSpectrum() { List peakels = getSelectedIPeakels(); Peakel peakel = peakels.get(0).getPeakel(); PeakelsHelper helper = getPeakelsHelper(); - List coelutingPeakels = helper.findCoelutigPeakels(peakel.getApexMz() - 5, + RTParamDialog dialog = new RTParamDialog((Window)this.getTopLevelAncestor()); + dialog.setHelpHeaderText("The spectrum construction needs to search for co-eluting peakels.
" + + " The coelution definition is based on the following time tolerance."); + dialog.pack(); + dialog.setVisible(true); + + if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { + + List coelutingPeakels = helper.findCoelutingPeakels(peakel.getApexMz() - 5, peakel.getApexMz() + 5, - peakel.getFirstElutionTime(), - peakel.getLastElutionTime()); - SpectrumData spectrumData = helper.buildSpectrumDataFromPeakels(peakel, coelutingPeakels); - Spectrum spectrum = new Spectrum(-1, peakel.getApexElutionTime(), spectrumData.getMzList(), spectrumData.getIntensityList(), 1, Spectrum.ScanType.CENTROID); - m_viewersController.getRawFileViewer(peakels.get(0).getRawFile(), true).setReferenceSpectrum(spectrum); + peakel.getElutionTime() - dialog.getRTTolerance(), + peakel.getLastElutionTime() + dialog.getRTTolerance()); + SpectrumData spectrumData = helper.buildSpectrumFromPeakels(coelutingPeakels, peakel); + Spectrum spectrum = new Spectrum(-1, peakel.getElutionTime(), spectrumData.getMzList(), spectrumData.getIntensityList(), 1, Spectrum.ScanType.CENTROID); + m_viewersController.getRawFileViewer(peakels.get(0).getRawFile(), true).setReferenceSpectrum(spectrum); + } } private PeakelsHelper getPeakelsHelper() { @@ -148,139 +143,112 @@ public void addFeatures(List features) { public void setFeatures(List features, boolean displayRawFileColumn) { m_modelSelectedRowBeforeSort = -1; - m_helper = null; - ((FeaturesTableModel)m_compoundTableModel.getBaseModel()).setFeatures(features); - this.m_features = features; - m_markerContainerPanel.setMaxLineNumber(features.size()); + m_helper = null; + m_features = features == null ? new ArrayList() : features; + ((FeaturesTableModel)m_compoundTableModel.getBaseModel()).setFeatures(m_features); + m_markerContainerPanel.setMaxLineNumber(m_features.size()); // hide RawFileName column m_table.getColumnExt(m_table.convertColumnIndexToView(FeaturesTableModel.COLTYPE_FEATURE_RAWFILE.getIndex())).setVisible(displayRawFileColumn); } - private void matchCSVIons() { - Preferences prefs = Preferences.userNodeForPackage(this.getClass()); - String directory = prefs.get(LAST_DIR, m_fchooser.getCurrentDirectory().getAbsolutePath()); - m_fchooser.setCurrentDirectory(new File(directory)); - int result = m_fchooser.showOpenDialog(this); - if (result == JFileChooser.APPROVE_OPTION) { - File csvFile = m_fchooser.getSelectedFile(); - String fileName = csvFile.getName(); - if (!fileName.endsWith(".csv")) { - JOptionPane.showMessageDialog(this, "The file must be a csv file", "Error", JOptionPane.ERROR_MESSAGE); - return; - } - prefs.put(LAST_DIR, csvFile.getParentFile().getAbsolutePath()); - ImportedDataTableModel importedTableModel = new ImportedDataTableModel(); - Exception csvException = ImportedDataTableModel.loadFile(importedTableModel, csvFile.getAbsolutePath(), ';', true, false); - if (csvException == null) { - int mzColumnIdx = findColumn(importedTableModel, new String[]{"moz", "m/z", "mz"}); - int rtColumnIdx = findColumn(importedTableModel, new String[]{"rt", "retention_time", "retention time", "elution_time", "elution time", "time"}); - int zColumnIdx = findColumn(importedTableModel, new String[]{"charge", "z"}); - - if (mzColumnIdx != -1) { - List mzValues = new ArrayList<>(); - List rtValues = new ArrayList<>(); - List zValues = new ArrayList<>(); - for (int k = 0; k < importedTableModel.getRowCount(); k++) { - mzValues.add((Double) importedTableModel.getValueAt(k, mzColumnIdx)); - rtValues.add((rtColumnIdx != -1) ? (Double) importedTableModel.getValueAt(k, rtColumnIdx) : -1.0); - zValues.add((zColumnIdx != -1) ? ((Long) importedTableModel.getValueAt(k, zColumnIdx)).intValue() : 0); - } - - matchFeatures(mzValues, rtValues, zValues); - } else { - StringBuffer columnNamesBuffer = new StringBuffer("["); - for (int i = 0; i < importedTableModel.getColumnCount(); i++) { - columnNamesBuffer.append(importedTableModel.getColumnName(i)).append(";"); - } - columnNamesBuffer.deleteCharAt(columnNamesBuffer.length()-1); - columnNamesBuffer.append("]"); - - String message = "No column named \"mz\",\"moz\" or \"m/z\" detected in the imported file.\n Verify the column headers (the column separator must be \";\") \n" + - columnNamesBuffer.toString(); - JOptionPane.showMessageDialog(this, message, "Error", JOptionPane.ERROR_MESSAGE); - } - } else { - - JOptionPane.showMessageDialog(this, "Error while redading CSV file : "+csvException.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); - } - } - } - private void matchFeatures(List mzValues, List rtValues, List zValues) { - float moztol = 10; //MzScopePreferences.getInstance().getMzPPMTolerance(); + protected void matchIons(List ions, ImportedDataTableModel importedTableModel) { + float moztol = MzScopePreferences.getInstance().getMzPPMTolerance(); Map> featuresByNominalMass = m_features.stream().collect(Collectors.groupingBy(f -> Integer.valueOf((int) f.getMz()), Collectors.toList())); int matchingCount = 0; - List> matched = new ArrayList<>(); + List> matchedFeatures = new ArrayList<>(); List notFound = new ArrayList<>(); - List dubiousFeatures = new ArrayList<>(); - for (int k = 0; k < mzValues.size(); k++) { - double mz = mzValues.get(k); - double rt = rtValues.get(k) * 60.0; - int z = zValues.get(k); + List duplicateIons = ions.stream().filter(i -> Collections.frequency(ions, i) > 1).collect(Collectors.toList()); + logger.info("ions duplicates summary :: {}", duplicateIons.size()); + + + for (int k = 0; k < ions.size(); k++) { + BaseFeature ion = ions.get(k); + double mz = ion.getMz(); + double rt = ion.getElutionTime() * 60.0; + int z = ion.getCharge(); + double i = ion.getApexIntensity(); + List features = featuresByNominalMass.get(Integer.valueOf((int) mz)); + if (Math.abs( Integer.valueOf((int) mz) - mz) < 0.01) { + features.addAll(featuresByNominalMass.get(Integer.valueOf((int) mz) - 1)); + } else if (Math.abs( Integer.valueOf((int) mz) - mz) > 0.99) { + features.addAll(featuresByNominalMass.get(Integer.valueOf((int) mz) + 1)); + } + if (features != null) { IFeature feature = features.stream().filter(f -> { - double tolDa = f.getMz() * moztol / 1e6; - return (rt >= f.getFirstElutionTime() && rt <= f.getLastElutionTime() && (Math.abs(f.getMz() - mz) < tolDa) && ((f.getCharge() == 0) || (z == 0) || (z == f.getCharge()))); + double tolDa = (f.getMz() * moztol) / 1e6; + return (rt >= (f.getFirstElutionTime() -0.6) && rt <= (f.getLastElutionTime()+0.6) && (Math.abs(f.getMz() - mz) < tolDa) && ((f.getCharge() == 0) || (z == 0) || (z == f.getCharge()))); } ).findFirst().orElse(null); if (feature != null) { matchingCount++; - matched.add(new ImmutablePair<>(k, feature)); - logger.info("Feature matching: {}; {}; {}; {}+ = {}; {}; {}+; {}", k, mz, rt, z, feature.getMz(), feature.getElutionTime(), feature.getCharge(), feature.getPeakelsCount()); - if (feature.getPeakelsCount() <= 2) { - dubiousFeatures.add(feature); + matchedFeatures.add(new ImmutablePair<>(k, feature)); + //logger.info("Feature matching: {}; {}; {}; {}+ = {}; {}; {}+; {}", k, mz, rt, z, feature.getMz(), feature.getElutionTime(), feature.getCharge(), feature.getPeakelsCount()); + if ((z == 0) || (feature.getCharge() == 0)) { + logger.warn("Charge 0 detected !!!!!!!!!!"); } + + if (Math.abs(ion.getApexIntensity() - feature.getApexIntensity()) > 2) { + Peakel[] peakels = feature.getPeakels(); + int j = 0; + for (; j < peakels.length; j++) { + if (Math.abs(ion.getApexIntensity() - peakels[j].getApexIntensity()) < 2) { + break; + } + } + + if (j >= peakels.length) { + logger.info("Inconsistent matching : the ion intensity cannot be found: {}; {}; {}; {}; {}+ = {}; {}; {}; {}+; {}", k, mz, rt/60.0, i , z, feature.getMz(), feature.getElutionTime()/60.0, feature.getApexIntensity(), feature.getCharge(), feature.getPeakelsCount()); + } else { + logger.info("The peakel matching the ion has been found at index {}. Feature matching: {}; {}; {}; {}; {}+ = {}; {}; {}; {}+; {}", j, k, mz, rt/60.0, i , z, feature.getMz(), feature.getElutionTime()/60.0, feature.getApexIntensity(), feature.getCharge(), feature.getPeakelsCount()); + } + } + + } else { - BaseFeature f = new BaseFeature(mz, (float) rt, (float) rt, (float) rt, null, 1); - f.setCharge(z); - notFound.add(f); - logger.warn("no feature found for {}, {}, {}+", mz, rt / 60.0, z); + notFound.add(ion); + //logger.warn("no feature found for {}, {}, {}+, {}", mz, rt / 60.0, z, getRowAsString(k, importedTableModel)); } } else { - BaseFeature f = new BaseFeature(mz, (float) rt, (float) rt, (float) rt, null, 1); - f.setCharge(z); - notFound.add(f); - logger.warn("no feature found for {}, {}, {}+", mz, rt / 60.0, z); + notFound.add(ion); + //logger.warn("no feature found for {}, {}, {}+, {}", mz, rt / 60.0, z, getRowAsString(k, importedTableModel)); } } - logger.info("Found {} matches over {}", matchingCount, mzValues.size()); + logger.info("Found {} matches over {} ions among {} features ", matchingCount, ions.size(), m_features.size()); - logger.info("Not matched summary :: {}", matched.size()); - matched.forEach(p -> logger.info("matched Feature = {}; {}; {}; {}; {} ",p.getLeft(), p.getRight().getMz(), p.getRight().getElutionTime() / 60.0, p.getRight().getCharge(), p.getRight().getPeakelsCount())); + logger.info("Matched summary :: {}", matchedFeatures.size()); + //matchedFeatures.forEach(p -> logger.info("matched Feature = {}; {}; {}; {}; {} ",p.getLeft(), p.getRight().getMz(), p.getRight().getElutionTime() / 60.0, p.getRight().getCharge(), p.getRight().getPeakelsCount())); logger.info("Not found summary :: {}", notFound.size()); - notFound.forEach(feature -> logger.info("Feature not found = {}, {}, {}+", feature.getMz(), feature.getElutionTime() / 60.0, feature.getCharge())); + //notFound.forEach(feature -> logger.info("Feature not found = {}, {}, {}+", feature.getMz(), feature.getElutionTime() / 60.0, feature.getCharge())); - logger.info("Dubious features summary :: {} ", dubiousFeatures.size()); + logger.info("Found {} matches over {}", matchingCount, ions.size()); + logger.info("Distinct features matched :: {}", matchedFeatures.stream().map(p -> p.getRight()).distinct().count()); + logger.info("Not found summary :: {}", notFound.size()); - dubiousFeatures.forEach(feature -> logger.info("Dubious Feature = {}, {}, {}+, {} ", feature.getMz(), feature.getElutionTime() / 60.0, feature.getCharge(), feature.getPeakelsCount())); + Map> result = matchedFeatures.stream().map(p -> p.getRight()).collect(Collectors.groupingBy(IFeature::getPeakelsCount, Collectors.toList())); + for (Map.Entry> e : result.entrySet()) { + logger.info("matched Features with {} peakels: {} or {} distinct", e.getKey(), e.getValue().size(), e.getValue().stream().distinct().count()); - logger.info("Found {} matches over {}", matchingCount, mzValues.size()); - logger.info("Not found summary :: {}", notFound.size()); - logger.info("Dubious features summary :: {} ", dubiousFeatures.size()); +// List list = e.getValue(); +// List duplicates = list.stream().filter(i -> Collections.frequency(list, i) > 1).collect(Collectors.toList()); +// logger.info("duplicates matches :: {}", duplicates.size()); - Map result = dubiousFeatures.stream().collect(Collectors.groupingBy(IFeature::getPeakelsCount, Collectors.counting())); - for (Map.Entry e : result.entrySet()) { - logger.info("dubious features with {} peakels: {}", e.getKey(), e.getValue()); } - } + List monoIsotopicFeatures = matchedFeatures.stream().map(p -> p.getRight()).filter(f -> f.getPeakelsCount() == 1).collect(Collectors.toList()); + logger.info("Mono isotopic features summary :: {}", monoIsotopicFeatures.size()); + //monoIsotopicFeatures.forEach(feature -> logger.info("Mono Feature = {}, {}, {}+, {} ", feature.getMz(), feature.getElutionTime() / 60.0, feature.getCharge(), feature.getPeakelsCount())); - private int findColumn(AbstractTableModel tableModel, String[] alternativeNames) { - int columnIdx = -1; - for (String name : alternativeNames) { - columnIdx = tableModel.findColumn(name); - if (columnIdx != -1) { - break; - } - } - return columnIdx; } + + } diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/FeaturesTableModel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/FeaturesTableModel.java index 3f803223a..9585b34e1 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/FeaturesTableModel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/FeaturesTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -18,11 +18,13 @@ import fr.profi.mzdb.model.Feature; import fr.proline.mzscope.model.IFeature; +import fr.proline.mzscope.model.IPeakel; import fr.proline.studio.extendedtablemodel.ExtraDataType; import fr.proline.studio.table.Column; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * Table model for Features @@ -31,8 +33,8 @@ */ public class FeaturesTableModel extends PeakelsTableModel { - public static final Column COLTYPE_FEATURE_CHARGE_COL = new Column("Charge", "Charge state", Integer.class, 7); - public static final Column COLTYPE_FEATURE_PEAKELS_COUNT_COL = new Column("Peakels", "number of isotopes", Integer.class, 8); + public static final Column COLTYPE_FEATURE_CHARGE_COL = new Column("Charge", "Charge state", Integer.class, 8); + public static final Column COLTYPE_FEATURE_PEAKELS_COUNT_COL = new Column("Peakels", "number of isotopes", Integer.class, 9); @Override public Object getValueAt(int rowIndex, int columnIndex) { @@ -53,16 +55,12 @@ public ArrayList getExtraDataTypes() { return list; } - public void setFeatures(List features) { - m_peakels.clear(); - m_peakels.addAll(features); - fireTableDataChanged(); + super.setPeakels(features.stream().map(f -> ((IPeakel)f)).collect(Collectors.toList())); } public void addFeatures(List features) { - m_peakels.addAll(features); - fireTableDataChanged(); + super.addPeakels(features.stream().map(f -> ((IPeakel)f)).collect(Collectors.toList())); } } diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/PeakelsPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/PeakelsPanel.java index 4ba7fd8ab..dc9b0baf5 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/PeakelsPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/PeakelsPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,20 +16,39 @@ */ package fr.proline.mzscope.ui.peakels; +import com.almworks.sqlite4java.SQLiteException; +import fr.profi.ms.algo.IsotopePatternEstimator; +import fr.profi.ms.model.TheoreticalIsotopePattern; +import fr.profi.mzdb.algo.PeakelsPatternPredictor; +import fr.profi.mzdb.model.Feature; import fr.profi.mzdb.model.Peakel; import fr.profi.mzdb.model.SpectrumData; -import fr.proline.mzscope.model.IPeakel; -import fr.proline.mzscope.model.Spectrum; +import fr.profi.util.metrics.Metric; +import fr.proline.mzscope.model.*; +import fr.proline.mzscope.mzdb.MzdbFeatureWrapper; +import fr.proline.mzscope.processing.IsotopicPatternUtils; import fr.proline.mzscope.processing.PeakelsHelper; import fr.proline.mzscope.ui.IMzScopeController; +import fr.proline.mzscope.ui.dialog.RTParamDialog; +import fr.proline.mzscope.ui.model.MzScopePreferences; +import fr.proline.studio.Exceptions; import fr.proline.studio.extendedtablemodel.CompoundTableModel; +import fr.proline.studio.extendedtablemodel.ImportedDataTableModel; +import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.utils.IconManager; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import scala.Tuple2; +import scala.collection.JavaConverters; +import scala.collection.mutable.ArrayBuffer; import javax.swing.*; -import javax.swing.event.RowSorterListener; -import java.util.ArrayList; -import java.util.Arrays; +import java.awt.*; +import java.io.StreamCorruptedException; import java.util.List; +import java.util.*; import java.util.stream.Collectors; /** @@ -39,6 +58,8 @@ */ public class PeakelsPanel extends AbstractPeakelsPanel { + final private static Logger logger = LoggerFactory.getLogger(PeakelsPanel.class); + protected List m_peakels = new ArrayList<>(); protected PeakelsHelper m_helper = null; @@ -62,34 +83,325 @@ protected List getSelectedIPeakels() { @Override protected List getSelectedPeakels() { - return getSelectedIPeakels().stream().map(p-> p.getPeakel()).collect(Collectors.toList()); + List selectedPeakels = getSelectedIPeakels(); + return selectedPeakels == null ? null : selectedPeakels.stream().map(p-> p.getPeakel()).collect(Collectors.toList()); + } + + @Override + protected void matchIons(List ions, ImportedDataTableModel importedTableModel) { + + Metric metric = new Metric("ions matching"); + PeakelsHelper helper = getPeakelsHelper(); + float mzPPMTolerance = MzScopePreferences.getInstance().getMzPPMTolerance(); + IRawFile rawFile = m_peakels.get(0).getRawFile(); + int matchingCount = 0; + + List> matchedFeatures = new ArrayList<>(); + List notFound = new ArrayList<>(); + + List duplicateIons = ions.stream().filter(i -> Collections.frequency(ions, i) > 1).collect(Collectors.toList()); + logger.info("ions duplicates summary :: {}", duplicateIons.size()); + + int psmRtColumnIdx = findColumn(importedTableModel, new String[]{"rt.y"}); + + for (int k = 0; k < ions.size(); k++) { + + double ionMz = ions.get(k).getMz(); + double ionRt = ions.get(k).getElutionTime() * 60.0; + int ionCharge = ions.get(k).getCharge(); + double ionApexIntensity = ions.get(k).getApexIntensity(); + + double tolDa = (ionMz * mzPPMTolerance) / 1e6; + float tolRt = 40.0f; + + List peakelList = helper.findCoelutingPeakels(ionMz - tolDa, ionMz + tolDa, (float)(ionRt - tolRt), (float)(ionRt + tolRt)); + + if (peakelList != null) { + // ions rt have been rounded to 0.01 minutes, take this approximation into account + List filteredPeakelList = peakelList.stream().filter(p -> (ionRt >= (p.getFirstElutionTime()-0.6) && ionRt <= (p.getLastElutionTime()+0.6))).collect(Collectors.toList()); + Peakel peakel = null; + if (!filteredPeakelList.isEmpty()) { + matchingCount++; + if (filteredPeakelList.size() == 1) { + peakel = filteredPeakelList.get(0); + } else { + peakel = filteredPeakelList.stream().collect(Collectors.minBy(Comparator.comparingDouble(p -> Math.abs(ionMz-p.getApexMz())))).get(); + } + + List isotopes = helper.findFeatureIsotopes(peakel, ionCharge, mzPPMTolerance); + Feature feature = new Feature(isotopes.get(0).getMz(), ionCharge, JavaConverters.asScalaBufferConverter(isotopes).asScala(), true); + matchedFeatures.add(new ImmutablePair<>(k, new MzdbFeatureWrapper(feature, rawFile, 1))); + + //try to assess monoisotope and charge of the matched peakel + List coelutingPeakels = helper.findCoelutingPeakels(peakel.getApexMz() - helper.HALF_MZ_WINDOW, + peakel.getApexMz() + helper.HALF_MZ_WINDOW, + peakel.getElutionTime() - tolRt, + peakel.getElutionTime() + tolRt); + + SpectrumData spectrum = helper.buildSpectrumFromPeakels(coelutingPeakels, peakel); + TheoreticalIsotopePattern pattern = IsotopicPatternUtils.predictIsotopicPattern(spectrum, peakel.getMz(), mzPPMTolerance)._2; + + // alternative method to select the best pattern hypothese +// TheoreticalIsotopePattern alternativepattern = null; +// Tuple2[] putativePatterns = DotProductPatternScorer.calcIsotopicPatternHypotheses(spectrum, peakel.getMz(), mzPPMTolerance); +// boolean atLeastOneCorrelation = false; +// for (int j = 0;j< putativePatterns.length; j++) { +// TheoreticalIsotopePattern putativePattern = putativePatterns[j]._2; +// List scoredPeakels = helper.findFeatureIsotopes(peakel, putativePattern.charge(), mzPPMTolerance); +// if (scoredPeakels.size() > 2) { +// atLeastOneCorrelation = true; +// double corr = SpectrumUtils.correlation(peakel, scoredPeakels.get(0)); +// double corr2 = SpectrumUtils.correlation(peakel, scoredPeakels.get(1)); +// double corr3 = SpectrumUtils.correlation(peakel, scoredPeakels.get(2)); +// if ((corr > 0.6) && (corr2 > 0.6) && (corr3 > 0.6)) { +// alternativepattern = putativePattern; +// metric.incr("correlating isotope peakels found"); +// break; +// } +// } else { +// +// } +// } +// +// if (alternativepattern == null) { +// metric.incr("no alternative pattern found"); +// if (atLeastOneCorrelation) { +// metric.incr("at least one correlation calculated"); +// } +// } else { +// if ((alternativepattern.charge() == pattern.charge()) && (Math.abs(pattern.monoMz() - alternativepattern.monoMz()) <= tolDa)) { +// metric.incr("alternative pattern == pattern"); +// } +// pattern = alternativepattern; +// } + + + if ((pattern.charge() != ionCharge) || (Math.abs(pattern.monoMz() - peakel.getMz()) > tolDa)) { + metric.incr("incorrect prediction"); + + logger.info("incorrect prediction: expected {}, {}+, predicted {}, {}+ (rt = {})", peakel.getMz(), ionCharge, pattern.monoMz(), pattern.charge(), ionRt / 60.0); + // try to predict from the psm RT + if (psmRtColumnIdx != -1) { + float psmRt = ((Double) importedTableModel.getValueAt(k, psmRtColumnIdx)).floatValue() * 60.0f; + testPrediction(psmRt, helper, peakel, tolRt, mzPPMTolerance, tolDa, ionCharge, metric, "incorrect psm rt"); + } + + if (pattern.charge() != ionCharge) { + metric.incr("incorrect charge prediction"); + } + + if (Math.abs(pattern.monoMz() - peakel.getMz()) > tolDa) { + metric.incr("incorrect mono mz prediction"); + } + + // try to rescue prediction at 10ppm if the moz tolerance was below 5ppm +// if (mzPPMTolerance <= 5.0) { +// // try to predict at 10 ppm to assess moz tolerance impact +// coelutingPeakels = helper.findCoelutingPeakels(peakel.getApexMz() - helper.HALF_MZ_WINDOW, +// peakel.getApexMz() + helper.HALF_MZ_WINDOW, +// peakel.getElutionTime() - tolRt, +// peakel.getElutionTime() + tolRt); +// +// spectrum = helper.buildSpectrumFromPeakels(coelutingPeakels, peakel); +// pattern = IsotopicPatternUtils.predictIsotopicPattern(spectrum, peakel.getMz(), 10.0)._2; +// if ((pattern.charge() != ionCharge) || (Math.abs(pattern.monoMz() - peakel.getMz()) > tolDa)) { +// metric.incr("incorrect even at 10ppm"); +// } else { +// logger.info("rescued at 10ppm {}; {}; {}; {}; {}+", k, ionMz, ionRt/60.0, ionApexIntensity , ionCharge); +// metric.incr("rescued at 10ppm"); +// } +// } + + + } else { + // prediction was correct, negative control: test prediction from the psmRt +// if (psmRtColumnIdx != -1) { +// float psmRt = ((Double) importedTableModel.getValueAt(k, psmRtColumnIdx)).floatValue() * 60.0f; +// testPrediction(psmRt, helper, peakel, tolRt, mzPPMTolerance, tolDa, ionCharge, metric, "ctr psm rt"); +// } + + if (isotopes.size() > 1) { + double dm = (isotopes.get(1).getMz() - isotopes.get(0).getMz()) * ionCharge; + if (Math.abs(dm - IsotopePatternEstimator.avgIsoMassDiff()) < 0.01) { + metric.addValue("isotopic dmass", dm); + } else { + metric.incr("missing second isotope detected"); + logger.info("missing second isotope for {}; {}; {}; {}+", ionMz, ionRt/60.0, ionApexIntensity , ionCharge); + + } + } else { + metric.incr("mono isotopic feature detected"); + } + + + metric.addValue("correct prediction intensity distribution", ionApexIntensity); + } + + } else { + notFound.add(ions.get(k)); + logger.warn("no peakel found for {}, {}, {}, {}+", k, ionMz, ionRt / 60.0, ionCharge); + } + } + } + + logger.info("Found {} matches over {}", matchingCount, ions.size()); + logger.info("Distinct features matched :: {}", matchedFeatures.stream().map(p -> p.getRight()).distinct().count()); + + List featureList = matchedFeatures.stream().map(p -> p.getRight()).collect(Collectors.toList()); + List duplicates = featureList.stream().filter(i -> Collections.frequency(featureList, i) > 1).collect(Collectors.toList()); + + logger.info("incorrect predictions:: "); + logger.info(metric.toString()); + logger.info("Not found summary :: {}", notFound.size()); + + Map> result = matchedFeatures.stream().map(p -> p.getRight()).collect(Collectors.groupingBy(IFeature::getPeakelsCount, Collectors.toList())); + for (Map.Entry> e : result.entrySet()) { + logger.info("matched Features with {} peakels: {} or {} distinct", e.getKey(), e.getValue().size(), e.getValue().stream().distinct().count()); + } + + Map> map = new HashMap<>(); + map.put(PeakelsHelper.VALID_FEATURES, featureList); + m_viewersController.displayFeatures(map); + + + // dump peakels stats of matched features +// for (IFeature f : featureList) { +// for (Peakel p : f.getPeakels()) { +// double[] mzValues = p.mzValues(); +// double standardDeviation = new DescriptiveStatistics(mzValues).getStandardDeviation(); +// double delta = 1e6*(p.getApexMz() - p.calcWeightedMz())/p.getApexMz(); +// logger.info("matched peakel: {}; {}; {}; {}; {}", p.getMz(), p.getElutionTime()/60.0, p.getApexIntensity(), delta, 1e6 * standardDeviation / p.getMz()); +// } +// } + } + + protected void testPrediction(float psmRt, PeakelsHelper helper, Peakel peakel, float tolRt, double moztol, double tolDa, int expectedCharge, Metric metric, String prefix) { + if ((psmRt >= peakel.getFirstElutionTime()) && (psmRt <= peakel.getLastElutionTime())) { + + //logger.info("Trying to predict monoisotope & charge from rt={} instead of {} ...", psmRt/60.0, peakel.getElutionTime()/60.0); + List coelutingPeakels = helper.findCoelutingPeakels(peakel.getApexMz() - helper.HALF_MZ_WINDOW, + peakel.getApexMz() + helper.HALF_MZ_WINDOW, + psmRt - tolRt, + psmRt + tolRt); + + // search for the spectrumId corresponding to the psm RT + int idx = java.util.Arrays.binarySearch(peakel.getElutionTimes(), psmRt); + idx = (idx < 0) ? ~idx : idx; + // build spectrum from the spectrumId + Tuple2, ArrayBuffer> pairs = PeakelsPatternPredictor.slicePeakels(JavaConverters.asScalaBufferConverter(coelutingPeakels).asScala(), peakel.getSpectrumIds()[idx], 1); + List objectList = JavaConverters.bufferAsJavaListConverter(pairs._1).asJava(); + double[] mzList = new double[objectList.size()]; + int j = 0; + for(Object o: objectList) { + mzList[j++] = ((Double)o).doubleValue(); + } + + objectList = JavaConverters.bufferAsJavaListConverter(pairs._2).asJava(); + float[] intensitiesList = new float[objectList.size()]; + j = 0; + for(Object o: objectList) { + intensitiesList[j++] = ((Float)o).floatValue(); + } + SpectrumData spectrum = new SpectrumData(mzList, intensitiesList); + TheoreticalIsotopePattern pattern = IsotopicPatternUtils.predictIsotopicPattern(spectrum, peakel.getMz(), moztol)._2; + if ((pattern.charge() != expectedCharge) || (Math.abs(pattern.monoMz() - peakel.getMz()) > tolDa)) { + metric.incr(prefix+" incorrect prediction"); + } else { + metric.incr(prefix +" prediction rescued"); + } + } else { + metric.incr(prefix+" best psm outside peakel bounds"); + } + + } protected JToolBar initToolbar() { JToolBar toolbar = super.initToolbar(); JButton buildSpectrumBtn = new JButton(); - buildSpectrumBtn.setIcon(IconManager.getIcon(IconManager.IconType.SIGNAL)); + buildSpectrumBtn.setIcon(IconManager.getIcon(IconManager.IconType.CENTROID_SPECTRA)); buildSpectrumBtn.setToolTipText("Build Spectrum from peakels"); - buildSpectrumBtn.addActionListener(e -> buildSpectrum()); + buildSpectrumBtn.addActionListener(e -> buildSpectrumFromPeakels()); toolbar.add(buildSpectrumBtn); + JButton buildFeaturesBtn = new JButton(); + buildFeaturesBtn.setIcon(IconManager.getIcon(IconManager.IconType.ISOTOPES_PREDICTION)); + buildFeaturesBtn.setToolTipText("Deconvolute peakels to features"); + buildFeaturesBtn.addActionListener(e -> buildFeatures()); + + JButton matchIonsBtn = new JButton(); + matchIonsBtn.setIcon(IconManager.getIcon(IconManager.IconType.TABLE_IMPORT)); + matchIonsBtn.setToolTipText("Match (m/z,rt) values from a csv file..."); + matchIonsBtn.addActionListener(e -> matchCSVIons()); + + toolbar.add(matchIonsBtn); + + toolbar.add(buildFeaturesBtn); + return toolbar; } - private void buildSpectrum() { + private void buildSpectrumFromPeakels() { List peakels = getSelectedIPeakels(); Peakel peakel = peakels.get(0).getPeakel(); PeakelsHelper helper = getPeakelsHelper(); - List coelutingPeakels = helper.findCoelutigPeakels(peakel.getApexMz() - 5, - peakel.getApexMz() + 5, - peakel.getFirstElutionTime(), - peakel.getLastElutionTime()); - SpectrumData spectrumData = helper.buildSpectrumDataFromPeakels(peakel, coelutingPeakels); - Spectrum spectrum = new Spectrum(-1, peakel.getApexElutionTime(), spectrumData.getMzList(), spectrumData.getIntensityList(), 1, Spectrum.ScanType.CENTROID); - m_viewersController.getRawFileViewer(peakels.get(0).getRawFile(), true).setReferenceSpectrum(spectrum); + + RTParamDialog dialog = new RTParamDialog((Window)this.getTopLevelAncestor()); + dialog.setHelpHeaderText("The spectrum construction needs to search for co-eluting peakels.
" + + " The coelution definition is based on the following time tolerance."); + dialog.pack(); + dialog.setVisible(true); + + if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { + + List coelutingPeakels = helper.findCoelutingPeakels(peakel.getApexMz() - 5, + peakel.getApexMz() + 5, + peakel.getElutionTime() - dialog.getRTTolerance(), + peakel.getLastElutionTime() + dialog.getRTTolerance()); + SpectrumData spectrumData = helper.buildSpectrumFromPeakels(coelutingPeakels, peakel); + + logger.info(Arrays.toString(spectrumData.getMzList())); + logger.info(Arrays.toString(spectrumData.getIntensityList())); + + Spectrum spectrum = new Spectrum(-1, peakel.getElutionTime(), spectrumData.getMzList(), spectrumData.getIntensityList(), 1, Spectrum.ScanType.CENTROID); + m_viewersController.getRawFileViewer(peakels.get(0).getRawFile(), true).setReferenceSpectrum(spectrum); + } + } + + private void buildFeatures() { + + RTParamDialog dialog = new RTParamDialog(null); + dialog.setHelpHeaderText("The feature detection (especially charge state detection) needs to
" + + "group co-eluting peakels. The coelution definition is based on the following
" + + "time tolerance."); + dialog.pack(); + dialog.setVisible(true); + + if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { + try { + + PeakelsHelper helper = getPeakelsHelper(); + Map> features = helper.deisotopePeakels(MzScopePreferences.getInstance().getMzPPMTolerance(), dialog.getRTTolerance()); + Map> wrappedFeatures = new HashMap<>(); + IRawFile rawFile = m_peakels.get(0).getRawFile(); + + for(Map.Entry> e : features.entrySet()) { + List listIFeatures = new ArrayList<>(e.getValue().size()); + e.getValue().forEach(f -> listIFeatures.add(new MzdbFeatureWrapper(f, rawFile, 1))); + wrappedFeatures.put(e.getKey(), listIFeatures); + } + + m_viewersController.displayFeatures(wrappedFeatures); + + } catch (StreamCorruptedException ex) { + Exceptions.printStackTrace(ex); + } catch (SQLiteException ex) { + Exceptions.printStackTrace(ex); + } + } } private PeakelsHelper getPeakelsHelper() { diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/PeakelsTableModel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/PeakelsTableModel.java index 98f943783..58caaeb63 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/PeakelsTableModel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/ui/peakels/PeakelsTableModel.java @@ -9,10 +9,13 @@ import fr.proline.studio.table.TableDefaultRendererManager; import fr.proline.studio.table.renderer.BigFloatOrDoubleRenderer; import fr.proline.studio.table.renderer.DefaultRightAlignRenderer; +import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; import javax.swing.table.TableCellRenderer; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class PeakelsTableModel extends AbstractNonLazyTableModel implements GlobalTableModelInterface { @@ -25,8 +28,10 @@ public class PeakelsTableModel extends AbstractNonLazyTableModel implements Glob public static final Column COLTYPE_FEATURE_AREA_COL = new Column("Area", "Area", Double.class,4, BIG_FLOAT); public static final Column COLTYPE_FEATURE_SCAN_COUNT_COL = new Column("MS Count", "MS Count", Integer.class, 5); public static final Column COLTYPE_FEATURE_RAWFILE = new Column("Raw file", "Raw File Name", String.class,6, Column.STRING_LEFT); + public static final Column COLTYPE_FEATURE_MZ_STDEV = new Column("mz Stdev", "m/z standard deviation", Double.class,7, Column.DOUBLE_5DIGITS_RIGHT); protected List m_peakels = new ArrayList<>(); + protected Map m_statistics = new HashMap<>(); @Override public int[] getKeysColumn() { @@ -71,11 +76,26 @@ public Object getValueAt(int rowIndex, int columnIndex) { return m_peakels.get(rowIndex).getScanCount(); } else if (columnIndex == COLTYPE_FEATURE_RAWFILE.getIndex()) { return m_peakels.get(rowIndex).getRawFile().getName(); + } else if (columnIndex == COLTYPE_FEATURE_MZ_STDEV.getIndex()) { + return m_statistics.get(rowIndex); } return null; // should not happen } + private Double getMzStats(int row, IPeakel iPeakel) { + if (!m_statistics.containsKey(row)) { + if (iPeakel.getPeakel() != null) { + double[] mzValues = iPeakel.getPeakel().mzValues(); + double standardDeviation = new DescriptiveStatistics(mzValues).getStandardDeviation(); + m_statistics.put(row, 1e6 * standardDeviation / iPeakel.getMz()); + } else { + return 0.0; + } + } + return m_statistics.get(row); + } + @Override public Object getValue(Class c) { return getSingleValue(c); @@ -95,13 +115,22 @@ public Object getColValue(Class c, int col) { } public void setPeakels(List peakels) { + m_statistics.clear(); m_peakels.clear(); m_peakels.addAll(peakels); + int row = 0; + for(IPeakel p : m_peakels) { + getMzStats(row++, p); + } fireTableDataChanged(); } public void addPeakels(List features) { + int row = m_peakels.size()-1; m_peakels.addAll(features); + for(IPeakel p : features) { + getMzStats(row++, p); + } fireTableDataChanged(); } diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/Base64.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/Base64.java index 9420ca136..bf34a9ae7 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/Base64.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/Base64.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.utils; import java.util.Arrays; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/BinarySearch.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/BinarySearch.java index d153acc80..db23c61f9 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/BinarySearch.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/BinarySearch.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.utils; public class BinarySearch { diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/ButtonTabComponent.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/ButtonTabComponent.java index 1ac846abf..952515540 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/ButtonTabComponent.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/ButtonTabComponent.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.utils; import fr.proline.studio.utils.IconManager; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/Display.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/Display.java index d524d8a61..4a7133648 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/Display.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/Display.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.utils; import fr.proline.studio.graphics.marker.AbstractMarker; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/IPopupMenuDelegate.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/IPopupMenuDelegate.java index 82ecb523e..756db1005 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/IPopupMenuDelegate.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/IPopupMenuDelegate.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.utils; import java.awt.event.ActionListener; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/KeyEventDispatcherDecorator.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/KeyEventDispatcherDecorator.java index 0f4e8208b..016c0b79b 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/KeyEventDispatcherDecorator.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/KeyEventDispatcherDecorator.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.utils; import java.awt.KeyEventDispatcher; diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/MzScopeCallback.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/MzScopeCallback.java index e2f4e06cc..e0a313c4b 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/MzScopeCallback.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/MzScopeCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,14 +14,14 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.mzscope.utils; - -/** - * - * @author CB205360 - */ -public interface MzScopeCallback { - - public void callback(boolean success); - -} +package fr.proline.mzscope.utils; + +/** + * + * @author CB205360 + */ +public interface MzScopeCallback { + + public void callback(boolean success); + +} diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/ObjectInspectorPanel.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/ObjectInspectorPanel.java index 4651b6d57..8b16944dc 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/ObjectInspectorPanel.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/ObjectInspectorPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.utils; /* diff --git a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/OutputUtils.java b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/OutputUtils.java index cf44e7c2d..5b94f4d1d 100644 --- a/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/OutputUtils.java +++ b/prolinestudio-mzscope/src/main/java/fr/proline/mzscope/utils/OutputUtils.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.utils; public class OutputUtils { diff --git a/prolinestudio-mzscope/src/test/java/fr/proline/mzscope/map/LcMsViewerApp.java b/prolinestudio-mzscope/src/test/java/fr/proline/mzscope/map/LcMsViewerApp.java index ac79816e4..b8cb436e5 100644 --- a/prolinestudio-mzscope/src/test/java/fr/proline/mzscope/map/LcMsViewerApp.java +++ b/prolinestudio-mzscope/src/test/java/fr/proline/mzscope/map/LcMsViewerApp.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.mzscope.map; import java.awt.BorderLayout; diff --git a/prolinestudio-resultexplorer/pom.xml b/prolinestudio-resultexplorer/pom.xml index cd2243e78..bc74726e8 100644 --- a/prolinestudio-resultexplorer/pom.xml +++ b/prolinestudio-resultexplorer/pom.xml @@ -5,277 +5,37 @@ prolinestudio-parent fr.proline - 2.1.2 + 2.2.0 fr.proline prolinestudio-resultexplorer - nbm + jar - ProlineStudio-ResultExplorer + prolinestudio + ${project.basedir}/src/main/resources/assembly.xml UTF-8 + 1.0.392 + ${project.build.directory}/sqlite4java - - - - nexus-ebi-release-repo - http://www.ebi.ac.uk/Tools/maven/repos/content/groups/ebi-repo/ - - - nexus-ebi-snapshot-repo - http://www.ebi.ac.uk/Tools/maven/repos/content/groups/ebi-snapshots/ - - + + + + + + + + + + + - - - org.netbeans.api - org-netbeans-api-annotations-common - ${netbeans.version} - - - org.netbeans.api - org-openide-windows - ${netbeans.version} - - - org.netbeans.api - org-openide-util - ${netbeans.version} - - - org.netbeans.api - org-openide-util-lookup - ${netbeans.version} - - - - org.netbeans.api - org-netbeans-modules-nbjunit - ${netbeans.version} - test - - - org.netbeans.api - org-openide-awt - ${netbeans.version} - - - org.netbeans.api - org-netbeans-modules-settings - ${netbeans.version} - - - org.netbeans.modules - org-netbeans-modules-db-core - ${netbeans.version} - nbm-file - - - org.netbeans.modules - org-netbeans-modules-dbapi - ${netbeans.version} - nbm-file - - - org.netbeans.modules - org-netbeans-modules-db-metadata-model - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-openide-nodes - ${netbeans.version} - nbm - - - org.netbeans.modules - org-netbeans-modules-db-drivers - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-openide-explorer - ${netbeans.version} - nbm - - - org.netbeans.modules - org-netbeans-modules-db-sql-editor - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-openide-dialogs - ${netbeans.version} - nbm - - - org.netbeans.modules - org-netbeans-modules-db-dataview - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-openide-modules - ${netbeans.version} - jar - - - - org.netbeans.api - org-netbeans-core-ide - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-netbeans-modules-project-libraries - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-netbeans-modules-projectapi - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-netbeans-modules-projectuiapi - ${netbeans.version} - nbm-file - - - org.netbeans.modules - org-netbeans-modules-projectui - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-openidex-util - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-netbeans-modules-editor - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-netbeans-modules-editor-completion - ${netbeans.version} - nbm-file - - - org.netbeans.modules - org-netbeans-modules-editor-actions - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-netbeans-modules-editor-deprecated-pre65formatting - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-netbeans-modules-editor-lib - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-netbeans-modules-editor-lib2 - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-netbeans-modules-editor-indent - ${netbeans.version} - nbm-file - - - org.netbeans.modules - org-netbeans-modules-editor-settings-storage - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-netbeans-modules-editor-settings - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-netbeans-modules-editor-util - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-netbeans-modules-editor-fold - ${netbeans.version} - nbm-file - - - org.netbeans.api - org-netbeans-modules-lexer - ${netbeans.version} - nbm-file - - - org.netbeans.modules - org-netbeans-libs-swingx - ${netbeans.version} - nbm-file - - - - - org.netbeans.modules - org-netbeans-modules-project-indexingbridge - ${netbeans.version} - nbm-file - - - org.netbeans.modules - org-netbeans-modules-editor-fold-nbui - ${netbeans.version} - nbm-file - - - - org.netbeans.api - org-netbeans-modules-csl-api - ${netbeans.version} - - - - org.netbeans.api - org-netbeans-modules-editor-bracesmatching - ${netbeans.version} - - - - commons-io - commons-io - 2.5 - + + @@ -297,6 +57,7 @@ ${project.groupId} prolinestudio-logger ${project.version} + pom fr.proline @@ -356,18 +117,35 @@ xml-apis xml-apis 1.4.01 - - + + + + org.postgresql + postgresql + + + + org.hibernate + hibernate-entitymanager + + org.hibernate.javax.persistence hibernate-jpa-2.1-api 1.0.0.Final - + + + + org.hibernate + hibernate-core + ${hibernate.version} + + org.python jython @@ -382,19 +160,7 @@ org.apache.commons commons-math3 - + org.apache.httpcomponents httpclient @@ -413,52 +179,6 @@ 3.4.13-EDyP - - - - io.netty - netty-all - 4.1.42.Final - - - - sape.inf.usi.ch @@ -479,56 +199,134 @@ fr.proline log-parser - 2.1.2 + 2.2.0 jar + - - org.codehaus.mojo - nbm-maven-plugin - - true - - - fr.proline.studio.rsmexplorer - - - - com.google.code.maven-replacer-plugin replacer + + + + org.apache.maven.plugins + maven-dependency-plugin - generate-sources + copy + compile - replace + copy + + + + + com.almworks.sqlite4java + sqlite4java-win32-x64 + ${sqlite4java.version} + dll + true + ${sqlite4java.library.path} + + + + com.almworks.sqlite4java + libsqlite4java-linux-amd64 + ${sqlite4java.version} + so + true + ${sqlite4java.library.path} + + + + + + copy-dependencies + package + + copy-dependencies + + + jar + ${project.build.directory}/lib + true + + + + + + + maven-resources-plugin + + + + + copy-scripts + validate + + copy-resources + + + UTF-8 + ${project.build.directory} + + + src/main/resources + true + + *.bat + + + + + + + + + + + + maven-assembly-plugin + - ${basedir}/src/main/resources/fr/proline/studio/installer/VersionInstaller.java.template - ${basedir}/src/main/java/fr/proline/studio/installer/VersionInstaller.java - - - @build.date@ - ${maven.build.timestamp}_${user.name} - - - @version@ - ${project.version} - - + ${project.name} + + ${assembly.file.path} + + false - + + + + full + + + true + + + ${java.home.dir} + + + + standalone + + + + + + diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/installer/Installer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/installer/Installer.java deleted file mode 100644 index c52de1bff..000000000 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/installer/Installer.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.installer; - - - -import fr.proline.studio.dam.taskinfo.TaskInfoManager; -import fr.proline.studio.dpm.ServerConnectionManager; -import fr.proline.studio.dpm.task.util.JMSConnectionManager; -import fr.proline.studio.gui.InfoDialog; -import fr.proline.studio.gui.OptionDialog; -import fr.proline.studio.rserver.RServerManager; -import java.awt.Frame; -import java.io.File; -import java.io.IOException; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import org.apache.commons.io.FileUtils; -import org.openide.windows.WindowManager; - -/** - * 1- Used to connect to web-core and UDS database as soon as possible - * - * 2- Used to check when the user wants to close the application - * - * @author jm235353 - */ -public class Installer extends VersionInstaller { - - @Override - public void restored() { - - //Clear cache in case installation folder has been renamed - String s = System.getProperty("netbeans.user"); - StringBuilder sb = new StringBuilder(s); - if(s != null && !s.isEmpty()){ - sb.append(File.separator).append("/var/cache"); - } - File f = new File(sb.toString()); - - try { - boolean clean =false; - if(f.exists() && f.isDirectory()){ - FileUtils.cleanDirectory(f); - clean = true; - } - } catch (IOException ex) { - - } - - // for Mac : we need to use Metal UI, otherwise the browse file on server does not work - forceMetalUIForMac(); - - //VDS: module version should be release or SNAPSHOT - // if release => keep vesion number only - // if SNAPSHOT => add Milestone + build date - String productVersion = moduleVersion; - int snapIndex = moduleVersion.toLowerCase().indexOf("-snapshot"); - boolean isSnapshot = snapIndex > 0; - if(snapIndex > 0) - productVersion = moduleVersion.substring(0, snapIndex); -// int firstIndex = moduleVersion.indexOf('.'); -// int secIndex = moduleVersion.length(); -// int thirdIndex = -1; -// if(firstIndex >0) -// secIndex = moduleVersion.indexOf('.', firstIndex+1); -// if(secIndex>0) -// productVersion = moduleVersion.substring(0, secIndex); - - //Hardcoded # of Milestone ! - String buildnumber = isSnapshot ? productVersion+" Milestone 2 ("+moduleBuildDate+")" : productVersion; //specify if Milestone, Release Candidate or release (or nothing = release) - - // set the proline version for the application title - System.setProperty("netbeans.buildnumber", buildnumber); //"1.0.1 (alpha : build date @build.date@)" - - // initialize the connection to the server as soon as possible - ServerConnectionManager.getServerConnectionManager(); - - } - - private void forceMetalUIForMac() { - String OS = System.getProperty("os.name").toLowerCase(); - if (OS.contains("mac")) { - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - try { - UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); - Frame f = WindowManager.getDefault().getMainWindow(); - if (f == null) { - // should never be null - forceMetalUIForMac(); - } else { - SwingUtilities.updateComponentTreeUI(f); - } - } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException e) { - e.printStackTrace(); - } - - } - - }); - } - } - - @Override - public boolean closing() { - - // check if there is tasks being done which ask not to close the application - if (TaskInfoManager.getTaskInfoManager().askBeforeExitingApp()) { - InfoDialog exitDialog = new InfoDialog(WindowManager.getDefault().getMainWindow(), InfoDialog.InfoType.WARNING, "Warning", "You should not exit. Important tasks are being done.\nAre you sure you want to exit ?"); - exitDialog.setButtonName(OptionDialog.BUTTON_OK, "Yes"); - exitDialog.setButtonName(OptionDialog.BUTTON_CANCEL, "No"); - exitDialog.centerToWindow(WindowManager.getDefault().getMainWindow()); - exitDialog.setVisible(true); - - if (exitDialog.getButtonClicked() == OptionDialog.BUTTON_CANCEL) { - // No clicked - return false; - } - - } - - // Close connection to R Server and kill it if needed - RServerManager.getRServerManager().stopRProcess(); - - //Close connection to JMS Server if needed - JMSConnectionManager.getJMSConnectionManager().closeConnection(); - - return true; - } -} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/installer/VersionInstaller.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/installer/VersionInstaller.java deleted file mode 100644 index 55e28626b..000000000 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/installer/VersionInstaller.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package fr.proline.studio.installer; - -import org.openide.modules.ModuleInstall; - -//Do not commit java file (only template!) -/** - * Class generated from template. Do not edit ! - * - * @author VD225637 - */ -public class VersionInstaller extends ModuleInstall{ - - public final String moduleVersion = "2.1.0"; - public final String moduleBuildDate = "2021-01-12T14:03:19Z_VD225637"; -} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/main/Main.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/main/Main.java new file mode 100644 index 000000000..ae522f0cb --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/main/Main.java @@ -0,0 +1,230 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.main; + + + +import fr.proline.studio.NbPreferences; +import fr.proline.studio.dpm.ServerConnectionManager; +import fr.proline.studio.rsmexplorer.MainFrame; +import fr.proline.studio.rsmexplorer.SplashScreenWindow; +import fr.proline.studio.WindowManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +import javax.swing.*; +import java.awt.*; + +public class Main { + + + protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); + + + public static void main(String[] args) { + + // Only one parameter is taken in account : + // --userdir dirParam : to specify where the Preferences.properties is saved + String userPath = null; + boolean nextIsuserDirPath = false; + for (String arg : args) { + if (arg.compareToIgnoreCase("--userdir") == 0) { + nextIsuserDirPath = true; + } else if (nextIsuserDirPath) { + userPath = arg; + break; + } else { + m_logger.warn("Application Parameter has not been recognized: " + arg); + } + + } + if (userPath != null) { + NbPreferences.initPreferences(userPath); + } + + + + try { + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + + SplashScreenWindow splashScreen = new SplashScreenWindow(); + splashScreen.setVisible(true); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + + + JFrame frame = MainFrame.getInstance(); + + initTheme(); + + + + frame.setVisible(true); + frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH); + + splashScreen.setVisible(false); + } + }); + + + + + } + }); + } catch (Exception e) { + + } + } + + + private static void initTheme() { + // for Mac : we need to use Metal UI, otherwise the browse file on server does not work + setUI(); + + + // initialize the connection to the server as soon as possible + ServerConnectionManager.getServerConnectionManager(); + } + + + private static void setUI() { + final String OS = System.getProperty("os.name").toLowerCase(); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + try { + + if (isMacOS(OS) || isUnixOS(OS)) { + UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + } else if (OS.contains("win")) { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } + + MainFrame frame = MainFrame.getInstance(); + SwingUtilities.updateComponentTreeUI(frame); + + } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException e) { + // should never happen + m_logger.error("Setting look and feel failed", e); + } + + } + + }); + } + + private static boolean isMacOS(String os) { + return (os.contains("mac")); + } + private static boolean isUnixOS(String os) { + return (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0 || os.indexOf("aix") > 0 ); + } + + } + + + /* + private static String[] parseJMSServerURL(String serverURL) { + String[] hostAndPort = new String[2]; + + String parsedURL = serverURL; + int portSep = parsedURL.indexOf(":"); + if (portSep > 0) { + hostAndPort[0] = parsedURL.substring(0, portSep); + hostAndPort[1] = parsedURL.substring(portSep + 1); + } else { + hostAndPort[0] = parsedURL; + } + + return hostAndPort; + }*/ + +//JPM.DOCK.TEST +//TEST JMS +/* + + try { + String[] jmsHostAndPort = parseJMSServerURL("localhost"); + JMSConnectionManager.getJMSConnectionManager().setJMSServerHost(jmsHostAndPort[0]); + if (jmsHostAndPort[1] != null) { + JMSConnectionManager.getJMSConnectionManager().setJMSServerPort(Integer.parseInt(jmsHostAndPort[1])); + } + //Try to connect to server + JMSConnectionManager.getJMSConnectionManager().getJMSConnection(); + } catch (Exception e) { + } + + + final HashMap databaseProperties = new HashMap<>(); + final String[] databasePassword = new String[1]; + databasePassword[0] = ""; + + AbstractJMSCallback callback = new AbstractJMSCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success) { + if (success) { + + String password = databasePassword[0]; + + GetDBConnectionTemplateTask task = new GetDBConnectionTemplateTask(null, password, databaseProperties); + AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); + + + } else { + System.err.println("ERREUR"); + } + } + }; + + + int count =30; + while(count>0) { + + + + AuthenticateUserTask task = new AuthenticateUserTask(callback, "menetrey", "proline", databasePassword); + AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); + + try { + Thread.sleep(10); + } catch (Exception e) { + e.printStackTrace(); + } +count--; + } + + try { + Thread.sleep(1000); + } catch (Exception e) { + e.printStackTrace(); + }*/ + diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/AddWorkingSetDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/AddWorkingSetDialog.java index 70036ca05..aaed3344a 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/AddWorkingSetDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/AddWorkingSetDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/AddlWorkingSetEntryDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/AddlWorkingSetEntryDialog.java index e3773d180..d441d0fb8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/AddlWorkingSetEntryDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/AddlWorkingSetEntryDialog.java @@ -1,21 +1,22 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; +import fr.proline.studio.NbPreferences; import fr.proline.studio.dam.DatabaseDataManager; import fr.proline.studio.dpm.serverfilesystem.ServerFile; import fr.proline.studio.dpm.serverfilesystem.ServerFileSystemView; @@ -44,7 +45,6 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.filechooser.FileNameExtensionFilter; -import org.openide.util.NbPreferences; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/ConversionSettings.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/ConversionSettings.java index 7457f1b58..f8ab94c39 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/ConversionSettings.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/ConversionSettings.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; /** @@ -25,12 +25,14 @@ public class ConversionSettings { private final String m_converterPath, m_outputPath; private final boolean m_deleteRaw, m_uploadAfterConversion; private MzdbUploadSettings m_uploadSettings; - - public ConversionSettings(String converterPath, String outputPath, boolean deleteRaw, boolean uploadAfterConversion){ + private boolean m_isVersion1_1; + + public ConversionSettings(String converterPath, String outputPath, boolean deleteRaw, boolean uploadAfterConversion, boolean isVersion1_1){ m_converterPath = converterPath; m_outputPath = outputPath; m_deleteRaw = deleteRaw; m_uploadAfterConversion = uploadAfterConversion; + m_isVersion1_1 = isVersion1_1; } public String getConverterPath(){ @@ -48,6 +50,10 @@ public boolean getDeleteRaw(){ public boolean getUploadAfterConversion(){ return m_uploadAfterConversion; } + + public boolean isVersion1_1(){ + return m_isVersion1_1; + } public void setUploadSettings(MzdbUploadSettings settings){ m_uploadSettings = settings; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/ConvertionUploadBatch.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/ConvertionUploadBatch.java index d9203646a..a41547dec 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/ConvertionUploadBatch.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/ConvertionUploadBatch.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,7 +16,8 @@ */ package fr.proline.studio.msfiles; -import fr.proline.studio.rsmexplorer.MzdbFilesTopComponent; +import fr.proline.studio.rsmexplorer.MzdbFilesTopPanel; + import java.io.File; import java.util.ArrayList; import java.util.HashMap; @@ -74,6 +75,7 @@ public void run() { if (m_pathToExpand == null) { Iterator it = m_conversions.entrySet().iterator(); + String mountingPointPath = null; while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); ConversionSettings settings = (ConversionSettings) pair.getValue(); @@ -85,19 +87,16 @@ public void run() { m_parentDirectories.add(settings.getUploadSettings().getDestination()); } } + if (settings.getUploadSettings() != null && mountingPointPath==null) + mountingPointPath = settings.getUploadSettings().getMountingPointPath(); } - - MzdbUploadSettings uploadSettings = m_conversions.values().iterator().next().getUploadSettings(); - if (uploadSettings != null) { - MzdbFilesTopComponent.getExplorer().getTreeFileChooserPanel().expandMultipleTreePath(m_parentDirectories, uploadSettings.getMountingPointPath()); - MzdbFilesTopComponent.getExplorer().getTreeFileChooserPanel().updateTree(); - } + if(mountingPointPath != null) + MzdbFilesTopPanel.getExplorer().getTreeFileChooserPanel().expandMultipleTreePath(m_parentDirectories, mountingPointPath); } else { - MzdbFilesTopComponent.getExplorer().getTreeFileChooserPanel().expandTreePath(m_pathToExpand); - MzdbFilesTopComponent.getExplorer().getTreeFileChooserPanel().updateTree(); + MzdbFilesTopPanel.getExplorer().getTreeFileChooserPanel().expandTreePath(m_pathToExpand); } - + MzdbFilesTopPanel.getExplorer().getTreeFileChooserPanel().updateTree(); Iterator it = m_conversions.entrySet().iterator(); while (it.hasNext()) { @@ -118,7 +117,7 @@ public void conversionPerformed(ArrayList list) { if (p.wasSuccessful()) { if (p.getConversionSettings() != null && p.getConversionSettings().getUploadSettings() != null) { - MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().updateTree(); + MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().updateTree(); upload(p.getFile(), p.getConversionSettings().getUploadSettings()); } } @@ -142,7 +141,7 @@ public void uploadPerformed(ArrayList list) { } if (success) { - MzdbFilesTopComponent.getExplorer().getTreeFileChooserPanel().updateTree(); + MzdbFilesTopPanel.getExplorer().getTreeFileChooserPanel().updateTree(); } } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/DatUploadBatch.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/DatUploadBatch.java index d491dbf96..b8f23614b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/DatUploadBatch.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/DatUploadBatch.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import java.io.File; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/ExportMgfDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/ExportMgfDialog.java index 2524c5457..f9dcc00a9 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/ExportMgfDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/ExportMgfDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.profi.mzdb.io.writer.mgf.DefaultPrecursorComputer; @@ -65,7 +65,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.filechooser.FileNameExtensionFilter; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileDeletionBatch.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileDeletionBatch.java index 68d16ec84..ea562642c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileDeletionBatch.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileDeletionBatch.java @@ -1,25 +1,26 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.rsmexplorer.MzdbFilesTopComponent; +import fr.proline.studio.rsmexplorer.MzdbFilesTopPanel; + import java.io.File; import java.util.ArrayList; @@ -48,7 +49,7 @@ public boolean mustBeCalledInAWT() { @Override public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().updateTree(); + MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().updateTree(); } }; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileDeletionTask.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileDeletionTask.java index 50ac2d110..caebdc090 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileDeletionTask.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileDeletionTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.studio.dam.taskinfo.TaskError; @@ -23,7 +23,7 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; -import org.openide.util.Exceptions; +import fr.proline.studio.Exceptions; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileToTransfer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileToTransfer.java index 81aef521d..8229c9ef3 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileToTransfer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileToTransfer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileUtility.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileUtility.java index 578705f97..cc56a59b0 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileUtility.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/FileUtility.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import java.io.File; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/LocalFileSystemFile.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/LocalFileSystemFile.java index 09daf0eda..1fec4afc4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/LocalFileSystemFile.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/LocalFileSystemFile.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import java.io.File; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExportBatch.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExportBatch.java index 388ea4c97..b26943718 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExportBatch.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExportBatch.java @@ -1,25 +1,26 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.rsmexplorer.MzdbFilesTopComponent; +import fr.proline.studio.rsmexplorer.MzdbFilesTopPanel; + import java.io.File; import java.util.HashMap; import java.util.HashSet; @@ -58,8 +59,8 @@ public void run() { outputDirectory = outputDirectory.getParentFile(); } - MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().expandMultipleTreePath(m_parentDirectories); - MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().updateTree(); + MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().expandMultipleTreePath(m_parentDirectories); + MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().updateTree(); } @@ -106,7 +107,7 @@ public boolean mustBeCalledInAWT() { @Override public void run(boolean success, long taskId, SubTask subTask, boolean finished) { if (success) { - MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().updateTree(); + MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().updateTree(); } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExportSettings.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExportSettings.java index 8554ea5aa..f65892de4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExportSettings.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExportSettings.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.mzscope.ui.MgfExportParameters; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExportTask.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExportTask.java index a9b67b731..b21c1f381 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExportTask.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExportTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.mzscope.mzdb.MzdbRawFile; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExporter.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExporter.java index c24121d94..231528e5f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExporter.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MgfExporter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.studio.dam.AccessDatabaseThread; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsFilesExplorer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsFilesExplorer.java index bf994bdd7..7d12855e4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsFilesExplorer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsFilesExplorer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -17,7 +17,7 @@ package fr.proline.studio.msfiles; import fr.proline.studio.dpm.serverfilesystem.ServerFileSystemView; -import fr.proline.studio.rsmexplorer.MzdbFilesTopComponent; +import fr.proline.studio.rsmexplorer.MzdbFilesTopPanel; import fr.proline.studio.rsmexplorer.gui.LocalFileSystemTransferHandler; import fr.proline.studio.rsmexplorer.gui.LocalFileSystemView; import fr.proline.studio.rsmexplorer.gui.TreeFileChooserPanel; @@ -31,6 +31,7 @@ import java.util.ArrayList; import javax.swing.BorderFactory; import javax.swing.JPanel; +import javax.swing.JScrollPane; import javax.swing.Box; import javax.swing.JButton; import javax.swing.JOptionPane; @@ -45,7 +46,7 @@ public class MsFilesExplorer extends JPanel { private final TreeFileChooserPanel m_tree; private final TreeFileChooserTransferHandler m_transferHandler; private final LocalFileSystemView m_localFileSystemView; - + private boolean m_downAllowed = false; private boolean m_upAllowed = false; @@ -108,7 +109,7 @@ public class TransferFileButtonsPanel extends JPanel implements FileSelectionInt private ArrayList m_filesDown = null; private ArrayList m_directoriesDown = null; private ArrayList m_parentDirectoriesDown = null; - + public TransferFileButtonsPanel() { setLayout(new GridBagLayout()); @@ -147,7 +148,7 @@ public TransferFileButtonsPanel() { m_upButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - + if (m_filesDown == null) { JOptionPane.showMessageDialog(m_upButton, "You must select from the Proline Server File System to download them to the Local File System.", "Upload Error", JOptionPane.WARNING_MESSAGE); return; @@ -164,13 +165,13 @@ public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(m_upButton, "You must select a directory of the Local File System where the files will be downloaded.", "Upload Error", JOptionPane.WARNING_MESSAGE); return; } - - ArrayList fileList = new ArrayList<>(); + + ArrayList fileList = new ArrayList<>(); for (FileToTransfer f : m_filesDown) { fileList.add(f.getFile()); } TreePath path = (!m_parentDirectoriesUp.isEmpty()) ? m_parentDirectoriesUp.get(0).getPath() : m_directoriesUp.get(0).getPath(); - MzdbDownloadBatch downloadBatch = new MzdbDownloadBatch(fileList, path, MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().getSelectedRoot()); + MzdbDownloadBatch downloadBatch = new MzdbDownloadBatch(fileList, path, MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().getSelectedRoot()); Thread downloadThread = new Thread(downloadBatch); downloadThread.start(); } @@ -197,8 +198,8 @@ public void actionPerformed(ActionEvent e) { return; } - - ArrayList fileList = new ArrayList<>(); + + ArrayList fileList = new ArrayList<>(); for (FileToTransfer f : m_filesUp) { fileList.add(f.getFile()); } @@ -224,7 +225,7 @@ public void downSelectionChanged(ArrayList files, ArrayList. - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import java.util.ArrayList; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerConverterParameter.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerConverterParameter.java index 6288e92da..a26f47166 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerConverterParameter.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerConverterParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import java.io.File; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerDownloadParameter.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerDownloadParameter.java index 364a257cb..107884551 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerDownloadParameter.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerDownloadParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import java.io.File; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerEntryUpdateParameter.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerEntryUpdateParameter.java index be3d1e801..8c642ec3e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerEntryUpdateParameter.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerEntryUpdateParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import java.io.File; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerParameter.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerParameter.java index 08fc3e5bc..e292730fb 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerParameter.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MsListenerParameter.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import java.io.File; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbDownloadBatch.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbDownloadBatch.java index 355ba6a2b..017b647c8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbDownloadBatch.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbDownloadBatch.java @@ -1,204 +1,203 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.msfiles; - -import fr.proline.studio.dpm.AccessJMSManagerThread; -import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; -import fr.proline.studio.dpm.task.jms.DownloadFileTask; -import fr.proline.studio.rsmexplorer.MzdbFilesTopComponent; -import java.io.File; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import javax.swing.tree.TreePath; - -/** - * - * @author AK249877 - */ -public class MzdbDownloadBatch implements Runnable { - - private TreePath m_pathToExpand; - private final String m_localURL; - private ArrayList m_files; - private ArrayList m_entries; - private final String m_root; - private MsListener m_listener; - private ArrayList m_downloadList; - private File m_localFile; - - public MzdbDownloadBatch(ArrayList files, TreePath pathToExpand, String root) { - m_files = files; - m_pathToExpand = pathToExpand; - m_root = root; - - m_downloadList = new ArrayList<>(); - - StringBuilder temp = new StringBuilder(); - - Object elements[] = pathToExpand.getPath(); - for (int i = 0, n = elements.length; i < n; i++) { - temp.append(elements[i]).append("\\"); - } - - m_localURL = temp.toString(); - } - - public MzdbDownloadBatch(String localURL, String root, ArrayList entries) { - m_entries = entries; - m_root = root; - m_localURL = localURL; - m_downloadList = new ArrayList(); - } - - public void addMsListener(MsListener listener) { - m_listener = listener; - } - - private void downloadFile(File remoteFile) { - - AbstractJMSCallback callback = new AbstractJMSCallback() { - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success) { - - if (success) { - if (m_pathToExpand != null) { - MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().updateTree(); - } - m_downloadList.add(new MsListenerDownloadParameter(m_localFile, remoteFile, true)); - } else { - m_downloadList.add(new MsListenerDownloadParameter(m_localFile, remoteFile, false)); - } - - if (m_listener != null) { - if (m_downloadList.size() == m_files.size()) { - m_listener.downloadPerformed(m_downloadList); - } - } - } - }; - - String destinationDirectory = m_root + m_localURL; - - String filename = remoteFile.getName(); - String url = destinationDirectory + File.separatorChar + filename; - - m_localFile = new File(url); - while (m_localFile.exists()) { - int lastIndexOfDot = url.lastIndexOf("."); - if (lastIndexOfDot != -1) { - url = url.substring(0, lastIndexOfDot) + " - Copie"+url.substring(lastIndexOfDot, url.length()); - } else { - url = url + " - Copie"; - } - - m_localFile = new File(url); - } - - - /*boolean isMzdbFile = remoteFile.getAbsolutePath().toLowerCase().endsWith(".mzdb"); - if (isMzdbFile) {*/ - DownloadFileTask task = new DownloadFileTask(callback, remoteFile.getAbsolutePath(), m_localFile); - AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); - /*} else { - String serverNodeId = ""; // ????? - DownloadFileTask task = new DownloadFileTask(callback, m_localFile.getAbsolutePath(), remoteFile.getAbsolutePath(), serverNodeId); - AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); - }*/ - - - } - - private void downloadEntry(WorkingSetEntry entry) { - if (entry.getFile().getAbsolutePath().toLowerCase().endsWith(".mzdb")) { - AbstractJMSCallback callback = new AbstractJMSCallback() { - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success) { - - if (success) { - if (m_pathToExpand != null) { - MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().updateTree(); - } - m_downloadList.add(new MsListenerDownloadParameter(m_localFile, entry.getFile(), true)); - } else { - m_downloadList.add(new MsListenerDownloadParameter(m_localFile, entry.getFile(), false)); - } - - if (m_listener != null) { - - ArrayList stateList = new ArrayList(); - stateList.add(new MsListenerEntryUpdateParameter(entry.getFile(), MsListenerEntryUpdateParameter.State.DOWNLOAD_COMPLETE)); - - m_listener.entryStateUpdated(stateList); - - if (m_downloadList.size() == m_entries.size()) { - m_listener.downloadPerformed(m_downloadList); - } - } - } - }; - - String destinationDirectory = m_root + m_localURL; - - String filename = entry.getFilename(); - String url = destinationDirectory+File.separatorChar+filename; - - m_localFile = new File(url); - while(m_localFile.exists()){ - url = url.substring(0, url.lastIndexOf("."))+" - Copie.mzdb"; - m_localFile = new File(url); - } - - DownloadFileTask task = new DownloadFileTask(callback, entry.getFile().getAbsolutePath(), m_localFile); - - if (m_listener != null) { - ArrayList list = new ArrayList(); - list.add(new MsListenerEntryUpdateParameter(entry.getFile(), MsListenerEntryUpdateParameter.State.START_DOWNLOADING)); - m_listener.entryStateUpdated(list); - } - - AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); - } - } - - @Override - public void run() { - if (m_pathToExpand != null) { - MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().expandTreePath(m_pathToExpand); - } - if (m_files != null) { - for (int i = 0; i < m_files.size(); i++) { - downloadFile(m_files.get(i)); - } - } else if (m_entries != null) { - for (int i = 0; i < m_entries.size(); i++) { - downloadEntry(m_entries.get(i)); - } - } - } - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.msfiles; + +import fr.proline.studio.dpm.AccessJMSManagerThread; +import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; +import fr.proline.studio.dpm.task.jms.DownloadFileTask; +import fr.proline.studio.rsmexplorer.MzdbFilesTopPanel; + +import java.io.File; +import java.util.ArrayList; +import javax.swing.tree.TreePath; + +/** + * + * @author AK249877 + */ +public class MzdbDownloadBatch implements Runnable { + + private TreePath m_pathToExpand; + private final String m_localURL; + private ArrayList m_files; + private ArrayList m_entries; + private final String m_root; + private MsListener m_listener; + private ArrayList m_downloadList; + private File m_localFile; + + public MzdbDownloadBatch(ArrayList files, TreePath pathToExpand, String root) { + m_files = files; + m_pathToExpand = pathToExpand; + m_root = root; + + m_downloadList = new ArrayList<>(); + + StringBuilder temp = new StringBuilder(); + + Object elements[] = pathToExpand.getPath(); + for (int i = 0, n = elements.length; i < n; i++) { + temp.append(elements[i]).append("\\"); + } + + m_localURL = temp.toString(); + } + + public MzdbDownloadBatch(String localURL, String root, ArrayList entries) { + m_entries = entries; + m_root = root; + m_localURL = localURL; + m_downloadList = new ArrayList(); + } + + public void addMsListener(MsListener listener) { + m_listener = listener; + } + + private void downloadFile(File remoteFile) { + + AbstractJMSCallback callback = new AbstractJMSCallback() { + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success) { + + if (success) { + if (m_pathToExpand != null) { + MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().updateTree(); + } + m_downloadList.add(new MsListenerDownloadParameter(m_localFile, remoteFile, true)); + } else { + m_downloadList.add(new MsListenerDownloadParameter(m_localFile, remoteFile, false)); + } + + if (m_listener != null) { + if (m_downloadList.size() == m_files.size()) { + m_listener.downloadPerformed(m_downloadList); + } + } + } + }; + + String destinationDirectory = m_root + m_localURL; + + String filename = remoteFile.getName(); + String url = destinationDirectory + File.separatorChar + filename; + + m_localFile = new File(url); + while (m_localFile.exists()) { + int lastIndexOfDot = url.lastIndexOf("."); + if (lastIndexOfDot != -1) { + url = url.substring(0, lastIndexOfDot) + " - Copie"+url.substring(lastIndexOfDot, url.length()); + } else { + url = url + " - Copie"; + } + + m_localFile = new File(url); + } + + + /*boolean isMzdbFile = remoteFile.getAbsolutePath().toLowerCase().endsWith(".mzdb"); + if (isMzdbFile) {*/ + DownloadFileTask task = new DownloadFileTask(callback, remoteFile.getAbsolutePath(), m_localFile); + AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); + /*} else { + String serverNodeId = ""; // ????? + DownloadFileTask task = new DownloadFileTask(callback, m_localFile.getAbsolutePath(), remoteFile.getAbsolutePath(), serverNodeId); + AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); + }*/ + + + } + + private void downloadEntry(WorkingSetEntry entry) { + if (entry.getFile().getAbsolutePath().toLowerCase().endsWith(".mzdb")) { + AbstractJMSCallback callback = new AbstractJMSCallback() { + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success) { + + if (success) { + if (m_pathToExpand != null) { + MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().updateTree(); + } + m_downloadList.add(new MsListenerDownloadParameter(m_localFile, entry.getFile(), true)); + } else { + m_downloadList.add(new MsListenerDownloadParameter(m_localFile, entry.getFile(), false)); + } + + if (m_listener != null) { + + ArrayList stateList = new ArrayList(); + stateList.add(new MsListenerEntryUpdateParameter(entry.getFile(), MsListenerEntryUpdateParameter.State.DOWNLOAD_COMPLETE)); + + m_listener.entryStateUpdated(stateList); + + if (m_downloadList.size() == m_entries.size()) { + m_listener.downloadPerformed(m_downloadList); + } + } + } + }; + + String destinationDirectory = m_root + m_localURL; + + String filename = entry.getFilename(); + String url = destinationDirectory+File.separatorChar+filename; + + m_localFile = new File(url); + while(m_localFile.exists()){ + url = url.substring(0, url.lastIndexOf("."))+" - Copie.mzdb"; + m_localFile = new File(url); + } + + DownloadFileTask task = new DownloadFileTask(callback, entry.getFile().getAbsolutePath(), m_localFile); + + if (m_listener != null) { + ArrayList list = new ArrayList(); + list.add(new MsListenerEntryUpdateParameter(entry.getFile(), MsListenerEntryUpdateParameter.State.START_DOWNLOADING)); + m_listener.entryStateUpdated(list); + } + + AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); + } + } + + @Override + public void run() { + if (m_pathToExpand != null) { + MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().expandTreePath(m_pathToExpand); + } + if (m_files != null) { + for (int i = 0; i < m_files.size(); i++) { + downloadFile(m_files.get(i)); + } + } else if (m_entries != null) { + for (int i = 0; i < m_entries.size(); i++) { + downloadEntry(m_entries.get(i)); + } + } + } + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbEncodingVerificationBatch.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbEncodingVerificationBatch.java index 6da9d2cf5..9f317276c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbEncodingVerificationBatch.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbEncodingVerificationBatch.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.studio.dam.AccessDatabaseThread; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbEncodingVerificationTask.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbEncodingVerificationTask.java index 48ddadca7..2a4304393 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbEncodingVerificationTask.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbEncodingVerificationTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.studio.dam.taskinfo.TaskError; @@ -27,7 +27,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import org.openide.util.Exceptions; +import fr.proline.studio.Exceptions; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbIntegrityVerificationTask.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbIntegrityVerificationTask.java index cfb71d204..bad99e7cc 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbIntegrityVerificationTask.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbIntegrityVerificationTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import com.almworks.sqlite4java.SQLiteException; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbUploadBatch.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbUploadBatch.java index 996f48be9..a21ceb254 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbUploadBatch.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbUploadBatch.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -19,7 +19,8 @@ import fr.proline.studio.dpm.AccessJMSManagerThread; import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; import fr.proline.studio.dpm.task.jms.FileUploadTask; -import fr.proline.studio.rsmexplorer.MzdbFilesTopComponent; +import fr.proline.studio.rsmexplorer.MzdbFilesTopPanel; + import java.io.File; import java.util.ArrayList; import java.util.HashMap; @@ -112,9 +113,9 @@ public void run() { } } } - MzdbFilesTopComponent.getExplorer().getTreeFileChooserPanel().expandMultipleTreePath(m_directories, m_uploads.entrySet().iterator().next().getValue().getMountingPointPath()); + MzdbFilesTopPanel.getExplorer().getTreeFileChooserPanel().expandMultipleTreePath(m_directories, m_uploads.entrySet().iterator().next().getValue().getMountingPointPath()); } else { - MzdbFilesTopComponent.getExplorer().getTreeFileChooserPanel().expandTreePath(m_pathToExpand); + MzdbFilesTopPanel.getExplorer().getTreeFileChooserPanel().expandTreePath(m_pathToExpand); } Iterator it = m_uploads.entrySet().iterator(); @@ -144,7 +145,7 @@ public void uploadPerformed(ArrayList list) { } if (success) { - MzdbFilesTopComponent.getExplorer().getTreeFileChooserPanel().updateTree(); + MzdbFilesTopPanel.getExplorer().getTreeFileChooserPanel().updateTree(); } } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbUploadSettings.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbUploadSettings.java index 1b20a4fe4..d93d83db1 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbUploadSettings.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbUploadSettings.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; /** diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbUploader.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbUploader.java index 949ae1eae..7321ccfb3 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbUploader.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/MzdbUploader.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.studio.dam.AccessDatabaseThread; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/RawConversionTask.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/RawConversionTask.java index d92788b95..ec89d81a5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/RawConversionTask.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/RawConversionTask.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.studio.dam.taskinfo.TaskError; @@ -22,7 +22,10 @@ import fr.proline.studio.dam.tasks.AbstractDatabaseTask; import java.io.File; import java.io.IOException; -import org.openide.util.Exceptions; +import java.util.ArrayList; +import java.util.List; + +import fr.proline.studio.Exceptions; /** * @@ -56,7 +59,15 @@ public boolean fetchData() { suffix = ".wiff"; } - m_process = new ProcessBuilder(m_settings.getConverterPath(), "-i", m_file.getAbsolutePath(), "-o", m_settings.getOutputPath() + File.separator + m_file.getName().substring(0, m_file.getName().lastIndexOf(suffix)) + ".mzdb").start(); + List commandParams = new ArrayList<>(); + commandParams.add(m_settings.getConverterPath()); + commandParams.add("-i"); + commandParams.add( m_file.getAbsolutePath()); + commandParams.add("-o"); + commandParams.add(m_settings.getOutputPath()+ File.separator + m_file.getName().substring(0, m_file.getName().lastIndexOf(suffix))+ ".mzdb"); + if(m_settings.isVersion1_1()) + commandParams.add("-n"); + m_process = new ProcessBuilder(commandParams).start(); } catch (IOException ex) { if (m_process != null && m_process.isAlive()) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/RawConverter.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/RawConverter.java index af6f20b79..c2d6893ba 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/RawConverter.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/RawConverter.java @@ -1,25 +1,26 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.rsmexplorer.MzdbFilesTopComponent; +import fr.proline.studio.rsmexplorer.MzdbFilesTopPanel; + import java.io.File; import java.io.IOException; import java.nio.file.DirectoryNotEmptyException; @@ -99,8 +100,8 @@ public void run() { outputDirectory = outputDirectory.getParentFile(); } - MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().expandMultipleTreePath(directories); - MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().updateTree(); + MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().expandMultipleTreePath(directories); + MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().updateTree(); } catch (NoSuchFileException ex) { ; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/TransferableEntryWrapper.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/TransferableEntryWrapper.java index ce6c63aa6..481a372b6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/TransferableEntryWrapper.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/TransferableEntryWrapper.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import java.io.Serializable; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSet.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSet.java index 1232f536f..5d44ec67b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSet.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSet.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.studio.msfiles.WorkingSetEntry.Location; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetEntriesTransferHandler.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetEntriesTransferHandler.java index 238db166c..f77d8e2a6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetEntriesTransferHandler.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetEntriesTransferHandler.java @@ -1,21 +1,23 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; +import fr.proline.studio.Exceptions; + import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; @@ -25,7 +27,7 @@ import javax.swing.TransferHandler; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; -import org.openide.util.Exceptions; + /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetEntriesTransferable.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetEntriesTransferable.java index d3a55d01e..7020182e0 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetEntriesTransferable.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetEntriesTransferable.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import java.awt.datatransfer.DataFlavor; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetEntry.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetEntry.java index c0547e365..08f8621fc 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetEntry.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetEntry.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.studio.dpm.serverfilesystem.ServerFile; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetModel.java index 8d57d7d08..d4187852b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetModel.java @@ -1,21 +1,22 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; +import fr.proline.studio.NbPreferences; import fr.proline.studio.msfiles.WorkingSetEntry.Location; import fr.proline.studio.rsmexplorer.gui.dialog.ApplicationSettingsDialog; import java.util.ArrayList; @@ -28,7 +29,7 @@ import javax.swing.tree.TreePath; import org.json.simple.JSONArray; import org.json.simple.JSONObject; -import org.openide.util.NbPreferences; + /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetRoot.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetRoot.java index 646d7534a..447c131f9 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetRoot.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetRoot.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import java.util.HashSet; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetUtil.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetUtil.java index 70e06e86e..a2e238167 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetUtil.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetUtil.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import java.io.File; @@ -25,7 +25,7 @@ import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; -import org.openide.util.Exceptions; +import fr.proline.studio.Exceptions; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetView.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetView.java index ffd8ac906..c8c5bfb50 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetView.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/msfiles/WorkingSetView.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.msfiles; import fr.proline.mzscope.utils.IPopupMenuDelegate; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AbstractDataBox.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AbstractDataBox.java index f4a9885fc..ad60a479d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AbstractDataBox.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AbstractDataBox.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -17,39 +17,29 @@ package fr.proline.studio.pattern; import fr.proline.core.orm.util.TransientDataInterface; -import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.memory.TransientMemoryCacheManager; import fr.proline.studio.dam.memory.TransientMemoryClientInterface; import fr.proline.studio.dam.taskinfo.TaskInfo; import fr.proline.studio.dam.tasks.AbstractDatabaseTask; +import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; import fr.proline.studio.gui.SplittedPanelContainer; import fr.proline.studio.id.ProjectId; -import fr.proline.studio.pattern.xic.DataboxChildFeature; -import fr.proline.studio.pattern.xic.DataboxExperimentalDesign; -import fr.proline.studio.pattern.xic.DataboxMapAlignment; -import fr.proline.studio.pattern.xic.DataboxPSMOfMasterQuantPeptide; -import fr.proline.studio.pattern.xic.DataboxXicParentsPeptideIon; -import fr.proline.studio.pattern.xic.DataboxXicPeptideIon; -import fr.proline.studio.pattern.xic.DataboxXicPeptideSet; -import fr.proline.studio.pattern.xic.DataboxXicProteinSet; +import fr.proline.studio.pattern.xic.*; import fr.proline.studio.progress.ProgressInterface; import fr.proline.studio.table.TableInfo; import fr.proline.studio.utils.IconManager; -import java.awt.Image; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import org.jdesktop.swingx.JXTable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.ActionListener; +import java.util.List; +import java.util.*; + /** * * A Box receive IN-parameters. According to them, it loads data from the @@ -156,11 +146,14 @@ public enum DataboxType { DataBoxXicPTMPeptidesMatches(51), DataBoxPTMSitePeptidesGraphic(52), DataboxMultiGraphicsDoubleYAxis(53), - DataBoxPTMPeptides(54), + DataBoxPTMPeptides(54), DataBoxPTMClusters(55), DataBoxPTMPeptidesMatches(56), DataBoxPTMPeptidesGraphic(57), - DataboxXicParentsPeptideIon(58) + DataboxXicParentsPeptideIon(58), + DataBoxPTMSiteAsClusters(59), + DataBoxPTMClustersSites(60), + DataBoxXicPTMClustersSites(61) ; int m_type; private static HashMap m_databoxTypeMap = null; @@ -275,6 +268,13 @@ public AbstractDataBox getDatabox() { return new DataBoxPTMPeptidesGraphic(); case DataboxXicParentsPeptideIon: return new DataboxXicParentsPeptideIon(); + case DataBoxPTMSiteAsClusters: + return new DataBoxPTMClusters(true); + case DataBoxPTMClustersSites: + return new DataBoxPTMClustersSites(); + case DataBoxXicPTMClustersSites: + return new DataBoxPTMClustersSites(true); + } return null; // should not happen } @@ -448,7 +448,7 @@ public ParameterList getInParameters() { /** * Return potential extra data available for the corresponding parameter of class type - * @param c + * @param parameterType * @return */ public Object getExtraData(Class parameterType) { @@ -480,7 +480,23 @@ public boolean isDataProvider(Class dataType, ParameterSubtypeEnum subtype) { return (m_outParameters.isDataDependant(dataType, subtype)); } - public void loadedDataModified(Long rsetId, Long rsmId, Class dataType, ArrayList modificationsList, int reason) { + public boolean isDataOfInterest(Long rsetId, Long rsmId, Class dataType) { + boolean isOfInterest = rsetId == null || rsetId.equals(getRsetId()); + isOfInterest = rsmId!=null ? (isOfInterest && rsmId.equals(getRsmId()) ) : isOfInterest; + return (isOfInterest && isDataProvider(dataType, null)); + } + + + public boolean isClosable(){ + return true; + } + + public String getClosingWarningMessage(){ + return ""; + } + + + public void loadedDataModified(Long rsetId, Long rsmId, Class dataType, ArrayList modificationsList, byte reason) { if (isDataProvider(dataType, null)) { dataMustBeRecalculated(rsetId, rsmId, dataType, modificationsList, reason); } @@ -537,15 +553,20 @@ public void removeNextDataBox(AbstractDataBox nextDataBox) { * modificiation of the data of the current databox. (for instance, * disabling peptides -> modifications of protein set in the XIC View * - * @param dataType + * @param rsetId : Result Set Id the modified data belongs to. May be null + * @param rsmId : Result Summary Id the modified data belongs to. May be null + * @param modificationsList :modified data list + * @param dataType : dataType type of data that may be impacted by modification + * @param reason: Combination of DataBoxViewerManager.REASON_MODIF Flags. Combination is done using REASON_MODIF.getReasonValue */ - public void dataMustBeRecalculated(Long rsetId, Long rsmId, Class dataType, ArrayList modificationsList, int reason) { + public void dataMustBeRecalculated(Long rsetId, Long rsmId, Class dataType, ArrayList modificationsList, byte reason) { } public final Object getData(Class parameterType) { return getData(parameterType, ParameterSubtypeEnum.SINGLE_DATA); } + public final Object getData(Class parameterType, ParameterSubtypeEnum parameterSubtype) { // I remove this log, it generates too much logs @@ -554,8 +575,11 @@ public final Object getData(Class parameterType, ParameterSubtypeEnum parameterS // check if the box has the right to ask this data checkDataAsked(parameterType, parameterSubtype); - - + + //If no specidic subtype assume it's SINGLE_DATA + if(parameterSubtype == null ) + parameterSubtype = ParameterSubtypeEnum.SINGLE_DATA; + return getDataImpl(parameterType, parameterSubtype); } @@ -953,11 +977,11 @@ public ArrayList getNextDataBoxArray() { return m_nextDataBoxArray; } - public Class[] getImportantInParameterClass() { + public Class[] getDataboxNavigationOutParameterClasses() { return null; } - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { return null; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AbstractDataBoxPTMPeptides.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AbstractDataBoxPTMPeptides.java index 96cbfdcfb..162f4101a 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AbstractDataBoxPTMPeptides.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AbstractDataBoxPTMPeptides.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -17,13 +17,11 @@ package fr.proline.studio.pattern; import fr.proline.core.orm.msi.ResultSummary; +import fr.proline.core.orm.msi.dto.DMasterQuantPeptide; import fr.proline.core.orm.msi.dto.DMasterQuantProteinSet; import fr.proline.core.orm.msi.dto.DPeptideInstance; import fr.proline.core.orm.msi.dto.DPeptideMatch; -import fr.proline.studio.dam.AccessDatabaseThread; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; -import fr.proline.studio.dam.tasks.DatabasePTMSitesTask; -import fr.proline.studio.dam.tasks.SubTask; +import fr.proline.core.orm.uds.dto.DDataset; import fr.proline.studio.dam.tasks.data.ptm.PTMCluster; import fr.proline.studio.dam.tasks.data.ptm.PTMDataset; import fr.proline.studio.dam.tasks.data.ptm.PTMPeptideInstance; @@ -31,14 +29,15 @@ import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; import fr.proline.studio.gui.SplittedPanelContainer; -import fr.proline.studio.rsmexplorer.gui.PTMPeptidesTablePanel; import fr.proline.studio.rsmexplorer.gui.xic.QuantChannelInfo; +import fr.proline.studio.types.XicMode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * @@ -52,7 +51,7 @@ public abstract class AbstractDataBoxPTMPeptides extends AbstractDataBox { protected List m_ptmPepInstances; protected List m_ptmClusters; - protected boolean m_isXICResult = true; + protected boolean m_isMS1LabelFreeQuantitation = true; protected boolean m_displayAllPepMatches = false; protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer.ptm"); @@ -68,10 +67,9 @@ protected void registerParameters() { // One ResultSummary ParameterList inParameter = new ParameterList(); inParameter.addParameter(PTMPeptideInstance.class, m_displayAllPepMatches ? ParameterSubtypeEnum.LEAF_PTMPeptideInstance : ParameterSubtypeEnum.PARENT_PTMPeptideInstance); - inParameter.addParameter(PTMPeptideInstance.class); - inParameter.addParameter(PTMDataset.class); - if (m_isXICResult) { + + if (m_isMS1LabelFreeQuantitation) { inParameter.addParameter(QuantChannelInfo.class); inParameter.addParameter(DMasterQuantProteinSet.class); } @@ -88,8 +86,12 @@ protected void registerParameters() { outParameter.addParameter(DPeptideInstance.class, ParameterSubtypeEnum.LIST_DATA); outParameter.addParameter(ResultSummary.class); outParameter.addParameter(PTMDataset.class); - if (m_isXICResult) { + outParameter.addParameter(DDataset.class); + if (m_isMS1LabelFreeQuantitation) { outParameter.addParameter(ExtendedTableModelInterface.class); + outParameter.addParameter(DMasterQuantPeptide.class); + outParameter.addParameter(QuantChannelInfo.class); + outParameter.addParameter(XicMode.class); } outParameter.addParameter(MsQueryInfoRsm.class); registerOutParameter(outParameter); @@ -99,8 +101,8 @@ protected boolean isAllPSMsDisplayed() { return m_displayAllPepMatches; } - protected boolean isQuantiResult() { - return m_isXICResult; + protected boolean isMS1LabelFreeQuantitation() { + return m_isMS1LabelFreeQuantitation; } @Override @@ -120,6 +122,9 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub return m_rsm; } } + if (parameterType.equals(DDataset.class)) { + return m_ptmDataset.getDataset(); + } if (parameterType.equals(PTMDataset.class)) { return m_ptmDataset; @@ -229,65 +234,65 @@ public void dataChanged() { updateData(); } - protected List getNotLoadedPTMSite() { - - final List notLoadedPtmSite = new ArrayList<>(); - for (PTMPeptideInstance ptmPepInst : m_ptmPepInstances) { - ptmPepInst.getPTMSites().stream().forEach(ptmSite -> { - if (!ptmSite.isLoaded()) { - notLoadedPtmSite.add(ptmSite); - } - }); - } - return notLoadedPtmSite; - } +// protected List getNotLoadedPTMSite() { +// +// final List notLoadedPtmSite = new ArrayList<>(); +// for (PTMPeptideInstance ptmPepInst : m_ptmPepInstances) { +// ptmPepInst.getPTMSites().stream().forEach(ptmSite -> { +// if (!ptmSite.isLoaded()) { +// notLoadedPtmSite.add(ptmSite); +// } +// }); +// } +// return notLoadedPtmSite; +// } protected void resetPrevPTMTaskId() { m_previousPTMTaskId = null; } - protected void loadPtmSite(List notLoadedPtmSite) { - - //Load PTMSite not yet loaded ! - final int loadingId = setLoading(); - - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - setLoaded(loadingId); - if (!success) { - ((PTMPeptidesTablePanel) getDataBoxPanelInterface()).setData(null, null, null, null, finished); - } else { - m_previousPTMTaskId = null; - unregisterTask(taskId); - if (m_isXICResult) { - loadXicAndPropagate(); - } else { - ((PTMPeptidesTablePanel) getDataBoxPanelInterface()).setData(null, m_ptmPepInstances, m_ptmClusters, null, finished); - addDataChanged(PTMPeptideInstance.class, null); //JPM.DATABOX : put null, because I don't know which subtype has been change : null means all. So it works as previously - addDataChanged(ExtendedTableModelInterface.class); - propagateDataChanged(); - } - } - } - }; - - DatabasePTMSitesTask task = new DatabasePTMSitesTask(callback); - task.initFillPTMSites(getProjectId(), m_rsm, notLoadedPtmSite); - Long taskId = task.getId(); - if (m_previousPTMTaskId != null) { - // old task is suppressed if it has not been already done - AccessDatabaseThread.getAccessDatabaseThread().abortTask(m_previousPTMTaskId); - } - m_previousPTMTaskId = taskId; - registerTask(task); - } +// protected void loadPtmSite(List notLoadedPtmSite) { +// +// //Load PTMSite not yet loaded ! +// final int loadingId = setLoading(); +// +// AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { +// +// @Override +// public boolean mustBeCalledInAWT() { +// return true; +// } +// +// @Override +// public void run(boolean success, long taskId, SubTask subTask, boolean finished) { +// setLoaded(loadingId); +// if (!success) { +// ((PTMPeptidesTablePanel) getDataBoxPanelInterface()).setData(null, null, null, null, finished); +// } else { +// m_previousPTMTaskId = null; +// unregisterTask(taskId); +// if (m_isMS1LabelFreeQuantitation) { +// loadXicAndPropagate(); +// } else { +// ((PTMPeptidesTablePanel) getDataBoxPanelInterface()).setData(null, m_ptmPepInstances, m_ptmClusters, null, finished); +// addDataChanged(PTMPeptideInstance.class, null); //JPM.DATABOX : put null, because I don't know which subtype has been change : null means all. So it works as previously +// addDataChanged(ExtendedTableModelInterface.class); +// propagateDataChanged(); +// } +// } +// } +// }; +// +// DatabasePTMSitesTask task = new DatabasePTMSitesTask(callback); +// task.initFillPTMSites(getProjectId(), m_rsm, notLoadedPtmSite); +// Long taskId = task.getId(); +// if (m_previousPTMTaskId != null) { +// // old task is suppressed if it has not been already done +// AccessDatabaseThread.getAccessDatabaseThread().abortTask(m_previousPTMTaskId); +// } +// m_previousPTMTaskId = taskId; +// registerTask(task); +// } abstract protected DPeptideMatch getSelectedPeptideMatch(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AddDataBoxActionListener.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AddDataBoxActionListener.java index 04b67f6d9..486e58397 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AddDataBoxActionListener.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AddDataBoxActionListener.java @@ -1,29 +1,31 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.pattern; +import fr.proline.studio.WindowManager; import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.gui.SplittedPanelContainer; import fr.proline.studio.rsmexplorer.gui.dialog.DataBoxChooserDialog; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import org.openide.windows.WindowManager; /** * Action to add a new Databox at the end of the queue @@ -33,6 +35,7 @@ public class AddDataBoxActionListener implements ActionListener { private final SplittedPanelContainer m_splittedPanel; private final AbstractDataBox m_previousDatabox; + protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); public AddDataBoxActionListener(SplittedPanelContainer splittedPanel, AbstractDataBox previousDatabox) { m_splittedPanel = splittedPanel; @@ -48,20 +51,11 @@ public void actionPerformed(ActionEvent event) { AbstractDataBox genericDatabox = dialog.getSelectedDataBox(); try { - AbstractDataBox newGenericDatabox = (AbstractDataBox) genericDatabox.getClass().newInstance(); // copy the databox - - //Some databox must be specifically configured ... - // FIXME VDS : To be more generic ?! - if(DataboxGraphics.class.isInstance(newGenericDatabox)) { - ((DataboxGraphics)newGenericDatabox).setDefaultLocked(((DataboxGraphics)genericDatabox).isDefaultLocked()); - } else if (DataboxMultiGraphics.class.isInstance(newGenericDatabox) ){ - newGenericDatabox = new DataboxMultiGraphics(false, false, ((DataboxMultiGraphics)genericDatabox).isDoubleYAxis()); - } else if (DataBoxPTMPeptides.class.equals(newGenericDatabox.getClass())){ - newGenericDatabox = new DataBoxPTMPeptides(((DataBoxPTMPeptides)genericDatabox).isQuantiResult(), ((DataBoxPTMPeptides)genericDatabox).isAllPSMsDisplayed()); - } - genericDatabox = newGenericDatabox; + + genericDatabox = DataboxManager.getDataboxNewInstance(genericDatabox); } catch (InstantiationException | IllegalAccessException e) { // should never happen + m_logger.error("Error creating new Databox ",e); } m_previousDatabox.addNextDataBox(genericDatabox); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AvailableParameters.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AvailableParameters.java index 323115075..33b307cb4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AvailableParameters.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/AvailableParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,8 +16,7 @@ */ package fr.proline.studio.pattern; -import java.util.ArrayList; -import java.util.HashMap; +import java.util.*; /** * Container for available parameters of a DataBox @@ -27,19 +26,34 @@ public class AvailableParameters { - private HashMap m_availableParametersMap; + private TreeMap m_availableParametersMap; public AvailableParameters(AbstractDataBox box) { initAvailableParameters(box); } - public HashMap getParametersMap() { + public Map getParametersMap() { return m_availableParametersMap; } private void initAvailableParameters(AbstractDataBox box) { - m_availableParametersMap = new HashMap<>(); + m_availableParametersMap = new TreeMap<>(new Comparator() { + @Override + public int compare(DataParameter o1, DataParameter o2) { + if(o1 == null && o2 == null) + return 0; + if(o1 == null) + return 1; + if(o2 == null) + return 1; + if (o1.equalsData(o2)) + return 0; + if(o1.equals(o2)) + return (o1.getSubtype().compareTo(o2.getSubtype())); + return (o1.getParameterClass().toString().compareTo(o2.getParameterClass().toString())); + } + }); initAvailableParameters(box, 0); } private void initAvailableParameters(AbstractDataBox box, Integer depth) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataAnalyzerWindowBoxManager.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataAnalyzerWindowBoxManager.java index eebacbaf5..31124de83 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataAnalyzerWindowBoxManager.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataAnalyzerWindowBoxManager.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,9 +16,10 @@ */ package fr.proline.studio.pattern; +import fr.proline.studio.WindowManager; import fr.proline.studio.id.ProjectId; import fr.proline.studio.table.TableInfo; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.gui.calc.DataAnalyzerPanel; import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; @@ -34,7 +35,7 @@ public class DataAnalyzerWindowBoxManager { private static WindowBox m_windowBox = null; - private static DataBoxViewerTopComponent m_win = null; + private static DataBoxViewerTopPanel m_win = null; public static void addTableInfo(TableInfo tableInfo) { @@ -50,9 +51,9 @@ public static void addTableInfo(TableInfo tableInfo) { } // open a window to display the window box - m_win = new DataBoxViewerTopComponent(m_windowBox); - m_win.open(); - m_win.requestActive(); + m_win = new DataBoxViewerTopPanel(m_windowBox); + WindowManager.getDefault().getMainWindow().displayWindow(m_win); + } else { if (m_windowBox.getEntryBox() instanceof DataboxDataAnalyzer) { DataboxDataAnalyzer analyzer = (DataboxDataAnalyzer) m_windowBox.getEntryBox(); @@ -70,13 +71,10 @@ public static void addTableInfo(TableInfo tableInfo) { m_windowBox.setEntryData(id, tableInfo); } - if (m_win.isOpened()) { - m_win.requestActive(); - } else { - m_win = new DataBoxViewerTopComponent(m_windowBox); - m_win.open(); - m_win.requestActive(); - } + + + WindowManager.getDefault().getMainWindow().displayWindow(m_win); + } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxAdjacencyMatrix.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxAdjacencyMatrix.java index 09b61a0c1..ac9caf1f4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxAdjacencyMatrix.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxAdjacencyMatrix.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxAdjacencyMatrixChoice.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxAdjacencyMatrixChoice.java index 45e64e309..a2d4d3ffc 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxAdjacencyMatrixChoice.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxAdjacencyMatrixChoice.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -86,6 +86,7 @@ public void createPanel() { @Override public void dataChanged() { + //VDS : Si change de RSM ? final ResultSummary _rsm = (m_rsm != null) ? m_rsm : (ResultSummary) getData( ResultSummary.class); // register the link to the Transient Data linkCache(_rsm); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxDataAnalyzerResults.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxDataAnalyzerResults.java index 92e0c1086..b219ccfc8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxDataAnalyzerResults.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxDataAnalyzerResults.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxFrozenCopy.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxFrozenCopy.java index 5537ae42f..be7c27662 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxFrozenCopy.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxFrozenCopy.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -21,6 +21,7 @@ import fr.proline.core.orm.uds.dto.DDataset; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; /** * @@ -36,7 +37,7 @@ public DataBoxFrozenCopy(AbstractDataBox srcDataBox) { AvailableParameters avalaibleParameters = new AvailableParameters(srcDataBox); - HashMap parametersMap = avalaibleParameters.getParametersMap(); + Map parametersMap = avalaibleParameters.getParametersMap(); Iterator it = parametersMap.keySet().iterator(); while (it.hasNext()) { DataParameter parameter = it.next(); @@ -45,10 +46,9 @@ public DataBoxFrozenCopy(AbstractDataBox srcDataBox) { HashMap map = m_frozenDataMap.get(c); if (map == null) { map = new HashMap<>(); - map.put(subtype, srcDataBox.getData(c, subtype)); - m_frozenDataMap.put(c, map); } - + map.put(subtype, srcDataBox.getData(c, subtype)); + m_frozenDataMap.put(c, map); } Class specificClass = ResultSet.class; @@ -60,7 +60,7 @@ public DataBoxFrozenCopy(AbstractDataBox srcDataBox) { } } if (rset == null) { - ResultSummary rsm = (ResultSummary) srcDataBox.getData(specificClass, null); + ResultSummary rsm = (ResultSummary) srcDataBox.getData(ResultSummary.class, null); if (rsm != null) { rset = rsm.getResultSet(); } @@ -69,9 +69,9 @@ public DataBoxFrozenCopy(AbstractDataBox srcDataBox) { HashMap map = m_frozenDataMap.get(specificClass); if (map == null) { map = new HashMap<>(); + } map.put(null, rset); m_frozenDataMap.put(specificClass, map); - } } specificClass = ResultSummary.class; @@ -86,9 +86,9 @@ public DataBoxFrozenCopy(AbstractDataBox srcDataBox) { HashMap map = m_frozenDataMap.get(specificClass); if (map == null) { map = new HashMap<>(); - map.put(null, rsm); - m_frozenDataMap.put(specificClass, map); } + map.put(null, rsm); + m_frozenDataMap.put(specificClass, map); } // register out parameters @@ -100,7 +100,9 @@ public DataBoxFrozenCopy(AbstractDataBox srcDataBox) { } registerOutParameter(outParameter); - + // register in parameters + ParameterList inParameter = srcDataBox.getInParameters(); + registerInParameter(inParameter); } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxImage.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxImage.java index c28bd600a..634737965 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxImage.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxImage.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.pattern; import fr.proline.studio.rsmexplorer.gui.ImagePanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxMSQueriesForRSM.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxMSQueriesForRSM.java index 5551b10b9..80e303cfc 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxMSQueriesForRSM.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxMSQueriesForRSM.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -148,13 +148,13 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub } @Override - public Class[] getImportantInParameterClass() { + public Class[] getDataboxNavigationOutParameterClasses() { Class[] classList = { DMsQuery.class, MsQueryInfoRsm.class }; return classList; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DMsQuery q = (DMsQuery) getData(DMsQuery.class); if (q != null) { int id = q.getInitialId(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxMSQueriesForRset.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxMSQueriesForRset.java index d5f838bf0..d192c07e9 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxMSQueriesForRset.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxMSQueriesForRset.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -151,13 +151,13 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub } @Override - public Class[] getImportantInParameterClass() { + public Class[] getDataboxNavigationOutParameterClasses() { Class[] classList = { DMsQuery.class, MsQueryInfoRset.class }; return classList; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DMsQuery q = (DMsQuery) getData(DMsQuery.class); if (q != null) { int id = q.getInitialId(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxMzScope.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxMzScope.java index faff6b3bb..bf79489a9 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxMzScope.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxMzScope.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMClusters.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMClusters.java index f01f1d0ba..83550c434 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMClusters.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMClusters.java @@ -1,591 +1,709 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.pattern; - -import fr.proline.core.orm.msi.ResultSummary; -import fr.proline.core.orm.msi.dto.DMasterQuantPeptide; -import fr.proline.core.orm.msi.dto.DMasterQuantProteinSet; -import fr.proline.core.orm.msi.dto.DPeptideInstance; -import fr.proline.core.orm.msi.dto.DPeptideMatch; -import fr.proline.core.orm.msi.dto.DProteinMatch; -import fr.proline.core.orm.msi.dto.DProteinSet; -import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.core.orm.uds.dto.DMasterQuantitationChannel; -import fr.proline.core.orm.util.DStoreCustomPoolConnectorFactory; -import fr.proline.studio.dam.AccessDatabaseThread; -import fr.proline.studio.dam.taskinfo.TaskError; -import fr.proline.studio.dam.taskinfo.TaskInfo; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; -import fr.proline.studio.dam.tasks.DatabaseDataSetTask; -import fr.proline.studio.dam.tasks.DatabasePTMsTask; -import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.dam.tasks.data.ptm.AggregatedMasterQuantPeptide; -import fr.proline.studio.dam.tasks.data.ptm.PTMCluster; -import fr.proline.studio.dam.tasks.data.ptm.PTMDataset; -import fr.proline.studio.dam.tasks.data.ptm.PTMPeptideInstance; -import fr.proline.studio.dam.tasks.xic.DatabaseLoadLcMSTask; -import fr.proline.studio.dam.tasks.xic.DatabaseLoadXicMasterQuantTask; -import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; -import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; -import fr.proline.studio.graphics.CrossSelectionInterface; -import fr.proline.studio.rsmexplorer.gui.PTMClustersPanel; -import fr.proline.studio.rsmexplorer.gui.xic.QuantChannelInfo; -import fr.proline.studio.types.XicMode; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import javax.persistence.EntityManager; -import javax.persistence.Query; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author VD225637 - */ -public class DataBoxPTMClusters extends AbstractDataBox { - - private final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer.ptm"); - - private boolean m_loadSitesAsClusters; - private long logStartTime; - - private PTMDataset m_ptmDataset; - private ResultSummary m_rsm; - private QuantChannelInfo m_quantChannelInfo; //Xic Specific - private boolean m_isXicResult = false; //If false: display Ident result PTM Clusters - - public DataBoxPTMClusters() { - super(AbstractDataBox.DataboxType.DataBoxPTMClusters, AbstractDataBox.DataboxStyle.STYLE_RSM); - - // Name of this databox - m_typeName = "Dataset PTMs Clusters"; //May be Quant PTM Protein Sites... - m_description = "Clusters of Modification Sites of a Dataset";//May be Ident or Quant dataset... - - // Register in parameters - ParameterList inParameter = new ParameterList(); - - inParameter.addParameter(PTMDataset.class); - inParameter.addParameter(DDataset.class); - - registerInParameter(inParameter); - - // Register possible out parameters - ParameterList outParameter = new ParameterList(); - outParameter.addParameter(ResultSummary.class); - - outParameter.addParameter(PTMPeptideInstance.class, ParameterSubtypeEnum.LEAF_PTMPeptideInstance); - outParameter.addParameter(PTMPeptideInstance.class, ParameterSubtypeEnum.PARENT_PTMPeptideInstance); - outParameter.addParameter(PTMDataset.class); - - outParameter.addParameter(DProteinMatch.class); - outParameter.addParameter(DPeptideMatch.class); - - outParameter.addParameter(PTMCluster.class, ParameterSubtypeEnum.LIST_DATA); - - outParameter.addParameter(ExtendedTableModelInterface.class); - outParameter.addParameter(CrossSelectionInterface.class); - - registerOutParameter(outParameter); - - } - - public void setViewSitesOnly(boolean viewSitesAsClusters) { - m_loadSitesAsClusters = viewSitesAsClusters; - if (m_loadSitesAsClusters) - m_typeName = "Dataset PTMs Sites"; - } - - private boolean isXicResult() { - return m_isXicResult; - } - - public void setXicResult(boolean isXICResult) { - m_isXicResult = isXICResult; - m_style = (m_isXicResult) ? DataboxStyle.STYLE_XIC : DataboxStyle.STYLE_SC; - if (m_isXicResult) { - registerXicOutParameter(); - } - } - - private void registerXicOutParameter(){ - ParameterList outParameter = new ParameterList(); - - outParameter.addParameter(DMasterQuantProteinSet.class); - outParameter.addParameter(DProteinSet.class); - outParameter.addParameter(QuantChannelInfo.class); - - registerOutParameter(outParameter); - } - - @Override - public Long getRsetId() { - if (m_ptmDataset == null) { - return null; - } - return m_ptmDataset.getDataset().getResultSetId(); - } - - @Override - public Long getRsmId() { - if (m_ptmDataset == null) { - return null; - } - return m_ptmDataset.getDataset().getResultSummaryId(); - } - - @Override - public void createPanel() { - PTMClustersPanel p = new PTMClustersPanel(); - p.setName(m_typeName); - p.setDataBox(this); - setDataBoxPanelInterface(p); - } - - @Override - public void dataChanged() { - - // register the link to the Transient Data - linkCache(m_rsm); - - final int loadingId = setLoading(); - final long logStartTimelocal = System.currentTimeMillis(); - List ptmDS = new ArrayList<>(); - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - m_logger.debug("DataBoxPTMClusters : **** Callback task "+taskId+", success "+success+", finished "+finished+"; with subtask : "+(subTask != null)+". Duration: "+(System.currentTimeMillis()-logStartTimelocal)+" TimeMillis"); - if(success) { - if(subTask == null){ - //Main task callback! - m_ptmDataset = ptmDS.get(0); - m_logger.debug(" -- created "+m_ptmDataset.getPTMClusters().size()+" PTMCluster."); - m_loadPepMatchOnGoing=true; - ((PTMClustersPanel) getDataBoxPanelInterface()).setData(taskId, (ArrayList) m_ptmDataset.getPTMClusters(), finished); - loadPeptideMatches(); - - } - } else{ - displayLoadError(taskId, finished); - } - - if (finished) { - setLoaded(loadingId); - unregisterTask(taskId); - m_logger.debug(" Task "+taskId+" DONE. Should propagate changes "); - addDataChanged(ExtendedTableModelInterface.class); - propagateDataChanged(); - } - } - }; - - - // ask asynchronous loading of data - - DatabasePTMsTask task = new DatabasePTMsTask(callback); - task.initLoadPTMDataset(getProjectId(), m_ptmDataset.getDataset(), ptmDS, m_loadSitesAsClusters); - m_logger.debug("DataBoxPTMClusters : **** Register task DatabasePTMsTask.initLoadPTMDataset. ID= "+task.getId()); - registerTask(task); - - } - - private void displayLoadError(long taskId, boolean isFinished){ - TaskInfo ti = getTaskInfo(taskId); - - TaskError taskError = ti.getTaskError(); - if (taskError != null) { - if (taskError.getErrorTitle().equals(DatabasePTMsTask.ERROR_PTM_CLUSTER_LOADING)) { - JOptionPane.showMessageDialog(((JPanel) getDataBoxPanelInterface()), "To display Modification Sites or Modification Clusters, you must run \"Identify Modification Sites\" beforehand.", taskError.getErrorTitle(), JOptionPane.WARNING_MESSAGE); - } else { - JOptionPane.showMessageDialog(((JPanel) getDataBoxPanelInterface()), taskError.getErrorText(), DatabasePTMsTask.ERROR_PTM_CLUSTER_LOADING, JOptionPane.ERROR_MESSAGE); - } - - } - - ((PTMClustersPanel) getDataBoxPanelInterface()).setData(taskId, null, isFinished); - - } - - private boolean m_loadPepMatchOnGoing = false; - private void loadPeptideMatches(){ - - final int loadingId = setLoading(); - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, final long taskId, SubTask subTask, boolean finished) { - m_logger.debug("DataBoxPTMClusters : **** Callback task "+taskId+", success "+success+", finished "+finished+"; with subtask : "+subTask+". Duration: "+(System.currentTimeMillis()-logStartTime)+" TimeMillis"); - if(!success){ - displayLoadError(taskId, finished); - } - - if (finished) { - m_loadPepMatchOnGoing = false; - m_logger.debug(" Task "+taskId+" DONE. Should propagate changes or get Xic DATA "); - m_ptmDataset.updateParentPTMPeptideInstanceClusters(); - if(isXicResult()){ - loadXicData(loadingId); - } else { - setLoaded(loadingId); - ((PTMClustersPanel) getDataBoxPanelInterface()).dataUpdated(subTask, finished); - addDataChanged(PTMPeptideInstance.class, null); //JPM.DATABOX : put null, because I don't know which subtype has been change : null means all. So it works as previously - addDataChanged(ExtendedTableModelInterface.class); - propagateDataChanged(); - } - unregisterTask(taskId); - } - } - }; - - DatabasePTMsTask task = new DatabasePTMsTask(callback); - task.initFillPTMSites(getProjectId(), m_ptmDataset, m_ptmDataset.getPTMSites()); - logStartTime = System.currentTimeMillis(); - m_logger.debug("DataBoxPTMClusters : **** Register task DatabasePTMsTask.initFillPTMSites. ID= " +task.getId()); - registerTask(task); - } - - public void loadXicData(int loadingId) { - List m_masterQuantProteinSetList = new ArrayList(); - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, final long taskId, SubTask subTask, boolean finished) { - m_logger.debug("DataBoxPTMClusters : **** Callback task "+taskId+", success "+success+", finished "+finished+"; with subtask : "+subTask+"; found "+m_masterQuantProteinSetList.size()+" mqPrS Duration: "+(System.currentTimeMillis()-logStartTime)+" TimeMillis"); - if (subTask == null) { - //Do at Main task return. - m_quantChannelInfo = new QuantChannelInfo(m_ptmDataset.getDataset()); - getDataBoxPanelInterface().addSingleValue(m_quantChannelInfo); - AbstractDatabaseCallback mapCallback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, long task2Id, SubTask subTask, boolean finished) { - m_logger.info("**** +++ END task "+task2Id+" if finished ? "+finished); - if (finished) { -// m_quantChannelInfo = new QuantChannelInfo(m_ptmDataset.getDataset()); -// getDataBoxPanelInterface().addSingleValue(m_quantChannelInfo); - unregisterTask(task2Id); - } - } - - }; - // ask asynchronous loading of data - DatabaseLoadLcMSTask taskMap = new DatabaseLoadLcMSTask(mapCallback); - taskMap.initLoadAlignmentForXic(getProjectId(), m_ptmDataset.getDataset()); - m_logger.info("DataBoxPTMClusters **** +++ Register task DatabaseLoadLcMSTask.initLoadAlignmentForXic "+taskMap.getId()); - registerTask(taskMap); - - } - - if (finished) { - m_logger.info(" **** +++ Unregister "+taskId+" + loadProteinMatchMapping + propagate and set Loaded"); - setLoaded(loadingId); - Map typicalProteinMatchIdByProteinMatchId = loadProteinMatchMapping(); - m_ptmDataset.setQuantProteinSets(m_masterQuantProteinSetList, typicalProteinMatchIdByProteinMatchId); - unregisterTask(taskId); - startLoadingMasterQuantPeptides(m_ptmDataset.getPTMClusters()); - addDataChanged(ExtendedTableModelInterface.class); - propagateDataChanged(); - } - } - }; - - // ask asynchronous loading of data - DatabaseLoadXicMasterQuantTask task = new DatabaseLoadXicMasterQuantTask(callback); - task.initLoadProteinSets(getProjectId(), m_ptmDataset.getDataset(), m_masterQuantProteinSetList); - logStartTime = System.currentTimeMillis(); - m_logger.debug("DataBoxPTMClusters : ****Register task XicMasterQuantTask - initLoadProteinSets. ID = "+task.getId()); - registerTask(task); - } - - - private Map loadProteinMatchMapping() { - Map typicalProteinMatchIdByProteinMatchId = new HashMap<>(); - EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(getProjectId()).createEntityManager(); - try { - - entityManagerMSI.getTransaction().begin(); - - long start = System.currentTimeMillis(); - // Load Proteins for PeptideMatch - Query proteinMatchQuery = entityManagerMSI.createQuery("SELECT pspmi.proteinMatch.id, pspmi.proteinSet.representativeProteinMatchId FROM ProteinSetProteinMatchItem pspmi WHERE pspmi.resultSummary.id=:rsmId"); - proteinMatchQuery.setParameter("rsmId", m_ptmDataset.getDataset().getResultSummaryId()); - List resultList = proteinMatchQuery.getResultList(); - Iterator iterator = resultList.iterator(); - - while (iterator.hasNext()) { - Object[] cur = iterator.next(); - Long proteinMatchId = (Long) cur[0]; - Long typicalProteinMatchId = (Long) cur[1]; - typicalProteinMatchIdByProteinMatchId.put(proteinMatchId, typicalProteinMatchId); - } - - m_logger.info("Protein match ids map retrieve {} entries in {} ms", typicalProteinMatchIdByProteinMatchId.size(), (System.currentTimeMillis() - start)); - entityManagerMSI.getTransaction().commit(); - } catch (RuntimeException e) { - try { - entityManagerMSI.getTransaction().rollback(); - } catch (Exception rollbackException) { - m_logger.error(getClass().getSimpleName() + " failed : potential network problem", rollbackException); - } - m_logger.error(getClass().getSimpleName() + " failed : ", e); - return null; - } finally { - entityManagerMSI.close(); - } - return typicalProteinMatchIdByProteinMatchId; - } - - - private void startLoadingMasterQuantPeptides(final List proteinPTMClusters) { - m_logger.debug("start loading MQPeptides from PTMCluster and compute PTMCluster expression values"); - List masterQuantPeptideList = new ArrayList(); - - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, final long taskId, SubTask subTask, boolean finished) { - if(finished) { - unregisterTask(taskId); - m_logger.info("MQPeptides loaded !! "); - DMasterQuantitationChannel masterQC = proteinPTMClusters.get(0).getPTMDataset().getDataset().getMasterQuantitationChannels().get(0); - Map mqPepById = masterQuantPeptideList.stream().collect(Collectors.toMap(x -> x.getPeptideInstanceId(), x -> x)); - - for (PTMCluster currentCluster : proteinPTMClusters) { - if (currentCluster.getMasterQuantProteinSet() != null) { - - // Update DMasterQuantPeptide for bestPtm - // Get BestPepMatch Parent DPeptideInstance - List parentPeptideInstances = currentCluster.getParentPeptideInstances(); - - // - // Best peptide match quantification - // - Long bestPepMatchPepId = currentCluster.getRepresentativePepMatch().getPeptide().getId(); - Optional parentBestPepI = parentPeptideInstances.stream().filter(peI ->bestPepMatchPepId.equals(peI.getPeptideId())).findFirst(); - if(parentBestPepI.isPresent()) { - DMasterQuantPeptide mqPep = mqPepById.get(parentBestPepI.get().getId()); - currentCluster.setRepresentativeMQPepMatch(mqPep); - } - - // - // Sum of peptides - // - List mqPeps = parentPeptideInstances.stream().map(parentPepI -> mqPepById.get(parentPepI.getId())).filter(mqp -> mqp != null).collect(Collectors.toList()); - currentCluster.setRepresentativeMQPepMatch(new AggregatedMasterQuantPeptide(mqPeps, masterQC)); - } - } - //Update Cluster Panel - ((PTMClustersPanel) getDataBoxPanelInterface()).dataUpdated(subTask, finished); - } - } - }; - - - DatabaseLoadXicMasterQuantTask task = new DatabaseLoadXicMasterQuantTask(callback); - List parentPepInstanceIds = proteinPTMClusters.stream().flatMap(cluster -> cluster.getParentPeptideInstances().stream()).map(pepInstance -> pepInstance.getId()).distinct().collect(Collectors.toList()); - m_logger.info("Loading {} peptideInstances XIC data", parentPepInstanceIds.size()); - task.initLoadPeptides(getProjectId(), m_ptmDataset.getDataset(), parentPepInstanceIds.toArray(new Long[parentPepInstanceIds.size()]), masterQuantPeptideList, true); - registerTask(task); - } - - - @Override - public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSubtype) { - if (parameterType!= null ) { - - if (parameterSubtype == ParameterSubtypeEnum.SINGLE_DATA) { - - if (parameterType.equals(ResultSummary.class)) { - return m_rsm; - } - - if (parameterType.equals(DProteinMatch.class)) { - PTMCluster cluster = ((PTMClustersPanel)getDataBoxPanelInterface()).getSelectedProteinPTMCluster(); - if (cluster != null) { - return cluster.getProteinMatch(); - } - } - if (parameterType.equals(DPeptideMatch.class)) { - PTMCluster cluster = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedProteinPTMCluster(); - if (cluster != null) { - return cluster.getRepresentativePepMatch(); - } - } - - if (parameterType.equals(PTMDataset.class)) { - return m_ptmDataset; - } - if (parameterType.equals(DDataset.class)) { - return m_ptmDataset.getDataset(); - } - //XIC Specific ---- - if (parameterType.equals(DMasterQuantProteinSet.class) && isXicResult()) { - PTMCluster cluster = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedProteinPTMCluster(); - if (cluster != null) { - return cluster.getMasterQuantProteinSet(); - } - } - if (parameterType.equals(DProteinSet.class) && isXicResult()) { - PTMCluster cluster = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedProteinPTMCluster(); - if (cluster != null && cluster.getMasterQuantProteinSet() != null) { - return cluster.getMasterQuantProteinSet().getProteinSet(); - } - } - if (parameterType.equals(QuantChannelInfo.class) && isXicResult()) { - return m_quantChannelInfo; - } - - if (parameterType.equals(ExtendedTableModelInterface.class)) { - return ((GlobalTabelModelProviderInterface) getDataBoxPanelInterface()).getGlobalTableModelInterface(); - } - if (parameterType.equals(CrossSelectionInterface.class)) { - return ((GlobalTabelModelProviderInterface) getDataBoxPanelInterface()).getCrossSelectionInterface(); - } - if (parameterType.equals(XicMode.class) && m_ptmDataset.getDataset().isQuantitation()) { - return new XicMode(true); - } - } - - if (parameterSubtype == ParameterSubtypeEnum.LIST_DATA) { - if (parameterType.equals(PTMCluster.class)) { - List clusters = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedPTMClusters(); - return clusters; - } - } - - - if (parameterType.equals(PTMPeptideInstance.class) && (parameterSubtype.equals(ParameterSubtypeEnum.PARENT_PTMPeptideInstance) || parameterSubtype.equals(ParameterSubtypeEnum.LEAF_PTMPeptideInstance)) ) { - if (m_loadPepMatchOnGoing) { - return null; - } - boolean parentPTMPeptideInstance = parameterSubtype.equals(ParameterSubtypeEnum.PARENT_PTMPeptideInstance); - - List clusters = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedPTMClusters(); - List ptmPeptideInstances = new ArrayList<>(); - if (!clusters.isEmpty()) { - Collections.sort(clusters); - //get First Selected Cluster, and consider only PTMCluster on same protein match - Long protMatchId = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedProteinPTMCluster().getProteinMatch().getId(); - clusters.stream().filter(cluster -> protMatchId.equals(cluster.getProteinMatch().getId())).forEach(cluster -> {ptmPeptideInstances.addAll(parentPTMPeptideInstance ? cluster.getParentPTMPeptideInstances() : cluster.getLeafPTMPeptideInstances()); }); - } - return ptmPeptideInstances; - } - - - } - - return super.getDataImpl(parameterType, parameterSubtype); - } - - @Override - public void setEntryData(Object data) { - - getDataBoxPanelInterface().addSingleValue(data); - if(DDataset.class.isInstance(data)){ - m_ptmDataset = new PTMDataset((DDataset)data); - //Test if rsm is loaded - if(m_ptmDataset.getDataset().getResultSummary() == null ){ - // we have to load the RSM/RS - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - m_rsm = m_ptmDataset.getDataset().getResultSummary(); //facilitation === PTM Ident - dataChanged(); - } - }; - - // ask asynchronous loading of data - DatabaseDataSetTask task = new DatabaseDataSetTask(callback); - task.initLoadRsetAndRsm((DDataset)data); - AccessDatabaseThread.getAccessDatabaseThread().addTask(task); - } else { - m_rsm = m_ptmDataset.getDataset().getResultSummary(); //facilitation === PTM Ident - dataChanged(); - } - } else if(PTMDataset.class.isInstance(data)){ - m_ptmDataset = (PTMDataset) data; - if(m_ptmDataset.getDataset().getResultSummary() == null ){ - throw new IllegalArgumentException("PTMDataset not associated to a valid DDataset (empty RSM)."); - } - m_rsm = m_ptmDataset.getDataset().getResultSummary(); //facilitation === PTM Ident - - dataChanged(); - } else - throw new IllegalArgumentException("Unsupported type "+data.getClass()+": DDataset or PTMDataset expected."); - } - - @Override - public Class[] getImportantInParameterClass() { - if(isXicResult()){ - Class[] classList = {DProteinMatch.class, DMasterQuantProteinSet.class}; - return classList; - }else{ - Class[] classList = {DProteinMatch.class}; - return classList; - } - } - - @Override - public String getImportantOutParameterValue() { - DProteinMatch p = (DProteinMatch) getData(DProteinMatch.class); - if (p != null) { - return p.getAccession(); - } - return null; - } - - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.pattern; + +import fr.proline.core.orm.msi.ResultSummary; +import fr.proline.core.orm.msi.dto.DMasterQuantPeptide; +import fr.proline.core.orm.msi.dto.DMasterQuantProteinSet; +import fr.proline.core.orm.msi.dto.DPeptideInstance; +import fr.proline.core.orm.msi.dto.DPeptideMatch; +import fr.proline.core.orm.msi.dto.DProteinMatch; +import fr.proline.core.orm.msi.dto.DProteinSet; +import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.core.orm.util.DStoreCustomPoolConnectorFactory; +import fr.proline.studio.dam.AccessDatabaseThread; +import fr.proline.studio.dam.DatabaseDataManager; +import fr.proline.studio.dam.taskinfo.TaskError; +import fr.proline.studio.dam.taskinfo.TaskInfo; +import fr.proline.studio.dam.tasks.*; +import fr.proline.studio.dam.tasks.data.ptm.*; +import fr.proline.studio.dam.tasks.xic.DatabaseLoadLcMSTask; +import fr.proline.studio.dam.tasks.xic.DatabaseLoadXicMasterQuantTask; +import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; +import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; +import fr.proline.studio.graphics.CrossSelectionInterface; +import fr.proline.studio.rsmexplorer.DataBoxViewerManager; +import fr.proline.studio.rsmexplorer.gui.PTMClustersPanel; +import fr.proline.studio.rsmexplorer.gui.xic.QuantChannelInfo; +import fr.proline.studio.types.XicMode; + +import java.util.*; +import java.util.stream.Collectors; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author VD225637 + */ +public class DataBoxPTMClusters extends AbstractDataBox { + + private final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer.ptm"); + + private boolean m_loadSitesAsClusters; + private boolean m_isAnnotatedData; + private long logStartTime; + + private PTMDatasetPair m_ptmDatasetPair; + private DDataset m_datasetSet; + private ResultSummary m_rsm; + private QuantChannelInfo m_quantChannelInfo; //Xic Specific + private boolean m_isXicResult = false; //If false: display Ident result PTM Clusters + + private boolean m_shouldBeSaved = false; //Indicates data of this Databox are not saved in datastore; + + public DataBoxPTMClusters() { + this(false, false); + } + + public DataBoxPTMClusters(boolean viewSitesAsClusters) { + this(viewSitesAsClusters, false); + } + + public DataBoxPTMClusters(boolean viewSitesAsClusters, boolean isAnnotatedData) { + super(viewSitesAsClusters ? DataboxType.DataBoxPTMSiteAsClusters : DataboxType.DataBoxPTMClusters, AbstractDataBox.DataboxStyle.STYLE_RSM); + m_loadSitesAsClusters = viewSitesAsClusters; + m_isAnnotatedData = isAnnotatedData; + + // Name of this databox + m_typeName = viewSitesAsClusters ? (isAnnotatedData ? "Annotated PTMs Sites" : "Dataset PTMs Sites") : (isAnnotatedData ? "Annotated PTMs Clusters" : "Dataset PTMs Clusters"); //May be Quant PTM Protein Sites... + m_description = "Clusters of Modification Sites of a Dataset";//May be Ident or Quant dataset... + + // Register in parameters + ParameterList inParameter = new ParameterList(); + + inParameter.addParameter(PTMDataset.class); + inParameter.addParameter(DDataset.class); + + registerInParameter(inParameter); + + // Register possible out parameters + ParameterList outParameter = new ParameterList(); + outParameter.addParameter(ResultSummary.class); + + outParameter.addParameter(PTMPeptideInstance.class, ParameterSubtypeEnum.LEAF_PTMPeptideInstance); + outParameter.addParameter(PTMPeptideInstance.class, ParameterSubtypeEnum.PARENT_PTMPeptideInstance); + outParameter.addParameter(PTMDataset.class); + outParameter.addParameter(PTMDatasetPair.class); + + outParameter.addParameter(DProteinMatch.class); + outParameter.addParameter(DPeptideMatch.class); + + outParameter.addParameter(PTMCluster.class, ParameterSubtypeEnum.LIST_DATA); + + outParameter.addParameter(ExtendedTableModelInterface.class); + outParameter.addParameter(CrossSelectionInterface.class); + + registerOutParameter(outParameter); + + } + + + private boolean isXicResult() { + return m_isXicResult; + } + + public void setXicResult(boolean isXICResult) { + m_isXicResult = isXICResult; + m_style = (m_isXicResult) ? DataboxStyle.STYLE_XIC : DataboxStyle.STYLE_RSM; + if (m_isXicResult) { + registerXicOutParameter(); + } + } + + private void registerXicOutParameter(){ + ParameterList outParameter = new ParameterList(); + + outParameter.addParameter(DMasterQuantProteinSet.class); + outParameter.addParameter(DProteinSet.class); + outParameter.addParameter(QuantChannelInfo.class); + + registerOutParameter(outParameter); + } + + @Override + public Long getRsetId() { + if (m_ptmDatasetPair == null) { + return null; + } + return m_datasetSet.getResultSetId(); + } + + @Override + public Long getRsmId() { + if (m_ptmDatasetPair == null) { + return null; + } + return m_datasetSet.getResultSummaryId(); + } + + @Override + public void createPanel() { + PTMClustersPanel p = new PTMClustersPanel(!m_loadSitesAsClusters); + p.setName(m_typeName); + p.setDataBox(this); + setDataBoxPanelInterface(p); + } + + + @Override + public void dataMustBeRecalculated(Long rsetId, Long rsmId, Class dataType, ArrayList modificationsList, byte reason) { + if(! ( isDataOfInterest(rsetId, rsmId, dataType) && dataType.equals(PTMCluster.class))) + return; + + DataBoxViewerManager.REASON_MODIF reasonModif = DataBoxViewerManager.REASON_MODIF.getReasonModifFor(reason); + if(reasonModif == null) + return; + switch (reasonModif){ + case REASON_PTMCLUSTER_MODIFIED: + m_shouldBeSaved = true; + break; + + case REASON_PTMDATASET_SAVED: + //If saved done this is now an annotated dataset cluster + m_isAnnotatedData = true; + m_shouldBeSaved = false; + break; + + case REASON_PTMCLUSTER_MERGED : + case REASON_PEPTIDE_SUPPRESSED: + m_shouldBeSaved = true; + addDataChanged(PTMPeptideInstance.class, null); + propagateDataChanged(); + break; + } + m_ptmDatasetPair.setShouldSavePTMDataset(m_shouldBeSaved); + } + + public boolean isClosable(){ + return !m_shouldBeSaved; + } + + public String getClosingWarningMessage(){ + if(m_shouldBeSaved) + return "Annotated PTM Dataset has not been saved...."; + return ""; + } + + //VDS TODO: Allow real inParameter: Actually this view works only as Top View ! Data set using setEntryData + @Override + public void dataChanged() { + + // register the link to the Transient Data + linkCache(m_rsm); + + final int loadingId = setLoading(); + final long logStartTimelocal = System.currentTimeMillis(); + List ptmDSSet = new ArrayList<>(); + AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success, long taskId, SubTask subTask, boolean finished) { + m_logger.debug("DataBoxPTMClusters : **** Callback task "+taskId+", success "+success+", finished "+finished+"; with subtask : "+(subTask != null)+". Duration: "+(System.currentTimeMillis()-logStartTimelocal)+" TimeMillis"); + if(success) { + if(subTask == null){ + //Main task callback! + + m_ptmDatasetPair = ptmDSSet.get(0); + getDataBoxPanelInterface().addSingleValue(m_ptmDatasetPair); + m_shouldBeSaved = false; + m_logger.debug(" -- created "+getPTMDatasetToView().getPTMClusters().size()+" PTMCluster."); + m_loadPepMatchOnGoing=true; + ((PTMClustersPanel) getDataBoxPanelInterface()).setData(taskId, (ArrayList) getPTMDatasetToView().getPTMClusters(), finished); + loadPeptideMatches(); + } else { + ((PTMClustersPanel) getDataBoxPanelInterface()).dataUpdated(subTask, finished); + } + } else{ + displayLoadError(taskId, finished); + } + + if (finished) { + setLoaded(loadingId); + unregisterTask(taskId); + if(m_isAnnotatedData) + DatabaseDataManager.getDatabaseDataManager().addLoadedAnnotatedPTMDatasetSet(ptmDSSet.get(0)); + else + DatabaseDataManager.getDatabaseDataManager().addLoadedPTMDatasetSet(ptmDSSet.get(0)); + m_logger.debug(" Task "+taskId+" DONE. Should propagate changes "); + addDataChanged(ExtendedTableModelInterface.class); + propagateDataChanged(); + } + } + }; + + + // ask asynchronous loading of data + + DatabaseDatasetPTMsTask task = new DatabaseDatasetPTMsTask(callback); + task.initLoadPTMDataset(getProjectId(), m_datasetSet, ptmDSSet, m_isAnnotatedData); + m_logger.debug("DataBoxPTMClusters : **** Register task DatabasePTMsTask.initLoadPTMDataset. ID= "+task.getId()); + registerTask(task); + + } + + private void displayLoadError(long taskId, boolean isFinished){ + TaskInfo ti = getTaskInfo(taskId); + + TaskError taskError = ti.getTaskError(); + if (taskError != null) { + if (DatabaseDatasetPTMsTask.ERROR_PTM_CLUSTER_LOADING.equals(taskError.getErrorTitle()) ) { + JOptionPane.showMessageDialog(((JPanel) getDataBoxPanelInterface()), "To display Modification Sites or Modification Clusters, you must run \"Identify Modification Sites\" beforehand.", taskError.getErrorTitle(), JOptionPane.WARNING_MESSAGE); + } else { + JOptionPane.showMessageDialog(((JPanel) getDataBoxPanelInterface()), taskError.getErrorText(), DatabaseDatasetPTMsTask.ERROR_PTM_CLUSTER_LOADING, JOptionPane.ERROR_MESSAGE); + } + + } + + ((PTMClustersPanel) getDataBoxPanelInterface()).setData(taskId, null, isFinished); + + } + + private boolean m_loadPepMatchOnGoing = false; + private void loadPeptideMatches(){ + + final int loadingId = setLoading(); + AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success, final long taskId, SubTask subTask, boolean finished) { + m_logger.debug("DataBoxPTMClusters : **** Callback task "+taskId+", success "+success+", finished "+finished+"; with subtask : "+subTask+". Duration: "+(System.currentTimeMillis()-logStartTime)+" TimeMillis"); + if(!success){ + displayLoadError(taskId, finished); + } + + if (finished) { + m_loadPepMatchOnGoing = false; + m_logger.debug(" Task "+taskId+" DONE. Should propagate changes or get Xic DATA "); + m_ptmDatasetPair.updateParentPTMPeptideInstanceClusters(); + unregisterTask(taskId); + + + if(isXicResult()){ + loadXicData(loadingId); + } else { + setLoaded(loadingId); + ((PTMClustersPanel) getDataBoxPanelInterface()).dataUpdated(subTask, finished); + addDataChanged(PTMPeptideInstance.class, null); //JPM.DATABOX : put null, because I don't know which subtype has been change : null means all. So it works as previously + addDataChanged(ExtendedTableModelInterface.class); + propagateDataChanged(); + } + unregisterTask(taskId); + } + } + }; + + DatabaseDatasetPTMsTask task = new DatabaseDatasetPTMsTask(callback); + List allSites = new ArrayList<>(m_ptmDatasetPair.getClusterPTMDataset().getPTMSites()); + allSites.addAll(m_ptmDatasetPair.getSitePTMDataset().getPTMSites()); + task.initFillPTMSites(getProjectId(), m_ptmDatasetPair, allSites); + logStartTime = System.currentTimeMillis(); + m_logger.debug("DataBoxPTMClusters : **** Register task DatabasePTMsTask.initFillPTMSites. ID= " +task.getId()); + registerTask(task); + } + + private void loadXicData(int loadingId) { + List masterQuantProteinSetList = new ArrayList<>(); + + AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success, final long taskId, SubTask subTask, boolean finished) { + m_logger.debug("DataBoxPTMClusters : **** Callback task "+taskId+", success "+success+", finished "+finished+"; with subtask : "+subTask+"; found "+masterQuantProteinSetList.size()+" mqPrS Duration: "+(System.currentTimeMillis()-logStartTime)+" TimeMillis"); + if (subTask == null) { + //Do at Main task return. + m_quantChannelInfo = new QuantChannelInfo(m_datasetSet); + getDataBoxPanelInterface().addSingleValue(m_quantChannelInfo); + AbstractDatabaseCallback mapCallback = new AbstractDatabaseCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success, long task2Id, SubTask subTask, boolean finished) { + m_logger.info("**** +++ END task "+task2Id+" if finished ? "+finished); + if (finished) { + unregisterTask(task2Id); + } + } + + }; + // ask asynchronous loading of data + DatabaseLoadLcMSTask taskMap = new DatabaseLoadLcMSTask(mapCallback); + taskMap.initLoadAlignmentForXic(getProjectId(), m_datasetSet); + m_logger.info("DataBoxPTMClusters **** +++ Register task DatabaseLoadLcMSTask.initLoadAlignmentForXic "+taskMap.getId()); + registerTask(taskMap); + + } + + if (finished) { + m_logger.info(" **** +++ Unregister "+taskId+" + loadProteinMatchMapping + propagate and set Loaded"); + setLoaded(loadingId); + Map typicalProteinMatchIdByProteinMatchId = loadProteinMatchMapping(); + m_ptmDatasetPair.getClusterPTMDataset().setQuantProteinSets(masterQuantProteinSetList, typicalProteinMatchIdByProteinMatchId); + m_ptmDatasetPair.getSitePTMDataset().setQuantProteinSets(masterQuantProteinSetList, typicalProteinMatchIdByProteinMatchId); + unregisterTask(taskId); + List allClusters = new ArrayList<>(m_ptmDatasetPair.getClusterPTMDataset().getPTMClusters()); + allClusters.addAll(m_ptmDatasetPair.getSitePTMDataset().getPTMClusters()); + startLoadingMasterQuantPeptides(allClusters); + addDataChanged(ExtendedTableModelInterface.class); + propagateDataChanged(); + } + } + }; + + // ask asynchronous loading of data + DatabaseLoadXicMasterQuantTask task = new DatabaseLoadXicMasterQuantTask(callback); + task.initLoadProteinSets(getProjectId(), m_datasetSet, masterQuantProteinSetList); + logStartTime = System.currentTimeMillis(); + m_logger.debug("DataBoxPTMClusters : ****Register task XicMasterQuantTask - initLoadProteinSets. ID = "+task.getId()); + registerTask(task); + } + + + private Map loadProteinMatchMapping() { + Map typicalProteinMatchIdByProteinMatchId = new HashMap<>(); + EntityManager entityManagerMSI = DStoreCustomPoolConnectorFactory.getInstance().getMsiDbConnector(getProjectId()).createEntityManager(); + try { + + entityManagerMSI.getTransaction().begin(); + + long start = System.currentTimeMillis(); + // Load Proteins for PeptideMatch + Query proteinMatchQuery = entityManagerMSI.createQuery("SELECT pspmi.proteinMatch.id, pspmi.proteinSet.representativeProteinMatchId FROM ProteinSetProteinMatchItem pspmi WHERE pspmi.resultSummary.id=:rsmId"); + proteinMatchQuery.setParameter("rsmId", m_datasetSet.getResultSummaryId()); + List resultList = proteinMatchQuery.getResultList(); + Iterator iterator = resultList.iterator(); + + while (iterator.hasNext()) { + Object[] cur = iterator.next(); + Long proteinMatchId = (Long) cur[0]; + Long typicalProteinMatchId = (Long) cur[1]; + typicalProteinMatchIdByProteinMatchId.put(proteinMatchId, typicalProteinMatchId); + } + + m_logger.info("Protein match ids map retrieve {} entries in {} ms", typicalProteinMatchIdByProteinMatchId.size(), (System.currentTimeMillis() - start)); + entityManagerMSI.getTransaction().commit(); + } catch (RuntimeException e) { + try { + entityManagerMSI.getTransaction().rollback(); + } catch (Exception rollbackException) { + m_logger.error(getClass().getSimpleName() + " failed : potential network problem", rollbackException); + } + m_logger.error(getClass().getSimpleName() + " failed : ", e); + return null; + } finally { + entityManagerMSI.close(); + } + return typicalProteinMatchIdByProteinMatchId; + } + + + private void startLoadingMasterQuantPeptides(final List proteinPTMClusters) { + m_logger.debug("start loading MQPeptides from PTMCluster and compute PTMCluster expression values"); + List masterQuantPeptideList = new ArrayList<>(); + + AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success, final long taskId, SubTask subTask, boolean finished) { + if(finished) { + unregisterTask(taskId); + m_logger.info("MQPeptides loaded !! "); + Map mqPepByPepInstId = masterQuantPeptideList.stream().collect(Collectors.toMap(DMasterQuantPeptide::getPeptideInstanceId, x -> x)); + + for (PTMCluster currentCluster : proteinPTMClusters) { + currentCluster.setRepresentativeMQPepMatch(getPTMDatasetToView().getRepresentativeMQPeptideForCluster(currentCluster, mqPepByPepInstId)); + } + + //Update Cluster Panel + ((PTMClustersPanel) getDataBoxPanelInterface()).dataUpdated(subTask, finished); + } + } + }; + + + DatabaseLoadXicMasterQuantTask task = new DatabaseLoadXicMasterQuantTask(callback); + List parentPepInstanceIds = proteinPTMClusters.stream().flatMap(cluster -> cluster.getParentPeptideInstances().stream()).map(DPeptideInstance::getId).distinct().collect(Collectors.toList()); + //VDS To complete parentPepInstanceIds with both PTMDataset ?! + m_logger.info("Loading {} peptideInstances XIC data", parentPepInstanceIds.size()); + task.initLoadPeptides(getProjectId(),m_datasetSet, parentPepInstanceIds.toArray(new Long[0]), masterQuantPeptideList, true); + registerTask(task); + } + + + @Override + public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSubtype) { + if (parameterType!= null ) { + + if (parameterSubtype == ParameterSubtypeEnum.SINGLE_DATA) { + + if (parameterType.equals(ResultSummary.class)) { + return m_rsm; + } + + if (parameterType.equals(DProteinMatch.class)) { + PTMCluster cluster = ((PTMClustersPanel)getDataBoxPanelInterface()).getSelectedProteinPTMCluster(); + if (cluster != null) { + return cluster.getProteinMatch(); + } + } + if (parameterType.equals(DPeptideMatch.class)) { + PTMCluster cluster = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedProteinPTMCluster(); + if (cluster != null) { + return cluster.getRepresentativePepMatch(); + } + } + + if (parameterType.equals(PTMDataset.class)) { + return getPTMDatasetToView(); + } + if (parameterType.equals(DDataset.class)) { + return m_datasetSet; + } + if(parameterType.equals(PTMDatasetPair.class)){ + return m_ptmDatasetPair; + } + + //XIC Specific ---- + if (parameterType.equals(DMasterQuantProteinSet.class) && isXicResult()) { + PTMCluster cluster = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedProteinPTMCluster(); + if (cluster != null) { + return cluster.getMasterQuantProteinSet(); + } + } + if (parameterType.equals(DProteinSet.class) && isXicResult()) { + PTMCluster cluster = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedProteinPTMCluster(); + if (cluster != null && cluster.getMasterQuantProteinSet() != null) { + return cluster.getMasterQuantProteinSet().getProteinSet(); + } + } + if (parameterType.equals(QuantChannelInfo.class) && isXicResult()) { + return m_quantChannelInfo; + } + + if (parameterType.equals(ExtendedTableModelInterface.class)) { + return ((GlobalTabelModelProviderInterface) getDataBoxPanelInterface()).getGlobalTableModelInterface(); + } + if (parameterType.equals(CrossSelectionInterface.class)) { + return ((GlobalTabelModelProviderInterface) getDataBoxPanelInterface()).getCrossSelectionInterface(); + } + if (parameterType.equals(XicMode.class) && m_datasetSet.isQuantitation()) { + return new XicMode(true); + } + } + + if (parameterSubtype == ParameterSubtypeEnum.LIST_DATA) { + if (parameterType.equals(PTMCluster.class)) { + return ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedPTMClusters(); + } + } + + + if (parameterType.equals(PTMPeptideInstance.class) && (parameterSubtype.equals(ParameterSubtypeEnum.PARENT_PTMPeptideInstance) || parameterSubtype.equals(ParameterSubtypeEnum.LEAF_PTMPeptideInstance)) ) { + if (m_loadPepMatchOnGoing) { + return null; + } + boolean parentPTMPeptideInstance = parameterSubtype.equals(ParameterSubtypeEnum.PARENT_PTMPeptideInstance); + + List clusters = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedPTMClusters(); + List ptmPeptideInstances = new ArrayList<>(); + if (!clusters.isEmpty()) { + Collections.sort(clusters); + //get First Selected Cluster, and consider only PTMCluster on same protein match + Long protMatchId = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedProteinPTMCluster().getProteinMatch().getId(); + clusters.stream().filter(cluster -> protMatchId.equals(cluster.getProteinMatch().getId())).forEach(cluster -> { + ptmPeptideInstances.addAll(parentPTMPeptideInstance ? cluster.getParentPTMPeptideInstances() : cluster.getLeafPTMPeptideInstances()); + }); + } + return ptmPeptideInstances; + } + + + } + + return super.getDataImpl(parameterType, parameterSubtype); + } + + private PTMDataset getPTMDatasetToView(){ + if(m_loadSitesAsClusters) + return m_ptmDatasetPair.getSitePTMDataset(); + else + return m_ptmDatasetPair.getClusterPTMDataset(); + } + + @Override + public void setEntryData(Object data) { + + getDataBoxPanelInterface().addSingleValue(data); + if(data instanceof DDataset){ + //Test if PTMDataset already loaded + m_datasetSet = (DDataset)data; + m_ptmDatasetPair = m_isAnnotatedData ? DatabaseDataManager.getDatabaseDataManager().getAnnotatedPTMDatasetSetForDS(m_datasetSet.getId() ) : DatabaseDataManager.getDatabaseDataManager().getPTMDatasetSetForDS( m_datasetSet.getId() ); + + //Not yet loaded. Init dataset if needed before loading all data => dataChanged(); + if( m_ptmDatasetPair == null){ + + //Test if rsm is loaded + if (m_datasetSet.getResultSummary() == null) { + + // we have to load the RSM/RS + AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success, long taskId, SubTask subTask, boolean finished) { + m_rsm = ((DDataset) data).getResultSummary(); //facilitation === PTM Ident + dataChanged(); + } + }; + + // ask asynchronous loading of data + DatabaseDataSetTask task = new DatabaseDataSetTask(callback); + task.initLoadRsetAndRsm((DDataset) data); + AccessDatabaseThread.getAccessDatabaseThread().addTask(task); + } else { + //RSM already loaded. + m_rsm = ((DDataset) data).getResultSummary(); //facilitation === PTM Ident + dataChanged(); + } + + // End PTMDataset is not defined + } else { + //PTMDataset exist. + m_rsm = m_datasetSet.getResultSummary(); + getDataBoxPanelInterface().addSingleValue(m_ptmDatasetPair); + if(m_ptmDatasetPair.shouldSavePTMDataset()) + m_shouldBeSaved = true; + + // Verfiy if PTMDataset has quantitation data (if needed) + if(isXicResult()) { + boolean allDataLoaded = getPTMDatasetToView().isQuantDataLoaded(); + if(allDataLoaded) { + //data already loaded. init param and load associated panel + m_quantChannelInfo = new QuantChannelInfo(m_datasetSet); + getDataBoxPanelInterface().addSingleValue(m_quantChannelInfo); + ((PTMClustersPanel) getDataBoxPanelInterface()).setData(-1L, (ArrayList) getPTMDatasetToView().getPTMClusters(), false); + ((PTMClustersPanel) getDataBoxPanelInterface()).dataUpdated(null, true); + } else { + //load XIC data + final int loadingId = setLoading(); + loadXicData(loadingId); + } + } else { + //Identification PTMDataset + //load associated panel + ((PTMClustersPanel) getDataBoxPanelInterface()).setData(-1L, (ArrayList) getPTMDatasetToView().getPTMClusters(), false); + ((PTMClustersPanel) getDataBoxPanelInterface()).dataUpdated(null, true); + } + + } //END IF/Else PTMDataset exist + + } else if(data instanceof PTMDataset){ //specified data is not DDataset, check if it is a PTMDataset + + // If PTMDataset is specified it should be initialized ... + m_ptmDatasetPair = m_isAnnotatedData ? DatabaseDataManager.getDatabaseDataManager().getAnnotatedPTMDatasetSetForDS( ((PTMDataset) data).getDataset().getId() ) : DatabaseDataManager.getDatabaseDataManager().getPTMDatasetSetForDS( ((PTMDataset) data).getDataset().getId() ); + if(m_ptmDatasetPair == null || (!m_ptmDatasetPair.getClusterPTMDataset().equals(data) && !m_ptmDatasetPair.getSitePTMDataset().equals(data))) + throw new IllegalArgumentException("Invalid specified PTMDataset."); + getDataBoxPanelInterface().addSingleValue(m_ptmDatasetPair); + //set parameter before loading associated panel + m_datasetSet = m_ptmDatasetPair.getDataset(); + m_rsm = m_datasetSet.getResultSummary(); + + // Verfiy if PTMDataset has quantitation data (if needed) + if(isXicResult()) { + boolean allDataLoaded = getPTMDatasetToView().isQuantDataLoaded(); + if(allDataLoaded) { + //data already loaded. init param and load associated panel + m_quantChannelInfo = new QuantChannelInfo(m_datasetSet); + getDataBoxPanelInterface().addSingleValue(m_quantChannelInfo); + ((PTMClustersPanel) getDataBoxPanelInterface()).setData(-1L, (ArrayList) ((PTMDataset) data).getPTMClusters(), false); + ((PTMClustersPanel) getDataBoxPanelInterface()).dataUpdated(null, true); + } else { + //load XIC data + final int loadingId = setLoading(); + loadXicData(loadingId); + } + } else { + //Identification PTMDataset + //load associated panel + ((PTMClustersPanel) getDataBoxPanelInterface()).setData(-1L, (ArrayList) ((PTMDataset) data).getPTMClusters(), false); + ((PTMClustersPanel) getDataBoxPanelInterface()).dataUpdated(null, true); + } + + } else //specified data is neither a DDataset nor PTMDataset + throw new IllegalArgumentException("Unsupported type "+data.getClass()+": DDataset or PTMDataset expected."); + } + + @Override + public Class[] getDataboxNavigationOutParameterClasses() { + if(isXicResult()){ + return new Class[]{DProteinMatch.class, PTMDatasetPair.class, DMasterQuantProteinSet.class}; + }else{ + return new Class[]{DProteinMatch.class, PTMDatasetPair.class}; + } + } + + @Override + public String getDataboxNavigationDisplayValue() { + List selectedCl = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedPTMClusters(); + if(selectedCl == null || selectedCl.isEmpty()) + return null; + + DProteinMatch p = selectedCl.get(0).getProteinMatch(); + + int nbrPM = selectedCl.stream().collect( Collectors.groupingBy(PTMCluster::getProteinMatch)).size(); + + if(nbrPM>1) + return p.getAccession()+"+ "+(nbrPM-1); + else + return p.getAccession(); + + } + + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMClustersSites.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMClustersSites.java new file mode 100644 index 000000000..dede0885e --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMClustersSites.java @@ -0,0 +1,246 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.pattern; + +import fr.proline.core.orm.msi.dto.DMasterQuantProteinSet; +import fr.proline.core.orm.msi.dto.DPeptideMatch; +import fr.proline.core.orm.msi.dto.DProteinMatch; +import fr.proline.core.orm.msi.dto.DProteinSet; +import fr.proline.studio.dam.tasks.data.ptm.PTMCluster; +import fr.proline.studio.dam.tasks.data.ptm.PTMDataset; +import fr.proline.studio.dam.tasks.data.ptm.PTMDatasetPair; +import fr.proline.studio.dam.tasks.data.ptm.PTMPeptideInstance; +import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; +import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; +import fr.proline.studio.graphics.CrossSelectionInterface; +import fr.proline.studio.rsmexplorer.gui.PTMClustersPanel; +import fr.proline.studio.rsmexplorer.gui.xic.QuantChannelInfo; +import fr.proline.studio.types.XicMode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * + * @author VD225637 + */ +public class DataBoxPTMClustersSites extends AbstractDataBox { + + private final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer.ptm"); + + private PTMDatasetPair m_currentPtmDs; + private ArrayList m_clusters; + private QuantChannelInfo m_quantChannelInfo; //Xic Specific + private boolean m_isXicResult; + + public DataBoxPTMClustersSites() { + this(false); + } + + public DataBoxPTMClustersSites(boolean isXICResult) { + super(isXICResult ? DataboxType.DataBoxXicPTMClustersSites : DataboxType.DataBoxPTMClustersSites, isXICResult ? DataboxStyle.STYLE_XIC : DataboxStyle.STYLE_RSM); + + // Name of this databox + m_typeName = isXICResult ? "Quantitation Clusters PTMs Sites" : "Clusters PTMs Sites"; + + m_description = isXICResult ? "Quantitation Modification Sites of Clusters" : "Modification Sites of Clusters"; + m_isXicResult = isXICResult; + + // Register in parameters + ParameterList inParameter = new ParameterList(); + inParameter.addParameter(PTMCluster.class, ParameterSubtypeEnum.LIST_DATA); + inParameter.addParameter(PTMDatasetPair.class); + if (m_isXicResult) { + inParameter.addParameter(QuantChannelInfo.class); + } + registerInParameter(inParameter); + + // Register possible out parameters + ParameterList outParameter = new ParameterList(); + outParameter.addParameter(PTMPeptideInstance.class, ParameterSubtypeEnum.LEAF_PTMPeptideInstance); + outParameter.addParameter(PTMPeptideInstance.class, ParameterSubtypeEnum.PARENT_PTMPeptideInstance); + + outParameter.addParameter(DProteinMatch.class); + outParameter.addParameter(DPeptideMatch.class); + + outParameter.addParameter(PTMCluster.class, ParameterSubtypeEnum.LIST_DATA); + + outParameter.addParameter(ExtendedTableModelInterface.class); + outParameter.addParameter(CrossSelectionInterface.class); + + registerOutParameter(outParameter); + if (m_isXicResult) { + registerXicOutParameter(); + } + } + + private boolean isXicResult() { + return m_isXicResult; + } + + private void registerXicOutParameter(){ + ParameterList outParameter = new ParameterList(); + + outParameter.addParameter(DMasterQuantProteinSet.class); + outParameter.addParameter(DProteinSet.class); + outParameter.addParameter(QuantChannelInfo.class); + + registerOutParameter(outParameter); + } + + @Override + public void createPanel() { + PTMClustersPanel p = new PTMClustersPanel(false); + p.setName(m_typeName); + p.setDataBox(this); + setDataBoxPanelInterface(p); + } + + + @Override + public void dataChanged() { + + m_currentPtmDs =(PTMDatasetPair) m_previousDataBox.getData(PTMDatasetPair.class); + List newClusters = (List) m_previousDataBox.getData(PTMCluster.class, ParameterSubtypeEnum.LIST_DATA); + if(newClusters == null || newClusters.isEmpty()) { // && m_clusters != null && !m_clusters.isEmpty() ) { + m_clusters = null; + ((PTMClustersPanel) getDataBoxPanelInterface()).setData(null, m_clusters, true); + m_logger.debug("No PTM Clusters'Site to display. "); + return; + } + + m_clusters = new ArrayList<>(); + + if(m_isXicResult) { + m_quantChannelInfo = (QuantChannelInfo) m_previousDataBox.getData(QuantChannelInfo.class); + getDataBoxPanelInterface().addSingleValue(m_quantChannelInfo); + } + + PTMDataset siteDS = m_currentPtmDs.getSitePTMDataset(); + for(PTMCluster c : newClusters){ + c.getPTMSites().forEach(site -> { + PTMCluster siteCluster = siteDS.getPTMCluster(site.getId()); + if(siteCluster != null && !m_clusters.contains(siteCluster)) + m_clusters.add(siteCluster); + }); + } + + ((PTMClustersPanel) getDataBoxPanelInterface()).setData(null, m_clusters, true); + + } + + + @Override + public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSubtype) { + if (parameterType!= null ) { + + if (parameterSubtype == ParameterSubtypeEnum.SINGLE_DATA) { + if (parameterType.equals(DProteinMatch.class)) { + PTMCluster cluster = ((PTMClustersPanel)getDataBoxPanelInterface()).getSelectedProteinPTMCluster(); + if (cluster != null) { + return cluster.getProteinMatch(); + } + } + if (parameterType.equals(DPeptideMatch.class)) { + PTMCluster cluster = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedProteinPTMCluster(); + if (cluster != null) { + return cluster.getRepresentativePepMatch(); + } + } + + + //XIC Specific ---- + if (parameterType.equals(DMasterQuantProteinSet.class) && isXicResult()) { + PTMCluster cluster = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedProteinPTMCluster(); + if (cluster != null) { + return cluster.getMasterQuantProteinSet(); + } + } + if (parameterType.equals(DProteinSet.class) && isXicResult()) { + PTMCluster cluster = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedProteinPTMCluster(); + if (cluster != null && cluster.getMasterQuantProteinSet() != null) { + return cluster.getMasterQuantProteinSet().getProteinSet(); + } + } + if (parameterType.equals(QuantChannelInfo.class) && isXicResult()) { + return m_quantChannelInfo; + } + + if (parameterType.equals(ExtendedTableModelInterface.class)) { + return ((GlobalTabelModelProviderInterface) getDataBoxPanelInterface()).getGlobalTableModelInterface(); + } + if (parameterType.equals(CrossSelectionInterface.class)) { + return ((GlobalTabelModelProviderInterface) getDataBoxPanelInterface()).getCrossSelectionInterface(); + } + if (parameterType.equals(XicMode.class) && m_currentPtmDs.getClusterPTMDataset().isQuantitation()) { + return new XicMode(true); + } + } + + if (parameterSubtype == ParameterSubtypeEnum.LIST_DATA) { + if (parameterType.equals(PTMCluster.class)) { + return ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedPTMClusters(); + } + } + + + if (parameterType.equals(PTMPeptideInstance.class) && (parameterSubtype.equals(ParameterSubtypeEnum.PARENT_PTMPeptideInstance) || parameterSubtype.equals(ParameterSubtypeEnum.LEAF_PTMPeptideInstance)) ) { + + boolean parentPTMPeptideInstance = parameterSubtype.equals(ParameterSubtypeEnum.PARENT_PTMPeptideInstance); + + List clusters = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedPTMClusters(); + List ptmPeptideInstances = new ArrayList<>(); + if (!clusters.isEmpty()) { + Collections.sort(clusters); + //get First Selected Cluster, and consider only PTMCluster on same protein match + Long protMatchId = ((PTMClustersPanel) getDataBoxPanelInterface()).getSelectedProteinPTMCluster().getProteinMatch().getId(); + clusters.stream().filter(cluster -> protMatchId.equals(cluster.getProteinMatch().getId())).forEach(cluster -> {ptmPeptideInstances.addAll(parentPTMPeptideInstance ? cluster.getParentPTMPeptideInstances() : cluster.getLeafPTMPeptideInstances()); }); + } + return ptmPeptideInstances; + } + + + } + + return super.getDataImpl(parameterType, parameterSubtype); + } + + + + @Override + public Class[] getDataboxNavigationOutParameterClasses() { + if(isXicResult()){ + return new Class[]{DProteinMatch.class, DMasterQuantProteinSet.class}; + }else{ + return new Class[]{DProteinMatch.class}; + } + } + + @Override + public String getDataboxNavigationDisplayValue() { + DProteinMatch p = (DProteinMatch) getData(DProteinMatch.class); + if (p != null) { + return p.getAccession(); + } + return null; + } + + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMPeptides.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMPeptides.java index b825d65b7..122ba0589 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMPeptides.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMPeptides.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,9 +16,9 @@ */ package fr.proline.studio.pattern; +import fr.proline.core.orm.msi.Peptide; import fr.proline.core.orm.msi.dto.DMasterQuantPeptide; import fr.proline.core.orm.msi.dto.DMasterQuantProteinSet; -import fr.proline.core.orm.msi.dto.DPeptideInstance; import fr.proline.core.orm.msi.dto.DPeptideMatch; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; @@ -35,6 +35,8 @@ import fr.proline.studio.rsmexplorer.gui.xic.QuantChannelInfo; import fr.proline.studio.rsmexplorer.gui.xic.XICComparePeptideTableModel; import fr.proline.studio.rsmexplorer.gui.xic.XicAbundanceProteinTableModel; +import fr.proline.studio.types.XicMode; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -50,7 +52,7 @@ */ public class DataBoxPTMPeptides extends AbstractDataBoxPTMPeptides { - //For XIC Data only + //For Quantitation data only private QuantChannelInfo m_quantChannelInfo; private List m_masterQuantPeptideList; private DMasterQuantProteinSet m_masterQuantProteinSet; @@ -72,6 +74,17 @@ private static DataboxType getDataboxType(boolean xicResult, boolean showAllPepM } } + /** + * Create a DataBoxPTMPeptides : table view of PTMPeptideInstances. By + * default, this databox is displayed in a quantitation context and only + * best Peptide Match is displayed + * Warning: Default Constructor should be defined for Custom view & "Diaplay" navigation + * + */ + public DataBoxPTMPeptides() { + this(false, false); + } + /** * Create a DataBoxPTMPeptides : table view of PTMPeptideInstances. Specify * if this databox is displayed in a quantitation context and if all peptide @@ -82,10 +95,11 @@ private static DataboxType getDataboxType(boolean xicResult, boolean showAllPepM public DataBoxPTMPeptides(boolean xicResult, boolean showAllPepMatches) { super(getDataboxType(xicResult, showAllPepMatches), xicResult ? DataboxStyle.STYLE_XIC : DataboxStyle.STYLE_RSM); m_displayAllPepMatches = showAllPepMatches; - m_isXICResult = xicResult; - m_typeName = m_displayAllPepMatches ? "PSMs" : "Peptides"; - m_description = m_displayAllPepMatches ? "PSMs matching a modification site or cluster" : "Peptides matching of modification site or cluster"; - m_logger.debug(" ----> Created DataBoxPTMPeptides " + m_typeName); + m_isMS1LabelFreeQuantitation = xicResult; + StringBuilder stb = (m_isMS1LabelFreeQuantitation) ? new StringBuilder("Quanti. ") : new StringBuilder(); + m_typeName = m_displayAllPepMatches ? stb.append("Site PSMs").toString() : stb.append("Site Peptides").toString(); + stb = (m_isMS1LabelFreeQuantitation) ? new StringBuilder("Quantified ") : new StringBuilder(); + m_description = m_displayAllPepMatches ? stb.append("PSMs matching a modification site or cluster").toString() : stb.append("Peptides matching of modification site or cluster").toString(); // Register in parameters super.registerParameters(); @@ -93,7 +107,7 @@ public DataBoxPTMPeptides(boolean xicResult, boolean showAllPepMatches) { @Override public void createPanel() { - PTMPeptidesTablePanel p = new PTMPeptidesTablePanel(m_displayAllPepMatches, m_isXICResult); + PTMPeptidesTablePanel p = new PTMPeptidesTablePanel(m_displayAllPepMatches, m_isMS1LabelFreeQuantitation); p.setName(m_typeName); p.setDataBox(this); setDataBoxPanelInterface(p); @@ -126,7 +140,7 @@ public void updateData() { } //Get QuantInfo - if (m_isXICResult) { + if (m_isMS1LabelFreeQuantitation) { m_quantChannelInfo = (QuantChannelInfo) getData(QuantChannelInfo.class); if (m_quantChannelInfo != null) { panel.addSingleValue(m_quantChannelInfo); @@ -134,11 +148,11 @@ public void updateData() { m_masterQuantProteinSet = (DMasterQuantProteinSet) getData(DMasterQuantProteinSet.class); } - final List notLoadedPtmSite = getNotLoadedPTMSite(); - - if (notLoadedPtmSite.isEmpty()) { +// final List notLoadedPtmSite = getNotLoadedPTMSite(); +// +// if (notLoadedPtmSite.isEmpty()) { resetPrevPTMTaskId(); - if (m_isXICResult) { + if (m_isMS1LabelFreeQuantitation) { loadXicAndPropagate(); } else { ((PTMPeptidesTablePanel) getDataBoxPanelInterface()).setData(null, m_ptmPepInstances, m_ptmClusters, null, true); @@ -147,10 +161,46 @@ public void updateData() { addDataChanged(ExtendedTableModelInterface.class); propagateDataChanged(); } +// } else { +// loadPtmSite(notLoadedPtmSite); +// } + } + } + + @Override + public Class[] getDataboxNavigationOutParameterClasses() { + if(isMS1LabelFreeQuantitation()) { + return new Class[]{DMasterQuantPeptide.class, PTMPeptideInstance.class}; + } else { + return new Class[]{ PTMPeptideInstance.class}; + } + } + + @Override + public String getDataboxNavigationDisplayValue() { + try { + Peptide peptide = null; + if (isMS1LabelFreeQuantitation()) { + DMasterQuantPeptide qPep = ((PTMPeptidesTablePanel) getDataBoxPanelInterface()).getSelectedMasterQuantPeptide(); + if (qPep != null) + peptide = qPep.getPeptideInstance().getPeptide(); } else { - loadPtmSite(notLoadedPtmSite); + DPeptideMatch p = (DPeptideMatch) getData(DPeptideMatch.class); + if (p != null) { + peptide = p.getPeptide(); + } } + + if (peptide != null) { + return peptide.getSequence(); + } + + return null; + } catch (Exception e){ + m_logger.error("Error getting (quant) peptide information ",e); + return null; } + } private Long m_previousXICTaskId = null; @@ -231,7 +281,7 @@ public void run(boolean success, long task2Id, SubTask subTask, boolean finished }; // ask asynchronous loading of data - m_masterQuantPeptideList = new ArrayList(); + m_masterQuantPeptideList = new ArrayList<>(); if (m_previousXICTaskId != null) { // old task is suppressed if it has not been already done AccessDatabaseThread.getAccessDatabaseThread().abortTask(m_previousXICTaskId); @@ -249,7 +299,7 @@ public void run(boolean success, long task2Id, SubTask subTask, boolean finished @Override protected ArrayList getSelectedIndex() { ArrayList selection = ((PTMPeptidesTablePanel) this.m_panel).getCrossSelectionInterface().getSelection(); - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); for (Long l : selection) { result.add(l.intValue()); } @@ -265,7 +315,7 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub (!(panel instanceof SplittedPanelContainer.ReactiveTabbedComponent) || ((panel instanceof SplittedPanelContainer.ReactiveTabbedComponent) && ((SplittedPanelContainer.ReactiveTabbedComponent) panel).isShowed())) //JPM.DATABOX : this check could produce bugs - && m_isXICResult) { + && m_isMS1LabelFreeQuantitation) { // Returning single data if (parameterSubtype == ParameterSubtypeEnum.SINGLE_DATA) { @@ -278,8 +328,15 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub protTableModel.setName("Protein"); return protTableModel; } - if (parameterType.equals(DPeptideInstance.class)) { - ((PTMPeptidesTablePanel) getDataBoxPanelInterface()).getSelectedPTMPeptideInstance(); +// if (parameterType.equals(DPeptideInstance.class)) { +// return ((PTMPeptidesTablePanel) getDataBoxPanelInterface()).getSelectedPTMPeptideInstance(); +// } + + if (parameterType.equals(DMasterQuantPeptide.class)) { + return ((PTMPeptidesTablePanel) getDataBoxPanelInterface()).getSelectedMasterQuantPeptide() ; + } + if (parameterType.equals(XicMode.class)) { + return new XicMode(m_isMS1LabelFreeQuantitation); } } @@ -293,7 +350,7 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub if (parameterSubtype == ParameterSubtypeEnum.PEPTIDES_SELECTION_LIST) { if (parameterType.equals(Integer.class)) { CrossSelectionInterface crossSelectionInterface = ((PTMPeptidesTablePanel) this.m_panel).getCrossSelectionInterface(); - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); if (crossSelectionInterface != null) { ArrayList selection = null; try { @@ -316,7 +373,7 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub } private List getTableModelInterfaceList() { - List list = new ArrayList(); + List list = new ArrayList<>(); if (m_quantChannelInfo == null && m_previousDataBox != null) { m_quantChannelInfo = (QuantChannelInfo) getData(QuantChannelInfo.class); } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMPeptidesGraphic.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMPeptidesGraphic.java index 23a014b76..8fa30c5ad 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMPeptidesGraphic.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPTMPeptidesGraphic.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -26,11 +26,12 @@ import fr.proline.studio.dam.tasks.data.ptm.PTMPeptideInstance; import fr.proline.studio.dam.tasks.data.ptm.PTMSite; import fr.proline.studio.rsmexplorer.gui.ptm.PTMGraphicCtrlPanel; -import java.util.ArrayList; -import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.ArrayList; +import java.util.List; + /** * This class is very similaire as DataBoxPTMSitePeptides * @@ -47,7 +48,7 @@ public class DataBoxPTMPeptidesGraphic extends AbstractDataBoxPTMPeptides { public DataBoxPTMPeptidesGraphic() { super(DataboxType.DataBoxPTMPeptidesGraphic, DataboxStyle.STYLE_RSM); m_displayAllPepMatches = false; - m_isXICResult = false; + m_isMS1LabelFreeQuantitation = false; // Name of this databox m_typeName = "Graphical Peptides PTMs info"; @@ -94,7 +95,6 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) setLoaded(loadingId); if (success) { ((PTMGraphicCtrlPanel) getDataBoxPanelInterface()).setSelectedProtein(proteinMatch); - } else { } if (finished) { unregisterTask(taskId); @@ -122,18 +122,18 @@ public void updateData() { return; } loadPeptidesInstances(); - final List notLoadedPtmSite = getNotLoadedPTMSite(); - - if (notLoadedPtmSite.isEmpty()) { +// final List notLoadedPtmSite = getNotLoadedPTMSite(); +// +// if (notLoadedPtmSite.isEmpty()) { resetPrevPTMTaskId(); graphicView.setData(m_ptmPepInstances); addDataChanged(PTMPeptideInstance.class, null); //JPM.DATABOX : put null, because I don't know which subtype has been change : null means all. So it works as previously propagateDataChanged(); - } else { - - loadPtmSite(notLoadedPtmSite); - } +// } else { +// +// loadPtmSite(notLoadedPtmSite); +// } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPanelInterface.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPanelInterface.java index 50270307e..56fb5d765 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPanelInterface.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxPanelInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.pattern; import fr.proline.studio.gui.SplittedPanelContainer; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetAll.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetAll.java index 4e9978ddd..9562f1dbd 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetAll.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetAll.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetAllProteinMatch.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetAllProteinMatch.java index 081d00f1e..c60155d9f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetAllProteinMatch.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetAllProteinMatch.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -158,13 +158,12 @@ public void setEntryData(Object data) { } @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {DProteinMatch.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{DProteinMatch.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DProteinMatch pm = (DProteinMatch) getData(DProteinMatch.class); if (pm != null) { return pm.getAccession(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetMSDiag.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetMSDiag.java index d42b111cb..15e9683c2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetMSDiag.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetMSDiag.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPSM.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPSM.java index 2c289dbb5..c529962ab 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPSM.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPSM.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -20,15 +20,14 @@ import fr.proline.core.orm.msi.ResultSet; import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.msi.dto.DPeptideMatch; -import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; import fr.proline.studio.dam.AccessDatabaseThread; -import fr.proline.studio.dam.memory.TransientMemoryCacheManager; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; import fr.proline.studio.dam.tasks.DatabaseLoadPeptideMatchTask; import fr.proline.studio.dam.tasks.SubTask; +import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; +import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; import fr.proline.studio.graphics.CrossSelectionInterface; import fr.proline.studio.rsmexplorer.gui.PeptideMatchPanel; -import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; /** * Databox for all PSM of a ResultSet (Search Result) @@ -176,13 +175,12 @@ public void setEntryData(Object data) { } @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {DPeptideMatch.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{DPeptideMatch.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DPeptideMatch p = (DPeptideMatch) getData(DPeptideMatch.class); if (p != null) { Peptide peptide = p.getPeptide(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideFragmentation.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideFragmentation.java index 8bf214462..8aaa9d323 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideFragmentation.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideFragmentation.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideSpectrum.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideSpectrum.java index bab4052c4..9ac13290d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideSpectrum.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideSpectrum.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -126,8 +126,6 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) public void loadAnnotations(final DPeptideMatch peptideMatch) { - final DataBoxRsetPeptideSpectrum _databox = this; - final ObjectTree[] objectTreeResult = new ObjectTree[1]; AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideSpectrumError.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideSpectrumError.java index 1f9f9a1ae..6c038fc3e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideSpectrumError.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideSpectrumError.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideSpectrumValues.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideSpectrumValues.java index 76246da64..5ba46c1ae 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideSpectrumValues.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetPeptideSpectrumValues.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetProteinsForPeptideMatch.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetProteinsForPeptideMatch.java index dc88f96b9..51760b7a6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetProteinsForPeptideMatch.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsetProteinsForPeptideMatch.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmAllProteinSet.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmAllProteinSet.java index fb3d03771..3262e3b10 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmAllProteinSet.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmAllProteinSet.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -174,13 +174,12 @@ protected void selectDataWhenLoaded(HashSet data) { private HashSet m_dataToBeSelected = null; @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {DProteinSet.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{DProteinSet.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DProteinSet p = (DProteinSet) getData(DProteinSet.class); if (p != null) { DProteinMatch pm = p.getTypicalProteinMatch(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPSM.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPSM.java index 6628c2c23..e5c68f9e8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPSM.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPSM.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -167,13 +167,12 @@ public void setEntryData(Object data) { } @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {DPeptideMatch.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{DPeptideMatch.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DPeptideMatch p = (DPeptideMatch) getData(DPeptideMatch.class); if (p != null) { Peptide peptide = p.getPeptide(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPSMForMsQuery.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPSMForMsQuery.java index f5e827051..679222fee 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPSMForMsQuery.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPSMForMsQuery.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -95,7 +95,7 @@ public void dataChanged() { ((PeptideMatchPanel)getDataBoxPanelInterface()).setData(-1L, null, null, true); return; } - if (_msqI != null && _msqI.getMsQuery() != null && oldMsQId == _msqI.getMsQuery().getId()){ + if (_msqI.getMsQuery() != null && oldMsQId == _msqI.getMsQuery().getId()){ return ; } @@ -141,7 +141,7 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) // ask asynchronous loading of data - m_peptideMatches = new ArrayList(); + m_peptideMatches = new ArrayList<>(); if (m_msQuery != null){ registerTask(new DatabaseLoadPeptideMatchTask(callback, getProjectId(), m_msQuery, m_rsm, m_rset, m_peptideMatches)); } @@ -184,13 +184,12 @@ public void setEntryData(Object data) { } @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {DPeptideMatch.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{DPeptideMatch.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DPeptideMatch p = (DPeptideMatch) getData(DPeptideMatch.class); if (p != null) { Peptide peptide = p.getPeptide(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPeptideInstances.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPeptideInstances.java index 0d9e9849d..7a340baac 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPeptideInstances.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPeptideInstances.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -174,13 +174,12 @@ public void setEntryData(Object data) { } @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {PeptideInstance.class, DPeptideMatch.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{PeptideInstance.class, DPeptideMatch.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DPeptideMatch p = (DPeptideMatch) getData(DPeptideMatch.class); if (p != null) { Peptide peptide = p.getPeptide(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPeptidesOfProtein.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPeptidesOfProtein.java index b7915b302..0a228c79c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPeptidesOfProtein.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmPeptidesOfProtein.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -158,13 +158,12 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub } @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {DPeptideMatch.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{DPeptideMatch.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DPeptideMatch p = (DPeptideMatch) getData(DPeptideMatch.class); if (p != null) { Peptide peptide = p.getPeptide(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmProteinAndPeptideSequence.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmProteinAndPeptideSequence.java index c85604fdb..55718b4dd 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmProteinAndPeptideSequence.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmProteinAndPeptideSequence.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -87,8 +87,8 @@ public void dataChanged() { } else if (selectedPeptide != null) { boolean foundPeptide = false; - for (int i = 0; i < peptideInstances.length; i++) { - if (peptideInstances[i].getId() == selectedPeptide.getId()) { + for (DPeptideInstance peptideInstance : peptideInstances) { + if (peptideInstance.getId() == selectedPeptide.getId()) { foundPeptide = true; break; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmProteinSetOfPeptides.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmProteinSetOfPeptides.java index 8f007913d..6bcbd3d80 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmProteinSetOfPeptides.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmProteinSetOfPeptides.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -46,7 +46,7 @@ public DataBoxRsmProteinSetOfPeptides() { // Name of this databox m_typeName = "Protein Set"; - m_description = "All Protein Sets coresponding to a Peptide Instance"; + m_description = "All Protein Sets corresponding to a Peptide Instance"; // Register in parameters @@ -174,13 +174,12 @@ public void setEntryData(Object data) { } @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {DProteinSet.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{DProteinSet.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DProteinSet p = (DProteinSet) getData(DProteinSet.class); if (p != null) { DProteinMatch pm = p.getTypicalProteinMatch(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmProteinsOfProteinSet.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmProteinsOfProteinSet.java index bf2f30742..13218a4e5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmProteinsOfProteinSet.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxRsmProteinsOfProteinSet.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -144,13 +144,12 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub } @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {DProteinMatch.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{DProteinMatch.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DProteinMatch pm = (DProteinMatch) getData(DProteinMatch.class); if (pm != null) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxSystemTasks.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxSystemTasks.java index 0aa258e3f..dac067caa 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxSystemTasks.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxSystemTasks.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -34,6 +34,7 @@ public DataBoxSystemTasks() { @Override public void createPanel() { SystemTasksPanel p = new SystemTasksPanel(); + p.initListener(); p.setName(m_typeName); p.setDataBox(this); setDataBoxPanelInterface(p); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxTaskDescription.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxTaskDescription.java index fe01bdef2..b0968cb38 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxTaskDescription.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxTaskDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxTaskList.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxTaskList.java index f107e5d46..023547dfa 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxTaskList.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataBoxTaskList.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -48,7 +48,8 @@ public DataBoxTaskList() { @Override public void createPanel() { - TasksPanel p = new TasksPanel(); + TasksPanel p = new TasksPanel(); + p.initListener(); p.setName(m_typeName); p.setDataBox(this); setDataBoxPanelInterface(p); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataParameter.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataParameter.java index d7e7d46c4..1ba0b31a4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataParameter.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataParameter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -57,7 +57,11 @@ public boolean equals(Object p) { } return false; } - + + public boolean equalsData(DataParameter otherDataParam) { + return equalsData(otherDataParam.m_type, otherDataParam.getSubtype()); + } + public boolean equalsData(Class dataC, ParameterSubtypeEnum subtype) { return m_type.equals(dataC) && ((subtype==null) || (m_subtype==null) || (m_subtype.equals(subtype))); // subtype null corresponds to subtype not specified } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxDataAnalyzer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxDataAnalyzer.java index 65d464799..a47a86a38 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxDataAnalyzer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxDataAnalyzer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxGeneric.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxGeneric.java index 4e7b95ffa..ac2d45a7c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxGeneric.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxGeneric.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxGraphics.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxGraphics.java index a5635fbf0..f5e1460ed 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxGraphics.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxGraphics.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxManager.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxManager.java index d9d0e3c1a..c582780d8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxManager.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxManager.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,12 +16,8 @@ */ package fr.proline.studio.pattern; -import fr.proline.studio.pattern.xic.DataboxChildFeature; -import fr.proline.studio.pattern.xic.DataboxMapAlignment; -import fr.proline.studio.pattern.xic.DataboxPSMOfMasterQuantPeptide; -import fr.proline.studio.pattern.xic.DataboxXicPeptideIon; -import fr.proline.studio.pattern.xic.DataboxXicPeptideSet; -import fr.proline.studio.pattern.xic.DataboxXicProteinSet; +import fr.proline.studio.pattern.xic.*; + import java.util.ArrayList; import java.util.TreeMap; @@ -37,7 +33,7 @@ public class DataboxManager { private final AbstractDataBox[] m_dataBoxStartingArray = {new DataBoxRsetAll(), new DataBoxRsetPSM(), new DataBoxRsetAllProteinMatch(), new DataBoxRsmPSM(), new DataBoxRsmPeptideInstances(), new DataBoxAdjacencyMatrixChoice(), new DataBoxRsmAllProteinSet(), new DataboxXicPeptideSet(), new DataboxXicPeptideIon(), new DataboxXicProteinSet(), - new DataBoxMSQueriesForRSM(), new DataBoxMSQueriesForRset(), new DataBoxPTMClusters()}; + new DataBoxMSQueriesForRSM(), new DataBoxMSQueriesForRset(), new DataBoxPTMClusters(), new DataBoxPTMClusters(true)}; //VDS : If some databox takes parameter in constructor : config will be lost when adding the databox : newInstance called in AddDataBoxActionListener // Added specific code in AddDataBoxActionListener to configure these specific databox ! @@ -71,10 +67,33 @@ public class DataboxManager { new DataBoxPTMPeptides(true, false), // Quanti PTMs Peptides new DataBoxPTMPeptides(false, true), // Ident PTMs Peptides Matches new DataBoxPTMPeptides(true, true), // Quanti PTMs Peptides Matches - new DataBoxPTMPeptidesGraphic() - + new DataBoxPTMPeptidesGraphic(), + new DataboxXicParentsPeptideIon(), + new DataBoxPTMClustersSites(), + new DataBoxPTMClustersSites(true) }; + public static AbstractDataBox getDataboxNewInstance(AbstractDataBox sourceDB) throws IllegalAccessException, InstantiationException { + + AbstractDataBox newGenericDatabox = sourceDB.getClass().newInstance(); // copy the databox + + //Some databox must be specifically configured ... + // FIXME VDS : To be more generic ?! + if(DataboxGraphics.class.isInstance(newGenericDatabox)) { + ((DataboxGraphics)newGenericDatabox).setDefaultLocked(((DataboxGraphics)sourceDB).isDefaultLocked()); + } else if (DataboxMultiGraphics.class.isInstance(newGenericDatabox) ){ + newGenericDatabox = new DataboxMultiGraphics(false, false, ((DataboxMultiGraphics)sourceDB).isDoubleYAxis()); + } else if (DataBoxPTMPeptides.class.equals(newGenericDatabox.getClass())) { + newGenericDatabox = new DataBoxPTMPeptides(((DataBoxPTMPeptides) sourceDB).isMS1LabelFreeQuantitation(), ((DataBoxPTMPeptides) sourceDB).isAllPSMsDisplayed()); + } else if(DataBoxPTMClusters.class.equals(newGenericDatabox.getClass())) { + newGenericDatabox = new DataBoxPTMClusters( ((DataBoxPTMClusters)sourceDB).m_type.equals(AbstractDataBox.DataboxType.DataBoxPTMSiteAsClusters) ); + } else if(DataBoxPTMClustersSites.class.equals(newGenericDatabox.getClass())) { + newGenericDatabox = new DataBoxPTMClustersSites( ((DataBoxPTMClustersSites)sourceDB).m_type.equals(AbstractDataBox.DataboxType.DataBoxXicPTMClustersSites) ); + } + + return newGenericDatabox; + } + private DataboxManager() { } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxMultiGraphics.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxMultiGraphics.java index e24c4d6bb..b92be7901 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxMultiGraphics.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxMultiGraphics.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -76,13 +76,13 @@ public DataboxMultiGraphics(boolean defaultLocked, boolean canChooseColor, boole inParameter.addParameter(Integer.class, ParameterSubtypeEnum.PEPTIDES_SELECTION_LIST, false /* not compulsory */); inParameter.addParameter(ExtendedTableModelInterface.class, ParameterSubtypeEnum.LIST_DATA); - inParameter.addParameter(CrossSelectionInterface.class, ParameterSubtypeEnum.LIST_DATA); + inParameter.addParameter(CrossSelectionInterface.class, ParameterSubtypeEnum.LIST_DATA, false); if (m_displayDoubleYAxis) { inParameter.addParameter(SecondAxisTableModelInterface.class); - inParameter.addParameter(PTMPeptideInstance.class);//for DataBoxPTMPeptide[XXXX].propagate //JPM.DATABOX : big wart to be suppressed : removed true - inParameter.addParameter(DMasterQuantPeptide.class);//for DataBoxXicPeptideSet.propagate + inParameter.addParameter(PTMPeptideInstance.class, false);//for DataBoxPTMPeptide[XXXX].propagate //JPM.DATABOX : big wart to be suppressed : removed true + inParameter.addParameter(DMasterQuantPeptide.class, false);//for DataBoxXicPeptideSet.propagate } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsetPSMForMsQuery.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsetPSMForMsQuery.java index b55cbb444..f6b9c0035 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsetPSMForMsQuery.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsetPSMForMsQuery.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -86,7 +86,7 @@ public void createPanel() { public void dataChanged() { long oldMsQId = m_msQuery == null? -1: m_msQuery.getId(); final MsQueryInfoRset _msqI = (MsQueryInfoRset) getData(MsQueryInfoRset.class); - if ((_msqI == null) || (_msqI != null && _msqI.getMsQuery() != null && oldMsQId == _msqI.getMsQuery().getId())){ + if (_msqI == null || (_msqI.getMsQuery() != null && oldMsQId == _msqI.getMsQuery().getId()) ){ return ; } @@ -129,7 +129,7 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) // ask asynchronous loading of data - m_peptideMatches = new ArrayList(); + m_peptideMatches = new ArrayList<>(); if (m_msQuery != null){ registerTask(new DatabaseLoadPeptideMatchTask(callback, getProjectId(), m_msQuery, null, m_rset, m_peptideMatches)); } @@ -171,13 +171,12 @@ public void setEntryData(Object data) { } @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {DPeptideMatch.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{DPeptideMatch.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DPeptideMatch p = (DPeptideMatch) getData(DPeptideMatch.class); if (p != null) { Peptide peptide = p.getPeptide(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsetPeptidesOfProtein.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsetPeptidesOfProtein.java index fd5d33a0c..7e8543f3d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsetPeptidesOfProtein.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsetPeptidesOfProtein.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -164,13 +164,12 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub } @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {DPeptideMatch.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{DPeptideMatch.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DPeptideMatch p = (DPeptideMatch) getData(DPeptideMatch.class); if (p != null) { Peptide peptide = p.getPeptide(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsmPSMOfPeptide.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsmPSMOfPeptide.java index 47056423c..ca3ef4aa4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsmPSMOfPeptide.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsmPSMOfPeptide.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -139,13 +139,13 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub @Override - public Class[] getImportantInParameterClass() { + public Class[] getDataboxNavigationOutParameterClasses() { Class[] classList = {DPeptideMatch.class}; return classList; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DPeptideMatch p = (DPeptideMatch) getData(DPeptideMatch.class); if (p != null) { Peptide peptide = p.getPeptide(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsmPSMOfProteinSet.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsmPSMOfProteinSet.java index b948ade58..ffab9586b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsmPSMOfProteinSet.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/DataboxRsmPSMOfProteinSet.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -142,13 +142,12 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub } @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {DPeptideMatch.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{DPeptideMatch.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DPeptideMatch p = (DPeptideMatch) getData(DPeptideMatch.class); if (p != null) { Peptide peptide = p.getPeptide(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MsQueryInfo.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MsQueryInfo.java index 2fdc86bec..10ebf86d5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MsQueryInfo.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MsQueryInfo.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.pattern; import fr.proline.core.orm.msi.dto.DMsQuery; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MsQueryInfoRset.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MsQueryInfoRset.java index 5ea41220d..376384904 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MsQueryInfoRset.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MsQueryInfoRset.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.pattern; import fr.proline.core.orm.msi.dto.DMsQuery; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MsQueryInfoRsm.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MsQueryInfoRsm.java index df43557aa..0dfeb4352 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MsQueryInfoRsm.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MsQueryInfoRsm.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.pattern; import fr.proline.core.orm.msi.dto.DMsQuery; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MzScopeWindowBoxManager.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MzScopeWindowBoxManager.java index 1cfbe98e9..0a117c3b0 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MzScopeWindowBoxManager.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/MzScopeWindowBoxManager.java @@ -1,23 +1,24 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.pattern; +import fr.proline.studio.WindowManager; import fr.proline.studio.mzscope.MzScopeInterface; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; /** * @@ -26,7 +27,7 @@ public class MzScopeWindowBoxManager { private static WindowBox m_windowBox = null; - private static DataBoxViewerTopComponent m_win = null; + private static DataBoxViewerTopPanel m_win = null; public static void addMzdbScope(MzScopeInterface mzScopeInterface) { if (m_windowBox == null) { @@ -34,18 +35,11 @@ public static void addMzdbScope(MzScopeInterface mzScopeInterface) { m_windowBox.setEntryData(-1, mzScopeInterface); // open a window to display the window box - m_win = new DataBoxViewerTopComponent(m_windowBox); - m_win.open(); - m_win.requestActive(); + m_win = new DataBoxViewerTopPanel(m_windowBox); + WindowManager.getDefault().getMainWindow().displayWindow(m_win); } else { m_windowBox.setEntryData(-1, mzScopeInterface); - if (m_win.isOpened()) { - m_win.requestActive(); - } else { - m_win = new DataBoxViewerTopComponent(m_windowBox); - m_win.open(); - m_win.requestActive(); - } + WindowManager.getDefault().getMainWindow().displayWindow(m_win); } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/ParameterDistance.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/ParameterDistance.java index 530783368..96691198d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/ParameterDistance.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/ParameterDistance.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.pattern; /** diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/ParameterList.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/ParameterList.java index dc26d11c8..a20b78384 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/ParameterList.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/ParameterList.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/RemoveDataBoxActionListener.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/RemoveDataBoxActionListener.java index 3678c3f9d..ea27e9156 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/RemoveDataBoxActionListener.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/RemoveDataBoxActionListener.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.pattern; import fr.proline.studio.gui.SplittedPanelContainer; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/SaveDataBoxActionListener.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/SaveDataBoxActionListener.java index fde0d7c4d..c11361564 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/SaveDataBoxActionListener.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/SaveDataBoxActionListener.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -24,7 +24,7 @@ import java.awt.event.ActionListener; import java.util.ArrayList; import javax.swing.JPanel; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; /** diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/WindowBox.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/WindowBox.java index 3141566fe..9c413e9d4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/WindowBox.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/WindowBox.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.pattern; import fr.proline.studio.gui.SplittedPanelContainer; @@ -27,7 +27,7 @@ /** - * A window box contains a set of Databox and can be display by a DataBoxViewerTopComponent + * A window box contains a set of Databox and can be display by a DataBoxViewerTopPanel * @author JM235353 */ public class WindowBox { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/WindowBoxFactory.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/WindowBoxFactory.java index 551ed8d8f..1b7f099fd 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/WindowBoxFactory.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/WindowBoxFactory.java @@ -1,786 +1,803 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.pattern; - -import fr.proline.core.orm.msi.ResultSet; -import java.util.HashMap; - -import fr.proline.studio.gui.SplittedPanelContainer; -import fr.proline.studio.pattern.xic.DataboxChildFeature; -import fr.proline.studio.pattern.xic.DataboxExperimentalDesign; -import fr.proline.studio.pattern.xic.DataboxMapAlignment; -import fr.proline.studio.pattern.xic.DataboxXicPeptideIon; -import fr.proline.studio.pattern.xic.DataboxXicPeptideSet; -import fr.proline.studio.pattern.xic.DataboxXicProteinSet; -import fr.proline.studio.utils.IconManager; -import java.awt.Image; - -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.JSplitPane; -import javax.swing.JTabbedPane; -import javax.swing.border.EmptyBorder; -import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; -import fr.proline.studio.pattern.xic.DataboxXicParentsPeptideIon; - -/** - * - * @author JM235353 - */ -public class WindowBoxFactory { - - public static WindowBox getUserDefinedWindowBox(String dataName, String windowName, AbstractDataBox databox, boolean isDecoy, boolean isXIC, char windowType) { - AbstractDataBox[] boxes = new AbstractDataBox[1]; - boxes[0] = databox; - boxes[0].setDataName(dataName); - - Image icon; - switch (windowType) { - case WindowSavedManager.SAVE_WINDOW_FOR_RSM: - icon = IconManager.getImage(isDecoy ? IconManager.IconType.DATASET_RSM_DECOY : IconManager.IconType.DATASET_RSM); - break; - case WindowSavedManager.SAVE_WINDOW_FOR_RSET: - icon = IconManager.getImage(isDecoy ? IconManager.IconType.DATASET_RSET_DECOY : IconManager.IconType.DATASET_RSET); - break; - case WindowSavedManager.SAVE_WINDOW_FOR_QUANTI: - icon = IconManager.getImage(isXIC ? IconManager.IconType.QUANT_XIC : IconManager.IconType.QUANT_SC); - break; - default: - icon = databox.getDefaultIcon(); - break; - } - - WindowBox winBox = new WindowBox(windowName, generatePanel(boxes), boxes[0], icon); - - return winBox; - } - - public static WindowBox getDetailWindowBox(String dataName, String windowName, AbstractDataBox databox) { - AbstractDataBox[] boxes = createBoxArray(databox, dataName); - - Image icon = databox.getDefaultIcon(); - - WindowBox winBox = new WindowBox(windowName, generatePanel(boxes), boxes[0], icon); - - return winBox; - } - - private static AbstractDataBox[] createBoxArray(AbstractDataBox databox, String dataName) { - - ResultSet rset = (ResultSet) databox.getData( ResultSet.class); - - AbstractDataBox[] boxes; - if (databox instanceof DataBoxRsetProteinsForPeptideMatch) { - - boolean mergedData = false; - if (rset != null) { - ResultSet.Type rsType = rset.getType(); - mergedData = (rsType == ResultSet.Type.USER) || (rsType == ResultSet.Type.DECOY_USER); // Merge or Decoy Merge - } - - boxes = new AbstractDataBox[2]; - boxes[1] = new DataboxRsetPeptidesOfProtein(mergedData); - - } else if (databox instanceof DataBoxRsetPeptideSpectrumValues) { - boxes = new AbstractDataBox[2]; - boxes[1] = new DataBoxRsetPeptideSpectrum(); - boxes[1].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - } else if (databox instanceof DataBoxRsetPeptideSpectrum) { - boxes = new AbstractDataBox[4]; - boxes[1] = new DataBoxRsetPeptideSpectrumError(); - boxes[1].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[2] = new DataBoxRsetPeptideFragmentation(); - boxes[2].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[3] = new DataBoxRsetPeptideSpectrumValues(); - boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - - } else if (databox instanceof DataBoxAdjacencyMatrixChoice) { - - DataBoxAdjacencyMatrixChoice adjacencyMatrixChoice = ((DataBoxAdjacencyMatrixChoice) databox); - adjacencyMatrixChoice.setKeepSameset(true); - adjacencyMatrixChoice.doNotTakeFirstSelection(true); - adjacencyMatrixChoice.createPanel(); //JPM.WART - databox = new DataBoxAdjacencyMatrix(); - adjacencyMatrixChoice.addNextDataBox(databox); - boxes = new AbstractDataBox[7]; - - boxes[1] = new DataBoxRsetPeptideSpectrum(); - boxes[2] = new DataBoxRsetPeptideSpectrumError(); - boxes[2].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[3] = new DataBoxRsetPeptideFragmentation(); - boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[4] = new DataBoxRsetPeptideSpectrumValues(); - boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - - boxes[5] = new DataBoxRsmProteinAndPeptideSequence(); - boxes[6] = new DataBoxRsmPeptidesOfProtein(); - boxes[6].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - - } else if (databox instanceof DataBoxRsmProteinSetOfPeptides) { - boxes = new AbstractDataBox[3]; - boxes[1] = new DataBoxRsmProteinsOfProteinSet(); - boxes[2] = new DataBoxRsmPeptidesOfProtein(); - } else if (databox instanceof DataBoxRsmProteinsOfProteinSet) { - boxes = new AbstractDataBox[7]; - boxes[1] = new DataBoxRsmPeptidesOfProtein(); - boxes[2] = new DataBoxRsmProteinAndPeptideSequence(); - boxes[3] = new DataBoxRsetPeptideSpectrum(); - boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[4] = new DataBoxRsetPeptideSpectrumError(); - boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[5] = new DataBoxRsetPeptideFragmentation(); - boxes[5].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[6] = new DataBoxRsetPeptideSpectrumValues(); - boxes[6].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - - } else if (databox instanceof DataboxRsmPSMOfProteinSet) { - boxes = new AbstractDataBox[5]; - boxes[1] = new DataBoxRsetPeptideSpectrum(); - boxes[2] = new DataBoxRsetPeptideSpectrumError(); - boxes[2].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[3] = new DataBoxRsetPeptideFragmentation(); - boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[4] = new DataBoxRsetPeptideSpectrumValues(); - boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - } else if (databox instanceof DataBoxRsmPeptidesOfProtein) { - boxes = new AbstractDataBox[6]; - boxes[1] = new DataBoxRsmProteinAndPeptideSequence(); - boxes[2] = new DataBoxRsetPeptideSpectrum(); - boxes[2].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[3] = new DataBoxRsetPeptideSpectrumError(); - boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[4] = new DataBoxRsetPeptideFragmentation(); - boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[5] = new DataBoxRsetPeptideSpectrumValues(); - boxes[5].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - } else { - boxes = new AbstractDataBox[1]; - } - - boxes[0] = databox; - boxes[0].setDataName(dataName); - - return boxes; - } - - public static WindowBox getPeptidesWindowBox(String dataName, boolean isDecoy, boolean isMerged) { - return getPeptidesForRsetOnlyWindowBox(dataName, isDecoy, isMerged); - - } - - public static WindowBox getPeptidesForRsetOnlyWindowBox(String dataName, boolean isDecoy, boolean isMerged) { - // AW: search results / PSM set of boxes. - // - // create boxes - AbstractDataBox[] boxes = new AbstractDataBox[6]; - boxes[0] = new DataBoxRsetPSM(isMerged); - boxes[0].setDataName(dataName); - boxes[1] = new DataBoxRsetPeptideSpectrum(); - boxes[2] = new DataBoxRsetPeptideSpectrumError(); - boxes[2].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[3] = new DataBoxRsetPeptideFragmentation(); - boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[4] = new DataBoxRsetPeptideSpectrumValues(); - boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[5] = new DataBoxRsetProteinsForPeptideMatch(); - - IconManager.IconType iconType = isDecoy ? IconManager.IconType.DATASET_RSET_DECOY : IconManager.IconType.DATASET_RSET; - WindowBox winBox = new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - - return winBox; - - } - - public static WindowBox getMSDiagWindowBox(String dataName, HashMap resultMessage) { - // MSDiag - // - // create boxes - AbstractDataBox[] boxes = new AbstractDataBox[1]; - boxes[0] = new DataBoxRsetMSDiag(resultMessage); - boxes[0].setDataName(dataName); - - IconManager.IconType iconType = IconManager.IconType.CHART_PIE; // TODO: change icon - WindowBox winBox = new WindowBox(dataName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - - return winBox; - - } - - public static WindowBox getGraphicsWindowBox(String fullName, AbstractDataBox srcDatabox, boolean locked) { - AbstractDataBox[] boxes = new AbstractDataBox[1]; - boxes[0] = new DataboxGraphics(locked); - srcDatabox.addNextDataBox(boxes[0]); - IconManager.IconType iconType = IconManager.IconType.CHART; - WindowBox winBox = new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - boxes[0].dataChanged(); - return winBox; - } - - public static WindowBox getGraphicsWindowBox(String fullName, ExtendedTableModelInterface srcDataInterface, boolean locked) { - AbstractDataBox[] boxes = new AbstractDataBox[1]; - boxes[0] = new DataboxGraphics(locked); - IconManager.IconType iconType = IconManager.IconType.CHART; - WindowBox winBox = new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - boxes[0].setEntryData(srcDataInterface); - return winBox; - } - - public static WindowBox getMultiGraphicsWindowBox(String fullName, AbstractDataBox srcDatabox, boolean canChooseColor) { - AbstractDataBox[] boxes = new AbstractDataBox[1]; - boxes[0] = new DataboxMultiGraphics(true, canChooseColor); - srcDatabox.addNextDataBox(boxes[0]); - IconManager.IconType iconType = IconManager.IconType.CHART; - WindowBox winBox = new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - boxes[0].dataChanged(); - return winBox; - } - - public static WindowBox getProteinMatchesForRsetWindowBox(String dataName, boolean isDecoy, boolean mergedData) { - - // create boxes - // AW: search results / proteins - AbstractDataBox[] boxes = new AbstractDataBox[2]; - boxes[0] = new DataBoxRsetAllProteinMatch(); - boxes[0].setDataName(dataName); - boxes[1] = new DataboxRsetPeptidesOfProtein(mergedData); - - IconManager.IconType iconType = isDecoy ? IconManager.IconType.DATASET_RSET_DECOY : IconManager.IconType.DATASET_RSET; - WindowBox winBox = new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - - return winBox; - - } - -// public static WindowBox getPTMSitesWindowBoxV1(String dataName) { -// -// AbstractDataBox[] boxes = new AbstractDataBox[5]; -// boxes[0] = new DataBoxPTMSiteProtein(); -// boxes[0].setDataName(dataName); -// ((DataBoxPTMSiteProtein) boxes[0]).setXicResult(false); -// boxes[1] = new DataBoxPTMSitePeptidesGraphic(); -// boxes[2] = new DataBoxPTMSitePeptides(); -// boxes[2].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); -// boxes[3] = new DataBoxPTMSitePepMatches(); -// boxes[4] = new DataboxRsetPSMForMsQuery(); -// -// IconManager.IconType iconType = IconManager.IconType.DATASET_RSM; -// return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); -// } -// -// public static WindowBox getPTMSitesWindowBoxV2(String dataName) { -// -// AbstractDataBox[] boxes = new AbstractDataBox[5]; -// boxes[0] = new DataBoxPTMSiteProtein(true); -// boxes[0].setDataName(dataName); -// ((DataBoxPTMSiteProtein) boxes[0]).setXicResult(false); -// boxes[1] = new DataBoxPTMPeptidesGraphic(); -// ((DataBoxPTMPeptidesGraphic)boxes[1]).setIsClusterData(false); -// boxes[2] = new DataBoxPTMSitePeptides(); -// boxes[2].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); -// boxes[3] = new DataBoxPTMSitePepMatches(); -// boxes[4] = new DataboxRsetPSMForMsQuery(); -// -// IconManager.IconType iconType = IconManager.IconType.DATASET_RSM; -// return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); -// } - - /** - * PTM cluster databox - * @param dataName - * @return - */ - public static WindowBox getPTMDataWindowBox(String dataName, boolean viewSites) { - AbstractDataBox[] boxes = new AbstractDataBox[4]; - boxes[0] = new DataBoxPTMClusters(); - boxes[0].setDataName(dataName); - ((DataBoxPTMClusters) boxes[0]).setXicResult(false); - ((DataBoxPTMClusters) boxes[0]).setViewSitesOnly(viewSites); - boxes[1] = new DataBoxPTMPeptidesGraphic(); - boxes[2] = new DataBoxPTMPeptides(false, false); - boxes[2].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); - boxes[3] = new DataBoxPTMPeptides(false,true); - boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - // boxes[4] = new DataboxRsetPSMForMsQuery(); - IconManager.IconType iconType = IconManager.IconType.DATASET_RSM; - return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - - } - - /** - * XIC PTM cluster databox - * @param dataName - * @return - */ - public static WindowBox getXicPTMDataWindowBox(String dataName, boolean viewSites) { - AbstractDataBox[] boxes = new AbstractDataBox[7]; - boxes[0] = new DataBoxPTMClusters(); - boxes[0].setDataName(dataName); - ((DataBoxPTMClusters) boxes[0]).setXicResult(true); - ((DataBoxPTMClusters) boxes[0]).setViewSitesOnly(viewSites); - boxes[1] = new DataBoxPTMPeptides(true, false); - boxes[2] = new DataBoxPTMPeptides(false,true); - boxes[2].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[3] = new DataBoxPTMPeptidesGraphic(); - boxes[4] = new DataboxMultiGraphics(false,false,true);//associate a graphic databox for DataboxXicPeptideSet - ((DataboxMultiGraphics)boxes[4]).setHideButton(true); - boxes[4].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); - boxes[5] = new DataboxXicPeptideSet(false);//display the selected peptideMatch in each chanel - boxes[6] = new DataboxMultiGraphics(false,false,true); //associate a graphic databox for DataboxXicPeptideSet - ((DataboxMultiGraphics)boxes[6]).setHideButton(true); - boxes[6].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); - - IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; - return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - } - -// public static WindowBox getXicPTMSitesWindowBoxV2(String dataName) { -// -// AbstractDataBox[] boxes = new AbstractDataBox[6]; -// boxes[0] = new DataBoxPTMSiteProtein(true); -// boxes[0].setDataName(dataName); -// ((DataBoxPTMSiteProtein) boxes[0]).setXicResult(true); -// -// boxes[1] = new DataBoxPTMPeptides(); -// boxes[2] = new DataBoxPTMPeptidesGraphic(); -// ((DataBoxPTMPeptidesGraphic)boxes[2]).setIsClusterData(false); -// //boxes[2].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); -// -// // boxes[3] = new DataboxXicPeptideSet(true);//display the selected peptide in each chanel -// //((DataboxXicPeptideSet) boxes[3]).setXICMode(true); -// boxes[3] = new DataboxMultiGraphics(false,false,true);//associate a graphic databox for DataboxXicPeptideSet -// ((DataboxMultiGraphics)boxes[3]).setHideButton(true); -// boxes[3].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); -//// boxes[5] = new DataBoxPTMSitePepMatches(); -//// boxes[5].setLayout(SplittedPanelContainer.PanelLayout.TABBED); -//// -// boxes[4] = new DataboxXicPeptideSet(false);//display the selected peptideMatch in each chanel -// boxes[5] = new DataboxMultiGraphics(false,false,true); //associate a graphic databox for DataboxXicPeptideSet -// ((DataboxMultiGraphics)boxes[5]).setHideButton(true); -// boxes[5].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); -// -// IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; -// return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); -// } -// -// -// public static WindowBox getXicPTMSitesWindowBoxV1(String dataName) { -// -// AbstractDataBox[] boxes = new AbstractDataBox[8]; -// boxes[0] = new DataBoxPTMSiteProtein(); -// boxes[0].setDataName(dataName); -// ((DataBoxPTMSiteProtein) boxes[0]).setXicResult(true); -// -// boxes[1] = new DataBoxPTMSitePeptidesGraphic(); -// -// boxes[2] = new DataBoxPTMSitePeptides();//new DataBoxXicPTMSitePeptides(); -// boxes[2].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); -// -// boxes[3] = new DataboxXicPeptideSet(true);//display the selected peptide in each chanel -// ((DataboxXicPeptideSet) boxes[3]).setXICMode(true); -// boxes[4] = new DataboxMultiGraphics(false,false,true);//associate a graphic databox for DataboxXicPeptideSet -// ((DataboxMultiGraphics)boxes[4]).setHideButton(true); -// boxes[4].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); -// boxes[5] = new DataBoxPTMSitePepMatches(); -// boxes[5].setLayout(SplittedPanelContainer.PanelLayout.TABBED); -// -// boxes[6] = new DataboxXicPeptideSet(false);//display the selected peptideMatch in each chanel -// boxes[7] = new DataboxMultiGraphics(false,false,true); //associate a graphic databox for DataboxXicPeptideSet -// ((DataboxMultiGraphics)boxes[7]).setHideButton(true); -// boxes[7].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); -// -// IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; -// return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); -// } - - public static WindowBox getRsmPSMWindowBox(String dataName, boolean isDecoy, boolean mergedData) { - // create boxes - // AW: All PSM of an Identification Summary or corresponding to a Peptide Instance - AbstractDataBox[] boxes = new AbstractDataBox[1]; - boxes[0] = new DataBoxRsmPSM(mergedData); - boxes[0].setDataName(dataName); - - IconManager.IconType iconType = isDecoy ? IconManager.IconType.DATASET_RSM_DECOY : IconManager.IconType.DATASET_RSM; - return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - } - - public static WindowBox getRsmPeptidesWindowBox(String dataName, boolean isDecoy) { - // create boxes - // AW: Identification Summary / Peptide Instances"; - AbstractDataBox[] boxes = new AbstractDataBox[4]; - boxes[0] = new DataBoxRsmPeptideInstances(); - boxes[0].setDataName(dataName); - boxes[1] = new DataBoxRsmProteinSetOfPeptides(); - boxes[2] = new DataBoxRsmProteinsOfProteinSet(); - boxes[3] = new DataBoxRsmPeptidesOfProtein(); - boxes[3].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); - - IconManager.IconType iconType = isDecoy ? IconManager.IconType.DATASET_RSM_DECOY : IconManager.IconType.DATASET_RSM; - WindowBox winBox = new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - - return winBox; - } - - public static WindowBox getProteinSetsWindowBox(String dataName, boolean isDecoy) { - - // create boxes - AbstractDataBox[] boxes = new AbstractDataBox[8]; - boxes[0] = new DataBoxRsmAllProteinSet(); - boxes[0].setDataName(dataName); - boxes[1] = new DataBoxRsmProteinsOfProteinSet(); - boxes[2] = new DataBoxRsmPeptidesOfProtein(); - boxes[3] = new DataBoxRsmProteinAndPeptideSequence(); - boxes[4] = new DataBoxRsetPeptideSpectrum(); - boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[5] = new DataBoxRsetPeptideSpectrumError(); - boxes[5].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[6] = new DataBoxRsetPeptideFragmentation(); - boxes[6].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[7] = new DataBoxRsetPeptideSpectrumValues(); - boxes[7].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - - IconManager.IconType iconType = isDecoy ? IconManager.IconType.DATASET_RSM_DECOY : IconManager.IconType.DATASET_RSM; - - WindowBox winBox = new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - - return winBox; - } - - public static WindowBox getAdjacencyMatrixWindowBox(String dataName, boolean isDecoy) { - - // create boxes - AbstractDataBox[] boxes = new AbstractDataBox[2]; - boxes[0] = new DataBoxAdjacencyMatrixChoice(); - boxes[0].setDataName(dataName); - boxes[1] = new DataBoxAdjacencyMatrix(); - - IconManager.IconType iconType = isDecoy ? IconManager.IconType.DATASET_RSM_DECOY : IconManager.IconType.DATASET_RSM; - - WindowBox winBox = new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - - return winBox; - } - - public static WindowBox getAllResultSetWindowBox(String dataName) { - - // create boxes - AbstractDataBox[] boxes = new AbstractDataBox[1]; - boxes[0] = new DataBoxRsetAll(); - boxes[0].setDataName(dataName); - - WindowBox winBox = new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], null); - - return winBox; - - } - - /** - * xicMode : if false => SC - * - * @param dataName - * @param fullName - * @param xicMode - * @return - */ - public static WindowBox getXicQuantProteinSetWindowBox(String dataName, String fullName, boolean xicMode, boolean aggregatedQuantiPeptideIon) { - - // create boxes - int nbBoxes = xicMode ? ((aggregatedQuantiPeptideIon) ? 7 : 6) : 3; - - AbstractDataBox[] boxes = new AbstractDataBox[nbBoxes]; - boxes[0] = new DataboxXicProteinSet(); - boxes[0].setDataName(dataName); - ((DataboxXicProteinSet) boxes[0]).setXICMode(xicMode); - boxes[1] = new DataboxXicPeptideSet(); - ((DataboxXicPeptideSet) boxes[1]).setXICMode(xicMode); - boxes[2] = new DataboxMultiGraphics(false,true,true); - ((DataboxMultiGraphics)boxes[2]).setHideButton(true); - boxes[2].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); - if (xicMode) { - boxes[3] = new DataboxXicPeptideIon(); - ((DataboxXicPeptideIon) boxes[3]).setXICMode(xicMode); - boxes[3].setLayout(SplittedPanelContainer.PanelLayout.VERTICAL); - - if (aggregatedQuantiPeptideIon) { - boxes[4] = new DataboxXicParentsPeptideIon(); - boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[5] = new DataboxChildFeature(); - boxes[5].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[6] = new DataboxMultiGraphics(false, false); - boxes[6].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); - } else { - - boxes[4] = new DataboxChildFeature(); - boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); - boxes[5] = new DataboxMultiGraphics(false, false); - boxes[5].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); - } - } - - IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; - if (!xicMode) { - iconType = IconManager.IconType.QUANT_SC; - } - return new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - } - - public static WindowBox getXicQuantPeptideSetWindowBox(String dataName, String fullName, boolean xicMode) { - - // create boxes - int nbBoxes = xicMode ? 2 : 1; - AbstractDataBox[] boxes = new AbstractDataBox[nbBoxes]; - boxes[0] = new DataboxXicPeptideSet(); - boxes[0].setDataName(dataName); - ((DataboxXicPeptideSet) boxes[0]).setXICMode(xicMode); - if (xicMode) { - boxes[1] = new DataboxXicPeptideIon(); - ((DataboxXicPeptideIon) boxes[1]).setXICMode(xicMode); - } - - IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; - if (!xicMode) { - iconType = IconManager.IconType.QUANT_SC; - } - return new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - } - - public static WindowBox getXicQuantPeptideIonWindowBox(String dataName, String fullName, boolean xicMode) { - - // create boxes - AbstractDataBox[] boxes = new AbstractDataBox[1]; - boxes[0] = new DataboxXicPeptideIon(); - boxes[0].setDataName(dataName); - ((DataboxXicPeptideIon) boxes[0]).setXICMode(xicMode); - - IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; - if (!xicMode) { - iconType = IconManager.IconType.QUANT_SC; - } - return new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - } - - public static WindowBox getMzScopeWindowBox() { - AbstractDataBox[] boxes = new AbstractDataBox[1]; - boxes[0] = new DataBoxMzScope(); - - WindowBox winBox = new WindowBox("MzScope", generatePanel(boxes), boxes[0], IconManager.getImage(IconManager.IconType.WAVE)); - - return winBox; - } - - public static WindowBox getExperimentalDesignWindowBox(String dataName, String fullName) { - - // create boxes - AbstractDataBox[] boxes = new AbstractDataBox[1]; - boxes[0] = new DataboxExperimentalDesign(); - boxes[0].setDataName(dataName); - IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; - return new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - } - - public static WindowBox getMapAlignmentWindowBox(String dataName, String fullName) { - // create boxes - AbstractDataBox[] boxes = new AbstractDataBox[2]; - boxes[0] = new DataboxMapAlignment(); - boxes[0].setDataName(dataName); - boxes[1] = new DataboxMultiGraphics(false, false); - boxes[1].setLayout(SplittedPanelContainer.PanelLayout.VERTICAL); - IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; - return new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - } - - public static WindowBox getMSQueriesWindowBoxForRsm(String dataName, boolean mergedData) { - // create boxes - AbstractDataBox[] boxes = new AbstractDataBox[2]; - boxes[0] = new DataBoxMSQueriesForRSM(); - boxes[0].setDataName(dataName); - boxes[1] = new DataBoxRsmPSMForMsQuery(mergedData); - boxes[1].setLayout(SplittedPanelContainer.PanelLayout.VERTICAL); - IconManager.IconType iconType = IconManager.IconType.DATASET_RSM; - return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - } - - public static WindowBox getMSQueriesWindowBoxForRset(String dataName, boolean mergedData) { - // create boxes - AbstractDataBox[] boxes = new AbstractDataBox[2]; - boxes[0] = new DataBoxMSQueriesForRset(); - boxes[0].setDataName(dataName); - boxes[1] = new DataboxRsetPSMForMsQuery(mergedData); - boxes[1].setLayout(SplittedPanelContainer.PanelLayout.VERTICAL); - IconManager.IconType iconType = IconManager.IconType.DATASET_RSET; - return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - } - - public static WindowBox getTaskListWindowBox() { - AbstractDataBox[] boxes = new AbstractDataBox[2]; - boxes[0] = new DataBoxTaskList(); - boxes[1] = new DataBoxTaskDescription(); - - WindowBox winBox = new WindowBox("User Tasks", generatePanel(boxes), boxes[0], null); - - return winBox; - } - - public static WindowBox getSystemTaskLogWindowBox() { - AbstractDataBox[] boxes = new AbstractDataBox[1]; - boxes[0] = new DataBoxSystemTasks(); - - WindowBox winBox = new WindowBox("Server Tasks", generatePanel(boxes), boxes[0], null); - return winBox; - } - - public static WindowBox getDataAnalyzerWindowBox() { - AbstractDataBox[] boxes = new AbstractDataBox[2]; - boxes[0] = new DataboxDataAnalyzer(); - boxes[1] = new DataBoxDataAnalyzerResults(); - WindowBox winBox = new WindowBox("Data Analyzer", generatePanel(boxes, false), boxes[0], IconManager.getImage(IconManager.IconType.DATA_ANALYZER)); - return winBox; - } - - public static WindowBox[] getSystemMonitoringWindowBox() { - WindowBox[] m_windowBoxes = new WindowBox[2]; - m_windowBoxes[0] = WindowBoxFactory.getTaskListWindowBox(); - m_windowBoxes[1] = WindowBoxFactory.getSystemTaskLogWindowBox(); - -// WindowBox[] m_windowBoxes = new WindowBox[1]; -// m_windowBoxes[0] = WindowBoxFactory.getTaskListWindowBox(); - return m_windowBoxes; - } - - public static WindowBox getImageWindowBox(String dataName, Image img) { - AbstractDataBox[] boxes = new AbstractDataBox[1]; - boxes[0] = new DataBoxImage(); - - WindowBox winBox = new WindowBox(dataName + " Image", generatePanel(boxes, false), boxes[0], IconManager.getImage(IconManager.IconType.WAVE)); - winBox.setEntryData(-1, img); - - return winBox; - } - - public static WindowBox getGenericWindowBox(String dataName, String functionName, IconManager.IconType iconType, boolean removeStripAndSort) { - AbstractDataBox[] boxes = new AbstractDataBox[1]; - boxes[0] = new DataboxGeneric(dataName, functionName, removeStripAndSort); - - String windowName = (dataName == null) ? functionName : dataName + " " + functionName; - WindowBox winBox = new WindowBox(windowName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - - return winBox; - } - - public static WindowBox getFromBoxesWindowBox(String title, AbstractDataBox[] boxes, boolean isDecoy, boolean isXIC, char windowType) { - - IconManager.IconType iconType; - switch (windowType) { - case WindowSavedManager.SAVE_WINDOW_FOR_RSM: - iconType = isDecoy ? IconManager.IconType.DATASET_RSM_DECOY : IconManager.IconType.DATASET_RSM; - break; - case WindowSavedManager.SAVE_WINDOW_FOR_RSET: - iconType = isDecoy ? IconManager.IconType.DATASET_RSET_DECOY : IconManager.IconType.DATASET_RSET; - break; - case WindowSavedManager.SAVE_WINDOW_FOR_QUANTI: - iconType = isXIC ? IconManager.IconType.QUANT_XIC : IconManager.IconType.QUANT_SC; - break; - default: - iconType = IconManager.IconType.CHALKBOARD; - break; - } - - WindowBox winBox = new WindowBox(title, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); - - return winBox; - } - - private static SplittedPanelContainer generatePanel(AbstractDataBox[] boxes) { - return generatePanel(boxes, true); - } - - /** - * for each dataBox, add it's nextDataBox
- * from seconde dataBox, for each dataBox, if it's layout is vertical - * layout, add 1 nbContainerPanels
- * - * @param boxes - * @param includeSaveAndAddButtonsInToolbar - * @return - */ - private static SplittedPanelContainer generatePanel(AbstractDataBox[] boxes, boolean includeSaveAndAddButtonsInToolbar) { - - // link boxes together - int nb = boxes.length - 1; - for (int i = 0; i < nb; i++) { - boxes[i].addNextDataBox(boxes[i + 1]); - } - - // create panels for each Box - nb = boxes.length; - for (int i = 0; i < nb; i++) { - boxes[i].createPanel(); - } - - // create container panel for TABBED AND HORIZONTAL Boxes - int nbContainerPanels = 0; - for (int i = 0; i < nb; i++) { - if (boxes[i].getLayout() == SplittedPanelContainer.PanelLayout.VERTICAL) { - nbContainerPanels++; - } - } - - JComponent[] panels = new JComponent[nbContainerPanels]; - int panelIdx = 0; - SplittedPanelContainer.PanelLayout prevLayout = SplittedPanelContainer.PanelLayout.VERTICAL; - for (int i = 0; i < nb; i++) { - SplittedPanelContainer.PanelLayout layout = boxes[i].getLayout(); - if (layout == SplittedPanelContainer.PanelLayout.VERTICAL) { - panels[panelIdx++] = (JPanel) boxes[i].getPanel(); - } else if (layout == SplittedPanelContainer.PanelLayout.HORIZONTAL) { - JSplitPane sp = new JSplitPane(); - JComponent leftComponent = panels[--panelIdx]; - sp.setLeftComponent(leftComponent); - JComponent rightComponent = (JComponent) boxes[i].getPanel(); - sp.setRightComponent(rightComponent); - sp.setName(leftComponent.getName() + " / " + rightComponent.getName()); - - sp.setDividerLocation(350); //JPM.TODO - panels[panelIdx++] = sp; - } else if (layout == SplittedPanelContainer.PanelLayout.TABBED) { - if (prevLayout == SplittedPanelContainer.PanelLayout.TABBED) { - JTabbedPane tb = (JTabbedPane) panels[panelIdx - 1]; - tb.addTab(boxes[i].getTypeName(), (JPanel) boxes[i].getPanel()); - tb.setName(tb.getName() + " / " + boxes[i].getTypeName()); - } else { - SplittedPanelContainer.ReactiveTabbedPane tb = new SplittedPanelContainer.ReactiveTabbedPane(); - tb.setBorder(new EmptyBorder(8, 8, 8, 8)); - tb.addTab(boxes[i - 1].getTypeName(), panels[--panelIdx]); - tb.addTab(boxes[i].getTypeName(), (JPanel) boxes[i].getPanel()); - tb.setName(boxes[i - 1].getTypeName() + " / " + boxes[i].getTypeName()); - panels[panelIdx++] = tb; - - } - } - prevLayout = layout; - } - - SplittedPanelContainer splittedPanel = new SplittedPanelContainer(includeSaveAndAddButtonsInToolbar); - - for (int i = 0; i < nbContainerPanels; i++) { - splittedPanel.registerPanel(panels[i]); - } - splittedPanel.createPanel(); - - return splittedPanel; - } - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.pattern; + +import fr.proline.core.orm.msi.ResultSet; +import java.util.HashMap; + +import fr.proline.studio.gui.SplittedPanelContainer; +import fr.proline.studio.pattern.xic.DataboxChildFeature; +import fr.proline.studio.pattern.xic.DataboxExperimentalDesign; +import fr.proline.studio.pattern.xic.DataboxMapAlignment; +import fr.proline.studio.pattern.xic.DataboxXicPeptideIon; +import fr.proline.studio.pattern.xic.DataboxXicPeptideSet; +import fr.proline.studio.pattern.xic.DataboxXicProteinSet; +import fr.proline.studio.rsmexplorer.DataBoxViewerManager; +import fr.proline.studio.utils.IconManager; +import java.awt.Image; + +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.JTabbedPane; +import javax.swing.border.EmptyBorder; +import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; +import fr.proline.studio.pattern.xic.DataboxXicParentsPeptideIon; + +/** + * + * @author JM235353 + */ +public class WindowBoxFactory { + + public static WindowBox getUserDefinedWindowBox(String dataName, String windowName, AbstractDataBox databox, boolean isDecoy, boolean isXIC, char windowType) { + AbstractDataBox[] boxes = new AbstractDataBox[1]; + boxes[0] = databox; + boxes[0].setDataName(dataName); + + Image icon; + switch (windowType) { + case WindowSavedManager.SAVE_WINDOW_FOR_RSM: + icon = IconManager.getImage(isDecoy ? IconManager.IconType.DATASET_RSM_DECOY : IconManager.IconType.DATASET_RSM); + break; + case WindowSavedManager.SAVE_WINDOW_FOR_RSET: + icon = IconManager.getImage(isDecoy ? IconManager.IconType.DATASET_RSET_DECOY : IconManager.IconType.DATASET_RSET); + break; + case WindowSavedManager.SAVE_WINDOW_FOR_QUANTI: + icon = IconManager.getImage(isXIC ? IconManager.IconType.QUANT_XIC : IconManager.IconType.QUANT_SC); + break; + default: + icon = databox.getDefaultIcon(); + break; + } + + WindowBox winBox = new WindowBox(windowName, generatePanel(boxes), boxes[0], icon); + + return winBox; + } + + public static WindowBox getDetailWindowBox(String dataName, String windowName, AbstractDataBox databox) { + AbstractDataBox[] boxes = createBoxArray(databox, dataName); + + Image icon = databox.getDefaultIcon(); + + WindowBox winBox = new WindowBox(windowName, generatePanel(boxes), boxes[0], icon); + + return winBox; + } + + private static AbstractDataBox[] createBoxArray(AbstractDataBox databox, String dataName) { + + ResultSet rset = (ResultSet) databox.getData( ResultSet.class); + + AbstractDataBox[] boxes; + if (databox instanceof DataBoxRsetProteinsForPeptideMatch) { + + boolean mergedData = false; + if (rset != null) { + ResultSet.Type rsType = rset.getType(); + mergedData = (rsType == ResultSet.Type.USER) || (rsType == ResultSet.Type.DECOY_USER); // Merge or Decoy Merge + } + + boxes = new AbstractDataBox[2]; + boxes[1] = new DataboxRsetPeptidesOfProtein(mergedData); + + } else if (databox instanceof DataBoxRsetPeptideSpectrumValues) { + boxes = new AbstractDataBox[2]; + boxes[1] = new DataBoxRsetPeptideSpectrum(); + boxes[1].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + } else if (databox instanceof DataBoxRsetPeptideSpectrum) { + boxes = new AbstractDataBox[4]; + boxes[1] = new DataBoxRsetPeptideSpectrumError(); + boxes[1].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[2] = new DataBoxRsetPeptideFragmentation(); + boxes[2].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[3] = new DataBoxRsetPeptideSpectrumValues(); + boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + + } else if (databox instanceof DataBoxAdjacencyMatrixChoice) { + + DataBoxAdjacencyMatrixChoice adjacencyMatrixChoice = ((DataBoxAdjacencyMatrixChoice) databox); + adjacencyMatrixChoice.setKeepSameset(true); + adjacencyMatrixChoice.doNotTakeFirstSelection(true); + adjacencyMatrixChoice.createPanel(); //JPM.WART + databox = new DataBoxAdjacencyMatrix(); + adjacencyMatrixChoice.addNextDataBox(databox); + boxes = new AbstractDataBox[7]; + + boxes[1] = new DataBoxRsetPeptideSpectrum(); + boxes[2] = new DataBoxRsetPeptideSpectrumError(); + boxes[2].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[3] = new DataBoxRsetPeptideFragmentation(); + boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[4] = new DataBoxRsetPeptideSpectrumValues(); + boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + + boxes[5] = new DataBoxRsmProteinAndPeptideSequence(); + boxes[6] = new DataBoxRsmPeptidesOfProtein(); + boxes[6].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + + } else if (databox instanceof DataBoxRsmProteinSetOfPeptides) { + boxes = new AbstractDataBox[3]; + boxes[1] = new DataBoxRsmProteinsOfProteinSet(); + boxes[2] = new DataBoxRsmPeptidesOfProtein(); + } else if (databox instanceof DataBoxRsmProteinsOfProteinSet) { + boxes = new AbstractDataBox[7]; + boxes[1] = new DataBoxRsmPeptidesOfProtein(); + boxes[2] = new DataBoxRsmProteinAndPeptideSequence(); + boxes[3] = new DataBoxRsetPeptideSpectrum(); + boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[4] = new DataBoxRsetPeptideSpectrumError(); + boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[5] = new DataBoxRsetPeptideFragmentation(); + boxes[5].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[6] = new DataBoxRsetPeptideSpectrumValues(); + boxes[6].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + + } else if (databox instanceof DataboxRsmPSMOfProteinSet) { + boxes = new AbstractDataBox[5]; + boxes[1] = new DataBoxRsetPeptideSpectrum(); + boxes[2] = new DataBoxRsetPeptideSpectrumError(); + boxes[2].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[3] = new DataBoxRsetPeptideFragmentation(); + boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[4] = new DataBoxRsetPeptideSpectrumValues(); + boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + } else if (databox instanceof DataBoxRsmPeptidesOfProtein) { + boxes = new AbstractDataBox[6]; + boxes[1] = new DataBoxRsmProteinAndPeptideSequence(); + boxes[2] = new DataBoxRsetPeptideSpectrum(); + boxes[2].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[3] = new DataBoxRsetPeptideSpectrumError(); + boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[4] = new DataBoxRsetPeptideFragmentation(); + boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[5] = new DataBoxRsetPeptideSpectrumValues(); + boxes[5].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + } else { + boxes = new AbstractDataBox[1]; + } + + boxes[0] = databox; + boxes[0].setDataName(dataName); + + return boxes; + } + + public static WindowBox getPeptidesWindowBox(String dataName, boolean isDecoy, boolean isMerged) { + return getPeptidesForRsetOnlyWindowBox(dataName, isDecoy, isMerged); + + } + + public static WindowBox getPeptidesForRsetOnlyWindowBox(String dataName, boolean isDecoy, boolean isMerged) { + // AW: search results / PSM set of boxes. + // + // create boxes + AbstractDataBox[] boxes = new AbstractDataBox[6]; + boxes[0] = new DataBoxRsetPSM(isMerged); + boxes[0].setDataName(dataName); + boxes[1] = new DataBoxRsetPeptideSpectrum(); + boxes[2] = new DataBoxRsetPeptideSpectrumError(); + boxes[2].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[3] = new DataBoxRsetPeptideFragmentation(); + boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[4] = new DataBoxRsetPeptideSpectrumValues(); + boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[5] = new DataBoxRsetProteinsForPeptideMatch(); + + IconManager.IconType iconType = isDecoy ? IconManager.IconType.DATASET_RSET_DECOY : IconManager.IconType.DATASET_RSET; + WindowBox winBox = new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + + return winBox; + + } + + public static WindowBox getMSDiagWindowBox(String dataName, HashMap resultMessage) { + // MSDiag + // + // create boxes + AbstractDataBox[] boxes = new AbstractDataBox[1]; + boxes[0] = new DataBoxRsetMSDiag(resultMessage); + boxes[0].setDataName(dataName); + + IconManager.IconType iconType = IconManager.IconType.CHART_PIE; // TODO: change icon + WindowBox winBox = new WindowBox(dataName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + + return winBox; + + } + + public static WindowBox getGraphicsWindowBox(String fullName, AbstractDataBox srcDatabox, boolean locked) { + AbstractDataBox[] boxes = new AbstractDataBox[1]; + boxes[0] = new DataboxGraphics(locked); + srcDatabox.addNextDataBox(boxes[0]); + IconManager.IconType iconType = IconManager.IconType.CHART; + WindowBox winBox = new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + boxes[0].dataChanged(); + return winBox; + } + + public static WindowBox getGraphicsWindowBox(String fullName, ExtendedTableModelInterface srcDataInterface, boolean locked) { + AbstractDataBox[] boxes = new AbstractDataBox[1]; + boxes[0] = new DataboxGraphics(locked); + IconManager.IconType iconType = IconManager.IconType.CHART; + WindowBox winBox = new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + boxes[0].setEntryData(srcDataInterface); + return winBox; + } + + public static WindowBox getMultiGraphicsWindowBox(String fullName, AbstractDataBox srcDatabox, boolean canChooseColor) { + AbstractDataBox[] boxes = new AbstractDataBox[1]; + boxes[0] = new DataboxMultiGraphics(true, canChooseColor); + srcDatabox.addNextDataBox(boxes[0]); + IconManager.IconType iconType = IconManager.IconType.CHART; + WindowBox winBox = new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + boxes[0].dataChanged(); + return winBox; + } + + public static WindowBox getProteinMatchesForRsetWindowBox(String dataName, boolean isDecoy, boolean mergedData) { + + // create boxes + // AW: search results / proteins + AbstractDataBox[] boxes = new AbstractDataBox[2]; + boxes[0] = new DataBoxRsetAllProteinMatch(); + boxes[0].setDataName(dataName); + boxes[1] = new DataboxRsetPeptidesOfProtein(mergedData); + + IconManager.IconType iconType = isDecoy ? IconManager.IconType.DATASET_RSET_DECOY : IconManager.IconType.DATASET_RSET; + WindowBox winBox = new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + + return winBox; + + } + +// public static WindowBox getPTMSitesWindowBoxV1(String dataName) { +// +// AbstractDataBox[] boxes = new AbstractDataBox[5]; +// boxes[0] = new DataBoxPTMSiteProtein(); +// boxes[0].setDataName(dataName); +// ((DataBoxPTMSiteProtein) boxes[0]).setXicResult(false); +// boxes[1] = new DataBoxPTMSitePeptidesGraphic(); +// boxes[2] = new DataBoxPTMSitePeptides(); +// boxes[2].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); +// boxes[3] = new DataBoxPTMSitePepMatches(); +// boxes[4] = new DataboxRsetPSMForMsQuery(); +// +// IconManager.IconType iconType = IconManager.IconType.DATASET_RSM; +// return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); +// } +// +// public static WindowBox getPTMSitesWindowBoxV2(String dataName) { +// +// AbstractDataBox[] boxes = new AbstractDataBox[5]; +// boxes[0] = new DataBoxPTMSiteProtein(true); +// boxes[0].setDataName(dataName); +// ((DataBoxPTMSiteProtein) boxes[0]).setXicResult(false); +// boxes[1] = new DataBoxPTMPeptidesGraphic(); +// ((DataBoxPTMPeptidesGraphic)boxes[1]).setIsClusterData(false); +// boxes[2] = new DataBoxPTMSitePeptides(); +// boxes[2].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); +// boxes[3] = new DataBoxPTMSitePepMatches(); +// boxes[4] = new DataboxRsetPSMForMsQuery(); +// +// IconManager.IconType iconType = IconManager.IconType.DATASET_RSM; +// return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); +// } + + /** + * PTM cluster databox + * @param dataName + * @return + */ + public static WindowBox getPTMDataWindowBox(String dataName, boolean viewSites, boolean isAnnotated, boolean unsaved) { + AbstractDataBox[] boxes = new AbstractDataBox[4]; + boxes[0] = new DataBoxPTMClusters(viewSites, isAnnotated); + boxes[0].setDataName(dataName); + ((DataBoxPTMClusters) boxes[0]).setXicResult(false); + boxes[1] = new DataBoxPTMPeptidesGraphic(); + boxes[2] = new DataBoxPTMPeptides(false, false); + boxes[2].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); + boxes[3] = new DataBoxPTMPeptides(false,true); + boxes[3].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + // boxes[4] = new DataboxRsetPSMForMsQuery(); + IconManager.IconType iconType = IconManager.IconType.DATASET_RSM; + String title = boxes[0].getFullName(); + if(unsaved && !title.endsWith(DataBoxViewerManager.MODIFIED_TITLE_SUFFIX)) + title = title + " " + DataBoxViewerManager.MODIFIED_TITLE_SUFFIX; + return new WindowBox(title, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + + } + + /** + * XIC PTM cluster databox + * @param dataName + * @return + */ + public static WindowBox getXicPTMDataWindowBox(String dataName, boolean viewSites, boolean isAnnotated , boolean unsaved) { + AbstractDataBox[] boxes = new AbstractDataBox[7]; + boxes[0] = new DataBoxPTMClusters(viewSites, isAnnotated); + boxes[0].setDataName(dataName); + ((DataBoxPTMClusters) boxes[0]).setXicResult(true); + boxes[1] = new DataBoxPTMPeptides(true, false); + boxes[2] = new DataBoxPTMPeptides(false,true); + boxes[2].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[3] = new DataBoxPTMPeptidesGraphic(); + boxes[4] = new DataboxMultiGraphics(false,false,true);//associate a graphic databox for DataboxXicPeptideSet + ((DataboxMultiGraphics)boxes[4]).setHideButton(true); + boxes[4].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); + boxes[5] = new DataboxXicPeptideSet(false);//display the selected peptideMatch in each chanel + boxes[6] = new DataboxMultiGraphics(false,false,true); //associate a graphic databox for DataboxXicPeptideSet + ((DataboxMultiGraphics)boxes[6]).setHideButton(true); + boxes[6].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); + + IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; + String title = boxes[0].getFullName(); + if(unsaved && !title.endsWith(DataBoxViewerManager.MODIFIED_TITLE_SUFFIX)) + title = title + " " + DataBoxViewerManager.MODIFIED_TITLE_SUFFIX; + return new WindowBox(title, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + } + +// public static WindowBox getXicPTMSitesWindowBoxV2(String dataName) { +// +// AbstractDataBox[] boxes = new AbstractDataBox[6]; +// boxes[0] = new DataBoxPTMSiteProtein(true); +// boxes[0].setDataName(dataName); +// ((DataBoxPTMSiteProtein) boxes[0]).setXicResult(true); +// +// boxes[1] = new DataBoxPTMPeptides(); +// boxes[2] = new DataBoxPTMPeptidesGraphic(); +// ((DataBoxPTMPeptidesGraphic)boxes[2]).setIsClusterData(false); +// //boxes[2].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); +// +// // boxes[3] = new DataboxXicPeptideSet(true);//display the selected peptide in each chanel +// //((DataboxXicPeptideSet) boxes[3]).setXICMode(true); +// boxes[3] = new DataboxMultiGraphics(false,false,true);//associate a graphic databox for DataboxXicPeptideSet +// ((DataboxMultiGraphics)boxes[3]).setHideButton(true); +// boxes[3].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); +//// boxes[5] = new DataBoxPTMSitePepMatches(); +//// boxes[5].setLayout(SplittedPanelContainer.PanelLayout.TABBED); +//// +// boxes[4] = new DataboxXicPeptideSet(false);//display the selected peptideMatch in each chanel +// boxes[5] = new DataboxMultiGraphics(false,false,true); //associate a graphic databox for DataboxXicPeptideSet +// ((DataboxMultiGraphics)boxes[5]).setHideButton(true); +// boxes[5].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); +// +// IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; +// return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); +// } +// +// +// public static WindowBox getXicPTMSitesWindowBoxV1(String dataName) { +// +// AbstractDataBox[] boxes = new AbstractDataBox[8]; +// boxes[0] = new DataBoxPTMSiteProtein(); +// boxes[0].setDataName(dataName); +// ((DataBoxPTMSiteProtein) boxes[0]).setXicResult(true); +// +// boxes[1] = new DataBoxPTMSitePeptidesGraphic(); +// +// boxes[2] = new DataBoxPTMSitePeptides();//new DataBoxXicPTMSitePeptides(); +// boxes[2].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); +// +// boxes[3] = new DataboxXicPeptideSet(true);//display the selected peptide in each chanel +// ((DataboxXicPeptideSet) boxes[3]).setXICMode(true); +// boxes[4] = new DataboxMultiGraphics(false,false,true);//associate a graphic databox for DataboxXicPeptideSet +// ((DataboxMultiGraphics)boxes[4]).setHideButton(true); +// boxes[4].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); +// boxes[5] = new DataBoxPTMSitePepMatches(); +// boxes[5].setLayout(SplittedPanelContainer.PanelLayout.TABBED); +// +// boxes[6] = new DataboxXicPeptideSet(false);//display the selected peptideMatch in each chanel +// boxes[7] = new DataboxMultiGraphics(false,false,true); //associate a graphic databox for DataboxXicPeptideSet +// ((DataboxMultiGraphics)boxes[7]).setHideButton(true); +// boxes[7].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); +// +// IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; +// return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); +// } + + public static WindowBox getRsmPSMWindowBox(String dataName, boolean isDecoy, boolean mergedData) { + // create boxes + // AW: All PSM of an Identification Summary or corresponding to a Peptide Instance + AbstractDataBox[] boxes = new AbstractDataBox[1]; + boxes[0] = new DataBoxRsmPSM(mergedData); + boxes[0].setDataName(dataName); + + IconManager.IconType iconType = isDecoy ? IconManager.IconType.DATASET_RSM_DECOY : IconManager.IconType.DATASET_RSM; + return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + } + + public static WindowBox getRsmPeptidesWindowBox(String dataName, boolean isDecoy) { + // create boxes + // AW: Identification Summary / Peptide Instances"; + AbstractDataBox[] boxes = new AbstractDataBox[4]; + boxes[0] = new DataBoxRsmPeptideInstances(); + boxes[0].setDataName(dataName); + boxes[1] = new DataBoxRsmProteinSetOfPeptides(); + boxes[2] = new DataBoxRsmProteinsOfProteinSet(); + boxes[3] = new DataBoxRsmPeptidesOfProtein(); + boxes[3].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); + + IconManager.IconType iconType = isDecoy ? IconManager.IconType.DATASET_RSM_DECOY : IconManager.IconType.DATASET_RSM; + WindowBox winBox = new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + + return winBox; + } + + public static WindowBox getProteinSetsWindowBox(String dataName, boolean isDecoy) { + + // create boxes + AbstractDataBox[] boxes = new AbstractDataBox[8]; + boxes[0] = new DataBoxRsmAllProteinSet(); + boxes[0].setDataName(dataName); + boxes[1] = new DataBoxRsmProteinsOfProteinSet(); + boxes[2] = new DataBoxRsmPeptidesOfProtein(); + boxes[3] = new DataBoxRsmProteinAndPeptideSequence(); + boxes[4] = new DataBoxRsetPeptideSpectrum(); + boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[5] = new DataBoxRsetPeptideSpectrumError(); + boxes[5].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[6] = new DataBoxRsetPeptideFragmentation(); + boxes[6].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[7] = new DataBoxRsetPeptideSpectrumValues(); + boxes[7].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + + IconManager.IconType iconType = isDecoy ? IconManager.IconType.DATASET_RSM_DECOY : IconManager.IconType.DATASET_RSM; + + WindowBox winBox = new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + + return winBox; + } + + public static WindowBox getAdjacencyMatrixWindowBox(String dataName, boolean isDecoy) { + + // create boxes + AbstractDataBox[] boxes = new AbstractDataBox[2]; + boxes[0] = new DataBoxAdjacencyMatrixChoice(); + boxes[0].setDataName(dataName); + boxes[1] = new DataBoxAdjacencyMatrix(); + + IconManager.IconType iconType = isDecoy ? IconManager.IconType.DATASET_RSM_DECOY : IconManager.IconType.DATASET_RSM; + + WindowBox winBox = new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + + return winBox; + } + + public static WindowBox getAllResultSetWindowBox(String dataName) { + + // create boxes + AbstractDataBox[] boxes = new AbstractDataBox[1]; + boxes[0] = new DataBoxRsetAll(); + boxes[0].setDataName(dataName); + + WindowBox winBox = new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], null); + + return winBox; + + } + + /** + * xicMode : if false => SC + * + * @param dataName + * @param fullName + * @param xicMode + * @return + */ + public static WindowBox getXicQuantProteinSetWindowBox(String dataName, String fullName, boolean xicMode, boolean aggregatedQuantiPeptideIon) { + + // create boxes + int nbBoxes = xicMode ? ((aggregatedQuantiPeptideIon) ? 7 : 6) : 3; + + AbstractDataBox[] boxes = new AbstractDataBox[nbBoxes]; + boxes[0] = new DataboxXicProteinSet(); + boxes[0].setDataName(dataName); + ((DataboxXicProteinSet) boxes[0]).setXICMode(xicMode); + boxes[1] = new DataboxXicPeptideSet(); + ((DataboxXicPeptideSet) boxes[1]).setXICMode(xicMode); + boxes[2] = new DataboxMultiGraphics(false,true,true); + ((DataboxMultiGraphics)boxes[2]).setHideButton(true); + boxes[2].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); + if (xicMode) { + boxes[3] = new DataboxXicPeptideIon(); + ((DataboxXicPeptideIon) boxes[3]).setXICMode(xicMode); + boxes[3].setLayout(SplittedPanelContainer.PanelLayout.VERTICAL); + + if (aggregatedQuantiPeptideIon) { + boxes[4] = new DataboxXicParentsPeptideIon(); + boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[5] = new DataboxChildFeature(); + boxes[5].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[6] = new DataboxMultiGraphics(false, false); + boxes[6].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); + } else { + + boxes[4] = new DataboxChildFeature(); + boxes[4].setLayout(SplittedPanelContainer.PanelLayout.TABBED); + boxes[5] = new DataboxMultiGraphics(false, false); + boxes[5].setLayout(SplittedPanelContainer.PanelLayout.HORIZONTAL); + } + } + + IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; + if (!xicMode) { + iconType = IconManager.IconType.QUANT_SC; + } + return new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + } + + public static WindowBox getXicQuantPeptideSetWindowBox(String dataName, String fullName, boolean xicMode) { + + // create boxes + int nbBoxes = xicMode ? 2 : 1; + AbstractDataBox[] boxes = new AbstractDataBox[nbBoxes]; + boxes[0] = new DataboxXicPeptideSet(); + boxes[0].setDataName(dataName); + ((DataboxXicPeptideSet) boxes[0]).setXICMode(xicMode); + if (xicMode) { + boxes[1] = new DataboxXicPeptideIon(); + ((DataboxXicPeptideIon) boxes[1]).setXICMode(xicMode); + } + + IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; + if (!xicMode) { + iconType = IconManager.IconType.QUANT_SC; + } + return new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + } + + public static WindowBox getXicQuantPeptideIonWindowBox(String dataName, String fullName, boolean xicMode) { + + // create boxes + AbstractDataBox[] boxes = new AbstractDataBox[1]; + boxes[0] = new DataboxXicPeptideIon(); + boxes[0].setDataName(dataName); + ((DataboxXicPeptideIon) boxes[0]).setXICMode(xicMode); + + IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; + if (!xicMode) { + iconType = IconManager.IconType.QUANT_SC; + } + return new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + } + + public static WindowBox getMzScopeWindowBox() { + AbstractDataBox[] boxes = new AbstractDataBox[1]; + boxes[0] = new DataBoxMzScope(); + + WindowBox winBox = new WindowBox("MzScope", generatePanel(boxes), boxes[0], IconManager.getImage(IconManager.IconType.WAVE)); + + return winBox; + } + + public static WindowBox getExperimentalDesignWindowBox(String dataName, String fullName) { + + // create boxes + AbstractDataBox[] boxes = new AbstractDataBox[1]; + boxes[0] = new DataboxExperimentalDesign(); + boxes[0].setDataName(dataName); + IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; + return new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + } + + public static WindowBox getMapAlignmentWindowBox(String dataName, String fullName) { + // create boxes + AbstractDataBox[] boxes = new AbstractDataBox[2]; + boxes[0] = new DataboxMapAlignment(); + boxes[0].setDataName(dataName); + boxes[1] = new DataboxMultiGraphics(false, false); + boxes[1].setLayout(SplittedPanelContainer.PanelLayout.VERTICAL); + IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; + return new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + } + + public static WindowBox getMapMozCalibrationWindowBox(String dataName, String fullName) { + // create boxes + AbstractDataBox[] boxes = new AbstractDataBox[2]; + boxes[0] = new DataboxMapAlignment(true); + boxes[0].setDataName(dataName); + boxes[1] = new DataboxMultiGraphics(false, false); + boxes[1].setLayout(SplittedPanelContainer.PanelLayout.VERTICAL); + IconManager.IconType iconType = IconManager.IconType.QUANT_XIC; + return new WindowBox(fullName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + } + + + public static WindowBox getMSQueriesWindowBoxForRsm(String dataName, boolean mergedData) { + // create boxes + AbstractDataBox[] boxes = new AbstractDataBox[2]; + boxes[0] = new DataBoxMSQueriesForRSM(); + boxes[0].setDataName(dataName); + boxes[1] = new DataBoxRsmPSMForMsQuery(mergedData); + boxes[1].setLayout(SplittedPanelContainer.PanelLayout.VERTICAL); + IconManager.IconType iconType = IconManager.IconType.DATASET_RSM; + return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + } + + public static WindowBox getMSQueriesWindowBoxForRset(String dataName, boolean mergedData) { + // create boxes + AbstractDataBox[] boxes = new AbstractDataBox[2]; + boxes[0] = new DataBoxMSQueriesForRset(); + boxes[0].setDataName(dataName); + boxes[1] = new DataboxRsetPSMForMsQuery(mergedData); + boxes[1].setLayout(SplittedPanelContainer.PanelLayout.VERTICAL); + IconManager.IconType iconType = IconManager.IconType.DATASET_RSET; + return new WindowBox(boxes[0].getFullName(), generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + } + + public static WindowBox getTaskListWindowBox() { + AbstractDataBox[] boxes = new AbstractDataBox[2]; + boxes[0] = new DataBoxTaskList(); + boxes[1] = new DataBoxTaskDescription(); + + WindowBox winBox = new WindowBox("User Tasks", generatePanel(boxes), boxes[0], null); + + return winBox; + } + + public static WindowBox getSystemTaskLogWindowBox() { + AbstractDataBox[] boxes = new AbstractDataBox[1]; + boxes[0] = new DataBoxSystemTasks(); + + WindowBox winBox = new WindowBox("Server Tasks", generatePanel(boxes), boxes[0], null); + return winBox; + } + + public static WindowBox getDataAnalyzerWindowBox() { + AbstractDataBox[] boxes = new AbstractDataBox[2]; + boxes[0] = new DataboxDataAnalyzer(); + boxes[1] = new DataBoxDataAnalyzerResults(); + WindowBox winBox = new WindowBox("Data Analyzer", generatePanel(boxes, false), boxes[0], IconManager.getImage(IconManager.IconType.DATA_ANALYZER)); + return winBox; + } + + public static WindowBox[] getSystemMonitoringWindowBox() { + WindowBox[] m_windowBoxes = new WindowBox[2]; //2 + m_windowBoxes[0] = WindowBoxFactory.getTaskListWindowBox(); //JPM.DOCK.TEST + m_windowBoxes[1] = WindowBoxFactory.getSystemTaskLogWindowBox(); + +// WindowBox[] m_windowBoxes = new WindowBox[1]; +// m_windowBoxes[0] = WindowBoxFactory.getTaskListWindowBox(); + return m_windowBoxes; + } + + public static WindowBox getImageWindowBox(String dataName, Image img) { + AbstractDataBox[] boxes = new AbstractDataBox[1]; + boxes[0] = new DataBoxImage(); + + WindowBox winBox = new WindowBox(dataName + " Image", generatePanel(boxes, false), boxes[0], IconManager.getImage(IconManager.IconType.WAVE)); + winBox.setEntryData(-1, img); + + return winBox; + } + + public static WindowBox getGenericWindowBox(String dataName, String functionName, IconManager.IconType iconType, boolean removeStripAndSort) { + AbstractDataBox[] boxes = new AbstractDataBox[1]; + boxes[0] = new DataboxGeneric(dataName, functionName, removeStripAndSort); + + String windowName = (dataName == null) ? functionName : dataName + " " + functionName; + WindowBox winBox = new WindowBox(windowName, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + + return winBox; + } + + public static WindowBox getFromBoxesWindowBox(String title, AbstractDataBox[] boxes, boolean isDecoy, boolean isXIC, char windowType) { + + IconManager.IconType iconType; + switch (windowType) { + case WindowSavedManager.SAVE_WINDOW_FOR_RSM: + iconType = isDecoy ? IconManager.IconType.DATASET_RSM_DECOY : IconManager.IconType.DATASET_RSM; + break; + case WindowSavedManager.SAVE_WINDOW_FOR_RSET: + iconType = isDecoy ? IconManager.IconType.DATASET_RSET_DECOY : IconManager.IconType.DATASET_RSET; + break; + case WindowSavedManager.SAVE_WINDOW_FOR_QUANTI: + iconType = isXIC ? IconManager.IconType.QUANT_XIC : IconManager.IconType.QUANT_SC; + break; + default: + iconType = IconManager.IconType.CHALKBOARD; + break; + } + + WindowBox winBox = new WindowBox(title, generatePanel(boxes), boxes[0], IconManager.getImage(iconType)); + + return winBox; + } + + private static SplittedPanelContainer generatePanel(AbstractDataBox[] boxes) { + return generatePanel(boxes, true); + } + + /** + * for each dataBox, add it's nextDataBox
+ * from seconde dataBox, for each dataBox, if it's layout is vertical + * layout, add 1 nbContainerPanels
+ * + * @param boxes + * @param includeSaveAndAddButtonsInToolbar + * @return + */ + private static SplittedPanelContainer generatePanel(AbstractDataBox[] boxes, boolean includeSaveAndAddButtonsInToolbar) { + + // link boxes together + int nb = boxes.length - 1; + for (int i = 0; i < nb; i++) { + boxes[i].addNextDataBox(boxes[i + 1]); + } + + // create panels for each Box + nb = boxes.length; + for (int i = 0; i < nb; i++) { + boxes[i].createPanel(); + } + + // create container panel for TABBED AND HORIZONTAL Boxes + int nbContainerPanels = 0; + for (int i = 0; i < nb; i++) { + if (boxes[i].getLayout() == SplittedPanelContainer.PanelLayout.VERTICAL) { + nbContainerPanels++; + } + } + + JComponent[] panels = new JComponent[nbContainerPanels]; + int panelIdx = 0; + SplittedPanelContainer.PanelLayout prevLayout = SplittedPanelContainer.PanelLayout.VERTICAL; + for (int i = 0; i < nb; i++) { + SplittedPanelContainer.PanelLayout layout = boxes[i].getLayout(); + if (layout == SplittedPanelContainer.PanelLayout.VERTICAL) { + panels[panelIdx++] = (JPanel) boxes[i].getPanel(); + } else if (layout == SplittedPanelContainer.PanelLayout.HORIZONTAL) { + JSplitPane sp = new JSplitPane(); + JComponent leftComponent = panels[--panelIdx]; + sp.setLeftComponent(leftComponent); + JComponent rightComponent = (JComponent) boxes[i].getPanel(); + sp.setRightComponent(rightComponent); + sp.setName(leftComponent.getName() + " / " + rightComponent.getName()); + + sp.setDividerLocation(350); //JPM.TODO + panels[panelIdx++] = sp; + } else if (layout == SplittedPanelContainer.PanelLayout.TABBED) { + if (prevLayout == SplittedPanelContainer.PanelLayout.TABBED) { + JTabbedPane tb = (JTabbedPane) panels[panelIdx - 1]; + tb.addTab(boxes[i].getTypeName(), (JPanel) boxes[i].getPanel()); + tb.setName(tb.getName() + " / " + boxes[i].getTypeName()); + } else { + SplittedPanelContainer.ReactiveTabbedPane tb = new SplittedPanelContainer.ReactiveTabbedPane(); + tb.setBorder(new EmptyBorder(8, 8, 8, 8)); + tb.addTab(boxes[i - 1].getTypeName(), panels[--panelIdx]); + tb.addTab(boxes[i].getTypeName(), (JPanel) boxes[i].getPanel()); + tb.setName(boxes[i - 1].getTypeName() + " / " + boxes[i].getTypeName()); + panels[panelIdx++] = tb; + + } + } + prevLayout = layout; + } + + SplittedPanelContainer splittedPanel = new SplittedPanelContainer(includeSaveAndAddButtonsInToolbar); + + for (int i = 0; i < nbContainerPanels; i++) { + splittedPanel.registerPanel(panels[i]); + } + splittedPanel.createPanel(); + + return splittedPanel; + } + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/WindowSavedManager.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/WindowSavedManager.java index 267a173d0..96d05b580 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/WindowSavedManager.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/WindowSavedManager.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -26,7 +26,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.prefs.Preferences; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/extradata/GraphicExtraData.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/extradata/GraphicExtraData.java index dc2491380..8e699a770 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/extradata/GraphicExtraData.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/extradata/GraphicExtraData.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxChildFeature.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxChildFeature.java index d5dcb66e7..f890c0c8a 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxChildFeature.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxChildFeature.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -111,7 +111,7 @@ public void dataChanged() { m_masterQuantPeptideIon = (DMasterQuantPeptideIon) getData(DMasterQuantPeptideIon.class); m_quantChannelInfo = (QuantChannelInfo) getData(QuantChannelInfo.class); - if (m_masterQuantPeptideIon != null && (oldIon != null && m_masterQuantPeptideIon.equals(oldIon))) { + if (m_masterQuantPeptideIon != null && (m_masterQuantPeptideIon.equals(oldIon))) { return; } if (m_masterQuantPeptideIon == null && oldIon == null) { @@ -121,7 +121,7 @@ public void dataChanged() { if (m_quantChannelInfo == null) { - ((XicFeaturePanel) getDataBoxPanelInterface()).setData(-1l, null, null, null, true); + ((XicFeaturePanel) getDataBoxPanelInterface()).setData(-1l, null, null, null, true, null); return; } @@ -139,11 +139,11 @@ public boolean mustBeCalledInAWT() { public void run(boolean success, long taskId, SubTask subTask, boolean finished) { if (success) { - m_peakList = new ArrayList(); + m_peakList = new ArrayList<>(); if (m_childFeatureList != null) { for (int i = 0; i < m_childFeatureList.size(); i++) { boolean hasPeak = false; - List> list = new ArrayList(); + List> list = new ArrayList<>(); if (m_peakelList.size() >= i + 1) { for (Peakel peakel : m_peakelList.get(i)) { List listPeak = peakel.getPeakList(); @@ -159,14 +159,14 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) } - ((XicFeaturePanel) getDataBoxPanelInterface()).setData(taskId, m_childFeatureList, m_quantChannelInfo, m_featureHasPeak, finished); + ((XicFeaturePanel) getDataBoxPanelInterface()).setData(taskId, m_childFeatureList, m_quantChannelInfo, m_featureHasPeak, finished, m_masterQuantPeptideIon); } else { - m_childFeatureList = new ArrayList(); - m_featureHasPeak = new ArrayList(); - m_peakelList = new ArrayList(); - m_peakList = new ArrayList(); - ((XicFeaturePanel) getDataBoxPanelInterface()).setData(taskId, m_childFeatureList, m_quantChannelInfo, m_featureHasPeak, finished); + m_childFeatureList = new ArrayList<>(); + m_featureHasPeak = new ArrayList<>(); + m_peakelList = new ArrayList<>(); + m_peakList = new ArrayList<>(); + ((XicFeaturePanel) getDataBoxPanelInterface()).setData(taskId, m_childFeatureList, m_quantChannelInfo, m_featureHasPeak, finished, m_masterQuantPeptideIon); } @@ -185,10 +185,10 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) // ask asynchronous loading of data - m_childFeatureList = new ArrayList(); - m_featureHasPeak = new ArrayList(); - m_peakelList = new ArrayList(); - m_peakList = new ArrayList(); + m_childFeatureList = new ArrayList<>(); + m_featureHasPeak = new ArrayList<>(); + m_peakelList = new ArrayList<>(); + m_peakList = new ArrayList<>(); DatabaseLoadLcMSTask task = new DatabaseLoadLcMSTask(callback); // Long alnRefMapId = m_quantChannelInfo.getDataset().getAlnReferenceMapId(); @@ -204,7 +204,7 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) } private List getPeakTableModelList() { - List list = new ArrayList(); + List list = new ArrayList<>(); int viewType = ((XicFeaturePanel) getDataBoxPanelInterface()).getGraphViewType(); if (m_childFeatureList != null) { switch (viewType) { @@ -376,8 +376,8 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub /** * Return potential extra data available for the corresponding parameter of class type - * @param c - * @return + * @param parameterType parameter class type + * @return data available for the corresponding parameter of class type */ @Override public Object getExtraData(Class parameterType) { @@ -397,7 +397,7 @@ public String getFullName() { } private List getCompareDataInterfaceList() { - List listCDI = new ArrayList(); + List listCDI = new ArrayList<>(); List listPeakPanel = getPeakTableModelList(); //JPM : use of XicPeakPanel is a nonsense for (XicPeakPanel peakPanel : listPeakPanel) { listCDI.add(peakPanel.getGlobalTableModelInterface()); @@ -414,7 +414,7 @@ private List getCompareDataInterfaceList() { private List getCrossSelectionInterfaceList() { - List listCSI = new ArrayList(); + List listCSI = new ArrayList<>(); List listPeakPanel = getPeakTableModelList(); for (XicPeakPanel peakPanel : listPeakPanel) { listCSI.add(peakPanel.getCrossSelectionInterface()); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxExperimentalDesign.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxExperimentalDesign.java index c31e33e65..5b9027a71 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxExperimentalDesign.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxExperimentalDesign.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxMapAlignment.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxMapAlignment.java index b3cb98dd8..a8e6bce6b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxMapAlignment.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxMapAlignment.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,33 +16,31 @@ */ package fr.proline.studio.pattern.xic; -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; -import java.util.HashMap; -import java.util.Map; import fr.proline.core.orm.lcms.MapAlignment; -import fr.proline.core.orm.lcms.MapTime; import fr.proline.core.orm.lcms.ProcessedMap; +import fr.proline.core.orm.lcms.ProcessedMapMozCalibration; import fr.proline.core.orm.msi.dto.DMasterQuantPeptideIon; import fr.proline.core.orm.uds.dto.DDataset; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; import fr.proline.studio.dam.tasks.SubTask; import fr.proline.studio.dam.tasks.xic.DatabaseLoadLcMSTask; import fr.proline.studio.dam.tasks.xic.DatabaseLoadXicMasterQuantTask; -import fr.proline.studio.graphics.CrossSelectionInterface; +import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; import fr.proline.studio.pattern.AbstractDataBox; import fr.proline.studio.pattern.ParameterList; import fr.proline.studio.pattern.ParameterSubtypeEnum; -import fr.proline.studio.rsmexplorer.gui.xic.MapAlignmentPanel; -import fr.proline.studio.rsmexplorer.gui.xic.MapTimePanel; -import fr.proline.studio.rsmexplorer.gui.xic.QuantChannelInfo; -import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; import fr.proline.studio.rsmexplorer.gui.dialog.xic.AbstractLabelFreeMSParamsPanel; +import fr.proline.studio.rsmexplorer.gui.xic.*; import fr.proline.studio.rsmexplorer.gui.xic.alignment.IonsRTTableModel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.awt.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * databox for mapAlignment data * @@ -57,20 +55,27 @@ public class DataboxMapAlignment extends AbstractDataBox { private QuantChannelInfo m_quantChannelInfo; private List m_masterQuantPeptideIonList; - private Map m_compareRT2Maps; - private double m_RT_Tolerance; + private Map m_ionsRTBySourceMapId; + private double m_crossAssignmentTimeTolerance = AbstractLabelFreeMSParamsPanel.DEFAULT_CA_FEATMAP_RTTOL_VALUE; + private double m_featureAlignmentTimeTolerance = AbstractLabelFreeMSParamsPanel.DEFAULT_ALIGN_FEATMAP_TIMETOL_VALUE; private Long m_paramTaskId; private boolean m_isCloudLoaded; private boolean m_isCloudTaskAsked; - + private boolean m_isMoZAlignment; + public DataboxMapAlignment() { + this(false); + } + + public DataboxMapAlignment(boolean isMoZAlignment) { super(DataboxType.DataBoxMapAlignment, DataboxStyle.STYLE_XIC); + m_isMoZAlignment = isMoZAlignment; // Name of this databox - m_typeName = "Map Alignment Plot"; - m_description = "Graphical display of XIC Map Alignment."; + m_typeName = m_isMoZAlignment ? "Moz Calibration Plot" : "Map Alignment Plot"; + m_description = m_isMoZAlignment ? "Graphical display of XIC MoZ Calibration." : "Graphical display of XIC Map Alignment."; - m_compareRT2Maps = new HashMap(); + m_ionsRTBySourceMapId = new HashMap<>(); // Register in parameters ParameterList inParameter = new ParameterList(); inParameter.addParameter(DDataset.class); @@ -78,20 +83,21 @@ public DataboxMapAlignment() { // Register possible out parameters ParameterList outParameter = new ParameterList(); - + outParameter.addParameter(ExtendedTableModelInterface.class, ParameterSubtypeEnum.LIST_DATA); - outParameter.addParameter(CrossSelectionInterface.class, ParameterSubtypeEnum.LIST_DATA); - + registerOutParameter(outParameter); - m_RT_Tolerance = 0.0; - m_isCloudLoaded = false; m_isCloudTaskAsked = false; } - public double getRT_Tolerance() { - return m_RT_Tolerance; + public double getCrossAssignmentTimeTolerance() { + return m_crossAssignmentTimeTolerance; + } + + public double getFeatureAlignmentTimeTolerance() { + return m_featureAlignmentTimeTolerance; } /** @@ -100,9 +106,8 @@ public double getRT_Tolerance() { * m_previousDataBox.getData, his m_previousDataBox is this * DataboxMapAlignment used by DataboxMultiGraphics.dataChanged * - * @param getArray * @param parameterType - * @param isList + * @param parameterSubtype * @return */ @Override @@ -114,59 +119,53 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub if (parameterType.equals(ExtendedTableModelInterface.class)) { return getCompareDataInterfaceList(); } - if (parameterType.equals(CrossSelectionInterface.class)) { - return getCrossSelectionInterfaceList(); - } } } return super.getDataImpl(parameterType, parameterSubtype); } private List getCompareDataInterfaceList() { - List listCDI = new ArrayList(); - List listMapTimePanel = getMapTimeTableModelList(); - for (MapTimePanel mapTimePanel : listMapTimePanel) { - listCDI.add(mapTimePanel.getGlobalTableModelInterface()); - } - return listCDI; - } + List listCDI = new ArrayList<>(); - private List getCrossSelectionInterfaceList() { - List listCSI = new ArrayList(); - List listMapTimePanel = getMapTimeTableModelList(); - for (MapTimePanel mapTimePanel : listMapTimePanel) { - listCSI.add(mapTimePanel.getCrossSelectionInterface()); - } - return listCSI; - } + if(m_isMoZAlignment){ + for(ProcessedMap map : m_dataset.getMaps()) { + List allMozCalib = new ArrayList<>(map.getProcessedMapMozCalibration()); - /** - * get new MapAligments and create MapTimePanel for each MapAlignement - * - * @return - */ - private List getMapTimeTableModelList() { - //logger.debug(" getMapTimeTableModelList"); - List list = new ArrayList(); - for (MapAlignment mapAlignment : m_dataset.getMapAlignmentsFromMap(m_dataset.getAlnReferenceMapId())) {//only these from reference map - //for (MapAlignment mapAlignment : m_dataset.getMapAlignments()) {//all maps - List listMapTime = mapAlignment.getMapTimeList(); - MapTimePanel mapTimePanel = new MapTimePanel(); - String fromMap = m_quantChannelInfo.getMapTitle(mapAlignment.getSourceMap().getId()); - String toMap = m_quantChannelInfo.getMapTitle(mapAlignment.getDestinationMap().getId()); - String title = "Map Alignment from " + fromMap + " (to " + toMap + ")"; - Color color = m_quantChannelInfo.getMapColor(mapAlignment.getDestinationMap().getId()); - mapTimePanel.setData((long) -1, mapAlignment, listMapTime, color, title, true, fromMap); //set mapAlignemnt curve data with its AxisX - list.add(mapTimePanel); + String mapTitle = m_quantChannelInfo.getMapTitle(map.getId()); + String title = "MoZ calibration for "+ mapTitle; + + for (ProcessedMapMozCalibration mapMozAlignment : allMozCalib) { + Color color = m_quantChannelInfo.getMapColor(map.getId()); + MapTimeTableModel model = new MapTimeTableModel(mapMozAlignment.getProcessedMapMozList(), color, title, mapTitle); + listCDI.add(model); + } + } + } else { + for (MapAlignment mapAlignment : m_dataset.getMapAlignmentsFromMap(m_dataset.getAlnReferenceMapId())) { + String fromMap = m_quantChannelInfo.getMapTitle(mapAlignment.getSourceMap().getId()); + String toMap = m_quantChannelInfo.getMapTitle(mapAlignment.getDestinationMap().getId()); + String title = "Map Alignment from " + fromMap + " (to " + toMap + ")"; + Color color = m_quantChannelInfo.getMapColor(mapAlignment.getDestinationMap().getId()); + MapTimeTableModel model = new MapTimeTableModel(mapAlignment.getMapTimeList(), color, title, fromMap, toMap); //set mapAlignemnt curve data with its AxisX + listCDI.add(model); + } } - return list; + return listCDI; } + @Override public void createPanel() { - MapAlignmentPanel p = new MapAlignmentPanel(this); - p.setName(m_typeName); - setDataBoxPanelInterface(p); + if(m_isMoZAlignment){ + MapMozAlignmentPanel p = new MapMozAlignmentPanel(this); + p.setName(m_typeName); + setDataBoxPanelInterface(p); + + } else { + MapAlignmentPanel p = new MapAlignmentPanel(this); + p.setName(m_typeName); + setDataBoxPanelInterface(p); + } } @Override @@ -204,7 +203,10 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) // do nothing, if only de paramTask finished if (taskId != m_paramTaskId) { m_quantChannelInfo = new QuantChannelInfo(m_dataset); - ((MapAlignmentPanel) getDataBoxPanelInterface()).setData(m_quantChannelInfo, getCompareDataInterfaceList(), getCrossSelectionInterfaceList()); + if(m_isMoZAlignment) + ((MapMozAlignmentPanel) getDataBoxPanelInterface()).setData(m_quantChannelInfo, getCompareDataInterfaceList()); + else + ((MapAlignmentPanel) getDataBoxPanelInterface()).setData(m_quantChannelInfo, getCompareDataInterfaceList()); if (finished) { addDataChanged(ExtendedTableModelInterface.class, ParameterSubtypeEnum.LIST_DATA); @@ -233,11 +235,14 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) */ public void loadCloud() { - if (m_isCloudLoaded == true) { - ((MapAlignmentPanel) super.getDataBoxPanelInterface()).setAlignmentCloud(); + if (m_isCloudLoaded) { + if(m_isMoZAlignment) + ((MapMozAlignmentPanel) getDataBoxPanelInterface()).setAlignmentCloud(); + else + ((MapAlignmentPanel) getDataBoxPanelInterface()).setAlignmentCloud(); } else { //avoid multiple call when the cloud is not loaded - if (this.m_isCloudTaskAsked == true) { + if (this.m_isCloudTaskAsked) { return; } @@ -266,8 +271,11 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) //if all task loaded, then execute the first Alignement Cloud if (DataboxMapAlignment.this.isLoaded()) { m_isCloudLoaded = true; - m_RT_Tolerance = getTimeTol(); - ((MapAlignmentPanel) DataboxMapAlignment.this.getPanel()).setAlignmentCloud(); + extractTimeToleranceParameters(); + if(m_isMoZAlignment) + ((MapMozAlignmentPanel) getDataBoxPanelInterface()).setAlignmentCloud(); + else + ((MapAlignmentPanel) getDataBoxPanelInterface()).setAlignmentCloud(); } } } @@ -275,7 +283,7 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) }; - m_masterQuantPeptideIonList = new ArrayList(); + m_masterQuantPeptideIonList = new ArrayList<>(); DatabaseLoadXicMasterQuantTask taskPeptideCloud = new DatabaseLoadXicMasterQuantTask(callback); taskPeptideCloud.initLoadPeptideIons(this.getProjectId(), m_dataset, m_masterQuantPeptideIonList); m_logCloudStartTime = System.currentTimeMillis(); @@ -288,58 +296,68 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) /** * from the m_dataset, extact the RT tolerance * - * @return + * the cross assignment time tolerance */ - private double getTimeTol() { - Double time = AbstractLabelFreeMSParamsPanel.DEFAULT_CA_FEATMAP_RTTOL_VALUE; + private void extractTimeToleranceParameters() { + Double time; try { Map quantParams = this.m_dataset.getQuantProcessingConfigAsMap(); if (quantParams.containsKey("cross_assignment_config")) { Map crossAssignmentConfig = (Map) quantParams.get("cross_assignment_config"); Map ftMappingParams = (Map) crossAssignmentConfig.getOrDefault("ft_mapping_params", new HashMap<>()); time = Double.valueOf((String) ftMappingParams.get("time_tol")); - if (time == null) { - time = AbstractLabelFreeMSParamsPanel.DEFAULT_CA_FEATMAP_RTTOL_VALUE; + if (time != null) { + m_crossAssignmentTimeTolerance = time; } } + + if (quantParams.containsKey("alignment_config")) { + Map alignmentConfig = (Map) quantParams.get("alignment_config"); + if (alignmentConfig.containsKey("ft_mapping_method_params")) { + Map featureMappingConfig = (Map) alignmentConfig.get("ft_mapping_method_params"); + time = Double.valueOf((String) featureMappingConfig.get("time_tol")); + if (time != null) { + m_featureAlignmentTimeTolerance = time; + } + } + } + } catch (Exception ex) { - logger.error("error while get Tolerence RT Time " + ex); + logger.error("error while get cross assignment or alignment RT tolerance " + ex); } - return time; } /** - * create a TableModel for PlotScatt + * create a IonsRTTableModel representing ion's retention time and deltaTime from the + * source map to the other maps. * - * @param mapFrom - * @param mapTo + * @param mapIdFrom the source (from) Map id. */ public IonsRTTableModel getPeptideCloud(long mapIdFrom) { IonsRTTableModel listETI; - listETI = m_compareRT2Maps.get(mapIdFrom); + listETI = m_ionsRTBySourceMapId.get(mapIdFrom); if (listETI == null) { - listETI = createMapRTCompareTableModel(mapIdFrom); - m_compareRT2Maps.put(mapIdFrom, listETI); + listETI = createIonsRTTableModel(mapIdFrom); + m_ionsRTBySourceMapId.put(mapIdFrom, listETI); } return listETI; } - private IonsRTTableModel createMapRTCompareTableModel(long mapIdFrom) { - Map idNameMap = new HashMap<>(); // Map - Map idMap = new HashMap<>(); // Map + private IonsRTTableModel createIonsRTTableModel(long mapIdFrom) { + Map mapTitleByRsmId = new HashMap<>(); // Map + Map rsmIdByMapId = new HashMap<>(); // Map List processMapList = m_quantChannelInfo.getDataset().getMaps(); long[] rsmIdArray = new long[processMapList.size()]; int index = 1; for (ProcessedMap map : processMapList) { Long mapId = map.getId(); - String mapTitle = m_quantChannelInfo.getMapTitle(mapId); //by example F083069 - - Long rsmId = m_quantChannelInfo.getQuantChannelForMap(mapId).getId();//resultSummayId + String mapTitle = m_quantChannelInfo.getMapTitle(mapId); + Long rsmId = m_quantChannelInfo.getQuantChannelForMap(mapId).getId(); - idMap.put(mapId, rsmId); - idNameMap.put(rsmId, mapTitle); + rsmIdByMapId.put(mapId, rsmId); + mapTitleByRsmId.put(rsmId, mapTitle); if (mapId == mapIdFrom) { rsmIdArray[0] = rsmId; } else { @@ -348,8 +366,7 @@ private IonsRTTableModel createMapRTCompareTableModel(long mapIdFrom) { } } - IonsRTTableModel cloud = new IonsRTTableModel(m_masterQuantPeptideIonList, idMap, idNameMap, rsmIdArray); - return cloud; + return new IonsRTTableModel(m_masterQuantPeptideIonList, rsmIdByMapId, mapTitleByRsmId, rsmIdArray); } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxPSMOfMasterQuantPeptide.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxPSMOfMasterQuantPeptide.java index fedba989f..c075237ac 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxPSMOfMasterQuantPeptide.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxPSMOfMasterQuantPeptide.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicParentsPeptideIon.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicParentsPeptideIon.java index 69eebac65..9c679c6de 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicParentsPeptideIon.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicParentsPeptideIon.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -32,10 +32,10 @@ import fr.proline.studio.pattern.ParameterSubtypeEnum; import fr.proline.studio.rsmexplorer.gui.xic.QuantChannelInfo; import fr.proline.studio.rsmexplorer.gui.xic.XicParentPeptideIonPanel; + import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; /** @@ -56,7 +56,7 @@ public class DataboxXicParentsPeptideIon extends AbstractDataBox { //private boolean m_isXICMode = true; public DataboxXicParentsPeptideIon() { - super(AbstractDataBox.DataboxType.DataboxXicPeptideIon, AbstractDataBox.DataboxStyle.STYLE_XIC); + super(DataboxType.DataboxXicParentsPeptideIon, AbstractDataBox.DataboxStyle.STYLE_XIC); // Name of this databox m_typeName = "Source Quanti. Peptides Ions"; @@ -218,15 +218,7 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub } return pi.getBestPeptideMatch(); } - /*if (parameterType.equals(DDataset.class)) { - return m_dataset; - } - if (parameterType.equals(ExtendedTableModelInterface.class)) { - return ((GlobalTabelModelProviderInterface) getDataBoxPanelInterface()).getGlobalTableModelInterface(); - } - if (parameterType.equals(CrossSelectionInterface.class)) { - return ((GlobalTabelModelProviderInterface) getDataBoxPanelInterface()).getCrossSelectionInterface(); - }*/ + if (parameterType.equals(QuantChannelInfo.class)) { return ((XicParentPeptideIonPanel) getDataBoxPanelInterface()).getSelectedQuantChannelInfo(); } @@ -244,13 +236,12 @@ public String getFullName() { } @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {DMasterQuantPeptideIon.class, DPeptideMatch.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{DMasterQuantPeptideIon.class, DPeptideMatch.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DMasterQuantPeptideIon peptideIon = (DMasterQuantPeptideIon) getData(DMasterQuantPeptideIon.class); if (peptideIon != null) { DPeptideInstance peptideInstance = peptideIon.getPeptideInstance(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicPeptideIon.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicPeptideIon.java index b5e6bbbee..12d93af93 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicPeptideIon.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicPeptideIon.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -240,13 +240,13 @@ public String getFullName() { } @Override - public Class[] getImportantInParameterClass() { + public Class[] getDataboxNavigationOutParameterClasses() { Class[] classList = {DMasterQuantPeptideIon.class, DPeptideMatch.class}; return classList; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DMasterQuantPeptideIon peptideIon = (DMasterQuantPeptideIon) getData(DMasterQuantPeptideIon.class); if (peptideIon != null) { DPeptideInstance peptideInstance = peptideIon.getPeptideInstance(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicPeptideSet.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicPeptideSet.java index e0b85281c..448accf5f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicPeptideSet.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicPeptideSet.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -231,7 +231,7 @@ public void run(boolean success, final long taskId, SubTask subTask, boolean fin }; // ask asynchronous loading of data - m_masterQuantPeptideList = new ArrayList(); + m_masterQuantPeptideList = new ArrayList<>(); DatabaseLoadXicMasterQuantTask task = new DatabaseLoadXicMasterQuantTask(callback); if (allPeptides) { task.initLoadPeptides(getProjectId(), m_dataset, m_masterQuantPeptideList, isXICMode()); @@ -339,8 +339,8 @@ public Object getDataImpl(Class parameterType, ParameterSubtypeEnum parameterSub /** * Return potential extra data available for the corresponding parameter of class type - * @param c - * @return + * @param parameterType parameter class type + * @return potential extra data available for the corresponding parameter of class type */ @Override public Object getExtraData(Class parameterType) { @@ -385,13 +385,12 @@ private List getTableModelInterfaceList() { } @Override - public Class[] getImportantInParameterClass() { - Class[] classList = {DMasterQuantPeptide.class, DPeptideMatch.class}; - return classList; + public Class[] getDataboxNavigationOutParameterClasses() { + return new Class[]{DMasterQuantPeptide.class, DPeptideMatch.class}; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DMasterQuantPeptide mqp = (DMasterQuantPeptide) getData(DMasterQuantPeptide.class); if (mqp != null) { DPeptideInstance peptideInstance = mqp.getPeptideInstance(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicProteinSet.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicProteinSet.java index a174d157d..55359bfd6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicProteinSet.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/pattern/xic/DataboxXicProteinSet.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -21,11 +21,11 @@ import fr.proline.core.orm.msi.dto.DProteinMatch; import fr.proline.core.orm.msi.dto.DProteinSet; import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.dam.tasks.xic.DatabaseLoadLcMSTask; import fr.proline.studio.dam.tasks.xic.DatabaseLoadXicMasterQuantTask; +import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; +import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; import fr.proline.studio.graphics.CrossSelectionInterface; import fr.proline.studio.pattern.AbstractDataBox; import fr.proline.studio.pattern.ParameterList; @@ -34,12 +34,12 @@ import fr.proline.studio.rsmexplorer.gui.xic.QuantChannelInfo; import fr.proline.studio.rsmexplorer.gui.xic.XicProteinSetPanel; import fr.proline.studio.types.XicMode; -import java.util.ArrayList; -import java.util.List; -import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.ArrayList; +import java.util.List; + /** * * @author JM235353 @@ -162,7 +162,7 @@ public void run(boolean success, final long taskId, SubTask subTask, boolean fin }; // ask asynchronous loading of data - m_masterQuantProteinSetList = new ArrayList(); + m_masterQuantProteinSetList = new ArrayList<>(); DatabaseLoadXicMasterQuantTask task = new DatabaseLoadXicMasterQuantTask(callback); task.initLoadProteinSets(getProjectId(), m_dataset, m_masterQuantProteinSetList); //Long taskId = task.getId(); @@ -184,16 +184,11 @@ public void run(boolean success, final long taskId, SubTask subTask, boolean fin * @param dataType */ @Override - public void dataMustBeRecalculated(Long rsetId, Long rsmId, Class dataType, ArrayList modificationsList, int reason) { - if (m_dataset.getResultSetId() != rsetId) { - return; - } - if (m_dataset.getResultSummaryId() != rsmId) { + public void dataMustBeRecalculated(Long rsetId, Long rsmId, Class dataType, ArrayList modificationsList, byte reason) { + if(! ( isDataOfInterest(rsetId, rsmId, dataType) && dataType.equals(DMasterQuantProteinSet.class))) return; - } - if (dataType.equals(DMasterQuantProteinSet.class)) { - ((XicProteinSetPanel) getDataBoxPanelInterface()).dataModified(modificationsList, reason); - } + + ((XicProteinSetPanel) getDataBoxPanelInterface()).dataModified(modificationsList, reason); } @Override @@ -286,13 +281,13 @@ private ProteinQuantPanel getProteinQuantTableModelList() { } @Override - public Class[] getImportantInParameterClass() { + public Class[] getDataboxNavigationOutParameterClasses() { Class[] classList = {DMasterQuantProteinSet.class, DProteinSet.class}; return classList; } @Override - public String getImportantOutParameterValue() { + public String getDataboxNavigationDisplayValue() { DProteinSet p = (DProteinSet) getData(DProteinSet.class); if (p != null) { DProteinMatch pm = p.getTypicalProteinMatch(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/DataBoxViewerManager.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/DataBoxViewerManager.java index 0024f507c..a83b33850 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/DataBoxViewerManager.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/DataBoxViewerManager.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,9 +16,10 @@ */ package fr.proline.studio.rsmexplorer; -import java.util.ArrayList; -import java.util.Iterator; -import org.openide.windows.TopComponent; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dock.AbstractTopPanel; + +import java.util.*; /** * @@ -26,17 +27,57 @@ */ public class DataBoxViewerManager { - public static final int REASON_PEPTIDE_SUPPRESSED = 0; - public static final int REASON_PROTEINS_REFINED = 1; - - public static void loadedDataModified(long projectId, Long rsetId, Long rsmId, Class c, ArrayList modificationsList, int reason) { + public static final String MODIFIED_TITLE_SUFFIX ="***"; + + public enum REASON_MODIF{ + REASON_CHANGE_TITLE((byte)0, false), // special entry, can't be combined with other. To Change title + REASON_PEPTIDE_SUPPRESSED((byte) 1,true), + REASON_PROTEINS_REFINED((byte)2,false), + REASON_PTMCLUSTER_MERGED((byte)4, true), + REASON_PTMCLUSTER_MODIFIED((byte)8,true), + REASON_PTMDATASET_SAVED((byte)16, false); + + + private byte m_reasonValue; + private boolean m_shouldSave; + + REASON_MODIF(byte reasonValue, boolean shouldSave){ + m_reasonValue = reasonValue; + m_shouldSave = shouldSave; + } + + public byte getReasonValue(){ + return m_reasonValue; + } + + public static REASON_MODIF getReasonModifFor(byte value){ + REASON_MODIF[] allVals = REASON_MODIF.values(); + for (REASON_MODIF allVal : allVals) { + if ( allVal != REASON_CHANGE_TITLE && isReasonDefine(allVal, value)) + return allVal; + } + return null; + } + + public boolean shouldBeSaved(){ + return m_shouldSave; + } + + public static boolean isReasonDefine(REASON_MODIF reason, byte value){ + return ( (reason.getReasonValue() & value) == reason.getReasonValue()); + } + + } + + public static void loadedDataModified(long projectId, Long rsetId, Long rsmId, Class c, ArrayList modificationsList, byte reason) { - Iterator itTop = TopComponent.getRegistry().getOpened().iterator(); + Set tcs = WindowManager.getDefault().getMainWindow().getTopPanels(); + Iterator itTop = tcs.iterator(); while (itTop.hasNext()) { - TopComponent topComponent = itTop.next(); - if (topComponent instanceof DataBoxViewerTopComponent) { + AbstractTopPanel topComponent = itTop.next(); + if (topComponent instanceof DataBoxViewerTopPanel) { - DataBoxViewerTopComponent databoxViewerTP = ((DataBoxViewerTopComponent) topComponent); + DataBoxViewerTopPanel databoxViewerTP = ((DataBoxViewerTopPanel) topComponent); long pId = databoxViewerTP.getProjectId(); if (pId != projectId) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/DataBoxViewerTopComponent.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/DataBoxViewerTopPanel.java similarity index 57% rename from prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/DataBoxViewerTopComponent.java rename to prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/DataBoxViewerTopPanel.java index af5d87307..6bf032059 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/DataBoxViewerTopComponent.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/DataBoxViewerTopPanel.java @@ -1,177 +1,214 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer; - -import fr.proline.studio.gui.DefaultDialog; -import fr.proline.studio.gui.OptionDialog; -import fr.proline.studio.pattern.ParameterList; -import fr.proline.studio.pattern.ParameterSubtypeEnum; -import fr.proline.studio.pattern.WindowBox; -import fr.proline.studio.table.TableInfo; -import java.awt.Graphics; -import java.awt.GridLayout; -import java.awt.Image; -import java.awt.event.ActionEvent; -import java.util.ArrayList; -import java.util.List; -import javax.swing.AbstractAction; -import javax.swing.Action; -import org.openide.windows.TopComponent; -import org.openide.windows.WindowManager; - -/** - * TopComponent for a windox box with databoxes - * @author JM235353 - */ -public class DataBoxViewerTopComponent extends TopComponent { - - private WindowBox m_windowBox = null; - - /** - * Creates new form DataBoxViewerTopComponent - */ - public DataBoxViewerTopComponent(WindowBox windowBox) { - - m_windowBox = windowBox; - - // Add panel - setLayout(new GridLayout()); - add(windowBox.getPanel()); - - // Set Name - setName(windowBox.getName()); - - // Set Tooltip - setToolTipText(windowBox.getName()); - - } - - public WindowBox getWindowBox(){ - return m_windowBox; - } - - - public void retrieveTableModels(ArrayList list) { - m_windowBox.retrieveTableModels(list); - } - - @Override - public Action[] getActions() { - Action[] actions = super.getActions(); - - Action renameAction = new AbstractAction("Rename...") { - - @Override - public void actionPerformed(ActionEvent e) { - OptionDialog dialog = new OptionDialog(WindowManager.getDefault().getMainWindow(), "Rename", null, "New Name", OptionDialog.OptionDialogType.TEXTFIELD); - dialog.setText(getName()); - Object o = e.getSource(); - //dialog.setLocation(x, y); - dialog.setVisible(true); - String newName = null; - if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { - newName = dialog.getText(); - } - - if ((newName != null) && (newName.length() > 0)) { - setName(newName); - m_windowBox.getEntryBox().setUserName(newName); - } - } - - }; - - List actionList; - if (actions == null) { - actionList = new ArrayList<>(2); - actionList.add(renameAction); - } else { - actionList = new ArrayList<>(actions.length+2); - actionList.add(renameAction); - actionList.add(null); - for (Action a : actions) { - actionList.add(a); - } - } - - - return actionList.toArray(new Action[0]); - - } - - - @Override - protected void componentOpened() { - m_windowBox.windowOpened(); - } - - @Override - protected void componentClosed() { - m_windowBox.windowClosed(); - } - - @Override - public Image getIcon() { - return m_windowBox.getIcon(); - } - - - @Override - public int getPersistenceType() { - return PERSISTENCE_NEVER; - } - - @Override - public void paint(Graphics g) { - super.paint(g); - - // JPM.HACK : force the default size after the first display of the window - // I have not found another way to do it. - if (firstPaint) { - firstPaint = false; - - // size correctly the sub panels - m_windowBox.resetDefaultSize(); - } - } - private boolean firstPaint = true; - - - public ParameterList getInParameters(){ - return m_windowBox.getEntryBox().getInParameters(); - } - - public ParameterList getOutParameters(){ - return m_windowBox.getEntryBox().getOutParameters(); - } - - public Object getData(Class parameterType){ - return getData(parameterType, ParameterSubtypeEnum.SINGLE_DATA); - } - public Object getData(Class parameterType, ParameterSubtypeEnum parameterSubtype){ - return m_windowBox.getEntryBox().getData(parameterType, parameterSubtype); - } - - public long getProjectId(){ - return m_windowBox.getEntryBox().getProjectId(); - } - - public void loadedDataModified(Long rsetId, Long rsmId, Class c, ArrayList modificationsList, int reason) { - m_windowBox.getEntryBox().loadedDataModified(rsetId, rsmId, c, modificationsList, reason); - } - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.rsmexplorer; + +import fr.proline.studio.dock.AbstractTopPanel; +import fr.proline.studio.dock.TopPanelListener; +import fr.proline.studio.dock.container.DockComponent; +import fr.proline.studio.gui.DefaultDialog; +import fr.proline.studio.gui.OptionDialog; +import fr.proline.studio.pattern.ParameterList; +import fr.proline.studio.pattern.ParameterSubtypeEnum; +import fr.proline.studio.pattern.WindowBox; +import fr.proline.studio.table.TableInfo; +import fr.proline.studio.WindowManager; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.List; + +public class DataBoxViewerTopPanel extends AbstractTopPanel { + + private WindowBox m_windowBox; + + public DataBoxViewerTopPanel(WindowBox windowBox) { + + m_windowBox = windowBox; + + // Add panel + setLayout(new GridLayout()); + add(windowBox.getPanel()); + + // Set Name + setName(windowBox.getName()); + + // Set Tooltip + setToolTipText(windowBox.getName()); + + } + + + public WindowBox getWindowBox(){ + return m_windowBox; + } + + + public void retrieveTableModels(ArrayList list) { + m_windowBox.retrieveTableModels(list); + } + + @Override + public Action[] getActions(DockComponent component) { + Action[] actions = super.getActions(component); + + Action renameAction = new AbstractAction("Rename...") { + + @Override + public void actionPerformed(ActionEvent e) { + OptionDialog dialog = new OptionDialog(WindowManager.getDefault().getMainWindow(), "Rename", null, "New Name", OptionDialog.OptionDialogType.TEXTFIELD); + dialog.setText(getName()); + dialog.setVisible(true); + String newName = null; + if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { + newName = dialog.getText(); + } + + if ((newName != null) && (newName.length() > 0)) { + setName(newName); + component.setTitle(newName); + m_windowBox.getEntryBox().setUserName(newName); + } + } + + }; + + List actionList; + if (actions == null) { + actionList = new ArrayList<>(2); + actionList.add(renameAction); + } else { + actionList = new ArrayList<>(actions.length+2); + actionList.add(renameAction); + actionList.add(null); + for (Action a : actions) { + actionList.add(a); + } + } + + + return actionList.toArray(new Action[0]); + + } + + + @Override + protected void componentOpened() { + m_windowBox.windowOpened(); + } + + public boolean warnBeforeClosing(){ + return !m_windowBox.getEntryBox().isClosable(); + } + + public String getWarnClosingMessage(){ + return m_windowBox.getEntryBox().getClosingWarningMessage(); + } + + @Override + public void componentClosed() { + + m_windowBox.windowClosed(); + } + + @Override + public Image getIcon() { + return m_windowBox.getIcon(); + } + + + @Override + public void paint(Graphics g) { + super.paint(g); + + // JPM.HACK : force the default size after the first display of the window + // I have not found another way to do it. + if (firstPaint) { + firstPaint = false; + + // size correctly the sub panels + m_windowBox.resetDefaultSize(); + } + } + private boolean firstPaint = true; + + + public ParameterList getInParameters(){ + return m_windowBox.getEntryBox().getInParameters(); + } + + public ParameterList getOutParameters(){ + return m_windowBox.getEntryBox().getOutParameters(); + } + + public Object getData(Class parameterType){ + return getData(parameterType, ParameterSubtypeEnum.SINGLE_DATA); + } + public Object getData(Class parameterType, ParameterSubtypeEnum parameterSubtype){ + return m_windowBox.getEntryBox().getData(parameterType, parameterSubtype); + } + + public long getProjectId(){ + return m_windowBox.getEntryBox().getProjectId(); + } + + public void loadedDataModified(Long rsetId, Long rsmId, Class c, ArrayList modificationsList, byte reason) { + //Test if information is pertinent for thos view + if(m_windowBox.getEntryBox().isDataOfInterest(rsetId,rsmId, c )) { + + if(reason == DataBoxViewerManager.REASON_MODIF.REASON_CHANGE_TITLE.getReasonValue()){ + //VDS: modificationsList shound have 1 entry = new name. + String title = (String) modificationsList.get(0); + this.setName(title); + fireTopPanelPropertyChange(TopPanelListener.TITLE_PROPERTY); + } else { + DataBoxViewerManager.REASON_MODIF reasonModif = DataBoxViewerManager.REASON_MODIF.getReasonModifFor(reason); + if (reasonModif != null && reasonModif.shouldBeSaved()) { + //Set title as modified + String title = getName(); + if (!title.endsWith(DataBoxViewerManager.MODIFIED_TITLE_SUFFIX)) + title = title + " " + DataBoxViewerManager.MODIFIED_TITLE_SUFFIX; + this.setName(title); + fireTopPanelPropertyChange(TopPanelListener.TITLE_PROPERTY); + } else { //Warning should add hasSaved property ? + //remove title modified + String title = getName(); + if (title.endsWith(DataBoxViewerManager.MODIFIED_TITLE_SUFFIX)) + title = title.substring(0, title.lastIndexOf(DataBoxViewerManager.MODIFIED_TITLE_SUFFIX) - 1); + this.setName(title); + fireTopPanelPropertyChange(TopPanelListener.TITLE_PROPERTY); + } + m_windowBox.getEntryBox().loadedDataModified(rsetId, rsmId, c, modificationsList, reason); + } + } + repaint(); + } + + + + @Override + public String getTopPanelIdentifierKey() { + return null; + } + + @Override + public String getTitle() { + return getName(); + } +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MainFrame.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MainFrame.java new file mode 100644 index 000000000..ad4e0d81a --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MainFrame.java @@ -0,0 +1,541 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.rsmexplorer; + +import fr.proline.studio.JavaVersion; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dam.taskinfo.TaskInfoManager; +import fr.proline.studio.dock.AbstractDockFrame; +import fr.proline.studio.dock.AbstractTopPanel; +import fr.proline.studio.dock.container.*; +import fr.proline.studio.dock.gui.InfoLabel; +import fr.proline.studio.dpm.ServerConnectionManager; +import fr.proline.studio.dpm.task.util.JMSConnectionManager; +import fr.proline.studio.gui.DefaultDialog; +import fr.proline.studio.gui.InfoDialog; +import fr.proline.studio.rserver.RServerManager; +import fr.proline.studio.rsmexplorer.actions.*; +import fr.proline.studio.rsmexplorer.gui.ProjectExplorerPanel; +import fr.proline.studio.rsmexplorer.gui.dialog.ServerConnectionDialog; +import fr.proline.studio.utils.IconManager; + +import javax.swing.*; +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.util.ArrayList; +import java.util.HashSet; + +public class MainFrame extends AbstractDockFrame implements WindowListener { + + private static MainFrame m_singleton = null; + + private DockContainerRoot m_containerRoot = null; + private DocContainerMinimizeZone m_dockContainerMinimizeZone = null; + private DockContainerSplit m_mainContainerSplit = null; + + public static MainFrame getInstance() { + if (m_singleton == null) { + m_singleton = new MainFrame(); + } + return m_singleton; + } + + private MainFrame() { + super("Proline Studio "+ (JavaVersion.isMileStoneVersion() ? JavaVersion.getMilestoneProductVersion() : JavaVersion.getProductVersion()) ); + setSize(1000, 800); + + setIconImage(IconManager.getImage(IconManager.IconType.FRAME_ICON)); + + setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + + JMenuBar menuBar = createMenu(); + setJMenuBar(menuBar); + + // Root + m_containerRoot = new DockContainerRoot(); + + try { + + // left tab + DockContainerTab propertiesAreaTab = new DockContainerTab(); + propertiesAreaTab.setZoneArea("PROPERTIES_AREA"); + + DockComponent propertiesComponent = new DockComponent(RSMExplorerTopPanel.getSingleton(), DockComponent.PROP_MINIMIZE); + propertiesAreaTab.add(propertiesComponent); + + DockComponent mzdbComponent = new DockComponent(MzdbFilesTopPanel.getSingleton(), DockComponent.PROP_MINIMIZE); + propertiesAreaTab.add(mzdbComponent); + + propertiesComponent.toFront(); + + // left tab put in container which accepts minimized containers + m_dockContainerMinimizeZone = new DocContainerMinimizeZone(); + m_dockContainerMinimizeZone.set(propertiesAreaTab); + + + // right tab + DockContainerTab windowAreaTab = new DockContainerTab(); + windowAreaTab.setZoneArea("WINDOWS_AREA"); + + DockComponent logComponent = new DockComponent(TaskLogTopPanel.getSingleton(), DockComponent.PROP_CLOSE); + windowAreaTab.add(logComponent); + + + // Split pane + m_mainContainerSplit = new DockContainerSplit(); + m_mainContainerSplit.add(true, m_dockContainerMinimizeZone, windowAreaTab); + m_mainContainerSplit.setCanRemoveChildren(false); + + // add right tab to root + m_containerRoot.add(m_mainContainerSplit, new DockPosition(DockPosition.CENTER)); + + // -- Divider Location + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + ((JSplitPane) m_mainContainerSplit.getComponent()).setDividerLocation(300); + } + }); + + } catch (DockException e) { + // should not happen + System.err.println(e.getMessage()); + } + + getContentPane().add(m_containerRoot.getMainPanel()); + + + m_containerRoot.getMemoryPanel().setActionListener(new MemoryAction()); + + addWindowListener(this); + + + WindowManager.getDefault().setMainWindow(this); + + + } + + public void alert(InfoLabel.INFO_LEVEL level, String message, Throwable t) { + m_containerRoot.getInfoLabel().setInfo(level, message, t); + } + public void alert(InfoLabel.INFO_LEVEL level, Throwable t) { + m_containerRoot.getInfoLabel().setInfo(level, t); + } + + + public void addLog() { + DockComponent logComponent = new DockComponent(TaskLogTopPanel.getSingleton(), DockComponent.PROP_CLOSE); + DockContainerTab windowAreaTab = (DockContainerTab) m_mainContainerSplit.searchZoneArea("WINDOWS_AREA"); + windowAreaTab.add(logComponent); + } + + + private JMenuBar createMenu() { + JMenuBar menuBar = new JMenuBar(); + + // FILE + JMenu fileMenu = new JMenu("File"); + fileMenu.setMnemonic(KeyEvent.VK_F); + menuBar.add(fileMenu); + + // FILE > Admin + JMenuItem menuItem = new JMenuItem(new AdminAction()); + menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.ALT_MASK)); + fileMenu.add(menuItem); + + // FILE > Connect... + menuItem = new JMenuItem(ConnectAction.getAction()); + fileMenu.add(menuItem); + + // FILE > Change Password + menuItem = new JMenuItem(new ChangePasswordAction()); + fileMenu.add(menuItem); + + // FILE > General Settings + menuItem = new JMenuItem(new SettingsAction()); + fileMenu.add(menuItem); + + + // ------------------- + fileMenu.addSeparator(); + + // FILE > Exit + menuItem = new JMenuItem(new ExitAction()); + fileMenu.add(menuItem); + + // --------------------------------------------------------------- + + // WINDOW + JMenu windowMenu = new JMenu("Window"); + windowMenu.setMnemonic(KeyEvent.VK_W); + menuBar.add(windowMenu); + + // WINDOW > Projects + menuItem = new JMenuItem(new DisplayWindow("Projects", RSMExplorerTopPanel.getSingleton())); + windowMenu.add(menuItem); + + // WINDOW > Ms Files + menuItem = new JMenuItem(new DisplayWindow("Ms Files", MzdbFilesTopPanel.getSingleton())); + windowMenu.add(menuItem); + + // WINDOW > Projects + menuItem = new JMenuItem(new DisplayWindow("Logs", TaskLogTopPanel.getSingleton())); + windowMenu.add(menuItem); + + // Window > Data Analyzer + menuItem = new JMenuItem(new DataAnalyzerAction()); + windowMenu.add(menuItem); + + // ------------------- + windowMenu.addSeparator(); + + // Window > Memory Usage + menuItem = new JMenuItem(new MemoryAction()); + windowMenu.add(menuItem); + + // ------------------- + windowMenu.addSeparator(); + + // Window > Reset Windows + menuItem = new JMenuItem(new ResetWindowsAction()); + windowMenu.add(menuItem); + + // Window > Close All Proteomics Data + menuItem = new JMenuItem(new CloseAllDataWindows()); + windowMenu.add(menuItem); + + + + // --------------------------------------------------------------- + + // HELP + JMenu helpMenu = new JMenu("Help"); + menuBar.add(helpMenu); + + // Help > Getting Started + menuItem = new JMenuItem(new HelpAction()); + helpMenu.add(menuItem); + + // Help > How to + menuItem = new JMenuItem(new HelpHowToAction()); + helpMenu.add(menuItem); + + // Help > Proline Help + menuItem = new JMenuItem(new HelpProlineAction()); + helpMenu.add(menuItem); + + + // ------------------- + helpMenu.addSeparator(); + + // Help > Proline Help + menuItem = new JMenuItem(new AboutAction()); + helpMenu.add(menuItem); + + + + + return menuBar; + + } + + @Override + public void closeWindow(AbstractTopPanel topPanel) { + DockContainer container = m_containerRoot.search(topPanel.getTopPanelIdentifierKey()); + if (container != null) { + ((DockContainerTab) ((DockComponent) container).getParent()).remove(container); + } + } + + @Override + public void displayWindow(AbstractTopPanel topPanel) { + DockContainer searchedContainer = m_containerRoot.search(topPanel.getTopPanelIdentifierKey()); + if (searchedContainer != null) { + if (((DockComponent)searchedContainer).canMinimize()) { + ((DockComponent) searchedContainer).maximize(); + } else { + searchedContainer.toFront(); + } + + } else { + + DockContainerTab windowAreaTab = (DockContainerTab) m_mainContainerSplit.searchZoneArea("WINDOWS_AREA"); + + + // container not found, we must create it + + DockComponent component = new DockComponent(topPanel, DockComponent.PROP_CLOSE); + windowAreaTab.add(component); + } + } + + @Override + public void resetWindows() { + + // WINDOWS AREA + + DockContainer windowsArea = m_mainContainerSplit.getRightContainer(); + // is logs opened ? + boolean logsFound = windowsArea.search(TaskLogTopPanel.getSingleton().getTopPanelIdentifierKey()) != null; + + // remove all components + ArrayList componentsList = new ArrayList<>(); + windowsArea.findAllDockComponents(componentsList); + for (DockComponent c : componentsList) { + ((DockContainerTab) c.getParent()).remove(c); + } + + // add logs if necessary + if (! logsFound) { + MainFrame f = (MainFrame) WindowManager.getDefault().getMainWindow(); + f.displayWindow(TaskLogTopPanel.getSingleton()); + } + + // put back all removed components + DockContainerTab windowAreaTab = (DockContainerTab) m_mainContainerSplit.searchZoneArea("WINDOWS_AREA"); + for (DockComponent c : componentsList) { + windowAreaTab.add(c); + } + + componentsList.clear(); + + // PROPERTIES AREA + + m_dockContainerMinimizeZone.findAllDockComponents(componentsList); + + // maximize all components + for (DockComponent c : componentsList) { + c.maximize(); + } + + // remove all components + for (DockComponent c : componentsList) { + ((DockContainerTab) c.getParent()).remove(c); + } + + // put back all components + DockContainerTab propertiesAreaTab = (DockContainerTab) m_mainContainerSplit.searchZoneArea("PROPERTIES_AREA"); + for (DockComponent c : componentsList) { + propertiesAreaTab.add(c); + } + + + // put Projects to front + DockContainer propertiesArea = m_mainContainerSplit.getLeftContainer(); + DockContainer projectsContainer = propertiesArea.search(RSMExplorerTopPanel.getSingleton().getTopPanelIdentifierKey()); + projectsContainer.toFront(); + + // -- Divider Location + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + ((JSplitPane) m_mainContainerSplit.getComponent()).setDividerLocation(300); + } + }); + + + } + + @Override + public void closeDataWindows() { + + + DockContainer windowsArea = m_mainContainerSplit.getRightContainer(); + + // logs will not be closed + DockContainer logContainer = windowsArea.search(TaskLogTopPanel.getSingleton().getTopPanelIdentifierKey()); + + + + // remove all components + ArrayList componentsList = new ArrayList<>(); + windowsArea.findAllDockComponents(componentsList); + for (DockComponent c : componentsList) { + if ((logContainer != null) && (logContainer.equals(c))) { + continue; + } + ((DockContainerTab) c.getParent()).remove(c); + + if (c.getComponent() instanceof AbstractTopPanel) { + ((AbstractTopPanel) c.getComponent()).componentClosed(); + } + + } + + } + + @Override + public boolean isDisplayed(String windowKey) { + DockContainer searchedContainer = m_containerRoot.search(windowKey); + return (searchedContainer != null); + } + + @Override + public void toFront(String windowKey) { + DockContainer searchedContainer = m_containerRoot.search(windowKey); + if (searchedContainer != null) { + searchedContainer.toFront(); + } + } + + @Override + public HashSet getTopPanels() { + HashSet set = new HashSet<>(); + m_containerRoot.getTopPanels(set); + + return set; + } + + + + + public void exit() { + + // check if there is tasks being done which ask not to close the application + if (TaskInfoManager.getTaskInfoManager().askBeforeExitingApp()) { + InfoDialog exitDialog = new InfoDialog(WindowManager.getDefault().getMainWindow(), InfoDialog.InfoType.WARNING, "Warning", "You should not exit. Important tasks are being done.\nAre you sure you want to exit ?"); + exitDialog.setButtonName(DefaultDialog.BUTTON_OK, "Yes"); + exitDialog.setButtonName(DefaultDialog.BUTTON_CANCEL, "No"); + exitDialog.centerToWindow(WindowManager.getDefault().getMainWindow()); + exitDialog.setVisible(true); + + if (exitDialog.getButtonClicked() == DefaultDialog.BUTTON_CANCEL) { + // No clicked + return; + } + + } + + // check if action are to be done on some windows ... + HashSet topPanels = getTopPanels(); + for(AbstractTopPanel topPanel : topPanels ){ + if(topPanel.warnBeforeClosing()) { + InfoDialog exitDialog = new InfoDialog(WindowManager.getDefault().getMainWindow(), InfoDialog.InfoType.WARNING, "Warning", "You should not exit. A window need an action : "+topPanel.getWarnClosingMessage()+"\nAre you sure you want to exit ?"); + exitDialog.setButtonName(DefaultDialog.BUTTON_OK, "Yes"); + exitDialog.setButtonName(DefaultDialog.BUTTON_CANCEL, "No"); + exitDialog.centerToWindow(WindowManager.getDefault().getMainWindow()); + exitDialog.setVisible(true); + if (exitDialog.getButtonClicked() == DefaultDialog.BUTTON_CANCEL) { + // No clicked + return; + } + } + } + + // Close connection to R Server and kill it if needed + RServerManager.getRServerManager().stopRProcess(); + + //Close connection to JMS Server if needed + JMSConnectionManager.getJMSConnectionManager().closeConnection(); + + + System.exit(0); + } + + @Override + public void windowOpened(WindowEvent e) { + + + Thread t = new Thread() { + @Override + public void run() { + + ServerConnectionManager serverConnectionMgr = ServerConnectionManager.getServerConnectionManager(); + while (serverConnectionMgr.isConnectionAsked()) { + // wait for the connection to have succedeed or failed + try { + Thread.sleep(100); // JPM.TODO : one day remove the polling and write blocking code instead + } catch (InterruptedException ex) { + } + } + + if ((serverConnectionMgr.isNotConnected()) || (serverConnectionMgr.isConnectionFailed())) { + // the user need to enter connection parameters + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + ServerConnectionDialog serverConnectionDialog = ServerConnectionDialog.getDialog(WindowManager.getDefault().getMainWindow()); + serverConnectionDialog.centerToScreen(); + //databaseConnectionDialog.centerToFrame(WindowManager.getDefault().getMainWindow()); // does not work : main window has not its size most of the time at this point + serverConnectionDialog.setVisible(true); + + ServerConnectionManager serciceConnectionMgr = ServerConnectionManager.getServerConnectionManager(); + if (serciceConnectionMgr.isConnectionDone()) { + ProjectExplorerPanel.getProjectExplorerPanel().startLoadingProjects(); + //RSMTree.getTree().startLoading(); + } + } + }); + + } else if (serverConnectionMgr.isConnectionDone()) { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + ProjectExplorerPanel.getProjectExplorerPanel().startLoadingProjects(); + //RSMTree.getTree().startLoading(); + } + }); + } + + } + }; + t.start(); + + + // check if the connection to the UDS is done + + } + + @Override + public void windowClosing(WindowEvent e) { + + exit(); + + } + + @Override + public void windowClosed(WindowEvent e) { + + } + + @Override + public void windowIconified(WindowEvent e) { + + } + + @Override + public void windowDeiconified(WindowEvent e) { + + } + + @Override + public void windowActivated(WindowEvent e) { + + } + + @Override + public void windowDeactivated(WindowEvent e) { + + } + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MultiDataBoxViewerTopComponent.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MultiDataBoxViewerTopPanel.java similarity index 66% rename from prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MultiDataBoxViewerTopComponent.java rename to prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MultiDataBoxViewerTopPanel.java index 5b51468d6..bcb6e4bf1 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MultiDataBoxViewerTopComponent.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MultiDataBoxViewerTopPanel.java @@ -1,9 +1,9 @@ -/* - * Copyright (C) 2019 VD225637 +/* + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 + * ; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -11,31 +11,26 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * CeCILL License V2.1 for more details. * - * You should have received a copy of the CeCILL License + * You should have received a copy of the CeCILL License * along with this program; If not, see . */ + package fr.proline.studio.rsmexplorer; -import fr.proline.studio.pattern.DataParameter; + import fr.proline.studio.pattern.ParameterList; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.table.TableInfo; -import java.awt.GridLayout; + +import javax.swing.*; +import java.awt.*; import java.util.ArrayList; -import java.util.HashSet; -import javax.swing.ImageIcon; -import javax.swing.JPanel; -import javax.swing.JTabbedPane; -/** - * - * @author VD225637 - */ -public class MultiDataBoxViewerTopComponent extends DataBoxViewerTopComponent { +public class MultiDataBoxViewerTopPanel extends DataBoxViewerTopPanel { private WindowBox[] m_windowBoxes = null; - public MultiDataBoxViewerTopComponent(WindowBox[] windowBoxes, String name) { + public MultiDataBoxViewerTopPanel(WindowBox[] windowBoxes, String name) { super(windowBoxes[0]); m_windowBoxes = windowBoxes; removeAll(); @@ -44,17 +39,18 @@ public MultiDataBoxViewerTopComponent(WindowBox[] windowBoxes, String name) { setName(name); } + private JPanel createPanel() { JPanel internalPanel = new JPanel(new GridLayout()); - JTabbedPane tabbedPane = new JTabbedPane(); + JTabbedPane tabbedPane = new JTabbedPane(); for (WindowBox wBox : m_windowBoxes) { ImageIcon boxIcon = null; if(wBox.getIcon() != null) boxIcon = new ImageIcon(wBox.getIcon()); tabbedPane.addTab(wBox.getName(), boxIcon, wBox.getPanel(), null); } - + internalPanel.add(tabbedPane); return internalPanel; @@ -67,15 +63,21 @@ public void retrieveTableModels(ArrayList list) { } } + + @Override - protected void componentOpened() { + public void componentOpened() { + super.componentOpened(); + for (WindowBox wBox : m_windowBoxes) { wBox.windowOpened(); } } @Override - protected void componentClosed() { + public void componentClosed() { + super.componentClosed(); + for (WindowBox wBox : m_windowBoxes) { wBox.windowClosed(); } @@ -84,21 +86,23 @@ protected void componentClosed() { @Override public ParameterList getInParameters(){ ParameterList inParameters = new ParameterList(); - for (WindowBox wBox : m_windowBoxes) { - ParameterList windowInParameters = wBox.getEntryBox().getInParameters(); - inParameters.addParameter(windowInParameters); + for (WindowBox wBox : m_windowBoxes) { + ParameterList windowInParameters = wBox.getEntryBox().getInParameters(); + inParameters.addParameter(windowInParameters); } return inParameters; } - + @Override public ParameterList getOutParameters(){ ParameterList outParameters = new ParameterList(); - for (WindowBox wBox : m_windowBoxes) { - ParameterList windowOutParameters = wBox.getEntryBox().getOutParameters(); - outParameters.addParameter(windowOutParameters); + for (WindowBox wBox : m_windowBoxes) { + ParameterList windowOutParameters = wBox.getEntryBox().getOutParameters(); + outParameters.addParameter(windowOutParameters); } - return outParameters; + return outParameters; } + + } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MzdbFilesTopComponent.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MzdbFilesTopComponent.java deleted file mode 100644 index 96bafee89..000000000 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MzdbFilesTopComponent.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer; - -import fr.proline.studio.dpm.ServerConnectionManager; -import fr.proline.studio.msfiles.MsFilesExplorer; -import fr.proline.studio.msfiles.WorkingSetView; -import fr.proline.studio.rsmexplorer.gui.TreeUtils; -import java.awt.BorderLayout; -import javax.swing.JTabbedPane; - -import org.netbeans.api.settings.ConvertAsProperties; -import org.openide.awt.ActionID; -import org.openide.awt.ActionReference; - -import org.openide.windows.TopComponent; -import org.openide.util.NbBundle.Messages; - -/** - * Top component to dispay the mzdb Files Panel - */ -@ConvertAsProperties(dtd = "-//fr.proline.studio.rsmexplorer//MzdbFiles//EN", - autostore = false) -@TopComponent.Description(preferredID = "MzdbFilesTopComponent", - //iconBase="SET/PATH/TO/ICON/HERE", - persistenceType = TopComponent.PERSISTENCE_ALWAYS) -@TopComponent.Registration(mode = "explorer", openAtStartup = true, position = 2) -@ActionID(category = "Window", id = "fr.proline.studio.rsmexplorer.MzdbFilesTopComponent") -@ActionReference(path = "Menu/Window", position = 20 -) -@TopComponent.OpenActionRegistration(displayName = "#CTL_MzdbFilesAction", - preferredID = "MzdbFilesTopComponent") -@Messages({ - "CTL_MzdbFilesAction=Ms Files", - "CTL_MzdbFilesTopComponent=Ms Files", - "HINT_MzdbFilesTopComponent=Ms Files" -}) -public final class MzdbFilesTopComponent extends TopComponent { - - private static MsFilesExplorer m_explorer; - private JTabbedPane m_tabbedPane; - - public MzdbFilesTopComponent() { - initComponents(); - setName(Bundle.CTL_MzdbFilesTopComponent()); - setToolTipText(Bundle.HINT_MzdbFilesTopComponent()); - - } - - private void initComponents() { - - setLayout(new BorderLayout()); - m_tabbedPane = new JTabbedPane(); - - m_explorer = new MsFilesExplorer(); - m_tabbedPane.add("Explorer", m_explorer); - - m_tabbedPane.add("Working Sets", WorkingSetView.getWorkingSetView()); - add(m_tabbedPane, BorderLayout.CENTER); - - if (!ServerConnectionManager.getServerConnectionManager().isNotConnected()) { - m_explorer.getTreeFileChooserPanel().initTree(); - m_explorer.getTreeFileChooserPanel().restoreTree(TreeUtils.TreeType.SERVER); - } - - } - - public static MsFilesExplorer getExplorer() { - return m_explorer; - } - - @Override - public void componentOpened() { - - } - - @Override - public void componentClosed() { - // TODO add custom code on component closing - } - - void writeProperties(java.util.Properties p) { - // better to version settings since initial version as advocated at - // http://wiki.apidesign.org/wiki/PropertyFiles - p.setProperty("version", "1.0"); - // TODO store your settings - } - - void readProperties(java.util.Properties p) { - String version = p.getProperty("version"); - // TODO read your settings according to their version - } - -} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MzdbFilesTopPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MzdbFilesTopPanel.java new file mode 100644 index 000000000..24f5a8328 --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/MzdbFilesTopPanel.java @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.rsmexplorer; + +import fr.proline.studio.dock.AbstractTopPanel; +import fr.proline.studio.dpm.ServerConnectionManager; +import fr.proline.studio.msfiles.MsFilesExplorer; +import fr.proline.studio.msfiles.WorkingSetView; +import fr.proline.studio.rsmexplorer.gui.TreeUtils; + +import javax.swing.*; +import java.awt.*; + +public class MzdbFilesTopPanel extends AbstractTopPanel { + + private static MsFilesExplorer m_explorer; + private JTabbedPane m_tabbedPane; + + private static MzdbFilesTopPanel m_singleton = null; + + public MzdbFilesTopPanel() { + + initComponents(); + setName("Ms Files"); + setToolTipText("Ms Files"); + } + + + public static MzdbFilesTopPanel getSingleton() { + if (m_singleton == null) { + m_singleton = new MzdbFilesTopPanel(); + } + + return m_singleton; + } + + + + private void initComponents() { + + setLayout(new BorderLayout()); + m_tabbedPane = new JTabbedPane(); + + m_explorer = new MsFilesExplorer(); + m_tabbedPane.add("Explorer", m_explorer); + + m_tabbedPane.add("Working Sets", WorkingSetView.getWorkingSetView()); + add(m_tabbedPane, BorderLayout.CENTER); + + if (!ServerConnectionManager.getServerConnectionManager().isNotConnected()) { + m_explorer.getTreeFileChooserPanel().initTree(); + m_explorer.getTreeFileChooserPanel().restoreTree(TreeUtils.TreeType.SERVER); + } + + } + + public static MsFilesExplorer getExplorer() { + return m_explorer; + } + + @Override + public String getTopPanelIdentifierKey() { + return "MZDB_FILES_TOP_PANEL"; + } + + @Override + public Image getIcon() { + return null; + } + + @Override + public String getTitle() { + return getName(); + } + + @Override + protected void componentOpened() { + // nothing to do + } + + @Override + public void componentClosed() { + // nothing to do + } + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/PropertiesTopComponent.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/PropertiesTopComponent.java deleted file mode 100644 index 364dd990c..000000000 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/PropertiesTopComponent.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer; - -import fr.proline.studio.gui.HourglassPanel; -import fr.proline.studio.rsmexplorer.tree.PropertiesWrapperNode; -import fr.proline.studio.utils.PropertiesProviderInterface; -import java.awt.BorderLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import org.openide.explorer.propertysheet.PropertySheet; -import org.openide.windows.TopComponent; - -/** - * Top Component to display properties - * @author JM235353 - */ -public class PropertiesTopComponent extends TopComponent { - - private HourglassPanel m_hourglassPanel = null; - private PropertySheet m_propertySheet = null; - - public PropertiesTopComponent(String name) { - - setName(name); - - m_propertySheet = new PropertySheet(); - - m_hourglassPanel = new HourglassPanel(); - m_hourglassPanel.setLoading(1); - m_hourglassPanel.setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - c.gridx = 0; - c.gridy = 0; - c.weightx = 1.0; - c.weighty = 1.0; - m_hourglassPanel.add(m_propertySheet, c); - - - - setLayout (new BorderLayout ()); - add(m_hourglassPanel, BorderLayout.CENTER); - } - - public void setProperties(PropertiesProviderInterface[] propertiesProviders) { - - int nbProp = propertiesProviders.length; - - PropertiesWrapperNode[] wrappedNodes = new PropertiesWrapperNode[nbProp]; - for (int i=0;i. - */ -package fr.proline.studio.rsmexplorer; - - - -import fr.proline.studio.dpm.ServerConnectionManager; -import fr.proline.studio.rsmexplorer.gui.ProjectExplorerPanel; -import fr.proline.studio.rsmexplorer.gui.dialog.ServerConnectionDialog; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import javax.swing.SwingUtilities; - -import org.netbeans.api.settings.ConvertAsProperties; -import org.openide.awt.ActionID; -import org.openide.awt.ActionReference; - -import org.openide.windows.TopComponent; -import org.openide.util.NbBundle.Messages; -import org.openide.windows.WindowManager; - - -/** - * Top component to dispay the RSM Tree. - */ -@ConvertAsProperties(dtd = "-//fr.proline.studio.rsmexplorer//RSMExplorer//EN", -autostore = false) -@TopComponent.Description(preferredID = "RSMExplorerTopComponent", -//iconBase="SET/PATH/TO/ICON/HERE", -persistenceType = TopComponent.PERSISTENCE_ALWAYS) -@TopComponent.Registration(mode = "explorer", openAtStartup = true, position=1) -@ActionID(category = "Window", id = "fr.proline.studio.rsmexplorer.RSMExplorerTopComponent") -@ActionReference(path = "Menu/Window" - , position = 10 - ) -@TopComponent.OpenActionRegistration(displayName = "#CTL_RSMExplorerAction", -preferredID = "RSMExplorerTopComponent") -@Messages({ - "CTL_RSMExplorerAction=Projects", - "CTL_RSMExplorerTopComponent=Projects", - "HINT_RSMExplorerTopComponent=Projects" -}) -public final class RSMExplorerTopComponent extends TopComponent { - - - public RSMExplorerTopComponent() { - initComponents(); - setName(Bundle.CTL_RSMExplorerTopComponent()); - setToolTipText(Bundle.HINT_RSMExplorerTopComponent()); - - } - - - - private void initComponents() { - - // Add panel - setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - add(ProjectExplorerPanel.getProjectExplorerPanel(), c); - } - - - @Override - public void componentOpened() { - - Thread t = new Thread() { - @Override - public void run() { - - ServerConnectionManager serverConnectionMgr = ServerConnectionManager.getServerConnectionManager(); - while (serverConnectionMgr.isConnectionAsked()) { - // wait for the connection to have succedeed or failed - try { - Thread.sleep(100); // JPM.TODO : one day remove the polling and write blocking code instead - } catch (InterruptedException ex) { - } - } - - if ((serverConnectionMgr.isNotConnected()) || (serverConnectionMgr.isConnectionFailed())) { - // the user need to enter connection parameters - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - ServerConnectionDialog serverConnectionDialog = ServerConnectionDialog.getDialog(WindowManager.getDefault().getMainWindow()); - serverConnectionDialog.centerToScreen(); - //databaseConnectionDialog.centerToFrame(WindowManager.getDefault().getMainWindow()); // does not work : main window has not its size most of the time at this point - serverConnectionDialog.setVisible(true); - - ServerConnectionManager serciceConnectionMgr = ServerConnectionManager.getServerConnectionManager(); - if (serciceConnectionMgr.isConnectionDone()) { - ProjectExplorerPanel.getProjectExplorerPanel().startLoadingProjects(); - //RSMTree.getTree().startLoading(); - } - } - }); - - } else if (serverConnectionMgr.isConnectionDone()) { - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - ProjectExplorerPanel.getProjectExplorerPanel().startLoadingProjects(); - //RSMTree.getTree().startLoading(); - } - }); - } - - } - }; - t.start(); - - - // check if the connection to the UDS is done - - - } - - @Override - public void componentClosed() { - // TODO add custom code on component closing - } - - void writeProperties(java.util.Properties p) { - // better to version settings since initial version as advocated at - // http://wiki.apidesign.org/wiki/PropertyFiles - p.setProperty("version", "1.0"); - // TODO store your settings - } - - void readProperties(java.util.Properties p) { - String version = p.getProperty("version"); - // TODO read your settings according to their version - } - - - - - - - -} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/RSMExplorerTopPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/RSMExplorerTopPanel.java new file mode 100644 index 000000000..47833d95b --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/RSMExplorerTopPanel.java @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.rsmexplorer; + +import fr.proline.studio.dock.AbstractTopPanel; +import fr.proline.studio.rsmexplorer.gui.ProjectExplorerPanel; + +import javax.swing.*; +import java.awt.*; + +public class RSMExplorerTopPanel extends AbstractTopPanel { + + private static RSMExplorerTopPanel m_singleton = null; + + private RSMExplorerTopPanel() { + initComponents(); + setName("Projects"); + setToolTipText("Projects"); + + } + + public static RSMExplorerTopPanel getSingleton() { + if (m_singleton == null) { + m_singleton = new RSMExplorerTopPanel(); + } + + return m_singleton; + } + + + private void initComponents() { + + // Add panel + setLayout(new GridBagLayout()); + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.insets = new java.awt.Insets(5, 5, 5, 5); + + c.gridx = 0; + c.gridy = 0; + c.weightx = 1; + c.weighty = 1; + add(ProjectExplorerPanel.getProjectExplorerPanel(), c); + } + + @Override + public String getTopPanelIdentifierKey() { + return "PROJECTS_TOP_PANEL"; + } + + @Override + public Image getIcon() { + return null; + } + + @Override + public String getTitle() { + return getName(); + } + + @Override + public void componentOpened() { + // nothing to do + } + + @Override + public void componentClosed() { + // nothing to do + } +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/SplashScreenWindow.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/SplashScreenWindow.java new file mode 100644 index 000000000..f8f31c968 --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/SplashScreenWindow.java @@ -0,0 +1,32 @@ +package fr.proline.studio.rsmexplorer; + +import fr.proline.studio.utils.IconManager; + +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; + +public class SplashScreenWindow extends JWindow { + + private Image m_image = null; + + public SplashScreenWindow() { + super(); + + m_image = IconManager.getImage(IconManager.IconType.SPLASH); + + int width = m_image.getWidth(null); + int height = m_image.getHeight(null); + setSize(new Dimension(width, height)); + + setLocationRelativeTo(null); + setAlwaysOnTop(true); + + + } + + public void paint(Graphics g){ + + g.drawImage(m_image,0,0,null); + } +} \ No newline at end of file diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/TaskLogTopComponent.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/TaskLogTopComponent.java deleted file mode 100644 index 3f1509900..000000000 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/TaskLogTopComponent.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer; - -import fr.proline.studio.pattern.WindowBoxFactory; -import org.netbeans.api.settings.ConvertAsProperties; -import org.openide.awt.ActionID; -import org.openide.awt.ActionReference; -import org.openide.util.NbBundle; -import org.openide.windows.TopComponent; - -/** - * Top Component for logs of tasks and services - * @author JM235353 - */ - -@ConvertAsProperties(dtd = "-//fr.proline.studio.rsmexplorer//TaskLog//EN", -autostore = false) -@TopComponent.Description(preferredID = "TaskLogTopComponent", -//iconBase="SET/PATH/TO/ICON/HERE", -persistenceType = TopComponent.PERSISTENCE_ALWAYS) -@TopComponent.Registration(mode = "editor", openAtStartup = true) -@ActionID(category = "Window", id = "fr.proline.studio.rsmexplorer.TaskLogTopComponent") -@ActionReference(path = "Menu/Window" /* - * , position = 333 - */) -@TopComponent.OpenActionRegistration(displayName = "#CTL_TaskLogAction", -preferredID = "TaskLogTopComponent") -@NbBundle.Messages({ - "CTL_TaskLogAction=Logs", - "CTL_TaskLogTopComponent=Logs", - "HINT_TaskLogTopComponent=Logs" -}) -public class TaskLogTopComponent extends MultiDataBoxViewerTopComponent { - - public TaskLogTopComponent() { - super(WindowBoxFactory.getSystemMonitoringWindowBox(),"Logs"); - - setName(Bundle.CTL_TaskLogTopComponent()); - setToolTipText(Bundle.HINT_TaskLogTopComponent()); - } - - - void writeProperties(java.util.Properties p) { - // better to version settings since initial version as advocated at - // http://wiki.apidesign.org/wiki/PropertyFiles - p.setProperty("version", "1.0"); - // TODO store your settings - } - - void readProperties(java.util.Properties p) { - String version = p.getProperty("version"); - // TODO read your settings according to their version - } - - - @Override - protected void componentClosed() { - } - -} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/TaskLogTopPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/TaskLogTopPanel.java new file mode 100644 index 000000000..76b35a362 --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/TaskLogTopPanel.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.rsmexplorer; + + +import fr.proline.studio.pattern.WindowBoxFactory; + + +public class TaskLogTopPanel extends MultiDataBoxViewerTopPanel { + + private static TaskLogTopPanel m_singleton = null; + + public TaskLogTopPanel() { + super(WindowBoxFactory.getSystemMonitoringWindowBox(),"Logs"); + + setName("Logs"); + setToolTipText("Logs"); + } + + + public static TaskLogTopPanel getSingleton() { + if (m_singleton == null) { + m_singleton = new TaskLogTopPanel(); + } + + return m_singleton; + } + + @Override + public String getTopPanelIdentifierKey() { + return "LOG_TOP_PANEL"; + } + + + + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/AboutAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/AboutAction.java new file mode 100644 index 000000000..ac7eb60c3 --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/AboutAction.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.rsmexplorer.actions; + +import fr.proline.studio.WindowManager; +import fr.proline.studio.gui.AboutDialog; +import fr.proline.studio.rsmexplorer.gui.dialog.HelpDialog; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; + +public class AboutAction extends AbstractAction { + + public AboutAction() { + putValue(Action.NAME, "About"); + + setEnabled(true); + } + + + + @Override + public void actionPerformed(ActionEvent e) { + + Frame f = WindowManager.getDefault().getMainWindow(); + + AboutDialog aboutDialog = new AboutDialog(f); + aboutDialog.centerToWindow(f); + aboutDialog.setVisible(true); + + } +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/AbstractDisplayPTMDataAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/AbstractDisplayPTMDataAction.java new file mode 100644 index 000000000..2cf4a63ae --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/AbstractDisplayPTMDataAction.java @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.actions; + +import fr.proline.core.orm.msi.ResultSummary; +import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.dam.AccessDatabaseThread; +import fr.proline.studio.dam.DatabaseDataManager; +import fr.proline.studio.dam.data.DataSetData; +import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; +import fr.proline.studio.dam.tasks.DatabaseDataSetTask; +import fr.proline.studio.dam.tasks.SubTask; +import fr.proline.studio.dam.tasks.data.ptm.PTMDataset; +import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; +import fr.proline.studio.rsmexplorer.tree.AbstractNode; +import fr.proline.studio.rsmexplorer.tree.AbstractTree; +import fr.proline.studio.rsmexplorer.tree.DataSetNode; + +public abstract class AbstractDisplayPTMDataAction extends AbstractRSMAction { + + private boolean m_dataIsPTMSite; + private boolean m_isAnnotatedPTMs; + + public AbstractDisplayPTMDataAction(boolean isSite, AbstractTree tree) { + this(isSite, false, tree); + } + + public AbstractDisplayPTMDataAction(boolean isSite,boolean isAnnotatedPTMDs, AbstractTree tree) { + super(isSite ? (isAnnotatedPTMDs ? "Annotated Sites" : "Sites" ): (isAnnotatedPTMDs ? "Annotated Clusters" : "Clusters" ), tree); + m_dataIsPTMSite = isSite; + m_isAnnotatedPTMs = isAnnotatedPTMDs; + } + + public AbstractDisplayPTMDataAction(boolean isSite,boolean isAnnotatedPTMDs, AbstractTree tree, String prefix) { + super(isSite ? (isAnnotatedPTMDs ? prefix+" Annotated Sites" : prefix+" Sites" ): (isAnnotatedPTMDs ? prefix+" Annotated Clusters" : prefix+" Clusters" ), tree); + m_dataIsPTMSite = isSite; + m_isAnnotatedPTMs = isAnnotatedPTMDs; + } + + + @Override + public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { + int nbNodes = selectedNodes.length; + for (int i = 0; i < nbNodes; i++) { + DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; + actionImpl(dataSetNode); + } + } + + protected boolean isAnnotatedPTMsAction(){ + return m_isAnnotatedPTMs; + } + + protected abstract void loadWindowBox(DDataset dataSet, Object data, boolean unsaved); + + protected void actionImpl(DataSetNode dataSetNode) { + + final DDataset dataSet = ((DataSetData) dataSetNode.getData()).getDataset(); + + if (!dataSetNode.hasResultSummary()) { + return; // should not happen + } + + //Test if PTMDataset already loaded + PTMDataset ptmDataset = null; + boolean unsaved = false; + if(m_isAnnotatedPTMs) { + if(DatabaseDataManager.getDatabaseDataManager().getAnnotatedPTMDatasetSetForDS(dataSet.getId())!=null) + unsaved = DatabaseDataManager.getDatabaseDataManager().getAnnotatedPTMDatasetSetForDS(dataSet.getId()).shouldSavePTMDataset(); + ptmDataset = m_dataIsPTMSite ? DatabaseDataManager.getDatabaseDataManager().getAnnotatedSitesPTMDatasetForDS(dataSet.getId()) : DatabaseDataManager.getDatabaseDataManager().getAnnotatedClustersPTMDatasetForDS(dataSet.getId()); + + } else + ptmDataset = m_dataIsPTMSite ? DatabaseDataManager.getDatabaseDataManager().getSitesPTMDatasetForDS(dataSet.getId()) : DatabaseDataManager.getDatabaseDataManager().getClustersPTMDatasetForDS(dataSet.getId()); + + if(ptmDataset != null){ + loadWindowBox(dataSet, ptmDataset,unsaved); + + } else { + //Not loaded yet + + ResultSummary rsm = dataSetNode.getResultSummary(); + if (rsm != null) { + loadWindowBox(dataSet, dataSet, unsaved); + + } else { + + + // we have to load the result set + AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success, long taskId, SubTask subTask, boolean finished) { + loadWindowBox(dataSet, dataSet, false); + } + }; + + + // ask asynchronous loading of data + DatabaseDataSetTask task = new DatabaseDataSetTask(callback); + task.initLoadRsetAndRsm(dataSet); + AccessDatabaseThread.getAccessDatabaseThread().addTask(task); + } + } + } + + + @Override + public void updateEnabled(AbstractNode[] selectedNodes) { + int nbSelectedNodes = selectedNodes.length; + + + if (nbSelectedNodes == 0) { + setEnabled(false); + return; + } + + for (int i=0;i. - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions; import fr.proline.core.orm.uds.UserAccount; +import fr.proline.studio.WindowManager; import fr.proline.studio.rsmexplorer.gui.admin.AdminDialog; import fr.proline.studio.dam.DatabaseDataManager; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.AbstractAction; -import javax.swing.Action; -import org.openide.awt.ActionRegistration; -import org.openide.awt.ActionReference; -import org.openide.awt.ActionReferences; -import org.openide.awt.ActionID; -import org.openide.util.ContextAwareAction; -import org.openide.util.Lookup; -import org.openide.util.NbBundle; -import org.openide.util.NbBundle.Messages; -import org.openide.windows.WindowManager; +import javax.swing.*; -@ActionID(category = "File", id = "fr.proline.studio.rsmexplorer.actions.AdminAction") -@ActionRegistration(displayName = "#CTL_AdminAction") -@ActionReferences({ - @ActionReference(path = "Menu/File", position = 50) -}) -@Messages("CTL_AdminAction=Admin") -public final class AdminAction extends AbstractAction implements ActionListener, ContextAwareAction { + +public final class AdminAction extends AbstractAction implements ActionListener { public AdminAction() { - putValue(Action.NAME, NbBundle.getMessage(AdminAction.class, "CTL_AdminAction")); + putValue(Action.NAME, "Admin"); setEnabled(true); } @@ -53,6 +39,8 @@ public void actionPerformed(ActionEvent e) { Frame f = WindowManager.getDefault().getMainWindow(); Boolean isUser = true; UserAccount user = DatabaseDataManager.getDatabaseDataManager().getLoggedUser(); + if(user == null) + JOptionPane.showMessageDialog(f,"You must be logged to access this view ", "Admin View Error",JOptionPane.ERROR_MESSAGE); if (user != null) { isUser = !DatabaseDataManager.isAdmin(user); } @@ -66,18 +54,14 @@ public void actionPerformed(ActionEvent e) { } - @Override - public Action createContextAwareInstance(Lookup lkp) { - return new SettingsAction(); - } @Override public boolean isEnabled() { - UserAccount user = DatabaseDataManager.getDatabaseDataManager().getLoggedUser(); - if (user == null) { - return false; - } +// UserAccount user = DatabaseDataManager.getDatabaseDataManager().getLoggedUser(); +// if (user == null) { +// return false; +// } return true; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ChangePasswordAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ChangePasswordAction.java index b04af2924..d52902c4b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ChangePasswordAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ChangePasswordAction.java @@ -1,59 +1,43 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions; +import fr.proline.studio.WindowManager; import fr.proline.studio.dpm.AccessJMSManagerThread; import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.rsmexplorer.gui.dialog.ChangePasswordDialog; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; -import javax.swing.Action; import javax.swing.JOptionPane; -import org.openide.awt.ActionID; -import org.openide.awt.ActionReference; -import org.openide.awt.ActionReferences; -import org.openide.awt.ActionRegistration; -import org.openide.util.ContextAwareAction; -import org.openide.util.Lookup; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + /** - * Action to connect or disconnect to a UDS database + * Action to connect change password * * @author jm235353 */ -@ActionID(category = "File", id = "fr.proline.studio.rsmexplorer.actions.ChangePasswordAction") -@ActionRegistration(displayName = "#CTL_ChangePasswordAction") -@ActionReferences({ - @ActionReference(path = "Menu/File", position = 200) -}) -@NbBundle.Messages("CTL_ChangePasswordAction=Change password") -public class ChangePasswordAction extends AbstractAction implements ContextAwareAction { + +public class ChangePasswordAction extends AbstractAction { public ChangePasswordAction() { - super(NbBundle.getMessage(ChangePasswordAction.class, "CTL_ChangePasswordAction")); + super("Change Password"); } - @Override - public Action createContextAwareInstance(Lookup lkp) { - return new ChangePasswordAction(); - } @Override public void actionPerformed(ActionEvent e) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/CloseAllDataWindows.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/CloseAllDataWindows.java new file mode 100644 index 000000000..d5d7b68bc --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/CloseAllDataWindows.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.rsmexplorer.actions; + +import fr.proline.studio.WindowManager; +import fr.proline.studio.dock.AbstractDockFrame; + +import javax.swing.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class CloseAllDataWindows extends AbstractAction implements ActionListener { + + public CloseAllDataWindows() { + putValue(Action.NAME, "Close All Proteomics Data"); + setEnabled(true); + } + + @Override + public void actionPerformed(ActionEvent e) { + + AbstractDockFrame f = WindowManager.getDefault().getMainWindow(); + f.closeDataWindows(); + + } + + + @Override + public boolean isEnabled() { + return true; + } + + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ConnectAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ConnectAction.java index 3d7905074..04b1f7ba8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ConnectAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ConnectAction.java @@ -1,53 +1,42 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.taskinfo.TaskInfoManager; import fr.proline.studio.dpm.ServerConnectionManager; +import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.gui.InfoDialog; -import fr.proline.studio.gui.OptionDialog; import fr.proline.studio.rsmexplorer.gui.ProjectExplorerPanel; import fr.proline.studio.rsmexplorer.gui.dialog.ServerConnectionDialog; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.SwingUtilities; -import org.openide.awt.ActionID; -import org.openide.awt.ActionReference; -import org.openide.awt.ActionReferences; -import org.openide.awt.ActionRegistration; -import org.openide.util.ContextAwareAction; -import org.openide.util.Lookup; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + /** * Action to connect or disconnect to a UDS database * @author jm235353 */ -@ActionID(category = "File", id = "fr.proline.studio.rsmexplorer.actions.ConnectAction") -@ActionRegistration(displayName = "#CTL_ConnectAction") -@ActionReferences({ - @ActionReference(path = "Menu/File", position = 100) -}) -@NbBundle.Messages("CTL_ConnectAction=Connect...") -public class ConnectAction extends AbstractAction implements ContextAwareAction { + +public class ConnectAction extends AbstractAction { private static ConnectAction m_action = null; @@ -60,6 +49,13 @@ private ConnectAction() { setConnectionType(true, true); } + public static ConnectAction getAction() { + if (m_action == null) { + m_action = new ConnectAction(); + } + return m_action; + } + public final static void setConnectionType(boolean connectAction, boolean enabled) { m_connectAction = connectAction; @@ -67,17 +63,13 @@ public final static void setConnectionType(boolean connectAction, boolean enable if (m_action != null) { m_action.setEnabled(enabled); if (connectAction) { - m_action.putValue(Action.NAME, NbBundle.getMessage(ConnectAction.class, "CTL_ConnectAction")); + m_action.putValue(Action.NAME, "Connect..."); } else { m_action.putValue(Action.NAME, "Change User..."); } } } - @Override - public Action createContextAwareInstance(Lookup lkp) { - return new ConnectAction(); - } @Override public void actionPerformed(ActionEvent e) { @@ -122,12 +114,12 @@ public void run() { // check if there is tasks being done which ask not to disconnect/close the application if (TaskInfoManager.getTaskInfoManager().askBeforeExitingApp()) { InfoDialog exitDialog = new InfoDialog(WindowManager.getDefault().getMainWindow(), InfoDialog.InfoType.WARNING, "Warning", "You should not disconnect. Important tasks are being done.\nAre you sure you want to disconnect ?"); - exitDialog.setButtonName(OptionDialog.BUTTON_OK, "Yes"); - exitDialog.setButtonName(OptionDialog.BUTTON_CANCEL, "No"); + exitDialog.setButtonName(DefaultDialog.BUTTON_OK, "Yes"); + exitDialog.setButtonName(DefaultDialog.BUTTON_CANCEL, "No"); exitDialog.centerToWindow(WindowManager.getDefault().getMainWindow()); exitDialog.setVisible(true); - if (exitDialog.getButtonClicked() == OptionDialog.BUTTON_CANCEL) { + if (exitDialog.getButtonClicked() == DefaultDialog.BUTTON_CANCEL) { // No clicked return; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ConvertRawAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ConvertRawAction.java index 468ef7eca..f96c1d734 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ConvertRawAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ConvertRawAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions; import fr.proline.studio.rsmexplorer.gui.dialog.ConvertRawDialog; @@ -22,28 +22,15 @@ import java.awt.event.ActionListener; import javax.swing.AbstractAction; import javax.swing.Action; -import org.openide.awt.ActionRegistration; -import org.openide.awt.ActionID; -import org.openide.util.ContextAwareAction; -import org.openide.util.Lookup; -import org.openide.util.NbBundle; -import org.openide.util.NbBundle.Messages; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; -@ActionID(category = "File", id = "fr.proline.studio.rsmexplorer.actions.ConvertRawAction") -@ActionRegistration(displayName = "#CTL_ConvertRawAction") -/* -@ActionReferences({ - @ActionReference(path = "Menu/File", position = 600) -}) -*/ -@Messages("CTL_ConvertRawAction=Convert RAW File(s)") -public final class ConvertRawAction extends AbstractAction implements ActionListener, ContextAwareAction { + +public final class ConvertRawAction extends AbstractAction implements ActionListener { private static ConvertRawAction m_action = null; public ConvertRawAction() { - putValue(Action.NAME, NbBundle.getMessage(ConvertRawAction.class, "CTL_ConvertRawAction")); + putValue(Action.NAME, "Convert RAW File(s)"); m_action = this; setEnabled(true); } @@ -63,8 +50,5 @@ public void actionPerformed(ActionEvent e) { } - @Override - public Action createContextAwareInstance(Lookup lkp) { - return new ConvertRawAction(); - } + } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/DataAnalyzerAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/DataAnalyzerAction.java index b74a413f4..7fea16b66 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/DataAnalyzerAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/DataAnalyzerAction.java @@ -1,29 +1,27 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions; import fr.proline.studio.pattern.DataAnalyzerWindowBoxManager; + +import javax.swing.*; import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import org.openide.awt.ActionRegistration; -import org.openide.awt.ActionReference; -import org.openide.awt.ActionReferences; -import org.openide.awt.ActionID; -import org.openide.util.NbBundle; + + /** * @@ -32,13 +30,15 @@ * @author JM235353 */ -@ActionID(category = "Window", id = "fr.proline.studio.rsmexplorer.actions.DataAnalyzerAction") -@ActionRegistration(displayName = "#CTL_DataAnalyzerAction") -@ActionReferences({ - @ActionReference(path = "Menu/Window", position = 100) -}) -@NbBundle.Messages("CTL_DataAnalyzerAction=Data Analyzer") -public final class DataAnalyzerAction implements ActionListener { + +public final class DataAnalyzerAction extends AbstractAction { + + public DataAnalyzerAction() { + putValue(Action.NAME, "Data Analyzer"); + + + setEnabled(true); + } @Override public void actionPerformed(ActionEvent e) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/DisplayWindow.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/DisplayWindow.java new file mode 100644 index 000000000..51d394def --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/DisplayWindow.java @@ -0,0 +1,37 @@ +package fr.proline.studio.rsmexplorer.actions; + +import fr.proline.studio.WindowManager; +import fr.proline.studio.dock.AbstractTopPanel; +import fr.proline.studio.rsmexplorer.MainFrame; + +import javax.swing.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class DisplayWindow extends AbstractAction implements ActionListener { + + private AbstractTopPanel m_topPanel = null; + + public DisplayWindow(String actionName, AbstractTopPanel topPanel) { + m_topPanel = topPanel; + putValue(Action.NAME, actionName); + setEnabled(true); + } + + @Override + public void actionPerformed(ActionEvent e) { + + MainFrame f = (MainFrame) WindowManager.getDefault().getMainWindow(); + f.displayWindow(m_topPanel); + + } + + + @Override + public boolean isEnabled() { + + return true; + } + + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ExitAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ExitAction.java new file mode 100644 index 000000000..97815a092 --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ExitAction.java @@ -0,0 +1,33 @@ +package fr.proline.studio.rsmexplorer.actions; + +import fr.proline.studio.WindowManager; +import fr.proline.studio.rsmexplorer.MainFrame; + +import javax.swing.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class ExitAction extends AbstractAction implements ActionListener { + + public ExitAction() { + putValue(Action.NAME, "Exit"); + setEnabled(true); + } + + @Override + public void actionPerformed(ActionEvent e) { + + MainFrame f = (MainFrame) WindowManager.getDefault().getMainWindow(); + f.exit(); + + } + + + @Override + public boolean isEnabled() { + + return true; + } + + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ExportPTMDatasetAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ExportPTMDatasetAction.java new file mode 100644 index 000000000..722f4b3c0 --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ExportPTMDatasetAction.java @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.actions; + +import com.google.gson.FieldNamingPolicy; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import fr.proline.core.orm.msi.dto.DInfoPTM; +import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dam.DatabaseDataManager; +import fr.proline.studio.dam.data.DataSetData; +import fr.proline.studio.dam.tasks.DatabaseDatasetPTMsTask; +import fr.proline.studio.dam.tasks.DatabasePTMsTask; +import fr.proline.studio.dam.tasks.data.ptm.*; +import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; +import fr.proline.studio.rsmexplorer.tree.AbstractNode; +import fr.proline.studio.rsmexplorer.tree.AbstractTree; +import fr.proline.studio.rsmexplorer.tree.DataSetNode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.swing.*; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.List; + +// VDS: Export PTM Dataset in JSON format. Test only .... +public class ExportPTMDatasetAction extends AbstractRSMAction { + + protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer.ExportFastaAction"); + + public ExportPTMDatasetAction(AbstractTree tree) { + super("PTM Dataset", tree); + } + + @Override + public void updateEnabled(AbstractNode[] selectedNodes) { + int nbSelectedNodes = selectedNodes.length; + + if (nbSelectedNodes != 1) {//don't allow multiple + setEnabled(false); + return; + } + + DataSetNode dataSetNode = (DataSetNode) selectedNodes[0]; + if (dataSetNode.isChanging() || dataSetNode.isFolder()) { + setEnabled(false); + return; + } + + if (!dataSetNode.hasResultSet() || !dataSetNode.hasResultSummary()) { + setEnabled(false); + } + } + + @Override + public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { + + final DDataset dataSet = ((DataSetData) selectedNodes[0].getData()).getDataset(); + + //Test if PTMDataset already loaded + PTMDataset ptmDataset = DatabaseDataManager.getDatabaseDataManager().getClustersPTMDatasetForDS(dataSet.getId()); + if(ptmDataset == null) + ptmDataset = DatabaseDataManager.getDatabaseDataManager().getSitesPTMDatasetForDS(dataSet.getId()); + + if(ptmDataset != null){ + exportPTMDataset(ptmDataset); + + } else { + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "PTM Dataset not loaded yet ! Display it to load data...", DatabaseDatasetPTMsTask.ERROR_PTM_CLUSTER_LOADING, JOptionPane.ERROR_MESSAGE); + } + } + + + private void exportPTMDataset(PTMDataset ptmDataset){ + + try { + JSONPTMDataset jsonPTMDataset = ptmDataset.createJSONPTMDataset(); + if(jsonPTMDataset == null) + return; + + + //File to export to + String ptmFileName = ptmDataset.getDataset().getName().trim(); + File ptmFile = new File("./"+ptmFileName+".json"); + + FileWriter writer = new FileWriter(ptmFile); + Gson gson = new GsonBuilder().serializeNulls().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create(); + String jsonString = gson.toJson(jsonPTMDataset); + + writer.write(jsonString); + writer.flush(); + writer.close(); + + } catch (IOException | IllegalAccessException e) { + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), e.getMessage(), DatabaseDatasetPTMsTask.ERROR_PTM_CLUSTER_LOADING, JOptionPane.ERROR_MESSAGE); + e.printStackTrace(); + } + + + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "Export PTM DS with "+ptmDataset.getPTMClusters().size()+" clusters ", DatabaseDatasetPTMsTask.ERROR_PTM_CLUSTER_LOADING, JOptionPane.ERROR_MESSAGE); + } + + + + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/HelpAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/HelpAction.java index 929635597..fe8f85cf2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/HelpAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/HelpAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions; import fr.proline.studio.rsmexplorer.gui.dialog.HelpDialog; @@ -21,26 +21,16 @@ import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; -import org.openide.awt.ActionRegistration; -import org.openide.awt.ActionReference; -import org.openide.awt.ActionReferences; -import org.openide.awt.ActionID; -import org.openide.util.*; -import org.openide.util.NbBundle.Messages; -import org.openide.windows.WindowManager; -@ActionID(category = "Help", id = "fr.proline.studio.rsmexplorer.actions.HelpAction") -@ActionRegistration(displayName = "#CTL_HelpAction") -@ActionReferences({ - @ActionReference(path = "Menu/Help", position = 100) -}) -@Messages("CTL_HelpAction=Getting Started") -public final class HelpAction extends AbstractAction implements /*LookupListener,*/ ContextAwareAction { +import fr.proline.studio.WindowManager; + + +public final class HelpAction extends AbstractAction { private static HelpAction m_action = null; public HelpAction() { - putValue(Action.NAME, NbBundle.getMessage(HelpAction.class, "CTL_HelpAction")); + putValue(Action.NAME, "Getting Started"); m_action = this; @@ -48,14 +38,10 @@ public HelpAction() { } public static HelpAction getAction() { - m_action.putValue(Action.NAME, "totoche"); + m_action.putValue(Action.NAME, "Getting Started"); return m_action; } - @Override - public Action createContextAwareInstance(Lookup lkp) { - return new HelpAction(); - } @Override public void actionPerformed(ActionEvent e) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/HelpHowToAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/HelpHowToAction.java index 51f463229..f793cd6e9 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/HelpHowToAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/HelpHowToAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -20,20 +20,18 @@ import java.awt.Desktop; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import org.openide.awt.ActionRegistration; -import org.openide.awt.ActionReference; -import org.openide.awt.ActionReferences; -import org.openide.awt.ActionID; -import org.openide.util.NbBundle.Messages; import org.slf4j.LoggerFactory; -@ActionID(category = "Help", id = "fr.proline.studio.rsmexplorer.actions.HelpHowToAction") -@ActionRegistration(displayName = "#CTL_HelpHowToAction") -@ActionReferences({ - @ActionReference(path = "Menu/Help", position = 125) -}) -@Messages("CTL_HelpHowToAction=How to") -public final class HelpHowToAction implements ActionListener { +import javax.swing.*; + + +public final class HelpHowToAction extends AbstractAction implements ActionListener { + + public HelpHowToAction() { + putValue(Action.NAME, "How to"); + setEnabled(true); + } + public void actionPerformed(ActionEvent e) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/HelpProlineAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/HelpProlineAction.java index f5acf90aa..f5f6e7ab2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/HelpProlineAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/HelpProlineAction.java @@ -1,39 +1,37 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions; import fr.proline.studio.utils.HelpUtils; import java.awt.Desktop; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import org.openide.awt.ActionRegistration; -import org.openide.awt.ActionReference; -import org.openide.awt.ActionReferences; -import org.openide.awt.ActionID; -import org.openide.util.NbBundle.Messages; import org.slf4j.LoggerFactory; -@ActionID(category = "Help", id = "fr.proline.studio.rsmexplorer.actions.HelpProlineAction") -@ActionRegistration(displayName = "#CTL_HelpProlineAction") -@ActionReferences({ - @ActionReference(path = "Menu/Help", position = 150, separatorAfter = 175) -}) -@Messages("CTL_HelpProlineAction=Proline Help") -public final class HelpProlineAction implements ActionListener { +import javax.swing.*; + + +public final class HelpProlineAction extends AbstractAction implements ActionListener { + + public HelpProlineAction() { + putValue(Action.NAME, "Proline Help"); + setEnabled(true); + } + @Override public void actionPerformed(ActionEvent e) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/MemoryAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/MemoryAction.java index 8600da8eb..7d6e68ecf 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/MemoryAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/MemoryAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -23,24 +23,13 @@ import java.awt.event.ActionListener; import javax.swing.AbstractAction; import javax.swing.Action; -import org.openide.awt.ActionRegistration; -import org.openide.awt.ActionReference; -import org.openide.awt.ActionReferences; -import org.openide.awt.ActionID; -import org.openide.util.NbBundle; -import org.openide.util.NbBundle.Messages; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; + -@ActionID(category = "Window", id = "fr.proline.studio.rsmexplorer.actions.MemoryAction") -@ActionRegistration(displayName = "#CTL_MemoryAction") -@ActionReferences({ - @ActionReference(path = "Menu/Window", position = 51) -}) -@Messages("CTL_MemoryAction=Memory Usage") public final class MemoryAction extends AbstractAction implements ActionListener { public MemoryAction() { - putValue(Action.NAME, NbBundle.getMessage(MemoryAction.class, "CTL_MemoryAction")); + putValue(Action.NAME, "Memory Usage"); setEnabled(true); } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ResetWindowsAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ResetWindowsAction.java new file mode 100644 index 000000000..80cd3128d --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ResetWindowsAction.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ + +package fr.proline.studio.rsmexplorer.actions; + +import fr.proline.studio.WindowManager; +import fr.proline.studio.dock.AbstractDockFrame; + +import javax.swing.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class ResetWindowsAction extends AbstractAction implements ActionListener { + + public ResetWindowsAction() { + putValue(Action.NAME, "Reset Windows"); + setEnabled(true); + } + + @Override + public void actionPerformed(ActionEvent e) { + + AbstractDockFrame f = WindowManager.getDefault().getMainWindow(); + f.resetWindows(); + + + + } + + + @Override + public boolean isEnabled() { + return true; + } + + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/SettingsAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/SettingsAction.java index 3a0e80716..83c19af4f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/SettingsAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/SettingsAction.java @@ -1,49 +1,37 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions; +import fr.proline.studio.WindowManager; import fr.proline.studio.rsmexplorer.gui.dialog.ApplicationSettingsDialog; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.AbstractAction; import javax.swing.Action; -import org.openide.awt.ActionRegistration; -import org.openide.awt.ActionReference; -import org.openide.awt.ActionReferences; -import org.openide.awt.ActionID; -import org.openide.util.ContextAwareAction; -import org.openide.util.Lookup; -import org.openide.util.NbBundle; -import org.openide.util.NbBundle.Messages; -import org.openide.windows.WindowManager; -@ActionID(category = "File", id = "fr.proline.studio.rsmexplorer.actions.SettingsAction") -@ActionRegistration(displayName = "#CTL_SettingsAction") -@ActionReferences({ - @ActionReference(path = "Menu/File", position = 400) -}) -@Messages("CTL_SettingsAction=General Settings") -public final class SettingsAction extends AbstractAction implements ActionListener, ContextAwareAction { + + +public final class SettingsAction extends AbstractAction implements ActionListener { private static SettingsAction m_action = null; public SettingsAction() { - putValue(Action.NAME, NbBundle.getMessage(SettingsAction.class, "CTL_SettingsAction")); + putValue(Action.NAME, "General Settings"); m_action = this; setEnabled(true); } @@ -63,8 +51,4 @@ public void actionPerformed(ActionEvent e) { } - @Override - public Action createContextAwareInstance(Lookup lkp) { - return new SettingsAction(); - } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/UploadDatAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/UploadDatAction.java index 6d98da739..8676db5bb 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/UploadDatAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/UploadDatAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions; import fr.proline.studio.rsmexplorer.gui.dialog.UploadDatDialog; @@ -22,27 +22,16 @@ import java.awt.event.ActionListener; import javax.swing.AbstractAction; import javax.swing.Action; -import org.openide.awt.ActionRegistration; -import org.openide.awt.ActionReferences; -import org.openide.awt.ActionID; -import org.openide.util.ContextAwareAction; -import org.openide.util.Lookup; -import org.openide.util.NbBundle; -import org.openide.util.NbBundle.Messages; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; -@ActionID(category = "File", id = "fr.proline.studio.rsmexplorer.actions.UploadDatAction") -@ActionRegistration(displayName = "#CTL_UploadDatAction") -@ActionReferences({ - //@ActionReference(path = "Menu/File", position = 600) -}) -@Messages("CTL_UploadDatAction=Upload .dat File(s)") -public final class UploadDatAction extends AbstractAction implements ActionListener, ContextAwareAction { + + +public final class UploadDatAction extends AbstractAction implements ActionListener { private static UploadDatAction m_action = null; public UploadDatAction() { - putValue(Action.NAME, NbBundle.getMessage(UploadDatAction.class, "CTL_UploadDatAction")); + putValue(Action.NAME, "Upload .dat File(s)"); m_action = this; setEnabled(true); } @@ -62,8 +51,4 @@ public void actionPerformed(ActionEvent e) { } - @Override - public Action createContextAwareInstance(Lookup lkp) { - return new UploadDatAction(); - } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/UploadMzdbAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/UploadMzdbAction.java index 635f94b1e..724b051d9 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/UploadMzdbAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/UploadMzdbAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions; import fr.proline.studio.rsmexplorer.gui.dialog.UploadMzdbDialog; @@ -22,30 +22,17 @@ import java.awt.event.ActionListener; import javax.swing.AbstractAction; import javax.swing.Action; -import org.openide.awt.ActionRegistration; -import org.openide.awt.ActionID; -import org.openide.util.ContextAwareAction; -import org.openide.util.Lookup; -import org.openide.util.NbBundle; -import org.openide.util.NbBundle.Messages; -import org.openide.windows.WindowManager; -@ActionID(category = "File", id = "fr.proline.studio.rsmexplorer.actions.UploadMzdbAction") -@ActionRegistration(displayName = "#CTL_UploadMzdbAction") -/* -@ActionReferences({ - @ActionReference(path = "Menu/File", position = 500) -}) -*/ +import fr.proline.studio.WindowManager; -@Messages("CTL_UploadMzdbAction=Upload mzDB File(s)") -public final class UploadMzdbAction extends AbstractAction implements ActionListener, ContextAwareAction { + +public final class UploadMzdbAction extends AbstractAction implements ActionListener { private static UploadMzdbAction m_action = null; public UploadMzdbAction() { - putValue(Action.NAME, NbBundle.getMessage(UploadMzdbAction.class, "CTL_UploadMzdbAction")); + putValue(Action.NAME, "Upload mzDB File(s)"); m_action = this; setEnabled(true); } @@ -65,8 +52,4 @@ public void actionPerformed(ActionEvent e) { } - @Override - public Action createContextAwareInstance(Lookup lkp) { - return new UploadMzdbAction(); - } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ViewColocalizedPTMClustersAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ViewColocalizedPTMClustersAction.java new file mode 100644 index 000000000..b6602a6a9 --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/ViewColocalizedPTMClustersAction.java @@ -0,0 +1,70 @@ +package fr.proline.studio.rsmexplorer.actions; + +import fr.proline.studio.dam.tasks.data.ptm.PTMCluster; +import fr.proline.studio.extendedtablemodel.CompoundTableModel; +import fr.proline.studio.filter.FilterTableModelInterface; +import fr.proline.studio.rsmexplorer.gui.model.PTMClusterTableModel; +import fr.proline.studio.table.AbstractTableAction; + +import javax.swing.*; +import javax.swing.table.TableModel; +import java.util.HashSet; +import java.util.List; + +public class ViewColocalizedPTMClustersAction extends AbstractTableAction { + + + public ViewColocalizedPTMClustersAction() { + super("View Co-localized Clusters"); + } + + @Override + public void actionPerformed(int col, int row, int[] selectedRows, JTable table) { + + TableModel tableModel = table.getModel(); + if(!(tableModel instanceof CompoundTableModel && ((CompoundTableModel)tableModel).getBaseModel() instanceof PTMClusterTableModel)){ + return; + } + + PTMClusterTableModel ptmTbModel = (PTMClusterTableModel) ((CompoundTableModel)tableModel).getBaseModel(); + FilterTableModelInterface filterTableModel = (FilterTableModelInterface) tableModel; + + //Get index in inital model (no sorting/filtering) + int selectFilteredModelRow = table.convertRowIndexToModel(selectedRows[0]); + int selectClusterModelRow = filterTableModel.convertRowToOriginalModel(selectFilteredModelRow); + + //Get PTMCLuster at specified index + PTMCluster cluster = (PTMCluster) ptmTbModel.getRowValue(PTMCluster.class, selectClusterModelRow); + + //Get PTMCluster colocalized clusters and filter table with these clusters only + if(cluster != null){ + List colocClusters = cluster.getPTMDataset().getColocatedClusters(cluster); + if(colocClusters.isEmpty()) + return; + + HashSet restrainRowSet = filterTableModel.getRestrainRowSet(); + if (restrainRowSet == null) { + restrainRowSet = new HashSet<>(); + } else { + restrainRowSet.clear(); + } + + //Reset filter to access all rows + filterTableModel.restrain(null); + + for (PTMCluster colocCl : colocClusters) { + + //index in initial model + int modelIndex = ptmTbModel.getModelIndexFor(colocCl); + restrainRowSet.add(modelIndex); + } + + filterTableModel.restrain(restrainRowSet); + } + } + + @Override + public void updateEnabled(int row, int col, int[] selectedRows, JTable table) { + setEnabled((selectedRows!=null) && (selectedRows.length==1)); + } +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/AbstractRSMAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/AbstractRSMAction.java index 6f22eff1a..ecf7f8606 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/AbstractRSMAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/AbstractRSMAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/AddIdentificationFolderAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/AddIdentificationFolderAction.java index 3aa090037..4406cb139 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/AddIdentificationFolderAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/AddIdentificationFolderAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.Project; @@ -34,7 +34,7 @@ import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; import java.util.ArrayList; import javax.swing.tree.DefaultTreeModel; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/AggregateAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/AggregateAction.java index fcc960367..7ecf6d2e8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/AggregateAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/AggregateAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.studio.rsmexplorer.tree.AbstractNode; @@ -35,8 +35,8 @@ import fr.proline.studio.rsmexplorer.gui.dialog.AddAggregateDialog; import java.util.ArrayList; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; /** * Add Aggregate action @@ -46,7 +46,7 @@ public class AggregateAction extends AbstractRSMAction { public AggregateAction(AbstractTree tree) { - super(NbBundle.getMessage(AggregateAction.class, "CTL_AggregateAction"), tree); + super("Add Dataset...", tree); } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ChangeTypicalProteinJMSAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ChangeTypicalProteinJMSAction.java index f9da9f930..7fdb43576 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ChangeTypicalProteinJMSAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ChangeTypicalProteinJMSAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -23,8 +23,8 @@ import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.uds.Project; import fr.proline.studio.dam.DatabaseDataManager; @@ -44,7 +44,7 @@ public class ChangeTypicalProteinJMSAction extends AbstractRSMAction { public ChangeTypicalProteinJMSAction(AbstractTree tree) { - super(NbBundle.getMessage(ChangeTypicalProteinJMSAction.class, "CTL_ChangeTypicalProtein"), tree); + super("Change Typical Protein...", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ClearDatasetAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ClearDatasetAction.java index 59e5da247..63f411326 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ClearDatasetAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ClearDatasetAction.java @@ -1,23 +1,24 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.Project; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.core.orm.uds.dto.DDatasetType; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.DatabaseDataManager; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; @@ -30,8 +31,8 @@ import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; import javax.swing.JOptionPane; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; /** * Remove Identification Summary and potentially Search Result from a dataset @@ -39,58 +40,69 @@ */ public class ClearDatasetAction extends AbstractRSMAction { - + boolean m_fullClear = false; + public ClearDatasetAction(AbstractTree tree) { - super(NbBundle.getMessage(ClearDatasetAction.class, "CTL_ClearAction"), tree); + super("Clear Validation", tree); + } + + public ClearDatasetAction(AbstractTree tree, boolean fullClear) { + super(fullClear ? "Clear All" : "Clear Validation", tree); + m_fullClear = fullClear; } @Override public void actionPerformed(final AbstractNode[] selectedNodes, int x, int y) { - String msg = NbBundle.getMessage(ClearDatasetAction.class,"ClearDatasetAction.help.text"); + StringBuilder sb = new StringBuilder("The Clear action will delete generated data (Identification Summary"); + if (m_fullClear) { + sb.append(" and Merged DataSet)"); + } else { + sb.append(")"); + } + sb.append("\n(This can not be undone) Are you sure ?"); String title = "Clear Dataset"; - int n = JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), - msg, title, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + int n = JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(),sb.toString(), title, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (n == JOptionPane.YES_OPTION) { - IdentificationTree tree = IdentificationTree.getCurrentTree(); - final DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel(); - - int nbNodes = selectedNodes.length; - for (int i = 0; i < nbNodes; i++) { - final DataSetNode node = (DataSetNode) selectedNodes[i]; - node.setIsChanging(true); - treeModel.nodeChanged(node); - - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { + IdentificationTree tree = IdentificationTree.getCurrentTree(); + final DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel(); - @Override - public boolean mustBeCalledInAWT() { - return true; - } + int nbNodes = selectedNodes.length; + for (int i = 0; i < nbNodes; i++) { + final DataSetNode node = (DataSetNode) selectedNodes[i]; + node.setIsChanging(true); + treeModel.nodeChanged(node); + + AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - - if (success) { - DDataset dataset = node.getDataset(); - dataset.setResultSummaryId(null); - dataset.setResultSummary(null); - if (!node.isLeaf()) { - dataset.setResultSetId(null); - dataset.setResultSet(null); + @Override + public void run(boolean success, long taskId, SubTask subTask, boolean finished) { + + if (success) { + DDataset dataset = node.getDataset(); + dataset.setResultSummaryId(null); + dataset.setResultSummary(null); + if (m_fullClear && !node.isLeaf()) { + dataset.setResultSetId(null); + dataset.setResultSet(null); + } } + node.setIsChanging(false); + treeModel.nodeChanged(node); } - node.setIsChanging(false); - treeModel.nodeChanged(node); - } - }; - - DDataset dataset = node.getDataset(); - DatabaseDataSetTask task = new DatabaseDataSetTask(callback); - task.initClearDataset(dataset, !node.isLeaf()); - - AccessDatabaseThread.getAccessDatabaseThread().addTask(task); - } + }; + + DDataset dataset = node.getDataset(); + DatabaseDataSetTask task = new DatabaseDataSetTask(callback); + task.initClearDataset(dataset, (m_fullClear && !node.isLeaf()) ); + + AccessDatabaseThread.getAccessDatabaseThread().addTask(task); + } } } @@ -141,6 +153,22 @@ public void updateEnabled(AbstractNode[] selectedNodes) { setEnabled(false); return; } else { + + if (!datasetNode.hasResultSummary() && !m_fullClear) { + setEnabled(false); + return; + } + + + DDatasetType.AggregationInformation aggInfo = datasetNode.getDataset().getAggregationInformation(); + if(aggInfo.equals(DDatasetType.AggregationInformation.IDENTIFICATION_SUMMARY_AGG) || aggInfo.equals(DDatasetType.AggregationInformation.IDENTIFICATION_SUMMARY_UNION)){ + // Identification merged only full clear + if(!m_fullClear) { + setEnabled(false); + return; + } + } + AbstractNode parentNode = (AbstractNode) datasetNode.getParent(); if (parentNode.getType() == AbstractNode.NodeTypes.DATA_SET) { DataSetNode parentDatasetNode = (DataSetNode) parentNode; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/CopySearchResult.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/CopySearchResult.java index 770d3288c..e8bbf9d5c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/CopySearchResult.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/CopySearchResult.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.Aggregation; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/CreateQuantitationAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/CreateQuantitationAction.java index 2c509c3f4..3d85bb924 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/CreateQuantitationAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/CreateQuantitationAction.java @@ -1,289 +1,289 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.actions.identification; - -import fr.proline.core.orm.uds.Project; -import fr.proline.core.orm.uds.QuantitationMethod; -import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.core.orm.uds.dto.DDatasetType; -import fr.proline.studio.dam.AccessDatabaseThread; -import fr.proline.studio.dam.DatabaseDataManager; -import fr.proline.studio.dam.data.DataSetData; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; -import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.dam.tasks.xic.DatabaseLoadXicMasterQuantTask; -import fr.proline.studio.dpm.AccessJMSManagerThread; -import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; -import fr.proline.studio.dpm.task.jms.RunQuantitationTask; -import fr.proline.studio.gui.DefaultDialog; -import fr.proline.studio.rsmexplorer.gui.ProjectExplorerPanel; -import fr.proline.studio.rsmexplorer.gui.dialog.xic.CreateQuantitationDialog; -import fr.proline.studio.rsmexplorer.tree.quantitation.QuantitationTree; -import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import fr.proline.studio.rsmexplorer.tree.AbstractNode; -import fr.proline.studio.rsmexplorer.tree.AbstractTree; -import fr.proline.studio.rsmexplorer.tree.ChildFactory; -import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; -import java.util.*; -import javax.swing.JOptionPane; -import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author JM235353 - */ -public class CreateQuantitationAction extends AbstractRSMAction { - - protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); - - private QuantitationMethod.Type m_quantitationType; - private boolean m_isFromExistingQuantitation = false; - private boolean m_referenceDataSetDefined = false; - - static String getMessage(boolean fromExistingXIC, QuantitationMethod.Type type) { - - switch (type) { - case LABEL_FREE: { - if (fromExistingXIC) { - return NbBundle.getMessage(CreateQuantitationAction.class, "CTL_CreateXIC_Clone"); - } else { - return NbBundle.getMessage(CreateQuantitationAction.class, "CTL_CreateXIC"); - } - } - case RESIDUE_LABELING: return NbBundle.getMessage(CreateQuantitationAction.class, "CTL_CreateResidueLabeling"); - case ISOBARIC_TAGGING: return NbBundle.getMessage(CreateQuantitationAction.class, "CTL_CreateIsobaricLabeling"); - - } - return "unknown"; - } - - public CreateQuantitationAction(AbstractTree tree, boolean fromExistingXIC) { - super(CreateQuantitationAction.getMessage(fromExistingXIC, QuantitationMethod.Type.LABEL_FREE), tree); - // warn : at this time cloning is only supported for LABEL FREE quantitations - m_quantitationType = QuantitationMethod.Type.LABEL_FREE; - m_isFromExistingQuantitation = fromExistingXIC; - } - - public CreateQuantitationAction(AbstractTree tree, QuantitationMethod.Type type) { - super(CreateQuantitationAction.getMessage(false, type), tree); - m_quantitationType = type; - m_isFromExistingQuantitation = false; - } - - @Override - public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { - - if (ProjectExplorerPanel.getProjectExplorerPanel().getSelectedProject() == null) { - JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "A project should be selected !", "Warning", JOptionPane.ERROR_MESSAGE); - return; - } - - if (m_isFromExistingQuantitation) { - final DDataset currentDataset = ((DataSetData) ((DataSetNode) selectedNodes[0]).getData()).getDataset(); - final int posx = x; - final int posy = y; - - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - createQuantitationDialog(currentDataset, posx, posy); - } - }; - DatabaseLoadXicMasterQuantTask task = new DatabaseLoadXicMasterQuantTask(callback); - task.initLoadQuantChannels(ProjectExplorerPanel.getProjectExplorerPanel().getSelectedProject().getId(), currentDataset); - AccessDatabaseThread.getAccessDatabaseThread().addTask(task); - - } else { - AbstractNode n = selectedNodes[0]; - DDataset refDataset = null; - if (!n.isRoot() && DataSetNode.class.isInstance(n)) { - DataSetNode node = (DataSetNode) n; - DataSetData dataset = (DataSetData) node.getData(); - DDatasetType dsType = dataset.getDatasetType(); - if (node.hasResultSummary() && (dsType.isAggregation() || dsType.isIdentification())) { - m_referenceDataSetDefined = true; - refDataset = dataset.getDataset(); - } else { - m_referenceDataSetDefined = false; - } - } - createQuantitationDialog(refDataset, x, y); - } - } - - private void createQuantitationDialog(DDataset dataset, int x, int y) { - Long pID = ProjectExplorerPanel.getProjectExplorerPanel().getSelectedProject().getId(); - CreateQuantitationDialog dialog = CreateQuantitationDialog.getDialog(WindowManager.getDefault().getMainWindow()); - IdentificationTree childTree = null; - DDataset refDataset = null; - DDataset existingDataset = (m_isFromExistingQuantitation) ? dataset : null; - - if (m_referenceDataSetDefined) { - childTree = IdentificationTree.getCurrentTree().copyDataSetRootSubTree(dataset, dataset.getProject().getId()); - refDataset = dataset; - } else if (existingDataset != null && existingDataset.getMasterQuantitationChannels().get(0).getIdentDataset() != null) { - refDataset = dataset.getMasterQuantitationChannels().get(0).getIdentDataset(); - childTree = IdentificationTree.getCurrentTree().copyDataSetRootSubTree(refDataset, refDataset.getProject().getId()); - if (childTree == null) { - m_logger.debug("Reference dataset not already loaded: creates a new node to display in a new IdentificationTree"); - childTree = new IdentificationTree(ChildFactory.createNode(new DataSetData(refDataset))); - } - } - - dialog.initializeExperimentalDesignTree(existingDataset, refDataset, childTree, m_quantitationType); - - dialog.setLocation(x, y); - dialog.setVisible(true); - final Long[] _xicQuantiDataSetId = new Long[1]; - - if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { - - //User specified experimental design dataset - DataSetData _quantiDS = null; - Map expParams = null; - - StringBuffer errorMsg = new StringBuffer(""); - - Map quantParams = dialog.getQuantiParameters(); - if (quantParams == null) { - errorMsg.append("Null Quantitation parameters ! "); - } - - if (dialog.getQuantitationDataset() == null) { - errorMsg.append("No experimental design defined "); - - } else { - - String registerErrMsg = dialog.registerRawFiles(); - if(registerErrMsg != null && !registerErrMsg.isEmpty()) - errorMsg.append( registerErrMsg); - - //*** Get experimental design values - _quantiDS = dialog.getQuantitationDataset(); - - try { - expParams = dialog.getExperimentalDesignParameters(); - } catch (IllegalAccessException iae) { - errorMsg.append(iae.getMessage()); - } - } - - if (!errorMsg.toString().isEmpty()) { - JOptionPane.showMessageDialog(dialog, errorMsg, "Warning", JOptionPane.ERROR_MESSAGE); - return; - } - - m_logger.debug(" Will Compute Quantitation on " + ((List) expParams.get("biological_samples")).size() + "samples."); - - final QuantitationTree tree = QuantitationTree.getCurrentTree(); - final DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel(); - final DataSetNode[] _quantitationNode = { QuantitationTree.getCurrentTree().createQuantitationNode(_quantiDS.getName()) }; - - // CallBack for Xic Quantitation Service - AbstractJMSCallback quantCallback = new AbstractJMSCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success) { - if (success) { - m_logger.debug(" Quantitation SUCCESS : " + _xicQuantiDataSetId[0]); - QuantitationTree.getCurrentTree().loadDataSet(_xicQuantiDataSetId[0], _quantitationNode[0]); - } else { - m_logger.debug(" Quantitation ERROR "); - treeModel.removeNodeFromParent(_quantitationNode[0]); - } - } - }; - - RunQuantitationTask task = new RunQuantitationTask(quantCallback, pID, _quantiDS.getName(), quantParams, expParams, dialog.getQuantMethodId(), _xicQuantiDataSetId); - AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); - - } //End OK entered - } - - @Override - public void updateEnabled(AbstractNode[] selectedNodes) { - - // to execute this action, the user must be the owner of the project - Project selectedProject = ProjectExplorerPanel.getProjectExplorerPanel().getSelectedProject(); - if (!DatabaseDataManager.getDatabaseDataManager().ownProject(selectedProject)) { - setEnabled(false); - return; - } - - if (m_isFromExistingQuantitation) { - // only one node selected - if (selectedNodes.length != 1) { - setEnabled(false); - return; - } - - AbstractNode node = (AbstractNode) selectedNodes[0]; - - // the node must not be in changing state - if (node.isChanging()) { - setEnabled(false); - return; - } - - // must be a dataset - if (node.getType() != AbstractNode.NodeTypes.DATA_SET) { - setEnabled(false); - return; - } - - DataSetNode datasetNode = (DataSetNode) node; - - // must be a quantitation XIC - if (!datasetNode.isQuantXIC()) { - setEnabled(false); - return; - } - } else { - AbstractNode node = (AbstractNode) selectedNodes[0]; - - // must be a dataset or a project quantitation - if ((node.getType() != AbstractNode.NodeTypes.DATA_SET) && (node.getType() != AbstractNode.NodeTypes.PROJECT_QUANTITATION) ) { - setEnabled(false); - return; - } - - if ((node.getType() == AbstractNode.NodeTypes.DATA_SET) && ((DataSetNode)node).isFolder() ) { - setEnabled(false); - return; - } - - } - - setEnabled(true); - } - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.actions.identification; + +import fr.proline.core.orm.uds.Project; +import fr.proline.core.orm.uds.QuantitationMethod; +import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.core.orm.uds.dto.DDatasetType; +import fr.proline.studio.dam.AccessDatabaseThread; +import fr.proline.studio.dam.DatabaseDataManager; +import fr.proline.studio.dam.data.DataSetData; +import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; +import fr.proline.studio.dam.tasks.SubTask; +import fr.proline.studio.dam.tasks.xic.DatabaseLoadXicMasterQuantTask; +import fr.proline.studio.dpm.AccessJMSManagerThread; +import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; +import fr.proline.studio.dpm.task.jms.RunQuantitationTask; +import fr.proline.studio.gui.DefaultDialog; +import fr.proline.studio.rsmexplorer.gui.ProjectExplorerPanel; +import fr.proline.studio.rsmexplorer.gui.dialog.xic.CreateQuantitationDialog; +import fr.proline.studio.rsmexplorer.tree.quantitation.QuantitationTree; +import fr.proline.studio.rsmexplorer.tree.DataSetNode; +import fr.proline.studio.rsmexplorer.tree.AbstractNode; +import fr.proline.studio.rsmexplorer.tree.AbstractTree; +import fr.proline.studio.rsmexplorer.tree.ChildFactory; +import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; +import java.util.*; +import javax.swing.JOptionPane; +import javax.swing.tree.DefaultTreeModel; + +import fr.proline.studio.WindowManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author JM235353 + */ +public class CreateQuantitationAction extends AbstractRSMAction { + + protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); + + private QuantitationMethod.Type m_quantitationType; + private boolean m_isFromExistingQuantitation = false; + private boolean m_referenceDataSetDefined = false; + + static String getMessage(boolean fromExistingXIC, QuantitationMethod.Type type) { + + switch (type) { + case LABEL_FREE: { + if (fromExistingXIC) { + return "Clone & Extract Abundances..."; + } else { + return "Label Free..."; + } + } + case RESIDUE_LABELING: return "Residue Labeling..."; + case ISOBARIC_TAGGING: return "Isobaric Labeling..."; + + } + return "unknown"; + } + + public CreateQuantitationAction(AbstractTree tree, boolean fromExistingXIC) { + super(CreateQuantitationAction.getMessage(fromExistingXIC, QuantitationMethod.Type.LABEL_FREE), tree); + // warn : at this time cloning is only supported for LABEL FREE quantitations + m_quantitationType = QuantitationMethod.Type.LABEL_FREE; + m_isFromExistingQuantitation = fromExistingXIC; + } + + public CreateQuantitationAction(AbstractTree tree, QuantitationMethod.Type type) { + super(CreateQuantitationAction.getMessage(false, type), tree); + m_quantitationType = type; + m_isFromExistingQuantitation = false; + } + + @Override + public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { + + if (ProjectExplorerPanel.getProjectExplorerPanel().getSelectedProject() == null) { + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "A project should be selected !", "Warning", JOptionPane.ERROR_MESSAGE); + return; + } + + if (m_isFromExistingQuantitation) { + final DDataset currentDataset = ((DataSetData) ((DataSetNode) selectedNodes[0]).getData()).getDataset(); + final int posx = x; + final int posy = y; + + AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success, long taskId, SubTask subTask, boolean finished) { + createQuantitationDialog(currentDataset, posx, posy); + } + }; + DatabaseLoadXicMasterQuantTask task = new DatabaseLoadXicMasterQuantTask(callback); + task.initLoadQuantChannels(ProjectExplorerPanel.getProjectExplorerPanel().getSelectedProject().getId(), currentDataset); + AccessDatabaseThread.getAccessDatabaseThread().addTask(task); + + } else { + AbstractNode n = selectedNodes[0]; + DDataset refDataset = null; + if (!n.isRoot() && DataSetNode.class.isInstance(n)) { + DataSetNode node = (DataSetNode) n; + DataSetData dataset = (DataSetData) node.getData(); + DDatasetType dsType = dataset.getDatasetType(); + if (node.hasResultSummary() && (dsType.isAggregation() || dsType.isIdentification())) { + m_referenceDataSetDefined = true; + refDataset = dataset.getDataset(); + } else { + m_referenceDataSetDefined = false; + } + } + createQuantitationDialog(refDataset, x, y); + } + } + + private void createQuantitationDialog(DDataset dataset, int x, int y) { + Long pID = ProjectExplorerPanel.getProjectExplorerPanel().getSelectedProject().getId(); + CreateQuantitationDialog dialog = CreateQuantitationDialog.getDialog(WindowManager.getDefault().getMainWindow()); + IdentificationTree childTree = null; + DDataset refDataset = null; + DDataset existingDataset = (m_isFromExistingQuantitation) ? dataset : null; + + if (m_referenceDataSetDefined) { + childTree = IdentificationTree.getCurrentTree().copyDataSetRootSubTree(dataset, dataset.getProject().getId()); + refDataset = dataset; + } else if (existingDataset != null && existingDataset.getMasterQuantitationChannels().get(0).getIdentDataset() != null) { + refDataset = dataset.getMasterQuantitationChannels().get(0).getIdentDataset(); + childTree = IdentificationTree.getCurrentTree().copyDataSetRootSubTree(refDataset, refDataset.getProject().getId()); + if (childTree == null) { + m_logger.debug("Reference dataset not already loaded: creates a new node to display in a new IdentificationTree"); + childTree = new IdentificationTree(ChildFactory.createNode(new DataSetData(refDataset))); + } + } + + dialog.initializeExperimentalDesignTree(existingDataset, refDataset, childTree, m_quantitationType); + + dialog.setLocation(x, y); + dialog.setVisible(true); + final Long[] _xicQuantiDataSetId = new Long[1]; + + if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { + + //User specified experimental design dataset + DataSetData _quantiDS = null; + Map expParams = null; + + StringBuffer errorMsg = new StringBuffer(""); + + Map quantParams = dialog.getQuantiParameters(); + if (quantParams == null) { + errorMsg.append("Null Quantitation parameters ! "); + } + + if (dialog.getQuantitationDataset() == null) { + errorMsg.append("No experimental design defined "); + + } else { + + String registerErrMsg = dialog.registerRawFiles(); + if(registerErrMsg != null && !registerErrMsg.isEmpty()) + errorMsg.append( registerErrMsg); + + //*** Get experimental design values + _quantiDS = dialog.getQuantitationDataset(); + + try { + expParams = dialog.getExperimentalDesignParameters(); + } catch (IllegalAccessException iae) { + errorMsg.append(iae.getMessage()); + } + } + + if (!errorMsg.toString().isEmpty()) { + JOptionPane.showMessageDialog(dialog, errorMsg, "Warning", JOptionPane.ERROR_MESSAGE); + return; + } + + m_logger.debug(" Will Compute Quantitation on " + ((List) expParams.get("biological_samples")).size() + "samples."); + + final QuantitationTree tree = QuantitationTree.getCurrentTree(); + final DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel(); + final DataSetNode[] _quantitationNode = { QuantitationTree.getCurrentTree().createQuantitationNode(_quantiDS.getName()) }; + + // CallBack for Xic Quantitation Service + AbstractJMSCallback quantCallback = new AbstractJMSCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success) { + if (success) { + m_logger.debug(" Quantitation SUCCESS : " + _xicQuantiDataSetId[0]); + QuantitationTree.getCurrentTree().loadDataSet(_xicQuantiDataSetId[0], _quantitationNode[0]); + } else { + m_logger.debug(" Quantitation ERROR "); + treeModel.removeNodeFromParent(_quantitationNode[0]); + } + } + }; + + RunQuantitationTask task = new RunQuantitationTask(quantCallback, pID, _quantiDS.getName(), quantParams, expParams, dialog.getQuantMethodId(), _xicQuantiDataSetId); + AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); + + } //End OK entered + } + + @Override + public void updateEnabled(AbstractNode[] selectedNodes) { + + // to execute this action, the user must be the owner of the project + Project selectedProject = ProjectExplorerPanel.getProjectExplorerPanel().getSelectedProject(); + if (!DatabaseDataManager.getDatabaseDataManager().ownProject(selectedProject)) { + setEnabled(false); + return; + } + + if (m_isFromExistingQuantitation) { + // only one node selected + if (selectedNodes.length != 1) { + setEnabled(false); + return; + } + + AbstractNode node = (AbstractNode) selectedNodes[0]; + + // the node must not be in changing state + if (node.isChanging()) { + setEnabled(false); + return; + } + + // must be a dataset + if (node.getType() != AbstractNode.NodeTypes.DATA_SET) { + setEnabled(false); + return; + } + + DataSetNode datasetNode = (DataSetNode) node; + + // must be a quantitation XIC + if (!datasetNode.isQuantXIC()) { + setEnabled(false); + return; + } + } else { + AbstractNode node = (AbstractNode) selectedNodes[0]; + + // must be a dataset or a project quantitation + if ((node.getType() != AbstractNode.NodeTypes.DATA_SET) && (node.getType() != AbstractNode.NodeTypes.PROJECT_QUANTITATION) ) { + setEnabled(false); + return; + } + + if ((node.getType() == AbstractNode.NodeTypes.DATA_SET) && ((DataSetNode)node).isFolder() ) { + setEnabled(false); + return; + } + + } + + setEnabled(true); + } + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DeleteAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DeleteAction.java index 28137dd72..74214b69d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DeleteAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DeleteAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.Project; @@ -27,7 +27,7 @@ import java.util.Enumeration; import java.util.HashSet; import java.util.Iterator; -import org.openide.util.NbBundle; + /** * Delete a dataset Action @@ -37,7 +37,7 @@ public class DeleteAction extends AbstractRSMAction { public DeleteAction(AbstractTree tree) { - super(NbBundle.getMessage(DeleteAction.class, "CTL_DeleteAction"), tree); + super("Delete", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayAdjacencyMatrixAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayAdjacencyMatrixAction.java index c57442f9a..e81a9ba40 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayAdjacencyMatrixAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayAdjacencyMatrixAction.java @@ -1,23 +1,24 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.data.DataSetData; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; @@ -25,11 +26,11 @@ import fr.proline.studio.dam.tasks.SubTask; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; import fr.proline.studio.rsmexplorer.tree.AbstractNode; -import org.openide.util.NbBundle; + /** @@ -39,7 +40,7 @@ public class DisplayAdjacencyMatrixAction extends AbstractRSMAction { public DisplayAdjacencyMatrixAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayAdjacencyMatrixAction.class, "CTL_DisplayAdjacencyMatrixAction"), tree); + super("Adjacency Matrix", tree); } @Override @@ -71,18 +72,16 @@ private void actionImpl(DataSetNode dataSetNode) { // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } else { // we have to load the result summary final WindowBox wbox = WindowBoxFactory.getAdjacencyMatrixWindowBox(dataset.getName(), false); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayAllRsetAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayAllRsetAction.java index 10e6f8150..209a7a015 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayAllRsetAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayAllRsetAction.java @@ -1,32 +1,29 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.Project; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.rsmexplorer.tree.identification.IdProjectIdentificationNode; import fr.proline.studio.rsmexplorer.tree.AbstractTree; -import java.util.Set; -import org.openide.util.NbBundle; -import org.openide.windows.TopComponent; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; /** * Action to display a window with all Search Results (rset) @@ -35,7 +32,7 @@ public class DisplayAllRsetAction extends AbstractRSMAction { public DisplayAllRsetAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayAllRsetAction.class, "CTL_DisplayAllRset"), tree); + super("Display List", tree); } @Override @@ -50,21 +47,21 @@ public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { String windowName = p.getName()+" : All Imported"; - TopComponent tc = findTopComponent(windowName); - if (tc != null) { - tc.requestActive(); + boolean displayed = WindowManager.getDefault().getMainWindow().isDisplayed(windowName); + if (displayed) { + WindowManager.getDefault().getMainWindow().toFront(windowName); } else { - // prepare window box WindowBox wbox = WindowBoxFactory.getAllResultSetWindowBox(windowName); wbox.setEntryData(p.getId(), p); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + + WindowManager.getDefault().getMainWindow().displayWindow(win); } + } @Override @@ -72,15 +69,6 @@ public void updateEnabled(AbstractNode[] selectedNodes) { setEnabled(true); //JPM.TODO } - - private TopComponent findTopComponent(String name) { - Set openTopComponents = WindowManager.getDefault().getRegistry().getOpened(); - for (TopComponent tc : openTopComponents) { - if (tc.getName().startsWith(name)) { - return tc; - } - } - return null; - } + } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayMSQueryAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayMSQueryAction.java index fcd283c3d..0937074f1 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayMSQueryAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayMSQueryAction.java @@ -1,24 +1,25 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.msi.ResultSet; import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.data.DataSetData; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; @@ -26,11 +27,11 @@ import fr.proline.studio.dam.tasks.SubTask; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import org.openide.util.NbBundle; + /** * Action to display all msQueries for a given resultSet @@ -39,7 +40,7 @@ public class DisplayMSQueryAction extends AbstractRSMAction { public DisplayMSQueryAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayMSQueryAction.class, "CTL_DisplayMSQueryAction"), tree); + super("MSQueries", tree); } @Override @@ -74,9 +75,8 @@ private void actionImpl(DataSetNode dataSetNode) { wbox.setEntryData(dataSet.getProject().getId(), rsm); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } else { @@ -98,9 +98,8 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) WindowBox wbox = WindowBoxFactory.getMSQueriesWindowBoxForRsm(dataSet.getName(), mergedData); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); // prepare window box wbox.setEntryData(dataSet.getProject().getId(), rsm); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayMSQueryForRsetAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayMSQueryForRsetAction.java index 71518c896..63ab8f7cd 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayMSQueryForRsetAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayMSQueryForRsetAction.java @@ -1,23 +1,24 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.msi.ResultSet; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.data.DataSetData; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; @@ -25,11 +26,11 @@ import fr.proline.studio.dam.tasks.SubTask; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import org.openide.util.NbBundle; + /** * Action to display all msQueries for a given resultSet @@ -38,7 +39,7 @@ public class DisplayMSQueryForRsetAction extends AbstractRSMAction { public DisplayMSQueryForRsetAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayMSQueryForRsetAction.class, "CTL_DisplayMSQueryAction"), tree); + super("MSQueries", tree); } @Override @@ -72,9 +73,8 @@ private void actionImpl(DataSetNode dataSetNode) { wbox.setEntryData(dataSet.getProject().getId(), rset); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } else { @@ -95,9 +95,8 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) WindowBox wbox = WindowBoxFactory.getMSQueriesWindowBoxForRset(dataSet.getName(), mergedData); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); // prepare window box wbox.setEntryData(dataSet.getProject().getId(), rset); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayPTMClustersAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayPTMClustersAction.java index c9b299263..32a7193d6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayPTMClustersAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayPTMClustersAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,121 +16,38 @@ */ package fr.proline.studio.rsmexplorer.actions.identification; -import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.studio.dam.AccessDatabaseThread; -import fr.proline.studio.dam.data.DataSetData; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; -import fr.proline.studio.dam.tasks.DatabaseDataSetTask; -import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.dam.tasks.data.ptm.PTMDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; -import fr.proline.studio.rsmexplorer.tree.AbstractNode; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; +import fr.proline.studio.rsmexplorer.actions.AbstractDisplayPTMDataAction; import fr.proline.studio.rsmexplorer.tree.AbstractTree; -import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import org.openide.util.NbBundle; + /** * * @author JM235353 */ -public class DisplayPTMClustersAction extends AbstractRSMAction { +public class DisplayPTMClustersAction extends AbstractDisplayPTMDataAction { - public DisplayPTMClustersAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayPTMSitesAction.class, "CTL_PtmClusterProtein"), tree); + public DisplayPTMClustersAction(boolean isAnnotated, AbstractTree tree) { + super(false, isAnnotated, tree); } - - @Override - public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { - int nbNodes = selectedNodes.length; - for (int i = 0; i < nbNodes; i++) { - DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; - actionImpl(dataSetNode); - } + public DisplayPTMClustersAction(AbstractTree tree) { + super(false, tree); } - - private void actionImpl(DataSetNode dataSetNode) { - - final DDataset dataSet = ((DataSetData) dataSetNode.getData()).getDataset(); - - if (!dataSetNode.hasResultSummary()) { - return; // should not happen - } - - ResultSummary rsm = dataSetNode.getResultSummary(); - if (rsm != null) { - - // prepare window box - WindowBox wbox = WindowBoxFactory.getPTMDataWindowBox(dataSet.getName(), false); - wbox.setEntryData(dataSet.getProject().getId(), new PTMDataset(dataSet)); - - // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); - } else { - - - // we have to load the result set - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - @Override - public boolean mustBeCalledInAWT() { - return true; - } + protected void loadWindowBox(DDataset dataSet, Object data, boolean unsaved){ + WindowBox wbox = WindowBoxFactory.getPTMDataWindowBox(dataSet.getName(), false, isAnnotatedPTMsAction(), unsaved); + wbox.setEntryData(dataSet.getProject().getId(), data); - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - - WindowBox wbox = WindowBoxFactory.getPTMDataWindowBox(dataSet.getName(), false); - // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); - - // prepare window box - wbox.setEntryData(dataSet.getProject().getId(), new PTMDataset(dataSet)); - } - }; + // open a window to display the window box + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); - - // ask asynchronous loading of data - DatabaseDataSetTask task = new DatabaseDataSetTask(callback); - task.initLoadRsetAndRsm(dataSet); - AccessDatabaseThread.getAccessDatabaseThread().addTask(task); - } } - - - @Override - public void updateEnabled(AbstractNode[] selectedNodes) { - int nbSelectedNodes = selectedNodes.length; - - if (nbSelectedNodes <0) { - setEnabled(false); - return; - } - - for (int i=0;i. + */ +package fr.proline.studio.rsmexplorer.actions.identification; + +import fr.proline.studio.rsmexplorer.tree.AbstractNode; +import fr.proline.studio.rsmexplorer.tree.AbstractTree; + +import javax.swing.*; + + +/** + * Action for the menu to display data for Modifications Data + * @author JM235353 + */ +public class DisplayPTMRsmAction extends AbstractRSMAction { + + + private DisplayPTMSitesAction m_displayPtmSiteProtein; + private DisplayPTMClustersAction m_displayPtmClusterProtein; + + private DisplayPTMClustersAction m_displayAnnotatedPtmClusterProtein; + + + + private JMenu m_menu; + + public DisplayPTMRsmAction(AbstractTree tree) { + super("Display Modifications ", tree); + } + + @Override + public JMenuItem getPopupPresenter() { + m_menu = new JMenu((String) getValue(NAME)); + m_displayPtmSiteProtein = new DisplayPTMSitesAction(getTree()); + m_displayPtmClusterProtein = new DisplayPTMClustersAction(getTree()); + m_displayAnnotatedPtmClusterProtein = new DisplayPTMClustersAction(true , getTree()); + + JMenuItem displayPtmSiteProteinItem = new JMenuItem(m_displayPtmSiteProtein); + JMenuItem displayPtmClusterProteinItem = new JMenuItem(m_displayPtmClusterProtein); + JMenuItem displayAnnotatedPtmClusterProteinItem = new JMenuItem(m_displayAnnotatedPtmClusterProtein); + + m_menu.add(displayPtmSiteProteinItem); + m_menu.add(displayPtmClusterProteinItem); + m_menu.addSeparator(); + m_menu.add(displayAnnotatedPtmClusterProteinItem); + + return m_menu; + } + + @Override + public void updateEnabled(AbstractNode[] selectedNodes) { + m_displayPtmSiteProtein.updateEnabled(selectedNodes); + m_displayPtmClusterProtein.updateEnabled(selectedNodes); + m_displayAnnotatedPtmClusterProtein.updateEnabled(selectedNodes); + + boolean isEnabled = m_displayPtmClusterProtein.isEnabled() || m_displayAnnotatedPtmClusterProtein.isEnabled() || m_displayPtmSiteProtein.isEnabled(); + setEnabled(isEnabled); + m_menu.setEnabled(isEnabled); + } +} \ No newline at end of file diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayPTMSitesAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayPTMSitesAction.java index abfb906a9..f69bd94e2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayPTMSitesAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayPTMSitesAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,241 +16,38 @@ */ package fr.proline.studio.rsmexplorer.actions.identification; -import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.studio.dam.AccessDatabaseThread; -import fr.proline.studio.dam.data.DataSetData; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; -import fr.proline.studio.dam.tasks.DatabaseDataSetTask; -import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.dam.tasks.data.ptm.PTMDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; -import fr.proline.studio.rsmexplorer.tree.AbstractNode; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; +import fr.proline.studio.rsmexplorer.actions.AbstractDisplayPTMDataAction; import fr.proline.studio.rsmexplorer.tree.AbstractTree; -import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import org.openide.util.NbBundle; /** * * @author JM235353 */ -public class DisplayPTMSitesAction extends AbstractRSMAction { +public class DisplayPTMSitesAction extends AbstractDisplayPTMDataAction { - public DisplayPTMSitesAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayPTMSitesAction.class, "CTL_PtmSiteProtein"), tree); + public DisplayPTMSitesAction(boolean isAnnotated, AbstractTree tree) { + super(true, isAnnotated, tree); } - - @Override - public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { - int nbNodes = selectedNodes.length; - for (int i = 0; i < nbNodes; i++) { - DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; - actionImpl(dataSetNode); - } + public DisplayPTMSitesAction(AbstractTree tree) { + super(true, tree); } - private void actionImpl(DataSetNode dataSetNode) { - - final DDataset dataSet = ((DataSetData) dataSetNode.getData()).getDataset(); - - if (!dataSetNode.hasResultSummary()) { - return; // should not happen - } - - ResultSummary rsm = dataSetNode.getResultSummary(); - if (rsm != null) { - - // prepare window box - WindowBox wbox = WindowBoxFactory.getPTMDataWindowBox(dataSet.getName(), true); - wbox.setEntryData(dataSet.getProject().getId(), new PTMDataset(dataSet)); - - // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); - } else { - - - // we have to load the result set - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - @Override - public boolean mustBeCalledInAWT() { - return true; - } + protected void loadWindowBox(DDataset ds, Object data, boolean unsaved){ + WindowBox wbox = WindowBoxFactory.getPTMDataWindowBox(ds.getName(), true, isAnnotatedPTMsAction(),unsaved); - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { + // open a window to display the window box + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); - WindowBox wbox = WindowBoxFactory.getPTMDataWindowBox(dataSet.getName(), true); - - // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); - - // prepare window box - wbox.setEntryData(dataSet.getProject().getId(), new PTMDataset(dataSet)); - } - }; - - - // ask asynchronous loading of data - DatabaseDataSetTask task = new DatabaseDataSetTask(callback); - task.initLoadRsetAndRsm(dataSet); - AccessDatabaseThread.getAccessDatabaseThread().addTask(task); - } + // prepare window box + wbox.setEntryData(ds.getProject().getId(), data); } -// @Override -// public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { -//// int answer= JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), "Do you want to view Protein Sites V2 ?"); -// DisplayPTMSiteDialog dialog = new DisplayPTMSiteDialog(WindowManager.getDefault().getMainWindow()); -// dialog.setLocation(x, y); -// dialog.setVisible(true); -// if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { -// int nbNodes = selectedNodes.length; -// for (int i = 0; i < nbNodes; i++) { -// DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; -// -// actionImpl(dataSetNode, dialog.getServiceVersion()); -// } -// } -// } - -// private void actionImpl(DataSetNode dataSetNode, String serviceVersion) { -// -// final DDataset dataSet = ((DataSetData) dataSetNode.getData()).getDataset(); -// -// if (!dataSetNode.hasResultSummary()) { -// return; // should not happen -// } -// -// ResultSummary rsm = dataSetNode.getResultSummary(); -// if (rsm != null) { -// -// // prepare window box -// WindowBox wbox; -// if (serviceVersion.equals("2.0")) { -// wbox = WindowBoxFactory.getPTMSitesWindowBoxV2(dataSet.getName()); -// } else { -// wbox = WindowBoxFactory.getPTMSitesWindowBoxV1(dataSet.getName()); -// } -// wbox.setEntryData(dataSet.getProject().getId(), new PTMDataset(dataSet)); -// -// // open a window to display the window box -// DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); -// win.open(); -// win.requestActive(); -// } else { -// -// -// // we have to load the result set -// AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { -// -// @Override -// public boolean mustBeCalledInAWT() { -// return true; -// } -// -// @Override -// public void run(boolean success, long taskId, SubTask subTask, boolean finished) { -// -// WindowBox wbox ; -// if (serviceVersion.equals("2.0")) { -// wbox = WindowBoxFactory.getPTMSitesWindowBoxV2(dataSet.getName()); -// } else if (serviceVersion.equals("2.1")) { -// wbox = WindowBoxFactory.getPTMDataWindowBox(dataSet.getName(), true); -// } else { -// wbox = WindowBoxFactory.getPTMSitesWindowBoxV1(dataSet.getName()); -// } -// // open a window to display the window box -// DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); -// win.open(); -// win.requestActive(); -// -// // prepare window box -// wbox.setEntryData(dataSet.getProject().getId(), new PTMDataset(dataSet)); -// } -// }; -// -// -// // ask asynchronous loading of data -// DatabaseDataSetTask task = new DatabaseDataSetTask(callback); -// task.initLoadRsetAndRsm(dataSet); -// AccessDatabaseThread.getAccessDatabaseThread().addTask(task); -// } -// } - - - @Override - public void updateEnabled(AbstractNode[] selectedNodes) { - int nbSelectedNodes = selectedNodes.length; - - - if (nbSelectedNodes <0) { - setEnabled(false); - return; - } - - for (int i=0;i m_serviceVersionCbx; -// -// public DisplayPTMSiteDialog(Window parent){ -// super(parent, Dialog.ModalityType.APPLICATION_MODAL); -// setTitle("Display Modification Sites"); -// setHelpHeaderText("Select the version of PTMs identification service that was used: \n
"+ -// " • v1.0 a list of all identified sites was generated \n
"+ -// " • v2.0 a PTMs Dataset in which sites are clusterized has been generated.\n
"); -// initInternalPanel(); -// pack(); -// } -// -// private void initInternalPanel() { -// JPanel internalPanel = new JPanel(); -// internalPanel.setLayout(new java.awt.GridBagLayout()); -// GridBagConstraints c = new GridBagConstraints(); -// c.anchor = GridBagConstraints.NORTHWEST; -// c.fill = GridBagConstraints.HORIZONTAL; -// c.insets = new java.awt.Insets(15, 15, 15, 15); -// c.gridx = 0; -// c.gridy = 0; -// -// JLabel label = new JLabel("Service version:"); -// internalPanel.add(label, c); -// String[] versions = new String[] {"Modification Sites (v1.0)", "PTMs Dataset (v2.0)", "Sites as Clusters (v2.1)"}; -// m_serviceVersionCbx = new JComboBox(versions); -// c.gridx++; -// internalPanel.add(m_serviceVersionCbx, c); -// setInternalComponent(internalPanel); -// } -// -// public String getServiceVersion() { -// String selectedOption = m_serviceVersionCbx.getItemAt(m_serviceVersionCbx.getSelectedIndex()); -// return selectedOption.contains("2.0") ? "2.0" : selectedOption.contains("2.1") ? "2.1" : "1.0"; -// } -// -// } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsetAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsetAction.java index 4f8f401f1..6116317f9 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsetAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsetAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.studio.pattern.WindowSavedManager; @@ -23,7 +23,7 @@ import java.util.ArrayList; import javax.swing.JMenu; import javax.swing.JMenuItem; -import org.openide.util.NbBundle; + /** * Action with a Menu for the Display of Rset (Search Result) @@ -42,7 +42,7 @@ public class DisplayRsetAction extends AbstractRSMAction { private JMenu m_menu; public DisplayRsetAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayRsetAction.class, "CTL_DisplayRsetAction"), tree); + super("Display Search Result", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsetPeptidesAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsetPeptidesAction.java index 2f55f72ca..a4a81e904 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsetPeptidesAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsetPeptidesAction.java @@ -1,25 +1,26 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.msi.ResultSet; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.data.DataSetData; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; @@ -27,11 +28,11 @@ import fr.proline.studio.dam.tasks.SubTask; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; import fr.proline.studio.rsmexplorer.tree.AbstractNode; -import org.openide.util.NbBundle; + /** * Display PSM of Search Result (rset) @@ -42,7 +43,7 @@ public class DisplayRsetPeptidesAction extends AbstractRSMAction { //private static ProteinGroupsAction instance = null; public DisplayRsetPeptidesAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayRsetPeptidesAction.class, "CTL_DisplayPeptidesAction"), tree); + super("PSMs", tree); } @Override @@ -82,9 +83,8 @@ private void actionImpl(DataSetNode dataSetNode) { // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } else { @@ -107,9 +107,8 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) final WindowBox wbox = (hasResultSummary) ? WindowBoxFactory.getPeptidesWindowBox(dataSet.getName(), false, mergedData) : WindowBoxFactory.getPeptidesForRsetOnlyWindowBox(dataSet.getName(), false, mergedData); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); wbox.setEntryData(dataSet.getProject().getId(), rset); } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsetProteinMatchesAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsetProteinMatchesAction.java index eb97a772b..709c18b29 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsetProteinMatchesAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsetProteinMatchesAction.java @@ -1,25 +1,26 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.msi.ResultSet; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.data.DataSetData; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; @@ -27,11 +28,11 @@ import fr.proline.studio.dam.tasks.SubTask; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; import fr.proline.studio.rsmexplorer.tree.AbstractNode; -import org.openide.util.NbBundle; + /** * Display Protein Matches of a Search Result (rset) @@ -40,7 +41,7 @@ public class DisplayRsetProteinMatchesAction extends AbstractRSMAction { public DisplayRsetProteinMatchesAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayRsetPeptidesAction.class, "CTL_DisplayProteinMatchesAction"), tree); + super("Proteins", tree); } @Override @@ -78,9 +79,8 @@ private void actionImpl(DataSetNode dataSetNode) { // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } else { @@ -102,9 +102,8 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) WindowBox wbox = WindowBoxFactory.getProteinMatchesForRsetWindowBox(dataSet.getName(), false, mergedData); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); // prepare window box wbox.setEntryData(dataSet.getProject().getId(), rset); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmAction.java index dd3b3b2a0..c77d492d2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.studio.pattern.WindowSavedManager; @@ -23,7 +23,7 @@ import java.util.ArrayList; import javax.swing.JMenu; import javax.swing.JMenuItem; -import org.openide.util.NbBundle; + /** * Action for the menu to display data for Identification Summary @@ -34,8 +34,8 @@ public class DisplayRsmAction extends AbstractRSMAction { private DisplayRsmPSMAction m_displayRsmPSMAction; private DisplayRsmPeptidesAction m_displayRsmPeptidesAction; private DisplayRsmProteinSetsAction m_displayRsmProteinSetsAction; - private DisplayPTMSitesAction m_displayPtmSiteProtein; - private DisplayPTMClustersAction m_displayPtmClusterProtein; +// private DisplayPTMSitesAction m_displayPtmSiteProtein; +// private DisplayPTMClustersAction m_displayPtmClusterProtein; private DisplayAdjacencyMatrixAction m_displayAdjacencyMatrixAction; @@ -48,7 +48,7 @@ public class DisplayRsmAction extends AbstractRSMAction { private JMenu m_menu; public DisplayRsmAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayRsmAction.class, "CTL_DisplayRsmAction"), tree); + super("Display Identification Summary", tree); } @Override @@ -59,8 +59,8 @@ public JMenuItem getPopupPresenter() { m_displayRsmPSMAction = new DisplayRsmPSMAction(getTree()); m_displayRsmPeptidesAction = new DisplayRsmPeptidesAction(getTree()); m_displayRsmProteinSetsAction = new DisplayRsmProteinSetsAction(getTree()); - m_displayPtmSiteProtein = new DisplayPTMSitesAction(getTree()); - m_displayPtmClusterProtein = new DisplayPTMClustersAction(getTree()); +// m_displayPtmSiteProtein = new DisplayPTMSitesAction(getTree()); +// m_displayPtmClusterProtein = new DisplayPTMClustersAction(getTree()); m_displayAdjacencyMatrixAction = new DisplayAdjacencyMatrixAction(getTree()); @@ -84,8 +84,8 @@ public JMenuItem getPopupPresenter() { JMenuItem displayRsmPSMItem = new JMenuItem(m_displayRsmPSMAction); JMenuItem displayRsmPeptidesItem = new JMenuItem(m_displayRsmPeptidesAction); JMenuItem displayRsmProteinSetsItem = new JMenuItem(m_displayRsmProteinSetsAction); - JMenuItem displayPtmSiteProteinItem = new JMenuItem(m_displayPtmSiteProtein); - JMenuItem displayPtmClusterProteinItem = new JMenuItem(m_displayPtmClusterProtein); +// JMenuItem displayPtmSiteProteinItem = new JMenuItem(m_displayPtmSiteProtein); +// JMenuItem displayPtmClusterProteinItem = new JMenuItem(m_displayPtmClusterProtein); JMenuItem displayAdjacencyMatrixItem = new JMenuItem(m_displayAdjacencyMatrixAction); JMenuItem displayUserWindowItem = new JMenuItem(m_displayUserWindowAction); JMenuItem manageUserWindowsItem = new JMenuItem(m_manageUserWindowsAction); @@ -96,9 +96,9 @@ public JMenuItem getPopupPresenter() { m_menu.add(displayRsmProteinSetsItem); m_menu.add(displayAdjacencyMatrixItem); m_menu.addSeparator(); - m_menu.add(displayPtmSiteProteinItem); - m_menu.add(displayPtmClusterProteinItem); - m_menu.addSeparator(); +// m_menu.add(displayPtmSiteProteinItem); +// m_menu.add(displayPtmClusterProteinItem); +// m_menu.addSeparator(); m_menu.add(displayUserWindowItem); m_menu.add(manageUserWindowsItem); int nbUserWindows = m_displaySavedWindowActionList.size(); @@ -118,8 +118,8 @@ public void updateEnabled(AbstractNode[] selectedNodes) { m_displayRsmPSMAction.updateEnabled(selectedNodes); m_displayRsmPeptidesAction.updateEnabled(selectedNodes); m_displayRsmProteinSetsAction.updateEnabled(selectedNodes); - m_displayPtmSiteProtein.updateEnabled(selectedNodes); - m_displayPtmClusterProtein.updateEnabled(selectedNodes); +// m_displayPtmSiteProtein.updateEnabled(selectedNodes); +// m_displayPtmClusterProtein.updateEnabled(selectedNodes); m_displayAdjacencyMatrixAction.updateEnabled(selectedNodes); m_displayUserWindowAction.updateEnabled(selectedNodes); m_manageUserWindowsAction.updateEnabled(selectedNodes); @@ -131,7 +131,7 @@ public void updateEnabled(AbstractNode[] selectedNodes) { listEnabled |= m_displaySavedWindowActionList.get(i).isEnabled(); } - boolean isEnabled = m_displayRsmPSMAction.isEnabled() || m_displayRsmPeptidesAction.isEnabled() || m_displayPtmClusterProtein.isEnabled() || m_displayRsmProteinSetsAction.isEnabled()|| m_displayPtmSiteProtein.isEnabled() || m_displayMSQueryAction.isEnabled() || m_displayUserWindowAction.isEnabled()|| m_manageUserWindowsAction.isEnabled() || listEnabled; + boolean isEnabled = m_displayRsmPSMAction.isEnabled() || m_displayRsmPeptidesAction.isEnabled() ||/* m_displayPtmClusterProtein.isEnabled() || */m_displayRsmProteinSetsAction.isEnabled()|| /*m_displayPtmSiteProtein.isEnabled() || */m_displayMSQueryAction.isEnabled() || m_displayUserWindowAction.isEnabled()|| m_manageUserWindowsAction.isEnabled() || listEnabled; setEnabled(isEnabled); m_menu.setEnabled(isEnabled); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmPSMAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmPSMAction.java index 21500da22..a5da1a0e9 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmPSMAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmPSMAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; @@ -21,6 +21,7 @@ import fr.proline.core.orm.msi.ResultSet; import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.data.DataSetData; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; @@ -28,11 +29,11 @@ import fr.proline.studio.dam.tasks.SubTask; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; import fr.proline.studio.rsmexplorer.tree.AbstractNode; -import org.openide.util.NbBundle; + /** * Display PSM of Identification Summary (Rsm) @@ -41,7 +42,7 @@ public class DisplayRsmPSMAction extends AbstractRSMAction { public DisplayRsmPSMAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayRsmPeptidesAction.class, "CTL_DisplayRsmPSMAction"), tree); + super("PSMs", tree); } @Override @@ -78,9 +79,8 @@ private void actionImpl(DataSetNode dataSetNode) { wbox.setEntryData(dataSet.getProject().getId(), rsm); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } else { @@ -104,9 +104,8 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) final WindowBox wbox = WindowBoxFactory.getRsmPSMWindowBox(dataSet.getName(), false, mergedData); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); // prepare window box wbox.setEntryData(dataSet.getProject().getId(), rsm); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmPeptidesAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmPeptidesAction.java index cca4987c9..36c413804 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmPeptidesAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmPeptidesAction.java @@ -1,25 +1,26 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.data.DataSetData; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; @@ -27,11 +28,11 @@ import fr.proline.studio.dam.tasks.SubTask; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; import fr.proline.studio.rsmexplorer.tree.AbstractNode; -import org.openide.util.NbBundle; + /** * @@ -40,7 +41,7 @@ public class DisplayRsmPeptidesAction extends AbstractRSMAction { public DisplayRsmPeptidesAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayRsmPeptidesAction.class, "CTL_DisplayRsmPeptidesAction"), tree); + super("Peptides", tree); } @Override @@ -73,16 +74,14 @@ private void actionImpl(DataSetNode dataSetNode) { wbox.setEntryData(dataSet.getProject().getId(), rsm); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } else { final WindowBox wbox = WindowBoxFactory.getRsmPeptidesWindowBox(dataSet.getName(), false); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); // we have to load the result set AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmProteinSetsAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmProteinSetsAction.java index 86eacc71f..3f3088093 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmProteinSetsAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplayRsmProteinSetsAction.java @@ -1,23 +1,24 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.data.DataSetData; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; @@ -25,11 +26,11 @@ import fr.proline.studio.dam.tasks.SubTask; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; import fr.proline.studio.rsmexplorer.tree.AbstractNode; -import org.openide.util.NbBundle; + /** * Display Protein Sets of an Identification Summary (rsm) @@ -38,7 +39,7 @@ public class DisplayRsmProteinSetsAction extends AbstractRSMAction { public DisplayRsmProteinSetsAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayRsmProteinSetsAction.class, "CTL_DisplayProteinSetsAction"), tree); + super("Protein Sets", tree); } @Override @@ -71,18 +72,16 @@ private void actionImpl(DataSetNode dataSetNode) { // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } else { // we have to load the result summary final WindowBox wbox = WindowBoxFactory.getProteinSetsWindowBox(dataset.getName(), false); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplaySavedWindowAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplaySavedWindowAction.java index 162ffdf86..cc4ebd368 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplaySavedWindowAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/DisplaySavedWindowAction.java @@ -1,215 +1,215 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.actions.identification; - -import fr.proline.core.orm.msi.ResultSet; -import fr.proline.core.orm.msi.ResultSummary; -import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.studio.dam.AccessDatabaseThread; -import fr.proline.studio.dam.data.DataSetData; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; -import fr.proline.studio.dam.tasks.DatabaseDataSetTask; -import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.pattern.AbstractDataBox; -import fr.proline.studio.pattern.WindowBox; -import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.pattern.WindowSavedManager; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; -import fr.proline.studio.rsmexplorer.tree.AbstractNode; -import fr.proline.studio.rsmexplorer.tree.AbstractTree; -import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import java.util.ArrayList; -import java.util.prefs.Preferences; -import org.openide.util.NbPreferences; - -/** - * - * @author JM235353 - */ -public class DisplaySavedWindowAction extends AbstractRSMAction { - - private int m_wndIndex; - - public DisplaySavedWindowAction(String name, int wndIndex, AbstractTree tree) { - super(name, tree); - m_wndIndex = wndIndex; - } - - @Override - public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { - - ArrayList savedWindowsList = WindowSavedManager.readSavedWindows(); - if (savedWindowsList.isEmpty()) { - return; - } - - String savedWindow = savedWindowsList.get(m_wndIndex); - - char windowType = WindowSavedManager.getWindowType(savedWindow); - String windowName = WindowSavedManager.getWindowName(savedWindow); - - int nbNodes = selectedNodes.length; - for (int i = 0; i < nbNodes; i++) { - DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; - - actionImpl(windowName, savedWindow, dataSetNode, windowType); - } - } - - private void actionImpl(String windowName, String savedWindow, DataSetNode dataSetNode, char windowType) { - - final DDataset dataSet = ((DataSetData) dataSetNode.getData()).getDataset(); - long projectId = dataSet.getProject().getId(); - - - AbstractDataBox[] databoxes = WindowSavedManager.readBoxes(savedWindow); - databoxes[0].setProjectId(projectId); - WindowBox wbox = WindowBoxFactory.getFromBoxesWindowBox(dataSet.getName()+" "+windowName, databoxes, false, dataSetNode.isQuantitation() && !dataSetNode.isQuantSC(), windowType); - - if (windowType == WindowSavedManager.SAVE_WINDOW_FOR_RSM) { - ResultSummary rsm = dataSetNode.getResultSummary(); - if (rsm == null) { - loadRsmOrRsetAndDisplayWnd(dataSet, wbox, WindowSavedManager.SAVE_WINDOW_FOR_RSM); - return; - } - } else if (windowType == WindowSavedManager.SAVE_WINDOW_FOR_RSET){ - ResultSet rset = dataSetNode.getResultSet(); - if (rset == null) { - loadRsmOrRsetAndDisplayWnd(dataSet, wbox, WindowSavedManager.SAVE_WINDOW_FOR_RSET); - return; - } - }else if (windowType == WindowSavedManager.SAVE_WINDOW_FOR_QUANTI){ - DDataset ds = dataSetNode.getDataset(); - if (ds == null) { - loadDatasetAndDisplayWnd(dataSet, wbox); - return; - } - } - - displayWnd(dataSet, wbox, windowType); - - } - private void loadRsmOrRsetAndDisplayWnd(final DDataset dataSet, final WindowBox wbox, final char windowType) { - // we have to load the result set - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - displayWnd(dataSet, wbox, windowType); - } - }; - - - // ask asynchronous loading of data - DatabaseDataSetTask task = new DatabaseDataSetTask(callback); - task.initLoadRsetAndRsm(dataSet); - AccessDatabaseThread.getAccessDatabaseThread().addTask(task); - } - - private void loadDatasetAndDisplayWnd(final DDataset dataSet, final WindowBox wbox){ - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - displayWnd(dataSet, wbox, WindowSavedManager.SAVE_WINDOW_FOR_QUANTI); - } - }; - - - // ask asynchronous loading of data - DatabaseDataSetTask task = new DatabaseDataSetTask(callback); - task.initLoadQuantitation(dataSet.getProject(), dataSet); - AccessDatabaseThread.getAccessDatabaseThread().addTask(task); - } - - - private void displayWnd(DDataset dataSet, WindowBox wbox, char windowType) { - long projectId = dataSet.getProject().getId(); - - if (windowType == WindowSavedManager.SAVE_WINDOW_FOR_RSM) { - wbox.setEntryData(projectId, dataSet.getResultSummary()); - } else if (windowType == WindowSavedManager.SAVE_WINDOW_FOR_RSET){ - wbox.setEntryData(projectId, dataSet.getResultSet()); - }else if (windowType == WindowSavedManager.SAVE_WINDOW_FOR_QUANTI){ - wbox.setEntryData(projectId, dataSet); - } - - // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); - } - - - @Override - public void updateEnabled(AbstractNode[] selectedNodes) { - - Preferences preferences = NbPreferences.root(); - String wndDefinition = WindowSavedManager.readSavedWindows().get(m_wndIndex); - - boolean needsRset = WindowSavedManager.hasResultSetParameter(wndDefinition); - boolean needsRsm = WindowSavedManager.hasResultSummaryParameter(wndDefinition); - boolean needsDataset = WindowSavedManager.hasQuantiParameter(wndDefinition); - - - int nbSelectedNodes = selectedNodes.length; - - // at least one node must be selected - if (nbSelectedNodes <0) { - setEnabled(false); - return; - } - - for (int i=0;i. + */ +package fr.proline.studio.rsmexplorer.actions.identification; + +import fr.proline.core.orm.msi.ResultSet; +import fr.proline.core.orm.msi.ResultSummary; +import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dam.AccessDatabaseThread; +import fr.proline.studio.dam.data.DataSetData; +import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; +import fr.proline.studio.dam.tasks.DatabaseDataSetTask; +import fr.proline.studio.dam.tasks.SubTask; +import fr.proline.studio.pattern.AbstractDataBox; +import fr.proline.studio.pattern.WindowBox; +import fr.proline.studio.pattern.WindowBoxFactory; +import fr.proline.studio.pattern.WindowSavedManager; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; +import fr.proline.studio.rsmexplorer.tree.AbstractNode; +import fr.proline.studio.rsmexplorer.tree.AbstractTree; +import fr.proline.studio.rsmexplorer.tree.DataSetNode; +import java.util.ArrayList; +import java.util.prefs.Preferences; +import fr.proline.studio.NbPreferences; + +/** + * + * @author JM235353 + */ +public class DisplaySavedWindowAction extends AbstractRSMAction { + + private int m_wndIndex; + + public DisplaySavedWindowAction(String name, int wndIndex, AbstractTree tree) { + super(name, tree); + m_wndIndex = wndIndex; + } + + @Override + public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { + + ArrayList savedWindowsList = WindowSavedManager.readSavedWindows(); + if (savedWindowsList.isEmpty()) { + return; + } + + String savedWindow = savedWindowsList.get(m_wndIndex); + + char windowType = WindowSavedManager.getWindowType(savedWindow); + String windowName = WindowSavedManager.getWindowName(savedWindow); + + int nbNodes = selectedNodes.length; + for (int i = 0; i < nbNodes; i++) { + DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; + + actionImpl(windowName, savedWindow, dataSetNode, windowType); + } + } + + private void actionImpl(String windowName, String savedWindow, DataSetNode dataSetNode, char windowType) { + + final DDataset dataSet = ((DataSetData) dataSetNode.getData()).getDataset(); + long projectId = dataSet.getProject().getId(); + + + AbstractDataBox[] databoxes = WindowSavedManager.readBoxes(savedWindow); + databoxes[0].setProjectId(projectId); + WindowBox wbox = WindowBoxFactory.getFromBoxesWindowBox(dataSet.getName()+" "+windowName, databoxes, false, dataSetNode.isQuantitation() && !dataSetNode.isQuantSC(), windowType); + + if (windowType == WindowSavedManager.SAVE_WINDOW_FOR_RSM) { + ResultSummary rsm = dataSetNode.getResultSummary(); + if (rsm == null) { + loadRsmOrRsetAndDisplayWnd(dataSet, wbox, WindowSavedManager.SAVE_WINDOW_FOR_RSM); + return; + } + } else if (windowType == WindowSavedManager.SAVE_WINDOW_FOR_RSET){ + ResultSet rset = dataSetNode.getResultSet(); + if (rset == null) { + loadRsmOrRsetAndDisplayWnd(dataSet, wbox, WindowSavedManager.SAVE_WINDOW_FOR_RSET); + return; + } + }else if (windowType == WindowSavedManager.SAVE_WINDOW_FOR_QUANTI){ + DDataset ds = dataSetNode.getDataset(); + if (ds == null) { + loadDatasetAndDisplayWnd(dataSet, wbox); + return; + } + } + + displayWnd(dataSet, wbox, windowType); + + } + private void loadRsmOrRsetAndDisplayWnd(final DDataset dataSet, final WindowBox wbox, final char windowType) { + // we have to load the result set + AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success, long taskId, SubTask subTask, boolean finished) { + displayWnd(dataSet, wbox, windowType); + } + }; + + + // ask asynchronous loading of data + DatabaseDataSetTask task = new DatabaseDataSetTask(callback); + task.initLoadRsetAndRsm(dataSet); + AccessDatabaseThread.getAccessDatabaseThread().addTask(task); + } + + private void loadDatasetAndDisplayWnd(final DDataset dataSet, final WindowBox wbox){ + AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success, long taskId, SubTask subTask, boolean finished) { + displayWnd(dataSet, wbox, WindowSavedManager.SAVE_WINDOW_FOR_QUANTI); + } + }; + + + // ask asynchronous loading of data + DatabaseDataSetTask task = new DatabaseDataSetTask(callback); + task.initLoadQuantitation(dataSet.getProject(), dataSet); + AccessDatabaseThread.getAccessDatabaseThread().addTask(task); + } + + + private void displayWnd(DDataset dataSet, WindowBox wbox, char windowType) { + long projectId = dataSet.getProject().getId(); + + if (windowType == WindowSavedManager.SAVE_WINDOW_FOR_RSM) { + wbox.setEntryData(projectId, dataSet.getResultSummary()); + } else if (windowType == WindowSavedManager.SAVE_WINDOW_FOR_RSET){ + wbox.setEntryData(projectId, dataSet.getResultSet()); + }else if (windowType == WindowSavedManager.SAVE_WINDOW_FOR_QUANTI){ + wbox.setEntryData(projectId, dataSet); + } + + // open a window to display the window box + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); + } + + + @Override + public void updateEnabled(AbstractNode[] selectedNodes) { + + Preferences preferences = NbPreferences.root(); + String wndDefinition = WindowSavedManager.readSavedWindows().get(m_wndIndex); + + boolean needsRset = WindowSavedManager.hasResultSetParameter(wndDefinition); + boolean needsRsm = WindowSavedManager.hasResultSummaryParameter(wndDefinition); + boolean needsDataset = WindowSavedManager.hasQuantiParameter(wndDefinition); + + + int nbSelectedNodes = selectedNodes.length; + + // at least one node must be selected + if (nbSelectedNodes <0) { + setEnabled(false); + return; + } + + for (int i=0;i. - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.Project; @@ -25,8 +25,8 @@ import fr.proline.studio.dam.tasks.DatabaseClearProjectTask; import fr.proline.studio.dam.tasks.DatabaseDataSetTask; import fr.proline.studio.dam.tasks.SubTask; +import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.gui.InfoDialog; -import fr.proline.studio.gui.OptionDialog; import fr.proline.studio.rsmexplorer.gui.ProjectExplorerPanel; import fr.proline.studio.rsmexplorer.tree.DataSetNode; import fr.proline.studio.rsmexplorer.tree.AbstractNode; @@ -36,8 +36,8 @@ import java.util.ArrayList; import java.util.List; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; /** * Action to empty the Trash @@ -48,7 +48,7 @@ public class EmptyTrashAction extends AbstractRSMAction { public EmptyTrashAction(AbstractTree tree) { - super(NbBundle.getMessage(EmptyTrashAction.class, "CTL_EmptyTrashAction"), tree); + super("Empty Trash", tree); } // @Override @@ -110,12 +110,12 @@ public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { // check if user also wants to erase locally InfoDialog exitDialog = new InfoDialog(WindowManager.getDefault().getMainWindow(), InfoDialog.InfoType.WARNING, "Confirm Erasing of Recycle Bin", "Are you sure you want to erase the contents of the Recycle Bin?"); - exitDialog.setButtonName(OptionDialog.BUTTON_OK, "Yes"); - exitDialog.setButtonName(OptionDialog.BUTTON_CANCEL, "No"); + exitDialog.setButtonName(DefaultDialog.BUTTON_OK, "Yes"); + exitDialog.setButtonName(DefaultDialog.BUTTON_CANCEL, "No"); exitDialog.centerToWindow(WindowManager.getDefault().getMainWindow()); exitDialog.setVisible(true); - if (exitDialog.getButtonClicked() == OptionDialog.BUTTON_CANCEL) { + if (exitDialog.getButtonClicked() == DefaultDialog.BUTTON_CANCEL) { // No clicked return; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportAction.java index 9cc0d8204..fac269713 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,13 +16,14 @@ */ package fr.proline.studio.rsmexplorer.actions.identification; +//import fr.proline.studio.rsmexplorer.actions.ExportPTMDatasetAction; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import javax.swing.JMenu; import javax.swing.JMenuItem; import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; -import org.openide.util.NbBundle; + /** * Add Action (menu for sub-actions identification and aggregation) @@ -33,7 +34,7 @@ public class ExportAction extends AbstractRSMAction { // Could be ExportXXXAction or ExportXXXJMSAction private AbstractRSMAction m_exportDatasetAction; -// private AbstractRSMAction m_exportPrideAction; + private AbstractRSMAction m_exportPTMDatasetAction; private AbstractRSMAction m_exportPeakViewSpectraAction; private AbstractRSMAction m_exportSpectronautSpectraAction; private AbstractRSMAction m_exportMzIdentMLAction; @@ -42,7 +43,7 @@ public class ExportAction extends AbstractRSMAction { private JMenu m_menu; public ExportAction(AbstractTree tree) { - super(NbBundle.getMessage(ExportAction.class, "CTL_ExportAction"), tree); + super("Export", tree); } @Override @@ -52,26 +53,19 @@ public JMenuItem getPopupPresenter() { m_exportDatasetAction = new ExportDatasetJMSAction(getTree()); if (getTree() == IdentificationTree.getCurrentTree()) { -// m_exportPrideAction = new ExportRSM2PrideJMSAction(getTree()); m_exportMzIdentMLAction = new ExportMzIdentMLAction(getTree()); } else { -// m_exportPrideAction = null; m_exportMzIdentMLAction = null; } JMenuItem exportDatasetItem = new JMenuItem(m_exportDatasetAction); m_menu.add(exportDatasetItem); -// if (m_exportPrideAction != null) { -// JMenuItem exportPrideItem = new JMenuItem(m_exportPrideAction); -// m_menu.add(exportPrideItem); -// } - if (m_exportMzIdentMLAction != null) { JMenuItem exportMzIdentMLItem = new JMenuItem(m_exportMzIdentMLAction); m_menu.add(exportMzIdentMLItem); } - JMenu exportMenu = new JMenu(NbBundle.getMessage(ExportAction.class, "CTL_ExportSpectraListAction")); + JMenu exportMenu = new JMenu("Spectra List"); m_exportPeakViewSpectraAction = new ExportSpectraListJMSAction(getTree(), ExportSpectraListJMSAction.FormatCompatibility.PeakView); m_exportSpectronautSpectraAction = new ExportSpectraListJMSAction(getTree(), ExportSpectraListJMSAction.FormatCompatibility.Spectronaut); @@ -84,6 +78,10 @@ public JMenuItem getPopupPresenter() { JMenuItem exportFastaItem = new JMenuItem(m_exporFastaAction); m_menu.add(exportFastaItem); + // VDS : Export PTM Dataset in JSON format. For test only +// m_exportPTMDatasetAction = new ExportPTMDatasetAction(getTree()); +// JMenuItem exportPTMDatasetItem = new JMenuItem(m_exportPTMDatasetAction); +// m_menu.add(exportPTMDatasetItem); return m_menu; } @@ -91,9 +89,6 @@ public JMenuItem getPopupPresenter() { public void updateEnabled(AbstractNode[] selectedNodes) { m_exportDatasetAction.updateEnabled(selectedNodes); -// if (m_exportPrideAction != null) { -// m_exportPrideAction.updateEnabled(selectedNodes); -// } if (m_exportMzIdentMLAction != null) { m_exportMzIdentMLAction.updateEnabled(selectedNodes); } @@ -102,7 +97,7 @@ public void updateEnabled(AbstractNode[] selectedNodes) { m_exportPeakViewSpectraAction.updateEnabled(selectedNodes); boolean isEnabled = m_exportDatasetAction.isEnabled() -// || (m_exportPrideAction != null && m_exportPrideAction.isEnabled()) + /* || m_exportPTMDatasetAction.isEnabled()*/ || m_exportSpectronautSpectraAction.isEnabled() || m_exportPeakViewSpectraAction.isEnabled() || (m_exportMzIdentMLAction != null && m_exportMzIdentMLAction.isEnabled()); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportDatasetJMSAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportDatasetJMSAction.java index c3e935681..43828d951 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportDatasetJMSAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportDatasetJMSAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -31,8 +31,8 @@ import java.util.ArrayList; import java.util.List; import javax.swing.SwingUtilities; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,11 +47,11 @@ public class ExportDatasetJMSAction extends AbstractRSMAction { private List m_config; public ExportDatasetJMSAction(AbstractTree tree) { - super(NbBundle.getMessage(ExportDatasetJMSAction.class, "CTL_ExportDatasetAction"), tree); + super("Excel...", tree); } public ExportDatasetJMSAction(AbstractTree tree, boolean exportTitle) { - super(NbBundle.getMessage(ExportDatasetJMSAction.class, "CTL_ExportAction") + " " + NbBundle.getMessage(ExportDatasetJMSAction.class, "CTL_ExportDatasetAction"), tree); + super("Export Excel...", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportFastaAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportFastaAction.java index 0e368c988..d771e14cc 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportFastaAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportFastaAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -27,6 +27,7 @@ import fr.proline.studio.dam.tasks.DatabaseDataSetTask; import fr.proline.studio.dam.tasks.DatabaseProteinSetsTask; import fr.proline.studio.dam.tasks.SubTask; +import fr.proline.studio.dock.gui.InfoLabel; import fr.proline.studio.dpm.AccessJMSManagerThread; import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; import fr.proline.studio.dpm.task.jms.RetrieveBioSeqTask; @@ -36,7 +37,6 @@ import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; import fr.proline.studio.utils.IconManager; -import fr.proline.studio.utils.StudioExceptions; import java.awt.Dialog; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -65,9 +65,9 @@ import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.tree.DefaultTreeModel; import org.apache.commons.lang3.StringUtils; -import org.openide.util.NbBundle; -import org.openide.util.NbPreferences; -import org.openide.windows.WindowManager; + +import fr.proline.studio.NbPreferences; +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -81,12 +81,9 @@ public class ExportFastaAction extends AbstractRSMAction { //private LoadWaitingDialog m_loadWaitingDialog; public ExportFastaAction(AbstractTree tree) { - super(NbBundle.getMessage(ExportDatasetJMSAction.class, "CTL_ExportFastaAction"), tree); + super("Sequence Fasta", tree); } - public ExportFastaAction(AbstractTree tree, boolean exportTitle) { - super(NbBundle.getMessage(ExportFastaAction.class, "CTL_ExportAction") + " " + NbBundle.getMessage(ExportFastaAction.class, "CTL_ExportFastaAction"), tree); - } /** * open a dialog to define de export file location @@ -97,9 +94,6 @@ public ExportFastaAction(AbstractTree tree, boolean exportTitle) { */ @Override public void actionPerformed(final AbstractNode[] selectedNodes, final int x, final int y) { - String waitingTxt = "Please wait while loading template to configure export"; - - final DataSetNode dataSetNode = (DataSetNode) selectedNodes[0]; FastaExportMulitipleDialog exportMultipleDialog = new FastaExportMulitipleDialog(WindowManager.getDefault().getMainWindow(), selectedNodes); ExportFastaProgressTask exportFastaProgressTask = new ExportFastaProgressTask(selectedNodes, exportMultipleDialog); @@ -395,7 +389,7 @@ private void writeBioSequence(DataSetNode node) { try { write(proteinSetArray, node); } catch (IOException ex) { - StudioExceptions.notify("IO Exception when write fasta file", ex); + WindowManager.getDefault().getMainWindow().alert(InfoLabel.INFO_LEVEL.ERROR, "IO Exception when write fasta file", ex); } finally { node.setIsChanging(false); DefaultTreeModel treeModel = (DefaultTreeModel) getTree().getModel(); @@ -458,7 +452,7 @@ private void writeBioSequence() { try { write(proteinSetArray, firstNode); } catch (IOException ex) { - StudioExceptions.notify("IO Exception when write fasta file", ex); + WindowManager.getDefault().getMainWindow().alert(InfoLabel.INFO_LEVEL.ERROR, "IO Exception when write fasta file", ex); } finally { for (AbstractNode anode : m_selectedNodes) { DataSetNode node = (DataSetNode) anode; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportMzIdentMLAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportMzIdentMLAction.java index 777d73bcb..bf901ab08 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportMzIdentMLAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportMzIdentMLAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -28,8 +28,8 @@ import fr.proline.studio.rsmexplorer.tree.DataSetNode; import java.util.ArrayList; import java.util.List; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +42,7 @@ public class ExportMzIdentMLAction extends AbstractRSMAction { protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); public ExportMzIdentMLAction(AbstractTree tree) { - super(NbBundle.getMessage(ExportMzIdentMLAction.class, "CTL_ExportMzIdentMLAction") , tree); + super("MzIdentML...", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportRSM2PrideJMSAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportRSM2PrideJMSAction.java index 79eef726e..1b4685dea 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportRSM2PrideJMSAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportRSM2PrideJMSAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -28,8 +28,8 @@ import fr.proline.studio.rsmexplorer.tree.DataSetNode; import java.util.ArrayList; import java.util.List; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +42,7 @@ public class ExportRSM2PrideJMSAction extends AbstractRSMAction { protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); public ExportRSM2PrideJMSAction(AbstractTree tree){ - super(NbBundle.getMessage(ExportRSM2PrideJMSAction.class, "CTL_ExportPrideAction"), tree); + super("Pride...", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportSpectraListJMSAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportSpectraListJMSAction.java index a2f6c8d17..126aac4b0 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportSpectraListJMSAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ExportSpectraListJMSAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -31,8 +31,8 @@ import java.util.HashMap; import java.util.List; import javax.swing.JOptionPane; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +49,8 @@ public enum FormatCompatibility { PeakView, Spectronaut } FormatCompatibility m_compatibility; public ExportSpectraListJMSAction(AbstractTree tree, FormatCompatibility compatibility) { - super(NbBundle.getMessage(ExportSpectraListJMSAction.class, "CTL_"+compatibility.toString()+"SpectraListAction"), tree); + super(compatibility.equals(FormatCompatibility.PeakView) ? "PeakView..." : "Spectronaut...", tree); + m_compatibility = compatibility; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/FilterRSMProteinSetsJMSAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/FilterRSMProteinSetsJMSAction.java index 3dde66832..7ef3bd29d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/FilterRSMProteinSetsJMSAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/FilterRSMProteinSetsJMSAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -33,8 +33,8 @@ import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; import java.util.HashMap; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; /** * Filters the ProteinSets of all selected ResultSummaries via JMS @@ -44,7 +44,7 @@ public class FilterRSMProteinSetsJMSAction extends AbstractRSMAction{ public FilterRSMProteinSetsJMSAction(AbstractTree tree) { - super(NbBundle.getMessage(FilterRSMProteinSetsJMSAction.class, "CTL_FilterRSMProteinSetsAction"), tree); + super("Filter ProteinSets...", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/GenerateMSDiagReportAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/GenerateMSDiagReportAction.java index a055e1f7c..4ab4b1bc4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/GenerateMSDiagReportAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/GenerateMSDiagReportAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import java.util.ArrayList; @@ -29,14 +29,14 @@ import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.gui.dialog.MSDiagDialog; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; import fr.proline.studio.rsmexplorer.tree.AbstractNode; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; /** * Action to launch the msdiag generation of the report. action @@ -47,7 +47,7 @@ public class GenerateMSDiagReportAction extends AbstractRSMAction { public GenerateMSDiagReportAction(AbstractTree tree) { - super(NbBundle.getMessage(GenerateMSDiagReportAction.class, "CTL_GenerateMSDiagReportAction"), tree); + super("Quality Control...", tree); } @Override @@ -90,16 +90,14 @@ private void actionImpl(DataSetNode dataSetNode, ArrayList resultMessages) { wbox.setEntryData(dataSet.getProject().getId(), rset); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } else { final WindowBox wbox = WindowBoxFactory.getMSDiagWindowBox(dataSet.getName() + " Quality Control", (HashMap) resultMessages.get(0)); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); // we have to load the result set AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/GenerateSpectrumMatchesJMSAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/GenerateSpectrumMatchesJMSAction.java index 79a237263..97244838e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/GenerateSpectrumMatchesJMSAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/GenerateSpectrumMatchesJMSAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.Project; @@ -37,8 +37,8 @@ import java.util.ArrayList; import java.util.List; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,7 +51,7 @@ public class GenerateSpectrumMatchesJMSAction extends AbstractRSMAction { protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); public GenerateSpectrumMatchesJMSAction(AbstractTree tree) { - super(NbBundle.getMessage(GenerateSpectrumMatchesJMSAction.class, "CTL_GenerateSpectrumMatchesAction"), tree); + super("Generate Spectrum Matches", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/IdentifyPtmSitesJMSAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/IdentifyPtmSitesJMSAction.java index 59646d2bb..cbce84184 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/IdentifyPtmSitesJMSAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/IdentifyPtmSitesJMSAction.java @@ -1,161 +1,183 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.actions.identification; - -import fr.proline.core.orm.msi.Ptm; -import fr.proline.core.orm.msi.PtmSpecificity; -import fr.proline.core.orm.uds.Project; -import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.studio.dam.DatabaseDataManager; -import fr.proline.studio.dam.tasks.DatabasePTMSitesTask; -import fr.proline.studio.dpm.AccessJMSManagerThread; -import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; -import fr.proline.studio.dpm.task.jms.IdentifyPtmSitesTask; -import fr.proline.studio.gui.DefaultDialog; -import fr.proline.studio.rsmexplorer.gui.ProjectExplorerPanel; -import fr.proline.studio.rsmexplorer.gui.dialog.IdentifyPtmSitesDialog; -import fr.proline.studio.rsmexplorer.tree.AbstractNode; -import fr.proline.studio.rsmexplorer.tree.AbstractTree; -import fr.proline.studio.rsmexplorer.tree.DataSetNode; - -import javax.swing.tree.DefaultTreeModel; - -import org.apache.lucene.search.FieldComparator; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.TreeSet; -import java.util.stream.Collectors; - -/** - * action to generate spectrum matches via JMS - * - * @author MB243701 - */ -public class IdentifyPtmSitesJMSAction extends AbstractRSMAction { - - protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); - - public IdentifyPtmSitesJMSAction(AbstractTree tree) { - super(NbBundle.getMessage(IdentifyPtmSitesJMSAction.class, "CTL_IdentifyPtmSitesAction"), tree); - } - - @Override - public void actionPerformed(final AbstractNode[] selectedNodes, int x, int y) { - - final DefaultTreeModel treeModel = (DefaultTreeModel) getTree().getModel(); - int nbNodes = selectedNodes.length; - - if (nbNodes > 0) { - List ptms = new ArrayList<>(); - //Retrieve potential PTMs from dataset - for (int i = 0; i < nbNodes; i++) { - ArrayList ptmSpecificities = new ArrayList<>(); - DataSetNode node = (DataSetNode) selectedNodes[i]; - DatabasePTMSitesTask ptmTask = new DatabasePTMSitesTask(null); - ptmTask.initLoadUsedPTMs(node.getDataset().getProject().getId(), node.getDataset().getResultSummaryId(), ptmSpecificities); - ptmTask.fetchData(); - ptms.addAll(ptmSpecificities.stream().map(s -> s.getPtm()).distinct().collect(Collectors.toList())); - } - - TreeSet ptmsTreeSet = ptms.stream().collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(p -> Long.valueOf(p.getId()))))); - ptms = new ArrayList<>(ptmsTreeSet); - - IdentifyPtmSitesDialog dialog = new IdentifyPtmSitesDialog(WindowManager.getDefault().getMainWindow(), ptms); - dialog.setLocation(x, y); - dialog.setVisible(true); - if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { - - for (int i = 0; i < nbNodes; i++) { - - final DataSetNode node = (DataSetNode) selectedNodes[i]; - AbstractJMSCallback callback = new AbstractJMSCallback() { - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success) { - node.setIsChanging(false); - treeModel.nodeChanged(node); - } - }; - - final DDataset dataset = node.getDataset(); - - node.setIsChanging(true); - treeModel.nodeChanged(node); - - Long projectId = dataset.getProject().getId(); - Long resultSummaryId = dataset.getResultSummaryId(); - IdentifyPtmSitesTask task; - task = new IdentifyPtmSitesTask(callback, dataset.getName(), projectId, resultSummaryId, null, "2.0", dialog.getPtms(), dialog.getClusteringMethodName()); - AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); - } - } - } - } - - - @Override - public void updateEnabled(AbstractNode[] selectedNodes) { - - // to execute this action, the user must be the owner of the project - Project selectedProject = ProjectExplorerPanel.getProjectExplorerPanel().getSelectedProject(); - if (!DatabaseDataManager.getDatabaseDataManager().ownProject(selectedProject)) { - setEnabled(false); - return; - } - - int nbSelectedNodes = selectedNodes.length; - for (int i = 0; i < nbSelectedNodes; i++) { - AbstractNode node = selectedNodes[i]; - - if (node.isChanging()) { - setEnabled(false); - return; - } - - if (node.getType() != AbstractNode.NodeTypes.DATA_SET) { - setEnabled(false); - return; - } - - DataSetNode dataSetNode = (DataSetNode) node; - - if (dataSetNode.isFolder()) { - setEnabled(false); - return; - } - - if (!dataSetNode.hasResultSet() || !dataSetNode.hasResultSummary()) { - setEnabled(false); - return; - } - - - } - setEnabled(true); - } - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.actions.identification; + +import fr.proline.core.orm.msi.Ptm; +import fr.proline.core.orm.msi.PtmSpecificity; +import fr.proline.core.orm.uds.Project; +import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dam.DatabaseDataManager; +import fr.proline.studio.dam.tasks.DatabasePTMsTask; +import fr.proline.studio.dpm.AccessJMSManagerThread; +import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; +import fr.proline.studio.dpm.task.jms.IdentifyPtmSitesTask; +import fr.proline.studio.gui.DefaultDialog; +import fr.proline.studio.gui.InfoDialog; +import fr.proline.studio.rsmexplorer.gui.ProjectExplorerPanel; +import fr.proline.studio.rsmexplorer.gui.dialog.IdentifyPtmSitesDialog; +import fr.proline.studio.rsmexplorer.tree.AbstractNode; +import fr.proline.studio.rsmexplorer.tree.AbstractTree; +import fr.proline.studio.rsmexplorer.tree.DataSetNode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.swing.tree.DefaultTreeModel; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.TreeSet; +import java.util.stream.Collectors; + +/** + * action to generate spectrum matches via JMS + * + * @author MB243701 + */ +public class IdentifyPtmSitesJMSAction extends AbstractRSMAction { + + protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); + + public IdentifyPtmSitesJMSAction(AbstractTree tree) { + super("Identify Modification Sites", tree); + } + + @Override + public void actionPerformed(final AbstractNode[] selectedNodes, int x, int y) { + + final DefaultTreeModel treeModel = (DefaultTreeModel) getTree().getModel(); + int nbNodes = selectedNodes.length; + + if (nbNodes > 0) { + //Test if some nodes has already loaded PTMDataset + boolean isPTMDatasetLoaded = false; + //Retrieve potential PTMs from dataset + List ptms = new ArrayList<>(); + for (int i = 0; i < nbNodes; i++) { + ArrayList ptmSpecificities = new ArrayList<>(); + DataSetNode node = (DataSetNode) selectedNodes[i]; + if(DatabaseDataManager.getDatabaseDataManager().getPTMDatasetSetForDS(node.getDataset().getId()) != null || + DatabaseDataManager.getDatabaseDataManager().getPTMDatasetSetForDS(node.getDataset().getId()) != null) + isPTMDatasetLoaded = true; + + DatabasePTMsTask ptmTask = new DatabasePTMsTask(null); + ptmTask.initLoadUsedPTMs(node.getDataset().getProject().getId(), node.getDataset().getResultSummaryId(), ptmSpecificities); + ptmTask.fetchData(); + ptms.addAll(ptmSpecificities.stream().map(s -> s.getPtm()).distinct().collect(Collectors.toList())); + } + + TreeSet ptmsTreeSet = ptms.stream().collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(p -> Long.valueOf(p.getId()))))); + ptms = new ArrayList<>(ptmsTreeSet); + + IdentifyPtmSitesDialog dialog = new IdentifyPtmSitesDialog(WindowManager.getDefault().getMainWindow(), ptms); + dialog.setLocation(x, y); + dialog.setVisible(true); + if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { + + //Test if PTMDataset loaded + + //Alert user : previous modification view (Site/Cluster) should be closed in order to load new data + StringBuilder msg = isPTMDatasetLoaded ? new StringBuilder("Be sure to close all previous Modification Site/Cluster view !\n\n") : new StringBuilder(); + msg.append("Warning: Previously saved Annotated Modification Dataset will be deleted ! \nAre you sure you want to continue ?"); + InfoDialog id = new InfoDialog(WindowManager.getDefault().getMainWindow(), InfoDialog.InfoType.WARNING,"Run Identify Modification Sites",msg.toString()); + id.setButtonName(DefaultDialog.BUTTON_OK, "Yes"); + id.setButtonName(DefaultDialog.BUTTON_CANCEL, "No"); + id.centerToWindow(WindowManager.getDefault().getMainWindow()); + id.setVisible(true); + if (id.getButtonClicked() == DefaultDialog.BUTTON_CANCEL) { + // No clicked + return; + } + + for (int i = 0; i < nbNodes; i++) { + + final DataSetNode node = (DataSetNode) selectedNodes[i]; + AbstractJMSCallback callback = new AbstractJMSCallback() { + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success) { + node.setIsChanging(false); + treeModel.nodeChanged(node); + if(success){ + //remove previous Modificatio data to force reload + DatabaseDataManager.getDatabaseDataManager().removeAllPTMDatasetsForDS( node.getDataset().getId()); + } + } + }; + + final DDataset dataset = node.getDataset(); + + node.setIsChanging(true); + treeModel.nodeChanged(node); + + Long projectId = dataset.getProject().getId(); + Long resultSummaryId = dataset.getResultSummaryId(); + IdentifyPtmSitesTask task; + task = new IdentifyPtmSitesTask(callback, dataset.getName(), projectId, resultSummaryId, null, "2.0", dialog.getPtms(), dialog.getClusteringMethodName()); + AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); + } + } + } + } + + + @Override + public void updateEnabled(AbstractNode[] selectedNodes) { + + // to execute this action, the user must be the owner of the project + Project selectedProject = ProjectExplorerPanel.getProjectExplorerPanel().getSelectedProject(); + if (!DatabaseDataManager.getDatabaseDataManager().ownProject(selectedProject)) { + setEnabled(false); + return; + } + + int nbSelectedNodes = selectedNodes.length; + for (int i = 0; i < nbSelectedNodes; i++) { + AbstractNode node = selectedNodes[i]; + + if (node.isChanging()) { + setEnabled(false); + return; + } + + if (node.getType() != AbstractNode.NodeTypes.DATA_SET) { + setEnabled(false); + return; + } + + DataSetNode dataSetNode = (DataSetNode) node; + + if (dataSetNode.isFolder()) { + setEnabled(false); + return; + } + + if (!dataSetNode.hasResultSet() || !dataSetNode.hasResultSummary()) { + setEnabled(false); + return; + } + + + } + setEnabled(true); + } + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportManager.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportManager.java index ef6bdd32d..63e0ebf08 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportManager.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportManager.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.dto.DDataset; @@ -27,7 +27,7 @@ import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; import java.util.Hashtable; import javax.swing.JOptionPane; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportMaxQuantResultJMSAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportMaxQuantResultJMSAction.java index bf4e54c96..7a8874f2d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportMaxQuantResultJMSAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportMaxQuantResultJMSAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.Aggregation; @@ -45,8 +45,8 @@ import java.util.Map; import javax.swing.JOptionPane; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; /** * @@ -55,7 +55,7 @@ public class ImportMaxQuantResultJMSAction extends AbstractRSMAction { public ImportMaxQuantResultJMSAction(AbstractTree tree) { - super(NbBundle.getMessage(ImportMaxQuantResultJMSAction.class, "CTL_ImportMaxQuantResult"), tree); + super("Import MaxQuant Result...", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportSearchResultAsDatasetJMSAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportSearchResultAsDatasetJMSAction.java index 2ba204697..bf43fa4d1 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportSearchResultAsDatasetJMSAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportSearchResultAsDatasetJMSAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.studio.rsmexplorer.tree.AbstractTree; @@ -42,8 +42,8 @@ import java.util.ArrayList; import java.util.HashMap; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; /** * @@ -58,7 +58,7 @@ public class ImportSearchResultAsDatasetJMSAction extends AbstractRSMAction { private static final String GENERAL_APPLICATION_SETTINGS = "General Application Settings"; public ImportSearchResultAsDatasetJMSAction(AbstractTree tree) { - super(NbBundle.getMessage(ImportSearchResultAsDatasetJMSAction.class, "CTL_AddSearchResult"), tree); + super("Import Search Result...", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportSearchResultAsRsetJMSAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportSearchResultAsRsetJMSAction.java index 6191e7028..445fc64d0 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportSearchResultAsRsetJMSAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ImportSearchResultAsRsetJMSAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.studio.rsmexplorer.tree.identification.IdAllImportedNode; @@ -35,8 +35,8 @@ import java.util.HashMap; import javax.swing.event.ChangeListener; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; /** * Action to import one or multiple identification @@ -51,7 +51,7 @@ public class ImportSearchResultAsRsetJMSAction extends AbstractRSMAction { private static HashMap> m_listenerMap = new HashMap<>(); public ImportSearchResultAsRsetJMSAction(AbstractTree tree) { - super(NbBundle.getMessage(ImportSearchResultAsRsetJMSAction.class, "CTL_AddSearchResult"), tree); + super("Import Search Result...", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ManageUserWindowsAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ManageUserWindowsAction.java index c245b967f..40d0c6b9a 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ManageUserWindowsAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ManageUserWindowsAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.studio.pattern.WindowSavedManager; @@ -22,8 +22,8 @@ import fr.proline.studio.rsmexplorer.tree.AbstractTree; import java.util.ArrayList; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; /** * Action to manage the list of Saved User Windows @@ -34,7 +34,7 @@ public class ManageUserWindowsAction extends AbstractRSMAction { private char m_windowType; public ManageUserWindowsAction(char saveWindowType, AbstractTree tree) { - super(NbBundle.getMessage(ManageUserWindowsAction.class, "CTL_ManagerUserWindowsAction"), tree); + super("Manage User Windows...", tree); m_windowType = saveWindowType; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/MergeJMSAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/MergeJMSAction.java index 071fa381a..aecc6dc88 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/MergeJMSAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/MergeJMSAction.java @@ -1,338 +1,338 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.actions.identification; - -import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.core.orm.uds.Project; -import fr.proline.core.orm.uds.dto.DDatasetType.AggregationInformation; -import fr.proline.studio.dam.AccessDatabaseThread; -import fr.proline.studio.dam.DatabaseDataManager; -import fr.proline.studio.dam.data.DataSetData; -import fr.proline.studio.dam.taskinfo.TaskInfo; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; -import fr.proline.studio.dam.tasks.DatabaseDataSetTask; -import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.dpm.AccessJMSManagerThread; -import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; -import fr.proline.studio.dpm.task.jms.MergeTask; -import fr.proline.studio.rsmexplorer.gui.ProjectExplorerPanel; -import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import fr.proline.studio.rsmexplorer.tree.AbstractNode; -import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; -import fr.proline.studio.rsmexplorer.tree.AbstractTree; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.prefs.Preferences; -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.util.NbPreferences; - -/** - * Action to Merge data from a set of Search Results (rset) or Identification Summaries (rsm) - * @author JM235353 - */ -public class MergeJMSAction extends AbstractRSMAction { - - private JMenu m_menu; - private ConfigurableMergeAction m_aggregationMergeAction; - private ConfigurableMergeAction m_unionMergeAction; - - public MergeJMSAction(AbstractTree tree) { - super(NbBundle.getMessage(MergeJMSAction.class, "CTL_MergeAction"), tree); - } - - @Override - public JMenuItem getPopupPresenter() { - m_menu = new JMenu((String) getValue(NAME)); - Preferences preferences = NbPreferences.root(); - Boolean showHiddenFunctionnality = preferences.getBoolean("Profi", false); - - m_aggregationMergeAction = new ConfigurableMergeAction(getTree(), MergeTask.Config.AGGREGATION); - m_unionMergeAction = new ConfigurableMergeAction(getTree(), MergeTask.Config.UNION); - JMenuItem mergeAggregateItem = new JMenuItem(m_aggregationMergeAction); - m_menu.add(mergeAggregateItem); - JMenuItem mergeUnionItem = new JMenuItem(m_unionMergeAction); - m_menu.add(mergeUnionItem); - - return m_menu; - } - - @Override - public void updateEnabled(AbstractNode[] selectedNodes) { - - m_aggregationMergeAction.updateEnabled(selectedNodes); - m_unionMergeAction.updateEnabled(selectedNodes); - - boolean isEnabled = m_aggregationMergeAction.isEnabled() || m_unionMergeAction.isEnabled(); - setEnabled(isEnabled); - m_menu.setEnabled(isEnabled); - } -} - -class ConfigurableMergeAction extends AbstractRSMAction { - - private MergeTask.Config m_configuration; - - public ConfigurableMergeAction(AbstractTree tree, MergeTask.Config config) { - super(config.getValue(), tree); - m_configuration = config; - } - - @Override - public void actionPerformed(final AbstractNode[] selectedNodes, int x, int y) { - - int nbSelectedNodes = selectedNodes.length; - for (int i = 0; i < nbSelectedNodes; i++) { - final AbstractNode node = (AbstractNode) selectedNodes[i]; - - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - - // check if we can do a merge - String error = null; - int nbChildren = node.getChildCount(); - /*if (nbChildren == 1) { - error = "Merge on an Dataset with only one Child is not possible"; - }*/ - - HashSet checkDifferentResultSetId = new HashSet<>(); - ArrayList resultSetIdList = new ArrayList<>(); - ArrayList resultSummaryIdList = new ArrayList<>(); - for (int i = 0; i < nbChildren; i++) { - DataSetNode childNode = (DataSetNode) node.getChildAt(i); - if (childNode.isChanging()) { - error = "Merge is not possible: child DataSet ("+childNode.getDataset().getName() +") is being processed"; - break; - } - if (!childNode.hasResultSet()) { - error = "Merge is not possible: " + childNode.getDataset().getName() + " has no Search Result"; - break; - } - - Long rsetId = childNode.getDataset().getResultSetId(); - if (checkDifferentResultSetId.contains(rsetId)) { - error = "Merge is not possible: several Search Results are identical"; - break; - } - checkDifferentResultSetId.add(rsetId); - resultSetIdList.add(rsetId); - if (childNode.hasResultSummary()) { - resultSummaryIdList.add(childNode.getDataset().getResultSummaryId()); - } } - - if (error != null) { - JOptionPane.showMessageDialog(IdentificationTree.getCurrentTree(), error, "Warning", JOptionPane.ERROR_MESSAGE); - return; - } - - if (resultSummaryIdList.size() == nbChildren) { - // we do a merge on resultSummary - askMergeService((DataSetNode) node, resultSummaryIdList, true); - } else if (resultSummaryIdList.size() > 0) { - // not all children have a result summary - error = "Merge is not possible: some Search Results are not validated "; - JOptionPane.showMessageDialog(IdentificationTree.getCurrentTree(), error, "Warning", JOptionPane.ERROR_MESSAGE); - } else { - // merge on result set - askMergeService((DataSetNode) node, resultSetIdList, false); - } - - } - }; - - IdentificationTree.getCurrentTree().loadInBackground(node, callback); - } - - } - - private void askMergeService(final DataSetNode node, final List idList, final boolean mergeOnRsm) { - - final DDataset dataset = node.getDataset(); - long projectId = dataset.getProject().getId(); - String datasetName = dataset.getName(); - - node.setIsChanging(true); - IdentificationTree tree = IdentificationTree.getCurrentTree(); - final DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel(); - treeModel.nodeChanged(node); - - // used as out parameter for the service - final Long[] _resultSetId = new Long[1]; - final Long[] _resultSummaryId = new Long[1]; - - AbstractJMSCallback callback = new AbstractJMSCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success) { - if (success) { - updateDataset(node, dataset, _resultSetId[0], _resultSummaryId[0], getTaskInfo()); - - } else { - //JPM.TODO : manage error with errorMessage - node.setIsChanging(false); - - treeModel.nodeChanged(node); - } - } - }; - - MergeTask task = new MergeTask(callback, projectId, m_configuration); - if (mergeOnRsm) { - task.initMergeRsm(idList, datasetName, _resultSetId, _resultSummaryId); - } else { - _resultSummaryId[0] = null; - task.initMergeRset(idList, datasetName, _resultSetId); - } - AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); - } - - private void updateDataset(final DataSetNode datasetNode, DDataset d, Long resultSetId, Long resultSummaryId, TaskInfo taskInfo) { - - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - - datasetNode.setIsChanging(false); - - if (datasetNode.hasResultSummary()) { - if(MergeTask.Config.AGGREGATION.equals(m_configuration)) - datasetNode.getDataset().setAggregationInformation( - AggregationInformation.IDENTIFICATION_SUMMARY_AGG); - else - datasetNode.getDataset().setAggregationInformation( - AggregationInformation.IDENTIFICATION_SUMMARY_UNION); - } else { - if(MergeTask.Config.AGGREGATION.equals(m_configuration)) - datasetNode.getDataset().setAggregationInformation( - AggregationInformation.SEARCH_RESULT_AGG); - else - datasetNode.getDataset().setAggregationInformation( - AggregationInformation.SEARCH_RESULT_UNION); - } - - - IdentificationTree tree = IdentificationTree.getCurrentTree(); - DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel(); - treeModel.nodeChanged(datasetNode); - } - }; - - // ask asynchronous loading of data - - - - DatabaseDataSetTask task = new DatabaseDataSetTask(callback); - task.initModifyDatasetForMerge(d, resultSetId, resultSummaryId, taskInfo); - AccessDatabaseThread.getAccessDatabaseThread().addTask(task); - - } - - @Override - public void updateEnabled(AbstractNode[] selectedNodes) { - - // to execute this action, the user must be the owner of the project - Project selectedProject = ProjectExplorerPanel.getProjectExplorerPanel().getSelectedProject(); - if (!DatabaseDataManager.getDatabaseDataManager().ownProject(selectedProject)) { - setEnabled(false); - return; - } - - int nbSelectedNodes = selectedNodes.length; - - if (nbSelectedNodes<0) { - setEnabled(false); - return; - } - - // check if the user has asked merge at the same time between children and - // parents, if it is the case, it is forbidden - HashSet allSelelectedNodeSet = new HashSet<>(); - for (int i = 0; i < nbSelectedNodes; i++) { - AbstractNode node = selectedNodes[i]; - allSelelectedNodeSet.add(node); - } - for (int i = 0; i < nbSelectedNodes; i++) { - AbstractNode node = selectedNodes[i]; - node = (AbstractNode) node.getParent(); - while (node != null) { - if (allSelelectedNodeSet.contains(node)) { - setEnabled(false); - return; - } - node = (AbstractNode) node.getParent(); - } - } - - - - for (int i = 0; i < nbSelectedNodes; i++) { - AbstractNode node = (AbstractNode) selectedNodes[i]; - - if (node.isChanging()) { - setEnabled(false); - return; - } - - if (node.getType() != AbstractNode.NodeTypes.DATA_SET) { - setEnabled(false); - return; - } - - DataSetNode datasetNode = (DataSetNode) node; - - if (datasetNode.isLeaf()) { - setEnabled(false); - return; - } - - if (!((DataSetData) datasetNode.getData()).getDatasetType().isAggregation()) { - setEnabled(false); - return; - } - - if (datasetNode.hasResultSet()) { - setEnabled(false); - return; - } - } - - setEnabled(true ); - } - +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.actions.identification; + +import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.core.orm.uds.Project; +import fr.proline.core.orm.uds.dto.DDatasetType.AggregationInformation; +import fr.proline.studio.dam.AccessDatabaseThread; +import fr.proline.studio.dam.DatabaseDataManager; +import fr.proline.studio.dam.data.DataSetData; +import fr.proline.studio.dam.taskinfo.TaskInfo; +import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; +import fr.proline.studio.dam.tasks.DatabaseDataSetTask; +import fr.proline.studio.dam.tasks.SubTask; +import fr.proline.studio.dpm.AccessJMSManagerThread; +import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; +import fr.proline.studio.dpm.task.jms.MergeTask; +import fr.proline.studio.rsmexplorer.gui.ProjectExplorerPanel; +import fr.proline.studio.rsmexplorer.tree.DataSetNode; +import fr.proline.studio.rsmexplorer.tree.AbstractNode; +import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; +import fr.proline.studio.rsmexplorer.tree.AbstractTree; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.prefs.Preferences; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.tree.DefaultTreeModel; + +import fr.proline.studio.NbPreferences; + +/** + * Action to Merge data from a set of Search Results (rset) or Identification Summaries (rsm) + * @author JM235353 + */ +public class MergeJMSAction extends AbstractRSMAction { + + private JMenu m_menu; + private ConfigurableMergeAction m_aggregationMergeAction; + private ConfigurableMergeAction m_unionMergeAction; + + public MergeJMSAction(AbstractTree tree) { + super("Merge Datasets", tree); + } + + @Override + public JMenuItem getPopupPresenter() { + m_menu = new JMenu((String) getValue(NAME)); + Preferences preferences = NbPreferences.root(); + Boolean showHiddenFunctionnality = preferences.getBoolean("Profi", false); + + m_aggregationMergeAction = new ConfigurableMergeAction(getTree(), MergeTask.Config.AGGREGATION); + m_unionMergeAction = new ConfigurableMergeAction(getTree(), MergeTask.Config.UNION); + JMenuItem mergeAggregateItem = new JMenuItem(m_aggregationMergeAction); + m_menu.add(mergeAggregateItem); + JMenuItem mergeUnionItem = new JMenuItem(m_unionMergeAction); + m_menu.add(mergeUnionItem); + + return m_menu; + } + + @Override + public void updateEnabled(AbstractNode[] selectedNodes) { + + m_aggregationMergeAction.updateEnabled(selectedNodes); + m_unionMergeAction.updateEnabled(selectedNodes); + + boolean isEnabled = m_aggregationMergeAction.isEnabled() || m_unionMergeAction.isEnabled(); + setEnabled(isEnabled); + m_menu.setEnabled(isEnabled); + } +} + +class ConfigurableMergeAction extends AbstractRSMAction { + + private MergeTask.Config m_configuration; + + public ConfigurableMergeAction(AbstractTree tree, MergeTask.Config config) { + super(config.getValue(), tree); + m_configuration = config; + } + + @Override + public void actionPerformed(final AbstractNode[] selectedNodes, int x, int y) { + + int nbSelectedNodes = selectedNodes.length; + for (int i = 0; i < nbSelectedNodes; i++) { + final AbstractNode node = (AbstractNode) selectedNodes[i]; + + AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success, long taskId, SubTask subTask, boolean finished) { + + // check if we can do a merge + String error = null; + int nbChildren = node.getChildCount(); + /*if (nbChildren == 1) { + error = "Merge on an Dataset with only one Child is not possible"; + }*/ + + HashSet checkDifferentResultSetId = new HashSet<>(); + ArrayList resultSetIdList = new ArrayList<>(); + ArrayList resultSummaryIdList = new ArrayList<>(); + for (int i = 0; i < nbChildren; i++) { + DataSetNode childNode = (DataSetNode) node.getChildAt(i); + if (childNode.isChanging()) { + error = "Merge is not possible: child DataSet ("+childNode.getDataset().getName() +") is being processed"; + break; + } + if (!childNode.hasResultSet()) { + error = "Merge is not possible: " + childNode.getDataset().getName() + " has no Search Result"; + break; + } + + Long rsetId = childNode.getDataset().getResultSetId(); + if (checkDifferentResultSetId.contains(rsetId)) { + error = "Merge is not possible: several Search Results are identical"; + break; + } + checkDifferentResultSetId.add(rsetId); + resultSetIdList.add(rsetId); + if (childNode.hasResultSummary()) { + resultSummaryIdList.add(childNode.getDataset().getResultSummaryId()); + } } + + if (error != null) { + JOptionPane.showMessageDialog(IdentificationTree.getCurrentTree(), error, "Warning", JOptionPane.ERROR_MESSAGE); + return; + } + + if (resultSummaryIdList.size() == nbChildren) { + // we do a merge on resultSummary + askMergeService((DataSetNode) node, resultSummaryIdList, true); + } else if (resultSummaryIdList.size() > 0) { + // not all children have a result summary + error = "Merge is not possible: some Search Results are not validated "; + JOptionPane.showMessageDialog(IdentificationTree.getCurrentTree(), error, "Warning", JOptionPane.ERROR_MESSAGE); + } else { + // merge on result set + askMergeService((DataSetNode) node, resultSetIdList, false); + } + + } + }; + + IdentificationTree.getCurrentTree().loadInBackground(node, callback); + } + + } + + private void askMergeService(final DataSetNode node, final List idList, final boolean mergeOnRsm) { + + final DDataset dataset = node.getDataset(); + long projectId = dataset.getProject().getId(); + String datasetName = dataset.getName(); + + node.setIsChanging(true); + IdentificationTree tree = IdentificationTree.getCurrentTree(); + final DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel(); + treeModel.nodeChanged(node); + + // used as out parameter for the service + final Long[] _resultSetId = new Long[1]; + final Long[] _resultSummaryId = new Long[1]; + + AbstractJMSCallback callback = new AbstractJMSCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success) { + if (success) { + updateDataset(node, dataset, _resultSetId[0], _resultSummaryId[0], getTaskInfo()); + + } else { + //JPM.TODO : manage error with errorMessage + node.setIsChanging(false); + + treeModel.nodeChanged(node); + } + } + }; + + MergeTask task = new MergeTask(callback, projectId, m_configuration); + if (mergeOnRsm) { + task.initMergeRsm(idList, datasetName, _resultSetId, _resultSummaryId); + } else { + _resultSummaryId[0] = null; + task.initMergeRset(idList, datasetName, _resultSetId); + } + AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); + } + + private void updateDataset(final DataSetNode datasetNode, DDataset d, Long resultSetId, Long resultSummaryId, TaskInfo taskInfo) { + + AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success, long taskId, SubTask subTask, boolean finished) { + + datasetNode.setIsChanging(false); + + if (datasetNode.hasResultSummary()) { + if(MergeTask.Config.AGGREGATION.equals(m_configuration)) + datasetNode.getDataset().setAggregationInformation( + AggregationInformation.IDENTIFICATION_SUMMARY_AGG); + else + datasetNode.getDataset().setAggregationInformation( + AggregationInformation.IDENTIFICATION_SUMMARY_UNION); + } else { + if(MergeTask.Config.AGGREGATION.equals(m_configuration)) + datasetNode.getDataset().setAggregationInformation( + AggregationInformation.SEARCH_RESULT_AGG); + else + datasetNode.getDataset().setAggregationInformation( + AggregationInformation.SEARCH_RESULT_UNION); + } + + + IdentificationTree tree = IdentificationTree.getCurrentTree(); + DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel(); + treeModel.nodeChanged(datasetNode); + } + }; + + // ask asynchronous loading of data + + + + DatabaseDataSetTask task = new DatabaseDataSetTask(callback); + task.initModifyDatasetForMerge(d, resultSetId, resultSummaryId, taskInfo); + AccessDatabaseThread.getAccessDatabaseThread().addTask(task); + + } + + @Override + public void updateEnabled(AbstractNode[] selectedNodes) { + + // to execute this action, the user must be the owner of the project + Project selectedProject = ProjectExplorerPanel.getProjectExplorerPanel().getSelectedProject(); + if (!DatabaseDataManager.getDatabaseDataManager().ownProject(selectedProject)) { + setEnabled(false); + return; + } + + int nbSelectedNodes = selectedNodes.length; + + if (nbSelectedNodes<0) { + setEnabled(false); + return; + } + + // check if the user has asked merge at the same time between children and + // parents, if it is the case, it is forbidden + HashSet allSelelectedNodeSet = new HashSet<>(); + for (int i = 0; i < nbSelectedNodes; i++) { + AbstractNode node = selectedNodes[i]; + allSelelectedNodeSet.add(node); + } + for (int i = 0; i < nbSelectedNodes; i++) { + AbstractNode node = selectedNodes[i]; + node = (AbstractNode) node.getParent(); + while (node != null) { + if (allSelelectedNodeSet.contains(node)) { + setEnabled(false); + return; + } + node = (AbstractNode) node.getParent(); + } + } + + + + for (int i = 0; i < nbSelectedNodes; i++) { + AbstractNode node = (AbstractNode) selectedNodes[i]; + + if (node.isChanging()) { + setEnabled(false); + return; + } + + if (node.getType() != AbstractNode.NodeTypes.DATA_SET) { + setEnabled(false); + return; + } + + DataSetNode datasetNode = (DataSetNode) node; + + if (datasetNode.isLeaf()) { + setEnabled(false); + return; + } + + if (!((DataSetData) datasetNode.getData()).getDatasetType().isAggregation()) { + setEnabled(false); + return; + } + + if (datasetNode.hasResultSet()) { + setEnabled(false); + return; + } + } + + setEnabled(true ); + } + } \ No newline at end of file diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/PasteSearchResult.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/PasteSearchResult.java index d3c07047c..f43fd96e4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/PasteSearchResult.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/PasteSearchResult.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.Project; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/PropertiesAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/PropertiesAction.java index 826c59d2f..50cb595f4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/PropertiesAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/PropertiesAction.java @@ -1,28 +1,29 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.pattern.DataboxGeneric; import fr.proline.studio.rsmexplorer.gui.model.properties.IdentificationPropertiesTableModel; import java.util.*; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.gui.GenericPanel; import fr.proline.studio.rsmexplorer.gui.model.properties.AbstractPropertiesTableModel; import fr.proline.studio.rsmexplorer.gui.model.properties.XICPropertiesTableModel; @@ -31,7 +32,7 @@ import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; import fr.proline.studio.utils.IconManager; -import org.openide.util.NbBundle; + /** * Display of the properties of a rset and rsm @@ -43,7 +44,7 @@ public class PropertiesAction extends AbstractRSMAction { public PropertiesAction(AbstractTree tree) { - super(NbBundle.getMessage(PropertiesAction.class, "CTL_PropertiesAction"), tree); + super("Properties", tree); } @Override @@ -74,9 +75,9 @@ public void actionPerformed(final AbstractNode[] selectedNodes, int x, int y) { WindowBox windowBox = WindowBoxFactory.getGenericWindowBox(name, "Properties", IconManager.IconType.DOCUMENT_LIST, true); model = identificationProperties ? new IdentificationPropertiesTableModel() : new XICPropertiesTableModel(); windowBox.setEntryData(-1L, model); - DataBoxViewerTopComponent win2 = new DataBoxViewerTopComponent(windowBox); - win2.open(); - win2.requestActive(); + DataBoxViewerTopPanel win2 = new DataBoxViewerTopPanel(windowBox); + WindowManager.getDefault().getMainWindow().displayWindow(win2); + //JPM.HACK ! Impossible to set the max number of lines differently in this case DataboxGeneric databoxGeneric = ((DataboxGeneric) windowBox.getEntryBox()); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/QuantifyAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/QuantifyAction.java index 16bbd3bd5..823ac0376 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/QuantifyAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/QuantifyAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.QuantitationMethod; @@ -22,7 +22,7 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; -import org.openide.util.NbBundle; + /** * Action for the menu to display data for Identification Summary @@ -38,7 +38,7 @@ public class QuantifyAction extends AbstractRSMAction { private JMenu m_menu; public QuantifyAction(AbstractTree tree) { - super(NbBundle.getMessage(QuantifyAction.class, "CTL_QuantifyAction"), tree); + super("Quantify", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/RenameAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/RenameAction.java index 7e0a21ef5..60a132ab5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/RenameAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/RenameAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.dto.DDataset; @@ -26,8 +26,8 @@ import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.rsmexplorer.tree.identification.IdProjectIdentificationNode; import fr.proline.studio.rsmexplorer.tree.AbstractTree; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; /** * Action to Rename a dataset @@ -39,7 +39,7 @@ public class RenameAction extends AbstractRSMAction { * Builds the RenameAction depending of the treeType */ public RenameAction(AbstractTree tree) { - super(NbBundle.getMessage(RenameAction.class, "CTL_RenameAction"), tree); + super("Rename...", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/RenameRsetAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/RenameRsetAction.java index 321dba23d..4c753e9ea 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/RenameRsetAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/RenameRsetAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.studio.rsmexplorer.tree.AbstractNode; @@ -21,7 +21,7 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; -import org.openide.util.NbBundle; + /** * Action with a Menu for the Display of Rset (Search Result) @@ -35,7 +35,7 @@ public class RenameRsetAction extends AbstractRSMAction { private JMenu m_menu; public RenameRsetAction(AbstractTree tree) { - super(NbBundle.getMessage(RenameRsetAction.class, "CTL_RenameRsetAction"), tree); + super("Rename", tree); } @Override @@ -44,10 +44,10 @@ public JMenuItem getPopupPresenter() { m_renameAction = new RenameAction(getTree()); - m_searchNameAction = new SetRsetNameAction(getTree(), ImportManager.SEARCH_RESULT_NAME_SOURCE, "CTL_RenameRsetSearchResultAction"); - m_peaklistAction = new SetRsetNameAction(getTree(), ImportManager.PEAKLIST_PATH_SOURCE, "CTL_RenameRsetPeaklistAction"); - m_msiAction = new SetRsetNameAction(getTree(), ImportManager.MSI_SEARCH_FILE_NAME_SOURCE, "CTL_RenameRsetMsiAction"); - m_mascotAction = new SetRsetNameAction(getTree(), ImportManager.MASCOT_DAEMON_RULE, "CTL_RenameRsetMascotAction"); + m_searchNameAction = new SetRsetNameAction(getTree(), ImportManager.SEARCH_RESULT_NAME_SOURCE, "Set Search Result Name"); + m_peaklistAction = new SetRsetNameAction(getTree(), ImportManager.PEAKLIST_PATH_SOURCE, "Set Peaklist Name"); + m_msiAction = new SetRsetNameAction(getTree(), ImportManager.MSI_SEARCH_FILE_NAME_SOURCE, "Set MSI Search Filename Name"); + m_mascotAction = new SetRsetNameAction(getTree(), ImportManager.MASCOT_DAEMON_RULE, "Set Using Mascot Daemon Rule"); JMenuItem renameItem = new JMenuItem(m_renameAction); JMenuItem searchNameItem = new JMenuItem(m_searchNameAction); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/RetrieveBioSeqJMSAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/RetrieveBioSeqJMSAction.java index 2db04273d..6b4f7c8be 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/RetrieveBioSeqJMSAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/RetrieveBioSeqJMSAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -33,8 +33,8 @@ import java.util.ArrayList; import java.util.List; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +47,7 @@ public class RetrieveBioSeqJMSAction extends AbstractRSMAction { protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); public RetrieveBioSeqJMSAction(AbstractTree tree) { - super(NbBundle.getMessage(RetrieveBioSeqJMSAction.class, "CTL_RetrieveBioSeq"), tree); + super("Retrieve Protein Sequences...", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/SetRsetNameAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/SetRsetNameAction.java index 351f94221..55d9e1fc7 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/SetRsetNameAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/SetRsetNameAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.dto.DDataset; @@ -31,7 +31,7 @@ import java.util.ArrayList; import java.util.Enumeration; import javax.swing.JOptionPane; -import org.openide.util.NbBundle; + /** * Action to Rename a dataset @@ -51,8 +51,8 @@ public class SetRsetNameAction extends AbstractRSMAction { * Builds the RenameAction depending of the treeType * */ - public SetRsetNameAction(AbstractTree tree, String naming, String ctlProperty) { - super(NbBundle.getMessage(SetRsetNameAction.class, ctlProperty), tree); + public SetRsetNameAction(AbstractTree tree, String naming, String name) { + super(name, tree); this.m_naming = naming; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/SpectralCountAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/SpectralCountAction.java index b41a20cde..6d35f4acc 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/SpectralCountAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/SpectralCountAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.Project; @@ -36,8 +36,8 @@ import java.util.ArrayList; import javax.swing.JOptionPane; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,7 +56,7 @@ public class SpectralCountAction extends AbstractRSMAction { public SpectralCountAction(AbstractTree tree) { - super(NbBundle.getMessage(SpectralCountAction.class, "CTL_CompareWithSCAction"), tree); + super("Spectral Counting...", tree); } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/UpdatePeaklistSoftwareAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/UpdatePeaklistSoftwareAction.java index 4615fb88f..b2f90cd01 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/UpdatePeaklistSoftwareAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/UpdatePeaklistSoftwareAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.identification; import fr.proline.core.orm.uds.Project; @@ -31,8 +31,8 @@ import java.util.ArrayList; import java.util.List; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,7 +44,7 @@ public class UpdatePeaklistSoftwareAction extends AbstractRSMAction { protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); public UpdatePeaklistSoftwareAction(AbstractTree tree){ - super(NbBundle.getMessage(UpdatePeaklistSoftwareAction.class, "CTL_UpdatePeaklistSoft"), tree); + super("Update Spectrum using Peaklist software...", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ValidateJMSAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ValidateJMSAction.java index a4001e1d4..7274e8500 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ValidateJMSAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/identification/ValidateJMSAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -44,8 +44,8 @@ import java.util.*; import java.util.stream.Collectors; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; /** * Action to validate or re-validate a Search Result @@ -57,7 +57,7 @@ public class ValidateJMSAction extends AbstractRSMAction { public ValidateJMSAction(AbstractTree tree) { - super(NbBundle.getMessage(ValidateJMSAction.class, "CTL_ValidateAction"), tree); + super("Validate Search Result...", tree); } @Override @@ -135,7 +135,7 @@ public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { final DDataset d = dataSetNode.getDataset(); - if (dataSetNode.hasResultSummary()) { + if (dataSetNode.hasResultSummary() || propagateValidation ) { removePreviousValidation(dataSetNode, propagateValidation); } askValidation(dataSetNode, validationArguments, changeTypicalRules, scoringType, propagateValidation); @@ -151,15 +151,15 @@ public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { private void removePreviousValidation(DataSetNode dataSetNode, boolean removeInHierarchy){ if (removeInHierarchy) { - Runnable callback = new Runnable() { - @Override - public void run() { - removePreviousValidationImpl(dataSetNode, removeInHierarchy); - } + Runnable callback = new Runnable() { + @Override + public void run() { + removePreviousValidationImpl(dataSetNode, removeInHierarchy); + } - }; - - IdentificationTree.getCurrentTree().loadNode(dataSetNode, callback, true); + }; + + IdentificationTree.getCurrentTree().loadNode(dataSetNode, callback, true); } else { removePreviousValidationImpl(dataSetNode, removeInHierarchy); } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayIdentificationProteinSetsAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayIdentificationProteinSetsAction.java index cb3491f50..7137e184e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayIdentificationProteinSetsAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayIdentificationProteinSetsAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -17,10 +17,11 @@ package fr.proline.studio.rsmexplorer.actions.table; import fr.proline.core.orm.msi.ResultSummary; +import fr.proline.studio.WindowManager; import fr.proline.studio.pattern.AbstractDataBox; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.table.AbstractTableAction; import fr.proline.studio.table.ExportTableSelectionInterface; import java.util.HashSet; @@ -59,9 +60,8 @@ public void actionPerformed(int col, int row, int[] selectedRows, JTable table) wbox.setEntryData(m_box.getProjectId(), rsm); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayMenuAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayMenuAction.java index d9eb73a59..557d9ffac 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayMenuAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayMenuAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.table; import fr.proline.studio.pattern.AbstractDataBox; @@ -67,9 +67,13 @@ public void populate(AbstractDataBox dataBox) { boolean hasSubActions = false; DataboxStyle previousStyle = null; - for (DataboxStyle style : DataboxStyle.values()) { + TreeMap dataBoxMap = DataboxManager.getDataboxManager().findCompatibleDataboxList(dataBox, dataBox.getDataboxNavigationOutParameterClasses()); + if(!dataBox.isLoaded()){ + m_menu.setEnabled(hasSubActions); + return; + } - TreeMap dataBoxMap = DataboxManager.getDataboxManager().findCompatibleDataboxList(dataBox, dataBox.getImportantInParameterClass()); + for (DataboxStyle style : DataboxStyle.values()) { Iterator it = dataBoxMap.descendingKeySet().iterator(); while (it.hasNext()) { AbstractDataBox destDatabox = dataBoxMap.get(it.next()); @@ -87,7 +91,6 @@ public void populate(AbstractDataBox dataBox) { m_menu.add(displayOptionMenuItem); hasSubActions = true; } - } m_menu.setEnabled(hasSubActions); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayTablePopupMenu.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayTablePopupMenu.java index 6f88b98af..8fcec82bb 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayTablePopupMenu.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayTablePopupMenu.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayViewInNewWindowAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayViewInNewWindowAction.java index 80ff94054..d0db8464c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayViewInNewWindowAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/table/DisplayViewInNewWindowAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,11 +16,12 @@ */ package fr.proline.studio.rsmexplorer.actions.table; -import fr.proline.studio.pattern.AbstractDataBox; -import fr.proline.studio.pattern.DataBoxFrozenCopy; -import fr.proline.studio.pattern.WindowBox; -import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.WindowManager; +import fr.proline.studio.pattern.*; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.awt.Image; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; @@ -35,7 +36,7 @@ public class DisplayViewInNewWindowAction extends AbstractAction { private AbstractDataBox m_sourceBox; private AbstractDataBox m_destinationBox; - + protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); public DisplayViewInNewWindowAction(AbstractDataBox sourceBox, AbstractDataBox destinationBox, String description) { super(description); @@ -47,9 +48,10 @@ public DisplayViewInNewWindowAction(AbstractDataBox sourceBox, AbstractDataBox d m_sourceBox = sourceBox; try { - m_destinationBox = destinationBox.getClass().newInstance(); + m_destinationBox = DataboxManager.getDataboxNewInstance(destinationBox); } catch (InstantiationException | IllegalAccessException e) { // should never happen + m_logger.error("Error creating new Databox ",e); } } @@ -62,7 +64,7 @@ public void actionPerformed(ActionEvent e) { dataBoxFrozenCopy.addNextDataBox(m_destinationBox); - String dataName = m_sourceBox.getImportantOutParameterValue(); + String dataName = m_sourceBox.getDataboxNavigationDisplayValue(); if ((dataName !=null) && (dataName.length()>12)) { dataName = dataName.substring(0,10)+"..."; } @@ -70,18 +72,17 @@ public void actionPerformed(ActionEvent e) { final WindowBox wbox = WindowBoxFactory.getDetailWindowBox(dataName, dataName+": "+m_destinationBox.getDescription(), m_destinationBox); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); - Class[] classes = m_sourceBox.getImportantInParameterClass(); - for (int i=0;i. - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.xic; import fr.proline.core.orm.uds.Project; @@ -35,7 +35,7 @@ import fr.proline.studio.rsmexplorer.tree.quantitation.QuantitationTree; import java.util.ArrayList; import javax.swing.tree.DefaultTreeModel; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/AggregateQuantitationsAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/AggregateQuantitationsAction.java index aab7d148b..52cb95e28 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/AggregateQuantitationsAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/AggregateQuantitationsAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -42,8 +42,8 @@ import java.util.stream.Collectors; import javax.swing.JOptionPane; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -57,7 +57,7 @@ public class AggregateQuantitationsAction extends AbstractRSMAction { private int m_nbLoadedQuanti; public AggregateQuantitationsAction(AbstractTree tree) { - super(NbBundle.getMessage(AggregateQuantitationsAction.class, "CTL_AggregateQuantitations"), tree); + super("Aggregate Quantitations", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/ComputeQuantPostProcessingAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/ComputeQuantPostProcessingAction.java index 4d2bcd33f..d7d2d4521 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/ComputeQuantPostProcessingAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/ComputeQuantPostProcessingAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -23,10 +23,7 @@ import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.DatabaseDataManager; import fr.proline.studio.dam.data.DataSetData; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; -import fr.proline.studio.dam.tasks.DatabaseDataSetTask; -import fr.proline.studio.dam.tasks.DatabasePTMSitesTask; -import fr.proline.studio.dam.tasks.SubTask; +import fr.proline.studio.dam.tasks.*; import fr.proline.studio.dpm.AccessJMSManagerThread; import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; import fr.proline.studio.gui.DefaultDialog; @@ -47,8 +44,8 @@ import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; /** * key word: Refine = Compute Quan Post Processing @@ -60,7 +57,7 @@ public class ComputeQuantPostProcessingAction extends AbstractRSMAction { private int m_nbLoadedQuanti; public ComputeQuantPostProcessingAction(AbstractTree tree) { - super(NbBundle.getMessage(ComputeQuantPostProcessingAction.class, "CTL_ComputeQuantPostProcessingAction"), tree); + super("Compute Post Processing on Abundances...", tree); } @Override @@ -76,7 +73,7 @@ public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { final int posX = x; final int posY = y; - ArrayList computedList = new ArrayList(); + ArrayList computedList = new ArrayList<>(); ArrayList selectedDatasetNodeList = new ArrayList<>(); m_nbLoadedQuanti = 0; for (AbstractNode n : selectedNodes) { @@ -211,15 +208,15 @@ public void run(boolean success) { } public static boolean quantificationProfile(final ResultCallback resultCallback, int posx, int posy, Long pID, DDataset paramsFromdataSet) { - ArrayList nodeList = new ArrayList(); + ArrayList nodeList = new ArrayList<>(); nodeList.add(new DataSetNode(new DataSetData(paramsFromdataSet))); return quantificationProfile(resultCallback, posx, posy, pID, nodeList, paramsFromdataSet); } private static ArrayList fetchPtmsFromDAM(ArrayList nodeList) { - ArrayList ptms = new ArrayList(); - DatabasePTMSitesTask task = new DatabasePTMSitesTask(null); - ArrayList rsmIdList = new ArrayList(); + ArrayList ptms = new ArrayList<>(); + DatabasePTMsTask task = new DatabasePTMsTask(null); + ArrayList rsmIdList = new ArrayList<>(); DDataset dataset; long projectId = nodeList.get(0).getDataset().getProject().getId(); for (int i = 0; i < nodeList.size(); i++) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/CreateAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/CreateAction.java index 48f70bc78..57c5d9e2d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/CreateAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/CreateAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.xic; import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; @@ -22,7 +22,7 @@ import fr.proline.studio.rsmexplorer.tree.xic.QuantExperimentalDesignTree; import javax.swing.JMenu; import javax.swing.JMenuItem; -import org.openide.util.NbBundle; + /** * @@ -41,7 +41,7 @@ public class CreateAction extends AbstractRSMAction { private JMenuItem m_createChannelItem; public CreateAction(QuantExperimentalDesignTree tree) { - super(NbBundle.getMessage(CreateAction.class, "CTL_CreateAction"), tree); + super("Create", tree); m_tree = tree; } @@ -52,11 +52,11 @@ public JMenuItem getPopupPresenter() { m_menu = new JMenu((String) getValue(NAME)); m_createSampleAction = new CreateXICBiologicalNodeAction( - NbBundle.getMessage(CreateAction.class, "CTL_CreateSampleAction"), AbstractNode.NodeTypes.BIOLOGICAL_SAMPLE, m_tree); + "Sample", AbstractNode.NodeTypes.BIOLOGICAL_SAMPLE, m_tree); m_createGroupAction = new CreateXICBiologicalNodeAction( - NbBundle.getMessage(CreateAction.class, "CTL_CreateGroupAction"), AbstractNode.NodeTypes.BIOLOGICAL_GROUP, m_tree); + "Group", AbstractNode.NodeTypes.BIOLOGICAL_GROUP, m_tree); m_createChannelAction = new CreateXICBiologicalNodeAction( - NbBundle.getMessage(CreateAction.class, "CTL_CreateChannelAction"), AbstractNode.NodeTypes.BIOLOGICAL_SAMPLE_ANALYSIS, m_tree); + "Channel", AbstractNode.NodeTypes.BIOLOGICAL_SAMPLE_ANALYSIS, m_tree); m_createSampleItem = new JMenuItem(m_createSampleAction); m_createGroupItem = new JMenuItem(m_createGroupAction); m_createChannelItem = new JMenuItem(m_createChannelAction); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/CreateXICBiologicalNodeAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/CreateXICBiologicalNodeAction.java index f83394ac3..e02c2a717 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/CreateXICBiologicalNodeAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/CreateXICBiologicalNodeAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.xic; import fr.proline.studio.dam.data.DataSetData; @@ -28,7 +28,7 @@ import fr.proline.studio.rsmexplorer.tree.xic.XICBiologicalSampleNode; import javax.swing.Action; import javax.swing.tree.DefaultTreeModel; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DeleteAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DeleteAction.java index c355c86ab..3c98c0388 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DeleteAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DeleteAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.xic; import fr.proline.core.orm.uds.Project; @@ -23,7 +23,7 @@ import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import java.util.ArrayList; -import org.openide.util.NbBundle; + /** * Delete a Node in a Xic QuantExperimentalDesignTree @@ -33,7 +33,7 @@ public class DeleteAction extends AbstractRSMAction { public DeleteAction(AbstractTree tree) { - super(NbBundle.getMessage(DeleteAction.class, "CTL_DeleteAction"), tree); + super("Delete", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayExperimentalDesignAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayExperimentalDesignAction.java index 895a22b50..59e63510b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayExperimentalDesignAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayExperimentalDesignAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.xic; import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; @@ -21,7 +21,7 @@ import fr.proline.studio.rsmexplorer.tree.AbstractTree; import javax.swing.JMenu; import javax.swing.JMenuItem; -import org.openide.util.NbBundle; + /** * Action to display the experimental design: menu with exp. design parameters @@ -33,11 +33,12 @@ public class DisplayExperimentalDesignAction extends AbstractRSMAction { private AbstractRSMAction m_xicParamAction; private AbstractRSMAction m_mapAlignmentAction; + private AbstractRSMAction m_mapMozAlignmentAction; private JMenu m_menu; public DisplayExperimentalDesignAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayExperimentalDesignAction.class, "CTL_DisplayExperimentalDesignAction"), tree); + super("Display Exp. Design", tree); } @Override @@ -46,12 +47,15 @@ public JMenuItem getPopupPresenter() { m_xicParamAction = new DisplayXicParamAction(getTree()); m_mapAlignmentAction = new DisplayMapAlignmentAction(getTree()); + m_mapMozAlignmentAction = new DisplayMapMoZAlignmentAction(getTree()); JMenuItem xicParamItem = new JMenuItem(m_xicParamAction); JMenuItem mapAlignItem = new JMenuItem(m_mapAlignmentAction); - + JMenuItem mapMoZAlignItem = new JMenuItem(m_mapMozAlignmentAction); + m_menu.add(xicParamItem); m_menu.add(mapAlignItem); + m_menu.add(mapMoZAlignItem); return m_menu; } @@ -61,9 +65,9 @@ public void updateEnabled(AbstractNode[] selectedNodes) { m_xicParamAction.updateEnabled(selectedNodes); m_mapAlignmentAction.updateEnabled(selectedNodes); + m_mapMozAlignmentAction.updateEnabled(selectedNodes); - - boolean isEnabled = m_xicParamAction.isEnabled() || m_mapAlignmentAction.isEnabled(); + boolean isEnabled = m_xicParamAction.isEnabled() || m_mapAlignmentAction.isEnabled() ||m_mapMozAlignmentAction.isEnabled(); setEnabled(isEnabled); m_menu.setEnabled(isEnabled); } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayMapAlignmentAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayMapAlignmentAction.java index 35e0e406b..c5edb5fd7 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayMapAlignmentAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayMapAlignmentAction.java @@ -1,31 +1,32 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.xic; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.data.DataSetData; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import org.openide.util.NbBundle; + /** * Action to display map alignment @@ -35,7 +36,7 @@ public class DisplayMapAlignmentAction extends AbstractRSMAction { public DisplayMapAlignmentAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayMapAlignmentAction.class, "CTL_DisplayMapAlignmentAction"), tree); + super("Map Alignment", tree); } @Override @@ -58,9 +59,8 @@ private void actionImpl(DataSetNode dataSetNode) { wbox.setEntryData(dataset.getProject().getId(), dataset); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayMapMoZAlignmentAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayMapMoZAlignmentAction.java new file mode 100644 index 000000000..8db920d34 --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayMapMoZAlignmentAction.java @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.actions.xic; + +import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dam.data.DataSetData; +import fr.proline.studio.pattern.WindowBox; +import fr.proline.studio.pattern.WindowBoxFactory; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; +import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; +import fr.proline.studio.rsmexplorer.tree.AbstractNode; +import fr.proline.studio.rsmexplorer.tree.AbstractTree; +import fr.proline.studio.rsmexplorer.tree.DataSetNode; + + +/** + * Action to display map alignment + * + * @author MB243701 + */ +public class DisplayMapMoZAlignmentAction extends AbstractRSMAction { + + public DisplayMapMoZAlignmentAction(AbstractTree tree) { + super("MoZ Calibration", tree); + } + + @Override + public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { + + int nbNodes = selectedNodes.length; + for (int i = 0; i < nbNodes; i++) { + DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; + + actionImpl(dataSetNode); + } + + } + + private void actionImpl(DataSetNode dataSetNode) { + + final DDataset dataset = ((DataSetData) dataSetNode.getData()).getDataset(); + + WindowBox wbox = WindowBoxFactory.getMapMozCalibrationWindowBox(dataset.getName(), dataset.getName() + " Moz calibration"); + wbox.setEntryData(dataset.getProject().getId(), dataset); + + // open a window to display the window box + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); + } + + @Override + public void updateEnabled(AbstractNode[] selectedNodes) { + // only one node selected + if (selectedNodes.length != 1) { + setEnabled(false); + return; + } + + AbstractNode node = (AbstractNode) selectedNodes[0]; + + // the node must not be in changing state + if (node.isChanging()) { + setEnabled(false); + return; + } + + // must be a dataset + if (node.getType() != AbstractNode.NodeTypes.DATA_SET) { + setEnabled(false); + return; + } + + if ((node.getType() == AbstractNode.NodeTypes.DATA_SET) && ((DataSetNode)node).getDataset().isAggregation() ) { + setEnabled(false); + return; + } + + DataSetNode datasetNode = (DataSetNode) node; + + if (datasetNode.isFolder()) { + setEnabled(false); + return; + } + + // must be a quantitation XIC + if (!datasetNode.isQuantXIC()) { + setEnabled(false); + return; + } + + setEnabled(true); + } +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICAction.java index 49b0be75f..c7fff192f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.xic; import fr.proline.studio.pattern.WindowSavedManager; @@ -26,7 +26,7 @@ import java.util.ArrayList; import javax.swing.JMenu; import javax.swing.JMenuItem; -import org.openide.util.NbBundle; + /** * @@ -39,14 +39,17 @@ public class DisplayXICAction extends AbstractRSMAction { private DisplayXICProteinSetAction m_displayXICProteinSetAction; private DisplayXICPeptideSetAction m_displayXICPeptideSetAction; private DisplayXICPeptideIonAction m_displayXICPeptideIonAction; + private DisplayXICPTMSitesAction m_displayXICPtmSiteProteinAction; private DisplayXICPTMClusterAction m_displayXICPtmClusterProteinAction; + private DisplayXICPTMClusterAction m_displayyAnnotatedXICPtmClusterProteinAction; + private DisplayUserWindowAction m_displayUserWindowAction; private ManageUserWindowsAction m_manageUserWindowsAction; private ArrayList m_displaySavedWindowActionList; public DisplayXICAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayXICAction.class,"CTL_DisplayXicAction"), tree); + super("Display Abundances", tree); } @Override @@ -56,8 +59,11 @@ public JMenuItem getPopupPresenter() { m_displayXICProteinSetAction = new DisplayXICProteinSetAction(getTree()); m_displayXICPeptideSetAction = new DisplayXICPeptideSetAction(getTree()); m_displayXICPeptideIonAction = new DisplayXICPeptideIonAction(getTree()); + m_displayXICPtmSiteProteinAction = new DisplayXICPTMSitesAction(getTree()); m_displayXICPtmClusterProteinAction = new DisplayXICPTMClusterAction(getTree()); + m_displayyAnnotatedXICPtmClusterProteinAction = new DisplayXICPTMClusterAction(true, getTree()); + m_manageUserWindowsAction = new ManageUserWindowsAction(WindowSavedManager.SAVE_WINDOW_FOR_QUANTI, getTree()); m_displayUserWindowAction = new DisplayUserWindowAction(WindowSavedManager.SAVE_WINDOW_FOR_QUANTI, getTree()); @@ -79,7 +85,8 @@ public JMenuItem getPopupPresenter() { JMenuItem displayXICPeptideIonItem = new JMenuItem(m_displayXICPeptideIonAction); JMenuItem displayXICPtmSiteProteinItem = new JMenuItem(m_displayXICPtmSiteProteinAction); JMenuItem displayXICPtmClusterProteinItem = new JMenuItem(m_displayXICPtmClusterProteinAction); - + JMenuItem displayXICAnnotatedPtmClusterProteinItem = new JMenuItem(m_displayyAnnotatedXICPtmClusterProteinAction); + JMenuItem displayUserWindowItem = new JMenuItem(m_displayUserWindowAction); JMenuItem manageUserWindowsItem = new JMenuItem(m_manageUserWindowsAction); @@ -89,6 +96,7 @@ public JMenuItem getPopupPresenter() { m_menu.addSeparator(); m_menu.add(displayXICPtmSiteProteinItem); m_menu.add(displayXICPtmClusterProteinItem); + m_menu.add(displayXICAnnotatedPtmClusterProteinItem); m_menu.addSeparator(); m_menu.add(displayUserWindowItem); m_menu.add(manageUserWindowsItem); @@ -112,6 +120,7 @@ public void updateEnabled(AbstractNode[] selectedNodes) { m_displayXICPeptideIonAction.updateEnabled(selectedNodes); m_displayXICPtmSiteProteinAction.updateEnabled(selectedNodes); m_displayXICPtmClusterProteinAction.updateEnabled(selectedNodes); + m_displayyAnnotatedXICPtmClusterProteinAction.updateEnabled(selectedNodes); m_displayUserWindowAction.updateEnabled(selectedNodes); m_manageUserWindowsAction.updateEnabled(selectedNodes); @@ -121,7 +130,8 @@ public void updateEnabled(AbstractNode[] selectedNodes) { listEnabled |= m_displaySavedWindowActionList1.isEnabled(); } - boolean isEnabled = m_displayXICProteinSetAction.isEnabled() || m_displayXICPtmSiteProteinAction.isEnabled()|| m_displayXICPtmClusterProteinAction.isEnabled() || m_displayXICPeptideSetAction.isEnabled() || m_displayXICPeptideIonAction.isEnabled() || m_displayUserWindowAction.isEnabled() || m_manageUserWindowsAction.isEnabled() || listEnabled; + boolean isEnabled = m_displayXICProteinSetAction.isEnabled() || m_displayXICPtmSiteProteinAction.isEnabled() || m_displayXICPtmClusterProteinAction.isEnabled() + || m_displayyAnnotatedXICPtmClusterProteinAction.isEnabled() || m_displayXICPeptideSetAction.isEnabled() || m_displayXICPeptideIonAction.isEnabled() || m_displayUserWindowAction.isEnabled() || m_manageUserWindowsAction.isEnabled() || listEnabled; setEnabled(isEnabled); m_menu.setEnabled(isEnabled); } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICPTMClusterAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICPTMClusterAction.java index 11f58d369..e3161967b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICPTMClusterAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICPTMClusterAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,95 +16,30 @@ */ package fr.proline.studio.rsmexplorer.actions.xic; -import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.studio.dam.AccessDatabaseThread; -import fr.proline.studio.dam.data.DataSetData; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; -import fr.proline.studio.dam.tasks.DatabaseDataSetTask; -import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.dam.tasks.data.ptm.PTMDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; -import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; +import fr.proline.studio.rsmexplorer.actions.AbstractDisplayPTMDataAction; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import org.openide.util.NbBundle; + /** * * @author VD225637 */ -public class DisplayXICPTMClusterAction extends AbstractRSMAction { - - public DisplayXICPTMClusterAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayXICPTMClusterAction.class, "CTL_DisplayPtmClusterProtein"), tree); - } - - @Override - public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { - // int answer= JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), "Do you want to \n - View Protein Sites in V2 ? Click on YES \n - View PTM Clusters ? Click on No \n - View PTM Sites in V1 ? Click on Cancel."); - int nbNodes = selectedNodes.length; - for (int i = 0; i < nbNodes; i++) { - DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; - actionImpl(dataSetNode); - } +public class DisplayXICPTMClusterAction extends AbstractDisplayPTMDataAction { + public DisplayXICPTMClusterAction(boolean isAnnotatedPTMDs, AbstractTree tree) { + super(false, isAnnotatedPTMDs, tree, "Modification"); } - - private void actionImpl(DataSetNode dataSetNode) { - - final DDataset dataSet = ((DataSetData) dataSetNode.getData()).getDataset(); - - if (!dataSetNode.hasResultSummary()) { - return; // should not happen - } - - ResultSummary rsm = dataSetNode.getResultSummary(); - if (rsm != null) { - - // prepare window box - WindowBox wbox = WindowBoxFactory.getXicPTMDataWindowBox(dataSet.getName(), false); ; - wbox.setEntryData(dataSet.getProject().getId(), new PTMDataset(dataSet)); - - // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); - - } else { - - - // we have to load the result set - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - WindowBox wbox = WindowBoxFactory.getXicPTMDataWindowBox(dataSet.getName(), false); - - // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); - - // prepare window box - wbox.setEntryData(dataSet.getProject().getId(), new PTMDataset(dataSet)); - } - }; - - // ask asynchronous loading of data - DatabaseDataSetTask task = new DatabaseDataSetTask(callback); - task.initLoadRsetAndRsm(dataSet); - AccessDatabaseThread.getAccessDatabaseThread().addTask(task); - } + public DisplayXICPTMClusterAction(AbstractTree tree) + { + this( false, tree); } @@ -112,7 +47,7 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) public void updateEnabled(AbstractNode[] selectedNodes) { int nbSelectedNodes = selectedNodes.length; - if (nbSelectedNodes <0) { + if (nbSelectedNodes == 0) { setEnabled(false); return; } @@ -139,6 +74,14 @@ public void updateEnabled(AbstractNode[] selectedNodes) { setEnabled(true); } - + + protected void loadWindowBox(DDataset dataSet, Object data, boolean unsaved) { + WindowBox wbox = WindowBoxFactory.getXicPTMDataWindowBox(dataSet.getName(), false, isAnnotatedPTMsAction(),unsaved); + wbox.setEntryData(dataSet.getProject().getId(), data); + + // open a window to display the window box + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); + } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICPTMSitesAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICPTMSitesAction.java index 9b6988b19..f62c7fca2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICPTMSitesAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICPTMSitesAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,183 +16,53 @@ */ package fr.proline.studio.rsmexplorer.actions.xic; -import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.studio.dam.AccessDatabaseThread; -import fr.proline.studio.dam.data.DataSetData; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; -import fr.proline.studio.dam.tasks.DatabaseDataSetTask; -import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.dam.tasks.data.ptm.PTMDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; -import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; +import fr.proline.studio.rsmexplorer.actions.AbstractDisplayPTMDataAction; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import org.openide.util.NbBundle; /** * * @author VD225637 */ -public class DisplayXICPTMSitesAction extends AbstractRSMAction { +public class DisplayXICPTMSitesAction extends AbstractDisplayPTMDataAction { + + public DisplayXICPTMSitesAction( boolean isAnnotatedPTMDs, AbstractTree tree) { + super(true, isAnnotatedPTMDs, tree,"Modification"); - public DisplayXICPTMSitesAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayXICPTMSitesAction.class, "CTL_DisplayPtmSiteProtein"), tree); } - @Override - public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { - int nbNodes = selectedNodes.length; - for (int i = 0; i < nbNodes; i++) { - DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; - actionImpl(dataSetNode); - } + public DisplayXICPTMSitesAction(AbstractTree tree) { + this( false, tree); } - private void actionImpl(DataSetNode dataSetNode) { - final DDataset dataSet = ((DataSetData) dataSetNode.getData()).getDataset(); + protected void loadWindowBox(DDataset dataSet, Object data, boolean unsaved) { - if (!dataSetNode.hasResultSummary()) { - return; // should not happen - } + // prepare window box + WindowBox wbox = WindowBoxFactory.getXicPTMDataWindowBox(dataSet.getName(), true, isAnnotatedPTMsAction(),unsaved); + wbox.setEntryData(dataSet.getProject().getId(), data); - ResultSummary rsm = dataSetNode.getResultSummary(); - if (rsm != null) { - - // prepare window box - WindowBox wbox = WindowBoxFactory.getXicPTMDataWindowBox(dataSet.getName(), true); - wbox.setEntryData(dataSet.getProject().getId(), new PTMDataset(dataSet)); - - // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); - - } else { - - // we have to load the result set - AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - WindowBox wbox = WindowBoxFactory.getXicPTMDataWindowBox(dataSet.getName(), true); - // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); - - // prepare window box - wbox.setEntryData(dataSet.getProject().getId(), new PTMDataset(dataSet)); - } - }; - - // ask asynchronous loading of data - DatabaseDataSetTask task = new DatabaseDataSetTask(callback); - task.initLoadRsetAndRsm(dataSet); - AccessDatabaseThread.getAccessDatabaseThread().addTask(task); - } + // open a window to display the window box + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } -// @Override -// public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { -// DisplayPTMSitesAction.DisplayPTMSiteDialog dialog = new DisplayPTMSitesAction.DisplayPTMSiteDialog(WindowManager.getDefault().getMainWindow()); -// dialog.setLocation(x, y); -// dialog.setVisible(true); -// if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { -// int nbNodes = selectedNodes.length; -// for (int i = 0; i < nbNodes; i++) { -// DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; -// actionImpl(dataSetNode, dialog.getServiceVersion()); -// } -// } -// -// -// } - -// private void actionImpl(DataSetNode dataSetNode, String serviceVersion) { -// -// final DDataset dataSet = ((DataSetData) dataSetNode.getData()).getDataset(); -// -// if (!dataSetNode.hasResultSummary()) { -// return; // should not happen -// } -// -// ResultSummary rsm = dataSetNode.getResultSummary(); -// if (rsm != null) { -// -// // prepare window box -// WindowBox wbox; -// if (serviceVersion.equals("2.0")) { -// wbox = WindowBoxFactory.getXicPTMSitesWindowBoxV2(dataSet.getName()); -// } else if (serviceVersion.equals("2.1")){ -// wbox = WindowBoxFactory.getXicPTMDataWindowBox(dataSet.getName(), true); -// } else { -// wbox = WindowBoxFactory.getXicPTMSitesWindowBoxV1(dataSet.getName()); -// } -// wbox.setEntryData(dataSet.getProject().getId(), new PTMDataset(dataSet)); -// -// // open a window to display the window box -// DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); -// win.open(); -// win.requestActive(); -// -// } else { -// -// -// // we have to load the result set -// AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { -// -// @Override -// public boolean mustBeCalledInAWT() { -// return true; -// } -// -// @Override -// public void run(boolean success, long taskId, SubTask subTask, boolean finished) { -// WindowBox wbox; -// if (serviceVersion.equals("2.0")) { -// wbox = WindowBoxFactory.getXicPTMSitesWindowBoxV2(dataSet.getName()); -// } else { -// wbox = WindowBoxFactory.getXicPTMSitesWindowBoxV1(dataSet.getName()); -// } -// // open a window to display the window box -// DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); -// win.open(); -// win.requestActive(); -// -// // prepare window box -// wbox.setEntryData(dataSet.getProject().getId(), new PTMDataset(dataSet)); -// } -// }; -// -// -// // ask asynchronous loading of data -// DatabaseDataSetTask task = new DatabaseDataSetTask(callback); -// task.initLoadRsetAndRsm(dataSet); -// AccessDatabaseThread.getAccessDatabaseThread().addTask(task); -// } -// } - @Override public void updateEnabled(AbstractNode[] selectedNodes) { - int nbSelectedNodes = selectedNodes.length; - - if (nbSelectedNodes <0) { + int nbSelectedNodes = selectedNodes.length; + if (nbSelectedNodes == 0) { setEnabled(false); return; } - + for (int i=0;i. - */ -package fr.proline.studio.rsmexplorer.actions.xic; - -import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.studio.dam.data.DataSetData; -import fr.proline.studio.pattern.WindowBox; -import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; -import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; -import fr.proline.studio.rsmexplorer.tree.AbstractNode; -import fr.proline.studio.rsmexplorer.tree.AbstractTree; -import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import org.openide.util.NbBundle; - -/** - * Action to see all peptides ions information per quant Channel - * @author JM235353 - */ -public class DisplayXICPeptideIonAction extends AbstractRSMAction { - - public DisplayXICPeptideIonAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayXICPeptideIonAction.class, "CTL_DisplayXicPeptideIonAction"), tree); - } - - @Override - public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { - - int nbNodes = selectedNodes.length; - for (int i = 0; i < nbNodes; i++) { - DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; - - actionImpl(dataSetNode); - } - - } - - private void actionImpl(DataSetNode dataSetNode) { - - final DDataset dataset = ((DataSetData) dataSetNode.getData()).getDataset(); - - - WindowBox wbox = WindowBoxFactory.getXicQuantPeptideIonWindowBox(dataset.getName(), dataset.getName()+" Peptides Ions", dataSetNode.isQuantitation() && !dataSetNode.isQuantSC()); - wbox.setEntryData(dataset.getProject().getId(), dataset); - - - // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); - } - - - @Override - public void updateEnabled(AbstractNode[] selectedNodes) { - - // only one node selected - if (selectedNodes.length != 1) { - setEnabled(false); - return; - } - - AbstractNode node = (AbstractNode) selectedNodes[0]; - - // the node must not be in changing state - if (node.isChanging()) { - setEnabled(false); - return; - } - - // must be a dataset - if (node.getType() != AbstractNode.NodeTypes.DATA_SET) { - setEnabled(false); - return; - } - - DataSetNode datasetNode = (DataSetNode) node; - - if (! (datasetNode.isQuantitation() && !datasetNode.isQuantSC()) ) { - setEnabled(false); - return; - } - - setEnabled(true); - } +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.actions.xic; + +import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dam.data.DataSetData; +import fr.proline.studio.pattern.WindowBox; +import fr.proline.studio.pattern.WindowBoxFactory; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; +import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; +import fr.proline.studio.rsmexplorer.tree.AbstractNode; +import fr.proline.studio.rsmexplorer.tree.AbstractTree; +import fr.proline.studio.rsmexplorer.tree.DataSetNode; + + +/** + * Action to see all peptides ions information per quant Channel + * @author JM235353 + */ +public class DisplayXICPeptideIonAction extends AbstractRSMAction { + + public DisplayXICPeptideIonAction(AbstractTree tree) { + super("Peptides Ions", tree); + } + + @Override + public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { + + int nbNodes = selectedNodes.length; + for (int i = 0; i < nbNodes; i++) { + DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; + + actionImpl(dataSetNode); + } + + } + + private void actionImpl(DataSetNode dataSetNode) { + + final DDataset dataset = ((DataSetData) dataSetNode.getData()).getDataset(); + + + WindowBox wbox = WindowBoxFactory.getXicQuantPeptideIonWindowBox(dataset.getName(), dataset.getName()+" Peptides Ions", dataSetNode.isQuantitation() && !dataSetNode.isQuantSC()); + wbox.setEntryData(dataset.getProject().getId(), dataset); + + + // open a window to display the window box + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); + } + + + @Override + public void updateEnabled(AbstractNode[] selectedNodes) { + + // only one node selected + if (selectedNodes.length != 1) { + setEnabled(false); + return; + } + + AbstractNode node = (AbstractNode) selectedNodes[0]; + + // the node must not be in changing state + if (node.isChanging()) { + setEnabled(false); + return; + } + + // must be a dataset + if (node.getType() != AbstractNode.NodeTypes.DATA_SET) { + setEnabled(false); + return; + } + + DataSetNode datasetNode = (DataSetNode) node; + + if (! (datasetNode.isQuantitation() && !datasetNode.isQuantSC()) ) { + setEnabled(false); + return; + } + + setEnabled(true); + } } \ No newline at end of file diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICPeptideSetAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICPeptideSetAction.java index 2c3710f91..47e85ed23 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICPeptideSetAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICPeptideSetAction.java @@ -1,99 +1,99 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.actions.xic; - -import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.studio.dam.data.DataSetData; -import fr.proline.studio.pattern.WindowBox; -import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; -import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; -import fr.proline.studio.rsmexplorer.tree.AbstractNode; -import fr.proline.studio.rsmexplorer.tree.AbstractTree; -import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import org.openide.util.NbBundle; - -/** - * Action to see all peptides information per quant Channel - * @author JM235353 - */ -public class DisplayXICPeptideSetAction extends AbstractRSMAction { - - public DisplayXICPeptideSetAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayXICPeptideSetAction.class, "CTL_DisplayXicPeptideSetAction"), tree); - } - - @Override - public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { - - int nbNodes = selectedNodes.length; - for (int i = 0; i < nbNodes; i++) { - DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; - - actionImpl(dataSetNode); - } - - } - - private void actionImpl(DataSetNode dataSetNode) { - - final DDataset dataset = ((DataSetData) dataSetNode.getData()).getDataset(); - - WindowBox wbox = WindowBoxFactory.getXicQuantPeptideSetWindowBox(dataset.getName(), dataset.getName() + " Peptides", dataSetNode.isQuantitation() && !dataSetNode.isQuantSC()); - wbox.setEntryData(dataset.getProject().getId(), dataset); - - // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); - } - - - @Override - public void updateEnabled(AbstractNode[] selectedNodes) { - - // only one node selected - if (selectedNodes.length != 1) { - setEnabled(false); - return; - } - - AbstractNode node = (AbstractNode) selectedNodes[0]; - - // the node must not be in changing state - if (node.isChanging()) { - setEnabled(false); - return; - } - - // must be a dataset - if (node.getType() != AbstractNode.NodeTypes.DATA_SET) { - setEnabled(false); - return; - } - - DataSetNode datasetNode = (DataSetNode) node; - - // must be a quantitation - if (!datasetNode.isQuantitation()) { - setEnabled(false); - return; - } - - setEnabled(true); - } +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.actions.xic; + +import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dam.data.DataSetData; +import fr.proline.studio.pattern.WindowBox; +import fr.proline.studio.pattern.WindowBoxFactory; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; +import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; +import fr.proline.studio.rsmexplorer.tree.AbstractNode; +import fr.proline.studio.rsmexplorer.tree.AbstractTree; +import fr.proline.studio.rsmexplorer.tree.DataSetNode; + + +/** + * Action to see all peptides information per quant Channel + * @author JM235353 + */ +public class DisplayXICPeptideSetAction extends AbstractRSMAction { + + public DisplayXICPeptideSetAction(AbstractTree tree) { + super("Peptides", tree); + } + + @Override + public void actionPerformed(AbstractNode[] selectedNodes, int x, int y) { + + int nbNodes = selectedNodes.length; + for (int i = 0; i < nbNodes; i++) { + DataSetNode dataSetNode = (DataSetNode) selectedNodes[i]; + + actionImpl(dataSetNode); + } + + } + + private void actionImpl(DataSetNode dataSetNode) { + + final DDataset dataset = ((DataSetData) dataSetNode.getData()).getDataset(); + + WindowBox wbox = WindowBoxFactory.getXicQuantPeptideSetWindowBox(dataset.getName(), dataset.getName() + " Peptides", dataSetNode.isQuantitation() && !dataSetNode.isQuantSC()); + wbox.setEntryData(dataset.getProject().getId(), dataset); + + // open a window to display the window box + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); + } + + + @Override + public void updateEnabled(AbstractNode[] selectedNodes) { + + // only one node selected + if (selectedNodes.length != 1) { + setEnabled(false); + return; + } + + AbstractNode node = (AbstractNode) selectedNodes[0]; + + // the node must not be in changing state + if (node.isChanging()) { + setEnabled(false); + return; + } + + // must be a dataset + if (node.getType() != AbstractNode.NodeTypes.DATA_SET) { + setEnabled(false); + return; + } + + DataSetNode datasetNode = (DataSetNode) node; + + // must be a quantitation + if (!datasetNode.isQuantitation()) { + setEnabled(false); + return; + } + + setEnabled(true); + } } \ No newline at end of file diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICProteinSetAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICProteinSetAction.java index 7118528aa..990dec770 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICProteinSetAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/DisplayXICProteinSetAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -17,15 +17,16 @@ package fr.proline.studio.rsmexplorer.actions.xic; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.data.DataSetData; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import org.openide.util.NbBundle; + /** * @@ -34,7 +35,7 @@ public class DisplayXICProteinSetAction extends AbstractRSMAction { public DisplayXICProteinSetAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayXICProteinSetAction.class, "CTL_XicProteinSetAction"), tree); + super("Proteins Sets", tree); } @Override @@ -59,9 +60,8 @@ private void actionImpl(DataSetNode dataSetNode) { // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); @@ -74,33 +74,39 @@ private void actionImpl(DataSetNode dataSetNode) { public void updateEnabled(AbstractNode[] selectedNodes) { // only one node selected - if (selectedNodes.length != 1) { +// if (selectedNodes.length != 1) { +// setEnabled(false); +// return; +// } + + if (selectedNodes.length <0) { setEnabled(false); return; } - AbstractNode node = (AbstractNode) selectedNodes[0]; + for (int i=0;i. - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.xic; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.data.DataSetData; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; -import org.openide.util.NbBundle; + /** * Action to display the XIC parameters + exp. design @@ -34,7 +35,7 @@ public class DisplayXicParamAction extends AbstractRSMAction { public DisplayXicParamAction(AbstractTree tree) { - super(NbBundle.getMessage(DisplayXicParamAction.class,"CTL_DisplayXicParamAction"), tree); + super("Parameters", tree); } @Override @@ -57,9 +58,8 @@ private void actionImpl(DataSetNode dataSetNode) { wbox.setEntryData(dataset.getProject().getId(), dataset); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/RenameAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/RenameAction.java index 5aa9ba3fc..c1f9f22ef 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/RenameAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/actions/xic/RenameAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.actions.xic; import fr.proline.core.orm.uds.Project; @@ -28,8 +28,8 @@ import fr.proline.studio.rsmexplorer.tree.xic.XICBiologicalSampleAnalysisNode; import javax.swing.tree.DefaultTreeModel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; + +import fr.proline.studio.WindowManager; /** * Rename a Node in a Xic QuantExperimentalDesignTree @@ -39,7 +39,7 @@ public class RenameAction extends AbstractRSMAction { public RenameAction(AbstractTree tree) { - super(NbBundle.getMessage(RenameAction.class, "CTL_RenameAction"), tree); + super("Rename...", tree); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/ordering/ClusterAComponent.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/ordering/ClusterAComponent.java index 44df45a39..d0a642b50 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/ordering/ClusterAComponent.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/ordering/ClusterAComponent.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.adjacencymatrix.ordering; import java.util.ArrayList; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/ordering/ExperimentData.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/ordering/ExperimentData.java index 2d64c9be0..f5552ac9c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/ordering/ExperimentData.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/ordering/ExperimentData.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.adjacencymatrix.ordering; import ch.usi.inf.sape.hac.experiment.Experiment; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/ordering/dissimilarityValue.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/ordering/dissimilarityValue.java index 37e294be3..d0170eabe 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/ordering/dissimilarityValue.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/ordering/dissimilarityValue.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.adjacencymatrix.ordering; import ch.usi.inf.sape.hac.experiment.DissimilarityMeasure; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/Component.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/Component.java index e7f69b7bc..065e22691 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/Component.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/Component.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.adjacencymatrix.visualize; import fr.proline.studio.dam.tasks.data.AdjacencyMatrixData; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/ConnectedComponents.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/ConnectedComponents.java index feb13c988..438544a45 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/ConnectedComponents.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/ConnectedComponents.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.adjacencymatrix.visualize; import java.util.ArrayList; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/DrawVisualization.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/DrawVisualization.java index db7877daf..15520c966 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/DrawVisualization.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/DrawVisualization.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.adjacencymatrix.visualize; import fr.proline.studio.dam.tasks.data.AdjacencyMatrixData; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/MatrixImageButton.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/MatrixImageButton.java index 3e1988ec9..82aff11d0 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/MatrixImageButton.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/MatrixImageButton.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.adjacencymatrix.visualize; import fr.proline.studio.dam.tasks.data.LightPeptideMatch; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/MatrixPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/MatrixPanel.java index bb019cd06..2b458b2e7 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/MatrixPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/MatrixPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/MatrixSelectionPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/MatrixSelectionPanel.java index 80a37397e..4f7309c77 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/MatrixSelectionPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/MatrixSelectionPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/SearchEvent.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/SearchEvent.java index f03e22e15..3af925cfb 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/SearchEvent.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/adjacencymatrix/visualize/SearchEvent.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.adjacencymatrix.visualize; import java.awt.event.ItemEvent; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/DataClearProjectTable.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/DataClearProjectTable.java index 671f7bc0b..0930423f5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/DataClearProjectTable.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/DataClearProjectTable.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import fr.proline.studio.table.DecoratedMarkerTable; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/DropZoneInterface.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/DropZoneInterface.java index d1c831f82..41c597957 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/DropZoneInterface.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/DropZoneInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import java.util.HashMap; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/EditClusterDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/EditClusterDialog.java new file mode 100644 index 000000000..3f6d88a1c --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/EditClusterDialog.java @@ -0,0 +1,293 @@ +package fr.proline.studio.rsmexplorer.gui; + +import fr.proline.core.orm.msi.Peptide; +import fr.proline.core.orm.msi.PeptideInstance; +import fr.proline.core.orm.msi.dto.DPeptideInstance; +import fr.proline.core.orm.msi.dto.DPeptideMatch; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dam.tasks.data.ptm.PTMCluster; +import fr.proline.studio.dam.tasks.data.ptm.PTMPeptideInstance; +import fr.proline.studio.extendedtablemodel.CompoundTableModel; +import fr.proline.studio.gui.DefaultDialog; +import fr.proline.studio.gui.InfoDialog; +import fr.proline.studio.rsmexplorer.gui.dialog.ModifyClusterStatusPanel; +import fr.proline.studio.rsmexplorer.gui.model.PTMPeptidesTableModel; +import fr.proline.studio.table.LazyTable; +import fr.proline.studio.table.TablePopupMenu; +import fr.proline.studio.utils.IconManager; +import fr.proline.studio.utils.StudioResourceBundle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.swing.*; +import javax.swing.border.TitledBorder; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.TableModelListener; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +public class EditClusterDialog extends DefaultDialog { + + private static final Logger LOG = LoggerFactory.getLogger("ProlineStudio.ResultExplorer.ptm"); + + private PTMCluster m_editedCluster; + private List m_ptmPeptideInstances; + private List m_removedPeptideInstances; + + private ModifyClusterStatusPanel m_statusPanel; + private JScrollPane m_ptmPeptidesScrollPane; + private PTMPeptidesTable m_ptmPeptidesTable; + private PTMPeptidesTableModel m_ptmPeptidesTableModel; + + private boolean m_peptidesDeleted; + private boolean m_statusModified; + + public EditClusterDialog(PTMCluster cluster) { + super(WindowManager.getDefault().getMainWindow()); + + setTitle("Edit Cluster "+cluster.getId()+" ["+cluster.getProteinMatch().getAccession()+" / "+cluster.getRepresentativePepMatch().getPeptide().getSequence()+"]"); + setResizable(true); + + StringBuilder helpTextBuilder = new StringBuilder(StudioResourceBundle.getMessage(EditClusterDialog.class, "EditCluster.status.modif.html.help")); + helpTextBuilder.append("

").append(StudioResourceBundle.getMessage(EditClusterDialog.class, "EditCluster.peptide.remove.html.help")); + setHelpHeader(IconManager.getIcon(IconManager.IconType.INFORMATION),"Edit Cluster",helpTextBuilder.toString()); + + m_editedCluster = cluster; + m_ptmPeptideInstances = new ArrayList<>(cluster.getParentPTMPeptideInstances()); + initComponent(); + + m_statusPanel.setData(m_editedCluster); + m_ptmPeptidesTable.setData(m_ptmPeptideInstances); + m_removedPeptideInstances = new ArrayList<>(); + } + + private void initComponent(){ + + JPanel editPanel = new JPanel(); + editPanel.setLayout(new GridBagLayout()); + + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTH; + c.insets = new java.awt.Insets(2, 2, 2, 2); + c.fill = GridBagConstraints.BOTH; + c.gridx = 0; + c.gridy = 0; + + + JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT); + sp.setResizeWeight(0.5); + + m_statusPanel = new ModifyClusterStatusPanel(); + m_statusPanel.setBorder(new TitledBorder(" Cluster Status ")); + sp.setTopComponent(m_statusPanel); + + JPanel peptidePanel = createCLusterPeptidesPanel(); + sp.setBottomComponent(peptidePanel); + + c.weightx = 1; + c.weighty = 1; + + editPanel.add(sp, c); + + setInternalComponent(editPanel); + } + + private JPanel createCLusterPeptidesPanel() { + JPanel peptidePanel = new JPanel(); + peptidePanel.setBorder(new TitledBorder(" Cluster Peptides ")); + peptidePanel.setLayout(new GridBagLayout()); + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.gridx = 0; + c.gridy = 0; + + JToolBar toolbar = new JToolBar(JToolBar.VERTICAL); + toolbar.setFloatable(false); + JButton removePeptideButton = new JButton(); + removePeptideButton.setIcon(IconManager.getIcon(IconManager.IconType.CANCEL)); + removePeptideButton.setToolTipText("Remove selected Peptides from Cluster"); + removePeptideButton.addActionListener(e -> { + if (m_ptmPeptidesTable.getSelectedRowCount() == 1) { + removeSelectedPeptide(); + } else { + InfoDialog err = new InfoDialog(WindowManager.getDefault().getMainWindow(),InfoDialog.InfoType.INFO, "Remove Peptide" ,"At least one, and only one, peptide should be selected."); + err.setButtonVisible(InfoDialog.BUTTON_CANCEL, false); + err.setButtonName(InfoDialog.BUTTON_OK, "OK"); + err.centerToWindow(WindowManager.getDefault().getMainWindow()); + err.setVisible(true); + } + }); + toolbar.add(removePeptideButton); + + JPanel ptmPeptidesPanel = createPtmPeptidesPanel(); + + peptidePanel.add(toolbar, c); + + c.gridx++; + c.weightx = 1; + c.weighty = 1; + peptidePanel.add(ptmPeptidesPanel, c); + + return peptidePanel; + } + + private JPanel createPtmPeptidesPanel() { + JPanel ptmPeptidesPanel = new JPanel(); + ptmPeptidesPanel.setLayout(new GridBagLayout()); + + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTH; + //c.insets = new java.awt.Insets(2, 2, 2, 2); + c.fill = GridBagConstraints.BOTH; + c.gridx = 0; + c.gridy = 0; + c.weightx = 1; + c.weighty = 1; + + // create objects + m_ptmPeptidesScrollPane = new JScrollPane(); + + m_ptmPeptidesTable = new PTMPeptidesTable(); + m_ptmPeptidesTableModel = new PTMPeptidesTableModel(m_ptmPeptidesTable, false, false); + m_ptmPeptidesTable.setModel(new CompoundTableModel(m_ptmPeptidesTableModel, true)); + + TableRowSorter sorter = new TableRowSorter<>(m_ptmPeptidesTable.getModel()); + m_ptmPeptidesTable.setRowSorter(sorter); + + m_ptmPeptidesScrollPane.setViewportView(m_ptmPeptidesTable); + m_ptmPeptidesTable.setFillsViewportHeight(true); + m_ptmPeptidesTable.setViewport(m_ptmPeptidesScrollPane.getViewport()); + + + ptmPeptidesPanel.add(m_ptmPeptidesScrollPane, c); + + return ptmPeptidesPanel; + } + + private void removeSelectedPeptide(){ + ArrayList clusters = new ArrayList<>(); + clusters.add(m_editedCluster); + PTMPeptideInstance ptmPep = getSelectedPTMPeptideInstance(); + DPeptideMatch repPepMatch = ptmPep.getRepresentativePepMatch(clusters); + DPeptideMatch clusterPepMatch = m_editedCluster.getRepresentativePepMatch(); + if(repPepMatch != null && clusterPepMatch.getId() == repPepMatch.getId()){ + InfoDialog id = new InfoDialog(WindowManager.getDefault().getMainWindow(), InfoDialog.InfoType.WARNING, "Remove Peptide Error", "Can not remove representative peptide from cluster" ); + id.setButtonName(DefaultDialog.BUTTON_OK, "OK"); + id.setButtonVisible(DefaultDialog.BUTTON_CANCEL, false); + id.centerToWindow(WindowManager.getDefault().getMainWindow()); + id.setVisible(true); + return; + } +// m_editedCluster.removePeptide(ptmPep); + m_removedPeptideInstances.add(ptmPep); + m_ptmPeptideInstances.remove(ptmPep); + m_peptidesDeleted = true; + m_ptmPeptidesTable.setData(m_ptmPeptideInstances); + + LOG.debug(" DELETE ptm peptide "+ptmPep.getPeptideInstance().getId()); + } + + private PTMPeptideInstance getSelectedPTMPeptideInstance() { + if (m_ptmPeptidesTableModel.getRowCount() <= 0) { + return null; + } + PTMPeptidesTableModel.Row row = m_ptmPeptidesTableModel.getPTMPeptideInstanceAt(getSelectedRowInTableModel()); + return row != null ? row.ptmPeptideInstance : null; + } + + private int getSelectedRowInTableModel() { + + // Retrieve Selected Row + int selectedRow = m_ptmPeptidesTable.getSelectedRow(); + + // nothing selected + if (selectedRow == -1) { + return -1; + } + + CompoundTableModel compoundTableModel = ((CompoundTableModel) m_ptmPeptidesTable.getModel()); + // convert according to the sorting + selectedRow = m_ptmPeptidesTable.convertRowIndexToModel(selectedRow); + //find the original index + selectedRow = compoundTableModel.convertCompoundRowToBaseModelRow(selectedRow); + return selectedRow; + } + + @Override + protected boolean okCalled() { + m_statusModified = m_statusPanel.applyModifiedStatus(); + return true; + } + + protected boolean isClusterModified() { + return m_statusModified || m_peptidesDeleted; + } + + protected boolean isStatusModified() { + return m_statusModified; + } + + protected boolean isPeptideDeleted() { + return m_peptidesDeleted; + } + + protected List getRemovedPeptideInstances(){ + return m_removedPeptideInstances; + } + + private class PTMPeptidesTable extends LazyTable { + + public PTMPeptidesTable() { + super(m_ptmPeptidesScrollPane.getVerticalScrollBar()); + } + + @Override + public TablePopupMenu initPopupMenu() { + return null; + } + + @Override + public void prepostPopupMenu() { + + } + + /** + * Called whenever the value of the selection changes. + * + * @param e the event that characterizes the change. + */ + @Override + public void valueChanged(ListSelectionEvent e) { + super.valueChanged(e); + } + + @Override + public void addTableModelListener(TableModelListener l) { + + } + + @Override + public boolean isLoaded() { + return true; + } + + @Override + public int getLoadingPercentage() { + return 100; + } + + public void setData(List m_ptmPeptideInstances) { + + List clusters = new ArrayList<>(); + clusters.add(m_editedCluster); + ((PTMPeptidesTableModel) (((CompoundTableModel) getModel()).getBaseModel())).setData(null, new ArrayList<>(m_ptmPeptideInstances),clusters,null); + //fireTableDataChanged(); + } + } + + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/FilesTransferable.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/FilesTransferable.java index 543d1c0af..34d8e8443 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/FilesTransferable.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/FilesTransferable.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/FlipButton.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/FlipButton.java index 5f5daa277..51d1aaf99 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/FlipButton.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/FlipButton.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import fr.proline.studio.progress.ProgressBarDialog; @@ -26,7 +26,7 @@ import javax.swing.JButton; import org.jdesktop.swingx.JXTable; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; /** * Button to export data of a table or image of a JPanel diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/GenericPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/GenericPanel.java index 22c329390..8cf935f96 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/GenericPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/GenericPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/GraphicsPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/GraphicsPanel.java index 5a2204e28..eeeb31663 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/GraphicsPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/GraphicsPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ImagePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ImagePanel.java index 8420f5dda..d58eed92a 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ImagePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ImagePanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import fr.proline.studio.export.ExportButton; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/LocalFileSystemModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/LocalFileSystemModel.java index 70cf5fa93..8f3f3910e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/LocalFileSystemModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/LocalFileSystemModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/LocalFileSystemTransferHandler.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/LocalFileSystemTransferHandler.java index 4a57846d5..71262cb2a 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/LocalFileSystemTransferHandler.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/LocalFileSystemTransferHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -18,7 +18,6 @@ import fr.proline.studio.msfiles.MzdbDownloadBatch; -import fr.proline.studio.rsmexplorer.MzdbFilesTopComponent; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.File; @@ -29,7 +28,9 @@ import javax.swing.TransferHandler; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; -import org.openide.util.Exceptions; + +import fr.proline.studio.rsmexplorer.MzdbFilesTopPanel; +import fr.proline.studio.Exceptions; /** * @@ -102,9 +103,9 @@ public boolean canImport(TransferHandler.TransferSupport support) { /* Now we can drop on a file (corresponds to usual behaviour on Window) But when we drop on a file, in fact we drop on the parent directory of the file - + TreePath dropPath = ((JTree.DropLocation) support.getDropLocation()).getPath(); - File dropFile = pathToFile(MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().getSelectedRoot(), dropPath); + File dropFile = pathToFile(MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().getSelectedRoot(), dropPath); if (!dropFile.isDirectory()) { return false; }*/ @@ -132,13 +133,13 @@ public boolean importData(TransferHandler.TransferSupport support) { JTree.DropLocation dropLocation = (JTree.DropLocation) support.getDropLocation(); TreePath dropPath = dropLocation.getPath(); - File dropFile = pathToFile(MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().getSelectedRoot(), dropPath); + File dropFile = pathToFile(MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().getSelectedRoot(), dropPath); if (dropFile.isFile()) { // drop on a file corresponds to a drop on the parent directory dropPath = dropPath.getParentPath(); } - - MzdbDownloadBatch downloadBatch = new MzdbDownloadBatch(filesToTransfer, dropPath, MzdbFilesTopComponent.getExplorer().getLocalFileSystemView().getSelectedRoot()); + + MzdbDownloadBatch downloadBatch = new MzdbDownloadBatch(filesToTransfer, dropPath, MzdbFilesTopPanel.getExplorer().getLocalFileSystemView().getSelectedRoot()); Thread downloadThread = new Thread(downloadBatch); downloadThread.start(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/LocalFileSystemView.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/LocalFileSystemView.java index b4f09f108..85f9c2202 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/LocalFileSystemView.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/LocalFileSystemView.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,7 @@ */ package fr.proline.studio.rsmexplorer.gui; +import fr.proline.studio.NbPreferences; import fr.proline.studio.msfiles.ExportMgfDialog; import fr.proline.studio.msfiles.FileDeletionBatch; import fr.proline.mzscope.utils.IPopupMenuDelegate; @@ -64,8 +65,7 @@ import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreePath; -import org.openide.util.NbPreferences; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -329,7 +329,7 @@ private ArrayList getSelectedURLs() { } private void getSelectedFilesAndDirectories(ArrayList files, ArrayList directories, ArrayList parentDirectory) { - + TreePath[] paths = m_tree.getSelectionPaths(); if (paths != null) { for (TreePath path : paths) { @@ -348,7 +348,7 @@ private void getSelectedFilesAndDirectories(ArrayList files, Arr } } - + // special case : if a file is selected and no directory // the parent directory is considerer as potential drop directory if (directories.isEmpty() && (files.size() == 1)) { @@ -358,7 +358,7 @@ private void getSelectedFilesAndDirectories(ArrayList files, Arr File f = (File) node.getUserObject(); if (f.isFile()) { - + String url = f.getAbsolutePath().toLowerCase(); if (url.endsWith(".mzdb") || url.endsWith(".raw") || url.endsWith(".wiff") || url.endsWith(".dat")) { TreePath parentPath = path.getParentPath(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiagOutput_AW.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiagOutput_AW.java index a08f4063b..e9f05144e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiagOutput_AW.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiagOutput_AW.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiagTable_1stColumnIsString.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiagTable_1stColumnIsString.java index eef78d973..915f80570 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiagTable_1stColumnIsString.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiagTable_1stColumnIsString.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import java.awt.Color; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiagTable_GenericTable.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiagTable_GenericTable.java index 79496d18e..ad89ffddf 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiagTable_GenericTable.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiagTable_GenericTable.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import java.awt.Color; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_BoxAndWhisker.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_BoxAndWhisker.java index 5b61377d5..b92cb38eb 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_BoxAndWhisker.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_BoxAndWhisker.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import java.awt.BasicStroke; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_BoxChart.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_BoxChart.java index 426417031..2f8f4c4f3 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_BoxChart.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_BoxChart.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import java.awt.BorderLayout; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_CategoryPlot.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_CategoryPlot.java index 1c35588b4..0b0d3d098 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_CategoryPlot.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_CategoryPlot.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import java.awt.BorderLayout; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_Chromatogram.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_Chromatogram.java index fa4b5eb4e..6f368924d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_Chromatogram.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_Chromatogram.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import java.awt.BorderLayout; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_PieChart.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_PieChart.java index 2ba2c39a2..7ce873f3e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_PieChart.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_PieChart.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import java.awt.BorderLayout; import java.awt.Color; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_StackedXYAreaChart.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_StackedXYAreaChart.java index 99d24329d..d7b2aa9e4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_StackedXYAreaChart.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSDiag_StackedXYAreaChart.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import java.awt.BorderLayout; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSQueriesPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSQueriesPanel.java index 14800f590..c5ca93837 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSQueriesPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MSQueriesPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MultiGraphicsPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MultiGraphicsPanel.java index 1cafdce58..23406fdf7 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MultiGraphicsPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MultiGraphicsPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -41,6 +41,7 @@ import javax.swing.JPanel; import javax.swing.JToggleButton; import javax.swing.JToolBar; + import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; import fr.proline.studio.extendedtablemodel.SecondAxisTableModelInterface; import static fr.proline.studio.graphics.PlotBaseAbstract.COL_X_ID; @@ -91,10 +92,10 @@ public class MultiGraphicsPanel extends GraphicsToolbarPanel implements DataBoxP private boolean m_setHideButton; public MultiGraphicsPanel(boolean dataLocked, boolean canChooseColor, boolean isDoubleYAxis, boolean setHideButton) { - super(dataLocked, isDoubleYAxis); + super(dataLocked, isDoubleYAxis); columnXYIndex = new int[2]; m_canChooseColor = canChooseColor; - m_setHideButton = setHideButton; + m_setHideButton = setHideButton; fillGraphicToolbar(); } @@ -109,7 +110,7 @@ protected final JPanel createInternalPanel() { c.fill = GridBagConstraints.BOTH; c.insets = new java.awt.Insets(0, 5, 0, 5); - PlotPanel panel = new PlotPanel(m_isDoubleYAxis); + PlotPanel panel = new PlotPanel(); m_plotPanel = panel.getBasePlotPanel(); m_plotPanel.setPlotToolbarListener(this); JPanel selectPanel = createSelectPanel(); @@ -130,7 +131,7 @@ protected final JPanel createInternalPanel() { public final void fillToolbar(JToolBar toolbar) { SettingsButton settingsButton = new SettingsButton(null, m_plotPanel); - + ExportButton exportImageButton = new ExportButton("Graphic", m_plotPanel); // add buttons to toolbar @@ -403,12 +404,12 @@ private void setDataImpl(boolean keepZoom, Double limitMinAxisY) { double minXValue = xAxis.getMinValue(); double maxXValue = xAxis.getMaxValue(); keepZoom &= (maxXValue>minXValue); - - + + YAxis yAxis = m_plotPanel.getYAxis(); double minYValue = yAxis.getMinValue(); double maxYValue = yAxis.getMaxValue(); - + double minYValueRight = 0; double maxYValueRight = 0; if (m_isDoubleYAxis) { @@ -428,7 +429,7 @@ private void setDataImpl(boolean keepZoom, Double limitMinAxisY) { keepZoom &= (maxYValue>minYValue); keepZoom &= (xAxis.getRangeModifiedByUser() || yAxis.getRangeModifiedByUser() || ((m_isDoubleYAxis) && m_plotPanel.getYAxisRight().getRangeModifiedByUser())); - + if (keepZoom) { xAxis = m_plotPanel.getXAxis(); // axis has been changed if (xAxis.isEnum()) { @@ -452,7 +453,7 @@ private void setDataImpl(boolean keepZoom, Double limitMinAxisY) { } } } - + m_plotPanel.repaint(); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MzDBFilesPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MzDBFilesPanel.java index fdd192949..da03bbfe0 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MzDBFilesPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MzDBFilesPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import fr.proline.mzscope.model.IRawFile; @@ -43,7 +43,7 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JTextField; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MzScope.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MzScope.java index 881dfe292..d162adeac 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MzScope.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/MzScope.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import fr.proline.studio.mzscope.MzScopeInterface; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/PTMClustersPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/PTMClustersPanel.java index affaee0d5..66c022d90 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/PTMClustersPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/PTMClustersPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -19,15 +19,21 @@ import fr.proline.core.orm.msi.dto.DProteinMatch; import fr.proline.core.orm.msi.dto.DProteinSet; -import fr.proline.studio.extendedtablemodel.AddDataAnalyzerButton; -import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dam.DatabaseDataManager; +import fr.proline.studio.dam.tasks.DatabaseDatasetPTMsTask; import fr.proline.studio.dam.tasks.SubTask; import fr.proline.studio.dam.tasks.data.ptm.PTMCluster; +import fr.proline.studio.dam.tasks.data.ptm.PTMDataset; +import fr.proline.studio.dam.tasks.data.ptm.PTMDatasetPair; import fr.proline.studio.dam.tasks.data.ptm.PTMPeptideInstance; import fr.proline.studio.export.ExportButton; +import fr.proline.studio.extendedtablemodel.*; import fr.proline.studio.filter.FilterButton; import fr.proline.studio.graphics.CrossSelectionInterface; +import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.gui.HourglassPanel; +import fr.proline.studio.gui.InfoDialog; import fr.proline.studio.gui.SplittedPanelContainer; import fr.proline.studio.info.InfoInterface; import fr.proline.studio.info.InfoToggleButton; @@ -35,61 +41,63 @@ import fr.proline.studio.markerbar.MarkerContainerPanel; import fr.proline.studio.parameter.SettingsButton; import fr.proline.studio.pattern.AbstractDataBox; -import fr.proline.studio.pattern.DataBoxPanelInterface; import fr.proline.studio.pattern.DataAnalyzerWindowBoxManager; +import fr.proline.studio.pattern.DataBoxPanelInterface; +import fr.proline.studio.progress.ProgressBarDialog; +import fr.proline.studio.rsmexplorer.DataBoxViewerManager.REASON_MODIF; import fr.proline.studio.progress.ProgressInterface; -import fr.proline.studio.rsmexplorer.gui.model.PTMClusterTableModel; -import fr.proline.studio.table.TableInfo; +import fr.proline.studio.rsmexplorer.DataBoxViewerManager; +import fr.proline.studio.rsmexplorer.actions.ViewColocalizedPTMClustersAction; import fr.proline.studio.rsmexplorer.actions.table.DisplayTablePopupMenu; +import fr.proline.studio.rsmexplorer.gui.dialog.ModifyClusterStatusPanel; +import fr.proline.studio.rsmexplorer.gui.model.PTMClusterTableModel; +import fr.proline.studio.rsmexplorer.gui.renderer.RendererMouseCallback; +import fr.proline.studio.rsmexplorer.gui.renderer.SelectLevelRenderer; import fr.proline.studio.search.SearchToggleButton; -import fr.proline.studio.extendedtablemodel.CompoundTableModel; -import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; import fr.proline.studio.table.ImportTableSelectionInterface; import fr.proline.studio.table.LazyTable; +import fr.proline.studio.table.TableInfo; import fr.proline.studio.table.TablePopupMenu; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Image; +import fr.proline.studio.utils.IconManager; +import fr.proline.studio.utils.StudioResourceBundle; +import org.jdesktop.swingx.JXTable; +import org.jdesktop.swingx.table.TableColumnExt; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.TableModelListener; +import javax.swing.table.TableColumn; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; +import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; +import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.HashSet; -import javax.swing.ImageIcon; -import javax.swing.JLayeredPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextField; -import javax.swing.JToolBar; -import javax.swing.ListSelectionModel; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.TableModel; -import javax.swing.table.TableRowSorter; -import org.jdesktop.swingx.JXTable; -import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; - import java.util.List; -import javax.swing.table.TableColumn; -import org.jdesktop.swingx.table.TableColumnExt; /** * * @author JM235353 */ -public class PTMClustersPanel extends HourglassPanel implements DataBoxPanelInterface, GlobalTabelModelProviderInterface { - +public class PTMClustersPanel extends HourglassPanel implements RendererMouseCallback, DataBoxPanelInterface, GlobalTabelModelProviderInterface { + + private static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); + private AbstractDataBox m_dataBox; private JScrollPane m_scrollPane; private PTMClusterTable m_ptmClusterTable; + private PTMClusterTableModel m_ptmClusterTableModel; private JTextField m_countModificationTextField; private MarkerContainerPanel m_markerContainerPanel; + private ModifyStatusDialog m_modifyStatusDialog; private SearchToggleButton m_searchToggleButton; private InfoToggleButton m_infoToggleButton; @@ -99,10 +107,13 @@ public class PTMClustersPanel extends HourglassPanel implements DataBoxPanelInte private ExportButton m_exportButton; private AddDataAnalyzerButton m_addCompareDataButton; + private boolean m_areClustersEditable; + /** * Creates new form PTMProteinSitePanel */ - public PTMClustersPanel() { + public PTMClustersPanel(boolean editable) { + m_areClustersEditable = editable; initComponents(); } @@ -111,8 +122,7 @@ public PTMClustersPanel() { public void setData(Long taskId, ArrayList ptmClusters, boolean finished) { - PTMClusterTableModel model = ((PTMClusterTableModel) ((CompoundTableModel) m_ptmClusterTable.getModel()).getBaseModel()); - model.setData(taskId,ptmClusters); + m_ptmClusterTableModel.setData(taskId,ptmClusters); // select the first row if ((ptmClusters != null) && (ptmClusters.size() > 0)) { @@ -126,7 +136,7 @@ public void setData(Long taskId, ArrayList ptmClusters, boolean fini } m_infoToggleButton.updateInfo(); - m_countModificationTextField.setText(model.getModificationsInfo()); + m_countModificationTextField.setText(m_ptmClusterTableModel.getModificationsInfo()); if (finished) { m_ptmClusterTable.setSortable(true); @@ -136,8 +146,7 @@ public void setData(Long taskId, ArrayList ptmClusters, boolean fini public void dataUpdated(SubTask subTask, boolean finished) { m_ptmClusterTable.dataUpdated(subTask, finished); - PTMClusterTableModel model = ((PTMClusterTableModel) ((CompoundTableModel) m_ptmClusterTable.getModel()).getBaseModel()); - m_countModificationTextField.setText(model.getModificationsInfo()); + m_countModificationTextField.setText(m_ptmClusterTableModel.getModificationsInfo()); } @@ -178,13 +187,13 @@ public List getSelectedPTMClusters() { // convert according to the sorting CompoundTableModel compoundTableModel = ((CompoundTableModel) m_ptmClusterTable.getModel()); - PTMClusterTableModel tableModel = (PTMClusterTableModel) compoundTableModel.getBaseModel(); + for(int i=0; i EDIT IN ANNOTATED DATA OK !!! "); + } else { + PTMDatasetPair annPtmDatasetpair = DatabaseDataManager.getDatabaseDataManager().getAnnotatedPTMDatasetSetForDS(ptmDatasetpair.getDataset().getId()); + String existMsg = (annPtmDatasetpair != null) ? " Annotated PTM Exist " : " Annotated do NOT Exist !"; + m_logger.debug(" ==> EDIT IN NOT ANNOTATED DATA NOO OK !!! " + existMsg); + } + + if (m_ptmClusterTableModel.isRowEditable(rowModelIndex)) { + if (m_modifyStatusDialog == null) { + m_modifyStatusDialog = new ModifyStatusDialog(); + } + + PTMCluster cluster = getSelectedProteinPTMCluster(); + m_modifyStatusDialog.setData(cluster); + m_modifyStatusDialog.setLocation(e.getLocationOnScreen().x, e.getLocationOnScreen().y); + m_modifyStatusDialog.setVisible(true); + } + } + } + } + @Override public ActionListener getAddAction(SplittedPanelContainer splittedPanel) { return m_dataBox.getAddAction(splittedPanel); @@ -276,7 +328,7 @@ public void componentHidden(ComponentEvent e) { private void setColumnsVisibility() { // hide the rawAbundance and selectionLevel columns - List listIdsToHide = ((PTMClusterTableModel) ((CompoundTableModel) m_ptmClusterTable.getModel()).getBaseModel()).getDefaultColumnsToHide(); + List listIdsToHide =m_ptmClusterTableModel.getDefaultColumnsToHide(); List columns = m_ptmClusterTable.getColumns(true); for (Integer id : listIdsToHide) { boolean columnVisible = ((TableColumnExt) columns.get(id)).isVisible(); @@ -310,7 +362,6 @@ private JToolBar initToolbar() { // Search Button m_searchToggleButton = new SearchToggleButton(m_ptmClusterTable, m_ptmClusterTable, ((CompoundTableModel) m_ptmClusterTable.getModel())); - toolbar.add(m_searchToggleButton); m_filterButton = new FilterButton(((CompoundTableModel) m_ptmClusterTable.getModel())) { @@ -325,6 +376,7 @@ protected void filteringDone() { m_exportButton = new ExportButton(((CompoundTableModel) m_ptmClusterTable.getModel()), "Protein Sets", m_ptmClusterTable); + toolbar.add(m_searchToggleButton); toolbar.add(m_filterButton); toolbar.add(m_settingsButton); toolbar.add(m_exportButton); @@ -342,12 +394,21 @@ public void actionPerformed() { DataAnalyzerWindowBoxManager.addTableInfo(tableInfo); } }; - toolbar.add(m_addCompareDataButton); m_infoToggleButton = new InfoToggleButton(m_ptmClusterTable, m_ptmClusterTable); - + + toolbar.add(m_addCompareDataButton); toolbar.add(m_infoToggleButton); - + toolbar.addSeparator(); + + SaveToggleButton saveButton = new SaveToggleButton(m_ptmClusterTable); + MergeToggleButton mergeButton = new MergeToggleButton(m_ptmClusterTable); + EditToggleButton editButton = new EditToggleButton(m_ptmClusterTable); + + toolbar.add(mergeButton); + toolbar.add(editButton); + toolbar.add(saveButton); + return toolbar; } @@ -365,9 +426,13 @@ private JPanel createInternalPanel() { m_scrollPane = new JScrollPane(); m_ptmClusterTable = new PTMClusterTable(); - PTMClusterTableModel model = new PTMClusterTableModel((LazyTable) m_ptmClusterTable); - m_ptmClusterTable.setModel(new CompoundTableModel(model, true)); - + m_ptmClusterTableModel = new PTMClusterTableModel(m_ptmClusterTable, this); + m_ptmClusterTable.setModel(new CompoundTableModel(m_ptmClusterTableModel, true)); + + SelectLevelRenderer renderer = (SelectLevelRenderer) m_ptmClusterTableModel.getRenderer(0, PTMClusterTableModel.COLTYPE_PTM_CLUSTER_SELECTION_LEVEL); + m_ptmClusterTable.addMouseListener(renderer); + m_ptmClusterTable.addMouseMotionListener(renderer); + // hide the id column m_ptmClusterTable.getColumnExt(m_ptmClusterTable.convertColumnIndexToView(PTMClusterTableModel.COLTYPE_PROTEIN_ID)).setVisible(false); //m_ptmProteinSiteTable.displayColumnAsPercentage(PTMProteinSiteTableModel.COLTYPE_PEPTIDE_SCORE); @@ -410,7 +475,7 @@ private JPanel createInternalPanel() { // }); - m_markerContainerPanel = new MarkerContainerPanel(m_scrollPane, (PTMClusterTable) m_ptmClusterTable); + m_markerContainerPanel = new MarkerContainerPanel(m_scrollPane, m_ptmClusterTable); m_scrollPane.setViewportView(m_ptmClusterTable); m_ptmClusterTable.setFillsViewportHeight(true); @@ -449,26 +514,26 @@ public PTMClusterTable() { super(m_scrollPane.getVerticalScrollBar() ); } - @Override - public void tableChanged(TableModelEvent e) { - super.tableChanged(e); - - if ((m_ptmClusterTable != null) && (m_countModificationTextField != null)) { - - CompoundTableModel model = (CompoundTableModel) m_ptmClusterTable.getModel(); - if (model != null) { - - // prepare a lost of current filtered ProteinPTMSite with no redundancy - - ArrayList proteinPTMCluster = new ArrayList<>(); - - int nbRows = model.getRowCount(); // loop through filtered DProteinPTMSite - for (int i = 0; i < nbRows; i++) { - proteinPTMCluster.add((PTMCluster) model.getRowValue(PTMCluster.class, i)); - } - } - } - } +// @Override +// public void tableChanged(TableModelEvent e) { +// super.tableChanged(e); +// +// if ((m_ptmClusterTable != null) && (m_countModificationTextField != null)) { +// +// CompoundTableModel model = (CompoundTableModel) m_ptmClusterTable.getModel(); +// if (model != null) { +// +// // prepare a lost of current filtered ProteinPTMSite with no redundancy +// +// ArrayList proteinPTMCluster = new ArrayList<>(); +// +// int nbRows = model.getRowCount(); // loop through filtered DProteinPTMSite +// for (int i = 0; i < nbRows; i++) { +// proteinPTMCluster.add((PTMCluster) model.getRowValue(PTMCluster.class, i)); +// } +// } +// } +// } @Override public void addTableModelListener(TableModelListener l) { @@ -564,11 +629,11 @@ public void importSelection(HashSet selectedData) { selectionTableModel.clearSelection(); int firstRow = -1; - PTMClusterTableModel model = (PTMClusterTableModel) ((CompoundTableModel) m_ptmClusterTable.getModel()).getBaseModel(); +// PTMClusterTableModel model = (PTMClusterTableModel) ((CompoundTableModel) m_ptmClusterTable.getModel()).getBaseModel(); - int rowCount = model.getRowCount(); + int rowCount = m_ptmClusterTableModel.getRowCount(); for (int i=0;i1) ? " PTM Clusters" : " PTM Cluster")+" \n "+modifInfo; } } + private class ModifyStatusDialog extends DefaultDialog { + + private ModifyClusterStatusPanel m_panel; + private PTMCluster m_currentCluster; + + public ModifyStatusDialog() { + super(WindowManager.getDefault().getMainWindow(), Dialog.ModalityType.APPLICATION_MODAL); + + setTitle("Modify Modification Cluster Status"); + + String helpText = StudioResourceBundle.getMessage(PTMClustersPanel.class, "EditCluster.status.modif.html.help"); + setHelpHeaderText(helpText); + m_panel = new ModifyClusterStatusPanel(); + setInternalComponent(m_panel); + setResizable(true); + + setButtonVisible(BUTTON_HELP, false);//use only cancel, ok button + } + + @Override + protected boolean okCalled() { + ArrayList clustersToModify = new ArrayList<>(); + clustersToModify.add(m_currentCluster); + if(m_panel.applyModifiedStatus()) + DataBoxViewerManager.loadedDataModified(m_dataBox.getProjectId(), m_dataBox.getRsetId(), m_dataBox.getRsmId(), PTMCluster.class, clustersToModify, REASON_MODIF.REASON_PTMCLUSTER_MODIFIED.getReasonValue()); + return true; + } + + public void setData(PTMCluster clusterToModify) { + m_currentCluster =clusterToModify; + m_panel.setData(clusterToModify); + + } + + } + + private class SaveToggleButton extends JToggleButton { + + private ProgressInterface m_progressInterface = null; + + public SaveToggleButton(ProgressInterface progressInterface) { + setIcon(IconManager.getIcon(IconManager.IconType.SAVE_SETTINGS)); + m_progressInterface = progressInterface; + setEnabled(m_areClustersEditable); + init(); + } + + private void init() { + setToolTipText("Save Annotated Modifications Clusters"); + + addActionListener(e -> { + + //Verfify all data is load before allowing editing + if ((m_progressInterface != null) && (!m_progressInterface.isLoaded())) { + + ProgressBarDialog dialog = ProgressBarDialog.getDialog(WindowManager.getDefault().getMainWindow(), m_progressInterface, "Data loading", "Save is not available while data is loading. Please Wait."); + dialog.setLocation(getLocationOnScreen().x + getWidth() + 5, getLocationOnScreen().y + getHeight() + 5); + dialog.setVisible(true); + + if (!dialog.isWaitingFinished()) { + setSelected(false); + return; + } + } + + //Verify which dataset is loaded : if Annotated PTMDataset,nothing to do otherwise should switch to annotated dataset ! + PTMDatasetPair ptmDatasetpair = (PTMDatasetPair) m_dataBox.getData(PTMDatasetPair.class); + if(!ptmDatasetpair.shouldSavePTMDataset()){ + InfoDialog err = new InfoDialog(WindowManager.getDefault().getMainWindow(),InfoDialog.InfoType.INFO, "Save Information" ,"No modification to save..."); + err.setButtonVisible(InfoDialog.BUTTON_CANCEL, false); + err.setButtonName(InfoDialog.BUTTON_OK, "OK"); + err.centerToWindow(WindowManager.getDefault().getMainWindow()); + err.setVisible(true); + return; + } + + boolean changeToAnnotated = false; + if (ptmDatasetpair.getPTMDatasetType() == PTMDatasetPair.RAW_PTM_DATASET) { + InfoDialog err = new InfoDialog(WindowManager.getDefault().getMainWindow(),InfoDialog.InfoType.INFO, "Save Warning" ,"If annotated modification clusters already exist, it will be replace by new modification. Are you sure ? "); + err.centerToWindow(WindowManager.getDefault().getMainWindow()); + err.setVisible(true); + int choice = err.getButtonClicked(); + if(choice == InfoDialog.BUTTON_CANCEL) + return; + + DatabaseDataManager.getDatabaseDataManager().removeAllPTMDatasetsForDS(ptmDatasetpair.getDataset().getId()); + ptmDatasetpair.changePTMDatasetType(PTMDatasetPair.ANNOTATED_PTM_DATASET); + DatabaseDataManager.getDatabaseDataManager().addLoadedAnnotatedPTMDatasetSet(ptmDatasetpair); + changeToAnnotated = true; + } + + PTMDataset ptmDataset = (PTMDataset) m_dataBox.getData(PTMDataset.class); + + DatabaseDatasetPTMsTask task = new DatabaseDatasetPTMsTask(null); + task.initAddAnnotatedPTMDataset(m_dataBox.getProjectId(), ptmDataset); + task.fetchData(); + + m_infoToggleButton.updateInfo(); + + DataBoxViewerManager.loadedDataModified(m_dataBox.getProjectId(), m_dataBox.getRsetId(), m_dataBox.getRsmId(), PTMCluster.class, + new ArrayList(), REASON_MODIF.REASON_PTMDATASET_SAVED.getReasonValue()); + + if(changeToAnnotated) { + String newTitle = m_dataBox.getFullName(); + if(!newTitle.contains("Annotated PTMs")){ + newTitle = newTitle.replace("Dataset PTMs", "Annotated PTMs"); + } + ArrayList modifData = new ArrayList(); + modifData.add(newTitle); + + DataBoxViewerManager.loadedDataModified(m_dataBox.getProjectId(), m_dataBox.getRsetId(), m_dataBox.getRsmId(), PTMCluster.class, + modifData, REASON_MODIF.REASON_CHANGE_TITLE.getReasonValue()); + } + + + }); + + } + } + + private class MergeToggleButton extends JToggleButton { + + private ProgressInterface m_progressInterface; + + public MergeToggleButton(ProgressInterface progressInterface){ + m_progressInterface = progressInterface; + setIcon(IconManager.getIcon(IconManager.IconType.MERGE_PTM)); + setEnabled(m_areClustersEditable); + init(); + } + + private void init() { + setToolTipText("Merge selected clusters"); + + addActionListener(e -> { + if ((m_progressInterface != null) && (!m_progressInterface.isLoaded())) { + + ProgressBarDialog dialog = ProgressBarDialog.getDialog(WindowManager.getDefault().getMainWindow(), m_progressInterface, "Data loading", "Merge is not available while data is loading. Please Wait."); + dialog.setLocation(getLocationOnScreen().x + getWidth() + 5, getLocationOnScreen().y + getHeight() + 5); + dialog.setVisible(true); + + if (!dialog.isWaitingFinished()) { + setSelected(false); + return; + } + } + + if (m_ptmClusterTableModel.getRowCount() > 0 && m_ptmClusterTable.getSelectedRowCount() > 1) { + List clusters = getSelectedPTMClusters(); +// PTMDataset ptmDataset = (PTMDataset) m_dataBox.getData(PTMDataset.class); +// PTMDatasetPair ptmDatasetpair = (PTMDatasetPair) m_dataBox.getData(PTMDatasetPair.class); + + PTMDataset ptmDS = clusters.get(0).getPTMDataset(); + boolean merged = ptmDS.mergeClusters(clusters); + if (merged) { + m_ptmClusterTable.dataUpdated(null, true); + m_dataBox.propagateDataChanged(); + m_infoToggleButton.updateInfo(); + // propagate modifications to the previous views + DataBoxViewerManager.loadedDataModified(m_dataBox.getProjectId(), m_dataBox.getRsetId(), m_dataBox.getRsmId(), PTMCluster.class, + new ArrayList(clusters), REASON_MODIF.REASON_PTMCLUSTER_MERGED.getReasonValue()); + } else { + InfoDialog err = new InfoDialog(WindowManager.getDefault().getMainWindow(),InfoDialog.InfoType.WARNING, "Merge Error" ,"Merge has not be done. Be sure selected clusters are co-localized."); + err.setButtonVisible(InfoDialog.BUTTON_CANCEL, false); + err.setButtonName(InfoDialog.BUTTON_OK, "OK"); + err.centerToWindow(WindowManager.getDefault().getMainWindow()); + err.setVisible(true); + } + } else { + InfoDialog err = new InfoDialog(WindowManager.getDefault().getMainWindow(),InfoDialog.InfoType.INFO, "Merge Information" ,"Select more than one co-localized modification clusters."); + err.setButtonVisible(InfoDialog.BUTTON_CANCEL, false); + err.setButtonName(InfoDialog.BUTTON_OK, "OK"); + err.centerToWindow(WindowManager.getDefault().getMainWindow()); + err.setVisible(true); + } + + }); + } + } + + private class EditToggleButton extends JToggleButton { + + private ProgressInterface m_progressInterface; + + public EditToggleButton(ProgressInterface progressInterface){ + m_progressInterface = progressInterface; + setIcon(IconManager.getIcon(IconManager.IconType.EDIT)); + setEnabled(m_areClustersEditable); + init(); + } + + private void init() { + setToolTipText("Edit selected cluster"); + + addActionListener(e -> { + + //Verfify all data is load before allowing editing + if ((m_progressInterface != null) && (!m_progressInterface.isLoaded())) { + + ProgressBarDialog dialog = ProgressBarDialog.getDialog(WindowManager.getDefault().getMainWindow(), m_progressInterface, "Data loading", "Edit is not available while data is loading. Please Wait."); + dialog.setLocation(getLocationOnScreen().x + getWidth() + 5, getLocationOnScreen().y + getHeight() + 5); + dialog.setVisible(true); + + if (!dialog.isWaitingFinished()) { + setSelected(false); + return; + } + } + + + if(m_ptmClusterTableModel.getRowCount() > 0 && m_ptmClusterTable.getSelectedRowCount() == 1) { + PTMCluster cluster = getSelectedProteinPTMCluster(); + m_logger.debug(" Edit clusters id "+cluster.getId()+" ("+cluster.getProteinMatch().getAccession()+"_"+cluster.getRepresentativePepMatch().getPeptide().getSequence()+")"); + EditClusterDialog editClusterDialog = new EditClusterDialog(cluster); + editClusterDialog.centerToWindow(WindowManager.getDefault().getMainWindow()); + editClusterDialog.setVisible(true); + if(editClusterDialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { + ArrayList clustersToModify = new ArrayList<>(); + clustersToModify.add(cluster); + + byte reason = -1; + if (editClusterDialog.isPeptideDeleted()) { + editClusterDialog.getRemovedPeptideInstances().forEach( ptmPeptide -> cluster.removePeptide(ptmPeptide)); + reason = REASON_MODIF.REASON_PEPTIDE_SUPPRESSED.getReasonValue(); + } + if (editClusterDialog.isStatusModified()) { + reason = (reason == -1) ? REASON_MODIF.REASON_PTMCLUSTER_MODIFIED.getReasonValue() : (byte) (reason | REASON_MODIF.REASON_PTMCLUSTER_MODIFIED.getReasonValue()); + } + + if(editClusterDialog.isClusterModified()) + DataBoxViewerManager.loadedDataModified(m_dataBox.getProjectId(), m_dataBox.getRsetId(), m_dataBox.getRsmId(), PTMCluster.class, clustersToModify, reason); + + } + } else { + InfoDialog err = new InfoDialog(WindowManager.getDefault().getMainWindow(),InfoDialog.InfoType.INFO, "Edition Information" ,"Can't edit more than one modification cluster at the time. "); + err.setButtonVisible(InfoDialog.BUTTON_CANCEL, false); + err.setButtonName(InfoDialog.BUTTON_OK, "OK"); + err.centerToWindow(WindowManager.getDefault().getMainWindow()); + err.setVisible(true); + } + }); + + } + } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/PTMPeptidesTablePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/PTMPeptidesTablePanel.java index 485fdf408..ad3b82e7a 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/PTMPeptidesTablePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/PTMPeptidesTablePanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -48,11 +48,7 @@ import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; -import javax.swing.ImageIcon; -import javax.swing.JLayeredPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JToolBar; +import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.TableModelListener; import javax.swing.table.TableModel; @@ -134,6 +130,13 @@ public DPeptideMatch getSelectedPeptideMatch() { return row != null ? row.peptideMatch : null; } + public DMasterQuantPeptide getSelectedMasterQuantPeptide() { + if (m_ptmPeptidesTableModel.getRowCount() <= 0) { + return null; + } + return m_ptmPeptidesTableModel.getMasterQuantPeptideAt(getSelectedRowInTableModel()); + } + public int getSelectedIndex() { if (m_ptmPeptidesTableModel.getRowCount() <= 0) { return -1; @@ -435,7 +438,7 @@ public void setShowed(boolean showed) { } m_isDisplayed = showed; if (showed) { - if (DataBoxPTMPeptides.class.isInstance(m_dataBox)) { + if (m_dataBox instanceof DataBoxPTMPeptides) { ((DataBoxPTMPeptides) m_dataBox).updateData(); } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/PeptideMatchPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/PeptideMatchPanel.java index 412edb1bc..5b9c85f23 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/PeptideMatchPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/PeptideMatchPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -20,6 +20,7 @@ import fr.proline.core.orm.msi.ResultSet; import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.msi.dto.DPeptideMatch; +import fr.proline.studio.dock.AbstractTopPanel; import fr.proline.studio.extendedtablemodel.AddDataAnalyzerButton; import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; import fr.proline.studio.dam.tasks.SubTask; @@ -36,7 +37,7 @@ import fr.proline.studio.progress.ProgressBarDialog; import fr.proline.studio.progress.ProgressInterface; import fr.proline.studio.table.TableInfo; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.actions.table.DisplayTablePopupMenu; import fr.proline.studio.rsmexplorer.gui.model.PeptideMatchTableModel; import fr.proline.studio.search.SearchToggleButton; @@ -54,8 +55,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.TableModelListener; import org.jdesktop.swingx.JXTable; -import org.openide.windows.TopComponent; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; /** @@ -163,12 +163,13 @@ public void dataUpdated(SubTask subTask, boolean finished) { } private String getTopComponentName() { + Container c = getParent(); - while ((c != null) && !(c instanceof TopComponent)) { + while ((c != null) && !(c instanceof AbstractTopPanel)) { c = c.getParent(); } - if ((c != null) && (c instanceof TopComponent)) { - return ((TopComponent) c).getName(); + if ((c != null) && (c instanceof AbstractTopPanel)) { + return ((AbstractTopPanel) c).getTitle(); } return ""; } @@ -284,9 +285,8 @@ public void actionPerformed(ActionEvent e) { } // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } }); } @@ -347,9 +347,8 @@ public void actionPerformed(ActionEvent e) { WindowBox wbox = WindowBoxFactory.getGraphicsWindowBox("Graphic", m_dataBox, true); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } }); } @@ -461,7 +460,6 @@ private class PeptideMatchTable extends LazyTable implements InfoInterface { /** * Called whenever the value of the selection changes. * - * @param e the event that characterizes the change. */ //ProteinSet proteinSetSelected = null; public PeptideMatchTable() { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ProjectExplorerPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ProjectExplorerPanel.java index 33e99fa4d..ff812bdcf 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ProjectExplorerPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ProjectExplorerPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -23,6 +23,8 @@ import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.uds.Project; import fr.proline.core.orm.uds.UserAccount; +import fr.proline.studio.NbPreferences; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.DatabaseDataManager; import fr.proline.studio.dam.data.AbstractData; @@ -33,43 +35,31 @@ import fr.proline.studio.dam.tasks.DatabaseClearProjectTask; import fr.proline.studio.dam.tasks.DatabaseProjectTask; import fr.proline.studio.dam.tasks.SubTask; +import fr.proline.studio.dock.AbstractTopPanel; import fr.proline.studio.dpm.AccessJMSManagerThread; import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; import fr.proline.studio.dpm.task.jms.ClearProjectTask; import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.gui.InfoDialog; -import fr.proline.studio.pattern.DataParameter; -import fr.proline.studio.pattern.ParameterList; -import fr.proline.studio.pattern.ParameterSubtypeEnum; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; -import fr.proline.studio.rsmexplorer.PropertiesTopComponent; +import fr.proline.studio.pattern.*; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.actions.ConnectAction; import fr.proline.studio.rsmexplorer.gui.dialog.AddProjectDialog; import fr.proline.studio.rsmexplorer.gui.dialog.ClearProjectDialog; +import fr.proline.studio.rsmexplorer.gui.model.properties.ProjectPropertiesTableModel; import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; import fr.proline.studio.rsmexplorer.tree.quantitation.QuantitationTree; +import fr.proline.studio.table.PropertiesTableModel; import fr.proline.studio.utils.IconManager; -import fr.proline.studio.utils.PropertiesProviderInterface; -import java.awt.Color; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; + +import javax.swing.*; +import javax.swing.plaf.basic.BasicComboBoxRenderer; +import java.awt.*; import java.util.ArrayList; -import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Set; import java.util.prefs.Preferences; -import javax.swing.*; -import javax.swing.plaf.basic.BasicComboBoxRenderer; -import org.openide.nodes.Node; -import org.openide.nodes.PropertySupport; -import org.openide.nodes.Sheet; -import org.openide.util.NbPreferences; -import org.openide.windows.TopComponent; -import org.openide.windows.WindowManager; -import org.slf4j.LoggerFactory; /** * @@ -83,9 +73,9 @@ public class ProjectExplorerPanel extends JPanel { private JButton m_editProjectButton; private JButton m_propertiesProjectButton; private JButton m_clearProjectButton; - private JComboBox m_projectsComboBox = null; - private JScrollPane m_identificationTreeScrollPane = null; - private JScrollPane m_quantitationTreeScrollPane = null; + private JComboBox m_projectsComboBox; + private JScrollPane m_identificationTreeScrollPane; + private JScrollPane m_quantitationTreeScrollPane; public static ProjectExplorerPanel getProjectExplorerPanel() { if (m_singleton == null) { @@ -141,7 +131,7 @@ public Project getSelectedProject() { ProjectItem pi = (ProjectItem) m_projectsComboBox.getSelectedItem(); - if (pi.m_projectIdentificationData == null) { + if (pi == null || pi.m_projectIdentificationData == null) { return null; } else { return pi.m_projectIdentificationData.getProject(); @@ -204,39 +194,13 @@ private JPanel createButtonPanel() { //buttonsPanel.add(m_clearProjectButton, c); // Interactions - m_addProjectButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - addProjectActionPerformed(); - - } - }); - - m_editProjectButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - editProjectActionPerformed(); - - } - }); + m_addProjectButton.addActionListener(e -> addProjectActionPerformed()); - m_propertiesProjectButton.addActionListener(new ActionListener() { + m_editProjectButton.addActionListener(e -> editProjectActionPerformed()); - @Override - public void actionPerformed(ActionEvent e) { - showPropertiesProjectActionPerformed(); - } - }); + m_propertiesProjectButton.addActionListener(e -> showPropertiesProjectActionPerformed()); - m_clearProjectButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - clearProjectActionPerformed(); - } - }); + m_clearProjectButton.addActionListener(e -> clearProjectActionPerformed()); return buttonsPanel; } @@ -320,6 +284,8 @@ public void run(boolean success) { private void editProjectActionPerformed() { final ProjectItem projectItem = (ProjectItem) m_projectsComboBox.getSelectedItem(); + if(projectItem == null) + return; ProjectIdentificationData projectData = projectItem.getProjectIdentificationData(); final Project project = projectData.getProject(); final String oldName = project.getName(); @@ -373,25 +339,32 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) private void showPropertiesProjectActionPerformed() { ProjectItem projectItem = (ProjectItem) m_projectsComboBox.getSelectedItem(); + if(projectItem == null) + return; + ProjectIdentificationData projectData = projectItem.getProjectIdentificationData(); String projectName = projectData.getName(); - String dialogName = "Properties : " + projectName; - final PropertiesTopComponent win = new PropertiesTopComponent(dialogName); - ProjectItem[] projectItemArray = new ProjectItem[1]; - projectItemArray[0] = projectItem; - win.setProperties(projectItemArray); - win.open(); - win.requestActive(); + Project project = projectItem.getProjectIdentificationData().getProject(); + + WindowBox windowBox = WindowBoxFactory.getGenericWindowBox(projectName, "Properties", IconManager.IconType.DOCUMENT_LIST, true); + PropertiesTableModel model = new ProjectPropertiesTableModel(project); + + windowBox.setEntryData(-1L, model); + DataBoxViewerTopPanel win2 = new DataBoxViewerTopPanel(windowBox); + WindowManager.getDefault().getMainWindow().displayWindow(win2); } private void clearProjectActionPerformed() { ProjectItem projectItem = (ProjectItem) m_projectsComboBox.getSelectedItem(); + if(projectItem == null) + return; + ProjectIdentificationData projectData = projectItem.getProjectIdentificationData(); final Project project = projectData.getProject(); - List data = new ArrayList(); + List data = new ArrayList<>(); List openedData = ProjectExplorerPanel.getOpenedData(project); AbstractDatabaseCallback callback = new AbstractDatabaseCallback() { @@ -413,41 +386,42 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) /** * returns the list of rs/rsm opened in the application for a given project - * @param projectId + * @param project * @return */ public static List getOpenedData(Project project) { - List openedData = new ArrayList(); + List openedData = new ArrayList<>(); long projectId = project.getId(); String allImportedWindowsName = project.getName()+" : All Imported"; // remove data which are opened in windows - Iterator itTop = TopComponent.getRegistry().getOpened().iterator(); + Set tcs = WindowManager.getDefault().getMainWindow().getTopPanels(); + Iterator itTop = tcs.iterator(); while (itTop.hasNext()) { - TopComponent topComponent = itTop.next(); - if (topComponent instanceof DataBoxViewerTopComponent && !(topComponent.getName().startsWith(allImportedWindowsName))) { - long pId = ((DataBoxViewerTopComponent) topComponent).getProjectId(); + AbstractTopPanel topComponent = itTop.next(); + if (topComponent instanceof DataBoxViewerTopPanel && !(topComponent.getName().startsWith(allImportedWindowsName))) { + long pId = ((DataBoxViewerTopPanel) topComponent).getProjectId(); if (pId == projectId) { - ParameterList inParam = ((DataBoxViewerTopComponent) topComponent).getInParameters(); + ParameterList inParam = ((DataBoxViewerTopPanel) topComponent).getInParameters(); for (DataParameter dataParam : inParam.getParameterList()) { if (dataParam.equalsData(ResultSummary.class, ParameterSubtypeEnum.SINGLE_DATA)) { - ResultSummary rsm = (ResultSummary) ((DataBoxViewerTopComponent) topComponent).getData(ResultSummary.class); + ResultSummary rsm = (ResultSummary) ((DataBoxViewerTopPanel) topComponent).getData(ResultSummary.class); openedData.add(new ClearProjectData(projectId, rsm)); openedData.add(new ClearProjectData(projectId, rsm.getResultSet())); } else if (dataParam.equalsData(ResultSet.class, ParameterSubtypeEnum.SINGLE_DATA)) { - ResultSet rs = (ResultSet) ((DataBoxViewerTopComponent) topComponent).getData(ResultSet.class); + ResultSet rs = (ResultSet) ((DataBoxViewerTopPanel) topComponent).getData(ResultSet.class); openedData.add(new ClearProjectData(projectId, rs)); } } - ParameterList outParam = ((DataBoxViewerTopComponent) topComponent).getOutParameters(); + ParameterList outParam = ((DataBoxViewerTopPanel) topComponent).getOutParameters(); for (DataParameter dataParam : outParam.getParameterList()) { if (dataParam.equalsData(ResultSummary.class, ParameterSubtypeEnum.SINGLE_DATA)) { - ResultSummary rsm = (ResultSummary) ((DataBoxViewerTopComponent) topComponent).getData(ResultSummary.class); + ResultSummary rsm = (ResultSummary) ((DataBoxViewerTopPanel) topComponent).getData(ResultSummary.class); openedData.add(new ClearProjectData(projectId, rsm)); openedData.add(new ClearProjectData(projectId, rsm.getResultSet())); } else if (dataParam.equalsData(ResultSet.class, ParameterSubtypeEnum.SINGLE_DATA)) { - ResultSet rs = (ResultSet) ((DataBoxViewerTopComponent) topComponent).getData(ResultSet.class); + ResultSet rs = (ResultSet) ((DataBoxViewerTopPanel) topComponent).getData(ResultSet.class); openedData.add(new ClearProjectData(projectId, rs)); } } @@ -482,9 +456,9 @@ protected Object doInBackground() throws Exception { if ((clearProjectDialog.canModifyValues())) { List dataToClear = clearProjectDialog.getSelectedData(); - List rsmIds = new ArrayList(); - List rsIds = new ArrayList(); - dataToClear.stream().forEach((d) -> { + List rsmIds = new ArrayList<>(); + List rsIds = new ArrayList<>(); + dataToClear.forEach((d) -> { if (d.isResultSet()) { rsIds.add(d.getResultSet().getId()); } else if (d.isResultSummary()) { @@ -551,34 +525,32 @@ public void run() { if (nbProjects > 0) { m_projectsComboBox.addItem(new ProjectItem(null, null)); // Null Project corresponds to Select a Project Item } - for (int i = 0; i < nbProjects; i++) { - ProjectIdentificationData identificationData = (ProjectIdentificationData) projectList.get(i); + for (AbstractData abstractData : projectList) { + ProjectIdentificationData identificationData = (ProjectIdentificationData) abstractData; m_projectsComboBox.addItem(new ProjectItem(identificationData, new ProjectQuantitationData(identificationData.getProject()))); } m_addProjectButton.setEnabled(true); - m_projectsComboBox.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - ProjectItem item = (ProjectItem) m_projectsComboBox.getSelectedItem(); - getProjectExplorerPanel().selectProject(item); - - if ((item != null) && (item.getProjectIdentificationData() != null) && (!item.isChanging())) { - m_editProjectButton.setEnabled(true); - m_propertiesProjectButton.setEnabled(true); - m_clearProjectButton.setEnabled(true); - - Preferences preferences = NbPreferences.root(); - preferences.put("DefaultSelectedProject", item.getProjectIdentificationData().getName()); - } else { - m_editProjectButton.setEnabled(false); - m_propertiesProjectButton.setEnabled(false); - m_clearProjectButton.setEnabled(false); - } - + m_projectsComboBox.addActionListener(e -> { + ProjectItem item = (ProjectItem) m_projectsComboBox.getSelectedItem(); + getProjectExplorerPanel().selectProject(item); + + if ((item != null) && (item.getProjectIdentificationData() != null) && (!item.isChanging())) { + DatabaseDataManager.getDatabaseDataManager().setCurrentProject(item.getProjectIdentificationData().getProject()); + m_editProjectButton.setEnabled(true); + m_propertiesProjectButton.setEnabled(true); + m_clearProjectButton.setEnabled(true); + + Preferences preferences = NbPreferences.root(); + preferences.put("DefaultSelectedProject", item.getProjectIdentificationData().getName()); + } else { + DatabaseDataManager.getDatabaseDataManager().setCurrentProject(null); + m_editProjectButton.setEnabled(false); + m_propertiesProjectButton.setEnabled(false); + m_clearProjectButton.setEnabled(false); } + }); Preferences preferences = NbPreferences.root(); @@ -607,19 +579,16 @@ public void actionPerformed(ActionEvent e) { public void selectProject(ProjectItem projectItem) { - if ((projectItem == null) || (!projectItem.isActive())) { + if ((projectItem == null) || (projectItem.isInactive())) { m_identificationTreeScrollPane.setViewportView(null); m_quantitationTreeScrollPane.setViewportView(null); - if ((projectItem != null) && (!projectItem.isActive())) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - InfoDialog infoDialog = new InfoDialog(WindowManager.getDefault().getMainWindow(), InfoDialog.InfoType.WARNING, "Project Deleted", "Databases corresponding to this project have been deleted.\nAsk to your Administrator to restore them."); - infoDialog.setButtonVisible(InfoDialog.BUTTON_CANCEL, false); - infoDialog.centerToWindow(WindowManager.getDefault().getMainWindow()); - infoDialog.setVisible(true); - } + if ((projectItem != null) && (projectItem.isInactive())) { + SwingUtilities.invokeLater(() -> { + InfoDialog infoDialog = new InfoDialog(WindowManager.getDefault().getMainWindow(), InfoDialog.InfoType.WARNING, "Project Deleted", "Databases corresponding to this project have been deleted.\nAsk to your Administrator to restore them."); + infoDialog.setButtonVisible(InfoDialog.BUTTON_CANCEL, false); + infoDialog.centerToWindow(WindowManager.getDefault().getMainWindow()); + infoDialog.setVisible(true); }); } @@ -643,7 +612,7 @@ public void run() { } } - public class ProjectComboboxRenderer extends BasicComboBoxRenderer { + public static class ProjectComboboxRenderer extends BasicComboBoxRenderer { public ProjectComboboxRenderer() { } @@ -677,7 +646,8 @@ public Component getListCellRendererComponent(JList list, Object value, int inde if (serializedProperties != null) { JsonObject jsonObject = parser.parse(serializedProperties).getAsJsonObject(); JsonPrimitive isActiveObject = jsonObject.getAsJsonPrimitive("is_active"); - isActive = isActiveObject.getAsBoolean(); + if(isActiveObject != null) + isActive = isActiveObject.getAsBoolean(); } projectItem.setIsActive(isActive); @@ -698,7 +668,7 @@ public Component getListCellRendererComponent(JList list, Object value, int inde } } - public static class ProjectItem implements PropertiesProviderInterface { + public static class ProjectItem { private ProjectIdentificationData m_projectIdentificationData; private ProjectQuantitationData m_projectQuantitationData; @@ -738,45 +708,9 @@ public void setIsActive(boolean v) { m_active = v; } - public boolean isActive() { - return m_active; + public boolean isInactive() { + return !m_active; } - - - @Override - public Sheet createSheet() { - Project p = m_projectIdentificationData.getProject(); - - Sheet sheet = Sheet.createDefault(); - try { - - Sheet.Set propGroup = Sheet.createPropertiesSet(); - - Node.Property prop = new PropertySupport.Reflection<>(p, Long.class, "getId", null); - prop.setName("id"); - propGroup.put(prop); - - prop = new PropertySupport.Reflection<>(p, String.class, "getName", null); - prop.setName("name"); - propGroup.put(prop); - - prop = new PropertySupport.Reflection<>(p, String.class, "getDescription", null); - prop.setName("description"); - propGroup.put(prop); - - sheet.put(propGroup); - - } catch (NoSuchMethodException e) { - LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error(getClass().getSimpleName() + " properties error ", e); - } - - return sheet; - } - - @Override - public void loadDataForProperties(Runnable callback) { - // nothing to do - } } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsetAllPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsetAllPanel.java index 58a7d5a3e..b748ed97e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsetAllPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsetAllPanel.java @@ -1,929 +1,849 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.gui; - -import fr.proline.core.orm.msi.MsiSearch; -import fr.proline.core.orm.msi.Peaklist; -import fr.proline.core.orm.msi.ResultSet; -import fr.proline.studio.extendedtablemodel.ExtraDataType; -import fr.proline.studio.dam.AccessDatabaseThread; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; -import fr.proline.studio.dam.tasks.AbstractDatabaseTask; -import fr.proline.studio.dam.tasks.DatabaseRsetProperties; -import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.export.ExportButton; -import fr.proline.studio.export.ExportModelUtilities; -import fr.proline.studio.export.ExportFontData; -import fr.proline.studio.filter.ConvertValueInterface; -import fr.proline.studio.filter.Filter; -import fr.proline.studio.filter.FilterButton; -import fr.proline.studio.filter.IntegerFilter; -import fr.proline.studio.graphics.PlotInformation; -import fr.proline.studio.graphics.PlotType; -import fr.proline.studio.gui.HourglassPanel; -import fr.proline.studio.gui.SplittedPanelContainer; -import fr.proline.studio.markerbar.MarkerContainerPanel; -import fr.proline.studio.pattern.AbstractDataBox; -import fr.proline.studio.pattern.DataBoxPanelInterface; -import fr.proline.studio.progress.ProgressInterface; -import fr.proline.studio.rsmexplorer.actions.identification.PropertiesAction; -import fr.proline.studio.rsmexplorer.gui.renderer.TimestampRenderer; -import fr.proline.studio.rsmexplorer.tree.identification.IdTransferable; -import fr.proline.studio.search.SearchToggleButton; -import fr.proline.studio.table.AbstractTableAction; -import fr.proline.studio.extendedtablemodel.CompoundTableModel; -import fr.proline.studio.table.DecoratedTableModel; -import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; -import fr.proline.studio.filter.StringDiffFilter; -import fr.proline.studio.pattern.DataboxGeneric; -import fr.proline.studio.pattern.WindowBox; -import fr.proline.studio.pattern.WindowBoxFactory; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; -import fr.proline.studio.rsmexplorer.gui.model.properties.IdentificationPropertiesTableModel; -import fr.proline.studio.table.LazyData; -import fr.proline.studio.table.LazyTable; -import fr.proline.studio.table.TablePopupMenu; -import fr.proline.studio.utils.IconManager; -import fr.proline.studio.utils.PropertiesProviderInterface; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.datatransfer.Transferable; -import java.awt.event.*; -import java.sql.Timestamp; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.LinkedHashMap; -import java.util.Locale; -import java.util.Map; -import javax.swing.*; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.TableCellRenderer; -import org.openide.nodes.Sheet; -import org.openide.util.NbBundle; - -/** - * Panel to display all Search Results (rset) imported - * - * @author JM235353 - */ -public class RsetAllPanel extends HourglassPanel implements DataBoxPanelInterface { - - private AbstractDataBox m_dataBox; - private ResultSetTable m_resultSetTable; - - private MarkerContainerPanel m_markerContainerPanel; - - private SearchToggleButton m_searchToggleButton; - private FilterButton m_filterButton; - private ExportButton m_exportButton; - - private JScrollPane m_scrollPane; - - public RsetAllPanel() { - - setLayout(new BorderLayout()); - - final JPanel resultSetPanel = this.createResultSetPanel(); - - final JLayeredPane layeredPane = new JLayeredPane(); - - layeredPane.addComponentListener(new ComponentListener() { - - @Override - public void componentResized(ComponentEvent e) { - final Component c = e.getComponent(); - - resultSetPanel.setBounds(0, 0, c.getWidth(), c.getHeight()); - layeredPane.revalidate(); - layeredPane.repaint(); - - } - - @Override - public void componentMoved(ComponentEvent e) { - } - - @Override - public void componentShown(ComponentEvent e) { - } - - @Override - public void componentHidden(ComponentEvent e) { - } - }); - add(layeredPane, BorderLayout.CENTER); - - layeredPane.add(resultSetPanel, JLayeredPane.DEFAULT_LAYER); - layeredPane.add(m_searchToggleButton.getSearchPanel(), JLayeredPane.PALETTE_LAYER); - - } - - private JPanel createResultSetPanel(){ - JPanel panel = new JPanel(); - - panel.setLayout(new BorderLayout()); - panel.setBounds(0, 0, 500, 400); - - JPanel internalPanel = initInternalPanel(); - panel.add(internalPanel, BorderLayout.CENTER); - - JToolBar toolbar = initToolbar(); - panel.add(toolbar, BorderLayout.WEST); - - return panel; - } - - private JPanel initInternalPanel() { - - JPanel internalPanel = new JPanel(); - - internalPanel.setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - // create objects - m_scrollPane = new JScrollPane(); - m_resultSetTable = new ResultSetTable(); - ResultSetTableModel resultSetTableModel = new ResultSetTableModel(); - - m_resultSetTable.setModel(new CompoundTableModel((GlobalTableModelInterface) resultSetTableModel, true)); - - m_markerContainerPanel = new MarkerContainerPanel(m_scrollPane, m_resultSetTable); - - m_scrollPane.setViewportView(m_resultSetTable); - m_resultSetTable.setFillsViewportHeight(true); - m_resultSetTable.setViewport(m_scrollPane.getViewport()); - - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 3; - internalPanel.add(m_markerContainerPanel, c); - - return internalPanel; - - } - - private JToolBar initToolbar() { - JToolBar toolbar = new JToolBar(JToolBar.VERTICAL); - toolbar.setFloatable(false); - - JButton refreshButton = new JButton(IconManager.getIcon(IconManager.IconType.REFRESH)); - refreshButton.setToolTipText("Refresh"); - refreshButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - m_dataBox.dataChanged(); - } - }); - - // Search Button - m_searchToggleButton = new SearchToggleButton(m_resultSetTable, m_resultSetTable, ((CompoundTableModel) m_resultSetTable.getModel())); - - // Filter Button - m_filterButton = new FilterButton(((CompoundTableModel) m_resultSetTable.getModel())) { - - @Override - protected void filteringDone() { - m_dataBox.dataChanged(); - } - - }; - - // Export Button - m_exportButton = new ExportButton(((ProgressInterface) m_resultSetTable), "All Imported Sets", m_resultSetTable); - - toolbar.add(refreshButton); - toolbar.add(m_searchToggleButton); - toolbar.add(m_filterButton); - toolbar.add(m_exportButton); - - return toolbar; - } - - public void setData(long taskId, ArrayList resultSetList) { - CompoundTableModel compoundTableModel = (CompoundTableModel) m_resultSetTable.getModel(); - ResultSetTableModel resultSetTableModel = (ResultSetTableModel) compoundTableModel.getBaseModel(); - - resultSetTableModel.setData(resultSetList); - - // select the first row - if ((resultSetList != null) && (resultSetList.size() > 0)) { - m_resultSetTable.getSelectionModel().setSelectionInterval(0, 0); - m_markerContainerPanel.setMaxLineNumber(resultSetList.size()); - } - - m_resultSetTable.setSortable(true); - } - - public ResultSet getSelectedResultSet() { - - // Retrieve Selected Row - int selectedRow = m_resultSetTable.getSelectedRow(); - - // nothing selected - if (selectedRow == -1) { - return null; - - } - - // convert according to the sorting - selectedRow = m_resultSetTable.convertRowIndexToModel(selectedRow); - - // Retrieve ProteinSet selected - ResultSetTableModel tableModel = (ResultSetTableModel) m_resultSetTable.getModel(); - return tableModel.getResultSet(selectedRow); - } - - @Override - public void setDataBox(AbstractDataBox dataBox) { - m_dataBox = dataBox; - } - - @Override - public AbstractDataBox getDataBox() { - return m_dataBox; - } - - @Override - public void addSingleValue(Object v) { - ((CompoundTableModel) m_resultSetTable.getModel()).addSingleValue(v); - } - - private class ResultSetTable extends LazyTable implements ProgressInterface { - - public ResultSetTable() { - super(m_scrollPane.getVerticalScrollBar()); - - setDragEnabled(true); - TableTransferHandler handler = new TableTransferHandler(); - setTransferHandler(handler); - - setDefaultRenderer(Timestamp.class, new TimestampRenderer(getDefaultRenderer(String.class))); - - // remove mouse listeners and put them back later - // (our listener must be executed first so the selection - // of nodes have not been already managed - final MouseListener[] ls = getMouseListeners(); - for (final MouseListener l : ls) { - removeMouseListener(l); - } - - addMouseListener(new MouseAdapter() { - - @Override - public void mouseReleased(MouseEvent e) { - - } - - @Override - public void mousePressed(MouseEvent e) { - // Need to explicitly start a drag operation when the mouse is pressed. - // Otherwise drags are only started *after* the user has clicked once - // on the JTable (this could be down to the L&F not doing the right thing). - - if (!SwingUtilities.isLeftMouseButton(e)) { - return; - } - - // hack to avoid a conflict with selection manager - // --- begin - int row = m_resultSetTable.rowAtPoint(e.getPoint()); - if (row == -1) { - return; - } - - int[] selectedRows = m_resultSetTable.getSelectedRows(); - - for (int i = 0; i < selectedRows.length; i++) { - if (selectedRows[i] == row) { - return; - } - } - // -- end - - if (e.isControlDown()) { - m_resultSetTable.addRowSelectionInterval(row, row); - } else if (e.isShiftDown()) { - int minIndex = m_resultSetTable.getSelectionModel().getMinSelectionIndex(); - if ((minIndex == -1) || (row < minIndex)) { - minIndex = row; - } - int maxIndex = m_resultSetTable.getSelectionModel().getMaxSelectionIndex(); - if ((maxIndex == -1) || (row > maxIndex)) { - maxIndex = row; - } - m_resultSetTable.setRowSelectionInterval(minIndex, maxIndex); - } else { - m_resultSetTable.setRowSelectionInterval(row, row); - } - - getTransferHandler().exportAsDrag(m_resultSetTable, e, TransferHandler.COPY); - - } - }); - - // put back mouse listeners - for (final MouseListener l : ls) { - addMouseListener(l); - } - } - - @Override - public void addTableModelListener(TableModelListener l) { - getModel().addTableModelListener(l); - } - - /** - * Called whenever the value of the selection changes. - * - * @param e the event that characterizes the change. - */ - @Override - public void valueChanged(ListSelectionEvent e) { - - super.valueChanged(e); - - if (e.getValueIsAdjusting()) { - // value is adjusting, so valueChanged will be called again - return; - } - - m_dataBox.addDataChanged(ResultSet.class); - m_dataBox.propagateDataChanged(); - - } - - @Override - public TablePopupMenu initPopupMenu() { - - TablePopupMenu popupMenu = new TablePopupMenu(); - popupMenu.addAction(new PropertiesFromTableAction()); - - return popupMenu; - } - - // set as abstract - @Override - public void prepostPopupMenu() { - // nothing to do - } - - @Override - public boolean isLoaded() { - return true; - //return m_dataBox.isLoaded(); - } - - @Override - public int getLoadingPercentage() { - return 100; - //return m_dataBox.getLoadingPercentage(); - } - - } - - @Override - public ActionListener getRemoveAction(SplittedPanelContainer splittedPanel) { - return m_dataBox.getRemoveAction(splittedPanel); - } - - @Override - public ActionListener getAddAction(SplittedPanelContainer splittedPanel) { - return m_dataBox.getAddAction(splittedPanel); - } - - @Override - public ActionListener getSaveAction(SplittedPanelContainer splittedPanel) { - return m_dataBox.getSaveAction(splittedPanel); - } - - private class PropertiesFromTableAction extends AbstractTableAction { - - public PropertiesFromTableAction() { - super(NbBundle.getMessage(PropertiesAction.class, "CTL_PropertiesAction")); - } - - @Override - public void actionPerformed(int col, int row, int[] selectedRows, JTable table) { - - int nbResultSet = selectedRows.length; - - ResultSetTableModel rsetModel = (ResultSetTableModel) ((CompoundTableModel) m_resultSetTable.getModel()).getBaseModel(); - - final long projectId = m_dataBox.getProjectId(); - - ArrayList resultSetList = new ArrayList<>(nbResultSet); - - for (int i = 0; i < nbResultSet; i++) { - int rowInModel = m_resultSetTable.convertRowIndexToModel(selectedRows[i]); - - ResultSet rset = rsetModel.getResultSet(rowInModel); - resultSetList.add(rset); - } - - String rsetFileName = resultSetList.get(0).getMsiSearch().getResultFileName(); - if (rsetFileName != null) { - int index = rsetFileName.lastIndexOf('.'); - if (index != -1) { - rsetFileName = rsetFileName.substring(0, index); - } - } else { - rsetFileName = ""; // should not happen - } - - String dialogName = "Properties " + rsetFileName; - - // new Properties window - WindowBox windowBox = WindowBoxFactory.getGenericWindowBox(dialogName, "Properties", IconManager.IconType.DOCUMENT_LIST, true); - final IdentificationPropertiesTableModel _model = new IdentificationPropertiesTableModel(); - windowBox.setEntryData(-1L, _model); - DataBoxViewerTopComponent win2 = new DataBoxViewerTopComponent(windowBox); - win2.open(); - win2.requestActive(); - - //JPM.HACK ! Impossible to set the max number of lines differently in this case - DataboxGeneric databoxGeneric = ((DataboxGeneric) windowBox.getEntryBox()); - GenericPanel genericPanel = (GenericPanel) databoxGeneric.getPanel(); - - final GenericPanel _genericPanel = genericPanel; - - final int loadingId = databoxGeneric.setLoading(); - - // load data for properties - final RsetCallback dataLoadedCallback2 = new RsetCallback(nbResultSet) { - - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - m_nbDataToLoad--; - if (m_nbDataToLoad == 0) { - - databoxGeneric.setLoaded(loadingId); - - if (_model != null) { - _model.setData(projectId, resultSetList); - _genericPanel.setMaxLineNumber(_model.getRowCount()); - } - - } - } - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - - - }; - - for (int i = 0; i < nbResultSet; i++) { - - ResultSet rset = resultSetList.get(i); - DatabaseRsetProperties task = new DatabaseRsetProperties(dataLoadedCallback2, projectId, rset, rset.getName()); - task.setPriority(AbstractDatabaseTask.Priority.HIGH_3); // highest priority - - AccessDatabaseThread.getAccessDatabaseThread().addTask(task); - } - - } - - @Override - public void updateEnabled(int row, int col, int[] selectedRows, JTable table) { - setEnabled(selectedRows.length > 0); - } - - } - - - - - public abstract class RsetCallback extends AbstractDatabaseCallback { - - protected int m_nbDataToLoad; - - public RsetCallback(int nbDataToLoad) { - m_nbDataToLoad = nbDataToLoad; - } - - - - }; - - public class ResultsetPropertiesProvider implements PropertiesProviderInterface { - - private ResultSet m_rset = null; - private String m_name = null; - private long m_projectId = -1; - - public ResultsetPropertiesProvider(ResultSet rset, long projectId, String name) { - m_rset = rset; - m_name = name; - m_projectId = projectId; - } - - @Override - public void loadDataForProperties(final Runnable callback) { - - AbstractDatabaseCallback taskCallback = new AbstractDatabaseCallback() { - - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success, long taskId, SubTask subTask, boolean finished) { - - callback.run(); - - } - }; - - //Load ResultSet Extra Data - DatabaseRsetProperties task = new DatabaseRsetProperties(taskCallback, m_projectId, m_rset, m_name); - task.setPriority(AbstractDatabaseTask.Priority.HIGH_3); // highest priority - - AccessDatabaseThread.getAccessDatabaseThread().addTask(task); - } - - public ResultSet getResultset() { - return m_rset; - } - - @Override - public Sheet createSheet() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - } - - private static class ResultSetTableModel extends DecoratedTableModel implements GlobalTableModelInterface { - - public static final int COLTYPE_RSET_ID = 0; - public static final int COLTYPE_RSET_NAME = 1; - public static final int COLTYPE_PEAKLIST_PATH = 2; - public static final int COLTYPE_MSISEARCH_FILE_NAME = 3; - public static final int COLTYPE_MSISEARCH_FILE_DIRECTORY = 4; - public static final int COLTYPE_MSISEARCH_SEARCH_DATE = 5; - private static final String[] columnNames = {"id", "Search Result Name", "Peaklist Path", "MSISearch File Name", "MSISearch File Directory", "Search Date"}; - - private ArrayList m_resultSetList = null; - - public void setData(ArrayList resultSetList) { - m_resultSetList = resultSetList; - fireTableDataChanged(); - - } - - public ResultSet getResultSet(int row) { - if (m_resultSetList == null) { - return null; - } - if (m_resultSetList.size() <= row) { - return null; - } - return m_resultSetList.get(row); - } - - @Override - public Class getColumnClass(int col) { - switch (col) { - case COLTYPE_RSET_ID: - return Long.class; - case COLTYPE_MSISEARCH_SEARCH_DATE: - return Timestamp.class; - default: - return String.class; - } - } - - @Override - public int getRowCount() { - if (m_resultSetList == null) { - return 0; - } - return m_resultSetList.size(); - } - - @Override - public int getColumnCount() { - return columnNames.length; - } - - @Override - public String getColumnName(int col) { - return columnNames[col]; - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - ResultSet rset = m_resultSetList.get(rowIndex); - switch (columnIndex) { - case COLTYPE_RSET_ID: { - return Long.valueOf(rset.getId()); - } - case COLTYPE_RSET_NAME: { - return rset.getName(); - } - case COLTYPE_PEAKLIST_PATH: { - MsiSearch msiSearch = rset.getMsiSearch(); - if (msiSearch == null) { - return ""; - } - Peaklist peaklist = msiSearch.getPeaklist(); - if (peaklist == null) { - return ""; - } - return peaklist.getPath(); - } - case COLTYPE_MSISEARCH_FILE_NAME: { - MsiSearch msiSearch = rset.getMsiSearch(); - if (msiSearch == null) { - return ""; - } - return msiSearch.getResultFileName(); - } - case COLTYPE_MSISEARCH_FILE_DIRECTORY: { - MsiSearch msiSearch = rset.getMsiSearch(); - if (msiSearch == null) { - return ""; - } - return msiSearch.getResultFileDirectory(); - } - case COLTYPE_MSISEARCH_SEARCH_DATE: { - MsiSearch msiSearch = rset.getMsiSearch(); - if (msiSearch == null) { - return null; - } - return msiSearch.getDate(); - } - } - return null; // should not happen - } - - @Override - public String getToolTipForHeader(int col) { - return getColumnName(col); - } - - @Override - public String getTootlTipValue(int row, int col) { - return null; - } - - @Override - public TableCellRenderer getRenderer(int row, int col) { - return null; - } - - @Override - public GlobalTableModelInterface getFrozzenModel() { - return this; - } - - @Override - public Long getTaskId() { - return -1L; // not needed - } - - @Override - public LazyData getLazyData(int row, int col) { - return null; - } - - @Override - public void givePriorityTo(Long taskId, int row, int col) { - // nothing to do - } - - @Override - public void sortingChanged(int col) { - // nothing to do - } - - @Override - public int getSubTaskId(int col) { - return -1; - } - - @Override - public String getDataColumnIdentifier(int columnIndex) { - return getColumnName(columnIndex); - } - - @Override - public Class getDataColumnClass(int columnIndex) { - return getColumnClass(columnIndex); - } - - @Override - public Object getDataValueAt(int rowIndex, int columnIndex) { - return getValueAt(rowIndex, columnIndex); - } - - @Override - public int[] getKeysColumn() { - return null; - } - - @Override - public int getInfoColumn() { - return -1; - } - - @Override - public void setName(String name) { - // nothing to do - } - - @Override - public String getName() { - return null; - } - - @Override - public Map getExternalData() { - return null; - } - - @Override - public PlotInformation getPlotInformation() { - return null; - } - - @Override - public ArrayList getExtraDataTypes() { - return null; - } - - @Override - public Object getValue(Class c) { - return getSingleValue(c); - } - - @Override - public Object getRowValue(Class c, int row) { - return null; - } - - @Override - public Object getColValue(Class c, int col) { - return null; - } - - @Override - public void addFilters(LinkedHashMap filtersMap) { - - ConvertValueInterface longConverter = new ConvertValueInterface() { - @Override - public Object convertValue(Object o) { - if (o == null) { - return null; - } - - return Integer.parseInt(o.toString()); - } - - }; - - filtersMap.put(ResultSetTableModel.COLTYPE_RSET_ID, new IntegerFilter(getColumnName(ResultSetTableModel.COLTYPE_RSET_ID), longConverter, ResultSetTableModel.COLTYPE_RSET_ID)); - - filtersMap.put(ResultSetTableModel.COLTYPE_RSET_NAME, new StringDiffFilter(getColumnName(ResultSetTableModel.COLTYPE_RSET_NAME), null, ResultSetTableModel.COLTYPE_RSET_NAME)); - filtersMap.put(ResultSetTableModel.COLTYPE_PEAKLIST_PATH, new StringDiffFilter(getColumnName(ResultSetTableModel.COLTYPE_PEAKLIST_PATH), null, ResultSetTableModel.COLTYPE_PEAKLIST_PATH)); - filtersMap.put(ResultSetTableModel.COLTYPE_MSISEARCH_FILE_NAME, new StringDiffFilter(getColumnName(ResultSetTableModel.COLTYPE_MSISEARCH_FILE_NAME), null, ResultSetTableModel.COLTYPE_MSISEARCH_FILE_NAME)); - filtersMap.put(ResultSetTableModel.COLTYPE_MSISEARCH_FILE_DIRECTORY, new StringDiffFilter(getColumnName(ResultSetTableModel.COLTYPE_MSISEARCH_FILE_DIRECTORY), null, ResultSetTableModel.COLTYPE_MSISEARCH_FILE_DIRECTORY)); - - ConvertValueInterface dateConverter = new ConvertValueInterface() { - @Override - public Object convertValue(Object o) { - if (o == null) { - return null; - } - Timestamp timestamp = Timestamp.valueOf(o.toString()); - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(timestamp.getTime()); - - SimpleDateFormat dateFormatter = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH); - - return dateFormatter.format(timestamp).toString(); - } - - }; - - filtersMap.put(ResultSetTableModel.COLTYPE_MSISEARCH_SEARCH_DATE, new StringDiffFilter(getColumnName(ResultSetTableModel.COLTYPE_MSISEARCH_SEARCH_DATE), dateConverter, ResultSetTableModel.COLTYPE_MSISEARCH_SEARCH_DATE)); - } - - @Override - public boolean isLoaded() { - return true; - } - - @Override - public int getLoadingPercentage() { - return 100; - } - - @Override - public PlotType getBestPlotType() { - return null; - } - - @Override - public int[] getBestColIndex(PlotType plotType) { - return null; - } - - - @Override - public String getExportRowCell(int row, int col) { - return ExportModelUtilities.getExportRowCell(this, row, col); - } - - @Override - public ArrayList getExportFonts(int row, int col) { - return null; - } - - @Override - public String getExportColumnName(int col) { - return getColumnName(col); - } - - } - - public class TableTransferHandler extends TransferHandler { - - @Override - public int getSourceActions(JComponent c) { - return TransferHandler.COPY; - } - - @Override - public boolean canImport(TransferHandler.TransferSupport support) { - - return false; - } - - @Override - protected Transferable createTransferable(JComponent c) { - - ResultSetTable table = (ResultSetTable) c; - CompoundTableModel compoundTableModel = (CompoundTableModel) table.getModel(); - ResultSetTableModel model = (ResultSetTableModel) compoundTableModel.getBaseModel(); - - int[] rows = table.getSelectedRows(); - int nbRows = rows.length; - - if (nbRows == 0) { - return null; - } - - ArrayList resultSetList = new ArrayList<>(nbRows); - - for (int i = 0; i < nbRows; i++) { -// int row = table.convertRowIndexToModel(rows[i]); - int row = table.convertRowIndexToNonFilteredModel(rows[i]); - ResultSet rset = model.getResultSet(row); - resultSetList.add(rset); - - } - - IdTransferable.TransferData data = new IdTransferable.TransferData(); - data.setResultSetList(resultSetList); - Integer transferKey = IdTransferable.register(data); - - return new IdTransferable(transferKey, m_dataBox.getProjectId()); - - } - - @Override - protected void exportDone(JComponent source, Transferable data, int action) { - - // clean all transferred data - IdTransferable.clearRegisteredData(); - } - } - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.gui; + +import fr.proline.core.orm.msi.MsiSearch; +import fr.proline.core.orm.msi.Peaklist; +import fr.proline.core.orm.msi.ResultSet; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dam.AccessDatabaseThread; +import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; +import fr.proline.studio.dam.tasks.AbstractDatabaseTask; +import fr.proline.studio.dam.tasks.DatabaseRsetProperties; +import fr.proline.studio.dam.tasks.SubTask; +import fr.proline.studio.export.ExportButton; +import fr.proline.studio.export.ExportFontData; +import fr.proline.studio.export.ExportModelUtilities; +import fr.proline.studio.extendedtablemodel.CompoundTableModel; +import fr.proline.studio.extendedtablemodel.ExtraDataType; +import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; +import fr.proline.studio.filter.*; +import fr.proline.studio.graphics.PlotInformation; +import fr.proline.studio.graphics.PlotType; +import fr.proline.studio.gui.HourglassPanel; +import fr.proline.studio.gui.SplittedPanelContainer; +import fr.proline.studio.markerbar.MarkerContainerPanel; +import fr.proline.studio.pattern.*; +import fr.proline.studio.progress.ProgressInterface; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; +import fr.proline.studio.rsmexplorer.gui.model.properties.IdentificationPropertiesTableModel; +import fr.proline.studio.rsmexplorer.gui.renderer.TimestampRenderer; +import fr.proline.studio.rsmexplorer.tree.identification.IdTransferable; +import fr.proline.studio.search.SearchToggleButton; +import fr.proline.studio.table.*; +import fr.proline.studio.utils.IconManager; + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.TableModelListener; +import javax.swing.table.TableCellRenderer; +import java.awt.*; +import java.awt.datatransfer.Transferable; +import java.awt.event.*; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.*; + + +/** + * Panel to display all Search Results (rset) imported + * + * @author JM235353 + */ +public class RsetAllPanel extends HourglassPanel implements DataBoxPanelInterface { + + private AbstractDataBox m_dataBox; + private ResultSetTable m_resultSetTable; + + private MarkerContainerPanel m_markerContainerPanel; + + private SearchToggleButton m_searchToggleButton; + private FilterButton m_filterButton; + private ExportButton m_exportButton; + + private JScrollPane m_scrollPane; + + public RsetAllPanel() { + + setLayout(new BorderLayout()); + + final JPanel resultSetPanel = this.createResultSetPanel(); + + final JLayeredPane layeredPane = new JLayeredPane(); + + layeredPane.addComponentListener(new ComponentListener() { + + @Override + public void componentResized(ComponentEvent e) { + final Component c = e.getComponent(); + + resultSetPanel.setBounds(0, 0, c.getWidth(), c.getHeight()); + layeredPane.revalidate(); + layeredPane.repaint(); + + } + + @Override + public void componentMoved(ComponentEvent e) { + } + + @Override + public void componentShown(ComponentEvent e) { + } + + @Override + public void componentHidden(ComponentEvent e) { + } + }); + add(layeredPane, BorderLayout.CENTER); + + layeredPane.add(resultSetPanel, JLayeredPane.DEFAULT_LAYER); + layeredPane.add(m_searchToggleButton.getSearchPanel(), JLayeredPane.PALETTE_LAYER); + + } + + private JPanel createResultSetPanel(){ + JPanel panel = new JPanel(); + + panel.setLayout(new BorderLayout()); + panel.setBounds(0, 0, 500, 400); + + JPanel internalPanel = initInternalPanel(); + panel.add(internalPanel, BorderLayout.CENTER); + + JToolBar toolbar = initToolbar(); + panel.add(toolbar, BorderLayout.WEST); + + return panel; + } + + private JPanel initInternalPanel() { + + JPanel internalPanel = new JPanel(); + + internalPanel.setLayout(new GridBagLayout()); + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.insets = new java.awt.Insets(5, 5, 5, 5); + + // create objects + m_scrollPane = new JScrollPane(); + m_resultSetTable = new ResultSetTable(); + ResultSetTableModel resultSetTableModel = new ResultSetTableModel(); + + m_resultSetTable.setModel(new CompoundTableModel((GlobalTableModelInterface) resultSetTableModel, true)); + + m_markerContainerPanel = new MarkerContainerPanel(m_scrollPane, m_resultSetTable); + + m_scrollPane.setViewportView(m_resultSetTable); + m_resultSetTable.setFillsViewportHeight(true); + m_resultSetTable.setViewport(m_scrollPane.getViewport()); + + c.gridx = 0; + c.gridy = 0; + c.weightx = 1; + c.weighty = 1; + c.gridwidth = 3; + internalPanel.add(m_markerContainerPanel, c); + + return internalPanel; + + } + + private JToolBar initToolbar() { + JToolBar toolbar = new JToolBar(JToolBar.VERTICAL); + toolbar.setFloatable(false); + + JButton refreshButton = new JButton(IconManager.getIcon(IconManager.IconType.REFRESH)); + refreshButton.setToolTipText("Refresh"); + refreshButton.addActionListener(e -> m_dataBox.dataChanged()); + + // Search Button + m_searchToggleButton = new SearchToggleButton(m_resultSetTable, m_resultSetTable, ((CompoundTableModel) m_resultSetTable.getModel())); + + // Filter Button + m_filterButton = new FilterButton(((CompoundTableModel) m_resultSetTable.getModel())) { + + @Override + protected void filteringDone() { + m_dataBox.dataChanged(); + } + + }; + + // Export Button + m_exportButton = new ExportButton( m_resultSetTable, "All Imported Sets", m_resultSetTable); + + toolbar.add(refreshButton); + toolbar.add(m_searchToggleButton); + toolbar.add(m_filterButton); + toolbar.add(m_exportButton); + + return toolbar; + } + + public void setData(long taskId, ArrayList resultSetList) { + CompoundTableModel compoundTableModel = (CompoundTableModel) m_resultSetTable.getModel(); + ResultSetTableModel resultSetTableModel = (ResultSetTableModel) compoundTableModel.getBaseModel(); + + resultSetTableModel.setData(resultSetList); + + // select the first row + if ((resultSetList != null) && (resultSetList.size() > 0)) { + m_resultSetTable.getSelectionModel().setSelectionInterval(0, 0); + m_markerContainerPanel.setMaxLineNumber(resultSetList.size()); + } + + m_resultSetTable.setSortable(true); + } + + public ResultSet getSelectedResultSet() { + + // Retrieve Selected Row + int selectedRow = m_resultSetTable.getSelectedRow(); + + // nothing selected + if (selectedRow == -1) { + return null; + + } + + // convert according to the sorting + selectedRow = m_resultSetTable.convertRowIndexToModel(selectedRow); + + // Retrieve ProteinSet selected + ResultSetTableModel tableModel = (ResultSetTableModel) m_resultSetTable.getModel(); + return tableModel.getResultSet(selectedRow); + } + + @Override + public void setDataBox(AbstractDataBox dataBox) { + m_dataBox = dataBox; + } + + @Override + public AbstractDataBox getDataBox() { + return m_dataBox; + } + + @Override + public void addSingleValue(Object v) { + ((CompoundTableModel) m_resultSetTable.getModel()).addSingleValue(v); + } + + private class ResultSetTable extends LazyTable implements ProgressInterface { + + public ResultSetTable() { + super(m_scrollPane.getVerticalScrollBar()); + + setDragEnabled(true); + TableTransferHandler handler = new TableTransferHandler(); + setTransferHandler(handler); + + setDefaultRenderer(Timestamp.class, new TimestampRenderer(getDefaultRenderer(String.class))); + + // remove mouse listeners and put them back later + // (our listener must be executed first so the selection + // of nodes have not been already managed + final MouseListener[] ls = getMouseListeners(); + for (final MouseListener l : ls) { + removeMouseListener(l); + } + + addMouseListener(new MouseAdapter() { + + @Override + public void mouseReleased(MouseEvent e) { + + } + + @Override + public void mousePressed(MouseEvent e) { + // Need to explicitly start a drag operation when the mouse is pressed. + // Otherwise drags are only started *after* the user has clicked once + // on the JTable (this could be down to the L&F not doing the right thing). + + if (!SwingUtilities.isLeftMouseButton(e)) { + return; + } + + // hack to avoid a conflict with selection manager + // --- begin + int row = m_resultSetTable.rowAtPoint(e.getPoint()); + if (row == -1) { + return; + } + + int[] selectedRows = m_resultSetTable.getSelectedRows(); + + for (int i = 0; i < selectedRows.length; i++) { + if (selectedRows[i] == row) { + return; + } + } + // -- end + + if (e.isControlDown()) { + m_resultSetTable.addRowSelectionInterval(row, row); + } else if (e.isShiftDown()) { + int minIndex = m_resultSetTable.getSelectionModel().getMinSelectionIndex(); + if ((minIndex == -1) || (row < minIndex)) { + minIndex = row; + } + int maxIndex = m_resultSetTable.getSelectionModel().getMaxSelectionIndex(); + if ((maxIndex == -1) || (row > maxIndex)) { + maxIndex = row; + } + m_resultSetTable.setRowSelectionInterval(minIndex, maxIndex); + } else { + m_resultSetTable.setRowSelectionInterval(row, row); + } + + getTransferHandler().exportAsDrag(m_resultSetTable, e, TransferHandler.COPY); + + } + }); + + // put back mouse listeners + for (final MouseListener l : ls) { + addMouseListener(l); + } + } + + @Override + public void addTableModelListener(TableModelListener l) { + getModel().addTableModelListener(l); + } + + /** + * Called whenever the value of the selection changes. + * + * @param e the event that characterizes the change. + */ + @Override + public void valueChanged(ListSelectionEvent e) { + + super.valueChanged(e); + + if (e.getValueIsAdjusting()) { + // value is adjusting, so valueChanged will be called again + return; + } + + m_dataBox.addDataChanged(ResultSet.class); + m_dataBox.propagateDataChanged(); + + } + + @Override + public TablePopupMenu initPopupMenu() { + + TablePopupMenu popupMenu = new TablePopupMenu(); + popupMenu.addAction(new PropertiesFromTableAction()); + + return popupMenu; + } + + // set as abstract + @Override + public void prepostPopupMenu() { + // nothing to do + } + + @Override + public boolean isLoaded() { + return true; + //return m_dataBox.isLoaded(); + } + + @Override + public int getLoadingPercentage() { + return 100; + //return m_dataBox.getLoadingPercentage(); + } + + } + + @Override + public ActionListener getRemoveAction(SplittedPanelContainer splittedPanel) { + return m_dataBox.getRemoveAction(splittedPanel); + } + + @Override + public ActionListener getAddAction(SplittedPanelContainer splittedPanel) { + return m_dataBox.getAddAction(splittedPanel); + } + + @Override + public ActionListener getSaveAction(SplittedPanelContainer splittedPanel) { + return m_dataBox.getSaveAction(splittedPanel); + } + + private class PropertiesFromTableAction extends AbstractTableAction { + + public PropertiesFromTableAction() { + super("Properties"); + } + + @Override + public void actionPerformed(int col, int row, int[] selectedRows, JTable table) { + + int nbResultSet = selectedRows.length; + + ResultSetTableModel rsetModel = (ResultSetTableModel) ((CompoundTableModel) m_resultSetTable.getModel()).getBaseModel(); + + final long projectId = m_dataBox.getProjectId(); + + ArrayList resultSetList = new ArrayList<>(nbResultSet); + + for (int i = 0; i < nbResultSet; i++) { + int rowInModel = m_resultSetTable.convertRowIndexToModel(selectedRows[i]); + + ResultSet rset = rsetModel.getResultSet(rowInModel); + resultSetList.add(rset); + } + + String rsetFileName = resultSetList.get(0).getMsiSearch().getResultFileName(); + if (rsetFileName != null) { + int index = rsetFileName.lastIndexOf('.'); + if (index != -1) { + rsetFileName = rsetFileName.substring(0, index); + } + } else { + rsetFileName = ""; // should not happen + } + + String dialogName = "Properties " + rsetFileName; + + // new Properties window + WindowBox windowBox = WindowBoxFactory.getGenericWindowBox(dialogName, "Properties", IconManager.IconType.DOCUMENT_LIST, true); + final IdentificationPropertiesTableModel _model = new IdentificationPropertiesTableModel(); + windowBox.setEntryData(-1L, _model); + DataBoxViewerTopPanel win2 = new DataBoxViewerTopPanel(windowBox); + WindowManager.getDefault().getMainWindow().displayWindow(win2); + + + //JPM.HACK ! Impossible to set the max number of lines differently in this case + DataboxGeneric databoxGeneric = ((DataboxGeneric) windowBox.getEntryBox()); + final GenericPanel genericPanel = (GenericPanel) databoxGeneric.getPanel(); + + final int loadingId = databoxGeneric.setLoading(); + + // load data for properties + final RsetCallback dataLoadedCallback2 = new RsetCallback(nbResultSet) { + + @Override + public void run(boolean success, long taskId, SubTask subTask, boolean finished) { + m_nbDataToLoad--; + if (m_nbDataToLoad == 0) { + + databoxGeneric.setLoaded(loadingId); + + _model.setData(projectId, resultSetList); + genericPanel.setMaxLineNumber(_model.getRowCount()); + + } + } + + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + + + }; + + for (int i = 0; i < nbResultSet; i++) { + + ResultSet rset = resultSetList.get(i); + DatabaseRsetProperties task = new DatabaseRsetProperties(dataLoadedCallback2, projectId, rset, rset.getName()); + task.setPriority(AbstractDatabaseTask.Priority.HIGH_3); // highest priority + + AccessDatabaseThread.getAccessDatabaseThread().addTask(task); + } + + } + + @Override + public void updateEnabled(int row, int col, int[] selectedRows, JTable table) { + setEnabled(selectedRows.length > 0); + } + + } + + + + + public abstract static class RsetCallback extends AbstractDatabaseCallback { + + protected int m_nbDataToLoad; + + public RsetCallback(int nbDataToLoad) { + m_nbDataToLoad = nbDataToLoad; + } + + }; + + private static class ResultSetTableModel extends DecoratedTableModel implements GlobalTableModelInterface { + + public static final int COLTYPE_RSET_ID = 0; + public static final int COLTYPE_RSET_NAME = 1; + public static final int COLTYPE_PEAKLIST_PATH = 2; + public static final int COLTYPE_MSISEARCH_FILE_NAME = 3; + public static final int COLTYPE_MSISEARCH_FILE_DIRECTORY = 4; + public static final int COLTYPE_MSISEARCH_SEARCH_DATE = 5; + private static final String[] columnNames = {"id", "Search Result Name", "Peaklist Path", "MSISearch File Name", "MSISearch File Directory", "Search Date"}; + + private ArrayList m_resultSetList = null; + + public void setData(ArrayList resultSetList) { + m_resultSetList = resultSetList; + fireTableDataChanged(); + + } + + public ResultSet getResultSet(int row) { + if (m_resultSetList == null) { + return null; + } + if (m_resultSetList.size() <= row) { + return null; + } + return m_resultSetList.get(row); + } + + @Override + public Class getColumnClass(int col) { + switch (col) { + case COLTYPE_RSET_ID: + return Long.class; + case COLTYPE_MSISEARCH_SEARCH_DATE: + return Timestamp.class; + default: + return String.class; + } + } + + @Override + public int getRowCount() { + if (m_resultSetList == null) { + return 0; + } + return m_resultSetList.size(); + } + + @Override + public int getColumnCount() { + return columnNames.length; + } + + @Override + public String getColumnName(int col) { + return columnNames[col]; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + ResultSet rset = m_resultSetList.get(rowIndex); + switch (columnIndex) { + case COLTYPE_RSET_ID: { + return Long.valueOf(rset.getId()); + } + case COLTYPE_RSET_NAME: { + return rset.getName(); + } + case COLTYPE_PEAKLIST_PATH: { + MsiSearch msiSearch = rset.getMsiSearch(); + if (msiSearch == null) { + return ""; + } + Peaklist peaklist = msiSearch.getPeaklist(); + if (peaklist == null) { + return ""; + } + return peaklist.getPath(); + } + case COLTYPE_MSISEARCH_FILE_NAME: { + MsiSearch msiSearch = rset.getMsiSearch(); + if (msiSearch == null) { + return ""; + } + return msiSearch.getResultFileName(); + } + case COLTYPE_MSISEARCH_FILE_DIRECTORY: { + MsiSearch msiSearch = rset.getMsiSearch(); + if (msiSearch == null) { + return ""; + } + return msiSearch.getResultFileDirectory(); + } + case COLTYPE_MSISEARCH_SEARCH_DATE: { + MsiSearch msiSearch = rset.getMsiSearch(); + if (msiSearch == null) { + return null; + } + return msiSearch.getDate(); + } + } + return null; // should not happen + } + + @Override + public String getToolTipForHeader(int col) { + return getColumnName(col); + } + + @Override + public String getTootlTipValue(int row, int col) { + return null; + } + + @Override + public TableCellRenderer getRenderer(int row, int col) { + return null; + } + + @Override + public GlobalTableModelInterface getFrozzenModel() { + return this; + } + + @Override + public Long getTaskId() { + return -1L; // not needed + } + + @Override + public LazyData getLazyData(int row, int col) { + return null; + } + + @Override + public void givePriorityTo(Long taskId, int row, int col) { + // nothing to do + } + + @Override + public void sortingChanged(int col) { + // nothing to do + } + + @Override + public int getSubTaskId(int col) { + return -1; + } + + @Override + public String getDataColumnIdentifier(int columnIndex) { + return getColumnName(columnIndex); + } + + @Override + public Class getDataColumnClass(int columnIndex) { + return getColumnClass(columnIndex); + } + + @Override + public Object getDataValueAt(int rowIndex, int columnIndex) { + return getValueAt(rowIndex, columnIndex); + } + + @Override + public int[] getKeysColumn() { + return null; + } + + @Override + public int getInfoColumn() { + return -1; + } + + @Override + public void setName(String name) { + // nothing to do + } + + @Override + public String getName() { + return null; + } + + @Override + public Map getExternalData() { + return null; + } + + @Override + public PlotInformation getPlotInformation() { + return null; + } + + @Override + public ArrayList getExtraDataTypes() { + return null; + } + + @Override + public Object getValue(Class c) { + return getSingleValue(c); + } + + @Override + public Object getRowValue(Class c, int row) { + return null; + } + + @Override + public Object getColValue(Class c, int col) { + return null; + } + + @Override + public void addFilters(LinkedHashMap filtersMap) { + + ConvertValueInterface longConverter = new ConvertValueInterface() { + @Override + public Object convertValue(Object o) { + if (o == null) { + return null; + } + + return Integer.parseInt(o.toString()); + } + + }; + + filtersMap.put(ResultSetTableModel.COLTYPE_RSET_ID, new IntegerFilter(getColumnName(ResultSetTableModel.COLTYPE_RSET_ID), longConverter, ResultSetTableModel.COLTYPE_RSET_ID)); + + filtersMap.put(ResultSetTableModel.COLTYPE_RSET_NAME, new StringDiffFilter(getColumnName(ResultSetTableModel.COLTYPE_RSET_NAME), null, ResultSetTableModel.COLTYPE_RSET_NAME)); + filtersMap.put(ResultSetTableModel.COLTYPE_PEAKLIST_PATH, new StringDiffFilter(getColumnName(ResultSetTableModel.COLTYPE_PEAKLIST_PATH), null, ResultSetTableModel.COLTYPE_PEAKLIST_PATH)); + filtersMap.put(ResultSetTableModel.COLTYPE_MSISEARCH_FILE_NAME, new StringDiffFilter(getColumnName(ResultSetTableModel.COLTYPE_MSISEARCH_FILE_NAME), null, ResultSetTableModel.COLTYPE_MSISEARCH_FILE_NAME)); + filtersMap.put(ResultSetTableModel.COLTYPE_MSISEARCH_FILE_DIRECTORY, new StringDiffFilter(getColumnName(ResultSetTableModel.COLTYPE_MSISEARCH_FILE_DIRECTORY), null, ResultSetTableModel.COLTYPE_MSISEARCH_FILE_DIRECTORY)); + + ConvertValueInterface dateConverter = new ConvertValueInterface() { + @Override + public Object convertValue(Object o) { + if (o == null) { + return null; + } + Timestamp timestamp = Timestamp.valueOf(o.toString()); + Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(timestamp.getTime()); + + SimpleDateFormat dateFormatter = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH); + + return dateFormatter.format(timestamp).toString(); + } + + }; + + filtersMap.put(ResultSetTableModel.COLTYPE_MSISEARCH_SEARCH_DATE, new StringDiffFilter(getColumnName(ResultSetTableModel.COLTYPE_MSISEARCH_SEARCH_DATE), dateConverter, ResultSetTableModel.COLTYPE_MSISEARCH_SEARCH_DATE)); + } + + @Override + public boolean isLoaded() { + return true; + } + + @Override + public int getLoadingPercentage() { + return 100; + } + + @Override + public PlotType getBestPlotType() { + return null; + } + + @Override + public int[] getBestColIndex(PlotType plotType) { + return null; + } + + + @Override + public String getExportRowCell(int row, int col) { + return ExportModelUtilities.getExportRowCell(this, row, col); + } + + @Override + public ArrayList getExportFonts(int row, int col) { + return null; + } + + @Override + public String getExportColumnName(int col) { + return getColumnName(col); + } + + } + + public class TableTransferHandler extends TransferHandler { + + @Override + public int getSourceActions(JComponent c) { + return TransferHandler.COPY; + } + + @Override + public boolean canImport(TransferHandler.TransferSupport support) { + + return false; + } + + @Override + protected Transferable createTransferable(JComponent c) { + + ResultSetTable table = (ResultSetTable) c; + CompoundTableModel compoundTableModel = (CompoundTableModel) table.getModel(); + ResultSetTableModel model = (ResultSetTableModel) compoundTableModel.getBaseModel(); + + int[] rows = table.getSelectedRows(); + int nbRows = rows.length; + + if (nbRows == 0) { + return null; + } + + ArrayList resultSetList = new ArrayList<>(nbRows); + + for (int i = 0; i < nbRows; i++) { + int row = table.convertRowIndexToNonFilteredModel(rows[i]); + ResultSet rset = model.getResultSet(row); + resultSetList.add(rset); + + } + + IdTransferable.TransferData data = new IdTransferable.TransferData(); + data.setResultSetList(resultSetList); + Integer transferKey = IdTransferable.register(data); + + return new IdTransferable(transferKey, m_dataBox.getProjectId()); + + } + + @Override + protected void exportDone(JComponent source, Transferable data, int action) { + + // clean all transferred data + IdTransferable.clearRegisteredData(); + } + } + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsetMSDiagPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsetMSDiagPanel.java index 51e769283..e540157f5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsetMSDiagPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsetMSDiagPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import java.awt.BorderLayout; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsetProteinsPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsetProteinsPanel.java index b6ac9f039..ab48c446b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsetProteinsPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsetProteinsPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -19,6 +19,8 @@ import fr.proline.core.orm.msi.ResultSet; import fr.proline.core.orm.msi.dto.DPeptideMatch; import fr.proline.core.orm.msi.dto.DProteinMatch; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dock.AbstractTopPanel; import fr.proline.studio.extendedtablemodel.AddDataAnalyzerButton; import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; import fr.proline.studio.gui.HourglassPanel; @@ -46,7 +48,7 @@ import fr.proline.studio.pattern.*; import fr.proline.studio.progress.ProgressInterface; import fr.proline.studio.table.TableInfo; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.actions.table.DisplayTablePopupMenu; import fr.proline.studio.search.SearchToggleButton; import fr.proline.studio.extendedtablemodel.CompoundTableModel; @@ -58,7 +60,6 @@ import javax.swing.*; import javax.swing.event.TableModelListener; import org.jdesktop.swingx.JXTable; -import org.openide.windows.TopComponent; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; /** @@ -177,9 +178,8 @@ public void actionPerformed(ActionEvent e) { wbox.setEntryData(m_dataBox.getProjectId(), decoyRset); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } }); } @@ -232,12 +232,13 @@ public void actionPerformed() { } private String getTopComponentName() { + Container c = getParent(); - while ((c != null) && !(c instanceof TopComponent)) { + while ((c != null) && !(c instanceof AbstractTopPanel)) { c = c.getParent(); } - if ((c != null) && (c instanceof TopComponent)) { - return ((TopComponent) c).getName(); + if ((c != null) && (c instanceof AbstractTopPanel)) { + return ((AbstractTopPanel) c).getTitle(); } return ""; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmPeptidesOfProteinPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmPeptidesOfProteinPanel.java index 984abeea5..d6f2024a5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmPeptidesOfProteinPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmPeptidesOfProteinPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -202,7 +202,7 @@ private JPanel createInternalPanel() { m_peptidesTable = new PeptideTable(); m_peptidesTable.setModel(new CompoundTableModel(new PeptideTableModel(), true)); m_peptidesTable.getColumnExt(m_peptidesTable.convertColumnIndexToView(PeptideTableModel.COLTYPE_PEPTIDE_ID)).setVisible(false); - + m_peptidesTable.getColumnExt(m_peptidesTable.convertColumnIndexToView(PeptideTableModel.COLTYPE_PEPTIDE_NONE_AMBIGUOUS_SEQ)).setVisible(false); m_scrollPane = new JScrollPane(); m_markerContainerPanel = new MarkerContainerPanel(m_scrollPane, m_peptidesTable); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmPeptidesPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmPeptidesPanel.java index e799cba17..c61efc2bd 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmPeptidesPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmPeptidesPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -19,6 +19,7 @@ import fr.proline.core.orm.msi.PeptideInstance; import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.msi.dto.DPeptideMatch; +import fr.proline.studio.dock.AbstractTopPanel; import fr.proline.studio.extendedtablemodel.AddDataAnalyzerButton; import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; import fr.proline.studio.dam.tasks.SubTask; @@ -34,7 +35,7 @@ import fr.proline.studio.pattern.*; import fr.proline.studio.progress.ProgressInterface; import fr.proline.studio.table.TableInfo; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.actions.table.DisplayTablePopupMenu; import fr.proline.studio.rsmexplorer.gui.dialog.CalcDialog; import fr.proline.studio.rsmexplorer.gui.model.PeptideInstanceTableModel; @@ -53,8 +54,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.TableModelListener; import org.jdesktop.swingx.JXTable; -import org.openide.windows.TopComponent; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; /** @@ -124,12 +124,13 @@ public void componentHidden(ComponentEvent e) { } private String getTopComponentName() { + Container c = getParent(); - while ((c != null) && !(c instanceof TopComponent)) { + while ((c != null) && !(c instanceof AbstractTopPanel)) { c = c.getParent(); } - if ((c != null) && (c instanceof TopComponent)) { - return ((TopComponent) c).getName(); + if ((c != null) && (c instanceof AbstractTopPanel)) { + return ((AbstractTopPanel) c).getTitle(); } return ""; } @@ -160,9 +161,9 @@ public void actionPerformed(ActionEvent e) { wbox.setEntryData(m_dataBox.getProjectId(), decoyRsm); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); + } }); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinAndPeptideOverviewPlotPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinAndPeptideOverviewPlotPanel.java index 0d53306d6..05cb382b6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinAndPeptideOverviewPlotPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinAndPeptideOverviewPlotPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinAndPeptideSequencePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinAndPeptideSequencePanel.java index cec71a423..a4984eaa3 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinAndPeptideSequencePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinAndPeptideSequencePanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinSetPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinSetPanel.java index 97e1e8854..9fb11f3c5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinSetPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinSetPanel.java @@ -1,618 +1,619 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.gui; - - - -import fr.proline.core.orm.msi.ResultSet; -import fr.proline.core.orm.msi.ResultSummary; -import fr.proline.core.orm.msi.dto.DProteinSet; -import fr.proline.studio.extendedtablemodel.AddDataAnalyzerButton; -import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; -import fr.proline.studio.dam.tasks.*; -import fr.proline.studio.export.ExportButton; -import fr.proline.studio.filter.FilterButton; -import fr.proline.studio.graphics.CrossSelectionInterface; -import fr.proline.studio.gui.HourglassPanel; -import fr.proline.studio.gui.SplittedPanelContainer; -import fr.proline.studio.info.InfoInterface; -import fr.proline.studio.info.InfoToggleButton; -import fr.proline.studio.markerbar.BookmarkMarker; -import fr.proline.studio.markerbar.MarkerContainerPanel; -import fr.proline.studio.parameter.SettingsButton; -import fr.proline.studio.pattern.*; -import fr.proline.studio.progress.ProgressInterface; -import fr.proline.studio.table.TableInfo; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; -import fr.proline.studio.rsmexplorer.actions.table.DisplayTablePopupMenu; -import fr.proline.studio.rsmexplorer.gui.model.ProteinSetTableModel; -import fr.proline.studio.search.SearchToggleButton; -import fr.proline.studio.extendedtablemodel.CompoundTableModel; -import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; -import fr.proline.studio.table.ImportTableSelectionInterface; -import fr.proline.studio.table.LazyTable; -import fr.proline.studio.table.TablePopupMenu; -import fr.proline.studio.utils.IconManager; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; -import java.util.HashSet; -import javax.swing.*; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.TableModelListener; -import org.jdesktop.swingx.JXTable; -import org.openide.windows.TopComponent; -import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Container; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Image; -import java.util.List; - -/** - * In : Window which display Protein Sets of a Result Summary - * - Panel used to display Protein Sets (at the top) - * - * @author JM235353 - */ -public class RsmProteinSetPanel extends HourglassPanel implements DataBoxPanelInterface, GlobalTabelModelProviderInterface { - - private AbstractDataBox m_dataBox; - - private JScrollPane m_proteinSetScrollPane; - private ProteinSetTable m_proteinSetTable; - - private MarkerContainerPanel m_markerContainerPanel; - - private final boolean m_firstPanel; - private JButton m_decoyButton; - - private SearchToggleButton m_searchToggleButton; - private InfoToggleButton m_infoToggleButton; - - private SettingsButton m_settingsButton; - private FilterButton m_filterButton; - private ExportButton m_exportButton; - private AddDataAnalyzerButton m_addCompareDataButton; - - private boolean m_hideFirstTime = true; // to initialize visible column on first display (then user cfg will be used) - - /** - * Creates new form RsmProteinSetPanel - */ - public RsmProteinSetPanel(boolean firstPanel) { - - m_firstPanel = firstPanel; - - initComponents(); - - } - - public void setData(Long taskId, DProteinSet[] proteinSets, boolean finished) { - - // update toolbar - boolean mergedData = false; - ResultSummary rsm = (ResultSummary) m_dataBox.getData(ResultSummary.class); - if (rsm != null) { - - if (m_firstPanel) { - m_decoyButton.setEnabled(rsm.getDecoyResultSummary() != null); - } - ResultSet.Type rsType = rsm.getResultSet().getType(); - mergedData = (rsType == ResultSet.Type.USER) || (rsType == ResultSet.Type.DECOY_USER); // Merge or Decoy Merge - } - - ProteinSetTableModel tableModel = (ProteinSetTableModel) ((CompoundTableModel)m_proteinSetTable.getModel()).getBaseModel(); - tableModel.setData(taskId, proteinSets, mergedData); - - // select the first row - if ((proteinSets != null) && (proteinSets.length > 0)) { - m_proteinSetTable.getSelectionModel().setSelectionInterval(0, 0); - m_markerContainerPanel.setMaxLineNumber(proteinSets.length); - - if (!m_firstPanel) { - m_markerContainerPanel.removeAllMarkers(); - } - - if(m_hideFirstTime){ - // hide the geneName columns - List listIdsToHide = tableModel.getDefaultColumnsToHide(); - for (Integer id : listIdsToHide) { - m_proteinSetTable.getColumnExt(m_proteinSetTable.convertColumnIndexToView(id)).setVisible(false); - } - m_hideFirstTime = false; - } - } - - m_infoToggleButton.updateInfo(); - - if (finished) { - m_proteinSetTable.setSortable(true); - } - } - - public void dataUpdated(SubTask subTask, boolean finished) { - m_proteinSetTable.dataUpdated(subTask, finished); - if (m_hideFirstTime) { - // hide geneName column - List listIdsToHide = ((ProteinSetTableModel) ((CompoundTableModel)m_proteinSetTable.getModel()).getBaseModel()).getDefaultColumnsToHide(); - for (Integer id : listIdsToHide) { - m_proteinSetTable.getColumnExt(m_proteinSetTable.convertColumnIndexToView(id)).setVisible(false); - } - m_hideFirstTime = false; - - } - } - - public DProteinSet getSelectedProteinSet() { - - // Retrieve Selected Row - int selectedRow = m_proteinSetTable.getSelectedRow(); - - - // nothing selected - if (selectedRow == -1) { - return null; - } - - // convert according to the sorting - selectedRow = m_proteinSetTable.convertRowIndexToModel(selectedRow); - - CompoundTableModel compoundTableModel = ((CompoundTableModel)m_proteinSetTable.getModel()); - selectedRow = compoundTableModel.convertCompoundRowToBaseModelRow(selectedRow); - - // Retrieve ProteinSet selected - ProteinSetTableModel tableModel = (ProteinSetTableModel) compoundTableModel.getBaseModel(); - return tableModel.getProteinSet(selectedRow); - } - - @Override - public void setDataBox(AbstractDataBox dataBox) { - m_dataBox = dataBox; - } - @Override - public AbstractDataBox getDataBox() { - return m_dataBox; - } - - @Override - public void addSingleValue(Object v) { - getGlobalTableModelInterface().addSingleValue(v); - } - - @Override - public GlobalTableModelInterface getGlobalTableModelInterface() { - return (GlobalTableModelInterface) m_proteinSetTable.getModel(); - } - - @Override - public JXTable getGlobalAssociatedTable() { - return m_proteinSetTable; - } - - @Override - public CrossSelectionInterface getCrossSelectionInterface() { - return m_proteinSetTable; - } - - @Override - public ActionListener getRemoveAction(SplittedPanelContainer splittedPanel) { - return m_dataBox.getRemoveAction(splittedPanel); - } - - @Override - public ActionListener getAddAction(SplittedPanelContainer splittedPanel) { - return m_dataBox.getAddAction(splittedPanel); - } - - @Override - public ActionListener getSaveAction(SplittedPanelContainer splittedPanel) { - return m_dataBox.getSaveAction(splittedPanel); - } - - private String getTopComponentName() { - Container c = getParent(); - while ((c != null) && !(c instanceof TopComponent)) { - c = c.getParent(); - } - if ((c != null) && (c instanceof TopComponent)) { - return ((TopComponent) c).getName(); - } - return ""; - } - - - - private void initComponents() { - - - setLayout(new BorderLayout()); - - final JPanel proteinSetPanel = createProteinSetPanel(); - - - final JLayeredPane layeredPane = new JLayeredPane(); - - layeredPane.addComponentListener(new ComponentListener() { - - @Override - public void componentResized(ComponentEvent e) { - final Component c = e.getComponent(); - - proteinSetPanel.setBounds(0, 0, c.getWidth(), c.getHeight()); - layeredPane.revalidate(); - layeredPane.repaint(); - - } - - @Override - public void componentMoved(ComponentEvent e) { - } - - @Override - public void componentShown(ComponentEvent e) { - } - - @Override - public void componentHidden(ComponentEvent e) { - } - }); - add(layeredPane, BorderLayout.CENTER); - - layeredPane.add(proteinSetPanel, JLayeredPane.DEFAULT_LAYER); - layeredPane.add(m_infoToggleButton.getInfoPanel(), JLayeredPane.PALETTE_LAYER); - layeredPane.add(m_searchToggleButton.getSearchPanel(), new Integer(JLayeredPane.PALETTE_LAYER+1)); - - - } - - - private JPanel createProteinSetPanel() { - - JPanel proteinSetPanel = new JPanel(); - proteinSetPanel.setBounds(0, 0, 500, 400); - proteinSetPanel.setLayout(new BorderLayout()); - - JPanel internalPanel = createInternalPanel(); - - JToolBar toolbar = initToolbar(); - proteinSetPanel.add(toolbar, BorderLayout.WEST); - proteinSetPanel.add(internalPanel, BorderLayout.CENTER); - - return proteinSetPanel; - } - - private JToolBar initToolbar() { - JToolBar toolbar = new JToolBar(JToolBar.VERTICAL); - toolbar.setFloatable(false); - - if (m_firstPanel) { - - // Decoy Button - m_decoyButton = new JButton(IconManager.getIcon(IconManager.IconType.DATASET_RSM_DECOY)); - m_decoyButton.setToolTipText("Display Decoy Data"); - m_decoyButton.setEnabled(false); - - m_decoyButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - - ResultSummary rsm = (ResultSummary) m_dataBox.getData(ResultSummary.class); - ResultSummary decoyRsm = rsm.getDecoyResultSummary(); - if (decoyRsm == null) { - return; - } - - String savedWindow = SaveDataBoxActionListener.saveParentContainer("tmp", m_decoyButton); - - AbstractDataBox[] databoxes = WindowSavedManager.readBoxes(savedWindow); - WindowBox wbox = WindowBoxFactory.getFromBoxesWindowBox("Decoy " + getTopComponentName(), databoxes, true, false, WindowSavedManager.SAVE_WINDOW_FOR_RSM); - wbox.setEntryData(m_dataBox.getProjectId(), decoyRsm); - - // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); - - } - }); - - - toolbar.add(m_decoyButton); - - } - - m_settingsButton = new SettingsButton(((ProgressInterface) m_proteinSetTable.getModel()), m_proteinSetTable); - - - // Search Button - m_searchToggleButton = new SearchToggleButton(m_proteinSetTable, m_proteinSetTable, ((CompoundTableModel) m_proteinSetTable.getModel())); - toolbar.add(m_searchToggleButton); - - m_filterButton = new FilterButton(((CompoundTableModel) m_proteinSetTable.getModel())) { - - @Override - protected void filteringDone() { - m_dataBox.addDataChanged(ExtendedTableModelInterface.class); - m_dataBox.propagateDataChanged(); - m_infoToggleButton.updateInfo(); - } - - }; - - m_exportButton = new ExportButton(((CompoundTableModel) m_proteinSetTable.getModel()), "Protein Sets", m_proteinSetTable); - - toolbar.add(m_filterButton); - toolbar.add(m_settingsButton); - toolbar.add(m_exportButton); - - m_addCompareDataButton = new AddDataAnalyzerButton(((CompoundTableModel) m_proteinSetTable.getModel())) { - - @Override - public void actionPerformed() { - JXTable table = getGlobalAssociatedTable(); - TableInfo tableInfo = new TableInfo(m_dataBox.getId(), m_dataBox.getUserName(), m_dataBox.getDataName(), m_dataBox.getTypeName(), table); - Image i = m_dataBox.getIcon(); - if (i!=null) { - tableInfo.setIcon(new ImageIcon(i)); - } - DataAnalyzerWindowBoxManager.addTableInfo(tableInfo); - } - }; - toolbar.add(m_addCompareDataButton); - - m_infoToggleButton = new InfoToggleButton(m_proteinSetTable, m_proteinSetTable); - toolbar.add(m_infoToggleButton); - - return toolbar; - } - - private JPanel createInternalPanel() { - - JPanel internalPanel = new JPanel(); - - internalPanel.setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - // create objects - m_proteinSetScrollPane = new JScrollPane(); - - m_proteinSetTable = new ProteinSetTable(); - m_proteinSetTable.setModel(new CompoundTableModel(new ProteinSetTableModel((LazyTable)m_proteinSetTable), true)); - // hide the id column - m_proteinSetTable.getColumnExt(m_proteinSetTable.convertColumnIndexToView(ProteinSetTableModel.COLTYPE_PROTEIN_SET_ID)).setVisible(false); - - m_markerContainerPanel = new MarkerContainerPanel(m_proteinSetScrollPane, (ProteinSetTable) m_proteinSetTable); - - m_proteinSetScrollPane.setViewportView(m_proteinSetTable); - m_proteinSetTable.setFillsViewportHeight(true); - m_proteinSetTable.setViewport(m_proteinSetScrollPane.getViewport()); - - //m_proteinSetTable.displayColumnAsPercentage(ProteinSetTableModel.COLTYPE_PROTEIN_SCORE); - - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 3; - internalPanel.add(m_markerContainerPanel, c); - - return internalPanel; - } - - public void selectData(HashSet data) { - m_proteinSetTable.importSelection(data); - } - - - private class ProteinSetTable extends LazyTable implements ImportTableSelectionInterface, CrossSelectionInterface, InfoInterface { - - - public ProteinSetTable() { - super(m_proteinSetScrollPane.getVerticalScrollBar() ); - - } - - @Override - public void addTableModelListener(TableModelListener l) { - getModel().addTableModelListener(l); - } - - /** - * Called whenever the value of the selection changes. - * @param e the event that characterizes the change. - */ - @Override - public void valueChanged(ListSelectionEvent e) { - - super.valueChanged(e); - - if (selectionWillBeRestored) { - return; - } - - if (e.getValueIsAdjusting()) { - // value is adjusting, so valueChanged will be called again - return; - } - - m_dataBox.addDataChanged(DProteinSet.class); - m_dataBox.propagateDataChanged(); - - } - - /*public boolean selectProteinSet(Long proteinSetId, String searchText) { - ProteinSetTableModel tableModel = (ProteinSetTableModel) ((CompoundTableModel)getModel()).getBaseModel(); - int row = tableModel.findRow(proteinSetId); - if (row == -1) { - return false; - } - row = ((CompoundTableModel)getModel()).convertBaseModelRowToCompoundRow(row); - if (row == -1) { - return false; - } - - // JPM.hack we need to keep the search text - // to be able to give it if needed to the panel - // which display proteins of a protein set - //m_searchTextBeingDone = searchText; - - // must convert row index if there is a sorting - row = convertRowIndexToView(row); - - // select the row - getSelectionModel().setSelectionInterval(row, row); - - // scroll to the row - scrollRowToVisible(row); - - //m_searchTextBeingDone = null; - - return true; - } - //private String m_searchTextBeingDone = null;*/ - - - public void dataUpdated(SubTask subTask, boolean finished) { - - LastAction keepLastAction = m_lastAction; - try { - - - // retrieve selected row - int rowSelected = getSelectionModel().getMinSelectionIndex(); - int rowSelectedInModel = (rowSelected == -1) ? -1 : convertRowIndexToModel(rowSelected); - - // Update Model (but protein set table must not react to the model update) - - selectionWillBeRestored(true); - try { - ((ProteinSetTableModel) (((CompoundTableModel) getModel()).getBaseModel())).dataUpdated(); - } finally { - selectionWillBeRestored(false); - } - - - - // restore selected row - if (rowSelectedInModel != -1) { - int rowSelectedInView = convertRowIndexToView(rowSelectedInModel); - //getSelectionModel().setSelectionInterval(rowSelectedInView, rowSelectedInView); - setSelection(rowSelectedInView); - - - // if the subtask correspond to the loading of the data of the sorted column, - // we keep the row selected visible - if (((keepLastAction == LastAction.ACTION_SELECTING ) || (keepLastAction == LastAction.ACTION_SORTING)) && (subTask.getSubTaskId() == ((CompoundTableModel) getModel()).getSubTaskId( getSortedColumnIndex() )) ) { - scrollRowToVisible(rowSelectedInView); - } - - } - - } finally { - - m_lastAction = keepLastAction; - - } - - if (finished) { - setSortable(true); - } - } - - public void selectionWillBeRestored(boolean b) { - selectionWillBeRestored = b; - } - private boolean selectionWillBeRestored = false; - - @Override - public int getLoadingPercentage() { - return m_dataBox.getLoadingPercentage(); - } - - @Override - public boolean isLoaded() { - return m_dataBox.isLoaded(); - } - - @Override - public void importSelection(HashSet selectedData) { - - ListSelectionModel selectionTableModel = getSelectionModel(); - selectionTableModel.clearSelection(); - - int firstRow = -1; - ProteinSetTableModel model = (ProteinSetTableModel) ((CompoundTableModel) m_proteinSetTable.getModel()).getBaseModel(); - int rowCount = model.getRowCount(); - for (int i=0;i1) ? " Proteins Sets" : " Protein Set"); - } - - - - } - - - +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.gui; + + + +import fr.proline.core.orm.msi.ResultSet; +import fr.proline.core.orm.msi.ResultSummary; +import fr.proline.core.orm.msi.dto.DProteinSet; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dock.AbstractTopPanel; +import fr.proline.studio.extendedtablemodel.AddDataAnalyzerButton; +import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; +import fr.proline.studio.dam.tasks.*; +import fr.proline.studio.export.ExportButton; +import fr.proline.studio.filter.FilterButton; +import fr.proline.studio.graphics.CrossSelectionInterface; +import fr.proline.studio.gui.HourglassPanel; +import fr.proline.studio.gui.SplittedPanelContainer; +import fr.proline.studio.info.InfoInterface; +import fr.proline.studio.info.InfoToggleButton; +import fr.proline.studio.markerbar.BookmarkMarker; +import fr.proline.studio.markerbar.MarkerContainerPanel; +import fr.proline.studio.parameter.SettingsButton; +import fr.proline.studio.pattern.*; +import fr.proline.studio.progress.ProgressInterface; +import fr.proline.studio.table.TableInfo; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; +import fr.proline.studio.rsmexplorer.actions.table.DisplayTablePopupMenu; +import fr.proline.studio.rsmexplorer.gui.model.ProteinSetTableModel; +import fr.proline.studio.search.SearchToggleButton; +import fr.proline.studio.extendedtablemodel.CompoundTableModel; +import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; +import fr.proline.studio.table.ImportTableSelectionInterface; +import fr.proline.studio.table.LazyTable; +import fr.proline.studio.table.TablePopupMenu; +import fr.proline.studio.utils.IconManager; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; +import java.util.HashSet; +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.TableModelListener; +import org.jdesktop.swingx.JXTable; +import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Container; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Image; +import java.util.List; + +/** + * In : Window which display Protein Sets of a Result Summary + * - Panel used to display Protein Sets (at the top) + * + * @author JM235353 + */ +public class RsmProteinSetPanel extends HourglassPanel implements DataBoxPanelInterface, GlobalTabelModelProviderInterface { + + private AbstractDataBox m_dataBox; + + private JScrollPane m_proteinSetScrollPane; + private ProteinSetTable m_proteinSetTable; + + private MarkerContainerPanel m_markerContainerPanel; + + private final boolean m_firstPanel; + private JButton m_decoyButton; + + private SearchToggleButton m_searchToggleButton; + private InfoToggleButton m_infoToggleButton; + + private SettingsButton m_settingsButton; + private FilterButton m_filterButton; + private ExportButton m_exportButton; + private AddDataAnalyzerButton m_addCompareDataButton; + + private boolean m_hideFirstTime = true; // to initialize visible column on first display (then user cfg will be used) + + /** + * Creates new form RsmProteinSetPanel + */ + public RsmProteinSetPanel(boolean firstPanel) { + + m_firstPanel = firstPanel; + + initComponents(); + + } + + public void setData(Long taskId, DProteinSet[] proteinSets, boolean finished) { + + // update toolbar + boolean mergedData = false; + ResultSummary rsm = (ResultSummary) m_dataBox.getData(ResultSummary.class); + if (rsm != null) { + + if (m_firstPanel) { + m_decoyButton.setEnabled(rsm.getDecoyResultSummary() != null); + } + ResultSet.Type rsType = rsm.getResultSet().getType(); + mergedData = (rsType == ResultSet.Type.USER) || (rsType == ResultSet.Type.DECOY_USER); // Merge or Decoy Merge + } + + ProteinSetTableModel tableModel = (ProteinSetTableModel) ((CompoundTableModel)m_proteinSetTable.getModel()).getBaseModel(); + tableModel.setData(taskId, proteinSets, mergedData); + + // select the first row + if ((proteinSets != null) && (proteinSets.length > 0)) { + m_proteinSetTable.getSelectionModel().setSelectionInterval(0, 0); + m_markerContainerPanel.setMaxLineNumber(proteinSets.length); + + if (!m_firstPanel) { + m_markerContainerPanel.removeAllMarkers(); + } + + if(m_hideFirstTime){ + // hide the geneName columns + List listIdsToHide = tableModel.getDefaultColumnsToHide(); + for (Integer id : listIdsToHide) { + m_proteinSetTable.getColumnExt(m_proteinSetTable.convertColumnIndexToView(id)).setVisible(false); + } + m_hideFirstTime = false; + } + } + + m_infoToggleButton.updateInfo(); + + if (finished) { + m_proteinSetTable.setSortable(true); + } + } + + public void dataUpdated(SubTask subTask, boolean finished) { + m_proteinSetTable.dataUpdated(subTask, finished); + if (m_hideFirstTime) { + // hide geneName column + List listIdsToHide = ((ProteinSetTableModel) ((CompoundTableModel)m_proteinSetTable.getModel()).getBaseModel()).getDefaultColumnsToHide(); + for (Integer id : listIdsToHide) { + m_proteinSetTable.getColumnExt(m_proteinSetTable.convertColumnIndexToView(id)).setVisible(false); + } + m_hideFirstTime = false; + + } + } + + public DProteinSet getSelectedProteinSet() { + + // Retrieve Selected Row + int selectedRow = m_proteinSetTable.getSelectedRow(); + + + // nothing selected + if (selectedRow == -1) { + return null; + } + + // convert according to the sorting + selectedRow = m_proteinSetTable.convertRowIndexToModel(selectedRow); + + CompoundTableModel compoundTableModel = ((CompoundTableModel)m_proteinSetTable.getModel()); + selectedRow = compoundTableModel.convertCompoundRowToBaseModelRow(selectedRow); + + // Retrieve ProteinSet selected + ProteinSetTableModel tableModel = (ProteinSetTableModel) compoundTableModel.getBaseModel(); + return tableModel.getProteinSet(selectedRow); + } + + @Override + public void setDataBox(AbstractDataBox dataBox) { + m_dataBox = dataBox; + } + @Override + public AbstractDataBox getDataBox() { + return m_dataBox; + } + + @Override + public void addSingleValue(Object v) { + getGlobalTableModelInterface().addSingleValue(v); + } + + @Override + public GlobalTableModelInterface getGlobalTableModelInterface() { + return (GlobalTableModelInterface) m_proteinSetTable.getModel(); + } + + @Override + public JXTable getGlobalAssociatedTable() { + return m_proteinSetTable; + } + + @Override + public CrossSelectionInterface getCrossSelectionInterface() { + return m_proteinSetTable; + } + + @Override + public ActionListener getRemoveAction(SplittedPanelContainer splittedPanel) { + return m_dataBox.getRemoveAction(splittedPanel); + } + + @Override + public ActionListener getAddAction(SplittedPanelContainer splittedPanel) { + return m_dataBox.getAddAction(splittedPanel); + } + + @Override + public ActionListener getSaveAction(SplittedPanelContainer splittedPanel) { + return m_dataBox.getSaveAction(splittedPanel); + } + + private String getTopComponentName() { + + Container c = getParent(); + while ((c != null) && !(c instanceof AbstractTopPanel)) { + c = c.getParent(); + } + if ((c != null) && (c instanceof AbstractTopPanel)) { + return ((AbstractTopPanel) c).getTitle(); + } + return ""; + } + + + + private void initComponents() { + + + setLayout(new BorderLayout()); + + final JPanel proteinSetPanel = createProteinSetPanel(); + + + final JLayeredPane layeredPane = new JLayeredPane(); + + layeredPane.addComponentListener(new ComponentListener() { + + @Override + public void componentResized(ComponentEvent e) { + final Component c = e.getComponent(); + + proteinSetPanel.setBounds(0, 0, c.getWidth(), c.getHeight()); + layeredPane.revalidate(); + layeredPane.repaint(); + + } + + @Override + public void componentMoved(ComponentEvent e) { + } + + @Override + public void componentShown(ComponentEvent e) { + } + + @Override + public void componentHidden(ComponentEvent e) { + } + }); + add(layeredPane, BorderLayout.CENTER); + + layeredPane.add(proteinSetPanel, JLayeredPane.DEFAULT_LAYER); + layeredPane.add(m_infoToggleButton.getInfoPanel(), JLayeredPane.PALETTE_LAYER); + layeredPane.add(m_searchToggleButton.getSearchPanel(), new Integer(JLayeredPane.PALETTE_LAYER+1)); + + + } + + + private JPanel createProteinSetPanel() { + + JPanel proteinSetPanel = new JPanel(); + proteinSetPanel.setBounds(0, 0, 500, 400); + proteinSetPanel.setLayout(new BorderLayout()); + + JPanel internalPanel = createInternalPanel(); + + JToolBar toolbar = initToolbar(); + proteinSetPanel.add(toolbar, BorderLayout.WEST); + proteinSetPanel.add(internalPanel, BorderLayout.CENTER); + + return proteinSetPanel; + } + + private JToolBar initToolbar() { + JToolBar toolbar = new JToolBar(JToolBar.VERTICAL); + toolbar.setFloatable(false); + + if (m_firstPanel) { + + // Decoy Button + m_decoyButton = new JButton(IconManager.getIcon(IconManager.IconType.DATASET_RSM_DECOY)); + m_decoyButton.setToolTipText("Display Decoy Data"); + m_decoyButton.setEnabled(false); + + m_decoyButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + + ResultSummary rsm = (ResultSummary) m_dataBox.getData(ResultSummary.class); + ResultSummary decoyRsm = rsm.getDecoyResultSummary(); + if (decoyRsm == null) { + return; + } + + String savedWindow = SaveDataBoxActionListener.saveParentContainer("tmp", m_decoyButton); + + AbstractDataBox[] databoxes = WindowSavedManager.readBoxes(savedWindow); + WindowBox wbox = WindowBoxFactory.getFromBoxesWindowBox("Decoy " + getTopComponentName(), databoxes, true, false, WindowSavedManager.SAVE_WINDOW_FOR_RSM); + wbox.setEntryData(m_dataBox.getProjectId(), decoyRsm); + + // open a window to display the window box + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); + + } + }); + + + toolbar.add(m_decoyButton); + + } + + m_settingsButton = new SettingsButton(((ProgressInterface) m_proteinSetTable.getModel()), m_proteinSetTable); + + + // Search Button + m_searchToggleButton = new SearchToggleButton(m_proteinSetTable, m_proteinSetTable, ((CompoundTableModel) m_proteinSetTable.getModel())); + toolbar.add(m_searchToggleButton); + + m_filterButton = new FilterButton(((CompoundTableModel) m_proteinSetTable.getModel())) { + + @Override + protected void filteringDone() { + m_dataBox.addDataChanged(ExtendedTableModelInterface.class); + m_dataBox.propagateDataChanged(); + m_infoToggleButton.updateInfo(); + } + + }; + + m_exportButton = new ExportButton(((CompoundTableModel) m_proteinSetTable.getModel()), "Protein Sets", m_proteinSetTable); + + toolbar.add(m_filterButton); + toolbar.add(m_settingsButton); + toolbar.add(m_exportButton); + + m_addCompareDataButton = new AddDataAnalyzerButton(((CompoundTableModel) m_proteinSetTable.getModel())) { + + @Override + public void actionPerformed() { + JXTable table = getGlobalAssociatedTable(); + TableInfo tableInfo = new TableInfo(m_dataBox.getId(), m_dataBox.getUserName(), m_dataBox.getDataName(), m_dataBox.getTypeName(), table); + Image i = m_dataBox.getIcon(); + if (i!=null) { + tableInfo.setIcon(new ImageIcon(i)); + } + DataAnalyzerWindowBoxManager.addTableInfo(tableInfo); + } + }; + toolbar.add(m_addCompareDataButton); + + m_infoToggleButton = new InfoToggleButton(m_proteinSetTable, m_proteinSetTable); + toolbar.add(m_infoToggleButton); + + return toolbar; + } + + private JPanel createInternalPanel() { + + JPanel internalPanel = new JPanel(); + + internalPanel.setLayout(new GridBagLayout()); + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.insets = new java.awt.Insets(5, 5, 5, 5); + + // create objects + m_proteinSetScrollPane = new JScrollPane(); + + m_proteinSetTable = new ProteinSetTable(); + m_proteinSetTable.setModel(new CompoundTableModel(new ProteinSetTableModel((LazyTable)m_proteinSetTable), true)); + // hide the id column + m_proteinSetTable.getColumnExt(m_proteinSetTable.convertColumnIndexToView(ProteinSetTableModel.COLTYPE_PROTEIN_SET_ID)).setVisible(false); + + m_markerContainerPanel = new MarkerContainerPanel(m_proteinSetScrollPane, (ProteinSetTable) m_proteinSetTable); + + m_proteinSetScrollPane.setViewportView(m_proteinSetTable); + m_proteinSetTable.setFillsViewportHeight(true); + m_proteinSetTable.setViewport(m_proteinSetScrollPane.getViewport()); + + //m_proteinSetTable.displayColumnAsPercentage(ProteinSetTableModel.COLTYPE_PROTEIN_SCORE); + + c.gridx = 0; + c.gridy = 0; + c.weightx = 1; + c.weighty = 1; + c.gridwidth = 3; + internalPanel.add(m_markerContainerPanel, c); + + return internalPanel; + } + + public void selectData(HashSet data) { + m_proteinSetTable.importSelection(data); + } + + + private class ProteinSetTable extends LazyTable implements ImportTableSelectionInterface, CrossSelectionInterface, InfoInterface { + + + public ProteinSetTable() { + super(m_proteinSetScrollPane.getVerticalScrollBar() ); + + } + + @Override + public void addTableModelListener(TableModelListener l) { + getModel().addTableModelListener(l); + } + + /** + * Called whenever the value of the selection changes. + * @param e the event that characterizes the change. + */ + @Override + public void valueChanged(ListSelectionEvent e) { + + super.valueChanged(e); + + if (selectionWillBeRestored) { + return; + } + + if (e.getValueIsAdjusting()) { + // value is adjusting, so valueChanged will be called again + return; + } + + m_dataBox.addDataChanged(DProteinSet.class); + m_dataBox.propagateDataChanged(); + + } + + /*public boolean selectProteinSet(Long proteinSetId, String searchText) { + ProteinSetTableModel tableModel = (ProteinSetTableModel) ((CompoundTableModel)getModel()).getBaseModel(); + int row = tableModel.findRow(proteinSetId); + if (row == -1) { + return false; + } + row = ((CompoundTableModel)getModel()).convertBaseModelRowToCompoundRow(row); + if (row == -1) { + return false; + } + + // JPM.hack we need to keep the search text + // to be able to give it if needed to the panel + // which display proteins of a protein set + //m_searchTextBeingDone = searchText; + + // must convert row index if there is a sorting + row = convertRowIndexToView(row); + + // select the row + getSelectionModel().setSelectionInterval(row, row); + + // scroll to the row + scrollRowToVisible(row); + + //m_searchTextBeingDone = null; + + return true; + } + //private String m_searchTextBeingDone = null;*/ + + + public void dataUpdated(SubTask subTask, boolean finished) { + + LastAction keepLastAction = m_lastAction; + try { + + + // retrieve selected row + int rowSelected = getSelectionModel().getMinSelectionIndex(); + int rowSelectedInModel = (rowSelected == -1) ? -1 : convertRowIndexToModel(rowSelected); + + // Update Model (but protein set table must not react to the model update) + + selectionWillBeRestored(true); + try { + ((ProteinSetTableModel) (((CompoundTableModel) getModel()).getBaseModel())).dataUpdated(); + } finally { + selectionWillBeRestored(false); + } + + + + // restore selected row + if (rowSelectedInModel != -1) { + int rowSelectedInView = convertRowIndexToView(rowSelectedInModel); + //getSelectionModel().setSelectionInterval(rowSelectedInView, rowSelectedInView); + setSelection(rowSelectedInView); + + + // if the subtask correspond to the loading of the data of the sorted column, + // we keep the row selected visible + if (((keepLastAction == LastAction.ACTION_SELECTING ) || (keepLastAction == LastAction.ACTION_SORTING)) && (subTask.getSubTaskId() == ((CompoundTableModel) getModel()).getSubTaskId( getSortedColumnIndex() )) ) { + scrollRowToVisible(rowSelectedInView); + } + + } + + } finally { + + m_lastAction = keepLastAction; + + } + + if (finished) { + setSortable(true); + } + } + + public void selectionWillBeRestored(boolean b) { + selectionWillBeRestored = b; + } + private boolean selectionWillBeRestored = false; + + @Override + public int getLoadingPercentage() { + return m_dataBox.getLoadingPercentage(); + } + + @Override + public boolean isLoaded() { + return m_dataBox.isLoaded(); + } + + @Override + public void importSelection(HashSet selectedData) { + + ListSelectionModel selectionTableModel = getSelectionModel(); + selectionTableModel.clearSelection(); + + int firstRow = -1; + ProteinSetTableModel model = (ProteinSetTableModel) ((CompoundTableModel) m_proteinSetTable.getModel()).getBaseModel(); + int rowCount = model.getRowCount(); + for (int i=0;i1) ? " Proteins Sets" : " Protein Set"); + } + + + + } + + + } \ No newline at end of file diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinsOfProteinSetPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinsOfProteinSetPanel.java index 96dd36f6c..75ecffde5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinsOfProteinSetPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/RsmProteinsOfProteinSetPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/SelectLevelRadioButtonGroup.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/SelectLevelRadioButtonGroup.java new file mode 100644 index 000000000..5d348cb12 --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/SelectLevelRadioButtonGroup.java @@ -0,0 +1,100 @@ +package fr.proline.studio.rsmexplorer.gui; + +import fr.proline.studio.utils.IconManager; + +import javax.swing.*; +import java.awt.*; + +public class SelectLevelRadioButtonGroup { + + private final JRadioButton m_radioButton; + private final JLabel m_validationLabel; + private final JLabel m_automaticLabel; + + /** + * + * @param containerPanel : Panel where radio button and associated component should be added + * @param c : GridBagConstraints to be used to add radio button. This will be modified while component are added + * @param text : Label to be used for radio button + * @param icon : icon to be used for radio button with radio button + */ + public SelectLevelRadioButtonGroup(JPanel containerPanel, GridBagConstraints c, String text, ImageIcon icon) { + + m_radioButton = new JRadioButton(text); + + m_validationLabel = new JLabel(icon){ + @Override + public Dimension getPreferredSize() { + return new Dimension(16,16); + } + }; + m_validationLabel.setHorizontalTextPosition(JLabel.LEFT); + m_validationLabel.setVerticalTextPosition(JLabel.BOTTOM); + m_validationLabel.setToolTipText(text); + + m_automaticLabel = new JLabel("") { + @Override + public Dimension getPreferredSize() { + return new Dimension(16,16); + } + }; + + containerPanel.add(m_radioButton, c); + + + c.gridx++; + containerPanel.add(m_validationLabel, c); + + c.gridx++; + containerPanel.add(m_automaticLabel, c); + + c.gridx++; + c.weightx = 1; + containerPanel.add(Box.createHorizontalGlue(), c); + c.weightx = 0; + + } + + + public JRadioButton getRadioButton() { + return m_radioButton; + } + + /** + * Add an icon indicating if selection level was obtained automatically or manually) + * + * @param selectLevel ; Selection Level to represent. + */ + public void addIcon(int selectLevel) { + boolean isManual = false; + switch (selectLevel) { + case 0: + case 3: + isManual = true; + break; + case 1: + case 2: + isManual = false; + } + + ImageIcon icon = null; + String tooltips; + if (isManual) { + icon = new ImageIcon(IconManager.getIcon(IconManager.IconType.HAND_OPEN).getImage().getScaledInstance(16, 16, Image.SCALE_DEFAULT)); + tooltips = "Manual"; + } else { + icon = new ImageIcon(IconManager.getIcon(IconManager.IconType.GEAR).getImage().getScaledInstance(16, 16, Image.SCALE_DEFAULT)); + tooltips = "Automatic"; + } + m_automaticLabel.setIcon(icon); + m_automaticLabel.setToolTipText(tooltips); + } + + /** + * Remove automatic/manual indication + */ + public void removeOptionIcon() { + m_automaticLabel.setIcon(null); + } + + } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/StudioMzScopePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/StudioMzScopePanel.java index 4b3ed1014..094aef00a 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/StudioMzScopePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/StudioMzScopePanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import fr.proline.mzscope.MzScope; @@ -38,7 +38,7 @@ import java.util.List; import javax.swing.JPanel; import javax.swing.JToolBar; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooser.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooser.java index 07df2b102..51c02849b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooser.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooser.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; import fr.proline.studio.rsmexplorer.gui.TreeFileChooserPanel.FileNode; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooserPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooserPanel.java index 9f06e3f24..67204289c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooserPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooserPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooserTableModelInterface.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooserTableModelInterface.java index 04a09cccf..9ef53caf4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooserTableModelInterface.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooserTableModelInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,17 +14,17 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.rsmexplorer.gui; - -import java.io.File; -import java.util.ArrayList; - -/** - * - * @author JM235353 - */ -public interface TreeFileChooserTableModelInterface { - public void setFiles(ArrayList fileList, int rowIndex); - public boolean shouldConfirmCorruptFiles(ArrayList indices); - public boolean canSetFiles(ArrayList indices); -} +package fr.proline.studio.rsmexplorer.gui; + +import java.io.File; +import java.util.ArrayList; + +/** + * + * @author JM235353 + */ +public interface TreeFileChooserTableModelInterface { + public void setFiles(ArrayList fileList, int rowIndex); + public boolean shouldConfirmCorruptFiles(ArrayList indices); + public boolean canSetFiles(ArrayList indices); +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooserTransferHandler.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooserTransferHandler.java index c71c7e2a1..ebbe4c21e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooserTransferHandler.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeFileChooserTransferHandler.java @@ -1,403 +1,403 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.gui; - -import fr.proline.studio.dpm.serverfilesystem.RootInfo; -import fr.proline.studio.dpm.serverfilesystem.ServerFileSystemView; -import fr.proline.studio.msfiles.MzdbUploadBatch; -import fr.proline.studio.msfiles.MzdbUploadSettings; -import java.awt.Color; -import java.awt.datatransfer.Transferable; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.io.File; -import java.io.IOException; -import java.util.*; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JTable; -import javax.swing.JTree; - -import javax.swing.TransferHandler; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreePath; -import org.openide.util.Exceptions; - -/** - * Class used for Drag and Drop of nodes - * - * @author JM235353 - */ -public class TreeFileChooserTransferHandler extends TransferHandler { - - private HashMap m_components; - - public TreeFileChooserTransferHandler() { - m_components = new HashMap(); - } - - public void addComponent(JComponent component) { - m_components.put(component, component); - } - - public void clearHighlights() { - Iterator it = m_components.keySet().iterator(); - while (it.hasNext()) { - JComponent key = it.next(); - key.setBackground(null); - } - } - - @Override - public int getSourceActions(JComponent c) { - return TransferHandler.COPY; - } - - @Override - protected Transferable createTransferable(JComponent c) { - - if (c instanceof TreeFileChooser) { - TreeFileChooser tree = (TreeFileChooser) c; - - ArrayList selectedFiles = tree.getSelectedFiles(); - if (selectedFiles.isEmpty()) { - return null; - } - - return new FilesTransferable(selectedFiles, FilesTransferable.SourceFileSystem.SOURCE_SERVE_FILE_SYSTEM); - - } - return null; - } - - @Override - protected void exportDone(JComponent source, Transferable data, int action) { - clearHighlights(); - } - - @Override - public boolean canImport(TransferHandler.TransferSupport support) { - - support.setShowDropLocation(true); - - if (support.isDataFlavorSupported(FilesTransferable.Files_FLAVOR)) { - - - - DropLocation dropLocation = support.getDropLocation(); - if (dropLocation instanceof JTable.DropLocation) { - return true; - } else if (m_components.containsKey((JComponent) support.getComponent())) { - m_components.get((JComponent) support.getComponent()).setBackground(Color.WHITE); - return true; - } else if (dropLocation instanceof JTree.DropLocation) { - try { - FilesTransferable transferable = (FilesTransferable) support.getTransferable().getTransferData(FilesTransferable.Files_FLAVOR); - if (transferable.getSource() == FilesTransferable.SourceFileSystem.SOURCE_LOCAL_FILE_SYSTEM) { - - JTree.DropLocation treeDropLocation = (JTree.DropLocation) support.getDropLocation(); - TreePath treePath = treeDropLocation.getPath(); - - DropInfo dropInfo = checkServer(treePath); - if (dropInfo == null) { - return false; - } - - ArrayList transferredFiles = transferable.getFiles(); - - ArrayList compatibleTransferredFiles = dropInfo.filterCompatibleFiles(transferredFiles); - if (compatibleTransferredFiles.isEmpty()) { - return false; - } - - return true; - } else { - return false; - } - } catch (UnsupportedFlavorException | IOException e) { - return false; - } - } - } - - clearHighlights(); - return false; - } - - @Override - public boolean importData(TransferHandler.TransferSupport support) { - - if (support.getComponent() instanceof JTable) { - - try { - JTable table = (JTable) support.getComponent(); - JTable.DropLocation dl = (JTable.DropLocation) support.getDropLocation(); - - int index = table.convertRowIndexToModel(dl.getRow()); - - int max = table.getModel().getRowCount(); - if (index < 0 || index > max) { - return false; - } - - FilesTransferable transferable = (FilesTransferable) support.getTransferable().getTransferData(FilesTransferable.Files_FLAVOR); - ArrayList transferredFiles = transferable.getFiles(); - - ArrayList indices = new ArrayList<>(); - for (int i = 0; i < transferredFiles.size(); i++) { - indices.add(index + i); - } - - TreeFileChooserTableModelInterface model = (TreeFileChooserTableModelInterface) table.getModel(); - - if (!model.canSetFiles(indices)) { - JOptionPane.showMessageDialog(null, "An mzDB file is already linked to this dataset. Operation is cancelled.", "Warning", JOptionPane.WARNING_MESSAGE); - return false; - } - - if (model.shouldConfirmCorruptFiles(indices)) { - int reply = JOptionPane.showConfirmDialog(null, "Previous quantitation has been run with existing mzDB file.\n Are you sure you want to overwrite this link.", "Warning", JOptionPane.YES_NO_OPTION); - if (reply == JOptionPane.NO_OPTION) { - return false; - } - } - - model.setFiles(transferredFiles, index); - - } catch (Exception e) { - //should not happen - return false; - } - } else if (support.getComponent() instanceof DropZoneInterface) { - try { - - DropZoneInterface dropZone = (DropZoneInterface) support.getComponent(); - - FilesTransferable transferable = (FilesTransferable) support.getTransferable().getTransferData(FilesTransferable.Files_FLAVOR); - ArrayList transferredFiles = transferable.getFiles(); - - ArrayList samples = new ArrayList(); - - for (int i = 0; i < transferredFiles.size(); i++) { - - if (transferredFiles.get(i).isFile()) { - samples.add(transferredFiles.get(i)); - } else { - File[] listOfFiles = transferredFiles.get(i).listFiles(); - for (File file : listOfFiles) { - if (file.isFile()) { - samples.add(file); - } - } - - } - } - - dropZone.addSamples(samples); - - } catch (Exception e) { - //should not happen - return false; - } - - return false; - } else if (support.getComponent() instanceof TreeFileChooser) { - - try { - - FilesTransferable transferable = (FilesTransferable) support.getTransferable().getTransferData(FilesTransferable.Files_FLAVOR); - ArrayList transferredFiles = transferable.getFiles(); - - JTree.DropLocation treeDropLocation = (JTree.DropLocation) support.getDropLocation(); - TreePath dropPath = treeDropLocation.getPath(); - - return treeTransfer(transferredFiles, dropPath); - - } catch (UnsupportedFlavorException | IOException ex) { - Exceptions.printStackTrace(ex); - } - - } - - return true; - - } - - public boolean treeTransfer(ArrayList transferredFiles, TreePath dropPath) { - DropInfo dropInfo = checkServer(dropPath); - if (dropInfo == null) { - return false; - } - ArrayList compatibleTransferredFiles = dropInfo.filterCompatibleFiles(transferredFiles); - if (compatibleTransferredFiles.isEmpty()) { - return false; - } - - String parentLabel = dropInfo.getParentLabel(); - String destination = dropInfo.getDestination(); - - //Here we must do a small modification so that mzdb is deleted if it is a result of a conversion drag! - MzdbUploadSettings uploadSettings = new MzdbUploadSettings(false, parentLabel, destination); - - //Here prepare mzdb samples HashMap! - HashMap uploadSamples = new HashMap(); - for (int i = 0; i < transferredFiles.size(); i++) { - if (compatibleTransferredFiles.get(i).isFile()) { - uploadSamples.put(compatibleTransferredFiles.get(i), uploadSettings); - } else { - File[] listOfFiles = compatibleTransferredFiles.get(i).listFiles(); - for (File file : listOfFiles) { - if (file.isFile()) { - uploadSamples.put(file, uploadSettings); - } - } - } - } - - //Uploading Task - MzdbUploadBatch uploadBatch = new MzdbUploadBatch(uploadSamples, dropPath); - Thread thread = new Thread(uploadBatch); - thread.start(); - - return true; - } - - private DropInfo checkServer(TreePath treePath) { - - // Check that the path if a directory - DefaultMutableTreeNode node = (DefaultMutableTreeNode) treePath.getLastPathComponent(); - Object data = node.getUserObject(); - if (data instanceof IconData) { - Object extraData = ((IconData) data).getObject(); - if (extraData instanceof TreeFileChooserPanel.FileNode) { - File f = ((TreeFileChooserPanel.FileNode) extraData).getFile(); - if (!f.isDirectory()) { - return checkServer(treePath.getParentPath()); - } - } - } - - String textTreePath = treePath.toString(); - - textTreePath = textTreePath.replaceAll("\\[", "").replaceAll("\\]", ""); - - String[] pathNodes = textTreePath.split(","); - - for (int i = 0; i < pathNodes.length; i++) { - pathNodes[i] = pathNodes[i].trim(); - } - - DropInfo dropInfo = lookForLabels(pathNodes, RootInfo.TYPE_MZDB_FILES); - if (dropInfo != null) { - return dropInfo; - } - - dropInfo = lookForLabels(pathNodes, RootInfo.TYPE_RAW_FILES); - if (dropInfo != null) { - return dropInfo; - } - - dropInfo = lookForLabels(pathNodes, RootInfo.TYPE_RESULT_FILES); - return dropInfo; - - - } - - private DropInfo lookForLabels(String[] pathNodes, String rootInfoType) { - ArrayList labels = ServerFileSystemView.getServerFileSystemView().getLabels(rootInfoType); - String parentLabel = null; - int parentIndex = -1; - - for (int i = 0; i < pathNodes.length; i++) { - - for (int j = 0; j < labels.size(); j++) { - String node = pathNodes[i]; - String label = labels.get(j); - - if (node.compareToIgnoreCase(label) == 0) { - parentLabel = pathNodes[i]; - parentIndex = i; - break; - } - } - - } - - if (parentLabel == null || parentIndex == -1) { - return null; - } - - StringBuilder destinationBuilder = new StringBuilder(); - - for (int i = parentIndex + 1; i < pathNodes.length; i++) { - destinationBuilder.append(File.separator).append(pathNodes[i]); - } - destinationBuilder.append(File.separator); - - String destination = destinationBuilder.toString(); - - return new DropInfo(parentLabel, parentIndex, destination, rootInfoType); - } - - private class DropInfo { - - private String m_parentLabel; - private int m_parentIndex; - private String m_destination; - private String m_rootInfoType; - - public DropInfo(String parentLabel, int parentIndex, String destination, String rootInfoType) { - m_parentLabel = parentLabel; - m_parentIndex = parentIndex; - m_destination = destination; - m_rootInfoType = rootInfoType; - } - - public String getParentLabel() { - return m_parentLabel; - } - - public int getParentIndex() { - return m_parentIndex; - } - - public String getDestination() { - return m_destination; - } - - public ArrayList filterCompatibleFiles(ArrayList files) { - - String allowedExtension = null; - if (m_rootInfoType.equals(RootInfo.TYPE_MZDB_FILES)) { - allowedExtension = ".mzdb"; - } else if (m_rootInfoType.equals(RootInfo.TYPE_RAW_FILES)) { - allowedExtension = ".raw"; - } else if (m_rootInfoType.equals(RootInfo.TYPE_RESULT_FILES)) { - allowedExtension = ".dat"; - } - - - ArrayList compatibleFiles = new ArrayList<>(files.size()); - for (File f : files) { - if (f.getAbsolutePath().toLowerCase().endsWith(allowedExtension)) { - compatibleFiles.add(f); - } - } - return compatibleFiles; - } - } - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.gui; + +import fr.proline.studio.dpm.serverfilesystem.RootInfo; +import fr.proline.studio.dpm.serverfilesystem.ServerFileSystemView; +import fr.proline.studio.msfiles.MzdbUploadBatch; +import fr.proline.studio.msfiles.MzdbUploadSettings; +import java.awt.Color; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.File; +import java.io.IOException; +import java.util.*; +import javax.swing.JComponent; +import javax.swing.JOptionPane; +import javax.swing.JTable; +import javax.swing.JTree; + +import javax.swing.TransferHandler; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreePath; +import fr.proline.studio.Exceptions; + +/** + * Class used for Drag and Drop of nodes + * + * @author JM235353 + */ +public class TreeFileChooserTransferHandler extends TransferHandler { + + private HashMap m_components; + + public TreeFileChooserTransferHandler() { + m_components = new HashMap(); + } + + public void addComponent(JComponent component) { + m_components.put(component, component); + } + + public void clearHighlights() { + Iterator it = m_components.keySet().iterator(); + while (it.hasNext()) { + JComponent key = it.next(); + key.setBackground(null); + } + } + + @Override + public int getSourceActions(JComponent c) { + return TransferHandler.COPY; + } + + @Override + protected Transferable createTransferable(JComponent c) { + + if (c instanceof TreeFileChooser) { + TreeFileChooser tree = (TreeFileChooser) c; + + ArrayList selectedFiles = tree.getSelectedFiles(); + if (selectedFiles.isEmpty()) { + return null; + } + + return new FilesTransferable(selectedFiles, FilesTransferable.SourceFileSystem.SOURCE_SERVE_FILE_SYSTEM); + + } + return null; + } + + @Override + protected void exportDone(JComponent source, Transferable data, int action) { + clearHighlights(); + } + + @Override + public boolean canImport(TransferHandler.TransferSupport support) { + + support.setShowDropLocation(true); + + if (support.isDataFlavorSupported(FilesTransferable.Files_FLAVOR)) { + + + + DropLocation dropLocation = support.getDropLocation(); + if (dropLocation instanceof JTable.DropLocation) { + return true; + } else if (m_components.containsKey((JComponent) support.getComponent())) { + m_components.get((JComponent) support.getComponent()).setBackground(Color.WHITE); + return true; + } else if (dropLocation instanceof JTree.DropLocation) { + try { + FilesTransferable transferable = (FilesTransferable) support.getTransferable().getTransferData(FilesTransferable.Files_FLAVOR); + if (transferable.getSource() == FilesTransferable.SourceFileSystem.SOURCE_LOCAL_FILE_SYSTEM) { + + JTree.DropLocation treeDropLocation = (JTree.DropLocation) support.getDropLocation(); + TreePath treePath = treeDropLocation.getPath(); + + DropInfo dropInfo = checkServer(treePath); + if (dropInfo == null) { + return false; + } + + ArrayList transferredFiles = transferable.getFiles(); + + ArrayList compatibleTransferredFiles = dropInfo.filterCompatibleFiles(transferredFiles); + if (compatibleTransferredFiles.isEmpty()) { + return false; + } + + return true; + } else { + return false; + } + } catch (UnsupportedFlavorException | IOException e) { + return false; + } + } + } + + clearHighlights(); + return false; + } + + @Override + public boolean importData(TransferHandler.TransferSupport support) { + + if (support.getComponent() instanceof JTable) { + + try { + JTable table = (JTable) support.getComponent(); + JTable.DropLocation dl = (JTable.DropLocation) support.getDropLocation(); + + int index = table.convertRowIndexToModel(dl.getRow()); + + int max = table.getModel().getRowCount(); + if (index < 0 || index > max) { + return false; + } + + FilesTransferable transferable = (FilesTransferable) support.getTransferable().getTransferData(FilesTransferable.Files_FLAVOR); + ArrayList transferredFiles = transferable.getFiles(); + + ArrayList indices = new ArrayList<>(); + for (int i = 0; i < transferredFiles.size(); i++) { + indices.add(index + i); + } + + TreeFileChooserTableModelInterface model = (TreeFileChooserTableModelInterface) table.getModel(); + + if (!model.canSetFiles(indices)) { + JOptionPane.showMessageDialog(null, "An mzDB file is already linked to this dataset. Operation is cancelled.", "Warning", JOptionPane.WARNING_MESSAGE); + return false; + } + + if (model.shouldConfirmCorruptFiles(indices)) { + int reply = JOptionPane.showConfirmDialog(null, "Previous quantitation has been run with existing mzDB file.\n Are you sure you want to overwrite this link.", "Warning", JOptionPane.YES_NO_OPTION); + if (reply == JOptionPane.NO_OPTION) { + return false; + } + } + + model.setFiles(transferredFiles, index); + + } catch (Exception e) { + //should not happen + return false; + } + } else if (support.getComponent() instanceof DropZoneInterface) { + try { + + DropZoneInterface dropZone = (DropZoneInterface) support.getComponent(); + + FilesTransferable transferable = (FilesTransferable) support.getTransferable().getTransferData(FilesTransferable.Files_FLAVOR); + ArrayList transferredFiles = transferable.getFiles(); + + ArrayList samples = new ArrayList(); + + for (int i = 0; i < transferredFiles.size(); i++) { + + if (transferredFiles.get(i).isFile()) { + samples.add(transferredFiles.get(i)); + } else { + File[] listOfFiles = transferredFiles.get(i).listFiles(); + for (File file : listOfFiles) { + if (file.isFile()) { + samples.add(file); + } + } + + } + } + + dropZone.addSamples(samples); + + } catch (Exception e) { + //should not happen + return false; + } + + return false; + } else if (support.getComponent() instanceof TreeFileChooser) { + + try { + + FilesTransferable transferable = (FilesTransferable) support.getTransferable().getTransferData(FilesTransferable.Files_FLAVOR); + ArrayList transferredFiles = transferable.getFiles(); + + JTree.DropLocation treeDropLocation = (JTree.DropLocation) support.getDropLocation(); + TreePath dropPath = treeDropLocation.getPath(); + + return treeTransfer(transferredFiles, dropPath); + + } catch (UnsupportedFlavorException | IOException ex) { + Exceptions.printStackTrace(ex); + } + + } + + return true; + + } + + public boolean treeTransfer(ArrayList transferredFiles, TreePath dropPath) { + DropInfo dropInfo = checkServer(dropPath); + if (dropInfo == null) { + return false; + } + ArrayList compatibleTransferredFiles = dropInfo.filterCompatibleFiles(transferredFiles); + if (compatibleTransferredFiles.isEmpty()) { + return false; + } + + String parentLabel = dropInfo.getParentLabel(); + String destination = dropInfo.getDestination(); + + //Here we must do a small modification so that mzdb is deleted if it is a result of a conversion drag! + MzdbUploadSettings uploadSettings = new MzdbUploadSettings(false, parentLabel, destination); + + //Here prepare mzdb samples HashMap! + HashMap uploadSamples = new HashMap(); + for (int i = 0; i < transferredFiles.size(); i++) { + if (compatibleTransferredFiles.get(i).isFile()) { + uploadSamples.put(compatibleTransferredFiles.get(i), uploadSettings); + } else { + File[] listOfFiles = compatibleTransferredFiles.get(i).listFiles(); + for (File file : listOfFiles) { + if (file.isFile()) { + uploadSamples.put(file, uploadSettings); + } + } + } + } + + //Uploading Task + MzdbUploadBatch uploadBatch = new MzdbUploadBatch(uploadSamples, dropPath); + Thread thread = new Thread(uploadBatch); + thread.start(); + + return true; + } + + private DropInfo checkServer(TreePath treePath) { + + // Check that the path if a directory + DefaultMutableTreeNode node = (DefaultMutableTreeNode) treePath.getLastPathComponent(); + Object data = node.getUserObject(); + if (data instanceof IconData) { + Object extraData = ((IconData) data).getObject(); + if (extraData instanceof TreeFileChooserPanel.FileNode) { + File f = ((TreeFileChooserPanel.FileNode) extraData).getFile(); + if (!f.isDirectory()) { + return checkServer(treePath.getParentPath()); + } + } + } + + String textTreePath = treePath.toString(); + + textTreePath = textTreePath.replaceAll("\\[", "").replaceAll("\\]", ""); + + String[] pathNodes = textTreePath.split(","); + + for (int i = 0; i < pathNodes.length; i++) { + pathNodes[i] = pathNodes[i].trim(); + } + + DropInfo dropInfo = lookForLabels(pathNodes, RootInfo.TYPE_MZDB_FILES); + if (dropInfo != null) { + return dropInfo; + } + + dropInfo = lookForLabels(pathNodes, RootInfo.TYPE_RAW_FILES); + if (dropInfo != null) { + return dropInfo; + } + + dropInfo = lookForLabels(pathNodes, RootInfo.TYPE_RESULT_FILES); + return dropInfo; + + + } + + private DropInfo lookForLabels(String[] pathNodes, String rootInfoType) { + ArrayList labels = ServerFileSystemView.getServerFileSystemView().getLabels(rootInfoType); + String parentLabel = null; + int parentIndex = -1; + + for (int i = 0; i < pathNodes.length; i++) { + + for (int j = 0; j < labels.size(); j++) { + String node = pathNodes[i]; + String label = labels.get(j); + + if (node.compareToIgnoreCase(label) == 0) { + parentLabel = pathNodes[i]; + parentIndex = i; + break; + } + } + + } + + if (parentLabel == null || parentIndex == -1) { + return null; + } + + StringBuilder destinationBuilder = new StringBuilder(); + + for (int i = parentIndex + 1; i < pathNodes.length; i++) { + destinationBuilder.append(File.separator).append(pathNodes[i]); + } + destinationBuilder.append(File.separator); + + String destination = destinationBuilder.toString(); + + return new DropInfo(parentLabel, parentIndex, destination, rootInfoType); + } + + private class DropInfo { + + private String m_parentLabel; + private int m_parentIndex; + private String m_destination; + private String m_rootInfoType; + + public DropInfo(String parentLabel, int parentIndex, String destination, String rootInfoType) { + m_parentLabel = parentLabel; + m_parentIndex = parentIndex; + m_destination = destination; + m_rootInfoType = rootInfoType; + } + + public String getParentLabel() { + return m_parentLabel; + } + + public int getParentIndex() { + return m_parentIndex; + } + + public String getDestination() { + return m_destination; + } + + public ArrayList filterCompatibleFiles(ArrayList files) { + + String allowedExtension = null; + if (m_rootInfoType.equals(RootInfo.TYPE_MZDB_FILES)) { + allowedExtension = ".mzdb"; + } else if (m_rootInfoType.equals(RootInfo.TYPE_RAW_FILES)) { + allowedExtension = ".raw"; + } else if (m_rootInfoType.equals(RootInfo.TYPE_RESULT_FILES)) { + allowedExtension = ".dat"; + } + + + ArrayList compatibleFiles = new ArrayList<>(files.size()); + for (File f : files) { + if (f.getAbsolutePath().toLowerCase().endsWith(allowedExtension)) { + compatibleFiles.add(f); + } + } + return compatibleFiles; + } + } + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeUtils.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeUtils.java index bd5b0e055..7a132be56 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeUtils.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/TreeUtils.java @@ -1,21 +1,23 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui; +import fr.proline.studio.NbPreferences; + import java.util.Enumeration; import java.util.HashSet; import java.util.Iterator; @@ -29,7 +31,7 @@ import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; -import org.openide.util.NbPreferences; + /** * @@ -71,7 +73,7 @@ public static void saveExpansionState(JTree tree, TreeType type, String rootSuff public static HashSet loadExpansionState(TreeType type, String rootSuffix) { HashSet retrievedSet = new HashSet(); - String s; + String s = null; if (type == TreeType.SERVER) { s = m_preferences.get("TreeStateUtil.Server_tree", null); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/AdminDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/AdminDialog.java index 0bf56e9e7..80d5f19e0 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/AdminDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/AdminDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/FragmentationRuleSetDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/FragmentationRuleSetDialog.java index 476e021ae..b0b99445e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/FragmentationRuleSetDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/FragmentationRuleSetDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.admin; import fr.proline.core.orm.uds.FragmentationRule; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/FragmentationRuleSetPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/FragmentationRuleSetPanel.java index dabf8a802..c74dd621d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/FragmentationRuleSetPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/FragmentationRuleSetPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.admin; import fr.proline.core.orm.uds.FragmentationRule; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/PeakListSoftwareDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/PeakListSoftwareDialog.java index 0d664c1de..345efdc0c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/PeakListSoftwareDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/PeakListSoftwareDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/PeaklistSoftwarePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/PeaklistSoftwarePanel.java index a316cab12..6e369eb9a 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/PeaklistSoftwarePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/PeaklistSoftwarePanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/ProjectsPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/ProjectsPanel.java index 36285b9e7..1c4c7240f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/ProjectsPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/ProjectsPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -73,7 +73,7 @@ import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import org.jdesktop.swingx.table.TableColumnExt; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/UserAccountDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/UserAccountDialog.java index 8d59ab834..446e2b200 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/UserAccountDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/UserAccountDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.admin; import fr.proline.core.orm.uds.UserAccount; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/UserAccountsPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/UserAccountsPanel.java index 74346b830..e28c15ff4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/UserAccountsPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/admin/UserAccountsPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.admin; import fr.proline.core.orm.uds.UserAccount; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataAnalyzerPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataAnalyzerPanel.java index a77eb95a8..5983df1ab 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataAnalyzerPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataAnalyzerPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataAnalyzerResultsPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataAnalyzerResultsPanel.java index e2bc38284..2c21d1728 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataAnalyzerResultsPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataAnalyzerResultsPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc; import fr.proline.studio.gui.ClosableTabPanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataTree.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataTree.java index 895f7ee5c..1650d4f23 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataTree.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataTree.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,10 +16,12 @@ */ package fr.proline.studio.rsmexplorer.gui.calc; +import fr.proline.studio.WindowManager; +import fr.proline.studio.dock.AbstractTopPanel; import fr.proline.studio.graphics.PlotType; import fr.proline.studio.python.data.Table; import fr.proline.studio.table.TableInfo; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.gui.calc.functions.AbstractFunction; import fr.proline.studio.rsmexplorer.gui.calc.functions.AdjustPFunction; import fr.proline.studio.rsmexplorer.gui.calc.functions.SCDiffAnalysisFunction; @@ -72,7 +74,6 @@ import javax.swing.tree.TreePath; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.table.TableColumnExt; -import org.openide.windows.TopComponent; /** * Tree Panel for the DataAnalyzer with data and functions @@ -219,15 +220,17 @@ private void fillDataNodes(ParentDataNode parentNode) { HashMap tableMap = new HashMap<>(); ArrayList list = new ArrayList<>(); - - Set tcs = TopComponent.getRegistry().getOpened(); - Iterator itTop = tcs.iterator(); + + + + Set< AbstractTopPanel > tcs = WindowManager.getDefault().getMainWindow().getTopPanels(); + Iterator itTop = tcs.iterator(); while (itTop.hasNext()) { - TopComponent topComponent = itTop.next(); - if (topComponent instanceof DataBoxViewerTopComponent) { + AbstractTopPanel topComponent = itTop.next(); + if (topComponent instanceof DataBoxViewerTopPanel) { list.clear(); - DataBoxViewerTopComponent databoxViewerTopComponent = (DataBoxViewerTopComponent) topComponent; - databoxViewerTopComponent.retrieveTableModels(list); + DataBoxViewerTopPanel DataBoxViewerTopPanel = (DataBoxViewerTopPanel) topComponent; + DataBoxViewerTopPanel.retrieveTableModels(list); int nb = list.size(); if (nb > 0) { WindowDataNode windowDataNode = new WindowDataNode(list.get(0)); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataTreeTransferHandler.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataTreeTransferHandler.java index cf07359d9..98a6d862d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataTreeTransferHandler.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataTreeTransferHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataTreeTransferable.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataTreeTransferable.java index 3b4f3bf7b..600b9edab 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataTreeTransferable.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/DataTreeTransferable.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc; import java.awt.datatransfer.DataFlavor; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/GraphPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/GraphPanel.java index 67df11197..fbb6feabb 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/GraphPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/GraphPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc; import fr.proline.studio.graphics.SelectionGestureLasso; @@ -64,7 +64,7 @@ import javax.swing.SwingUtilities; import javax.swing.Timer; import javax.swing.ToolTipManager; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; /** * Panel to display the Graph for the Data analyzer diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/ProcessCallbackInterface.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/ProcessCallbackInterface.java index 54a7cd7d5..ed7709f2b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/ProcessCallbackInterface.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/ProcessCallbackInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc; import fr.proline.studio.rsmexplorer.gui.calc.graph.GraphNode; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/ProcessEngine.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/ProcessEngine.java index 443bc01d8..58bcdf542 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/ProcessEngine.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/ProcessEngine.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc; import fr.proline.studio.gui.SplittedPanelContainer; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/ProcessEngineInfo.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/ProcessEngineInfo.java index 2d46036ce..455fd60f8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/ProcessEngineInfo.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/ProcessEngineInfo.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc; import fr.proline.studio.gui.SplittedPanelContainer; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/UserMacroParser.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/UserMacroParser.java index dec7c17f3..d7b98e4ea 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/UserMacroParser.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/UserMacroParser.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc; import fr.proline.studio.graphics.PlotType; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/AbstractFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/AbstractFunction.java index 6b9f2241a..de9c1b25f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/AbstractFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/AbstractFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.gui.SplittedPanelContainer; @@ -22,7 +22,7 @@ import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; import fr.proline.studio.python.interpreter.CalcError; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.gui.calc.GraphPanel; import fr.proline.studio.rsmexplorer.gui.calc.ProcessCallbackInterface; import fr.proline.studio.rsmexplorer.gui.calc.graph.FunctionGraphNode; @@ -35,7 +35,7 @@ import java.awt.Color; import java.util.ArrayList; import javax.swing.ImageIcon; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; /** * Abstract Parent Function for all functions of the data analyzer @@ -197,9 +197,8 @@ protected void display(String dataName, String functionName, int resultIndex) { ProjectId projectId = (ProjectId) m_globalTableModelInterface.get(resultIndex).getSingleValue(ProjectId.class); long id = (projectId!=null) ? projectId.getId() : -1L; windowBox.setEntryData(id, m_globalTableModelInterface.get(resultIndex)); - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(windowBox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(windowBox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } protected ArrayList getDisplayWindowBoxList(String dataName, String functionName, int resultIndex) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/AbstractOnExperienceDesignFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/AbstractOnExperienceDesignFunction.java index a5c1ea630..d55ed20dc 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/AbstractOnExperienceDesignFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/AbstractOnExperienceDesignFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.core.orm.uds.BiologicalGroup; @@ -51,7 +51,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; /** * Abstract class for functions on Experience Disgn for the data analyzer diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/AdjustPFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/AdjustPFunction.java index 06e87ce93..014f36ca1 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/AdjustPFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/AdjustPFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.parameter.AbstractLinkedParameters; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ColumnFilterFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ColumnFilterFunction.java index 2b7c05558..d39e26f0b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ColumnFilterFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ColumnFilterFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.gui.AdvancedSelectionPanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ComputeFDRFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ComputeFDRFunction.java index fe482691c..2f5a965a2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ComputeFDRFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ComputeFDRFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.graphics.BasePlotPanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/DiffAnalysisFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/DiffAnalysisFunction.java index 4f6b2dff8..f4ef3507a 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/DiffAnalysisFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/DiffAnalysisFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.parameter.ObjectParameter; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/DiffFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/DiffFunction.java index dbc962e09..ec7f10dd1 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/DiffFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/DiffFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.extendedtablemodel.AbstractJoinDataModel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ExpressionFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ExpressionFunction.java index d445f6106..9203f74db 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ExpressionFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ExpressionFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.gui.expressionbuilder.ExpressionEntity; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/FilterFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/FilterFunction.java index 51e849ee5..02dfb7656 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/FilterFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/FilterFunction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -32,7 +32,7 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.Map; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ImportTSVFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ImportTSVFunction.java index 5211af9bd..3ef281a4f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ImportTSVFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/ImportTSVFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/JoinFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/JoinFunction.java index 25bed1c37..f32182462 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/JoinFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/JoinFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.parameter.AbstractLinkedParameters; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/LogFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/LogFunction.java index 5b994ecbc..d07ce8712 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/LogFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/LogFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/MissingValuesImputationFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/MissingValuesImputationFunction.java index 4d446b809..c1ad6ff53 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/MissingValuesImputationFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/MissingValuesImputationFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.parameter.AbstractLinkedParameters; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/NormalizationFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/NormalizationFunction.java index 25a6af128..8b81942a6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/NormalizationFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/NormalizationFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.parameter.AbstractLinkedParameters; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/PValueFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/PValueFunction.java index ec35d3dd3..84e7ec9ec 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/PValueFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/PValueFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.rsmexplorer.gui.calc.GraphPanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/QuantiFilterFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/QuantiFilterFunction.java index 9a126586b..4c248db13 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/QuantiFilterFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/QuantiFilterFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.parameter.IntegerParameter; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/SCDiffAnalysisFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/SCDiffAnalysisFunction.java index 42ee94685..a067a3da2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/SCDiffAnalysisFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/SCDiffAnalysisFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.rsmexplorer.gui.calc.GraphPanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/TtdFunction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/TtdFunction.java index e73a2a012..76498bf88 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/TtdFunction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/functions/TtdFunction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.functions; import fr.proline.studio.rsmexplorer.gui.calc.GraphPanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/AbstractConnectedGraphObject.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/AbstractConnectedGraphObject.java index 4ec2dd399..50e172ab7 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/AbstractConnectedGraphObject.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/AbstractConnectedGraphObject.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graph; import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/AbstractGraphObject.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/AbstractGraphObject.java index d139df88d..e5027282f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/AbstractGraphObject.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/AbstractGraphObject.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graph; import fr.proline.studio.rsmexplorer.gui.calc.GraphPanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/DataGraphNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/DataGraphNode.java index 0bac7311f..8f499e8b1 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/DataGraphNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/DataGraphNode.java @@ -1,27 +1,28 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graph; +import fr.proline.studio.WindowManager; import fr.proline.studio.gui.SplittedPanelContainer; import fr.proline.studio.id.ProjectId; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; import fr.proline.studio.table.TableInfo; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.gui.calc.GraphPanel; import fr.proline.studio.rsmexplorer.gui.calc.ProcessCallbackInterface; import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; @@ -150,9 +151,8 @@ public void askDisplay(int index) { long id = (projectId!=null) ? projectId.getId() : -1L; windowBox.setEntryData(id, model); - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(windowBox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(windowBox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/FunctionGraphNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/FunctionGraphNode.java index fe026295a..32116efbf 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/FunctionGraphNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/FunctionGraphNode.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graph; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphConnector.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphConnector.java index 0dc5debdd..f73f7811c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphConnector.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphConnector.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graph; import fr.proline.studio.rsmexplorer.gui.calc.GraphPanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphGroup.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphGroup.java index ba73dff10..a8047da83 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphGroup.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphGroup.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graph; import fr.proline.studio.rsmexplorer.gui.calc.GraphPanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphLink.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphLink.java index f88882e02..d2c3b37ed 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphLink.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphLink.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graph; import fr.proline.studio.rsmexplorer.gui.calc.GraphPanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphNode.java index ab35b871d..9afb940e0 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphNode.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graph; import fr.proline.studio.gui.InfoDialog; @@ -39,7 +39,7 @@ import javax.swing.ImageIcon; import javax.swing.JMenu; import javax.swing.JPopupMenu; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; /** * Parent Node for all graph nodes diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphNodeAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphNodeAction.java index 202494297..857b38be1 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphNodeAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphNodeAction.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graph; import fr.proline.studio.rsmexplorer.gui.calc.GraphPanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphicGraphNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphicGraphNode.java index 08f9f6422..957d25700 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphicGraphNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graph/GraphicGraphNode.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graph; import fr.proline.studio.gui.SplittedPanelContainer; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/AbstractGraphic.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/AbstractGraphic.java index 2bf0108c6..869d5d959 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/AbstractGraphic.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/AbstractGraphic.java @@ -1,28 +1,30 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graphics; +import fr.proline.studio.WindowManager; import fr.proline.studio.gui.SplittedPanelContainer; import fr.proline.studio.parameter.ParameterList; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; import fr.proline.studio.python.interpreter.CalcError; import fr.proline.studio.rserver.dialog.ImageViewerTopComponent; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.gui.calc.GraphPanel; import fr.proline.studio.rsmexplorer.gui.calc.ProcessCallbackInterface; import fr.proline.studio.rsmexplorer.gui.calc.graph.GraphConnector; @@ -34,7 +36,6 @@ import java.awt.Image; import java.util.ArrayList; import javax.swing.ImageIcon; -import org.openide.windows.WindowManager; /** * Base class for the definition of a Graphic (scatter, histogram...) with its parameters @@ -128,13 +129,11 @@ public void display(String dataName) { String functionName = getName(); if (m_generatedImage != null) { ImageViewerTopComponent win = new ImageViewerTopComponent(dataName + " " + functionName, m_generatedImage); - win.open(); - win.requestActive(); + WindowManager.getDefault().getMainWindow().displayWindow(win); } else { WindowBox windowBox = WindowBoxFactory.getGraphicsWindowBox(dataName, m_graphicsModelInterface, true); - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(windowBox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(windowBox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/AbstractMatrixPlotGraphic.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/AbstractMatrixPlotGraphic.java index effb363ca..943e04ff6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/AbstractMatrixPlotGraphic.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/AbstractMatrixPlotGraphic.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graphics; import fr.proline.core.orm.uds.BiologicalGroup; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/BoxPlotGraphic.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/BoxPlotGraphic.java index ee60533a4..307726a2a 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/BoxPlotGraphic.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/BoxPlotGraphic.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graphics; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/CalibrationPlotGraphic.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/CalibrationPlotGraphic.java index 138d4f7d4..0e2f12b4e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/CalibrationPlotGraphic.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/CalibrationPlotGraphic.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graphics; import fr.proline.studio.parameter.AbstractLinkedParameters; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/DensityPlotGraphic.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/DensityPlotGraphic.java index 9507ff46f..f2a0d3d6d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/DensityPlotGraphic.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/DensityPlotGraphic.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graphics; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/LockedDataGraphicsModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/LockedDataGraphicsModel.java index 58da0aaec..74e2f1815 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/LockedDataGraphicsModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/LockedDataGraphicsModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graphics; import fr.proline.studio.extendedtablemodel.LockedDataModel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/ParallelCoordinatesGraphic.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/ParallelCoordinatesGraphic.java index ed1753eb7..60c2c412f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/ParallelCoordinatesGraphic.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/ParallelCoordinatesGraphic.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graphics; import fr.proline.studio.graphics.PlotType; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/ScatterOrHistogramGraphic.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/ScatterOrHistogramGraphic.java index 3b9ac11b2..9f61f05ca 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/ScatterOrHistogramGraphic.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/ScatterOrHistogramGraphic.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graphics; import fr.proline.studio.graphics.PlotType; @@ -98,7 +98,7 @@ public void generateDefaultParameters(GraphConnector[] graphObjects) { int nbColumnsKept = 0; for (int i = 0; i < nbColumns; i++) { Class c = model1.getDataColumnClass(i); - if (c.equals(Integer.class) || c.equals(Float.class) || c.equals(Double.class)) { + if (c.equals(Integer.class) || c.equals(Float.class) || c.equals(Double.class) || c.equals(Long.class)) { nbColumnsKept++; } } @@ -107,7 +107,7 @@ public void generateDefaultParameters(GraphConnector[] graphObjects) { int iKept = 0; for (int i = 0; i < nbColumns; i++) { Class c = model1.getDataColumnClass(i); - if (c.equals(Integer.class) || c.equals(Float.class) || c.equals(Double.class)) { + if (c.equals(Integer.class) || c.equals(Float.class) || c.equals(Double.class) || c.equals(Long.class)) { objectArray1[iKept] = model1.getColumnName(i); associatedObjectArray1[iKept] = i; if (i == bestXColumnIndex) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/VarianceDistPlotGraphic.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/VarianceDistPlotGraphic.java index 8ff6d42cd..114546f62 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/VarianceDistPlotGraphic.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/VarianceDistPlotGraphic.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graphics; import fr.proline.studio.rsmexplorer.gui.calc.GraphPanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/VennDiagramGraphic.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/VennDiagramGraphic.java index 654fd5faf..a62f599b7 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/VennDiagramGraphic.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/graphics/VennDiagramGraphic.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.graphics; import fr.proline.studio.graphics.PlotType; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/macros/AbstractMacro.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/macros/AbstractMacro.java index 8f09a70a9..eec5d3617 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/macros/AbstractMacro.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/macros/AbstractMacro.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.macros; import fr.proline.studio.rsmexplorer.gui.calc.DataTree.DataNode; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/macros/MacroSavedManager.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/macros/MacroSavedManager.java index 03a623412..7520494bf 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/macros/MacroSavedManager.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/macros/MacroSavedManager.java @@ -1,25 +1,25 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.macros; import java.util.ArrayList; import java.util.prefs.Preferences; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; /** * Management of all user macros for DataAnalyzer diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/macros/ProStarMacro.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/macros/ProStarMacro.java index 051ce21dc..ed9b83d3f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/macros/ProStarMacro.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/macros/ProStarMacro.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/parameters/CheckParameterInterface.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/parameters/CheckParameterInterface.java index 5e712297f..895f086f8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/parameters/CheckParameterInterface.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/parameters/CheckParameterInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,15 +14,15 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.rsmexplorer.gui.calc.parameters; - -import fr.proline.studio.parameter.ParameterError; -import fr.proline.studio.rsmexplorer.gui.calc.graph.GraphConnector; - -/** - * - * @author JM235353 - */ -public interface CheckParameterInterface { - public ParameterError checkParameters(GraphConnector[] graphObjects); -} +package fr.proline.studio.rsmexplorer.gui.calc.parameters; + +import fr.proline.studio.parameter.ParameterError; +import fr.proline.studio.rsmexplorer.gui.calc.graph.GraphConnector; + +/** + * + * @author JM235353 + */ +public interface CheckParameterInterface { + public ParameterError checkParameters(GraphConnector[] graphObjects); +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/parameters/FunctionParametersDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/parameters/FunctionParametersDialog.java index a9a10251c..fecc99d8f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/parameters/FunctionParametersDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/calc/parameters/FunctionParametersDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.calc.parameters; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddAggregateDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddAggregateDialog.java index 8ba7802e2..7de44c5aa 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddAggregateDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddAggregateDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddAggregatePanel.form b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddAggregatePanel.form deleted file mode 100644 index 4e9d1a772..000000000 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddAggregatePanel.form +++ /dev/null @@ -1,151 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddAggregatePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddAggregatePanel.java index 738f4c080..c49d1f6a9 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddAggregatePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddAggregatePanel.java @@ -1,27 +1,30 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import fr.proline.core.orm.uds.Aggregation; +import fr.proline.studio.utils.StudioResourceBundle; + import java.awt.Component; import java.awt.Container; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.ResourceBundle; import javax.swing.*; /** @@ -63,15 +66,15 @@ private void initComponents() { multipleAggregateCheckBox = new javax.swing.JCheckBox(); nbAggregateSpinner = new javax.swing.JSpinner(); - parameterPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(AddAggregatePanel.class, "AddAggregatePanel.parameterPanel.border.title"))); // NOI18N + parameterPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(StudioResourceBundle.getMessage(AddAggregatePanel.class, "AddAggregatePanel.parameterPanel.border.title"))); // NOI18N - nameLabel.setText(org.openide.util.NbBundle.getMessage(AddAggregatePanel.class, "AddAggregatePanel.nameLabel.text")); // NOI18N + nameLabel.setText(StudioResourceBundle.getMessage(AddAggregatePanel.class, "AddAggregatePanel.nameLabel.text")); // NOI18N - nameTextfield.setText(org.openide.util.NbBundle.getMessage(AddAggregatePanel.class, "AddAggregatePanel.nameTextfield.text")); // NOI18N + nameTextfield.setText(StudioResourceBundle.getMessage(AddAggregatePanel.class, "AddAggregatePanel.nameTextfield.text")); // NOI18N - typeLabel.setText(org.openide.util.NbBundle.getMessage(AddAggregatePanel.class, "AddAggregatePanel.typeLabel.text")); // NOI18N + typeLabel.setText(StudioResourceBundle.getMessage(AddAggregatePanel.class, "AddAggregatePanel.typeLabel.text")); // NOI18N - multipleAggregateCheckBox.setText(org.openide.util.NbBundle.getMessage(AddAggregatePanel.class, "AddAggregatePanel.multipleAggregateCheckBox.text")); // NOI18N + multipleAggregateCheckBox.setText(StudioResourceBundle.getMessage(AddAggregatePanel.class, "AddAggregatePanel.multipleAggregateCheckBox.text")); // NOI18N multipleAggregateCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multipleAggregateCheckBoxActionPerformed(evt); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddFolderDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddFolderDialog.java index 5975c6fe0..83c4e8a0d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddFolderDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddFolderDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddProjectDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddProjectDialog.java index f37cf943d..6e11c388e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddProjectDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/AddProjectDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ApplicationSettingsDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ApplicationSettingsDialog.java index f5b838787..35737f7e8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ApplicationSettingsDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ApplicationSettingsDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,7 @@ */ package fr.proline.studio.rsmexplorer.gui.dialog; +import fr.proline.studio.NbPreferences; import fr.proline.studio.dpm.task.util.JMSConnectionManager; import fr.proline.studio.graphics.PlotScatter; import fr.proline.studio.gui.AbstractParameterListTree; @@ -45,7 +46,6 @@ import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.ExpandVetoException; import javax.swing.tree.TreePath; -import org.openide.util.NbPreferences; import org.slf4j.LoggerFactory; /** @@ -353,6 +353,8 @@ private ParameterError checkExistingLists() { File f = new File(m_converterFilePath.getStringValue()); if (!f.exists() || !f.getAbsolutePath().endsWith("raw2mzDB.exe")) { ParameterError error = new ParameterError("The selected raw2mzDB.exe is not valid.", m_converterFilePath.getComponent()); + CardLayout cl = (CardLayout) (m_cards.getLayout()); + cl.show(m_cards, key); return error; } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/CalcDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/CalcDialog.java index 7e9f7b471..458407d28 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/CalcDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/CalcDialog.java @@ -1,23 +1,24 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; +import fr.proline.studio.WindowManager; import fr.proline.studio.id.ProjectId; import fr.proline.studio.pattern.WindowBox; import fr.proline.studio.pattern.WindowBoxFactory; @@ -30,7 +31,7 @@ import fr.proline.studio.python.interpreter.CalcInterpreterThread; import fr.proline.studio.python.interpreter.ResultVariable; import fr.proline.studio.rserver.dialog.ImageViewerTopComponent; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.gui.calc.DataTree; import fr.proline.studio.table.renderer.DefaultRightAlignRenderer; import fr.proline.studio.table.renderer.DoubleRenderer; @@ -87,7 +88,7 @@ import javax.swing.text.DefaultHighlighter; import javax.swing.text.Highlighter; import org.jdesktop.swingx.JXTable; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; import org.python.core.PyObject; @@ -265,15 +266,14 @@ public void mouseReleased(MouseEvent e) { long id = (projectId!=null) ? projectId.getId() : -1L; windowBox.setEntryData(id, model ); - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(windowBox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(windowBox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } else if (o instanceof PythonImage) { BufferedImage image = ((PythonImage) o).getImage(); ImageViewerTopComponent win = new ImageViewerTopComponent(resultVariable.getName(), image); - win.open(); - win.requestActive(); + WindowManager.getDefault().getMainWindow().displayWindow(win); + } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ChangePasswordDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ChangePasswordDialog.java index 1ff47294c..750787c3d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ChangePasswordDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ChangePasswordDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import fr.proline.studio.dpm.ServerConnectionManager; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ChangeTypicalProteinDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ChangeTypicalProteinDialog.java index b8d868fda..1859c65bb 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ChangeTypicalProteinDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ChangeTypicalProteinDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -22,7 +22,7 @@ import java.util.List; import javax.swing.JPanel; import javax.swing.JTextArea; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ChangeTypicalProteinPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ChangeTypicalProteinPanel.java index c98cb77d9..a4cdcbc09 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ChangeTypicalProteinPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ChangeTypicalProteinPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import fr.proline.studio.dpm.data.ChangeTypicalRule; @@ -24,7 +24,7 @@ import java.util.List; import java.util.prefs.Preferences; import javax.swing.*; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; /** * Panel to change the typical proteins of Protein Groups of Identification Results diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ClearProjectDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ClearProjectDialog.java index aaca7f4de..48ad78b7d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ClearProjectDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ClearProjectDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import fr.proline.core.orm.uds.Project; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ClearProjectPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ClearProjectPanel.java index 4ea37b7bf..41cecc50e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ClearProjectPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ClearProjectPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import fr.proline.studio.dam.data.ClearProjectData; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ConvertRawDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ConvertRawDialog.java index cd1a447fa..eaee821b3 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ConvertRawDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ConvertRawDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -60,7 +60,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.filechooser.FileNameExtensionFilter; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; /** * @@ -70,13 +70,13 @@ public class ConvertRawDialog extends DefaultDialog implements FileDialogInterfa private static ConvertRawDialog m_singletonNonConnectedDialog = null; private static ConvertRawDialog m_singletonConnectedDialog = null; - + private boolean m_serverConnected; private JList m_fileList; private JScrollPane m_fileListScrollPane; private JButton m_addFileButton, m_removeFileButton; private ParameterList m_parameterList; - private BooleanParameter m_deleteMzdb, m_deleteRaw, m_uploadMzdb, m_createParentDirectoryParameter; + private BooleanParameter m_deleteMzdb, m_deleteRaw, m_uploadMzdb, m_createParentDirectoryParameter, m_isConverter_v1; private FileParameter m_converterFilePath, m_outputFilePath; @@ -84,10 +84,10 @@ public class ConvertRawDialog extends DefaultDialog implements FileDialogInterfa private String m_lastParentDirectory; public static ConvertRawDialog getDialog(Window parent) { - + ArrayList labels = ServerFileSystemView.getServerFileSystemView().getLabels(RootInfo.TYPE_MZDB_FILES); boolean connectedToServer = (labels != null); - + if (connectedToServer) { if (m_singletonConnectedDialog == null) { m_singletonConnectedDialog = new ConvertRawDialog(parent, true); @@ -102,7 +102,7 @@ public static ConvertRawDialog getDialog(Window parent) { model.clear(); } } - + return m_singletonConnectedDialog; } else { if (m_singletonNonConnectedDialog == null) { @@ -115,19 +115,19 @@ public static ConvertRawDialog getDialog(Window parent) { model.clear(); } } - + return m_singletonNonConnectedDialog; } - + } private ConvertRawDialog(Window parent, boolean serverConnected) { super(parent, Dialog.ModalityType.MODELESS); m_serverConnected = serverConnected; - + setTitle("Convert raw file(s)"); setSize(new Dimension(360, 480)); @@ -185,31 +185,35 @@ private JPanel createParameterPanel() { m_outputFilePath.setDefaultDirectory(new File(preferences.get("mzDB_Settings.Output_Path", System.getProperty("user.home")))); m_parameterList.add(m_outputFilePath); + JCheckBox isConverterV1Checkbox = new JCheckBox("Converter version 1.1 or above"); + m_isConverter_v1 = new BooleanParameter("CONVERTER_V1", "Converter version is greater or equal to 1.1", isConverterV1Checkbox, false); + m_parameterList.add(m_isConverter_v1); + JCheckBox rawCheckbox = new JCheckBox("Delete raw file after a successful conversion"); m_deleteRaw = new BooleanParameter("DELETE_RAW", "Delete raw file after a successful conversion", rawCheckbox, false); m_parameterList.add(m_deleteRaw); - + if (m_serverConnected) { JCheckBox uploadCheckbox = new JCheckBox("Upload .mzdb file successful conversion"); m_uploadMzdb = new BooleanParameter("UPLOAD_CONVERTED", "Upload after conversion", uploadCheckbox, false); m_parameterList.add(m_uploadMzdb); - + ArrayList labels = ServerFileSystemView.getServerFileSystemView().getLabels(RootInfo.TYPE_MZDB_FILES); - + Object[] associatedTable = labels.toArray(new String[labels.size()]); Object[] objectTable = labels.toArray(new String[labels.size()]); JComboBox namingComboBox = new JComboBox(associatedTable); m_uploadLabelParameter = new ObjectParameter("MZDB_MOUNT_LABEL", "Server's mounting point", namingComboBox, associatedTable, objectTable, 0, null); m_parameterList.add(m_uploadLabelParameter); - + JCheckBox mzdbCheckbox = new JCheckBox("Delete .mzdb file after a successful upload"); m_deleteMzdb = new BooleanParameter("DELETE_MZDB", "Delete mzdb file after a successful upload", mzdbCheckbox, false); m_parameterList.add(m_deleteMzdb); - + JCheckBox parentDirectoryCheckbox = new JCheckBox("Create Parent Directory in Destination"); m_createParentDirectoryParameter = new BooleanParameter("CREATE_PARENT_DIRECTORY", "Create Parent Directory in Destination", parentDirectoryCheckbox, false); m_parameterList.add(m_createParentDirectoryParameter); @@ -239,7 +243,7 @@ public void valueChanged(String value, Object associatedValue) { if (m_serverConnected) { m_uploadMzdb.addLinkedParameters(linkedParameters); } - + return parameterPanel; } @@ -395,7 +399,7 @@ protected boolean okCalled() { File file = (File) m_fileList.getModel().getElementAt(i); - ConversionSettings conversionSettings = new ConversionSettings(m_converterFilePath.getStringValue(), m_outputFilePath.getStringValue(), (boolean) m_deleteRaw.getObjectValue(), (m_serverConnected) ? (boolean) m_uploadMzdb.getObjectValue() : false); + ConversionSettings conversionSettings = new ConversionSettings(m_converterFilePath.getStringValue(), m_outputFilePath.getStringValue(), (boolean) m_deleteRaw.getObjectValue(), (m_serverConnected) ? (boolean) m_uploadMzdb.getObjectValue() : false, (boolean) m_isConverter_v1.getObjectValue()); if(conversionSettings.getUploadAfterConversion()){ MzdbUploadSettings uploadSettings = new MzdbUploadSettings((boolean) m_deleteMzdb.getObjectValue(), m_uploadLabelParameter.getStringValue(), (boolean) m_createParentDirectoryParameter.getObjectValue() ? File.separator + file.getParentFile().getName() : ""); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/DataBoxChooserDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/DataBoxChooserDialog.java index 24021264b..6233d93c6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/DataBoxChooserDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/DataBoxChooserDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/DefaultConverterDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/DefaultConverterDialog.java index 8fb713108..75c1339e8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/DefaultConverterDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/DefaultConverterDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import fr.proline.studio.gui.DefaultDialog; @@ -34,7 +34,7 @@ import javax.swing.JFileChooser; import javax.swing.JPanel; import javax.swing.JTextField; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; import org.slf4j.LoggerFactory; /** diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/DefaultDialogInterface.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/DefaultDialogInterface.java index 777901484..8ee7a7be2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/DefaultDialogInterface.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/DefaultDialogInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import java.awt.Component; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FileDialogInterface.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FileDialogInterface.java index 973cc94af..17f3f38a5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FileDialogInterface.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FileDialogInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,17 +14,17 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.rsmexplorer.gui.dialog; - -import java.io.File; -import java.util.ArrayList; - -/** - * - * @author AK249877 - */ -public interface FileDialogInterface { - - public void setFiles(ArrayList files); - -} +package fr.proline.studio.rsmexplorer.gui.dialog; + +import java.io.File; +import java.util.ArrayList; + +/** + * + * @author AK249877 + */ +public interface FileDialogInterface { + + public void setFiles(ArrayList files); + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FilterProtSetDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FilterProtSetDialog.java index b1ba82a42..f103f2573 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FilterProtSetDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FilterProtSetDialog.java @@ -1,208 +1,171 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.gui.dialog; - -import fr.proline.studio.gui.DefaultDialog; -import fr.proline.studio.parameter.AbstractParameter; -import fr.proline.studio.parameter.ParameterError; -import fr.proline.studio.parameter.ParameterList; -import fr.proline.studio.parameter.ParametersComboPanel; -import fr.proline.studio.settings.FilePreferences; -import fr.proline.studio.settings.SettingsDialog; -import fr.proline.studio.settings.SettingsUtils; -import org.openide.util.NbPreferences; -import org.slf4j.LoggerFactory; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; -import java.io.File; -import java.util.HashMap; -import java.util.prefs.Preferences; - -/** - * - * @author VD225637 - */ -public class FilterProtSetDialog extends DefaultDialog implements ComponentListener { - - private static FilterProtSetDialog m_singletonDialog = null; - - private ParameterList m_parameterList; - private AbstractParameter[] m_proteinFilterParameters; - private ParametersComboPanel m_proteinPrefiltersPanel; - - private final static String SETTINGS_KEY = "ProtSetFiltering"; - - public static FilterProtSetDialog getDialog(Window parent) { - if (m_singletonDialog == null) { - m_singletonDialog = new FilterProtSetDialog(parent); - } - return m_singletonDialog; - } - - public FilterProtSetDialog(Window parent) { - super(parent, Dialog.ModalityType.APPLICATION_MODAL); - setTitle("ProteinSet Filtering"); - - setDocumentationSuffix("id.2lwamvv"); - - setButtonVisible(BUTTON_LOAD, true); - setButtonVisible(BUTTON_SAVE, true); - - m_parameterList = new ParameterList("ProtSet Filtering"); - m_proteinFilterParameters = FilterProteinSetPanel.createProteinSetFilterParameters("", m_parameterList); - m_parameterList.updateValues(NbPreferences.root()); - - setInternalComponent(createInternalPanel()); - -// m_proteinPrefiltersPanel.initProteinFilterPanel(); - - } - - private JPanel createInternalPanel() { - - JPanel internalPanel = new JPanel(new GridBagLayout()); - - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - c.gridx = 0; - c.gridy = 0; - c.weightx = 1.0; - m_proteinPrefiltersPanel = new ParametersComboPanel(" Filter(s) ", m_proteinFilterParameters); - m_proteinPrefiltersPanel.addComponentListener((ComponentListener) this); - internalPanel.add(m_proteinPrefiltersPanel, c); - - return internalPanel; - } - - public HashMap getArguments() { - return m_parameterList.getValues(); - } - - @Override - protected boolean okCalled() { - - // check parameters - if (!checkParameters()) { - return false; - } - - // save parameters - Preferences preferences = NbPreferences.root(); - saveParameters(preferences); - - return true; - } - - private void saveParameters(Preferences preferences) { - // Save Parameters - m_parameterList.saveParameters(preferences); - - } - - private boolean checkParameters() { - // check parameters - ParameterError error = m_parameterList.checkParameters(); - if (error != null) { - setStatus(true, error.getErrorMessage()); - highlight(error.getParameterComponent()); - return false; - } - return true; - } - - @Override - protected boolean saveCalled() { - // check parameters - if (!checkParameters()) { - return false; - } - - JFileChooser fileChooser = SettingsUtils.getFileChooser(SETTINGS_KEY); - int result = fileChooser.showSaveDialog(this); - if (result == JFileChooser.APPROVE_OPTION) { - File f = fileChooser.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(f, null, ""); - - saveParameters(filePreferences); - - SettingsUtils.addSettingsPath(SETTINGS_KEY, f.getAbsolutePath()); - SettingsUtils.writeDefaultDirectory(SETTINGS_KEY, f.getParent()); - } - return false; - } - - @Override - protected boolean loadCalled() { - - SettingsDialog settingsDialog = new SettingsDialog(this, SETTINGS_KEY); - settingsDialog.setLocationRelativeTo(this); - settingsDialog.setVisible(true); - - if (settingsDialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { - if (settingsDialog.isDefaultSettingsSelected()) { - m_parameterList.initDefaults(); - } else { - try { - File settingsFile = settingsDialog.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(settingsFile, null, ""); - - Preferences preferences = NbPreferences.root(); - String[] keys = filePreferences.keys(); - for (String key : keys) { - String value = filePreferences.get(key, null); - preferences.put(key, value); - } - - m_parameterList.loadParameters(filePreferences); - m_proteinPrefiltersPanel.updatePanel(); - - } catch (Exception e) { - LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Parsing of User Settings File Failed", e); - setStatus(true, "Parsing of your Settings File failed"); - } - } - } - - return false; - } - - @Override - public void componentResized(ComponentEvent e) { - repack(); - } - - @Override - public void componentMoved(ComponentEvent e) { - - } - - @Override - public void componentShown(ComponentEvent e) { - } - - @Override - public void componentHidden(ComponentEvent e) { - - } - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.gui.dialog; + +import fr.proline.studio.NbPreferences; +import fr.proline.studio.gui.DefaultStorableDialog; +import fr.proline.studio.parameter.*; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; +import java.util.HashMap; +import java.util.prefs.Preferences; + + +/** + * + * @author VD225637 + */ +public class FilterProtSetDialog extends DefaultStorableDialog implements ComponentListener { + + private static FilterProtSetDialog m_singletonDialog = null; + + private ParameterList m_parameterList; + private AbstractParameter[] m_proteinFilterParameters; + private ParametersComboPanel m_proteinPrefiltersPanel; + + private final static String SETTINGS_KEY = "ProtSetFiltering"; + + public static FilterProtSetDialog getDialog(Window parent) { + if (m_singletonDialog == null) { + m_singletonDialog = new FilterProtSetDialog(parent); + } + return m_singletonDialog; + } + + public FilterProtSetDialog(Window parent) { + super(parent, Dialog.ModalityType.APPLICATION_MODAL); + setTitle("ProteinSet Filtering"); + + setDocumentationSuffix("id.2lwamvv"); + + m_parameterList = new ParameterList("ProtSet Filtering"); + m_proteinFilterParameters = FilterProteinSetPanel.createProteinSetFilterParameters("", m_parameterList); + m_parameterList.updateValues(NbPreferences.root()); + + setInternalComponent(createInternalPanel()); + +// m_proteinPrefiltersPanel.initProteinFilterPanel(); + + } + + private JPanel createInternalPanel() { + + JPanel internalPanel = new JPanel(new GridBagLayout()); + + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.insets = new java.awt.Insets(5, 5, 5, 5); + + c.gridx = 0; + c.gridy = 0; + c.weightx = 1.0; + m_proteinPrefiltersPanel = new ParametersComboPanel(" Filter(s) ", m_proteinFilterParameters); + m_proteinPrefiltersPanel.addComponentListener( this); + internalPanel.add(m_proteinPrefiltersPanel, c); + + return internalPanel; + } + + public HashMap getArguments() { + return m_parameterList.getValues(); + } + + @Override + protected boolean okCalled() { + + // check parameters + if (!checkParameters()) { + return false; + } + + // save parameters + Preferences preferences = NbPreferences.root(); + saveParameters(preferences); + + return true; + } + + /*** DefaultStorableDialog Abstract methods ***/ + + @Override + protected String getSettingsKey() { + return SETTINGS_KEY; + } + + @Override + protected void saveParameters(Preferences preferences) { + // Save Parameters + m_parameterList.saveParameters(preferences); + + } + + @Override + protected boolean checkParameters() { + // check parameters + ParameterError error = m_parameterList.checkParameters(); + if (error != null) { + setStatus(true, error.getErrorMessage()); + highlight(error.getParameterComponent()); + return false; + } + return true; + } + + @Override + protected void resetParameters() { + m_parameterList.initDefaults(); + m_proteinPrefiltersPanel.clearPanel(); + } + + @Override + protected void loadParameters(Preferences filePreferences) throws Exception { + Preferences preferences = NbPreferences.root(); + String[] keys = filePreferences.keys(); + for (String key : keys) { + String value = filePreferences.get(key, null); + preferences.put(key, value); + } + + m_parameterList.loadParameters(filePreferences); + m_proteinPrefiltersPanel.updatePanel(); + } + + + @Override + public void componentResized(ComponentEvent e) { + repack(); + } + + @Override + public void componentMoved(ComponentEvent e) { + + } + + @Override + public void componentShown(ComponentEvent e) { + } + + @Override + public void componentHidden(ComponentEvent e) { + + } + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FilterProteinSetPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FilterProteinSetPanel.java index 62b6682c0..be3e435e4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FilterProteinSetPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FilterProteinSetPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FragmentationRuleSetViewer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FragmentationRuleSetViewer.java index 2e0edaaad..ffaebe020 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FragmentationRuleSetViewer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/FragmentationRuleSetViewer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/GenerateSpectrumMatchesDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/GenerateSpectrumMatchesDialog.java index 922f12c7d..98a6e8525 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/GenerateSpectrumMatchesDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/GenerateSpectrumMatchesDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -29,7 +29,9 @@ import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -50,12 +52,27 @@ public class GenerateSpectrumMatchesDialog extends DefaultDialog { private JComboBox m_fragmentationRuleSetsComboBox = null; private JCheckBox m_forceGenerateChB = null; private JCheckBox m_useDefinedFRSChB = null; + + private List m_msiSearches = null; + private boolean oneMerged = false; + + public GenerateSpectrumMatchesDialog(Window parent, MsiSearch msiSearch){ + super(parent, Dialog.ModalityType.APPLICATION_MODAL); + m_msiSearches = Collections.singletonList(msiSearch); + + initDialog(); + } - private List m_datasets = null; - - public GenerateSpectrumMatchesDialog(Window parent){ + public GenerateSpectrumMatchesDialog(Window parent, List allDSs){ super(parent, Dialog.ModalityType.APPLICATION_MODAL); - + if(allDSs != null && !allDSs.isEmpty()) { + m_msiSearches = allDSs.stream().map(ds -> ds.getResultSet().getMsiSearch()).collect(Collectors.toList()); + oneMerged = allDSs.stream().filter(ds -> !DDatasetType.AggregationInformation.NONE.equals(ds.getAggregationInformation())).count() > 0; + } + initDialog(); + } + + private void initDialog(){ setTitle("Generate Spectrum Matches"); setDocumentationSuffix("id.1idq7dh"); setHelpHeaderText("Choose Fragmentation Rule Set that will be used to generate spectrum matches.
" + @@ -63,12 +80,7 @@ public GenerateSpectrumMatchesDialog(Window parent){ initInternalPanel(); pack(); } - - public GenerateSpectrumMatchesDialog(Window parent, List allDSs){ - this(parent); - m_datasets = allDSs; - } - + private void initInternalPanel() { JPanel internalPanel = new JPanel(); @@ -157,26 +169,20 @@ private String getFragmentationRuleSetsLabel(){ StringBuilder sb = new StringBuilder(); boolean oneNull = false; boolean oneNotNull = false; - boolean oneMerged = false; - if (m_datasets == null || m_datasets.isEmpty()) //from specific pepMatch. TODO Get DS informatoin ? + if (m_msiSearches == null || m_msiSearches.isEmpty()) return "unknown - see dataset properties"; - for (DDataset ds : m_datasets){ - if(!DDatasetType.AggregationInformation.NONE.equals(ds.getAggregationInformation())) - oneMerged = true; + for (MsiSearch msiSearch : m_msiSearches){ + if(msiSearch == null) + oneNull = true; else { - MsiSearch msiSearch = ds.getResultSet().getMsiSearch(); - if(msiSearch == null) + FragmentationRuleSet fragSet = DatabaseDataManager.getDatabaseDataManager().getFragmentationRuleSet(msiSearch.getSearchSetting().getFragmentationRuleSetId()); + if (fragSet == null) oneNull = true; else { - FragmentationRuleSet fragSet = DatabaseDataManager.getDatabaseDataManager().getFragmentationRuleSet(msiSearch.getSearchSetting().getFragmentationRuleSetId()); - if(fragSet == null) - oneNull = true; - else { - if(oneNotNull) - sb.append(", "); - sb.append(fragSet.getName()); - oneNotNull = true; - } + if (oneNotNull) + sb.append(", "); + sb.append(fragSet.getName()); + oneNotNull = true; } } } @@ -196,7 +202,7 @@ private String getFragmentationRuleSetsLabel(){ @Override protected boolean okCalled() { - if(!m_useDefinedFRSChB.isSelected() && (FragmentationRuleSet) m_fragmentationRuleSetsComboBox.getSelectedItem()==null){ + if(!m_useDefinedFRSChB.isSelected() && m_fragmentationRuleSetsComboBox.getSelectedItem() ==null){ setStatus(true, "A Fragmentation Rule Set should be selected"); highlight(m_fragmentationRuleSetsComboBox); return false; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/GetSystemInfoButtonAction.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/GetSystemInfoButtonAction.java index 15bb2e864..3b50dc0fe 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/GetSystemInfoButtonAction.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/GetSystemInfoButtonAction.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -20,7 +20,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/HelpDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/HelpDialog.java index 9b150dc78..3f4f34a09 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/HelpDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/HelpDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -29,7 +29,7 @@ import javax.swing.*; import javax.swing.tree.*; import org.slf4j.LoggerFactory; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; /** * Help Dialog with links to the how to sections diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/IdentifyPtmSitesDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/IdentifyPtmSitesDialog.java index 98bdc2a48..8271d0ceb 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/IdentifyPtmSitesDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/IdentifyPtmSitesDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -23,15 +23,16 @@ import java.awt.*; import java.util.ArrayList; import java.util.Comparator; +import java.util.HashMap; import java.util.List; import java.util.stream.Collectors; public class IdentifyPtmSitesDialog extends DefaultDialog { - private List m_ptms; + private final List m_ptms; private List m_selectedPtms; - + private HashMap m_ptmsByFullName; private JLabel m_clusteringMethod; private JRadioButton m_clusterizePartiallyIsomorph; private JRadioButton m_clusterizeIsomorphOnly; @@ -46,14 +47,22 @@ public IdentifyPtmSitesDialog(Window parent, List ptms) { setHelpHeaderText("Select the list of modifications of interest
" + "(other modifications will be ignored during clustering) and set
" + "the method's parameters that will be used to clusterize modification sites."); + + initPTMsList(); initInternalPanel(); - pack(); + //pack(); + setResizable(true); } - private void initInternalPanel() { + private void initPTMsList(){ + m_selectedPtms = new ArrayList<>(m_ptms); + m_ptmsByFullName = new HashMap<>(); + m_ptms.forEach((nextPtm) -> { + m_ptmsByFullName.put(nextPtm.getFullName(),nextPtm); + }); + } - JPanel parametersPanel = new JPanel(); - parametersPanel.setLayout(new java.awt.GridBagLayout()); + private void initInternalPanel() { JPanel clusteringMethodPanel = new JPanel(new GridBagLayout()); clusteringMethodPanel.setBorder(BorderFactory.createTitledBorder("Clustering method")); @@ -85,8 +94,11 @@ private void initInternalPanel() { m_clusterizePartiallyIsomorph.setSelected(true); + JPanel parametersPanel = new JPanel(); + parametersPanel.setLayout(new java.awt.GridBagLayout()); + JPanel ptmOIPanel = new JPanel(new GridBagLayout()); - ptmOIPanel.setBorder(BorderFactory.createTitledBorder("PTMs of interest")); + //ptmOIPanel.setBorder(BorderFactory.createTitledBorder("PTMs of interest")); c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; @@ -94,19 +106,39 @@ private void initInternalPanel() { c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new java.awt.Insets(5, 15, 5, 5); + + final JCheckBox allSelectedChkBox = new JCheckBox("select/unselect all",true); + allSelectedChkBox.addActionListener(evt -> { + boolean isSelectAll = ((JCheckBox) evt.getSource()).isSelected(); + if (ptmOIPanel.getComponentCount() > 0) { + Component[] allCompo = ptmOIPanel.getComponents(); + for (int i = 0; i < allCompo.length; i++) { + if (JCheckBox.class.isInstance(allCompo[i])) { + String fullName = ((JCheckBox) allCompo[i]).getText(); + ((JCheckBox) allCompo[i]).setSelected(isSelectAll); + Ptm ptm = m_ptmsByFullName.get(fullName); + setPTMSelectStatus(ptm, isSelectAll); + } + } + } + }); + ptmOIPanel.add(allSelectedChkBox, c); + c.gridx++; + for (Ptm ptm : m_ptms) { JCheckBox checkbox = new JCheckBox(ptm.getFullName(), true); checkbox.addActionListener(evt -> { - if (((JCheckBox)evt.getSource()).isSelected()) { - m_selectedPtms.add(ptm); - } else { - m_selectedPtms.remove(ptm); - } + setPTMSelectStatus(ptm, ((JCheckBox)evt.getSource()).isSelected()); }); ptmOIPanel.add(checkbox, c); c.gridy++; } + JScrollPane m_scrollPane = new JScrollPane(); + m_scrollPane.setBorder(BorderFactory.createTitledBorder("PTMs of interest")); + m_scrollPane.setViewportView(ptmOIPanel); + m_scrollPane.createVerticalScrollBar(); + c = new GridBagConstraints(); c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.HORIZONTAL; @@ -116,11 +148,19 @@ private void initInternalPanel() { parametersPanel.add(clusteringMethodPanel, c); c.gridy++; - parametersPanel.add(ptmOIPanel, c); + c.weighty=1; + c.fill = GridBagConstraints.BOTH; + parametersPanel.add(m_scrollPane, c); - JPanel internalPanel = new JPanel(new BorderLayout()); - internalPanel.add(parametersPanel, BorderLayout.CENTER); - setInternalComponent(internalPanel); + setInternalComponent(parametersPanel); + } + + private void setPTMSelectStatus(Ptm ptm, boolean selectStatus){ + if (selectStatus) { + m_selectedPtms.add(ptm); + } else { + m_selectedPtms.remove(ptm); + } } public List getPtms() { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportIdentificationDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportIdentificationDialog.java index 9029db812..a9e59b270 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportIdentificationDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportIdentificationDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,40 +16,34 @@ */ package fr.proline.studio.rsmexplorer.gui.dialog; -import fr.proline.core.orm.uds.InstrumentConfiguration; import fr.proline.core.orm.uds.FragmentationRuleSet; +import fr.proline.core.orm.uds.InstrumentConfiguration; import fr.proline.core.orm.uds.PeaklistSoftware; +import fr.proline.studio.NbPreferences; import fr.proline.studio.dam.DatabaseDataManager; import fr.proline.studio.dpm.serverfilesystem.RootInfo; import fr.proline.studio.dpm.serverfilesystem.ServerFile; import fr.proline.studio.dpm.serverfilesystem.ServerFileSystemView; import fr.proline.studio.gui.DefaultDialog; +import fr.proline.studio.gui.DefaultStorableDialog; import fr.proline.studio.gui.InfoDialog; -import fr.proline.studio.gui.OptionDialog; import fr.proline.studio.parameter.*; -import fr.proline.studio.progress.ProgressInterface; -import fr.proline.studio.settings.FilePreferences; -import fr.proline.studio.settings.SettingsDialog; -import fr.proline.studio.settings.SettingsUtils; import fr.proline.studio.utils.IconManager; +import org.slf4j.LoggerFactory; + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.File; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.Iterator; -import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; import java.util.List; +import java.util.*; import java.util.prefs.Preferences; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import org.openide.util.NbPreferences; -import org.slf4j.LoggerFactory; /** * @@ -59,7 +53,7 @@ * * @author jm235353 */ -public class ImportIdentificationDialog extends DefaultDialog { +public class ImportIdentificationDialog extends DefaultStorableDialog { private static ImportIdentificationDialog m_singletonDialog = null; @@ -91,7 +85,6 @@ public class ImportIdentificationDialog extends DefaultDialog { private final static String SETTINGS_KEY = "ImporteIdentification"; private JList m_fileList; - private JScrollPane m_fileListScrollPane; private JButton m_addFileButton; private JButton m_removeFileButton; @@ -104,7 +97,7 @@ public class ImportIdentificationDialog extends DefaultDialog { private JComboBox m_instrumentsComboBox = null; private JComboBox m_fragmentationRuleSetsComboBox = null; private JComboBox m_peaklistSoftwaresComboBox = null; - //private JCheckBox m_saveSpectrumCheckBox ; + private JComboBox m_decoyComboBox = null; private JLabel m_decoyAccessionRegexLabel = null; private JTextField m_decoyRegexTextField = null; @@ -133,9 +126,6 @@ private ImportIdentificationDialog(Window parent) { setDocumentationSuffix("id.147n2zr"); - setButtonVisible(BUTTON_LOAD, true); - setButtonVisible(BUTTON_SAVE, true); - setResizable(true); setMinimumSize(new Dimension(200, 240)); @@ -144,6 +134,85 @@ private ImportIdentificationDialog(Window parent) { restoreInitialParameters(NbPreferences.root()); } + /*** DefaultStorableDialog Abstract methods ***/ + + @Override + protected String getSettingsKey() { + return SETTINGS_KEY; + } + + + @Override + protected void resetParameters() throws Exception { + ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); + parameterList.initDefaults(); + } + + @Override + protected void loadParameters(Preferences filePreferences) throws Exception { + + Preferences preferences = NbPreferences.root(); + String[] keys = filePreferences.keys(); + for (int i = 0; i < keys.length; i++) { + String key = keys[i]; + String value = filePreferences.get(key, null); + preferences.put(key, value); + } + + restoreInitialParameters(preferences); + + ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); + parameterList.loadParameters(filePreferences); + m_sourceParameterList.loadParameters(filePreferences); + } + + @Override + protected void saveParameters(Preferences preferences) { + + ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); + + // save parser + String parserSelected = parameterList.toString(); + preferences.put("IdentificationParser", parserSelected); + + // save file path + if (m_defaultDirectory != null) { + preferences.put("IdentificationFilePath", m_defaultDirectory.getAbsolutePath()); + } + + // Save Other Parameters + m_sourceParameterList.saveParameters(preferences); + parameterList.saveParameters(preferences); + + if (m_decoyRegexTextField.isEnabled()) { + ArrayList regexArrayList = readRegexArray(m_decoyRegexTextField.getText()); + writeRegexArray(preferences, regexArrayList); + } + + } + + @Override + protected boolean checkParameters() { + ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); + + // check source parameters + ParameterError error = m_sourceParameterList.checkParameters(); + + // check specific parameters + if (error == null) { + error = parameterList.checkParameters(); + } + + // report error + if (error != null) { + setStatus(true, error.getErrorMessage()); + highlight(error.getParameterComponent()); + return false; + } + + return true; + } + private void initInternalPanel() { JPanel internalPanel = new JPanel(); @@ -220,7 +289,7 @@ private JPanel createFileSelectionPanel() { fileSelectionPanel.setBorder(BorderFactory.createTitledBorder(" Files Selection ")); m_fileList = new JList<>(new DefaultListModel()); - m_fileListScrollPane = new JScrollPane(m_fileList) { + JScrollPane m_fileListScrollPane = new JScrollPane(m_fileList) { private Dimension preferredSize = new Dimension(360, 200); @@ -279,7 +348,7 @@ public void actionPerformed(ActionEvent e) { LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Server has returned no Root Path for Result Files. There is a problem with the server installation, please contact your administrator."); InfoDialog errorDialog = new InfoDialog(m_singletonDialog, InfoDialog.InfoType.WARNING, "Root Path Error", "Server has returned no Root Path for Result Files.\nThere is a problem with the server installation, please contact your administrator."); - errorDialog.setButtonVisible(OptionDialog.BUTTON_CANCEL, false); + errorDialog.setButtonVisible(DefaultDialog.BUTTON_CANCEL, false); errorDialog.setLocationRelativeTo(m_singletonDialog); errorDialog.setVisible(true); return; @@ -588,25 +657,6 @@ public void actionPerformed(ActionEvent e) { return decoyPanel; } - /*private JPanel createSaveSpectrumPanel() { - - JPanel saveSpectrumPanel = new JPanel(new GridBagLayout()); - - - - // Placement of Objects for Parser Panel - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - // c.gridx = 0; - // c.gridy = 0; - // c.weightx = 1; - // saveSpectrumPanel.add(m_saveSpectrumCheckBox, c); - - return saveSpectrumPanel; - }*/ private ArrayList readRegexArray(String regexToAdd) { ArrayList regexArrayList = new ArrayList(); @@ -766,67 +816,6 @@ protected boolean cancelCalled() { return true; } - @Override - protected boolean saveCalled() { - // check parameters - if (!checkParametersForSave()) { - return false; - } - - JFileChooser fileChooser = SettingsUtils.getFileChooser(SETTINGS_KEY); - int result = fileChooser.showSaveDialog(this); - if (result == JFileChooser.APPROVE_OPTION) { - File f = fileChooser.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(f, null, ""); - - saveParameters(filePreferences); - - SettingsUtils.addSettingsPath(SETTINGS_KEY, f.getAbsolutePath()); - SettingsUtils.writeDefaultDirectory(SETTINGS_KEY, f.getParent()); - } - - return false; - } - - @Override - protected boolean loadCalled() { - - SettingsDialog settingsDialog = new SettingsDialog(this, SETTINGS_KEY); - settingsDialog.setLocationRelativeTo(this); - settingsDialog.setVisible(true); - - if (settingsDialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { - if (settingsDialog.isDefaultSettingsSelected()) { - ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); - parameterList.initDefaults(); - } else { - try { - File settingsFile = settingsDialog.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(settingsFile, null, ""); - - Preferences preferences = NbPreferences.root(); - String[] keys = filePreferences.keys(); - for (int i = 0; i < keys.length; i++) { - String key = keys[i]; - String value = filePreferences.get(key, null); - preferences.put(key, value); - } - - restoreInitialParameters(preferences); - - ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); - parameterList.loadParameters(filePreferences); - m_sourceParameterList.loadParameters(filePreferences); - - } catch (Exception e) { - LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Parsing of User Settings File Failed", e); - setStatus(true, "Parsing of your Settings File failed"); - } - } - } - - return false; - } private boolean checkParametersForOK() { // check files selected @@ -837,54 +826,9 @@ private boolean checkParametersForOK() { return false; } - return checkParametersForSave(); + return checkParameters(); } - private boolean checkParametersForSave() { - - ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); - - // check source parameters - ParameterError error = m_sourceParameterList.checkParameters(); - - // check specific parameters - if (error == null) { - error = parameterList.checkParameters(); - } - - // report error - if (error != null) { - setStatus(true, error.getErrorMessage()); - highlight(error.getParameterComponent()); - return false; - } - - return true; - } - - private void saveParameters(Preferences preferences) { - - ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); - - // save parser - String parserSelected = parameterList.toString(); - preferences.put("IdentificationParser", parserSelected); - - // save file path - if (m_defaultDirectory != null) { - preferences.put("IdentificationFilePath", m_defaultDirectory.getAbsolutePath()); - } - - // Save Other Parameters - m_sourceParameterList.saveParameters(preferences); - parameterList.saveParameters(preferences); - - if (m_decoyRegexTextField.isEnabled()) { - ArrayList regexArrayList = readRegexArray(m_decoyRegexTextField.getText()); - writeRegexArray(preferences, regexArrayList); - } - - } private void restoreInitialParameters(Preferences preferences) { String parser = preferences.get("IdentificationParser", null); @@ -970,11 +914,7 @@ public long getFragmentationRuleSetId() { return fragmentationRuleSet.getId(); } -// public boolean getSaveSpectrumMatches() { -//// return m_saveSpectrumCheckBox.isEnabled() && m_saveSpectrumCheckBox.isSelected(); -// // return false for mascot result files, true otherwise -// return (m_parserComboBox.getSelectedItem().toString().compareTo(MASCOT_PARSER) != 0); -// } + public String getParserId() { return PARSER_IDS[m_parserComboBox.getSelectedIndex()]; } @@ -997,9 +937,7 @@ private ParameterList[] createParameters() { private ParameterList createMascotParser() { ParameterList parameterList = new ParameterList(MASCOT_PARSER); -// parameterList.add(new DoubleParameter("ion.score.cutoff", "Ion Score Cutoff", JTextField.class, new Double(0.0), new Double(0), null)); parameterList.add(new DoubleParameter("subset.threshold", "Subset Threshold", JTextField.class, new Double(1.0), new Double(0), new Double(1))); -// parameterList.add(new StringParameter("mascot.server.url", "Mascot Server URL (including /cgi/)", JTextField.class, "http://www.matrixscience.com/cgi/", null, null)); return parameterList; } @@ -1016,8 +954,6 @@ private ParameterList createOmssaParser() { String[] fileFilterNames2 = {"PTM composition File"}; String[] fileFilterExtensions2 = {"txt"}; parameterList.add(new FileParameter(ServerFileSystemView.getServerFileSystemView(), "ptm.composition.file", "PTM composition file path", JTextField.class, preferences.get("Omssa_Parser.PTM_composition_file_path", ""), fileFilterNames2, fileFilterExtensions2)); -// parameterList.add(new BooleanParameter("fasta.contains.target", "Fasta contains target entries", JCheckBox.class, Boolean.TRUE)); -// parameterList.add(new BooleanParameter("fasta.contains.decoy", "Fasta contains decoy entries", JCheckBox.class, Boolean.TRUE)); return parameterList; } @@ -1119,9 +1055,6 @@ public void actionPerformed(ActionEvent e) { m_decoyRegexParameter.setCompulsory(false); parameterList.add(m_decoyRegexParameter); -// BooleanParameter saveSpectrumParameter = new BooleanParameter("save_spectrum_matches", "Save Spectrum Matches", JCheckBox.class, Boolean.FALSE); -// m_saveSpectrumCheckBox = (JCheckBox) saveSpectrumParameter.getComponent(null); -// parameterList.add(saveSpectrumParameter); return parameterList; } @@ -1308,23 +1241,4 @@ public ArrayList getRegexArrayList() { } } - public class CertifyIdentificationProgress implements ProgressInterface { - - private boolean m_isLoaded = false; - - @Override - public boolean isLoaded() { - return m_isLoaded; - } - - @Override - public int getLoadingPercentage() { - return 0; // progress bar displayed as a waiting bar - } - - public void setLoaded() { - m_isLoaded = true; - } - }; - } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportIdentificationDialogUpdated.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportIdentificationDialogUpdated.java deleted file mode 100644 index 06be8cce5..000000000 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportIdentificationDialogUpdated.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.gui.dialog; - -import fr.proline.studio.gui.DefaultDialog; -import java.awt.*; -import java.io.File; -import java.io.IOException; - -/** - * - * Dialog used to start the import of identifications by selecting multiple - * files, a parser and its parameters. The fields are filled with last used - * parameters. If they not exist, these fields are filled with default values. - * - * @author jm235353 - */ -public class ImportIdentificationDialogUpdated extends DefaultDialog implements DefaultDialogInterface { - - private static ImportIdentificationDialogUpdated m_singletonDialog = null; - private ImportIdentificationPanel m_identificationPanel; - - public static ImportIdentificationDialogUpdated getDialog(Window parent/*, long projectId*/) { - - if (m_singletonDialog == null) { - m_singletonDialog = new ImportIdentificationDialogUpdated(parent); - } - - m_singletonDialog.reinitialize(); - - return m_singletonDialog; - } - - private ImportIdentificationDialogUpdated(Window parent) { - super(parent, Dialog.ModalityType.APPLICATION_MODAL); - - m_identificationPanel = new ImportIdentificationPanel(parent); - - setTitle("Import Search Results"); - - setDocumentationSuffix("id.319y80a "); - - setButtonVisible(BUTTON_LOAD, true); - setButtonVisible(BUTTON_SAVE, true); - - setResizable(true); - setMinimumSize(new Dimension(200, 240)); - - setInternalComponent(m_identificationPanel); - m_identificationPanel.setDialog(this); - - } - - private void reinitialize() { - m_identificationPanel.reinitializePanel(); - } - - @Override - protected boolean okCalled() { - return m_identificationPanel.okTriggered(); - } - - @Override - protected boolean cancelCalled() { - return m_identificationPanel.cancelTriggered(); - } - - @Override - protected boolean saveCalled() { - return m_identificationPanel.saveTriggered(); - } - - @Override - protected boolean loadCalled() { - return m_identificationPanel.loadTriggered(); - } - - @Override - public void setDialogStatus(boolean b, String s) { - setStatus(b, s); - } - - @Override - public void highlightPanelComponent(Component c) { - highlight(c); - } - - @Override - public void provokeRepack() { - this.repack(); - } - - @Override - public void provokeBusy(boolean b) { - ; - } - -} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportIdentificationPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportIdentificationPanel.java deleted file mode 100644 index b6334b4c3..000000000 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportIdentificationPanel.java +++ /dev/null @@ -1,1205 +0,0 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.gui.dialog; - -import fr.proline.core.orm.uds.InstrumentConfiguration; -import fr.proline.core.orm.uds.PeaklistSoftware; -import fr.proline.studio.dam.DatabaseDataManager; -import fr.proline.studio.dpm.serverfilesystem.RootInfo; -import fr.proline.studio.dpm.serverfilesystem.ServerFile; -import fr.proline.studio.dpm.serverfilesystem.ServerFileSystemView; -import fr.proline.studio.gui.DefaultDialog; -import fr.proline.studio.gui.InfoDialog; -import fr.proline.studio.gui.OptionDialog; -import fr.proline.studio.parameter.AbstractParameterToString; -import fr.proline.studio.parameter.DoubleParameter; -import fr.proline.studio.parameter.FileParameter; -import fr.proline.studio.parameter.ObjectParameter; -import fr.proline.studio.parameter.ParameterError; -import fr.proline.studio.parameter.ParameterList; -import fr.proline.studio.parameter.StringParameter; -import fr.proline.studio.progress.ProgressInterface; -import fr.proline.studio.settings.FilePreferences; -import fr.proline.studio.settings.SettingsDialog; -import fr.proline.studio.settings.SettingsUtils; -import fr.proline.studio.utils.IconManager; -import java.awt.BorderLayout; -import java.awt.Dialog; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Window; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.prefs.Preferences; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JFileChooser; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextField; -import javax.swing.SwingConstants; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.filechooser.FileNameExtensionFilter; -import org.openide.util.NbPreferences; -import org.slf4j.LoggerFactory; - -/** - * - * @author AK249877 - */ -public class ImportIdentificationPanel extends JPanel implements InternalPanelInterface { - - private Window m_parent; - private DefaultDialogInterface m_dialog; - - private static final String OMSSA_PARSER = "Omssa Parser"; - private static final String MASCOT_PARSER = "Mascot"; - private static final String XTANDEM_PARSER = "X!Tandem Parser"; - private static final String MZ_IDENT_PARSER = "MzIdentML"; - - private final static String[] PARSER_NAMES = {MASCOT_PARSER, OMSSA_PARSER, XTANDEM_PARSER, MZ_IDENT_PARSER}; - // ABU : added a map to consider the case when a parser handles more than one extensions - // the key is the extension, the value is the id of the parser in the other arrays - private static final Map EXTENSION_TO_PARSER = new HashMap<>(); - - static { - EXTENSION_TO_PARSER.put("dat", 0); - EXTENSION_TO_PARSER.put("omx", 1); - EXTENSION_TO_PARSER.put("omx.bz2", 1); - EXTENSION_TO_PARSER.put("xml", 2); - EXTENSION_TO_PARSER.put("mzid", 3); - } - - private final static String[] FILE_EXTENSIONS_DESCRIPTION = {"Mascot Identification Result", "Omssa Identification Result", "X!Tandem Identification Result", "MZIdentML Identification Result"}; - private final static String[] PARSER_IDS = {"mascot.dat", "omssa.omx", "xtandem.xml", "mzidentml.mzid"}; - - private final static String[] DECOY_VALUES = {null, "No Decoy", "Software Engine Decoy", "Concatenated Decoy"}; - private final static String[] DECOY_VALUES_ASSOCIATED_KEYS = DECOY_VALUES; - private static final int CONCATENATED_DECOY_INDEX = 3; - - private final static String SETTINGS_KEY = "ImporteIdentification"; - - private JList m_fileList; - private JScrollPane m_fileListScrollPane; - - private JButton m_addFileButton; - private JButton m_removeFileButton; - - private JComboBox m_parserComboBox; - private int m_previousParserIndex = -1; - private ParameterList m_sourceParameterList; - private StringParameter m_decoyRegexParameter; - - private JComboBox m_instrumentsComboBox = null; - private JComboBox m_peaklistSoftwaresComboBox = null; - private JComboBox m_decoyComboBox = null; - private JLabel m_decoyAccessionRegexLabel = null; - private JTextField m_decoyRegexTextField = null; - private JButton m_regexButton; - - private JPanel m_parserParametersPanel = null; - - private boolean m_rootPathError = false; - - private ServerFile m_defaultDirectory = null; - - public ImportIdentificationPanel(Window parent) { - m_parent = parent; - - this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(), BorderFactory.createTitledBorder("Import Search Results"))); - - setMinimumSize(new Dimension(200, 240)); - - this.setLayout(new BorderLayout()); - this.add(this.initInternalPanel(), BorderLayout.CENTER); - - restoreInitialParameters(NbPreferences.root()); - } - - private JPanel initInternalPanel() { - - JPanel internalPanel = new JPanel(); - internalPanel.setLayout(new java.awt.GridBagLayout()); - - // create fileSelectionPanel - JPanel fileSelectionPanel = createFileSelectionPanel(); - - // create all other parameters panel - JPanel allParametersPanel = createAllParametersPanel(); - - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - c.gridx = 0; - c.gridy = 0; - c.weightx = 1.0; - c.weighty = 1.0; - internalPanel.add(fileSelectionPanel, c); - - c.gridy++; - c.weighty = 0; - internalPanel.add(allParametersPanel, c); - - return internalPanel; - } - - private JPanel createAllParametersPanel() { - JPanel allParametersPanel = new JPanel(new GridBagLayout()); - allParametersPanel.setBorder(BorderFactory.createTitledBorder(" Parameters ")); - - // create parserPanel - JPanel parserPanel = createParserPanel(); - - // create decoyPanel - JPanel decoyPanel = createDecoyPanel(); - - // create parameter panel - m_parserParametersPanel = createParametersPanel(); - - // create panel with option save Spectrum Matches - //JPanel saveSpectrumPanel = createSaveSpectrumPanel(); - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - c.gridx = 0; - c.gridy = 0; - c.weightx = 1.0; - allParametersPanel.add(parserPanel, c); - - c.gridy++; - allParametersPanel.add(decoyPanel, c); - - c.gridy++; - allParametersPanel.add(m_parserParametersPanel, c); - - // init the first parser parameters panel selected - m_parserComboBox.setSelectedIndex(0); - - return allParametersPanel; - } - - private JPanel createFileSelectionPanel() { - - // Creation of Objects for File Selection Panel - JPanel fileSelectionPanel = new JPanel(new GridBagLayout()); - fileSelectionPanel.setBorder(BorderFactory.createTitledBorder(" Files Selection ")); - - m_fileList = new JList<>(new DefaultListModel()); - m_fileListScrollPane = new JScrollPane(m_fileList) { - - private Dimension preferredSize = new Dimension(360, 200); - - @Override - public Dimension getPreferredSize() { - return preferredSize; - } - }; - - m_addFileButton = new JButton(IconManager.getIcon(IconManager.IconType.OPEN_FILE)); - m_addFileButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); - m_removeFileButton = new JButton(IconManager.getIcon(IconManager.IconType.ERASER)); - m_removeFileButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); - - // Placement of Objects for File Selection Panel - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - c.gridx = 0; - c.gridy = 0; - c.gridheight = 3; - c.weightx = 1.0; - c.weighty = 1.0; - fileSelectionPanel.add(m_fileListScrollPane, c); - - c.gridx++; - c.gridheight = 1; - c.weightx = 0; - c.weighty = 0; - fileSelectionPanel.add(m_addFileButton, c); - - c.gridy++; - fileSelectionPanel.add(m_removeFileButton, c); - - c.gridy++; - fileSelectionPanel.add(Box.createVerticalStrut(30), c); - - // Actions on objects - m_fileList.addListSelectionListener(new ListSelectionListener() { - - @Override - public void valueChanged(ListSelectionEvent e) { - boolean sometingSelected = (m_fileList.getSelectedIndex() != -1); - m_removeFileButton.setEnabled(sometingSelected); - } - }); - - m_addFileButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - - if (m_rootPathError) { - LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Server has returned no Root Path for Result Files. There is a problem with the server installation, please contact your administrator."); - - InfoDialog errorDialog = new InfoDialog(m_parent, InfoDialog.InfoType.WARNING, "Root Path Error", "Server has returned no Root Path for Result Files.\nThere is a problem with the server installation, please contact your administrator."); - errorDialog.setButtonVisible(OptionDialog.BUTTON_CANCEL, false); - errorDialog.setLocationRelativeTo(m_parent); - errorDialog.setVisible(true); - return; - } - - JFileChooser fchooser; - if ((m_defaultDirectory != null) && (m_defaultDirectory.isDirectory())) { - fchooser = new JFileChooser(m_defaultDirectory, ServerFileSystemView.getServerFileSystemView()); - } else { - // should not happen in fact - fchooser = new JFileChooser(ServerFileSystemView.getServerFileSystemView()); - } - fchooser.setMultiSelectionEnabled(true); - - // ABU : for each parser, add all its extensions - String[] filters = new String[FILE_EXTENSIONS_DESCRIPTION.length]; - for (String key : EXTENSION_TO_PARSER.keySet()) { - int i = EXTENSION_TO_PARSER.get(key); - if (filters[i] == null) { - filters[i] = ""; - } - if (!filters[i].equals("")) { - filters[i] += ";"; - } - if (key.contains(".")) { // if the extension contains a dot, only keep what is on its right (ie. "omx.bz2" -> "bz2") - int indexOfDot = key.lastIndexOf('.'); - filters[i] += key.substring(indexOfDot + 1); - } else { - filters[i] += key; - } - } - for (int i = 0; i < filters.length; i++) { // extensions with a dot inside will not be considered - FileNameExtensionFilter filter = new FileNameExtensionFilter(FILE_EXTENSIONS_DESCRIPTION[i], filters[i].split(";")); - fchooser.addChoosableFileFilter(filter); - } - - int result = fchooser.showOpenDialog(m_parent); - if (result == JFileChooser.APPROVE_OPTION) { - - boolean hasFilesPreviously = (m_fileList.getModel().getSize() != 0); - - File[] files = fchooser.getSelectedFiles(); - int nbFiles = files.length; - for (int i = 0; i < nbFiles; i++) { - ((DefaultListModel) m_fileList.getModel()).addElement(files[i]); - } - - // select Parser according to the extension of the first file - // ABU : use the map to deal with different extensions for the same parser - if ((nbFiles > 0) && !hasFilesPreviously) { - File f = files[0]; - String fileName = f.getName(); - int parserIndex = -1; - for (String key : EXTENSION_TO_PARSER.keySet()) { - String extension = "." + key; - if (fileName.endsWith(extension)) { - parserIndex = EXTENSION_TO_PARSER.get(key); - break; - } - } - if (parserIndex >= 0) { - m_parserComboBox.setSelectedIndex(parserIndex); - } - - } - - if (nbFiles > 0) { - File f = files[0]; - f = f.getParentFile(); - if ((f != null) && (f.isDirectory())) { - if (f instanceof ServerFile) { - m_defaultDirectory = (ServerFile) f; - } - } - } - } - } - }); - - m_removeFileButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - List selectedValues = m_fileList.getSelectedValuesList(); - Iterator it = selectedValues.iterator(); - while (it.hasNext()) { - ((DefaultListModel) m_fileList.getModel()).removeElement(it.next()); - } - m_removeFileButton.setEnabled(false); - } - }); - - return fileSelectionPanel; - - } - - private JPanel createParserPanel() { - // Creation of Objects for the Parser Panel - JPanel parserPanel = new JPanel(new GridBagLayout()); - - JLabel parserLabel = new JLabel("Software Engine :"); - parserLabel.setHorizontalAlignment(SwingConstants.RIGHT); - m_parserComboBox = new JComboBox(createParameters()); - - // Placement of Objects for Parser Panel - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - c.gridx = 0; - c.gridy = 0; - parserPanel.add(parserLabel, c); - - c.gridx++; - c.gridwidth = 2; - c.weightx = 1; - parserPanel.add(m_parserComboBox, c); - - m_sourceParameterList = createSourceParameters(); - m_sourceParameterList.updateValues(NbPreferences.root()); - - c.gridx = 0; - c.gridwidth = 1; - c.weightx = 0; - c.gridy++; - JLabel instrumentLabel = new JLabel("Instrument :"); - instrumentLabel.setHorizontalAlignment(SwingConstants.RIGHT); - parserPanel.add(instrumentLabel, c); - - c.gridx++; - c.gridwidth = 2; - c.weightx = 1; - parserPanel.add(m_instrumentsComboBox, c); - - c.gridx = 0; - c.gridwidth = 1; - c.weightx = 0; - c.gridy++; - JLabel peaklistSoftwareLabel = new JLabel("Peaklist Software :"); - peaklistSoftwareLabel.setHorizontalAlignment(SwingConstants.RIGHT); - parserPanel.add(peaklistSoftwareLabel, c); - - c.gridx++; - c.gridwidth = 2; - c.weightx = 1; - parserPanel.add(m_peaklistSoftwaresComboBox, c); - - m_parserComboBox.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - int parserIndex = m_parserComboBox.getSelectedIndex(); - if (parserIndex == m_previousParserIndex) { - return; - } - - m_previousParserIndex = parserIndex; - - initParameters(); - - m_dialog.provokeRepack(); - - } - }); - - return parserPanel; - } - - private JPanel createDecoyPanel() { - // Creation of Objects for the Parser Panel - JPanel decoyPanel = new JPanel(new GridBagLayout()); - decoyPanel.setBorder(BorderFactory.createTitledBorder(" Decoy Parameters ")); - - // Placement of Objects for Parser Panel - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - c.gridx = 0; - c.gridwidth = 1; - c.weightx = 0; - c.gridy = 0; - JLabel decoyLabel = new JLabel("Decoy :"); - decoyLabel.setHorizontalAlignment(SwingConstants.RIGHT); - decoyPanel.add(decoyLabel, c); - - c.gridx++; - c.gridwidth = 2; - c.weightx = 1; - decoyPanel.add(m_decoyComboBox, c); - - c.gridx = 0; - c.gridwidth = 1; - c.weightx = 0; - c.gridy++; - m_decoyAccessionRegexLabel = new JLabel("Decoy Accession Regex :"); - m_decoyAccessionRegexLabel.setHorizontalAlignment(SwingConstants.RIGHT); - decoyPanel.add(m_decoyAccessionRegexLabel, c); - - c.gridx++; - c.weightx = 1; - decoyPanel.add(m_decoyRegexTextField, c); - - c.gridx++; - c.weightx = 0; - m_regexButton = new JButton(IconManager.getIcon(IconManager.IconType.DOCUMENT_LIST)); - m_regexButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); - decoyPanel.add(m_regexButton, c); - - m_decoyComboBox.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - updateDecoyRegexEnabled(); - } - }); - - m_regexButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - - ArrayList regexArrayList = readRegexArray(null); - - //HEREPROBLEM - ImportIdentificationDialog.SelectRegexDialog regexDialog = ImportIdentificationDialog.SelectRegexDialog.getDialog(null, regexArrayList); - - regexDialog.setLocationRelativeTo(m_regexButton); - regexDialog.setVisible(true); - if (regexDialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { - - String selectedRegex = regexDialog.getSelectedRegex(); - if (selectedRegex != null) { - m_decoyRegexTextField.setText(selectedRegex); - } - regexArrayList = regexDialog.getRegexArrayList(); - writeRegexArray(NbPreferences.root(), regexArrayList); - - } - } - }); - - return decoyPanel; - } - - private ArrayList readRegexArray(String regexToAdd) { - - ArrayList regexArrayList = new ArrayList(); - Preferences preferences = NbPreferences.root(); - int i = 1; - while (true) { - String regex = preferences.get("DecoyRegex_" + i, null); - if (regex == null) { - break; - } - if ((regexToAdd != null) && (regex.compareTo(regexToAdd) == 0)) { - regexToAdd = null; - regexArrayList.add(0, regex); - } else { - regexArrayList.add(regex); - } - i++; - } - if (regexToAdd != null) { - regexArrayList.add(0, regexToAdd); - } - - boolean grenobleRegexFound = false; - boolean strasbourgRegexFound = false; - for (i = 0; i < regexArrayList.size(); i++) { - String regex = regexArrayList.get(i); - if (regex.compareTo("###REV###\\S+") == 0) { // Grenoble Regex - grenobleRegexFound = true; - } else if (regex.compareTo("sp\\|REV_\\S+") == 0) { // Strasbourg Regex - strasbourgRegexFound = true; - } - } - if (!grenobleRegexFound) { - regexArrayList.add("###REV###\\S+"); - } - if (!strasbourgRegexFound) { - regexArrayList.add("sp\\|REV_\\S+"); - } - - return regexArrayList; - } - - private void writeRegexArray(Preferences preferences, ArrayList regexArrayList) { - - // remove previous regex - int i = 1; - while (true) { - String key = "DecoyRegex_" + i; - - String regex = preferences.get(key, null); - if (regex == null) { - break; - } - preferences.remove(key); - i++; - } - - // put new regex - for (i = 0; i < regexArrayList.size(); i++) { - String key = "DecoyRegex_" + (i + 1); - preferences.put(key, regexArrayList.get(i)); - } - } - - private void updateDecoyRegexEnabled() { - boolean enabled = (m_decoyComboBox.getSelectedIndex() == CONCATENATED_DECOY_INDEX); - m_decoyRegexParameter.setUsed(enabled); // done anyway to be sure there is not a problem at initialization - m_decoyAccessionRegexLabel.setEnabled(enabled); - m_decoyRegexTextField.setEnabled(enabled); - m_regexButton.setEnabled(enabled); - - } - - private JPanel createParametersPanel() { - - JPanel panel = new JPanel(new GridBagLayout()); - panel.setBorder(BorderFactory.createTitledBorder(" Parser Parameters ")); - return panel; - } - - private void initParameters() { - - // remove all parameters - m_parserParametersPanel.removeAll(); - - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - - ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); - m_parserParametersPanel.add(parameterList.getPanel(), c); - - } - - private boolean checkParametersForOK() { - // check files selected - int nbFiles = m_fileList.getModel().getSize(); - if (nbFiles == 0) { - //HEREPROBLEM - //setStatus(true, "You must select a file to import."); - m_dialog.setDialogStatus(true, "You must select a file to import."); - //highlight(m_fileList); - m_dialog.highlightPanelComponent(m_fileList); - return false; - } - - return checkParametersForSave(); - } - - private boolean checkParametersForSave() { - - ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); - - // check source parameters - ParameterError error = m_sourceParameterList.checkParameters(); - - // check specific parameters - if (error == null) { - error = parameterList.checkParameters(); - } - - // report error - if (error != null) { - - //HEREPROBLEM - //setStatus(true, error.getErrorMessage()); - m_dialog.setDialogStatus(true, error.getErrorMessage()); - //highlight(error.getParameterComponent()); - m_dialog.highlightPanelComponent(error.getParameterComponent()); - return false; - } - - return true; - } - - private void saveParameters(Preferences preferences) { - - ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); - - // save parser - String parserSelected = parameterList.toString(); - preferences.put("IdentificationParser", parserSelected); - - // save file path - if (m_defaultDirectory != null) { - preferences.put("IdentificationFilePath", m_defaultDirectory.getAbsolutePath()); - } - - // Save Other Parameters - m_sourceParameterList.saveParameters(preferences); - parameterList.saveParameters(preferences); - - if (m_decoyRegexTextField.isEnabled()) { - ArrayList regexArrayList = readRegexArray(m_decoyRegexTextField.getText()); - writeRegexArray(preferences, regexArrayList); - } - - } - - private void restoreInitialParameters(Preferences preferences) { - String parser = preferences.get("IdentificationParser", null); - - int parserIndex = -1; - if (parser != null) { - - int nbParsers = PARSER_NAMES.length; - for (int i = 0; i < nbParsers; i++) { - String parserCur = PARSER_NAMES[i]; - if (parser.compareToIgnoreCase(parserCur) == 0) { - parserIndex = i; - break; - } - } - } - if (parserIndex == -1) { - parserIndex = 0; // select first parser of the list - } - - // select the parser - m_parserComboBox.setSelectedIndex(parserIndex); - - ArrayList roots = ServerFileSystemView.getServerFileSystemView().getLabels(RootInfo.TYPE_RESULT_FILES); - if ((roots == null) || (roots.isEmpty())) { - // check that the server has sent me at least one root path - LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Server has returned no Root Path for Result Files. There is a problem with the server installation, please contact your administrator."); - m_rootPathError = true; - return; - } else { - m_rootPathError = false; - } - - // - String filePath = preferences.get("IdentificationFilePath", null); - if (filePath == null) { - if (roots.size() >= 1) { - filePath = roots.get(0); - } - } - if (filePath != null) { - ServerFile f = new ServerFile(filePath, filePath, true, 0, 0); - if (f.isDirectory()) { - m_defaultDirectory = f; - } - } - - } - - public File[] getFilePaths() { - - DefaultListModel model = ((DefaultListModel) m_fileList.getModel()); - int nbFiles = model.getSize(); - File[] filePaths = new File[nbFiles]; - for (int i = 0; i < nbFiles; i++) { - filePaths[i] = ((File) model.getElementAt(i)); - } - - return filePaths; - } - - public HashMap getParserArguments() { - ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); - return parameterList.getValues(); - } - - public long getInstrumentId() { - - InstrumentConfiguration instrument = (InstrumentConfiguration) m_sourceParameterList.getParameter("instrument").getObjectValue(); - return instrument.getId(); - } - - public long getPeaklistSoftwareId() { - PeaklistSoftware peaklistSoftware = (PeaklistSoftware) m_sourceParameterList.getParameter("peaklist_software").getObjectValue(); - return peaklistSoftware.getId(); - } - - public String getParserId() { - return PARSER_IDS[m_parserComboBox.getSelectedIndex()]; - } - - public String getDecoyRegex() { - if (m_decoyRegexTextField.isEnabled()) { - return m_decoyRegexTextField.getText(); - } - return null; - } - - private ParameterList[] createParameters() { - ParameterList[] plArray = new ParameterList[4]; - plArray[0] = createMascotParser(); - plArray[1] = createOmssaParser(); - plArray[2] = createXtandemParser(); - plArray[3] = createMzIdentParser(); - return plArray; - } - - private ParameterList createMascotParser() { - ParameterList parameterList = new ParameterList(MASCOT_PARSER); -// parameterList.add(new DoubleParameter("ion.score.cutoff", "Ion Score Cutoff", JTextField.class, new Double(0.0), new Double(0), null)); - parameterList.add(new DoubleParameter("subset.threshold", "Subset Threshold", JTextField.class, new Double(1.0), new Double(0), new Double(1))); -// parameterList.add(new StringParameter("mascot.server.url", "Mascot Server URL (including /cgi/)", JTextField.class, "http://www.matrixscience.com/cgi/", null, null)); - - return parameterList; - } - - private ParameterList createOmssaParser() { - ParameterList parameterList = new ParameterList(OMSSA_PARSER); - - Preferences preferences = NbPreferences.root(); - - String[] fileFilterNames = {"Usermods XML File"}; - String[] fileFilterExtensions = {"xml"}; - parameterList.add(new FileParameter(ServerFileSystemView.getServerFileSystemView(), "usermod.xml.file", "Usermods file path", JTextField.class, preferences.get("Omssa_Parser.Usermods_file_path", ""), fileFilterNames, fileFilterExtensions)); - - String[] fileFilterNames2 = {"PTM composition File"}; - String[] fileFilterExtensions2 = {"txt"}; - parameterList.add(new FileParameter(ServerFileSystemView.getServerFileSystemView(), "ptm.composition.file", "PTM composition file path", JTextField.class, preferences.get("Omssa_Parser.PTM_composition_file_path", ""), fileFilterNames2, fileFilterExtensions2)); -// parameterList.add(new BooleanParameter("fasta.contains.target", "Fasta contains target entries", JCheckBox.class, Boolean.TRUE)); -// parameterList.add(new BooleanParameter("fasta.contains.decoy", "Fasta contains decoy entries", JCheckBox.class, Boolean.TRUE)); - - return parameterList; - } - - private ParameterList createXtandemParser() { - ParameterList parameterList = new ParameterList(XTANDEM_PARSER); - -// Preferences preferences = NbPreferences.root(); -// parameterList.add(new FileParameter(ServerFileSystemView.getServerFileSystemView(), "usermod.xml.file", "Usermods file path", JTextField.class, preferences.get("Omssa_Parser.Usermods_file_path", ""), "Usermods XML File", "xml")); -// parameterList.add(new FileParameter(ServerFileSystemView.getServerFileSystemView(), "ptm.composition.file", "PTM composition file path", JTextField.class, preferences.get("Omssa_Parser.PTM_composition_file_path", ""), "PTM composition File", "txt")); - return parameterList; - } - - private ParameterList createMzIdentParser() { - ParameterList mzIdentParameterList = new ParameterList(MZ_IDENT_PARSER); - - Preferences preferences = NbPreferences.root(); - mzIdentParameterList.add(new StringParameter("Test", "Test", JTextField.class, preferences.get("MzIdentParser.test", ""), 0, 20)); - - return mzIdentParameterList; - } - - private ParameterList createSourceParameters() { - - ParameterList parameterList = new ParameterList("Parameter Source"); - - AbstractParameterToString instrumentToString = new AbstractParameterToString() { - @Override - public String toString(InstrumentConfiguration o) { - return o.getName(); - } - }; - - AbstractParameterToString softwareToString = new AbstractParameterToString() { - @Override - public String toString(PeaklistSoftware o) { - String version = o.getVersion(); - if (version == null) { - return o.getName(); - } - return o.getName() + " " + version; - } - }; - - m_instrumentsComboBox = new JComboBox(DatabaseDataManager.getDatabaseDataManager().getInstrumentsWithNullArray()); - final ObjectParameter instrumentParameter = new ObjectParameter<>("instrument", "Instrument", m_instrumentsComboBox, DatabaseDataManager.getDatabaseDataManager().getInstrumentsWithNullArray(), null, -1, instrumentToString); - parameterList.add(instrumentParameter); - m_instrumentsComboBox.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - instrumentParameter.setUsed(true); //JPM.WART : found a better fix (parameters not saved if it has never been set) - } - }); - - m_peaklistSoftwaresComboBox = new JComboBox(DatabaseDataManager.getDatabaseDataManager().getPeaklistSoftwaresWithNullArray()); - final ObjectParameter peaklistParameter = new ObjectParameter("peaklist_software", "Peaklist Software", m_peaklistSoftwaresComboBox, DatabaseDataManager.getDatabaseDataManager().getPeaklistSoftwaresWithNullArray(), null, -1, softwareToString); - parameterList.add(peaklistParameter); - m_peaklistSoftwaresComboBox.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - peaklistParameter.setUsed(true); //JPM.WART : found a better fix (parameters not saved if it has never been set) - } - }); - - m_decoyComboBox = new JComboBox(DECOY_VALUES); - final ObjectParameter decoyParameter = new ObjectParameter<>("decoy_accession", "Decoy", m_decoyComboBox, DECOY_VALUES, DECOY_VALUES_ASSOCIATED_KEYS, 0, null); - parameterList.add(decoyParameter); - m_decoyComboBox.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - decoyParameter.setUsed(true); //JPM.WART : found a better fix (parameters not saved if it has never been set) - } - }); - - m_decoyRegexTextField = new JTextField(20); - m_decoyRegexParameter = new StringParameter("decoy_accession", "Decoy Accession", m_decoyRegexTextField, "", new Integer(2), null); - m_decoyRegexParameter.setUsed(false); - m_decoyRegexParameter.setCompulsory(false); - parameterList.add(m_decoyRegexParameter); - - return parameterList; - - } - - @Override - public boolean cancelTriggered() { - return true; - } - - @Override - public boolean okTriggered() { - // check parameters - if (!checkParametersForOK()) { - return false; - } - saveParameters(NbPreferences.root()); - return true; - } - - @Override - public boolean defaultTriggered() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public boolean backTriggered() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public boolean saveTriggered() { - // check parameters - if (!checkParametersForSave()) { - return false; - } - JFileChooser fileChooser = SettingsUtils.getFileChooser(SETTINGS_KEY); - int result = fileChooser.showSaveDialog(this); - if (result == JFileChooser.APPROVE_OPTION) { - File f = fileChooser.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(f, null, ""); - - saveParameters(filePreferences); - - SettingsUtils.addSettingsPath(SETTINGS_KEY, f.getAbsolutePath()); - SettingsUtils.writeDefaultDirectory(SETTINGS_KEY, f.getParent()); - } - return false; - } - - @Override - public boolean loadTriggered() { - SettingsDialog settingsDialog = new SettingsDialog(m_parent, SETTINGS_KEY); - settingsDialog.setLocationRelativeTo(this); - settingsDialog.setVisible(true); - - if (settingsDialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { - if (settingsDialog.isDefaultSettingsSelected()) { - ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); - parameterList.initDefaults(); - } else { - try { - File settingsFile = settingsDialog.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(settingsFile, null, ""); - - Preferences preferences = NbPreferences.root(); - String[] keys = filePreferences.keys(); - for (int i = 0; i < keys.length; i++) { - String key = keys[i]; - String value = filePreferences.get(key, null); - preferences.put(key, value); - } - - restoreInitialParameters(preferences); - - ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); - parameterList.loadParameters(filePreferences); - m_sourceParameterList.loadParameters(filePreferences); - - } catch (Exception e) { - LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Parsing of User Settings File Failed", e); - - //HEREPROBLEM - //setStatus(true, "Parsing of your Settings File failed"); - m_dialog.setDialogStatus(true, "Parsing of your Settings File failed"); - } - } - } - - return false; - } - - @Override - public void setDialog(DefaultDialogInterface dialog) { - m_dialog = dialog; - } - - @Override - public void reinitializePanel() { - // reinit of files selection - ((DefaultListModel) m_fileList.getModel()).removeAllElements(); - m_removeFileButton.setEnabled(false); - // reinit of some parameters - ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); - parameterList.clean(); - updateDecoyRegexEnabled(); - } - - /** - * Class used to select Regex previously used - */ - public static class SelectRegexDialog extends DefaultDialog { - - private static SelectRegexDialog m_selectRegexSingletonDialog = null; - - private JList m_regexList; - private JScrollPane m_regexListScrollPane; - private JButton m_removeRegexButton; - - private String m_selectedRegex = null; - private ArrayList m_regexArrayList = null; - - public static SelectRegexDialog getDialog(JDialog parent, ArrayList regexArrayList) { - if (m_selectRegexSingletonDialog == null) { - m_selectRegexSingletonDialog = new SelectRegexDialog(parent); - } - m_selectRegexSingletonDialog.initData(regexArrayList); - - return m_selectRegexSingletonDialog; - } - - private SelectRegexDialog(JDialog parent) { - super(parent, Dialog.ModalityType.APPLICATION_MODAL); - - setTitle("Select Decoy Accession Regex"); - setResizable(false); - setMinimumSize(new Dimension(200, 240)); - - setButtonVisible(DefaultDialog.BUTTON_HELP, false); - - initInternalPanel(); - - } - - private void initData(ArrayList regexArrayList) { - m_regexArrayList = regexArrayList; - - DefaultListModel model = (DefaultListModel) m_regexList.getModel(); - model.clear(); - - int nb = regexArrayList.size(); - for (int i = 0; i < nb; i++) { - model.addElement(regexArrayList.get(i)); - } - } - - private void initInternalPanel() { - - JPanel internalPanel = new JPanel(); - internalPanel.setLayout(new java.awt.GridBagLayout()); - - // create regexSelectionPanel - JPanel regexSelectionPanel = createRegexSelectionPanel(); - - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - c.gridx = 0; - c.gridy = 0; - c.weightx = 1.0; - c.weighty = 1.0; - internalPanel.add(regexSelectionPanel, c); - - setInternalComponent(internalPanel); - - } - - private JPanel createRegexSelectionPanel() { - - // Creation of Objects for Regex Selection Panel - JPanel regexSelectionPanel = new JPanel(new GridBagLayout()); - regexSelectionPanel.setBorder(BorderFactory.createTitledBorder(" Regex Selection ")); - - m_regexList = new JList<>(new DefaultListModel()); - - // double clicking on regex -> select it and click on ok button - m_regexList.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - if (e.getClickCount() == 2) { - m_selectRegexSingletonDialog.doClick(DefaultDialog.BUTTON_OK); - } - } - }); - - m_regexListScrollPane = new JScrollPane(m_regexList) { - - private Dimension preferredSize = new Dimension(280, 140); - - @Override - public Dimension getPreferredSize() { - return preferredSize; - } - }; - - m_removeRegexButton = new JButton(IconManager.getIcon(IconManager.IconType.ERASER)); - m_removeRegexButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); - - // Placement of Objects for Regex Selection Panel - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - c.gridx = 0; - c.gridy = 0; - c.gridheight = 3; - c.weightx = 1.0; - c.weighty = 1.0; - regexSelectionPanel.add(m_regexListScrollPane, c); - - c.gridx++; - c.gridheight = 1; - c.weightx = 0; - c.weighty = 0; - regexSelectionPanel.add(m_removeRegexButton, c); - - c.gridy++; - regexSelectionPanel.add(Box.createVerticalStrut(30), c); - - // Actions on objects - m_regexList.addListSelectionListener(new ListSelectionListener() { - - @Override - public void valueChanged(ListSelectionEvent e) { - boolean sometingSelected = (m_regexList.getSelectedIndex() != -1); - m_removeRegexButton.setEnabled(sometingSelected); - } - }); - - m_removeRegexButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - List selectedValues = m_regexList.getSelectedValuesList(); - Iterator it = selectedValues.iterator(); - while (it.hasNext()) { - ((DefaultListModel) m_regexList.getModel()).removeElement(it.next()); - } - m_removeRegexButton.setEnabled(false); - } - }); - - return regexSelectionPanel; - - } - - @Override - protected boolean okCalled() { - m_selectedRegex = m_regexList.getSelectedValue(); - - DefaultListModel model = (DefaultListModel) m_regexList.getModel(); - int size = model.getSize(); - if (m_regexArrayList == null) { - m_regexArrayList = new ArrayList<>(size); - } else { - m_regexArrayList.clear(); - } - for (int i = 0; i < size; i++) { - m_regexArrayList.add(model.elementAt(i)); - } - return true; - } - - @Override - protected boolean cancelCalled() { - m_selectedRegex = null; - return true; - } - - public String getSelectedRegex() { - return m_selectedRegex; - } - - public ArrayList getRegexArrayList() { - return m_regexArrayList; - } - } - - public class CertifyIdentificationProgress implements ProgressInterface { - - private boolean m_isLoaded = false; - - @Override - public boolean isLoaded() { - return m_isLoaded; - } - - @Override - public int getLoadingPercentage() { - return 0; // progress bar displayed as a waiting bar - } - - public void setLoaded() { - m_isLoaded = true; - } - }; - -} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportMaxQuantResultDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportMaxQuantResultDialog.java index 20d911394..e6543b6a0 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportMaxQuantResultDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ImportMaxQuantResultDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -18,53 +18,28 @@ import fr.proline.core.orm.uds.InstrumentConfiguration; import fr.proline.core.orm.uds.PeaklistSoftware; +import fr.proline.studio.NbPreferences; import fr.proline.studio.dam.DatabaseDataManager; -import fr.proline.studio.gui.DefaultDialog; -import fr.proline.studio.parameter.AbstractParameterToString; -import fr.proline.studio.parameter.BooleanParameter; -import fr.proline.studio.parameter.ObjectParameter; -import fr.proline.studio.parameter.ParameterError; -import fr.proline.studio.parameter.ParameterList; -import fr.proline.studio.parameter.StringParameter; -import fr.proline.studio.settings.FilePreferences; -import fr.proline.studio.settings.SettingsDialog; -import fr.proline.studio.settings.SettingsUtils; +import fr.proline.studio.gui.DefaultStorableDialog; +import fr.proline.studio.parameter.*; import fr.proline.studio.utils.IconManager; -import java.awt.Dialog; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Window; + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.Iterator; import java.util.List; import java.util.prefs.Preferences; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JFileChooser; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextField; -import javax.swing.SwingConstants; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import org.openide.util.NbBundle; -import org.openide.util.NbPreferences; -import org.slf4j.LoggerFactory; /** * * @author VD225637 */ -public class ImportMaxQuantResultDialog extends DefaultDialog { +public class ImportMaxQuantResultDialog extends DefaultStorableDialog { private final static String SETTINGS_KEY = "ImportMaxQuantResult"; @@ -76,7 +51,6 @@ public class ImportMaxQuantResultDialog extends DefaultDialog { //To select folder containing result private JList m_fileList; - private JScrollPane m_fileListScrollPane; private JButton m_addFileButton; private JButton m_removeFileButton; private String m_defaultImportMQPath; @@ -89,7 +63,7 @@ public static ImportMaxQuantResultDialog getDialog(Window parent) { m_singletonDialog = new ImportMaxQuantResultDialog(parent); } - m_singletonDialog.reinitialize(); + m_singletonDialog.resetParameters(); return m_singletonDialog; } @@ -99,8 +73,6 @@ private ImportMaxQuantResultDialog(Window parent) { setTitle("Import MaxQuant Results"); - setButtonVisible(BUTTON_LOAD, true); - setButtonVisible(BUTTON_SAVE, true); setDocumentationSuffix("h.1tuee74"); setResizable(true); setMinimumSize(new Dimension(200, 240)); @@ -149,7 +121,7 @@ private JPanel createFileSelectionPanel() { fileSelectionPanel.setBorder(BorderFactory.createTitledBorder(" Files Selection ")); m_fileList = new JList<>(new DefaultListModel()); - m_fileListScrollPane = new JScrollPane(m_fileList) { + JScrollPane m_fileListScrollPane = new JScrollPane(m_fileList) { private Dimension preferredSize = new Dimension(360, 200); @@ -305,14 +277,6 @@ private JPanel createAllParametersPanel() { return allParametersPanel; } - private void reinitialize() { - // reinit of files selection - ((DefaultListModel) m_fileList.getModel()).removeAllElements(); - m_removeFileButton.setEnabled(false); - setStatus(false, String.format("%d file(s)", m_fileList.getModel().getSize())); - restoreInitialParameters(NbPreferences.root()); - } - public long getInstrumentId() { InstrumentConfiguration instrument = (InstrumentConfiguration) m_sourceParameterList.getParameter("instrument").getObjectValue(); return instrument.getId(); @@ -338,81 +302,81 @@ public File[] getFilePaths() { return filePaths; } + + /*** DefaultStorableDialog Abstract methods ***/ + @Override - protected boolean okCalled() { + protected String getSettingsKey() { + return SETTINGS_KEY; + } - // check parameters - if (!checkParametersForOK()) { + @Override + protected boolean checkParameters() { + + // check source parameters + ParameterError error = m_sourceParameterList.checkParameters(); + + // report error + if (error != null) { + setStatus(true, error.getErrorMessage()); + highlight(error.getParameterComponent()); return false; } - saveParameters(NbPreferences.root()); - return true; } @Override - protected boolean cancelCalled() { - return true; + protected void resetParameters() { + // reinit of files selection + ((DefaultListModel) m_fileList.getModel()).removeAllElements(); + m_removeFileButton.setEnabled(false); + setStatus(false, String.format("%d file(s)", m_fileList.getModel().getSize())); + restoreInitialParameters(NbPreferences.root()); } @Override - protected boolean saveCalled() { - // check parameters - if (!checkParametersForSave()) { - return false; + protected void loadParameters(Preferences filePreferences) throws Exception { + Preferences preferences = NbPreferences.root(); + String[] keys = filePreferences.keys(); + for (int i = 0; i < keys.length; i++) { + String key = keys[i]; + String value = filePreferences.get(key, null); + preferences.put(key, value); } - JFileChooser fileChooser = SettingsUtils.getFileChooser(SETTINGS_KEY); - int result = fileChooser.showSaveDialog(this); - if (result == JFileChooser.APPROVE_OPTION) { - File f = fileChooser.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(f, null, ""); + restoreInitialParameters(preferences); - saveParameters(filePreferences); + m_sourceParameterList.loadParameters(filePreferences); + } - SettingsUtils.addSettingsPath(SETTINGS_KEY, f.getAbsolutePath()); - SettingsUtils.writeDefaultDirectory(SETTINGS_KEY, f.getParent()); + @Override + protected void saveParameters(Preferences preferences) { + // save file path + if (m_defaultImportMQPath != null) { + preferences.put("DefaultImportMQResultPath", m_defaultImportMQPath); } - return false; + // Save Other Parameters + m_sourceParameterList.saveParameters(preferences); } @Override - protected boolean loadCalled() { - - SettingsDialog settingsDialog = new SettingsDialog(this, SETTINGS_KEY); - settingsDialog.setLocationRelativeTo(this); - settingsDialog.setVisible(true); - - if (settingsDialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { - if (settingsDialog.isDefaultSettingsSelected()) { - reinitialize(); - } else { - try { - File settingsFile = settingsDialog.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(settingsFile, null, ""); - - Preferences preferences = NbPreferences.root(); - String[] keys = filePreferences.keys(); - for (int i = 0; i < keys.length; i++) { - String key = keys[i]; - String value = filePreferences.get(key, null); - preferences.put(key, value); - } + protected boolean okCalled() { - restoreInitialParameters(preferences); + // check parameters + if (!checkParametersForOK()) { + return false; + } - m_sourceParameterList.loadParameters(filePreferences); + saveParameters(NbPreferences.root()); - } catch (Exception e) { - LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Parsing of User Settings File Failed", e); - setStatus(true, "Parsing of your Settings File failed"); - } - } - } + return true; + } - return false; + @Override + protected boolean cancelCalled() { + return true; } private boolean checkParametersForOK() { @@ -424,34 +388,9 @@ private boolean checkParametersForOK() { return false; } - return checkParametersForSave(); + return checkParameters(); } - private boolean checkParametersForSave() { - - // check source parameters - ParameterError error = m_sourceParameterList.checkParameters(); - - // report error - if (error != null) { - setStatus(true, error.getErrorMessage()); - highlight(error.getParameterComponent()); - return false; - } - - return true; - } - - private void saveParameters(Preferences preferences) { - - // save file path - if (m_defaultImportMQPath != null) { - preferences.put("DefaultImportMQResultPath", m_defaultImportMQPath); - } - - // Save Other Parameters - m_sourceParameterList.saveParameters(preferences); - } private void restoreInitialParameters(Preferences preferences) { m_defaultImportMQPath = preferences.get("DefaultImportMQResultPath", null); @@ -492,7 +431,7 @@ public void actionPerformed(ActionEvent e) { }); m_accessionRegexpTF = new JTextField(20); - m_accessionRegexpTF.setToolTipText(NbBundle.getMessage(ImportMaxQuantResultDialog.class, "ImportMaxQuantResultDialog.accessionRegExp.Tooltip.text")); + m_accessionRegexpTF.setToolTipText("Specify regular expression to extract Protein accession from MaxQuant Protein Ids.\\n Leave blanc if not needed"); StringParameter accessionParameter = new StringParameter("accession_regexp", "Accession regular expression", m_accessionRegexpTF, "", 0, null); accessionParameter.setUsed(true); parameterList.add(accessionParameter); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/InternalPanelInterface.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/InternalPanelInterface.java index 8f47283b0..e6cccd739 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/InternalPanelInterface.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/InternalPanelInterface.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; /** diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/LoadWaitingDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/LoadWaitingDialog.java index 9c1ab7c91..a2db94085 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/LoadWaitingDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/LoadWaitingDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/MSDiagDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/MSDiagDialog.java index 0d461b553..981bcedba 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/MSDiagDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/MSDiagDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,35 +16,29 @@ */ package fr.proline.studio.rsmexplorer.gui.dialog; -import fr.proline.studio.gui.DefaultDialog; -import fr.proline.studio.parameter.*; -import fr.proline.studio.progress.ProgressInterface; -import fr.proline.studio.settings.FilePreferences; -import fr.proline.studio.settings.SettingsDialog; +import fr.proline.studio.NbPreferences; +import fr.proline.studio.gui.DefaultStorableDialog; +import fr.proline.studio.parameter.IntegerParameter; +import fr.proline.studio.parameter.ParameterList; +import fr.proline.studio.parameter.StringParameter; + +import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.File; -import java.io.IOException; import java.util.HashMap; -import javax.swing.*; import java.util.prefs.Preferences; -import org.openide.util.NbPreferences; -import org.slf4j.LoggerFactory; - /** * * Dialog used to set MSDiag settings * * @author AW */ -public class MSDiagDialog extends DefaultDialog { +public class MSDiagDialog extends DefaultStorableDialog { private static MSDiagDialog m_singletonDialog = null; - private static final String MSDIAG_SETTINGS = "General Settings"; - - private final static String SETTINGS_KEY = "Settings key for msdiag"; + private final static String SETTINGS_KEY = "MSDiag"; private JComboBox m_parserComboBox; private ParameterList m_sourceParameterList; @@ -67,15 +61,11 @@ private MSDiagDialog(Window parent) { setDocumentationSuffix("id.1qoc8b1"); - setButtonVisible(BUTTON_LOAD, true); - setButtonVisible(BUTTON_SAVE, true); - setResizable(true); setMinimumSize(new Dimension(200, 240)); initInternalPanel(); - restoreInitialParameters(NbPreferences.root()); } private void initInternalPanel() { @@ -198,101 +188,20 @@ private void reinitialize() { } @Override - protected boolean okCalled() { - - // check parameters - if (!checkParametersForOK()) { - return false; - } - - saveParameters(NbPreferences.root()); - - return true; - - } - - @Override - protected boolean cancelCalled() { - return true; + protected String getSettingsKey() { + return SETTINGS_KEY; } -// @Override -// protected boolean saveCalled() { -// // check parameters -// if (!checkParametersForSave()) { -// return false; -// } -// -// JFileChooser fileChooser = SettingsUtils.getFileChooser(SETTINGS_KEY); -// int result = fileChooser.showSaveDialog(this); -// if (result == JFileChooser.APPROVE_OPTION) { -// File f = fileChooser.getSelectedFile(); -// FilePreferences filePreferences = new FilePreferences(f, null, ""); -// -// saveParameters(filePreferences); -// -// SettingsUtils.addSettingsPath(SETTINGS_KEY, f.getAbsolutePath()); -// SettingsUtils.writeDefaultDirectory(SETTINGS_KEY, f.getParent()); -// } -// -// return false; -// } @Override - protected boolean loadCalled() { - - SettingsDialog settingsDialog = new SettingsDialog(this, SETTINGS_KEY); - settingsDialog.setLocationRelativeTo(this); - settingsDialog.setVisible(true); - - if (settingsDialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { - if (settingsDialog.isDefaultSettingsSelected()) { - ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); - parameterList.initDefaults(); - } else { - try { - File settingsFile = settingsDialog.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(settingsFile, null, ""); - - Preferences preferences = NbPreferences.root(); - String[] keys = filePreferences.keys(); - for (int i = 0; i < keys.length; i++) { - String key = keys[i]; - String value = filePreferences.get(key, null); - preferences.put(key, value); - } - - restoreInitialParameters(preferences); - - ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); - parameterList.loadParameters(filePreferences); - - } catch (Exception e) { - LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Parsing of User Settings File Failed", e); - setStatus(true, "Parsing of your Settings File failed"); - } - } - } - - return false; - } - - private boolean checkParametersForOK() { - // check files selected - - // if problem: return false; - return checkParametersForSave(); - } - - private boolean checkParametersForSave() { - - // ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); + protected boolean checkParameters() { + // ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); // check source parameters //ParameterError error = m_sourceParameterList.checkParameters(); // check specific parameters // if (error == null) { // error = parameterList.checkParameters(); // } -// +// // // report error // if (error != null) { // setStatus(true, error.getErrorMessage()); @@ -302,7 +211,31 @@ private boolean checkParametersForSave() { return true; } - private void saveParameters(Preferences preferences) { + @Override + protected void resetParameters() throws Exception { + ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); + parameterList.initDefaults(); + + } + + @Override + protected void loadParameters(Preferences filePreferences) throws Exception { + Preferences preferences = NbPreferences.root(); + String[] keys = filePreferences.keys(); + for (int i = 0; i < keys.length; i++) { + String key = keys[i]; + String value = filePreferences.get(key, null); + preferences.put(key, value); + } + + + ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); + parameterList.loadParameters(filePreferences); + } + + + @Override + protected void saveParameters(Preferences preferences) { ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); @@ -311,15 +244,31 @@ private void saveParameters(Preferences preferences) { preferences.put("IdentificationParser", parserSelected); // save file path - // Save Other Parameters + // Save Other Parameters //m_sourceParameterList.saveParameters(preferences); //parameterList.saveParameters(preferences); } - private void restoreInitialParameters(Preferences preferences) { + @Override + protected boolean okCalled() { + + // check parameters + if (!checkParameters()) { + return false; + } + saveParameters(NbPreferences.root()); + + return true; + + } + + @Override + protected boolean cancelCalled() { + return true; } + public HashMap getMSDiagSettings() { ParameterList parameterList = (ParameterList) m_parserComboBox.getSelectedItem(); return parameterList.getValues(); @@ -333,7 +282,7 @@ private ParameterList[] createParameters() { } private ParameterList createMSDiagSettings() { - ParameterList parameterList = new ParameterList(MSDIAG_SETTINGS); + ParameterList parameterList = new ParameterList(SETTINGS_KEY); parameterList.add(new StringParameter("score.windows", "Score windows (ex: 20-40-60)", JTextField.class, "20-40-60", null, null)); parameterList.add(new IntegerParameter("max.rank", "Max rank", JTextField.class, new Integer(1), new Integer(0), null)); //parameterList.add(new IntegerParameter("scan.groups.size", "Scan groups size", JTextField.class, new Integer(1), new Integer(0), new Integer(0))); @@ -341,23 +290,4 @@ private ParameterList createMSDiagSettings() { return parameterList; } - public class CertifyIdentificationProgress implements ProgressInterface { - - private boolean m_isLoaded = false; - - @Override - public boolean isLoaded() { - return m_isLoaded; - } - - @Override - public int getLoadingPercentage() { - return 0; // progress bar displayed as a waiting bar - } - - public void setLoaded() { - m_isLoaded = true; - } - }; - } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ManageSaveWindowsDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ManageSaveWindowsDialog.java index 944f66e42..0cdf49874 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ManageSaveWindowsDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ManageSaveWindowsDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/MemoryDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/MemoryDialog.java index c114d5b70..45d2cf796 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/MemoryDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/MemoryDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ModifyClusterStatusPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ModifyClusterStatusPanel.java new file mode 100644 index 000000000..6aaf67fc0 --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ModifyClusterStatusPanel.java @@ -0,0 +1,173 @@ +package fr.proline.studio.rsmexplorer.gui.dialog; + +import fr.proline.studio.dam.data.SelectLevelEnum; +import fr.proline.studio.dam.tasks.data.ptm.PTMCluster; +import fr.proline.studio.rsmexplorer.gui.SelectLevelRadioButtonGroup; +import fr.proline.studio.utils.IconManager; + +import javax.swing.*; +import javax.swing.text.DefaultFormatterFactory; +import javax.swing.text.NumberFormatter; +import java.awt.*; +import java.text.ParseException; + +public class ModifyClusterStatusPanel extends JPanel { + + protected static final String CMD_VALIDATED = "Validated"; + protected static final String CMD_INVALIDATED = "Invalidated"; + + private SelectLevelRadioButtonGroup m_validRButton; + private SelectLevelRadioButtonGroup m_invalidRButton; + private ButtonGroup m_statusButtonGroup; + private JFormattedTextField m_statusConfidenceLevelTF; + private JTextArea m_statusConfidenceInfoTA; + private PTMCluster m_editedCluster; + + public ModifyClusterStatusPanel() { + setLayout(new BorderLayout()); + + JPanel internalPanel = createInternalPanel(); + + add(internalPanel, BorderLayout.CENTER); + } + + private JPanel createInternalPanel() { + + JPanel p = new JPanel(new GridBagLayout()); + + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.insets = new java.awt.Insets(5, 5, 5, 5); + c.fill = GridBagConstraints.BOTH; + c.gridx = 0; + c.gridy = 0; + + JLabel statusTextLabel = new JLabel("Modification Cluster Status:"); + p.add(statusTextLabel, c); + + c.gridx++; + m_validRButton = new SelectLevelRadioButtonGroup(p, c, CMD_VALIDATED, IconManager.getIcon(IconManager.IconType.VALIDATED)); + m_validRButton.getRadioButton().setActionCommand(CMD_VALIDATED); + + + c.gridy++; + c.gridx = 1; + m_invalidRButton = new SelectLevelRadioButtonGroup(p, c, CMD_INVALIDATED,IconManager.getIcon(IconManager.IconType.INVALIDATED)); + m_invalidRButton.getRadioButton().setActionCommand(CMD_INVALIDATED); + + m_statusButtonGroup = new ButtonGroup(); + m_statusButtonGroup.add(m_validRButton.getRadioButton()); + m_statusButtonGroup.add(m_invalidRButton.getRadioButton()); + + c.fill = GridBagConstraints.BOTH; + c.gridy++; + c.gridx = 0; + JLabel statConfidenceLabel = new JLabel("Status Confidence level:"); + p.add(statConfidenceLabel, c); + + c.gridx++; + c.gridwidth = 4; + + m_statusConfidenceLevelTF = new JFormattedTextField(); + m_statusConfidenceLevelTF.setFormatterFactory(new DefaultFormatterFactory(new NumberAndNullFormatter())); + m_statusConfidenceLevelTF.setColumns(10); + p.add(m_statusConfidenceLevelTF, c); + + c.gridy++; + c.gridx = 0; + c.gridwidth = 1; + JLabel statConfidenceInfo = new JLabel("Status Confidence description:"); + p.add(statConfidenceInfo, c); + + c.gridx++; + c.gridwidth = 4; + c.weighty = 1; + JScrollPane scrollPane = new JScrollPane(); + m_statusConfidenceInfoTA = new JTextArea(5,20); + scrollPane.setViewportView(m_statusConfidenceInfoTA); + p.add(scrollPane, c); + + + return p; + } + + /** + * Apply Modification to currently displayed cluster + * + * @return true is modification has been done. + */ + public boolean applyModifiedStatus(){ + + String command = m_statusButtonGroup.getSelection().getActionCommand(); + boolean changedDone = false; + + if( command.equals(CMD_VALIDATED) && m_editedCluster.getSelectionLevel()<2) { + m_editedCluster.setSelectionLevel(3); + changedDone = true; + } + + if(command.equals(CMD_INVALIDATED) && m_editedCluster.getSelectionLevel()>=2) { + m_editedCluster.setSelectionLevel(0); + changedDone = true; + } + + //get confidence parameters values + String confidenceDesc = m_statusConfidenceInfoTA.getText(); + Integer confidenceNotation = (m_statusConfidenceLevelTF.getValue() == null || (m_statusConfidenceLevelTF.getValue().toString().isEmpty()) ) ? null : new Integer(m_statusConfidenceLevelTF.getValue().toString()); + + if( (confidenceDesc != null && !confidenceDesc.equals(m_editedCluster.getSelectionInfo())) || (confidenceDesc == null && m_editedCluster.getSelectionInfo() !=null)) { + m_editedCluster.setSelectionInfo(confidenceDesc); + changedDone = true; + } + + if( (confidenceNotation != null && !confidenceNotation.equals(m_editedCluster.getSelectionNotation())) || (confidenceNotation == null && m_editedCluster.getSelectionNotation() !=null)) { + m_editedCluster.setSelectionNotation(confidenceNotation); + changedDone = true; + } + + return changedDone; + } + + public void setData(PTMCluster clusterToModify) { + + m_editedCluster = clusterToModify; + int clusterSelectionLevel = clusterToModify.getSelectionLevel(); + Integer clusterNotation = clusterToModify.getSelectionNotation(); + String clusterDescription= clusterToModify.getSelectionInfo(); + + //Set selection level in Panel + SelectLevelEnum val =SelectLevelEnum.valueOf(clusterSelectionLevel); + switch (val){ + case RESET_AUTO: + case UNKNOWN: + break; + case DESELECTED_AUTO: + case DESELECTED_MANUAL: + m_invalidRButton.getRadioButton().setSelected( true); + break; + + case SELECTED_AUTO: + case SELECTED_MANUAL: + m_validRButton.getRadioButton().setSelected( true); + break; + } + + //Set description if common exist + m_statusConfidenceInfoTA.setText(clusterDescription); + + //Set confidence notation if common exist + m_statusConfidenceLevelTF.setValue(clusterNotation); + } + + private static class NumberAndNullFormatter extends NumberFormatter { + @Override + public Object stringToValue(String text) throws ParseException { + if ( text.length() == 0 ) + return null; + return super.stringToValue(text); + } + + } + + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SeqDBInfoDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SeqDBInfoDialog.java index a82180014..50a994a02 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SeqDBInfoDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SeqDBInfoDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import fr.proline.studio.gui.InfoDialog; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ServerConnectionDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ServerConnectionDialog.java index 5e4f465d9..28b20f353 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ServerConnectionDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ServerConnectionDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -19,14 +19,14 @@ import fr.proline.core.orm.uds.UserAccount; import fr.proline.studio.dam.DatabaseDataManager; import fr.proline.studio.dam.taskinfo.TaskError; +import fr.proline.studio.dock.AbstractTopPanel; import fr.proline.studio.dpm.ServerConnectionManager; import fr.proline.studio.gui.ConnectionDialog; import fr.proline.studio.pattern.DataboxDataAnalyzer; import fr.proline.studio.pattern.WindowBox; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; -import fr.proline.studio.rsmexplorer.MzdbFilesTopComponent; -import fr.proline.studio.rsmexplorer.PropertiesTopComponent; -import fr.proline.studio.rsmexplorer.TaskLogTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; +import fr.proline.studio.rsmexplorer.MzdbFilesTopPanel; +import fr.proline.studio.rsmexplorer.TaskLogTopPanel; import fr.proline.studio.rsmexplorer.gui.ProjectExplorerPanel; import fr.proline.studio.rsmexplorer.gui.TreeUtils; import fr.proline.studio.rsmexplorer.gui.calc.DataAnalyzerPanel; @@ -34,8 +34,7 @@ import java.util.Iterator; import java.util.Set; import javax.swing.*; -import org.openide.windows.TopComponent; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; /** * Dialog to Connect to the server @@ -88,14 +87,14 @@ protected boolean okCalled() { if (m_changingUser) { // close all specific windows - Set tcs = TopComponent.getRegistry().getOpened(); - Iterator itTop = tcs.iterator(); + Set tcs = WindowManager.getDefault().getMainWindow().getTopPanels(); + Iterator itTop = tcs.iterator(); while (itTop.hasNext()) { - TopComponent topComponent = itTop.next(); - if (((topComponent instanceof DataBoxViewerTopComponent) || (topComponent instanceof PropertiesTopComponent)) && !(topComponent instanceof TaskLogTopComponent)) { + AbstractTopPanel topComponent = itTop.next(); + if ( (topComponent instanceof DataBoxViewerTopPanel) && !(topComponent instanceof TaskLogTopPanel)) { - if (topComponent instanceof DataBoxViewerTopComponent) { - DataBoxViewerTopComponent databoxComponent = (DataBoxViewerTopComponent) topComponent; + if (topComponent instanceof DataBoxViewerTopPanel) { + DataBoxViewerTopPanel databoxComponent = (DataBoxViewerTopPanel) topComponent; WindowBox winBox = databoxComponent.getWindowBox(); if (winBox.getEntryBox() instanceof DataboxDataAnalyzer) { DataboxDataAnalyzer analyzer = (DataboxDataAnalyzer) winBox.getEntryBox(); @@ -106,7 +105,8 @@ protected boolean okCalled() { } } - topComponent.close(); + WindowManager.getDefault().getMainWindow().closeWindow(topComponent); + } } @@ -212,9 +212,9 @@ public void run() { if (m_serverURLTextField != null && m_serverURLTextField.isEnabled()) { - if (MzdbFilesTopComponent.getExplorer() != null) { - MzdbFilesTopComponent.getExplorer().getTreeFileChooserPanel().initTree(); - MzdbFilesTopComponent.getExplorer().getTreeFileChooserPanel().restoreTree(TreeUtils.TreeType.SERVER); + if (MzdbFilesTopPanel.getExplorer() != null) { + MzdbFilesTopPanel.getExplorer().getTreeFileChooserPanel().initTree(); + MzdbFilesTopPanel.getExplorer().getTreeFileChooserPanel().restoreTree(TreeUtils.TreeType.SERVER); } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SetQuantitationDSNameDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SetQuantitationDSNameDialog.java index 0eee0fbcb..804f534b1 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SetQuantitationDSNameDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SetQuantitationDSNameDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SetQuantitationDSNamePanel.form b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SetQuantitationDSNamePanel.form deleted file mode 100644 index d106e9b0d..000000000 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SetQuantitationDSNamePanel.form +++ /dev/null @@ -1,144 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SetQuantitationDSNamePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SetQuantitationDSNamePanel.java index fc064e4f4..2b619a402 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SetQuantitationDSNamePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SetQuantitationDSNamePanel.java @@ -1,21 +1,23 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; +import fr.proline.studio.utils.StudioResourceBundle; + import javax.swing.JTextField; /** @@ -69,18 +71,18 @@ private void initComponents() { jTextArea1.setRows(5); jScrollPane1.setViewportView(jTextArea1); - setToolTipText(org.openide.util.NbBundle.getMessage(SetQuantitationDSNamePanel.class, "SetQuantitationDSNamePanel.toolTipText")); // NOI18N + setToolTipText(StudioResourceBundle.getMessage(SetQuantitationDSNamePanel.class, "SetQuantitationDSNamePanel.toolTipText")); // NOI18N - propertiesPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(SetQuantitationDSNamePanel.class, "SetQuantitationDSNamePanel.propertiesPanel.border.title"))); // NOI18N + propertiesPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(StudioResourceBundle.getMessage(SetQuantitationDSNamePanel.class, "SetQuantitationDSNamePanel.propertiesPanel.border.title"))); // NOI18N propertiesPanel.setMinimumSize(new java.awt.Dimension(50, 50)); - nameLabel.setText(org.openide.util.NbBundle.getMessage(SetQuantitationDSNamePanel.class, "SetQuantitationDSNamePanel.nameLabel.text")); // NOI18N + nameLabel.setText(StudioResourceBundle.getMessage(SetQuantitationDSNamePanel.class, "SetQuantitationDSNamePanel.nameLabel.text")); // NOI18N - nameTextField.setText(org.openide.util.NbBundle.getMessage(SetQuantitationDSNamePanel.class, "SetQuantitationDSNamePanel.nameTextField.text")); // NOI18N + nameTextField.setText(StudioResourceBundle.getMessage(SetQuantitationDSNamePanel.class, "SetQuantitationDSNamePanel.nameTextField.text")); // NOI18N - descrPanel.setText(org.openide.util.NbBundle.getMessage(SetQuantitationDSNamePanel.class, "SetQuantitationDSNamePanel.descrPanel.text")); // NOI18N + descrPanel.setText(StudioResourceBundle.getMessage(SetQuantitationDSNamePanel.class, "SetQuantitationDSNamePanel.descrPanel.text")); // NOI18N - descrTextField.setText(org.openide.util.NbBundle.getMessage(SetQuantitationDSNamePanel.class, "SetQuantitationDSNamePanel.descrTextField.text")); // NOI18N + descrTextField.setText(StudioResourceBundle.getMessage(SetQuantitationDSNamePanel.class, "SetQuantitationDSNamePanel.descrTextField.text")); // NOI18N javax.swing.GroupLayout propertiesPanelLayout = new javax.swing.GroupLayout(propertiesPanel); propertiesPanel.setLayout(propertiesPanelLayout); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SystemInfoDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SystemInfoDialog.java index edcd24775..338899777 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SystemInfoDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/SystemInfoDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/TreeSelectionDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/TreeSelectionDialog.java index eab1495f8..d37bf9e34 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/TreeSelectionDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/TreeSelectionDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import fr.proline.core.orm.msi.ResultSummary; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/UpdatePeaklistSoftDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/UpdatePeaklistSoftDialog.java index fcb3cfad1..09ee3ea03 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/UpdatePeaklistSoftDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/UpdatePeaklistSoftDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/UploadDatDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/UploadDatDialog.java index 501aef0fe..fe3a28b11 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/UploadDatDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/UploadDatDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog; import fr.proline.studio.gui.DefaultDialog; @@ -45,7 +45,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.filechooser.FileNameExtensionFilter; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/UploadMzdbDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/UploadMzdbDialog.java index 6a6b4ed31..d79fbef6f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/UploadMzdbDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/UploadMzdbDialog.java @@ -1,320 +1,320 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.gui.dialog; - -import fr.proline.studio.dpm.serverfilesystem.RootInfo; -import fr.proline.studio.dpm.serverfilesystem.ServerFileSystemView; -import fr.proline.studio.gui.DefaultDialog; -import static fr.proline.studio.gui.DefaultDialog.BUTTON_CANCEL; -import static fr.proline.studio.gui.DefaultDialog.BUTTON_OK; -import fr.proline.studio.parameter.BooleanParameter; -import fr.proline.studio.parameter.ObjectParameter; -import fr.proline.studio.parameter.ParameterError; -import fr.proline.studio.parameter.ParameterList; -import fr.proline.studio.utils.IconManager; -import fr.proline.studio.msfiles.MzdbUploadBatch; -import fr.proline.studio.msfiles.MzdbUploadSettings; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dialog; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Window; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.prefs.Preferences; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JFileChooser; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.filechooser.FileNameExtensionFilter; -import org.openide.util.NbPreferences; - -/** - * - * @author AK249877 - */ -public class UploadMzdbDialog extends DefaultDialog implements FileDialogInterface { - - private static UploadMzdbDialog m_singletonDialog = null; - private static JList m_fileList; - private JScrollPane m_fileListScrollPane; - private JButton m_addFileButton, m_removeFileButton; - private static ParameterList m_parameterList; - private BooleanParameter m_deleteMzdbParameter, m_createParentDirectoryParameter; - private static ObjectParameter m_uploadLabelParameter; - private String m_lastParentDirectory; - - public static UploadMzdbDialog getDialog(Window parent) { - if (m_singletonDialog == null) { - m_singletonDialog = new UploadMzdbDialog(parent); - } else { - ArrayList labels = ServerFileSystemView.getServerFileSystemView().getLabels(RootInfo.TYPE_MZDB_FILES); - Object[] associatedTable = labels.toArray(new String[labels.size()]); - Object[] objectTable = labels.toArray(new String[labels.size()]); - m_uploadLabelParameter.updateAssociatedObjects(associatedTable); - m_uploadLabelParameter.updateObjects(objectTable); - m_parameterList.loadParameters(NbPreferences.root()); - if (m_fileList != null) { - DefaultListModel model = (DefaultListModel) m_fileList.getModel(); - model.clear(); - } - } - - return m_singletonDialog; - } - - public UploadMzdbDialog(Window parent) { - super(parent, Dialog.ModalityType.MODELESS); - - setTitle("Upload mzDB file(s)"); - - setSize(new Dimension(360, 480)); - setResizable(true); - - this.setDocumentationSuffix("h.x6aqgbmas2le"); - - setButtonVisible(BUTTON_CANCEL, true); - setButtonName(BUTTON_OK, "OK"); - setStatusVisible(true); - - setInternalComponent(createInternalComponent()); - - } - - @Override - public void setFiles(ArrayList files) { - ((DefaultListModel) m_fileList.getModel()).clear(); - if (files.size() > 0) { - for (File f : files) { - ((DefaultListModel) m_fileList.getModel()).addElement(f); - } - - if (files.get(0).getParentFile() != null) { - m_lastParentDirectory = files.get(0).getParentFile().getAbsolutePath(); - } - } - } - - private Component createInternalComponent() { - JPanel internalPanel = new JPanel(); - internalPanel.setLayout(new BorderLayout()); - internalPanel.add(createFileSelectionPanel(), BorderLayout.CENTER); - internalPanel.add(createParameterPanel(), BorderLayout.SOUTH); - return internalPanel; - } - - private JPanel createParameterPanel() { - m_parameterList = new ParameterList("mzDB Settings"); - JCheckBox deleteCheckbox = new JCheckBox("Delete mzdb file after a successful upload"); - m_deleteMzdbParameter = new BooleanParameter("DELETE_MZDB", "Delete mzdb file after a successful upload", deleteCheckbox, false); - m_parameterList.add(m_deleteMzdbParameter); - - JCheckBox parentDirectoryCheckbox = new JCheckBox("Create Parent Directory in Destination"); - m_createParentDirectoryParameter = new BooleanParameter("CREATE_PARENT_DIRECTORY", "Create Parent Directory in Destination", parentDirectoryCheckbox, false); - m_parameterList.add(m_createParentDirectoryParameter); - - ArrayList labels = ServerFileSystemView.getServerFileSystemView().getLabels(RootInfo.TYPE_MZDB_FILES); - - Object[] associatedTable = labels.toArray(new String[labels.size()]); - JComboBox namingComboBox = new JComboBox(associatedTable); - Object[] objectTable = labels.toArray(new String[labels.size()]); - m_uploadLabelParameter = new ObjectParameter("MZDB_MOUNT_LABEL", "Server's mounting point", namingComboBox, associatedTable, objectTable, 0, null); - m_parameterList.add(m_uploadLabelParameter); - - m_parameterList.loadParameters(NbPreferences.root()); - - JPanel parameterPanel = m_parameterList.getPanel(); - parameterPanel.setBorder(BorderFactory.createTitledBorder(" Upload Options ")); - - return parameterPanel; - } - - private JPanel createFileSelectionPanel() { - - // Creation of Objects for File Selection Panel - JPanel fileSelectionPanel = new JPanel(new GridBagLayout()); - fileSelectionPanel.setBorder(BorderFactory.createTitledBorder(" Files Selection ")); - - m_fileList = new JList<>(new DefaultListModel()); - m_fileListScrollPane = new JScrollPane(m_fileList) { - - private Dimension preferredSize = new Dimension(360, 200); - - @Override - public Dimension getPreferredSize() { - return preferredSize; - } - }; - - m_addFileButton = new JButton(IconManager.getIcon(IconManager.IconType.OPEN_FILE)); - m_addFileButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); - m_removeFileButton = new JButton(IconManager.getIcon(IconManager.IconType.ERASER)); - m_removeFileButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); - - // Placement of Objects for File Selection Panel - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - c.gridx = 0; - c.gridy = 0; - c.gridheight = 3; - c.weightx = 1.0; - c.weighty = 1.0; - fileSelectionPanel.add(m_fileListScrollPane, c); - - c.gridx++; - c.gridheight = 1; - c.weightx = 0; - c.weighty = 0; - fileSelectionPanel.add(m_addFileButton, c); - - c.gridy++; - fileSelectionPanel.add(m_removeFileButton, c); - - c.gridy++; - fileSelectionPanel.add(Box.createVerticalStrut(30), c); - - // Actions on objects - m_fileList.addListSelectionListener(new ListSelectionListener() { - - @Override - public void valueChanged(ListSelectionEvent e) { - boolean sometingSelected = (m_fileList.getSelectedIndex() != -1); - m_removeFileButton.setEnabled(sometingSelected); - } - }); - - m_addFileButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - - Preferences preferences = NbPreferences.root(); - String initializationDirectory = preferences.get("mzDB_Settings.LAST_MZDB_PATH", System.getProperty("user.home")); - - File f = new File(initializationDirectory); - if (!(f.exists() && f.isDirectory())) { - initializationDirectory = System.getProperty("user.home"); - } - - JFileChooser fchooser = new JFileChooser(initializationDirectory); - - fchooser.setMultiSelectionEnabled(true); - - fchooser.addChoosableFileFilter(new FileNameExtensionFilter(".mzdb", "mzDB")); - fchooser.setAcceptAllFileFilterUsed(false); - - //put the one and only filter here! (.mzdb) - int result = fchooser.showOpenDialog(m_singletonDialog); - if (result == JFileChooser.APPROVE_OPTION) { - - File[] files = fchooser.getSelectedFiles(); - int nbFiles = files.length; - for (int i = 0; i < nbFiles; i++) { - ((DefaultListModel) m_fileList.getModel()).addElement(files[i]); - } - - if (files.length > 0) { - if (files[0].getParentFile() != null) { - m_lastParentDirectory = files[0].getParentFile().getAbsolutePath(); - } - } - } - } - }); - - m_removeFileButton.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - List selectedValues = m_fileList.getSelectedValuesList(); - Iterator it = selectedValues.iterator(); - while (it.hasNext()) { - ((DefaultListModel) m_fileList.getModel()).removeElement(it.next()); - } - m_removeFileButton.setEnabled(false); - } - }); - - return fileSelectionPanel; - - } - - @Override - protected boolean okCalled() { - if (m_fileList.getModel().getSize() == 0) { - setStatus(true, "No files are selected."); - highlight(m_fileList); - return false; - } - ParameterError error = m_parameterList.checkParameters(); - if (error != null) { - setStatus(true, error.getErrorMessage()); - highlight(error.getParameterComponent()); - return false; - } - m_parameterList.saveParameters(NbPreferences.root()); - - if (m_lastParentDirectory != null) { - Preferences preferences = NbPreferences.root(); - preferences.put("mzDB_Settings.LAST_MZDB_PATH", m_lastParentDirectory); - } - - HashMap mzdbFiles = new HashMap(); - for (int i = 0; i < m_fileList.getModel().getSize(); i++) { - - File file = (File) m_fileList.getModel().getElementAt(i); - - MzdbUploadSettings uploadSettings = new MzdbUploadSettings((boolean) m_deleteMzdbParameter.getObjectValue(), m_uploadLabelParameter.getStringValue(), (boolean) m_createParentDirectoryParameter.getObjectValue() ? File.separator + file.getParentFile().getName() : ""); - - mzdbFiles.put((File) m_fileList.getModel().getElementAt(i), uploadSettings); - } - - MzdbUploadBatch uploadBatch = new MzdbUploadBatch(mzdbFiles); - Thread thread = new Thread(uploadBatch); - thread.start(); - - DefaultListModel listModel = (DefaultListModel) m_fileList.getModel(); - listModel.removeAllElements(); - - return true; - - } - - @Override - protected boolean cancelCalled() { - return true; - } - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.gui.dialog; + +import fr.proline.studio.dpm.serverfilesystem.RootInfo; +import fr.proline.studio.dpm.serverfilesystem.ServerFileSystemView; +import fr.proline.studio.gui.DefaultDialog; +import static fr.proline.studio.gui.DefaultDialog.BUTTON_CANCEL; +import static fr.proline.studio.gui.DefaultDialog.BUTTON_OK; +import fr.proline.studio.parameter.BooleanParameter; +import fr.proline.studio.parameter.ObjectParameter; +import fr.proline.studio.parameter.ParameterError; +import fr.proline.studio.parameter.ParameterList; +import fr.proline.studio.utils.IconManager; +import fr.proline.studio.msfiles.MzdbUploadBatch; +import fr.proline.studio.msfiles.MzdbUploadSettings; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.prefs.Preferences; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.DefaultListModel; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JFileChooser; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.filechooser.FileNameExtensionFilter; +import fr.proline.studio.NbPreferences; + +/** + * + * @author AK249877 + */ +public class UploadMzdbDialog extends DefaultDialog implements FileDialogInterface { + + private static UploadMzdbDialog m_singletonDialog = null; + private static JList m_fileList; + private JScrollPane m_fileListScrollPane; + private JButton m_addFileButton, m_removeFileButton; + private static ParameterList m_parameterList; + private BooleanParameter m_deleteMzdbParameter, m_createParentDirectoryParameter; + private static ObjectParameter m_uploadLabelParameter; + private String m_lastParentDirectory; + + public static UploadMzdbDialog getDialog(Window parent) { + if (m_singletonDialog == null) { + m_singletonDialog = new UploadMzdbDialog(parent); + } else { + ArrayList labels = ServerFileSystemView.getServerFileSystemView().getLabels(RootInfo.TYPE_MZDB_FILES); + Object[] associatedTable = labels.toArray(new String[labels.size()]); + Object[] objectTable = labels.toArray(new String[labels.size()]); + m_uploadLabelParameter.updateAssociatedObjects(associatedTable); + m_uploadLabelParameter.updateObjects(objectTable); + m_parameterList.loadParameters(NbPreferences.root()); + if (m_fileList != null) { + DefaultListModel model = (DefaultListModel) m_fileList.getModel(); + model.clear(); + } + } + + return m_singletonDialog; + } + + public UploadMzdbDialog(Window parent) { + super(parent, Dialog.ModalityType.MODELESS); + + setTitle("Upload mzDB file(s)"); + + setSize(new Dimension(360, 480)); + setResizable(true); + + this.setDocumentationSuffix("h.x6aqgbmas2le"); + + setButtonVisible(BUTTON_CANCEL, true); + setButtonName(BUTTON_OK, "OK"); + setStatusVisible(true); + + setInternalComponent(createInternalComponent()); + + } + + @Override + public void setFiles(ArrayList files) { + ((DefaultListModel) m_fileList.getModel()).clear(); + if (files.size() > 0) { + for (File f : files) { + ((DefaultListModel) m_fileList.getModel()).addElement(f); + } + + if (files.get(0).getParentFile() != null) { + m_lastParentDirectory = files.get(0).getParentFile().getAbsolutePath(); + } + } + } + + private Component createInternalComponent() { + JPanel internalPanel = new JPanel(); + internalPanel.setLayout(new BorderLayout()); + internalPanel.add(createFileSelectionPanel(), BorderLayout.CENTER); + internalPanel.add(createParameterPanel(), BorderLayout.SOUTH); + return internalPanel; + } + + private JPanel createParameterPanel() { + m_parameterList = new ParameterList("mzDB Settings"); + JCheckBox deleteCheckbox = new JCheckBox("Delete mzdb file after a successful upload"); + m_deleteMzdbParameter = new BooleanParameter("DELETE_MZDB", "Delete mzdb file after a successful upload", deleteCheckbox, false); + m_parameterList.add(m_deleteMzdbParameter); + + JCheckBox parentDirectoryCheckbox = new JCheckBox("Create Parent Directory in Destination"); + m_createParentDirectoryParameter = new BooleanParameter("CREATE_PARENT_DIRECTORY", "Create Parent Directory in Destination", parentDirectoryCheckbox, false); + m_parameterList.add(m_createParentDirectoryParameter); + + ArrayList labels = ServerFileSystemView.getServerFileSystemView().getLabels(RootInfo.TYPE_MZDB_FILES); + + Object[] associatedTable = labels.toArray(new String[labels.size()]); + JComboBox namingComboBox = new JComboBox(associatedTable); + Object[] objectTable = labels.toArray(new String[labels.size()]); + m_uploadLabelParameter = new ObjectParameter("MZDB_MOUNT_LABEL", "Server's mounting point", namingComboBox, associatedTable, objectTable, 0, null); + m_parameterList.add(m_uploadLabelParameter); + + m_parameterList.loadParameters(NbPreferences.root()); + + JPanel parameterPanel = m_parameterList.getPanel(); + parameterPanel.setBorder(BorderFactory.createTitledBorder(" Upload Options ")); + + return parameterPanel; + } + + private JPanel createFileSelectionPanel() { + + // Creation of Objects for File Selection Panel + JPanel fileSelectionPanel = new JPanel(new GridBagLayout()); + fileSelectionPanel.setBorder(BorderFactory.createTitledBorder(" Files Selection ")); + + m_fileList = new JList<>(new DefaultListModel()); + m_fileListScrollPane = new JScrollPane(m_fileList) { + + private Dimension preferredSize = new Dimension(360, 200); + + @Override + public Dimension getPreferredSize() { + return preferredSize; + } + }; + + m_addFileButton = new JButton(IconManager.getIcon(IconManager.IconType.OPEN_FILE)); + m_addFileButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); + m_removeFileButton = new JButton(IconManager.getIcon(IconManager.IconType.ERASER)); + m_removeFileButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); + + // Placement of Objects for File Selection Panel + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.insets = new java.awt.Insets(5, 5, 5, 5); + + c.gridx = 0; + c.gridy = 0; + c.gridheight = 3; + c.weightx = 1.0; + c.weighty = 1.0; + fileSelectionPanel.add(m_fileListScrollPane, c); + + c.gridx++; + c.gridheight = 1; + c.weightx = 0; + c.weighty = 0; + fileSelectionPanel.add(m_addFileButton, c); + + c.gridy++; + fileSelectionPanel.add(m_removeFileButton, c); + + c.gridy++; + fileSelectionPanel.add(Box.createVerticalStrut(30), c); + + // Actions on objects + m_fileList.addListSelectionListener(new ListSelectionListener() { + + @Override + public void valueChanged(ListSelectionEvent e) { + boolean sometingSelected = (m_fileList.getSelectedIndex() != -1); + m_removeFileButton.setEnabled(sometingSelected); + } + }); + + m_addFileButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + + Preferences preferences = NbPreferences.root(); + String initializationDirectory = preferences.get("mzDB_Settings.LAST_MZDB_PATH", System.getProperty("user.home")); + + File f = new File(initializationDirectory); + if (!(f.exists() && f.isDirectory())) { + initializationDirectory = System.getProperty("user.home"); + } + + JFileChooser fchooser = new JFileChooser(initializationDirectory); + + fchooser.setMultiSelectionEnabled(true); + + fchooser.addChoosableFileFilter(new FileNameExtensionFilter(".mzdb", "mzDB")); + fchooser.setAcceptAllFileFilterUsed(false); + + //put the one and only filter here! (.mzdb) + int result = fchooser.showOpenDialog(m_singletonDialog); + if (result == JFileChooser.APPROVE_OPTION) { + + File[] files = fchooser.getSelectedFiles(); + int nbFiles = files.length; + for (int i = 0; i < nbFiles; i++) { + ((DefaultListModel) m_fileList.getModel()).addElement(files[i]); + } + + if (files.length > 0) { + if (files[0].getParentFile() != null) { + m_lastParentDirectory = files[0].getParentFile().getAbsolutePath(); + } + } + } + } + }); + + m_removeFileButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + List selectedValues = m_fileList.getSelectedValuesList(); + Iterator it = selectedValues.iterator(); + while (it.hasNext()) { + ((DefaultListModel) m_fileList.getModel()).removeElement(it.next()); + } + m_removeFileButton.setEnabled(false); + } + }); + + return fileSelectionPanel; + + } + + @Override + protected boolean okCalled() { + if (m_fileList.getModel().getSize() == 0) { + setStatus(true, "No files are selected."); + highlight(m_fileList); + return false; + } + ParameterError error = m_parameterList.checkParameters(); + if (error != null) { + setStatus(true, error.getErrorMessage()); + highlight(error.getParameterComponent()); + return false; + } + m_parameterList.saveParameters(NbPreferences.root()); + + if (m_lastParentDirectory != null) { + Preferences preferences = NbPreferences.root(); + preferences.put("mzDB_Settings.LAST_MZDB_PATH", m_lastParentDirectory); + } + + HashMap mzdbFiles = new HashMap(); + for (int i = 0; i < m_fileList.getModel().getSize(); i++) { + + File file = (File) m_fileList.getModel().getElementAt(i); + + MzdbUploadSettings uploadSettings = new MzdbUploadSettings((boolean) m_deleteMzdbParameter.getObjectValue(), m_uploadLabelParameter.getStringValue(), (boolean) m_createParentDirectoryParameter.getObjectValue() ? File.separator + file.getParentFile().getName() : ""); + + mzdbFiles.put((File) m_fileList.getModel().getElementAt(i), uploadSettings); + } + + MzdbUploadBatch uploadBatch = new MzdbUploadBatch(mzdbFiles); + Thread thread = new Thread(uploadBatch); + thread.start(); + + DefaultListModel listModel = (DefaultListModel) m_fileList.getModel(); + listModel.removeAllElements(); + + return true; + + } + + @Override + protected boolean cancelCalled() { + return true; + } + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ValidationDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ValidationDialog.java index fedf3aab5..2d77f406a 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ValidationDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/ValidationDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -18,6 +18,9 @@ import fr.proline.core.orm.msi.ResultSet; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.Exceptions; +import fr.proline.studio.NbPreferences; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; import fr.proline.studio.dam.tasks.AbstractDatabaseTask; @@ -26,23 +29,16 @@ import fr.proline.studio.dpm.data.ChangeTypicalRule; import fr.proline.studio.dpm.task.jms.ValidationTask; import fr.proline.studio.gui.DefaultDialog; +import fr.proline.studio.gui.DefaultStorableDialog; import fr.proline.studio.gui.InfoDialog; -import fr.proline.studio.gui.OptionDialog; import fr.proline.studio.parameter.*; -import fr.proline.studio.settings.FilePreferences; -import fr.proline.studio.settings.SettingsDialog; -import fr.proline.studio.settings.SettingsUtils; -import org.openide.util.NbPreferences; -import org.openide.windows.WindowManager; -import org.slf4j.LoggerFactory; -import javax.swing.*; import javax.swing.Timer; +import javax.swing.*; import java.awt.*; import java.awt.event.*; -import java.io.File; -import java.util.*; import java.util.List; +import java.util.*; import java.util.prefs.Preferences; /** @@ -51,7 +47,7 @@ * * @author JM235353 */ -public class ValidationDialog extends DefaultDialog implements ComponentListener { +public class ValidationDialog extends DefaultStorableDialog { private static ValidationDialog m_singletonDialog = null; @@ -74,6 +70,8 @@ public class ValidationDialog extends DefaultDialog implements ComponentListener //WARNING VDS: If current param version change load behaviour may also change private final Integer VALIDATION_PARAM_CURRENT_VERSION = 3; + private boolean m_checkFDR = true; // Specify if CheckParameter also check FDR info + private final ParameterList m_parameterList; private AbstractParameter[] m_psmPrefilterParameters; @@ -109,7 +107,7 @@ public class ValidationDialog extends DefaultDialog implements ComponentListener private JComboBox m_psmFdrMethodComboBox = null; private AbstractParameter m_psmFdrCheckboxParameter; private JCheckBox m_psmFdrCheckbox = null; - private JComboBox m_tdAnalyzerComboBox = null; +// private JComboBox m_tdAnalyzerComboBox = null; private JPanel m_tdParamsPanel; // private JLabel m_tdAnalyzerParamLabel = null; // private JTextField m_tdAnalyzerParamTF = null; @@ -154,14 +152,12 @@ public static ValidationDialog getDialog(Window parent) { public ValidationDialog(Window parent) { super(parent, Dialog.ModalityType.APPLICATION_MODAL); + setResizable(true); setTitle("Identification Validation"); setDocumentationSuffix("id.42ddq1a"); - setButtonVisible(BUTTON_LOAD, true); - setButtonVisible(BUTTON_SAVE, true); - m_parameterList = new ParameterList("Validation"); createParameters(); m_parameterList.updateValues(NbPreferences.root()); @@ -178,6 +174,7 @@ public ValidationDialog(Window parent) { } + public synchronized void setHasDecoy(DecoyStatus hasDecoy) { m_hasDecoy = hasDecoy; } @@ -278,6 +275,7 @@ private JPanel createInternalPanel() { c.gridx = 0; c.gridy = 0; c.weightx = 1.0; + c.weighty = 1.0; internalPanel.add(tabbedPane, c); return internalPanel; @@ -285,6 +283,9 @@ private JPanel createInternalPanel() { private JPanel createValidationPanel() { + JPanel validationPanel = new JPanel(new BorderLayout()); + JScrollPane sPane = new JScrollPane(); + JPanel psmTabPanel = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); @@ -303,7 +304,9 @@ private JPanel createValidationPanel() { c.gridy++; psmTabPanel.add(createProteinSetFilterPanel(), c); - return psmTabPanel; + sPane.setViewportView(psmTabPanel); + validationPanel.add(sPane, BorderLayout.CENTER); + return validationPanel; } private JPanel createPeptideFilterPanel() { @@ -343,12 +346,9 @@ private JPanel createPSMFilterPanel() { m_propagatePsmFiltersCheckBox.setSelected(false); m_propagatePsmFiltersCheckBox.setEnabled(m_allowPropagateFilters); panel.add(m_propagatePsmFiltersCheckBox, c); - m_propagatePsmFiltersCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - boolean enabled = (m_propagatePsmFiltersCheckBox.isSelected()); - m_propagatePsmFiltersParameter.setUsed(enabled); - } + m_propagatePsmFiltersCheckBox.addActionListener(e -> { + boolean enabled = (m_propagatePsmFiltersCheckBox.isSelected()); + m_propagatePsmFiltersParameter.setUsed(enabled); }); c.gridy++; @@ -356,7 +356,6 @@ public void actionPerformed(ActionEvent e) { m_psmPrefiltersPanel = new ParametersComboPanel(" Prefilter(s) ", m_psmPrefilterParameters); panel.add(m_psmPrefiltersPanel, c); - m_psmPrefiltersPanel.addComponentListener(this); c.gridy++; panel.add(createPSMFDRPanel(), c); @@ -409,9 +408,7 @@ private JPanel createPSMFDRPanel() { c.weightx = 0.1; m_tdParamsPanel.add(Box.createHorizontalBox(), c); - m_psmFdrCheckbox.addActionListener((ActionEvent e) -> { - updatePSMFDRObjects(m_psmFdrCheckbox.isSelected()); - }); + m_psmFdrCheckbox.addActionListener((ActionEvent e) -> updatePSMFDRObjects(m_psmFdrCheckbox.isSelected())); // enable frd by clicking on any component MouseListener actionOnClick = new MouseAdapter() { @@ -553,9 +550,7 @@ private JPanel createPeptideFDRPanel() { c.weightx = 1.0; fdrPanel.add(Box.createHorizontalBox(), c); - m_peptideFdrCheckbox.addActionListener((ActionEvent e) -> { - updatePeptideFDRObjects(m_peptideFdrCheckbox.isSelected()); - }); + m_peptideFdrCheckbox.addActionListener((ActionEvent e) -> updatePeptideFDRObjects(m_peptideFdrCheckbox.isSelected())); MouseListener actionOnClick = new MouseAdapter() { @@ -593,17 +588,11 @@ private JPanel createProteinSetFilterPanel() { m_propagateProtSetFiltersCheckBox.setEnabled(m_allowPropagateFilters); proteinSetFilterPanel.add(m_propagateProtSetFiltersCheckBox, c); - m_propagateProtSetFiltersCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - m_propagateProtSetFiltersParameter.setUsed(m_propagateProtSetFiltersCheckBox.isSelected()); - } - }); + m_propagateProtSetFiltersCheckBox.addActionListener(e -> m_propagateProtSetFiltersParameter.setUsed(m_propagateProtSetFiltersCheckBox.isSelected())); c.gridy++; c.weightx = 1.0; m_proteinPrefiltersPanel = new ParametersComboPanel(" Filter(s) ", m_proteinPrefilterParameters); - m_proteinPrefiltersPanel.addComponentListener(this); proteinSetFilterPanel.add(m_proteinPrefiltersPanel, c); c.gridy++; @@ -643,12 +632,7 @@ private JPanel createTypicalProteinPanel() { m_typicalProteinMatchCheckBox.setHorizontalAlignment(SwingConstants.RIGHT); typicalProteinPanel.add(m_typicalProteinMatchCheckBox, c); - m_typicalProteinMatchCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - m_changeTypicalPanel.enableRules(m_typicalProteinMatchCheckBox.isSelected()); - } - }); + m_typicalProteinMatchCheckBox.addActionListener(e -> m_changeTypicalPanel.enableRules(m_typicalProteinMatchCheckBox.isSelected())); c.gridx = 0; c.gridy++; @@ -691,9 +675,7 @@ private JPanel createProteinFDRPanel() { c.gridx++; fdrPanel.add(m_proteinFdrMethodComboBox, c); - m_proteinFdrMethodComboBox.addActionListener((ActionEvent e) -> { - synchFDRMethods((JComboBox)e.getSource()); - }); + m_proteinFdrMethodComboBox.addActionListener((ActionEvent e) -> synchFDRMethods((JComboBox)e.getSource())); c.gridx++; fdrPanel.add(m_proteinFdrLabel, c); @@ -708,9 +690,7 @@ private JPanel createProteinFDRPanel() { c.weightx = 1.0; fdrPanel.add(Box.createHorizontalBox(), c); - m_proteinFdrCheckbox.addActionListener((ActionEvent e) -> { - updateProteinFDRObjects(m_proteinFdrCheckbox.isSelected()); - }); + m_proteinFdrCheckbox.addActionListener((ActionEvent e) -> updateProteinFDRObjects(m_proteinFdrCheckbox.isSelected())); MouseListener actionOnClick = new MouseAdapter() { @Override @@ -765,7 +745,7 @@ private void restoreScoringTypeParameter(Preferences preferences) { private void restoreTypicalProteinParameters(Preferences preferences) { - boolean useTypicalProteinRegex =(preferences == null) ? true : preferences.getBoolean("UseTypicalProteinRegex", true); + boolean useTypicalProteinRegex = (preferences == null) || preferences.getBoolean("UseTypicalProteinRegex", true); m_typicalProteinMatchCheckBox.setSelected(useTypicalProteinRegex); m_changeTypicalPanel.restoreInitialParameters(); @@ -824,30 +804,32 @@ private void updateFdrMethod(){ } private void createParameters() { - m_psmPrefilterParameters = new AbstractParameter[11]; //<< get sync + m_psmPrefilterParameters = new AbstractParameter[12]; //<< get sync m_psmPrefilterParameters[0] = null; - m_psmPrefilterParameters[1] = new IntegerParameter("PSM_" + ValidationTask.PSMFilter.RANK.key, ValidationTask.PSMFilter.RANK.name, new JTextField(6), new Integer(1), new Integer(0), new Integer(10)); + m_psmPrefilterParameters[1] = new IntegerParameter("PSM_" + ValidationTask.PSMFilter.RANK.key, ValidationTask.PSMFilter.RANK.name, new JTextField(6), 1, 0, 10); m_psmPrefilterParameters[1].setAssociatedData("<="); m_psmPrefilterParameters[1].addBackwardCompatibleKey("Rank"); m_psmPrefilterParameters[1].addBackwardCompatibleKey("PSM_RANK"); - m_psmPrefilterParameters[2] = new IntegerParameter("PSM_" + ValidationTask.PSMFilter.PEP_LENGTH.key, ValidationTask.PSMFilter.PEP_LENGTH.name, new JTextField(6), new Integer(4), new Integer(4), null); + m_psmPrefilterParameters[2] = new IntegerParameter("PSM_" + ValidationTask.PSMFilter.PEP_LENGTH.key, ValidationTask.PSMFilter.PEP_LENGTH.name, new JTextField(6), 4, 4, null); m_psmPrefilterParameters[2].setAssociatedData(">="); - m_psmPrefilterParameters[3] = new DoubleParameter("PSM_" + ValidationTask.PSMFilter.SCORE.key, ValidationTask.PSMFilter.SCORE.name, new JTextField(6), new Double(0), new Double(0), null); + m_psmPrefilterParameters[3] = new DoubleParameter("PSM_" + ValidationTask.PSMFilter.SCORE.key, ValidationTask.PSMFilter.SCORE.name, new JTextField(6), Double.valueOf(0), Double.valueOf(0), null); m_psmPrefilterParameters[3].setAssociatedData(">="); - m_psmPrefilterParameters[4] = new DoubleParameter("PSM_" + ValidationTask.PSMFilter.MASCOT_EVAL.key, ValidationTask.PSMFilter.MASCOT_EVAL.name, new JTextField(6), new Double(1), new Double(0), new Double(1)); + m_psmPrefilterParameters[4] = new DoubleParameter("PSM_" + ValidationTask.PSMFilter.MASCOT_EVAL.key, ValidationTask.PSMFilter.MASCOT_EVAL.name, new JTextField(6), Double.valueOf(1), Double.valueOf(0), Double.valueOf(1)); m_psmPrefilterParameters[4].setAssociatedData("<="); - m_psmPrefilterParameters[5] = new DoubleParameter("PSM_" + ValidationTask.PSMFilter.MASCOT_ADJUSTED_EVALUE.key, ValidationTask.PSMFilter.MASCOT_ADJUSTED_EVALUE.name, new JTextField(6), new Double(1), new Double(0), new Double(1)); + m_psmPrefilterParameters[5] = new DoubleParameter("PSM_" + ValidationTask.PSMFilter.MASCOT_ADJUSTED_EVALUE.key, ValidationTask.PSMFilter.MASCOT_ADJUSTED_EVALUE.name, new JTextField(6), Double.valueOf(1), Double.valueOf(0), Double.valueOf(1)); m_psmPrefilterParameters[5].setAssociatedData("<="); - m_psmPrefilterParameters[6] = new DoubleParameter("PSM_" + ValidationTask.PSMFilter.MASCOT_IT_SCORE.key, ValidationTask.PSMFilter.MASCOT_IT_SCORE.name, new JTextField(6), new Double(0.05), new Double(0), new Double(1)); + m_psmPrefilterParameters[6] = new DoubleParameter("PSM_" + ValidationTask.PSMFilter.MASCOT_IT_SCORE.key, ValidationTask.PSMFilter.MASCOT_IT_SCORE.name, new JTextField(6), 0.05, Double.valueOf(0),Double.valueOf(1)); m_psmPrefilterParameters[6].setAssociatedData("="); - m_psmPrefilterParameters[7] = new DoubleParameter("PSM_" + ValidationTask.PSMFilter.MASCOT_HT_SCORE.key, ValidationTask.PSMFilter.MASCOT_HT_SCORE.name, new JTextField(6), new Double(0.05), new Double(0), new Double(1)); + m_psmPrefilterParameters[7] = new DoubleParameter("PSM_" + ValidationTask.PSMFilter.MASCOT_HT_SCORE.key, ValidationTask.PSMFilter.MASCOT_HT_SCORE.name, new JTextField(6), 0.05, Double.valueOf(0), Double.valueOf(1)); m_psmPrefilterParameters[7].setAssociatedData("="); m_psmPrefilterParameters[8] = new NoneParameter("PSM_" + ValidationTask.PSMFilter.SINGLE_PSM_QUERY.key, ValidationTask.PSMFilter.SINGLE_PSM_QUERY.name); m_psmPrefilterParameters[8].setAssociatedData(":"); m_psmPrefilterParameters[9] = new NoneParameter("PSM_" + ValidationTask.PSMFilter.SINGLE_PSM_RANK.key, ValidationTask.PSMFilter.SINGLE_PSM_RANK.name); m_psmPrefilterParameters[9].setAssociatedData(":"); - m_psmPrefilterParameters[10] = new IntegerParameter("PSM_" + ValidationTask.PSMFilter.ISOTOPE_OFFSET.key, ValidationTask.PSMFilter.ISOTOPE_OFFSET.name, new JTextField(6), new Integer(1), new Integer(0), null); - m_psmPrefilterParameters[10].setAssociatedData("<="); + m_psmPrefilterParameters[10] = new NoneParameter("PSM_" + ValidationTask.PSMFilter.SINGLE_SEQ_RANK.key, ValidationTask.PSMFilter.SINGLE_SEQ_RANK.name); + m_psmPrefilterParameters[10].setAssociatedData(":"); + m_psmPrefilterParameters[11] = new IntegerParameter("PSM_" + ValidationTask.PSMFilter.ISOTOPE_OFFSET.key, ValidationTask.PSMFilter.ISOTOPE_OFFSET.name, new JTextField(6), 1, 0, null); + m_psmPrefilterParameters[11].setAssociatedData("<="); for (AbstractParameter p : m_psmPrefilterParameters) { if (p == null) { @@ -859,13 +841,13 @@ private void createParameters() { } m_psmFdrCheckbox = new JCheckBox(); - m_psmFdrCheckboxParameter = new BooleanParameter("fdr_peptide_match_validation", "PSM FDR Validation", m_psmFdrCheckbox, false); + m_psmFdrCheckboxParameter = new BooleanParameter("fdr_psm_validation", "PSM FDR Validation", m_psmFdrCheckbox, false); m_psmFdrCheckboxParameter.setUsed(false); m_psmFdrCheckboxParameter.setCompulsory(false); m_parameterList.add(m_psmFdrCheckboxParameter); m_psmFdrTextField = new JTextField(5); - m_psmFdrFilterParameter = new DoubleParameter(ValidationTask.ValidationParameters.EXPECTED_FDR.key,ValidationTask.ValidationParameters.EXPECTED_FDR.name, m_psmFdrTextField, new Double(1), new Double(0), new Double(10)); + m_psmFdrFilterParameter = new DoubleParameter(ValidationTask.ValidationParameters.EXPECTED_FDR.key,ValidationTask.ValidationParameters.EXPECTED_FDR.name, m_psmFdrTextField, Double.valueOf(1), Double.valueOf(0), Double.valueOf(10)); m_psmFdrFilterParameter.setUsed(false); m_psmFdrFilterParameter.setCompulsory(false); m_parameterList.add(m_psmFdrFilterParameter); @@ -922,7 +904,7 @@ private void createParameters() { m_parameterList.add(m_peptideFdrCheckboxParameter); m_peptideFdrTextField = new JTextField(5); - m_peptideFdrFilterParameter = new DoubleParameter(ValidationTask.ValidationParameters.PEPTIDE_EXPECTED_FDR.key, ValidationTask.ValidationParameters.PEPTIDE_EXPECTED_FDR.name, m_peptideFdrTextField, new Double(1), new Double(0), new Double(10)); + m_peptideFdrFilterParameter = new DoubleParameter(ValidationTask.ValidationParameters.PEPTIDE_EXPECTED_FDR.key, ValidationTask.ValidationParameters.PEPTIDE_EXPECTED_FDR.name, m_peptideFdrTextField, Double.valueOf(1), Double.valueOf(0), Double.valueOf(10)); m_peptideFdrFilterParameter.setUsed(false); m_peptideFdrFilterParameter.setCompulsory(false); m_parameterList.add(m_peptideFdrFilterParameter); @@ -936,7 +918,7 @@ private void createParameters() { m_parameterList.add(m_proteinFdrCheckboxParameter); m_proteinFdrTextField = new JTextField(5); - m_proteinFdrFilterParameter = new DoubleParameter(ValidationTask.ValidationParameters.PROTEIN_EXPECTED_FDR.key, ValidationTask.ValidationParameters.PROTEIN_EXPECTED_FDR.name, m_proteinFdrTextField, new Double(5), new Double(0), new Double(10)); + m_proteinFdrFilterParameter = new DoubleParameter(ValidationTask.ValidationParameters.PROTEIN_EXPECTED_FDR.key, ValidationTask.ValidationParameters.PROTEIN_EXPECTED_FDR.name, m_proteinFdrTextField, Double.valueOf(5), Double.valueOf(0), Double.valueOf(10)); m_proteinFdrFilterParameter.setUsed(false); m_proteinFdrFilterParameter.setCompulsory(false); m_parameterList.add(m_proteinFdrFilterParameter); @@ -975,20 +957,33 @@ public String getScoringType() { protected boolean okCalled() { // check parameters - if (!checkParameters(true)) { + m_checkFDR = true; + if (!checkParameters()) { return false; } // save parameters Preferences preferences = NbPreferences.root(); - saveParameters(preferences); + try { + saveParameters(preferences); + } catch (Exception e) { + Exceptions.printStackTrace(e); + } return true; } - private void saveParameters(Preferences preferences) { - // Save Parameters + /*** DefaultStorableDialog Abstract methods ***/ + + @Override + protected String getSettingsKey() { + return SETTINGS_KEY; + } + + @Override + protected void saveParameters(Preferences preferences) throws Exception{ + // Save Parameters m_parameterList.saveParameters(preferences); // save scoring type @@ -998,25 +993,79 @@ private void saveParameters(Preferences preferences) { m_changeTypicalPanel.savePreference(preferences); preferences.putBoolean("UseTypicalProteinRegex", m_typicalProteinMatchCheckBox.isSelected()); preferences.putInt(VALIDATION_PARAMS_VERSION_KEY, VALIDATION_PARAM_CURRENT_VERSION); + } - private boolean checkParameters(boolean checkFDR) { + + @Override + protected void resetParameters() throws Exception{ + m_parameterList.initDefaults(); + m_psmPrefiltersPanel.clearPanel(); + m_peptidePrefiltersPanel.clearPanel(); + m_proteinPrefiltersPanel.clearPanel(); + restoreScoringTypeParameter(null); + restoreTypicalProteinParameters(null); + updateSelectedFilters(); + } + + @Override + protected void loadParameters(Preferences filePreferences) throws Exception{ + Integer paramVersion = filePreferences.getInt(VALIDATION_PARAMS_VERSION_KEY, 1); + + Preferences preferences = NbPreferences.root(); + String[] keys = filePreferences.keys(); + for (String key : keys) { + String value = filePreferences.get(key, null); + preferences.put(key, value); + } + + m_parameterList.loadParameters(filePreferences); + //WARNING VDS: If current param change behaviour may also change + if(paramVersion < VALIDATION_PARAM_CURRENT_VERSION) { + //No FDR method before... Must test estimated FDR to see if defined + String paramKey = m_parameterList.getPrefixName() + m_psmFdrFilterParameter.getKey(); + if(filePreferences.get(paramKey, null) != null){ //An expected FDR was defined + m_psmFdrFilterParameter.setUsed(true); + } + paramKey = m_parameterList.getPrefixName() + m_proteinFdrFilterParameter.getKey(); + if(filePreferences.get(paramKey, null) != null){ + m_proteinFdrFilterParameter.setUsed(true); + } + } + restoreScoringTypeParameter(filePreferences); + restoreTypicalProteinParameters(filePreferences); + updatePSMFDRObjects(m_psmFdrFilterParameter.isUsed()); + updateProteinFDRObjects(m_proteinFdrFilterParameter.isUsed()); + updatePeptideFDRObjects(m_peptideFdrFilterParameter.isUsed()); + + //Init PSM/Prot filters Propagation if possible + if(m_allowPropagateFilters){ + m_propagatePsmFiltersCheckBox.setSelected(m_propagatePsmFiltersParameter.isUsed()); + m_propagateProtSetFiltersCheckBox.setSelected(m_propagateProtSetFiltersParameter.isUsed()); + } + + updateSelectedFilters(); + + } + + @Override + protected boolean checkParameters() { if (getArguments().isEmpty() && !m_psmFdrCheckbox.isSelected() && !m_proteinFdrCheckbox.isSelected()) { InfoDialog emptyArgumentsDialog = new InfoDialog(WindowManager.getDefault().getMainWindow(), InfoDialog.InfoType.WARNING, "Warning", "You should not validate. Important arguments are not set.\nAre you sure you want to validate?"); - emptyArgumentsDialog.setButtonName(OptionDialog.BUTTON_OK, "Yes"); - emptyArgumentsDialog.setButtonName(OptionDialog.BUTTON_CANCEL, "No"); + emptyArgumentsDialog.setButtonName(DefaultDialog.BUTTON_OK, "Yes"); + emptyArgumentsDialog.setButtonName(DefaultDialog.BUTTON_CANCEL, "No"); emptyArgumentsDialog.centerToWindow(m_singletonDialog); emptyArgumentsDialog.setVisible(true); - if (emptyArgumentsDialog.getButtonClicked() == OptionDialog.BUTTON_CANCEL) { + if (emptyArgumentsDialog.getButtonClicked() == DefaultDialog.BUTTON_CANCEL) { return false; } } - if (checkFDR) { + if (m_checkFDR) { boolean aTDFdrSelected = (m_psmFdrCheckbox.isSelected() || m_proteinFdrCheckbox.isSelected() || m_peptideFdrCheckbox.isSelected()) && ((String) m_psmFdrMethodComboBox.getSelectedItem()).toLowerCase().endsWith("decoy"); @@ -1094,116 +1143,15 @@ public void actionPerformed(ActionEvent e) { @Override protected boolean saveCalled() { - // check parameters - if (!checkParameters(false)) { - return false; - } - - JFileChooser fileChooser = SettingsUtils.getFileChooser(SETTINGS_KEY); - int result = fileChooser.showSaveDialog(this); - if (result == JFileChooser.APPROVE_OPTION) { - File f = fileChooser.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(f, null, ""); - - saveParameters(filePreferences); - - SettingsUtils.addSettingsPath(SETTINGS_KEY, f.getAbsolutePath()); - SettingsUtils.writeDefaultDirectory(SETTINGS_KEY, f.getParent()); - } - - return false; - } - - @Override - protected boolean loadCalled() { - - SettingsDialog settingsDialog = new SettingsDialog(this, SETTINGS_KEY); - settingsDialog.setLocationRelativeTo(this); - settingsDialog.setVisible(true); - - if (settingsDialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { - if (settingsDialog.isDefaultSettingsSelected()) { - m_parameterList.initDefaults(); - m_psmPrefiltersPanel.clearPanel(); - m_peptidePrefiltersPanel.clearPanel(); - m_proteinPrefiltersPanel.clearPanel(); - restoreScoringTypeParameter(null); - restoreTypicalProteinParameters(null); - updateSelectedFilters(); - } else { - try { - File settingsFile = settingsDialog.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(settingsFile, null, ""); - Integer paramVersion = filePreferences.getInt(VALIDATION_PARAMS_VERSION_KEY, 1); - - Preferences preferences = NbPreferences.root(); - String[] keys = filePreferences.keys(); - for (String key : keys) { - String value = filePreferences.get(key, null); - preferences.put(key, value); - } - - m_parameterList.loadParameters(filePreferences); - //WARNING VDS: If current param change behaviour may also change - if(paramVersion < VALIDATION_PARAM_CURRENT_VERSION) { - //No FDR method before... Must test estimated FDR to see if defined - String paramKey = m_parameterList.getPrefixName() + m_psmFdrFilterParameter.getKey(); - if(filePreferences.get(paramKey, null) != null){ //An expected FDR was defined - m_psmFdrFilterParameter.setUsed(true); - } - paramKey = m_parameterList.getPrefixName() + m_proteinFdrFilterParameter.getKey(); - if(filePreferences.get(paramKey, null) != null){ - m_proteinFdrFilterParameter.setUsed(true); - } - } - restoreScoringTypeParameter(filePreferences); - restoreTypicalProteinParameters(filePreferences); - updatePSMFDRObjects(m_psmFdrFilterParameter.isUsed()); - updateProteinFDRObjects(m_proteinFdrFilterParameter.isUsed()); - updatePeptideFDRObjects(m_peptideFdrFilterParameter.isUsed()); - - //Init PSM/Prot filters Propagation if possible - if(m_allowPropagateFilters){ - m_propagatePsmFiltersCheckBox.setSelected(m_propagatePsmFiltersParameter.isUsed()); - m_propagateProtSetFiltersCheckBox.setSelected(m_propagateProtSetFiltersParameter.isUsed()); - } - - updateSelectedFilters(); - - } catch (Exception e) { - LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Parsing of User Settings File Failed", e); - setStatus(true, "Parsing of your Settings File failed"); - } - } - } - - return false; + m_checkFDR = false; + return super.saveCalled(); } - @Override + @Override protected boolean cancelCalled() { return true; } - @Override - public void componentResized(ComponentEvent e) { - repack(); - } - - @Override - public void componentMoved(ComponentEvent e) { - - } - - @Override - public void componentShown(ComponentEvent e) { - } - - @Override - public void componentHidden(ComponentEvent e) { - - } - void setPanelEnabled(JPanel panel, Boolean isEnabled) { panel.setEnabled(isEnabled); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/Export2MzIdentMLDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/Export2MzIdentMLDialog.java index 98c60e63f..d7e0cc86c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/Export2MzIdentMLDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/Export2MzIdentMLDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -17,21 +17,19 @@ package fr.proline.studio.rsmexplorer.gui.dialog.exporter; import fr.proline.studio.gui.DefaultDialog; -import fr.proline.studio.settings.FilePreferences; -import fr.proline.studio.settings.SettingsUtils; +import fr.proline.studio.gui.DefaultStorableDialog; import fr.proline.studio.utils.IconManager; -import java.awt.Dialog; -import java.awt.Window; -import java.io.File; + +import java.awt.*; import java.util.HashMap; -import javax.swing.JFileChooser; -import org.openide.util.NbBundle; +import java.util.prefs.Preferences; + /** * * @author VD225637 */ -public class Export2MzIdentMLDialog extends DefaultDialog { +public class Export2MzIdentMLDialog extends DefaultStorableDialog { protected final static String MZIDENT_SETTINGS_KEY = "Export2MzIdentML"; @@ -51,11 +49,9 @@ public Export2MzIdentMLDialog(Window parent) { // setDocumentationSuffix(m_contact_FN_key); //VDS TODO setButtonName(BUTTON_OK, "Next"); setButtonIcon(DefaultDialog.BUTTON_OK, IconManager.getIcon(IconManager.IconType.ARROW)); - setButtonVisible(BUTTON_LOAD, true); - setButtonVisible(BUTTON_SAVE, true); setDocumentationSuffix("id.338fx5o"); m_paramPanel = new Export2MzIdentMLParamPanel(this); - this.setHelpHeader(IconManager.getIcon(IconManager.IconType.INFORMATION),"MzIdentML parameters", NbBundle.getMessage(Export2MzIdentMLDialog.class,"Export2MzIdentMLDialog.help.text")); + this.setHelpHeader(IconManager.getIcon(IconManager.IconType.INFORMATION),"MzIdentML parameters", "Spectrum Matches should have been generated before exporting to MzidentML format.
It is also recommended to jave run 'Retrieve proteins sequences'."); setInternalComponent(m_paramPanel); } @@ -63,6 +59,33 @@ public void setTask(DefaultDialog.ProgressTask task) { m_task = task; } + /*** DefaultStorableDialog Abstract methods ***/ + + @Override + protected String getSettingsKey() { + return MZIDENT_SETTINGS_KEY; + } + + @Override + protected void saveParameters(Preferences filePreferences) { + m_paramPanel.saveParameters(filePreferences); + } + + @Override + protected boolean checkParameters() { + return true; + } + + @Override + protected void resetParameters() { + m_paramPanel.resetParameters(); + } + + @Override + protected void loadParameters(Preferences preferences) throws Exception { + m_paramPanel.loadParameters(preferences); + } + @Override protected boolean okCalled() { if (m_step == STEP_PANEL_EXPORT_PARAM_DEF) { @@ -80,7 +103,7 @@ protected boolean okCalled() { setButtonVisible(BUTTON_SAVE, false); m_filePanel = new Export2MzIdentMLFilePanel(this); - this.setHelpHeader(IconManager.getIcon(IconManager.IconType.INFORMATION), "MzIdentML output file", NbBundle.getMessage(Export2MzIdentMLDialog.class, "Export2MzIdentMLDialog.help.text")); + this.setHelpHeader(IconManager.getIcon(IconManager.IconType.INFORMATION), "MzIdentML output file", "Spectrum Matches should have been generated before exporting to MzidentML format.
It is also recommended to jave run 'Retrieve proteins sequences'."); replaceInternalComponent(m_filePanel); revalidate(); @@ -100,7 +123,7 @@ protected boolean okCalled() { @Override protected boolean loadCalled() { if (m_step == STEP_PANEL_EXPORT_PARAM_DEF) { - m_paramPanel.loadParameters(); + super.loadCalled(); } return false; } @@ -115,16 +138,7 @@ protected boolean saveCalled() { return false; } - JFileChooser fileChooser = SettingsUtils.getFileChooser(MZIDENT_SETTINGS_KEY); - int result = fileChooser.showSaveDialog(this); - if (result == JFileChooser.APPROVE_OPTION) { - File f = fileChooser.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(f, null, ""); - - m_paramPanel.saveParameters(filePreferences); - SettingsUtils.addSettingsPath(MZIDENT_SETTINGS_KEY, f.getAbsolutePath()); - SettingsUtils.writeDefaultDirectory(MZIDENT_SETTINGS_KEY, f.getParent()); - } + return super.saveCalled(); } return false; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/Export2MzIdentMLFilePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/Export2MzIdentMLFilePanel.java index 50df6c9c4..be707cd27 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/Export2MzIdentMLFilePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/Export2MzIdentMLFilePanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.exporter; import fr.proline.studio.gui.DefaultDialog; @@ -30,8 +30,8 @@ import javax.swing.JTextField; import javax.swing.filechooser.FileNameExtensionFilter; import org.apache.commons.lang3.StringUtils; -import org.openide.util.NbBundle; -import org.openide.util.NbPreferences; + +import fr.proline.studio.NbPreferences; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/Export2MzIdentMLParamPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/Export2MzIdentMLParamPanel.java index 43649b01f..22f9e5aae 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/Export2MzIdentMLParamPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/Export2MzIdentMLParamPanel.java @@ -1,41 +1,32 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.exporter; +import fr.proline.studio.NbPreferences; import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.parameter.AbstractParameter; import fr.proline.studio.parameter.ParameterError; import fr.proline.studio.parameter.ParameterList; import fr.proline.studio.parameter.StringParameter; -import fr.proline.studio.settings.FilePreferences; -import fr.proline.studio.settings.SettingsDialog; -import java.awt.BorderLayout; -import java.awt.GridBagConstraints; -import java.io.File; +import javax.swing.*; +import java.awt.*; import java.util.HashMap; import java.util.prefs.Preferences; -import javax.swing.Box; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -import org.openide.util.NbPreferences; -import org.slf4j.LoggerFactory; /** * @@ -205,37 +196,23 @@ protected boolean checkParameters(){ return false; } } - - protected void loadParameters(){ - SettingsDialog settingsDialog = new SettingsDialog(m_parent, Export2MzIdentMLDialog.MZIDENT_SETTINGS_KEY); - settingsDialog.setLocationRelativeTo(this); - settingsDialog.setVisible(true); - if (settingsDialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { - if (settingsDialog.isDefaultSettingsSelected()) { - m_parameterList.initDefaults(); - } else { - try { - File settingsFile = settingsDialog.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(settingsFile, null, ""); + protected void loadParameters(Preferences filePreferences ) throws Exception{ + Preferences preferences = NbPreferences.root(); + String[] keys = filePreferences.keys(); + for (String key : keys) { + String value = filePreferences.get(key, null); + preferences.put(key, value); + } - Preferences preferences = NbPreferences.root(); - String[] keys = filePreferences.keys(); - for (String key : keys) { - String value = filePreferences.get(key, null); - preferences.put(key, value); - } + m_parameterList.loadParameters(filePreferences); + } - m_parameterList.loadParameters(filePreferences); + protected void resetParameters(){ + m_parameterList.initDefaults(); - } catch (Exception e) { - LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Parsing of User Settings File Failed", e); - m_parent.setStatus(true, "Parsing of your Settings File failed"); - } - } - } - } + private void setUsedParams(){ for (AbstractParameter param : m_parameterList) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/ExportPrideDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/ExportPrideDialog.java index eca95c396..519e81bd9 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/ExportPrideDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/ExportPrideDialog.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.exporter; import fr.proline.studio.gui.DefaultDialog; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideExpDescPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideExpDescPanel.java index 6187a18ba..ffa3cae68 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideExpDescPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideExpDescPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.exporter; import java.awt.Component; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideFileSelectionPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideFileSelectionPanel.java index 641a210be..83a687665 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideFileSelectionPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideFileSelectionPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.exporter; import fr.proline.studio.utils.IconManager; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideProtocolDescPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideProtocolDescPanel.java index 1ae794132..46fb7b43d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideProtocolDescPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideProtocolDescPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.exporter; import fr.proline.studio.dpm.data.CVParam; @@ -43,7 +43,7 @@ import uk.ac.ebi.pride.toolsuite.ols.dialog.OLSDialog; import org.apache.commons.lang3.StringUtils; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import org.slf4j.LoggerFactory; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideSampleDescPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideSampleDescPanel.java index c55633188..07e74fac2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideSampleDescPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideSampleDescPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.exporter; import fr.proline.studio.dpm.data.CVParam; @@ -45,7 +45,7 @@ import uk.ac.ebi.pride.toolsuite.ols.dialog.OLSDialog; import uk.ac.ebi.pride.toolsuite.ols.dialog.OLSInputable; import org.apache.commons.lang3.StringUtils; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import org.slf4j.LoggerFactory; import uk.ac.ebi.pride.utilities.ols.web.service.model.Term; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideWizardPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideWizardPanel.java index 62fba7b6f..41bf66eda 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideWizardPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/exporter/PrideWizardPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.exporter; import fr.proline.studio.gui.HelpHeaderPanel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/spectralcount/SpectralCountDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/spectralcount/SpectralCountDialog.java index ca8a8357e..c689c482d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/spectralcount/SpectralCountDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/spectralcount/SpectralCountDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/spectralcount/SpectralCountNamePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/spectralcount/SpectralCountNamePanel.java index 59a68535e..60e9e12c2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/spectralcount/SpectralCountNamePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/spectralcount/SpectralCountNamePanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.spectralcount; import java.awt.BorderLayout; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/spectralcount/TreeSelectionPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/spectralcount/TreeSelectionPanel.java index 4b5a46d9b..29f0c9cfd 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/spectralcount/TreeSelectionPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/spectralcount/TreeSelectionPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.spectralcount; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AbstractLabelFreeMSParamsPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AbstractLabelFreeMSParamsPanel.java index 94a4c002e..3f11fc8e8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AbstractLabelFreeMSParamsPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AbstractLabelFreeMSParamsPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,17 +16,17 @@ */ package fr.proline.studio.rsmexplorer.gui.dialog.xic; +import fr.proline.studio.NbPreferences; import fr.proline.studio.parameter.ParameterList; import fr.proline.studio.settings.FilePreferences; -import java.util.prefs.BackingStoreException; -import java.util.prefs.Preferences; -import javax.swing.BorderFactory; -import javax.swing.JScrollPane; -import javax.swing.border.TitledBorder; -import org.openide.util.NbPreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.swing.*; +import javax.swing.border.TitledBorder; +import java.util.prefs.BackingStoreException; +import java.util.prefs.Preferences; + /** * * @author VD225637 @@ -125,7 +125,7 @@ public abstract class AbstractLabelFreeMSParamsPanel extends AbstractParamsPanel protected final static String DEFAULT_CLUSTER_INTENSITYCOMPUT_VALUE = "MOST_INTENSE"; protected final static Boolean DEFAULT_ALIGN_VALUE = Boolean.TRUE; - protected final static Double DEFAULT_ALIGN_FEATMAP_TIMETOL_VALUE = 600.0; + public final static Double DEFAULT_ALIGN_FEATMAP_TIMETOL_VALUE = 600.0; protected final static Double DEFAULT_ALIGN_FEATMAP_MOZTOL_VALUE = 5.0; protected final static Integer DEFAULT_ALIGN_MAXITE_VALUE = 3; protected final static Integer DEFAULT_ALIGN_MASSINTERVAL_VALUE = 20000; @@ -148,6 +148,7 @@ public abstract class AbstractLabelFreeMSParamsPanel extends AbstractParamsPanel public final static String XIC_PARAMS_VERSION_KEY = XIC_PARAMS_PREFIX + ".parametersVersion"; public final static String ALIGNMENT_CONFIG = "alignment_config"; public final static String ALIGNMENT_METHOD_NAME = "method_name"; + public final static String ALIGNMENT_SMOOTHING_METHOD_NAME = "smoothing_method_name"; protected final boolean m_readOnly; protected JScrollPane m_scrollPane; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AbstractParamsPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AbstractParamsPanel.java index faba77f21..e045dba72 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AbstractParamsPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AbstractParamsPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.xic; import fr.proline.studio.parameter.ParameterList; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AggregateQuantitationDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AggregateQuantitationDialog.java index edb0c0982..508ea9420 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AggregateQuantitationDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AggregateQuantitationDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AggregationQuantChannelsPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AggregationQuantChannelsPanel.java index 0da00b9e1..bc3058689 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AggregationQuantChannelsPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AggregationQuantChannelsPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AssociationWrapper.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AssociationWrapper.java index 51f2fb69f..4249f3dfd 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AssociationWrapper.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/AssociationWrapper.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.xic; /** diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/CreateQuantitationDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/CreateQuantitationDialog.java index 3d95e07a4..f43bc4fc8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/CreateQuantitationDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/CreateQuantitationDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -17,6 +17,9 @@ package fr.proline.studio.rsmexplorer.gui.dialog.xic; import fr.proline.core.orm.msi.PtmSpecificity; +import fr.proline.studio.Exceptions; +import fr.proline.studio.dam.tasks.*; +import fr.proline.studio.dock.gui.InfoLabel; import fr.proline.studio.rsmexplorer.tree.xic.QuantExperimentalDesignTree; import fr.proline.core.orm.uds.Project; import fr.proline.core.orm.uds.QuantitationLabel; @@ -28,12 +31,6 @@ import fr.proline.studio.dam.data.DataSetData; import fr.proline.studio.dam.data.RunInfoData; import fr.proline.studio.dam.data.RunInfoData.Status; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; -import fr.proline.studio.dam.tasks.DatabasePTMSitesTask; -import fr.proline.studio.dam.tasks.DatabasePeaklistTask; -import fr.proline.studio.dam.tasks.DatabaseRunsTask; -import fr.proline.studio.dam.tasks.DatabaseVerifySpectrumFromResultSets; -import fr.proline.studio.dam.tasks.SubTask; import fr.proline.studio.dpm.AccessJMSManagerThread; import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; import fr.proline.studio.gui.DefaultDialog; @@ -51,12 +48,12 @@ import fr.proline.studio.settings.SettingsDialog; import fr.proline.studio.settings.SettingsUtils; import fr.proline.studio.utils.IconManager; -import fr.proline.studio.utils.StudioExceptions; import java.awt.Dialog; import java.awt.HeadlessException; import java.awt.Point; import java.awt.Window; import java.io.File; +import java.io.FileOutputStream; import java.util.*; import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; @@ -64,8 +61,9 @@ import javax.swing.JFileChooser; import javax.swing.JList; import javax.swing.JOptionPane; -import org.openide.util.NbPreferences; -import org.openide.windows.WindowManager; +import fr.proline.studio.NbPreferences; +import fr.proline.studio.WindowManager; +import fr.proline.studio.utils.StudioResourceBundle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -165,7 +163,7 @@ public void initializeExperimentalDesignTree(DDataset existingQuantDataset, DDat } } catch (Exception ex) { LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Error while setting Quant Param ", ex); - StudioExceptions.notify("An error occured while cloning XIC parameters", ex); + WindowManager.getDefault().getMainWindow().alert(InfoLabel.INFO_LEVEL.ERROR, "An error occured while cloning XIC parameters", ex); } } else { // set refDataset node @@ -215,7 +213,7 @@ protected void displayLinkRawFilesPanel() { setButtonName(DefaultDialog.BUTTON_OK, "Next"); setButtonIcon(DefaultDialog.BUTTON_OK, IconManager.getIcon(IconManager.IconType.ARROW)); } else { - setButtonName(DefaultDialog.BUTTON_OK, org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.okButton.text")); + setButtonName(DefaultDialog.BUTTON_OK, StudioResourceBundle.getMessage(DefaultDialog.class, "DefaultDialog.okButton.text")); setButtonIcon(DefaultDialog.BUTTON_OK, IconManager.getIcon(IconManager.IconType.OK)); } setButtonVisible(BUTTON_LOAD, false); @@ -265,7 +263,7 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) } }; - DatabasePTMSitesTask task = new DatabasePTMSitesTask(callback); + DatabasePTMsTask task = new DatabasePTMsTask(callback); if (m_refIdentDataset == null) { //get information from leaf rsm Long projectId = ProjectExplorerPanel.getProjectExplorerPanel().getSelectedProject().getId(); @@ -295,7 +293,7 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) protected void displayLabelFreeParamsPanel() { m_step = STEP_PANEL_LABEL_FREE_PARAMS; - setButtonName(DefaultDialog.BUTTON_OK, org.openide.util.NbBundle.getMessage(DefaultDialog.class, "DefaultDialog.okButton.text")); + setButtonName(DefaultDialog.BUTTON_OK, StudioResourceBundle.getMessage(DefaultDialog.class, "DefaultDialog.okButton.text")); setButtonIcon(DefaultDialog.BUTTON_OK, IconManager.getIcon(IconManager.IconType.OK)); setButtonVisible(BUTTON_BACK, true); @@ -571,16 +569,25 @@ protected boolean saveCalled() { JFileChooser fileChooser = SettingsUtils.getFileChooser(SETTINGS_KEY); int result = fileChooser.showSaveDialog(this); if (result == JFileChooser.APPROVE_OPTION) { - File f = fileChooser.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(f, null, ""); - - // Save Parameters - ParameterList parameterList = LabelFreeMSParamsPanel.getLabelFreeMSQuantParamsPanel().getParamsPanel().getParameterList(); - parameterList.saveParameters(filePreferences); - filePreferences.putBoolean(AbstractLabelFreeMSParamsPanel.XIC_SIMPLIFIED_PARAMS, LabelFreeMSParamsPanel.getLabelFreeMSQuantParamsPanel().getParamsPanel().isSimplifiedPanel()); - filePreferences.put(AbstractLabelFreeMSParamsPanel.XIC_PARAMS_VERSION_KEY, LabelFreeMSParamsPanel.getLabelFreeMSQuantParamsPanel().getParamsVersion()); - SettingsUtils.addSettingsPath(SETTINGS_KEY, f.getAbsolutePath()); - SettingsUtils.writeDefaultDirectory(SETTINGS_KEY, f.getParent()); + try { + File f = fileChooser.getSelectedFile(); + if(f.exists()){ + FileOutputStream fos = new FileOutputStream(f); + fos.close(); + } + FilePreferences filePreferences = new FilePreferences(f, null, ""); + + // Save Parameters + ParameterList parameterList = LabelFreeMSParamsPanel.getLabelFreeMSQuantParamsPanel().getParamsPanel().getParameterList(); + parameterList.saveParameters(filePreferences); + filePreferences.putBoolean(AbstractLabelFreeMSParamsPanel.XIC_SIMPLIFIED_PARAMS, LabelFreeMSParamsPanel.getLabelFreeMSQuantParamsPanel().getParamsPanel().isSimplifiedPanel()); + filePreferences.put(AbstractLabelFreeMSParamsPanel.XIC_PARAMS_VERSION_KEY, LabelFreeMSParamsPanel.getLabelFreeMSQuantParamsPanel().getParamsVersion()); + SettingsUtils.addSettingsPath(SETTINGS_KEY, f.getAbsolutePath()); + SettingsUtils.writeDefaultDirectory(SETTINGS_KEY, f.getParent()); + } catch (Exception e) { + Exceptions.printStackTrace(e); + JOptionPane.showMessageDialog(this, "Error saving settings "+e.getMessage(), "Save Settings Error",JOptionPane.ERROR_MESSAGE); + } } return false; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/IsobaricMethodParamsPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/IsobaricMethodParamsPanel.java index cfc994162..a7e467cb0 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/IsobaricMethodParamsPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/IsobaricMethodParamsPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/LabelFreeMSParamsCompletePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/LabelFreeMSParamsCompletePanel.java index f5ab064c4..4ad65c8fe 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/LabelFreeMSParamsCompletePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/LabelFreeMSParamsCompletePanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -28,8 +28,8 @@ import java.util.HashMap; import java.util.Map; import javax.swing.*; -import org.openide.util.NbPreferences; -import org.openide.windows.WindowManager; +import fr.proline.studio.NbPreferences; +import fr.proline.studio.WindowManager; /** * Panel to set the different parameters for the XIC Quantitation diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/LabelFreeMSParamsPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/LabelFreeMSParamsPanel.java index f3e034b54..892136da6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/LabelFreeMSParamsPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/LabelFreeMSParamsPanel.java @@ -1,23 +1,23 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.xic; +import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.gui.InfoDialog; -import fr.proline.studio.gui.OptionDialog; import fr.proline.studio.utils.IconManager; import java.awt.BorderLayout; import java.awt.GridBagConstraints; @@ -28,8 +28,8 @@ import javax.swing.Box; import javax.swing.JButton; import javax.swing.JPanel; -import org.openide.util.NbPreferences; -import org.openide.windows.WindowManager; +import fr.proline.studio.NbPreferences; +import fr.proline.studio.WindowManager; /** * @@ -89,7 +89,7 @@ public void actionPerformed(ActionEvent e) { exitDialog.centerToWindow(WindowManager.getDefault().getMainWindow()); exitDialog.setVisible(true); - if (exitDialog.getButtonClicked() == OptionDialog.BUTTON_OK) { + if (exitDialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { setIsSimplifiedPanel(m_completePanel); //if current is complete, switch to simplified panel. } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/LabelFreeMSParamsSimplifiedPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/LabelFreeMSParamsSimplifiedPanel.java index 850404aa5..fd2d65870 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/LabelFreeMSParamsSimplifiedPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/LabelFreeMSParamsSimplifiedPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -27,7 +27,7 @@ import java.util.Map; import javax.swing.*; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; /** * diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/QuantExperimentalDesignPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/QuantExperimentalDesignPanel.java index 1de74ca8e..06acf38ed 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/QuantExperimentalDesignPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/QuantExperimentalDesignPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/QuantPostProcessingDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/QuantPostProcessingDialog.java index bb639eadd..f2261270e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/QuantPostProcessingDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/QuantPostProcessingDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -18,32 +18,27 @@ import fr.proline.core.orm.msi.PtmSpecificity; import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.studio.NbPreferences; import fr.proline.studio.corewrapper.data.QuantPostProcessingParams; -import fr.proline.studio.gui.DefaultDialog; +import fr.proline.studio.gui.DefaultStorableDialog; import fr.proline.studio.parameter.ParameterError; import fr.proline.studio.parameter.ParameterList; -import fr.proline.studio.settings.FilePreferences; -import fr.proline.studio.settings.SettingsDialog; -import fr.proline.studio.settings.SettingsUtils; -import java.awt.Dialog; -import java.awt.Window; -import java.io.File; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.swing.*; +import java.awt.*; import java.util.ArrayList; import java.util.Map; import java.util.prefs.Preferences; import java.util.stream.Collectors; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import org.openide.util.NbPreferences; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Dialog to compute the quantitation profile * * @author MB243701 */ -public class QuantPostProcessingDialog extends DefaultDialog { +public class QuantPostProcessingDialog extends DefaultStorableDialog { private static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); @@ -67,67 +62,54 @@ public QuantPostProcessingDialog(Window parent, ArrayList ptms, } @Override - protected boolean saveCalled() { - // check parameters - if (!checkParameters()) { - return false; - } + protected String getSettingsKey() { + return QuantPostProcessingParams.SETTINGS_KEY; + } - JFileChooser fileChooser = SettingsUtils.getFileChooser(QuantPostProcessingParams.SETTINGS_KEY); - int result = fileChooser.showSaveDialog(this); - if (result == JFileChooser.APPROVE_OPTION) { - File f = fileChooser.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(f, null, ""); - - // Save Parameters - ParameterList parameterList = m_quantPostProcessingPanel.getParameterList(); - parameterList.saveParameters(filePreferences); - filePreferences.put(QuantPostProcessingParams.PARAM_VERSION_KEY, QuantPostProcessingParams.CURRENT_VERSION); - SettingsUtils.addSettingsPath(QuantPostProcessingParams.SETTINGS_KEY, f.getAbsolutePath()); - SettingsUtils.writeDefaultDirectory(QuantPostProcessingParams.SETTINGS_KEY, f.getParent()); - } + @Override + protected void saveParameters(Preferences filePreferences) { + // Save Parameters + ParameterList parameterList = m_quantPostProcessingPanel.getParameterList(); + parameterList.saveParameters(filePreferences); + filePreferences.put(QuantPostProcessingParams.PARAM_VERSION_KEY, QuantPostProcessingParams.CURRENT_VERSION); + } - return false; + @Override + protected void resetParameters() { + ParameterList parameterList = m_quantPostProcessingPanel.getParameterList(); + parameterList.initDefaults(); } @Override - protected boolean loadCalled() { + protected void loadParameters(Preferences filePreferences) throws Exception { + + String version = filePreferences.get(QuantPostProcessingParams.PARAM_VERSION_KEY, null); + boolean modifiedPepParamExist = (filePreferences.get(QuantPostProcessingParams.SETTINGS_KEY+"."+QuantPostProcessingParams.getSettingKey(QuantPostProcessingParams.DISCARD_MODIFIED_PEPTIDES), null) != null); + if(version == null){ + if(modifiedPepParamExist) + version = "2.0"; + else + version = "1.0"; + } + if (!version.equals(QuantPostProcessingParams.CURRENT_VERSION)) { + String msg = "Try loading Post Processing parameters ("+ QuantPostProcessingParams.CURRENT_VERSION + ") from file with version "+version+". All parameters may not have been taken into account !"; + JOptionPane.showMessageDialog(this, msg, "Load Post Processing parameters error", JOptionPane.ERROR_MESSAGE); + } - SettingsDialog settingsDialog = new SettingsDialog(this, QuantPostProcessingParams.SETTINGS_KEY); - settingsDialog.setLocationRelativeTo(this); - settingsDialog.setVisible(true); + m_quantPostProcessingPanel.loadParameters(filePreferences, version); + } - if (settingsDialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { - if (settingsDialog.isDefaultSettingsSelected()) { - ParameterList parameterList = m_quantPostProcessingPanel.getParameterList(); - parameterList.initDefaults(); - } else { - try { - File settingsFile = settingsDialog.getSelectedFile(); - FilePreferences filePreferences = new FilePreferences(settingsFile, null, ""); - - String version = filePreferences.get(QuantPostProcessingParams.PARAM_VERSION_KEY, null); - boolean modifiedPepParamExist = (filePreferences.get(QuantPostProcessingParams.SETTINGS_KEY+"."+QuantPostProcessingParams.getSettingKey(QuantPostProcessingParams.DISCARD_MODIFIED_PEPTIDES), null) != null); - if(version == null){ - if(modifiedPepParamExist) - version = "2.0"; - else - version = "1.0"; - } - if (!version.equals(QuantPostProcessingParams.CURRENT_VERSION)) { - String msg = "Try loading Post Processing parameters ("+ QuantPostProcessingParams.CURRENT_VERSION + ") from file with version "+version+". All parameters may not have been taken into account !"; - JOptionPane.showMessageDialog(this, msg, "Load Post Processing parameters error", JOptionPane.ERROR_MESSAGE); - } - - m_quantPostProcessingPanel.loadParameters(filePreferences, version); - } catch (Exception e) { - LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error("Parsing of User Settings File Failed", e); - setStatus(true, "Parsing of your Settings File failed"); - } - } + @Override + protected boolean checkParameters() { + // check parameters + ParameterError error = m_quantPostProcessingPanel.getParameterList().checkParameters(); + if (error != null) { + setStatus(true, error.getErrorMessage()); + highlight(error.getParameterComponent()); + return false; } - return false; + return true; } @Override @@ -146,17 +128,7 @@ protected boolean okCalled() { } - private boolean checkParameters() { - // check parameters - ParameterError error = m_quantPostProcessingPanel.getParameterList().checkParameters(); - if (error != null) { - setStatus(true, error.getErrorMessage()); - highlight(error.getParameterComponent()); - return false; - } - return true; - } public Map getQuantParams() { return m_quantPostProcessingPanel.getQuantParams(); @@ -178,7 +150,7 @@ private void init(ArrayList ptms, boolean isAggregation, DDatase } catch (Exception ex) { m_logger.error("error while settings quanti params " + ex); } - + m_quantPostProcessingPanel.setDiscardPeptidesSharingPeakelsChB(isAggregation); setInternalComponent(m_quantPostProcessingPanel); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/QuantPostProcessingPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/QuantPostProcessingPanel.java index a2e77e3ea..ee5ff72a6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/QuantPostProcessingPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/QuantPostProcessingPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,31 +16,21 @@ */ package fr.proline.studio.rsmexplorer.gui.dialog.xic; +import fr.proline.studio.NbPreferences; import fr.proline.studio.corewrapper.data.QuantPostProcessingParams; -import fr.proline.studio.parameter.AbstractParameter; -import fr.proline.studio.parameter.BooleanParameter; -import fr.proline.studio.parameter.DoubleParameter; -import fr.proline.studio.parameter.ObjectParameter; -import fr.proline.studio.parameter.ParameterList; -import fr.proline.studio.settings.FilePreferences; +import fr.proline.studio.parameter.*; import fr.proline.studio.utils.StringUtils; -import java.awt.BorderLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.Map; +import java.util.*; import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; -import javax.swing.*; -import org.openide.util.NbPreferences; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * panel with the different parameters for computing quantitation profile all @@ -293,7 +283,7 @@ private void updateDiscardPTMs() { * @param filePreferences * @throws BackingStoreException */ - public void loadParameters(FilePreferences filePreferences, String version) throws BackingStoreException { + public void loadParameters(Preferences filePreferences, String version) throws BackingStoreException { boolean loadedPTMsParamsError = false;//Specify if loaded params from file don't contains this Quant PTMs list String[] hiddenParams = {m_parameterList.getPrefixName() + m_peptideStatTestsAlphaParameter.getName(), @@ -334,7 +324,7 @@ else if(key.startsWith(filePrefix+QuantPostProcessingParams.getSettingKey(QuantP if (!completeMode) { if (Arrays.asList(hiddenParams).contains(key)) { - filePreferences.remove(key); // Don't load this parameter + filePreferences.remove(key); // Don't load this parameter } else { String value = filePreferences.get(key, null); preferences.put(key, value); @@ -357,7 +347,7 @@ else if(key.startsWith(filePrefix+QuantPostProcessingParams.getSettingKey(QuantP String label = m_discardModifiedPeptidesChB.getText()+" (WARNING-PTMs: Read parameters don't match current list)"; m_discardModifiedPeptidesChB.setText(label); } - getParameterList().loadParameters(filePreferences); //Load params + getParameterList().loadParameters(filePreferences); //Load params updateDiscardPTMs(); } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/ResidueMethodParamsPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/ResidueMethodParamsPanel.java index fb5065c6a..42cb3cdf1 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/ResidueMethodParamsPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/ResidueMethodParamsPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/SelectRawFileDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/SelectRawFileDialog.java index 81adc8343..5ed5f4dc9 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/SelectRawFileDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/SelectRawFileDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/SelectRawFilesPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/SelectRawFilesPanel.java index 5df1cbf54..04007d2cb 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/SelectRawFilesPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/SelectRawFilesPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -316,6 +316,7 @@ private void cleanRawFileDialog(int posX, int posY) { yesNoDialog.setVisible(true); if (yesNoDialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { m_model.cleanRawFile(); + resetDropZonePanel(); repaint(); } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/XICDropZone.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/XICDropZone.java index 65645e985..93e129362 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/XICDropZone.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/XICDropZone.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/XICDropZoneInfo.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/XICDropZoneInfo.java index e424a3061..c7f54d4a3 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/XICDropZoneInfo.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/XICDropZoneInfo.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.dialog.xic; import fr.proline.studio.rsmexplorer.gui.dialog.xic.AssociationWrapper.AssociationType; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/DQuantitationChannelMapping.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/DQuantitationChannelMapping.java index 71503ad73..9147011cf 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/DQuantitationChannelMapping.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/DQuantitationChannelMapping.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/QCMappingTransferHandler.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/QCMappingTransferHandler.java index 26453a602..4823a826f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/QCMappingTransferHandler.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/QCMappingTransferHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -28,7 +28,7 @@ import javax.swing.JOptionPane; import javax.swing.JTable; import javax.swing.TransferHandler; -import org.openide.util.Exceptions; +import fr.proline.studio.Exceptions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/QCMappingTreeTable.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/QCMappingTreeTable.java index bfb71d4a2..f60d67e65 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/QCMappingTreeTable.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/QCMappingTreeTable.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/QCMappingTreeTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/QCMappingTreeTableModel.java index f0300cba8..13c35681f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/QCMappingTreeTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/dialog/xic/aggregation/QCMappingTreeTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/DataClearProjectTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/DataClearProjectTableModel.java index df8b12606..5c403b510 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/DataClearProjectTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/DataClearProjectTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.model; import fr.proline.studio.extendedtablemodel.ExtraDataType; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/MSQueriesTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/MSQueriesTableModel.java index fb310519a..adc15508f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/MSQueriesTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/MSQueriesTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PTMClusterTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PTMClusterTableModel.java index 7aaadb676..a86572fd4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PTMClusterTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PTMClusterTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -19,7 +19,8 @@ import fr.proline.core.orm.msi.PeptideReadablePtmString; import fr.proline.core.orm.msi.dto.*; import fr.proline.core.orm.uds.dto.DQuantitationChannel; -import fr.proline.studio.dam.tasks.DatabasePTMsTask; +import fr.proline.studio.dam.data.SelectLevelEnum; +import fr.proline.studio.dam.tasks.DatabaseDatasetPTMsTask; import fr.proline.studio.dam.tasks.data.ptm.ComparableList; import fr.proline.studio.dam.tasks.data.ptm.PTMCluster; import fr.proline.studio.dam.tasks.data.ptm.PTMSite; @@ -30,9 +31,7 @@ import fr.proline.studio.filter.*; import fr.proline.studio.graphics.PlotInformation; import fr.proline.studio.graphics.PlotType; -import fr.proline.studio.rsmexplorer.gui.renderer.PeptideRenderer; -import fr.proline.studio.rsmexplorer.gui.renderer.PercentageRenderer; -import fr.proline.studio.rsmexplorer.gui.renderer.ScoreRenderer; +import fr.proline.studio.rsmexplorer.gui.renderer.*; import fr.proline.studio.rsmexplorer.gui.xic.QuantChannelInfo; import fr.proline.studio.table.*; import fr.proline.studio.table.renderer.*; @@ -54,26 +53,31 @@ public class PTMClusterTableModel extends LazyTableModel implements GlobalTableM private final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ptm"); public static final int COLTYPE_PTM_CLUSTER_ID = 0; - public static final int COLTYPE_PROTEIN_ID = 1; - public static final int COLTYPE_PROTEIN_NAME = 2; - public static final int COLTYPE_PEPTIDE_NAME = 3; - public static final int COLTYPE_PEPTIDE_PTM = 4; - public static final int COLTYPE_PTM_PROBA = 5; - - - public static final int COLTYPE_PEPTIDE_SCORE = 6; - public static final int COLTYPE_PEPTIDE_COUNT = 7; - public static final int COLTYPE_PTMSITE_COUNT = 8; - public static final int COLTYPE_PTMSITE_POSITIONS = 9; - public static final int COLTYPE_PTM_CLUSTER_CONFIDENCE = 10; - public static final int COLTYPE_PTMSITE_CONFIDENCES = 11; - - public static final int COLTYPE_DELTA_MASS_PTM = 12; - public static final int COLTYPE_SPECTRUM_TITLE = 13; + public static final int COLTYPE_PTM_CLUSTER_SELECTION_LEVEL = 1; + public static final int COLTYPE_PROTEIN_ID = 2; + public static final int COLTYPE_PROTEIN_NAME = 3; + public static final int COLTYPE_PEPTIDE_NAME = 4; + public static final int COLTYPE_CLUSTER_NOTATION= 5; + public static final int COLTYPE_CLUSTER_INFO = 6; + public static final int COLTYPE_PEPTIDE_PTM = 7; + public static final int COLTYPE_PTM_PROBA = 8; + + + public static final int COLTYPE_PEPTIDE_SCORE = 9; + public static final int COLTYPE_PEPTIDE_COUNT = 10; + public static final int COLTYPE_PTMSITE_COUNT = 11; + public static final int COLTYPE_PTMSITE_POSITIONS = 12; + public static final int COLTYPE_PTMSITE_PEP_POSITIONS = 13; + public static final int COLTYPE_PTM_CLUSTER_CONFIDENCE = 14; + public static final int COLTYPE_PTMSITE_CONFIDENCES = 15; + + public static final int COLTYPE_DELTA_MASS_PTM = 16; + public static final int COLTYPE_SPECTRUM_TITLE = 17; + public static final int LAST_STATIC_COLUMN = COLTYPE_SPECTRUM_TITLE; - private static final String[] m_columnNames = {"Id", "Protein Id", "Protein", "Peptide", "PTMs", "PTMs Confid.(MDScore, %)", "Score", "Peptide count", "Site count", "Sites Loc.", "Confidence" ,"Sites Confid.(%)", "PTM D.Mass", "Spectrum title"}; - private static final String[] m_columnTooltips = {"PTM cluster Id", "Protein match Id", "Protein", "Peptide", "Peptide's PTMs", "PTMs localisation confidence (%)", "Score of the peptide match", "Number of peptides matching the modification site", "Number of modification sites grouped into the cluster", "Sites localisation on the protein", "Sites combined confidence", "Sites localisation confidence (%)", "PTMs delta mass", "Peptide match spectrum title"}; + private static final String[] m_columnNames = {"Id", "Status", "Protein Id", "Protein", "Peptide", "Status confidence","Status description" ,"PTMs", "PTMs Confid.(MDScore, %)", "Score", "Peptide count", "Site count", "Sites Loc.","Sites Modif. on peptide", "Confidence" ,"Sites Confid.(%)", "PTM D.Mass", "Spectrum title"}; + private static final String[] m_columnTooltips = {"PTM cluster Id", "Cluster Status: Validated or Invalidated ", "Protein match Id", "Protein", "Peptide","Value illustrating the confidence in the Cluster Status", "Comment to outline Cluster Status", "Peptide's PTMs", "PTMs localisation confidence (%)", "Score of the peptide match", "Number of peptides matching the modification site", "Number of modification sites grouped into the cluster", "Sites localisation on the protein \nMay be greater than site count in case of merged clusters. ", "Sites modification and localisation on the representative peptide", "Sites combined confidence", "Sites localisation confidence (%) \nMay be greater than site count in case of merged clusters. ", "PTMs delta mass", "Peptide match spectrum title"}; //Dynamique columns @@ -96,9 +100,11 @@ public class PTMClusterTableModel extends LazyTableModel implements GlobalTableM private String m_modificationInfo = ""; private final ScoreRenderer m_scoreRenderer = new ScoreRenderer(); + private RendererMouseCallback m_selectLevelRendererCallback; // To be called by renderer whenmouse action - public PTMClusterTableModel(LazyTable table) { + public PTMClusterTableModel(LazyTable table, RendererMouseCallback callback) { super(table); + m_selectLevelRendererCallback = callback; } @Override @@ -164,6 +170,9 @@ public List getDefaultColumnsToHide() { List listIds = new ArrayList(); listIds.add(COLTYPE_PROTEIN_ID); listIds.add(COLTYPE_PTM_CLUSTER_CONFIDENCE); + listIds.add(COLTYPE_CLUSTER_NOTATION); + listIds.add(COLTYPE_CLUSTER_INFO); + listIds.add(COLTYPE_PTMSITE_PEP_POSITIONS); if(m_isQuantitationDS){ for (int i = m_quantChannels.length - 1; i >= 0; i--) { listIds.add(COLTYPE_START_QUANT_INDEX + COLTYPE_RAW_ABUNDANCE + (i * m_columnNamesQC.length)); @@ -176,19 +185,24 @@ public List getDefaultColumnsToHide() { public Class getColumnClass(int col) { switch (col) { + case COLTYPE_PTM_CLUSTER_SELECTION_LEVEL: + return SelectLevelEnum.class; case COLTYPE_PTM_CLUSTER_ID: case COLTYPE_PROTEIN_ID: return Long.class; case COLTYPE_PROTEIN_NAME: + case COLTYPE_CLUSTER_INFO: return String.class; case COLTYPE_PTM_CLUSTER_CONFIDENCE: return Float.class; - case COLTYPE_PEPTIDE_COUNT: - case COLTYPE_PTMSITE_COUNT: + case COLTYPE_PEPTIDE_COUNT: + case COLTYPE_CLUSTER_NOTATION: return Integer.class; case COLTYPE_PTMSITE_POSITIONS: case COLTYPE_PTMSITE_CONFIDENCES: + case COLTYPE_PTMSITE_PEP_POSITIONS: return ComparableList.class; + case COLTYPE_PTMSITE_COUNT: case COLTYPE_PEPTIDE_NAME: case COLTYPE_PEPTIDE_PTM: case COLTYPE_SPECTRUM_TITLE: @@ -205,13 +219,14 @@ public Class getColumnClass(int col) { @Override public int getSubTaskId(int col) { switch (col) { + case COLTYPE_PTMSITE_COUNT: case COLTYPE_PEPTIDE_NAME: case COLTYPE_PEPTIDE_PTM: case COLTYPE_SPECTRUM_TITLE: case COLTYPE_PTM_PROBA: case COLTYPE_DELTA_MASS_PTM: case COLTYPE_PEPTIDE_SCORE: - return DatabasePTMsTask.SUB_TASK_PTMCLUSTER_PEPTIDES; + return DatabaseDatasetPTMsTask.SUB_TASK_PTMCLUSTER_PEPTIDES; } return -1; } @@ -238,6 +253,19 @@ public Object getValueAt(int row, int col) { case COLTYPE_PTM_CLUSTER_ID: return ptmCluster.getId(); + case COLTYPE_PTM_CLUSTER_SELECTION_LEVEL: + SelectLevelEnum level = SelectLevelEnum.valueOf(ptmCluster.getSelectionLevel()); + if (level == null) { + level = SelectLevelEnum.SELECTED_AUTO; + } + return level; + + case COLTYPE_CLUSTER_INFO: + return ptmCluster.getSelectionInfo(); + + case COLTYPE_CLUSTER_NOTATION: + return ptmCluster.getSelectionNotation(); + case COLTYPE_PROTEIN_ID: return proteinMatch.getId(); @@ -313,6 +341,9 @@ public Object getValueAt(int row, int col) { case COLTYPE_PTMSITE_POSITIONS: return ptmCluster.getPositionsOnProtein(); + case COLTYPE_PTMSITE_PEP_POSITIONS: + return ptmCluster.getPTMSites().stream().map(s -> s.peptideSpecificReadablePtmString(peptideMatch.getPeptide().getId())).collect(ComparableList::new, ComparableList::add, ComparableList::addAll); + case COLTYPE_PTMSITE_CONFIDENCES: return ptmCluster.getSiteConfidences(); @@ -323,8 +354,15 @@ public Object getValueAt(int row, int col) { return ptmCluster.getPeptideCount(); case COLTYPE_PTMSITE_COUNT: - return ptmCluster.getPTMSites().size(); - + Integer siteSize = ptmCluster.getPTMSitesCount(); + if (siteSize < 0) { + lazyData.setData(null); + givePriorityTo(m_taskId, row, col); + return lazyData; + } + lazyData.setData(siteSize); + return lazyData; + case COLTYPE_SPECTRUM_TITLE: { if (peptideMatch == null) { lazyData.setData(null); @@ -351,7 +389,7 @@ public Object getValueAt(int row, int col) { if (quantPeptideByQchIds == null) { switch (id) { case COLTYPE_RAW_ABUNDANCE: - lazyData.setData(Integer.valueOf(0)); + lazyData.setData(Float.valueOf(0)); break; case COLTYPE_ABUNDANCE: lazyData.setData(Float.valueOf(0)); @@ -363,7 +401,7 @@ public Object getValueAt(int row, int col) { if (quantPeptide == null) { switch (id) { case COLTYPE_RAW_ABUNDANCE: - lazyData.setData(Integer.valueOf(0)); + lazyData.setData(Float.valueOf(0)); break; case COLTYPE_ABUNDANCE: lazyData.setData(Float.valueOf(0)); @@ -398,7 +436,7 @@ public void setData(Long taskId, ArrayList proteinPTMClusterArray) { return -1; if(o2 == null) return 1; - return o1.getId().compareTo(o2.getId()); + return o1.getId().compareTo(o2.getId()); }); Map> clustersBySitesCount = m_ptmClusters.stream().collect(Collectors.partitioningBy(c -> c.getPTMSites().size() > 1)); StringBuilder sb = new StringBuilder(); @@ -464,6 +502,10 @@ public void dataUpdated() { } } + public boolean isRowEditable(int rowIndex) { + return true; + } + public PTMCluster getProteinPTMCluster(int i) { return m_ptmClusters.get(i); } @@ -496,8 +538,12 @@ public Class getDataColumnClass(int columnIndex) { case COLTYPE_PTM_PROBA: case COLTYPE_PEPTIDE_SCORE: return Float.class; - default: - return getColumnClass(columnIndex); + case COLTYPE_PTMSITE_COUNT: + return Integer.class; + default: + if(columnIndex <= LAST_STATIC_COLUMN) + return getColumnClass(columnIndex); + return Float.class; //Quanti specific col : (raw)abundances } } @@ -505,7 +551,10 @@ public Class getDataColumnClass(int columnIndex) { public Object getDataValueAt(int rowIndex, int columnIndex) { if (columnIndex == COLTYPE_PEPTIDE_NAME) { return ((DPeptideMatch)((LazyData) getValueAt(rowIndex, columnIndex)).getData()).getPeptide().getSequence(); + } else if (columnIndex == COLTYPE_PTM_CLUSTER_SELECTION_LEVEL){ + return ((SelectLevelEnum)getValueAt(rowIndex, columnIndex)).getIntValue(); } + return getValueAt(rowIndex, columnIndex); } @@ -589,7 +638,23 @@ public Object convertValue(Object o) { filtersMap.put(COLTYPE_PTMSITE_COUNT, new IntegerFilter(getColumnName(COLTYPE_PTMSITE_COUNT), null, COLTYPE_PTMSITE_COUNT)); // filtersMap.put(COLTYPE_MODIFICATION_PROBA, new DoubleFilter(getColumnName(COLTYPE_MODIFICATION_PROBA), null, COLTYPE_MODIFICATION_PROBA)); filtersMap.put(COLTYPE_SPECTRUM_TITLE, new StringDiffFilter(getColumnName(COLTYPE_SPECTRUM_TITLE), null, COLTYPE_SPECTRUM_TITLE)); - +// filtersMap.put(COLTYPE_ABUNDANCE, new StringDiffFilter(getColumnName(COLTYPE_SPECTRUM_TITLE), null, COLTYPE_SPECTRUM_TITLE)); + + int nbCol = getColumnCount(); + for (int i = LAST_STATIC_COLUMN + 1; i < nbCol; i++) { + int dynQchIndex = i - (COLTYPE_START_QUANT_INDEX); + int nbQc = dynQchIndex / m_columnNamesQC.length; + int id = dynQchIndex - (nbQc * m_columnNamesQC.length); + + switch (id) { + case COLTYPE_ABUNDANCE: + filtersMap.put(i, new DoubleFilter(getColumnName(i), null, i)); + break; + case COLTYPE_RAW_ABUNDANCE: + filtersMap.put(i, new DoubleFilter(getColumnName(i), null, i)); + break; + } + } } @Override @@ -672,11 +737,24 @@ public TableCellRenderer getRenderer(int row, int col) { renderer = new CollectionRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)), 2); break; } + case COLTYPE_PTMSITE_PEP_POSITIONS: case COLTYPE_PTMSITE_POSITIONS: { renderer = new CollectionRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class))); break; } + case COLTYPE_PTM_CLUSTER_SELECTION_LEVEL: { + renderer = new SelectLevelRenderer(m_selectLevelRendererCallback, COLTYPE_PTM_CLUSTER_SELECTION_LEVEL); + } + case COLTYPE_PROTEIN_ID : + case COLTYPE_PTM_CLUSTER_ID: + case COLTYPE_PEPTIDE_COUNT: + case COLTYPE_PTMSITE_COUNT: + case COLTYPE_CLUSTER_INFO: + case COLTYPE_CLUSTER_NOTATION: + //Return explicitly null to don't go in default case + break; + default: { if (m_isQuantitationDS) { int nbQc = (col - COLTYPE_START_QUANT_INDEX) / m_columnNamesQC.length; @@ -694,8 +772,13 @@ public TableCellRenderer getRenderer(int row, int col) { m_rendererMap.put(col, renderer); return renderer; } - - private final HashMap m_rendererMap = new HashMap(); + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + return columnIndex == COLTYPE_PTM_CLUSTER_SELECTION_LEVEL; + } + + private final HashMap m_rendererMap = new HashMap(); @Override public GlobalTableModelInterface getFrozzenModel() { @@ -746,4 +829,8 @@ public Object getColValue(Class c, int col) { return null; } + public int getModelIndexFor(PTMCluster cluster){ + return m_ptmClusters.indexOf(cluster); + } + } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PTMPeptidesTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PTMPeptidesTableModel.java index 100a9b042..90f93d526 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PTMPeptidesTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PTMPeptidesTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -30,10 +30,7 @@ import fr.proline.studio.export.ExportModelUtilities; import fr.proline.studio.extendedtablemodel.ExtraDataType; import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; -import fr.proline.studio.filter.ConvertValueInterface; -import fr.proline.studio.filter.DoubleFilter; -import fr.proline.studio.filter.Filter; -import fr.proline.studio.filter.StringDiffFilter; +import fr.proline.studio.filter.*; import fr.proline.studio.graphics.PlotInformation; import fr.proline.studio.graphics.PlotType; import fr.proline.studio.rsmexplorer.gui.renderer.FloatRenderer; @@ -71,14 +68,16 @@ public class PTMPeptidesTableModel extends LazyTableModel implements GlobalTable public static final int COLTYPE_PEPTIDE_ID = 0; public static final int COLTYPE_PEPTIDE_NAME = 1; public static final int COLTYPE_PEPTIDE_SCORE = 2; - public static final int COLTYPE_PEPTIDE_PTM = 3; - public static final int COLTYPE_DELTA_MASS_PTM = 4; - public static final int COLTYPE_PTM_PROBA = 5; - public static final int COLTYPE_SPECTRUM_TITLE = 6; + public static final int COLTYPE_PEPTIDE_EXP_MOZ = 3; + public static final int COLTYPE_PEPTIDE_CHARGE = 4; + public static final int COLTYPE_PEPTIDE_PTM = 5; + public static final int COLTYPE_DELTA_MASS_PTM =6; + public static final int COLTYPE_PTM_PROBA = 7; + public static final int COLTYPE_SPECTRUM_TITLE = 8; public static final int LAST_STATIC_COLUMN = COLTYPE_SPECTRUM_TITLE; - private static final String[] m_columnNames = {"Id", "Peptide", "Score", "PTMs", "PTMs D.Mass", "PTMs Confid.(%)", "Spectrum title"}; - private static final String[] m_columnTooltips = {"Peptide match Id", "Peptide Sequence", "Score of the peptide match", "PTMs associated with this peptide", "PTMs delta mass", "PTMs localisation confidence", "Peptide match query title"}; + private static final String[] m_columnNames = {"Id", "Peptide", "Score", "Exp. MoZ", "Charge", "PTMs", "PTMs D.Mass", "PTMs Confid.(%)", "Spectrum title"}; + private static final String[] m_columnTooltips = {"Peptide match Id", "Peptide Sequence", "Score of the peptide match", "Experimental Mass to Charge Ratio","Charge", "PTMs associated with this peptide", "PTMs delta mass", "PTMs localisation confidence", "Peptide match query title"}; // Dynamic columns list 1 : PTM Probability related private static final String COLTYPE_SITE_PROBA_SUFFIX = "Probability"; @@ -256,6 +255,15 @@ private String getPtmSiteProbaColNameAt(int col){ return m_dynamiqueColumnNamesByProtLoc.get(keyCol); } + + public DMasterQuantPeptide getMasterQuantPeptideAt(int row) { + if (row < 0 || (row >= getRowCount())) { + return null; + } + + return m_quantPeptidesByPepInsId.get(m_ptmPepInstancesAsRow.get(row).ptmPeptideInstance.getPeptideInstance().getId()); + } + public PTMPeptidesTableModel.Row getPTMPeptideInstanceAt(int row) { if (row < 0 || (row >= getRowCount())) { return null; @@ -338,7 +346,13 @@ public Object getValueAt(int rowIndex, int columnIndex) { } case COLTYPE_PEPTIDE_SCORE:{ return (pepMatch==null) ? Float.valueOf(0) : pepMatch.getScore(); - } + } + case COLTYPE_PEPTIDE_CHARGE:{ + return (pepMatch==null) ? 0 : pepMatch.getCharge(); + } + case COLTYPE_PEPTIDE_EXP_MOZ:{ + return (pepMatch==null) ? Double.NaN : pepMatch.getExperimentalMoz(); + } case COLTYPE_PEPTIDE_PTM: { if(pepMatch == null) return "UNKNOWN"; @@ -521,6 +535,7 @@ public TableCellRenderer getRenderer(int row, int col) { renderer = new DefaultLeftAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)); break; } + case COLTYPE_PEPTIDE_CHARGE: case COLTYPE_PEPTIDE_ID: { renderer = new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(Integer.class)); break; @@ -529,6 +544,7 @@ public TableCellRenderer getRenderer(int row, int col) { renderer = new FloatRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)), 2); break; } + case COLTYPE_PEPTIDE_EXP_MOZ: case COLTYPE_DELTA_MASS_PTM: { renderer = new DoubleRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)), 4); break; @@ -589,6 +605,8 @@ public String getDataColumnIdentifier(int columnIndex) { @Override public Class getDataColumnClass(int columnIndex) { switch (columnIndex) { + case COLTYPE_PEPTIDE_CHARGE: + return Integer.class; case COLTYPE_PEPTIDE_ID: return Long.class; case COLTYPE_PEPTIDE_NAME: @@ -596,6 +614,7 @@ public Class getDataColumnClass(int columnIndex) { case COLTYPE_SPECTRUM_TITLE: return String.class; case COLTYPE_DELTA_MASS_PTM: + case COLTYPE_PEPTIDE_EXP_MOZ: return Double.class; case COLTYPE_PEPTIDE_SCORE: case COLTYPE_PTM_PROBA: @@ -631,6 +650,8 @@ public Class getDataColumnClass(int columnIndex) { public Class getColumnClass(int col) { switch (col) { + case COLTYPE_PEPTIDE_CHARGE: + return Integer.class; case COLTYPE_PEPTIDE_ID: return Long.class; case COLTYPE_PEPTIDE_NAME: @@ -638,6 +659,7 @@ public Class getColumnClass(int col) { case COLTYPE_PEPTIDE_PTM: case COLTYPE_SPECTRUM_TITLE: return String.class; + case COLTYPE_PEPTIDE_EXP_MOZ: case COLTYPE_DELTA_MASS_PTM: return Double.class; case COLTYPE_PTM_PROBA: @@ -744,6 +766,8 @@ public Object convertValue(Object o) { filtersMap.put(COLTYPE_PEPTIDE_NAME, new StringDiffFilter(getColumnName(COLTYPE_PEPTIDE_NAME), peptideConverter, COLTYPE_PEPTIDE_NAME)); filtersMap.put(COLTYPE_PEPTIDE_SCORE, new DoubleFilter(getColumnName(COLTYPE_PEPTIDE_SCORE), null, COLTYPE_PEPTIDE_SCORE)); + filtersMap.put(COLTYPE_PEPTIDE_EXP_MOZ, new DoubleFilter(getColumnName(COLTYPE_PEPTIDE_EXP_MOZ), null, COLTYPE_PEPTIDE_EXP_MOZ)); + filtersMap.put(COLTYPE_PEPTIDE_CHARGE, new IntegerFilter(getColumnName(COLTYPE_PEPTIDE_CHARGE), null, COLTYPE_PEPTIDE_CHARGE)); filtersMap.put(COLTYPE_PEPTIDE_PTM, new StringDiffFilter(getColumnName(COLTYPE_PEPTIDE_PTM), null, COLTYPE_PEPTIDE_PTM)); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptideInstanceTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptideInstanceTableModel.java index c5044a6b6..9ebf4d210 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptideInstanceTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptideInstanceTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,43 +16,36 @@ */ package fr.proline.studio.rsmexplorer.gui.model; -import fr.proline.studio.table.*; import fr.proline.core.orm.msi.Peptide; import fr.proline.core.orm.msi.PeptideInstance; import fr.proline.core.orm.msi.PeptideReadablePtmString; import fr.proline.core.orm.msi.ResultSummary; -import fr.proline.core.orm.msi.dto.DPeptideMatch; import fr.proline.core.orm.msi.dto.DMsQuery; +import fr.proline.core.orm.msi.dto.DPeptideMatch; +import fr.proline.studio.WindowManager; import fr.proline.studio.corewrapper.util.PeptideClassesUtils; -import fr.proline.studio.extendedtablemodel.ExtraDataType; import fr.proline.studio.dam.tasks.DatabaseLoadPeptidesInstancesTask; -import fr.proline.studio.export.ExportModelUtilities; +import fr.proline.studio.dock.gui.InfoLabel; import fr.proline.studio.export.ExportFontData; -import fr.proline.studio.filter.ConvertValueInterface; -import fr.proline.studio.filter.DoubleFilter; -import fr.proline.studio.filter.Filter; -import fr.proline.studio.filter.IntegerFilter; -import fr.proline.studio.filter.StringFilter; +import fr.proline.studio.export.ExportModelUtilities; +import fr.proline.studio.extendedtablemodel.CompoundTableModel; +import fr.proline.studio.extendedtablemodel.ExtraDataType; +import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; +import fr.proline.studio.filter.*; import fr.proline.studio.graphics.PlotInformation; import fr.proline.studio.graphics.PlotType; -import fr.proline.studio.table.renderer.DefaultLeftAlignRenderer; -import fr.proline.studio.table.renderer.DefaultRightAlignRenderer; import fr.proline.studio.rsmexplorer.gui.renderer.FloatRenderer; import fr.proline.studio.rsmexplorer.gui.renderer.MsQueryRenderer; import fr.proline.studio.rsmexplorer.gui.renderer.PeptideRenderer; import fr.proline.studio.rsmexplorer.gui.renderer.ScoreRenderer; -import fr.proline.studio.extendedtablemodel.CompoundTableModel; -import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; -import fr.proline.studio.filter.StringDiffFilter; -import fr.proline.studio.table.TableDefaultRendererManager; -import fr.proline.studio.utils.StudioExceptions; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Map; +import fr.proline.studio.table.*; +import fr.proline.studio.table.renderer.DefaultLeftAlignRenderer; +import fr.proline.studio.table.renderer.DefaultRightAlignRenderer; + import javax.swing.table.TableCellRenderer; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.*; /** * Table Model for PeptideInstance of a Rsm @@ -190,7 +183,9 @@ public Object getValueAt(int row, int col) { return (peptideMatch == null) ? null : peptideMatch.getPeptide().getSequence().length(); } case COLTYPE_PEPTIDE_EXPERIMENTAL_MOZ: { - return Float.valueOf((float) peptideMatch.getExperimentalMoz()); + BigDecimal bd = new BigDecimal(peptideMatch.getExperimentalMoz()); + Float expMoz = bd.setScale(4, RoundingMode.HALF_UP).floatValue(); + return expMoz; } case COLTYPE_PEPTIDE_PPM: { float ppm = PeptideClassesUtils.getPPMFor(peptideMatch, peptideMatch.getPeptide()); @@ -199,7 +194,8 @@ public Object getValueAt(int row, int col) { case COLTYPE_PEPTIDE_CALCULATED_MASS: { Peptide peptide = peptideMatch.getPeptide(); - Float calculatedMass = Float.valueOf((float) peptide.getCalculatedMass()); + BigDecimal bd = new BigDecimal(peptide.getCalculatedMass()); + Float calculatedMass = bd.setScale(4, RoundingMode.HALF_UP).floatValue(); return calculatedMass; } @@ -292,7 +288,7 @@ public Object getValueAt(int row, int col) { Double score = (Double)((Map)properties.get("score")).get("score"); return score.floatValue(); } catch (Exception e) { - StudioExceptions.notify("Peptide instance property cannot be read", e); + WindowManager.getDefault().getMainWindow().alert(InfoLabel.INFO_LEVEL.ERROR,"Peptide instance property cannot be read", e); return null; } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptideMatchTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptideMatchTableModel.java index 1aa070b9f..5ff2bf32d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptideMatchTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptideMatchTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,42 +16,32 @@ */ package fr.proline.studio.rsmexplorer.gui.model; -import fr.proline.studio.table.LazyData; -import fr.proline.studio.table.LazyTableModel; -import fr.proline.studio.table.LazyTable; import fr.proline.core.orm.msi.Peptide; import fr.proline.core.orm.msi.PeptideReadablePtmString; import fr.proline.core.orm.msi.SequenceMatch; import fr.proline.core.orm.msi.dto.DMsQuery; import fr.proline.core.orm.msi.dto.DPeptideMatch; import fr.proline.studio.corewrapper.util.PeptideClassesUtils; -import fr.proline.studio.extendedtablemodel.ExtraDataType; import fr.proline.studio.dam.tasks.DatabaseLoadPeptideMatchTask; -import fr.proline.studio.export.ExportModelUtilities; import fr.proline.studio.export.ExportFontData; -import fr.proline.studio.filter.BooleanFilter; -import fr.proline.studio.filter.ConvertValueInterface; -import fr.proline.studio.filter.DoubleFilter; -import fr.proline.studio.filter.Filter; -import fr.proline.studio.filter.IntegerFilter; -import fr.proline.studio.graphics.PlotInformation; -import fr.proline.studio.graphics.PlotType; -import fr.proline.studio.rsmexplorer.gui.renderer.BooleanRenderer; -import fr.proline.studio.table.renderer.DefaultRightAlignRenderer; -import fr.proline.studio.rsmexplorer.gui.renderer.FloatRenderer; -import fr.proline.studio.rsmexplorer.gui.renderer.MsQueryRenderer; -import fr.proline.studio.rsmexplorer.gui.renderer.PeptideRenderer; -import fr.proline.studio.rsmexplorer.gui.renderer.ScoreRenderer; +import fr.proline.studio.export.ExportModelUtilities; import fr.proline.studio.extendedtablemodel.CompoundTableModel; +import fr.proline.studio.extendedtablemodel.ExtraDataType; import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; -import fr.proline.studio.filter.StringDiffFilter; +import fr.proline.studio.filter.*; +import fr.proline.studio.graphics.PlotInformation; +import fr.proline.studio.graphics.PlotType; +import fr.proline.studio.rsmexplorer.gui.renderer.*; +import fr.proline.studio.table.LazyData; +import fr.proline.studio.table.LazyTable; +import fr.proline.studio.table.LazyTableModel; import fr.proline.studio.table.TableDefaultRendererManager; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Map; +import fr.proline.studio.table.renderer.DefaultRightAlignRenderer; + import javax.swing.table.TableCellRenderer; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.*; /** * Table Model for PeptideMatch of a RSet @@ -400,13 +390,11 @@ public Object getValueAt(int row, int col) { } case COLTYPE_PEPTIDE_EXPERIMENTAL_MOZ: { - lazyData.setData(Float.valueOf((float) peptideMatch.getExperimentalMoz())); + BigDecimal bd = new BigDecimal(peptideMatch.getExperimentalMoz()); + Float expMoz = bd.setScale(4, RoundingMode.HALF_UP).floatValue(); + lazyData.setData(expMoz); return lazyData; } - /*case COLTYPE_PEPTIDE_DELTA_MOZ: { - lazyData.setData(Float.valueOf((float) peptideMatch.getDeltaMoz())); - return lazyData; - }*/ case COLTYPE_PEPTIDE_PPM: { Peptide peptide = peptideMatch.getPeptide(); @@ -427,7 +415,8 @@ public Object getValueAt(int row, int col) { givePriorityTo(m_taskId, row, col); lazyData.setData(null); } else { - Float calculatedMass = Float.valueOf((float) peptide.getCalculatedMass()); + BigDecimal bd = new BigDecimal(peptide.getCalculatedMass()); + Float calculatedMass = bd.setScale(4, RoundingMode.HALF_UP).floatValue(); lazyData.setData(calculatedMass); } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptideTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptideTableModel.java index 8a5fc6f1a..4b5002691 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptideTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptideTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -80,6 +80,7 @@ public class PeptideTableModel extends DecoratedTableModel implements GlobalTabl public static final int COLTYPE_PEPTIDE_MSQUERY = 19; public static final int COLTYPE_SPECTRUM_TITLE = 20; public static final int COLTYPE_PEPTIDE_SCORE = 21; + public static final int COLTYPE_PEPTIDE_NONE_AMBIGUOUS_SEQ = 22; // private static final TableColumn[] COLUMNS = new TableColumn[COLTYPE_PEPTIDE_SCORE+1]; @@ -106,7 +107,8 @@ public class PeptideTableModel extends DecoratedTableModel implements GlobalTabl .add(COLTYPE_PEPTIDE_ION_PARENT_INTENSITY,"Ion Parent Int.", "Ion Parent Intensity", Float.class) .add(COLTYPE_PEPTIDE_MSQUERY,"MsQuery", "MsQuery", DMsQuery.class) .add(COLTYPE_SPECTRUM_TITLE, "Spectrum Title", "Spectrum Title", String.class) - .add(COLTYPE_PEPTIDE_SCORE, "Score", "Peptide Score", Float.class).build(); + .add(COLTYPE_PEPTIDE_SCORE, "Score", "Peptide Score", Float.class) + .add(COLTYPE_PEPTIDE_NONE_AMBIGUOUS_SEQ, "None Ambiguous Seq", "Peptide Sequence with Ambiguous AA substituted ", String.class).build(); private DPeptideInstance[] m_peptideInstances = null; private ScoreRenderer m_scoreRenderer = new ScoreRenderer(); @@ -387,6 +389,15 @@ public Object getValueAt(int row, int col) { Double score = (Double)((Map)properties.get("score")).get("score"); return score.floatValue(); } + + case COLTYPE_PEPTIDE_NONE_AMBIGUOUS_SEQ: { + if (peptideMatch == null) { + return ""; + } + + return peptideMatch.getDisambiguatedSeq(); + + } } return null; // should never happen } @@ -416,6 +427,7 @@ public Object convertValue(Object o) { }; filtersMap.put(COLTYPE_PEPTIDE_NAME, new StringDiffFilter(getColumnName(COLTYPE_PEPTIDE_NAME), peptideConverter, COLTYPE_PEPTIDE_NAME)); + filtersMap.put(COLTYPE_PEPTIDE_NONE_AMBIGUOUS_SEQ, new StringDiffFilter(getColumnName(COLTYPE_PEPTIDE_NONE_AMBIGUOUS_SEQ), null, COLTYPE_PEPTIDE_NONE_AMBIGUOUS_SEQ)); filtersMap.put(COLTYPE_PEPTIDE_NEXT_AA, new StringDiffFilter(getColumnName(COLTYPE_PEPTIDE_NEXT_AA), null, COLTYPE_PEPTIDE_NEXT_AA)); filtersMap.put(COLTYPE_PEPTIDE_LENGTH, new IntegerFilter(getColumnName(COLTYPE_PEPTIDE_LENGTH), null, COLTYPE_PEPTIDE_LENGTH)); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptidesPTMSiteTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptidesPTMSiteTableModel.java index 3bc59ca09..459793d76 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptidesPTMSiteTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/PeptidesPTMSiteTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/ProteinSetTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/ProteinSetTableModel.java index 589c4e53b..d6304adb1 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/ProteinSetTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/ProteinSetTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -59,7 +59,7 @@ public class ProteinSetTableModel extends LazyTableModel implements GlobalTableM // --------------------------------------------------- public static final int COLTYPE_PROTEIN_SET_ID = 0; public static final int COLTYPE_PROTEIN_SET_NAME = 1; - public static final int COLTYPE_PROTEIN_SET_DESCRIPTION = 2; + public static final int COLTYPE_PROTEIN_SET_DESCRIPTION = 2; public static final int COLTYPE_PROTEIN_SCORE = 3; public static final int COLTYPE_PROTEINS_COUNT = 4; public static final int COLTYPE_PEPTIDES_COUNT = 5; @@ -95,9 +95,9 @@ private void setColUsed(boolean mergedRsm) { m_colUsed = colUsed; } } - + /** - * by default the geneName is hidden + * by default the geneName is hidden * * @return the list of columns ids of these columns */ @@ -138,7 +138,7 @@ public String getToolTipForHeader(int col) { } else if(colUsed == COLTYPE_PROTEIN_SET_GENE_NAME){ return "Correcponding Gene Name. This information is fill in during 'Retrieve Sequence' task."; } else if(colUsed == COLTYPE_OBSERVABLE_PEPTIDES){ - return "Theorical observable peptides count. This information is fill in during 'Retrieve Sequence' task."; + return "Theoretical observable peptides count. This information is fill in during 'Retrieve Sequence' task."; } else { return getColumnName(col); } @@ -242,12 +242,12 @@ public Object getValueAt(int row, int col) { lazyData.setData(null); givePriorityTo(m_taskId, row, col); } else { - String geneName = proteinMatch.getGeneName(); + String geneName = proteinMatch.getGeneName(); if(geneName == null ) geneName = ""; lazyData.setData(geneName); } - return lazyData; + return lazyData; } case COLTYPE_PROTEIN_SCORE: { /*Float score = Float.valueOf(proteinSet.getPeptideOverSet().getScore()); @@ -586,7 +586,7 @@ public int getInfoColumn() { * public static final int COLTYPE_PROTEIN_SET_ID = 0; public static final int COLTYPE_PROTEIN_SET_NAME = 1; - public static final int COLTYPE_PROTEIN_SET_DESCRIPTION = 2; + public static final int COLTYPE_PROTEIN_SET_DESCRIPTION = 2; public static final int COLTYPE_PROTEIN_SCORE = 3; public static final int COLTYPE_PROTEINS_COUNT = 4; public static final int COLTYPE_PEPTIDES_COUNT = 5; @@ -596,7 +596,7 @@ public int getInfoColumn() { public static final int COLTYPE_UNIQUE_SEQUENCES_COUNT = 9; public static final int COLTYPE_PROTEIN_MASS = 10; public static final int COLTYPE_PROTEIN_SET_GENE_NAME = 11; - * @param filtersMap + * @param filtersMap */ @Override public void addFilters(LinkedHashMap filtersMap) { @@ -605,37 +605,37 @@ public void addFilters(LinkedHashMap filtersMap) { colIdx++; // COLTYPE_PROTEIN_SET_NAME filtersMap.put(colIdx, new StringDiffFilter(getColumnName(colIdx), null, colIdx)); - + colIdx++; // COLTYPE_PROTEIN_SET_DESCRIPTION filtersMap.put(colIdx, new StringDiffFilter(getColumnName(colIdx), null, colIdx)); - + colIdx++; // COLTYPE_PROTEIN_SCORE filtersMap.put(colIdx, new DoubleFilter(getColumnName(colIdx), null, colIdx)); colIdx++; //COLTYPE_PROTEINS_COUNT => No Filter colIdx++; // COLTYPE_PEPTIDES_COUNT filtersMap.put(colIdx, new IntegerFilter(getColumnName(colIdx), null, colIdx)); - + colIdx++; // COLTYPE_OBSERVABLE_PEPTIDES filtersMap.put(colIdx, new IntegerFilter(getColumnName(colIdx), null, colIdx)); - + colIdx++; // COLTYPE_SPECTRAL_COUNT filtersMap.put(colIdx, new IntegerFilter(getColumnName(colIdx), null, colIdx)); - + colIdx++; // COLTYPE_SPECIFIC_SPECTRAL_COUNT /*if (m_mergedData) { filtersMap.put(colIdx, new IntegerFilter(getColumnName(colIdx), null, colIdx)); colIdx++; // COLTYPE_BASIC_SPECTRAL_COUNT }*/ filtersMap.put(colIdx, new IntegerFilter(getColumnName(colIdx), null, colIdx)); - - colIdx++; // COLTYPE_UNIQUE_SEQUENCES_COUNT + + colIdx++; // COLTYPE_UNIQUE_SEQUENCES_COUNT filtersMap.put(colIdx, new IntegerFilter(getColumnName(colIdx), null, colIdx)); - + colIdx++; // COLTYPE_PROTEIN_MASS filtersMap.put(colIdx, new DoubleFilter(getColumnName(colIdx), null, colIdx)); colIdx++; // COLTYPE_PROTEIN_SET_GENE_NAME filtersMap.put(colIdx, new StringDiffFilter(getColumnName(colIdx), null, colIdx)); - + } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/ProteinTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/ProteinTableModel.java index c2a9f3e9f..f1adc30bb 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/ProteinTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/ProteinTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/ProteinsOfPeptideMatchTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/ProteinsOfPeptideMatchTableModel.java index 745026f43..3e91b3936 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/ProteinsOfPeptideMatchTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/ProteinsOfPeptideMatchTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.model; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/AbstractPropertiesTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/AbstractPropertiesTableModel.java index 05c23875b..1490888e5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/AbstractPropertiesTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/AbstractPropertiesTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.model.properties; import fr.proline.core.orm.uds.dto.DDataset; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/IdentificationPropertiesTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/IdentificationPropertiesTableModel.java index 9511a5be3..760c741e3 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/IdentificationPropertiesTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/IdentificationPropertiesTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/ProjectPropertiesTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/ProjectPropertiesTableModel.java new file mode 100644 index 000000000..942875ba0 --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/ProjectPropertiesTableModel.java @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.gui.model.properties; + +import fr.proline.core.orm.uds.Project; +import fr.proline.core.orm.uds.ProjectUserAccountMap; +import fr.proline.studio.table.DataGroup; +import fr.proline.studio.table.PropertiesTableModel; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Set; + +public class ProjectPropertiesTableModel extends PropertiesTableModel { + + Project m_project; + + public ProjectPropertiesTableModel(Project p) { + m_project = p; + init(); + } + + private void init(){ + m_datasetNameArray = new ArrayList<>(); + m_datasetNameArray.add(m_project.getName()); + DataGroup dg = new ProjectInformationGroup(0); + m_dataGroupList = new ArrayList<>(1); + m_dataGroupList.add(dg); + } + + public class ProjectInformationGroup extends DataGroup { + + private static final int ROWTYPE_PROJECT_ID = 0; + private static final int ROWTYPE_PROJECT_NAME = 1; + private static final int ROWTYPE_PROJECT_DESCRIPTION = 2; + private static final int ROWTYPE_PROJECT_OWNER = 3; + private static final int ROWTYPE_PROJECT_MEMBERS = 4; + + private static final int ROW_COUNT = 5; //<-- get in sync + private final Color GROUP_COLOR_BACKGROUND = new Color(76, 166, 107); + + public ProjectInformationGroup(int rowStart) { + super("Project Information", rowStart); + } + + @Override + public GroupObject getGroupNameAt(int rowIndex) { + + switch (rowIndex) { + case ROWTYPE_PROJECT_ID: + return new GroupObject("Id", this); + case ROWTYPE_PROJECT_NAME: + return new GroupObject("Name", this); + case ROWTYPE_PROJECT_DESCRIPTION: + return new GroupObject("Description", this); + case ROWTYPE_PROJECT_OWNER: + return new GroupObject("Owner", this); + case ROWTYPE_PROJECT_MEMBERS: + return new GroupObject("Shared with", this); + } + + return null; + } + + @Override + public GroupObject getGroupValueAt(int rowIndex, int columnIndex) { + + if (m_project == null) { + return new GroupObject("", this); + } + + switch (rowIndex) { + case ROWTYPE_PROJECT_ID: + return new GroupObject(String.valueOf(m_project.getId()), this); + case ROWTYPE_PROJECT_NAME: + return new GroupObject(m_project.getName(), this); + case ROWTYPE_PROJECT_DESCRIPTION: + return new GroupObject(m_project.getDescription(), this); + case ROWTYPE_PROJECT_OWNER: + return new GroupObject(m_project.getOwner().getLogin(), this); + case ROWTYPE_PROJECT_MEMBERS: { + StringBuilder sb = new StringBuilder(); + Set members = m_project.getProjectUserAccountMap(); + boolean first = true; + for (ProjectUserAccountMap nextMember : members) { + if (!first) { + sb.append(", "); + } else + first = false; + + sb.append(nextMember.getUserAccount().getLogin()); + } + return new GroupObject(sb.toString(), this); + } + } + + return null; + } + + @Override + public Color getGroupColor(int row) { + return GROUP_COLOR_BACKGROUND; + } + + @Override + public int getRowCountImpl() { + return ROW_COUNT; + } + + } +} + diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/XICPropertiesTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/XICPropertiesTableModel.java index a034a0424..0534f362b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/XICPropertiesTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/model/properties/XICPropertiesTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.model.properties; import fr.proline.core.orm.msi.ResultSummary; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMGraphicCtrlPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMGraphicCtrlPanel.java index 87ab87c8f..f0101bd20 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMGraphicCtrlPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMGraphicCtrlPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMMark.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMMark.java index 51c7b199b..21286e8cc 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMMark.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMMark.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.ptm; import fr.proline.core.orm.msi.dto.DInfoPTM; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMPeptidesGraphicModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMPeptidesGraphicModel.java index dacf9f870..c792581dd 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMPeptidesGraphicModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMPeptidesGraphicModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMPeptidesGraphicView.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMPeptidesGraphicView.java index fc250e323..ab24e2dd4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMPeptidesGraphicView.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMPeptidesGraphicView.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMSitePeptidesGraphicCtrlPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMSitePeptidesGraphicCtrlPanel.java index 6399a6269..1aa4d2b07 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMSitePeptidesGraphicCtrlPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMSitePeptidesGraphicCtrlPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMSitePeptidesGraphicDataMgr.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMSitePeptidesGraphicDataMgr.java index ec1834ba7..e0a5d66c3 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMSitePeptidesGraphicDataMgr.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMSitePeptidesGraphicDataMgr.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.ptm; import fr.proline.core.orm.msi.dto.DBioSequence; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMSitePeptidesGraphicViewPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMSitePeptidesGraphicViewPanel.java index 944999dbf..09d1bf49d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMSitePeptidesGraphicViewPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PTMSitePeptidesGraphicViewPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PeptideOnProteinOverviewPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PeptideOnProteinOverviewPanel.java index c501943e9..b5dbfc196 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PeptideOnProteinOverviewPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/PeptideOnProteinOverviewPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/ViewContext.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/ViewContext.java index d5001c0d6..a53547030 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/ViewContext.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/ViewContext.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.ptm; public class ViewContext { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/ViewPtmAbstract.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/ViewPtmAbstract.java index 7ef5abb1f..fab3cf1b2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/ViewPtmAbstract.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/ViewPtmAbstract.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.ptm; import java.awt.Graphics2D; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/ViewSetting.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/ViewSetting.java index ce4bd6904..11d4cb921 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/ViewSetting.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/ViewSetting.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.ptm; import fr.proline.studio.dam.tasks.data.ptm.PTMSite; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/PTMMarkCtrl.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/PTMMarkCtrl.java index 782c3a83c..529af5910 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/PTMMarkCtrl.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/PTMMarkCtrl.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.ptm.mark; import fr.proline.studio.rsmexplorer.gui.ptm.PTMMark; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/PTMMarkSetView.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/PTMMarkSetView.java index ce341da7f..c1c74dc3d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/PTMMarkSetView.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/PTMMarkSetView.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.ptm.mark; import fr.proline.studio.rsmexplorer.gui.ptm.ViewContext; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/PTMMarkView.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/PTMMarkView.java index 12c5075d0..058e310bc 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/PTMMarkView.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/PTMMarkView.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.ptm.mark; import fr.proline.studio.rsmexplorer.gui.ptm.PTMMark; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/ProteinSequence.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/ProteinSequence.java index d958e51a5..741b6a8fa 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/ProteinSequence.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/mark/ProteinSequence.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.ptm.mark; import fr.proline.studio.rsmexplorer.gui.ptm.ViewContext; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideAreaCtrl.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideAreaCtrl.java index dd93ffd96..2c883d904 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideAreaCtrl.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideAreaCtrl.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideAreaModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideAreaModel.java index 34045609c..938d758a2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideAreaModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideAreaModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideSetView.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideSetView.java index 3c84fc461..00211fd32 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideSetView.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideSetView.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideView.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideView.java index 038118639..939b60ea9 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideView.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/ptm/pep/PeptideView.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/BooleanRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/BooleanRenderer.java index 672bad75a..6e0a0269d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/BooleanRenderer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/BooleanRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.renderer; import fr.proline.studio.export.ExportFontData; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/CompareValueRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/CompareValueRenderer.java index 007d91a4e..dfad08c0c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/CompareValueRenderer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/CompareValueRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.renderer; import fr.proline.studio.export.ExportFontData; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/FloatRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/FloatRenderer.java index 84b3016e1..aef208b04 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/FloatRenderer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/FloatRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.renderer; import fr.proline.studio.utils.DataFormat; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/FontRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/FontRenderer.java index cd994c19e..788d15c58 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/FontRenderer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/FontRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.renderer; import fr.proline.studio.rsmexplorer.gui.xic.FeatureTableModel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/MsQueryRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/MsQueryRenderer.java index 48bdd3af0..fe78c4227 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/MsQueryRenderer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/MsQueryRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.renderer; import fr.proline.core.orm.msi.dto.DMsQuery; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/PeptideRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/PeptideRenderer.java index 5b1e1056a..1c0087553 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/PeptideRenderer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/PeptideRenderer.java @@ -1,35 +1,33 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.renderer; +import fr.profi.util.CollectionUtils; import fr.proline.core.orm.msi.Peptide; import fr.proline.core.orm.msi.dto.DPeptideMatch; import fr.proline.core.orm.msi.dto.DPeptidePTM; +import fr.proline.studio.table.renderer.GrayableTableCellRenderer; import fr.proline.studio.utils.GlobalValues; -import java.awt.Color; -import java.awt.Component; -import java.awt.Font; - -import java.util.ArrayList; -import java.util.HashMap; -import javax.swing.JLabel; -import javax.swing.JTable; + +import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; -import fr.proline.studio.table.renderer.GrayableTableCellRenderer; +import java.awt.*; +import java.util.List; +import java.util.*; /** * Renderer for a Peptide in a Table Cell @@ -52,7 +50,7 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole if ((value == null) || !(DPeptideMatch.class.isAssignableFrom(value.getClass()) || Peptide.class.isAssignableFrom(value.getClass()))) { displayString = ""; } else if (DPeptideMatch.class.isAssignableFrom(value.getClass())) { - displayString = constructPeptideDisplay(((DPeptideMatch) value).getPeptide()); + displayString = constructPeptideDisplay(((DPeptideMatch) value).getPeptide(), (DPeptideMatch)value); } else { displayString = constructPeptideDisplay((Peptide) value); } @@ -65,46 +63,66 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole return l; } - + public static String constructPeptideDisplay(Peptide peptide) { - StringBuilder m_displaySB = new StringBuilder(); - StringBuilder m_exportSB = new StringBuilder(); + return PeptideRenderer.constructPeptideDisplay(peptide,null); + } + + public static String constructPeptideDisplay(Peptide peptide, DPeptideMatch match) { String textToExport; if ((peptide != null) && (peptide.getTransientData() != null)) { + String sequence = peptide.getSequence(); - HashMap ptmMap = peptide.getTransientData().getDPeptidePtmMap(); - if (ptmMap != null) { - m_displaySB.append(GlobalValues.HTML_TAG_BEGIN); + List ambiguousIndex = new ArrayList<>(); + boolean hasAmbiguity = false; + if(match!= null && match.hasAmbiguousSeq()){ + hasAmbiguity = true; + String ambiguityInfo = (String) ((Map) match.getPropertiesAsMap().get("mascot_properties")).get("ambiguity_string"); + List ambiguityChars = Arrays.asList(ambiguityInfo.split(",")); + CollectionUtils.createSlidingWindow(ambiguityChars, 3).forEach(substInfo -> { + ambiguousIndex.add(Integer.parseInt(substInfo.get(0)) -1); + }); } - String sequence = peptide.getSequence(); + StringBuilder m_displaySB = new StringBuilder(); + HashMap ptmMap = peptide.getTransientData().getDPeptidePtmMap(); + boolean hasPtms = ptmMap != null; - if (ptmMap == null) { + if(!hasPtms && !hasAmbiguity ) { m_displaySB.append(sequence); - m_exportSB.append(sequence); } else { + m_displaySB.append(GlobalValues.HTML_TAG_BEGIN); int nb = sequence.length(); for (int i = 0; i < nb; i++) { + boolean isAmbiguous = false; + if(ambiguousIndex.contains(i)){ + isAmbiguous = true; + } + boolean nTerOrCterModification = false; - if (i == 0) { - DPeptidePTM nterPtm = ptmMap.get(0); - if (nterPtm != null) { - nTerOrCterModification = true; - } - } else if (i == nb - 1) { - DPeptidePTM cterPtm = ptmMap.get(-1); - if (cterPtm != null) { - nTerOrCterModification = true; + DPeptidePTM ptm = null; + if(hasPtms) { + if (i == 0) { + DPeptidePTM nterPtm = ptmMap.get(0); + if (nterPtm != null) { + nTerOrCterModification = true; + } + } else if (i == nb - 1) { + DPeptidePTM cterPtm = ptmMap.get(-1); + if (cterPtm != null) { + nTerOrCterModification = true; + } } + + ptm = ptmMap.get(i + 1); } - DPeptidePTM ptm = ptmMap.get(i + 1); boolean aminoAcidModification = (ptm != null); - if (nTerOrCterModification || aminoAcidModification) { + if (nTerOrCterModification || aminoAcidModification || isAmbiguous) { if (nTerOrCterModification && aminoAcidModification) { m_displaySB.append(""); @@ -117,33 +135,36 @@ public static String constructPeptideDisplay(Peptide peptide) { } + if(isAmbiguous) + m_displaySB.append(""); + m_displaySB.append(sequence.charAt(i)); - m_displaySB.append(GlobalValues.HTML_TAG_SPAN_END); + + if(isAmbiguous) + m_displaySB.append(""); + + if(nTerOrCterModification || aminoAcidModification) + m_displaySB.append(GlobalValues.HTML_TAG_SPAN_END); } else { m_displaySB.append(sequence.charAt(i)); } - m_exportSB.append(sequence.charAt(i)); } - } - if (ptmMap != null) { m_displaySB.append(GlobalValues.HTML_TAG_END); } - textToExport = m_exportSB.toString(); - m_exportSB.setLength(0); - - String res = m_displaySB.toString(); - m_displaySB.setLength(0); - return res; - } + textToExport = m_displaySB.toString(); - if (peptide == null) { - textToExport = ""; } else { - textToExport = peptide.getSequence(); + + if (peptide == null) { + textToExport = ""; + } else { + textToExport = peptide.getSequence(); + } } + return textToExport; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/PercentageRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/PercentageRenderer.java index d7c033f0d..b5a3bafea 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/PercentageRenderer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/PercentageRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.renderer; import fr.proline.studio.utils.DataFormat; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/ProteinCountRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/ProteinCountRenderer.java index 9c02bff15..2e5b15129 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/ProteinCountRenderer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/ProteinCountRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.renderer; import fr.proline.studio.rsmexplorer.gui.model.ProteinSetTableModel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/RendererMouseCallback.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/RendererMouseCallback.java index 4875a965d..cf001f779 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/RendererMouseCallback.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/RendererMouseCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/SamesetRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/SamesetRenderer.java index d5b2913cc..64877c942 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/SamesetRenderer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/SamesetRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.renderer; import fr.proline.studio.rsmexplorer.gui.model.ProteinTableModel; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/ScoreRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/ScoreRenderer.java index 647ea182d..6752018da 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/ScoreRenderer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/ScoreRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.renderer; import fr.proline.studio.utils.DataFormat; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/SelectLevelRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/SelectLevelRenderer.java new file mode 100644 index 000000000..b264afd0a --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/SelectLevelRenderer.java @@ -0,0 +1,185 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.gui.renderer; + +import fr.proline.studio.dam.data.SelectLevelEnum; +import fr.proline.studio.utils.IconManager; + +import javax.swing.*; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableColumn; +import javax.swing.table.TableColumnModel; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; + +/** + * + * @author KX257079 + */ +public class SelectLevelRenderer extends DefaultTableCellRenderer implements MouseListener, MouseMotionListener { + + private final RendererMouseCallback m_callback; + private final int m_column; + + public SelectLevelRenderer(RendererMouseCallback callback, int column) { + m_callback = callback; + m_column = column; + } + + + @Override + public void mousePressed(MouseEvent e) { } + + @Override + public void mouseReleased(MouseEvent e) { } + + @Override + public void mouseEntered(MouseEvent e) { + checkCursor(e); + } + + @Override + public void mouseExited(MouseEvent e) { + checkCursor(e); + } + + @Override + public void mouseDragged(MouseEvent e) { + checkCursor(e); + } + + @Override + public void mouseMoved(MouseEvent e) { + checkCursor(e); + } + + @Override + public void mouseClicked(MouseEvent e) { + + if (m_callback == null) { + return; + } + + if (!SwingUtilities.isLeftMouseButton(e)) { + return; + } + if (e.isShiftDown() || e.isControlDown()) { + return; // multi selection ongoing + } + + JTable table = (JTable) e.getSource(); + Point pt = e.getPoint(); + int col = table.columnAtPoint(pt); + int row = table.rowAtPoint(pt); + + int modelCol = table.convertColumnIndexToModel(col); + + if ((modelCol != m_column) || (row == -1)) { + return; + } + + JTableHeader th = table.getTableHeader(); + TableColumnModel tcm = th.getColumnModel(); + + int columnStart = 0; + for (int i=0;i. - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.renderer; import fr.proline.studio.utils.DataFormat; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/TimestampRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/TimestampRenderer.java index 72c520da9..b6a3708d1 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/TimestampRenderer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/TimestampRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.renderer; import java.awt.Component; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/XicStatusRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/XicStatusRenderer.java index bddc88b0d..c0108015b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/XicStatusRenderer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/renderer/XicStatusRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -17,21 +17,18 @@ package fr.proline.studio.rsmexplorer.gui.renderer; import fr.proline.core.orm.msi.dto.DMasterQuantPeptideIon.PepIonStatus; +import fr.proline.studio.dam.data.SelectLevelEnum; import fr.proline.studio.utils.IconManager; -import java.util.HashMap; -import java.awt.Color; -import java.awt.Component; -import java.awt.Cursor; -import java.awt.Point; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; -import javax.swing.JTable; -import javax.swing.SwingUtilities; + +import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.JTableHeader; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; /** * @@ -158,16 +155,16 @@ private void checkCursor(MouseEvent e) { public static class SelectLevel implements Comparable { public SelectLevelEnum m_status; public SelectLevelEnum m_globalStatus; - + public SelectLevel(SelectLevelEnum status, SelectLevelEnum globalStatus) { m_status = status; m_globalStatus = globalStatus; } - + public String getDescription() { return m_status.getDescription(); } - + public SelectLevelEnum getStatus() { return m_status; } @@ -179,55 +176,12 @@ public int compareTo(SelectLevel o) { return deltaStatus; } return m_status.getIntValue()-o.m_status.getIntValue(); - - } - - } - - public static enum SelectLevelEnum { - DESELECTED_MANUAL(0, "Invalidated manually"), - DESELECTED_AUTO(1, "Invalidated automatically"), - SELECTED_AUTO(2, "Validated automatically"), - SELECTED_MANUAL(3, "Validated Manual"), - UNKNOWN(-1, "Invalid (not quantified)"), - RESET_AUTO(-2, "Reset auto"); - - private int _intValue; - private String _description; - private static HashMap map = new HashMap<>(); - - private SelectLevelEnum(int value, String description) { - this._intValue = value; - this._description = description; - } - static { - for (SelectLevelEnum status : SelectLevelEnum.values()) { - map.put(status._intValue, status); - } - } - - public boolean isSelected() { - return this.equals(SELECTED_AUTO) || this.equals(SELECTED_MANUAL); - } - - public boolean isDeselected() { - return this.equals(DESELECTED_AUTO) || this.equals(DESELECTED_MANUAL); } - public int getIntValue() { - return _intValue; - } - - public String getDescription() { - return _description; - } + } - public static SelectLevelEnum valueOf(int status) { - return (SelectLevelEnum) map.get(status); - } - } public static String getPepIonStatusText(PepIonStatus status) { switch (status) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/AbstractPeptideSpectrumPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/AbstractPeptideSpectrumPanel.java index 9203b2ef5..b0d5a3670 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/AbstractPeptideSpectrumPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/AbstractPeptideSpectrumPanel.java @@ -1,560 +1,564 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.gui.spectrum; - -import fr.proline.core.orm.msi.Peptide; -import fr.proline.core.orm.msi.dto.DMsQuery; -import fr.proline.core.orm.msi.dto.DPeptideMatch; -import fr.proline.core.orm.msi.dto.DSpectrum; -import fr.proline.studio.export.ExportButton; -import fr.proline.studio.gui.HourglassPanel; -import fr.proline.studio.gui.SplittedPanelContainer; -import fr.proline.studio.pattern.AbstractDataBox; -import fr.proline.studio.pattern.DataBoxPanelInterface; -import org.jfree.chart.ChartFactory; -import org.jfree.chart.ChartPanel; -import org.jfree.chart.JFreeChart; -import org.jfree.chart.annotations.XYLineAnnotation; -import org.jfree.chart.annotations.XYTextAnnotation; -import org.jfree.chart.axis.ValueAxis; -import org.jfree.chart.event.PlotChangeEvent; -import org.jfree.chart.event.PlotChangeListener; -import org.jfree.chart.plot.*; -import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; -import org.jfree.chart.renderer.xy.XYItemRendererState; -import org.jfree.chart.title.TextTitle; -import org.jfree.data.Range; -import org.jfree.data.xy.DefaultXYDataset; -import org.jfree.data.xy.XYDataset; -import org.jfree.ui.RectangleAnchor; -import org.jfree.ui.TextAnchor; -import org.openide.windows.WindowManager; -import org.slf4j.LoggerFactory; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.geom.Rectangle2D; -import java.util.List; - -/** - * Abstract panel used to display Spectrum information graphically - * - * @author CB205360 - */ -public abstract class AbstractPeptideSpectrumPanel extends HourglassPanel implements DataBoxPanelInterface, SplittedPanelContainer.ReactiveTabbedComponent, PlotChangeListener { - - public static Color ABC_SERIE_COLOR = new Color(51, 153, 255); - public static Color XYZ_SERIE_COLOR = new Color(255, 85, 85); - - private static final int ABC_SERIE_LABEL_YPOS = 0; - private static final int ABC_SERIE_LABEL_XPOS = 1; - private static final int XYZ_SERIE_LABEL_YPOS = 2; - private static final int XYZ_SERIE_LABEL_XPOS = 3; - - private static final String SERIES_NAME = "spectrumData"; - - protected final DefaultXYDataset m_dataSet; - protected final JFreeChart m_chart; - - protected AbstractDataBox m_dataBox; - protected ChartPanel m_spectrumPanel; - protected JToolBar m_toolbar; - protected DPeptideMatch m_peptideMatch; - protected PeptideFragmentationData m_peptideFragmentationData; - - /** - * Creates new form RsetPeptideSpectrumErrorPanel - */ - public AbstractPeptideSpectrumPanel(String yAxisTitle) { - - m_dataSet = new DefaultXYDataset(); - m_chart = ChartFactory.createXYLineChart("", "m/z", yAxisTitle, m_dataSet, PlotOrientation.VERTICAL, true, true, false); - m_chart.setNotify(true); // disable notifications. commented as it was "hard" to get it back...doesn't respond properly otherwise to mouse control - m_chart.removeLegend(); - m_chart.setBackgroundPaint(Color.white); - TextTitle textTitle = m_chart.getTitle(); - textTitle.setFont(textTitle.getFont().deriveFont(Font.PLAIN, 10.0f)); - - XYPlot plot = (XYPlot) m_chart.getPlot(); - plot.getRangeAxis().setUpperMargin(0.2); - - float maxXvalue; - maxXvalue = (float) m_chart.getXYPlot().getDomainAxis().getUpperBound(); - - m_chart.getXYPlot().getDomainAxis().setDefaultAutoRange(new Range(0, maxXvalue * 1.60)); - - plot.setBackgroundPaint(Color.white); - - XYStickRenderer renderer = new XYStickRenderer(); - renderer.setBaseStroke(new BasicStroke(1.0f)); - - plot.setRenderer(renderer); - - initComponents(); - - } - - private void initComponents() { - - setLayout(new BorderLayout()); - - ChartPanel cp = new ChartPanel(m_chart, true) { - @Override - public void restoreAutoBounds() { - - XYPlot plot = (XYPlot) getChart().getPlot(); - double domainStart = plot.getDomainAxis().getDefaultAutoRange().getLowerBound(); - double domainEnd = plot.getDomainAxis().getDefaultAutoRange().getUpperBound(); - double rangeStart = plot.getRangeAxis().getDefaultAutoRange().getLowerBound(); - double rangeEnd = plot.getRangeAxis().getDefaultAutoRange().getUpperBound(); - plot.getDomainAxis().setRange(domainStart, domainEnd); - plot.getRangeAxis().setRange(rangeStart, rangeEnd); - - } - }; - cp.setMinimumDrawWidth(0); - cp.setMinimumDrawHeight(0); - cp.setMaximumDrawWidth(Integer.MAX_VALUE); // make the legend to have a fixed size and not strecht it - cp.setMaximumDrawHeight(Integer.MAX_VALUE); // when the windows becomes bigger. - m_spectrumPanel = cp; - - // creation of the menuItem Show Spectrum Title - JMenuItem showSpectrumTitle = new JMenuItem("Show Spectrum Title"); - showSpectrumTitle.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if ((m_peptideMatch != null) && (m_peptideMatch.isMsQuerySet()) && (m_peptideMatch.getMsQuery().isSpectrumFullySet())) { - JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), m_peptideMatch.getMsQuery().getDSpectrum().getTitle(), "Spectrum Title", 1); - } - } - }); - m_spectrumPanel.getPopupMenu().add(showSpectrumTitle); - - m_toolbar = initToolbar(); - - add(m_toolbar, BorderLayout.WEST); - add(m_spectrumPanel, BorderLayout.CENTER); - - } - - public final JToolBar initToolbar() { - - JToolBar toolbar = new JToolBar(JToolBar.VERTICAL); - toolbar.setFloatable(false); - - ExportButton exportImageButton = new ExportButton("Spectre", m_spectrumPanel); - toolbar.add(exportImageButton); - return toolbar; - - } - - public void setData(DPeptideMatch peptideMatch, PeptideFragmentationData peptideFragmentationData) { - if ((peptideMatch != m_peptideMatch) || (m_peptideFragmentationData != peptideFragmentationData)) { - m_peptideMatch = peptideMatch; - m_peptideFragmentationData = peptideFragmentationData; - updateFragmentationPlot(peptideMatch, peptideFragmentationData); - } - } - - abstract public void updateFragmentationPlot(DPeptideMatch peptideMatch, PeptideFragmentationData peptideFragmentationData); - - abstract public void addCustomAnnotations(); - - public void annotateSpectrum() { - - clearAnnotations(); - - if ((m_peptideMatch == null) || (m_peptideFragmentationData == null)) - return; - - if (m_peptideFragmentationData.isEmpty()) - return; - - if (!m_peptideMatch.isMsQuerySet() || !m_peptideMatch.getMsQuery().isSpectrumFullySet()) - return; - - List theoreticalFragmentSeries = m_peptideFragmentationData.getTheoreticalFragmentSeries(); - PeptideFragmentationData.FragmentMatch[] fragmentMatches = m_peptideFragmentationData.getFragmentMatches(); - String peptideSequence = m_peptideMatch.getPeptide().getSequence(); - int sizeMaxSeries = peptideSequence.length(); - - double[][] fragTableTheo = new double[4][sizeMaxSeries + 1]; - double[][] fragTable = new double[4][sizeMaxSeries + 1]; - - // **-*-*-* HERE READING Data from Objects *-*-*-*-**- - - XYTextAnnotation xyta; - XYPlot plot = (XYPlot) m_chart.getPlot(); - - String xyzSerieName = m_peptideFragmentationData.getXYZReferenceSeriesName(); - String abcSerieName = m_peptideFragmentationData.getABCReferenceSeriesName(); - int abcSeriesIndex = m_peptideFragmentationData.getTheoreticalFragmentSeriesIndex(abcSerieName); - int xyzSeriesIndex = m_peptideFragmentationData.getTheoreticalFragmentSeriesIndex(xyzSerieName); - - double abcReferenceYPosition = getReferenceABCSeriesRange(); - double xyzReferenceYPosition = getReferenceXYZSeriesRange(); - double tickHalfSize = pixelToValueRange(3); - - plot.clearRangeMarkers(); - Marker target = new ValueMarker(xyzReferenceYPosition); - target.setPaint(XYZ_SERIE_COLOR); - target.setLabel(xyzSerieName); - target.setLabelAnchor(RectangleAnchor.TOP_RIGHT); - target.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); - plot.addRangeMarker(target); - Marker target2 = new ValueMarker(abcReferenceYPosition); - target2.setPaint(ABC_SERIE_COLOR); - target2.setLabel(abcSerieName); - target2.setLabelAnchor(RectangleAnchor.TOP_RIGHT); - target2.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); - plot.addRangeMarker(target2); - - int sizeABCserie = (theoreticalFragmentSeries.size() == 0) ? 0 : theoreticalFragmentSeries.get(abcSeriesIndex).masses.length; - int sizeXYZserie = (theoreticalFragmentSeries.size() == 0) ? 0 : theoreticalFragmentSeries.get(xyzSeriesIndex).masses.length; - - - if (xyzSerieName.contains("z+1")) { - xyzSerieName = "z"; // we keep only the char sequence instead of full (ex: z+1 -> z) - } - - int nbThroughB = 0; - int nbThroughY = 0; - - for (int j = 0; j < theoreticalFragmentSeries.size(); j++) { - // loop through theoFragment series here - for (int k = 0; k < theoreticalFragmentSeries.get(j).masses.length; k++) { - // loop through m_masses for each fragment series - fragTableTheo[ABC_SERIE_LABEL_YPOS][nbThroughB] = abcReferenceYPosition; // intensity for b ions - fragTableTheo[ABC_SERIE_LABEL_XPOS][nbThroughB] = theoreticalFragmentSeries.get(j).masses[k]; - fragTableTheo[XYZ_SERIE_LABEL_YPOS][nbThroughY] = xyzReferenceYPosition; // intensity for y ions - fragTableTheo[XYZ_SERIE_LABEL_XPOS][nbThroughY] = theoreticalFragmentSeries.get(j).masses[k]; - for (int i = 0; i < fragmentMatches.length; i++) { - // find matching fragMatches with theoFragSeries - if (j == abcSeriesIndex) { - if ((fragmentMatches[i].getCharge() == theoreticalFragmentSeries.get(j).getCharge()) - && fragmentMatches[i].getSeriesName().equals(theoreticalFragmentSeries.get(j).frag_series) - && fragmentMatches[i].getPosition() == nbThroughB + 1 - && Math.abs(fragmentMatches[i].calculated_moz - theoreticalFragmentSeries.get(j).masses[k]) < 0.1) { - fragTable[ABC_SERIE_LABEL_YPOS][nbThroughB] = fragmentMatches[i].intensity; - fragTable[ABC_SERIE_LABEL_XPOS][nbThroughB] = theoreticalFragmentSeries.get(j).masses[k]; - } - } - if (j == xyzSeriesIndex) { - if ((fragmentMatches[i].getCharge() == theoreticalFragmentSeries.get(j).getCharge()) - && fragmentMatches[i].getSeriesName().equals(theoreticalFragmentSeries.get(j).frag_series) - && (sizeMaxSeries - fragmentMatches[i].getPosition()) == nbThroughY - && Math.abs(fragmentMatches[i].calculated_moz - theoreticalFragmentSeries.get(j).masses[k]) < 0.1) { - fragTable[XYZ_SERIE_LABEL_YPOS][nbThroughY] = fragmentMatches[i].intensity; - fragTable[XYZ_SERIE_LABEL_XPOS][nbThroughY] = theoreticalFragmentSeries.get(j).masses[k]; - } - } - } - - if (j == abcSeriesIndex) { - nbThroughB++; - } - if (j == xyzSeriesIndex) { - nbThroughY++; - } - } - } - - double abcPrev = fragTable[ABC_SERIE_LABEL_XPOS][0] - SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(0)); - - boolean xyzPrevFound = false; // indicates if last iteration was a match or not. (if yes then highlight the AA) - boolean abcPrevFound = false; - String surroundingCharacters = ""; - - Font font = new Font(Font.MONOSPACED, Font.BOLD, 11); - - if (!abcSerieName.equals("")) { - if (peptideSequence.length() < sizeABCserie) // fill sequence in case of length problem. should not happen - { - LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error( - "AW: strange, serie length is not same length as sequence length...serie length:" - + sizeABCserie + " for sequence " + peptideSequence); - for (int filler = 0; filler < (sizeABCserie - peptideSequence.length()); filler++) { - peptideSequence = peptideSequence + "?"; - } - } - for (int i = 0; i < sizeABCserie; i++) { // loop through the series points - - // place separators marks------ - if (abcPrev != 0 && i > 0) { - float dash[] = {10.0f}; - BasicStroke stk = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, dash, 0.5f); - XYLineAnnotation line = new XYLineAnnotation(abcPrev, abcReferenceYPosition + tickHalfSize, - abcPrev, abcReferenceYPosition - tickHalfSize, stk, ABC_SERIE_COLOR); - plot.addAnnotation(line); - } - - // draw the outlined AA : B series - if ((fragTable[ABC_SERIE_LABEL_XPOS][i] != 0) || ((i == sizeABCserie - 1) && abcPrevFound)) // if the aa is matched - { - if (i == (sizeABCserie - 1)) { // if last element to be highlighted - abcPrevFound = true; - fragTable[ABC_SERIE_LABEL_XPOS][i] = abcPrev + SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(i)); - } - String aa = "" + peptideSequence.charAt(i); - xyta = new XYTextAnnotation(surroundingCharacters + aa + surroundingCharacters, (abcPrev + fragTable[ABC_SERIE_LABEL_XPOS][i]) / 2, abcReferenceYPosition); - if (abcPrevFound || i == 0 || i == (sizeABCserie - 1)) { - // 2 consecutives fragments matching, or first element or last element, then highlight the AA - xyta.setPaint(Color.white); - xyta.setBackgroundPaint(ABC_SERIE_COLOR); - - } else { - xyta.setPaint(ABC_SERIE_COLOR); - xyta.setBackgroundPaint(Color.white); - } - xyta.setFont(font); - plot.addAnnotation(xyta); - abcPrev = fragTableTheo[ABC_SERIE_LABEL_XPOS][i]; // - abcPrevFound = true; - - } else // draw the regular expected (but not found) aa - { - String aa = "" + peptideSequence.charAt(i); - if (i == sizeABCserie - 1) { // last element not highlighted - fragTableTheo[ABC_SERIE_LABEL_XPOS][i] = abcPrev + SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(i)); - } - if (i == 0) { - abcPrev = fragTableTheo[ABC_SERIE_LABEL_XPOS][0] - SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(i)); - } - xyta = new XYTextAnnotation(surroundingCharacters + aa + surroundingCharacters, (abcPrev + fragTableTheo[ABC_SERIE_LABEL_XPOS][i]) / 2, abcReferenceYPosition); - xyta.setPaint(ABC_SERIE_COLOR); - xyta.setFont(font); - xyta.setBackgroundPaint(Color.white); - plot.addAnnotation(xyta); - - abcPrev = fragTableTheo[ABC_SERIE_LABEL_XPOS][i]; - abcPrevFound = false; - } - } - } - - //--------------------- xyz - double xyzPrev = 0; - if (!xyzSerieName.equals("")) { - for (int i = sizeXYZserie - 1; i >= 0; i--) { // loop through the series points - - - // place separators marks------ - if (xyzPrev != 0) { - float dash[] = {10.0f}; - BasicStroke stk = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, dash, 0.5f); - XYLineAnnotation line = new XYLineAnnotation(xyzPrev, xyzReferenceYPosition - tickHalfSize, - xyzPrev, xyzReferenceYPosition + tickHalfSize, stk, XYZ_SERIE_COLOR); - plot.addAnnotation(line); - } - - // draw the outlined AA : Y series - if ((fragTable[XYZ_SERIE_LABEL_XPOS][i] != 0) || ((i == 0) && xyzPrevFound)) // if the aa is matched - { - if (i == 0) { // if last element to be highlighted - xyzPrevFound = true; - fragTable[XYZ_SERIE_LABEL_XPOS][i] = xyzPrev + SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(i)); - } - String aa = "" + peptideSequence.charAt(i); - xyta = new XYTextAnnotation(surroundingCharacters + aa + surroundingCharacters, (xyzPrev + fragTable[XYZ_SERIE_LABEL_XPOS][i]) / 2, xyzReferenceYPosition); - if (xyzPrevFound - || i == sizeXYZserie - 1 - || i == 0) {// 2 consecutives fragments matching, - // or first element or last element, then highlight the AA - xyta.setPaint(Color.white); - xyta.setBackgroundPaint(XYZ_SERIE_COLOR); - - } else { - xyta.setPaint(XYZ_SERIE_COLOR); - xyta.setBackgroundPaint(Color.white); - } - xyta.setFont(font); - plot.addAnnotation(xyta); - xyzPrev = fragTableTheo[XYZ_SERIE_LABEL_XPOS][i]; // - xyzPrevFound = true; - } else // draw the regular expected (but not found) aa - { - String aa = "" + peptideSequence.charAt(i); - if (i == 0) { // first element not highlighted - fragTableTheo[XYZ_SERIE_LABEL_XPOS][i] = xyzPrev + SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(i)); - } - if (i == sizeXYZserie - 1) { - xyzPrev = fragTableTheo[XYZ_SERIE_LABEL_XPOS][i] - SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(i)); - } - xyta = new XYTextAnnotation(surroundingCharacters + aa + surroundingCharacters, (xyzPrev + fragTableTheo[XYZ_SERIE_LABEL_XPOS][i]) / 2, xyzReferenceYPosition); - xyta.setPaint(XYZ_SERIE_COLOR); - xyta.setFont(font); - xyta.setBackgroundPaint(Color.white); - plot.addAnnotation(xyta); - - xyzPrev = fragTableTheo[XYZ_SERIE_LABEL_XPOS][i]; - xyzPrevFound = false; - } - } - } - - addCustomAnnotations(); - } - - public double getReferenceABCSeriesRange() { - XYPlot plot = (XYPlot) m_chart.getPlot(); - return (float) plot.getRangeAxis().getUpperBound() - pixelToValueRange(18); - } - - public double getReferenceXYZSeriesRange() { - XYPlot plot = (XYPlot) m_chart.getPlot(); - return (float) plot.getRangeAxis().getUpperBound() - pixelToValueRange(36); - } - - public double pixelToValueRange(double pixelSize) { - XYPlot plot = (XYPlot) m_chart.getPlot(); - Rectangle2D dataArea = m_spectrumPanel.getChartRenderingInfo().getPlotInfo().getDataArea(); - double java2DToValue = plot.getRangeAxis().java2DToValue(0, dataArea, plot.getRangeAxisEdge()); - java2DToValue = Math.abs(java2DToValue - plot.getRangeAxis().java2DToValue(pixelSize, dataArea, plot.getRangeAxisEdge())); - return java2DToValue; - } - - abstract public double[][] getMassIntensityValues(DSpectrum spectrum); - - protected void clearAnnotations() { - // clear all data - XYPlot plot = (XYPlot) m_chart.getPlot(); - plot.clearAnnotations(); - plot.clearRangeMarkers(); - } - - protected void constructSpectrumChart(DPeptideMatch pm) { - - final XYPlot plot = (XYPlot) m_chart.getPlot(); - - clearAnnotations(); - - m_dataSet.removeSeries(SERIES_NAME); - - if (pm == null) { - m_chart.setTitle("No Data Available"); - return; - } - - Peptide p = pm.getPeptide(); - if (p == null) { - m_chart.setTitle("No Data Available"); - return; - } - - DMsQuery msQuery = pm.isMsQuerySet() ? pm.getMsQuery() : null; - if (msQuery == null) { - m_chart.setTitle("No Data Available"); - return; - } - - DSpectrum spectrum = msQuery.isSpectrumFullySet() ? msQuery.getDSpectrum() : null; - if (spectrum == null) { - m_chart.setTitle("No Data Available"); - return; - } - - double[][] data = getMassIntensityValues(spectrum); - - m_dataSet.addSeries(SERIES_NAME, data); - - // Set title - String title = "Query " + msQuery.getInitialId() + " - " + p.getSequence(); - m_chart.setTitle(title); - - m_spectrumPanel.setBackground(Color.white); - - plot.getDomainAxis().setAutoRange(true); - plot.getRangeAxis().setAutoRange(true); - } - - @Override - public void plotChanged(PlotChangeEvent arg0) { - // unnecessary notification ? - -// m_chart.getPlot().removeChangeListener(this); -// annotateSpectrum(); -// m_chart.getPlot().addChangeListener(this); - - } - - @Override - public void setDataBox(AbstractDataBox dataBox) { - m_dataBox = dataBox; - } - - @Override - public AbstractDataBox getDataBox() { - return m_dataBox; - } - - @Override - public void addSingleValue(Object v) { - // not used for the moment JPM.TODO ? - } - - @Override - public ActionListener getRemoveAction(SplittedPanelContainer splittedPanel) { - return m_dataBox.getRemoveAction(splittedPanel); - } - - @Override - public ActionListener getAddAction(SplittedPanelContainer splittedPanel) { - return m_dataBox.getAddAction(splittedPanel); - } - - @Override - public ActionListener getSaveAction(SplittedPanelContainer splittedPanel) { - return m_dataBox.getSaveAction(splittedPanel); - } - - public static class XYStickRenderer extends AbstractXYItemRenderer { - @Override - public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, - PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, - XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { - - double x = dataset.getXValue(series, item); - double y = dataset.getYValue(series, item); - if (!Double.isNaN(y)) { - org.jfree.ui.RectangleEdge xAxisLocation = plot.getDomainAxisEdge(); - org.jfree.ui.RectangleEdge yAxisLocation = plot.getRangeAxisEdge(); - double transX = domainAxis.valueToJava2D(x, dataArea, xAxisLocation); - double transY = rangeAxis.valueToJava2D(y, dataArea, yAxisLocation); - double transOY = rangeAxis.valueToJava2D(0, dataArea, yAxisLocation); - g2.setPaint(getItemPaint(series, item)); - setSeriesPaint(0, Color.black); // AW: change peak bars color to black (was red by default) - // g2.setStroke(getBaseStroke()); // AW: original - g2.setStroke(new BasicStroke(0.5f)); // AW: A thinner stroke than the original - PlotOrientation orientation = plot.getOrientation(); - if (orientation == PlotOrientation.VERTICAL) { - g2.drawLine((int) transX, (int) transOY, (int) transX, (int) transY); - } else if (orientation == PlotOrientation.HORIZONTAL) { - g2.drawLine((int) transOY, (int) transX, (int) transY, (int) transX); - } - int domainAxisIndex = plot.getDomainAxisIndex(domainAxis); - int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis); - updateCrosshairValues(crosshairState, x, y, domainAxisIndex, rangeAxisIndex, transX, transY, - orientation); - - } - } - } - -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.gui.spectrum; + +import fr.proline.core.orm.msi.Peptide; +import fr.proline.core.orm.msi.dto.DMsQuery; +import fr.proline.core.orm.msi.dto.DPeptideMatch; +import fr.proline.core.orm.msi.dto.DSpectrum; +import fr.proline.studio.export.ExportButton; +import fr.proline.studio.gui.HourglassPanel; +import fr.proline.studio.gui.SplittedPanelContainer; +import fr.proline.studio.pattern.AbstractDataBox; +import fr.proline.studio.pattern.DataBoxPanelInterface; +import org.jfree.chart.ChartFactory; +import org.jfree.chart.ChartPanel; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.annotations.XYLineAnnotation; +import org.jfree.chart.annotations.XYTextAnnotation; +import org.jfree.chart.axis.ValueAxis; +import org.jfree.chart.event.PlotChangeEvent; +import org.jfree.chart.event.PlotChangeListener; +import org.jfree.chart.plot.*; +import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; +import org.jfree.chart.renderer.xy.XYItemRendererState; +import org.jfree.chart.title.TextTitle; +import org.jfree.data.Range; +import org.jfree.data.xy.DefaultXYDataset; +import org.jfree.data.xy.XYDataset; +import org.jfree.ui.RectangleAnchor; +import org.jfree.ui.TextAnchor; +import fr.proline.studio.WindowManager; +import org.slf4j.LoggerFactory; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.geom.Rectangle2D; +import java.util.List; + +/** + * Abstract panel used to display Spectrum information graphically + * + * @author CB205360 + */ +public abstract class AbstractPeptideSpectrumPanel extends HourglassPanel implements DataBoxPanelInterface, SplittedPanelContainer.ReactiveTabbedComponent, PlotChangeListener { + + public static Color ABC_SERIE_COLOR = new Color(51, 153, 255); + public static Color XYZ_SERIE_COLOR = new Color(255, 85, 85); + + private static final int ABC_SERIE_LABEL_YPOS = 0; + private static final int ABC_SERIE_LABEL_XPOS = 1; + private static final int XYZ_SERIE_LABEL_YPOS = 2; + private static final int XYZ_SERIE_LABEL_XPOS = 3; + + private static final String SERIES_NAME = "spectrumData"; + + protected final DefaultXYDataset m_dataSet; + protected final JFreeChart m_chart; + + protected AbstractDataBox m_dataBox; + protected ChartPanel m_spectrumPanel; + protected JToolBar m_toolbar; + protected DPeptideMatch m_peptideMatch; + protected PeptideFragmentationData m_peptideFragmentationData; + + /** + * Creates new form RsetPeptideSpectrumErrorPanel + */ + public AbstractPeptideSpectrumPanel(String yAxisTitle) { + + m_dataSet = new DefaultXYDataset(); + m_chart = ChartFactory.createXYLineChart("", "m/z", yAxisTitle, m_dataSet, PlotOrientation.VERTICAL, true, true, false); + m_chart.setNotify(true); // disable notifications. commented as it was "hard" to get it back...doesn't respond properly otherwise to mouse control + m_chart.removeLegend(); + m_chart.setBackgroundPaint(Color.white); + TextTitle textTitle = m_chart.getTitle(); + textTitle.setFont(textTitle.getFont().deriveFont(Font.PLAIN, 10.0f)); + + XYPlot plot = (XYPlot) m_chart.getPlot(); + plot.getRangeAxis().setUpperMargin(0.2); + + float maxXvalue; + maxXvalue = (float) m_chart.getXYPlot().getDomainAxis().getUpperBound(); + + m_chart.getXYPlot().getDomainAxis().setDefaultAutoRange(new Range(0, maxXvalue * 1.60)); + + plot.setBackgroundPaint(Color.white); + + XYStickRenderer renderer = new XYStickRenderer(); + renderer.setBaseStroke(new BasicStroke(1.0f)); + + plot.setRenderer(renderer); + + initComponents(); + + } + + private void initComponents() { + + setLayout(new BorderLayout()); + + ChartPanel cp = new ChartPanel(m_chart, true) { + @Override + public void restoreAutoBounds() { + + XYPlot plot = (XYPlot) getChart().getPlot(); + double domainStart = plot.getDomainAxis().getDefaultAutoRange().getLowerBound(); + double domainEnd = plot.getDomainAxis().getDefaultAutoRange().getUpperBound(); + double rangeStart = plot.getRangeAxis().getDefaultAutoRange().getLowerBound(); + double rangeEnd = plot.getRangeAxis().getDefaultAutoRange().getUpperBound(); + plot.getDomainAxis().setRange(domainStart, domainEnd); + plot.getRangeAxis().setRange(rangeStart, rangeEnd); + + } + }; + cp.setMinimumDrawWidth(0); + cp.setMinimumDrawHeight(0); + cp.setMaximumDrawWidth(Integer.MAX_VALUE); // make the legend to have a fixed size and not strecht it + cp.setMaximumDrawHeight(Integer.MAX_VALUE); // when the windows becomes bigger. + m_spectrumPanel = cp; + + // creation of the menuItem Show Spectrum Title + JMenuItem showSpectrumTitle = new JMenuItem("Show Spectrum Title"); + showSpectrumTitle.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if ((m_peptideMatch != null) && (m_peptideMatch.isMsQuerySet()) && (m_peptideMatch.getMsQuery().isSpectrumFullySet())) { + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), m_peptideMatch.getMsQuery().getDSpectrum().getTitle(), "Spectrum Title", 1); + } + } + }); + m_spectrumPanel.getPopupMenu().add(showSpectrumTitle); + + m_toolbar = initToolbar(); + + add(m_toolbar, BorderLayout.WEST); + add(m_spectrumPanel, BorderLayout.CENTER); + + } + + public final JToolBar initToolbar() { + + JToolBar toolbar = new JToolBar(JToolBar.VERTICAL); + toolbar.setFloatable(false); + + ExportButton exportImageButton = new ExportButton("Spectre", m_spectrumPanel); + toolbar.add(exportImageButton); + return toolbar; + + } + + public void setData(DPeptideMatch peptideMatch, PeptideFragmentationData peptideFragmentationData) { + if ((peptideMatch != m_peptideMatch) || (m_peptideFragmentationData != peptideFragmentationData)) { + m_peptideMatch = peptideMatch; + m_peptideFragmentationData = peptideFragmentationData; + updateFragmentationPlot(peptideMatch, peptideFragmentationData); + } + } + + abstract public void updateFragmentationPlot(DPeptideMatch peptideMatch, PeptideFragmentationData peptideFragmentationData); + + abstract public void addCustomAnnotations(); + + public void annotateSpectrum() { + + clearAnnotations(); + + if ((m_peptideMatch == null) || (m_peptideFragmentationData == null)) + return; + + if (m_peptideFragmentationData.isEmpty()) + return; + + if (!m_peptideMatch.isMsQuerySet() || !m_peptideMatch.getMsQuery().isSpectrumFullySet()) + return; + + List theoreticalFragmentSeries = m_peptideFragmentationData.getTheoreticalFragmentSeries(); + PeptideFragmentationData.FragmentMatch[] fragmentMatches = m_peptideFragmentationData.getFragmentMatches(); + String peptideSequence = m_peptideMatch.getPeptide().getSequence(); + int sizeMaxSeries = peptideSequence.length(); + + double[][] fragTableTheo = new double[4][sizeMaxSeries + 1]; + double[][] fragTable = new double[4][sizeMaxSeries + 1]; + + // **-*-*-* HERE READING Data from Objects *-*-*-*-**- + + XYTextAnnotation xyta; + XYPlot plot = (XYPlot) m_chart.getPlot(); + + String xyzSerieName = m_peptideFragmentationData.getXYZReferenceSeriesName(); + String abcSerieName = m_peptideFragmentationData.getABCReferenceSeriesName(); + int abcSeriesIndex = m_peptideFragmentationData.getTheoreticalFragmentSeriesIndex(abcSerieName); + int xyzSeriesIndex = m_peptideFragmentationData.getTheoreticalFragmentSeriesIndex(xyzSerieName); + + double abcReferenceYPosition = getReferenceABCSeriesRange(); + double xyzReferenceYPosition = getReferenceXYZSeriesRange(); + double tickHalfSize = pixelToValueRange(3); + + plot.clearRangeMarkers(); + Marker target = new ValueMarker(xyzReferenceYPosition); + target.setPaint(XYZ_SERIE_COLOR); + target.setLabel(xyzSerieName); + target.setLabelAnchor(RectangleAnchor.TOP_RIGHT); + target.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); + plot.addRangeMarker(target); + Marker target2 = new ValueMarker(abcReferenceYPosition); + target2.setPaint(ABC_SERIE_COLOR); + target2.setLabel(abcSerieName); + target2.setLabelAnchor(RectangleAnchor.TOP_RIGHT); + target2.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT); + plot.addRangeMarker(target2); + + int sizeABCserie = (theoreticalFragmentSeries.size() == 0) ? 0 : theoreticalFragmentSeries.get(abcSeriesIndex).masses.length; + int sizeXYZserie = (theoreticalFragmentSeries.size() == 0) ? 0 : theoreticalFragmentSeries.get(xyzSeriesIndex).masses.length; + + + if (xyzSerieName.contains("z+1")) { + xyzSerieName = "z"; // we keep only the char sequence instead of full (ex: z+1 -> z) + } + + int nbThroughB = 0; + int nbThroughY = 0; + + for (int j = 0; j < theoreticalFragmentSeries.size(); j++) { + // loop through theoFragment series here + for (int k = 0; k < theoreticalFragmentSeries.get(j).masses.length; k++) { + // loop through m_masses for each fragment series + fragTableTheo[ABC_SERIE_LABEL_YPOS][nbThroughB] = abcReferenceYPosition; // intensity for b ions + fragTableTheo[ABC_SERIE_LABEL_XPOS][nbThroughB] = theoreticalFragmentSeries.get(j).masses[k]; + fragTableTheo[XYZ_SERIE_LABEL_YPOS][nbThroughY] = xyzReferenceYPosition; // intensity for y ions + fragTableTheo[XYZ_SERIE_LABEL_XPOS][nbThroughY] = theoreticalFragmentSeries.get(j).masses[k]; + for (int i = 0; i < fragmentMatches.length; i++) { + // find matching fragMatches with theoFragSeries + if (j == abcSeriesIndex) { + if ((fragmentMatches[i].getCharge() == theoreticalFragmentSeries.get(j).getCharge()) + && fragmentMatches[i].getSeriesName().equals(theoreticalFragmentSeries.get(j).frag_series) + && fragmentMatches[i].getPosition() == nbThroughB + 1 + && Math.abs(fragmentMatches[i].calculated_moz - theoreticalFragmentSeries.get(j).masses[k]) < 0.1) { + fragTable[ABC_SERIE_LABEL_YPOS][nbThroughB] = fragmentMatches[i].intensity; + fragTable[ABC_SERIE_LABEL_XPOS][nbThroughB] = theoreticalFragmentSeries.get(j).masses[k]; + } + } + if (j == xyzSeriesIndex) { + if ((fragmentMatches[i].getCharge() == theoreticalFragmentSeries.get(j).getCharge()) + && fragmentMatches[i].getSeriesName().equals(theoreticalFragmentSeries.get(j).frag_series) + && (sizeMaxSeries - fragmentMatches[i].getPosition()) == nbThroughY + && Math.abs(fragmentMatches[i].calculated_moz - theoreticalFragmentSeries.get(j).masses[k]) < 0.1) { + fragTable[XYZ_SERIE_LABEL_YPOS][nbThroughY] = fragmentMatches[i].intensity; + fragTable[XYZ_SERIE_LABEL_XPOS][nbThroughY] = theoreticalFragmentSeries.get(j).masses[k]; + } + } + } + + if (j == abcSeriesIndex) { + nbThroughB++; + } + if (j == xyzSeriesIndex) { + nbThroughY++; + } + } + } + + double abcPrev = fragTable[ABC_SERIE_LABEL_XPOS][0] - SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(0)); + + boolean xyzPrevFound = false; // indicates if last iteration was a match or not. (if yes then highlight the AA) + boolean abcPrevFound = false; + String surroundingCharacters = ""; + + Font font = new Font(Font.MONOSPACED, Font.BOLD, 11); + + if (!abcSerieName.equals("")) { + if (peptideSequence.length() < sizeABCserie) // fill sequence in case of length problem. should not happen + { + LoggerFactory.getLogger("ProlineStudio.ResultExplorer").error( + "AW: strange, serie length is not same length as sequence length...serie length:" + + sizeABCserie + " for sequence " + peptideSequence); + for (int filler = 0; filler < (sizeABCserie - peptideSequence.length()); filler++) { + peptideSequence = peptideSequence + "?"; + } + } + for (int i = 0; i < sizeABCserie; i++) { // loop through the series points + + // place separators marks------ + if (abcPrev != 0 && i > 0) { + float dash[] = {10.0f}; + BasicStroke stk = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, dash, 0.5f); + XYLineAnnotation line = new XYLineAnnotation(abcPrev, abcReferenceYPosition + tickHalfSize, + abcPrev, abcReferenceYPosition - tickHalfSize, stk, ABC_SERIE_COLOR); + plot.addAnnotation(line); + } + + // draw the outlined AA : B series + if ((fragTable[ABC_SERIE_LABEL_XPOS][i] != 0) || ((i == sizeABCserie - 1) && abcPrevFound)) // if the aa is matched + { + if (i == (sizeABCserie - 1)) { // if last element to be highlighted + abcPrevFound = true; + fragTable[ABC_SERIE_LABEL_XPOS][i] = abcPrev + SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(i)); + } + String aa = "" + peptideSequence.charAt(i); + xyta = new XYTextAnnotation(surroundingCharacters + aa + surroundingCharacters, (abcPrev + fragTable[ABC_SERIE_LABEL_XPOS][i]) / 2, abcReferenceYPosition); + if (abcPrevFound || i == 0 || i == (sizeABCserie - 1)) { + // 2 consecutives fragments matching, or first element or last element, then highlight the AA + xyta.setPaint(Color.white); + xyta.setBackgroundPaint(ABC_SERIE_COLOR); + + } else { + xyta.setPaint(ABC_SERIE_COLOR); + xyta.setBackgroundPaint(Color.white); + } + xyta.setFont(font); + plot.addAnnotation(xyta); + abcPrev = fragTableTheo[ABC_SERIE_LABEL_XPOS][i]; // + abcPrevFound = true; + + } else // draw the regular expected (but not found) aa + { + String aa = "" + peptideSequence.charAt(i); + if (i == sizeABCserie - 1) { // last element not highlighted + fragTableTheo[ABC_SERIE_LABEL_XPOS][i] = abcPrev + SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(i)); + } + if (i == 0) { + abcPrev = fragTableTheo[ABC_SERIE_LABEL_XPOS][0] - SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(i)); + } + xyta = new XYTextAnnotation(surroundingCharacters + aa + surroundingCharacters, (abcPrev + fragTableTheo[ABC_SERIE_LABEL_XPOS][i]) / 2, abcReferenceYPosition); + xyta.setPaint(ABC_SERIE_COLOR); + xyta.setFont(font); + xyta.setBackgroundPaint(Color.white); + plot.addAnnotation(xyta); + + abcPrev = fragTableTheo[ABC_SERIE_LABEL_XPOS][i]; + abcPrevFound = false; + } + } + } + + //--------------------- xyz + double xyzPrev = 0; + if (!xyzSerieName.equals("")) { + for (int i = sizeXYZserie - 1; i >= 0; i--) { // loop through the series points + + + // place separators marks------ + if (xyzPrev != 0) { + float dash[] = {10.0f}; + BasicStroke stk = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, dash, 0.5f); + XYLineAnnotation line = new XYLineAnnotation(xyzPrev, xyzReferenceYPosition - tickHalfSize, + xyzPrev, xyzReferenceYPosition + tickHalfSize, stk, XYZ_SERIE_COLOR); + plot.addAnnotation(line); + } + + // draw the outlined AA : Y series + if ((fragTable[XYZ_SERIE_LABEL_XPOS][i] != 0) || ((i == 0) && xyzPrevFound)) // if the aa is matched + { + if (i == 0) { // if last element to be highlighted + xyzPrevFound = true; + fragTable[XYZ_SERIE_LABEL_XPOS][i] = xyzPrev + SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(i)); + } + String aa = "" + peptideSequence.charAt(i); + xyta = new XYTextAnnotation(surroundingCharacters + aa + surroundingCharacters, (xyzPrev + fragTable[XYZ_SERIE_LABEL_XPOS][i]) / 2, xyzReferenceYPosition); + if (xyzPrevFound + || i == sizeXYZserie - 1 + || i == 0) {// 2 consecutives fragments matching, + // or first element or last element, then highlight the AA + xyta.setPaint(Color.white); + xyta.setBackgroundPaint(XYZ_SERIE_COLOR); + + } else { + xyta.setPaint(XYZ_SERIE_COLOR); + xyta.setBackgroundPaint(Color.white); + } + xyta.setFont(font); + plot.addAnnotation(xyta); + xyzPrev = fragTableTheo[XYZ_SERIE_LABEL_XPOS][i]; // + xyzPrevFound = true; + } else // draw the regular expected (but not found) aa + { + String aa = "" + peptideSequence.charAt(i); + if (i == 0) { // first element not highlighted + fragTableTheo[XYZ_SERIE_LABEL_XPOS][i] = xyzPrev + SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(i)); + } + if (i == sizeXYZserie - 1) { + xyzPrev = fragTableTheo[XYZ_SERIE_LABEL_XPOS][i] - SpectrumFragmentationUtil.getMassFromAminoAcid(peptideSequence.charAt(i)); + } + xyta = new XYTextAnnotation(surroundingCharacters + aa + surroundingCharacters, (xyzPrev + fragTableTheo[XYZ_SERIE_LABEL_XPOS][i]) / 2, xyzReferenceYPosition); + xyta.setPaint(XYZ_SERIE_COLOR); + xyta.setFont(font); + xyta.setBackgroundPaint(Color.white); + plot.addAnnotation(xyta); + + xyzPrev = fragTableTheo[XYZ_SERIE_LABEL_XPOS][i]; + xyzPrevFound = false; + } + } + } + + addCustomAnnotations(); + } + + public double getReferenceABCSeriesRange() { + XYPlot plot = (XYPlot) m_chart.getPlot(); + return (float) plot.getRangeAxis().getUpperBound() - pixelToValueRange(18); + } + + public double getReferenceXYZSeriesRange() { + XYPlot plot = (XYPlot) m_chart.getPlot(); + return (float) plot.getRangeAxis().getUpperBound() - pixelToValueRange(36); + } + + public double pixelToValueRange(double pixelSize) { + XYPlot plot = (XYPlot) m_chart.getPlot(); + Rectangle2D dataArea = m_spectrumPanel.getChartRenderingInfo().getPlotInfo().getDataArea(); + double java2DToValue = plot.getRangeAxis().java2DToValue(0, dataArea, plot.getRangeAxisEdge()); + java2DToValue = Math.abs(java2DToValue - plot.getRangeAxis().java2DToValue(pixelSize, dataArea, plot.getRangeAxisEdge())); + return java2DToValue; + } + + abstract public double[][] getMassIntensityValues(DSpectrum spectrum); + + protected void clearAnnotations() { + // clear all data + XYPlot plot = (XYPlot) m_chart.getPlot(); + plot.clearAnnotations(); + plot.clearRangeMarkers(); + } + + protected void constructSpectrumChart(DPeptideMatch pm) { + + final XYPlot plot = (XYPlot) m_chart.getPlot(); + + clearAnnotations(); + + m_dataSet.removeSeries(SERIES_NAME); + + if (pm == null) { + m_chart.setTitle("No Data Available"); + return; + } + + Peptide p = pm.getPeptide(); + if (p == null) { + m_chart.setTitle("No Data Available"); + return; + } + + DMsQuery msQuery = pm.isMsQuerySet() ? pm.getMsQuery() : null; + if (msQuery == null) { + m_chart.setTitle("No Data Available"); + return; + } + + DSpectrum spectrum = msQuery.isSpectrumFullySet() ? msQuery.getDSpectrum() : null; + if (spectrum == null) { + m_chart.setTitle("No Data Available"); + return; + } + + double[][] data = getMassIntensityValues(spectrum); + + m_dataSet.addSeries(SERIES_NAME, data); + + // Set title + StringBuffer title = new StringBuffer("Query "); + title.append(msQuery.getInitialId()).append(" - ").append(p.getSequence()); + if(!p.getPtmString().isEmpty() && p.getTransientData().isPeptideReadablePtmStringLoaded()) + title.append(" [").append(p.getTransientData().getPeptideReadablePtmString().getReadablePtmString()).append("] "); + title.append(" ").append(pm.getCharge()).append("+"); + m_chart.setTitle(title.toString()); + + m_spectrumPanel.setBackground(Color.white); + + plot.getDomainAxis().setAutoRange(true); + plot.getRangeAxis().setAutoRange(true); + } + + @Override + public void plotChanged(PlotChangeEvent arg0) { + // unnecessary notification ? + +// m_chart.getPlot().removeChangeListener(this); +// annotateSpectrum(); +// m_chart.getPlot().addChangeListener(this); + + } + + @Override + public void setDataBox(AbstractDataBox dataBox) { + m_dataBox = dataBox; + } + + @Override + public AbstractDataBox getDataBox() { + return m_dataBox; + } + + @Override + public void addSingleValue(Object v) { + // not used for the moment JPM.TODO ? + } + + @Override + public ActionListener getRemoveAction(SplittedPanelContainer splittedPanel) { + return m_dataBox.getRemoveAction(splittedPanel); + } + + @Override + public ActionListener getAddAction(SplittedPanelContainer splittedPanel) { + return m_dataBox.getAddAction(splittedPanel); + } + + @Override + public ActionListener getSaveAction(SplittedPanelContainer splittedPanel) { + return m_dataBox.getSaveAction(splittedPanel); + } + + public static class XYStickRenderer extends AbstractXYItemRenderer { + @Override + public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, + PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, + XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) { + + double x = dataset.getXValue(series, item); + double y = dataset.getYValue(series, item); + if (!Double.isNaN(y)) { + org.jfree.ui.RectangleEdge xAxisLocation = plot.getDomainAxisEdge(); + org.jfree.ui.RectangleEdge yAxisLocation = plot.getRangeAxisEdge(); + double transX = domainAxis.valueToJava2D(x, dataArea, xAxisLocation); + double transY = rangeAxis.valueToJava2D(y, dataArea, yAxisLocation); + double transOY = rangeAxis.valueToJava2D(0, dataArea, yAxisLocation); + g2.setPaint(getItemPaint(series, item)); + setSeriesPaint(0, Color.black); // AW: change peak bars color to black (was red by default) + // g2.setStroke(getBaseStroke()); // AW: original + g2.setStroke(new BasicStroke(0.5f)); // AW: A thinner stroke than the original + PlotOrientation orientation = plot.getOrientation(); + if (orientation == PlotOrientation.VERTICAL) { + g2.drawLine((int) transX, (int) transOY, (int) transX, (int) transY); + } else if (orientation == PlotOrientation.HORIZONTAL) { + g2.drawLine((int) transOY, (int) transX, (int) transY, (int) transX); + } + int domainAxisIndex = plot.getDomainAxisIndex(domainAxis); + int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis); + updateCrosshairValues(crosshairState, x, y, domainAxisIndex, rangeAxisIndex, transX, transY, + orientation); + + } + } + } + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/HideFragmentsTableIntensityButton.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/HideFragmentsTableIntensityButton.java index cee58ab5a..400e28986 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/HideFragmentsTableIntensityButton.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/HideFragmentsTableIntensityButton.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.spectrum; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/PeptideFragmentationData.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/PeptideFragmentationData.java index a71f21bf1..353829a43 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/PeptideFragmentationData.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/PeptideFragmentationData.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideFragmentationTable.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideFragmentationTable.java index 4c64c04af..174b37f54 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideFragmentationTable.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideFragmentationTable.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.spectrum; import java.awt.Component; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideFragmentationTablePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideFragmentationTablePanel.java index 853e242d4..30fedcdd2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideFragmentationTablePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideFragmentationTablePanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.spectrum; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideSpectrumErrorPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideSpectrumErrorPanel.java index d30dbb33b..63b4898cc 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideSpectrumErrorPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideSpectrumErrorPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.spectrum; import fr.proline.core.orm.msi.dto.DPeptideMatch; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideSpectrumPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideSpectrumPanel.java index b37dc0c8f..24d17dab5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideSpectrumPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideSpectrumPanel.java @@ -1,24 +1,28 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.spectrum; +import fr.proline.core.orm.msi.MsiSearch; +import fr.proline.core.orm.msi.ResultSet; +import fr.proline.core.orm.msi.ResultSummary; import fr.proline.core.orm.msi.dto.DPeptideMatch; import fr.proline.core.orm.msi.dto.DSpectrum; import fr.proline.core.orm.uds.Project; +import fr.proline.core.orm.uds.dto.DDataset; import fr.proline.studio.dam.DatabaseDataManager; import fr.proline.studio.dpm.AccessJMSManagerThread; import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; @@ -33,7 +37,7 @@ import org.jfree.chart.plot.XYPlot; import org.jfree.data.Range; import org.jfree.ui.TextAnchor; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,6 +45,7 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.Collections; /** * Panel used to display a Spectrum of a PeptideMatch @@ -51,7 +56,7 @@ public class RsetPeptideSpectrumPanel extends AbstractPeptideSpectrumPanel { protected static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); - private static String SPECTRUM_GENERATION_RUNNING = "Generate Spectrum Match in progress..."; + private static final String SPECTRUM_GENERATION_RUNNING = "Generate Spectrum Match in progress..."; private JButton m_generateMatchButton; private boolean _isSpectrumMatchGenerationAsked = false; @@ -71,7 +76,14 @@ private void customizeToolbar() { m_generateMatchButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - GenerateSpectrumMatchesDialog dialog = new GenerateSpectrumMatchesDialog(WindowManager.getDefault().getMainWindow()); + DDataset dataset =(DDataset) getDataBox().getData(DDataset.class); + GenerateSpectrumMatchesDialog dialog; + if(dataset == null){ + MsiSearch msiSearch = getPeptideMatchMsiSearch(); + dialog = new GenerateSpectrumMatchesDialog(WindowManager.getDefault().getMainWindow(), msiSearch); + } else + dialog = new GenerateSpectrumMatchesDialog(WindowManager.getDefault().getMainWindow(),Collections.singletonList(dataset) ); + Point location = m_generateMatchButton.getLocationOnScreen(); dialog.setLocation(location.x + 30, location.y - dialog.getHeight() - 60); dialog.setVisible(true); @@ -90,6 +102,19 @@ public void actionPerformed(ActionEvent e) { m_toolbar.add(m_generateMatchButton); } + private MsiSearch getPeptideMatchMsiSearch(){ + ResultSet rs =(ResultSet) getDataBox().getData(ResultSet.class); + if(rs != null) + return rs.getMsiSearch(); + + ResultSummary rsm =(ResultSummary) getDataBox().getData(ResultSummary.class); + if(rsm !=null && rsm.getResultSet() !=null) + return rsm.getResultSet().getMsiSearch(); + + //VDS : Could add DB access to get information... + return null; + } + private void generateSpectrumMatch(Long frsId, Boolean forceGenerateSM) { AbstractJMSCallback spectrumMatchCallback = new AbstractJMSCallback() { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideSpectrumValuesPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideSpectrumValuesPanel.java index 7c3dfc0fe..b737d9a94 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideSpectrumValuesPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/RsetPeptideSpectrumValuesPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/SpectrumFragmentationUtil.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/SpectrumFragmentationUtil.java index 4b3d0373d..d58812d64 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/SpectrumFragmentationUtil.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/spectrum/SpectrumFragmentationUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/AbstractTasksPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/AbstractTasksPanel.java index 4549f79d3..9b4d90d45 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/AbstractTasksPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/AbstractTasksPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -33,7 +33,7 @@ import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JOptionPane; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,7 +58,7 @@ public abstract class AbstractTasksPanel extends HourglassPanel implements DataB public AbstractTasksPanel(){ this.m_isConnected = false; - initListener(); + initListener(); //calling it in constructor is incorrect: it calls overriden methods } @@ -69,7 +69,7 @@ protected boolean isMonitoringConnected(){ /** * Listener of JMS Connection state change : to connect/disconnect from topic */ - private void initListener(){ + public void initListener(){ JMSConnectionManager.getJMSConnectionManager().addConnectionListener(this); int currentState = JMSConnectionManager.getJMSConnectionManager().getConnectionState(); connectionStateChanged(currentState); @@ -80,7 +80,7 @@ protected boolean checkJMSVariables(){ m_serviceListener = JMSConnectionManager.getJMSConnectionManager().getNotificationListener(); if(m_serviceListener == null) { JOptionPane.showMessageDialog( WindowManager.getDefault().getMainWindow(), "Unable to get Notification Listener (JMS Connection problem ?!). Try Later", "Server Tasks Logs error",JOptionPane.ERROR_MESSAGE); - return false; + return false; } } return true; @@ -103,8 +103,8 @@ public void connectionStateChanged(int newStatus) { if (checkJMSVariables()){ final JMSNotificationMessage[] sysInfoResult = new JMSNotificationMessage[1]; m_notifierCallback = getServiceNotificationCallback(sysInfoResult); - m_serviceListener.addServiceNotifierCallback(m_notifierCallback, sysInfoResult); - + m_serviceListener.addServiceNotifierCallback(m_notifierCallback, sysInfoResult); + final JMSNotificationMessage[] purgerResult = new JMSNotificationMessage[1]; m_purgerCallback = getPurgeConsumerCallback(purgerResult); if(m_purgerCallback != null){ @@ -126,7 +126,7 @@ public void connectionStateChanged(int newStatus) { PurgeConsumer.getPurgeConsumer().removeCallback(m_purgerCallback); m_purgerCallback = null; stopOtherDataCollecting(); - } + } m_isConnected = false; break; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogControlPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogControlPanel.java index ac67975cb..035dde8fd 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogControlPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogControlPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -43,8 +43,8 @@ import javax.swing.JSplitPane; import javax.swing.JTextPane; import javax.swing.JToolBar; -import org.openide.util.NbPreferences; -import org.openide.windows.WindowManager; +import fr.proline.studio.NbPreferences; +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogFileNameDialog.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogFileNameDialog.java index 200bbd9fc..eb7cd9669 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogFileNameDialog.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogFileNameDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -59,7 +59,7 @@ import javax.swing.JTextPane; import javax.swing.WindowConstants; import javax.swing.border.EmptyBorder; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogTaskListView.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogTaskListView.java index 45eca6f46..2929c5244 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogTaskListView.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogTaskListView.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -21,7 +21,6 @@ import fr.proline.studio.export.ExportFontData; import fr.proline.studio.export.ExportModelInterface; import fr.proline.studio.extendedtablemodel.CompoundTableModel; -import fr.proline.studio.info.InfoInterface; import fr.proline.studio.table.DecoratedMarkerTable; import fr.proline.studio.table.TablePopupMenu; import java.awt.Component; @@ -50,7 +49,7 @@ public class ServerLogTaskListView extends JScrollPane implements TaskListInterf private ArrayList m_taskList;//data model used by TableModel private ServerLogTaskTable m_table; private ServerLogTaskTableModel m_tableModel; - private CompoundTableModel m_CompoundTableModel; + private CompoundTableModel m_compoundTableModel; ServerLogTaskListView(ServerLogControlPanel control) { @@ -60,16 +59,16 @@ public class ServerLogTaskListView extends JScrollPane implements TaskListInterf this.setPreferredSize(new Dimension(1400, 250)); m_taskList = new ArrayList(); m_tableModel = new ServerLogTaskTableModel(); - m_CompoundTableModel = new CompoundTableModel(m_tableModel, true);//true = Filter + m_compoundTableModel = new CompoundTableModel(m_tableModel, true);//true = Filter m_table = new ServerLogTaskTable(); - m_table.setModel(m_CompoundTableModel); + m_table.setModel(m_compoundTableModel); m_table.init(); this.setViewportView(m_table); m_table.setFillsViewportHeight(true); } public CompoundTableModel getCompoundTableModel() { - return m_CompoundTableModel; + return m_compoundTableModel; } public ServerLogTaskTable getTable() { @@ -143,6 +142,7 @@ public void valueChanged(ListSelectionEvent e) { if (!lsm.isSelectionEmpty()) { int sortedIndex = lsm.getMinSelectionIndex();//only the first one int selectedIndex = m_table.convertRowIndexToModel(sortedIndex); + selectedIndex = m_compoundTableModel.convertCompoundRowToBaseModelRow(selectedIndex); LogTask task = m_taskList.get(selectedIndex); String taskOrder = (task == null) ? "" : "" + task.getTaskOrder(); m_ctrl.valueChanged(task); @@ -158,12 +158,16 @@ public String getExportColumnName(int col) { @Override public String getExportRowCell(int row, int col) { - return m_tableModel.getExportRowCell(convertRowIndexToModel(row), convertColumnIndexToModel(col)); + int selectedIndex = convertRowIndexToModel(row); + selectedIndex = m_compoundTableModel.convertCompoundRowToBaseModelRow(selectedIndex); + return m_tableModel.getExportRowCell(selectedIndex, convertColumnIndexToModel(col)); } @Override public ArrayList getExportFonts(int row, int col) { - return m_tableModel.getExportFonts(convertRowIndexToModel(row), convertColumnIndexToModel(col)); + int selectedIndex = convertRowIndexToModel(row); + selectedIndex = m_compoundTableModel.convertCompoundRowToBaseModelRow(selectedIndex); + return m_tableModel.getExportFonts(selectedIndex, convertColumnIndexToModel(col)); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogTaskTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogTaskTableModel.java index 560a5225e..cc9dce790 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogTaskTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/ServerLogTaskTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -95,39 +95,27 @@ public LogTask getTask(int row) { @Override public Class getColumnClass(int columnIndex) { switch (columnIndex) { - case COLTYPE_ORDER_ID: { + case COLTYPE_ORDER_ID: + case COLTYPE_NB_TASK_PARALELLE: { return Integer.class; } - case COLTYPE_PROJECT_ID: { + case COLTYPE_PROJECT_ID: + case COLTYPE_THREAD_NAME: + case COLTYPE_MESSAGE_ID: + case COLTYPE_CALL_SERVICE: + case COLTYPE_META_INFO: { return String.class; } case COLTYPE_STATUS: { return LogTask.STATUS.class; } - case COLTYPE_START_TIME: { - return Date.class; - } + case COLTYPE_START_TIME: case COLTYPE_STOP_TIME: { return Date.class; } - case COLTYPE_THREAD_NAME: { - return String.class; - } - case COLTYPE_MESSAGE_ID: { - return String.class; - } - case COLTYPE_CALL_SERVICE: { - return String.class; - } - case COLTYPE_META_INFO: { - return String.class; - } case COLTYPE_DURATION: { return Long.class; } - case COLTYPE_NB_TASK_PARALELLE: { - return Integer.class; - } default: return null; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/SystemTasksPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/SystemTasksPanel.java index ee00c625f..c3106f0f7 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/SystemTasksPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/SystemTasksPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -17,6 +17,7 @@ package fr.proline.studio.rsmexplorer.gui.tasklog; import fr.profi.util.StringUtils; +import fr.proline.studio.WindowManager; import fr.proline.studio.dpm.data.JMSNotificationMessage; import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; import fr.proline.studio.dpm.task.util.JMSConnectionManager; @@ -28,36 +29,22 @@ import fr.proline.studio.table.TablePopupMenu; import fr.proline.studio.table.renderer.DefaultLeftAlignRenderer; import fr.proline.studio.utils.IconManager; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import javax.jms.Message; import javax.jms.QueueBrowser; -import javax.swing.JButton; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JToolBar; -import javax.swing.ListSelectionModel; import javax.swing.Timer; +import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumnModel; -import org.openide.windows.WindowManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.SimpleDateFormat; +import java.util.List; +import java.util.*; /** * @@ -81,6 +68,7 @@ public class SystemTasksPanel extends AbstractTasksPanel { public SystemTasksPanel() { super(); + m_loggerProline.warn(" STARTED system tasks !!"); setLayout(new GridBagLayout()); m_logParserDialog = new ServerLogFileNameDialog(); GridBagConstraints c = new GridBagConstraints(); @@ -270,7 +258,7 @@ public void run(boolean success) { /* * Called when notification is enabled to allow other king of data collect. - * Browse Proline JMS Queue + * Browse Proline JMS Queue */ @Override protected void startOtherDataCollecting() { @@ -317,6 +305,9 @@ private void browsePendingMessages() { } } catch (Exception jmsE) { + + jmsE.printStackTrace(); + m_connectionErrCount++; if (m_connectionErrCount < 2) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "Unable to browse pending messages (JMS Connection problem ?! : " + jmsE.getMessage() + ")", "Server Tasks Logs error", JOptionPane.ERROR_MESSAGE); @@ -328,8 +319,8 @@ private void browsePendingMessages() { // //TODO: add method in JMSConnectionManager to disconnect/reconnect without reset of variables // String jmsHost = JMSConnectionManager.getJMSConnectionManager().m_jmsServerHost; // JMSConnectionManager.getJMSConnectionManager().closeConnection(); -// JMSConnectionManager.getJMSConnectionManager().setJMSServerHost(jmsHost); -// if (!checkJMSVariables()) { // still can't connect +// JMSConnectionManager.getJMSConnectionManager().setJMSServerHost(jmsHost); +// if (!checkJMSVariables()) { // still can't connect // stopOtherDataCollecting(); // } // reInitConnection(); @@ -344,7 +335,7 @@ private void reInitConnection() { String jmsHost = JMSConnectionManager.getJMSConnectionManager().m_jmsServerHost; JMSConnectionManager.getJMSConnectionManager().closeConnection(); JMSConnectionManager.getJMSConnectionManager().setJMSServerHost(jmsHost); - if (!checkJMSVariables()) { // still can't connect + if (!checkJMSVariables()) { // still can't connect stopOtherDataCollecting(); m_reconnectButton.setEnabled(true); } else { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/TaskDescriptionPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/TaskDescriptionPanel.java index b83e52639..fb8ab5251 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/TaskDescriptionPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/TaskDescriptionPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,6 +16,8 @@ */ package fr.proline.studio.rsmexplorer.gui.tasklog; +import fr.proline.studio.WindowManager; +import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.utils.StringUtils; import fr.proline.studio.dam.taskinfo.TaskError; import fr.proline.studio.dam.taskinfo.TaskInfo; @@ -34,8 +36,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import javax.swing.*; -import org.openide.DialogDisplayer; -import org.openide.NotifyDescriptor; + /** * Panel to display information about a specific task @@ -55,13 +56,12 @@ public class TaskDescriptionPanel extends HourglassPanel implements DataBoxPanel private JTextArea m_errorTextArea; private JButton m_requestButton; - private RequestContentDialog m_requestDialog; + private String m_content; private String m_requestURL; public TaskDescriptionPanel() { initComponents(); - m_requestDialog = new RequestContentDialog(); } private void initComponents() { @@ -89,7 +89,9 @@ private void initComponents() { m_requestButton.setAction(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { - m_requestDialog.showRequestDetailsDialog(); + RequestContentDialog dialog = RequestContentDialog.getSingleton(m_content, m_requestURL); + + dialog.setVisible(true); } }); m_requestButton.setEnabled(false); @@ -251,8 +253,7 @@ public void setTaskInfo(TaskInfo taskInfo) { m_endTimeTextfield.setText(formatTime(taskInfo.getEndTimestamp())); m_deltaEndTimeTextfield.setText(formatDeltaTime(taskInfo.getDuration())); - m_requestDialog.setRequestContent(taskInfo.getRequestContent()); - + m_content = taskInfo.getRequestContent(); m_requestURL = taskInfo.getRequestURL(); m_requestButton.setEnabled((m_requestURL != null) && (!m_requestURL.isEmpty())); @@ -270,7 +271,6 @@ private void reinit() { m_deltaEndTimeTextfield.setText(""); m_requestURL = null; m_requestButton.setEnabled(false); - m_requestDialog.reinit(); } private String formatTime(long timestamp) { @@ -323,20 +323,54 @@ public ActionListener getSaveAction(SplittedPanelContainer splittedPanel) { return m_dataBox.getSaveAction(splittedPanel); } - class RequestContentDialog { + private static class RequestContentDialog extends DefaultDialog { private JTextArea _requestDialogContentTextarea; private JSplitPane _requestDialogContentPane; private JTree _requestContentTree; private String _requestContent = ""; + private boolean m_firstDisplay = true; + + private static RequestContentDialog m_singleton= null; + + private RequestContentDialog() { + super(WindowManager.getDefault().getMainWindow()); + setTitle("Request details"); + + setButtonVisible(BUTTON_CANCEL, false); + setButtonVisible(BUTTON_HELP, false); + + } + + public static RequestContentDialog getSingleton(String content, String requestURL) { + if (m_singleton == null) { + m_singleton = new RequestContentDialog(); + + } + + m_singleton.setContent(content, requestURL); + + return m_singleton; + } + + @Override + public void setVisible(boolean v) { + if (m_firstDisplay) { + m_singleton.centerToWindow(WindowManager.getDefault().getMainWindow()); + m_firstDisplay = false; + } + + + super.setVisible(v); + - public RequestContentDialog() { - _requestDialogContentTextarea = new JTextArea(); - //_requestDialogContentTextarea.setSize(600, 100); - _requestDialogContentPane = new JSplitPane(); } - public void showRequestDetailsDialog() { + private void setContent(String content, String requestURL) { + + _requestContent = content; + _requestContentTree = StringUtils.createExpandedTreeFromJson(content, "content"); + JPanel requestPanel = new JPanel(new GridBagLayout()); requestPanel.setPreferredSize(new Dimension(600, 400)); @@ -346,7 +380,7 @@ public void showRequestDetailsDialog() { c.insets = new java.awt.Insets(5, 5, 5, 5); JTextField requestURLTextfield = new JTextField(); - requestURLTextfield.setText(m_requestURL); + requestURLTextfield.setText(requestURL); _requestDialogContentTextarea = new JTextArea(); _requestDialogContentTextarea.setText(_requestContent); @@ -373,31 +407,13 @@ public void showRequestDetailsDialog() { _requestDialogContentPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, bottom); _requestDialogContentPane.setDividerLocation(60); requestPanel.add(_requestDialogContentPane, c); - NotifyDescriptor nd = new NotifyDescriptor( - requestPanel, // instance of your panel - "Request details", // title of the dialog - NotifyDescriptor.PLAIN_MESSAGE, // it is Yes/No dialog ... - NotifyDescriptor.PLAIN_MESSAGE, // ... of a question type => a question mark icon - null, - null - ); - DialogDisplayer.getDefault().notify(nd); + replaceInternalComponent(requestPanel); + pack(); } - private void setRequestContent(String content) { - _requestContent = content; - _requestContentTree = StringUtils.createExpandedTreeFromJson(content, "content"); - _requestDialogContentTextarea.setText(_requestContent); - int nbLine = _requestDialogContentTextarea.getLineCount(); - } - - private void reinit() { - _requestContent = ""; - _requestContentTree = null; - } } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/TasksPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/TasksPanel.java index dafdb8e8e..d8a334fc4 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/TasksPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/tasklog/TasksPanel.java @@ -1,809 +1,807 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.gui.tasklog; - -import fr.proline.studio.extendedtablemodel.ExtraDataType; -import fr.proline.studio.dam.taskinfo.TaskInfo; -import fr.proline.studio.dam.taskinfo.TaskInfoManager; -import fr.proline.studio.dpm.data.JMSNotificationMessage; -import fr.proline.studio.dpm.AccessJMSManagerThread; -import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; -import fr.proline.studio.dpm.task.jms.CancelTask; -import fr.proline.studio.dpm.task.jms.PurgeConsumer; -import fr.proline.studio.export.ExportFontData; -import fr.proline.studio.filter.ConvertValueInterface; -import fr.proline.studio.filter.Filter; -import fr.proline.studio.filter.FilterButton; -import fr.proline.studio.filter.IntegerFilter; -import fr.proline.studio.filter.ValueFilter; -import fr.proline.studio.graphics.PlotInformation; -import fr.proline.studio.graphics.PlotType; -import fr.proline.studio.rsmexplorer.gui.dialog.GetSystemInfoButtonAction; -import fr.proline.studio.rsmexplorer.gui.renderer.PercentageRenderer; -import fr.proline.studio.rsmexplorer.gui.renderer.ScoreRenderer; -import fr.proline.studio.table.AbstractTableAction; -import fr.proline.studio.extendedtablemodel.CompoundTableModel; -import fr.proline.studio.table.DecoratedMarkerTable; -import fr.proline.studio.table.DecoratedTableModel; -import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; -import fr.proline.studio.filter.StringDiffFilter; -import fr.proline.studio.table.LazyData; -import fr.proline.studio.table.TablePopupMenu; -import fr.proline.studio.utils.IconManager; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.LinkedHashMap; -import java.util.Map; -import javax.swing.*; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.*; -import org.jdesktop.swingx.renderer.DefaultTableRenderer; -import org.openide.windows.WindowManager; - -/** - * Panel used to display all logged tasks - * - * @author JM235353 - */ -public class TasksPanel extends AbstractTasksPanel { - - private LogTable m_logTable; - - private boolean m_firstDisplay = true; - - public TasksPanel() { - super(); - setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - c.weightx = 1; - c.weighty = 1; - add(createToolbarPanel(), c); - } - - - @Override - protected AbstractJMSCallback getServiceNotificationCallback(JMSNotificationMessage[] sysInfoResult) { - AbstractJMSCallback notifierCallback = new AbstractJMSCallback() { - @Override - public boolean mustBeCalledInAWT() { - return true; - } - - @Override - public void run(boolean success) { - if (sysInfoResult[0].getEventType().equals(JMSNotificationMessage.MessageStatus.STARTED)) { - TaskInfo tiToUpdate = TaskInfoManager.getTaskInfoManager().getTaskInfoWithJMSId(sysInfoResult[0].getServerUniqueMsgId()); - if (tiToUpdate != null) { - tiToUpdate.setRunning(true); - } - } - } - }; - return notifierCallback; - } - - //Nothing specific to do after cancel message was done : already taken into account be message response - @Override - protected AbstractJMSCallback getPurgeConsumerCallback(JMSNotificationMessage[] purgerResult){ - return null; - } - - // default start data collect is enough - @Override - protected void startOtherDataCollecting(){ - } - - // default stop data collect is enough - @Override - protected void stopOtherDataCollecting(){ - } - - private JPanel createToolbarPanel() { - JPanel toolbarPanel = new JPanel(); - - toolbarPanel.setLayout(new BorderLayout()); - - JPanel internalPanel = createInternalPanel(); - toolbarPanel.add(internalPanel, BorderLayout.CENTER); - - JToolBar toolbar = initToolbar(); - toolbarPanel.add(toolbar, BorderLayout.WEST); - - return toolbarPanel; - - } - - private JPanel createInternalPanel() { - - JPanel internalPanel = new JPanel(); - - internalPanel.setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - - // create objects - JScrollPane scrollPane = new JScrollPane(); - m_logTable = new LogTable(); - m_logTable.setModel(new CompoundTableModel(new LogTableModel(), true)); - - TableRowSorter sorter = new TableRowSorter<>(m_logTable.getModel()); - m_logTable.setRowSorter(sorter); - - sorter.setComparator(LogTableModel.COLTYPE_TASKINFO_CRITICALITY, new Comparator() { - - @Override - public int compare(TaskInfo o1, TaskInfo o2) { - int cmp = o2.getImportance() - o1.getImportance(); - if (cmp != 0) { - return cmp; - } - return o2.getId()-o1.getId(); - } - - - }); - - TableColumnModel columnModel = m_logTable.getColumnModel(); - - columnModel.getColumn(LogTableModel.COLTYPE_STEP).setCellRenderer(new TaskInfoStepRenderer()); - columnModel.getColumn(LogTableModel.COLTYPE_TASKINFO_CRITICALITY).setCellRenderer(new TaskInfoImportanceRenderer()); - - DefaultErrorRenderer defaultErrorRenderer = new DefaultErrorRenderer(new DefaultTableRenderer(), m_logTable); - columnModel.getColumn(LogTableModel.COLTYPE_TASKINFO_ID).setCellRenderer(defaultErrorRenderer); - columnModel.getColumn(LogTableModel.COLTYPE_TASKINFO_CATEGORY).setCellRenderer(defaultErrorRenderer); - columnModel.getColumn(LogTableModel.COLTYPE_DESCRIPTION).setCellRenderer(defaultErrorRenderer); - - - // set preferred width of different columns - columnModel.getColumn(LogTableModel.COLTYPE_STEP).setMaxWidth(20); - columnModel.getColumn(LogTableModel.COLTYPE_TASKINFO_ID).setMaxWidth(40); - columnModel.getColumn(LogTableModel.COLTYPE_TASKINFO_CATEGORY).setMaxWidth(180); - - scrollPane.setViewportView(m_logTable); - m_logTable.setFillsViewportHeight(true); - m_logTable.setViewport(scrollPane.getViewport()); - - - - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 3; - internalPanel.add(scrollPane, c); - - return internalPanel; - - } - - private JToolBar initToolbar() { - JToolBar toolbar = new JToolBar(JToolBar.VERTICAL); - toolbar.setFloatable(false); - - FilterButton filterButton = new FilterButton(((CompoundTableModel) m_logTable.getModel())) { - - @Override - protected void filteringDone() { - } - - }; - EraserButton taskEraserButton = new EraserButton(); - GetSystemInfoButtonAction systemInfoButton = new GetSystemInfoButtonAction(); - toolbar.add(filterButton); - toolbar.add(taskEraserButton); - toolbar.add(systemInfoButton); - - return toolbar; - } - - public void updateData() { - - if ((!m_firstDisplay) && (!TaskInfoManager.getTaskInfoManager().isUpdateNeeded())) { - return; - } - m_firstDisplay = false; - - - m_logTable.setUpdating(true); - - LogTableModel tableModel = (LogTableModel) ((CompoundTableModel) m_logTable.getModel()).getBaseModel(); - - int selectedTaskInfoId = -1; - int selectedIndex = m_logTable.getSelectionModel().getMinSelectionIndex(); - boolean aSelection = (selectedIndex != -1); - if (aSelection) { - selectedIndex = m_logTable.convertRowIndexToModel(selectedIndex); - selectedTaskInfoId = tableModel.getTaskInfo(selectedIndex).getId(); - } - - tableModel.updateData(); - - selectedIndex = (selectedTaskInfoId == -1) ? -1 : tableModel.findIndexOfTaskInfoById(selectedTaskInfoId); - - if (selectedIndex != -1) { - // selection unchanged - selectedIndex = m_logTable.convertRowIndexToView(selectedIndex); - m_logTable.getSelectionModel().setSelectionInterval(selectedIndex, selectedIndex); - m_logTable.setUpdating(false); // at the end reallow the update - - // TaskInfo selected can have been modified - getDataBox().addDataChanged(TaskInfo.class); - getDataBox().propagateDataChanged(); - } else if (aSelection) { - // selection lost - m_logTable.setUpdating(false); // allow first the update - m_logTable.getSelectionModel().clearSelection(); - - // TaskInfo selected can have been modified - getDataBox().addDataChanged(TaskInfo.class); - getDataBox().propagateDataChanged(); - } else { - m_logTable.setUpdating(false); - } - - } - - public TaskInfo getSelectedTaskInfo() { - - // Retrieve Selected Row - int selectedRow = m_logTable.getSelectedRow(); - return m_logTable.getTaskInfo(selectedRow); - - } - - - private class LogTable extends DecoratedMarkerTable { - - private boolean m_isUpdating = false; - - public LogTable() { - setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); - - //displayColumnAsPercentage(LogTableModel.COLTYPE_PERCENTAGE, AbstractLayoutPainter.HorizontalAlignment.LEFT); - //getRelativizer().setMin(0); - //getRelativizer().setMax(100); - - setDefaultRenderer(Float.class, new PercentageRenderer( getDefaultRenderer(String.class)) ); - } - - @Override - public void addTableModelListener(TableModelListener l) { - getModel().addTableModelListener(l); - } - - /** - * Called whenever the value of the selection changes. - * - * @param e the event that characterizes the change. - */ - @Override - public void valueChanged(ListSelectionEvent e) { - - super.valueChanged(e); - - if (e.getValueIsAdjusting()) { - // value is adjusting, so valueChanged will be called again - return; - } - - if (!m_isUpdating) { - getDataBox().addDataChanged(TaskInfo.class); - getDataBox().propagateDataChanged(); - } - } - - public void setUpdating(boolean updating) { - m_isUpdating = updating; - } - - @Override - public TablePopupMenu initPopupMenu() { - TablePopupMenu popupMenu = new TablePopupMenu(false); - popupMenu.addAction(new StopTaskAction()); - - return popupMenu; - } - - // set as abstract - @Override - public void prepostPopupMenu() { - // nothing to do - } - - private TaskInfo getTaskInfo(int row) { - if (row == -1) { - return null; - } - - // convert according to the sorting - row = convertRowIndexToModel(row); - - CompoundTableModel compoundTableModel = ((CompoundTableModel) getModel()); - row = compoundTableModel.convertCompoundRowToBaseModelRow(row); - - // Retrieve ProteinSet selected - LogTableModel tableModel = (LogTableModel) compoundTableModel.getBaseModel(); - return tableModel.getTaskInfo(row); - } - - } - - private static class LogTableModel extends DecoratedTableModel implements GlobalTableModelInterface { - - public static final int COLTYPE_STEP = 0; - public static final int COLTYPE_TASKINFO_ID = 1; - public static final int COLTYPE_TASKINFO_CATEGORY = 2; - public static final int COLTYPE_TASKINFO_CRITICALITY = 3; - public static final int COLTYPE_DESCRIPTION = 4; - public static final int COLTYPE_PERCENTAGE = 5; - private static final String[] columnNames = {"", "id", "Category", "Criticality", "Task Description", "Progress"}; - private ArrayList m_taskInfoList = null; - - public boolean updateData() { - if (m_taskInfoList == null) { - m_taskInfoList = new ArrayList<>(128); - } - boolean updateDone = TaskInfoManager.getTaskInfoManager().copyData(m_taskInfoList, false); - - if (updateDone) { - fireTableDataChanged(); - } - return updateDone; - } - - public TaskInfo getTaskInfo(int index) { - if ((m_taskInfoList == null) || (index >= m_taskInfoList.size()) || (index < 0)) { - return null; - } - - return m_taskInfoList.get(index); - - } - - public int findIndexOfTaskInfoById(int taskInfoId) { - if (taskInfoId == -1) { - return -1; - } - - for (int i = 0; i < m_taskInfoList.size(); i++) { - if (m_taskInfoList.get(i).getId() == taskInfoId) { - return i; - } - } - - return -1; - } - - @Override - public Class getColumnClass(int col) { - switch (col) { - case COLTYPE_STEP: - case COLTYPE_TASKINFO_CRITICALITY: - return TaskInfo.class; - case COLTYPE_TASKINFO_ID: - return Integer.class; - case COLTYPE_TASKINFO_CATEGORY: - case COLTYPE_DESCRIPTION: - return String.class; - case COLTYPE_PERCENTAGE: - return Float.class; - } - return null; // should not happen - } - - @Override - public int getRowCount() { - if (m_taskInfoList == null) { - return 0; - } - - return m_taskInfoList.size(); - } - - @Override - public int getColumnCount() { - return columnNames.length; - } - - @Override - public String getColumnName(int col) { - return columnNames[col]; - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - - TaskInfo taskInfo = m_taskInfoList.get(rowIndex); - switch (columnIndex) { - case COLTYPE_STEP: { - return taskInfo; - } - case COLTYPE_TASKINFO_ID: { - return taskInfo.getId(); - } - case COLTYPE_TASKINFO_CATEGORY: { - return taskInfo.getIdList(); - } - case COLTYPE_TASKINFO_CRITICALITY: { - return taskInfo; - } - case COLTYPE_DESCRIPTION: { - return taskInfo.getTaskDescription(); - } - case COLTYPE_PERCENTAGE: { - if (taskInfo.isRunning()) { - float percentage = taskInfo.getPercentage(); - if ((percentage<0.001) || (percentage>99.999)) { - return Float.NaN; - } - return percentage; - } else { - return Float.NaN; - } - - } - - } - return null; // should not happen - } - - @Override - public String getToolTipForHeader(int col) { - return null; // no tooltip - } - - @Override - public String getTootlTipValue(int row, int col) { - return null; - } - - @Override - public void addFilters(LinkedHashMap filtersMap) { - - ConvertValueInterface stepConverter = new ConvertValueInterface() { - @Override - public Object convertValue(Object o) { - if (o == null) { - return null; - } - return Integer.valueOf(((TaskInfo) o).getPublicState()); - } - - }; - filtersMap.put(COLTYPE_STEP, new ValueFilter("State", TaskInfo.PUBLIC_STATE_VALUES, PUBLIC_STATE_ICONS, ValueFilter.ValueFilterType.EQUAL, stepConverter, COLTYPE_STEP)); - filtersMap.put(COLTYPE_TASKINFO_ID, new IntegerFilter(getColumnName(COLTYPE_TASKINFO_ID), null, COLTYPE_TASKINFO_ID)); - - - ConvertValueInterface criticalityConverter = new ConvertValueInterface() { - @Override - public Object convertValue(Object o) { - if (o == null) { - return null; - } - return Integer.valueOf(((TaskInfo) o).getImportance()); - } - - }; - filtersMap.put(COLTYPE_TASKINFO_CRITICALITY, new ValueFilter(getColumnName(COLTYPE_TASKINFO_CRITICALITY), TaskInfo.IMPORTANCE_VALUES, null, ValueFilter.ValueFilterType.GREATER_EQUAL, criticalityConverter, COLTYPE_TASKINFO_CRITICALITY)); - filtersMap.put(COLTYPE_DESCRIPTION, new StringDiffFilter(getColumnName(COLTYPE_DESCRIPTION), null, COLTYPE_DESCRIPTION)); - - } - - @Override - public boolean isLoaded() { - return true; - } - - @Override - public int getLoadingPercentage() { - return 100; - } - - @Override - public Long getTaskId() { - return -1L; // not used - } - - @Override - public LazyData getLazyData(int row, int col) { - return null; // not used - } - - @Override - public void givePriorityTo(Long taskId, int row, int col) { - return; // not used - } - - @Override - public void sortingChanged(int col) { - return; // not used - } - - @Override - public int getSubTaskId(int col) { - return -1; // not used - } - - @Override - public String getDataColumnIdentifier(int columnIndex) { - return null; // not used - } - - @Override - public Class getDataColumnClass(int columnIndex) { - return null; // not used - } - - @Override - public Object getDataValueAt(int rowIndex, int columnIndex) { - return null; // not used - } - - @Override - public int[] getKeysColumn() { - return null; // not used - } - - @Override - public int getInfoColumn() { - return -1; // not used - } - - @Override - public void setName(String name) { - // not used - } - - @Override - public String getName() { - return null; // not used - } - - @Override - public Map getExternalData() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public PlotInformation getPlotInformation() { - return null; // not used - } - - - @Override - public PlotType getBestPlotType() { - return null; // not used - } - - @Override - public int[] getBestColIndex(PlotType plotType) { - return null; // not used - } - - - @Override - public String getExportRowCell(int row, int col) { - return null; // no specific export - } - - @Override - public ArrayList getExportFonts(int row, int col) { - return null; - } - - @Override - public String getExportColumnName(int col) { - return getColumnName(col); - } - - @Override - public TableCellRenderer getRenderer(int row, int col) { - if (col == COLTYPE_PERCENTAGE) { - return new ScoreRenderer(); - } - return null; - } - - @Override - public GlobalTableModelInterface getFrozzenModel() { - return this; - } - - @Override - public ArrayList getExtraDataTypes() { - ArrayList list = new ArrayList<>(); - list.add(new ExtraDataType(TaskInfo.class, true)); - registerSingleValuesAsExtraTypes(list); - return list; - } - - @Override - public Object getValue(Class c) { - return getSingleValue(c); - } - - @Override - public Object getRowValue(Class c, int row) { - if (c.equals(TaskInfo.class)) { - return m_taskInfoList.get(row); - } - return null; - } - - @Override - public Object getColValue(Class c, int col) { - return null; - } - - } - - public class TaskInfoStepRenderer extends DefaultTableCellRenderer { - - public TaskInfoStepRenderer() { - } - - @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - - super.getTableCellRendererComponent(table, value, isSelected, false, row, column); - - TaskInfo task = (TaskInfo) value; - - setIcon(PUBLIC_STATE_ICONS[task.getPublicState()]); - - return this; - } - } - - public class TaskInfoImportanceRenderer extends DefaultTableCellRenderer { - - public TaskInfoImportanceRenderer() { - } - - @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - - super.getTableCellRendererComponent(table, value, isSelected, false, row, column); - - TaskInfo task = (TaskInfo) value; - - setText(task.getImportanceAsString()); - - return this; - } - } - - public class DefaultErrorRenderer implements TableCellRenderer, Serializable { - - private final TableCellRenderer m_renderer; - private final LogTable m_table; - - public DefaultErrorRenderer(TableCellRenderer renderer, LogTable table) { - m_renderer = renderer; - m_table = table; - } - - @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - Component c = m_renderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - if (c instanceof JLabel) { - - JLabel l = ((JLabel) c); - - l.setHorizontalAlignment(JLabel.LEFT); - - TaskInfo taskInfo = m_table.getTaskInfo(row); - if (taskInfo.hasTaskError()) { - l.setForeground(Color.red); - } else { - if (isSelected) { - l.setForeground(Color.white); - } else { - l.setForeground(Color.black); - } - } - - } - - return c; - } - } - - public class EraserButton extends JButton implements ActionListener { - - public EraserButton() { - - setIcon(IconManager.getIcon(IconManager.IconType.ERASER)); - setToolTipText("Erase All Finished Tasks"); - - addActionListener(this); - } - - @Override - public void actionPerformed(ActionEvent e) { - TaskInfoManager.getTaskInfoManager().clear(); - m_firstDisplay = true; - updateData(); - } - } - - - private class StopTaskAction extends AbstractTableAction { - - public StopTaskAction() { - super("Cancel task..."); - } - - @Override - public void actionPerformed(int col, int row, int[] selectedRows, JTable table) { - int nbSelectedRset = selectedRows.length; - if(nbSelectedRset != 1 ){ - JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),"Only one task can be aborted at the same time","Cancel Task Error",JOptionPane.ERROR_MESSAGE); - return; - } - TaskInfo currentTaskInfo = getSelectedTaskInfo(); - if(fr.profi.util.StringUtils.isEmpty(currentTaskInfo.getJmsMessageID())){ - JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),"Only server side tasks can be aborted","Cancel Task Error",JOptionPane.ERROR_MESSAGE); - return; - } - - if( currentTaskInfo.getPublicState() == TaskInfo.PUBLIC_STATE_RUNNING){ - CancelTask task = new CancelTask(currentTaskInfo.getJmsMessageID()); - AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); - } else if ( currentTaskInfo.getPublicState() == TaskInfo.PUBLIC_STATE_WAITING){ - PurgeConsumer.getPurgeConsumer().clearMessage(currentTaskInfo.getJmsMessageID()); - } else { - JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),"Only pending or running task can be aborted","Cancel Task Error",JOptionPane.ERROR_MESSAGE); - } - } - - @Override - public void updateEnabled(int row, int col, int[] selectedRows, JTable table) { - - boolean enable = true; - if(selectedRows.length != 1 ) - enable = false; - else { - TaskInfo currentTaskInfo = getSelectedTaskInfo(); - int currentPublicState = currentTaskInfo.getPublicState(); - if( currentPublicState != TaskInfo.PUBLIC_STATE_WAITING &¤tPublicState !=TaskInfo.PUBLIC_STATE_RUNNING ){ - enable = false; - } - } - - setEnabled(enable); - } - } -} - - +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.gui.tasklog; + +import fr.proline.studio.extendedtablemodel.ExtraDataType; +import fr.proline.studio.dam.taskinfo.TaskInfo; +import fr.proline.studio.dam.taskinfo.TaskInfoManager; +import fr.proline.studio.dpm.data.JMSNotificationMessage; +import fr.proline.studio.dpm.AccessJMSManagerThread; +import fr.proline.studio.dpm.task.jms.AbstractJMSCallback; +import fr.proline.studio.dpm.task.jms.CancelTask; +import fr.proline.studio.dpm.task.jms.PurgeConsumer; +import fr.proline.studio.export.ExportFontData; +import fr.proline.studio.filter.ConvertValueInterface; +import fr.proline.studio.filter.Filter; +import fr.proline.studio.filter.FilterButton; +import fr.proline.studio.filter.IntegerFilter; +import fr.proline.studio.filter.ValueFilter; +import fr.proline.studio.graphics.PlotInformation; +import fr.proline.studio.graphics.PlotType; +import fr.proline.studio.rsmexplorer.gui.dialog.GetSystemInfoButtonAction; +import fr.proline.studio.rsmexplorer.gui.renderer.PercentageRenderer; +import fr.proline.studio.rsmexplorer.gui.renderer.ScoreRenderer; +import fr.proline.studio.table.AbstractTableAction; +import fr.proline.studio.extendedtablemodel.CompoundTableModel; +import fr.proline.studio.table.DecoratedMarkerTable; +import fr.proline.studio.table.DecoratedTableModel; +import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; +import fr.proline.studio.filter.StringDiffFilter; +import fr.proline.studio.table.LazyData; +import fr.proline.studio.table.TablePopupMenu; +import fr.proline.studio.utils.IconManager; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.LinkedHashMap; +import java.util.Map; +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.TableModelListener; +import javax.swing.table.*; +import org.jdesktop.swingx.renderer.DefaultTableRenderer; +import fr.proline.studio.WindowManager; + +/** + * Panel used to display all logged tasks + * + * @author JM235353 + */ +public class TasksPanel extends AbstractTasksPanel { + + private LogTable m_logTable; + + private boolean m_firstDisplay = true; + + public TasksPanel() { + super(); + setLayout(new GridBagLayout()); + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.insets = new java.awt.Insets(5, 5, 5, 5); + + c.weightx = 1; + c.weighty = 1; + add(createToolbarPanel(), c); + } + + + @Override + protected AbstractJMSCallback getServiceNotificationCallback(JMSNotificationMessage[] sysInfoResult) { + AbstractJMSCallback notifierCallback = new AbstractJMSCallback() { + @Override + public boolean mustBeCalledInAWT() { + return true; + } + + @Override + public void run(boolean success) { + if (sysInfoResult[0].getEventType().equals(JMSNotificationMessage.MessageStatus.STARTED)) { + TaskInfo tiToUpdate = TaskInfoManager.getTaskInfoManager().getTaskInfoWithJMSId(sysInfoResult[0].getServerUniqueMsgId()); + if (tiToUpdate != null) { + tiToUpdate.setRunning(true); + } + } + } + }; + return notifierCallback; + } + + //Nothing specific to do after cancel message was done : already taken into account be message response + @Override + protected AbstractJMSCallback getPurgeConsumerCallback(JMSNotificationMessage[] purgerResult){ + return null; + } + + // default start data collect is enough + @Override + protected void startOtherDataCollecting(){ + } + + // default stop data collect is enough + @Override + protected void stopOtherDataCollecting(){ + } + + private JPanel createToolbarPanel() { + JPanel toolbarPanel = new JPanel(); + + toolbarPanel.setLayout(new BorderLayout()); + + JPanel internalPanel = createInternalPanel(); + toolbarPanel.add(internalPanel, BorderLayout.CENTER); + + JToolBar toolbar = initToolbar(); + toolbarPanel.add(toolbar, BorderLayout.WEST); + + return toolbarPanel; + + } + + private JPanel createInternalPanel() { + + JPanel internalPanel = new JPanel(); + + internalPanel.setLayout(new GridBagLayout()); + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.NORTHWEST; + c.fill = GridBagConstraints.BOTH; + c.insets = new java.awt.Insets(5, 5, 5, 5); + + // create objects + JScrollPane scrollPane = new JScrollPane(); + m_logTable = new LogTable(); + m_logTable.setModel(new CompoundTableModel(new LogTableModel(), true)); + + TableRowSorter sorter = new TableRowSorter<>(m_logTable.getModel()); + m_logTable.setRowSorter(sorter); + + sorter.setComparator(LogTableModel.COLTYPE_TASKINFO_CRITICALITY, new Comparator() { + + @Override + public int compare(TaskInfo o1, TaskInfo o2) { + int cmp = o2.getImportance() - o1.getImportance(); + if (cmp != 0) { + return cmp; + } + return o2.getId()-o1.getId(); + } + + + }); + + TableColumnModel columnModel = m_logTable.getColumnModel(); + + columnModel.getColumn(LogTableModel.COLTYPE_STEP).setCellRenderer(new TaskInfoStepRenderer()); + columnModel.getColumn(LogTableModel.COLTYPE_TASKINFO_CRITICALITY).setCellRenderer(new TaskInfoImportanceRenderer()); + + DefaultErrorRenderer defaultErrorRenderer = new DefaultErrorRenderer(new DefaultTableRenderer(), m_logTable); + columnModel.getColumn(LogTableModel.COLTYPE_TASKINFO_ID).setCellRenderer(defaultErrorRenderer); + columnModel.getColumn(LogTableModel.COLTYPE_TASKINFO_CATEGORY).setCellRenderer(defaultErrorRenderer); + columnModel.getColumn(LogTableModel.COLTYPE_DESCRIPTION).setCellRenderer(defaultErrorRenderer); + + + // set preferred width of different columns + columnModel.getColumn(LogTableModel.COLTYPE_STEP).setMaxWidth(20); + columnModel.getColumn(LogTableModel.COLTYPE_TASKINFO_ID).setMaxWidth(40); + columnModel.getColumn(LogTableModel.COLTYPE_TASKINFO_CATEGORY).setMaxWidth(180); + + scrollPane.setViewportView(m_logTable); + m_logTable.setFillsViewportHeight(true); + m_logTable.setViewport(scrollPane.getViewport()); + + + + c.gridx = 0; + c.gridy = 0; + c.weightx = 1; + c.weighty = 1; + c.gridwidth = 3; + internalPanel.add(scrollPane, c); + + return internalPanel; + + } + + private JToolBar initToolbar() { + JToolBar toolbar = new JToolBar(JToolBar.VERTICAL); + toolbar.setFloatable(false); + + FilterButton filterButton = new FilterButton(((CompoundTableModel) m_logTable.getModel())) { + + @Override + protected void filteringDone() { + } + + }; + EraserButton taskEraserButton = new EraserButton(); + GetSystemInfoButtonAction systemInfoButton = new GetSystemInfoButtonAction(); + toolbar.add(filterButton); + toolbar.add(taskEraserButton); + toolbar.add(systemInfoButton); + + return toolbar; + } + + public void updateData() { + + if ((!m_firstDisplay) && (!TaskInfoManager.getTaskInfoManager().isUpdateNeeded())) { + return; + } + m_firstDisplay = false; + + + m_logTable.setUpdating(true); + + LogTableModel tableModel = (LogTableModel) ((CompoundTableModel) m_logTable.getModel()).getBaseModel(); + + int selectedTaskInfoId = -1; + int selectedIndex = m_logTable.getSelectionModel().getMinSelectionIndex(); + boolean aSelection = (selectedIndex != -1); + if (aSelection) { + selectedIndex = m_logTable.convertRowIndexToModel(selectedIndex); + selectedTaskInfoId = tableModel.getTaskInfo(selectedIndex).getId(); + } + + tableModel.updateData(); + + selectedIndex = (selectedTaskInfoId == -1) ? -1 : tableModel.findIndexOfTaskInfoById(selectedTaskInfoId); + + if (selectedIndex != -1) { + // selection unchanged + selectedIndex = m_logTable.convertRowIndexToView(selectedIndex); + m_logTable.getSelectionModel().setSelectionInterval(selectedIndex, selectedIndex); + m_logTable.setUpdating(false); // at the end reallow the update + + // TaskInfo selected can have been modified + getDataBox().addDataChanged(TaskInfo.class); + getDataBox().propagateDataChanged(); + } else if (aSelection) { + // selection lost + m_logTable.setUpdating(false); // allow first the update + m_logTable.getSelectionModel().clearSelection(); + + // TaskInfo selected can have been modified + getDataBox().addDataChanged(TaskInfo.class); + getDataBox().propagateDataChanged(); + } else { + m_logTable.setUpdating(false); + } + + } + + public TaskInfo getSelectedTaskInfo() { + + // Retrieve Selected Row + int selectedRow = m_logTable.getSelectedRow(); + return m_logTable.getTaskInfo(selectedRow); + + } + + + private class LogTable extends DecoratedMarkerTable { + + private boolean m_isUpdating = false; + + public LogTable() { + setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); + + //displayColumnAsPercentage(LogTableModel.COLTYPE_PERCENTAGE, AbstractLayoutPainter.HorizontalAlignment.LEFT); + //getRelativizer().setMin(0); + //getRelativizer().setMax(100); + + setDefaultRenderer(Float.class, new PercentageRenderer( getDefaultRenderer(String.class)) ); + } + + @Override + public void addTableModelListener(TableModelListener l) { + getModel().addTableModelListener(l); + } + + /** + * Called whenever the value of the selection changes. + * + * @param e the event that characterizes the change. + */ + @Override + public void valueChanged(ListSelectionEvent e) { + + super.valueChanged(e); + + if (e.getValueIsAdjusting()) { + // value is adjusting, so valueChanged will be called again + return; + } + + if (!m_isUpdating) { + getDataBox().addDataChanged(TaskInfo.class); + getDataBox().propagateDataChanged(); + } + } + + public void setUpdating(boolean updating) { + m_isUpdating = updating; + } + + @Override + public TablePopupMenu initPopupMenu() { + TablePopupMenu popupMenu = new TablePopupMenu(false); + popupMenu.addAction(new StopTaskAction()); + + return popupMenu; + } + + // set as abstract + @Override + public void prepostPopupMenu() { + // nothing to do + } + + private TaskInfo getTaskInfo(int row) { + if (row == -1) { + return null; + } + + // convert according to the sorting + row = convertRowIndexToModel(row); + + CompoundTableModel compoundTableModel = ((CompoundTableModel) getModel()); + row = compoundTableModel.convertCompoundRowToBaseModelRow(row); + + // Retrieve ProteinSet selected + LogTableModel tableModel = (LogTableModel) compoundTableModel.getBaseModel(); + return tableModel.getTaskInfo(row); + } + + } + + private static class LogTableModel extends DecoratedTableModel implements GlobalTableModelInterface { + + public static final int COLTYPE_STEP = 0; + public static final int COLTYPE_TASKINFO_ID = 1; + public static final int COLTYPE_TASKINFO_CATEGORY = 2; + public static final int COLTYPE_TASKINFO_CRITICALITY = 3; + public static final int COLTYPE_DESCRIPTION = 4; + public static final int COLTYPE_PERCENTAGE = 5; + private static final String[] columnNames = {"", "id", "Category", "Criticality", "Task Description", "Progress"}; + private ArrayList m_taskInfoList = null; + + public boolean updateData() { + if (m_taskInfoList == null) { + m_taskInfoList = new ArrayList<>(128); + } + boolean updateDone = TaskInfoManager.getTaskInfoManager().copyData(m_taskInfoList, false); + + if (updateDone) { + fireTableDataChanged(); + } + return updateDone; + } + + public TaskInfo getTaskInfo(int index) { + if ((m_taskInfoList == null) || (index >= m_taskInfoList.size()) || (index < 0)) { + return null; + } + + return m_taskInfoList.get(index); + + } + + public int findIndexOfTaskInfoById(int taskInfoId) { + if (taskInfoId == -1) { + return -1; + } + + for (int i = 0; i < m_taskInfoList.size(); i++) { + if (m_taskInfoList.get(i).getId() == taskInfoId) { + return i; + } + } + + return -1; + } + + @Override + public Class getColumnClass(int col) { + switch (col) { + case COLTYPE_STEP: + case COLTYPE_TASKINFO_CRITICALITY: + return TaskInfo.class; + case COLTYPE_TASKINFO_ID: + return Integer.class; + case COLTYPE_TASKINFO_CATEGORY: + case COLTYPE_DESCRIPTION: + return String.class; + case COLTYPE_PERCENTAGE: + return Float.class; + } + return null; // should not happen + } + + @Override + public int getRowCount() { + if (m_taskInfoList == null) { + return 0; + } + + return m_taskInfoList.size(); + } + + @Override + public int getColumnCount() { + return columnNames.length; + } + + @Override + public String getColumnName(int col) { + return columnNames[col]; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + + TaskInfo taskInfo = m_taskInfoList.get(rowIndex); + switch (columnIndex) { + case COLTYPE_STEP: + case COLTYPE_TASKINFO_CRITICALITY: { + return taskInfo; + } + case COLTYPE_TASKINFO_ID: { + return taskInfo.getId(); + } + case COLTYPE_TASKINFO_CATEGORY: { + return taskInfo.getIdList(); + } + case COLTYPE_DESCRIPTION: { + return taskInfo.getTaskDescription(); + } + case COLTYPE_PERCENTAGE: { + if (taskInfo.isRunning()) { + float percentage = taskInfo.getPercentage(); + if ((percentage<0.001) || (percentage>99.999)) { + return Float.NaN; + } + return percentage; + } else { + return Float.NaN; + } + + } + + } + return null; // should not happen + } + + @Override + public String getToolTipForHeader(int col) { + return null; // no tooltip + } + + @Override + public String getTootlTipValue(int row, int col) { + return null; + } + + @Override + public void addFilters(LinkedHashMap filtersMap) { + + ConvertValueInterface stepConverter = new ConvertValueInterface() { + @Override + public Object convertValue(Object o) { + if (o == null) { + return null; + } + return Integer.valueOf(((TaskInfo) o).getPublicState()); + } + + }; + filtersMap.put(COLTYPE_STEP, new ValueFilter("State", TaskInfo.PUBLIC_STATE_VALUES, PUBLIC_STATE_ICONS, ValueFilter.ValueFilterType.EQUAL, stepConverter, COLTYPE_STEP)); + filtersMap.put(COLTYPE_TASKINFO_ID, new IntegerFilter(getColumnName(COLTYPE_TASKINFO_ID), null, COLTYPE_TASKINFO_ID)); + + + ConvertValueInterface criticalityConverter = new ConvertValueInterface() { + @Override + public Object convertValue(Object o) { + if (o == null) { + return null; + } + return Integer.valueOf(((TaskInfo) o).getImportance()); + } + + }; + filtersMap.put(COLTYPE_TASKINFO_CRITICALITY, new ValueFilter(getColumnName(COLTYPE_TASKINFO_CRITICALITY), TaskInfo.IMPORTANCE_VALUES, null, ValueFilter.ValueFilterType.GREATER_EQUAL, criticalityConverter, COLTYPE_TASKINFO_CRITICALITY)); + filtersMap.put(COLTYPE_DESCRIPTION, new StringDiffFilter(getColumnName(COLTYPE_DESCRIPTION), null, COLTYPE_DESCRIPTION)); + + } + + @Override + public boolean isLoaded() { + return true; + } + + @Override + public int getLoadingPercentage() { + return 100; + } + + @Override + public Long getTaskId() { + return -1L; // not used + } + + @Override + public LazyData getLazyData(int row, int col) { + return null; // not used + } + + @Override + public void givePriorityTo(Long taskId, int row, int col) { + return; // not used + } + + @Override + public void sortingChanged(int col) { + return; // not used + } + + @Override + public int getSubTaskId(int col) { + return -1; // not used + } + + @Override + public String getDataColumnIdentifier(int columnIndex) { + return null; // not used + } + + @Override + public Class getDataColumnClass(int columnIndex) { + return null; // not used + } + + @Override + public Object getDataValueAt(int rowIndex, int columnIndex) { + return null; // not used + } + + @Override + public int[] getKeysColumn() { + return null; // not used + } + + @Override + public int getInfoColumn() { + return -1; // not used + } + + @Override + public void setName(String name) { + // not used + } + + @Override + public String getName() { + return null; // not used + } + + @Override + public Map getExternalData() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public PlotInformation getPlotInformation() { + return null; // not used + } + + + @Override + public PlotType getBestPlotType() { + return null; // not used + } + + @Override + public int[] getBestColIndex(PlotType plotType) { + return null; // not used + } + + + @Override + public String getExportRowCell(int row, int col) { + return null; // no specific export + } + + @Override + public ArrayList getExportFonts(int row, int col) { + return null; + } + + @Override + public String getExportColumnName(int col) { + return getColumnName(col); + } + + @Override + public TableCellRenderer getRenderer(int row, int col) { + if (col == COLTYPE_PERCENTAGE) { + return new ScoreRenderer(); + } + return null; + } + + @Override + public GlobalTableModelInterface getFrozzenModel() { + return this; + } + + @Override + public ArrayList getExtraDataTypes() { + ArrayList list = new ArrayList<>(); + list.add(new ExtraDataType(TaskInfo.class, true)); + registerSingleValuesAsExtraTypes(list); + return list; + } + + @Override + public Object getValue(Class c) { + return getSingleValue(c); + } + + @Override + public Object getRowValue(Class c, int row) { + if (c.equals(TaskInfo.class)) { + return m_taskInfoList.get(row); + } + return null; + } + + @Override + public Object getColValue(Class c, int col) { + return null; + } + + } + + public class TaskInfoStepRenderer extends DefaultTableCellRenderer { + + public TaskInfoStepRenderer() { + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + + super.getTableCellRendererComponent(table, value, isSelected, false, row, column); + + TaskInfo task = (TaskInfo) value; + + setIcon(PUBLIC_STATE_ICONS[task.getPublicState()]); + + return this; + } + } + + public class TaskInfoImportanceRenderer extends DefaultTableCellRenderer { + + public TaskInfoImportanceRenderer() { + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + + super.getTableCellRendererComponent(table, value, isSelected, false, row, column); + + TaskInfo task = (TaskInfo) value; + + setText(task.getImportanceAsString()); + + return this; + } + } + + public class DefaultErrorRenderer implements TableCellRenderer, Serializable { + + private final TableCellRenderer m_renderer; + private final LogTable m_table; + + public DefaultErrorRenderer(TableCellRenderer renderer, LogTable table) { + m_renderer = renderer; + m_table = table; + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + Component c = m_renderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + if (c instanceof JLabel) { + + JLabel l = ((JLabel) c); + + l.setHorizontalAlignment(JLabel.LEFT); + + TaskInfo taskInfo = m_table.getTaskInfo(row); + if (taskInfo.hasTaskError()) { + l.setForeground(Color.red); + } else { + if (isSelected) { + l.setForeground(Color.white); + } else { + l.setForeground(Color.black); + } + } + + } + + return c; + } + } + + public class EraserButton extends JButton implements ActionListener { + + public EraserButton() { + + setIcon(IconManager.getIcon(IconManager.IconType.ERASER)); + setToolTipText("Erase All Finished Tasks"); + + addActionListener(this); + } + + @Override + public void actionPerformed(ActionEvent e) { + TaskInfoManager.getTaskInfoManager().clear(); + m_firstDisplay = true; + updateData(); + } + } + + + private class StopTaskAction extends AbstractTableAction { + + public StopTaskAction() { + super("Cancel task..."); + } + + @Override + public void actionPerformed(int col, int row, int[] selectedRows, JTable table) { + int nbSelectedRset = selectedRows.length; + if(nbSelectedRset != 1 ){ + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),"Only one task can be aborted at the same time","Cancel Task Error",JOptionPane.ERROR_MESSAGE); + return; + } + TaskInfo currentTaskInfo = getSelectedTaskInfo(); + if(fr.profi.util.StringUtils.isEmpty(currentTaskInfo.getJmsMessageID())){ + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),"Only server side tasks can be aborted","Cancel Task Error",JOptionPane.ERROR_MESSAGE); + return; + } + + if( currentTaskInfo.getPublicState() == TaskInfo.PUBLIC_STATE_RUNNING){ + CancelTask task = new CancelTask(currentTaskInfo.getJmsMessageID()); + AccessJMSManagerThread.getAccessJMSManagerThread().addTask(task); + } else if ( currentTaskInfo.getPublicState() == TaskInfo.PUBLIC_STATE_WAITING){ + PurgeConsumer.getPurgeConsumer().clearMessage(currentTaskInfo.getJmsMessageID()); + } else { + JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),"Only pending or running task can be aborted","Cancel Task Error",JOptionPane.ERROR_MESSAGE); + } + } + + @Override + public void updateEnabled(int row, int col, int[] selectedRows, JTable table) { + + boolean enable = true; + if(selectedRows.length != 1 ) + enable = false; + else { + TaskInfo currentTaskInfo = getSelectedTaskInfo(); + int currentPublicState = currentTaskInfo.getPublicState(); + if( currentPublicState != TaskInfo.PUBLIC_STATE_WAITING &¤tPublicState !=TaskInfo.PUBLIC_STATE_RUNNING ){ + enable = false; + } + } + + setEnabled(enable); + } + } +} + + diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/AbstractMapAlignmentPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/AbstractMapAlignmentPanel.java new file mode 100644 index 000000000..48eea4d7a --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/AbstractMapAlignmentPanel.java @@ -0,0 +1,371 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.gui.xic; + +import fr.proline.core.orm.lcms.ProcessedMap; +import fr.proline.studio.export.ExportButton; +import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; +import fr.proline.studio.graphics.BasePlotPanel; +import fr.proline.studio.graphics.PlotPanel; +import fr.proline.studio.gui.HourglassPanel; +import fr.proline.studio.gui.SplittedPanelContainer; +import fr.proline.studio.pattern.AbstractDataBox; +import fr.proline.studio.pattern.DataBoxPanelInterface; +import fr.proline.studio.pattern.xic.DataboxMapAlignment; +import fr.proline.studio.rsmexplorer.gui.xic.alignment.IonsRTScatterPlot; +import fr.proline.studio.rsmexplorer.gui.xic.alignment.IonsRTTableModel; +import fr.proline.studio.utils.IconManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.swing.*; +import javax.swing.border.TitledBorder; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.util.List; +import java.util.Map; + +/** + * Common class for Map (delta time vs time) alignment and moz Map (delta moz vs time) alignement + */ +public abstract class AbstractMapAlignmentPanel extends HourglassPanel implements DataBoxPanelInterface { + + + protected static final Logger logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); + protected static final String CLOUD_VIEW_BEST_FIT_TEXT = "Zoom to fit RT tolerance range"; + protected static final String CLOUD_VIEW_All_TEXT = "Zoom to fit all ions"; + protected static final String CLOUD_VIEW_NOT_ENABLED_TEXT = "Zoom disabled"; + protected static final int CLOUD_VIEW_ALL = 1; + protected static final int CLOUD_VIEW_BEST_FIT = 0;//default show mode + protected static final String CLOUD_LOAD_TEXT = "Load matched peptide ions"; + protected static final String CLOUD_REMOVE_TEXT = "Remove peptide ions plot"; + protected static final String CLOUD_IS_LOADING = "Loading ions ..."; + protected final static NumberFormat format2 = new DecimalFormat("#0.0000"); + + final double THRESHOLD = .0001; + + // databox using this Panel + protected AbstractDataBox m_dataBox; + + // quanti information + protected QuantChannelInfo m_quantChannelInfo; + + // processed map to display by Index + protected Map m_pMapByIndex; + + String m_typeAlignement;//specify what is aligned with time + // + protected JLabel m_labelTitle; + protected JTextField m_srcTimeValueTF; + protected JTextField m_destValueTF; + protected JComboBox m_sourceMapsCB; + + //common buttons + private JToggleButton m_loadIonsBtn; + protected boolean m_isIonsCloudLoaded; + protected JToggleButton m_zoomModeBtn; + int m_zoomMode; + protected JButton m_showHideCrossAssigned; + + //displayed plot + protected BasePlotPanel m_alignmentGraphicPanel; + protected IonsRTScatterPlot m_ionsScatterPlot; + protected JSplitPane m_splitPane; + + + // for alignment iterative mode, sometimes, we should show 2 graphic + protected BasePlotPanel m_alignmentGraphicPanel_2; + protected IonsRTScatterPlot m_ionsScatterPlot2; + protected PlotPanel m_plotPanel2; + + protected boolean m_isInitialized = false; + + + //TODO Change typeAlignement usage ==> change to panelTitle + public AbstractMapAlignmentPanel(AbstractDataBox dataBox, String typeAlignement) { + this.m_dataBox = dataBox; + m_typeAlignement = typeAlignement; + + m_isIonsCloudLoaded = false; + + JPanel mainPanel = initComponents(); + + this.setLayout(new BorderLayout()); + this.add(mainPanel, BorderLayout.CENTER); + } + + protected abstract String getTitleLabel(); + protected abstract JPanel createConvertPanel(); + protected abstract List getMoreCloudButtons(); + public abstract void setData(QuantChannelInfo quantChannelInfo, List compareDataInterfaceList); + protected abstract Double getCorrespondingData(Double time, Long mapId); + protected abstract void setDataGraphic(); + + + + protected JPanel initComponents() { + JPanel mainPanel; + mainPanel = new JPanel(); + + JPanel headerPanel = initToolbarPanel(); + PlotPanel plotPanel1 = new PlotPanel(); + m_alignmentGraphicPanel = plotPanel1.getBasePlotPanel(); + + mainPanel.setLayout(new BorderLayout()); + TitledBorder titleB = new TitledBorder(null, "LC-MS Map "+m_typeAlignement+"Alignments", TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION); + mainPanel.setBorder(titleB); + mainPanel.add(headerPanel, BorderLayout.PAGE_START); + + m_plotPanel2 = new PlotPanel(); + m_alignmentGraphicPanel_2 = m_plotPanel2.getBasePlotPanel(); + // the second graphic panel has not data in exhaustive mode and in iterative mode, when one selected map is reference map + m_plotPanel2.setVisible(false); + + m_splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, plotPanel1, m_plotPanel2); + m_splitPane.setResizeWeight(0.5); //half half for each graphic panel + m_splitPane.setBorder(BorderFactory.createRaisedBevelBorder()); + + mainPanel.add(m_splitPane, BorderLayout.CENTER); + return mainPanel; + } + + private JPanel initToolbarPanel() { + ExportButton exportImageButton = new ExportButton("Graphic", this); + exportImageButton.setMargin(new Insets(2, 2, 2, 2)); + initLoadIonsButton(); + initZoomButton(); + + m_labelTitle = new JLabel(getTitleLabel()); + + m_srcTimeValueTF = new JTextField(10); + m_srcTimeValueTF.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + } + + @Override + public void focusLost(FocusEvent e) { + convertTime(); + } + }); + m_srcTimeValueTF.addActionListener(e -> convertTime()); + m_srcTimeValueTF.setName("tfSourceTime"); + m_srcTimeValueTF.setToolTipText("Enter retention time (in minutes) "); + + m_sourceMapsCB = new JComboBox(); + m_sourceMapsCB.addActionListener(e -> { + convertTime(); + setDataGraphic(); + }); + + JPanel cloudOptionPane = new JPanel(); + cloudOptionPane.setLayout(new BoxLayout(cloudOptionPane, BoxLayout.LINE_AXIS)); + + m_showHideCrossAssigned = new JButton(); + m_showHideCrossAssigned.setIcon(IconManager.getIcon(IconManager.IconType.SHOW_CROSS_ASSIGNED)); + m_showHideCrossAssigned.setActionCommand("SHOW"); + m_showHideCrossAssigned.setMargin(new Insets(2, 2, 2, 2)); + m_showHideCrossAssigned.setToolTipText("Show/Hide cross assigned ions"); + m_showHideCrossAssigned.addActionListener(e -> { + if (m_ionsScatterPlot != null || m_ionsScatterPlot2 != null) { + if (e.getActionCommand().equals("HIDE")) { + if (m_ionsScatterPlot != null) + m_ionsScatterPlot.showCrossAssignedIons(false); + if (m_ionsScatterPlot2 != null) + m_ionsScatterPlot2.showCrossAssignedIons(false); + m_showHideCrossAssigned.setActionCommand("SHOW"); + m_showHideCrossAssigned.setIcon(IconManager.getIcon(IconManager.IconType.SHOW_CROSS_ASSIGNED)); + + } else { + if (m_ionsScatterPlot2 != null) + m_ionsScatterPlot2.showCrossAssignedIons(true); + if (m_ionsScatterPlot != null) + m_ionsScatterPlot.showCrossAssignedIons(true); + m_showHideCrossAssigned.setActionCommand("HIDE"); + m_showHideCrossAssigned.setIcon(IconManager.getIcon(IconManager.IconType.HIDE_CROSS_ASSIGNED)); + } + m_alignmentGraphicPanel.repaintUpdateDoubleBuffer(); + m_plotPanel2.repaint(); + if(m_alignmentGraphicPanel_2.isVisible()) + m_alignmentGraphicPanel_2.repaintUpdateDoubleBuffer(); + + } + }); + + JSeparator separator = new JSeparator(JSeparator.VERTICAL); + cloudOptionPane.add(exportImageButton); + cloudOptionPane.add(m_loadIonsBtn); + cloudOptionPane.add(m_zoomModeBtn); + cloudOptionPane.add(m_showHideCrossAssigned); + for(JButton bt : getMoreCloudButtons()){ + cloudOptionPane.add(bt); + } + cloudOptionPane.add(Box.createRigidArea(new Dimension(10, 0))); + setEnabledCloudButtons(false); + cloudOptionPane.add(separator); + + JPanel beginPane = new JPanel(new FlowLayout()); + beginPane.add(cloudOptionPane); + beginPane.add(createConvertPanel()); + + JPanel pane = new JPanel(); + pane.setLayout(new BorderLayout()); + pane.add(beginPane, BorderLayout.LINE_START); + pane.add(m_labelTitle, BorderLayout.LINE_END); + pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); + return pane; + } + + protected void setEnabledCloudButtons(boolean enable) { + m_showHideCrossAssigned.setEnabled(enable); + m_zoomModeBtn.setEnabled(enable); + } + + private void initLoadIonsButton() { + m_loadIonsBtn = new JToggleButton(); + m_loadIonsBtn.setIcon(IconManager.getIcon(IconManager.IconType.LOAD_ALIGNMENT_CLOUD)); + m_loadIonsBtn.setMargin(new Insets(2, 2, 2, 2)); + + m_loadIonsBtn.setToolTipText(CLOUD_LOAD_TEXT); + m_loadIonsBtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (!m_isIonsCloudLoaded) {//action = set cloud + m_isIonsCloudLoaded = true; + m_loadIonsBtn.setIcon(IconManager.getIconWithHourGlass(IconManager.IconType.LOAD_ALIGNMENT_CLOUD)); + m_loadIonsBtn.setToolTipText(CLOUD_IS_LOADING); + ((DataboxMapAlignment) m_dataBox).loadCloud(); //will return in this class and call this.setAlignmentCloud + } else if (m_dataBox.isLoaded()) {//cloud is been shown, action = remove + m_isIonsCloudLoaded = false;//this boolean will affect cloud show + m_loadIonsBtn.setIcon(IconManager.getIcon(IconManager.IconType.LOAD_ALIGNMENT_CLOUD)); + m_loadIonsBtn.setToolTipText(CLOUD_LOAD_TEXT); + setEnabledCloudButtons(false); + setDataGraphic(); + } + } + }); + } + + protected void initZoomButton() { + m_zoomModeBtn = new JToggleButton(); + m_zoomModeBtn.setIcon(IconManager.getIcon(IconManager.IconType.ZOOM_ALL)); + m_zoomModeBtn.setMargin(new Insets(2, 2, 2, 2)); + m_zoomModeBtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (m_zoomMode == CLOUD_VIEW_BEST_FIT) { + m_zoomMode = CLOUD_VIEW_ALL; + m_zoomModeBtn.setIcon(IconManager.getIcon(IconManager.IconType.ZOOM_FIT)); + m_zoomModeBtn.setToolTipText(CLOUD_VIEW_BEST_FIT_TEXT); + setDataGraphic(); + } else { + m_zoomMode = CLOUD_VIEW_BEST_FIT; + m_zoomModeBtn.setIcon(IconManager.getIcon(IconManager.IconType.ZOOM_ALL)); + m_zoomModeBtn.setToolTipText(CLOUD_VIEW_All_TEXT); + setDataGraphic(); + } + + } + + }); + m_zoomModeBtn.setToolTipText(CLOUD_VIEW_NOT_ENABLED_TEXT); + } + + /** + * show in plotScatter, the cloud, usually be called when user change combo + * box selection
+ * can be called by DataBoxMapAlignment + */ + public void setAlignmentCloud() { + this.m_loadIonsBtn.setToolTipText(CLOUD_REMOVE_TEXT); + this.m_loadIonsBtn.setIcon(IconManager.getIcon(IconManager.IconType.REMOVE_ALIGNMENT_CLOUD)); + this.m_zoomModeBtn.setToolTipText(CLOUD_VIEW_All_TEXT); + setEnabledCloudButtons(true); + this.setDataGraphic(); + } + + @Override + public void setDataBox(AbstractDataBox dataBox) { + m_dataBox = dataBox; + } + + @Override + public AbstractDataBox getDataBox() { + return m_dataBox; + } + + @Override + public void addSingleValue(Object v) { + // not used for the moment JPM.TODO ? + } + + @Override + public ActionListener getRemoveAction(SplittedPanelContainer splittedPanel ) { + return m_dataBox.getRemoveAction(splittedPanel); + } + + @Override + public ActionListener getAddAction(SplittedPanelContainer splittedPanel ) { + return m_dataBox.getAddAction(splittedPanel); + } + + @Override + public ActionListener getSaveAction(SplittedPanelContainer splittedPanel ) { + return m_dataBox.getSaveAction(splittedPanel); + } + + void convertTime() { + try { + Double time = Double.parseDouble(m_srcTimeValueTF.getText()); + Double calcMoz = getCorrespondingData(time, getSelectedMapId(m_sourceMapsCB)); + if (calcMoz.isNaN()) { + m_destValueTF.setText("Not Found"); + } else { + m_destValueTF.setText(format2.format(calcMoz)); + } + } catch (NumberFormatException ex) { + } + } + + + IonsRTTableModel getCloudData(long mapIdSrc) { + if (this.m_dataBox.isLoaded()) { + return ((DataboxMapAlignment) this.m_dataBox).getPeptideCloud(mapIdSrc); + } else { + return null; + } + } + + protected Long getSelectedMapId(JComboBox cb) { + if (cb == null) { + return (long) -1; + } else { + int selId = cb.getSelectedIndex(); + if (m_pMapByIndex.containsKey(selId)) { + return m_pMapByIndex.get(selId).getId(); + } else { + return (long) -1;//should not happen + } + } + } + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/ExperimentalDesignPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/ExperimentalDesignPanel.java index 06904455a..26914444a 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/ExperimentalDesignPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/ExperimentalDesignPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,9 +16,11 @@ */ package fr.proline.studio.rsmexplorer.gui.xic; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import fr.proline.core.orm.msi.PtmSpecificity; import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.studio.dam.tasks.DatabasePTMSitesTask; +import fr.proline.studio.dam.tasks.DatabasePTMsTask; import fr.proline.studio.dam.tasks.SubTask; import fr.proline.studio.export.ExportButton; import fr.proline.studio.gui.HourglassPanel; @@ -37,11 +39,8 @@ import java.util.ArrayList; import java.util.Map; import java.util.stream.Collectors; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTabbedPane; -import javax.swing.JToolBar; +import javax.swing.*; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,14 +61,17 @@ public class ExperimentalDesignPanel extends HourglassPanel implements DataBoxPa private JTabbedPane m_tabbedPane; private QuantPostProcessingPanel m_profilizerParamPanel; private JPanel m_confPanel; + private JPanel m_lowlevelConfPanel; private JPanel m_refinedPanel; private DDataset m_dataset; private boolean m_displayPostProcessing = false; + private boolean m_displayLowLevel = false; private boolean m_displayQuantParam = true; private static String TAB_POST_PROCESSING_TITLE = "Compute Post Processing"; + private static String TAB_LOW_LEVEL_TITLE = "Low Level"; public ExperimentalDesignPanel() { super(); @@ -128,6 +130,9 @@ private JPanel createInternalPanel() { m_refinedPanel = new JPanel(); m_refinedPanel.setLayout(new BorderLayout()); + m_lowlevelConfPanel = new JPanel(); + m_lowlevelConfPanel.setLayout(new BorderLayout()); + m_tabbedPane.add("Exp.Design", m_scrollPaneExpDesign); m_tabbedPane.add("Exp. Parameters", m_confPanel); @@ -224,6 +229,33 @@ private void updateData() { } m_refinedPanel.removeAll(); } + + if (m_dataset.getQuantLowLevelConfig() != null) { + m_lowlevelConfPanel.removeAll(); + if (!m_displayLowLevel) { + m_tabbedPane.add(TAB_LOW_LEVEL_TITLE, m_lowlevelConfPanel); + m_displayLowLevel = true; + } + + JScrollPane sPane = new JScrollPane(); + sPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + JTextArea area = new JTextArea(100,20); + + Map llMap = m_dataset.getQuantLowLevelConfigAsMap(); + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + String formattedString = gson.toJson(llMap); + area.setText(formattedString); + area.setLineWrap(true); + sPane.setViewportView(area); + m_lowlevelConfPanel.add(sPane, BorderLayout.CENTER); + } else { + if (m_displayLowLevel) { + m_tabbedPane.remove(m_lowlevelConfPanel); + m_displayLowLevel = false; + } + m_lowlevelConfPanel.removeAll(); + } + } catch (Exception ex) { m_logger.error("error while settings quanti params " + ex); } @@ -232,7 +264,7 @@ private void updateData() { private Map getPtmSpecificityNameById() { final ArrayList ptms = new ArrayList<>(); - DatabasePTMSitesTask task = new DatabasePTMSitesTask(null); + DatabasePTMsTask task = new DatabasePTMsTask(null); task.initLoadUsedPTMs(m_dataset.getProject().getId(), m_dataset.getResultSummaryId(), ptms); task.fetchData(); return ptms.stream().collect(Collectors.toMap(ptmS -> ptmS.getId(), ptmS -> ptmS.toString())); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/FeatureTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/FeatureTableModel.java index e3f6e2a4f..e326223e9 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/FeatureTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/FeatureTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -17,7 +17,9 @@ package fr.proline.studio.rsmexplorer.gui.xic; import fr.proline.core.orm.lcms.dto.DFeature; +import fr.proline.core.orm.msi.dto.DMasterQuantPeptideIon; import fr.proline.core.orm.uds.dto.DQuantitationChannel; +import fr.proline.studio.corewrapper.util.PeptideClassesUtils; import fr.proline.studio.extendedtablemodel.ExtraDataType; import fr.proline.studio.dam.tasks.xic.DatabaseLoadLcMSTask; import fr.proline.studio.export.ExportFontData; @@ -42,6 +44,9 @@ import fr.proline.studio.table.LazyTableModel; import fr.proline.studio.table.TableDefaultRendererManager; import fr.proline.studio.utils.CyclicColorPalette; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.awt.Color; import java.util.ArrayList; import java.util.HashMap; @@ -61,30 +66,32 @@ public class FeatureTableModel extends LazyTableModel implements GlobalTableMode public static final int COLTYPE_FEATURE_MAP_NAME = 1; public static final int COLTYPE_FEATURE_QC = 2; public static final int COLTYPE_FEATURE_MOZ = 3; - public static final int COLTYPE_FEATURE_CHARGE = 4; - public static final int COLTYPE_FEATURE_RETENTION_TIME = 5; - public static final int COLTYPE_FEATURE_APEX_INTENSITY = 6; - public static final int COLTYPE_FEATURE_INTENSITY = 7; - public static final int COLTYPE_FEATURE_DURATION = 8; - public static final int COLTYPE_FEATURE_QUALITY_SCORE = 9; - public static final int COLTYPE_FEATURE_IS_OVERLAPPING = 10; - public static final int COLTYPE_FEATURE_PREDICTED_RETENTION_TIME = 11; - public static final int COLTYPE_FEATURE_PEAKELS_COUNT = 12; - + public static final int COLTYPE_FEATURE_CALIBRATED_MOZ = 4; + public static final int COLTYPE_FEATURE_CHARGE = 5; + public static final int COLTYPE_FEATURE_RETENTION_TIME = 6; + public static final int COLTYPE_FEATURE_APEX_INTENSITY = 7; + public static final int COLTYPE_FEATURE_INTENSITY = 8; + public static final int COLTYPE_FEATURE_DURATION = 9; + public static final int COLTYPE_FEATURE_QUALITY_SCORE = 10; + public static final int COLTYPE_FEATURE_IS_OVERLAPPING = 11; + public static final int COLTYPE_FEATURE_PREDICTED_RETENTION_TIME = 12; + public static final int COLTYPE_FEATURE_PEAKELS_COUNT = 13; + public final static String SERIALIZED_PROP_PREDICTED_ELUTION_TIME = "predicted_elution_time"; public final static String SERIALIZED_PROP_PEAKELS_COUNT = "peakels_count"; public final static String SERIALIZED_PROP_IS_RELIABLE = "is_reliable"; + + protected static final Logger logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); + private static final String[] m_columnNames = {"Id", "Map", "Quant. Channel", "m/z", "Calibrated MoZ", "Charge", "RT", "Apex Intensity", "Intensity", "Duration (sec)", "Quality Score", "Is Overlapping", "Predicted RT", "#Peakels"}; + private static final String[] m_toolTipColumns = {"Feature Id","Map name","Quantitation Channel ", "Mass to Charge Ratio", "Calibrated Mass to Charge Ratio", "Charge", "Retention Time in minutes", "Apex Intensity", "Intensity", "Duration (sec)", "Quality Score", "Is Overlapping", "Predicted Retention time in min", "Peakels count"}; + private static final String[] m_columnNamesForExport = {"Id", "Map", "Quantitation Channel", "m/z", "Calibrated MoZ", "Charge", "Elution Time (sec)", "Apex Intensity", "Intensity", "Duration (sec)", "Quality Score", "Is Overlapping", "Predicted Retention Time (sec)", "Peakels Count"}; - - private static final String[] m_columnNames = {"Id", "Map", "Quant. Channel", "m/z", "Charge", "RT", "Apex Intensity", "Intensity", "Duration (sec)", "Quality Score", "Is Overlapping", "Predicted RT", "#Peakels"}; - private static final String[] m_toolTipColumns = {"Feature Id","Map name","Quantitation Channel ", "Mass to Charge Ratio", "Charge", "Retention Time in minutes", "Apex Intensity", "Intensity", "Duration (sec)", "Quality Score", "Is Overlapping", "Predicted Retention time in min", "Peakels count"}; - private static final String[] m_columnNamesForExport = {"Id", "Map", "Quantitation Channel", "m/z", "Charge", "Elution Time (sec)", "Apex Intensity", "Intensity", "Duration (sec)", "Quality Score", "Is Overlapping", "Predicted Retention Time (sec)", "Peakels Count"}; - - + private DMasterQuantPeptideIon m_quantPeptideIon = null; private List m_features = null; private QuantChannelInfo m_quantChannelInfo = null; private List m_featureHasPeak = null; + private Map calibratedMozByFeatureId = new HashMap<>(); private String m_modelName; @@ -123,7 +130,7 @@ public Class getColumnClass(int col) { @Override public int getSubTaskId(int col) { - return DatabaseLoadLcMSTask.SUB_TASK_FEATURE; + return DatabaseLoadLcMSTask.SUB_TASK_PEAKEL_FOR_FEATURE; } @Override @@ -208,6 +215,21 @@ public Object getValueAt(int row, int col) { return lazyData; } + case COLTYPE_FEATURE_CALIBRATED_MOZ: { + LazyData lazyData = getLazyData(row, col); + if (feature.getCharge() == null) { + lazyData.setData(null); + givePriorityTo(m_taskId, row, col); + }else { + if(calibratedMozByFeatureId.containsKey(feature.getId()) ) + lazyData.setData(calibratedMozByFeatureId.get(feature.getId())); + else + lazyData.setData(getCalibratedMoZ(feature)); + } + return lazyData; + + } + case COLTYPE_FEATURE_APEX_INTENSITY: { LazyData lazyData = getLazyData(row, col); if (feature.getCharge() == null) { @@ -298,8 +320,28 @@ public Object getValueAt(int row, int col) { return null; // should never happen } - public void setData(Long taskId, List features, QuantChannelInfo quantChannelInfo, List featureHasPeak) { + private Double getCalibratedMoZ(DFeature feature){ + logger.debug("calculate delta moz at RT " + feature.getElutionTime() + " for map =" + feature.getMap().getName()); + Double calcMoz = Double.NaN; + try { + if(m_quantPeptideIon != null) { + Double deltaMoz = PeptideClassesUtils.getDeltaMozFor(feature.getMoz(), feature.getCharge(), m_quantPeptideIon.getPeptideInstance().getPeptide()).doubleValue(); + calcMoz = feature.getMoz() + deltaMoz; + calibratedMozByFeatureId.put(feature.getId(), calcMoz); + logger.debug("...result= " + calcMoz); + } + } catch (Exception e) { + logger.error("Error while retrieving time in map calibration: " + e); + } + //Displayed deltaMoz is inverted compare to store deltaMoz ! + return calcMoz; + } + + + public void setData(Long taskId, List features, QuantChannelInfo quantChannelInfo, List featureHasPeak, DMasterQuantPeptideIon pepIon) { m_features = features; + m_quantPeptideIon = pepIon; + calibratedMozByFeatureId.clear(); m_quantChannelInfo = quantChannelInfo; m_featureHasPeak = featureHasPeak ; @@ -375,6 +417,7 @@ public void sortAccordingToModel(ArrayList featureIds, CompoundTableModel public void addFilters(LinkedHashMap filtersMap) { filtersMap.put(COLTYPE_FEATURE_MOZ, new DoubleFilter(getColumnName(COLTYPE_FEATURE_MOZ), null, COLTYPE_FEATURE_MOZ)); + filtersMap.put(COLTYPE_FEATURE_CALIBRATED_MOZ, new DoubleFilter(getColumnName(COLTYPE_FEATURE_CALIBRATED_MOZ), null, COLTYPE_FEATURE_CALIBRATED_MOZ)); filtersMap.put(COLTYPE_FEATURE_CHARGE, new IntegerFilter(getColumnName(COLTYPE_FEATURE_CHARGE), null, COLTYPE_FEATURE_CHARGE)); ConvertValueInterface minuteConverter = new ConvertValueInterface() { @@ -422,6 +465,7 @@ public Class getDataColumnClass(int columnIndex) { case COLTYPE_FEATURE_QC: return String.class; case COLTYPE_FEATURE_MOZ: + case COLTYPE_FEATURE_CALIBRATED_MOZ: return Double.class; case COLTYPE_FEATURE_RETENTION_TIME: case COLTYPE_FEATURE_APEX_INTENSITY: @@ -504,6 +548,12 @@ public Object getDataValueAt(int rowIndex, int columnIndex) { case COLTYPE_FEATURE_PEAKELS_COUNT: { return feature.getPeakelCount(); } + case COLTYPE_FEATURE_CALIBRATED_MOZ:{ + if(calibratedMozByFeatureId.containsKey(feature.getId())) + return calibratedMozByFeatureId.get(feature.getId()); + else + return getCalibratedMoZ(feature); + } } return null; // should never happen } @@ -616,6 +666,14 @@ public String getExportRowCell(int row, int col) { return ""+feature.getMoz(); } + } + case COLTYPE_FEATURE_CALIBRATED_MOZ: { + if (!calibratedMozByFeatureId.containsKey(feature.getId()) || calibratedMozByFeatureId.get(feature.getId()).isNaN()) { + return ""; + } else { + return ""+calibratedMozByFeatureId.get(feature.getId()); + } + } case COLTYPE_FEATURE_CHARGE: { if (feature.getCharge() == null) { @@ -709,6 +767,7 @@ public List getDefaultColumnsToHide() { listIds.add(COLTYPE_FEATURE_PEAKELS_COUNT); listIds.add(COLTYPE_FEATURE_IS_OVERLAPPING); listIds.add(COLTYPE_FEATURE_QUALITY_SCORE); + listIds.add(COLTYPE_FEATURE_CALIBRATED_MOZ); return listIds; } @@ -808,15 +867,13 @@ public TableCellRenderer getRenderer(int row, int col) { TableCellRenderer renderer = null; switch (col) { - case COLTYPE_FEATURE_MAP_NAME: { - renderer = new FontRenderer( new DefaultLeftAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)) ); - break; - } + case COLTYPE_FEATURE_MAP_NAME: case COLTYPE_FEATURE_QC: case COLTYPE_FEATURE_IS_OVERLAPPING: { - renderer = new FontRenderer( new DefaultLeftAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class))); + renderer = new FontRenderer( new DefaultLeftAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)) ); break; } + case COLTYPE_FEATURE_CALIBRATED_MOZ: case COLTYPE_FEATURE_MOZ: { renderer = new FontRenderer( new DoubleRenderer( new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)), 4 )); break; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapAlignmentPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapAlignmentPanel.java index 299272ad8..e7ab6f1c5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapAlignmentPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapAlignmentPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -19,43 +19,32 @@ import fr.proline.core.orm.lcms.MapAlignment; import fr.proline.core.orm.lcms.MapTime; import fr.proline.core.orm.lcms.ProcessedMap; -import fr.proline.studio.graphics.*; -import fr.proline.studio.gui.DefaultDialog; -import fr.proline.studio.gui.HourglassPanel; -import fr.proline.studio.gui.SplittedPanelContainer; -import fr.proline.studio.pattern.AbstractDataBox; -import fr.proline.studio.pattern.DataBoxPanelInterface; +import fr.proline.studio.Exceptions; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.tasks.xic.MapAlignmentConverter; -import fr.proline.studio.export.ExportButton; - -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.text.DecimalFormat; -import java.text.NumberFormat; -import java.util.*; -import javax.swing.*; - -import fr.proline.studio.utils.CyclicColorPalette; -import org.apache.commons.math3.analysis.interpolation.LoessInterpolator; -import org.apache.commons.lang3.tuple.Pair; -import org.openide.windows.WindowManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; +import fr.proline.studio.graphics.BasePlotPanel; +import fr.proline.studio.graphics.PlotBaseAbstract; +import fr.proline.studio.graphics.PlotInformation; +import fr.proline.studio.graphics.PlotLinear; +import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.pattern.xic.DataboxMapAlignment; import fr.proline.studio.rsmexplorer.gui.dialog.xic.AbstractLabelFreeMSParamsPanel; -import fr.proline.studio.rsmexplorer.gui.xic.alignment.IonsRTTableModel; import fr.proline.studio.rsmexplorer.gui.xic.alignment.IonsRTScatterPlot; +import fr.proline.studio.rsmexplorer.gui.xic.alignment.IonsRTTableModel; import fr.proline.studio.table.BeanTableModel; +import fr.proline.studio.utils.CyclicColorPalette; import fr.proline.studio.utils.IconManager; -import java.io.PrintWriter; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.commons.math3.analysis.interpolation.LoessInterpolator; +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; -import javax.swing.border.TitledBorder; import static java.util.stream.Collectors.averagingDouble; import static java.util.stream.Collectors.groupingBy; @@ -65,148 +54,40 @@ * * @author MB243701 */ -public class MapAlignmentPanel extends HourglassPanel implements DataBoxPanelInterface { - - - private static final Logger logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); - private static final String CLOUD_VIEW_BEST_FIT_TEXT = "Zoom to fit RT tolerance range"; - private static final String CLOUD_VIEW_All_TEXT = "Zoom to fit all ions"; - private static final String CLOUD_VIEW_NOT_ENABLED_TEXT = "Zoom disabled"; - private static final int CLOUD_VIEW_ALL = 1; - private static final int CLOUD_VIEW_BEST_FIT = 0;//default show mode - private static final String CLOUD_LOAD_TEXT = "Load matched peptide ions"; - private static final String CLOUD_REMOVE_TEXT = "Remove peptide ions plot"; - private static final String CLOUD_IS_LOADING = "Loading ions ..."; - private final static NumberFormat format2 = new DecimalFormat("#0.0000"); - - private AbstractDataBox m_dataBox; - private QuantChannelInfo m_quantChannelInfo; +public class MapAlignmentPanel extends AbstractMapAlignmentPanel { + + //Data to display private List m_allMapAlignments; - private Map m_mapName; private long m_referenceMapId; - private JLabel m_labelTitle; - private JTextField m_SourceTimeTF; - private JTextField m_DestTimeTF; - private JComboBox m_sourceMapsCB; + //Second map private JComboBox m_destMapsCB; - private JToggleButton m_loadIonsBtn; - private boolean m_isIonsCloudLoaded; - private JToggleButton m_zoomModeBtn; - private int m_zoomMode; + //Loess Specific private JButton m_addLoessCurveBtn; private JButton m_removeLoessCurveBtn; - private JButton m_showHideCrossAssigned; - private JSplitPane m_splitPane; - private BasePlotPanel m_alignmentGraphicPanel; - /** - * for alignment iterative mode, sometimes, we should show 2 graphic - */ - private BasePlotPanel m_alignmentGraphicPanel_2; - private PlotPanel m_plotPanel2; - private boolean m_isInitialized = false; - private IonsRTScatterPlot m_ionsScatterPlot; public MapAlignmentPanel(DataboxMapAlignment dataBox) { - super(); + super(dataBox, "time"); m_referenceMapId = 0; - m_dataBox = dataBox; - m_isIonsCloudLoaded = false; - initComponents(); } - private void initComponents() { - JPanel pane; - pane = new JPanel(); - JPanel mapAlignmentPanel = initMapAlignmentPanel(); - //m_alignmentGraphicPanel = new MultiGraphicsPanel(false, false); - PlotPanel plotPanel1 = new PlotPanel(false); - m_alignmentGraphicPanel = plotPanel1.getBasePlotPanel(); - //m_alignmentGraphicPanel_2 = new MultiGraphicsPanel(false, false); - m_plotPanel2 = new PlotPanel(false); - m_alignmentGraphicPanel_2 = m_plotPanel2.getBasePlotPanel(); - // the second graphic panel has not data in exhaustive mode and in iterative mode, when one selected map is reference map - m_plotPanel2.setVisible(false); - pane.setLayout(new BorderLayout()); - TitledBorder titleB = new TitledBorder(null, " LC-MS Map Alignments", TitledBorder.CENTER, TitledBorder.CENTER); - pane.setBorder(titleB); - pane.add(mapAlignmentPanel, BorderLayout.PAGE_START); - m_splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, plotPanel1, m_plotPanel2); - m_splitPane.setResizeWeight(0.5); //half half for each grapic panel - m_splitPane.setBorder(BorderFactory.createRaisedBevelBorder()); - pane.add(m_splitPane, BorderLayout.CENTER); - this.setLayout(new BorderLayout()); - this.add(pane, BorderLayout.CENTER); + @Override + protected String getTitleLabel() { + return "Reference Map: ■ " + + " map  , Alignment Mode : I/H) "; } - private JPanel initMapAlignmentPanel() { - ExportButton exportImageButton = new ExportButton("Graphic", this); - exportImageButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); - createLoadIonsButton(); - createZoomButton(); - - m_labelTitle = new JLabel("Reference Map: ■ " - + " map  , Alignment Mode : I/H) "); - - m_SourceTimeTF = new JTextField(10); - m_SourceTimeTF.addFocusListener(new FocusListener() { - @Override - public void focusGained(FocusEvent e) { - } - - @Override - public void focusLost(FocusEvent e) { - convertTime(); - } - }); - m_SourceTimeTF.addActionListener(e -> convertTime()); - m_SourceTimeTF.setName("tfSourceTime"); - m_SourceTimeTF.setToolTipText("Enter retention time (in minutes)"); - - m_sourceMapsCB = new JComboBox(); - m_sourceMapsCB.addActionListener(e -> { - convertTime(); - setDataGraphic(); - }); - - m_destMapsCB = new JComboBox(); - m_destMapsCB.addActionListener(e -> { - convertTime(); - setDataGraphic(); - }); - m_destMapsCB.setName("cbDestMaps"); - - JPanel cloudOptionPane = new JPanel(); - JSeparator separator = new JSeparator(JSeparator.VERTICAL); - cloudOptionPane.setLayout(new BoxLayout(cloudOptionPane, BoxLayout.LINE_AXIS)); - - m_showHideCrossAssigned = new JButton(); - m_showHideCrossAssigned.setIcon(IconManager.getIcon(IconManager.IconType.HIDE_CROSS_ASSIGNED)); - m_showHideCrossAssigned.setActionCommand("HIDE"); - m_showHideCrossAssigned.setMargin(new java.awt.Insets(2, 2, 2, 2)); - m_showHideCrossAssigned.setToolTipText("Show/Hide cross assigned ions"); - m_showHideCrossAssigned.addActionListener(e -> { - if (m_ionsScatterPlot != null) { - if (e.getActionCommand().equals("HIDE")) { - m_ionsScatterPlot.showCrossAssignedIons(false); - m_showHideCrossAssigned.setActionCommand("SHOW"); - m_showHideCrossAssigned.setIcon(IconManager.getIcon(IconManager.IconType.SHOW_CROSS_ASSIGNED)); - } else { - m_ionsScatterPlot.showCrossAssignedIons(true); - m_showHideCrossAssigned.setActionCommand("HIDE"); - m_showHideCrossAssigned.setIcon(IconManager.getIcon(IconManager.IconType.HIDE_CROSS_ASSIGNED)); - } - m_alignmentGraphicPanel.repaintUpdateDoubleBuffer(); - } - }); - + @Override + protected List getMoreCloudButtons() { + List bts = new ArrayList<>(); m_addLoessCurveBtn = new JButton(); m_addLoessCurveBtn.setIcon(IconManager.getIcon(IconManager.IconType.ADD_LOESS_CURVE)); m_addLoessCurveBtn.setMargin(new java.awt.Insets(2, 2, 2, 2)); m_addLoessCurveBtn.setToolTipText("Fit a Loess smooth curve to ions scatter plot"); m_addLoessCurveBtn.addActionListener(e -> computeLoess()); + bts.add(m_addLoessCurveBtn); m_removeLoessCurveBtn = new JButton(); m_removeLoessCurveBtn.setIcon(IconManager.getIcon(IconManager.IconType.REMOVE_LOESS_CURVE)); @@ -217,53 +98,45 @@ public void focusLost(FocusEvent e) { ((DataboxMapAlignment) m_dataBox).loadCloud(); m_removeLoessCurveBtn.setEnabled(false); }); + bts.add(m_removeLoessCurveBtn); + return bts; + } - cloudOptionPane.add(exportImageButton); - cloudOptionPane.add(m_loadIonsBtn); - cloudOptionPane.add(m_zoomModeBtn); - cloudOptionPane.add(m_showHideCrossAssigned); - cloudOptionPane.add(m_addLoessCurveBtn); - cloudOptionPane.add(m_removeLoessCurveBtn); - cloudOptionPane.add(Box.createRigidArea(new Dimension(10, 0))); - setEnabledCloudButtons(false); - cloudOptionPane.add(separator); + @Override + protected JPanel createConvertPanel() { + + m_destMapsCB = new JComboBox(); + m_destMapsCB.addActionListener(e -> { + convertTime(); + setDataGraphic(); + }); + m_destMapsCB.setName("cbDestMaps"); JPanel timePanel = new JPanel(); timePanel.setLayout(new FlowLayout(FlowLayout.LEFT)); - timePanel.add(m_SourceTimeTF); + timePanel.add(m_srcTimeValueTF); JLabel label0 = new JLabel("(min) in "); timePanel.add(label0); m_sourceMapsCB.setName("cbSourceMaps"); timePanel.add(m_sourceMapsCB); JLabel label = new JLabel("predicted to"); timePanel.add(label); - m_DestTimeTF = new JTextField(10); - m_DestTimeTF.setName("tfDestTime"); - m_DestTimeTF.setEditable(false); - timePanel.add(m_DestTimeTF); + m_destValueTF = new JTextField(10); + m_destValueTF.setName("tfDestTime"); + m_destValueTF.setEditable(false); + timePanel.add(m_destValueTF); JLabel label2 = new JLabel("(min) in"); timePanel.add(label2); timePanel.add(m_destMapsCB); - - JPanel beginPane = new JPanel(new FlowLayout()); - beginPane.add(cloudOptionPane); - beginPane.add(timePanel); - - JPanel pane = new JPanel(); - pane.setLayout(new BorderLayout()); - pane.add(beginPane, BorderLayout.LINE_START); - pane.add(m_labelTitle, BorderLayout.LINE_END); - pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); - return pane; + return timePanel; } - private void setEnabledCloudButtons(boolean enable) { - m_addLoessCurveBtn.setEnabled(enable); - //warning: removeFit enable status depends on addFit only - m_removeLoessCurveBtn.setEnabled(false); - m_showHideCrossAssigned.setEnabled(enable); - m_zoomModeBtn.setEnabled(enable); + @Override + protected void setEnabledCloudButtons(boolean enable) { + super.setEnabledCloudButtons(enable); + m_addLoessCurveBtn.setEnabled(enable); + m_removeLoessCurveBtn.setEnabled(false); } private void computeLoess() { @@ -271,90 +144,112 @@ private void computeLoess() { long mapIdSrc = getSelectedMapId(m_sourceMapsCB); long mapIdDst = getSelectedMapId(m_destMapsCB); - MapAlignment map = MapAlignmentConverter.getMapAlgn(mapIdSrc, mapIdDst, m_allMapAlignments); + MapAlignment map = MapAlignmentConverter.getMapAlgn(mapIdSrc, mapIdDst, m_allMapAlignments); IonsRTTableModel cloudData = getCloudData(mapIdSrc); - if (cloudData != null) { + if (cloudData == null) { + logger.warn(" compute Loess, no Cloud data for source Map, id "+mapIdSrc); + return; + } + + IonsRTTableModel cloudData2 = map == null ? getCloudData(m_referenceMapId) : null; + if ( map == null && cloudData2 == null) { + logger.warn(" compute Loess, Not direct MAP, but no Cloud data for reference Map, id "+m_referenceMapId); + return; + } + + double bandwidth = 0.1; + + LoessParametersDialog dialog = new LoessParametersDialog(); + dialog.getValueTF().setText(Double.toString(bandwidth)); + Point panelLocation = this.getLocationOnScreen(); + dialog.setLocation(panelLocation.x + this.getWidth() / 2, panelLocation.y + this.getHeight() / 2); + dialog.setVisible(true); + + if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK) { - double bandwidth = 0.1; - - LoessParametersDialog dialog = new LoessParametersDialog(); - dialog.getValueTF().setText(Double.toString(bandwidth)); - Point panelLocation = this.getLocationOnScreen(); - dialog.setLocation(panelLocation.x + this.getWidth()/2, panelLocation.y+this.getHeight()/2); - dialog.setVisible(true); - - if (dialog.getButtonClicked() == DefaultDialog.BUTTON_OK){ - - bandwidth = Double.parseDouble(dialog.getValueTF().getText()); - - int axisX = cloudData.getColumnIndex(mapIdSrc); - int axisY = cloudData.getColumnIndex(mapIdDst); - int size = cloudData.getRowCount(); - List> data = new ArrayList<>(size); - - for (int i = 0; i < size; i++) { - if (!cloudData.isCrossAssigned(i, axisY)) { - Object value = cloudData.getDataValueAt(i, axisX); - Double v1 = ((value == null || !Number.class.isAssignableFrom(value.getClass())) ? Double.NaN : ((Number) value).doubleValue()); - value = cloudData.getDataValueAt(i, axisY); - Double v2 = ((value == null || !Number.class.isAssignableFrom(value.getClass())) ? Double.NaN : ((Number) value).doubleValue()); - if (Math.abs(v2) < 600.0) - data.add(Pair.of(v1, v2)); - } - } - - Map landmarks = data.stream().distinct().collect(groupingBy(p -> p.getKey(), averagingDouble(p -> p.getValue()))); - data = landmarks.entrySet().stream().map(e -> Pair.of(e.getKey(), e.getValue())).sorted().collect(Collectors.toList()); - - double[] x = new double[data.size()]; - double[] y = new double[data.size()]; - for (int i = 0; i < data.size(); i++) { - x[i] = data.get(i).getKey(); - y[i] = data.get(i).getValue(); - } - try { - - - LoessInterpolator interpolator = new LoessInterpolator(bandwidth, LoessInterpolator.DEFAULT_ROBUSTNESS_ITERS, LoessInterpolator.DEFAULT_ACCURACY); - double[] yfit = interpolator.smooth(x, y); - createRegressionPlot(x, yfit); - - PrintWriter writer = new PrintWriter("squared_residuals.csv"); - - double[] residuals = new double[yfit.length]; - for (int k = 0; k < yfit.length; k++) { - residuals[k] = (y[k] - yfit[k]) * (y[k] - yfit[k]); - writer.println(residuals[k]+","+x[k]); - } - - writer.close(); - - interpolator = new LoessInterpolator(Math.max(0.15, bandwidth), LoessInterpolator.DEFAULT_ROBUSTNESS_ITERS, LoessInterpolator.DEFAULT_ACCURACY); - double[] sd = interpolator.smooth(x, residuals); - double[] upper = new double[yfit.length]; - double[] lower = new double[yfit.length]; - for (int k = 0; k < yfit.length; k++) { - double s = Math.sqrt(Math.max(0, sd[k])); - upper[k] = yfit[k] + 2 * s; - lower[k] = yfit[k] - 2 * s; - } - - createRegressionPlot(x, upper); - createRegressionPlot(x, lower); - - m_removeLoessCurveBtn.setEnabled(true); - - } catch (Exception e) { - e.printStackTrace(); - } + + bandwidth = Double.parseDouble(dialog.getValueTF().getText()); + + if (map != null) { // Direct Map exist between src and dest + computeAndDisplayLoessForMaps(cloudData, mapIdSrc, mapIdDst, bandwidth, m_alignmentGraphicPanel); + } else { + //2 Plots / Map src -> Ref, Ref -> dest + computeAndDisplayLoessForMaps(cloudData, mapIdSrc, m_referenceMapId, bandwidth, m_alignmentGraphicPanel); + computeAndDisplayLoessForMaps(cloudData2, m_referenceMapId, mapIdDst, bandwidth, m_alignmentGraphicPanel_2); } + m_removeLoessCurveBtn.setEnabled(true); } } + } + + private void computeAndDisplayLoessForMaps(IonsRTTableModel cloudData, Long mapIdSrc,Long mapIdDst, double bandwidth, BasePlotPanel graphicalPanel ){ + + int sourceMapRTColumn = cloudData.getColumnIndex(mapIdSrc); + int destMapDeltaRTColumn = cloudData.getColumnIndex(mapIdDst); + int size = cloudData.getRowCount(); + List> data = new ArrayList<>(size); + + double ftAlignmentTimeTolerance = ((DataboxMapAlignment) this.m_dataBox).getFeatureAlignmentTimeTolerance(); + + for (int i = 0; i < size; i++) { + if (!cloudData.isCrossAssigned(i, destMapDeltaRTColumn)) { + Object value = cloudData.getDataValueAt(i, sourceMapRTColumn); + Double rt = ((value == null || !Number.class.isAssignableFrom(value.getClass())) ? Double.NaN : ((Number) value).doubleValue()); + value = cloudData.getDataValueAt(i, destMapDeltaRTColumn); + Double deltaRT = ((value == null || !Number.class.isAssignableFrom(value.getClass())) ? Double.NaN : ((Number) value).doubleValue()); + if (Math.abs(deltaRT) <= ftAlignmentTimeTolerance) + data.add(Pair.of(rt, deltaRT)); + } + } + + Map landmarks = data.stream().distinct().collect(groupingBy(p -> p.getKey(), averagingDouble(p -> p.getValue()))); + data = landmarks.entrySet().stream().map(e -> Pair.of(e.getKey(), e.getValue())).sorted().collect(Collectors.toList()); + + double[] x = new double[data.size()]; + double[] y = new double[data.size()]; + for (int i = 0; i < data.size(); i++) { + x[i] = data.get(i).getKey(); + y[i] = data.get(i).getValue(); + } + + try { + int robustness = LoessInterpolator.DEFAULT_ROBUSTNESS_ITERS; + double accuracy = LoessInterpolator.DEFAULT_ACCURACY; + LoessInterpolator interpolator = new LoessInterpolator(bandwidth, robustness, accuracy); + double[] yfit = interpolator.smooth(x, y); + createRegressionPlot(x, yfit, graphicalPanel); + + double[] residuals = new double[yfit.length]; + for (int k = 0; k < yfit.length; k++) { + residuals[k] = (y[k] - yfit[k]) * (y[k] - yfit[k]); + } + + interpolator = new LoessInterpolator(bandwidth, robustness, accuracy); + double[] sd = interpolator.smooth(x, residuals); + double[] upper = new double[yfit.length]; + double[] lower = new double[yfit.length]; + // 4.417 for 99.999% probability + // 3.890 for 99.99% probability + double nsigma = 3.890; + + for (int k = 0; k < yfit.length; k++) { + double s = Math.sqrt(Math.max(0, sd[k])); + upper[k] = yfit[k] + nsigma * s; + lower[k] = yfit[k] - nsigma * s; + } + + createRegressionPlot(x, upper, graphicalPanel); + createRegressionPlot(x, lower, graphicalPanel); + + + } catch (Exception e) { + e.printStackTrace(); + } } - private void createRegressionPlot(double[] x, double[] newDeltas) { + private void createRegressionPlot(double[] x, double[] newDeltas, BasePlotPanel graphicPanel ) { List> data; data = new ArrayList<>(x.length); for (int i = 0 ; i < x.length; i++) { @@ -363,88 +258,23 @@ private void createRegressionPlot(double[] x, double[] newDeltas) { BeanTableModel model = new BeanTableModel(Pair.class); model.setData(data); - String xAxisTitle = m_alignmentGraphicPanel.getXAxis().getTitle(); - String yAxisTitle = m_alignmentGraphicPanel.getYAxis().getTitle(); + String xAxisTitle = graphicPanel.getXAxis().getTitle(); + String yAxisTitle = graphicPanel.getYAxis().getTitle(); - PlotLinear regressionCurve = new PlotLinear(m_alignmentGraphicPanel, model, null ,0, 3); + PlotLinear regressionCurve = new PlotLinear(graphicPanel, model, null ,0, 3); PlotInformation plotInfo = new PlotInformation(); plotInfo.setPlotColor(CyclicColorPalette.GRAY_DARK); regressionCurve.setPlotInformation(plotInfo); regressionCurve.setStroke(1f); - m_alignmentGraphicPanel.addPlot(regressionCurve, true); + graphicPanel.addPlot(regressionCurve, true); // restore axis titles - m_alignmentGraphicPanel.getXAxis().setTitle(xAxisTitle); - m_alignmentGraphicPanel.getYAxis().setTitle(yAxisTitle); - m_alignmentGraphicPanel.repaint(); - } - - private void createLoadIonsButton() { - m_loadIonsBtn = new JToggleButton(); - m_loadIonsBtn.setIcon(IconManager.getIcon(IconManager.IconType.LOAD_ALIGNMENT_CLOUD)); - m_loadIonsBtn.setMargin(new java.awt.Insets(2, 2, 2, 2)); - - m_loadIonsBtn.setToolTipText(CLOUD_LOAD_TEXT); - m_loadIonsBtn.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (!m_isIonsCloudLoaded) {//action = set cloud - m_isIonsCloudLoaded = true; - m_loadIonsBtn.setIcon(IconManager.getIconWithHourGlass(IconManager.IconType.LOAD_ALIGNMENT_CLOUD)); - m_loadIonsBtn.setToolTipText(CLOUD_IS_LOADING); - ((DataboxMapAlignment) m_dataBox).loadCloud(); //will return in this class and call this.setAlignmentCloud - } else if (m_dataBox.isLoaded()) {//cloud is been shown, action = remove - m_isIonsCloudLoaded = false;//this boolean will affect cloud show - m_loadIonsBtn.setIcon(IconManager.getIcon(IconManager.IconType.LOAD_ALIGNMENT_CLOUD)); - m_loadIonsBtn.setToolTipText(CLOUD_LOAD_TEXT); - setEnabledCloudButtons(false); - setDataGraphic(); - } - } - }); - } - - private void createZoomButton() { - m_zoomModeBtn = new JToggleButton(); - m_zoomModeBtn.setIcon(IconManager.getIcon(IconManager.IconType.ZOOM_ALL)); - m_zoomModeBtn.setMargin(new java.awt.Insets(2, 2, 2, 2)); - m_zoomModeBtn.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (m_zoomMode == CLOUD_VIEW_BEST_FIT) { - m_zoomMode = CLOUD_VIEW_ALL; - m_zoomModeBtn.setIcon(IconManager.getIcon(IconManager.IconType.ZOOM_FIT)); - m_zoomModeBtn.setToolTipText(CLOUD_VIEW_BEST_FIT_TEXT); - setDataGraphic(); - } else { - m_zoomMode = CLOUD_VIEW_BEST_FIT; - m_zoomModeBtn.setIcon(IconManager.getIcon(IconManager.IconType.ZOOM_ALL)); - m_zoomModeBtn.setToolTipText(CLOUD_VIEW_All_TEXT); - setDataGraphic(); - } - - } - - }); - m_zoomModeBtn.setToolTipText(CLOUD_VIEW_NOT_ENABLED_TEXT); - } - - - - /** - * show in plotScatter, the cloud, usually be called when user change combo - * box selection
- * can be called by DataBoxMapAlignment - */ - public void setAlignmentCloud() { - this.m_loadIonsBtn.setToolTipText(CLOUD_REMOVE_TEXT); - this.m_loadIonsBtn.setIcon(IconManager.getIcon(IconManager.IconType.REMOVE_ALIGNMENT_CLOUD)); - this.m_zoomModeBtn.setToolTipText(CLOUD_VIEW_All_TEXT); - setEnabledCloudButtons(true); - this.setDataGraphic(); + graphicPanel.getXAxis().setTitle(xAxisTitle); + graphicPanel.getYAxis().setTitle(yAxisTitle); + graphicPanel.repaint(); } - public void setData(QuantChannelInfo quantChannelInfo, List compareDataInterfaceList, List crossSelectionInterfaceList) { + public void setData(QuantChannelInfo quantChannelInfo, List compareDataInterfaceList) { //@Karine XUE,when a databaseLoadTask or it's subTask is finished, the callback will be called in DataBox, //so this setData method can be called several time. m_isInitialized is used to limite the repetition if (!this.m_isInitialized) { @@ -471,7 +301,7 @@ public void setData(QuantChannelInfo quantChannelInfo, List(); + m_pMapByIndex = new HashMap<>(); String[] mapItems = new String[m_quantChannelInfo.getDataset().getMaps().size()]; int i = 0; for (ProcessedMap map : m_quantChannelInfo.getDataset().getMaps()) { @@ -482,7 +312,7 @@ public void setData(QuantChannelInfo quantChannelInfo, List"); mapItems[i] = sb.toString(); - m_mapName.put(i, map); + m_pMapByIndex.put(i, map); i++; } DefaultComboBoxModel sourceMapsModel = new DefaultComboBoxModel(mapItems); @@ -522,54 +352,21 @@ private String getAlignmentMethod() { } @Override - public void setDataBox(AbstractDataBox dataBox - ) { - m_dataBox = dataBox; - } - - @Override - public AbstractDataBox getDataBox() { - return m_dataBox; - } - - @Override - public void addSingleValue(Object v - ) { - // not used for the moment JPM.TODO ? - } - - @Override - public ActionListener getRemoveAction(SplittedPanelContainer splittedPanel - ) { - return m_dataBox.getRemoveAction(splittedPanel); - } - - @Override - public ActionListener getAddAction(SplittedPanelContainer splittedPanel - ) { - return m_dataBox.getAddAction(splittedPanel); - } - - @Override - public ActionListener getSaveAction(SplittedPanelContainer splittedPanel - ) { - return m_dataBox.getSaveAction(splittedPanel); - } - - private void convertTime() { + protected Double getCorrespondingData(Double time, Long mapId) { + Long targetMapId = getSelectedMapId(m_destMapsCB); + logger.debug("calculate time for " + time + " from source mapId=" + mapId + " to target MapId=" + targetMapId); + Double calcTime = Double.NaN; try { - Double time = Double.parseDouble(m_SourceTimeTF.getText()); - Double calcTime = calcTimeInMapAlign(time, getSelectedMapId(m_sourceMapsCB), getSelectedMapId(m_destMapsCB)); - if (calcTime.isNaN()) { - m_DestTimeTF.setText(""); - } else { - m_DestTimeTF.setText(format2.format(calcTime / 60)); - } - } catch (NumberFormatException ex) { + calcTime = MapAlignmentConverter.convertElutionTime(time * 60, mapId, targetMapId, m_allMapAlignments, m_quantChannelInfo.getDataset().getAlnReferenceMapId()); + logger.debug("...result= " + calcTime); + } catch (Exception e) { + logger.error("Error while retrieving time in map alignment: " + e); } + return (calcTime/ 60); //Back to minute } - private void setDataGraphic() { + + protected void setDataGraphic() { long mapIdSrc = getSelectedMapId(m_sourceMapsCB); long mapIdDst = getSelectedMapId(m_destMapsCB); if (mapIdSrc == mapIdDst) { @@ -584,16 +381,16 @@ private void setDataGraphic() { if (map != null) // exhaustive mode, or in Iterative mode, one of mapIdA,mapIdZ is the reference map { m_plotPanel2.setVisible(false); - setDataGraphicTableModel(map, m_alignmentGraphicPanel); + setDataGraphicTableModel(map, true);//m_alignmentGraphicPanel } else { //from source to reference map = MapAlignmentConverter.getMapAlgn(mapIdSrc, m_referenceMapId, m_allMapAlignments); if (map != null) { // in simple parameters extraction abundance, there is not any map Alignment - setDataGraphicTableModel(map, m_alignmentGraphicPanel); + setDataGraphicTableModel(map, true);//m_alignmentGraphicPanel //from reference to source map = MapAlignmentConverter.getMapAlgn(m_referenceMapId, mapIdDst, m_allMapAlignments); - setDataGraphicTableModel(map, m_alignmentGraphicPanel_2); + setDataGraphicTableModel(map, false);//m_alignmentGraphicPanel_2 m_plotPanel2.setVisible(true); this.m_splitPane.resetToPreferredSizes(); } @@ -601,87 +398,115 @@ private void setDataGraphic() { } } - private void setDataGraphicTableModel(MapAlignment map, BasePlotPanel graphicPanel) { - CrossSelectionInterface crossSelectionTableModel; - ExtendedTableModelInterface extendedTableModel; - Long mapIdSrc = map.getSourceMap().getId(); - Long mapIdDst = map.getDestinationMap().getId(); + private void setDataGraphicTableModel(MapAlignment mapAlignment, boolean toFirstPanel) { - MapTimePanel mapTimePanel; - List listMapTime = map.getMapTimeList(); - mapTimePanel = new MapTimePanel(); + Long mapIdSrc = mapAlignment.getSourceMap().getId(); + Long mapIdDst = mapAlignment.getDestinationMap().getId(); String mapTitleFrom = m_quantChannelInfo.getMapTitle(mapIdSrc); String mapTitleTo = m_quantChannelInfo.getMapTitle(mapIdDst); String title = "Map Alignment from " + mapTitleFrom + " (to. " + mapTitleTo + ")"; Color color = m_quantChannelInfo.getMapColor(mapIdDst); - mapTimePanel.setData((long) -1, map, listMapTime, color, title, true, mapTitleFrom, mapTitleTo);//set graphic content - crossSelectionTableModel = mapTimePanel.getCrossSelectionInterface(); - extendedTableModel = mapTimePanel.getGlobalTableModelInterface(); - double tolerance = ((DataboxMapAlignment) this.m_dataBox).getRT_Tolerance(); - PlotLinear alignmentCurve = new PlotLinear(graphicPanel, extendedTableModel, crossSelectionTableModel, - PlotBaseAbstract.COL_X_ID, PlotBaseAbstract.COL_Y_ID); + double crossAssignmentTimeTolerance = ((DataboxMapAlignment) this.m_dataBox).getCrossAssignmentTimeTolerance(); + double featureAlignmentTimeTolerance = ((DataboxMapAlignment) this.m_dataBox).getFeatureAlignmentTimeTolerance(); - alignmentCurve.setPlotInformation(extendedTableModel.getPlotInformation());//set Color - alignmentCurve.setStroke(3f); //set Stroke - alignmentCurve.setTolerance(tolerance); + ExtendedTableModelInterface extendedTableModel = new MapTimeTableModel(mapAlignment.getMapTimeList(), color, title, mapTitleFrom, mapTitleTo); + BasePlotPanel graphicPanel = toFirstPanel ? m_alignmentGraphicPanel : m_alignmentGraphicPanel_2; + PlotLinear alignmentCurve = new PlotLinear(graphicPanel, extendedTableModel,null, PlotBaseAbstract.COL_X_ID, PlotBaseAbstract.COL_Y_ID); + alignmentCurve.setPlotInformation(extendedTableModel.getPlotInformation()); + alignmentCurve.setStroke(3f); graphicPanel.setPlot(alignmentCurve); if (this.m_isIonsCloudLoaded) { + + if (crossAssignmentTimeTolerance > 0) { + + List timeList = mapAlignment.getMapTimeList(); + PlotInformation plotInformation = extendedTableModel.getPlotInformation(); + plotInformation.setDashed(true); + Map serializedPropsAsMap = null; + + try { + serializedPropsAsMap = mapAlignment.getSerializedPropertiesAsMap(); + } catch (Exception e) { + Exceptions.printStackTrace(e); + } + + List toleranceMapTime = serializedPropsAsMap == null ? null : (List)serializedPropsAsMap.get("tolerance_time_list"); + List newToleranceMapTime = new ArrayList<>(timeList.size()); + List maxToleranceTimeList = new ArrayList<>(timeList.size()); + List minToleranceTimeList = new ArrayList<>(timeList.size()); + for (int i = 0 ; i < timeList.size(); i++) { + MapTime mt = timeList.get(i); + double delta = toleranceMapTime != null ? toleranceMapTime.get(i) : crossAssignmentTimeTolerance; + maxToleranceTimeList.add(new MapTime(mt.getTime(), mt.getDeltaValue()+delta)); + minToleranceTimeList.add(new MapTime(mt.getTime(), mt.getDeltaValue()-delta)); + } + + PlotLinear maxDeltaRtCurve = getPlotLinear(graphicPanel, mapTitleFrom, mapTitleTo, title, color, plotInformation, maxToleranceTimeList); + graphicPanel.addPlot(maxDeltaRtCurve); + + PlotLinear minDeltaRtCurve = getPlotLinear(graphicPanel, mapTitleFrom, mapTitleTo, title, color, plotInformation, minToleranceTimeList); + graphicPanel.addPlot(minDeltaRtCurve); + + // temporarily add two additional curves at the tolerance value (because we cannot guess if the autoRT was ON or OFF + // and then if the stored tolerance_time_list was effectively used) + + // creates a new PlotInformation, with solid line + + plotInformation = extendedTableModel.getPlotInformation(); + plotInformation.setDashed(false); + + maxToleranceTimeList = new ArrayList<>(timeList.size()); + minToleranceTimeList = new ArrayList<>(timeList.size()); + for (int i = 0 ; i < timeList.size(); i++) { + MapTime mt = timeList.get(i); + maxToleranceTimeList.add(new MapTime(mt.getTime(), mt.getDeltaValue()+crossAssignmentTimeTolerance)); + minToleranceTimeList.add(new MapTime(mt.getTime(), mt.getDeltaValue()-crossAssignmentTimeTolerance)); + } + + maxDeltaRtCurve = getPlotLinear(graphicPanel, mapTitleFrom, mapTitleTo, title, color, plotInformation, maxToleranceTimeList); + graphicPanel.addPlot(maxDeltaRtCurve); + + minDeltaRtCurve = getPlotLinear(graphicPanel, mapTitleFrom, mapTitleTo, title, color, plotInformation, minToleranceTimeList); + graphicPanel.addPlot(minDeltaRtCurve); + + } + + IonsRTTableModel cloudData = getCloudData(mapIdSrc); if (cloudData != null) { int axisX = cloudData.getColumnIndex(mapIdSrc); int axisY = cloudData.getColumnIndex(mapIdDst); m_removeLoessCurveBtn.setEnabled(false); - m_ionsScatterPlot = new IonsRTScatterPlot(graphicPanel, cloudData, null, axisX, axisY); - m_ionsScatterPlot.showCrossAssignedIons(m_showHideCrossAssigned.getActionCommand().equals("HIDE")); - m_ionsScatterPlot.setColor(color); + + IonsRTScatterPlot ionsScatterPlot = new IonsRTScatterPlot(graphicPanel, cloudData, null, axisX, axisY); + ionsScatterPlot.showCrossAssignedIons(m_showHideCrossAssigned.getActionCommand().equals("HIDE")); + ionsScatterPlot.setColor(color); + ionsScatterPlot.setFeatureAlignmentTimeTolerance(featureAlignmentTimeTolerance); if (m_zoomMode == CLOUD_VIEW_BEST_FIT) { //set visible Min Max, the real Min Max are too large to show the alignment PlotLinear double yMax = alignmentCurve.getYMax(); double yMin = alignmentCurve.getYMin(); - m_ionsScatterPlot.setYMax(yMax + 2 * tolerance); - m_ionsScatterPlot.setYMin(yMin - 2 * tolerance); + ionsScatterPlot.setYMax(yMax + 2 * crossAssignmentTimeTolerance); + ionsScatterPlot.setYMin(yMin - 2 * crossAssignmentTimeTolerance); } - graphicPanel.setPlot(m_ionsScatterPlot); - graphicPanel.addPlot(alignmentCurve, true); + if(toFirstPanel) + m_ionsScatterPlot = ionsScatterPlot; + else + m_ionsScatterPlot2 = ionsScatterPlot; + graphicPanel.addPlot(ionsScatterPlot); } } graphicPanel.repaint(); } - private IonsRTTableModel getCloudData(long mapIdSrc) { - if (this.m_dataBox.isLoaded()) { - return ((DataboxMapAlignment) this.m_dataBox).getPeptideCloud(mapIdSrc); - } else { - return null; - } - } - - private Long getSelectedMapId(JComboBox cb) { - if (cb == null) { - return (long) -1; - } else { - int selId = cb.getSelectedIndex(); - if (m_mapName.containsKey(selId)) { - return m_mapName.get(selId).getId(); - } else { - return (long) -1;//should not happen - } - } - } - - private Double calcTimeInMapAlign(Double time, Long sourceMapId, Long targetMapId) { - logger.debug("calculate time for " + time + " from source mapId=" + sourceMapId + " to target MapId=" + targetMapId); - Double calcTime = Double.NaN; - try { - calcTime = MapAlignmentConverter.convertElutionTime(time * 60, sourceMapId, targetMapId, m_allMapAlignments, m_quantChannelInfo.getDataset().getAlnReferenceMapId()); - logger.debug("...result= " + calcTime); - } catch (Exception e) { - logger.error("Error while retrieving time in map alignment: " + e); - } - return calcTime; + private PlotLinear getPlotLinear(BasePlotPanel graphicPanel, String mapTitleFrom, String mapTitleTo, String title, Color color, PlotInformation plotInformation, List minDeltaRt) { + ExtendedTableModelInterface minExtendedTableModel = new MapTimeTableModel(minDeltaRt, color, title, mapTitleFrom, mapTitleTo); + PlotLinear minDeltaRtCurve = new PlotLinear(graphicPanel, minExtendedTableModel, null, PlotBaseAbstract.COL_X_ID, PlotBaseAbstract.COL_Y_ID); + minDeltaRtCurve.setPlotInformation(plotInformation); + return minDeltaRtCurve; } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapMozAlignmentPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapMozAlignmentPanel.java new file mode 100644 index 000000000..bcc1a83d1 --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapMozAlignmentPanel.java @@ -0,0 +1,220 @@ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.gui.xic; + +import fr.proline.core.orm.lcms.MapTime; +import fr.proline.core.orm.lcms.ProcessedMap; +import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; +import fr.proline.studio.graphics.PlotBaseAbstract; +import fr.proline.studio.graphics.PlotLinear; +import fr.proline.studio.pattern.xic.DataboxMapAlignment; +import fr.proline.studio.rsmexplorer.gui.dialog.xic.AbstractLabelFreeMSParamsPanel; +import fr.proline.studio.rsmexplorer.gui.xic.alignment.IonsRTScatterPlot; +import fr.proline.studio.rsmexplorer.gui.xic.alignment.IonsRTTableModel; + +import javax.swing.*; +import java.awt.*; +import java.util.*; +import java.util.List; + + +/** + * map alignment panel for 1 dataset + * + * @author MB243701 + */ +public class MapMozAlignmentPanel extends AbstractMapAlignmentPanel { + + //data to display + private Map m_pMapById; + + + public MapMozAlignmentPanel(DataboxMapAlignment dataBox) { + super(dataBox," moz "); + } + + @Override + protected String getTitleLabel() { + return "Reference Map: ■ " + + " map  , Alignment Mode : I/H) "; + } + + @Override + protected List getMoreCloudButtons() { + return new ArrayList<>(); + } + + @Override + protected JPanel createConvertPanel() { + JPanel moz2DeltaPanel = new JPanel(); + moz2DeltaPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); + + moz2DeltaPanel.add(m_srcTimeValueTF); +// m_srcTimeValueTF.setEditable(false); + moz2DeltaPanel.add(new JLabel("(min) in ")); + m_sourceMapsCB.setName("cbSourceMaps"); + moz2DeltaPanel.add(m_sourceMapsCB); + moz2DeltaPanel.add(new JLabel(" correspond to")); + m_destValueTF = new JTextField(10); + m_destValueTF.setName("tfDestTime"); + m_destValueTF.setEditable(false); + moz2DeltaPanel.add(m_destValueTF); + moz2DeltaPanel.add(new JLabel(" delta moz ")); + + return moz2DeltaPanel; + } + + + @Override + public void setData(QuantChannelInfo quantChannelInfo, List compareDataInterfaceList) { + if (!this.m_isInitialized) { + + this.m_quantChannelInfo = quantChannelInfo; + m_pMapByIndex = new HashMap<>(); + m_pMapById = new HashMap<>(); + + String[] mapItems = new String[m_quantChannelInfo.getDataset().getMaps().size()]; + int i = 0; + for (ProcessedMap map : m_quantChannelInfo.getDataset().getMaps()) { + String mapTitle = m_quantChannelInfo.getMapTitle(map.getId()); + StringBuilder sb = new StringBuilder(); + String mapColor = m_quantChannelInfo.getMapHtmlColor(map.getId()); + sb.append("■ "); + sb.append(mapTitle); + sb.append(""); + mapItems[i] = sb.toString(); + m_pMapByIndex.put(i, map); + m_pMapById.put(map.getId(), map); + i++; + } + + + StringBuilder sb = new StringBuilder(); + sb.append(" Alignment Smooting Mode : "); + sb.append(this.getAlignmentSmoothingMethod()); + sb.append(""); + m_labelTitle.setText(sb.toString()); + + DefaultComboBoxModel sourceMapsModel = new DefaultComboBoxModel(mapItems); + m_sourceMapsCB.setModel(sourceMapsModel); + if (mapItems.length > 0) { + sourceMapsModel.setSelectedItem(mapItems[0]); + } + setDataGraphic(); + this.m_isInitialized = true; + repaint(); + } + } + + /** + * info to show above the map alignment curve + * + * @return + */ + private String getAlignmentSmoothingMethod() { + String method = "unknown"; + Map quantParams; + try { + quantParams = m_quantChannelInfo.getDataset().getQuantProcessingConfigAsMap(); + if (quantParams.containsKey(AbstractLabelFreeMSParamsPanel.ALIGNMENT_CONFIG)) { + Map alignmentConfig = (Map) quantParams.get(AbstractLabelFreeMSParamsPanel.ALIGNMENT_CONFIG); + method = (String) alignmentConfig.getOrDefault(AbstractLabelFreeMSParamsPanel.ALIGNMENT_SMOOTHING_METHOD_NAME, "unknown"); + } + return method; + } catch (Exception e) { + return "unknown alignment method exception "; + } + } + + @Override + protected Double getCorrespondingData(Double time, Long mapId) { + Double timeInSeconds = time*60; + logger.debug("calculate delta moz at RT " + timeInSeconds + " for mapId=" + mapId); + Double calcDeltaMoz = Double.NaN; + try { + ProcessedMap pMap = m_pMapById.get(mapId); + if(pMap.getProcessedMapMozCalibration() != null && pMap.getProcessedMapMozCalibration().size()>0) { + List mapMozs = pMap.getProcessedMapMozCalibration().get(0).getProcessedMapMozList(); + mapMozs.sort(Comparator.comparing(MapTime::getTime)); + int index; + + for(index = 0; index < mapMozs.size(); index++){ + if (mapMozs.get(index).getTime()> timeInSeconds){ + break; + } + } + + if(index < mapMozs.size()) + calcDeltaMoz = mapMozs.get(index).getDeltaValue();// VOIR pour regression lineaire + } + logger.debug("...result= " + calcDeltaMoz); + } catch (Exception e) { + logger.error("Error while retrieving time in map calibration: " + e); + } + //Displayed deltaMoz is inverted compare to store deltaMoz ! + return -calcDeltaMoz; + } + + protected void setDataGraphic() { + long mapIdSrc = getSelectedMapId(m_sourceMapsCB); + ProcessedMap pMap = m_pMapById.get(mapIdSrc); + + String mapTitle = m_quantChannelInfo.getMapTitle(mapIdSrc); + String title = "MoZ calibration for " + mapTitle; + Color color = m_quantChannelInfo.getMapColor(mapIdSrc); + + double crossAssignmentTimeTolerance = ((DataboxMapAlignment) this.m_dataBox).getCrossAssignmentTimeTolerance(); + double featureAlignmentTimeTolerance = ((DataboxMapAlignment) this.m_dataBox).getFeatureAlignmentTimeTolerance(); + + if(pMap.getProcessedMapMozCalibration() != null && pMap.getProcessedMapMozCalibration().size()>0) { + ExtendedTableModelInterface extendedTableModel = new MapTimeTableModel(pMap.getProcessedMapMozCalibration().get(0).getProcessedMapMozList(), color, title, mapTitle); + + PlotLinear alignmentCurve = new PlotLinear(m_alignmentGraphicPanel, extendedTableModel, null, PlotBaseAbstract.COL_X_ID, PlotBaseAbstract.COL_Y_ID); + alignmentCurve.setPlotInformation(extendedTableModel.getPlotInformation()); + alignmentCurve.setStroke(3f); + m_alignmentGraphicPanel.setPlot(alignmentCurve); + if (this.m_isIonsCloudLoaded) { + IonsRTTableModel cloudData = getCloudData(mapIdSrc); + if (cloudData != null) { + int axisX = IonsRTTableModel.ELUTION_TIME_FROM_COL_INDEX; + int axisY = IonsRTTableModel.DELTA_MOZ_COL_INDEX; + m_ionsScatterPlot = new IonsRTScatterPlot(m_alignmentGraphicPanel, cloudData, null, axisX, axisY); + m_ionsScatterPlot.showCrossAssignedIons(m_showHideCrossAssigned.getActionCommand().equals("HIDE")); + m_ionsScatterPlot.setColor(color); + m_ionsScatterPlot.setFeatureAlignmentTimeTolerance(featureAlignmentTimeTolerance); + if (m_zoomMode == CLOUD_VIEW_BEST_FIT) { + //set visible Min Max, the real Min Max are too large to show the alignment PlotLinear + double yMax = alignmentCurve.getYMax(); + double yMin = alignmentCurve.getYMin(); + m_ionsScatterPlot.setYMax(yMax + 2 * crossAssignmentTimeTolerance); + m_ionsScatterPlot.setYMin(yMin - 2 * crossAssignmentTimeTolerance); + } + m_alignmentGraphicPanel.addPlot(m_ionsScatterPlot); + } + } + + } else { + m_alignmentGraphicPanel.clearPlotsWithRepaint(); + + } + m_alignmentGraphicPanel.repaint(); + + } + + +} + diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapTableModel.java deleted file mode 100644 index 05ad4bba7..000000000 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapTableModel.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.gui.xic; - -import fr.proline.core.orm.lcms.Map; -import fr.proline.studio.extendedtablemodel.ExtraDataType; -import fr.proline.studio.export.ExportFontData; -import fr.proline.studio.filter.Filter; -import fr.proline.studio.graphics.PlotInformation; -import fr.proline.studio.graphics.PlotType; -import fr.proline.studio.extendedtablemodel.CompoundTableModel; -import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; -import fr.proline.studio.filter.StringDiffFilter; -import fr.proline.studio.table.LazyData; -import fr.proline.studio.table.LazyTable; -import fr.proline.studio.table.LazyTableModel; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import javax.swing.table.TableCellRenderer; - -/** - * - * @author JM235353 - */ -public class MapTableModel extends LazyTableModel implements GlobalTableModelInterface { - - public static final int COLTYPE_MAP_ID = 0; - public static final int COLTYPE_MAP_NAME = 1; - public static final int COLTYPE_MAP_DESCRIPTION = 2; - public static final int COLTYPE_MAP_CREATION_DATE = 3; - - private static final String[] m_columnNames = {"Id", "Name", "Description", "Creation Date"}; - private static final String[] m_toolTipColumns = {"Map Id", "Name", "Description", "Creation Date"}; - - private List m_maps = null; - - public MapTableModel(LazyTable table) { - super(table); - } - - @Override - public int getColumnCount() { - return m_columnNames.length; - } - - @Override - public String getColumnName(int col) { - return m_columnNames[col]; - } - - @Override - public String getExportColumnName(int col) { - return m_columnNames[col]; - } - - @Override - public String getToolTipForHeader(int col) { - return m_toolTipColumns[col]; - } - - @Override - public String getTootlTipValue(int row, int col) { - return null; - } - - @Override - public Class getColumnClass(int col) { - if (col == COLTYPE_MAP_ID) { - return Long.class; - } - return LazyData.class; - } - - @Override - public int getSubTaskId(int col) { - return -1; - } - - @Override - public int getRowCount() { - if (m_maps == null) { - return 0; - } - - return m_maps.size(); - } - - - - @Override - public Object getValueAt(int row, int col) { - - - // Retrieve map - Map amap = m_maps.get(row); - - switch (col) { - case COLTYPE_MAP_ID: { - return amap.getId(); - } - case COLTYPE_MAP_NAME: { - LazyData lazyData = getLazyData(row, col); - lazyData.setData(amap.getName()); - return lazyData; - } - case COLTYPE_MAP_DESCRIPTION: { - LazyData lazyData = getLazyData(row, col); - lazyData.setData(amap.getDescription()); - return lazyData; - } - case COLTYPE_MAP_CREATION_DATE: { - LazyData lazyData = getLazyData(row, col); - lazyData.setData(amap.getCreationTimestamp()); - return lazyData; - } - } - return null; // should never happen - } - - public void setData(Long taskId, List maps) { - this.m_maps = maps; - - m_taskId = taskId; - - fireTableDataChanged(); - - - } - - public void dataUpdated() { - // no need to do an updateMinMax : scores are known at once - fireTableDataChanged(); - - } - - public Map getMap(int i) { - - return m_maps.get(i); - } - - public int findRow(long mapId) { - - int nb = m_maps.size(); - for (int i = 0; i < nb; i++) { - if (mapId == m_maps.get(i).getId()) { - return i; - } - } - return -1; - - } - - public void sortAccordingToModel(ArrayList mapIds, CompoundTableModel compoundTableModel) { - - if (m_maps == null) { - // data not loaded - return; - } - - HashSet mapIdMap = new HashSet<>(mapIds.size()); - mapIdMap.addAll(mapIds); - - int nb = m_table.getRowCount(); - int iCur = 0; - for (int iView = 0; iView < nb; iView++) { - int iModel = m_table.convertRowIndexToModel(iView); - if (compoundTableModel != null) { - iModel = compoundTableModel.convertCompoundRowToBaseModelRow(iModel); - } - // Retrieve Map - Map m = getMap(iModel); - if (mapIdMap.contains(m.getId())) { - mapIds.set(iCur++, m.getId()); - } - } - - } - - - @Override - public void addFilters(LinkedHashMap filtersMap) { - - filtersMap.put(COLTYPE_MAP_NAME, new StringDiffFilter(getColumnName(COLTYPE_MAP_NAME), null, COLTYPE_MAP_NAME)); - filtersMap.put(COLTYPE_MAP_DESCRIPTION, new StringDiffFilter(getColumnName(COLTYPE_MAP_DESCRIPTION), null, COLTYPE_MAP_DESCRIPTION)); - - } - - - @Override - public String getDataColumnIdentifier(int columnIndex) { - return null; // not needed - } - - @Override - public Class getDataColumnClass(int columnIndex) { - return null; // not needed - } - - @Override - public Object getDataValueAt(int rowIndex, int columnIndex) { - return null; // not needed - } - - @Override - public int[] getKeysColumn() { - return null; // not needed - } - - @Override - public int getInfoColumn() { - return -1; // not needed - } - - @Override - public void setName(String name) { - // not needed - } - - @Override - public String getName() { - return null; // not needed - } - - @Override - public java.util.Map getExternalData() { - return null; // not needed - } - - @Override - public PlotInformation getPlotInformation() { - return null; // not needed - } - - - @Override - public PlotType getBestPlotType() { - return null; - } - - @Override - public int[] getBestColIndex(PlotType plotType) { - return null; - } - - @Override - public int getLoadingPercentage() { - return m_table.getLoadingPercentage(); - } - - @Override - public boolean isLoaded() { - return m_table.isLoaded(); - } - - @Override - public String getExportRowCell(int row, int col) { - return null; // no specific export - } - - @Override - public ArrayList getExportFonts(int row, int col) { - return null; - } - - @Override - public TableCellRenderer getRenderer(int row, int col) { - return null; - } - - @Override - public GlobalTableModelInterface getFrozzenModel() { - return this; - } - - @Override - public ArrayList getExtraDataTypes() { - ArrayList list = new ArrayList<>(); - list.add(new ExtraDataType(Map.class, true)); - registerSingleValuesAsExtraTypes(list); - return list; - } - - @Override - public Object getValue(Class c) { - return getSingleValue(c); - } - - @Override - public Object getRowValue(Class c, int row) { - if (c.equals(Map.class)) { - return m_maps.get(row); - } - return null; - } - - @Override - public Object getColValue(Class c, int col) { - return null; - } - -} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapTimePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapTimePanel.java deleted file mode 100644 index e32923497..000000000 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapTimePanel.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.gui.xic; - -import fr.proline.core.orm.lcms.MapAlignment; -import fr.proline.core.orm.lcms.MapTime; -import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; -import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.graphics.CrossSelectionInterface; -import fr.proline.studio.gui.HourglassPanel; -import fr.proline.studio.gui.SplittedPanelContainer; -import fr.proline.studio.markerbar.MarkerContainerPanel; -import fr.proline.studio.pattern.AbstractDataBox; -import fr.proline.studio.pattern.DataBoxPanelInterface; -import fr.proline.studio.extendedtablemodel.CompoundTableModel; -import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; -import fr.proline.studio.table.LazyTable; -import fr.proline.studio.table.TablePopupMenu; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ActionListener; -import java.util.List; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JToolBar; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.TableModelListener; -import org.jdesktop.swingx.JXTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * map alignement data - * - * @author MB243701 - */ -public class MapTimePanel extends HourglassPanel implements DataBoxPanelInterface, GlobalTabelModelProviderInterface { - - private static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); - private AbstractDataBox m_dataBox; - - private JScrollPane m_timeScrollPane; - private MapAlignmentTable m_timeTable; - private MarkerContainerPanel m_markerContainerPanel; - - public MapTimePanel() { - super(); - initComponents(); - } - - private void initComponents() { - setLayout(new BorderLayout()); - JPanel expDesignPanel = createMapAlignmentPanel(); - this.add(expDesignPanel, BorderLayout.CENTER); - } - - private JPanel createMapAlignmentPanel() { - JPanel mapAlignmentPanel = new JPanel(); - mapAlignmentPanel.setBounds(0, 0, 500, 400); - mapAlignmentPanel.setLayout(new BorderLayout()); - - JPanel internalPanel = createInternalPanel(); - - JToolBar toolbar = initToolbar(); - mapAlignmentPanel.add(toolbar, BorderLayout.WEST); - mapAlignmentPanel.add(internalPanel, BorderLayout.CENTER); - return mapAlignmentPanel; - } - - private JToolBar initToolbar() { - JToolBar toolbar = new JToolBar(JToolBar.VERTICAL); - toolbar.setFloatable(false); - return toolbar; - } - - private JPanel createInternalPanel() { - JPanel internalPanel = new JPanel(); - - internalPanel.setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - c.anchor = GridBagConstraints.NORTHWEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new java.awt.Insets(5, 5, 5, 5); - // create objects - m_timeScrollPane = new JScrollPane(); - - m_timeTable = new MapAlignmentTable(); - m_timeTable.setModel(new CompoundTableModel(new MapTimeTableModel((LazyTable) m_timeTable), true)); - - m_timeTable.setSortable(false); - - m_markerContainerPanel = new MarkerContainerPanel(m_timeScrollPane, m_timeTable); - - m_timeScrollPane.setViewportView(m_timeTable); - m_timeTable.setFillsViewportHeight(true); - m_timeTable.setViewport(m_timeScrollPane.getViewport()); - - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 1; - c.gridwidth = 3; - internalPanel.add(m_markerContainerPanel, c); - return internalPanel; - } - - @Override - public void setDataBox(AbstractDataBox dataBox) { - m_dataBox = dataBox; - } - - @Override - public AbstractDataBox getDataBox() { - return m_dataBox; - } - - @Override - public ActionListener getRemoveAction(SplittedPanelContainer splittedPanel) { - return m_dataBox.getRemoveAction(splittedPanel); - } - - @Override - public ActionListener getAddAction(SplittedPanelContainer splittedPanel) { - return m_dataBox.getAddAction(splittedPanel); - } - - @Override - public ActionListener getSaveAction(SplittedPanelContainer splittedPanel) { - return m_dataBox.getSaveAction(splittedPanel); - } - - - public void setData(Long taskId, MapAlignment mapAlignment, List mapTimes, Color color, String title, boolean finished, String fromMapName) { - this.setData(taskId, mapAlignment, mapTimes, color, title, finished, fromMapName, ""); - } - - /** - * - * @param taskId - * @param mapAlignment - * @param mapTimes - * @param color - * @param title - * @param finished - * @param fromMapNamethe map Name will be shown in the AxisX of the curve - * @param toMapName map Name will be shown in the AxisY of the curve - */ - public void setData(Long taskId, MapAlignment mapAlignment, List mapTimes, Color color, String title, boolean finished, String fromMapName, String toMapName) { - ((MapTimeTableModel) ((CompoundTableModel) m_timeTable.getModel()).getBaseModel()).setData(taskId, mapAlignment, mapTimes, color, title, fromMapName, toMapName); - - // select the first row - if ((mapTimes != null) && (mapTimes.size() > 0)) { - m_timeTable.getSelectionModel().setSelectionInterval(0, 0); - m_markerContainerPanel.setMaxLineNumber(mapTimes.size()); - } - if (finished) { - m_timeTable.setSortable(true); - } - - } - - public void dataUpdated(SubTask subTask, boolean finished) { - updateData(); - } - - private void updateData() { - - } - - @Override - public CrossSelectionInterface getCrossSelectionInterface() { - return m_timeTable; - } - - @Override - public void addSingleValue(Object v) { - getGlobalTableModelInterface().addSingleValue(v); - } - - @Override - public GlobalTableModelInterface getGlobalTableModelInterface() { - return (GlobalTableModelInterface) m_timeTable.getModel(); - } - - @Override - public JXTable getGlobalAssociatedTable() { - return m_timeTable; - } - - private class MapAlignmentTable extends LazyTable { - - public MapAlignmentTable() { - super(m_timeScrollPane.getVerticalScrollBar()); - } - - @Override - public void addTableModelListener(TableModelListener l) { - getModel().addTableModelListener(l); - } - - /** - * Called whenever the value of the selection changes. - * - * @param e the event that characterizes the change. - */ - @Override - public void valueChanged(ListSelectionEvent e) { - - super.valueChanged(e); - - if (selectionWillBeRestored) { - return; - } - - if (e.getValueIsAdjusting()) { - // value is adjusting, so valueChanged will be called again - return; - } - - if (m_dataBox != null) { - m_dataBox.addDataChanged(MapAlignment.class); - m_dataBox.propagateDataChanged(); - } - - } - - public void dataUpdated(SubTask subTask, boolean finished) { - - LazyTable.LastAction keepLastAction = m_lastAction; - try { - // retrieve selected row - int rowSelected = getSelectionModel().getMinSelectionIndex(); - int rowSelectedInModel = (rowSelected == -1) ? -1 : convertRowIndexToModel(rowSelected); - - // Update Model (but protein set table must not react to the model update) - selectionWillBeRestored(true); - try { - ((MapTimeTableModel) (((CompoundTableModel) getModel()).getBaseModel())).dataUpdated(); - } finally { - selectionWillBeRestored(false); - } - - // restore selected row - if (rowSelectedInModel != -1) { - int rowSelectedInView = convertRowIndexToView(rowSelectedInModel); - //getSelectionModel().setSelectionInterval(rowSelectedInView, rowSelectedInView); - setSelection(rowSelectedInView); - - // if the subtask correspond to the loading of the data of the sorted column, - // we keep the row selected visible - if (((keepLastAction == LazyTable.LastAction.ACTION_SELECTING) || (keepLastAction == LazyTable.LastAction.ACTION_SORTING)) && (subTask.getSubTaskId() == ((CompoundTableModel) getModel()).getSubTaskId(getSortedColumnIndex()))) { - scrollRowToVisible(rowSelectedInView); - } - - } - - } finally { - - m_lastAction = keepLastAction; - - } - - if (finished) { - setSortable(true); - } - } - - @Override - public void sortingChanged(int col) { - } - - public void selectionWillBeRestored(boolean b) { - selectionWillBeRestored = b; - } - private boolean selectionWillBeRestored = false; - - @Override - public int getLoadingPercentage() { - return m_dataBox.getLoadingPercentage(); - } - - @Override - public boolean isLoaded() { - return m_dataBox.isLoaded(); - } - - @Override - public TablePopupMenu initPopupMenu() { - return null; - } - - // set as abstract - @Override - public void prepostPopupMenu() { - // nothing to do - } - - } -} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapTimeTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapTimeTableModel.java index 89483c0c4..20717cc3d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapTimeTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/MapTimeTableModel.java @@ -1,79 +1,92 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.xic; -import fr.proline.core.orm.lcms.MapAlignment; import fr.proline.core.orm.lcms.MapTime; +import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; import fr.proline.studio.extendedtablemodel.ExtraDataType; -import fr.proline.studio.export.ExportFontData; -import fr.proline.studio.filter.DoubleFilter; -import fr.proline.studio.filter.Filter; +import fr.proline.studio.graphics.PlotDataSpec; import fr.proline.studio.graphics.PlotInformation; -import fr.proline.studio.graphics.PlotType; -import fr.proline.studio.table.renderer.DefaultRightAlignRenderer; -import fr.proline.studio.table.renderer.DoubleRenderer; -import fr.proline.studio.rsmexplorer.gui.renderer.TimeRenderer; -import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; -import fr.proline.studio.table.LazyData; -import fr.proline.studio.table.LazyTable; -import fr.proline.studio.table.LazyTableModel; -import fr.proline.studio.table.TableDefaultRendererManager; -import java.awt.Color; + +import java.awt.*; import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import javax.swing.table.TableCellRenderer; /** - * map alignment table model (table not displayed, only used for graphic) + * map RT alignment on delta of value table model * - * @author MB243701 + * @author CB205360 */ -public class MapTimeTableModel extends LazyTableModel implements GlobalTableModelInterface { +public class MapTimeTableModel implements ExtendedTableModelInterface { - public static final int COLTYPE_TIME = 0; - public static final int COLTYPE_DELTA_TIME = 1; - private String[] m_columnNames; - private static final String[] m_toolTipColumns = {"Time (min)", "Delta time (s)"}; + protected List m_mapValues = null; + public static final int COLTYPE_VALUE = 0; + public static final int COLTYPE_DELTA_VALUE = 1; - private MapAlignment m_mapAlignment; - private List m_mapTimes = null; - private Color m_color = null; - private String m_title = null; + protected String[] m_columnNames = {"Value in Map", "Delta value"}; - private final HashMap m_rendererMap = new HashMap(); - private String m_modelName; + protected Color m_color; + protected String m_title; - public MapTimeTableModel(LazyTable table) { - super(table); - m_columnNames = new String[]{"Time in Reference Map (min)", "Delta time (s)"}; - } + private boolean m_inverseDeltaSign = false;//VDS WART: To have delta ppm from moz calibration and peptide delta moz with same "sign" - @Override - public int getSubTaskId(int col) { - return -1; + /** + * Create a MapTableModel for a single map. + * This is called when delta value to display are moz + * + * @param mapTimes : value to represent as MapTime list + * @param color : color to use for plot representation + * @param title : plot title + * @param mapName : name of represented map + */ + public MapTimeTableModel(List mapTimes, Color color, String title, String mapName) { + m_mapValues = mapTimes; + m_color = color; + m_title = title; + m_inverseDeltaSign = true; + m_columnNames[0] = "Time in Map (min)"; + m_columnNames[1] = "Delta moz (experimental - theoretical)" ; + } + + /** + * Create a MapTableModel with 2 different maps + * This is called when delta value to display are time + * + * @param mapTimes : value to represent as MapTime list + * @param color : color to use for plot representation + * @param title : plot title + * @param fromMapName : first map name + * @param toMapName : compared map name + */ + public MapTimeTableModel(List mapTimes, Color color, String title, String fromMapName, String toMapName) { + m_mapValues = mapTimes; + m_color = color; + m_title = title; + + m_columnNames[0] = "Time in Map " + fromMapName + " (min)"; + m_columnNames[1] = "Delta time to Map " + toMapName + " (s)"; } + @Override public int getRowCount() { - return m_mapTimes == null ? 0 : m_mapTimes.size(); + return m_mapValues == null ? 0 : m_mapValues.size(); } @Override @@ -81,76 +94,17 @@ public int getColumnCount() { return m_columnNames.length; } - @Override - public String getColumnName(int col) { - return m_columnNames[col]; - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - // Retrieve MapTime - MapTime mapTime = m_mapTimes.get(rowIndex); - - switch (columnIndex) { - case COLTYPE_TIME: { - LazyData lazyData = getLazyData(rowIndex, columnIndex); - lazyData.setData(mapTime.getTime()); - return lazyData; - - } - case COLTYPE_DELTA_TIME: { - LazyData lazyData = getLazyData(rowIndex, columnIndex); - lazyData.setData(mapTime.getDeltaTime()); - return lazyData; - - } - } - return null; // should never happen - } - - @Override - public String getToolTipForHeader(int col) { - return m_toolTipColumns[col]; - } - - @Override - public String getTootlTipValue(int row, int col) { - return null; - } - - @Override - public TableCellRenderer getRenderer(int row, int col) { - if (m_rendererMap.containsKey(col)) { - return m_rendererMap.get(col); - } - - TableCellRenderer renderer = null; - - switch (col) { - case COLTYPE_TIME: { - renderer = new TimeRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class))); - break; - } - case COLTYPE_DELTA_TIME: { - renderer = new DoubleRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class))); - break; - } - } - - m_rendererMap.put(col, renderer); - return renderer; - } @Override public String getDataColumnIdentifier(int columnIndex) { - return getColumnName(columnIndex); + return m_columnNames[columnIndex]; } @Override public Class getDataColumnClass(int columnIndex) { switch (columnIndex) { - case COLTYPE_TIME: - case COLTYPE_DELTA_TIME: + case COLTYPE_VALUE: + case COLTYPE_DELTA_VALUE: return Double.class; } return null; // should not happen @@ -159,40 +113,49 @@ public Class getDataColumnClass(int columnIndex) { @Override public Object getDataValueAt(int rowIndex, int columnIndex) { // Retrieve MapTime - MapTime mapTime = m_mapTimes.get(rowIndex); + MapTime mapTime = m_mapValues.get(rowIndex); switch (columnIndex) { - case COLTYPE_TIME: { + case COLTYPE_VALUE: { return mapTime.getTime() / 60; } - case COLTYPE_DELTA_TIME: { - return mapTime.getDeltaTime(); + case COLTYPE_DELTA_VALUE: { + if(m_inverseDeltaSign) + return -mapTime.getDeltaValue(); + return mapTime.getDeltaValue(); } } return null; // should never happen } + @Override + public Object getRowValue(Class c, int row) { + if (c.equals(MapTime.class)) { + return m_mapValues.get(row); + } + return null; + } + @Override public int[] getKeysColumn() { - int[] keys = {COLTYPE_TIME}; - return keys; + return new int[]{ COLTYPE_VALUE }; } @Override public int getInfoColumn() { - return COLTYPE_TIME; + return COLTYPE_VALUE; } @Override public void setName(String name) { - m_modelName = name; + throw new UnsupportedOperationException("Not supported yet."); } @Override public String getName() { - return m_modelName; + return "Signal"; } @Override @@ -200,6 +163,7 @@ public Map getExternalData() { return null; } + @Override public PlotInformation getPlotInformation() { PlotInformation plotInformation = new PlotInformation(); @@ -209,111 +173,45 @@ public PlotInformation getPlotInformation() { plotInformation.setDrawGap(true); return plotInformation; } - - @Override - public void addFilters(LinkedHashMap filtersMap) { - filtersMap.put(COLTYPE_TIME, new DoubleFilter(getColumnName(COLTYPE_TIME), null, COLTYPE_TIME)); - filtersMap.put(COLTYPE_DELTA_TIME, new DoubleFilter(getColumnName(COLTYPE_DELTA_TIME), null, COLTYPE_DELTA_TIME)); - } - - @Override - public boolean isLoaded() { - return m_table.isLoaded(); - } - - @Override - public int getLoadingPercentage() { - return m_table.getLoadingPercentage(); - } - - @Override - public PlotType getBestPlotType() { - return PlotType.LINEAR_PLOT; - } - @Override - public int[] getBestColIndex(PlotType plotType) { - - switch (plotType) { - case LINEAR_PLOT: { - int[] cols = new int[2]; - cols[0] = COLTYPE_TIME; - cols[1] = COLTYPE_DELTA_TIME; - return cols; - } - } + public ArrayList getExtraDataTypes() { return null; } @Override - public String getExportRowCell(int row, int col) { - return null; // no specific export + public Object getValue(Class c) { + return getSingleValue(c); } @Override - public ArrayList getExportFonts(int row, int col) { + public Object getColValue(Class c, int col) { return null; } @Override - public String getExportColumnName(int col) { - return m_columnNames[col]; - } - - public void setData(Long taskId, MapAlignment mapAlignment, List mapTimes, Color color, String title) { - this.setData(taskId, mapAlignment, mapTimes, color, title, "(Reference map)", ""); - } - - public void setData(Long taskId, MapAlignment mapAlignment, List mapTimes, Color color, String title, String fromMapName) { - this.setData(taskId, mapAlignment, mapTimes, color, title, fromMapName, ""); - } - - public void setData(Long taskId, MapAlignment mapAlignment, List mapTimes, Color color, String title, String fromMapName, String toMapName) { - m_mapAlignment = mapAlignment; - m_mapTimes = mapTimes; - m_color = color; - m_title = title; - m_taskId = taskId; - m_columnNames[0] = "Time in Map " + fromMapName + " (min)"; - m_columnNames[1] = "Delta time in Map " + toMapName + " (s)"; - fireTableDataChanged(); - } - - public void dataUpdated() { - // no need to do an updateMinMax : scores are known at once - fireTableDataChanged(); + public void addSingleValue(Object v) { } @Override - public GlobalTableModelInterface getFrozzenModel() { - return this; + public Object getSingleValue(Class c) { + return null; } @Override - public ArrayList getExtraDataTypes() { - ArrayList list = new ArrayList<>(); - list.add(new ExtraDataType(MapTime.class, true)); - registerSingleValuesAsExtraTypes(list); - return list; + public long row2UniqueId(int rowIndex) { + return rowIndex; } @Override - public Object getValue(Class c) { - return getSingleValue(c); + public int uniqueId2Row(long id) { + return (int) id; } @Override - public Object getRowValue(Class c, int row) { - if (c.equals(MapTime.class)) { - return m_mapTimes.get(row); - } + public PlotDataSpec getDataSpecAt(int i) { return null; } - @Override - public Object getColValue(Class c, int col) { - return null; - } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/PeakTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/PeakTableModel.java index 2e4f5d539..695df8e9e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/PeakTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/PeakTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/PeakelTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/PeakelTableModel.java index 23f3a90a4..9d13b7b5e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/PeakelTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/PeakelTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.xic; import fr.proline.core.orm.lcms.Feature; @@ -116,7 +116,7 @@ public Class getColumnClass(int col) { @Override public int getSubTaskId(int col) { - return DatabaseLoadLcMSTask.SUB_TASK_PEAKEL; + return DatabaseLoadLcMSTask.SUB_TASK_PEAKEL_FOR_FEATURE; } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/ProteinQuantPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/ProteinQuantPanel.java index 202b8822f..26c01ef97 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/ProteinQuantPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/ProteinQuantPanel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.xic; import fr.proline.core.orm.msi.dto.DMasterQuantProteinSet; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/ProteinQuantTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/ProteinQuantTableModel.java index 0b9899e1b..71bc5948b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/ProteinQuantTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/ProteinQuantTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantChannelInfo.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantChannelInfo.java index 416cc8598..fa9395092 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantChannelInfo.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantChannelInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantPeptideIonTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantPeptideIonTableModel.java index 3d0a91e4b..bdb983ef8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantPeptideIonTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantPeptideIonTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantPeptideTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantPeptideTableModel.java index 4bfa0c8f2..ad6dca445 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantPeptideTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantPeptideTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -27,6 +27,7 @@ import fr.proline.core.orm.msi.dto.MasterQuantProteinSetProperties; import fr.proline.core.orm.uds.dto.DDataset; import fr.proline.core.orm.uds.dto.DQuantitationChannel; +import fr.proline.studio.dam.data.SelectLevelEnum; import fr.proline.studio.extendedtablemodel.ExtraDataType; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; @@ -44,6 +45,7 @@ import fr.proline.studio.graphics.PlotType; import fr.proline.studio.pattern.AbstractDataBox; import fr.proline.studio.rsmexplorer.DataBoxViewerManager; +import fr.proline.studio.rsmexplorer.DataBoxViewerManager.REASON_MODIF; import fr.proline.studio.table.renderer.BigFloatOrDoubleRenderer; import fr.proline.studio.rsmexplorer.gui.renderer.CompareValueRenderer; import fr.proline.studio.table.renderer.DefaultLeftAlignRenderer; @@ -672,8 +674,8 @@ public boolean isRowEditable(int rowIndex) { return (f != null); // a peptide with an elutime is linked to a PeptideIon and MasterQuantComponent } - - public ArrayList listToModifyForValidateModifications(ArrayList selectedRows, XicStatusRenderer.SelectLevelEnum cmdSelectLevel) { + + public ArrayList listToModifyForValidateModifications(ArrayList selectedRows, SelectLevelEnum cmdSelectLevel) { if (selectedRows.isEmpty()) { return null; } @@ -700,10 +702,10 @@ public ArrayList listToModifyForValidateModifications(Array break; case RESET_AUTO: if (thisSelectLevel == 0) {//DESELECTED_MANUAL - masterQuantPeptide.setSelectionLevel(XicStatusRenderer.SelectLevelEnum.DESELECTED_AUTO.getIntValue());//DESELECTED_AUTO + masterQuantPeptide.setSelectionLevel(SelectLevelEnum.DESELECTED_AUTO.getIntValue());//DESELECTED_AUTO listToModify.add(masterQuantPeptide); } else if (thisSelectLevel == 3) {//SELECTED_MANUAL - masterQuantPeptide.setSelectionLevel(XicStatusRenderer.SelectLevelEnum.SELECTED_AUTO.getIntValue());//SELECTED_AUTO + masterQuantPeptide.setSelectionLevel(SelectLevelEnum.SELECTED_AUTO.getIntValue());//SELECTED_AUTO listToModify.add(masterQuantPeptide); } break; @@ -716,9 +718,9 @@ public ArrayList listToModifyForValidateModifications(Array } return listToModify; } - + public void validateModifications(final XicPeptidePanel panel, ArrayList listToModify) { - + if (listToModify == null) { panel.modifyStatusActionFinished(true, null); return; @@ -742,7 +744,7 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) // propagate modifications to the previous views DataBoxViewerManager.loadedDataModified(m_projectId, m_databox.getRsetId(), m_databox.getRsmId(), DMasterQuantProteinSet.class, - masterQuantProteinSetModified, DataBoxViewerManager.REASON_PEPTIDE_SUPPRESSED); + masterQuantProteinSetModified, REASON_MODIF.REASON_PEPTIDE_SUPPRESSED.getReasonValue()); fireTableDataChanged(); @@ -758,22 +760,22 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) } public XicStatusRenderer.SelectLevel getSelectionLevelFor(DMasterQuantPeptide peptide) { - XicStatusRenderer.SelectLevelEnum level = XicStatusRenderer.SelectLevelEnum.UNKNOWN; + SelectLevelEnum level = SelectLevelEnum.UNKNOWN; if (m_mqProtSetContext != null && !m_selectionLevelInContext.isEmpty()) { Integer value = m_selectionLevelInContext.get(peptide.getId()); if (value != null) { - level = XicStatusRenderer.SelectLevelEnum.valueOf(m_selectionLevelInContext.get(peptide.getId())); + level = SelectLevelEnum.valueOf(m_selectionLevelInContext.get(peptide.getId())); // logger.debug(" use masterQuantProtein specific selection for peptide " + peptide.getId() + ": " + level.toString()); } } - if (level == null || level.equals(XicStatusRenderer.SelectLevelEnum.UNKNOWN)) { - level = XicStatusRenderer.SelectLevelEnum.valueOf(peptide.getSelectionLevel()); + if (level == null || level.equals(SelectLevelEnum.UNKNOWN)) { + level = SelectLevelEnum.valueOf(peptide.getSelectionLevel()); } - return new XicStatusRenderer.SelectLevel(level, XicStatusRenderer.SelectLevelEnum.valueOf(peptide.getSelectionLevel())); - + return new XicStatusRenderer.SelectLevel(level, SelectLevelEnum.valueOf(peptide.getSelectionLevel())); + } @Override @@ -1145,9 +1147,9 @@ public void setData(Long taskId, long projectId, DQuantitationChannel[] quantCha if (selectLevelByMqPeps != null) { for (DMasterQuantPeptide mqPep : m_quantPeptides) { int globalSelectLevel = mqPep.getSelectionLevel(); - m_selectionLevelInContext.put(mqPep.getId(), selectLevelByMqPeps.getOrDefault(mqPep.getId(), XicStatusRenderer.SelectLevelEnum.UNKNOWN.getIntValue())); + m_selectionLevelInContext.put(mqPep.getId(), selectLevelByMqPeps.getOrDefault(mqPep.getId(), SelectLevelEnum.UNKNOWN.getIntValue())); m_globalLevel.put(mqPep.getId(), globalSelectLevel); - + } } } @@ -1493,7 +1495,12 @@ public Object getDataValueAt(int rowIndex, int columnIndex) { if (columnIndex == COLTYPE_PEPTIDE_ID) { return peptide.getId(); } else if (columnIndex == COLTYPE_MQPEPTIDE_SELECTION_LEVEL) { - return ((XicStatusRenderer.SelectLevel) data).getStatus().getIntValue(); + if (m_isXICMode) { + return ((XicStatusRenderer.SelectLevel) data).getStatus().getIntValue(); // return XicStatusRenderer.SelectLevel.class; + } else { + return ""; + } + } return data; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantProteinSetTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantProteinSetTableModel.java index 94ef174a9..522fc7683 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantProteinSetTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/QuantProteinSetTableModel.java @@ -1,1248 +1,1248 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.gui.xic; - -import fr.proline.core.orm.msi.ResultSummary; -import fr.proline.core.orm.msi.dto.DMasterQuantProteinSet; -import fr.proline.core.orm.msi.dto.DProteinMatch; -import fr.proline.core.orm.msi.dto.DProteinSet; -import fr.proline.core.orm.msi.dto.DQuantProteinSet; -import fr.proline.core.orm.uds.dto.DDataset; -import fr.proline.core.orm.uds.dto.DQuantitationChannel; -import fr.proline.studio.extendedtablemodel.ExtraDataType; -import fr.proline.studio.dam.tasks.xic.DatabaseLoadXicMasterQuantTask; -import fr.proline.studio.export.ExportFontData; -import fr.proline.studio.filter.DoubleFilter; -import fr.proline.studio.filter.Filter; -import fr.proline.studio.filter.IntegerFilter; -import fr.proline.studio.filter.StringDiffFilter; -import fr.proline.studio.graphics.PlotInformation; -import fr.proline.studio.graphics.PlotType; -import fr.proline.studio.table.renderer.BigFloatOrDoubleRenderer; -import fr.proline.studio.rsmexplorer.gui.renderer.CompareValueRenderer; -import fr.proline.studio.table.renderer.DefaultRightAlignRenderer; -import fr.proline.studio.rsmexplorer.gui.renderer.FloatRenderer; -import fr.proline.studio.extendedtablemodel.CompoundTableModel; -import fr.proline.studio.table.ExportTableSelectionInterface; -import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; -import fr.proline.studio.utils.CyclicColorPalette; -import fr.proline.studio.table.LazyData; -import fr.proline.studio.table.LazyTable; -import fr.proline.studio.table.LazyTableModel; -import fr.proline.studio.table.TableDefaultRendererManager; -import fr.proline.studio.table.renderer.GrayedRenderer; -import fr.proline.studio.types.QuantitationType; -import fr.proline.studio.types.XicGroup; -import fr.proline.studio.types.XicMode; -import fr.proline.studio.utils.StringUtils; -import fr.proline.studio.utils.URLCellRenderer; -import java.awt.Color; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import javax.swing.table.TableCellRenderer; - -/** - * Table Model for XIC-displayAbundances-Proteins sets - * @author JM235353 - */ -public class QuantProteinSetTableModel extends LazyTableModel implements ExportTableSelectionInterface, GlobalTableModelInterface { - - public static final int COLTYPE_PROTEIN_SET_ID = 0; - public static final int COLTYPE_PROTEIN_SET_NAME = 1; - public static final int COLTYPE_OVERVIEW = 2; - public static final int COLTYPE_DESCRIPTION = 3; //add a column type: description - public static final int COLTYPE_NB_PEPTIDE = 4; - public static final int COLTYPE_NB_QUANT_PEPTIDE = 5; - public static final int COLTYPE_PROTEIN_SET_GENE_NAME = 6; - public static final int LAST_STATIC_COLUMN = COLTYPE_PROTEIN_SET_GENE_NAME; - - private static final String[] m_columnNames = {"Id", "Protein Set", "Overview", "Description", "#Peptide", "#Quant.
Peptide", "Gene Name"}; - private static final String[] m_columnNamesForFilter = {"Id", "Protein Set", "Overview", "Description", "#Peptide", "#Quant.Peptide", "Gene Name"}; - private static final String[] m_toolTipColumns = {"MasterQuantProteinSet Id", "Identified Protein label", "Overview", "Description", "Number of Identified Peptides", "Number of Quantified Peptides","Correcponding Gene Name. This information is fill in during 'Retrieve Sequence' task."}; - - public static final int COLTYPE_PEP_NUMBER = 0; - public static final int COLTYPE_SELECTION_LEVEL = 1; - public static final int COLTYPE_PSM = 2; - public static final int COLTYPE_RAW_ABUNDANCE = 3; - public static final int COLTYPE_ABUNDANCE = 4; - public static final int COLTYPE_STATUS = 5; - - private static final String[] m_columnNamesQC = {"#Quant. Peptides", "Sel. level", "#Quant. PSMs", "Raw abundance", "Abundance"}; - private static final String[] m_toolTipQC = {"Not Applicable [Number of different peptides for this condition...]", "Selection level (manual or automatique [in]validation)", "Quantified Peptides matches count", "Raw abundance", "Abundance"}; - - private static final String[] m_columnNamesQC_SC = {"Peptides Count", "Sel. level", "Basic SC", "Specific SC", "Weighted SC", "Status"}; - private static final String[] m_toolTipQC_SC = {"Number of different peptides for this condition", "Selection level", "Basic Spectral Count", "Specific Spectral Count", "Weighted Spectral Count", "Status (typical, subset or sameset) of the protein in this condition"}; - - private List m_proteinSets = null; - private DQuantitationChannel[] m_quantChannels = null; - private int m_quantChannelNumber; - - private int m_overviewType = COLTYPE_ABUNDANCE; - - private String m_modelName; - - private boolean m_isXICMode; - - public QuantProteinSetTableModel(LazyTable table) { - super(table); - } - - @Override - public int getColumnCount() { - if (m_quantChannels == null) { - return m_columnNames.length; - } else if (m_isXICMode) { - return m_columnNames.length + m_quantChannelNumber * m_columnNamesQC.length; - } else { - return m_columnNames.length + m_quantChannelNumber * m_columnNamesQC_SC.length; - } - } - - private int getColumnPerQCCount() { - if (m_quantChannels == null) { - return 0; - } else if (m_isXICMode) { - return m_columnNamesQC.length; - } else { - return m_columnNamesQC_SC.length; - } - } - - @Override - public String getColumnName(int col) { - if (col <= LAST_STATIC_COLUMN) { - return m_columnNames[col]; - } else { - int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); - int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); - - StringBuilder sb = new StringBuilder(); - String rsmHtmlColor = CyclicColorPalette.getHTMLColor(nbQc); - sb.append("■ "); - if (m_isXICMode) { - sb.append(m_columnNamesQC[id]); - } else { - sb.append(m_columnNamesQC_SC[id]); - } - sb.append("
"); - sb.append(m_quantChannels[nbQc].getName()); - sb.append(""); - return sb.toString(); - } - } - - public String getColumnNameForFilter(int col) { - if (col <= LAST_STATIC_COLUMN) { - return m_columnNamesForFilter[col]; - } else if (m_quantChannels != null) { - int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); - int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); - return m_isXICMode ? m_columnNamesQC[id] : m_columnNamesQC_SC[id]; - } else { - return ""; // should not happen - } - } - - @Override - public String getExportColumnName(int col) { - if (col <= LAST_STATIC_COLUMN) { - return m_columnNamesForFilter[col]; - } else if (m_quantChannels != null) { - int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); - int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); - - StringBuilder sb = new StringBuilder(); - if (m_isXICMode) { - sb.append(m_columnNamesQC[id]); - } else { - sb.append(m_columnNamesQC_SC[id]); - } - sb.append(" "); - sb.append(m_quantChannels[nbQc].getName()); - - return sb.toString(); - } else { - return ""; // should not happen - } - - } - - @Override - public String getToolTipForHeader(int col) { - if (col == COLTYPE_OVERVIEW) { - return m_toolTipColumns[col] + " on " + (m_isXICMode ? m_toolTipQC[m_overviewType] : m_toolTipQC_SC[m_overviewType]); - } - if (col <= LAST_STATIC_COLUMN) { - return m_toolTipColumns[col]; - } else { - int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); - int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); - String rawFilePath = StringUtils.truncate(m_quantChannels[nbQc].getRawFilePath(), 50); - - StringBuilder sb = new StringBuilder(); - String rsmHtmlColor = CyclicColorPalette.getHTMLColor(nbQc); - sb.append("■ "); - if (m_isXICMode) { - sb.append(m_toolTipQC[id]); - } else { - sb.append(m_toolTipQC_SC[id]); - } - sb.append("
"); - sb.append(m_quantChannels[nbQc].getFullName()); - sb.append("
"); - sb.append(rawFilePath); - - sb.append(""); - return sb.toString(); - } - } - - @Override - public String getTootlTipValue(int row, int col) { - return null; - } - - @Override - public Class getColumnClass(int col) { - if (col == COLTYPE_PROTEIN_SET_ID) { - return Long.class; - } else if (col == COLTYPE_OVERVIEW) { - return CompareValueRenderer.CompareValue.class; - } - return LazyData.class; - } - - @Override - public int getSubTaskId(int col) { - return DatabaseLoadXicMasterQuantTask.SUB_TASK_PROTEIN_SET; - } - - @Override - public int getRowCount() { - if (m_proteinSets == null) { - return 0; - } - - return m_proteinSets.size(); - } - - @Override - public Object getValueAt(final int row, int col) { - - // Retrieve MasterQuantProtein Set - DMasterQuantProteinSet proteinSet = m_proteinSets.get(row); - - switch (col) { - case COLTYPE_PROTEIN_SET_ID: { - return proteinSet.getId(); - } - case COLTYPE_PROTEIN_SET_NAME: { - - LazyData lazyData = getLazyData(row, col); - - // Retrieve typical Protein Match - DProteinMatch proteinMatch = null; - if (proteinSet.getProteinSet() != null) { - proteinMatch = proteinSet.getProteinSet().getTypicalProteinMatch(); - if (proteinMatch == null) { - lazyData.setData(""); - } else { - lazyData.setData(proteinMatch.getAccession()); - } - } else { - lazyData.setData(null); - givePriorityTo(m_taskId, row, col); - } - return lazyData; - } - - case COLTYPE_OVERVIEW: - return new CompareValueRenderer.CompareValue() { - - @Override - public int getNumberColumns() { - return m_quantChannels.length; - } - - @Override - public Color getColor(int col) { - return CyclicColorPalette.getColor(col); - } - - @Override - public double getValue(int col) { - if (m_overviewType == -1) { - return 0; // should not happen - }// retrieve quantProteinSet for the quantChannelId - - int realCol = LAST_STATIC_COLUMN + 1 + m_overviewType + col * getColumnPerQCCount(); - LazyData lazyData = (LazyData) getValueAt(row, realCol); - if (lazyData != null && lazyData.getData() != null) { - if (Number.class.isAssignableFrom(lazyData.getData().getClass())) { - return ((Number) lazyData.getData()).floatValue(); - } - } - return 0; - } - - public double getValueNoNaN(int col) { - double val = getValue(col); - if (val != val) { // NaN value - return 0; - } - return val; - } - - @Override - public double getMaximumValue() { - int nbCols = getNumberColumns(); - double maxValue = 0; - for (int i = 0; i < nbCols; i++) { - double v = getValue(i); - if (v > maxValue) { - maxValue = v; - } - } - return maxValue; - - } - - @Override - public double calculateComparableValue() { - int nbColumns = getNumberColumns(); - double mean = 0; - for (int i = 0; i < nbColumns; i++) { - mean += getValueNoNaN(i); - } - mean /= nbColumns; - - double maxDiff = 0; - for (int i = 0; i < nbColumns; i++) { - double diff = getValueNoNaN(i) - mean; - if (diff < 0) { - diff = -diff; - } - if (diff > maxDiff) { - maxDiff = diff; - } - } - return maxDiff / mean; - } - - @Override - public int compareTo(CompareValueRenderer.CompareValue o) { - return Double.compare(calculateComparableValue(), o.calculateComparableValue()); - } - }; - - case COLTYPE_PROTEIN_SET_GENE_NAME:{ - LazyData lazyData = getLazyData(row, col); - - // Retrieve typical Protein Match - DProteinMatch proteinMatch = null; - if (proteinSet.getProteinSet() != null) { - proteinMatch = proteinSet.getProteinSet().getTypicalProteinMatch(); - if (proteinMatch == null) { - lazyData.setData(""); - } else { - String geneName = proteinMatch.getGeneName(); - if(geneName == null ) - geneName = ""; - lazyData.setData(geneName); - } - } else { - lazyData.setData(null); - givePriorityTo(m_taskId, row, col); - } - return lazyData; - } - - case COLTYPE_DESCRIPTION: {//Retrieve the description of the typical protein - LazyData lazyData = getLazyData(row, col); - - // Retrieve typical Protein Match - DProteinMatch proteinMatch = null; - if (proteinSet.getProteinSet() != null) { - proteinMatch = proteinSet.getProteinSet().getTypicalProteinMatch(); - if (proteinMatch == null) { - lazyData.setData(""); - } else { - lazyData.setData(proteinMatch.getDescription()); - } - } else { - lazyData.setData(null); - givePriorityTo(m_taskId, row, col); - } - return lazyData; - } - case COLTYPE_NB_PEPTIDE: { - LazyData lazyData = getLazyData(row, col); - - if (proteinSet.getProteinSet() != null) { - lazyData.setData(proteinSet.getNbPeptides()); - } else { - lazyData.setData(null); - givePriorityTo(m_taskId, row, col); - } - return lazyData; - } - case COLTYPE_NB_QUANT_PEPTIDE: { - LazyData lazyData = getLazyData(row, col); - - if (proteinSet.getProteinSet() != null) { - lazyData.setData(proteinSet.getNbQuantifiedPeptides()); - } else { - lazyData.setData(null); - givePriorityTo(m_taskId, row, col); - } - return lazyData; - } - - default: { - // Quant Channel columns - LazyData lazyData = getLazyData(row, col); - if (proteinSet.getProteinSet() == null) { - lazyData.setData(null); - givePriorityTo(m_taskId, row, col); - } else { - // retrieve quantProteinSet for the quantChannelId - int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); - int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); - Map quantProteinSetByQchIds = proteinSet.getQuantProteinSetByQchIds(); - if (quantProteinSetByQchIds == null) { - switch (id) { - case COLTYPE_PEP_NUMBER: - lazyData.setData(Integer.valueOf(0)); - break; - case COLTYPE_SELECTION_LEVEL: - lazyData.setData(Integer.valueOf(0)); - break; - case COLTYPE_ABUNDANCE: - lazyData.setData(Float.valueOf(0)); - break; - case COLTYPE_RAW_ABUNDANCE: - lazyData.setData(Float.valueOf(0)); - break; - case COLTYPE_PSM: - lazyData.setData(Integer.valueOf(0)); - break; - case COLTYPE_STATUS: //Should only be called for Spectral Count ... - lazyData.setData(""); - break; - } - } else { - DQuantProteinSet quantProteinSet = quantProteinSetByQchIds.get(m_quantChannels[nbQc].getId()); - if (quantProteinSet == null) { - switch (id) { - case COLTYPE_PEP_NUMBER: - lazyData.setData(Integer.valueOf(0)); - break; - case COLTYPE_SELECTION_LEVEL: - lazyData.setData(Integer.valueOf(0)); - break; - case COLTYPE_ABUNDANCE: - lazyData.setData(Float.valueOf(0)); - break; - case COLTYPE_RAW_ABUNDANCE: - lazyData.setData(Float.valueOf(0)); - break; - case COLTYPE_PSM: - lazyData.setData(Integer.valueOf(0)); - break; - case COLTYPE_STATUS: //Should only be called for Spectral Count ... - lazyData.setData(""); - break; - } - } else { - Map quantStatusByQCIds = proteinSet.getQuantStatusByQchIds(); - String status = proteinSet.getQuantStatusByQchIds().getOrDefault(m_quantChannels[nbQc].getId(), ""); - Integer pepNumber = proteinSet.getQuantPeptideNumberByQchIds().get(m_quantChannels[nbQc].getId()); - if (pepNumber == null || pepNumber < 0) { - pepNumber = 0; - } - switch (id) { - case COLTYPE_PEP_NUMBER: - lazyData.setData((quantProteinSet.getPeptidesCount()== null || quantProteinSet.getPeptidesCount()== 0 ) ? pepNumber : quantProteinSet.getPeptidesCount()); - break; - case COLTYPE_SELECTION_LEVEL: - lazyData.setData(quantProteinSet.getSelectionLevel()); - break; - case COLTYPE_ABUNDANCE: - lazyData.setData((quantProteinSet.getAbundance() == null || quantProteinSet.getAbundance().isNaN()) ? Float.valueOf(0) : quantProteinSet.getAbundance()); - break; - case COLTYPE_RAW_ABUNDANCE: - lazyData.setData((quantProteinSet.getRawAbundance() == null || quantProteinSet.getRawAbundance().isNaN()) ? Float.valueOf(0) : quantProteinSet.getRawAbundance()); - break; - case COLTYPE_PSM: - lazyData.setData(quantProteinSet.getPeptideMatchesCount() == null ? Integer.valueOf(0) : quantProteinSet.getPeptideMatchesCount()); - break; - case COLTYPE_STATUS: //Should only be called for Spectral Count ... - lazyData.setData(status); - break; - } - } - } - } - return lazyData; - } - } - //return null; // should never happen - } - - public DMasterQuantProteinSet getMasterQuantProteinSet(int row) { - - // Retrieve QuantProtein Set - DMasterQuantProteinSet quantProteinSet = m_proteinSets.get(row); - return quantProteinSet; - } - - public DProteinSet getProteinSet(int row) { - - // Retrieve Protein Set - DMasterQuantProteinSet quantProteinSet = m_proteinSets.get(row); - return quantProteinSet.getProteinSet(); - } - - public void setData(Long taskId, DQuantitationChannel[] quantChannels, List proteinSets, boolean isXICMode) { - m_quantChannels = quantChannels; - m_quantChannelNumber = quantChannels.length; - m_proteinSets = proteinSets; - m_isXICMode = isXICMode; - - m_taskId = taskId; - - fireTableStructureChanged(); - } - - public void dataUpdated() { - - // no need to do an updateMinMax : scores are known at once - fireTableDataChanged(); - - } - - public boolean dataModified(ArrayList modificationsList) { - HashMap modifiedMap = new HashMap<>(modificationsList.size()); - for (int i = 0; i < modificationsList.size(); i++) { - DMasterQuantProteinSet masterQuantProteinSet = (DMasterQuantProteinSet) modificationsList.get(i); - modifiedMap.put(masterQuantProteinSet.getId(), masterQuantProteinSet); - } - - boolean modificationDone = false; - - for (int i = 0; i < m_proteinSets.size(); i++) { - DMasterQuantProteinSet masterQuantProteinSet = m_proteinSets.get(i); - Long id = masterQuantProteinSet.getId(); - DMasterQuantProteinSet proteinSetModified = modifiedMap.get(id); - if (proteinSetModified != null) { - proteinSetModified.setProteinSet(masterQuantProteinSet.getProteinSet()); - m_proteinSets.set(i, proteinSetModified); - modificationDone = true; - } - } - - if (modificationDone) { - fireTableDataChanged(); - } - - return modificationDone; - } - - public DMasterQuantProteinSet getQuantProteinSet(int i) { - - return m_proteinSets.get(i); - } - - public int findRow(long proteinSetId) { - - int nb = m_proteinSets.size(); - for (int i = 0; i < nb; i++) { - if (proteinSetId == m_proteinSets.get(i).getProteinSetId()) { - return i; - } - } - return -1; - - } - - public void sortAccordingToModel(ArrayList proteinSetIds, CompoundTableModel compoundTableModel) { - - if (m_proteinSets == null) { - // data not loaded - return; - } - - HashSet proteinSetIdMap = new HashSet<>(proteinSetIds.size()); - proteinSetIdMap.addAll(proteinSetIds); - - int nb = m_table.getRowCount(); - int iCur = 0; - for (int iView = 0; iView < nb; iView++) { - int iModel = m_table.convertRowIndexToModel(iView); - if (compoundTableModel != null) { - iModel = compoundTableModel.convertCompoundRowToBaseModelRow(iModel); - } - // Retrieve Protein Set - DMasterQuantProteinSet ps = getQuantProteinSet(iModel); - if (proteinSetIdMap.contains(ps.getProteinSetId())) { - proteinSetIds.set(iCur++, ps.getProteinSetId()); - } - } - - } - - @Override - public void addFilters(LinkedHashMap filtersMap) { - filtersMap.put(COLTYPE_PROTEIN_SET_NAME, new StringDiffFilter(getColumnNameForFilter(COLTYPE_PROTEIN_SET_NAME), null, COLTYPE_PROTEIN_SET_NAME)); - filtersMap.put(COLTYPE_DESCRIPTION, new StringDiffFilter(getColumnNameForFilter(COLTYPE_DESCRIPTION), null, COLTYPE_DESCRIPTION)); - filtersMap.put(COLTYPE_PROTEIN_SET_GENE_NAME, new StringDiffFilter(getColumnNameForFilter(COLTYPE_PROTEIN_SET_GENE_NAME), null, COLTYPE_PROTEIN_SET_GENE_NAME)); - filtersMap.put(COLTYPE_NB_PEPTIDE, new IntegerFilter(getColumnNameForFilter(COLTYPE_NB_PEPTIDE), null, COLTYPE_NB_PEPTIDE)); - filtersMap.put(COLTYPE_NB_QUANT_PEPTIDE, new IntegerFilter(getColumnNameForFilter(COLTYPE_NB_QUANT_PEPTIDE), null, COLTYPE_NB_QUANT_PEPTIDE)); - int nbCol = getColumnCount(); - for (int i = LAST_STATIC_COLUMN + 1; i < nbCol; i++) { - int nbQc = (i - m_columnNames.length) / getColumnPerQCCount(); - int id = i - m_columnNames.length - (nbQc * getColumnPerQCCount()); - switch (id) { - case COLTYPE_PEP_NUMBER: - filtersMap.put(i, new IntegerFilter(getColumnName(i), null, i)); - break; - case COLTYPE_SELECTION_LEVEL: - filtersMap.put(i, new IntegerFilter(getColumnName(i), null, i)); - break; - case COLTYPE_ABUNDANCE: - filtersMap.put(i, new DoubleFilter(getColumnName(i), null, i)); - break; - case COLTYPE_RAW_ABUNDANCE: - filtersMap.put(i, new DoubleFilter(getColumnName(i), null, i)); - break; - case COLTYPE_PSM: - filtersMap.put(i, new IntegerFilter(getColumnName(i), null, i)); - break; - case COLTYPE_STATUS: //should only occur for spectral count - filtersMap.put(i, new StringDiffFilter(getColumnName(i), null, i)); - break; - default: - filtersMap.put(i, new DoubleFilter(getColumnName(i), null, i)); - break; - } - } - } - - @Override - public int getLoadingPercentage() { - return m_table.getLoadingPercentage(); - } - - @Override - public boolean isLoaded() { - return m_table.isLoaded(); - } - - public int getQCCount() { - return m_quantChannels.length; - } - - public int getQCColumStart(int index) { - return m_columnNames.length + index * getColumnPerQCCount(); - } - - public int getQCColumStop(int index) { - return m_columnNames.length + (1 + index) * getColumnPerQCCount() - 1; - } - - public String getQCName(int index) { - - StringBuilder sb = new StringBuilder(); - - String rsmHtmlColor = CyclicColorPalette.getHTMLColor(index); - sb.append("■ "); - sb.append(m_quantChannels[index].getFullName()); - /* sb.append("
"); - sb.append(m_quantChannels[i].getRawFileName());*/ - sb.append(""); - - return sb.toString(); - } - - public String getByQCMColumnName(int index) { - return m_isXICMode ? m_columnNamesQC[index] : m_columnNamesQC_SC[index]; - } - - public int getQCNumber(int col) { - return (col - m_columnNames.length) / getColumnPerQCCount(); - } - - public int getQCColIndex(int col) { - return (col - m_columnNames.length) % getColumnPerQCCount(); - } - - public Long getResultSummaryId() { - if ((m_proteinSets == null) || (m_proteinSets.isEmpty())) { - return null; - } - - return m_proteinSets.get(0).getQuantResultSummaryId(); - } - - public void setOverviewType(int overviewType) { - m_overviewType = overviewType; - fireTableDataChanged(); - } - - public int getOverviewType() { - return m_overviewType; - } - - /** - * by default the abundance and selectionLevel are hidden return the list of - * columns ids of these columns - * - * @return - */ - public List getDefaultColumnsToHide() { - List listIds = new ArrayList(); - listIds.add(COLTYPE_PROTEIN_SET_ID); - listIds.add(COLTYPE_PROTEIN_SET_GENE_NAME); - if (m_quantChannels != null) { - for (int i = m_quantChannels.length - 1; i >= 0; i--) { - listIds.add(m_columnNames.length + COLTYPE_SELECTION_LEVEL + (i * getColumnPerQCCount())); - if (m_isXICMode) { - listIds.add(m_columnNames.length + COLTYPE_RAW_ABUNDANCE + (i * getColumnPerQCCount())); - listIds.add(m_columnNames.length + COLTYPE_PEP_NUMBER + (i * getColumnPerQCCount())); - } - } - } - return listIds; - } - - @Override - public HashSet exportSelection(int[] rows) { - - int nbRows = rows.length; - HashSet selectedObjects = new HashSet(); - for (int i = 0; i < nbRows; i++) { - - int row = rows[i]; - - // Retrieve Protein Set - DMasterQuantProteinSet proteinSet = m_proteinSets.get(row); - - selectedObjects.add(proteinSet.getProteinSet().getId()); - } - return selectedObjects; - } - - @Override - public String getDataColumnIdentifier(int col) { - if (col <= LAST_STATIC_COLUMN) { - return m_columnNamesForFilter[col]; - } else { - int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); - int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); - - StringBuilder sb = new StringBuilder(); - if (m_isXICMode) { - sb.append(m_columnNamesQC[id]); - } else { - sb.append(m_columnNamesQC_SC[id]); - } - sb.append(' '); - sb.append(m_quantChannels[nbQc].getName()); - - return sb.toString(); - } - } - - @Override - public Class getDataColumnClass(int col) { - - switch (col) { - case COLTYPE_PROTEIN_SET_ID: { - return Long.class; - } - case COLTYPE_PROTEIN_SET_GENE_NAME: - case COLTYPE_PROTEIN_SET_NAME: { - return String.class; - } - case COLTYPE_OVERVIEW: { - return CompareValueRenderer.CompareValue.class; - } - case COLTYPE_DESCRIPTION: { - return String.class; - } - case COLTYPE_NB_PEPTIDE: { - return Integer.class; - } - case COLTYPE_NB_QUANT_PEPTIDE: { - return Integer.class; - } - default: { - int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); - int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); - switch (id) { - case COLTYPE_PEP_NUMBER: - return Integer.class; - case COLTYPE_SELECTION_LEVEL: - return Integer.class; - case COLTYPE_ABUNDANCE: - return Float.class; - case COLTYPE_RAW_ABUNDANCE: - return Float.class; - case COLTYPE_PSM: - return Integer.class; - case COLTYPE_STATUS: //Only for Spectral count - return String.class; - } - - } - } - return null; // should never happen - - } - - @Override - public Object getDataValueAt(int rowIndex, int columnIndex) { - Object data = getValueAt(rowIndex, columnIndex); - if (data instanceof LazyData) { - data = ((LazyData) data).getData(); - } - return data; - } - - @Override - public int[] getKeysColumn() { - int[] keys = {COLTYPE_PROTEIN_SET_NAME}; - return keys; - } - - @Override - public void setName(String name) { - m_modelName = name; - } - - @Override - public String getName() { - return m_modelName; - } - - @Override - public int getInfoColumn() { - return COLTYPE_PROTEIN_SET_NAME; - } - - @Override - public Map getExternalData() { - return null; - } - - @Override - public PlotInformation getPlotInformation() { - return null; - } - - @Override - public String getExportRowCell(int row, int col) { - - // Retrieve Protein Set - DMasterQuantProteinSet proteinSet = m_proteinSets.get(row); - //long rsmId = proteinSet.getResultSummaryId(); - - switch (col) { - case COLTYPE_PROTEIN_SET_ID: { - return "" + proteinSet.getId(); - } - case COLTYPE_PROTEIN_SET_NAME: { - // Retrieve typical Protein Match - DProteinMatch proteinMatch = null; - if (proteinSet.getProteinSet() != null) { - proteinMatch = proteinSet.getProteinSet().getTypicalProteinMatch(); - if (proteinMatch == null) { - return ""; - } else { - return proteinMatch.getAccession(); - } - } else { - return ""; - } - } - - case COLTYPE_OVERVIEW: - return ""; - - case COLTYPE_DESCRIPTION: { - if (proteinSet.getProteinSet() != null) { - DProteinMatch proteinMatch = proteinSet.getProteinSet().getTypicalProteinMatch(); - if (proteinMatch == null) { - return(""); - } else { - return proteinMatch.getDescription(); - } - } - return ""; - } - - case COLTYPE_PROTEIN_SET_GENE_NAME: { - if (proteinSet.getProteinSet() != null) { - DProteinMatch proteinMatch = proteinSet.getProteinSet().getTypicalProteinMatch(); - if (proteinMatch == null) { - return(""); - } else { - return proteinMatch.getGeneName(); - } - } - return ""; - } - case COLTYPE_NB_PEPTIDE: { - if (proteinSet.getProteinSet() != null) { - return "" + proteinSet.getNbPeptides(); - } else { - return ""; - } - } - case COLTYPE_NB_QUANT_PEPTIDE: { - if (proteinSet.getProteinSet() != null) { - return "" + proteinSet.getNbQuantifiedPeptides(); - } else { - return ""; - } - } - - default: { - // Quant Channel columns - int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); - int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); - if (proteinSet.getProteinSet() == null) { - switch (id) { - case COLTYPE_PEP_NUMBER: - return Integer.toString(0); - case COLTYPE_SELECTION_LEVEL: - return Integer.toString(0); - case COLTYPE_ABUNDANCE: - return Float.toString(0); - case COLTYPE_RAW_ABUNDANCE: - return Float.toString(0); - case COLTYPE_PSM: - return Integer.toString(0); - case COLTYPE_STATUS: //should only occur for spectral count - return ""; - } - } else { - // retrieve quantProteinSet for the quantChannelId - Map quantProteinSetByQchIds = proteinSet.getQuantProteinSetByQchIds(); - - if (quantProteinSetByQchIds == null) { - switch (id) { - case COLTYPE_PEP_NUMBER: - return Integer.toString(0); - case COLTYPE_SELECTION_LEVEL: - return Integer.toString(0); - case COLTYPE_ABUNDANCE: - return Float.toString(0); - case COLTYPE_RAW_ABUNDANCE: - return Float.toString(0); - case COLTYPE_PSM: - return Integer.toString(0); - case COLTYPE_STATUS: //Should only occur for spectral count - return ""; - } - } else { - DQuantProteinSet quantProteinSet = quantProteinSetByQchIds.get(m_quantChannels[nbQc].getId()); - if (quantProteinSet == null) { - switch (id) { - case COLTYPE_PEP_NUMBER: - return Integer.toString(0); - case COLTYPE_SELECTION_LEVEL: - return Integer.toString(0); - case COLTYPE_ABUNDANCE: - return Float.toString(0); - case COLTYPE_RAW_ABUNDANCE: - return Float.toString(0); - case COLTYPE_PSM: - return Integer.toString(0); - case COLTYPE_STATUS: //Should only occur for spectral count - return ""; - } - } else { - Integer pepNumber = proteinSet.getQuantPeptideNumberByQchIds().get(m_quantChannels[nbQc].getId()); - if (pepNumber == null || pepNumber < 0) { - pepNumber = 0; - } - switch (id) { - case COLTYPE_PEP_NUMBER: - return ( (quantProteinSet.getPeptidesCount()== null || quantProteinSet.getPeptidesCount()== 0) ? Integer.toString(pepNumber) : Integer.toString(quantProteinSet.getPeptidesCount())); - case COLTYPE_SELECTION_LEVEL: - return (quantProteinSet.getSelectionLevel() == null ? Integer.toString(0) : Integer.toString(quantProteinSet.getSelectionLevel())); - case COLTYPE_ABUNDANCE: - return ((quantProteinSet.getAbundance() == null || quantProteinSet.getAbundance().isNaN()) ? Float.toString(0) : Float.toString(quantProteinSet.getAbundance())); - case COLTYPE_RAW_ABUNDANCE: - return ((quantProteinSet.getRawAbundance() == null || quantProteinSet.getRawAbundance().isNaN()) ? Float.toString(0) : Float.toString(quantProteinSet.getRawAbundance())); - case COLTYPE_PSM: - return (quantProteinSet.getPeptideMatchesCount() == null ? Integer.toString(0) : Integer.toString(quantProteinSet.getPeptideMatchesCount())); - case COLTYPE_STATUS: //should only occur for spectral count - String status = proteinSet.getQuantStatusByQchIds().get(m_quantChannels[nbQc].getId()); - return status; - } - } - } - } - } - } - return ""; // should never happen - } - - @Override - public ArrayList getExportFonts(int row, int col) { - return null; - } - - @Override - public PlotType getBestPlotType() { - return null; //JPM.TODO - } - - @Override - public int[] getBestColIndex(PlotType plotType) { - return null; - } - - public Boolean containsModifiedQuantProteinSet() { - Boolean containsModifed = false; - try { - int nbRow = getRowCount(); - for (int i = 0; i < nbRow; i++) { - DMasterQuantProteinSet proteinSet = m_proteinSets.get(i); - Map pmqSerializedMap = proteinSet.getSerializedPropertiesAsMap(); - if ((pmqSerializedMap != null) && (pmqSerializedMap.containsKey(DMasterQuantProteinSet.MASTER_QUANT_PROTEINSET_WITH_PEPTIDE_MODIFIED)) && (pmqSerializedMap.get(DMasterQuantProteinSet.MASTER_QUANT_PROTEINSET_WITH_PEPTIDE_MODIFIED).equals(Boolean.TRUE))) { - containsModifed = true; - break; - } - - } - - } catch (Exception e) { - // should not happen - } - - return containsModifed; - } - - public ArrayList getModifiedQuantProteinSet() { - - ArrayList masterQuantProteinSetModified = new ArrayList<>(); - try { - int nbRow = getRowCount(); - for (int i = 0; i < nbRow; i++) { - DMasterQuantProteinSet proteinSet = m_proteinSets.get(i); - Map pmqSerializedMap = proteinSet.getSerializedPropertiesAsMap(); - if ((pmqSerializedMap != null) && (pmqSerializedMap.containsKey(DMasterQuantProteinSet.MASTER_QUANT_PROTEINSET_WITH_PEPTIDE_MODIFIED)) && (pmqSerializedMap.get(DMasterQuantProteinSet.MASTER_QUANT_PROTEINSET_WITH_PEPTIDE_MODIFIED).equals(Boolean.TRUE))) { - masterQuantProteinSetModified.add(proteinSet); - } - - } - - } catch (Exception e) { - // should not happen - } - - return masterQuantProteinSetModified; - } - - @Override - public TableCellRenderer getRenderer(int row, int col) { - - if (m_proteinSets == null) { - return null; - } - - DMasterQuantProteinSet proteinSet = m_proteinSets.get(row); - - boolean grayed = false; - - try { - Map pmqSerializedMap = proteinSet.getSerializedPropertiesAsMap(); - grayed = ((pmqSerializedMap != null) && (pmqSerializedMap.containsKey(DMasterQuantProteinSet.MASTER_QUANT_PROTEINSET_WITH_PEPTIDE_MODIFIED)) && pmqSerializedMap.get(DMasterQuantProteinSet.MASTER_QUANT_PROTEINSET_WITH_PEPTIDE_MODIFIED).equals(Boolean.TRUE)); - } catch (Exception e) { - - } - - if (grayed) { - if (m_rendererMapGrayed.containsKey(col)) { - return m_rendererMapGrayed.get(col); - } - } else { - if (m_rendererMap.containsKey(col)) { - return m_rendererMap.get(col); - } - } - - TableCellRenderer renderer = null; - - switch (col) { - case COLTYPE_PROTEIN_SET_ID: { - break; - } - case COLTYPE_PROTEIN_SET_NAME: { - renderer = new URLCellRenderer("URL_Template_Protein_Accession", "http://www.uniprot.org/uniprot/", COLTYPE_PROTEIN_SET_NAME); - break; - } - case COLTYPE_OVERVIEW: { - renderer = new CompareValueRenderer(); - break; - } - case COLTYPE_NB_PEPTIDE: - case COLTYPE_NB_QUANT_PEPTIDE: { - renderer = new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(Integer.class)); - break; - } - default: { - int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); - int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); - switch (id) { - case COLTYPE_PEP_NUMBER: - renderer = new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(Integer.class)); -// if (m_isXICMode) { -// renderer = new GrayedRenderer(renderer); -// } - break; - case COLTYPE_SELECTION_LEVEL: - case COLTYPE_PSM: { - renderer = new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(Integer.class)); - break; - } - case COLTYPE_ABUNDANCE: { - if (m_isXICMode) { - renderer = new BigFloatOrDoubleRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)), 0); - } else { - renderer = new FloatRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)), 2); - } - break; - } - case COLTYPE_RAW_ABUNDANCE: { - if (m_isXICMode) { - renderer = new BigFloatOrDoubleRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)), 0); - } else { - renderer = new FloatRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)), 0); - } - break; - } -// case COLTYPE_STATUS: -// if (m_isXICMode) { -// renderer = new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)); -// renderer = new GrayedRenderer(renderer); -// } -// break; - } - } - } - - if (grayed) { - if (renderer == null) { - return null; - } - renderer = new GrayedRenderer(renderer); - m_rendererMapGrayed.put(col, renderer); - } else { - m_rendererMap.put(col, renderer); - } - - return renderer; - } - private final HashMap m_rendererMap = new HashMap(); - private final HashMap m_rendererMapGrayed = new HashMap(); - - @Override - public GlobalTableModelInterface getFrozzenModel() { - return this; - } - - @Override - public ArrayList getExtraDataTypes() { - ArrayList list = new ArrayList<>(); - list.add(new ExtraDataType(DProteinSet.class, true)); - list.add(new ExtraDataType(DMasterQuantProteinSet.class, true)); - list.add(new ExtraDataType(DDataset.class, false)); - list.add(new ExtraDataType(QuantChannelInfo.class, false)); - list.add(new ExtraDataType(ResultSummary.class, false)); - list.add(new ExtraDataType(XicMode.class, false)); - registerSingleValuesAsExtraTypes(list); - return list; - } - - @Override - public Object getValue(Class c) { - return getSingleValue(c); - } - - @Override - public Object getRowValue(Class c, int row) { - if (c.equals(DMasterQuantProteinSet.class)) { - return m_proteinSets.get(row); - } - if (c.equals(DProteinSet.class)) { - DMasterQuantProteinSet masterQuantProteinSet = m_proteinSets.get(row); - return (masterQuantProteinSet != null) ? masterQuantProteinSet.getProteinSet() : null; - - } - return null; - } - - @Override - public Object getColValue(Class c, int col) { - if (c.equals(XicGroup.class)) { - if (col <= LAST_STATIC_COLUMN) { - return null; - } else { - int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); - return new XicGroup(m_quantChannels[nbQc].getBiologicalGroupId(), null); //biologicalGroupName.getBiologicalGroupName(); JPM.TODO - } - - } - if (c.equals(QuantitationType.class)) { - if (col <= LAST_STATIC_COLUMN) { - return null; - } else { - int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); - int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); - if (m_isXICMode) { - switch (id) { - case COLTYPE_ABUNDANCE: - return QuantitationType.getQuantitationType(QuantitationType.ABUNDANCE); - case COLTYPE_RAW_ABUNDANCE: - return QuantitationType.getQuantitationType(QuantitationType.RAW_ABUNDANCE); - } - } else { - switch (id) { - case COLTYPE_PSM: - return QuantitationType.getQuantitationType(QuantitationType.BASIC_SC); - case COLTYPE_RAW_ABUNDANCE: - return QuantitationType.getQuantitationType(QuantitationType.SPECIFIC_SC); - case COLTYPE_ABUNDANCE: - return QuantitationType.getQuantitationType(QuantitationType.WEIGHTED_SC); - } - } - - return null; - } - - } - return null; - } -} +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ +package fr.proline.studio.rsmexplorer.gui.xic; + +import fr.proline.core.orm.msi.ResultSummary; +import fr.proline.core.orm.msi.dto.DMasterQuantProteinSet; +import fr.proline.core.orm.msi.dto.DProteinMatch; +import fr.proline.core.orm.msi.dto.DProteinSet; +import fr.proline.core.orm.msi.dto.DQuantProteinSet; +import fr.proline.core.orm.uds.dto.DDataset; +import fr.proline.core.orm.uds.dto.DQuantitationChannel; +import fr.proline.studio.extendedtablemodel.ExtraDataType; +import fr.proline.studio.dam.tasks.xic.DatabaseLoadXicMasterQuantTask; +import fr.proline.studio.export.ExportFontData; +import fr.proline.studio.filter.DoubleFilter; +import fr.proline.studio.filter.Filter; +import fr.proline.studio.filter.IntegerFilter; +import fr.proline.studio.filter.StringDiffFilter; +import fr.proline.studio.graphics.PlotInformation; +import fr.proline.studio.graphics.PlotType; +import fr.proline.studio.table.renderer.BigFloatOrDoubleRenderer; +import fr.proline.studio.rsmexplorer.gui.renderer.CompareValueRenderer; +import fr.proline.studio.table.renderer.DefaultRightAlignRenderer; +import fr.proline.studio.rsmexplorer.gui.renderer.FloatRenderer; +import fr.proline.studio.extendedtablemodel.CompoundTableModel; +import fr.proline.studio.table.ExportTableSelectionInterface; +import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; +import fr.proline.studio.utils.CyclicColorPalette; +import fr.proline.studio.table.LazyData; +import fr.proline.studio.table.LazyTable; +import fr.proline.studio.table.LazyTableModel; +import fr.proline.studio.table.TableDefaultRendererManager; +import fr.proline.studio.table.renderer.GrayedRenderer; +import fr.proline.studio.types.QuantitationType; +import fr.proline.studio.types.XicGroup; +import fr.proline.studio.types.XicMode; +import fr.proline.studio.utils.StringUtils; +import fr.proline.studio.utils.URLCellRenderer; +import java.awt.Color; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import javax.swing.table.TableCellRenderer; + +/** + * Table Model for XIC-displayAbundances-Proteins sets + * @author JM235353 + */ +public class QuantProteinSetTableModel extends LazyTableModel implements ExportTableSelectionInterface, GlobalTableModelInterface { + + public static final int COLTYPE_PROTEIN_SET_ID = 0; + public static final int COLTYPE_PROTEIN_SET_NAME = 1; + public static final int COLTYPE_OVERVIEW = 2; + public static final int COLTYPE_DESCRIPTION = 3; //add a column type: description + public static final int COLTYPE_NB_PEPTIDE = 4; + public static final int COLTYPE_NB_QUANT_PEPTIDE = 5; + public static final int COLTYPE_PROTEIN_SET_GENE_NAME = 6; + public static final int LAST_STATIC_COLUMN = COLTYPE_PROTEIN_SET_GENE_NAME; + + private static final String[] m_columnNames = {"Id", "Protein Set", "Overview", "Description", "#Peptide", "#Quant.
Peptide", "Gene Name"}; + private static final String[] m_columnNamesForFilter = {"Id", "Protein Set", "Overview", "Description", "#Peptide", "#Quant.Peptide", "Gene Name"}; + private static final String[] m_toolTipColumns = {"MasterQuantProteinSet Id", "Identified Protein label", "Overview", "Description", "Number of Identified Peptides", "Number of Quantified Peptides","Correcponding Gene Name. This information is fill in during 'Retrieve Sequence' task."}; + + public static final int COLTYPE_PEP_NUMBER = 0; + public static final int COLTYPE_SELECTION_LEVEL = 1; + public static final int COLTYPE_PSM = 2; + public static final int COLTYPE_RAW_ABUNDANCE = 3; + public static final int COLTYPE_ABUNDANCE = 4; + public static final int COLTYPE_STATUS = 5; + + private static final String[] m_columnNamesQC = {"#Quant. Peptides", "Sel. level", "#Quant. PSMs", "Raw abundance", "Abundance"}; + private static final String[] m_toolTipQC = {"Not Applicable [Number of different peptides for this condition...]", "Selection level (manual or automatique [in]validation)", "Quantified Peptides matches count", "Raw abundance", "Abundance"}; + + private static final String[] m_columnNamesQC_SC = {"Peptides Count", "Sel. level", "Basic SC", "Specific SC", "Weighted SC", "Status"}; + private static final String[] m_toolTipQC_SC = {"Number of different peptides for this condition", "Selection level", "Basic Spectral Count", "Specific Spectral Count", "Weighted Spectral Count", "Status (typical, subset or sameset) of the protein in this condition"}; + + private List m_proteinSets = null; + private DQuantitationChannel[] m_quantChannels = null; + private int m_quantChannelNumber; + + private int m_overviewType = COLTYPE_ABUNDANCE; + + private String m_modelName; + + private boolean m_isXICMode; + + public QuantProteinSetTableModel(LazyTable table) { + super(table); + } + + @Override + public int getColumnCount() { + if (m_quantChannels == null) { + return m_columnNames.length; + } else if (m_isXICMode) { + return m_columnNames.length + m_quantChannelNumber * m_columnNamesQC.length; + } else { + return m_columnNames.length + m_quantChannelNumber * m_columnNamesQC_SC.length; + } + } + + private int getColumnPerQCCount() { + if (m_quantChannels == null) { + return 0; + } else if (m_isXICMode) { + return m_columnNamesQC.length; + } else { + return m_columnNamesQC_SC.length; + } + } + + @Override + public String getColumnName(int col) { + if (col <= LAST_STATIC_COLUMN) { + return m_columnNames[col]; + } else { + int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); + int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); + + StringBuilder sb = new StringBuilder(); + String rsmHtmlColor = CyclicColorPalette.getHTMLColor(nbQc); + sb.append("■ "); + if (m_isXICMode) { + sb.append(m_columnNamesQC[id]); + } else { + sb.append(m_columnNamesQC_SC[id]); + } + sb.append("
"); + sb.append(m_quantChannels[nbQc].getName()); + sb.append(""); + return sb.toString(); + } + } + + public String getColumnNameForFilter(int col) { + if (col <= LAST_STATIC_COLUMN) { + return m_columnNamesForFilter[col]; + } else if (m_quantChannels != null) { + int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); + int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); + return m_isXICMode ? m_columnNamesQC[id] : m_columnNamesQC_SC[id]; + } else { + return ""; // should not happen + } + } + + @Override + public String getExportColumnName(int col) { + if (col <= LAST_STATIC_COLUMN) { + return m_columnNamesForFilter[col]; + } else if (m_quantChannels != null) { + int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); + int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); + + StringBuilder sb = new StringBuilder(); + if (m_isXICMode) { + sb.append(m_columnNamesQC[id]); + } else { + sb.append(m_columnNamesQC_SC[id]); + } + sb.append(" "); + sb.append(m_quantChannels[nbQc].getName()); + + return sb.toString(); + } else { + return ""; // should not happen + } + + } + + @Override + public String getToolTipForHeader(int col) { + if (col == COLTYPE_OVERVIEW) { + return m_toolTipColumns[col] + " on " + (m_isXICMode ? m_toolTipQC[m_overviewType] : m_toolTipQC_SC[m_overviewType]); + } + if (col <= LAST_STATIC_COLUMN) { + return m_toolTipColumns[col]; + } else { + int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); + int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); + String rawFilePath = StringUtils.truncate(m_quantChannels[nbQc].getRawFilePath(), 50); + + StringBuilder sb = new StringBuilder(); + String rsmHtmlColor = CyclicColorPalette.getHTMLColor(nbQc); + sb.append("■ "); + if (m_isXICMode) { + sb.append(m_toolTipQC[id]); + } else { + sb.append(m_toolTipQC_SC[id]); + } + sb.append("
"); + sb.append(m_quantChannels[nbQc].getFullName()); + sb.append("
"); + sb.append(rawFilePath); + + sb.append(""); + return sb.toString(); + } + } + + @Override + public String getTootlTipValue(int row, int col) { + return null; + } + + @Override + public Class getColumnClass(int col) { + if (col == COLTYPE_PROTEIN_SET_ID) { + return Long.class; + } else if (col == COLTYPE_OVERVIEW) { + return CompareValueRenderer.CompareValue.class; + } + return LazyData.class; + } + + @Override + public int getSubTaskId(int col) { + return DatabaseLoadXicMasterQuantTask.SUB_TASK_PROTEIN_SET; + } + + @Override + public int getRowCount() { + if (m_proteinSets == null) { + return 0; + } + + return m_proteinSets.size(); + } + + @Override + public Object getValueAt(final int row, int col) { + + // Retrieve MasterQuantProtein Set + DMasterQuantProteinSet proteinSet = m_proteinSets.get(row); + + switch (col) { + case COLTYPE_PROTEIN_SET_ID: { + return proteinSet.getId(); + } + case COLTYPE_PROTEIN_SET_NAME: { + + LazyData lazyData = getLazyData(row, col); + + // Retrieve typical Protein Match + DProteinMatch proteinMatch = null; + if (proteinSet.getProteinSet() != null) { + proteinMatch = proteinSet.getProteinSet().getTypicalProteinMatch(); + if (proteinMatch == null) { + lazyData.setData(""); + } else { + lazyData.setData(proteinMatch.getAccession()); + } + } else { + lazyData.setData(null); + givePriorityTo(m_taskId, row, col); + } + return lazyData; + } + + case COLTYPE_OVERVIEW: + return new CompareValueRenderer.CompareValue() { + + @Override + public int getNumberColumns() { + return m_quantChannels.length; + } + + @Override + public Color getColor(int col) { + return CyclicColorPalette.getColor(col); + } + + @Override + public double getValue(int col) { + if (m_overviewType == -1) { + return 0; // should not happen + }// retrieve quantProteinSet for the quantChannelId + + int realCol = LAST_STATIC_COLUMN + 1 + m_overviewType + col * getColumnPerQCCount(); + LazyData lazyData = (LazyData) getValueAt(row, realCol); + if (lazyData != null && lazyData.getData() != null) { + if (Number.class.isAssignableFrom(lazyData.getData().getClass())) { + return ((Number) lazyData.getData()).floatValue(); + } + } + return 0; + } + + public double getValueNoNaN(int col) { + double val = getValue(col); + if (val != val) { // NaN value + return 0; + } + return val; + } + + @Override + public double getMaximumValue() { + int nbCols = getNumberColumns(); + double maxValue = 0; + for (int i = 0; i < nbCols; i++) { + double v = getValue(i); + if (v > maxValue) { + maxValue = v; + } + } + return maxValue; + + } + + @Override + public double calculateComparableValue() { + int nbColumns = getNumberColumns(); + double mean = 0; + for (int i = 0; i < nbColumns; i++) { + mean += getValueNoNaN(i); + } + mean /= nbColumns; + + double maxDiff = 0; + for (int i = 0; i < nbColumns; i++) { + double diff = getValueNoNaN(i) - mean; + if (diff < 0) { + diff = -diff; + } + if (diff > maxDiff) { + maxDiff = diff; + } + } + return maxDiff / mean; + } + + @Override + public int compareTo(CompareValueRenderer.CompareValue o) { + return Double.compare(calculateComparableValue(), o.calculateComparableValue()); + } + }; + + case COLTYPE_PROTEIN_SET_GENE_NAME:{ + LazyData lazyData = getLazyData(row, col); + + // Retrieve typical Protein Match + DProteinMatch proteinMatch = null; + if (proteinSet.getProteinSet() != null) { + proteinMatch = proteinSet.getProteinSet().getTypicalProteinMatch(); + if (proteinMatch == null) { + lazyData.setData(""); + } else { + String geneName = proteinMatch.getGeneName(); + if(geneName == null ) + geneName = ""; + lazyData.setData(geneName); + } + } else { + lazyData.setData(null); + givePriorityTo(m_taskId, row, col); + } + return lazyData; + } + + case COLTYPE_DESCRIPTION: {//Retrieve the description of the typical protein + LazyData lazyData = getLazyData(row, col); + + // Retrieve typical Protein Match + DProteinMatch proteinMatch = null; + if (proteinSet.getProteinSet() != null) { + proteinMatch = proteinSet.getProteinSet().getTypicalProteinMatch(); + if (proteinMatch == null) { + lazyData.setData(""); + } else { + lazyData.setData(proteinMatch.getDescription()); + } + } else { + lazyData.setData(null); + givePriorityTo(m_taskId, row, col); + } + return lazyData; + } + case COLTYPE_NB_PEPTIDE: { + LazyData lazyData = getLazyData(row, col); + + if (proteinSet.getProteinSet() != null) { + lazyData.setData(proteinSet.getNbPeptides()); + } else { + lazyData.setData(null); + givePriorityTo(m_taskId, row, col); + } + return lazyData; + } + case COLTYPE_NB_QUANT_PEPTIDE: { + LazyData lazyData = getLazyData(row, col); + + if (proteinSet.getProteinSet() != null) { + lazyData.setData(proteinSet.getNbQuantifiedPeptides()); + } else { + lazyData.setData(null); + givePriorityTo(m_taskId, row, col); + } + return lazyData; + } + + default: { + // Quant Channel columns + LazyData lazyData = getLazyData(row, col); + if (proteinSet.getProteinSet() == null) { + lazyData.setData(null); + givePriorityTo(m_taskId, row, col); + } else { + // retrieve quantProteinSet for the quantChannelId + int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); + int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); + Map quantProteinSetByQchIds = proteinSet.getQuantProteinSetByQchIds(); + if (quantProteinSetByQchIds == null) { + switch (id) { + case COLTYPE_PEP_NUMBER: + lazyData.setData(Integer.valueOf(0)); + break; + case COLTYPE_SELECTION_LEVEL: + lazyData.setData(Integer.valueOf(0)); + break; + case COLTYPE_ABUNDANCE: + lazyData.setData(Float.valueOf(0)); + break; + case COLTYPE_RAW_ABUNDANCE: + lazyData.setData(Float.valueOf(0)); + break; + case COLTYPE_PSM: + lazyData.setData(Integer.valueOf(0)); + break; + case COLTYPE_STATUS: //Should only be called for Spectral Count ... + lazyData.setData(""); + break; + } + } else { + DQuantProteinSet quantProteinSet = quantProteinSetByQchIds.get(m_quantChannels[nbQc].getId()); + if (quantProteinSet == null) { + switch (id) { + case COLTYPE_PEP_NUMBER: + lazyData.setData(Integer.valueOf(0)); + break; + case COLTYPE_SELECTION_LEVEL: + lazyData.setData(Integer.valueOf(0)); + break; + case COLTYPE_ABUNDANCE: + lazyData.setData(Float.valueOf(0)); + break; + case COLTYPE_RAW_ABUNDANCE: + lazyData.setData(Float.valueOf(0)); + break; + case COLTYPE_PSM: + lazyData.setData(Integer.valueOf(0)); + break; + case COLTYPE_STATUS: //Should only be called for Spectral Count ... + lazyData.setData(""); + break; + } + } else { + Map quantStatusByQCIds = proteinSet.getQuantStatusByQchIds(); + String status = proteinSet.getQuantStatusByQchIds().getOrDefault(m_quantChannels[nbQc].getId(), ""); + Integer pepNumber = proteinSet.getQuantPeptideNumberByQchIds().get(m_quantChannels[nbQc].getId()); + if (pepNumber == null || pepNumber < 0) { + pepNumber = 0; + } + switch (id) { + case COLTYPE_PEP_NUMBER: + lazyData.setData((quantProteinSet.getPeptidesCount()== null || quantProteinSet.getPeptidesCount()== 0 ) ? pepNumber : quantProteinSet.getPeptidesCount()); + break; + case COLTYPE_SELECTION_LEVEL: + lazyData.setData(quantProteinSet.getSelectionLevel()); + break; + case COLTYPE_ABUNDANCE: + lazyData.setData((quantProteinSet.getAbundance() == null || quantProteinSet.getAbundance().isNaN()) ? Float.valueOf(0) : quantProteinSet.getAbundance()); + break; + case COLTYPE_RAW_ABUNDANCE: + lazyData.setData((quantProteinSet.getRawAbundance() == null || quantProteinSet.getRawAbundance().isNaN()) ? Float.valueOf(0) : quantProteinSet.getRawAbundance()); + break; + case COLTYPE_PSM: + lazyData.setData(quantProteinSet.getPeptideMatchesCount() == null ? Integer.valueOf(0) : quantProteinSet.getPeptideMatchesCount()); + break; + case COLTYPE_STATUS: //Should only be called for Spectral Count ... + lazyData.setData(status); + break; + } + } + } + } + return lazyData; + } + } + //return null; // should never happen + } + + public DMasterQuantProteinSet getMasterQuantProteinSet(int row) { + + // Retrieve QuantProtein Set + DMasterQuantProteinSet quantProteinSet = m_proteinSets.get(row); + return quantProteinSet; + } + + public DProteinSet getProteinSet(int row) { + + // Retrieve Protein Set + DMasterQuantProteinSet quantProteinSet = m_proteinSets.get(row); + return quantProteinSet.getProteinSet(); + } + + public void setData(Long taskId, DQuantitationChannel[] quantChannels, List proteinSets, boolean isXICMode) { + m_quantChannels = quantChannels; + m_quantChannelNumber = quantChannels.length; + m_proteinSets = proteinSets; + m_isXICMode = isXICMode; + + m_taskId = taskId; + + fireTableStructureChanged(); + } + + public void dataUpdated() { + + // no need to do an updateMinMax : scores are known at once + fireTableDataChanged(); + + } + + public boolean dataModified(ArrayList modificationsList) { + HashMap modifiedMap = new HashMap<>(modificationsList.size()); + for (int i = 0; i < modificationsList.size(); i++) { + DMasterQuantProteinSet masterQuantProteinSet = (DMasterQuantProteinSet) modificationsList.get(i); + modifiedMap.put(masterQuantProteinSet.getId(), masterQuantProteinSet); + } + + boolean modificationDone = false; + + for (int i = 0; i < m_proteinSets.size(); i++) { + DMasterQuantProteinSet masterQuantProteinSet = m_proteinSets.get(i); + Long id = masterQuantProteinSet.getId(); + DMasterQuantProteinSet proteinSetModified = modifiedMap.get(id); + if (proteinSetModified != null) { + proteinSetModified.setProteinSet(masterQuantProteinSet.getProteinSet()); + m_proteinSets.set(i, proteinSetModified); + modificationDone = true; + } + } + + if (modificationDone) { + fireTableDataChanged(); + } + + return modificationDone; + } + + public DMasterQuantProteinSet getQuantProteinSet(int i) { + + return m_proteinSets.get(i); + } + + public int findRow(long proteinSetId) { + + int nb = m_proteinSets.size(); + for (int i = 0; i < nb; i++) { + if (proteinSetId == m_proteinSets.get(i).getProteinSetId()) { + return i; + } + } + return -1; + + } + + public void sortAccordingToModel(ArrayList proteinSetIds, CompoundTableModel compoundTableModel) { + + if (m_proteinSets == null) { + // data not loaded + return; + } + + HashSet proteinSetIdMap = new HashSet<>(proteinSetIds.size()); + proteinSetIdMap.addAll(proteinSetIds); + + int nb = m_table.getRowCount(); + int iCur = 0; + for (int iView = 0; iView < nb; iView++) { + int iModel = m_table.convertRowIndexToModel(iView); + if (compoundTableModel != null) { + iModel = compoundTableModel.convertCompoundRowToBaseModelRow(iModel); + } + // Retrieve Protein Set + DMasterQuantProteinSet ps = getQuantProteinSet(iModel); + if (proteinSetIdMap.contains(ps.getProteinSetId())) { + proteinSetIds.set(iCur++, ps.getProteinSetId()); + } + } + + } + + @Override + public void addFilters(LinkedHashMap filtersMap) { + filtersMap.put(COLTYPE_PROTEIN_SET_NAME, new StringDiffFilter(getColumnNameForFilter(COLTYPE_PROTEIN_SET_NAME), null, COLTYPE_PROTEIN_SET_NAME)); + filtersMap.put(COLTYPE_DESCRIPTION, new StringDiffFilter(getColumnNameForFilter(COLTYPE_DESCRIPTION), null, COLTYPE_DESCRIPTION)); + filtersMap.put(COLTYPE_PROTEIN_SET_GENE_NAME, new StringDiffFilter(getColumnNameForFilter(COLTYPE_PROTEIN_SET_GENE_NAME), null, COLTYPE_PROTEIN_SET_GENE_NAME)); + filtersMap.put(COLTYPE_NB_PEPTIDE, new IntegerFilter(getColumnNameForFilter(COLTYPE_NB_PEPTIDE), null, COLTYPE_NB_PEPTIDE)); + filtersMap.put(COLTYPE_NB_QUANT_PEPTIDE, new IntegerFilter(getColumnNameForFilter(COLTYPE_NB_QUANT_PEPTIDE), null, COLTYPE_NB_QUANT_PEPTIDE)); + int nbCol = getColumnCount(); + for (int i = LAST_STATIC_COLUMN + 1; i < nbCol; i++) { + int nbQc = (i - m_columnNames.length) / getColumnPerQCCount(); + int id = i - m_columnNames.length - (nbQc * getColumnPerQCCount()); + switch (id) { + case COLTYPE_PEP_NUMBER: + filtersMap.put(i, new IntegerFilter(getColumnName(i), null, i)); + break; + case COLTYPE_SELECTION_LEVEL: + filtersMap.put(i, new IntegerFilter(getColumnName(i), null, i)); + break; + case COLTYPE_ABUNDANCE: + filtersMap.put(i, new DoubleFilter(getColumnName(i), null, i)); + break; + case COLTYPE_RAW_ABUNDANCE: + filtersMap.put(i, new DoubleFilter(getColumnName(i), null, i)); + break; + case COLTYPE_PSM: + filtersMap.put(i, new IntegerFilter(getColumnName(i), null, i)); + break; + case COLTYPE_STATUS: //should only occur for spectral count + filtersMap.put(i, new StringDiffFilter(getColumnName(i), null, i)); + break; + default: + filtersMap.put(i, new DoubleFilter(getColumnName(i), null, i)); + break; + } + } + } + + @Override + public int getLoadingPercentage() { + return m_table.getLoadingPercentage(); + } + + @Override + public boolean isLoaded() { + return m_table.isLoaded(); + } + + public int getQCCount() { + return m_quantChannels.length; + } + + public int getQCColumStart(int index) { + return m_columnNames.length + index * getColumnPerQCCount(); + } + + public int getQCColumStop(int index) { + return m_columnNames.length + (1 + index) * getColumnPerQCCount() - 1; + } + + public String getQCName(int index) { + + StringBuilder sb = new StringBuilder(); + + String rsmHtmlColor = CyclicColorPalette.getHTMLColor(index); + sb.append("■ "); + sb.append(m_quantChannels[index].getFullName()); + /* sb.append("
"); + sb.append(m_quantChannels[i].getRawFileName());*/ + sb.append(""); + + return sb.toString(); + } + + public String getByQCMColumnName(int index) { + return m_isXICMode ? m_columnNamesQC[index] : m_columnNamesQC_SC[index]; + } + + public int getQCNumber(int col) { + return (col - m_columnNames.length) / getColumnPerQCCount(); + } + + public int getQCColIndex(int col) { + return (col - m_columnNames.length) % getColumnPerQCCount(); + } + + public Long getResultSummaryId() { + if ((m_proteinSets == null) || (m_proteinSets.isEmpty())) { + return null; + } + + return m_proteinSets.get(0).getQuantResultSummaryId(); + } + + public void setOverviewType(int overviewType) { + m_overviewType = overviewType; + fireTableDataChanged(); + } + + public int getOverviewType() { + return m_overviewType; + } + + /** + * by default the abundance and selectionLevel are hidden return the list of + * columns ids of these columns + * + * @return + */ + public List getDefaultColumnsToHide() { + List listIds = new ArrayList(); + listIds.add(COLTYPE_PROTEIN_SET_ID); + listIds.add(COLTYPE_PROTEIN_SET_GENE_NAME); + if (m_quantChannels != null) { + for (int i = m_quantChannels.length - 1; i >= 0; i--) { + listIds.add(m_columnNames.length + COLTYPE_SELECTION_LEVEL + (i * getColumnPerQCCount())); + if (m_isXICMode) { + listIds.add(m_columnNames.length + COLTYPE_RAW_ABUNDANCE + (i * getColumnPerQCCount())); + listIds.add(m_columnNames.length + COLTYPE_PEP_NUMBER + (i * getColumnPerQCCount())); + } + } + } + return listIds; + } + + @Override + public HashSet exportSelection(int[] rows) { + + int nbRows = rows.length; + HashSet selectedObjects = new HashSet(); + for (int i = 0; i < nbRows; i++) { + + int row = rows[i]; + + // Retrieve Protein Set + DMasterQuantProteinSet proteinSet = m_proteinSets.get(row); + + selectedObjects.add(proteinSet.getProteinSet().getId()); + } + return selectedObjects; + } + + @Override + public String getDataColumnIdentifier(int col) { + if (col <= LAST_STATIC_COLUMN) { + return m_columnNamesForFilter[col]; + } else { + int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); + int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); + + StringBuilder sb = new StringBuilder(); + if (m_isXICMode) { + sb.append(m_columnNamesQC[id]); + } else { + sb.append(m_columnNamesQC_SC[id]); + } + sb.append(' '); + sb.append(m_quantChannels[nbQc].getName()); + + return sb.toString(); + } + } + + @Override + public Class getDataColumnClass(int col) { + + switch (col) { + case COLTYPE_PROTEIN_SET_ID: { + return Long.class; + } + case COLTYPE_PROTEIN_SET_GENE_NAME: + case COLTYPE_PROTEIN_SET_NAME: { + return String.class; + } + case COLTYPE_OVERVIEW: { + return CompareValueRenderer.CompareValue.class; + } + case COLTYPE_DESCRIPTION: { + return String.class; + } + case COLTYPE_NB_PEPTIDE: { + return Integer.class; + } + case COLTYPE_NB_QUANT_PEPTIDE: { + return Integer.class; + } + default: { + int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); + int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); + switch (id) { + case COLTYPE_PEP_NUMBER: + return Integer.class; + case COLTYPE_SELECTION_LEVEL: + return Integer.class; + case COLTYPE_ABUNDANCE: + return Float.class; + case COLTYPE_RAW_ABUNDANCE: + return Float.class; + case COLTYPE_PSM: + return Integer.class; + case COLTYPE_STATUS: //Only for Spectral count + return String.class; + } + + } + } + return null; // should never happen + + } + + @Override + public Object getDataValueAt(int rowIndex, int columnIndex) { + Object data = getValueAt(rowIndex, columnIndex); + if (data instanceof LazyData) { + data = ((LazyData) data).getData(); + } + return data; + } + + @Override + public int[] getKeysColumn() { + int[] keys = {COLTYPE_PROTEIN_SET_NAME}; + return keys; + } + + @Override + public void setName(String name) { + m_modelName = name; + } + + @Override + public String getName() { + return m_modelName; + } + + @Override + public int getInfoColumn() { + return COLTYPE_PROTEIN_SET_NAME; + } + + @Override + public Map getExternalData() { + return null; + } + + @Override + public PlotInformation getPlotInformation() { + return null; + } + + @Override + public String getExportRowCell(int row, int col) { + + // Retrieve Protein Set + DMasterQuantProteinSet proteinSet = m_proteinSets.get(row); + //long rsmId = proteinSet.getResultSummaryId(); + + switch (col) { + case COLTYPE_PROTEIN_SET_ID: { + return "" + proteinSet.getId(); + } + case COLTYPE_PROTEIN_SET_NAME: { + // Retrieve typical Protein Match + DProteinMatch proteinMatch = null; + if (proteinSet.getProteinSet() != null) { + proteinMatch = proteinSet.getProteinSet().getTypicalProteinMatch(); + if (proteinMatch == null) { + return ""; + } else { + return proteinMatch.getAccession(); + } + } else { + return ""; + } + } + + case COLTYPE_OVERVIEW: + return ""; + + case COLTYPE_DESCRIPTION: { + if (proteinSet.getProteinSet() != null) { + DProteinMatch proteinMatch = proteinSet.getProteinSet().getTypicalProteinMatch(); + if (proteinMatch == null) { + return(""); + } else { + return proteinMatch.getDescription(); + } + } + return ""; + } + + case COLTYPE_PROTEIN_SET_GENE_NAME: { + if (proteinSet.getProteinSet() != null) { + DProteinMatch proteinMatch = proteinSet.getProteinSet().getTypicalProteinMatch(); + if (proteinMatch == null) { + return(""); + } else { + return proteinMatch.getGeneName(); + } + } + return ""; + } + case COLTYPE_NB_PEPTIDE: { + if (proteinSet.getProteinSet() != null) { + return "" + proteinSet.getNbPeptides(); + } else { + return ""; + } + } + case COLTYPE_NB_QUANT_PEPTIDE: { + if (proteinSet.getProteinSet() != null) { + return "" + proteinSet.getNbQuantifiedPeptides(); + } else { + return ""; + } + } + + default: { + // Quant Channel columns + int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); + int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); + if (proteinSet.getProteinSet() == null) { + switch (id) { + case COLTYPE_PEP_NUMBER: + return Integer.toString(0); + case COLTYPE_SELECTION_LEVEL: + return Integer.toString(0); + case COLTYPE_ABUNDANCE: + return Float.toString(0); + case COLTYPE_RAW_ABUNDANCE: + return Float.toString(0); + case COLTYPE_PSM: + return Integer.toString(0); + case COLTYPE_STATUS: //should only occur for spectral count + return ""; + } + } else { + // retrieve quantProteinSet for the quantChannelId + Map quantProteinSetByQchIds = proteinSet.getQuantProteinSetByQchIds(); + + if (quantProteinSetByQchIds == null) { + switch (id) { + case COLTYPE_PEP_NUMBER: + return Integer.toString(0); + case COLTYPE_SELECTION_LEVEL: + return Integer.toString(0); + case COLTYPE_ABUNDANCE: + return Float.toString(0); + case COLTYPE_RAW_ABUNDANCE: + return Float.toString(0); + case COLTYPE_PSM: + return Integer.toString(0); + case COLTYPE_STATUS: //Should only occur for spectral count + return ""; + } + } else { + DQuantProteinSet quantProteinSet = quantProteinSetByQchIds.get(m_quantChannels[nbQc].getId()); + if (quantProteinSet == null) { + switch (id) { + case COLTYPE_PEP_NUMBER: + return Integer.toString(0); + case COLTYPE_SELECTION_LEVEL: + return Integer.toString(0); + case COLTYPE_ABUNDANCE: + return Float.toString(0); + case COLTYPE_RAW_ABUNDANCE: + return Float.toString(0); + case COLTYPE_PSM: + return Integer.toString(0); + case COLTYPE_STATUS: //Should only occur for spectral count + return ""; + } + } else { + Integer pepNumber = proteinSet.getQuantPeptideNumberByQchIds().get(m_quantChannels[nbQc].getId()); + if (pepNumber == null || pepNumber < 0) { + pepNumber = 0; + } + switch (id) { + case COLTYPE_PEP_NUMBER: + return ( (quantProteinSet.getPeptidesCount()== null || quantProteinSet.getPeptidesCount()== 0) ? Integer.toString(pepNumber) : Integer.toString(quantProteinSet.getPeptidesCount())); + case COLTYPE_SELECTION_LEVEL: + return (quantProteinSet.getSelectionLevel() == null ? Integer.toString(0) : Integer.toString(quantProteinSet.getSelectionLevel())); + case COLTYPE_ABUNDANCE: + return ((quantProteinSet.getAbundance() == null || quantProteinSet.getAbundance().isNaN()) ? Float.toString(0) : Float.toString(quantProteinSet.getAbundance())); + case COLTYPE_RAW_ABUNDANCE: + return ((quantProteinSet.getRawAbundance() == null || quantProteinSet.getRawAbundance().isNaN()) ? Float.toString(0) : Float.toString(quantProteinSet.getRawAbundance())); + case COLTYPE_PSM: + return (quantProteinSet.getPeptideMatchesCount() == null ? Integer.toString(0) : Integer.toString(quantProteinSet.getPeptideMatchesCount())); + case COLTYPE_STATUS: //should only occur for spectral count + String status = proteinSet.getQuantStatusByQchIds().get(m_quantChannels[nbQc].getId()); + return status; + } + } + } + } + } + } + return ""; // should never happen + } + + @Override + public ArrayList getExportFonts(int row, int col) { + return null; + } + + @Override + public PlotType getBestPlotType() { + return null; //JPM.TODO + } + + @Override + public int[] getBestColIndex(PlotType plotType) { + return null; + } + + public Boolean containsModifiedQuantProteinSet() { + Boolean containsModifed = false; + try { + int nbRow = getRowCount(); + for (int i = 0; i < nbRow; i++) { + DMasterQuantProteinSet proteinSet = m_proteinSets.get(i); + Map pmqSerializedMap = proteinSet.getSerializedPropertiesAsMap(); + if ((pmqSerializedMap != null) && (pmqSerializedMap.containsKey(DMasterQuantProteinSet.MASTER_QUANT_PROTEINSET_WITH_PEPTIDE_MODIFIED)) && (pmqSerializedMap.get(DMasterQuantProteinSet.MASTER_QUANT_PROTEINSET_WITH_PEPTIDE_MODIFIED).equals(Boolean.TRUE))) { + containsModifed = true; + break; + } + + } + + } catch (Exception e) { + // should not happen + } + + return containsModifed; + } + + public ArrayList getModifiedQuantProteinSet() { + + ArrayList masterQuantProteinSetModified = new ArrayList<>(); + try { + int nbRow = getRowCount(); + for (int i = 0; i < nbRow; i++) { + DMasterQuantProteinSet proteinSet = m_proteinSets.get(i); + Map pmqSerializedMap = proteinSet.getSerializedPropertiesAsMap(); + if ((pmqSerializedMap != null) && (pmqSerializedMap.containsKey(DMasterQuantProteinSet.MASTER_QUANT_PROTEINSET_WITH_PEPTIDE_MODIFIED)) && (pmqSerializedMap.get(DMasterQuantProteinSet.MASTER_QUANT_PROTEINSET_WITH_PEPTIDE_MODIFIED).equals(Boolean.TRUE))) { + masterQuantProteinSetModified.add(proteinSet); + } + + } + + } catch (Exception e) { + // should not happen + } + + return masterQuantProteinSetModified; + } + + @Override + public TableCellRenderer getRenderer(int row, int col) { + + if (m_proteinSets == null) { + return null; + } + + DMasterQuantProteinSet proteinSet = m_proteinSets.get(row); + + boolean grayed = false; + + try { + Map pmqSerializedMap = proteinSet.getSerializedPropertiesAsMap(); + grayed = ((pmqSerializedMap != null) && (pmqSerializedMap.containsKey(DMasterQuantProteinSet.MASTER_QUANT_PROTEINSET_WITH_PEPTIDE_MODIFIED)) && pmqSerializedMap.get(DMasterQuantProteinSet.MASTER_QUANT_PROTEINSET_WITH_PEPTIDE_MODIFIED).equals(Boolean.TRUE)); + } catch (Exception e) { + + } + + if (grayed) { + if (m_rendererMapGrayed.containsKey(col)) { + return m_rendererMapGrayed.get(col); + } + } else { + if (m_rendererMap.containsKey(col)) { + return m_rendererMap.get(col); + } + } + + TableCellRenderer renderer = null; + + switch (col) { + case COLTYPE_PROTEIN_SET_ID: { + break; + } + case COLTYPE_PROTEIN_SET_NAME: { + renderer = new URLCellRenderer("URL_Template_Protein_Accession", "http://www.uniprot.org/uniprot/", COLTYPE_PROTEIN_SET_NAME); + break; + } + case COLTYPE_OVERVIEW: { + renderer = new CompareValueRenderer(); + break; + } + case COLTYPE_NB_PEPTIDE: + case COLTYPE_NB_QUANT_PEPTIDE: { + renderer = new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(Integer.class)); + break; + } + default: { + int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); + int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); + switch (id) { + case COLTYPE_PEP_NUMBER: + renderer = new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(Integer.class)); +// if (m_isXICMode) { +// renderer = new GrayedRenderer(renderer); +// } + break; + case COLTYPE_SELECTION_LEVEL: + case COLTYPE_PSM: { + renderer = new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(Integer.class)); + break; + } + case COLTYPE_ABUNDANCE: { + if (m_isXICMode) { + renderer = new BigFloatOrDoubleRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)), 0); + } else { + renderer = new FloatRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)), 2); + } + break; + } + case COLTYPE_RAW_ABUNDANCE: { + if (m_isXICMode) { + renderer = new BigFloatOrDoubleRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)), 0); + } else { + renderer = new FloatRenderer(new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)), 0); + } + break; + } +// case COLTYPE_STATUS: +// if (m_isXICMode) { +// renderer = new DefaultRightAlignRenderer(TableDefaultRendererManager.getDefaultRenderer(String.class)); +// renderer = new GrayedRenderer(renderer); +// } +// break; + } + } + } + + if (grayed) { + if (renderer == null) { + return null; + } + renderer = new GrayedRenderer(renderer); + m_rendererMapGrayed.put(col, renderer); + } else { + m_rendererMap.put(col, renderer); + } + + return renderer; + } + private final HashMap m_rendererMap = new HashMap(); + private final HashMap m_rendererMapGrayed = new HashMap(); + + @Override + public GlobalTableModelInterface getFrozzenModel() { + return this; + } + + @Override + public ArrayList getExtraDataTypes() { + ArrayList list = new ArrayList<>(); + list.add(new ExtraDataType(DProteinSet.class, true)); + list.add(new ExtraDataType(DMasterQuantProteinSet.class, true)); + list.add(new ExtraDataType(DDataset.class, false)); + list.add(new ExtraDataType(QuantChannelInfo.class, false)); + list.add(new ExtraDataType(ResultSummary.class, false)); + list.add(new ExtraDataType(XicMode.class, false)); + registerSingleValuesAsExtraTypes(list); + return list; + } + + @Override + public Object getValue(Class c) { + return getSingleValue(c); + } + + @Override + public Object getRowValue(Class c, int row) { + if (c.equals(DMasterQuantProteinSet.class)) { + return m_proteinSets.get(row); + } + if (c.equals(DProteinSet.class)) { + DMasterQuantProteinSet masterQuantProteinSet = m_proteinSets.get(row); + return (masterQuantProteinSet != null) ? masterQuantProteinSet.getProteinSet() : null; + + } + return null; + } + + @Override + public Object getColValue(Class c, int col) { + if (c.equals(XicGroup.class)) { + if (col <= LAST_STATIC_COLUMN) { + return null; + } else { + int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); + return new XicGroup(m_quantChannels[nbQc].getBiologicalGroupId(), null); //biologicalGroupName.getBiologicalGroupName(); JPM.TODO + } + + } + if (c.equals(QuantitationType.class)) { + if (col <= LAST_STATIC_COLUMN) { + return null; + } else { + int nbQc = (col - m_columnNames.length) / getColumnPerQCCount(); + int id = col - m_columnNames.length - (nbQc * getColumnPerQCCount()); + if (m_isXICMode) { + switch (id) { + case COLTYPE_ABUNDANCE: + return QuantitationType.getQuantitationType(QuantitationType.ABUNDANCE); + case COLTYPE_RAW_ABUNDANCE: + return QuantitationType.getQuantitationType(QuantitationType.RAW_ABUNDANCE); + } + } else { + switch (id) { + case COLTYPE_PSM: + return QuantitationType.getQuantitationType(QuantitationType.BASIC_SC); + case COLTYPE_RAW_ABUNDANCE: + return QuantitationType.getQuantitationType(QuantitationType.SPECIFIC_SC); + case COLTYPE_ABUNDANCE: + return QuantitationType.getQuantitationType(QuantitationType.WEIGHTED_SC); + } + } + + return null; + } + + } + return null; + } +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XICComparePeptideTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XICComparePeptideTableModel.java index d32182396..cfc11a5d8 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XICComparePeptideTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XICComparePeptideTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -22,8 +22,10 @@ import fr.proline.core.orm.uds.dto.DQuantitationChannel; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; import fr.proline.studio.extendedtablemodel.ExtraDataType; +import fr.proline.studio.graphics.BestGraphicsInterface; import fr.proline.studio.graphics.PlotDataSpec; import fr.proline.studio.graphics.PlotInformation; +import fr.proline.studio.graphics.PlotType; import fr.proline.studio.rsmexplorer.gui.renderer.PeptideRenderer; import fr.proline.studio.table.LazyData; import fr.proline.studio.utils.GlobalValues; @@ -40,7 +42,7 @@ * * @author Karine XUE at CEA */ -public class XICComparePeptideTableModel implements ExtendedTableModelInterface,TableModel { +public class XICComparePeptideTableModel implements ExtendedTableModelInterface,TableModel, BestGraphicsInterface { public static final int COLTYPE_QC_ID = 0; public static final int COLTYPE_QC_NAME = 1; @@ -74,7 +76,6 @@ public void setData(DQuantitationChannel[] quantChannels, DMasterQuantPeptide pe /** * copy of javax.swing.table.AbstractTableModel.java * - * @param e */ public void fireTableDataChanged() { fireTableChanged(new TableModelEvent(this)); @@ -362,4 +363,22 @@ public void addTableModelListener(TableModelListener l) { public void removeTableModelListener(TableModelListener l) { listenerList.remove(TableModelListener.class, l); } + + @Override + public PlotType getBestPlotType() { + return PlotType.LINEAR_PLOT; + } + + @Override + public int[] getBestColIndex(PlotType plotType) { + switch (plotType) { + case LINEAR_PLOT: { + int[] cols = new int[2]; + cols[0] = COLTYPE_QC_NAME; + cols[1] = COLTYPE_ABUNDANCE; + return cols; + } + } + return null; + } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicAbundanceProteinTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicAbundanceProteinTableModel.java index 27b959221..565d72e6f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicAbundanceProteinTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicAbundanceProteinTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicFeaturePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicFeaturePanel.java index bb8856c1f..bbfbc007f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicFeaturePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicFeaturePanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -44,7 +44,7 @@ import fr.proline.studio.pattern.WindowBoxFactory; import fr.proline.studio.progress.ProgressBarDialog; import fr.proline.studio.progress.ProgressInterface; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.actions.table.DisplayTablePopupMenu; import fr.proline.studio.extendedtablemodel.CompoundTableModel; import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; @@ -71,7 +71,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.TableModelListener; import org.jdesktop.swingx.JXTable; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; import fr.proline.studio.pattern.ParameterSubtypeEnum; import fr.proline.studio.pattern.xic.DataboxChildFeature; @@ -222,9 +222,8 @@ public void actionPerformed(ActionEvent e) { wbox.setEntryData(m_dataBox.getProjectId(), null); //JPM.DATABOX : it works with null, there must be a wart somewhere so it works.. // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } }); @@ -340,8 +339,8 @@ private JPanel createInternalPanel() { return internalPanel; } - public void setData(Long taskId, List features, QuantChannelInfo quantChannelInfo, List featureHasPeak, boolean finished) { - ((FeatureTableModel) ((CompoundTableModel) m_featureTable.getModel()).getBaseModel()).setData(taskId, features, quantChannelInfo, featureHasPeak); + public void setData(Long taskId, List features, QuantChannelInfo quantChannelInfo, List featureHasPeak, boolean finished, DMasterQuantPeptideIon peptideIon) { + ((FeatureTableModel) ((CompoundTableModel) m_featureTable.getModel()).getBaseModel()).setData(taskId, features, quantChannelInfo, featureHasPeak, peptideIon); if (features == null) { m_titleLabel.setText(TABLE_TITLE); @@ -465,7 +464,7 @@ public void valueChanged(ListSelectionEvent e) { } m_dataBox.addDataChanged(Feature.class); - + if (m_viewType == VIEW_ALL_ISOTOPES_FOR_FEATURE) { ((DataboxChildFeature) m_dataBox).propagateModelChangeWithoutModifyingZoom(); } else { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicParentPeptideIonPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicParentPeptideIonPanel.java index 80269d575..fce45d754 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicParentPeptideIonPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicParentPeptideIonPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeakPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeakPanel.java index 2292030a7..c2ca1abbf 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeakPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeakPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -36,7 +36,7 @@ import fr.proline.studio.pattern.WindowBoxFactory; import fr.proline.studio.progress.ProgressBarDialog; import fr.proline.studio.progress.ProgressInterface; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.extendedtablemodel.CompoundTableModel; import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; import fr.proline.studio.table.LazyTable; @@ -52,7 +52,6 @@ import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; import javax.swing.JButton; import javax.swing.JLayeredPane; @@ -62,7 +61,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.TableModelListener; import org.jdesktop.swingx.JXTable; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; /** @@ -185,9 +184,8 @@ public void actionPerformed(ActionEvent e) { wbox.setEntryData(m_dataBox.getProjectId(), m_dataBox.getData(ExtendedTableModelInterface.class)); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } }); toolbar.add(m_graphicsButton); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeakelPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeakelPanel.java index a57984b00..2d833ed3b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeakelPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeakelPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -35,7 +35,7 @@ import fr.proline.studio.pattern.WindowBoxFactory; import fr.proline.studio.progress.ProgressBarDialog; import fr.proline.studio.progress.ProgressInterface; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.actions.table.DisplayTablePopupMenu; import fr.proline.studio.extendedtablemodel.CompoundTableModel; import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; @@ -61,7 +61,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.TableModelListener; import org.jdesktop.swingx.JXTable; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; /** @@ -184,9 +184,8 @@ public void actionPerformed(ActionEvent e) { wbox.setEntryData(m_dataBox.getProjectId(), m_dataBox.getData(ExtendedTableModelInterface.class)); // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } }); toolbar.add(m_graphicsButton); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptideIonPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptideIonPanel.java index aebe4b4e9..d4c1cabbd 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptideIonPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptideIonPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptideMatchPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptideMatchPanel.java index 7f46278c0..ee9c23259 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptideMatchPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptideMatchPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptideMatchTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptideMatchTableModel.java index 0f20e3270..45efa3bd6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptideMatchTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptideMatchTableModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -22,34 +22,28 @@ import fr.proline.core.orm.msi.dto.DPeptideMatch; import fr.proline.core.orm.uds.dto.DQuantitationChannel; import fr.proline.studio.corewrapper.util.PeptideClassesUtils; -import fr.proline.studio.extendedtablemodel.ExtraDataType; import fr.proline.studio.export.ExportFontData; -import fr.proline.studio.filter.ConvertValueInterface; -import fr.proline.studio.filter.DoubleFilter; -import fr.proline.studio.filter.Filter; -import fr.proline.studio.filter.IntegerFilter; +import fr.proline.studio.extendedtablemodel.CompoundTableModel; +import fr.proline.studio.extendedtablemodel.ExtraDataType; +import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; +import fr.proline.studio.filter.*; import fr.proline.studio.graphics.PlotInformation; import fr.proline.studio.graphics.PlotType; -import fr.proline.studio.table.renderer.DefaultLeftAlignRenderer; -import fr.proline.studio.table.renderer.DefaultRightAlignRenderer; import fr.proline.studio.rsmexplorer.gui.renderer.FloatRenderer; import fr.proline.studio.rsmexplorer.gui.renderer.MsQueryRenderer; import fr.proline.studio.rsmexplorer.gui.renderer.PeptideRenderer; import fr.proline.studio.rsmexplorer.gui.renderer.ScoreRenderer; -import fr.proline.studio.extendedtablemodel.CompoundTableModel; -import fr.proline.studio.extendedtablemodel.GlobalTableModelInterface; -import fr.proline.studio.filter.StringDiffFilter; import fr.proline.studio.table.LazyData; import fr.proline.studio.table.LazyTable; import fr.proline.studio.table.LazyTableModel; import fr.proline.studio.table.TableDefaultRendererManager; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import fr.proline.studio.table.renderer.DefaultLeftAlignRenderer; +import fr.proline.studio.table.renderer.DefaultRightAlignRenderer; + import javax.swing.table.TableCellRenderer; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.*; /** * @@ -206,7 +200,9 @@ public Object getValueAt(int row, int col) { } case COLTYPE_PEPTIDE_EXPERIMENTAL_MOZ: { - lazyData.setData(Float.valueOf((float) peptideMatch.getExperimentalMoz())); + BigDecimal bd = new BigDecimal(peptideMatch.getExperimentalMoz()); + Float expMoz = bd.setScale(4, RoundingMode.HALF_UP).floatValue(); + lazyData.setData(expMoz); return lazyData; } case COLTYPE_PEPTIDE_PPM: { @@ -230,7 +226,8 @@ public Object getValueAt(int row, int col) { givePriorityTo(m_taskId, row, col); lazyData.setData(null); } else { - Float calculatedMass = Float.valueOf((float) peptide.getCalculatedMass()) ; + BigDecimal bd = new BigDecimal(peptide.getCalculatedMass()); + Float calculatedMass = bd.setScale(4, RoundingMode.HALF_UP).floatValue(); lazyData.setData(calculatedMass); } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptidePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptidePanel.java index 74fa65d8b..78fd03fc2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptidePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicPeptidePanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -19,6 +19,7 @@ import fr.proline.core.orm.msi.dto.DMasterQuantPeptide; import fr.proline.core.orm.msi.dto.DMasterQuantProteinSet; import fr.proline.core.orm.uds.dto.DQuantitationChannel; +import fr.proline.studio.dam.data.SelectLevelEnum; import fr.proline.studio.extendedtablemodel.AddDataAnalyzerButton; import fr.proline.studio.extendedtablemodel.GlobalTabelModelProviderInterface; import fr.proline.studio.dam.tasks.SubTask; @@ -42,8 +43,9 @@ import fr.proline.studio.pattern.WindowBoxFactory; import fr.proline.studio.progress.ProgressBarDialog; import fr.proline.studio.progress.ProgressInterface; +import fr.proline.studio.rsmexplorer.gui.SelectLevelRadioButtonGroup; import fr.proline.studio.table.TableInfo; -import fr.proline.studio.rsmexplorer.DataBoxViewerTopComponent; +import fr.proline.studio.rsmexplorer.DataBoxViewerTopPanel; import fr.proline.studio.rsmexplorer.actions.table.DisplayTablePopupMenu; import fr.proline.studio.search.SearchToggleButton; import fr.proline.studio.extendedtablemodel.CompoundTableModel; @@ -77,7 +79,7 @@ import javax.swing.table.TableColumn; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.table.TableColumnExt; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; import fr.proline.studio.gui.DefaultDialog; import fr.proline.studio.rsmexplorer.gui.renderer.RendererMouseCallback; @@ -139,7 +141,7 @@ private void initComponents(boolean xicMode) { ToolTipManager.sharedInstance().setInitialDelay(0); ToolTipManager.sharedInstance().setDismissDelay(5000); - + final JPanel peptidePanel = createPeptidePanel(xicMode); final JLayeredPane layeredPane = new JLayeredPane(); @@ -237,9 +239,8 @@ public void actionPerformed(ActionEvent e) { WindowBox wbox = WindowBoxFactory.getMultiGraphicsWindowBox("Peptide Graphic", m_dataBox, false); wbox.setEntryData(m_dataBox.getProjectId(), null); //JPM.DATABOX : it can work with null, there must be a wart somewhere so it works.. // open a window to display the window box - DataBoxViewerTopComponent win = new DataBoxViewerTopComponent(wbox); - win.open(); - win.requestActive(); + DataBoxViewerTopPanel win = new DataBoxViewerTopPanel(wbox); + WindowManager.getDefault().getMainWindow().displayWindow(win); } }); toolbar.add(m_graphicsButton); @@ -770,13 +771,13 @@ class ModifyStatusDialog extends DefaultDialog { private static final String CMD_VALIDATED = "Validated"; private static final String CMD_INVALIDATED = "Invalidated"; private static final String CMD_RESET = "Reset Status to Automatic"; - + //XRadioButtonPanel _localValidButtonPane; //XRadioButtonPanel _localInvalidButtonPane; //JPM.LOCAL : put back if we can modify local values private LocalStatusPanel m_localStatusPanel; - - private XRadioButtonGroup m_globalValidButtonPane; - private XRadioButtonGroup m_globalInvalidButtonPane; + + private SelectLevelRadioButtonGroup m_globalValidButtonPane; + private SelectLevelRadioButtonGroup m_globalInvalidButtonPane; private ButtonGroup m_globalButtonGroup; private JButton m_resetButton; @@ -785,9 +786,9 @@ class ModifyStatusDialog extends DefaultDialog { public ModifyStatusDialog() { super(WindowManager.getDefault().getMainWindow(), Dialog.ModalityType.APPLICATION_MODAL); - + setTitle("Modify Peptide Status"); - + m_internalPanel = new ModifyStatusPanel(); String help_text = "Peptide status is the combination between the global status" @@ -807,10 +808,10 @@ protected boolean okCalled() { actionStarted(); String command = m_globalButtonGroup.getSelection().getActionCommand(); if (command.equals(CMD_VALIDATED)) { - ArrayList listToModify = m_quantPeptideTableModel.listToModifyForValidateModifications(m_selectedRows, XicStatusRenderer.SelectLevelEnum.SELECTED_MANUAL); + ArrayList listToModify = m_quantPeptideTableModel.listToModifyForValidateModifications(m_selectedRows, SelectLevelEnum.SELECTED_MANUAL); m_quantPeptideTableModel.validateModifications(XicPeptidePanel.this, listToModify); } else if (command.equals(CMD_INVALIDATED)) { - ArrayList listToModify = m_quantPeptideTableModel.listToModifyForValidateModifications(m_selectedRows, XicStatusRenderer.SelectLevelEnum.DESELECTED_MANUAL); + ArrayList listToModify = m_quantPeptideTableModel.listToModifyForValidateModifications(m_selectedRows, SelectLevelEnum.DESELECTED_MANUAL); m_quantPeptideTableModel.validateModifications(XicPeptidePanel.this, listToModify); } super.m_buttonClicked = BUTTON_OK; @@ -821,8 +822,8 @@ private ActionListener createResetAction() { ActionListener resetAction = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - ArrayList listToModify = m_quantPeptideTableModel.listToModifyForValidateModifications(m_selectedRows, XicStatusRenderer.SelectLevelEnum.RESET_AUTO); - + ArrayList listToModify = m_quantPeptideTableModel.listToModifyForValidateModifications(m_selectedRows, SelectLevelEnum.RESET_AUTO); + m_quantPeptideTableModel.validateModifications(XicPeptidePanel.this, listToModify); } }; @@ -849,7 +850,7 @@ public void actionStarted() { m_internalPanel.setLoading(1, true); } - /** + /* * single selected, trigger by mouse clic on column * QuantPeptideTableModel.COLTYPE_MQPEPTIDE_SELECTION_LEVEL * @@ -865,23 +866,23 @@ public void actionStarted() { m_selectedPeptide = (DMasterQuantPeptide) m_quantPeptideTableModel.getRowValue(DMasterQuantPeptide.class, modelRow); if (m_selectedPeptide != null) {//single select - int globalSelectLevel = m_selectedPeptide.getSelectionLevel(); + int globalSelectLevel = m_selectedPeptide.getSelectionLevel(); updateRadioButton(XicStatusRenderer.SelectLevelEnum.valueOf(globalSelectLevel), m_globalValidButtonPane, m_globalInvalidButtonPane); XicStatusRenderer.SelectLevel selectLevel = m_quantPeptideTableModel.getSelectionLevelFor(m_selectedPeptide); - + updateLocal(selectLevel.m_status, m_localStatusPanel); //JPM.LOCAL //updateRadioButton(selectLevel.m_status, _localValidButtonPane, _localInvalidButtonPane); - } + } } - + ArrayList listToModify = m_quantPeptideTableModel.listToModifyForValidateModifications(m_selectedRows, XicStatusRenderer.SelectLevelEnum.RESET_AUTO); m_resetButton.setEnabled(listToModify != null); - + }*/ - - private void updateRadioButton(ButtonGroup buttonGroup, boolean selectLevelHomogenous, XicStatusRenderer.SelectLevelEnum selectLevel, XRadioButtonGroup validPane, XRadioButtonGroup invalidPane) { + + private void updateRadioButton(ButtonGroup buttonGroup, boolean selectLevelHomogenous, SelectLevelEnum selectLevel, SelectLevelRadioButtonGroup validPane, SelectLevelRadioButtonGroup invalidPane) { if (selectLevelHomogenous) { switch (selectLevel) { @@ -909,20 +910,20 @@ private void updateRadioButton(ButtonGroup buttonGroup, boolean selectLevelHomog buttonGroup.clearSelection(); } } - - private void updateLocal(boolean localSelectLevelHomogenous, XicStatusRenderer.SelectLevelEnum selectLevel, LocalStatusPanel statusPanel) { - boolean automatic = (selectLevel == XicStatusRenderer.SelectLevelEnum.DESELECTED_AUTO) || (selectLevel == XicStatusRenderer.SelectLevelEnum.SELECTED_AUTO); - boolean validated = (selectLevel == XicStatusRenderer.SelectLevelEnum.SELECTED_AUTO) || (selectLevel == XicStatusRenderer.SelectLevelEnum.SELECTED_MANUAL); - + private void updateLocal(boolean localSelectLevelHomogenous, SelectLevelEnum selectLevel, LocalStatusPanel statusPanel) { + + boolean automatic = (selectLevel == SelectLevelEnum.DESELECTED_AUTO) || (selectLevel == SelectLevelEnum.SELECTED_AUTO); + boolean validated = (selectLevel == SelectLevelEnum.SELECTED_AUTO) || (selectLevel == SelectLevelEnum.SELECTED_MANUAL); + statusPanel.setValues(localSelectLevelHomogenous, validated, automatic); - + } /** * multi select, trigger by m_modifyStatusButton * - * @param selectedRows: non empty array, table row orignal index, not + * @param selectedViewRows: non empty array, table row orignal index, not * model index */ /*private void setSelectedRowsOLD(int[] selectedViewRows) { @@ -936,37 +937,37 @@ private void updateLocal(boolean localSelectLevelHomogenous, XicStatusRenderer.S } m_globalValidButtonPane.removeOptionIcon(); m_globalInvalidButtonPane.removeOptionIcon(); - + m_localStatusPanel.resetValues(); } - + ArrayList listToModify = m_quantPeptideTableModel.listToModifyForValidateModifications(m_selectedRows, XicStatusRenderer.SelectLevelEnum.RESET_AUTO); m_resetButton.setEnabled(listToModify != null); }*/ private void setSelectedRows(int[] selectedViewRows) { - + m_selectedRows.clear(); for (int row : selectedViewRows) { int modelIndex = m_quantPeptideTable.convertRowIndexToModel(row); m_selectedRows.add(modelIndex); } - + DMasterQuantPeptide firstSelectedPeptide = (DMasterQuantPeptide) m_quantPeptideTableModel.getRowValue(DMasterQuantPeptide.class, m_selectedRows.get(0)); if (m_selectedRows.size() == 1) { m_selectedPeptide = firstSelectedPeptide; } - + boolean globalSelectLevelHomogenous = true; - int globalSelectLevelRef = firstSelectedPeptide.getSelectionLevel(); + int globalSelectLevelRef = firstSelectedPeptide.getSelectionLevel(); for (int modelIndex : m_selectedRows) { DMasterQuantPeptide selectedPeptide = (DMasterQuantPeptide) m_quantPeptideTableModel.getRowValue(DMasterQuantPeptide.class, modelIndex); - int globalSelectLevelCur = selectedPeptide.getSelectionLevel(); + int globalSelectLevelCur = selectedPeptide.getSelectionLevel(); if (globalSelectLevelRef != globalSelectLevelCur) { globalSelectLevelHomogenous = false; break; } } - updateRadioButton(m_globalButtonGroup, globalSelectLevelHomogenous, XicStatusRenderer.SelectLevelEnum.valueOf(globalSelectLevelRef), m_globalValidButtonPane, m_globalInvalidButtonPane); + updateRadioButton(m_globalButtonGroup, globalSelectLevelHomogenous, SelectLevelEnum.valueOf(globalSelectLevelRef), m_globalValidButtonPane, m_globalInvalidButtonPane); boolean localSelectLevelHomogenous = true; int localSelectLevelRef = m_quantPeptideTableModel.getSelectionLevelFor(firstSelectedPeptide).m_status.getIntValue(); @@ -983,8 +984,8 @@ private void setSelectedRows(int[] selectedViewRows) { //updateRadioButton(localSelectLevelHomogenous, selectLevel.m_status, _localValidButtonPane, _localInvalidButtonPane); - - ArrayList listToModify = m_quantPeptideTableModel.listToModifyForValidateModifications(m_selectedRows, XicStatusRenderer.SelectLevelEnum.RESET_AUTO); + + ArrayList listToModify = m_quantPeptideTableModel.listToModifyForValidateModifications(m_selectedRows, SelectLevelEnum.RESET_AUTO); m_resetButton.setEnabled(listToModify != null); } @@ -992,13 +993,13 @@ class ModifyStatusPanel extends HourglassPanel { ModifyStatusPanel() { super(); - + //create local items m_selectedRows = new ArrayList(); - + // Local Status JPanel localPane = createLocalStatusPanel(); - + // global status JPanel globalPane = createGlobalStatusPanel(); @@ -1013,12 +1014,12 @@ class ModifyStatusPanel extends HourglassPanel { setBounds(0, 0, (int) d.getWidth(), (int) d.getHeight()); } } - + private JPanel createLocalStatusPanel() { - + JLabel localText = new JLabel("Status for Selected Protein Set :"); m_localStatusPanel = new LocalStatusPanel(); - + JPanel localPane = new JPanel(new GridBagLayout()); localPane.setBorder(BorderFactory.createTitledBorder(" Peptide Local Status")); GridBagConstraints c = new GridBagConstraints(); @@ -1030,22 +1031,22 @@ private JPanel createLocalStatusPanel() { c.fill = GridBagConstraints.BOTH; localPane.add(Box.createHorizontalStrut(20), c); - + c.gridx++; localPane.add(localText, c); - + c.gridx++; localPane.add(Box.createHorizontalStrut(10), c); c.gridx++; localPane.add(m_localStatusPanel, c); - + c.gridx++; c.weightx = 1; localPane.add(Box.createGlue(), c); c.weightx = 0; - - + + return localPane; /*localPane.add(_localValidButtonPane, c1); c1.gridy++; @@ -1060,7 +1061,7 @@ private JPanel createLocalStatusPanel() { localButtonGroup.add(_localValidButtonPane.getRadioButton()); localButtonGroup.add(_localInvalidButtonPane.getRadioButton());*/ //JPM.LOCAL } - + private JPanel createGlobalStatusPanel() { JPanel globalPane = new JPanel(new GridBagLayout()); @@ -1075,20 +1076,20 @@ private JPanel createGlobalStatusPanel() { JLabel globalTextLabel = new JLabel("Status for Whole Dataset :"); globalPane.add(Box.createHorizontalStrut(20), c); - + c.gridx++; globalPane.add(globalTextLabel, c); - + c.gridx++; globalPane.add(Box.createHorizontalStrut(10), c); int anchor = c.gridx + 1; c.gridx = anchor; - m_globalValidButtonPane = new XRadioButtonGroup(globalPane, c, CMD_VALIDATED, IconManager.getIcon(IconManager.IconType.VALIDATED)); + m_globalValidButtonPane = new SelectLevelRadioButtonGroup(globalPane, c, CMD_VALIDATED, IconManager.getIcon(IconManager.IconType.VALIDATED)); c.gridy++; c.gridx = anchor; - m_globalInvalidButtonPane = new XRadioButtonGroup(globalPane, c, CMD_INVALIDATED, IconManager.getIcon(IconManager.IconType.INVALIDATED)); + m_globalInvalidButtonPane = new SelectLevelRadioButtonGroup(globalPane, c, CMD_INVALIDATED, IconManager.getIcon(IconManager.IconType.INVALIDATED)); m_globalValidButtonPane.getRadioButton().setActionCommand(CMD_VALIDATED); m_globalInvalidButtonPane.getRadioButton().setActionCommand(CMD_INVALIDATED); @@ -1124,21 +1125,21 @@ private JPanel createGlobalStatusPanel() { } - + private class LocalStatusPanel extends JPanel { - + private final JLabel m_textLabel; private final JLabel m_validatedlabel; private final JLabel m_automaticLabel; public LocalStatusPanel() { setLayout(new GridBagLayout()); - + GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.NORTHWEST; c.fill = GridBagConstraints.BOTH; c.insets = new java.awt.Insets(1, 1, 1, 1); - + m_textLabel = new JLabel(); m_validatedlabel = new JLabel() { @Override @@ -1152,27 +1153,27 @@ public Dimension getPreferredSize() { return new Dimension(16,16); } }; - + c.gridx = 0; add(m_textLabel, c); - + c.gridx++; add(Box.createHorizontalStrut(10), c); - + c.gridx++; add(m_validatedlabel, c); - + c.gridx++; add(m_automaticLabel, c); } - + public void setValues(boolean localSelectLevelHomogenous, boolean validated, boolean automatic) { - + if (!localSelectLevelHomogenous) { resetValues(); return; } - + if (validated) { m_textLabel.setText("Validated"); m_validatedlabel.setIcon(IconManager.getIcon(IconManager.IconType.VALIDATED)); @@ -1182,7 +1183,7 @@ public void setValues(boolean localSelectLevelHomogenous, boolean validated, boo m_validatedlabel.setIcon(IconManager.getIcon(IconManager.IconType.INVALIDATED)); m_validatedlabel.setToolTipText("Invalidated"); } - + if (automatic) { m_automaticLabel.setIcon(IconManager.getIcon(IconManager.IconType.GEAR)); m_automaticLabel.setToolTipText("Automatic"); @@ -1191,7 +1192,7 @@ public void setValues(boolean localSelectLevelHomogenous, boolean validated, boo m_automaticLabel.setToolTipText("Manual"); } } - + public void resetValues() { m_textLabel.setText("Heterogeneous Values"); m_validatedlabel.setIcon(null); @@ -1201,88 +1202,5 @@ public void resetValues() { } } - - /** - * Utility which show one JRadioButton with 2 icon after text - */ - private class XRadioButtonGroup { - - private final JRadioButton m_radioButton; - private final JLabel m_validationLabel; - private final JLabel m_automaticLabel; - public XRadioButtonGroup(JPanel p, GridBagConstraints c, String text, ImageIcon icon) { - - m_radioButton = new JRadioButton(text); - - m_validationLabel = new JLabel(icon){ - @Override - public Dimension getPreferredSize() { - return new Dimension(16,16); - } - }; - m_validationLabel.setHorizontalTextPosition(JLabel.LEFT); - m_validationLabel.setVerticalTextPosition(JLabel.BOTTOM); - m_validationLabel.setToolTipText(text); - - m_automaticLabel = new JLabel("") { - @Override - public Dimension getPreferredSize() { - return new Dimension(16,16); - } - }; - - p.add(m_radioButton, c); - - - c.gridx++; - p.add(m_validationLabel, c); - - c.gridx++; - p.add(m_automaticLabel, c); - - c.gridx++; - c.weightx = 1; - p.add(Box.createHorizontalGlue(), c); - c.weightx = 0; - - - - } - - - public JRadioButton getRadioButton() { - return m_radioButton; - } - - public void addIcon(int selectLevel) { - boolean isManual = false; - switch (selectLevel) { - case 0: - case 3: - isManual = true; - break; - case 1: - case 2: - isManual = false; - } - - ImageIcon icon = null; - String tooltips; - if (isManual) { - icon = new ImageIcon(IconManager.getIcon(IconManager.IconType.HAND_OPEN).getImage().getScaledInstance(16, 16, Image.SCALE_DEFAULT)); - tooltips = "Manual"; - } else { - icon = new ImageIcon(IconManager.getIcon(IconManager.IconType.GEAR).getImage().getScaledInstance(16, 16, Image.SCALE_DEFAULT)); - tooltips = "Automatic"; - } - m_automaticLabel.setIcon(icon); - m_automaticLabel.setToolTipText(tooltips); - } - - private void removeOptionIcon() { - m_automaticLabel.setIcon(null); - } - - } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicProteinSetPanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicProteinSetPanel.java index f7c49b7d5..1bb2dce84 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicProteinSetPanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/XicProteinSetPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -72,7 +72,7 @@ import javax.swing.table.TableColumn; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.table.TableColumnExt; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import fr.proline.studio.rsmexplorer.actions.xic.*; import fr.proline.studio.pattern.xic.*; import fr.proline.core.orm.uds.dto.DDataset; @@ -97,7 +97,6 @@ */ public class XicProteinSetPanel extends HourglassPanel implements DataBoxPanelInterface, GlobalTabelModelProviderInterface { - public final static int NB_MAX_COLUMN_CONTROL = 20; private AbstractDataBox m_dataBox; private JScrollPane m_proteinSetScrollPane; @@ -208,7 +207,7 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) } - DataBoxViewerManager.loadedDataModified(m_dataBox.getProjectId(), m_dataBox.getRsetId(), m_dataBox.getRsmId(), DMasterQuantProteinSet.class, masterQuantProteinSetModified, DataBoxViewerManager.REASON_PROTEINS_REFINED); + DataBoxViewerManager.loadedDataModified(m_dataBox.getProjectId(), m_dataBox.getRsetId(), m_dataBox.getRsmId(), DMasterQuantProteinSet.class, masterQuantProteinSetModified, DataBoxViewerManager.REASON_MODIF.REASON_PROTEINS_REFINED.getReasonValue()); } }; @@ -354,7 +353,7 @@ private JPanel createInternalPanel() { m_proteinSetScrollPane = new JScrollPane(); m_quantProteinSetTable = new QuantProteinSetTable(); - m_quantProteinSetTable.setModel(new CompoundTableModel(new QuantProteinSetTableModel((LazyTable) m_quantProteinSetTable), true)); + m_quantProteinSetTable.setModel(new CompoundTableModel(new QuantProteinSetTableModel(m_quantProteinSetTable), true)); CustomColumnControlButton customColumnControl = new CustomColumnControlButton(m_quantProteinSetTable); m_quantProteinSetTable.setColumnControl(customColumnControl); // hide the id column @@ -430,12 +429,12 @@ public void setData(Long taskId, DQuantitationChannel[] quantChannels, List getParameters() { int defaultIndex = 0; - if (!overviewColumnVisible) { - defaultIndex = 0; - } else { + if (overviewColumnVisible) { switch (overviewType) { case QuantProteinSetTableModel.COLTYPE_ABUNDANCE: defaultIndex = 2; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/alignment/IonsRTScatterPlot.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/alignment/IonsRTScatterPlot.java index ab582834e..f45b77f20 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/alignment/IonsRTScatterPlot.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/alignment/IonsRTScatterPlot.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -17,14 +17,11 @@ package fr.proline.studio.rsmexplorer.gui.xic.alignment; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; -import fr.proline.studio.graphics.BasePlotPanel; -import fr.proline.studio.graphics.CrossSelectionInterface; -import fr.proline.studio.graphics.PlotScatter; -import fr.proline.studio.graphics.XAxis; -import fr.proline.studio.graphics.YAxis; +import fr.proline.studio.graphics.*; import fr.proline.studio.utils.CyclicColorPalette; -import java.awt.Color; -import java.awt.Graphics2D; + +import java.awt.*; +import java.awt.geom.AffineTransform; /** * @@ -32,7 +29,8 @@ */ public class IonsRTScatterPlot extends PlotScatter { - private final static int TRANSPARENCY = 70; + private static final int TRANSPARENCY = 70; + private static final BasicStroke DEFAULT_STROKE = new BasicStroke(1.2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); private Color m_color; private Color m_highlightColor = new Color(CyclicColorPalette.GRAY_DARK.getRed(), CyclicColorPalette.GRAY_DARK.getGreen(), CyclicColorPalette.GRAY_DARK.getBlue(), TRANSPARENCY+15); @@ -41,6 +39,7 @@ public class IonsRTScatterPlot extends PlotScatter { private StringBuilder m_sBuilder; private int m_colY; //index of column Y + private double m_featureAlignmentTimeTolerance; public IonsRTScatterPlot(BasePlotPanel plotPanel, ExtendedTableModelInterface compareDataInterface, CrossSelectionInterface crossSelectionInterface, int colX, int colY) { super(plotPanel, compareDataInterface, crossSelectionInterface, colX, colY); @@ -53,6 +52,10 @@ public void setColor(Color c) { this.m_color = new Color(c.getRed(), c.getGreen(), c.getBlue(), TRANSPARENCY); } + public void setFeatureAlignmentTimeTolerance(double tolerance) { + this.m_featureAlignmentTimeTolerance = tolerance; + } + public void showCrossAssignedIons(boolean showCrossAssignedIons) { this.m_showCrossAssignedIons = showCrossAssignedIons; } @@ -112,7 +115,6 @@ public String getToolTipText(double x, double y) { @Override public void paint(Graphics2D g, XAxis xAxis, YAxis yAxis) { - // set clipping area int clipX = xAxis.valueToPixel(xAxis.getMinValue()); int clipWidth = xAxis.valueToPixel(xAxis.getMaxValue()) - clipX; @@ -120,6 +122,8 @@ public void paint(Graphics2D g, XAxis xAxis, YAxis yAxis) { int clipHeight = yAxis.valueToPixel(yAxis.getMinValue()) - clipY; g.setClip(clipX, clipY, clipWidth, clipHeight); + g.setStroke(DEFAULT_STROKE); + // first plot non selected int size = (m_dataX != null) ? m_dataX.length : 0; for (int i = 0; i < size; i++) { @@ -137,11 +141,18 @@ public void paint(Graphics2D g, XAxis xAxis, YAxis yAxis) { g.setColor(m_highlightColor); g.drawOval(x - 3, y - 3, 6, 6); } + } else if (Math.abs(m_dataY[i]) > m_featureAlignmentTimeTolerance) { + AffineTransform savedTransform = g.getTransform(); + AffineTransform transform = g.getTransform(); + transform.translate(x, y); + transform.rotate(Math.PI / 4.0); + g.setTransform(transform); + g.drawRect(- 2, - 2, 4, 4); + g.setTransform(savedTransform); } else { g.setColor(m_color); g.fillOval(x - 3, y - 3, 6, 6); } - } // plot selected diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/alignment/IonsRTTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/alignment/IonsRTTableModel.java index ca38df5d4..8a958bb3f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/alignment/IonsRTTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/gui/xic/alignment/IonsRTTableModel.java @@ -1,35 +1,39 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.gui.xic.alignment; import fr.proline.core.orm.msi.dto.DMasterQuantPeptideIon; import fr.proline.core.orm.msi.dto.DPeptideInstance; import fr.proline.core.orm.msi.dto.DQuantPeptideIon; +import fr.proline.studio.corewrapper.util.PeptideClassesUtils; import fr.proline.studio.extendedtablemodel.ExtendedTableModelInterface; import fr.proline.studio.extendedtablemodel.ExtraDataType; import fr.proline.studio.graphics.PlotDataSpec; import fr.proline.studio.graphics.PlotInformation; + import java.util.ArrayList; import java.util.List; import java.util.Map; /** + * Represent Peptide Ion information in Map alignment context, for a specified Source Map + * * RT = elution time = retention time. The table is organized as follows: - * |PEPTIDE_ID|PEPTIDE_SEQUENCE|CHARGE|ELUTION_TIME_FROM|_eTimeTo[0]|_eTimeTo[1]|....|_eTimeTo[n]| + * |PEPTIDE_ID|PEPTIDE_SEQUENCE|CHARGE|MOZ|DELTA_MOZ|ELUTION_TIME_FROM|_eTimeTo[0]|_eTimeTo[1]|....|_eTimeTo[n]| * * @author Karine XUE */ @@ -37,99 +41,112 @@ public class IonsRTTableModel implements ExtendedTableModelInterface { private String m_modelName; - /** - * Map: MapId,resultSummaryId - */ - private Map m_idMap; + private Map m_rsmIdByMapId; private long[] m_rsmIdArray; - private List m_data; + private List m_data; - public List getData() { - return m_data; - } - /** - * Map : rsmId,MapTitleName - */ - private Map m_idNameMap; + private Map m_mapTitleByRsmId; private String[] m_columnName; - private static int PEPTIDE_ID = 0; - private static int PEPTIDE_SEQUENCE = 1; - private static int CHARGE = 2; - private static int ELUTION_TIME_FROM = 3; + private static final int PEPTIDE_ID = 0; + private static final int PEPTIDE_SEQUENCE = 1; + private static final int CHARGE = 2; + private static final int MOZ = 3; + private static final int DELTA_MOZ = 4; + private static final int ELUTION_TIME_FROM = 5; + private static final int START_ELUTION_TO = 6; private int m_mapCount; + public static final int MOZ_COL_INDEX = MOZ; + public static final int ELUTION_TIME_FROM_COL_INDEX = ELUTION_TIME_FROM; + public static final int DELTA_MOZ_COL_INDEX = DELTA_MOZ; + /** * - * @param mapIdFrom - * @param idTitleMap, Map - * @param idMap, Map - * @param m_masterQuantPeptideIonList + * @param mapTitleByRsmId: Map + * @param rsmIdByMapId: Map + * @param rsmIdArray */ public IonsRTTableModel(List m_masterQuantPeptideIonList, - Map idMap, Map idNameMap, long[] rsmIdArray) { + Map rsmIdByMapId, Map mapTitleByRsmId, long[] rsmIdArray) { m_mapCount = rsmIdArray.length; - m_idNameMap = idNameMap; - m_idMap = idMap; + m_mapTitleByRsmId = mapTitleByRsmId; + m_rsmIdByMapId = rsmIdByMapId; m_rsmIdArray = rsmIdArray; m_data = new ArrayList<>(); - m_columnName = new String[rsmIdArray.length + 3]; - m_columnName[PEPTIDE_ID] = "Peptide Id";//[0] - m_columnName[PEPTIDE_SEQUENCE] = "Peptide Sequence";//[1] - m_columnName[CHARGE] = "Charge";//[2] - m_columnName[ELUTION_TIME_FROM] = "Time in Map " + m_idNameMap.get(rsmIdArray[0]) + " (min)"; - for (int i = 4; i < rsmIdArray.length + 3; i++) { - m_columnName[i] = "Delta time in Map " + m_idNameMap.get(rsmIdArray[i - 3]) + " (s)"; + m_columnName = new String[rsmIdArray.length + ELUTION_TIME_FROM]; + m_columnName[PEPTIDE_ID] = "Peptide Id"; + m_columnName[PEPTIDE_SEQUENCE] = "Peptide Sequence"; + m_columnName[CHARGE] = "Charge"; + m_columnName[MOZ] = "moz"; + m_columnName[DELTA_MOZ] = "Delta moz (experimental - theoretical)"; + m_columnName[ELUTION_TIME_FROM] = "Time in Map " + m_mapTitleByRsmId.get(rsmIdArray[0]) + " (min)"; + for (int i = START_ELUTION_TO; i < rsmIdArray.length + ELUTION_TIME_FROM; i++) { + m_columnName[i] = "Delta time in Map " + m_mapTitleByRsmId.get(rsmIdArray[i - ELUTION_TIME_FROM]) + " (s)"; } - long peptideId; - String peptideSequence; - int charge; float rTimeFrom; float[] rTimeTo; int matchCountFrom; int[] matchCountTo; - DPeptideInstance pi; - Map nbPepInMap; //MapmapId, DQuantPeptideIon> - for (DMasterQuantPeptideIon masterPep : m_masterQuantPeptideIonList) { + double deltaMoz; + DPeptideInstance peptideInstance; + + Map qPepIonByQCId; //MapmapId, DQuantPeptideIon> + for (DMasterQuantPeptideIon masterQuantPeptideIon : m_masterQuantPeptideIonList) { rTimeTo = new float[m_mapCount - 1]; matchCountTo = new int[rTimeTo.length]; - pi = masterPep.getPeptideInstance(); - if (pi == null) + peptideInstance = masterQuantPeptideIon.getPeptideInstance(); + if (peptideInstance == null) continue; - peptideId = pi.getPeptideId(); - peptideSequence = pi.getPeptide().getSequence(); - charge = masterPep.getCharge(); - nbPepInMap = masterPep.getQuantPeptideIonByQchIds(); - if (nbPepInMap == null || nbPepInMap.isEmpty()) { + + qPepIonByQCId = masterQuantPeptideIon.getQuantPeptideIonByQchIds(); + DQuantPeptideIon srcQPepIon; + if (qPepIonByQCId == null || qPepIonByQCId.isEmpty()) { continue; } else { Long rsmIdFrom = rsmIdArray[0]; - this.m_modelName = idNameMap.get(rsmIdFrom) + " ElutionTime compare table model"; - DQuantPeptideIon element = nbPepInMap.get(rsmIdFrom); - if (element == null) { + m_modelName = mapTitleByRsmId.get(rsmIdFrom) + " ElutionTime compare table model"; + srcQPepIon = qPepIonByQCId.get(rsmIdFrom); + if (srcQPepIon == null) { continue; } - rTimeFrom = element.getElutionTime(); - matchCountFrom = element.getPeptideMatchesCount(); - DQuantPeptideIon quantPeptideIon; + rTimeFrom = srcQPepIon.getElutionTime(); + matchCountFrom = srcQPepIon.getPeptideMatchesCount(); + DQuantPeptideIon destQPepIon; for (int i = 1; i < rsmIdArray.length; i++) {//0 is from - quantPeptideIon = nbPepInMap.get(rsmIdArray[i]); - if (quantPeptideIon == null) { + destQPepIon = qPepIonByQCId.get(rsmIdArray[i]); + if (destQPepIon == null) { rTimeTo[i - 1] = Float.NaN; //not a number, then show nothing in the PlotLiner } else { - float deltaTime = quantPeptideIon.getElutionTime() - rTimeFrom; + float deltaTime = destQPepIon.getElutionTime() - rTimeFrom; rTimeTo[i - 1] = deltaTime; - matchCountTo[i - 1] = quantPeptideIon.getPeptideMatchesCount(); + matchCountTo[i - 1] = destQPepIon.getPeptideMatchesCount(); } } } - this.m_data.add(new IonRTRow(peptideId, peptideSequence, charge, rTimeFrom, rTimeTo, matchCountFrom, matchCountTo)); + deltaMoz = Double.NaN; + if( masterQuantPeptideIon.getPeptideInstance().getPeptide() != null ) + deltaMoz = PeptideClassesUtils.getDeltaMozFor(srcQPepIon.getMoz(), masterQuantPeptideIon.getCharge(), masterQuantPeptideIon.getPeptideInstance().getPeptide() ); + m_data.add( + new IonRTMoZRow(peptideInstance.getPeptideId(), + peptideInstance.getPeptide().getSequence(), + masterQuantPeptideIon.getCharge(), + srcQPepIon.getMoz(), + deltaMoz, + rTimeFrom, + rTimeTo, + matchCountFrom, + matchCountTo) + ); } } - public String getInfo(int rowIndex) { - return this.m_data.get(rowIndex).toString(); + public List getData() { + return m_data; + } + public String getInfo(int rowIndex) { + return m_data.get(rowIndex).toString(); } @Override @@ -137,22 +154,26 @@ public PlotDataSpec getDataSpecAt(int i) { return null; } - protected class IonRTRow { + protected class IonRTMoZRow { long _peptideId; String _peptideSequence; int _charge; float _eTimeFrom; - float[] _eTimeTo; + float[] _deltaTimeTo; int _MatchCountFrom; int[] _MatchCountTo; + double _moz; + double _deltaMoz; - public IonRTRow(long peptideId, String peptideSequence, int charge, float eTimeFrom, float[] eTimeTo, int matchCountFrom, int[] matchCountTo) { + public IonRTMoZRow(long peptideId, String peptideSequence, int charge, double moz, double delaMoz, float eTimeFrom, float[] eTimeTo, int matchCountFrom, int[] matchCountTo) { this._peptideId = peptideId; this._peptideSequence = peptideSequence; this._charge = charge; this._eTimeFrom = eTimeFrom; - this._eTimeTo = eTimeTo; + this._deltaTimeTo = eTimeTo; + this._moz = moz; + this._deltaMoz = delaMoz; this._MatchCountFrom = matchCountFrom; this._MatchCountTo = matchCountTo; @@ -160,7 +181,7 @@ public IonRTRow(long peptideId, String peptideSequence, int charge, float eTimeF public String toString() { String s = ""; - for (float f : this._eTimeTo) { + for (float f : this._deltaTimeTo) { s += ";" + f; } return _peptideId + ";" + _peptideSequence + ";" + _charge + ";" + _eTimeFrom + s; @@ -185,12 +206,15 @@ public String getDataColumnIdentifier(int columnIndex) { @Override public Class getDataColumnClass(int columnIndex) { switch (columnIndex) { - case 0://MapRTCompareTableModel.PEPTIDE_ID: + case PEPTIDE_ID://MapRTCompareTableModel.PEPTIDE_ID: return Long.class; - case 1://MapRTCompareTableModel.PEPTIDE_SEQUENCE: + case PEPTIDE_SEQUENCE://MapRTCompareTableModel.PEPTIDE_SEQUENCE: return String.class; - case 2://MapRTCompareTableModel.CHARGE: + case CHARGE://MapRTCompareTableModel.CHARGE: return Integer.class; + case MOZ: + case DELTA_MOZ: + return Double.class; default: return Float.class; } @@ -198,28 +222,42 @@ public Class getDataColumnClass(int columnIndex) { @Override public Object getDataValueAt(int rowIndex, int columnIndex) { - IonRTRow row = this.m_data.get(rowIndex); - if (columnIndex == IonsRTTableModel.PEPTIDE_ID) { - return row._peptideId; - } else if (columnIndex == IonsRTTableModel.PEPTIDE_SEQUENCE) { - return row._peptideSequence; - } else if (columnIndex == IonsRTTableModel.CHARGE) { - return row._charge; - } else if (columnIndex == IonsRTTableModel.ELUTION_TIME_FROM) { - return row._eTimeFrom / 60d; //in minute - } else if (columnIndex > 3 && columnIndex < this.m_mapCount + 3) { - return row._eTimeTo[columnIndex - 4]; //in seconde - } else if (columnIndex == 3 + this.m_mapCount) { - return row._MatchCountTo; - } else { - return row._MatchCountTo[columnIndex - 4 - this.m_mapCount]; + IonRTMoZRow row = m_data.get(rowIndex); + switch (columnIndex) { + case PEPTIDE_ID: + return row._peptideId; + + case PEPTIDE_SEQUENCE: + return row._peptideSequence; + + case CHARGE: + return row._charge; + + case MOZ: + return row._moz; + + case DELTA_MOZ: + return row._deltaMoz; + + case ELUTION_TIME_FROM: + return row._eTimeFrom / 60d; //in minute + + default: { + if (columnIndex > ELUTION_TIME_FROM && columnIndex < m_mapCount + ELUTION_TIME_FROM) { + return row._deltaTimeTo[columnIndex - START_ELUTION_TO]; //in second + } else if (columnIndex == ELUTION_TIME_FROM + m_mapCount) { + return row._MatchCountTo; + } else { + return row._MatchCountTo[columnIndex - START_ELUTION_TO - m_mapCount]; + } + } } } public boolean isCrossAssigned(int rowIndex, int colY) { - IonRTRow row = this.m_data.get(rowIndex); + IonRTMoZRow row = m_data.get(rowIndex); int countFrom = row._MatchCountFrom; - int countTo = row._MatchCountTo[colY - 4]; + int countTo = colY < START_ELUTION_TO ? 1 : row._MatchCountTo[colY - START_ELUTION_TO]; // if not compare to other map, just test countFrom return (countFrom == 0 || countTo == 0); } @@ -231,10 +269,10 @@ public boolean isCrossAssigned(int rowIndex, int colY) { * @return */ public int getColumnIndex(Long mapId) { - long rsmId = this.m_idMap.get(mapId); + long rsmId = m_rsmIdByMapId.get(mapId); for (int i = 0; i < m_rsmIdArray.length; i++) { if (m_rsmIdArray[i] == rsmId) { - return i + 3; + return i + ELUTION_TIME_FROM; } } return -1; @@ -256,11 +294,13 @@ public int getInfoColumn() { * @return */ public String getToolTipInfo(int rowIndex) { - IonRTRow row = this.m_data.get(rowIndex); - String infoValue = " Peptide id : " + row._peptideId + "
"; - infoValue += ("Sequence : ") + row._peptideSequence + "
"; - infoValue += ("charge : ") + row._charge + "
"; - return infoValue; + IonRTMoZRow row = m_data.get(rowIndex); + StringBuilder infoValueSB = new StringBuilder(" Peptide id : "); + infoValueSB.append(row._peptideId).append("
"); + infoValueSB.append("Sequence : ").append(row._peptideSequence).append("
"); + infoValueSB.append("charge : ").append(row._charge).append( "
"); + infoValueSB.append("moz: ").append(row._moz).append(" dmoz: ").append(row._deltaMoz).append( "
"); + return infoValueSB.toString(); } @Override diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/AbstractNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/AbstractNode.java index 209fe792f..77a648a6b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/AbstractNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/AbstractNode.java @@ -1,36 +1,34 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree; import fr.proline.studio.dam.data.AbstractData; import fr.proline.studio.utils.IconManager; -import fr.proline.studio.utils.PropertiesProviderInterface; -import javax.swing.Action; -import javax.swing.ImageIcon; -import javax.swing.tree.DefaultMutableTreeNode; -import org.openide.nodes.Sheet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.swing.*; +import javax.swing.tree.DefaultMutableTreeNode; + /** * Super class for all nodes * @author JM235353 */ -public abstract class AbstractNode extends DefaultMutableTreeNode implements Cloneable, PropertiesProviderInterface { +public abstract class AbstractNode extends DefaultMutableTreeNode implements Cloneable { public enum NodeTypes { TREE_PARENT, @@ -141,11 +139,21 @@ public boolean isDisabled() { public String getToolTipText() { return null; } - - @Override - public abstract Sheet createSheet(); - - + + //Default implementation. + + /** + * Load all Data needed by the Properties view. + * Callback should the be called to display the information. + * + * Default implementation just call callback Runnable + * @param callback + */ + public void loadDataForProperties(Runnable callback) { + // nothing to do + callback.run(); + } + public abstract AbstractNode copyNode(); public void copyChildren(AbstractNode copyParent) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/AbstractTree.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/AbstractTree.java index 0bec9c2b3..16d02fc59 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/AbstractTree.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/AbstractTree.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/ChildFactory.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/ChildFactory.java index 189fb8c73..1e1e351d2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/ChildFactory.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/ChildFactory.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree; import fr.proline.studio.rsmexplorer.tree.quantitation.QuantitationProjectNode; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/DataSetNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/DataSetNode.java index b38da09b1..4b41cb15b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/DataSetNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/DataSetNode.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -21,26 +21,17 @@ import fr.proline.core.orm.uds.dto.DDataset; import fr.proline.core.orm.uds.dto.DDatasetType; import fr.proline.core.orm.uds.dto.DDatasetType.AggregationInformation; -import static fr.proline.core.orm.uds.dto.DDatasetType.AggregationInformation.IDENTIFICATION_SUMMARY_AGG; -import static fr.proline.core.orm.uds.dto.DDatasetType.AggregationInformation.IDENTIFICATION_SUMMARY_UNION; -import static fr.proline.core.orm.uds.dto.DDatasetType.AggregationInformation.SEARCH_RESULT_AGG; -import static fr.proline.core.orm.uds.dto.DDatasetType.AggregationInformation.SEARCH_RESULT_UNION; -import static fr.proline.core.orm.uds.dto.DDatasetType.AggregationInformation.UNKNOWN; import fr.proline.core.orm.uds.dto.DDatasetType.QuantitationMethodInfo; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.data.AbstractData; import fr.proline.studio.dam.data.DataSetData; -import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; +import fr.proline.studio.dam.tasks.*; import fr.proline.studio.dam.tasks.AbstractDatabaseTask.Priority; -import fr.proline.studio.dam.tasks.DatabaseDataSetTask; -import fr.proline.studio.dam.tasks.DatabaseRsetProperties; -import fr.proline.studio.dam.tasks.DatabaseRsummaryProperties; -import fr.proline.studio.dam.tasks.SubTask; import fr.proline.studio.utils.IconManager; -import java.util.Enumeration; -import javax.swing.ImageIcon; + +import javax.swing.*; import javax.swing.tree.DefaultTreeModel; -import org.openide.nodes.Sheet; +import java.util.Enumeration; /** * Node for Dataset @@ -466,11 +457,6 @@ public DDataset getParentMergedDataset() { } } - @Override - public Sheet createSheet() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - public void setIsReference() { this.m_isReference = true; } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/HourGlassNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/HourGlassNode.java index c3e9cac5d..03e5e0fb0 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/HourGlassNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/HourGlassNode.java @@ -1,26 +1,25 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree; import fr.proline.studio.dam.data.AbstractData; import fr.proline.studio.utils.IconManager; import javax.swing.ImageIcon; -import org.openide.nodes.Sheet; /** * Node used for a part of the tree which is not already loaded @@ -47,16 +46,6 @@ public ImageIcon getIcon(boolean expanded) { return getIcon(IconManager.IconType.HOUR_GLASS); } - @Override - public void loadDataForProperties(Runnable callback) { - // nothing to do - callback.run(); - } - - @Override - public Sheet createSheet() { - return null; // should never be called - } @Override public AbstractNode copyNode() { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/PropertiesWrapperNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/PropertiesWrapperNode.java deleted file mode 100644 index d2ba1b24e..000000000 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/PropertiesWrapperNode.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ -package fr.proline.studio.rsmexplorer.tree; - - -import fr.proline.studio.utils.PropertiesProviderInterface; -import org.openide.nodes.AbstractNode; -import org.openide.nodes.Children; -import org.openide.nodes.Sheet; - - -/** - * This node class wraps a PropertiesProviderInterface, so we can display properties - * with a PropertiesSheet (which accepts only netbean Nodes ) - * @author JM235353 - */ -public class PropertiesWrapperNode extends AbstractNode { - - private PropertiesProviderInterface m_propertiesProvider; - - public PropertiesWrapperNode(PropertiesProviderInterface propertiesProvider) { - super(new Children.Array()); - - m_propertiesProvider = propertiesProvider; - - } - - @Override - protected Sheet createSheet() { - return m_propertiesProvider.createSheet(); - } - - - -} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/TreeParentNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/TreeParentNode.java index c435253a6..5ebcc102d 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/TreeParentNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/TreeParentNode.java @@ -1,25 +1,24 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree; import fr.proline.studio.dam.data.AbstractData; import fr.proline.studio.utils.IconManager; import javax.swing.ImageIcon; -import org.openide.nodes.Sheet; /** * Node used a the Tree Parent @@ -40,18 +39,7 @@ public String toString() { public ImageIcon getIcon(boolean expanded) { return getIcon(IconManager.IconType.USER); } - - @Override - public void loadDataForProperties(Runnable callback) { - // nothing to do - callback.run(); - } - - @Override - public Sheet createSheet() { - return null; // should never be called - } - + @Override public AbstractNode copyNode() { return null; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdAllImportedNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdAllImportedNode.java index bb60e789a..a6c72ad6b 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdAllImportedNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdAllImportedNode.java @@ -1,26 +1,25 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree.identification; import fr.proline.studio.dam.data.AbstractData; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.utils.IconManager; import javax.swing.ImageIcon; -import org.openide.nodes.Sheet; @@ -39,15 +38,6 @@ public ImageIcon getIcon(boolean expanded) { return getIcon(IconManager.IconType.ALL_IMPORTED); } - @Override - public Sheet createSheet() { - return null; - } - - @Override - public void loadDataForProperties(Runnable callback) { - } - @Override public AbstractNode copyNode() { return null; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdProjectIdentificationNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdProjectIdentificationNode.java index 2659c35d9..c79df32a5 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdProjectIdentificationNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdProjectIdentificationNode.java @@ -1,22 +1,21 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree.identification; -import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; import fr.proline.core.orm.uds.Project; import fr.proline.studio.dam.AccessDatabaseThread; import fr.proline.studio.dam.data.AbstractData; @@ -28,9 +27,6 @@ import fr.proline.studio.utils.IconManager; import javax.swing.ImageIcon; import javax.swing.tree.DefaultTreeModel; -import org.openide.nodes.PropertySupport; -import org.openide.nodes.Sheet; -import org.openide.nodes.Node.Property; /** @@ -102,43 +98,7 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) } } - @Override - public void loadDataForProperties(Runnable callback) { - // nothing to do - callback.run(); - } - - @Override - public Sheet createSheet() { - Project p = getProject(); - - Sheet sheet = Sheet.createDefault(); - - try { - Sheet.Set propGroup = Sheet.createPropertiesSet(); - - - Property prop = new PropertySupport.Reflection<>(p, Long.class, "getId", null); - prop.setName("id"); - propGroup.put(prop); - - prop = new PropertySupport.Reflection<>(p, String.class, "getName", null); - prop.setName("name"); - propGroup.put(prop); - - prop = new PropertySupport.Reflection<>(p, String.class, "getDescription", null); - prop.setName("description"); - propGroup.put(prop); - - sheet.put(propGroup); - - } catch (NoSuchMethodException e) { - m_logger.error(getClass().getSimpleName() + " properties error ", e); - } - - return sheet; - } @Override public AbstractNode copyNode() { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdTransferHandler.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdTransferHandler.java index 1590f7aae..14f49b989 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdTransferHandler.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdTransferHandler.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree.identification; import fr.proline.core.orm.msi.ResultSet; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdTransferable.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdTransferable.java index 50002a4d5..4cf343ea7 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdTransferable.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdTransferable.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree.identification; import fr.proline.studio.rsmexplorer.tree.identification.IdentificationTree; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdentificationTree.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdentificationTree.java index 112bc9f36..24f4e211e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdentificationTree.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/identification/IdentificationTree.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -16,18 +16,7 @@ */ package fr.proline.studio.rsmexplorer.tree.identification; -import fr.proline.studio.rsmexplorer.actions.identification.DisplayRsmAction; -import fr.proline.studio.rsmexplorer.actions.identification.DeleteAction; -import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; -import fr.proline.studio.rsmexplorer.actions.identification.PropertiesAction; -import fr.proline.studio.rsmexplorer.actions.identification.DisplayAllRsetAction; -import fr.proline.studio.rsmexplorer.actions.identification.EmptyTrashAction; -import fr.proline.studio.rsmexplorer.actions.identification.DisplayRsetAction; -import fr.proline.studio.rsmexplorer.actions.identification.ChangeTypicalProteinJMSAction; -import fr.proline.studio.rsmexplorer.actions.identification.ImportSearchResultAsRsetJMSAction; -import fr.proline.studio.rsmexplorer.actions.identification.MergeJMSAction; -import fr.proline.studio.rsmexplorer.actions.identification.ValidateJMSAction; -import fr.proline.studio.rsmexplorer.actions.identification.RetrieveBioSeqJMSAction; +import fr.proline.studio.rsmexplorer.actions.identification.*; import fr.proline.core.orm.msi.ResultSet; import fr.proline.core.orm.uds.Project; import fr.proline.core.orm.uds.dto.DDataset; @@ -39,21 +28,6 @@ import fr.proline.studio.dam.tasks.AbstractDatabaseCallback; import fr.proline.studio.dam.tasks.DatabaseDataSetTask; import fr.proline.studio.dam.tasks.SubTask; -import fr.proline.studio.rsmexplorer.actions.identification.AddIdentificationFolderAction; -import fr.proline.studio.rsmexplorer.actions.identification.AggregateAction; -import fr.proline.studio.rsmexplorer.actions.identification.ClearDatasetAction; -import fr.proline.studio.rsmexplorer.actions.identification.CopySearchResult; -import fr.proline.studio.rsmexplorer.actions.identification.ExportAction; -import fr.proline.studio.rsmexplorer.actions.identification.FilterRSMProteinSetsJMSAction; -import fr.proline.studio.rsmexplorer.actions.identification.GenerateSpectrumMatchesJMSAction; -import fr.proline.studio.rsmexplorer.actions.identification.IdentifyPtmSitesJMSAction; -import fr.proline.studio.rsmexplorer.actions.identification.ImportManager; -import fr.proline.studio.rsmexplorer.actions.identification.ImportMaxQuantResultJMSAction; -import fr.proline.studio.rsmexplorer.actions.identification.ImportSearchResultAsDatasetJMSAction; -import fr.proline.studio.rsmexplorer.actions.identification.PasteSearchResult; -import fr.proline.studio.rsmexplorer.actions.identification.QuantifyAction; -import fr.proline.studio.rsmexplorer.actions.identification.RenameRsetAction; -import fr.proline.studio.rsmexplorer.actions.identification.UpdatePeaklistSoftwareAction; import fr.proline.studio.rsmexplorer.gui.ProjectExplorerPanel; import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.ChildFactory; @@ -71,7 +45,7 @@ import javax.swing.event.TreeWillExpandListener; import javax.swing.tree.*; import org.apache.commons.lang3.StringUtils; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; /** * Tree of projects and datasets (identification type) @@ -731,7 +705,7 @@ private void triggerPopup(MouseEvent e) { // create the actions Boolean showHiddenFunctionnality = false; // JPM.TODO : completely removed for the moment preferences.getBoolean("Profi", false); - m_mainActions = new ArrayList<>(25); // <--- get in sync + m_mainActions = new ArrayList<>(27); // <--- get in sync DisplayRsetAction displayRsetAction = new DisplayRsetAction(this); @@ -740,6 +714,9 @@ private void triggerPopup(MouseEvent e) { DisplayRsmAction displayRsmAction = new DisplayRsmAction(this); m_mainActions.add(displayRsmAction); + DisplayPTMRsmAction displayPtmRsmAction = new DisplayPTMRsmAction(this); + m_mainActions.add(displayPtmRsmAction); + m_mainActions.add(null); // separator AggregateAction aggregateAction = new AggregateAction(this); @@ -761,9 +738,12 @@ private void triggerPopup(MouseEvent e) { RenameRsetAction renameRsetAction = new RenameRsetAction(this); m_mainActions.add(renameRsetAction); - ClearDatasetAction clearAction = new ClearDatasetAction(this); + ClearDatasetAction clearAction = new ClearDatasetAction(this, false); m_mainActions.add(clearAction); + ClearDatasetAction clearFullAction = new ClearDatasetAction(this, true); + m_mainActions.add(clearFullAction); + DeleteAction deleteAction = new DeleteAction(this); m_mainActions.add(deleteAction); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantiTransferHandler.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantiTransferHandler.java index 5e09548a8..cbd336f4c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantiTransferHandler.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantiTransferHandler.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree.quantitation; import fr.proline.core.orm.uds.dto.DDataset; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantiTransferable.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantiTransferable.java index 4af9a337e..dd3f8260f 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantiTransferable.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantiTransferable.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree.quantitation; import fr.proline.core.orm.msi.ResultSet; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantitationProjectNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantitationProjectNode.java index b783348fd..13b9ccaef 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantitationProjectNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantitationProjectNode.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree.quantitation; import fr.proline.core.orm.uds.Project; @@ -22,7 +22,6 @@ import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.utils.IconManager; import javax.swing.ImageIcon; -import org.openide.nodes.Sheet; /** @@ -88,44 +87,6 @@ public void run(boolean success, long taskId, SubTask subTask, boolean finished) } }*/ - @Override - public void loadDataForProperties(Runnable callback) { - // nothing to do - callback.run(); - } - - @Override - public Sheet createSheet() { - /*Project p = getProject(); - - Sheet sheet = Sheet.createDefault(); - - try { - - Sheet.Set propGroup = Sheet.createPropertiesSet(); - - - Property prop = new PropertySupport.Reflection<>(p, Long.class, "getId", null); - prop.setName("id"); - propGroup.put(prop); - - prop = new PropertySupport.Reflection<>(p, String.class, "getName", null); - prop.setName("name"); - propGroup.put(prop); - - prop = new PropertySupport.Reflection<>(p, String.class, "getDescription", null); - prop.setName("description"); - propGroup.put(prop); - - sheet.put(propGroup); - - } catch (NoSuchMethodException e) { - m_logger.error(getClass().getSimpleName() + " properties error ", e); - } - - return sheet;*/ - return null; - } @Override public AbstractNode copyNode() { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantitationTree.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantitationTree.java index 84c9f521a..065e95924 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantitationTree.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/quantitation/QuantitationTree.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -196,7 +196,15 @@ private void triggerPopup(MouseEvent e) { if (m_multiPopup == null) { // create the actions - m_multiActions = new ArrayList<>(5); // <--- get in sync + m_multiActions = new ArrayList<>(8); // <--- get in sync + + DisplayXICAction displayXICAction = new DisplayXICAction(this); + m_multiActions.add(displayXICAction); + + DisplayRsmAction displayRsmAction = new DisplayRsmAction(this); + m_multiActions.add(displayRsmAction); + + m_multiActions.add(null); // separator AggregateQuantitationsAction aggregateAction = new AggregateQuantitationsAction(this); m_multiActions.add(aggregateAction); diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/AbstractTreeTransferHandler.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/AbstractTreeTransferHandler.java index 7beba87df..adeca0c3e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/AbstractTreeTransferHandler.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/AbstractTreeTransferHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/DatasetReferenceNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/DatasetReferenceNode.java index 991d9cf6c..dd1455191 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/DatasetReferenceNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/DatasetReferenceNode.java @@ -1,26 +1,25 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree.xic; import fr.proline.studio.dam.data.AbstractData; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.utils.IconManager; import javax.swing.ImageIcon; -import org.openide.nodes.Sheet; /** * Tree Node representing a Dataset and RSM used as reference for XIC : Creating @@ -72,20 +71,11 @@ public ImageIcon getIcon(boolean expanded) { } } - @Override - public Sheet createSheet() { - return null; - } - @Override public AbstractNode copyNode() { return null; } - @Override - public void loadDataForProperties(Runnable callback) { - } - @Override public boolean canBeDeleted() { return false; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/IdentificationSelectionTree.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/IdentificationSelectionTree.java index b59529862..1a73676a3 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/IdentificationSelectionTree.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/IdentificationSelectionTree.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree.xic; import fr.proline.studio.rsmexplorer.tree.AbstractNode; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/QuantAggregateExperimentalTreePanel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/QuantAggregateExperimentalTreePanel.java index 802a991c4..36704020c 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/QuantAggregateExperimentalTreePanel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/QuantAggregateExperimentalTreePanel.java @@ -4,16 +4,15 @@ import fr.proline.core.orm.uds.BiologicalSample; import fr.proline.core.orm.uds.QuantitationChannel; import fr.proline.core.orm.uds.dto.DDataset; -import org.openide.util.Exceptions; import fr.proline.studio.dam.data.AbstractData; import fr.proline.studio.dam.data.DataSetData; import fr.proline.studio.gui.DefaultFloatingPanel; -import fr.proline.studio.rsmexplorer.gui.calc.DataTreeTransferable; -import fr.proline.studio.gui.DefaultFloatingPanel; import fr.proline.studio.rsmexplorer.gui.dialog.xic.aggregation.DQuantitationChannelMapping; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.rsmexplorer.tree.DataSetNode; import fr.proline.studio.utils.IconManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.swing.*; import javax.swing.event.*; @@ -25,14 +24,15 @@ import java.awt.event.*; import java.io.IOException; import java.io.Serializable; -import java.util.*; import java.util.List; +import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import java.util.stream.Stream; public class QuantAggregateExperimentalTreePanel extends JPanel { + private static final Logger m_logger = LoggerFactory.getLogger("ProlineStudio.ResultExplorer"); private AssociatedQuantExperimentalDesignTree m_tree; private ChannelPanel m_channelPanel; private DefaultFloatingPanel m_floattingButtonsPanel; @@ -828,7 +828,7 @@ private boolean importDataFromXic(TransferHandler.TransferSupport support) { } catch (UnsupportedFlavorException ex) { //m_logger.error(getClass().getSimpleName() + " DnD error ", ex); } catch (IOException ex) { - Exceptions.printStackTrace(ex); + m_logger.error(ex.getMessage(), ex); } for (DropZone dropZone : m_selectedDropZoneList) { @@ -897,7 +897,7 @@ private boolean importDataFromDropNode(TransferHandler.TransferSupport support) } catch (UnsupportedFlavorException ex) { //m_logger.error(getClass().getSimpleName() + " DnD error ", ex); } catch (IOException ex) { - Exceptions.printStackTrace(ex); + m_logger.error(ex.getMessage(), ex); } for (DropZone dropZone : m_selectedDropZoneList) { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/QuantExperimentalDesignTree.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/QuantExperimentalDesignTree.java index 7ba9637f3..f098cfa5e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/QuantExperimentalDesignTree.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/QuantExperimentalDesignTree.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -25,6 +25,7 @@ import fr.proline.core.orm.uds.SampleAnalysis; import fr.proline.core.orm.uds.dto.DDataset; import fr.proline.core.orm.uds.dto.DQuantitationChannel; +import fr.proline.studio.WindowManager; import fr.proline.studio.dam.DatabaseDataManager; import fr.proline.studio.dam.data.DataSetData; import fr.proline.core.orm.uds.Run; @@ -34,6 +35,7 @@ import fr.proline.studio.dam.tasks.DatabaseDataSetTask; import fr.proline.studio.dam.tasks.DatabaseRunsTask; import fr.proline.studio.dam.tasks.SubTask; +import fr.proline.studio.dock.gui.InfoLabel; import fr.proline.studio.rsmexplorer.actions.identification.AbstractRSMAction; import fr.proline.studio.rsmexplorer.actions.xic.CreateAction; import fr.proline.studio.rsmexplorer.actions.xic.DeleteAction; @@ -43,7 +45,6 @@ import fr.proline.studio.rsmexplorer.tree.AbstractTree; import fr.proline.studio.rsmexplorer.tree.DataSetNode; import fr.proline.studio.rsmexplorer.tree.quantitation.QuantitationTree; -import fr.proline.studio.utils.StudioExceptions; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Collection; @@ -277,7 +278,7 @@ public static void displayExperimentalDesign(DDataset dataset, AbstractNode root } } catch (Exception e) { - StudioExceptions.notify("Unable to build aggregated datasets nodes", e); + WindowManager.getDefault().getMainWindow().alert(InfoLabel.INFO_LEVEL.ERROR, "Unable to build aggregated datasets nodes", e); } } diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICBiologicalGroupNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICBiologicalGroupNode.java index a9c64fbb1..cb702e4de 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICBiologicalGroupNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICBiologicalGroupNode.java @@ -1,26 +1,25 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree.xic; import fr.proline.studio.dam.data.AbstractData; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.utils.IconManager; import javax.swing.ImageIcon; -import org.openide.nodes.Sheet; /** * Biologic Group node used in XIC Design Tree @@ -37,20 +36,11 @@ public ImageIcon getIcon(boolean expanded) { return getIcon(IconManager.IconType.BIOLOGICAL_GROUP); } - @Override - public Sheet createSheet() { - return null; - } - @Override public AbstractNode copyNode() { return null; } - @Override - public void loadDataForProperties(Runnable callback) { - } - @Override public boolean canBeDeleted() { return true; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICBiologicalSampleAnalysisNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICBiologicalSampleAnalysisNode.java index eb46cc7f5..648c8a5d2 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICBiologicalSampleAnalysisNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICBiologicalSampleAnalysisNode.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree.xic; import fr.proline.core.orm.uds.dto.DDataset; @@ -24,7 +24,6 @@ import fr.proline.studio.utils.IconManager; import javax.swing.ImageIcon; import javax.swing.tree.MutableTreeNode; -import org.openide.nodes.Sheet; /** * Biological Sample Analysis Node used in XIC Design Tree @@ -117,11 +116,6 @@ public ImageIcon getIcon(boolean expanded) { return getIcon(IconManager.IconType.DATASET_RSM); } - @Override - public Sheet createSheet() { - return super.createSheet(); - } - @Override public AbstractNode copyNode() { return null; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICBiologicalSampleNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICBiologicalSampleNode.java index c5725b565..53ce17cc6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICBiologicalSampleNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICBiologicalSampleNode.java @@ -1,26 +1,25 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.rsmexplorer.tree.xic; import fr.proline.studio.dam.data.AbstractData; import fr.proline.studio.rsmexplorer.tree.AbstractNode; import fr.proline.studio.utils.IconManager; import javax.swing.ImageIcon; -import org.openide.nodes.Sheet; /** * Tree Node representing a Biological Sample @@ -37,19 +36,10 @@ public ImageIcon getIcon(boolean expanded) { return getIcon(IconManager.IconType.BIOLOGICAL_SAMPLE); } - @Override - public Sheet createSheet() { - return null; - } - @Override public AbstractNode copyNode() { return null; } - - @Override - public void loadDataForProperties(Runnable callback) { - } @Override public boolean canBeDeleted() { diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICRunNode.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICRunNode.java index c829b8676..6fae068c6 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICRunNode.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICRunNode.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -39,7 +39,6 @@ import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.MutableTreeNode; import javax.swing.tree.TreeNode; -import org.openide.nodes.Sheet; /** * Tree Node representing a Run @@ -336,20 +335,12 @@ public ImageIcon getIcon(boolean expanded) { return getIcon(IconManager.IconType.FILE); //JPM.TODO : to be changed } - @Override - public Sheet createSheet() { - return null; - } @Override public AbstractNode copyNode() { return null; } - @Override - public void loadDataForProperties(Runnable callback) { - } - public void setRawFile(final File selectedFile, ActionListener doneCallback) { // we search the raw file in the database, if we found it, we set this one diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICRunNodeInitListener.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICRunNodeInitListener.java index 7bd84efea..932186bbc 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICRunNodeInitListener.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICRunNodeInitListener.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -14,14 +14,14 @@ * You should have received a copy of the CeCILL License * along with this program; If not, see . */ -package fr.proline.studio.rsmexplorer.tree.xic; - -/** - * - * @author AK249877 - */ -public interface XICRunNodeInitListener { - - public void initCompleted(XICRunNode node); - -} +package fr.proline.studio.rsmexplorer.tree.xic; + +/** + * + * @author AK249877 + */ +public interface XICRunNodeInitListener { + + public void initCompleted(XICRunNode node); + +} diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICSelectionTransferable.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICSelectionTransferable.java index 53ab99bc5..f2996bcaf 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICSelectionTransferable.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICSelectionTransferable.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICTransferHandler.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICTransferHandler.java index 55891ec9f..144252e7e 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICTransferHandler.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/rsmexplorer/tree/xic/XICTransferHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -37,7 +37,7 @@ import javax.swing.TransferHandler; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; -import org.openide.util.NbPreferences; +import fr.proline.studio.NbPreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/ExportFontModelUtilities.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/ExportFontModelUtilities.java index e8ae807ee..fde86f663 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/ExportFontModelUtilities.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/ExportFontModelUtilities.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/LazyTable.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/LazyTable.java index 9ea4422d2..c91406d74 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/LazyTable.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/LazyTable.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 VD225637 + * Copyright (C) 2019 * * This program is free software; you can redistribute it and/or * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT @@ -33,7 +33,7 @@ import javax.swing.event.TableModelListener; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableModel; -import org.openide.windows.WindowManager; +import fr.proline.studio.WindowManager; import fr.proline.studio.table.renderer.GrayedRenderer; /** diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/LazyTableCellRenderer.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/LazyTableCellRenderer.java index cfcfe4cfe..bc07dacae 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/LazyTableCellRenderer.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/LazyTableCellRenderer.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table; import fr.proline.studio.table.TableDefaultRendererManager; diff --git a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/LazyTableModel.java b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/LazyTableModel.java index bbeda500b..82f048e67 100644 --- a/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/LazyTableModel.java +++ b/prolinestudio-resultexplorer/src/main/java/fr/proline/studio/table/LazyTableModel.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ package fr.proline.studio.table; import fr.proline.studio.dam.AccessDatabaseThread; diff --git a/prolinestudio-resultexplorer/src/main/resources/META-INF/persistence.xml b/prolinestudio-resultexplorer/src/main/resources/META-INF/persistence.xml new file mode 100644 index 000000000..fb3406edf --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,11 @@ + + + + + org.hibernate.jpa.HibernatePersistenceProvider + + + diff --git a/prolinestudio-resultexplorer/src/main/resources/assembly.xml b/prolinestudio-resultexplorer/src/main/resources/assembly.xml new file mode 100644 index 000000000..61d568101 --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/resources/assembly.xml @@ -0,0 +1,51 @@ + + + bin + + + zip + + + + + + + ${project.basedir} + + README* + LICENSE* + NOTICE* + + / + + + + + ${project.build.directory} + + *.jar + *.sh + *.bat + sqlite4java/** + + / + + + + + + + + + + + ${project.build.directory}/lib + /lib + + + + + + diff --git a/prolinestudio-resultexplorer/src/main/resources/fr/proline/studio/rsmexplorer/gui/Bundle.properties b/prolinestudio-resultexplorer/src/main/resources/fr/proline/studio/rsmexplorer/gui/Bundle.properties index 85de1aa7c..5505e00ac 100644 --- a/prolinestudio-resultexplorer/src/main/resources/fr/proline/studio/rsmexplorer/gui/Bundle.properties +++ b/prolinestudio-resultexplorer/src/main/resources/fr/proline/studio/rsmexplorer/gui/Bundle.properties @@ -1,7 +1,3 @@ -ProteinGroupProteinSelectedPanel.border.title=Protein -RsmProteinSetPanel.searchButton.text= -RsmProteinSetPanel.searchTextField.text= -RsmProteinAndPeptideSequencePanel.sequencePanel.TabConstraints.tabTitle=Sequence -RsetPeptidesOfProteinsCmpPanel.proteinNameTextField.text= -RsetPeptideMatchPanel.searchButton.text= -RsetPeptideMatchPanel.searchTextField.text= +#Help and tooltips text +EditCluster.status.modif.html.help=Change the status of selected modification Cluster. Three status properties can be modified :
\t* the Status it-self : validated or invalidated
\t* the Status confidence : a number indicating the confidence you have in the current status.
\t* a free description on current cluster status. +EditCluster.peptide.remove.html.help=Change peptides list.
Select peptide to remove from cluster in the table and click on remove icon. The pepitde used to represent the cluster can not be removed. diff --git a/application/src/main/resources/logback.xml b/prolinestudio-resultexplorer/src/main/resources/logback.xml similarity index 56% rename from application/src/main/resources/logback.xml rename to prolinestudio-resultexplorer/src/main/resources/logback.xml index 80ce9b4b4..705f3318c 100644 --- a/application/src/main/resources/logback.xml +++ b/prolinestudio-resultexplorer/src/main/resources/logback.xml @@ -1,54 +1,61 @@ - - Proline Studio - - - - - %-5level: %logger{35} [%thread] %date{dd MMM yyyy - HH:mm:ss} - %msg%n - - - - - log/Proline_Studio-${user.name}.log - true - - %-5level: %logger{35} [%thread] %date{dd MMM yyyy - HH:mm:ss} - %msg%n - - - - - log/Proline_Studio-Error-${user.name}.log - true - - WARN - - - %-5level: %logger{35} [%thread] %date{dd MMM yyyy - HH:mm:ss} - %msg%n - - - - - - - - - - - - - - - - - - - - - - - - - - + + Proline Studio + + + + + %-5level: %logger{35} [%thread] %date{dd MMM yyyy - HH:mm:ss} - %msg%n + + + + + true + logs/proline_studio_debug.log + + + logs/proline_studio_debug_.%d{yyyy-MM-dd}.%i.txt + 100MB + 30 + 2GB + + + + + %-5level: %date{dd MMM yyyy HH:mm:ss} %logger{35} [%thread] - %msg%n + + + + + + logs/proline_studio_error-${user.name}.log + true + + WARN + + + %-5level: %date{dd MMM yyyy HH:mm:ss} %logger{35} [%thread] - %msg%n + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/prolinestudio-resultexplorer/src/main/resources/start_studio.bat b/prolinestudio-resultexplorer/src/main/resources/start_studio.bat new file mode 100644 index 000000000..05900032f --- /dev/null +++ b/prolinestudio-resultexplorer/src/main/resources/start_studio.bat @@ -0,0 +1,2 @@ +title Proline Studio +${java.token}java -Xmx2G -XX:+UseG1GC -XX:+UseStringDeduplication -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=30 -cp "prolinestudio-resultexplorer-${pom.version}.jar;lib/*" -Djava.library.path=./sqlite4java -Dlogback.configurationFile=config/logback.xml fr.proline.studio.main.Main \ No newline at end of file diff --git a/prolinestudio-resultexplorer/src/test/java/MSDiagTest.java b/prolinestudio-resultexplorer/src/test/java/MSDiagTest.java index d7b68319f..2c09f1a94 100644 --- a/prolinestudio-resultexplorer/src/test/java/MSDiagTest.java +++ b/prolinestudio-resultexplorer/src/test/java/MSDiagTest.java @@ -1,19 +1,19 @@ -/* - * Copyright (C) 2019 VD225637 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT - * ; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program 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 - * CeCILL License V2.1 for more details. - * - * You should have received a copy of the CeCILL License - * along with this program; If not, see . - */ +/* + * Copyright (C) 2019 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the CeCILL FREE SOFTWARE LICENSE AGREEMENT + * ; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 + * CeCILL License V2.1 for more details. + * + * You should have received a copy of the CeCILL License + * along with this program; If not, see . + */ import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener;