1- // PathVisio,
2- // a tool for data visualization and analysis using Biological Pathways
3- // Copyright 2006-2009 BiGCaT Bioinformatics
1+ // PathSBML Plugin
2+ // SBML Plugin for PathVisio.
3+ // Copyright 2013 developed for Google Summer of Code
44//
55// Licensed under the Apache License, Version 2.0 (the "License");
66// you may not use this file except in compliance with the License.
1414// See the License for the specific language governing permissions and
1515// limitations under the License.
1616//
17+
1718package org .pathvisio .sbml ;
1819
1920import java .awt .Component ;
4950import javax .swing .SwingWorker ;
5051import javax .swing .border .Border ;
5152import javax .swing .table .AbstractTableModel ;
53+ import javax .swing .table .TableModel ;
5254import javax .swing .table .TableRowSorter ;
5355
5456import org .pathvisio .core .debug .Logger ;
6769 * @author anwesha
6870 * @version 1.0.0
6971 */
72+ @ SuppressWarnings ("serial" )
7073public class BioModelPanel extends JPanel {
7174
7275 SBMLPlugin plugin ;
7376
7477 static Border etch = BorderFactory .createEtchedBorder ();
7578 private JComboBox clientDropdown ;
7679 private JTable resultTable ;
77- private JScrollPane resultspane ;
80+ JScrollPane resultspane ;
7881
7982 private JRadioButton Browse ;
8083 private JRadioButton All ;
@@ -90,6 +93,9 @@ public class BioModelPanel extends JPanel {
9093 private JTextField taxonomyId ;
9194 private JButton search ;
9295
96+ /**
97+ * @param plugin
98+ */
9399 public BioModelPanel (final SBMLPlugin plugin ) {
94100
95101 this .plugin = plugin ;
@@ -114,13 +120,13 @@ public BioModelPanel(final SBMLPlugin plugin) {
114120 group2 .add (NonCurated );
115121
116122 // biomodel search terms
117- bioModelName = new JTextField ();
118- chebiId = new JTextField ();
119- uniprotId = new JTextField ();
120- pubTitId = new JTextField ();
121- personName = new JTextField ();
122- goId = new JTextField ();
123- taxonomyId = new JTextField ();
123+ setBioModelName ( new JTextField () );
124+ setChebiId ( new JTextField () );
125+ setUniprotId ( new JTextField () );
126+ setPubTitId ( new JTextField () );
127+ setPersonName ( new JTextField () );
128+ setGoId ( new JTextField () );
129+ setTaxonomyId ( new JTextField () );
124130
125131 //tooltips for browse buttons and search choice button
126132 All .setToolTipText ("Browse all submitted models at Biomodels" );
@@ -130,13 +136,13 @@ public BioModelPanel(final SBMLPlugin plugin) {
130136 Search .setToolTipText ("Choose to browse models in Biomodels" );
131137
132138 //tooltips for all the search boxes
133- bioModelName .setToolTipText ("Tip:Use Biomodel name (e.g.:'Tyson1991 - Cell Cycle 6 var')" );
134- pubTitId .setToolTipText ("Tip:Use publication name(e.g.:'sbml')" );
135- chebiId .setToolTipText ("Tip:Use Chebi id (e.g.:'24996')" );
136- personName .setToolTipText ("Tip:Use person/encoder name (e.g.:'Rainer','Nicolas')" );
137- uniprotId .setToolTipText ("Tip:Use Uniprot id (e.g.:'P04637','P10113')" );
138- goId .setToolTipText ("Tip:Use GO id (e.g.:'0006915')" );
139- taxonomyId .setToolTipText ("Tip:Use Taxonomy id (e.g.:'9606')" );
139+ getBioModelName () .setToolTipText ("Tip:Use Biomodel name (e.g.:'Tyson1991 - Cell Cycle 6 var')" );
140+ getPubTitId () .setToolTipText ("Tip:Use publication name(e.g.:'sbml')" );
141+ getChebiId () .setToolTipText ("Tip:Use Chebi id (e.g.:'24996')" );
142+ getPersonName () .setToolTipText ("Tip:Use person/encoder name (e.g.:'Rainer','Nicolas')" );
143+ getUniprotId () .setToolTipText ("Tip:Use Uniprot id (e.g.:'P04637','P10113')" );
144+ getGoId () .setToolTipText ("Tip:Use GO id (e.g.:'0006915')" );
145+ getTaxonomyId () .setToolTipText ("Tip:Use Taxonomy id (e.g.:'9606')" );
140146
141147 // browse biomodel action
142148 Action browseBioModelAction = new AbstractAction ("browseBioModels" ) {
@@ -242,37 +248,37 @@ public void actionPerformed(ActionEvent e) {
242248 cc2 .gridx = 1 ;
243249 cc2 .gridy = 0 ;
244250 cc2 .gridwidth =2 ;
245- searchOptBox .add (bioModelName , cc2 );
251+ searchOptBox .add (getBioModelName () , cc2 );
246252 cc2 .fill = GridBagConstraints .HORIZONTAL ;
247253 cc2 .gridx = 1 ;
248254 cc2 .gridy = 1 ;
249255 cc2 .gridwidth =2 ;
250- searchOptBox .add (pubTitId ,cc2 );
256+ searchOptBox .add (getPubTitId () ,cc2 );
251257 cc2 .fill = GridBagConstraints .HORIZONTAL ;
252258 cc2 .gridx = 1 ;
253259 cc2 .gridy = 2 ;
254260 cc2 .gridwidth =2 ;
255- searchOptBox .add (chebiId ,cc2 );
261+ searchOptBox .add (getChebiId () ,cc2 );
256262 cc2 .fill = GridBagConstraints .HORIZONTAL ;
257263 cc2 .gridx = 1 ;
258264 cc2 .gridy = 3 ;
259265 cc2 .gridwidth =2 ;
260- searchOptBox .add (personName ,cc2 );
266+ searchOptBox .add (getPersonName () ,cc2 );
261267 cc2 .fill = GridBagConstraints .HORIZONTAL ;
262268 cc2 .gridx = 1 ;
263269 cc2 .gridy = 4 ;
264270 cc2 .gridwidth =2 ;
265- searchOptBox .add (uniprotId ,cc2 );
271+ searchOptBox .add (getUniprotId () ,cc2 );
266272 cc2 .fill = GridBagConstraints .HORIZONTAL ;
267273 cc2 .gridx = 1 ;
268274 cc2 .gridy = 5 ;
269275 cc2 .gridwidth =2 ;
270- searchOptBox .add (goId ,cc2 );
276+ searchOptBox .add (getGoId () ,cc2 );
271277 cc2 .fill = GridBagConstraints .HORIZONTAL ;
272278 cc2 .gridx = 1 ;
273279 cc2 .gridy = 6 ;
274280 cc2 .gridwidth =2 ;
275- searchOptBox .add (taxonomyId ,cc2 );
281+ searchOptBox .add (getTaxonomyId () ,cc2 );
276282 cc2 .fill = GridBagConstraints .HORIZONTAL ;
277283 cc2 .gridx = 1 ;
278284 cc2 .gridy = 7 ;
@@ -414,7 +420,8 @@ public void mouseClicked(MouseEvent e) {
414420 * @throws InterruptedException
415421 * @throws ExecutionException
416422 */
417- private void browse (final String command ) throws RemoteException , InterruptedException ,
423+ void browse (final String command ) throws RemoteException ,
424+ InterruptedException ,
418425 ExecutionException {
419426
420427 String clientName = clientDropdown .getSelectedItem ().toString ();
@@ -506,7 +513,7 @@ else if(pk.isCancelled())
506513
507514 resultTable .setModel (new ResultTableModel (sw .get (), clientName ));
508515 resultTable
509- .setRowSorter (new TableRowSorter (resultTable .getModel ()));
516+ .setRowSorter (new TableRowSorter < TableModel > (resultTable .getModel ()));
510517 }
511518
512519
@@ -517,17 +524,17 @@ else if(pk.isCancelled())
517524 * @throws InterruptedException
518525 * @throws ExecutionException
519526 */
520- private void search () throws RemoteException , InterruptedException ,
527+ void search () throws RemoteException , InterruptedException ,
521528 ExecutionException {
522529
523530 // search terms typed in the search boxes are trimmed and stored in the following respective variables.
524- final String sbmlName = bioModelName .getText ().trim ();
525- final String sbmlPub = pubTitId .getText ().trim ();
526- final String sbmlChebi = chebiId .getText ().trim ();
527- final String sbmlPerson = personName .getText ().trim ();
528- final String sbmlUniprot = uniprotId .getText ().trim ();
529- final String sbmlGo = goId .getText ().trim ();
530- final String sbmlTaxonomy = taxonomyId .getText ().trim ();
531+ final String sbmlName = getBioModelName () .getText ().trim ();
532+ final String sbmlPub = getPubTitId () .getText ().trim ();
533+ final String sbmlChebi = getChebiId () .getText ().trim ();
534+ final String sbmlPerson = getPersonName () .getText ().trim ();
535+ final String sbmlUniprot = getUniprotId () .getText ().trim ();
536+ final String sbmlGo = getGoId () .getText ().trim ();
537+ final String sbmlTaxonomy = getTaxonomyId () .getText ().trim ();
531538
532539 if (!(sbmlPub .isEmpty ()&&sbmlName .isEmpty ()&&sbmlChebi .isEmpty ()&&sbmlPerson .isEmpty ()&&sbmlUniprot .isEmpty ()&&sbmlGo .isEmpty ()&&sbmlTaxonomy .isEmpty ())) {
533540 String clientName = clientDropdown .getSelectedItem ().toString ();
@@ -552,7 +559,7 @@ protected String[] doInBackground() throws Exception {
552559 String [] results7 = null ;
553560 try {
554561 // getting the models id by name.
555- if (!bioModelName .getText ().equalsIgnoreCase ("" ))
562+ if (!getBioModelName () .getText ().equalsIgnoreCase ("" ))
556563 {
557564 results1 = client .getModelsIdByName (sbmlName );
558565
@@ -565,7 +572,7 @@ protected String[] doInBackground() throws Exception {
565572 }
566573
567574 //getting the models id by publication title or id.
568- if (!pubTitId .getText ().equalsIgnoreCase ("" ))
575+ if (!getPubTitId () .getText ().equalsIgnoreCase ("" ))
569576 {
570577 results2 = client .getModelsIdByPublication (sbmlPub );
571578 if (results2 !=null ){
@@ -577,7 +584,7 @@ protected String[] doInBackground() throws Exception {
577584 }
578585
579586 //getting models id by chebi id.
580- if (!chebiId .getText ().equalsIgnoreCase ("" ))
587+ if (!getChebiId () .getText ().equalsIgnoreCase ("" ))
581588 {
582589 results3 = client .getModelsIdByChEBIId (sbmlChebi );
583590 if (results3 !=null ){
@@ -589,7 +596,7 @@ protected String[] doInBackground() throws Exception {
589596 }
590597
591598 //getting models id by person or encoder or author name.
592- if (!personName .getText ().equalsIgnoreCase ("" ))
599+ if (!getPersonName () .getText ().equalsIgnoreCase ("" ))
593600 {
594601 results4 = client .getModelsIdByPerson (sbmlPerson );
595602 if (results4 !=null ){
@@ -601,7 +608,7 @@ protected String[] doInBackground() throws Exception {
601608 }
602609
603610 //getting models id by uniprot id.
604- if (!uniprotId .getText ().equalsIgnoreCase ("" ))
611+ if (!getUniprotId () .getText ().equalsIgnoreCase ("" ))
605612 {
606613 results5 = client .getModelsIdByUniprot (sbmlUniprot );
607614 if (results5 !=null ){
@@ -613,7 +620,7 @@ protected String[] doInBackground() throws Exception {
613620 }
614621
615622 //getting models id by go id.
616- if (!goId .getText ().equalsIgnoreCase ("" ))
623+ if (!getGoId () .getText ().equalsIgnoreCase ("" ))
617624 {
618625 results6 = client .getModelsIdByGOId (sbmlGo );
619626
@@ -626,7 +633,7 @@ protected String[] doInBackground() throws Exception {
626633 }
627634
628635 //getting models id by taxonomy id.
629- if (!taxonomyId .getText ().equalsIgnoreCase ("" ))
636+ if (!getTaxonomyId () .getText ().equalsIgnoreCase ("" ))
630637 {
631638 results7 = client .getModelsIdByTaxonomyId (sbmlTaxonomy );
632639
@@ -675,15 +682,15 @@ else if(pk.isCancelled())
675682
676683 resultTable .setModel (new ResultTableModel (sw .get (), clientName ));
677684 resultTable
678- .setRowSorter (new TableRowSorter (resultTable .getModel ()));
685+ .setRowSorter (new TableRowSorter < TableModel > (resultTable .getModel ()));
679686 } else {
680687 JOptionPane .showMessageDialog (null , "Please Enter a Search Query" ,
681688 "ERROR" , JOptionPane .ERROR_MESSAGE );
682689 }
683690 }
684691
685692 //enable search
686- private void enableFrame (JPanel container , boolean enable ) {
693+ void enableFrame (JPanel container , boolean enable ) {
687694 Component [] components = container .getComponents ();
688695 for (Component component : components ) {
689696 component .setEnabled (enable );
@@ -692,6 +699,97 @@ private void enableFrame(JPanel container, boolean enable) {
692699 }
693700 }
694701 }
702+ /**
703+ * @return the pubTitId
704+ */
705+ public JTextField getPubTitId () {
706+ return pubTitId ;
707+ }
708+
709+ /**
710+ * @param pubTitId the pubTitId to set
711+ */
712+ public void setPubTitId (JTextField pubTitId ) {
713+ this .pubTitId = pubTitId ;
714+ }
715+ /**
716+ * @return the bioModelName
717+ */
718+ public JTextField getBioModelName () {
719+ return bioModelName ;
720+ }
721+
722+ /**
723+ * @param bioModelName the bioModelName to set
724+ */
725+ public void setBioModelName (JTextField bioModelName ) {
726+ this .bioModelName = bioModelName ;
727+ }
728+ /**
729+ * @return the chebiId
730+ */
731+ public JTextField getChebiId () {
732+ return chebiId ;
733+ }
734+
735+ /**
736+ * @param chebiId the chebiId to set
737+ */
738+ public void setChebiId (JTextField chebiId ) {
739+ this .chebiId = chebiId ;
740+ }
741+ /**
742+ * @return the personName
743+ */
744+ public JTextField getPersonName () {
745+ return personName ;
746+ }
747+
748+ /**
749+ * @param personName the personName to set
750+ */
751+ public void setPersonName (JTextField personName ) {
752+ this .personName = personName ;
753+ }
754+ /**
755+ * @return the goId
756+ */
757+ public JTextField getGoId () {
758+ return goId ;
759+ }
760+
761+ /**
762+ * @param goId the goId to set
763+ */
764+ public void setGoId (JTextField goId ) {
765+ this .goId = goId ;
766+ }
767+ /**
768+ * @return the taxonomyId
769+ */
770+ public JTextField getTaxonomyId () {
771+ return taxonomyId ;
772+ }
773+
774+ /**
775+ * @param taxonomyId the taxonomyId to set
776+ */
777+ public void setTaxonomyId (JTextField taxonomyId ) {
778+ this .taxonomyId = taxonomyId ;
779+ }
780+ /**
781+ * @return the uniprotId
782+ */
783+ public JTextField getUniprotId () {
784+ return uniprotId ;
785+ }
786+
787+ /**
788+ * @param uniprotId the uniprotId to set
789+ */
790+ public void setUniprotId (JTextField uniprotId ) {
791+ this .uniprotId = uniprotId ;
792+ }
695793 /**
696794 * This class creates the result table model
697795 * based on the results.
0 commit comments